- Adding accounts to the wallet heierchy
- Generating addresses for a specific account in any Zone
- Signing and sending transactions for any address in the wallet
- Serializing the wallet to JSON and deserializing it back to a wallet instance.
Example
Extends
AbstractHDWallet<QiAddressInfo>
Properties
Accessors
openChannels
Returns
string[]
The payment codes for all open channels.
Source
wallet/qi-hdwallet.ts:279Methods
addAddress()
Parameters
Returns
QiAddressInfo
The address info for the new address.
Overrides
AbstractHDWallet.addAddress
Source
wallet/qi-hdwallet.ts:1542addChangeAddress()
Parameters
Returns
QiAddressInfo
The address info for the new address.
Source
wallet/qi-hdwallet.ts:1556aggregate()
Parameters
Returns
Promise<TransactionResponse>
The transaction response.
Source
wallet/qi-hdwallet.ts:568checkAddressUse()
Parameters
Returns
Promise<{
"isUsed": boolean;
"outpoints": Outpoint[];
}>
A promise that resolves to an object containing a
boolean indicating whether the address is used and an array of outpoints.
isUsed
outpoints
Throws
If the query fails.Source
wallet/qi-hdwallet.ts:1086connect()
Parameters
Returns
void
Overrides
AbstractHDWallet.connect
Source
wallet/qi-hdwallet.ts:259convertToQuai()
Parameters
Returns
Promise<TransactionResponse>
A promise that resolves to the transaction response.
Throws
If the destination address is invalid, the amount is zero, or the conversion fails.Source
wallet/qi-hdwallet.ts:481getAddressInfo()
Parameters
Returns
null | QiAddressInfo
The address info or null if not found.
Overrides
AbstractHDWallet.getAddressInfo
Source
wallet/qi-hdwallet.ts:426getAddressesForAccount()
Parameters
Returns
QiAddressInfo[]
The addresses for the account.
Overrides
AbstractHDWallet.getAddressesForAccount
Source
wallet/qi-hdwallet.ts:1569getAddressesForZone()
Parameters
Returns
QiAddressInfo[]
The addresses for the zone.
Overrides
AbstractHDWallet.getAddressesForZone
Source
wallet/qi-hdwallet.ts:1109getBalanceForZone()
- BIP44 external addresses
- BIP44 change addresses
- BIP47 payment channel addresses
- Imported private key addresses
Parameters
Returns
Promise<bigint>
The total balance in the zone as a bigint
Source
wallet/qi-hdwallet.ts:1591getChangeAddressesForOutputs()
Parameters
Returns
Promise<string[]>
A promise that resolves to an array of change addresses
Source
wallet/qi-hdwallet.ts:853getChangeAddressesForZone()
Parameters
Returns
QiAddressInfo[]
The change addresses for the zone.
Source
wallet/qi-hdwallet.ts:1120getGapAddressesForZone()
Parameters
Returns
QiAddressInfo[]
The gap addresses for the zone.
Source
wallet/qi-hdwallet.ts:1131getGapChangeAddressesForZone()
Parameters
Returns
QiAddressInfo[]
The gap change addresses for the zone.
Source
wallet/qi-hdwallet.ts:1143getGapPaymentChannelAddressesForZone()
Parameters
Returns
QiAddressInfo[]
The gap payment channel addresses for the payment code.
Source
wallet/qi-hdwallet.ts:1166getImportedAddresses()
Parameters
Returns
QiAddressInfo[]
Array of address info objects for imported addresses
Source
wallet/qi-hdwallet.ts:1531getNextAddress()
Parameters
Returns
Promise<QiAddressInfo>
The next Qi address information.
Overrides
AbstractHDWallet.getNextAddress
Source
wallet/qi-hdwallet.ts:301getNextAddressSync()
Parameters
Returns
QiAddressInfo
The next Qi address information.
Overrides
AbstractHDWallet.getNextAddressSync
Source
wallet/qi-hdwallet.ts:312getNextChangeAddress()
Parameters
Returns
Promise<QiAddressInfo>
The next change neutered address information.
Source
wallet/qi-hdwallet.ts:323getNextChangeAddressSync()
Parameters
Returns
QiAddressInfo
The next change neutered address information.
Source
wallet/qi-hdwallet.ts:334getNextReceiveAddress()
Parameters
Returns
QiAddressInfo
A promise that resolves to the payment address for receiving funds.
Throws
Throws an error if the payment code version is invalid.Source
wallet/qi-hdwallet.ts:1473getNextSendAddress()
Parameters
Returns
QiAddressInfo
A promise that resolves to the payment address for sending funds.
Throws
Throws an error if the payment code version is invalid.Source
wallet/qi-hdwallet.ts:1457getOutpoints()
Parameters
Returns
OutpointInfo[]
The outpoints for the zone.
Source
wallet/qi-hdwallet.ts:388getPaymentChannelAddressesForZone()
Parameters
Returns
QiAddressInfo[]
The payment channel addresses for the zone.
Source
wallet/qi-hdwallet.ts:1156getPaymentCode()
Parameters
Returns
string
A promise that resolves to the Base58-encoded BIP47 payment code.
Source
wallet/qi-hdwallet.ts:1444getPrivateKey()
Parameters
Returns
string
The private key.
Overrides
AbstractHDWallet.getPrivateKey
Source
wallet/qi-hdwallet.ts:987getPrivateKeyForTxInput()
- For BIP44 addresses (standard or change), it uses the HD wallet to derive the private key.
- For payment channel addresses (BIP47), it uses PaymentCodePrivate to derive the private key.
Parameters
Returns
string
The private key corresponding to the transaction input.
Throws
If the input does not contain a public key or if the address information cannot be found.Source
wallet/qi-hdwallet.ts:974getUnusedBIP44Addresses()
Parameters
Returns
QiAddressInfo[]
An array of addresses.
Source
wallet/qi-hdwallet.ts:883importOutpoints()
Parameters
Returns
void
Source
wallet/qi-hdwallet.ts:343importPrivateKey()
Parameters
Returns
Promise<QiAddressInfo>
The address information for the imported key
Throws
If the private key is invalid or the address is already in useSource
wallet/qi-hdwallet.ts:1510openChannel()
Parameters
Returns
void
Source
wallet/qi-hdwallet.ts:1487outpointsToUTXOs()
Parameters
Returns
UTXO[]
An array of UTXO objects.
Source
wallet/qi-hdwallet.ts:460prepareAndSendTransaction()
Parameters
Returns
Promise<TransactionResponse>
A promise that resolves to the transaction response.
Throws
If provider is not set, insufficient balance, no available UTXOs, or insufficient spendable balance.Source
wallet/qi-hdwallet.ts:611prepareFeeEstimationTransaction()
Parameters
Returns
QiPerformActionTransaction
The prepared transaction.
Source
wallet/qi-hdwallet.ts:807prepareTransaction()
Parameters
Returns
Promise<QiTransaction>
A promise that resolves to the prepared transaction.
Source
wallet/qi-hdwallet.ts:741scan()
Parameters
Returns
Promise<void>
A promise that resolves when the scan is complete.
Throws
If the zone is invalid.Source
wallet/qi-hdwallet.ts:1025sendTransaction()
Parameters
Returns
Promise<TransactionResponse>
A promise that resolves to the transaction response.
Throws
If the payment code is invalid, the amount is zero, or the zones are invalid.Source
wallet/qi-hdwallet.ts:523serialize()
Returns
SerializedQiHDWallet
An object representing the serialized state of the HD wallet, including
outpoints, change addresses, gap addresses, and other inherited properties.
Overrides
AbstractHDWallet.serialize
Source
wallet/qi-hdwallet.ts:1197setAddressUseChecker()
Parameters
Returns
void
Source
wallet/qi-hdwallet.ts:290signMessage()
Parameters
Returns
Promise<string>
A promise that resolves to the signature of the message in hexadecimal string format.
Overrides
AbstractHDWallet.signMessage
Throws
If the address does not correspond to a valid HD node or if signing fails.Source
wallet/qi-hdwallet.ts:1179signTransaction()
Parameters
Returns
Promise<string>
The serialized transaction.
Overrides
AbstractHDWallet.signTransaction
Throws
If the UTXO transaction is invalid.Source
wallet/qi-hdwallet.ts:402sync()
Parameters
Returns
Promise<void>
A promise that resolves when the sync is complete.
Throws
If the zone is invalid.Source
wallet/qi-hdwallet.ts:1044validateDerivationPath()
Parameters
Returns
void
Throws
If the path is invalidSource
wallet/qi-hdwallet.ts:1363xPub()
Returns
string
The extended public key.
Source
wallet/qi-hdwallet.ts:249createRandom()
Type parameters
Parameters
Returns
T
The created instance.
Inherited from
AbstractHDWallet.createRandom
Source
wallet/abstract-hdwallet.ts:195deserialize()
Parameters
Returns
Promise<QiHDWallet>
A promise that resolves to a reconstructed QiHDWallet instance.
Overrides
AbstractHDWallet.deserialize
Throws
If the serialized data is invalid or if any addresses in the gap addresses or gap change addresses do not exist in the wallet.Source
wallet/qi-hdwallet.ts:1240fromMnemonic()
Type parameters
Parameters
Returns
T
The created instance.
Inherited from
AbstractHDWallet.fromMnemonic
Source
wallet/abstract-hdwallet.ts:180fromPhrase()
Type parameters
Parameters
Returns
T
The created instance.
Inherited from
AbstractHDWallet.fromPhrase
