Skip to main content

SpvVaultData<T>

Defined in: atomiq-base/src/spv_swap/SpvVaultData.ts:45

Represents the state of a single SPV vault (UTXO-controlled vault)

Extended by

Type Parameters

Type ParameterDefault type
T extends SpvWithdrawalTransactionDataSpvWithdrawalTransactionData

Implements

Constructors

Constructor

new SpvVaultData<T>(): SpvVaultData<T>;

Returns

SpvVaultData<T>

Properties

deserializers

static deserializers: object = {};

Defined in: atomiq-base/src/spv_swap/SpvVaultData.ts:50

A mapping of deserializers for different spv vault data types coming from different smart chain implementations

Index Signature

[type: string]: (serialized) => any

Methods

calculateStateAfter()

calculateStateAfter(priorWithdrawalTxs): object;

Defined in: atomiq-base/src/spv_swap/SpvVaultData.ts:129

A helper function which calculates the vault balances after processing an array of claims (withdrawals)

Parameters

ParameterTypeDescription
priorWithdrawalTxsT[]

Returns

object

NameTypeDefined in
balancesSpvVaultTokenBalance[]atomiq-base/src/spv_swap/SpvVaultData.ts:129
withdrawalCountnumberatomiq-base/src/spv_swap/SpvVaultData.ts:129

deserialize()

static deserialize<T>(data): T;

Defined in: atomiq-base/src/spv_swap/SpvVaultData.ts:59

Deserializer parsing the chain-specific spv vault data from a JSON-compatible object representation

Type Parameters

Type Parameter
T extends SpvVaultData<SpvWithdrawalTransactionData>

Parameters

ParameterTypeDescription
dataany

Returns

T


getBalances()

abstract getBalances(): SpvVaultTokenBalance[];

Defined in: atomiq-base/src/spv_swap/SpvVaultData.ts:89

Returns the token balance currently available in the vault

Returns

SpvVaultTokenBalance[]


getConfirmations()

abstract getConfirmations(): number;

Defined in: atomiq-base/src/spv_swap/SpvVaultData.ts:100

Gets the required number of confirmations that a bitcoin transaction has to get in order for the vault claim (withdrawal) to be authorized

Returns

number


getDepositCount()

abstract getDepositCount(): number;

Defined in: atomiq-base/src/spv_swap/SpvVaultData.ts:110

Returns the current number of deposits deposited into the vault

Returns

number


getOwner()

abstract getOwner(): string;

Defined in: atomiq-base/src/spv_swap/SpvVaultData.ts:74

Gets the owner of the vault

Returns

string


getTokenData()

abstract getTokenData(): SpvVaultTokenData[];

Defined in: atomiq-base/src/spv_swap/SpvVaultData.ts:84

Returns the configuration of the tokens supported by the vault

Returns

SpvVaultTokenData[]


getUtxo()

abstract getUtxo(): string;

Defined in: atomiq-base/src/spv_swap/SpvVaultData.ts:94

Returns the UTXO in [txId]:[vout] format which currently controls the vault

Returns

string


getVaultId()

abstract getVaultId(): bigint;

Defined in: atomiq-base/src/spv_swap/SpvVaultData.ts:79

Gets the vault ID, this along with the owner uniquely identifies a vault

Returns

bigint


getWithdrawalCount()

abstract getWithdrawalCount(): number;

Defined in: atomiq-base/src/spv_swap/SpvVaultData.ts:105

Returns the current number of claims (withdrawals) processed by the vault

Returns

number


isOpened()

abstract isOpened(): boolean;

Defined in: atomiq-base/src/spv_swap/SpvVaultData.ts:115

Checks whether a vault is opened and available to process claims (withdrawals)

Returns

boolean


serialize()

abstract serialize(): any;

Defined in: atomiq-base/src/spv_swap/SpvVaultData.ts:69

Serializes the object to a JSON-compatible object (i.e. no bigints, functions, etc.)

Returns

any

Implementation of

StorageObject.serialize


updateState()

abstract updateState(withdrawalTxOrEvent): void;

Defined in: atomiq-base/src/spv_swap/SpvVaultData.ts:122

Updates the state of the spv vault data from either an on-chain event or a SpvWithdrawalTransactionData

Parameters

ParameterTypeDescription
withdrawalTxOrEvent| T | SpvVaultOpenEvent | SpvVaultDepositEvent | SpvVaultClaimEvent | SpvVaultCloseEvent

Returns

void