Skip to main content

SwapData

Defined in: atomiq-base/src/swaps/SwapData.ts:9

Represents full escrow swap data and parameters

Extended by

Implements

Constructors

Constructor

new SwapData(): SwapData;

Returns

SwapData

Properties

deserializers

static deserializers: object = {};

Defined in: atomiq-base/src/swaps/SwapData.ts:14

A mapping of deserializers for different escrow swap data types coming from different smart chain implementations

Index Signature

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

Methods

deserialize()

static deserialize<T>(data): T;

Defined in: atomiq-base/src/swaps/SwapData.ts:23

Deserializer parsing the chain-specific escrow swap data from a JSON-compatible object representation

Type Parameters

Type Parameter
T extends SwapData

Parameters

ParameterTypeDescription
dataany

Returns

T


equals()

abstract equals(other): boolean;

Defined in: atomiq-base/src/swaps/SwapData.ts:215

Checks equality between 2 swap data objects

Parameters

ParameterTypeDescription
otherSwapData

Returns

boolean


getAmount()

abstract getAmount(): bigint;

Defined in: atomiq-base/src/swaps/SwapData.ts:82

Gets the amount of token deposited into the vault by the offerer

Returns

bigint


getClaimer()

abstract getClaimer(): string;

Defined in: atomiq-base/src/swaps/SwapData.ts:53

Gets the claim, which receives funds from the escrow

Returns

string


getClaimerBounty()

abstract getClaimerBounty(): bigint;

Defined in: atomiq-base/src/swaps/SwapData.ts:187

Gets the claimer bounty, an amount of native tokens deposited by the caller (initiator) on escrow initialization, that is paid out to a caller which claims the escrow as a reward, otherwise returned to the claimer if escrow is refunded

Returns

bigint


getClaimHash()

abstract getClaimHash(): string;

Defined in: atomiq-base/src/swaps/SwapData.ts:125

Returns the claim hash of the escrow, this specifies a condition that needs to be satisfied to claim the funds from the escrow

Returns

string


getConfirmationsHint()

abstract getConfirmationsHint(): number;

Defined in: atomiq-base/src/swaps/SwapData.ts:146

Retrieves required number of confirmations as a hint from the extra data provided, or null if no extra data has been provided when creating the escrow

Returns

number


getDepositToken()

abstract getDepositToken(): string;

Defined in: atomiq-base/src/swaps/SwapData.ts:201

Returns the token used for the deposit (security deposit & claimer bounty) (usually a native token of the underlying smart chain)

Returns

string


getEscrowHash()

abstract getEscrowHash(): string;

Defined in: atomiq-base/src/swaps/SwapData.ts:130

Returns a unique hash of this escrow

Returns

string


getExpiry()

abstract getExpiry(): bigint;

Defined in: atomiq-base/src/swaps/SwapData.ts:100

Returns the expiration time of this escrow, after the timeout an offerer is able to refund unilaterally. taking back funds from the escrow

Returns

bigint


getExtraData()

abstract getExtraData(): string;

Defined in: atomiq-base/src/swaps/SwapData.ts:140

Gets the extraneous data specified when creating this escrow, this provides helpers for 3rd party claimers

Returns

string


getHTLCHashHint()

getHTLCHashHint(): string;

Defined in: atomiq-base/src/swaps/SwapData.ts:164

Retrieves a hint providing an HTLC hash from the extra data provided, or null if no extra data has been provided when creating the escrow

Returns

string


getNonceHint()

abstract getNonceHint(): bigint;

Defined in: atomiq-base/src/swaps/SwapData.ts:152

Retrieves the PrTLC transaction nonce as a hint from the extra data provided, or null if no extra data has been provided when creating the escrow

Returns

bigint


getOfferer()

abstract getOfferer(): string;

Defined in: atomiq-base/src/swaps/SwapData.ts:34

Gets the offerer, which funds the escrow

Returns

string


getSecurityDeposit()

abstract getSecurityDeposit(): bigint;

Defined in: atomiq-base/src/swaps/SwapData.ts:180

Gets the security deposit, which is an amount of native tokens deposited by the caller (initiator) on escrow initialization to guarantee the execution, this acts as a compensation for offerer if he has to refund the escrow, otherwise it is returned back to claimer after a successful claim of the escrow

Returns

bigint


getSequence()

abstract getSequence(): bigint;

Defined in: atomiq-base/src/swaps/SwapData.ts:135

Returns a random variable sequence of this vault, used to ensure the escrow hash is always different

Returns

bigint


getToken()

abstract getToken(): string;

Defined in: atomiq-base/src/swaps/SwapData.ts:87

Gets the address of the deposited token in a vault

Returns

string


getTotalDeposit()

abstract getTotalDeposit(): bigint;

Defined in: atomiq-base/src/swaps/SwapData.ts:195

Returns the total deposit in native token to be deposited by the caller (initiator) on escrow initialization, due to how claimer bounty and security deposits work, this is basically a max(claimer bounty, security deposit), because either a swap is claimed (and claimer bounty is paid) or a swap is refunded (and security deposit is paid), never both!

Returns

bigint


getTxoHashHint()

abstract getTxoHashHint(): string;

Defined in: atomiq-base/src/swaps/SwapData.ts:158

Retrieves the PrTLC transaction txo (transaction output) hash as a hint from the extra data provided, or null if no extra data has been provided when creating the escrow

Returns

string


getType()

abstract getType(): ChainSwapType;

Defined in: atomiq-base/src/swaps/SwapData.ts:77

Returns the type of this escrow

Returns

ChainSwapType


hasSuccessAction()

hasSuccessAction(): boolean;

Defined in: atomiq-base/src/swaps/SwapData.ts:220

Checks whether the escrow contains an execution action (swap+)

Returns

boolean


isClaimer()

abstract isClaimer(address): boolean;

Defined in: atomiq-base/src/swaps/SwapData.ts:67

Checks whether the provided address is a claimer for this escrow

Parameters

ParameterTypeDescription
addressstring

Returns

boolean


isDepositToken()

abstract isDepositToken(token): boolean;

Defined in: atomiq-base/src/swaps/SwapData.ts:208

Checks whether a provided token is used as a deposit token (security deposit & claimer bounty) for the escrow

Parameters

ParameterTypeDescription
tokenstring

Returns

boolean


isOfferer()

abstract isOfferer(address): boolean;

Defined in: atomiq-base/src/swaps/SwapData.ts:48

Checks whether the provided address is an offerer for this escrow

Parameters

ParameterTypeDescription
addressstring

Returns

boolean


isPayIn()

abstract isPayIn(): boolean;

Defined in: atomiq-base/src/swaps/SwapData.ts:114

Whether this escrow will be funded from the offerer's wallet or from the offerer's vault inside the contract, when true it takes funds normally from the offerer's address, when false it pulls the funds from the offerer's vault inside the contract

Returns

boolean


isPayOut()

abstract isPayOut(): boolean;

Defined in: atomiq-base/src/swaps/SwapData.ts:107

Whether this escrow will pay out the claimer, when true it pays out normally to the claimer's address, when false it instead keeps the funds inside the contract and assigns them to the claimer's vault inside the contract

Returns

boolean


isToken()

abstract isToken(token): boolean;

Defined in: atomiq-base/src/swaps/SwapData.ts:94

Checks whether the provided token address is the actual token used by this escrow

Parameters

ParameterTypeDescription
tokenstring

Returns

boolean


isTrackingReputation()

abstract isTrackingReputation(): boolean;

Defined in: atomiq-base/src/swaps/SwapData.ts:119

Whether the outcome of this escrow should be used to track reputation of the claimer

Returns

boolean


serialize()

abstract serialize(): any;

Defined in: atomiq-base/src/swaps/SwapData.ts:72

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

Returns

any

Implementation of

StorageObject.serialize


setClaimer()

abstract setClaimer(newClaimer): void;

Defined in: atomiq-base/src/swaps/SwapData.ts:60

Sets the claimer which receives funds from the escrow

Parameters

ParameterTypeDescription
newClaimerstring

Returns

void


setExtraData()

abstract setExtraData(extraData): void;

Defined in: atomiq-base/src/swaps/SwapData.ts:173

Sets the extra data with hints for this escrow

Parameters

ParameterTypeDescription
extraDatastring

Returns

void


setOfferer()

abstract setOfferer(newOfferer): void;

Defined in: atomiq-base/src/swaps/SwapData.ts:41

Sets the offerer to fund the escrow

Parameters

ParameterTypeDescription
newOffererstring

Returns

void