@velocity-exchange/sdk 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/lib/browser/adminClient.d.ts +2 -2
  2. package/lib/browser/adminClient.js +3 -11
  3. package/lib/browser/equityFloorManager.d.ts +9 -5
  4. package/lib/browser/equityFloorManager.js +9 -5
  5. package/lib/browser/idl/velocity.d.ts +2 -1
  6. package/lib/browser/idl/velocity.json +2 -1
  7. package/lib/browser/index.d.ts +2 -0
  8. package/lib/browser/index.js +3 -0
  9. package/lib/browser/jupiter/jupiterClient.d.ts +31 -27
  10. package/lib/browser/jupiter/jupiterClient.js +61 -35
  11. package/lib/browser/math/margin.d.ts +12 -10
  12. package/lib/browser/math/margin.js +16 -14
  13. package/lib/browser/math/superStake.d.ts +9 -9
  14. package/lib/browser/math/superStake.js +8 -8
  15. package/lib/browser/swap/UnifiedSwapClient.d.ts +38 -76
  16. package/lib/browser/swap/UnifiedSwapClient.js +46 -117
  17. package/lib/browser/swap/routeInstructions.d.ts +19 -0
  18. package/lib/browser/swap/routeInstructions.js +43 -0
  19. package/lib/browser/swap/types.d.ts +196 -0
  20. package/lib/browser/swap/types.js +88 -0
  21. package/lib/browser/titan/titanClient.d.ts +32 -68
  22. package/lib/browser/titan/titanClient.js +128 -102
  23. package/lib/browser/user.d.ts +16 -18
  24. package/lib/browser/user.js +24 -26
  25. package/lib/browser/velocityClient.d.ts +83 -101
  26. package/lib/browser/velocityClient.js +152 -289
  27. package/lib/node/adminClient.d.ts +2 -2
  28. package/lib/node/adminClient.d.ts.map +1 -1
  29. package/lib/node/adminClient.js +3 -11
  30. package/lib/node/equityFloorManager.d.ts +9 -5
  31. package/lib/node/equityFloorManager.d.ts.map +1 -1
  32. package/lib/node/equityFloorManager.js +9 -5
  33. package/lib/node/idl/velocity.d.ts +2 -1
  34. package/lib/node/idl/velocity.d.ts.map +1 -1
  35. package/lib/node/idl/velocity.json +2 -1
  36. package/lib/node/index.d.ts +2 -0
  37. package/lib/node/index.d.ts.map +1 -1
  38. package/lib/node/index.js +3 -0
  39. package/lib/node/jupiter/jupiterClient.d.ts +31 -27
  40. package/lib/node/jupiter/jupiterClient.d.ts.map +1 -1
  41. package/lib/node/jupiter/jupiterClient.js +61 -35
  42. package/lib/node/math/margin.d.ts +12 -10
  43. package/lib/node/math/margin.d.ts.map +1 -1
  44. package/lib/node/math/margin.js +16 -14
  45. package/lib/node/math/superStake.d.ts +9 -9
  46. package/lib/node/math/superStake.d.ts.map +1 -1
  47. package/lib/node/math/superStake.js +8 -8
  48. package/lib/node/swap/UnifiedSwapClient.d.ts +38 -76
  49. package/lib/node/swap/UnifiedSwapClient.d.ts.map +1 -1
  50. package/lib/node/swap/UnifiedSwapClient.js +46 -117
  51. package/lib/node/swap/routeInstructions.d.ts +20 -0
  52. package/lib/node/swap/routeInstructions.d.ts.map +1 -0
  53. package/lib/node/swap/routeInstructions.js +43 -0
  54. package/lib/node/swap/types.d.ts +197 -0
  55. package/lib/node/swap/types.d.ts.map +1 -0
  56. package/lib/node/swap/types.js +88 -0
  57. package/lib/node/titan/titanClient.d.ts +32 -68
  58. package/lib/node/titan/titanClient.d.ts.map +1 -1
  59. package/lib/node/titan/titanClient.js +128 -102
  60. package/lib/node/user.d.ts +16 -18
  61. package/lib/node/user.d.ts.map +1 -1
  62. package/lib/node/user.js +24 -26
  63. package/lib/node/velocityClient.d.ts +83 -101
  64. package/lib/node/velocityClient.d.ts.map +1 -1
  65. package/lib/node/velocityClient.js +152 -289
  66. package/package.json +1 -1
@@ -1,66 +1,23 @@
1
- import { Connection, PublicKey, TransactionMessage, AddressLookupTableAccount, VersionedTransaction, TransactionInstruction } from '@solana/web3.js';
2
- import { BN } from '../isomorphic/anchor';
1
+ import { Connection, VersionedTransaction } from '@solana/web3.js';
3
2
  import { JupiterClient } from '../jupiter/jupiterClient';
4
3
  import { TitanClient } from '../titan/titanClient';
5
- export type SwapMode = 'ExactIn' | 'ExactOut';
6
- export type SwapClientType = 'jupiter' | 'titan';
4
+ import { GetRouteInstructionsParams, SwapClientType, SwapProvider, SwapQuote, SwapQuoteParams, SwapRouteInstructions } from './types';
5
+ export type { GetRouteInstructionsParams, SwapProviderRoute, SwapClientType, SwapMode, SwapProvider, SwapQuote, SwapQuoteParams, SwapRouteInstructions, UnifiedQuoteResponse, } from './types';
6
+ /** Byte budget handed to a swap provider for the route portion of the tx. */
7
+ export declare const DEFAULT_ROUTE_SIZE_CONSTRAINT: number;
7
8
  /**
8
- * Unified quote response interface that combines properties from both Jupiter and Titan
9
- * This provides a consistent interface while allowing for provider-specific fields
9
+ * Routes swap calls to the configured provider.
10
+ *
11
+ * Intentionally thin: it picks a provider and forwards. Anything that varies
12
+ * between Jupiter and Titan belongs in the provider, behind
13
+ * {@link SwapProvider} — branching on the provider here is how the two paths
14
+ * drifted apart previously, since nothing forced them to keep the same
15
+ * semantics.
10
16
  */
11
- export interface UnifiedQuoteResponse {
12
- inputMint: string;
13
- inAmount: string;
14
- outputMint: string;
15
- outAmount: string;
16
- swapMode: SwapMode;
17
- slippageBps: number;
18
- routePlan: Array<{
19
- swapInfo: any;
20
- percent: number;
21
- }>;
22
- otherAmountThreshold?: string;
23
- priceImpactPct?: string;
24
- platformFee?: {
25
- amount?: string;
26
- feeBps?: number;
27
- };
28
- contextSlot?: number;
29
- timeTaken?: number;
30
- error?: string;
31
- errorCode?: string;
32
- }
33
- export interface SwapQuoteParams {
34
- inputMint: PublicKey;
35
- outputMint: PublicKey;
36
- amount: BN;
37
- userPublicKey?: PublicKey;
38
- maxAccounts?: number;
39
- slippageBps?: number;
40
- swapMode?: SwapMode;
41
- onlyDirectRoutes?: boolean;
42
- excludeDexes?: string[];
43
- sizeConstraint?: number;
44
- accountsLimitWritable?: number;
45
- autoSlippage?: boolean;
46
- maxAutoSlippageBps?: number;
47
- usdEstimate?: number;
48
- }
49
- export interface SwapTransactionParams {
50
- quote: UnifiedQuoteResponse;
51
- userPublicKey: PublicKey;
52
- slippageBps?: number;
53
- }
54
- export interface SwapTransactionResult {
55
- transaction?: VersionedTransaction;
56
- transactionMessage?: TransactionMessage;
57
- lookupTables?: AddressLookupTableAccount[];
58
- }
59
- export declare class UnifiedSwapClient {
17
+ export declare class UnifiedSwapClient implements SwapProvider {
60
18
  private client;
61
19
  private clientType;
62
20
  /**
63
- * Create a unified swap client
64
21
  * @param clientType - 'jupiter' or 'titan'
65
22
  * @param connection - Solana connection
66
23
  * @param authToken - For Titan: auth token (required when not using proxy). For Jupiter: API key (required for api.jup.ag, get free key at https://portal.jup.ag)
@@ -74,32 +31,37 @@ export declare class UnifiedSwapClient {
74
31
  url?: string;
75
32
  proxyUrl?: string;
76
33
  });
34
+ get providerName(): SwapClientType;
35
+ /**
36
+ * The configured client, seen only as {@link SwapProvider}.
37
+ *
38
+ * Forwarding through the interface rather than the concrete union is what
39
+ * makes goal of this class enforceable: a provider added to the union that
40
+ * implements only part of the contract fails to compile here, instead of
41
+ * resolving against whichever call signatures the union happens to share.
42
+ */
43
+ private get provider();
77
44
  /**
78
- * Get a swap quote from the underlying client
45
+ * Get a swap quote from the configured provider.
46
+ *
47
+ * Provider-specific fields on {@link SwapQuoteParams} are mapped by the
48
+ * provider, so the ones it doesn't recognise are simply ignored.
79
49
  */
80
- getQuote(params: SwapQuoteParams): Promise<UnifiedQuoteResponse>;
50
+ getQuote(params: SwapQuoteParams): Promise<SwapQuote>;
81
51
  /**
82
- * Get a swap transaction from the underlying client
52
+ * Builds the route instructions for a quote from {@link getQuote}, at the
53
+ * slippage that quote was priced at.
54
+ * @throws If the quote came from a different provider or a different wallet.
83
55
  */
84
- getSwap(params: SwapTransactionParams): Promise<SwapTransactionResult>;
56
+ getRouteInstructions(params: GetRouteInstructionsParams): Promise<SwapRouteInstructions>;
85
57
  /**
86
- * Get swap instructions from the underlying client (Jupiter or Titan)
87
- * This is the core swap logic without any context preparation
58
+ * Builds a standalone swap transaction for a quote from {@link getQuote},
59
+ * keeping the provider's own compute budget, token account creation and SOL
60
+ * wrapping. Use {@link getRouteInstructions} for a swap that runs inside
61
+ * velocity's `beginSwap`/`endSwap` bracket.
62
+ * @throws If the quote came from a different provider or a different wallet.
88
63
  */
89
- getSwapInstructions({ inputMint, outputMint, amount, userPublicKey, slippageBps, swapMode, onlyDirectRoutes, quote, sizeConstraint, }: {
90
- inputMint: PublicKey;
91
- outputMint: PublicKey;
92
- amount: BN;
93
- userPublicKey: PublicKey;
94
- slippageBps?: number;
95
- swapMode?: SwapMode;
96
- onlyDirectRoutes?: boolean;
97
- quote?: UnifiedQuoteResponse;
98
- sizeConstraint?: number;
99
- }): Promise<{
100
- instructions: TransactionInstruction[];
101
- lookupTables: AddressLookupTableAccount[];
102
- }>;
64
+ getSwapTransaction(params: GetRouteInstructionsParams): Promise<VersionedTransaction>;
103
65
  /**
104
66
  * Get the underlying client instance
105
67
  */
@@ -1 +1 @@
1
- {"version":3,"file":"UnifiedSwapClient.d.ts","sourceRoot":"","sources":["../../../src/swap/UnifiedSwapClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,UAAU,EACV,SAAS,EACT,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,EACpB,sBAAsB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,EAAE,EAAE,MAAM,sBAAsB,CAAC;AAC1C,OAAO,EACN,aAAa,EAEb,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,WAAW,EAA6B,MAAM,sBAAsB,CAAC;AAG9E,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;AAC9C,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,OAAO,CAAC;AAYjD;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IAEpC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,QAAQ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;IAOlE;;;;OAIG;IACU,oBAAoB,CAChC,MAAM,EAAE,0BAA0B,GAChC,OAAO,CAAC,qBAAqB,CAAC;IAIjC;;;;;;OAMG;IACU,kBAAkB,CAC9B,MAAM,EAAE,0BAA0B,GAChC,OAAO,CAAC,oBAAoB,CAAC;IAIhC;;OAEG;IACI,SAAS,IAAI,aAAa,GAAG,WAAW;IAI/C;;OAEG;IACI,aAAa,IAAI,cAAc;IAItC;;OAEG;IACI,SAAS,IAAI,OAAO;IAI3B;;OAEG;IACI,OAAO,IAAI,OAAO;CAGzB"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnifiedSwapClient = void 0;
3
+ exports.UnifiedSwapClient = exports.DEFAULT_ROUTE_SIZE_CONSTRAINT = void 0;
4
4
  const jupiterClient_1 = require("../jupiter/jupiterClient");
5
5
  const titanClient_1 = require("../titan/titanClient");
6
6
  const utils_1 = require("../tx/utils");
@@ -10,10 +10,18 @@ const utils_1 = require("../tx/utils");
10
10
  */
11
11
  const VELOCITY_SWAP_IX_SIZE_BUFFER = 375;
12
12
  /** Byte budget handed to a swap provider for the route portion of the tx. */
13
- const DEFAULT_ROUTE_SIZE_CONSTRAINT = utils_1.MAX_TX_BYTE_SIZE - VELOCITY_SWAP_IX_SIZE_BUFFER;
13
+ exports.DEFAULT_ROUTE_SIZE_CONSTRAINT = utils_1.MAX_TX_BYTE_SIZE - VELOCITY_SWAP_IX_SIZE_BUFFER;
14
+ /**
15
+ * Routes swap calls to the configured provider.
16
+ *
17
+ * Intentionally thin: it picks a provider and forwards. Anything that varies
18
+ * between Jupiter and Titan belongs in the provider, behind
19
+ * {@link SwapProvider} — branching on the provider here is how the two paths
20
+ * drifted apart previously, since nothing forced them to keep the same
21
+ * semantics.
22
+ */
14
23
  class UnifiedSwapClient {
15
24
  /**
16
- * Create a unified swap client
17
25
  * @param clientType - 'jupiter' or 'titan'
18
26
  * @param connection - Solana connection
19
27
  * @param authToken - For Titan: auth token (required when not using proxy). For Jupiter: API key (required for api.jup.ag, get free key at https://portal.jup.ag)
@@ -41,129 +49,50 @@ class UnifiedSwapClient {
41
49
  throw new Error(`Unsupported client type: ${clientType}`);
42
50
  }
43
51
  }
52
+ get providerName() {
53
+ return this.clientType;
54
+ }
55
+ /**
56
+ * The configured client, seen only as {@link SwapProvider}.
57
+ *
58
+ * Forwarding through the interface rather than the concrete union is what
59
+ * makes goal of this class enforceable: a provider added to the union that
60
+ * implements only part of the contract fails to compile here, instead of
61
+ * resolving against whichever call signatures the union happens to share.
62
+ */
63
+ get provider() {
64
+ return this.client;
65
+ }
44
66
  /**
45
- * Get a swap quote from the underlying client
67
+ * Get a swap quote from the configured provider.
68
+ *
69
+ * Provider-specific fields on {@link SwapQuoteParams} are mapped by the
70
+ * provider, so the ones it doesn't recognise are simply ignored.
46
71
  */
47
72
  async getQuote(params) {
48
- if (this.clientType === 'jupiter') {
49
- const jupiterClient = this.client;
50
- const { userPublicKey: _userPublicKey, // Not needed for Jupiter
51
- sizeConstraint: _sizeConstraint, // Jupiter-specific params to exclude
52
- accountsLimitWritable: _accountsLimitWritable, ...jupiterParams } = params;
53
- return await jupiterClient.getQuote(jupiterParams);
54
- }
55
- else {
56
- const titanClient = this.client;
57
- const { autoSlippage: _autoSlippage, // Titan-specific params to exclude
58
- maxAutoSlippageBps: _maxAutoSlippageBps, usdEstimate: _usdEstimate, ...titanParams } = params;
59
- if (!titanParams.userPublicKey) {
60
- throw new Error('userPublicKey is required for Titan quotes');
61
- }
62
- // Cast to ensure TypeScript knows userPublicKey is defined
63
- const titanParamsWithUser = {
64
- ...titanParams,
65
- userPublicKey: titanParams.userPublicKey,
66
- swapMode: titanParams.swapMode, // Titan expects string
67
- sizeConstraint: titanParams.sizeConstraint || DEFAULT_ROUTE_SIZE_CONSTRAINT,
68
- };
69
- return await titanClient.getQuote(titanParamsWithUser);
70
- }
73
+ var _a;
74
+ return this.provider.getQuote({
75
+ ...params,
76
+ sizeConstraint: (_a = params.sizeConstraint) !== null && _a !== void 0 ? _a : exports.DEFAULT_ROUTE_SIZE_CONSTRAINT,
77
+ });
71
78
  }
72
79
  /**
73
- * Get a swap transaction from the underlying client
80
+ * Builds the route instructions for a quote from {@link getQuote}, at the
81
+ * slippage that quote was priced at.
82
+ * @throws If the quote came from a different provider or a different wallet.
74
83
  */
75
- async getSwap(params) {
76
- if (this.clientType === 'jupiter') {
77
- const jupiterClient = this.client;
78
- // Cast the quote to Jupiter's specific QuoteResponse type
79
- const jupiterParams = {
80
- ...params,
81
- quote: params.quote,
82
- };
83
- const transaction = await jupiterClient.getSwap(jupiterParams);
84
- return { transaction };
85
- }
86
- else {
87
- const titanClient = this.client;
88
- const { userPublicKey } = params;
89
- // For Titan, we need to reconstruct the parameters from the quote
90
- const result = await titanClient.getSwap({
91
- userPublicKey,
92
- });
93
- return {
94
- transactionMessage: result.transactionMessage,
95
- lookupTables: result.lookupTables,
96
- };
97
- }
84
+ async getRouteInstructions(params) {
85
+ return this.provider.getRouteInstructions(params);
98
86
  }
99
87
  /**
100
- * Get swap instructions from the underlying client (Jupiter or Titan)
101
- * This is the core swap logic without any context preparation
88
+ * Builds a standalone swap transaction for a quote from {@link getQuote},
89
+ * keeping the provider's own compute budget, token account creation and SOL
90
+ * wrapping. Use {@link getRouteInstructions} for a swap that runs inside
91
+ * velocity's `beginSwap`/`endSwap` bracket.
92
+ * @throws If the quote came from a different provider or a different wallet.
102
93
  */
103
- async getSwapInstructions({ inputMint, outputMint, amount, userPublicKey, slippageBps, swapMode = 'ExactIn', onlyDirectRoutes = false, quote, sizeConstraint, }) {
104
- const isExactOut = swapMode === 'ExactOut';
105
- let swapInstructions;
106
- let lookupTables;
107
- if (this.clientType === 'jupiter') {
108
- const jupiterClient = this.client;
109
- // Get quote if not provided
110
- let finalQuote = quote;
111
- if (!finalQuote) {
112
- finalQuote = await jupiterClient.getQuote({
113
- inputMint,
114
- outputMint,
115
- amount,
116
- slippageBps,
117
- swapMode,
118
- onlyDirectRoutes,
119
- });
120
- }
121
- if (!finalQuote) {
122
- throw new Error('Could not fetch swap quote. Please try again.');
123
- }
124
- // Get swap transaction and extract instructions
125
- const transaction = await jupiterClient.getSwap({
126
- quote: finalQuote,
127
- userPublicKey,
128
- slippageBps,
129
- });
130
- const { transactionMessage, lookupTables: jupiterLookupTables } = await jupiterClient.getTransactionMessageAndLookupTables({
131
- transaction,
132
- });
133
- swapInstructions = jupiterClient.getJupiterInstructions({
134
- transactionMessage,
135
- inputMint,
136
- outputMint,
137
- });
138
- lookupTables = jupiterLookupTables;
139
- }
140
- else {
141
- const titanClient = this.client;
142
- // For Titan, get swap directly (it handles quote internally).
143
- //
144
- // NOTE: `getSwap` reads only `userPublicKey` — it replays the route
145
- // cached by the preceding `getQuote`, so every other argument here is
146
- // inert. The size constraint is therefore enforced at quote time (see
147
- // `getQuote` above), which means an explicit `sizeConstraint` passed
148
- // only to this method does not affect route selection.
149
- const { transactionMessage, lookupTables: titanLookupTables } = await titanClient.getSwap({
150
- inputMint,
151
- outputMint,
152
- amount,
153
- userPublicKey,
154
- slippageBps,
155
- swapMode: isExactOut ? titanClient_1.SwapMode.ExactOut : titanClient_1.SwapMode.ExactIn,
156
- onlyDirectRoutes,
157
- sizeConstraint: sizeConstraint || DEFAULT_ROUTE_SIZE_CONSTRAINT,
158
- });
159
- swapInstructions = titanClient.getTitanInstructions({
160
- transactionMessage,
161
- inputMint,
162
- outputMint,
163
- });
164
- lookupTables = titanLookupTables;
165
- }
166
- return { instructions: swapInstructions, lookupTables };
94
+ async getSwapTransaction(params) {
95
+ return this.provider.getSwapTransaction(params);
167
96
  }
168
97
  /**
169
98
  * Get the underlying client instance
@@ -0,0 +1,20 @@
1
+ import { PublicKey, TransactionInstruction } from '@solana/web3.js';
2
+ /**
3
+ * Strips the setup and teardown a provider wraps around its route, leaving the
4
+ * instructions that go between `beginSwap` and `endSwap`.
5
+ *
6
+ * Velocity supplies its own compute budget, funds the input token account from
7
+ * the spot market vault, and sweeps the output back, so the provider's versions
8
+ * of all three are redundant. Its ATA creation for the input or output mint is
9
+ * dropped too, since velocity creates those itself; ATAs for any other mint
10
+ * (intermediate hops, fee accounts) are kept because nothing else creates them.
11
+ *
12
+ * Shared by both providers on purpose — when this lived in each client the two
13
+ * copies drifted, and the difference only showed up as a malformed transaction.
14
+ */
15
+ export declare function filterRouteInstructions({ instructions, inputMint, outputMint, }: {
16
+ instructions: TransactionInstruction[];
17
+ inputMint: PublicKey;
18
+ outputMint: PublicKey;
19
+ }): TransactionInstruction[];
20
+ //# sourceMappingURL=routeInstructions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routeInstructions.d.ts","sourceRoot":"","sources":["../../../src/swap/routeInstructions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAWpE;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,EACvC,YAAY,EACZ,SAAS,EACT,UAAU,GACV,EAAE;IACF,YAAY,EAAE,sBAAsB,EAAE,CAAC;IACvC,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,EAAE,SAAS,CAAC;CACtB,GAAG,sBAAsB,EAAE,CAwB3B"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.filterRouteInstructions = void 0;
4
+ const COMPUTE_BUDGET_PROGRAM_ID = 'ComputeBudget111111111111111111111111111111';
5
+ const TOKEN_PROGRAM_ID = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
6
+ const SYSTEM_PROGRAM_ID = '11111111111111111111111111111111';
7
+ const ASSOCIATED_TOKEN_PROGRAM_ID = 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
8
+ /** Index of the mint in an associated-token-account instruction's key list. */
9
+ const ATA_IX_MINT_KEY_INDEX = 3;
10
+ /**
11
+ * Strips the setup and teardown a provider wraps around its route, leaving the
12
+ * instructions that go between `beginSwap` and `endSwap`.
13
+ *
14
+ * Velocity supplies its own compute budget, funds the input token account from
15
+ * the spot market vault, and sweeps the output back, so the provider's versions
16
+ * of all three are redundant. Its ATA creation for the input or output mint is
17
+ * dropped too, since velocity creates those itself; ATAs for any other mint
18
+ * (intermediate hops, fee accounts) are kept because nothing else creates them.
19
+ *
20
+ * Shared by both providers on purpose — when this lived in each client the two
21
+ * copies drifted, and the difference only showed up as a malformed transaction.
22
+ */
23
+ function filterRouteInstructions({ instructions, inputMint, outputMint, }) {
24
+ return instructions.filter((instruction) => {
25
+ var _a;
26
+ const programId = instruction.programId.toString();
27
+ if (programId === COMPUTE_BUDGET_PROGRAM_ID ||
28
+ programId === TOKEN_PROGRAM_ID ||
29
+ programId === SYSTEM_PROGRAM_ID) {
30
+ return false;
31
+ }
32
+ if (programId === ASSOCIATED_TOKEN_PROGRAM_ID) {
33
+ // Guarded: a malformed ATA instruction with a short key list would
34
+ // otherwise throw here rather than simply being kept.
35
+ const mint = (_a = instruction.keys[ATA_IX_MINT_KEY_INDEX]) === null || _a === void 0 ? void 0 : _a.pubkey;
36
+ if (mint && (mint.equals(inputMint) || mint.equals(outputMint))) {
37
+ return false;
38
+ }
39
+ }
40
+ return true;
41
+ });
42
+ }
43
+ exports.filterRouteInstructions = filterRouteInstructions;
@@ -0,0 +1,197 @@
1
+ import { AddressLookupTableAccount, PublicKey, TransactionInstruction, VersionedTransaction } from '@solana/web3.js';
2
+ import { BN } from '../isomorphic/anchor';
3
+ export type SwapMode = 'ExactIn' | 'ExactOut';
4
+ export type SwapClientType = 'jupiter' | 'titan';
5
+ /** Account budget assumed when a caller doesn't specify one. */
6
+ export declare const DEFAULT_SWAP_MAX_ACCOUNTS = 50;
7
+ /**
8
+ * Quote fields shared by every provider. Provider-specific extras are optional
9
+ * and must never be required to build a swap — see {@link SwapQuote}.
10
+ */
11
+ export interface UnifiedQuoteResponse {
12
+ inputMint: string;
13
+ inAmount: string;
14
+ outputMint: string;
15
+ outAmount: string;
16
+ swapMode: SwapMode;
17
+ /**
18
+ * The slippage the route was quoted at. Authoritative — this is what the
19
+ * swap executes with, since {@link SwapProvider.getRouteInstructions} takes
20
+ * no slippage override. To swap at different slippage, quote again.
21
+ */
22
+ slippageBps: number;
23
+ routePlan: Array<{
24
+ swapInfo: any;
25
+ percent: number;
26
+ }>;
27
+ /** Jupiter only. */
28
+ otherAmountThreshold?: string;
29
+ /** Jupiter provides this; Titan doesn't, so callers derive it. */
30
+ priceImpactPct?: string;
31
+ platformFee?: {
32
+ amount?: string;
33
+ feeBps?: number;
34
+ };
35
+ contextSlot?: number;
36
+ timeTaken?: number;
37
+ error?: string;
38
+ errorCode?: string;
39
+ }
40
+ /**
41
+ * What the provider says its route does, recorded when the quote was produced.
42
+ *
43
+ * An implementation detail of the tamper check described on
44
+ * {@link expectProviderRoute} — you never write one of these. {@link
45
+ * buildSwapQuote} records it from the quote a provider is already returning.
46
+ */
47
+ export interface SwapRouteFields {
48
+ readonly inputMint: string;
49
+ readonly outputMint: string;
50
+ readonly inAmount: string;
51
+ readonly outAmount: string;
52
+ readonly swapMode: SwapMode;
53
+ readonly slippageBps: number;
54
+ }
55
+ /**
56
+ * Everything a provider needs to turn its own quote back into instructions.
57
+ *
58
+ * Attached to the quote rather than held on the client so that building a swap
59
+ * is a pure function of the quote you were given. A provider that kept this
60
+ * internally would silently build against whatever route it happened to have
61
+ * cached, which is invisible at the call site and wrong whenever more than one
62
+ * quote is in flight.
63
+ *
64
+ * Opaque — read the normalized fields on {@link SwapQuote} instead.
65
+ */
66
+ export type SwapProviderRoute = {
67
+ readonly provider: 'jupiter';
68
+ readonly quote: unknown;
69
+ readonly routed: SwapRouteFields;
70
+ readonly quotedFor?: string;
71
+ } | {
72
+ readonly provider: 'titan';
73
+ readonly route: unknown;
74
+ readonly routed: SwapRouteFields;
75
+ readonly quotedFor?: string;
76
+ };
77
+ /**
78
+ * A {@link SwapProviderRoute} as a provider hands it to {@link buildSwapQuote} —
79
+ * the payload without the `routed` fields, which `buildSwapQuote` records itself.
80
+ */
81
+ export type SwapProviderRoutePayload = OmitRouted<SwapProviderRoute>;
82
+ /** Distributes over the union, so each member keeps its own payload field. */
83
+ type OmitRouted<R> = R extends unknown ? Omit<R, 'routed'> : never;
84
+ /**
85
+ * A quote plus the provider payload needed to execute it. Always pass the quote
86
+ * you intend to swap on; providers will not fall back to a previous one.
87
+ *
88
+ * Treat it as immutable. The normalized fields are checked against the payload
89
+ * before a swap is built, so an edited copy is rejected rather than silently
90
+ * executed as the swap it was originally quoted for — re-quote instead.
91
+ */
92
+ export type SwapQuote = UnifiedQuoteResponse & {
93
+ readonly providerRoute: SwapProviderRoute;
94
+ };
95
+ export interface SwapQuoteParams {
96
+ inputMint: PublicKey;
97
+ outputMint: PublicKey;
98
+ amount: BN;
99
+ /** Required by Titan, which bakes the user's token accounts into the route. */
100
+ userPublicKey?: PublicKey;
101
+ maxAccounts?: number;
102
+ slippageBps?: number;
103
+ swapMode?: SwapMode;
104
+ onlyDirectRoutes?: boolean;
105
+ excludeDexes?: string[];
106
+ /** Titan only. */
107
+ sizeConstraint?: number;
108
+ /** Titan only. */
109
+ accountsLimitWritable?: number;
110
+ /** Jupiter only. */
111
+ autoSlippage?: boolean;
112
+ /** Jupiter only. */
113
+ maxAutoSlippageBps?: number;
114
+ /** Jupiter only. */
115
+ usdEstimate?: number;
116
+ }
117
+ export interface SwapRouteInstructions {
118
+ instructions: TransactionInstruction[];
119
+ lookupTables: AddressLookupTableAccount[];
120
+ }
121
+ export interface GetRouteInstructionsParams {
122
+ quote: SwapQuote;
123
+ /**
124
+ * Wallet the swap executes as. Must be the wallet the quote was requested
125
+ * for when the provider binds routes to a wallet — see
126
+ * {@link expectProviderRoute}.
127
+ *
128
+ * Don't be confused by the Velocity user account public key, which is different.
129
+ * This is usually the Velocity authority.
130
+ */
131
+ userPublicKey: PublicKey;
132
+ }
133
+ /**
134
+ * The contract every swap provider implements.
135
+ *
136
+ * Quote, then build — either into velocity's swap bracket, or into a standalone
137
+ * transaction. Both clients satisfying the same interface is what stops one
138
+ * provider growing behaviour the other doesn't have; callers get identical
139
+ * semantics regardless of which is configured.
140
+ *
141
+ * Provider-specific request fields live on {@link SwapQuoteParams} and are
142
+ * mapped by the provider itself, so adding one never means editing the unified
143
+ * client. Nothing that only one provider can honour belongs on
144
+ * {@link GetRouteInstructionsParams} — a build-time parameter the other silently
145
+ * ignores is indistinguishable from it being applied.
146
+ */
147
+ export interface SwapProvider {
148
+ readonly providerName: SwapClientType;
149
+ getQuote(params: SwapQuoteParams): Promise<SwapQuote>;
150
+ /**
151
+ * Builds the route instructions for a quote returned by this provider's
152
+ * `getQuote`, at the slippage that quote was priced at.
153
+ * @throws If the quote came from a different provider or a different wallet.
154
+ */
155
+ getRouteInstructions(params: GetRouteInstructionsParams): Promise<SwapRouteInstructions>;
156
+ /**
157
+ * Builds a complete, self-contained swap transaction — the setup and
158
+ * teardown `getRouteInstructions` strips are still attached: compute budget,
159
+ * token account creation, and SOL wrapping.
160
+ *
161
+ * For swaps the caller signs and sends on its own. A swap running inside
162
+ * velocity's `beginSwap`/`endSwap` bracket wants `getRouteInstructions`
163
+ * instead — velocity supplies all three itself, and a second copy wraps SOL
164
+ * that nothing then unwraps.
165
+ *
166
+ * @throws If the quote came from a different provider or a different wallet.
167
+ */
168
+ getSwapTransaction(params: GetRouteInstructionsParams): Promise<VersionedTransaction>;
169
+ }
170
+ /**
171
+ * Assembles the {@link SwapQuote} a provider's `getQuote` returns, from the
172
+ * normalized quote and the route payload that will execute it.
173
+ *
174
+ * Providers call this rather than building the object themselves. It records
175
+ * what the route was quoted with next to the payload, which is what lets
176
+ * {@link expectProviderRoute} reject a quote edited after it was returned — so
177
+ * that check needs no cooperation from the provider beyond calling this.
178
+ */
179
+ export declare function buildSwapQuote<Q extends UnifiedQuoteResponse>(quote: Q, providerRoute: SwapProviderRoutePayload): Q & SwapQuote;
180
+ /**
181
+ * Narrows a quote's payload to `provider`, checks it can be executed by
182
+ * `userPublicKey`, and checks it still matches the quote it travels on.
183
+ *
184
+ * A route is wallet-bound when the provider resolves the user's token accounts
185
+ * at quote time (Titan does; Jupiter builds per-wallet at swap time). Those
186
+ * providers record the wallet on `quotedFor`, and executing such a route as
187
+ * anyone else moves funds through accounts the signer doesn't own.
188
+ *
189
+ * @throws If the quote was produced by a different provider, for a wallet other
190
+ * than `userPublicKey`, or for a different pair, size, mode or slippage than the
191
+ * quote now claims.
192
+ */
193
+ export declare function expectProviderRoute<T extends SwapClientType>(quote: SwapQuote, provider: T, userPublicKey: PublicKey): Extract<SwapProviderRoute, {
194
+ provider: T;
195
+ }>;
196
+ export {};
197
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/swap/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,yBAAyB,EACzB,SAAS,EACT,sBAAsB,EACtB,oBAAoB,EACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,EAAE,EAAE,MAAM,sBAAsB,CAAC;AAE1C,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;AAC9C,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,OAAO,CAAC;AAEjD,gEAAgE;AAChE,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAE5C;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,QAAQ,CAAC;IACnB;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,GAAG,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAErD,oBAAoB;IACpB,oBAAo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