Skip to main content

BaseWalletManager

Methods

enable([options])

Enables to a wallet.

Parameters

NameTypeRequiredDefaultDescription
optionsIEnableOptionsno-An object to specify which network to enable.

Returns

TypeDescription
Promise<IEnableResult>An object containing the enabled accounts, the enabled network and optional session information.

Throws

TypeDescription
OperationCanceledErrorIf the request to enable the wallet was denied by the user.
NetworkNotSupportedErrorIf the network, as specified by the genesis hash, is not supported by the wallet.

postTxns(options)

Posts a list of signed transactions to the network.

note

This function is optional.

Parameters

NameTypeRequiredDefaultDescription
optionsIPostTxnsOptionsyes-An object containing the signed transactions to be sent to the network.

Returns

TypeDescription
Promise<IPostTxnsResult>An object containing the IDs of the transactions that were committed to the blockchain.

Throws

TypeDescription
OperationCanceledErrorIf the request to sign the transactions was canceled by the user.
FailedToPostSomeTransactionsErrorIf some transactions were not sent properly.

signBytes(options)

Signs an arbitrary piece of data. The returned signature can be verified using algosdk.verifyBytes.

note

This function is optional.

Parameters

NameTypeRequiredDefaultDescription
optionsISignBytesOptionsyes-An object to specify the data, and the account to use.

Returns

TypeDescription
Promise<ISignBytesResult>An object containing the ID of the wallet used and a signature of the signed data.

Throws

TypeDescription
OperationCanceledErrorIf the request to sign data was canceled by the user.
UnauthorizedSignerErrorIf supplied signer is not authorized by the wallet.

signTxns(options)

Sends a list of transactions to be signed. The transactions must conform to ARC-0001.

note

This function is optional.

Parameters

NameTypeRequiredDefaultDescription
optionsISignTxnsOptionsyes-An object containing a list of transaction information to be signed.

Returns

TypeDescription
Promise<ISignTxnsResult>An object containing the signed transactions ready to be posted to the network.

Throws

TypeDescription
OperationCanceledErrorIf the request to sign the transactions was canceled by the user.
UnauthorizedSignerErrorIf supplied signer is not authorized by the wallet.
InvalidGroupIdErrorIf computed group ID for the supplied transactions does not match the assigned group ID.
InvalidInputErrorIf the supplied parameters are malformed.

Types

IEnableOptions

NameTypeRequiredDefaultDescription
genesisHashstringno-The genesis hash of the network. If this is not specified, it is the wallet's decision to choose an appropriate network. See Algorand's networks for more information.

IEnableResult

NameTypeRequiredDefaultDescription
accountsIWalletAccount[]yes-A list of available accounts for the wallet.
genesisHashstringyes-The genesis hash of the network the wallet enabled.
genesisIdstringyes-The genesis ID of the network the wallet enabled.
sessionIdstringno-A unique identifier for this session provided by the wallet.

IPostTxnsOptions

NameTypeRequiredDefaultDescription
stxnsstring[]yes-A list of base64 encoded signed transactions to be sent to the network.

IPostTxnsResult

NameTypeRequiredDefaultDescription
txnIDsstring[]yes-A list of 52-character base32 strings (without padding) corresponding the completed transaction IDs.

ISignBytesOptions

NameTypeRequiredDefaultDescription
dataUint8Arrayyes-The arbitrary piece of data to sign.
signerstringno-The address to use to sign the data.

ISignBytesResult

NameTypeRequiredDefaultDescription
signatureUint8Arrayyes-The signature of the signed data with the MX prefix.

ISignTxnsOptions

NameTypeRequiredDefaultDescription
txnsIWalletTransaction[]yes-A list of transactions to be signed as well as extra data used; if any accounts are re-keyed, are multisig or is part of a group of transactions.

ISignTxnsResult

NameTypeRequiredDefaultDescription
stxns(string | null)[]yes-The list of base64 encoded signed transactions that is ready to be posted to the network. If any of the transactions were not signed by the wallet, and no stxns were supplied, then null will be in the place of the signed transaction.

IWalletAccount

NameTypeRequiredDefaultDescription
addressstringyes-The address (public key) of the account.
namestringno-A human-readable name for this account.

IWalletTransaction

NameTypeRequiredDefaultDescription
authAddrstringno-The auth address if the sender has rekeyed.
msigMultisigMetadatano-Extra metadata needed when sending multisig transactions.
signersstring[]no-A list of addresses to sign with (defaults to the sender in the transaction).
stxnstringno-If this is part of a group of transactions, some of which are already signed you must also provide these signed transactions and the signers array MUST be undefined or empty, as per ARC-0001.
txnstringyes-The base64 encoded unsigned transaction.