Wallets
@coinbase/waas-sdk-web • API
Interface: Wallets
Namespace for managing creating/restoring wallets.
There can only be one active wallet a time.
Extends
HasApi
Properties
api
api:
Api
Inherited from
HasApi.api
wallet?
optionalwallet:Wallet
Returns the current wallet if it exists.
Methods
create()
create(
passcode?):Promise<NewWallet>
Creates a new Wallet for derivation of a group of addresses. Note: A backup is only returned during the creation of a wallet. You can save it for future restoration.
Parameters
• passcode?: string
An optional, atleast 6-character-long passcode to provide for the wallet.
Returns
Promise<NewWallet>
A promise of NewWallet that contains the created Wallet and its backup.
Throws
An error if a valid wallet already exists or cannot perform the creation.
Example
Create a wallet with a passcode: `waas.wallets.create("123456")`
restoreFromBackup()
restoreFromBackup(
backup,passcode?):Promise<Wallet>
Restores access to a wallet, given the wallet backup.
Parameters
• backup: string
The backup produced during wallet creation.
• passcode?: string
The optional, atleast-6-char passcode associated with the wallet if provided during creation.
Returns
Promise<Wallet>
A promise of the restored Wallet.
Throws
An error if a valid wallet already exists or cannot perform the restore.
Example
Restore a wallet with a passcode: `waas.wallets.restoreFromBackup(backupData, "123456")`
restoreFromHostedBackup()
restoreFromHostedBackup(
passcode?):Promise<Wallet>
Restore your user's wallet, given the passcode for their wallet.
This function will only be available if Waas has been initialized with
InitializeWaasOptions.enableHostedBackups set to true.
NOTE: This feature is not available by default. Contact your Coinbase rep if you're interested in learning more.
NOTE: this requires a user-scoped JWT, issued via issueAuthTokenForUser().
Parameters
• passcode?: string
The passcode of the user's wallet being restored.
Returns
Promise<Wallet>