SolanaSwapData
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:52
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:134
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:140
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:73
Swap amount.
claimer
claimer: PublicKey;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:65
Claimer address receiving the swap funds.
claimerAta?
optional claimerAta: PublicKey;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:109
Optional claimer associated token account.
claimerBounty
claimerBounty: BN;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:122
Claimer bounty amount.
confirmations
confirmations: number;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:93
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:85
Swap expiry timestamp.
kind
kind: number;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:101
Solana on-chain swap kind discriminator.
nonce
nonce: BN;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:89
Nonce used in claim hash derivation.
offerer
offerer: PublicKey;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:61
Offerer address funding the swap.
offererAta?
optional offererAta: PublicKey;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:113
Optional offerer associated token account.
payIn
payIn: boolean;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:105
Whether funds are paid in from offerer wallet.
paymentHash
paymentHash: string;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:77
Payment hash identifying the swap.
payOut
payOut: boolean;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:97
Whether funds are paid out to claimer wallet directly.
programId
programId: PublicKey;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:57
Program ID for which this swap data was created
securityDeposit
securityDeposit: BN;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:118
Security deposit amount.
sequence
sequence: BN;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:81
Swap sequence used for uniqueness.
token
token: PublicKey;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:69
Token mint used for the swap.
txoHash?
optional txoHash: string;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:127
Optional txo hash hint.
Methods
correctPDA()
correctPDA(account): boolean;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:410
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:433
Checks equality between 2 swap data objects
Parameters
| Parameter | Type | Description |
|---|---|---|
other | SolanaSwapData |
Returns
boolean
Overrides
fromEscrowState()
static fromEscrowState(programId, account): SolanaSwapData;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:513
Deserializes swap data from an on-chain escrow account state.
Parameters
| Parameter | Type | Description |
|---|---|---|
programId | PublicKey | |
account | IdlAccounts<SwapProgram> | Escrow account state as returned by Anchor |
Returns
SolanaSwapData
fromInstruction()
static fromInstruction(
programId,
initIx,
txoHash): SolanaSwapData;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:470
Converts initialize instruction data into SolanaSwapData.
Parameters
| Parameter | Type | Description |
|---|---|---|
programId | PublicKey | |
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:248
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:204
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:377
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:319
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:284
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:600
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:326
Returns a unique hash of this escrow
Returns
string
Overrides
getEscrowStruct()
getEscrowStruct(): any;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:614
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-solana/src/solana/swaps/SolanaSwapData.ts:276
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:356
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:348
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:291
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:188
Gets the offerer, which funds the escrow
Returns
string
Overrides
getSecurityDeposit()
getSecurityDeposit(): bigint;
Defined in: atomiq-chain-solana/src/solana/swaps/SolanaSwapData.ts:370
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:333
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:255
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:384
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:340
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:269
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:580
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:607
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:593
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:298
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:305
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:262
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:312
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:563
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:221
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:211
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:363
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:195
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:391
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:545
Converts abstract swap type to Solana program kind discriminator.
Parameters
| Parameter | Type | Description |
|---|---|---|
type | ChainSwapType | Chain-agnostic swap type |
Returns
number