Skip to main content

AlgorandProvider

Methods

addWallet(wallet, [options])

Adds a wallet, or if the replace option is set, will replace any existing wallet matched by the wallet's ID.

Parameters

NameTypeRequiredDefaultDescription
walletBaseWalletManageryes-An initialized BaseWalletManager to add.
optionsIAddWalletOptionsno-An object to specify how the wallet is added.

Returns

TypeDescription
void-

enable([options])

Enables to a wallet. If the ID of the wallet is specified, that wallet is used, otherwise the default wallet is enabled.

Parameters

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

Returns

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

Throws

TypeDescription
NoWalletsDetectedErrorIf no wallets have been added.
WalletDoesNotExistErrorIf the wallet, as specified by its ID, does not exist.
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.

getWallets()

Gets a list of all the wallets by their IDs.

Returns

TypeDescription
string[]A list of the wallet IDs.

postTxns(options)

Posts a list of signed transactions to the network.

Parameters

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

Returns

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

Throws

TypeDescription
NoWalletsDetectedErrorIf no wallets have been added.
WalletDoesNotExistErrorIf the wallet, as specified by its ID, does not exist.
WalletOperationNotSupportedErrorIf the wallet does not support the signing of transactions.
OperationCanceledErrorIf the request to sign the transactions was canceled by the user.
FailedToPostSomeTransactionsErrorIf some transactions were not sent properly.

setDefaultWallet(id)

Sets the default wallet by ID. If the wallet does not exist, the default wallet is left unchanged.

Parameters

NameTypeRequiredDefaultDescription
idstringyes-The ID of the wallet to set to default.

Returns

TypeDescription
void-

signBytes(options)

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

Parameters

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

Returns

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

Throws

TypeDescription
NoWalletsDetectedErrorIf no wallets have been added.
WalletDoesNotExistErrorIf the wallet, as specified by its ID, does not exist.
WalletOperationNotSupportedErrorIf the wallet does not support the signing of data.
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.

Parameters

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

Returns

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

Throws

TypeDescription
NoWalletsDetectedErrorIf no wallets have been added.
WalletDoesNotExistErrorIf the wallet, as specified by its ID, does not exist.
WalletOperationNotSupportedErrorIf the wallet does not support the signing of transactions.
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

IAddWalletOptions

NameTypeRequiredDefaultDescription
makeDefaultbooleannofalseSets the added/replaced wallet as the default wallet.
replacebooleannofalseDetermines whether a matching wallet, by ID, should be replaced.

IEnableOptions

NameTypeRequiredDefaultDescription
idstringno-The ID of the wallet to enable. If none is specified, then the default wallet is used.
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.
idstringyes-The ID of the wallet that was used.
sessionIdstringno-A unique identifier for this session provided by the wallet.

IPostTxnsOptions

NameTypeRequiredDefaultDescription
idstringno-The ID of the wallet to use to post the transactions. If none is specified, then the default wallet is used.
stxnsstring[]yes-A list of base64 encoded signed transactions to be sent to the network.

IPostTxnsResult

NameTypeRequiredDefaultDescription
idstringyes-The ID of the wallet that was used.
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.
idstringno-The ID of the wallet to use to sign the data. If none is specified, then the default wallet is used.
signerstringno-The address to use to sign the data.

ISignBytesResult

NameTypeRequiredDefaultDescription
idstringyes-The ID of the wallet that was used.
signatureUint8Arrayyes-The signature of the signed data with the MX prefix.

ISignTxnsOptions

NameTypeRequiredDefaultDescription
idstringno-The ID of the wallet to use to sign the transactions. If none is specified, then the default wallet is used.
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
idstringyes-The ID of the wallet that was used.
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.