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
| Parameter | Type |
|---|---|
offerer | string |
claimer | string |
token | string |
refundHandler | string |
claimHandler | string |
payOut | boolean |
payIn | boolean |
reputation | boolean |
sequence | bigint |
claimData | string |
refundData | string |
amount | bigint |
depositToken | string |
securityDeposit | bigint |
claimerBounty | bigint |
kind | ChainSwapType |
extraData? | string |
successActionCommitment? | string |
Returns
EVMSwapData
Overrides
Constructor
new EVMSwapData(data): EVMSwapData;
Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:83
Parameters
| Parameter | Type |
|---|---|
data | any |
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
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
| Parameter | Type | Description |
|---|---|---|
data | any |
Returns
T
Inherited from
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
| Parameter | Type | Description |
|---|---|---|
struct | EscrowDataStruct | Escrow struct as returned by the contract |
claimHandlerImpl | IClaimHandler<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
| Parameter | Type | Description |
|---|---|---|
other | EVMSwapData |
Returns
boolean
Overrides
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
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
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
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
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
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
getEscrowHash()
getEscrowHash(): string;
Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:285
Returns a unique hash of this escrow
Returns
string
Overrides
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
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
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
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
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
getOfferer()
getOfferer(): string;
Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:170
Gets the offerer, which funds the escrow
Returns
string
Overrides
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
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
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
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
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
getType()
getType(): ChainSwapType;
Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:250
Returns the type of this escrow
Returns
ChainSwapType
Overrides
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
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
| Parameter | Type | Description |
|---|---|---|
data | string |
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
| Parameter | Type | Description |
|---|---|---|
address | string |
Returns
boolean
Overrides
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
| Parameter | Type | Description |
|---|---|---|
address | string |
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
| Parameter | Type | Description |
|---|---|---|
token | string |
Returns
boolean
Overrides
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
| Parameter | Type | Description |
|---|---|---|
address | string |
Returns
boolean
Overrides
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
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
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
| Parameter | Type | Description |
|---|---|---|
address | string |
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
| Parameter | Type | Description |
|---|---|---|
token | string |
Returns
boolean
Overrides
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
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
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
| Parameter | Type | Description |
|---|---|---|
newClaimer | string |
Returns
void
Overrides
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
| Parameter | Type | Description |
|---|---|---|
extraData | string |
Returns
void
Overrides
setOfferer()
setOfferer(newOfferer): void;
Defined in: atomiq-chain-evm/src/evm/swaps/EVMSwapData.ts:177
Sets the offerer to fund the escrow
Parameters
| Parameter | Type | Description |
|---|---|---|
newOfferer | string |
Returns
void
Overrides
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