Skip to content

OnlineWallet

Extends: Node

Description

This class is used for providing wallet-related online functionality, such as querying for the assets or UTxOs locked at the wallet. These features are possible due to the required [Provider] in its constructor.

This class is used for providing wallet-related online functionality, such as querying for the assets or UTxOs locked at the wallet. These features are possible due to the required [Provider] in its constructor.

Property Descriptions

active

var active: bool = false

Method Descriptions

total_lovelace

func total_lovelace() -> BigInt

Get the amount of Lovelace locked among all of the wallet's UTxOs

new_tx

func new_tx() -> CreateResult

Create a TxBuilder.

sign_transaction

func sign_transaction(password: String, transaction: Transaction) -> SignTxResult

get_address

func get_address() -> Address

get_utxos

func get_utxos() -> Array[Utxo]

get_payment_pub_key_hash

func get_payment_pub_key_hash() -> PubKeyHash

Signals

  • signal got_updated_utxos(utxos):

Sub-classes

SignTxResult

Property Descriptions

value

var value: Signature
  • Getter: @value_getter

WARNING: This function may fail! First match on Result.tag or call Result.is_ok.

error

var error: String
  • Getter: @error_getter

WARNING: This function may fail! First match on Result.tag or call Result._is_err.

OnlineSingleAddressWallet

Property Descriptions

utxos_update_age

@export var utxos_update_age: float = 30

utxos_cache_age

@export var utxos_cache_age: float = 30

time_left

var time_left: float
  • Getter: @time_left_getter

timer

var timer: Timer

utxos

var utxos: Array[Utxo]

Cached utxos, these can and will be outdated. To get the latest utxos, call OnlineWallet._get_utxos.

Method Descriptions

_init

func _init(single_address_wallet: SingleAddressWallet, provider: Provider, auto_update_utxos: bool = true) -> OnlineSingleAddressWallet

Construct the wallet by providing a SingleAddressWallet(SingleAddressWallet) (for the network functionality).

update_utxos

func update_utxos() -> void

Update the cached utxos. The same as OnlineWallet._get_utxos, but without returning the updated utxos.

add_account

func add_account(account_index: int, password: String) -> AddAccountResult

Add a new account to the wallet.

switch_account

func switch_account(account: Account) -> int

Switch the active account in the wallet.

send_lovelace_to

func send_lovelace_to(password: String, recipient: String, amount: BigInt) -> TransactionHash

Send a lovelace amount to a [param recipient] BECH32 address. This is provided for convenience, as it avoids using the [TxBuilder] interface.

tx_with

func tx_with(builder: Callable, signer: Callable) -> TransactionHash

See [method Provider.tx_with]