TReactUser
@coinbase/waas-sdk-web-react • API
Type alias: TReactUser
TReactUser:
Object
A wrapper for all of the user-scoped wallet management functions available in the Waas SDK.
Type declaration
create()
create: (
passcode
?) =>Promise
<WaaS.NewWallet
>
Creates a wallet, with an optional passcode.
In doing so, this will update the wallet as returned from
const {wallet} = useWalletContext()
automatically, via a react state update.
Parameters
• passcode?: string
The optional passcode to use for the wallet.
Returns
Promise
<WaaS.NewWallet
>
hasWallet
hasWallet:
boolean
Whether the user has a created wallet already.
restoreFromBackup()
restoreFromBackup: (
backup
,passcode
?) =>Promise
<Wallet
>
Restores a wallet from the backup string, which is available on all newly created NewWallet.
In doing so, this will update the wallet as returned from
const {wallet} = useWalletContext()
automatically, via a react state update.
Parameters
• backup: string
The backupData, as returned from {@WaaS.NewWallet.backup}
• passcode?: string
The passcode associated with the wallet.
Returns
Promise
<Wallet
>
restoreFromHostedBackup()?
optional
restoreFromHostedBackup: (passcode
?) =>Promise
<Wallet
>
Assuming that you've signed an auth token for a particular user, this function attempts to restore that user's wallet (given their optional passcode).
This utillizes Coinbase's encrypted cloud recovery option for MPC wallets.
NOTE: This feature is not generally available. Contact Coinbase if you're interested in learning more.
NOTE: This feature is only available if <WalletProvider enableHostedBackups>
is set.
NOTE: This feature requires a user-scoped JWT, signed via issueAuthTokenForUser
.
Parameters
• passcode?: string
If the user that you signed the access token for has a passcode on their wallet, you need to supply it here.
Returns
Promise
<Wallet
>