Skip to main content

SolanaSwapData

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:49

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

Extends

Constructors

Constructor

new SolanaSwapData(args): SolanaSwapData;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:127

Creates swap data from structured constructor arguments.

Parameters

ParameterTypeDescription
argsSolanaSwapDataCtorArgsSwap data fields

Returns

SolanaSwapData

Overrides

SwapData.constructor

Constructor

new SolanaSwapData(data): SolanaSwapData;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:133

Deserializes swap data from serialized storage representation.

Parameters

ParameterTypeDescription
dataobject & Serialized<SolanaSwapData>Serialized swap data from SolanaSwapData.serialize

Returns

SolanaSwapData

Overrides

SwapData.constructor

Properties

amount

amount: BN;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:66

Swap amount.


claimer

claimer: PublicKey;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:58

Claimer address receiving the swap funds.


claimerAta?

optional claimerAta: PublicKey;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:102

Optional claimer associated token account.


claimerBounty

claimerBounty: BN;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:115

Claimer bounty amount.


confirmations

confirmations: number;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:86

Required bitcoin confirmations for claim.


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


expiry

expiry: BN;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:78

Swap expiry timestamp.


kind

kind: number;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:94

Solana on-chain swap kind discriminator.


nonce

nonce: BN;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:82

Nonce used in claim hash derivation.


offerer

offerer: PublicKey;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:54

Offerer address funding the swap.


offererAta?

optional offererAta: PublicKey;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:106

Optional offerer associated token account.


payIn

payIn: boolean;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:98

Whether funds are paid in from offerer wallet.


paymentHash

paymentHash: string;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:70

Payment hash identifying the swap.


payOut

payOut: boolean;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:90

Whether funds are paid out to claimer wallet directly.


securityDeposit

securityDeposit: BN;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:111

Security deposit amount.


sequence

sequence: BN;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:74

Swap sequence used for uniqueness.


token

token: PublicKey;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:62

Token mint used for the swap.


txoHash?

optional txoHash: string;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:120

Optional txo hash hint.

Methods

correctPDA()

correctPDA(account): boolean;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:400

Checks whether the provided escrow account matches this swap data.

Parameters

ParameterTypeDescription
accountIdlAccounts<SwapProgram>Escrow account data fetched from chain

Returns

boolean


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


equals()

equals(other): boolean;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:423

Checks equality between 2 swap data objects

Parameters

ParameterTypeDescription
otherSolanaSwapData

Returns

boolean

Overrides

SwapData.equals


fromEscrowState()

static fromEscrowState(account): SolanaSwapData;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:499

Deserializes swap data from an on-chain escrow account state.

Parameters

ParameterTypeDescription
accountIdlAccounts<SwapProgram>Escrow account state as returned by Anchor

Returns

SolanaSwapData


fromInstruction()

static fromInstruction(initIx, txoHash): SolanaSwapData;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:459

Converts initialize instruction data into SolanaSwapData.

Parameters

ParameterTypeDescription
initIxInitInstructionDecoded initialize instruction
txoHashstringParsed txo hash hint from initialize event

Returns

SolanaSwapData

Converted and parsed swap data


getAmount()

getAmount(): bigint;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:238

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

Returns

bigint

Overrides

SwapData.getAmount


getClaimer()

getClaimer(): string;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:195

Gets the claim, which receives funds from the escrow

Returns

string

Overrides

SwapData.getClaimer


getClaimerBounty()

getClaimerBounty(): bigint;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:367

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-solana/src/solana/swaps/SolanaSwapData.ts:309

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-solana/src/solana/swaps/SolanaSwapData.ts:274

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-solana/src/solana/swaps/SolanaSwapData.ts:582

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-solana/src/solana/swaps/SolanaSwapData.ts:316

Returns a unique hash of this escrow

Returns

string

Overrides

SwapData.getEscrowHash


getExpiry()

getExpiry(): bigint;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:266

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-solana/src/solana/swaps/SolanaSwapData.ts:346

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-chain-solana/src/solana/swaps/SolanaSwapData.ts:338

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

Overrides

SwapData.getHTLCHashHint


getNonceHint()

getNonceHint(): bigint;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:281

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-solana/src/solana/swaps/SolanaSwapData.ts:179

Gets the offerer, which funds the escrow

Returns

string

Overrides

SwapData.getOfferer


getSecurityDeposit()

getSecurityDeposit(): bigint;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:360

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-solana/src/solana/swaps/SolanaSwapData.ts:323

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-solana/src/solana/swaps/SolanaSwapData.ts:245

Gets the address of the deposited token in a vault

Returns

string

Overrides

SwapData.getToken


getTotalDeposit()

getTotalDeposit(): bigint;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:374

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-solana/src/solana/swaps/SolanaSwapData.ts:330

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-solana/src/solana/swaps/SolanaSwapData.ts:259

Returns the type of this escrow

Returns

ChainSwapType

Overrides

SwapData.getType


hasSuccessAction()

hasSuccessAction(): boolean;

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

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

Returns

boolean

Inherited from

SwapData.hasSuccessAction


isClaimer()

isClaimer(address): any;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:562

Checks whether the provided address is a claimer for this escrow

Parameters

ParameterTypeDescription
addressstring

Returns

any

Overrides

SwapData.isClaimer


isDepositToken()

isDepositToken(token): boolean;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:589

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): any;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:575

Checks whether the provided address is an offerer for this escrow

Parameters

ParameterTypeDescription
addressstring

Returns

any

Overrides

SwapData.isOfferer


isPayIn()

isPayIn(): boolean;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:288

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-solana/src/solana/swaps/SolanaSwapData.ts:295

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


isToken()

isToken(token): boolean;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:252

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-solana/src/solana/swaps/SolanaSwapData.ts:302

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

Returns

boolean

Overrides

SwapData.isTrackingReputation


kindToType()

static kindToType(value): ChainSwapType;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:545

Converts Solana program kind discriminator to abstract swap type.

Parameters

ParameterTypeDescription
valuenumberSolana program swap kind value

Returns

ChainSwapType


serialize()

serialize(): object & Serialized<SolanaSwapData>;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:212

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

Returns

object & Serialized<SolanaSwapData>

Overrides

SwapData.serialize


setClaimer()

setClaimer(newClaimer): void;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:202

Sets the claimer which receives funds from the escrow

Parameters

ParameterTypeDescription
newClaimerstring

Returns

void

Overrides

SwapData.setClaimer


setExtraData()

setExtraData(txoHash): void;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:353

Sets the extra data with hints for this escrow

Parameters

ParameterTypeDescription
txoHashstring

Returns

void

Overrides

SwapData.setExtraData


setOfferer()

setOfferer(newOfferer): void;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:186

Sets the offerer to fund the escrow

Parameters

ParameterTypeDescription
newOffererstring

Returns

void

Overrides

SwapData.setOfferer


toSwapDataStruct()

toSwapDataStruct(): IdlTypes<SwapProgram>;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:381

Serializes the swap data into the Solana program SwapData struct representation.

Returns

IdlTypes<SwapProgram>


typeToKind()

static typeToKind(type): number;

Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:527

Converts abstract swap type to Solana program kind discriminator.

Parameters

ParameterTypeDescription
typeChainSwapTypeChain-agnostic swap type

Returns

number