@lifi/sdk-provider-solana 4.0.3 → 4.0.5
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.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/SolanaProvider.d.ts +0 -1
- package/dist/cjs/actions/getSolanaBalance.d.ts +0 -1
- package/dist/cjs/actions/getSolanaBalance.js.map +1 -1
- package/dist/cjs/actions/sendAndConfirmBundle.d.ts +7 -8
- package/dist/cjs/actions/sendAndConfirmTransaction.d.ts +6 -7
- package/dist/cjs/core/SolanaStepExecutor.d.ts +0 -1
- package/dist/cjs/core/tasks/SolanaJitoWaitForTransactionTask.d.ts +0 -1
- package/dist/cjs/core/tasks/SolanaSignAndExecuteTask.d.ts +0 -1
- package/dist/cjs/core/tasks/SolanaSignAndExecuteTask.js +6 -2
- package/dist/cjs/core/tasks/SolanaSignAndExecuteTask.js.map +1 -1
- package/dist/cjs/core/tasks/SolanaStandardWaitForTransactionTask.d.ts +0 -1
- package/dist/cjs/core/tasks/SolanaWaitForTransactionTask.d.ts +0 -1
- package/dist/cjs/core/tasks/SolanaWaitForTransactionTask.js +1 -4
- package/dist/cjs/core/tasks/SolanaWaitForTransactionTask.js.map +1 -1
- package/dist/cjs/errors/parseSolanaErrors.d.ts +0 -1
- package/dist/cjs/rpc/jito/api/getBundleStatuses.d.ts +3 -4
- package/dist/cjs/rpc/jito/api/getTipAccounts.d.ts +4 -5
- package/dist/cjs/rpc/jito/api/sendBundle.d.ts +10 -11
- package/dist/cjs/rpc/jito/api/simulateBundle.d.ts +12 -8
- package/dist/cjs/rpc/jito/createJitoRpc.d.ts +0 -1
- package/dist/cjs/rpc/jito/types.d.ts +2 -2
- package/dist/cjs/rpc/registry.d.ts +11 -9
- package/dist/cjs/rpc/registry.js +16 -2
- package/dist/cjs/rpc/registry.js.map +1 -1
- package/dist/cjs/rpc/types.d.ts +0 -1
- package/dist/cjs/rpc/utils.d.ts +53 -54
- package/dist/cjs/types.d.ts +5 -1
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/utils/KeypairWalletAdapter.d.ts +9 -10
- package/dist/cjs/utils/getWalletFeature.d.ts +15 -16
- package/dist/cjs/utils/solanaErrorCause.d.ts +4 -4
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/SolanaProvider.d.ts +0 -1
- package/dist/esm/SolanaProvider.d.ts.map +1 -1
- package/dist/esm/actions/getSNSAddress.d.ts.map +1 -1
- package/dist/esm/actions/getSolanaBalance.d.ts +0 -1
- package/dist/esm/actions/getSolanaBalance.d.ts.map +1 -1
- package/dist/esm/actions/resolveSolanaAddress.d.ts.map +1 -1
- package/dist/esm/actions/sendAndConfirmBundle.d.ts +7 -8
- package/dist/esm/actions/sendAndConfirmBundle.d.ts.map +1 -1
- package/dist/esm/actions/sendAndConfirmTransaction.d.ts +6 -7
- package/dist/esm/actions/sendAndConfirmTransaction.d.ts.map +1 -1
- package/dist/esm/core/SolanaStepExecutor.d.ts +0 -1
- package/dist/esm/core/SolanaStepExecutor.d.ts.map +1 -1
- package/dist/esm/core/tasks/SolanaJitoWaitForTransactionTask.d.ts +0 -1
- package/dist/esm/core/tasks/SolanaJitoWaitForTransactionTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/SolanaSignAndExecuteTask.d.ts +0 -1
- package/dist/esm/core/tasks/SolanaSignAndExecuteTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/SolanaSignAndExecuteTask.js +6 -2
- package/dist/esm/core/tasks/SolanaSignAndExecuteTask.js.map +1 -1
- package/dist/esm/core/tasks/SolanaStandardWaitForTransactionTask.d.ts +0 -1
- package/dist/esm/core/tasks/SolanaStandardWaitForTransactionTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/SolanaWaitForTransactionTask.d.ts +0 -1
- package/dist/esm/core/tasks/SolanaWaitForTransactionTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/SolanaWaitForTransactionTask.js +1 -4
- package/dist/esm/core/tasks/SolanaWaitForTransactionTask.js.map +1 -1
- package/dist/esm/errors/parseSolanaErrors.d.ts +0 -1
- package/dist/esm/errors/parseSolanaErrors.d.ts.map +1 -1
- package/dist/esm/rpc/jito/api/getBundleStatuses.d.ts +3 -4
- package/dist/esm/rpc/jito/api/getBundleStatuses.d.ts.map +1 -1
- package/dist/esm/rpc/jito/api/getTipAccounts.d.ts +4 -5
- package/dist/esm/rpc/jito/api/getTipAccounts.d.ts.map +1 -1
- package/dist/esm/rpc/jito/api/sendBundle.d.ts +10 -11
- package/dist/esm/rpc/jito/api/sendBundle.d.ts.map +1 -1
- package/dist/esm/rpc/jito/api/simulateBundle.d.ts +12 -8
- package/dist/esm/rpc/jito/api/simulateBundle.d.ts.map +1 -1
- package/dist/esm/rpc/jito/createJitoRpc.d.ts +0 -1
- package/dist/esm/rpc/jito/createJitoRpc.d.ts.map +1 -1
- package/dist/esm/rpc/jito/types.d.ts +2 -2
- package/dist/esm/rpc/jito/types.d.ts.map +1 -1
- package/dist/esm/rpc/registry.d.ts +11 -9
- package/dist/esm/rpc/registry.d.ts.map +1 -1
- package/dist/esm/rpc/registry.js +16 -2
- package/dist/esm/rpc/registry.js.map +1 -1
- package/dist/esm/rpc/types.d.ts +0 -1
- package/dist/esm/rpc/types.d.ts.map +1 -1
- package/dist/esm/rpc/utils.d.ts +53 -54
- package/dist/esm/rpc/utils.d.ts.map +1 -1
- package/dist/esm/types.d.ts +5 -1
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils/KeypairWallet.unit.helpers.d.ts.map +1 -1
- package/dist/esm/utils/KeypairWalletAdapter.d.ts +9 -10
- package/dist/esm/utils/KeypairWalletAdapter.d.ts.map +1 -1
- package/dist/esm/utils/base64ToUint8Array.d.ts.map +1 -1
- package/dist/esm/utils/getWalletFeature.d.ts +15 -16
- package/dist/esm/utils/getWalletFeature.d.ts.map +1 -1
- package/dist/esm/utils/solanaErrorCause.d.ts +4 -4
- package/dist/esm/utils/solanaErrorCause.d.ts.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.d.ts.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/package.json +2 -2
- package/src/core/tasks/SolanaSignAndExecuteTask.ts +9 -5
- package/src/core/tasks/SolanaWaitForTransactionTask.ts +5 -11
- package/src/rpc/registry.ts +18 -2
- package/src/types.ts +5 -0
- package/src/version.ts +1 -1
- package/dist/cjs/utils/shouldUseJitoBundle.d.ts +0 -8
- package/dist/cjs/utils/shouldUseJitoBundle.js +0 -12
- package/dist/cjs/utils/shouldUseJitoBundle.js.map +0 -1
- package/dist/esm/utils/shouldUseJitoBundle.d.ts +0 -8
- package/dist/esm/utils/shouldUseJitoBundle.d.ts.map +0 -1
- package/dist/esm/utils/shouldUseJitoBundle.js +0 -11
- package/dist/esm/utils/shouldUseJitoBundle.js.map +0 -1
- package/src/utils/shouldUseJitoBundle.ts +0 -18
package/dist/esm/rpc/registry.js
CHANGED
|
@@ -5,11 +5,25 @@ import { createSolanaRpc } from "@solana/kit";
|
|
|
5
5
|
const solanaRpcs = new LruMap(12);
|
|
6
6
|
const jitoRpcs = new LruMap(12);
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* A well-formed but non-existent Jito bundle id used solely to probe RPC
|
|
9
|
+
* capability. It forces `getBundleStatuses` to actually execute, so we can tell
|
|
10
|
+
* a Jito-capable RPC (resolves with `{ value: [null] }` — bundle not found)
|
|
11
|
+
* apart from a standard Solana RPC (throws "Method not found").
|
|
12
|
+
*
|
|
13
|
+
* Uses all `1`s: 64 chars, valid as both hex and base-58 (base-58 excludes
|
|
14
|
+
* `0`/`O`/`I`/`l`), so a provider that validates the id in either encoding
|
|
15
|
+
* still accepts it and performs the lookup instead of rejecting the probe.
|
|
16
|
+
*/
|
|
17
|
+
const PROBE_BUNDLE_ID = "1111111111111111111111111111111111111111111111111111111111111111";
|
|
18
|
+
/**
|
|
19
|
+
* Checks if an RPC URL supports Jito methods by calling getBundleStatuses.
|
|
20
|
+
* We probe with getBundleStatuses (rather than getTipAccounts) because it is the
|
|
21
|
+
* method actually used during bundle confirmation, and providers such as Helius
|
|
22
|
+
* support sendBundle/getBundleStatuses without exposing getTipAccounts.
|
|
9
23
|
*/
|
|
10
24
|
const isJitoRpc = async (rpcUrl) => {
|
|
11
25
|
try {
|
|
12
|
-
await createJitoRpc(rpcUrl).
|
|
26
|
+
await createJitoRpc(rpcUrl).getBundleStatuses([PROBE_BUNDLE_ID]).send();
|
|
13
27
|
return true;
|
|
14
28
|
} catch {
|
|
15
29
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","names":[],"sources":["../../../src/rpc/registry.ts"],"sourcesContent":["import { ChainId, LruMap, type SDKClient } from '@lifi/sdk'\nimport { createSolanaRpc } from '@solana/kit'\nimport { createJitoRpc } from './jito/createJitoRpc.js'\nimport type { JitoRpcType, SolanaRpcType } from './types.js'\n\nconst solanaRpcs = new LruMap<SolanaRpcType>(12)\nconst jitoRpcs = new LruMap<JitoRpcType>(12)\n\n/**\n * Checks if an RPC URL supports Jito methods by calling getTipAccounts.\n */\nexport const isJitoRpc = async (rpcUrl: string): Promise<boolean> => {\n try {\n const rpc = createJitoRpc(rpcUrl)\n await rpc.
|
|
1
|
+
{"version":3,"file":"registry.js","names":[],"sources":["../../../src/rpc/registry.ts"],"sourcesContent":["import { ChainId, LruMap, type SDKClient } from '@lifi/sdk'\nimport { createSolanaRpc } from '@solana/kit'\nimport { createJitoRpc } from './jito/createJitoRpc.js'\nimport type { JitoRpcType, SolanaRpcType } from './types.js'\n\nconst solanaRpcs = new LruMap<SolanaRpcType>(12)\nconst jitoRpcs = new LruMap<JitoRpcType>(12)\n\n/**\n * A well-formed but non-existent Jito bundle id used solely to probe RPC\n * capability. It forces `getBundleStatuses` to actually execute, so we can tell\n * a Jito-capable RPC (resolves with `{ value: [null] }` — bundle not found)\n * apart from a standard Solana RPC (throws \"Method not found\").\n *\n * Uses all `1`s: 64 chars, valid as both hex and base-58 (base-58 excludes\n * `0`/`O`/`I`/`l`), so a provider that validates the id in either encoding\n * still accepts it and performs the lookup instead of rejecting the probe.\n */\nconst PROBE_BUNDLE_ID =\n '1111111111111111111111111111111111111111111111111111111111111111'\n\n/**\n * Checks if an RPC URL supports Jito methods by calling getBundleStatuses.\n * We probe with getBundleStatuses (rather than getTipAccounts) because it is the\n * method actually used during bundle confirmation, and providers such as Helius\n * support sendBundle/getBundleStatuses without exposing getTipAccounts.\n */\nexport const isJitoRpc = async (rpcUrl: string): Promise<boolean> => {\n try {\n const rpc = createJitoRpc(rpcUrl)\n await rpc.getBundleStatuses([PROBE_BUNDLE_ID]).send()\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Initializes Solana RPCs for all available RPC URLs if they haven't been cached yet.\n * @param client - The SDK client used to fetch RPC URLs.\n */\nconst ensureSolanaRpcs = async (client: SDKClient): Promise<string[]> => {\n const rpcUrls = await client.getRpcUrlsByChainId(ChainId.SOL)\n for (const rpcUrl of rpcUrls) {\n if (!solanaRpcs.has(rpcUrl)) {\n solanaRpcs.set(rpcUrl, createSolanaRpc(rpcUrl))\n }\n }\n return rpcUrls\n}\n\n/**\n * Detects and caches Jito-capable RPCs by checking if they support the getTipAccounts method.\n * @param client - The SDK client used to fetch RPC URLs.\n */\nconst ensureJitoRpcs = async (client: SDKClient): Promise<string[]> => {\n const rpcUrls = await client.getRpcUrlsByChainId(ChainId.SOL)\n for (const rpcUrl of rpcUrls) {\n if (!jitoRpcs.has(rpcUrl) && (await isJitoRpc(rpcUrl))) {\n jitoRpcs.set(rpcUrl, createJitoRpc(rpcUrl))\n }\n }\n return rpcUrls\n}\n\n/**\n * Wrapper around getting the Solana RPCs\n * @returns - Solana RPCs\n */\nexport const getSolanaRpcs = async (\n client: SDKClient\n): Promise<SolanaRpcType[]> => {\n const rpcUrls = await ensureSolanaRpcs(client)\n return rpcUrls\n .map((rpcUrl) => solanaRpcs.get(rpcUrl))\n .filter((rpc): rpc is SolanaRpcType => Boolean(rpc))\n}\n\n/**\n * Wrapper around getting the Jito RPCs\n * @returns - Jito RPCs\n */\nexport const getJitoRpcs = async (\n client: SDKClient\n): Promise<JitoRpcType[]> => {\n const rpcUrls = await ensureJitoRpcs(client)\n return rpcUrls\n .map((rpcUrl) => jitoRpcs.get(rpcUrl))\n .filter((rpc): rpc is JitoRpcType => Boolean(rpc))\n}\n"],"mappings":";;;;AAKA,MAAM,aAAa,IAAI,OAAsB,EAAE;AAC/C,MAAM,WAAW,IAAI,OAAoB,EAAE;;;;;;;;;;;AAY3C,MAAM,kBACJ;;;;;;;AAQF,MAAa,YAAY,OAAO,WAAqC;CACnE,IAAI;EAEF,MADY,cAAc,MAClB,CAAC,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK;EACpD,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;;;;;AAMA,MAAM,mBAAmB,OAAO,WAAyC;CACvE,MAAM,UAAU,MAAM,OAAO,oBAAoB,QAAQ,GAAG;CAC5D,KAAK,MAAM,UAAU,SACnB,IAAI,CAAC,WAAW,IAAI,MAAM,GACxB,WAAW,IAAI,QAAQ,gBAAgB,MAAM,CAAC;CAGlD,OAAO;AACT;;;;;AAMA,MAAM,iBAAiB,OAAO,WAAyC;CACrE,MAAM,UAAU,MAAM,OAAO,oBAAoB,QAAQ,GAAG;CAC5D,KAAK,MAAM,UAAU,SACnB,IAAI,CAAC,SAAS,IAAI,MAAM,KAAM,MAAM,UAAU,MAAM,GAClD,SAAS,IAAI,QAAQ,cAAc,MAAM,CAAC;CAG9C,OAAO;AACT;;;;;AAMA,MAAa,gBAAgB,OAC3B,WAC6B;CAE7B,QAAO,MADe,iBAAiB,MAAM,EAAA,CAE1C,KAAK,WAAW,WAAW,IAAI,MAAM,CAAC,CAAC,CACvC,QAAQ,QAA8B,QAAQ,GAAG,CAAC;AACvD;;;;;AAMA,MAAa,cAAc,OACzB,WAC2B;CAE3B,QAAO,MADe,eAAe,MAAM,EAAA,CAExC,KAAK,WAAW,SAAS,IAAI,MAAM,CAAC,CAAC,CACrC,QAAQ,QAA4B,QAAQ,GAAG,CAAC;AACrD"}
|
package/dist/esm/rpc/types.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/rpc/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/rpc/types.ts"],"mappings":";;;KAGY,gBAAgB,kBAAkB;KAClC,cAAc,IAAI"}
|
package/dist/esm/rpc/utils.d.ts
CHANGED
|
@@ -1,66 +1,65 @@
|
|
|
1
1
|
import { JitoRpcType, SolanaRpcType } from "./types.js";
|
|
2
2
|
import { SDKClient } from "@lifi/sdk";
|
|
3
|
-
|
|
4
3
|
//#region src/rpc/utils.d.ts
|
|
5
4
|
type RetryFn<Rpc> = <R>(client: SDKClient, fn: (rpc: Rpc) => Promise<R>) => Promise<R>;
|
|
6
5
|
/**
|
|
7
|
-
* Calls a function on RPC instances with retry logic.
|
|
8
|
-
* Tries each RPC in sequence until one succeeds.
|
|
9
|
-
*
|
|
10
|
-
* @typeParam T - The type of the RPC instance.
|
|
11
|
-
* @typeParam R - The return type of the function.
|
|
12
|
-
* @param rpcs - An array of RPC instances to try.
|
|
13
|
-
* @param fn - The async function to execute on each RPC until one succeeds.
|
|
14
|
-
* @returns The result from the first successful RPC call.
|
|
15
|
-
* @throws {Error} If no RPCs are available.
|
|
16
|
-
* @throws {AggregateError} If all RPCs fail, containing all individual errors.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```ts
|
|
20
|
-
* const rpcs = await getSolanaRpcs(client)
|
|
21
|
-
* const result = await callWithRetry(rpcs, (rpc) =>
|
|
22
|
-
* rpc.getBalance(address).send()
|
|
23
|
-
* )
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
6
|
+
* Calls a function on RPC instances with retry logic.
|
|
7
|
+
* Tries each RPC in sequence until one succeeds.
|
|
8
|
+
*
|
|
9
|
+
* @typeParam T - The type of the RPC instance.
|
|
10
|
+
* @typeParam R - The return type of the function.
|
|
11
|
+
* @param rpcs - An array of RPC instances to try.
|
|
12
|
+
* @param fn - The async function to execute on each RPC until one succeeds.
|
|
13
|
+
* @returns The result from the first successful RPC call.
|
|
14
|
+
* @throws {Error} If no RPCs are available.
|
|
15
|
+
* @throws {AggregateError} If all RPCs fail, containing all individual errors.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const rpcs = await getSolanaRpcs(client)
|
|
20
|
+
* const result = await callWithRetry(rpcs, (rpc) =>
|
|
21
|
+
* rpc.getBalance(address).send()
|
|
22
|
+
* )
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
26
25
|
declare function callWithRetry<T, R>(rpcs: T[], fn: (rpc: T) => Promise<R>): Promise<R>;
|
|
27
26
|
/**
|
|
28
|
-
* Calls a function on Solana RPC instances with retry logic.
|
|
29
|
-
* Automatically fetches available Solana RPCs and tries each in sequence.
|
|
30
|
-
*
|
|
31
|
-
* @typeParam R - The return type of the function.
|
|
32
|
-
* @param client - The SDK client used to fetch RPC URLs.
|
|
33
|
-
* @param fn - The async function to execute on each RPC until one succeeds.
|
|
34
|
-
* @returns The result from the first successful RPC call.
|
|
35
|
-
* @throws {Error} If no Solana RPCs are available.
|
|
36
|
-
* @throws {AggregateError} If all RPCs fail.
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```ts
|
|
40
|
-
* const balance = await callSolanaRpcsWithRetry(client, (rpc) =>
|
|
41
|
-
* rpc.getBalance(address).send()
|
|
42
|
-
* )
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
27
|
+
* Calls a function on Solana RPC instances with retry logic.
|
|
28
|
+
* Automatically fetches available Solana RPCs and tries each in sequence.
|
|
29
|
+
*
|
|
30
|
+
* @typeParam R - The return type of the function.
|
|
31
|
+
* @param client - The SDK client used to fetch RPC URLs.
|
|
32
|
+
* @param fn - The async function to execute on each RPC until one succeeds.
|
|
33
|
+
* @returns The result from the first successful RPC call.
|
|
34
|
+
* @throws {Error} If no Solana RPCs are available.
|
|
35
|
+
* @throws {AggregateError} If all RPCs fail.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const balance = await callSolanaRpcsWithRetry(client, (rpc) =>
|
|
40
|
+
* rpc.getBalance(address).send()
|
|
41
|
+
* )
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
45
44
|
declare const callSolanaRpcsWithRetry: RetryFn<SolanaRpcType>;
|
|
46
45
|
/**
|
|
47
|
-
* Calls a function on Jito RPC instances with retry logic.
|
|
48
|
-
* Automatically fetches available Jito RPCs and tries each in sequence.
|
|
49
|
-
*
|
|
50
|
-
* @typeParam R - The return type of the function.
|
|
51
|
-
* @param client - The SDK client used to fetch RPC URLs.
|
|
52
|
-
* @param fn - The async function to execute on each RPC until one succeeds.
|
|
53
|
-
* @returns The result from the first successful RPC call.
|
|
54
|
-
* @throws {Error} If no Jito RPCs are available.
|
|
55
|
-
* @throws {AggregateError} If all RPCs fail.
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```ts
|
|
59
|
-
* const tipAccounts = await callJitoRpcsWithRetry(client, (rpc) =>
|
|
60
|
-
* rpc.getTipAccounts().send()
|
|
61
|
-
* )
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
46
|
+
* Calls a function on Jito RPC instances with retry logic.
|
|
47
|
+
* Automatically fetches available Jito RPCs and tries each in sequence.
|
|
48
|
+
*
|
|
49
|
+
* @typeParam R - The return type of the function.
|
|
50
|
+
* @param client - The SDK client used to fetch RPC URLs.
|
|
51
|
+
* @param fn - The async function to execute on each RPC until one succeeds.
|
|
52
|
+
* @returns The result from the first successful RPC call.
|
|
53
|
+
* @throws {Error} If no Jito RPCs are available.
|
|
54
|
+
* @throws {AggregateError} If all RPCs fail.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const tipAccounts = await callJitoRpcsWithRetry(client, (rpc) =>
|
|
59
|
+
* rpc.getTipAccounts().send()
|
|
60
|
+
* )
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
64
63
|
declare const callJitoRpcsWithRetry: RetryFn<JitoRpcType>;
|
|
65
64
|
//#endregion
|
|
66
65
|
export { callJitoRpcsWithRetry, callSolanaRpcsWithRetry, callWithRetry };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../../src/rpc/utils.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../../src/rpc/utils.ts"],"mappings":";;;KAIK,QAAQ,QAAQ,GACnB,QAAQ,WACR,KAAK,KAAK,QAAQ,QAAQ,OACvB,QAAQ;;;;;;;;;;;;;;;;;;;;;iBAsBS,cAAc,GAAG,GACrC,MAAM,KACN,KAAK,KAAK,MAAM,QAAQ,KACvB,QAAQ;;;;;;;;;;;;;;;;;;;cA8CE,yBAAyB,QAAQ;;;;;;;;;;;;;;;;;;;cAqBjC,uBAAuB,QAAQ"}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { SDKProvider, StepExecutorContext, StepExecutorOptions } from "@lifi/sdk";
|
|
2
2
|
import { Transaction } from "@solana/kit";
|
|
3
3
|
import { Wallet, WalletAccount } from "@wallet-standard/base";
|
|
4
|
-
|
|
5
4
|
//#region src/types.d.ts
|
|
6
5
|
interface SolanaProviderOptions {
|
|
7
6
|
getWallet?: () => Promise<Wallet>;
|
|
@@ -9,6 +8,11 @@ interface SolanaProviderOptions {
|
|
|
9
8
|
}
|
|
10
9
|
interface SolanaTaskContext {
|
|
11
10
|
signedTransactions?: Transaction[];
|
|
11
|
+
/**
|
|
12
|
+
* Whether the backend returned a Jito bundle (array `transactionRequest.data`)
|
|
13
|
+
* that must be submitted via `sendBundle` instead of `sendTransaction`.
|
|
14
|
+
*/
|
|
15
|
+
isBundleExecution?: boolean;
|
|
12
16
|
}
|
|
13
17
|
interface SolanaStepExecutorContext extends StepExecutorContext, SolanaTaskContext {
|
|
14
18
|
wallet: Wallet;
|
package/dist/esm/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/types.ts"],"mappings":";;;;UASiB;EACf,kBAAkB,QAAQ;EAC1B;;UAGe;EACf,qBAAqB;;;;;EAKrB;;UAGe,kCACP,qBACN;EACF,QAAQ;EACR,eAAe;EACf;;UAGe,0BAA0B;EACzC,WAAW,SAAS;;iBAGN,iBACd,UAAU,cACT,YAAY;UAIE,kCAAkC;EACjD,QAAQ;EACR"}
|
package/dist/esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/types.ts"],"sourcesContent":["import {\n ChainType,\n type SDKProvider,\n type StepExecutorContext,\n type StepExecutorOptions,\n} from '@lifi/sdk'\nimport type { Transaction } from '@solana/kit'\nimport type { Wallet, WalletAccount } from '@wallet-standard/base'\n\nexport interface SolanaProviderOptions {\n getWallet?: () => Promise<Wallet>\n skipSimulation?: boolean\n}\n\nexport interface SolanaTaskContext {\n signedTransactions?: Transaction[]\n}\n\nexport interface SolanaStepExecutorContext\n extends StepExecutorContext,\n SolanaTaskContext {\n wallet: Wallet\n walletAccount: WalletAccount\n skipSimulation: boolean\n}\n\nexport interface SolanaSDKProvider extends SDKProvider {\n setOptions(options: SolanaProviderOptions): void\n}\n\nexport function isSolanaProvider(\n provider: SDKProvider\n): provider is SolanaSDKProvider {\n return provider.type === ChainType.SVM\n}\n\nexport interface SolanaStepExecutorOptions extends StepExecutorOptions {\n wallet: Wallet\n skipSimulation?: boolean\n}\n"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/types.ts"],"sourcesContent":["import {\n ChainType,\n type SDKProvider,\n type StepExecutorContext,\n type StepExecutorOptions,\n} from '@lifi/sdk'\nimport type { Transaction } from '@solana/kit'\nimport type { Wallet, WalletAccount } from '@wallet-standard/base'\n\nexport interface SolanaProviderOptions {\n getWallet?: () => Promise<Wallet>\n skipSimulation?: boolean\n}\n\nexport interface SolanaTaskContext {\n signedTransactions?: Transaction[]\n /**\n * Whether the backend returned a Jito bundle (array `transactionRequest.data`)\n * that must be submitted via `sendBundle` instead of `sendTransaction`.\n */\n isBundleExecution?: boolean\n}\n\nexport interface SolanaStepExecutorContext\n extends StepExecutorContext,\n SolanaTaskContext {\n wallet: Wallet\n walletAccount: WalletAccount\n skipSimulation: boolean\n}\n\nexport interface SolanaSDKProvider extends SDKProvider {\n setOptions(options: SolanaProviderOptions): void\n}\n\nexport function isSolanaProvider(\n provider: SDKProvider\n): provider is SolanaSDKProvider {\n return provider.type === ChainType.SVM\n}\n\nexport interface SolanaStepExecutorOptions extends StepExecutorOptions {\n wallet: Wallet\n skipSimulation?: boolean\n}\n"],"mappings":";;AAmCA,SAAgB,iBACd,UAC+B;CAC/B,OAAO,SAAS,SAAS,UAAU;AACrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeypairWallet.unit.helpers.d.ts","names":[],"sources":["../../../src/utils/KeypairWallet.unit.helpers.ts"],"mappings":";cAKa,
|
|
1
|
+
{"version":3,"file":"KeypairWallet.unit.helpers.d.ts","names":[],"sources":["../../../src/utils/KeypairWallet.unit.helpers.ts"],"mappings":";cAKa,2BAAgC;EAC3C;EACA,WAAW"}
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { SolanaSignTransactionFeature } from "@solana/wallet-standard-features";
|
|
2
2
|
import { Wallet, WalletAccount } from "@wallet-standard/base";
|
|
3
|
-
|
|
4
3
|
//#region src/utils/KeypairWalletAdapter.d.ts
|
|
5
4
|
/**
|
|
6
|
-
* This keypair wallet adapter is unsafe to use on the frontend and is only included to provide an easy way for applications to test
|
|
7
|
-
* Wallet Adapter without using a third-party wallet.
|
|
8
|
-
*/
|
|
5
|
+
* This keypair wallet adapter is unsafe to use on the frontend and is only included to provide an easy way for applications to test
|
|
6
|
+
* Wallet Adapter without using a third-party wallet.
|
|
7
|
+
*/
|
|
9
8
|
declare class KeypairWalletAdapter implements Wallet {
|
|
10
9
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
* Storing a keypair locally like this is not safe because any application using this adapter could retrieve the
|
|
11
|
+
* secret key, and because the keypair will be lost any time the wallet is disconnected or the window is refreshed.
|
|
12
|
+
*/
|
|
14
13
|
private _signer;
|
|
15
14
|
private _account;
|
|
16
15
|
private readonly _secretKeyBytes;
|
|
17
|
-
readonly version
|
|
18
|
-
readonly name
|
|
19
|
-
readonly icon
|
|
16
|
+
readonly version: "1.0.0";
|
|
17
|
+
readonly name: "Keypair Wallet";
|
|
18
|
+
readonly icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48L3N2Zz4=";
|
|
20
19
|
constructor(secretKeyBase58: string);
|
|
21
20
|
get chains(): readonly ["solana:mainnet", "solana:devnet", "solana:testnet"];
|
|
22
21
|
get accounts(): readonly WalletAccount[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeypairWalletAdapter.d.ts","names":[],"sources":["../../../src/utils/KeypairWalletAdapter.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"KeypairWalletAdapter.d.ts","names":[],"sources":["../../../src/utils/KeypairWalletAdapter.ts"],"mappings":";;;;;;;cAuBa,gCAAgC;;;;;UAKnC;UACA;mBACS;WAER;WACA;WACA;EAGT,YAAY;MAqBR;MAIA,qBAAqB;MAIrB,YAAY;EAUhB,WAAiB;EAejB,cAAoB;UAMN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base64ToUint8Array.d.ts","names":[],"sources":["../../../src/utils/base64ToUint8Array.ts"],"mappings":";iBAAgB,
|
|
1
|
+
{"version":3,"file":"base64ToUint8Array.d.ts","names":[],"sources":["../../../src/utils/base64ToUint8Array.ts"],"mappings":";iBAAgB,mBAAmB,uBAAuB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SolanaSignAndSendTransaction, SolanaSignAndSendTransactionFeature, SolanaSignIn, SolanaSignInFeature, SolanaSignMessage, SolanaSignMessageFeature, SolanaSignTransaction, SolanaSignTransactionFeature } from "@solana/wallet-standard-features";
|
|
2
2
|
import { Wallet } from "@wallet-standard/base";
|
|
3
|
-
|
|
4
3
|
//#region src/utils/getWalletFeature.d.ts
|
|
5
4
|
type FeatureMap = {
|
|
6
5
|
[SolanaSignTransaction]: SolanaSignTransactionFeature[typeof SolanaSignTransaction];
|
|
@@ -9,21 +8,21 @@ type FeatureMap = {
|
|
|
9
8
|
[SolanaSignIn]: SolanaSignInFeature[typeof SolanaSignIn];
|
|
10
9
|
};
|
|
11
10
|
/**
|
|
12
|
-
* Helper function to safely extract a feature's properties from a wallet.
|
|
13
|
-
*
|
|
14
|
-
* This handles the TypeScript union type issue where wallet.features is typed as a union
|
|
15
|
-
* but at runtime is actually a record containing multiple features.
|
|
16
|
-
*
|
|
17
|
-
* @param wallet - The wallet instance
|
|
18
|
-
* @param featureName - The feature identifier constant
|
|
19
|
-
* @returns The feature's properties object
|
|
20
|
-
* @throws Error if the wallet doesn't support the requested feature
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* import { SolanaSignTransaction } from '@solana/wallet-standard-features'
|
|
24
|
-
*
|
|
25
|
-
* const { signTransaction } = getWalletFeature(wallet, SolanaSignTransaction)
|
|
26
|
-
*/
|
|
11
|
+
* Helper function to safely extract a feature's properties from a wallet.
|
|
12
|
+
*
|
|
13
|
+
* This handles the TypeScript union type issue where wallet.features is typed as a union
|
|
14
|
+
* but at runtime is actually a record containing multiple features.
|
|
15
|
+
*
|
|
16
|
+
* @param wallet - The wallet instance
|
|
17
|
+
* @param featureName - The feature identifier constant
|
|
18
|
+
* @returns The feature's properties object
|
|
19
|
+
* @throws Error if the wallet doesn't support the requested feature
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* import { SolanaSignTransaction } from '@solana/wallet-standard-features'
|
|
23
|
+
*
|
|
24
|
+
* const { signTransaction } = getWalletFeature(wallet, SolanaSignTransaction)
|
|
25
|
+
*/
|
|
27
26
|
declare function getWalletFeature<K extends keyof FeatureMap>(wallet: Wallet, featureName: K): FeatureMap[K];
|
|
28
27
|
//#endregion
|
|
29
28
|
export { getWalletFeature };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWalletFeature.d.ts","names":[],"sources":["../../../src/utils/getWalletFeature.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getWalletFeature.d.ts","names":[],"sources":["../../../src/utils/getWalletFeature.ts"],"mappings":";;;KAaK;GACF,wBAAwB,oCAAoC;GAC5D,oBAAoB,gCAAgC;GACpD,+BAA+B,2CAA2C;GAC1E,eAAe,2BAA2B;;;;;;;;;;;;;;;;;;iBAmB7B,iBAAiB,gBAAgB,YAC/C,QAAQ,QACR,aAAa,IACZ,WAAW"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
//#region src/utils/solanaErrorCause.d.ts
|
|
2
2
|
declare const safeStringifyBigInt: (value: unknown) => string;
|
|
3
3
|
/**
|
|
4
|
-
* Carries the structured payload of a failed Solana RPC simulation or
|
|
5
|
-
* confirmation so consumers can inspect `err` and `logs` directly from
|
|
6
|
-
* the thrown `TransactionError`'s `cause`, without re-simulating.
|
|
7
|
-
*/
|
|
4
|
+
* Carries the structured payload of a failed Solana RPC simulation or
|
|
5
|
+
* confirmation so consumers can inspect `err` and `logs` directly from
|
|
6
|
+
* the thrown `TransactionError`'s `cause`, without re-simulating.
|
|
7
|
+
*/
|
|
8
8
|
declare class SolanaTransactionDetailsError extends Error {
|
|
9
9
|
readonly err: unknown;
|
|
10
10
|
readonly logs: readonly string[] | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solanaErrorCause.d.ts","names":[],"sources":["../../../src/utils/solanaErrorCause.ts"],"mappings":";cAAa,
|
|
1
|
+
{"version":3,"file":"solanaErrorCause.d.ts","names":[],"sources":["../../../src/utils/solanaErrorCause.ts"],"mappings":";cAAa,sBAAuB;;;;;;cAavB,sCAAsC;WACxC;WACA;EAET,YAAY,cAAc"}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","names":[],"sources":["../../src/version.ts"],"mappings":";cAAa
|
|
1
|
+
{"version":3,"file":"version.d.ts","names":[],"sources":["../../src/version.ts"],"mappings":";cAAa;cACA"}
|
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-solana'\nexport const version = '4.0.
|
|
1
|
+
{"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@lifi/sdk-provider-solana'\nexport const version = '4.0.5'\n"],"mappings":";AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/sdk-provider-solana",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.5",
|
|
4
4
|
"description": "LI.FI Solana SDK Provider for Any-to-Any Cross-Chain-Swap",
|
|
5
5
|
"homepage": "https://github.com/lifinance/sdk",
|
|
6
6
|
"bugs": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@solana/kit": "^7.0.0",
|
|
32
32
|
"@solana/wallet-standard-features": "^1.4.0",
|
|
33
33
|
"@wallet-standard/base": "^1.1.1",
|
|
34
|
-
"@lifi/sdk": "4.
|
|
34
|
+
"@lifi/sdk": "4.3.0"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
@@ -34,13 +34,17 @@ export class SolanaSignAndExecuteTask extends BaseStepExecutionTask {
|
|
|
34
34
|
)
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const transactionRequestData = await getTransactionRequestData(
|
|
37
|
+
const transactionRequestData = (await getTransactionRequestData(
|
|
38
38
|
step,
|
|
39
39
|
executionOptions
|
|
40
|
-
)
|
|
40
|
+
)) as string | string[]
|
|
41
|
+
|
|
42
|
+
// The backend returns an array when it produced a Jito bundle and a string
|
|
43
|
+
// for a single transaction. The shape determines how we submit it later:
|
|
44
|
+
// array -> sendBundle, string -> sendTransaction.
|
|
45
|
+
const isBundleExecution = Array.isArray(transactionRequestData)
|
|
41
46
|
|
|
42
|
-
|
|
43
|
-
const transactionDataArray = Array.isArray(transactionRequestData)
|
|
47
|
+
const transactionDataArray = isBundleExecution
|
|
44
48
|
? transactionRequestData
|
|
45
49
|
: [transactionRequestData]
|
|
46
50
|
|
|
@@ -93,7 +97,7 @@ export class SolanaSignAndExecuteTask extends BaseStepExecutionTask {
|
|
|
93
97
|
|
|
94
98
|
return {
|
|
95
99
|
status: 'COMPLETED',
|
|
96
|
-
context: { signedTransactions },
|
|
100
|
+
context: { signedTransactions, isBundleExecution },
|
|
97
101
|
}
|
|
98
102
|
}
|
|
99
103
|
}
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
import { BaseStepExecutionTask, type TaskResult } from '@lifi/sdk'
|
|
2
2
|
import type { SolanaStepExecutorContext } from '../../types.js'
|
|
3
|
-
import { shouldUseJitoBundle } from '../../utils/shouldUseJitoBundle.js'
|
|
4
3
|
import { SolanaJitoWaitForTransactionTask } from './SolanaJitoWaitForTransactionTask.js'
|
|
5
4
|
import { SolanaStandardWaitForTransactionTask } from './SolanaStandardWaitForTransactionTask.js'
|
|
6
5
|
|
|
7
6
|
export class SolanaWaitForTransactionTask extends BaseStepExecutionTask {
|
|
8
7
|
async run(context: SolanaStepExecutorContext): Promise<TaskResult> {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
client.config.routeOptions,
|
|
15
|
-
signedTransactions
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
if (useJitoBundle) {
|
|
8
|
+
// The submission method is determined by the shape of the backend's
|
|
9
|
+
// `transactionRequest.data` (resolved in SolanaSignAndExecuteTask):
|
|
10
|
+
// a bundle (array) must go through `sendBundle`, a single transaction
|
|
11
|
+
// (string) through `sendTransaction`.
|
|
12
|
+
if (context.isBundleExecution) {
|
|
19
13
|
return new SolanaJitoWaitForTransactionTask().run(context)
|
|
20
14
|
}
|
|
21
15
|
return new SolanaStandardWaitForTransactionTask().run(context)
|
package/src/rpc/registry.ts
CHANGED
|
@@ -7,12 +7,28 @@ const solanaRpcs = new LruMap<SolanaRpcType>(12)
|
|
|
7
7
|
const jitoRpcs = new LruMap<JitoRpcType>(12)
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* A well-formed but non-existent Jito bundle id used solely to probe RPC
|
|
11
|
+
* capability. It forces `getBundleStatuses` to actually execute, so we can tell
|
|
12
|
+
* a Jito-capable RPC (resolves with `{ value: [null] }` — bundle not found)
|
|
13
|
+
* apart from a standard Solana RPC (throws "Method not found").
|
|
14
|
+
*
|
|
15
|
+
* Uses all `1`s: 64 chars, valid as both hex and base-58 (base-58 excludes
|
|
16
|
+
* `0`/`O`/`I`/`l`), so a provider that validates the id in either encoding
|
|
17
|
+
* still accepts it and performs the lookup instead of rejecting the probe.
|
|
18
|
+
*/
|
|
19
|
+
const PROBE_BUNDLE_ID =
|
|
20
|
+
'1111111111111111111111111111111111111111111111111111111111111111'
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Checks if an RPC URL supports Jito methods by calling getBundleStatuses.
|
|
24
|
+
* We probe with getBundleStatuses (rather than getTipAccounts) because it is the
|
|
25
|
+
* method actually used during bundle confirmation, and providers such as Helius
|
|
26
|
+
* support sendBundle/getBundleStatuses without exposing getTipAccounts.
|
|
11
27
|
*/
|
|
12
28
|
export const isJitoRpc = async (rpcUrl: string): Promise<boolean> => {
|
|
13
29
|
try {
|
|
14
30
|
const rpc = createJitoRpc(rpcUrl)
|
|
15
|
-
await rpc.
|
|
31
|
+
await rpc.getBundleStatuses([PROBE_BUNDLE_ID]).send()
|
|
16
32
|
return true
|
|
17
33
|
} catch {
|
|
18
34
|
return false
|
package/src/types.ts
CHANGED
|
@@ -14,6 +14,11 @@ export interface SolanaProviderOptions {
|
|
|
14
14
|
|
|
15
15
|
export interface SolanaTaskContext {
|
|
16
16
|
signedTransactions?: Transaction[]
|
|
17
|
+
/**
|
|
18
|
+
* Whether the backend returned a Jito bundle (array `transactionRequest.data`)
|
|
19
|
+
* that must be submitted via `sendBundle` instead of `sendTransaction`.
|
|
20
|
+
*/
|
|
21
|
+
isBundleExecution?: boolean
|
|
17
22
|
}
|
|
18
23
|
|
|
19
24
|
export interface SolanaStepExecutorContext
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/sdk-provider-solana'
|
|
2
|
-
export const version = '4.0.
|
|
2
|
+
export const version = '4.0.5'
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { RouteOptions } from "@lifi/sdk";
|
|
2
|
-
import { Transaction } from "@solana/kit";
|
|
3
|
-
|
|
4
|
-
//#region src/utils/shouldUseJitoBundle.d.ts
|
|
5
|
-
declare const shouldUseJitoBundle: (routeOptions: RouteOptions | undefined, transactions: Transaction[]) => boolean;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { shouldUseJitoBundle };
|
|
8
|
-
//# sourceMappingURL=shouldUseJitoBundle.d.ts.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
let _lifi_sdk = require("@lifi/sdk");
|
|
3
|
-
//#region src/utils/shouldUseJitoBundle.ts
|
|
4
|
-
const shouldUseJitoBundle = (routeOptions, transactions) => {
|
|
5
|
-
const isJitoBundleEnabled = Boolean(routeOptions?.jitoBundle);
|
|
6
|
-
if (transactions.length > 1 && !isJitoBundleEnabled) throw new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.TransactionUnprepared, `Received ${transactions.length} transactions but Jito bundle is not enabled. Enable Jito bundle in routeOptions to submit multiple transactions.`);
|
|
7
|
-
return transactions.length > 1 && isJitoBundleEnabled;
|
|
8
|
-
};
|
|
9
|
-
//#endregion
|
|
10
|
-
exports.shouldUseJitoBundle = shouldUseJitoBundle;
|
|
11
|
-
|
|
12
|
-
//# sourceMappingURL=shouldUseJitoBundle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shouldUseJitoBundle.js","names":["TransactionError","LiFiErrorCode"],"sources":["../../../src/utils/shouldUseJitoBundle.ts"],"sourcesContent":["import { LiFiErrorCode, type RouteOptions, TransactionError } from '@lifi/sdk'\nimport type { Transaction } from '@solana/kit'\n\nexport const shouldUseJitoBundle = (\n routeOptions: RouteOptions | undefined,\n transactions: Transaction[]\n): boolean => {\n const isJitoBundleEnabled = Boolean(routeOptions?.jitoBundle)\n\n if (transactions.length > 1 && !isJitoBundleEnabled) {\n throw new TransactionError(\n LiFiErrorCode.TransactionUnprepared,\n `Received ${transactions.length} transactions but Jito bundle is not enabled. Enable Jito bundle in routeOptions to submit multiple transactions.`\n )\n }\n\n return transactions.length > 1 && isJitoBundleEnabled\n}\n"],"mappings":";;;AAGA,MAAa,uBACX,cACA,iBACY;CACZ,MAAM,sBAAsB,QAAQ,cAAc,UAAU;CAE5D,IAAI,aAAa,SAAS,KAAK,CAAC,qBAC9B,MAAM,IAAIA,UAAAA,iBACRC,UAAAA,cAAc,uBACd,YAAY,aAAa,OAAO,kHAClC;CAGF,OAAO,aAAa,SAAS,KAAK;AACpC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { RouteOptions } from "@lifi/sdk";
|
|
2
|
-
import { Transaction } from "@solana/kit";
|
|
3
|
-
|
|
4
|
-
//#region src/utils/shouldUseJitoBundle.d.ts
|
|
5
|
-
declare const shouldUseJitoBundle: (routeOptions: RouteOptions | undefined, transactions: Transaction[]) => boolean;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { shouldUseJitoBundle };
|
|
8
|
-
//# sourceMappingURL=shouldUseJitoBundle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shouldUseJitoBundle.d.ts","names":[],"sources":["../../../src/utils/shouldUseJitoBundle.ts"],"mappings":";;;;cAGa,mBAAA,GACX,YAAA,EAAc,YAAA,cACd,YAAA,EAAc,WAAA"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { LiFiErrorCode, TransactionError } from "@lifi/sdk";
|
|
2
|
-
//#region src/utils/shouldUseJitoBundle.ts
|
|
3
|
-
const shouldUseJitoBundle = (routeOptions, transactions) => {
|
|
4
|
-
const isJitoBundleEnabled = Boolean(routeOptions?.jitoBundle);
|
|
5
|
-
if (transactions.length > 1 && !isJitoBundleEnabled) throw new TransactionError(LiFiErrorCode.TransactionUnprepared, `Received ${transactions.length} transactions but Jito bundle is not enabled. Enable Jito bundle in routeOptions to submit multiple transactions.`);
|
|
6
|
-
return transactions.length > 1 && isJitoBundleEnabled;
|
|
7
|
-
};
|
|
8
|
-
//#endregion
|
|
9
|
-
export { shouldUseJitoBundle };
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=shouldUseJitoBundle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shouldUseJitoBundle.js","names":[],"sources":["../../../src/utils/shouldUseJitoBundle.ts"],"sourcesContent":["import { LiFiErrorCode, type RouteOptions, TransactionError } from '@lifi/sdk'\nimport type { Transaction } from '@solana/kit'\n\nexport const shouldUseJitoBundle = (\n routeOptions: RouteOptions | undefined,\n transactions: Transaction[]\n): boolean => {\n const isJitoBundleEnabled = Boolean(routeOptions?.jitoBundle)\n\n if (transactions.length > 1 && !isJitoBundleEnabled) {\n throw new TransactionError(\n LiFiErrorCode.TransactionUnprepared,\n `Received ${transactions.length} transactions but Jito bundle is not enabled. Enable Jito bundle in routeOptions to submit multiple transactions.`\n )\n }\n\n return transactions.length > 1 && isJitoBundleEnabled\n}\n"],"mappings":";;AAGA,MAAa,uBACX,cACA,iBACY;CACZ,MAAM,sBAAsB,QAAQ,cAAc,UAAU;CAE5D,IAAI,aAAa,SAAS,KAAK,CAAC,qBAC9B,MAAM,IAAI,iBACR,cAAc,uBACd,YAAY,aAAa,OAAO,kHAClC;CAGF,OAAO,aAAa,SAAS,KAAK;AACpC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { LiFiErrorCode, type RouteOptions, TransactionError } from '@lifi/sdk'
|
|
2
|
-
import type { Transaction } from '@solana/kit'
|
|
3
|
-
|
|
4
|
-
export const shouldUseJitoBundle = (
|
|
5
|
-
routeOptions: RouteOptions | undefined,
|
|
6
|
-
transactions: Transaction[]
|
|
7
|
-
): boolean => {
|
|
8
|
-
const isJitoBundleEnabled = Boolean(routeOptions?.jitoBundle)
|
|
9
|
-
|
|
10
|
-
if (transactions.length > 1 && !isJitoBundleEnabled) {
|
|
11
|
-
throw new TransactionError(
|
|
12
|
-
LiFiErrorCode.TransactionUnprepared,
|
|
13
|
-
`Received ${transactions.length} transactions but Jito bundle is not enabled. Enable Jito bundle in routeOptions to submit multiple transactions.`
|
|
14
|
-
)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return transactions.length > 1 && isJitoBundleEnabled
|
|
18
|
-
}
|