|
1 | 1 | ## Jup Swap with Compressed Tokens - Demo
|
2 | 2 |
|
3 |
| -- Creates a single swap transaction with [additional instructions](https://github.com/Lightprotocol/example-jupiter-swap-node/blob/main/src/buildCompressedSwapTx.ts#L192-L200): `createInAtaIx`, `decompressIx`, `closeInAtaIx` |
4 |
| -- Accepts compressed tokens as tokenIn. |
5 |
| -- Cleans up ATA for tokenIn after swap. |
6 |
| -- Clean up ATA for tokenOut via `compressOutAtaIx` support is in progress. |
| 3 | +- Creates a single swap transaction with [additional instructions](https://github.com/Lightprotocol/example-jupiter-swap-node/blob/main/src/buildCompressedSwapTx.ts#L192-L200): `createTokenInAtaIx`, `createTokenOutAtaIx`, `decompressTokenInIx`, `compressTokenOutIx`, `closeTokenInAtaIx`, `closeTokenOutAtaIx` |
| 4 | +- Accepts compressed tokens as tokenIn |
| 5 | +- Returns compressed tokens as tokenOut |
| 6 | +- Cleans up intermediate ATAs for tokenIn after the swap |
| 7 | +- Cleans up ATA for tokenOut after the swap. |
| 8 | + |
| 9 | +to use the `compressTokenOutIx` feature, checkout [this branch](https://github.com/Lightprotocol/example-jupiter-swap-node/tree/use-compress-out-ata). |
7 | 10 |
|
8 | 11 | ### Notes
|
| 12 | + |
9 | 13 | - This e2e integration does not require on-chain changes to the Jup program.
|
10 | 14 | - Demo requires `directSwapsOnly=true` to avoid occasional tx size overruns (+ ~300 bytes overhead). This can be fixed by integrating natively in Jup's API for `setupInstructions` and `cleanupInstructions`.
|
| 15 | +- Future/Optional: `useSharedAccounts` could remove the need for intermediate ATA setup and cleanup. |
11 | 16 |
|
12 | 17 | ### Setup
|
13 | 18 |
|
|
23 | 28 |
|
24 | 29 | ```
|
25 | 30 | # get quotes, see tx size
|
26 |
| -ROUNDS=5 yarn dryrun # runs 5 rounds |
27 |
| -yarn dryrun # runs 1 round (default) |
| 31 | +yarn quote # runs 1 round (default) |
| 32 | +ROUNDS=5 yarn quote # runs 5 rounds |
| 33 | +COMPRESS_TOKEN_OUT=true yarn quote # uses compressTokenOutIx feature (default: false) |
28 | 34 | ```
|
29 | 35 |
|
30 | 36 | ```
|
31 | 37 | # also send and confirm
|
32 |
| -ROUNDS=5 yarn send # runs 5 rounds |
33 |
| -yarn send # runs 1 round (default) |
| 38 | +yarn swap # runs 1 round (default) |
| 39 | +ROUNDS=5 yarn swap # runs 5 rounds |
| 40 | +COMPRESS_TOKEN_OUT=true yarn swap # uses compressTokenOutIx feature (default: false) |
34 | 41 | ```
|
35 | 42 |
|
36 | 43 | ### Example tx sigs:
|
37 | 44 |
|
| 45 | +with compressTokenOutIx: |
| 46 | + |
| 47 | +- https://solscan.io/tx/47duf8bTsK7Fi6dQgeHbD3GwPXC1GFiiBnLEq1i6jSRtKcwc2by7Rxbx7dxkKeA6EyVuJf1b5BhL6EKgsSAzFKXG |
| 48 | +- https://solscan.io/tx/2qdBGCKhGnhSQKfoyiY3eHoChuHkQ7QtZpCR9m2CWTvLxwivxcRTNpUqtQkxPrWHd2ibh5QWwjsTjGnq7VsmAwzd |
| 49 | + |
| 50 | +without compressTokenOutIx: |
| 51 | + |
38 | 52 | - https://solscan.io/tx/4QiVMPKYQxZTQZagT6LDaooaUecSzFNTWkHM3UsQ7om2WvzqLWip3GQ5Gj8a4pYBuLD124RVnP2QKvp6EPRBidTK
|
39 | 53 | - https://solscan.io/tx/5JPv1k9HRqdzie8DcpYFFbwcLmdxYFu9rLpyrFFYii4AE6XPfrk59tgpRasZfykvLn6QgLhzBCKxFvBaNWTYRp4K
|
40 | 54 | - https://solscan.io/tx/3KVwEPz1XFxNifz7hptqQWSeM3vgxBDCj2v1SwLMjgRS9iKLi8mEoHzyuvcsAzMjPwLp9c3mizUy5hKYSKXELwuV
|
|
0 commit comments