注意: このページはまだ日本語に翻訳されていません。以下は英語の原文です。The Qi HD wallet is a BIP44-compliant hierarchical deterministic wallet used for managing a set of addresses in the Qi ledger. This is wallet implementation is the primary way to interact with the Qi UTXO ledger on the Quai network. The Qi HD wallet supports:
AbstractHDWallet
<QiAddressInfo
>Property | Modifier | Type | Default value | Description |
---|---|---|---|---|
bip47HDNode | private | HDNodeWallet | undefined | The BIP47 HDNode instance used for deriving payment code addresses. This follows the BIP47 derivation path m/47’/969’/account’/0/index |
changeBip44 | private | Bip44QiWallet | undefined | The BIP44 wallet instance used for deriving change (sending) addresses. This follows the BIP44 derivation path m/44’/969’/account’/0/index |
externalBip44 | private | Bip44QiWallet | undefined | The BIP44 wallet instance used for deriving external (receiving) addresses. This follows the BIP44 derivation path m/44’/969’/account’/0/index |
paymentChannels | private | Map <string , PaymentChannel > | ... | Map of payment channels indexed by counterparty payment code |
privatekeyWallet | private | PrivatekeyQiWallet | undefined | The private key wallet instance used for deriving addresses from private keys. |
bip47derivationPath | private | string | "m/47'/969'" | The BIP47 derivation path m/47’/969’ |
string
[]
The payment codes for all open channels.
Parameter | Type | Description |
---|---|---|
account | number | The account number. |
addressIndex | number | The address index. |
QiAddressInfo
The address info for the new address.
AbstractHDWallet.addAddress
Parameter | Type | Description |
---|---|---|
account | number | The account number. |
addressIndex | number | The address index. |
QiAddressInfo
The address info for the new address.
Parameter | Type | Description |
---|---|---|
zone | Zone | The zone to aggregate the balance for. |
options ? | QiTransactionOptions | Optional transaction configuration. |
Promise
<TransactionResponse
>
The transaction response.
Parameter | Type | Description |
---|---|---|
address | string | The address to check. |
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.
Parameter | Type | Description |
---|---|---|
provider | Provider | The provider. |
void
AbstractHDWallet.connect
Parameter | Type | Description |
---|---|---|
destinationAddress | string | The Quai address to send the converted Quai to. |
amount | bigint | The amount of Qi to convert to Quai. |
options ? | QiTransactionOptions | Optional transaction configuration. |
Promise
<TransactionResponse
>
A promise that resolves to the transaction response.
Parameter | Type | Description |
---|---|---|
address | string | The address to locate. |
null
| QiAddressInfo
The address info or null if not found.
AbstractHDWallet.getAddressInfo
Parameter | Type | Description |
---|---|---|
account | number | The account number. |
QiAddressInfo
[]
The addresses for the account.
AbstractHDWallet.getAddressesForAccount
Parameter | Type | Description |
---|---|---|
zone | Zone | The zone. |
QiAddressInfo
[]
The addresses for the zone.
AbstractHDWallet.getAddressesForZone
Parameter | Type | Description |
---|---|---|
zone | Zone | The zone to get the balance for |
Promise
<bigint
>
The total balance in the zone as a bigint
Parameter | Type | Default value | Description |
---|---|---|---|
count | number | undefined | The number of change addresses needed |
zone | Zone | undefined | The zone to get change addresses from |
account ? | number | 0 | The account index to use (defaults to 0). Default is 0 |
Promise
<string
[]>
A promise that resolves to an array of change addresses
Parameter | Type | Description |
---|---|---|
zone | Zone | The zone. |
QiAddressInfo
[]
The change addresses for the zone.
Parameter | Type | Description |
---|---|---|
zone | Zone | The zone. |
QiAddressInfo
[]
The gap addresses for the zone.
Parameter | Type | Description |
---|---|---|
zone | Zone | The zone. |
QiAddressInfo
[]
The gap change addresses for the zone.
Parameter | Type | Description |
---|---|---|
paymentCode | string | The payment code. |
zone | Zone | - |
QiAddressInfo
[]
The gap payment channel addresses for the payment code.
Parameter | Type | Description |
---|---|---|
zone ? | Zone | Optional zone to filter addresses by |
QiAddressInfo
[]
Array of address info objects for imported addresses
Parameter | Type | Description |
---|---|---|
account | number | The account number. |
zone | Zone | The zone. |
Promise
<QiAddressInfo
>
The next Qi address information.
AbstractHDWallet.getNextAddress
Parameter | Type | Description |
---|---|---|
account | number | The account number. |
zone | Zone | The zone. |
QiAddressInfo
The next Qi address information.
AbstractHDWallet.getNextAddressSync
Parameter | Type | Description |
---|---|---|
account | number | The index of the account for which to retrieve the next change address. |
zone | Zone | The zone in which to retrieve the next change address. |
Promise
<QiAddressInfo
>
The next change neutered address information.
Parameter | Type | Description |
---|---|---|
account | number | The index of the account for which to retrieve the next change address. |
zone | Zone | The zone in which to retrieve the next change address. |
QiAddressInfo
The next change neutered address information.
Parameter | Type | Default value | Description |
---|---|---|---|
senderPaymentCode | string | undefined | The Base58-encoded BIP47 payment code of the sender. |
zone | Zone | undefined | - |
account | number | 0 | - |
QiAddressInfo
A promise that resolves to the payment address for receiving funds.
Parameter | Type | Default value | Description |
---|---|---|---|
receiverPaymentCode | string | undefined | The Base58-encoded BIP47 payment code of the receiver. |
zone | Zone | undefined | - |
account | number | 0 | - |
QiAddressInfo
A promise that resolves to the payment address for sending funds.
Parameter | Type | Description |
---|---|---|
zone | Zone | The zone. |
OutpointInfo
[]
The outpoints for the zone.
Parameter | Type | Description |
---|---|---|
paymentCode | string | The payment code. |
zone | Zone | The zone. |
QiAddressInfo
[]
The payment channel addresses for the zone.
Parameter | Type | Default value | Description |
---|---|---|---|
account | number | 0 | The account index to derive the payment code from. |
string
A promise that resolves to the Base58-encoded BIP47 payment code.
Parameter | Type | Description |
---|---|---|
address | string | The address associated with the desired private key. |
string
The private key.
AbstractHDWallet.getPrivateKey
Parameter | Type | Description |
---|---|---|
input | TxInput | The transaction input containing the public key. |
string
The private key corresponding to the transaction input.
Parameter | Type | Description |
---|---|---|
amount | number | The number of addresses to get. |
account | number | - |
path | string | The derivation path to get addresses from. |
zone | Zone | The zone to get addresses from. |
QiAddressInfo
[]
An array of addresses.
Parameter | Type | Description |
---|---|---|
outpoints | OutpointInfo [] | The outpoints to import. |
void
Parameter | Type | Description |
---|---|---|
privateKey | string | The private key to import (hex string) |
Promise
<QiAddressInfo
>
The address information for the imported key
Parameter | Type | Description |
---|---|---|
paymentCode | string | The payment code to store. |
void
Parameter | Type | Description |
---|---|---|
zone | Zone | The zone to filter outpoints for. |
UTXO
[]
An array of UTXO objects.
Parameter | Type | Description |
---|---|---|
amount | bigint | The amount of Qi to send. |
originZone | Zone | The zone where the transaction originates. |
getDestinationAddresses | (count ) => Promise <string []> | A function that returns a promise resolving to an array of destination addresses. |
coinSelectorCreator | (utxos ) => FewestCoinSelector | ConversionCoinSelector | - |
options | QiTransactionOptions | - |
Promise
<TransactionResponse
>
A promise that resolves to the transaction response.
Parameter | Type | Description |
---|---|---|
selection | SelectedCoinsResult | The selected coins result. |
inputPubKeys | string [] | The public keys of the inputs. |
sendAddresses | string [] | The addresses to send to. |
changeAddresses | string [] | The addresses to change to. |
QiPerformActionTransaction
The prepared transaction.
Parameter | Type | Description |
---|---|---|
selection | SelectedCoinsResult | The selected coins result. |
sendAddresses | string [] | The addresses to send to. |
changeAddresses | string [] | The addresses to change to. |
chainId | number | The chain ID. |
options | QiTransactionOptions | - |
Promise
<QiTransaction
>
A promise that resolves to the prepared transaction.
Parameter | Type | Default value | Description |
---|---|---|---|
zone | Zone | undefined | The zone in which to scan for addresses. |
account ? | number | 0 | The index of the account to scan. Default is 0 |
Promise
<void
>
A promise that resolves when the scan is complete.
Parameter | Type | Description |
---|---|---|
recipientPaymentCode | string | The payment code of the recipient. |
amount | bigint | The amount of Qi to send. |
originZone | Zone | The zone where the transaction originates. |
destinationZone | Zone | The zone where the transaction is sent. |
options ? | QiTransactionOptions | Optional transaction configuration. |
Promise
<TransactionResponse
>
A promise that resolves to the transaction response.
SerializedQiHDWallet
An object representing the serialized state of the HD wallet, including
outpoints, change addresses, gap addresses, and other inherited properties.
AbstractHDWallet.serialize
Parameter | Type | Description |
---|---|---|
checker | AddressUsageCallback | The address use checker. |
void
Parameter | Type | Description |
---|---|---|
address | string | The address for which the message is to be signed. |
message | string | Uint8Array | The message to be signed, either as a string or Uint8Array. |
Promise
<string
>
A promise that resolves to the signature of the message in hexadecimal string format.
AbstractHDWallet.signMessage
Parameter | Type | Description |
---|---|---|
tx | QiTransactionRequest | The transaction to sign. |
Promise
<string
>
The serialized transaction.
AbstractHDWallet.signTransaction
Parameter | Type | Default value | Description |
---|---|---|---|
zone | Zone | undefined | The zone in which to sync addresses. |
account ? | number | 0 | The index of the account to sync. Default is 0 |
onOutpointsCreated ? | OutpointsCallback | undefined | - |
onOutpointsDeleted ? | OutpointsCallback | undefined | - |
Promise
<void
>
A promise that resolves when the sync is complete.
Parameter | Type | Description |
---|---|---|
path | string | The derivation path to validate |
isChange | boolean | Whether this is a change address |
void
string
The extended public key.
Type parameter |
---|
T extends AbstractHDWallet <NeuteredAddressInfo , T > |
Parameter | Type | Description |
---|---|---|
this | Object | The constructor of the HD wallet. |
password ? | string | The password. |
wordlist ? | Wordlist | The wordlist. |
T
The created instance.
AbstractHDWallet.createRandom
Parameter | Type | Description |
---|---|---|
serialized | SerializedQiHDWallet | The serialized object representing the state of a QiHDWallet. |
Promise
<QiHDWallet
>
A promise that resolves to a reconstructed QiHDWallet instance.
AbstractHDWallet.deserialize
Type parameter |
---|
T extends AbstractHDWallet <NeuteredAddressInfo , T > |
Parameter | Type | Description |
---|---|---|
this | Object | The constructor of the HD wallet. |
mnemonic | Mnemonic | The mnemonic. |
T
The created instance.
AbstractHDWallet.fromMnemonic
Type parameter |
---|
T extends AbstractHDWallet <NeuteredAddressInfo , T > |
Parameter | Type | Description |
---|---|---|
this | Object | The constructor of the HD wallet. |
phrase | string | The phrase. |
password ? | string | The password. |
wordlist ? | Wordlist | The wordlist. |
T
The created instance.
AbstractHDWallet.fromPhrase