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
Returns
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
Name | Type | Required | Default | Description |
---|
options | IEnableOptions | no | - | An object to specify which wallet and network to enable. |
Returns
Type | Description |
---|
Promise<IEnableResult > | An object containing the enabled accounts, the enabled network and optional session information. |
Throws
getWallets()
Gets a list of all the wallets by their IDs.
Returns
Type | Description |
---|
string[] | A list of the wallet IDs. |
postTxns(options)
Posts a list of signed transactions to the network.
Parameters
Name | Type | Required | Default | Description |
---|
options | IPostTxnsOptions | yes | - | An object containing the wallet information and the signed transactions to be sent to the network. |
Returns
Type | Description |
---|
Promise<IPostTxnsResult > | An object containing the wallet information and the IDs of the transactions that were committed to the blockchain. |
Throws
setDefaultWallet(id)
Sets the default wallet by ID. If the wallet does not exist, the default wallet is left unchanged.
Parameters
Name | Type | Required | Default | Description |
---|
id | string | yes | - | The ID of the wallet to set to default. |
Returns
signBytes(options)
Signs an arbitrary piece of data. The returned signature can be verified using algosdk.verifyBytes.
Parameters
Name | Type | Required | Default | Description |
---|
options | ISignBytesOptions | yes | - | An object to specify the data, the account and which wallet to use. |
Returns
Type | Description |
---|
Promise<ISignBytesResult > | An object containing the ID of the wallet used and a signature of the signed data. |
Throws
signTxns(options)
Sends a list of transactions to be signed. The transactions must conform to ARC-0001.
Parameters
Name | Type | Required | Default | Description |
---|
options | ISignTxnsOptions | yes | - | An object containing any wallet information and a list of transaction information to be signed. |
Returns
Type | Description |
---|
Promise<ISignTxnsResult > | An object containing the wallet information and the signed transactions ready to be posted to the network. |
Throws
Types
IAddWalletOptions
Name | Type | Required | Default | Description |
---|
makeDefault | boolean | no | false | Sets the added/replaced wallet as the default wallet. |
replace | boolean | no | false | Determines whether a matching wallet, by ID, should be replaced. |
IEnableOptions
Name | Type | Required | Default | Description |
---|
id | string | no | - | The ID of the wallet to enable. If none is specified, then the default wallet is used. |
genesisHash | string | no | - | 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
Name | Type | Required | Default | Description |
---|
accounts | IWalletAccount[] | yes | - | A list of available accounts for the wallet. |
genesisHash | string | yes | - | The genesis hash of the network the wallet enabled. |
genesisId | string | yes | - | The genesis ID of the network the wallet enabled. |
id | string | yes | - | The ID of the wallet that was used. |
sessionId | string | no | - | A unique identifier for this session provided by the wallet. |
IPostTxnsOptions
Name | Type | Required | Default | Description |
---|
id | string | no | - | The ID of the wallet to use to post the transactions. If none is specified, then the default wallet is used. |
stxns | string[] | yes | - | A list of base64 encoded signed transactions to be sent to the network. |
IPostTxnsResult
Name | Type | Required | Default | Description |
---|
id | string | yes | - | The ID of the wallet that was used. |
txnIDs | string[] | yes | - | A list of 52-character base32 strings (without padding) corresponding the completed transaction IDs. |
ISignBytesOptions
Name | Type | Required | Default | Description |
---|
data | Uint8Array | yes | - | The arbitrary piece of data to sign. |
id | string | no | - | The ID of the wallet to use to sign the data. If none is specified, then the default wallet is used. |
signer | string | no | - | The address to use to sign the data. |
ISignBytesResult
Name | Type | Required | Default | Description |
---|
id | string | yes | - | The ID of the wallet that was used. |
signature | Uint8Array | yes | - | The signature of the signed data with the MX prefix. |
ISignTxnsOptions
Name | Type | Required | Default | Description |
---|
id | string | no | - | The ID of the wallet to use to sign the transactions. If none is specified, then the default wallet is used. |
txns | IWalletTransaction[] | 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
Name | Type | Required | Default | Description |
---|
id | string | yes | - | 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
Name | Type | Required | Default | Description |
---|
address | string | yes | - | The address (public key) of the account. |
name | string | no | - | A human-readable name for this account. |
IWalletTransaction
Name | Type | Required | Default | Description |
---|
authAddr | string | no | - | The auth address if the sender has rekeyed. |
msig | MultisigMetadata | no | - | Extra metadata needed when sending multisig transactions. |
signers | string[] | no | - | A list of addresses to sign with (defaults to the sender in the transaction). |
stxn | string | no | - | 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. |
txn | string | yes | - | The base64 encoded unsigned transaction. |