Zap Functions
zapOut
Executes a generic zap out operation with custom parameters. Function- This is a generic function that can be used to zap out from any AMM program. In this example, we are using zap out of DAMM v2 pool.
zapOutThroughJupiter
Executes a zap out operation through Jupiter Aggregator v6. Function- This function is used to zap out through Jupiter Aggregator v6.
- The flow is as such:
- Get quote response from Jupiter API
- Get swap instruction from Jupiter API using quote response
- Get token programs for input and output mints
- Build zap transaction using the swap instruction
- Send zap transaction
zapOutThroughDammV2
Executes a zap out operation through DAMM v2 pool. Function- This function is used to zap out through DAMM v2 pool.
- The flow is as such:
- Get token programs for input mint
- Build zap transaction
- Send zap transaction
zapOutThroughDlmm
Executes a zap out operation through DLMM. Function- This function is used to zap out through DLMM.
- The flow is as such:
- Get token programs for input mint
- Build zap transaction
- Send zap transaction
Helper Functions
getTokenProgramFromMint
Get token program from mint. Function- This function is used to get token program from mint.
getJupiterQuote
Get Jupiter quote from Jupiter API. Function- This function is used to get Jupiter quote from Jupiter API.
- Any issues with the api you can check out Jupiter’s Quote API Documentation
getJupiterSwapInstruction
Get Jupiter swap instruction from Jupiter API. Function- This function is used to get Jupiter swap instruction from Jupiter API.
- Any issues with the api you can check out Jupiter’s Swap Instruction API Documentation