@across-protocol/sdk 4.3.45 → 4.3.46
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/arch/svm/SpokeUtils.d.ts +21 -10
- package/dist/cjs/arch/svm/SpokeUtils.js +128 -10
- package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/encoders.d.ts +19 -0
- package/dist/cjs/arch/svm/encoders.js +52 -0
- package/dist/cjs/arch/svm/encoders.js.map +1 -0
- package/dist/cjs/arch/svm/index.d.ts +1 -0
- package/dist/cjs/arch/svm/index.js +1 -0
- package/dist/cjs/arch/svm/index.js.map +1 -1
- package/dist/cjs/providers/solana/retryRpcFactory.js +14 -10
- package/dist/cjs/providers/solana/retryRpcFactory.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.d.ts +38 -10
- package/dist/esm/arch/svm/SpokeUtils.js +151 -10
- package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/encoders.d.ts +19 -0
- package/dist/esm/arch/svm/encoders.js +43 -0
- package/dist/esm/arch/svm/encoders.js.map +1 -0
- package/dist/esm/arch/svm/index.d.ts +1 -0
- package/dist/esm/arch/svm/index.js +1 -0
- package/dist/esm/arch/svm/index.js.map +1 -1
- package/dist/esm/providers/solana/retryRpcFactory.js +15 -10
- package/dist/esm/providers/solana/retryRpcFactory.js.map +1 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts +38 -10
- package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/encoders.d.ts +20 -0
- package/dist/types/arch/svm/encoders.d.ts.map +1 -0
- package/dist/types/arch/svm/index.d.ts +1 -0
- package/dist/types/arch/svm/index.d.ts.map +1 -1
- package/dist/types/providers/solana/retryRpcFactory.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/arch/svm/SpokeUtils.ts +187 -4
- package/src/arch/svm/encoders.ts +86 -0
- package/src/arch/svm/index.ts +1 -0
- package/src/providers/solana/retryRpcFactory.ts +6 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RpcTransport, SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR } from "@solana/kit";
|
|
2
|
+
import { getThrowSolanaErrorResponseTransformer } from "@solana/rpc-transformers";
|
|
2
3
|
import { SolanaClusterRpcFactory } from "./baseRpcFactories";
|
|
3
4
|
import { RateLimitedSolanaRpcFactory } from "./rateLimitedRpcFactory";
|
|
4
5
|
import { isSolanaError } from "../../arch/svm";
|
|
@@ -56,13 +57,16 @@ export class RetrySolanaRpcFactory extends SolanaClusterRpcFactory {
|
|
|
56
57
|
transportCall: () => Promise<TResponse>,
|
|
57
58
|
args: Parameters<RpcTransport>
|
|
58
59
|
): Promise<TResponse> {
|
|
59
|
-
const { method } = args[0].payload as { method: string; params?: unknown[] };
|
|
60
|
+
const { method, params } = args[0].payload as { method: string; params?: unknown[] };
|
|
60
61
|
let retryAttempt = 0;
|
|
61
62
|
|
|
62
63
|
// eslint-disable-next-line no-constant-condition
|
|
63
64
|
while (true) {
|
|
64
65
|
try {
|
|
65
|
-
|
|
66
|
+
const response = await transportCall();
|
|
67
|
+
// Make sure SolanaErrors get thrown
|
|
68
|
+
getThrowSolanaErrorResponseTransformer()(response, { methodName: method, params });
|
|
69
|
+
return response;
|
|
66
70
|
} catch (error) {
|
|
67
71
|
if (retryAttempt++ >= this.retries || this.shouldFailImmediate(method, error)) {
|
|
68
72
|
throw error;
|