Skip to main content

EVMSwapData

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:16

Represents swap data for executing PrTLC (on-chain) or HTLC (lightning) based swaps.

Extends

Constructors

Constructor

new EVMSwapData(
offerer,
claimer,
token,
refundHandler,
claimHandler,
payOut,
payIn,
reputation,
sequence,
claimData,
refundData,
amount,
depositToken,
securityDeposit,
claimerBounty,
kind,
extraData?,
successActionCommitment?): EVMSwapData;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:62

Parameters

ParameterType
offererstring
claimerstring
tokenstring
refundHandlerstring
claimHandlerstring
payOutboolean
payInboolean
reputationboolean
sequencebigint
claimDatastring
refundDatastring
amountbigint
depositTokenstring
securityDepositbigint
claimerBountybigint
kindChainSwapType
extraData?string
successActionCommitment?string

Returns

EVMSwapData

Overrides

SwapData.constructor

Constructor

new EVMSwapData(data): EVMSwapData;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:82

Parameters

ParameterType
dataany

Returns

EVMSwapData

Overrides

SwapData.constructor

Properties

amount

amount: bigint;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:50


claimData

claimData: string;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:47


claimer

claimer: string;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:35


claimerBounty

claimerBounty: bigint;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:54


claimHandler

claimHandler: string;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:39


depositToken

depositToken: string;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:52


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

Inherited from

SwapData.deserializers


extraData?

optional extraData: string;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:56


kind

kind: ChainSwapType;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:60


offerer

offerer: string;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:34


payIn

payIn: boolean;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:43


payOut

payOut: boolean;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:42


refundData

refundData: string;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:48


refundHandler

refundHandler: string;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:38


reputation

reputation: boolean;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:44


securityDeposit

securityDeposit: bigint;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:53


sequence

sequence: bigint;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:45


successActionCommitment

successActionCommitment: string;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:58


token

token: string;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:36

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

Inherited from

SwapData.deserialize


deserializeFromStruct()

static deserializeFromStruct(struct, claimHandlerImpl): EVMSwapData;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:491

Deserializes swap data from an on-chain escrow struct.

Parameters

ParameterTypeDescription
structEscrowDataStructEscrow struct as returned by the contract
claimHandlerImplIClaimHandler<any, any>Claim handler implementation used to resolve swap type

Returns

EVMSwapData


equals()

equals(other): boolean;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:439

Checks equality between 2 swap data objects

Parameters

ParameterTypeDescription
otherEVMSwapData

Returns

boolean

Overrides

SwapData.equals


getAmount()

getAmount(): bigint;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:228

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

Returns

bigint

Overrides

SwapData.getAmount


getClaimer()

getClaimer(): string;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:184

Gets the claim, which receives funds from the escrow

Returns

string

Overrides

SwapData.getClaimer


getClaimerBounty()

getClaimerBounty(): bigint;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:364

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

Overrides

SwapData.getClaimerBounty


getClaimHash()

getClaimHash(): string;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:300

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

Overrides

SwapData.getClaimHash


getConfirmationsHint()

getConfirmationsHint(): number;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:316

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

Overrides

SwapData.getConfirmationsHint


getDepositToken()

getDepositToken(): string;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:378

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

Returns

string

Overrides

SwapData.getDepositToken


getEscrowHash()

getEscrowHash(): string;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:284

Returns a unique hash of this escrow

Returns

string

Overrides

SwapData.getEscrowHash


getExpiry()

getExpiry(): bigint;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:256

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

Overrides

SwapData.getExpiry


getExtraData()

getExtraData(): string;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:343

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

Returns

string

Overrides

SwapData.getExtraData


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

Inherited from

SwapData.getHTLCHashHint


getNonceHint()

getNonceHint(): bigint;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:325

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

Overrides

SwapData.getNonceHint


getOfferer()

getOfferer(): string;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:169

Gets the offerer, which funds the escrow

Returns

string

Overrides

SwapData.getOfferer


getSecurityDeposit()

getSecurityDeposit(): bigint;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:357

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

Overrides

SwapData.getSecurityDeposit


getSequence()

getSequence(): bigint;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:309

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

Returns

bigint

Overrides

SwapData.getSequence


getToken()

getToken(): string;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:235

Gets the address of the deposited token in a vault

Returns

string

Overrides

SwapData.getToken


getTotalDeposit()

getTotalDeposit(): bigint;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:371

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

Overrides

SwapData.getTotalDeposit


getTxoHashHint()

getTxoHashHint(): string;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:334

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

Overrides

SwapData.getTxoHashHint


getType()

getType(): ChainSwapType;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:249

Returns the type of this escrow

Returns

ChainSwapType

Overrides

SwapData.getType


hasSuccessAction()

hasSuccessAction(): boolean;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:481

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

Returns

boolean

Overrides

SwapData.hasSuccessAction


isClaimData()

isClaimData(data): boolean;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:431

Checks if the passed data matches the swap's claim data.

Parameters

ParameterTypeDescription
datastring

Returns

boolean


isClaimer()

isClaimer(address): boolean;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:393

Checks whether the provided address is a claimer for this escrow

Parameters

ParameterTypeDescription
addressstring

Returns

boolean

Overrides

SwapData.isClaimer


isClaimHandler()

isClaimHandler(address): boolean;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:421

Checks whether the passed address is specified as the claim handler for the swap.

Parameters

ParameterTypeDescription
addressstring

Returns

boolean


isDepositToken()

isDepositToken(token): boolean;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:385

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

Parameters

ParameterTypeDescription
tokenstring

Returns

boolean

Overrides

SwapData.isDepositToken


isOfferer()

isOfferer(address): boolean;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:401

Checks whether the provided address is an offerer for this escrow

Parameters

ParameterTypeDescription
addressstring

Returns

boolean

Overrides

SwapData.isOfferer


isPayIn()

isPayIn(): boolean;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:263

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

Overrides

SwapData.isPayIn


isPayOut()

isPayOut(): boolean;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:270

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

Overrides

SwapData.isPayOut


isRefundHandler()

isRefundHandler(address): boolean;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:411

Checks whether the passed address is specified as the refund handler for the swap.

Parameters

ParameterTypeDescription
addressstring

Returns

boolean


isToken()

isToken(token): boolean;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:242

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

Parameters

ParameterTypeDescription
tokenstring

Returns

boolean

Overrides

SwapData.isToken


isTrackingReputation()

isTrackingReputation(): boolean;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:277

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

Returns

boolean

Overrides

SwapData.isTrackingReputation


serialize()

serialize(): any;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:201

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

Returns

any

Overrides

SwapData.serialize


setClaimer()

setClaimer(newClaimer): void;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:191

Sets the claimer which receives funds from the escrow

Parameters

ParameterTypeDescription
newClaimerstring

Returns

void

Overrides

SwapData.setClaimer


setExtraData()

setExtraData(extraData): void;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:350

Sets the extra data with hints for this escrow

Parameters

ParameterTypeDescription
extraDatastring

Returns

void

Overrides

SwapData.setExtraData


setOfferer()

setOfferer(newOfferer): void;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:176

Sets the offerer to fund the escrow

Parameters

ParameterTypeDescription
newOffererstring

Returns

void

Overrides

SwapData.setOfferer


toEscrowStruct()

toEscrowStruct(): EscrowDataStruct;

Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:460

Serializes the swap data into the EVM escrow-manager struct representation.

Returns

EscrowDataStruct