Skip to main content

EVMSwapData

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

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:63

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:83

Parameters​

ParameterType
dataany

Returns​

EVMSwapData

Overrides​

SwapData.constructor

Properties​

amount​

amount: bigint;

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


claimData​

claimData: string;

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


claimer​

claimer: string;

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


claimerBounty​

claimerBounty: bigint;

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


claimHandler​

claimHandler: string;

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


depositToken​

depositToken: string;

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


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:57


kind​

kind: ChainSwapType;

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


offerer​

offerer: string;

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


payIn​

payIn: boolean;

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


payOut​

payOut: boolean;

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


refundData​

refundData: string;

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


refundHandler​

refundHandler: string;

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


reputation​

reputation: boolean;

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


securityDeposit​

securityDeposit: bigint;

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


sequence​

sequence: bigint;

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


successActionCommitment​

successActionCommitment: string;

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


token​

token: string;

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

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:492

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:440

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:229

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:185

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:365

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:301

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:317

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:379

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:285

Returns a unique hash of this escrow

Returns​

string

Overrides​

SwapData.getEscrowHash


getEscrowStruct()​

getEscrowStruct(): any;

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

Returns the JSON-serialization safe representation of the underlying swap escrow struct committed (or to-be-committed) on-chain

Returns​

any

Overrides​

SwapData.getEscrowStruct


getExpiry()​

getExpiry(): bigint;

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

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:344

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:326

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:170

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:358

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:310

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:236

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:372

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:335

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:250

Returns the type of this escrow

Returns​

ChainSwapType

Overrides​

SwapData.getType


hasSuccessAction()​

hasSuccessAction(): boolean;

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

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:432

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:394

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:422

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:386

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:402

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:264

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:271

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:412

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:243

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:278

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:202

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:192

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:351

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:177

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:461

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

Returns​

EscrowDataStruct