Accounts
Helper utilities for deriving account data from addresses or transactions.
Data Types
Account = {
shard: bigint
realm: bigint
num: bigint
}
AccountLike = Account | string
Functions
Returns a hex representation of the provided account id.
hethers.utils.getAddressFromAccount('0.0.1')
// 0x0000000000000000000000000000000000000001
Returns an Account object from the provided ECDSA hash.
hethers.utils.getAccountFromAddress('0x0000000000000000000000000000000000000001')
// { shard: 0n, realm: 0n, num: 1n }
Returns an Account object from the provided string. Accepts either an account id or ECDSA hash.
hethers.utils.parseAccount('0x0000000000000000000000000000000000000001')
// { shard: 0n, realm: 0n, num: 1n }
hethers.utils.parseAccount('0.0.1')
// { shard: 0n, realm: 0n, num: 1n }
Converts the provided AccountLike data to an AccountId.
hethers.utils.asAccountString('0x0000000000000000000000000000000000000001')
// '0.0.1'
hethers.utils.getAccountFromTransactionId( transactionId: string) => string
hethers.utils.getAccountFromTransactionId( transactionId: string) => string
Accepts a valid TransactionId and extracts the accountId of the transation sender. Throws an INVALID_ARGUMENT
error If an invalid transactionId is provided.
hethers.utils.getAccountFromTransactionId("0.0.99999999@9999999999-999999999")
// 0.0.99999999
Last updated