For more high level overview on what wallets are available in the SDK, see the Wallet fundamentals page.
The QiHDWallet class provides additional low-level functionality on top of the base Wallet class, allowing for more granular control and wallet management.
Quai HD wallets allow for derivation of multiple accounts, addresses, and specific zones from a single mnemonic as specified by BIP-32.
Copy
Ask AI
// derive new address for account '0' in 'Cyprus1' zoneconst addressInfo1 = await quaiWallet.getNextAddress(0, quais.Zone.Cyprus1)// derive new address for account '1' in 'Cyrpus2' zoneconst addressInfo2 = await quaiWallet.getNextAddress(1, quais.Zone.Cyprus2)
The HD Wallet also provides a number of methods to return data for derived addresses by certain filters:
Copy
Ask AI
// get address info for account '0' new address '1'const addressInfo = quaiWallet.getAddressInfo(addressInfo1.address)// get all addresses for account '0' in 'Cyprus1' zoneconst cyprus1addressInfo = quaiWallet.getAddressesForZone(quais.Zone.Cyprus1)// get all addresses for account '0'const account0Addresses = quaiWallet.getAddressesForAccount(0)
Wallet storage and transmission can be securely done using a serialized representation of the wallet. The HD wallet provides functionality for both serializing and deserializing the wallet.
Copy
Ask AI
// serialize current (account/address) state of the walletconst serializedWallet = quaiWallet.serialize()// deserialize wallet from serialized dataconst deserializedWallet = quais.QuaiHDWallet.deserialize(serializedWallet)