Skip to content

Commit ed237bc

Browse files
feat(sdk): add Jupiter tracking account support (#1019)
Synced from glamsystems/glam cdc8813e34402223694fd6d7d2dd0641c32d8945
1 parent 02cbb6e commit ed237bc

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/cmds/jupiter.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
TokenListItem,
66
fromUiAmount,
77
} from "@glamsystems/glam-sdk";
8+
import { PublicKey } from "@solana/web3.js";
89
import { Command } from "commander";
910
import {
1011
CliContext,
@@ -207,12 +208,19 @@ export function installJupiterCommands(program: Command, context: CliContext) {
207208
)
208209
.option("--use-v1", "Use v1 instruction (default: v2)", false)
209210
.option("-d, --only-direct-routes", "Direct routes only")
211+
.option("-t, --tracking-account <pubkey>", "Tracking account public key")
210212
.option("-y, --yes", "Skip confirmation", false)
211213
.action(async (from, to, amount, options) => {
212214
const jupApi = context.glamClient.jupiterSwap.jupApi;
213215
const tokenFrom = await findToken(jupApi, from);
214216
const tokenTo = await findToken(jupApi, to);
215-
const { maxAccounts, slippageBps, onlyDirectRoutes, useV1 } = options;
217+
const {
218+
maxAccounts,
219+
slippageBps,
220+
onlyDirectRoutes,
221+
useV1,
222+
trackingAccount,
223+
} = options;
216224

217225
const quoteParams = {
218226
inputMint: tokenFrom.address,
@@ -230,7 +238,12 @@ export function installJupiterCommands(program: Command, context: CliContext) {
230238
await executeTxWithErrorHandling(
231239
() =>
232240
context.glamClient.jupiterSwap.swap(
233-
{ quoteParams },
241+
{
242+
quoteParams,
243+
trackingAccount: trackingAccount
244+
? new PublicKey(trackingAccount)
245+
: undefined,
246+
},
234247
context.txOptions,
235248
),
236249
{

0 commit comments

Comments
 (0)