참고: 이 페이지는 아직 한국어로 번역되지 않았습니다. 아래는 영어 원문입니다.A Wallet manages a single private key which is used to sign transactions, messages and other common payloads. This class is generally the main entry point for developers that wish to use a private key directly, as it can create instances from a large variety of common sources, including raw private key, BIP-39 mnemonics and encrypted JSON wallets.
BaseWallet
key
, optionally connected to provider
.
Parameter | Type | Description |
---|---|---|
key | string | SigningKey | The private key. |
provider ? | null | Provider | The provider to connect to. |
Wallet
BaseWallet.constructor
Property | Modifier | Type | Description | Inherited from |
---|---|---|---|---|
#address | private | string | The wallet address. | BaseWallet.#address |
#signingKey | private | SigningKey | The signing key used for signing payloads. | BaseWallet.#signingKey |
provider | readonly | null | Provider | The provider this signer is connected to. | BaseWallet.provider |
string
string
SigningKey
Parameter | Type | Description |
---|---|---|
provider | null | Provider | The provider to connect to. |
Wallet
The connected wallet.
BaseWallet.connect
password
.
If progressCallback
is specified, it will receive periodic updates as the encryption process progresses.
Parameter | Type | Description |
---|---|---|
password | string | Uint8Array | The password to encrypt the wallet with. |
progressCallback ? | ProgressCallback | An optional callback to keep the user informed. |
Promise
<string
>
The encrypted JSON wallet.
password
.
It is preferred to use the async version instead, which allows a
ProgressCallback to keep the user informed.
This method will block the event loop (freezing all UI) until it is complete, which may be a non-trivial
duration.
Parameter | Type | Description |
---|---|---|
password | string | Uint8Array | The password to encrypt the wallet with. |
string
The encrypted JSON wallet.
Parameter | Type | Description |
---|---|---|
_zone ? | string | The zone (optional). |
Promise
<string
>
The wallet address.
BaseWallet.getAddress
Parameter | Type | Description |
---|---|---|
message | string | Uint8Array | The message to sign. |
Promise
<string
>
The signed message.
BaseWallet.signMessage
message
signed with this wallet.
Parameter | Type | Description |
---|---|---|
message | string | Uint8Array | The message to sign. |
string
The serialized signature.
BaseWallet.signMessageSync
Parameter | Type | Description |
---|---|---|
tx | QuaiTransactionRequest | The transaction request. |
Promise
<string
>
The signed transaction.
BaseWallet.signTransaction
Parameter | Type | Description |
---|---|---|
domain | TypedDataDomain | The domain of the typed data. |
types | Record <string , TypedDataField []> | The types of the typed data. |
value | Record <string , any > | The value of the typed data. |
Promise
<string
>
The signed typed data.
BaseWallet.signTypedData
json
with password
.
If progress
is provided, it is called periodically during decryption so that any UI can be updated.
Parameter | Type | Description |
---|---|---|
json | string | The JSON data to decrypt. |
password | string | Uint8Array | The password to decrypt the JSON data. |
progress ? | ProgressCallback | An optional callback to keep the user informed. |
Promise
<Wallet
>
The decrypted wallet.
json
with password
.
The fromEncryptedJson method is preferred, as this method will lock up and
freeze the UI during decryption, which may take some time.
Parameter | Type | Description |
---|---|---|
json | string | The JSON data to decrypt. |
password | string | Uint8Array | The password to decrypt the JSON data. |
QuaiHDWallet
| Wallet
The decrypted wallet.