Class: Wallet

Wallet()

new Wallet()

Construct a wallet from this function, this function will load the web assembly into the buffer and instantiate it, it will block until the web assembly is loaded
Properties:
Name Type Description
seed Uint8Array The seed of the wallet
Source:

Members

(static) networkBlockHeight

Get the network block height
Source:

Methods

getBalance(psk) → {Promise.<BalanceInfo>}

Get balance
Parameters:
Name Type Description
psk string bs58 encoded public spend key of the user we want to
Source:
Returns:
The balance info
Type
Promise.<BalanceInfo>

getPsks() → {Promise.<Array.<string>>}

Get psks for the seed
Source:
Returns:
psks Psks of the first 21 address for the seed
Type
Promise.<Array.<string>>

history(psk) → {Array.<TxData>}

Get the history of the wallet
Parameters:
Name Type Description
psk string bs58 encoded public spend key of the user we want to fetch the history of
Source:
Returns:
The history of the wallet
Type
Array.<TxData>

reset() → {Promise}

Reset the state indexedb db and localStorage
Source:
Returns:
promise that resolves after the db is reset
Type
Promise

(async) stake(staker, amount, gasopt) → {Promise}

Stake Dusk from the provided psk, refund to the same psk
Parameters:
Name Type Attributes Description
staker string bs58 encoded Psk to stake from
amount number Amount of dusk to stake
gas Gas <optional>
Gas settings for the stake transaction
Source:
Returns:
promise that resolves after the stake is accepted into blockchain
Type
Promise

(async) stakeInfo(psk) → {Promise.<StakeInfo>}

Fetches the info of the stake if the person has staked
Parameters:
Name Type Description
psk string bs58 encoded Psk of the staker
Source:
Returns:
The stake info
Type
Promise.<StakeInfo>

sync(optionsopt) → {Promise}

Sync the wallet
Parameters:
Name Type Attributes Description
options SyncOptions <optional>
Options for the sync
Source:
Returns:
promise that resolves after the sync is complete
Type
Promise

transfer(sender, receiver, amount, gasopt) → {Promise}

Transfer Dusk from sender psk to receiver psk
Parameters:
Name Type Attributes Description
sender string bs58 encoded Psk to send the dusk from
receiver string bs68 encoded psk of the address who will receive the Dusk
amount number Amount of DUSK to send
gas Gas <optional>
Gas settings for the transfer transaction
Source:
Returns:
promise that resolves after the transfer is accepted into blockchain
Type
Promise

(async) unstake(unstaker, gasopt) → {Promise}

Unstake dusk from the provided psk, refund to the same psk
Parameters:
Name Type Attributes Description
unstaker string bs58 encoded psk to unstake from
gas Gas <optional>
Gas settings for the unstake transaction
Source:
Returns:
promise that resolves after the unstake is accepted into blockchain
Type
Promise

(async) withdrawReward(unstaker, gasopt) → {Promise}

Withdraw reward
Parameters:
Name Type Attributes Description
unstaker string bs58 encoded psk to unstake from
gas Gas <optional>
Gas settings for the withdrawReward transaction
Source:
Returns:
promise that resolves after the unstake is accepted into blockchain
Type
Promise