WalletHelper

High-level helper class for instances that implement the Wallet interface.

Constructor

const helper = new helios.WalletHelper(wallet: helios.Wallet)

Getters

allAddresses

Concatenation of usedAddresses and unusedAddresses.

helper.allAddresses: Promise<helios.Address[]>

baseAddress

First Address in allAddresses.

helper.baseAddress: Promise<helios.Address>

changeAddress

First Address in unusedAddresses.

helper.changeAddress: Promise<helios.Address>

refUtxo

First UTxO in utxos. Can be used to distinguish between preview and preprod networks.

helper.refUtxo: Promise<helios.UTxO>

Methods

isOwnAddress

Returns true if the PubKeyHash in the given Address is controlled by the wallet.

helper.isOwnAddress(address: helios.Address): boolean

isOwnPubKeyHash

Returns true if the givenPubKeyHash is controlled by the wallet.

helper.isOwnPubKeyHash(pkh: helios.PubKeyHash): boolean

pickUtxos

Pick a number of UTxOs needed to cover a given Value. The coin selection strategy is to pick the smallest first (WiP).

Returns two lists. The first list contains the selected UTxOs, the second list contains the remaining UTxOs.

helper.pickUtxos(amount: helios.Value): Promise<[helios.UTxO[], helios.UTxO[]]>

pickCollateral

Picks a single UTxO intended for collateral.

helper.pickCollateral(amount: bigint = 2000000n): Promise<helios.UTxO>