SPLTokenSwapProgram class

Instructions supported by the token swap program.

Inheritance

Constructors

SPLTokenSwapProgram({required List<AccountMeta> keys, required SolAddress programId, required ProgramLayout layout})
SPLTokenSwapProgram.create({required SolAddress tokenSwapAccount, required SolAddress authority, required SolAddress tokenAccountA, required SolAddress tokenAccountB, required SolAddress tokenPool, required SolAddress feeAccount, required SolAddress tokenAccountPool, required SolAddress poolTokenProgramId, required SolAddress swapProgramId, required SPLTokenSwapInitSwapLayout layout})
Initializes a new swap
factory
SPLTokenSwapProgram.depoitSingleToken({required SolAddress tokenSwap, required SolAddress authority, required SolAddress userTransferAuthority, required SolAddress source, required SolAddress intoA, required SolAddress intoB, required SolAddress poolToken, required SolAddress poolAccount, required SolAddress sourceMint, required SolAddress sourceTokenProgramId, required SolAddress poolTokenProgramId, required SPLTokenSwapDepositSingleTokenLayout layout, required SolAddress swapProgramId})
Deposit one type of tokens into the pool. The output is a "pool" token representing ownership into the pool. Input token is converted as if a swap and deposit all token types were performed.
factory
SPLTokenSwapProgram.deposit({required SolAddress tokenSwap, required SolAddress authority, required SolAddress userTransferAuthority, required SolAddress sourceA, required SolAddress sourceB, required SolAddress intoA, required SolAddress intoB, required SolAddress poolToken, required SolAddress poolAccount, required SolAddress mintA, required SolAddress mintB, required SolAddress swapProgramId, required SolAddress tokenProgramIdA, required SolAddress tokenProgramIdB, required SolAddress poolTokenProgramId, required SPLTokenSwapDepositLayout layout})
Deposit both types of tokens into the pool. The output is a "pool" token representing ownership in the pool. Inputs are converted to the current ratio.
factory
SPLTokenSwapProgram.fromBytes({required List<AccountMeta> keys, required List<int> instructionBytes, required SolAddress programId})
factory
SPLTokenSwapProgram.swap({required SolAddress tokenSwap, required SolAddress authority, required SolAddress userTransferAuthority, required SolAddress userSource, required SolAddress poolSource, required SolAddress poolDestination, required SolAddress userDestination, required SolAddress poolMint, required SolAddress feeAccount, required SolAddress sourceMint, required SolAddress destinationMint, required SolAddress sourceTokenProgramId, required SolAddress destinationTokenProgramId, required SolAddress poolTokenProgramId, required SPLTokenSwapSwapLayout layout, required SolAddress swapProgramId, SolAddress? hostFeeAccount})
Swap the tokens in the pool.
factory
SPLTokenSwapProgram.withdraw({required SolAddress tokenSwap, required SolAddress authority, required SolAddress userTransferAuthority, required SolAddress poolMint, required SolAddress feeAccount, required SolAddress sourcePoolAccount, required SolAddress fromA, required SolAddress fromB, required SolAddress userAccountA, required SolAddress userAccountB, required SolAddress mintA, required SolAddress mintB, required SolAddress poolTokenProgramId, required SolAddress tokenProgramIdA, required SolAddress tokenProgramIdB, required SPLTokenSwapWithdrawLayout layout, required SolAddress swapProgramId})
Withdraw both types of tokens from the pool at the current ratio, given pool tokens. The pool tokens are burned in exchange for an equivalent amount of token A and B.
factory
SPLTokenSwapProgram.withdrawSingleToken({required SolAddress tokenSwap, required SolAddress authority, required SolAddress userTransferAuthority, required SolAddress poolMint, required SolAddress feeAccount, required SolAddress sourcePoolAccount, required SolAddress fromA, required SolAddress fromB, required SolAddress destinationAccount, required SolAddress destinationMint, required SolAddress poolTokenProgramId, required SolAddress destinationTokenProgramId, required SPLTokenSwapWithdrawSingleTokenLayout layout, required SolAddress swapProgramId})
Withdraw one token type from the pool at the current ratio given the exact amount out expected.
factory

Properties

data List<int>
Program input.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
keys List<AccountMeta>
Public keys to include in this transaction Boolean represents whether this pubkey needs to sign the transaction
finalinherited
layout ProgramLayout
Program layout.
finalinherited
programId SolAddress
Program Id to execute.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited