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
| Parameter | Type | Description |
|---|---|---|
args | SolanaSwapDataCtorArgs | Swap data fields |
Returns
SolanaSwapData
Overrides
Constructor
new SolanaSwapData(data): SolanaSwapData;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:133
Deserializes swap data from serialized storage representation.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | object & 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
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
| Parameter | Type | Description |
|---|---|---|
account | IdlAccounts<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
| Parameter | Type | Description |
|---|---|---|
data | any |
Returns
T
Inherited from
equals()
equals(other): boolean;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:423
Checks equality between 2 swap data objects
Parameters
| Parameter | Type | Description |
|---|---|---|
other | SolanaSwapData |
Returns
boolean
Overrides
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
| Parameter | Type | Description |
|---|---|---|
account | IdlAccounts<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
| Parameter | Type | Description |
|---|---|---|
initIx | InitInstruction | Decoded initialize instruction |
txoHash | string | Parsed 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
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
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
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
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
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
getEscrowHash()
getEscrowHash(): string;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:316
Returns a unique hash of this escrow
Returns
string
Overrides
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
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
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
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
getOfferer()
getOfferer(): string;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:179
Gets the offerer, which funds the escrow
Returns
string
Overrides
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
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
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
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
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
getType()
getType(): ChainSwapType;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:259
Returns the type of this escrow
Returns
ChainSwapType
Overrides
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
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
| Parameter | Type | Description |
|---|---|---|
address | string |
Returns
any
Overrides
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
| Parameter | Type | Description |
|---|---|---|
token | string |
Returns
boolean
Overrides
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
| Parameter | Type | Description |
|---|---|---|
address | string |
Returns
any
Overrides
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
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
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
| Parameter | Type | Description |
|---|---|---|
token | string |
Returns
boolean
Overrides
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
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
| Parameter | Type | Description |
|---|---|---|
value | number | Solana 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
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
| Parameter | Type | Description |
|---|---|---|
newClaimer | string |
Returns
void
Overrides
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
| Parameter | Type | Description |
|---|---|---|
txoHash | string |
Returns
void
Overrides
setOfferer()
setOfferer(newOfferer): void;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:186
Sets the offerer to fund the escrow
Parameters
| Parameter | Type | Description |
|---|---|---|
newOfferer | string |
Returns
void
Overrides
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
| Parameter | Type | Description |
|---|---|---|
type | ChainSwapType | Chain-agnostic swap type |
Returns
number