Wallet
This feature is available in the Hedera JavaScript SDK only. (version >=2.14.0).
The Wallet
extends the Signer
. The Signer
is responsible for Signing
requests while the Provider
is responsible for communication between an application and a Hedera network, but is not required to communicate directly with a Hedera network. Note this means the Provider
can for instance communicate with some third party service which finally communicates with a Hedera network.
class Wallet extends Signer
Constructor
new
Wallet(
<accountId>, <privateKey>, <provider>
)
Constructs a local wallet from an account ID, private key, and provider.
Methods
<Wallet>.getLedgerId()
->** LedgerId
**
Returns the ledger ID.
<Wallet>.getAccountId()
->AccountId
Returns the account ID associated with this signer.
<Wallet>.getAccountKey()
->Key
Returns the account key.
<Wallet>.getNetwork()
->[Key:string]: string
Returns the full consensus network being used.
<Wallet>.getMirrorNetwork()
->string[]
Returns the mirror node for the network.
<Wallet>.sign (
messages; Uint8Array[]
)
-> Promise<SignerSignature[]>
Sign an arbitrary list of messages.
<Wallet>.getAccountBalance()
->** Promise<AccountBalance>
**
Returns the account balance.
<Wallet>.getAccountInfo
()->** Promise<AccountInfo>
**
Returns the account info.
<Wallet>.getAccountRecords
()->** Promise<TransactionRecord[]>
**
Fetch the last transaction records for this account using TransactionRecordQuery
.
<Wallet>.getProvider
()->** Provider
**
Returns the Hedera network.
<Wallet>.
signTransaction <T extends Transaction>(transaction:T
)->** Promise<T>
**
Signs a transaction, returning the signed transaction
NOTE: This method is allowed to mutate the parameter being passed in so the returned transaction is not guaranteed to be a new instance of the transaction.
<Wallet>.checkTransaction<T extends Transaction>
** ( transaction
: T
)-> Promise<T>
**
Check whether all the required fields are set appropriately. Fields such as the transaction ID's account ID should either be null
or be equal to the signer's account ID, and the node account IDs on the request should exist within the signer's network.
<Wallet>.populateTransaction<T extends Transaction>
** ( transaction
: T
)-> Promise<T>
**
Populate the requests with the required fields. The transaction ID should be constructed from the signer's account ID, and the node account IDs should be set using the signer's network.
<Wallet>.call(
<RequestT, ResponseT, OutputT>(request: Executable<RequestT, ResponseT, OutputT>
)
->** Promise <Output>
**
Responsible for serializing your request and sending it over the wire to be executed, and then deserializing the response into the appropriate type.
Note: This is a wrapper around the Provider.call()
method.
Last updated