-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add sessions to wallet stamper demo #338
base: main
Are you sure you want to change the base?
Conversation
d0e4c70
to
8008627
Compare
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
|
||
// Need to save resulting bundle and information. | ||
// This is required by the authIframeClient abstraction. | ||
localStorage.setItem("CREDENTIAL_BUNDLE", result?.credentialBundle!); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is soon to be abstracted away once we have proper support in our higher level SDK packages.
|
||
const handleCreateWallet = (walletName: string) => { | ||
createWallet(walletName, () => { | ||
getWallets().then((wallets) => setWallets(wallets)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing a callback here. A bit of an antipattern, but just a quick solution until proper resource fetching is in place
return whoami; | ||
} | ||
|
||
async function createWallet(walletName: string) { | ||
async function createWallet(walletName: string, callback: any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: bit of an antipattern. See caller in examples/with-wallet-stamper/src/components/user.tsx
<body className={inter.className}> | ||
<Providers>{children}</Providers> | ||
</body> | ||
<TurnkeyReactProvider config={turnkeyConfig}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We essentially have two wrappers here: TurnkeyReactProvider
from @turnkey/sdk-react
, and another one that's created within this project. I included TurnkeyReactProvider
in this demo because it abstracts away some iframe-related logic, so if it's confusing as to why where are two separate providers, I hope that offers some clarity.
8008627
to
5766067
Compare
5766067
to
b0e927b
Compare
Summary & Motivation
Add session support to the wallet stamper demo. See recording below:
Screen.Recording.2024-08-21.at.5.06.36.PM.mov
How I Tested These Changes
Did you add a changeset?
If updating one of our packages, you'll likely need to add a changeset to your PR. To do so, run
pnpm changeset
.pnpm changeset
will generate a file where you should write a human friendly message about the changes. Note how this (example) includes the package name (should be auto added by the command) along with the type of semver change (major.minor.patch) (which you should set).These changes will be used at release time to determine what packages to publish and how to bump their version. For more context see this comment.