Helios API/ API Reference/ Classes/
WalletHelper
High-level helper class for instances that implement the Wallet
interface.
Index
Constructors
constructor
• new WalletHelper(wallet
, getUtxosFallback?
)
Parameters
Accessors
allAddresses
• get
allAddresses(): Promise
<Address
[]>
Concatenation of usedAddresses
and unusedAddresses
.
Returns
Promise
<Address
[]>
baseAddress
• get
baseAddress(): Promise
<Address
>
First Address
in allAddresses
.
Returns
Promise
<Address
>
changeAddress
• get
changeAddress(): Promise
<Address
>
First Address
in unusedAddresses
(falls back to last Address
in usedAddresses
if not defined).
Returns
Promise
<Address
>
refUtxo
• get
refUtxo(): Promise
<null
| TxInput
>
First UTxO in utxos
. Can be used to distinguish between preview and preprod networks.
Returns
Promise
<null
| TxInput
>
Methods
calcBalance
▸ calcBalance(): Promise
<Value
>
Returns
Promise
<Value
>
getUtxos
▸ getUtxos(): Promise
<TxInput
[]>
Returns
Promise
<TxInput
[]>
isOwnAddress
▸ isOwnAddress(addr
): Promise
<boolean
>
Returns true
if the PubKeyHash
in the given Address
is controlled by the wallet.
Parameters
Name | Type |
---|---|
addr | Address |
Returns
Promise
<boolean
>
isOwnPubKeyHash
▸ isOwnPubKeyHash(pkh
): Promise
<boolean
>
Returns true
if the given PubKeyHash
is controlled by the wallet.
Parameters
Name | Type |
---|---|
pkh | PubKeyHash |
Returns
Promise
<boolean
>
pickCollateral
▸ pickCollateral(amount?
): Promise
<TxInput
>
Picks a single UTxO intended as collateral.
Parameters
Name | Type | Description |
---|---|---|
amount? | bigint | 2 Ada should cover most things |
Returns
Promise
<TxInput
>
pickUtxos
▸ pickUtxos(amount
, algorithm?
): Promise
<[TxInput
[], TxInput
[]]>
Pick a number of UTxOs needed to cover a given Value. The default coin selection strategy is to pick the smallest first.
Parameters
Name | Type |
---|---|
amount | Value |
algorithm? | CoinSelectionAlgorithm |
Returns
Promise
<[TxInput
[], TxInput
[]]>
The first list contains the selected UTxOs, the second list contains the remaining UTxOs.
toJson
▸ toJson(): Promise
<any
>
Returns
Promise
<any
>