@lifi/sdk-provider-solana 4.0.0-alpha.21 → 4.0.0-alpha.23
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/dist/cjs/SolanaProvider.d.ts +7 -2
- package/dist/cjs/SolanaProvider.js +31 -34
- package/dist/cjs/SolanaProvider.js.map +1 -1
- package/dist/cjs/actions/getSNSAddress.d.ts +5 -1
- package/dist/cjs/actions/getSNSAddress.js +16 -22
- package/dist/cjs/actions/getSNSAddress.js.map +1 -1
- package/dist/cjs/actions/getSolanaBalance.d.ts +7 -3
- package/dist/cjs/actions/getSolanaBalance.js +50 -79
- package/dist/cjs/actions/getSolanaBalance.js.map +1 -1
- package/dist/cjs/actions/resolveSolanaAddress.d.ts +5 -1
- package/dist/cjs/actions/resolveSolanaAddress.js +7 -5
- package/dist/cjs/actions/resolveSolanaAddress.js.map +1 -1
- package/dist/cjs/actions/sendAndConfirmBundle.d.ts +29 -17
- package/dist/cjs/actions/sendAndConfirmBundle.js +59 -84
- package/dist/cjs/actions/sendAndConfirmBundle.js.map +1 -1
- package/dist/cjs/actions/sendAndConfirmTransaction.d.ts +26 -15
- package/dist/cjs/actions/sendAndConfirmTransaction.js +68 -97
- package/dist/cjs/actions/sendAndConfirmTransaction.js.map +1 -1
- package/dist/cjs/core/SolanaStepExecutor.d.ts +16 -9
- package/dist/cjs/core/SolanaStepExecutor.js +47 -48
- package/dist/cjs/core/SolanaStepExecutor.js.map +1 -1
- package/dist/cjs/core/tasks/SolanaJitoWaitForTransactionTask.d.ts +9 -4
- package/dist/cjs/core/tasks/SolanaJitoWaitForTransactionTask.js +31 -39
- package/dist/cjs/core/tasks/SolanaJitoWaitForTransactionTask.js.map +1 -1
- package/dist/cjs/core/tasks/SolanaSignAndExecuteTask.d.ts +9 -4
- package/dist/cjs/core/tasks/SolanaSignAndExecuteTask.js +36 -45
- package/dist/cjs/core/tasks/SolanaSignAndExecuteTask.js.map +1 -1
- package/dist/cjs/core/tasks/SolanaStandardWaitForTransactionTask.d.ts +9 -4
- package/dist/cjs/core/tasks/SolanaStandardWaitForTransactionTask.js +43 -56
- package/dist/cjs/core/tasks/SolanaStandardWaitForTransactionTask.js.map +1 -1
- package/dist/cjs/core/tasks/SolanaWaitForTransactionTask.d.ts +9 -4
- package/dist/cjs/core/tasks/SolanaWaitForTransactionTask.js +16 -18
- package/dist/cjs/core/tasks/SolanaWaitForTransactionTask.js.map +1 -1
- package/dist/cjs/errors/parseSolanaErrors.d.ts +7 -2
- package/dist/cjs/errors/parseSolanaErrors.js +18 -28
- package/dist/cjs/errors/parseSolanaErrors.js.map +1 -1
- package/dist/cjs/index.d.ts +5 -5
- package/dist/cjs/index.js +14 -12
- package/dist/cjs/rpc/jito/api/getBundleStatuses.d.ts +22 -14
- package/dist/cjs/rpc/jito/api/getBundleStatuses.js +0 -3
- package/dist/cjs/rpc/jito/api/getTipAccounts.d.ts +14 -4
- package/dist/cjs/rpc/jito/api/getTipAccounts.js +0 -3
- package/dist/cjs/rpc/jito/api/sendBundle.d.ts +21 -5
- package/dist/cjs/rpc/jito/api/sendBundle.js +0 -3
- package/dist/cjs/rpc/jito/api/simulateBundle.d.ts +49 -41
- package/dist/cjs/rpc/jito/api/simulateBundle.js +0 -3
- package/dist/cjs/rpc/jito/createJitoRpc.d.ts +14 -10
- package/dist/cjs/rpc/jito/createJitoRpc.js +16 -11
- package/dist/cjs/rpc/jito/createJitoRpc.js.map +1 -1
- package/dist/cjs/rpc/jito/types.d.ts +8 -1
- package/dist/cjs/rpc/jito/types.js +0 -3
- package/dist/cjs/rpc/registry.d.ts +21 -5
- package/dist/cjs/rpc/registry.js +44 -34
- package/dist/cjs/rpc/registry.js.map +1 -1
- package/dist/cjs/rpc/types.d.ts +9 -4
- package/dist/cjs/rpc/types.js +0 -3
- package/dist/cjs/rpc/utils.d.ts +67 -4
- package/dist/cjs/rpc/utils.js +79 -22
- package/dist/cjs/rpc/utils.js.map +1 -1
- package/dist/cjs/types.d.ts +23 -15
- package/dist/cjs/types.js +7 -5
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/utils/KeypairWallet.unit.helpers.d.ts +7 -3
- package/dist/cjs/utils/KeypairWallet.unit.helpers.js +15 -17
- package/dist/cjs/utils/KeypairWallet.unit.helpers.js.map +1 -1
- package/dist/cjs/utils/KeypairWalletAdapter.d.ts +29 -16
- package/dist/cjs/utils/KeypairWalletAdapter.js +80 -83
- package/dist/cjs/utils/KeypairWalletAdapter.js.map +1 -1
- package/dist/cjs/utils/base64ToUint8Array.d.ts +5 -1
- package/dist/cjs/utils/base64ToUint8Array.js +10 -10
- package/dist/cjs/utils/base64ToUint8Array.js.map +1 -1
- package/dist/cjs/utils/getWalletFeature.d.ts +28 -8
- package/dist/cjs/utils/getWalletFeature.js +23 -8
- package/dist/cjs/utils/getWalletFeature.js.map +1 -1
- package/dist/cjs/utils/shouldUseJitoBundle.d.ts +8 -3
- package/dist/cjs/utils/shouldUseJitoBundle.js +8 -9
- package/dist/cjs/utils/shouldUseJitoBundle.js.map +1 -1
- package/dist/cjs/utils/withTimeout.d.ts +25 -6
- package/dist/cjs/utils/withTimeout.js +33 -33
- package/dist/cjs/utils/withTimeout.js.map +1 -1
- package/dist/cjs/version.d.ts +6 -2
- package/dist/cjs/version.js +8 -5
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/SolanaProvider.d.ts +7 -2
- package/dist/esm/SolanaProvider.d.ts.map +1 -0
- package/dist/esm/SolanaProvider.js +31 -32
- package/dist/esm/SolanaProvider.js.map +1 -1
- package/dist/esm/actions/getSNSAddress.d.ts +5 -1
- package/dist/esm/actions/getSNSAddress.d.ts.map +1 -0
- package/dist/esm/actions/getSNSAddress.js +17 -23
- package/dist/esm/actions/getSNSAddress.js.map +1 -1
- package/dist/esm/actions/getSolanaBalance.d.ts +7 -3
- package/dist/esm/actions/getSolanaBalance.d.ts.map +1 -0
- package/dist/esm/actions/getSolanaBalance.js +50 -78
- package/dist/esm/actions/getSolanaBalance.js.map +1 -1
- package/dist/esm/actions/resolveSolanaAddress.d.ts +5 -1
- package/dist/esm/actions/resolveSolanaAddress.d.ts.map +1 -0
- package/dist/esm/actions/resolveSolanaAddress.js +7 -3
- package/dist/esm/actions/resolveSolanaAddress.js.map +1 -1
- package/dist/esm/actions/sendAndConfirmBundle.d.ts +28 -24
- package/dist/esm/actions/sendAndConfirmBundle.d.ts.map +1 -0
- package/dist/esm/actions/sendAndConfirmBundle.js +58 -97
- package/dist/esm/actions/sendAndConfirmBundle.js.map +1 -1
- package/dist/esm/actions/sendAndConfirmTransaction.d.ts +25 -21
- package/dist/esm/actions/sendAndConfirmTransaction.d.ts.map +1 -0
- package/dist/esm/actions/sendAndConfirmTransaction.js +67 -111
- package/dist/esm/actions/sendAndConfirmTransaction.js.map +1 -1
- package/dist/esm/core/SolanaStepExecutor.d.ts +16 -9
- package/dist/esm/core/SolanaStepExecutor.d.ts.map +1 -0
- package/dist/esm/core/SolanaStepExecutor.js +47 -45
- package/dist/esm/core/SolanaStepExecutor.js.map +1 -1
- package/dist/esm/core/tasks/SolanaJitoWaitForTransactionTask.d.ts +9 -4
- package/dist/esm/core/tasks/SolanaJitoWaitForTransactionTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/SolanaJitoWaitForTransactionTask.js +31 -39
- package/dist/esm/core/tasks/SolanaJitoWaitForTransactionTask.js.map +1 -1
- package/dist/esm/core/tasks/SolanaSignAndExecuteTask.d.ts +9 -4
- package/dist/esm/core/tasks/SolanaSignAndExecuteTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/SolanaSignAndExecuteTask.js +36 -47
- package/dist/esm/core/tasks/SolanaSignAndExecuteTask.js.map +1 -1
- package/dist/esm/core/tasks/SolanaStandardWaitForTransactionTask.d.ts +9 -4
- package/dist/esm/core/tasks/SolanaStandardWaitForTransactionTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/SolanaStandardWaitForTransactionTask.js +43 -55
- package/dist/esm/core/tasks/SolanaStandardWaitForTransactionTask.js.map +1 -1
- package/dist/esm/core/tasks/SolanaWaitForTransactionTask.d.ts +9 -4
- package/dist/esm/core/tasks/SolanaWaitForTransactionTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/SolanaWaitForTransactionTask.js +16 -15
- package/dist/esm/core/tasks/SolanaWaitForTransactionTask.js.map +1 -1
- package/dist/esm/errors/parseSolanaErrors.d.ts +7 -2
- package/dist/esm/errors/parseSolanaErrors.d.ts.map +1 -0
- package/dist/esm/errors/parseSolanaErrors.js +18 -25
- package/dist/esm/errors/parseSolanaErrors.js.map +1 -1
- package/dist/esm/index.d.ts +5 -5
- package/dist/esm/index.js +5 -6
- package/dist/esm/package.json +1 -1
- package/dist/esm/rpc/jito/api/getBundleStatuses.d.ts +22 -22
- package/dist/esm/rpc/jito/api/getBundleStatuses.d.ts.map +1 -0
- package/dist/esm/rpc/jito/api/getBundleStatuses.js +0 -1
- package/dist/esm/rpc/jito/api/getTipAccounts.d.ts +13 -11
- package/dist/esm/rpc/jito/api/getTipAccounts.d.ts.map +1 -0
- package/dist/esm/rpc/jito/api/getTipAccounts.js +0 -1
- package/dist/esm/rpc/jito/api/sendBundle.d.ts +20 -20
- package/dist/esm/rpc/jito/api/sendBundle.d.ts.map +1 -0
- package/dist/esm/rpc/jito/api/sendBundle.js +0 -1
- package/dist/esm/rpc/jito/api/simulateBundle.d.ts +49 -50
- package/dist/esm/rpc/jito/api/simulateBundle.d.ts.map +1 -0
- package/dist/esm/rpc/jito/api/simulateBundle.js +0 -1
- package/dist/esm/rpc/jito/createJitoRpc.d.ts +14 -10
- package/dist/esm/rpc/jito/createJitoRpc.d.ts.map +1 -0
- package/dist/esm/rpc/jito/createJitoRpc.js +16 -12
- package/dist/esm/rpc/jito/createJitoRpc.js.map +1 -1
- package/dist/esm/rpc/jito/types.d.ts +7 -3
- package/dist/esm/rpc/jito/types.d.ts.map +1 -0
- package/dist/esm/rpc/jito/types.js +0 -1
- package/dist/esm/rpc/registry.d.ts +18 -13
- package/dist/esm/rpc/registry.d.ts.map +1 -0
- package/dist/esm/rpc/registry.js +38 -44
- package/dist/esm/rpc/registry.js.map +1 -1
- package/dist/esm/rpc/types.d.ts +9 -4
- package/dist/esm/rpc/types.d.ts.map +1 -0
- package/dist/esm/rpc/types.js +0 -1
- package/dist/esm/rpc/utils.d.ts +64 -57
- package/dist/esm/rpc/utils.d.ts.map +1 -0
- package/dist/esm/rpc/utils.js +73 -75
- package/dist/esm/rpc/utils.js.map +1 -1
- package/dist/esm/types.d.ts +23 -15
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +7 -3
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils/KeypairWallet.unit.helpers.d.ts +7 -3
- package/dist/esm/utils/KeypairWallet.unit.helpers.d.ts.map +1 -0
- package/dist/esm/utils/KeypairWallet.unit.helpers.js +16 -16
- package/dist/esm/utils/KeypairWallet.unit.helpers.js.map +1 -1
- package/dist/esm/utils/KeypairWalletAdapter.d.ts +28 -23
- package/dist/esm/utils/KeypairWalletAdapter.d.ts.map +1 -0
- package/dist/esm/utils/KeypairWalletAdapter.js +79 -89
- package/dist/esm/utils/KeypairWalletAdapter.js.map +1 -1
- package/dist/esm/utils/base64ToUint8Array.d.ts +5 -1
- package/dist/esm/utils/base64ToUint8Array.d.ts.map +1 -0
- package/dist/esm/utils/base64ToUint8Array.js +10 -8
- package/dist/esm/utils/base64ToUint8Array.js.map +1 -1
- package/dist/esm/utils/getWalletFeature.d.ts +27 -23
- package/dist/esm/utils/getWalletFeature.d.ts.map +1 -0
- package/dist/esm/utils/getWalletFeature.js +22 -23
- package/dist/esm/utils/getWalletFeature.js.map +1 -1
- package/dist/esm/utils/shouldUseJitoBundle.d.ts +8 -3
- package/dist/esm/utils/shouldUseJitoBundle.d.ts.map +1 -0
- package/dist/esm/utils/shouldUseJitoBundle.js +9 -7
- package/dist/esm/utils/shouldUseJitoBundle.js.map +1 -1
- package/dist/esm/utils/withTimeout.d.ts +24 -14
- package/dist/esm/utils/withTimeout.d.ts.map +1 -0
- package/dist/esm/utils/withTimeout.js +31 -38
- package/dist/esm/utils/withTimeout.js.map +1 -1
- package/dist/esm/version.d.ts +6 -2
- package/dist/esm/version.d.ts.map +1 -0
- package/dist/esm/version.js +6 -2
- package/dist/esm/version.js.map +1 -1
- package/package.json +6 -6
- package/src/SolanaProvider.ts +1 -0
- package/src/actions/getSNSAddress.ts +3 -1
- package/src/core/SolanaStepExecutor.ts +8 -3
- package/src/core/tasks/SolanaStandardWaitForTransactionTask.ts +25 -23
- package/src/rpc/utils.ts +10 -2
- package/src/types.ts +3 -0
- package/src/utils/KeypairWallet.unit.helpers.ts +4 -1
- package/src/utils/base64ToUint8Array.ts +1 -1
- package/src/version.ts +1 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/rpc/jito/api/getBundleStatuses.js.map +0 -1
- package/dist/cjs/rpc/jito/api/getTipAccounts.js.map +0 -1
- package/dist/cjs/rpc/jito/api/sendBundle.js.map +0 -1
- package/dist/cjs/rpc/jito/api/simulateBundle.js.map +0 -1
- package/dist/cjs/rpc/jito/types.js.map +0 -1
- package/dist/cjs/rpc/types.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/rpc/jito/api/getBundleStatuses.js.map +0 -1
- package/dist/esm/rpc/jito/api/getTipAccounts.js.map +0 -1
- package/dist/esm/rpc/jito/api/sendBundle.js.map +0 -1
- package/dist/esm/rpc/jito/api/simulateBundle.js.map +0 -1
- package/dist/esm/rpc/jito/types.js.map +0 -1
- package/dist/esm/rpc/types.js.map +0 -1
- package/dist/types/SolanaProvider.d.ts +0 -3
- package/dist/types/SolanaProvider.d.ts.map +0 -1
- package/dist/types/actions/getSNSAddress.d.ts +0 -2
- package/dist/types/actions/getSNSAddress.d.ts.map +0 -1
- package/dist/types/actions/getSolanaBalance.d.ts +0 -4
- package/dist/types/actions/getSolanaBalance.d.ts.map +0 -1
- package/dist/types/actions/resolveSolanaAddress.d.ts +0 -2
- package/dist/types/actions/resolveSolanaAddress.d.ts.map +0 -1
- package/dist/types/actions/sendAndConfirmBundle.d.ts +0 -29
- package/dist/types/actions/sendAndConfirmBundle.d.ts.map +0 -1
- package/dist/types/actions/sendAndConfirmTransaction.d.ts +0 -27
- package/dist/types/actions/sendAndConfirmTransaction.d.ts.map +0 -1
- package/dist/types/core/SolanaStepExecutor.d.ts +0 -11
- package/dist/types/core/SolanaStepExecutor.d.ts.map +0 -1
- package/dist/types/core/tasks/SolanaJitoWaitForTransactionTask.d.ts +0 -6
- package/dist/types/core/tasks/SolanaJitoWaitForTransactionTask.d.ts.map +0 -1
- package/dist/types/core/tasks/SolanaSignAndExecuteTask.d.ts +0 -6
- package/dist/types/core/tasks/SolanaSignAndExecuteTask.d.ts.map +0 -1
- package/dist/types/core/tasks/SolanaStandardWaitForTransactionTask.d.ts +0 -6
- package/dist/types/core/tasks/SolanaStandardWaitForTransactionTask.d.ts.map +0 -1
- package/dist/types/core/tasks/SolanaWaitForTransactionTask.d.ts +0 -6
- package/dist/types/core/tasks/SolanaWaitForTransactionTask.d.ts.map +0 -1
- package/dist/types/errors/parseSolanaErrors.d.ts +0 -3
- package/dist/types/errors/parseSolanaErrors.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -6
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/rpc/jito/api/getBundleStatuses.d.ts +0 -28
- package/dist/types/rpc/jito/api/getBundleStatuses.d.ts.map +0 -1
- package/dist/types/rpc/jito/api/getTipAccounts.d.ts +0 -15
- package/dist/types/rpc/jito/api/getTipAccounts.d.ts.map +0 -1
- package/dist/types/rpc/jito/api/sendBundle.d.ts +0 -24
- package/dist/types/rpc/jito/api/sendBundle.d.ts.map +0 -1
- package/dist/types/rpc/jito/api/simulateBundle.d.ts +0 -59
- package/dist/types/rpc/jito/api/simulateBundle.d.ts.map +0 -1
- package/dist/types/rpc/jito/createJitoRpc.d.ts +0 -11
- package/dist/types/rpc/jito/createJitoRpc.d.ts.map +0 -1
- package/dist/types/rpc/jito/types.d.ts +0 -5
- package/dist/types/rpc/jito/types.d.ts.map +0 -1
- package/dist/types/rpc/registry.d.ts +0 -17
- package/dist/types/rpc/registry.d.ts.map +0 -1
- package/dist/types/rpc/types.d.ts +0 -5
- package/dist/types/rpc/types.d.ts.map +0 -1
- package/dist/types/rpc/utils.d.ts +0 -61
- package/dist/types/rpc/utils.d.ts.map +0 -1
- package/dist/types/types.d.ts +0 -21
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/utils/KeypairWallet.unit.helpers.d.ts +0 -5
- package/dist/types/utils/KeypairWallet.unit.helpers.d.ts.map +0 -1
- package/dist/types/utils/KeypairWalletAdapter.d.ts +0 -26
- package/dist/types/utils/KeypairWalletAdapter.d.ts.map +0 -1
- package/dist/types/utils/base64ToUint8Array.d.ts +0 -2
- package/dist/types/utils/base64ToUint8Array.d.ts.map +0 -1
- package/dist/types/utils/getWalletFeature.d.ts +0 -27
- package/dist/types/utils/getWalletFeature.d.ts.map +0 -1
- package/dist/types/utils/shouldUseJitoBundle.d.ts +0 -4
- package/dist/types/utils/shouldUseJitoBundle.d.ts.map +0 -1
- package/dist/types/utils/withTimeout.d.ts +0 -17
- package/dist/types/utils/withTimeout.d.ts.map +0 -1
- package/dist/types/version.d.ts +0 -3
- package/dist/types/version.d.ts.map +0 -1
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { SolanaProviderOptions, SolanaSDKProvider } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/SolanaProvider.d.ts
|
|
4
|
+
declare function SolanaProvider(options?: SolanaProviderOptions): SolanaSDKProvider;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { SolanaProvider };
|
|
7
|
+
//# sourceMappingURL=SolanaProvider.d.ts.map
|
|
@@ -1,37 +1,34 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const SolanaStepExecutor_js_1 = require("./core/SolanaStepExecutor.js");
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_actions_getSolanaBalance = require("./actions/getSolanaBalance.js");
|
|
3
|
+
const require_actions_resolveSolanaAddress = require("./actions/resolveSolanaAddress.js");
|
|
4
|
+
const require_core_SolanaStepExecutor = require("./core/SolanaStepExecutor.js");
|
|
5
|
+
let _lifi_sdk = require("@lifi/sdk");
|
|
6
|
+
let _solana_kit = require("@solana/kit");
|
|
7
|
+
//#region src/SolanaProvider.ts
|
|
9
8
|
function SolanaProvider(options) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
setOptions(options) {
|
|
33
|
-
Object.assign(_options, options);
|
|
34
|
-
},
|
|
35
|
-
};
|
|
9
|
+
const _options = options ?? {};
|
|
10
|
+
return {
|
|
11
|
+
get type() {
|
|
12
|
+
return _lifi_sdk.ChainType.SVM;
|
|
13
|
+
},
|
|
14
|
+
isAddress: _solana_kit.isAddress,
|
|
15
|
+
resolveAddress: require_actions_resolveSolanaAddress.resolveSolanaAddress,
|
|
16
|
+
getBalance: require_actions_getSolanaBalance.getSolanaBalance,
|
|
17
|
+
async getStepExecutor(options) {
|
|
18
|
+
if (!_options.getWallet) throw new _lifi_sdk.ProviderError(_lifi_sdk.LiFiErrorCode.ConfigError, "SolanaProvider requires a getWallet function");
|
|
19
|
+
return new require_core_SolanaStepExecutor.SolanaStepExecutor({
|
|
20
|
+
wallet: await _options.getWallet(),
|
|
21
|
+
routeId: options.routeId,
|
|
22
|
+
skipSimulation: _options.skipSimulation,
|
|
23
|
+
executionOptions: { ...options.executionOptions }
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
setOptions(options) {
|
|
27
|
+
Object.assign(_options, options);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
36
30
|
}
|
|
31
|
+
//#endregion
|
|
32
|
+
exports.SolanaProvider = SolanaProvider;
|
|
33
|
+
|
|
37
34
|
//# sourceMappingURL=SolanaProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolanaProvider.js","
|
|
1
|
+
{"version":3,"file":"SolanaProvider.js","names":["ChainType","resolveSolanaAddress","getSolanaBalance","ProviderError","LiFiErrorCode","SolanaStepExecutor"],"sources":["../../src/SolanaProvider.ts"],"sourcesContent":["import {\n ChainType,\n LiFiErrorCode,\n ProviderError,\n type StepExecutorOptions,\n} from '@lifi/sdk'\nimport { isAddress } from '@solana/kit'\nimport { getSolanaBalance } from './actions/getSolanaBalance.js'\nimport { resolveSolanaAddress } from './actions/resolveSolanaAddress.js'\nimport { SolanaStepExecutor } from './core/SolanaStepExecutor.js'\nimport type { SolanaProviderOptions, SolanaSDKProvider } from './types.js'\n\nexport function SolanaProvider(\n options?: SolanaProviderOptions\n): SolanaSDKProvider {\n const _options: SolanaProviderOptions = options ?? {}\n return {\n get type() {\n return ChainType.SVM\n },\n isAddress,\n resolveAddress: resolveSolanaAddress,\n getBalance: getSolanaBalance,\n async getStepExecutor(\n options: StepExecutorOptions\n ): Promise<SolanaStepExecutor> {\n if (!_options.getWallet) {\n throw new ProviderError(\n LiFiErrorCode.ConfigError,\n 'SolanaProvider requires a getWallet function'\n )\n }\n\n const wallet = await _options.getWallet()\n\n const executor = new SolanaStepExecutor({\n wallet,\n routeId: options.routeId,\n skipSimulation: _options.skipSimulation,\n executionOptions: {\n ...options.executionOptions,\n },\n })\n\n return executor\n },\n setOptions(options: SolanaProviderOptions) {\n Object.assign(_options, options)\n },\n }\n}\n"],"mappings":";;;;;;;AAYA,SAAgB,eACd,SACmB;CACnB,MAAM,WAAkC,WAAW,EAAE;AACrD,QAAO;EACL,IAAI,OAAO;AACT,UAAOA,UAAAA,UAAU;;EAEnB,WAAA,YAAA;EACA,gBAAgBC,qCAAAA;EAChB,YAAYC,iCAAAA;EACZ,MAAM,gBACJ,SAC6B;AAC7B,OAAI,CAAC,SAAS,UACZ,OAAM,IAAIC,UAAAA,cACRC,UAAAA,cAAc,aACd,+CACD;AAcH,UATiB,IAAIC,gCAAAA,mBAAmB;IACtC,QAHa,MAAM,SAAS,WAAW;IAIvC,SAAS,QAAQ;IACjB,gBAAgB,SAAS;IACzB,kBAAkB,EAChB,GAAG,QAAQ,kBACZ;IACF,CAAC;;EAIJ,WAAW,SAAgC;AACzC,UAAO,OAAO,UAAU,QAAQ;;EAEnC"}
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/actions/getSNSAddress.d.ts
|
|
2
|
+
declare const getSNSAddress: (name: string) => Promise<string | undefined>;
|
|
3
|
+
//#endregion
|
|
4
|
+
export { getSNSAddress };
|
|
5
|
+
//# sourceMappingURL=getSNSAddress.d.ts.map
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const kit_1 = require("@solana/kit");
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let _solana_kit = require("@solana/kit");
|
|
3
|
+
//#region src/actions/getSNSAddress.ts
|
|
5
4
|
const getSNSAddress = async (name) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
return data.result;
|
|
20
|
-
}
|
|
21
|
-
catch (_) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
5
|
+
try {
|
|
6
|
+
if (!name.endsWith(".sol")) return;
|
|
7
|
+
const snsWorkerUrl = `https://sns-sdk-proxy.bonfida.workers.dev/resolve/${name}`;
|
|
8
|
+
const response = await fetch(snsWorkerUrl);
|
|
9
|
+
if (!response.ok) return;
|
|
10
|
+
const data = await response.json();
|
|
11
|
+
if (!(0, _solana_kit.isAddress)(data.result)) return;
|
|
12
|
+
return data.result;
|
|
13
|
+
} catch (_) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
24
16
|
};
|
|
17
|
+
//#endregion
|
|
25
18
|
exports.getSNSAddress = getSNSAddress;
|
|
19
|
+
|
|
26
20
|
//# sourceMappingURL=getSNSAddress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSNSAddress.js","
|
|
1
|
+
{"version":3,"file":"getSNSAddress.js","names":[],"sources":["../../../src/actions/getSNSAddress.ts"],"sourcesContent":["import { isAddress } from '@solana/kit'\n\ninterface SNSResult {\n s: 'ok' | 'error'\n result: string\n}\n\n// Subject to change\n// https://github.com/Bonfida/sns-sdk?tab=readme-ov-file#sdk-proxy\nexport const getSNSAddress = async (\n name: string\n): Promise<string | undefined> => {\n try {\n if (!name.endsWith('.sol')) {\n return\n }\n const snsWorkerUrl = `https://sns-sdk-proxy.bonfida.workers.dev/resolve/${name}`\n const response: Response = await fetch(snsWorkerUrl)\n if (!response.ok) {\n return\n }\n\n const data: SNSResult = await response.json()\n\n if (!isAddress(data.result)) {\n return\n }\n\n return data.result\n } catch (_) {\n // ignore\n return\n }\n}\n"],"mappings":";;;AASA,MAAa,gBAAgB,OAC3B,SACgC;AAChC,KAAI;AACF,MAAI,CAAC,KAAK,SAAS,OAAO,CACxB;EAEF,MAAM,eAAe,qDAAqD;EAC1E,MAAM,WAAqB,MAAM,MAAM,aAAa;AACpD,MAAI,CAAC,SAAS,GACZ;EAGF,MAAM,OAAkB,MAAM,SAAS,MAAM;AAE7C,MAAI,EAAA,GAAA,YAAA,WAAW,KAAK,OAAO,CACzB;AAGF,SAAO,KAAK;UACL,GAAG;AAEV"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { SDKClient, Token, TokenAmount } from "@lifi/sdk";
|
|
2
|
+
|
|
3
|
+
//#region src/actions/getSolanaBalance.d.ts
|
|
4
|
+
declare const getSolanaBalance: (client: SDKClient, walletAddress: string, tokens: Token[]) => Promise<TokenAmount[]>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { getSolanaBalance };
|
|
7
|
+
//# sourceMappingURL=getSolanaBalance.d.ts.map
|
|
@@ -1,84 +1,55 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const Token2022ProgramId = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb';
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_rpc_utils = require("../rpc/utils.js");
|
|
3
|
+
let _lifi_sdk = require("@lifi/sdk");
|
|
4
|
+
let _solana_kit = require("@solana/kit");
|
|
5
|
+
//#region src/actions/getSolanaBalance.ts
|
|
6
|
+
const SolSystemProgram = "11111111111111111111111111111111";
|
|
7
|
+
const TokenProgramId = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
8
|
+
const Token2022ProgramId = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
|
|
10
9
|
const getSolanaBalance = async (client, walletAddress, tokens) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
for (const token of tokens) {
|
|
16
|
-
if (token.chainId !== chainId) {
|
|
17
|
-
console.warn('Requested tokens have to be on the same chain.');
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return getSolanaBalanceDefault(client, chainId, tokens, walletAddress);
|
|
10
|
+
if (tokens.length === 0) return [];
|
|
11
|
+
const { chainId } = tokens[0];
|
|
12
|
+
for (const token of tokens) if (token.chainId !== chainId) console.warn("Requested tokens have to be on the same chain.");
|
|
13
|
+
return getSolanaBalanceDefault(client, chainId, tokens, walletAddress);
|
|
21
14
|
};
|
|
22
|
-
exports.getSolanaBalance = getSolanaBalance;
|
|
23
15
|
const getSolanaBalanceDefault = async (client, _chainId, tokens, walletAddress) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
: []),
|
|
60
|
-
].reduce((tokenAmounts, value) => {
|
|
61
|
-
const tokenAccount = value.account.data.parsed.info;
|
|
62
|
-
const amount = BigInt(tokenAccount.tokenAmount.amount);
|
|
63
|
-
if (amount > 0n) {
|
|
64
|
-
tokenAmounts[tokenAccount.mint] = amount;
|
|
65
|
-
}
|
|
66
|
-
return tokenAmounts;
|
|
67
|
-
}, {});
|
|
68
|
-
walletTokenAmounts[SolSystemProgram] = solBalance;
|
|
69
|
-
const tokenAmounts = tokens.map((token) => {
|
|
70
|
-
if (walletTokenAmounts[token.address]) {
|
|
71
|
-
return {
|
|
72
|
-
...token,
|
|
73
|
-
amount: walletTokenAmounts[token.address],
|
|
74
|
-
blockNumber,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
return {
|
|
78
|
-
...token,
|
|
79
|
-
blockNumber,
|
|
80
|
-
};
|
|
81
|
-
});
|
|
82
|
-
return tokenAmounts;
|
|
16
|
+
const accountAddress = (0, _solana_kit.address)(walletAddress);
|
|
17
|
+
const tokenProgramAddress = (0, _solana_kit.address)(TokenProgramId);
|
|
18
|
+
const token2022ProgramAddress = (0, _solana_kit.address)(Token2022ProgramId);
|
|
19
|
+
const [slot, balance, tokenAccountsByOwner, token2022AccountsByOwner] = await Promise.allSettled([
|
|
20
|
+
(0, _lifi_sdk.withDedupe)(() => require_rpc_utils.callSolanaRpcsWithRetry(client, (rpc) => rpc.getSlot({ commitment: "confirmed" }).send()), { id: `${getSolanaBalanceDefault.name}.getSlot` }),
|
|
21
|
+
(0, _lifi_sdk.withDedupe)(() => require_rpc_utils.callSolanaRpcsWithRetry(client, (rpc) => rpc.getBalance(accountAddress, { commitment: "confirmed" }).send()), { id: `${getSolanaBalanceDefault.name}.getBalance` }),
|
|
22
|
+
(0, _lifi_sdk.withDedupe)(() => require_rpc_utils.callSolanaRpcsWithRetry(client, (rpc) => rpc.getTokenAccountsByOwner(accountAddress, { programId: tokenProgramAddress }, {
|
|
23
|
+
commitment: "confirmed",
|
|
24
|
+
encoding: "jsonParsed"
|
|
25
|
+
}).send()), { id: `${getSolanaBalanceDefault.name}.getTokenAccountsByOwner.${TokenProgramId}` }),
|
|
26
|
+
(0, _lifi_sdk.withDedupe)(() => require_rpc_utils.callSolanaRpcsWithRetry(client, (rpc) => rpc.getTokenAccountsByOwner(accountAddress, { programId: token2022ProgramAddress }, {
|
|
27
|
+
commitment: "confirmed",
|
|
28
|
+
encoding: "jsonParsed"
|
|
29
|
+
}).send()), { id: `${getSolanaBalanceDefault.name}.getTokenAccountsByOwner.${Token2022ProgramId}` })
|
|
30
|
+
]);
|
|
31
|
+
const blockNumber = slot.status === "fulfilled" ? BigInt(slot.value) : 0n;
|
|
32
|
+
const solBalance = balance.status === "fulfilled" ? BigInt(balance.value.value) : 0n;
|
|
33
|
+
const walletTokenAmounts = [...tokenAccountsByOwner.status === "fulfilled" ? tokenAccountsByOwner.value.value : [], ...token2022AccountsByOwner.status === "fulfilled" ? token2022AccountsByOwner.value.value : []].reduce((tokenAmounts, value) => {
|
|
34
|
+
const tokenAccount = value.account.data.parsed.info;
|
|
35
|
+
const amount = BigInt(tokenAccount.tokenAmount.amount);
|
|
36
|
+
if (amount > 0n) tokenAmounts[tokenAccount.mint] = amount;
|
|
37
|
+
return tokenAmounts;
|
|
38
|
+
}, {});
|
|
39
|
+
walletTokenAmounts[SolSystemProgram] = solBalance;
|
|
40
|
+
return tokens.map((token) => {
|
|
41
|
+
if (walletTokenAmounts[token.address]) return {
|
|
42
|
+
...token,
|
|
43
|
+
amount: walletTokenAmounts[token.address],
|
|
44
|
+
blockNumber
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
...token,
|
|
48
|
+
blockNumber
|
|
49
|
+
};
|
|
50
|
+
});
|
|
83
51
|
};
|
|
52
|
+
//#endregion
|
|
53
|
+
exports.getSolanaBalance = getSolanaBalance;
|
|
54
|
+
|
|
84
55
|
//# sourceMappingURL=getSolanaBalance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSolanaBalance.js","
|
|
1
|
+
{"version":3,"file":"getSolanaBalance.js","names":["callSolanaRpcsWithRetry"],"sources":["../../../src/actions/getSolanaBalance.ts"],"sourcesContent":["import type { SDKClient } from '@lifi/sdk'\nimport {\n type ChainId,\n type Token,\n type TokenAmount,\n withDedupe,\n} from '@lifi/sdk'\nimport { address, type JsonParsedTokenAccount } from '@solana/kit'\n\nimport { callSolanaRpcsWithRetry } from '../rpc/utils.js'\n\nconst SolSystemProgram = '11111111111111111111111111111111'\nconst TokenProgramId = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'\nconst Token2022ProgramId = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'\n\nexport const getSolanaBalance = async (\n client: SDKClient,\n walletAddress: string,\n tokens: Token[]\n): Promise<TokenAmount[]> => {\n if (tokens.length === 0) {\n return []\n }\n const { chainId } = tokens[0]\n for (const token of tokens) {\n if (token.chainId !== chainId) {\n console.warn('Requested tokens have to be on the same chain.')\n }\n }\n\n return getSolanaBalanceDefault(client, chainId, tokens, walletAddress)\n}\n\nconst getSolanaBalanceDefault = async (\n client: SDKClient,\n _chainId: ChainId,\n tokens: Token[],\n walletAddress: string\n): Promise<TokenAmount[]> => {\n // Convert addresses to Solana Kit's address type\n const accountAddress = address(walletAddress)\n const tokenProgramAddress = address(TokenProgramId)\n const token2022ProgramAddress = address(Token2022ProgramId)\n\n // Use Solana Kit's RPC API with the retry wrapper\n const [slot, balance, tokenAccountsByOwner, token2022AccountsByOwner] =\n await Promise.allSettled([\n withDedupe(\n () =>\n callSolanaRpcsWithRetry(client, (rpc) =>\n rpc.getSlot({ commitment: 'confirmed' }).send()\n ),\n { id: `${getSolanaBalanceDefault.name}.getSlot` }\n ),\n withDedupe(\n () =>\n callSolanaRpcsWithRetry(client, (rpc) =>\n rpc.getBalance(accountAddress, { commitment: 'confirmed' }).send()\n ),\n { id: `${getSolanaBalanceDefault.name}.getBalance` }\n ),\n withDedupe(\n () =>\n callSolanaRpcsWithRetry(client, (rpc) =>\n rpc\n .getTokenAccountsByOwner(\n accountAddress,\n {\n programId: tokenProgramAddress,\n },\n {\n commitment: 'confirmed',\n encoding: 'jsonParsed',\n }\n )\n .send()\n ),\n {\n id: `${getSolanaBalanceDefault.name}.getTokenAccountsByOwner.${TokenProgramId}`,\n }\n ),\n withDedupe(\n () =>\n callSolanaRpcsWithRetry(client, (rpc) =>\n rpc\n .getTokenAccountsByOwner(\n accountAddress,\n {\n programId: token2022ProgramAddress,\n },\n {\n commitment: 'confirmed',\n encoding: 'jsonParsed',\n }\n )\n .send()\n ),\n {\n id: `${getSolanaBalanceDefault.name}.getTokenAccountsByOwner.${Token2022ProgramId}`,\n }\n ),\n ])\n const blockNumber = slot.status === 'fulfilled' ? BigInt(slot.value) : 0n\n const solBalance =\n balance.status === 'fulfilled' ? BigInt(balance.value.value) : 0n\n\n const walletTokenAmounts = [\n ...(tokenAccountsByOwner.status === 'fulfilled'\n ? tokenAccountsByOwner.value.value\n : []),\n ...(token2022AccountsByOwner.status === 'fulfilled'\n ? token2022AccountsByOwner.value.value\n : []),\n ].reduce(\n (tokenAmounts: Record<string, bigint>, value) => {\n const tokenAccount: JsonParsedTokenAccount =\n value.account.data.parsed.info\n const amount = BigInt(tokenAccount.tokenAmount.amount)\n if (amount > 0n) {\n tokenAmounts[tokenAccount.mint] = amount\n }\n return tokenAmounts\n },\n {} as Record<string, bigint>\n )\n\n walletTokenAmounts[SolSystemProgram] = solBalance\n const tokenAmounts: TokenAmount[] = tokens.map((token) => {\n if (walletTokenAmounts[token.address]) {\n return {\n ...token,\n amount: walletTokenAmounts[token.address],\n blockNumber,\n }\n }\n return {\n ...token,\n blockNumber,\n }\n })\n return tokenAmounts\n}\n"],"mappings":";;;;;AAWA,MAAM,mBAAmB;AACzB,MAAM,iBAAiB;AACvB,MAAM,qBAAqB;AAE3B,MAAa,mBAAmB,OAC9B,QACA,eACA,WAC2B;AAC3B,KAAI,OAAO,WAAW,EACpB,QAAO,EAAE;CAEX,MAAM,EAAE,YAAY,OAAO;AAC3B,MAAK,MAAM,SAAS,OAClB,KAAI,MAAM,YAAY,QACpB,SAAQ,KAAK,iDAAiD;AAIlE,QAAO,wBAAwB,QAAQ,SAAS,QAAQ,cAAc;;AAGxE,MAAM,0BAA0B,OAC9B,QACA,UACA,QACA,kBAC2B;CAE3B,MAAM,kBAAA,GAAA,YAAA,SAAyB,cAAc;CAC7C,MAAM,uBAAA,GAAA,YAAA,SAA8B,eAAe;CACnD,MAAM,2BAAA,GAAA,YAAA,SAAkC,mBAAmB;CAG3D,MAAM,CAAC,MAAM,SAAS,sBAAsB,4BAC1C,MAAM,QAAQ,WAAW;kCAGnBA,kBAAAA,wBAAwB,SAAS,QAC/B,IAAI,QAAQ,EAAE,YAAY,aAAa,CAAC,CAAC,MAAM,CAChD,EACH,EAAE,IAAI,GAAG,wBAAwB,KAAK,WAAW,CAClD;kCAGGA,kBAAAA,wBAAwB,SAAS,QAC/B,IAAI,WAAW,gBAAgB,EAAE,YAAY,aAAa,CAAC,CAAC,MAAM,CACnE,EACH,EAAE,IAAI,GAAG,wBAAwB,KAAK,cAAc,CACrD;kCAGGA,kBAAAA,wBAAwB,SAAS,QAC/B,IACG,wBACC,gBACA,EACE,WAAW,qBACZ,EACD;GACE,YAAY;GACZ,UAAU;GACX,CACF,CACA,MAAM,CACV,EACH,EACE,IAAI,GAAG,wBAAwB,KAAK,2BAA2B,kBAChE,CACF;kCAGGA,kBAAAA,wBAAwB,SAAS,QAC/B,IACG,wBACC,gBACA,EACE,WAAW,yBACZ,EACD;GACE,YAAY;GACZ,UAAU;GACX,CACF,CACA,MAAM,CACV,EACH,EACE,IAAI,GAAG,wBAAwB,KAAK,2BAA2B,sBAChE,CACF;EACF,CAAC;CACJ,MAAM,cAAc,KAAK,WAAW,cAAc,OAAO,KAAK,MAAM,GAAG;CACvE,MAAM,aACJ,QAAQ,WAAW,cAAc,OAAO,QAAQ,MAAM,MAAM,GAAG;CAEjE,MAAM,qBAAqB,CACzB,GAAI,qBAAqB,WAAW,cAChC,qBAAqB,MAAM,QAC3B,EAAE,EACN,GAAI,yBAAyB,WAAW,cACpC,yBAAyB,MAAM,QAC/B,EAAE,CACP,CAAC,QACC,cAAsC,UAAU;EAC/C,MAAM,eACJ,MAAM,QAAQ,KAAK,OAAO;EAC5B,MAAM,SAAS,OAAO,aAAa,YAAY,OAAO;AACtD,MAAI,SAAS,GACX,cAAa,aAAa,QAAQ;AAEpC,SAAO;IAET,EAAE,CACH;AAED,oBAAmB,oBAAoB;AAcvC,QAboC,OAAO,KAAK,UAAU;AACxD,MAAI,mBAAmB,MAAM,SAC3B,QAAO;GACL,GAAG;GACH,QAAQ,mBAAmB,MAAM;GACjC;GACD;AAEH,SAAO;GACL,GAAG;GACH;GACD;GACD"}
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/actions/resolveSolanaAddress.d.ts
|
|
2
|
+
declare function resolveSolanaAddress(name: string): Promise<string | undefined>;
|
|
3
|
+
//#endregion
|
|
4
|
+
export { resolveSolanaAddress };
|
|
5
|
+
//# sourceMappingURL=resolveSolanaAddress.d.ts.map
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const getSNSAddress_js_1 = require("./getSNSAddress.js");
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_actions_getSNSAddress = require("./getSNSAddress.js");
|
|
3
|
+
//#region src/actions/resolveSolanaAddress.ts
|
|
5
4
|
async function resolveSolanaAddress(name) {
|
|
6
|
-
|
|
5
|
+
return await require_actions_getSNSAddress.getSNSAddress(name);
|
|
7
6
|
}
|
|
7
|
+
//#endregion
|
|
8
|
+
exports.resolveSolanaAddress = resolveSolanaAddress;
|
|
9
|
+
|
|
8
10
|
//# sourceMappingURL=resolveSolanaAddress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveSolanaAddress.js","
|
|
1
|
+
{"version":3,"file":"resolveSolanaAddress.js","names":["getSNSAddress"],"sources":["../../../src/actions/resolveSolanaAddress.ts"],"sourcesContent":["import { getSNSAddress } from './getSNSAddress.js'\n\nexport async function resolveSolanaAddress(\n name: string\n): Promise<string | undefined> {\n return await getSNSAddress(name)\n}\n"],"mappings":";;;AAEA,eAAsB,qBACpB,MAC6B;AAC7B,QAAO,MAAMA,8BAAAA,cAAc,KAAK"}
|
|
@@ -1,20 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { SDKClient } from "@lifi/sdk";
|
|
2
|
+
import { Commitment, Signature, Transaction, TransactionError } from "@solana/kit";
|
|
3
|
+
|
|
4
|
+
//#region src/actions/sendAndConfirmBundle.d.ts
|
|
3
5
|
type SignatureStatus = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
slot: bigint;
|
|
7
|
+
confirmations: bigint | null;
|
|
8
|
+
err: TransactionError | null;
|
|
9
|
+
confirmationStatus: Commitment | null;
|
|
10
|
+
status: Readonly<{
|
|
11
|
+
Err: TransactionError;
|
|
12
|
+
}> | Readonly<{
|
|
13
|
+
Ok: null;
|
|
14
|
+
}>;
|
|
13
15
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
type BundleResult = {
|
|
17
|
+
bundleId: string;
|
|
18
|
+
txSignatures: Signature[];
|
|
19
|
+
signatureResults: (SignatureStatus | null)[];
|
|
18
20
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Send and confirm a bundle of transactions using Jito.
|
|
23
|
+
* Automatically selects a Jito-enabled RPC connection and polls for confirmation
|
|
24
|
+
* across multiple Jito RPCs in parallel.
|
|
25
|
+
* @param client - The SDK client.
|
|
26
|
+
* @param signedTransactions - Array of signed transactions to bundle.
|
|
27
|
+
* @returns BundleResult containing Bundle ID, transaction signatures, and confirmation results.
|
|
28
|
+
*/
|
|
29
|
+
declare function sendAndConfirmBundle(client: SDKClient, signedTransactions: Transaction[]): Promise<BundleResult>;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { BundleResult, sendAndConfirmBundle };
|
|
32
|
+
//# sourceMappingURL=sendAndConfirmBundle.d.ts.map
|
|
@@ -1,87 +1,62 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_rpc_registry = require("../rpc/registry.js");
|
|
3
|
+
let _lifi_sdk = require("@lifi/sdk");
|
|
4
|
+
let _solana_kit = require("@solana/kit");
|
|
5
|
+
//#region src/actions/sendAndConfirmBundle.ts
|
|
6
|
+
/**
|
|
7
|
+
* Send and confirm a bundle of transactions using Jito.
|
|
8
|
+
* Automatically selects a Jito-enabled RPC connection and polls for confirmation
|
|
9
|
+
* across multiple Jito RPCs in parallel.
|
|
10
|
+
* @param client - The SDK client.
|
|
11
|
+
* @param signedTransactions - Array of signed transactions to bundle.
|
|
12
|
+
* @returns BundleResult containing Bundle ID, transaction signatures, and confirmation results.
|
|
13
|
+
*/
|
|
7
14
|
async function sendAndConfirmBundle(client, signedTransactions) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
abortController.abort();
|
|
54
|
-
return {
|
|
55
|
-
bundleId,
|
|
56
|
-
txSignatures,
|
|
57
|
-
signatureResults: sigResponse.value,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
await (0, sdk_1.sleep)(400);
|
|
61
|
-
if (!abortController.signal.aborted) {
|
|
62
|
-
currentBlockHeight = await jitoRpc
|
|
63
|
-
.getBlockHeight({
|
|
64
|
-
commitment: 'confirmed',
|
|
65
|
-
})
|
|
66
|
-
.send();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
if (abortController.signal.aborted) {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
throw error;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
const result = await Promise.any(confirmPromises).catch(() => null);
|
|
79
|
-
if (!abortController.signal.aborted) {
|
|
80
|
-
abortController.abort();
|
|
81
|
-
}
|
|
82
|
-
if (!result) {
|
|
83
|
-
throw new Error('Failed to send and confirm bundle');
|
|
84
|
-
}
|
|
85
|
-
return result;
|
|
15
|
+
const jitoRpcs = await require_rpc_registry.getJitoRpcs(client);
|
|
16
|
+
if (jitoRpcs.length === 0) throw new Error("No Jito-enabled RPC connection available for bundle submission");
|
|
17
|
+
const serializedTransactions = signedTransactions.map((tx) => (0, _solana_kit.getBase64EncodedWireTransaction)(tx));
|
|
18
|
+
const abortController = new AbortController();
|
|
19
|
+
const confirmPromises = jitoRpcs.map(async (jitoRpc) => {
|
|
20
|
+
try {
|
|
21
|
+
let bundleId;
|
|
22
|
+
try {
|
|
23
|
+
bundleId = await jitoRpc.sendBundle(serializedTransactions).send();
|
|
24
|
+
} catch (_) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const [{ value: blockhashResult }, initialBlockHeight] = await Promise.all([jitoRpc.getLatestBlockhash({ commitment: "confirmed" }).send(), jitoRpc.getBlockHeight({ commitment: "confirmed" }).send()]);
|
|
28
|
+
let currentBlockHeight = initialBlockHeight;
|
|
29
|
+
while (currentBlockHeight < blockhashResult.lastValidBlockHeight && !abortController.signal.aborted) {
|
|
30
|
+
const bundleStatus = (await jitoRpc.getBundleStatuses([bundleId]).send()).value[0];
|
|
31
|
+
if (bundleStatus && (bundleStatus.confirmation_status === "confirmed" || bundleStatus.confirmation_status === "finalized")) {
|
|
32
|
+
const txSignatures = bundleStatus.transactions;
|
|
33
|
+
const sigResponse = await jitoRpc.getSignatureStatuses(txSignatures).send();
|
|
34
|
+
if (!sigResponse?.value || !Array.isArray(sigResponse.value)) {
|
|
35
|
+
await (0, _lifi_sdk.sleep)(400);
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
abortController.abort();
|
|
39
|
+
return {
|
|
40
|
+
bundleId,
|
|
41
|
+
txSignatures,
|
|
42
|
+
signatureResults: sigResponse.value
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
await (0, _lifi_sdk.sleep)(400);
|
|
46
|
+
if (!abortController.signal.aborted) currentBlockHeight = await jitoRpc.getBlockHeight({ commitment: "confirmed" }).send();
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
} catch (error) {
|
|
50
|
+
if (abortController.signal.aborted) return null;
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
const result = await Promise.any(confirmPromises).catch(() => null);
|
|
55
|
+
if (!abortController.signal.aborted) abortController.abort();
|
|
56
|
+
if (!result) throw new Error("Failed to send and confirm bundle");
|
|
57
|
+
return result;
|
|
86
58
|
}
|
|
59
|
+
//#endregion
|
|
60
|
+
exports.sendAndConfirmBundle = sendAndConfirmBundle;
|
|
61
|
+
|
|
87
62
|
//# sourceMappingURL=sendAndConfirmBundle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendAndConfirmBundle.js","
|
|
1
|
+
{"version":3,"file":"sendAndConfirmBundle.js","names":["getJitoRpcs"],"sources":["../../../src/actions/sendAndConfirmBundle.ts"],"sourcesContent":["import { type SDKClient, sleep } from '@lifi/sdk'\nimport {\n type Commitment,\n getBase64EncodedWireTransaction,\n type Signature,\n type Transaction,\n type TransactionError,\n} from '@solana/kit'\n\nimport { getJitoRpcs } from '../rpc/registry.js'\n\ntype SignatureStatus = {\n slot: bigint\n confirmations: bigint | null\n err: TransactionError | null\n confirmationStatus: Commitment | null\n status: Readonly<{ Err: TransactionError }> | Readonly<{ Ok: null }>\n}\n\nexport type BundleResult = {\n bundleId: string\n txSignatures: Signature[]\n signatureResults: (SignatureStatus | null)[]\n}\n\n/**\n * Send and confirm a bundle of transactions using Jito.\n * Automatically selects a Jito-enabled RPC connection and polls for confirmation\n * across multiple Jito RPCs in parallel.\n * @param client - The SDK client.\n * @param signedTransactions - Array of signed transactions to bundle.\n * @returns BundleResult containing Bundle ID, transaction signatures, and confirmation results.\n */\nexport async function sendAndConfirmBundle(\n client: SDKClient,\n signedTransactions: Transaction[]\n): Promise<BundleResult> {\n const jitoRpcs = await getJitoRpcs(client)\n\n if (jitoRpcs.length === 0) {\n throw new Error(\n 'No Jito-enabled RPC connection available for bundle submission'\n )\n }\n\n // Serialize transactions to base64\n const serializedTransactions = signedTransactions.map((tx) =>\n getBase64EncodedWireTransaction(tx)\n )\n\n const abortController = new AbortController()\n\n const confirmPromises = jitoRpcs.map(async (jitoRpc) => {\n try {\n // Send bundle to Jito\n let bundleId: string\n try {\n bundleId = await jitoRpc.sendBundle(serializedTransactions).send()\n } catch (_) {\n return null\n }\n\n const [{ value: blockhashResult }, initialBlockHeight] =\n await Promise.all([\n jitoRpc\n .getLatestBlockhash({\n commitment: 'confirmed',\n })\n .send(),\n jitoRpc\n .getBlockHeight({\n commitment: 'confirmed',\n })\n .send(),\n ])\n\n let currentBlockHeight = initialBlockHeight\n\n while (\n currentBlockHeight < blockhashResult.lastValidBlockHeight &&\n !abortController.signal.aborted\n ) {\n const statusResponse = await jitoRpc\n .getBundleStatuses([bundleId])\n .send()\n\n const bundleStatus = statusResponse.value[0]\n\n // Check if bundle is confirmed or finalized\n if (\n bundleStatus &&\n (bundleStatus.confirmation_status === 'confirmed' ||\n bundleStatus.confirmation_status === 'finalized')\n ) {\n // Bundle confirmed! Extract transaction signatures from bundle status\n const txSignatures = bundleStatus.transactions\n\n // Fetch individual signature results from Jito RPC\n const sigResponse = await jitoRpc\n .getSignatureStatuses(txSignatures)\n .send()\n\n if (!sigResponse?.value || !Array.isArray(sigResponse.value)) {\n // Keep polling if can't find signature results\n await sleep(400)\n continue\n }\n\n // Immediately abort all other connections when we find a result\n abortController.abort()\n return {\n bundleId,\n txSignatures,\n signatureResults: sigResponse.value,\n }\n }\n\n await sleep(400)\n if (!abortController.signal.aborted) {\n currentBlockHeight = await jitoRpc\n .getBlockHeight({\n commitment: 'confirmed',\n })\n .send()\n }\n }\n\n return null\n } catch (error) {\n if (abortController.signal.aborted) {\n return null // Don't treat abortion as an error\n }\n throw error\n }\n })\n\n // Wait for first successful confirmation\n const result = await Promise.any(confirmPromises).catch(() => null)\n\n if (!abortController.signal.aborted) {\n abortController.abort()\n }\n\n if (!result) {\n throw new Error('Failed to send and confirm bundle')\n }\n\n return result\n}\n"],"mappings":";;;;;;;;;;;;;AAiCA,eAAsB,qBACpB,QACA,oBACuB;CACvB,MAAM,WAAW,MAAMA,qBAAAA,YAAY,OAAO;AAE1C,KAAI,SAAS,WAAW,EACtB,OAAM,IAAI,MACR,iEACD;CAIH,MAAM,yBAAyB,mBAAmB,KAAK,QAAA,GAAA,YAAA,iCACrB,GAAG,CACpC;CAED,MAAM,kBAAkB,IAAI,iBAAiB;CAE7C,MAAM,kBAAkB,SAAS,IAAI,OAAO,YAAY;AACtD,MAAI;GAEF,IAAI;AACJ,OAAI;AACF,eAAW,MAAM,QAAQ,WAAW,uBAAuB,CAAC,MAAM;YAC3D,GAAG;AACV,WAAO;;GAGT,MAAM,CAAC,EAAE,OAAO,mBAAmB,sBACjC,MAAM,QAAQ,IAAI,CAChB,QACG,mBAAmB,EAClB,YAAY,aACb,CAAC,CACD,MAAM,EACT,QACG,eAAe,EACd,YAAY,aACb,CAAC,CACD,MAAM,CACV,CAAC;GAEJ,IAAI,qBAAqB;AAEzB,UACE,qBAAqB,gBAAgB,wBACrC,CAAC,gBAAgB,OAAO,SACxB;IAKA,MAAM,gBAJiB,MAAM,QAC1B,kBAAkB,CAAC,SAAS,CAAC,CAC7B,MAAM,EAE2B,MAAM;AAG1C,QACE,iBACC,aAAa,wBAAwB,eACpC,aAAa,wBAAwB,cACvC;KAEA,MAAM,eAAe,aAAa;KAGlC,MAAM,cAAc,MAAM,QACvB,qBAAqB,aAAa,CAClC,MAAM;AAET,SAAI,CAAC,aAAa,SAAS,CAAC,MAAM,QAAQ,YAAY,MAAM,EAAE;AAE5D,aAAA,GAAA,UAAA,OAAY,IAAI;AAChB;;AAIF,qBAAgB,OAAO;AACvB,YAAO;MACL;MACA;MACA,kBAAkB,YAAY;MAC/B;;AAGH,WAAA,GAAA,UAAA,OAAY,IAAI;AAChB,QAAI,CAAC,gBAAgB,OAAO,QAC1B,sBAAqB,MAAM,QACxB,eAAe,EACd,YAAY,aACb,CAAC,CACD,MAAM;;AAIb,UAAO;WACA,OAAO;AACd,OAAI,gBAAgB,OAAO,QACzB,QAAO;AAET,SAAM;;GAER;CAGF,MAAM,SAAS,MAAM,QAAQ,IAAI,gBAAgB,CAAC,YAAY,KAAK;AAEnE,KAAI,CAAC,gBAAgB,OAAO,QAC1B,iBAAgB,OAAO;AAGzB,KAAI,CAAC,OACH,OAAM,IAAI,MAAM,oCAAoC;AAGtD,QAAO"}
|