@lifi/sdk-provider-solana 4.3.7 → 4.3.9
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 +14 -0
- package/dist/cjs/SolanaProvider.d.ts +1 -4
- package/dist/cjs/SolanaProvider.js +1 -2
- package/dist/cjs/SolanaProvider.js.map +1 -1
- package/dist/cjs/actions/getSNSAddress.d.ts +1 -4
- package/dist/cjs/actions/getSNSAddress.js +1 -2
- package/dist/cjs/actions/getSolanaBalance.d.ts +1 -4
- package/dist/cjs/actions/getSolanaBalance.js +1 -2
- package/dist/cjs/actions/lookupSignatureStatus.d.ts +1 -4
- package/dist/cjs/actions/lookupSignatureStatus.js +2 -3
- package/dist/cjs/actions/resolveSolanaAddress.d.ts +1 -4
- package/dist/cjs/actions/resolveSolanaAddress.js +1 -2
- package/dist/cjs/actions/sendAndConfirmBundle.d.ts +1 -4
- package/dist/cjs/actions/sendAndConfirmBundle.js +3 -4
- package/dist/cjs/actions/sendAndConfirmTransaction.d.ts +2 -5
- package/dist/cjs/actions/sendAndConfirmTransaction.js +3 -4
- package/dist/cjs/confirmation/abortableSleep.d.ts +1 -4
- package/dist/cjs/confirmation/abortableSleep.js +1 -2
- package/dist/cjs/confirmation/confirmBundle.d.ts +2 -5
- package/dist/cjs/confirmation/confirmBundle.js +1 -2
- package/dist/cjs/confirmation/confirmSignature.d.ts +2 -5
- package/dist/cjs/confirmation/confirmSignature.js +2 -3
- package/dist/cjs/confirmation/createConfirmationDeadline.d.ts +1 -4
- package/dist/cjs/confirmation/createConfirmationDeadline.js +1 -2
- package/dist/cjs/confirmation/pollUntilDeadline.d.ts +2 -5
- package/dist/cjs/confirmation/pollUntilDeadline.js +1 -2
- package/dist/cjs/confirmation/raceRpcs.d.ts +1 -4
- package/dist/cjs/confirmation/raceRpcs.js +1 -2
- package/dist/cjs/confirmation/raceRpcs.js.map +1 -1
- package/dist/cjs/confirmation/types.d.ts +1 -4
- package/dist/cjs/confirmation/types.js +1 -2
- package/dist/cjs/core/SolanaStepExecutor.d.ts +1 -4
- package/dist/cjs/core/SolanaStepExecutor.js +1 -2
- package/dist/cjs/core/SolanaStepExecutor.js.map +1 -1
- package/dist/cjs/core/tasks/SolanaJitoWaitForTransactionTask.d.ts +1 -4
- package/dist/cjs/core/tasks/SolanaJitoWaitForTransactionTask.js +4 -5
- package/dist/cjs/core/tasks/SolanaJitoWaitForTransactionTask.js.map +1 -1
- package/dist/cjs/core/tasks/SolanaSignAndExecuteTask.d.ts +1 -4
- package/dist/cjs/core/tasks/SolanaSignAndExecuteTask.js +1 -2
- package/dist/cjs/core/tasks/SolanaSignAndExecuteTask.js.map +1 -1
- package/dist/cjs/core/tasks/SolanaStandardWaitForTransactionTask.d.ts +1 -4
- package/dist/cjs/core/tasks/SolanaStandardWaitForTransactionTask.js +4 -5
- package/dist/cjs/core/tasks/SolanaStandardWaitForTransactionTask.js.map +1 -1
- package/dist/cjs/core/tasks/SolanaWaitForTransactionTask.d.ts +1 -4
- package/dist/cjs/core/tasks/SolanaWaitForTransactionTask.js +1 -2
- package/dist/cjs/core/tasks/confirmationError.d.ts +1 -4
- package/dist/cjs/core/tasks/confirmationError.js +1 -2
- package/dist/cjs/core/tasks/readSignature.d.ts +1 -4
- package/dist/cjs/core/tasks/readSignature.js +1 -2
- package/dist/cjs/core/tasks/resumeFromStore.d.ts +2 -5
- package/dist/cjs/core/tasks/resumeFromStore.js +3 -4
- package/dist/cjs/core/tasks/resumeFromStore.js.map +1 -1
- package/dist/cjs/core/tasks/transactionOutcome.d.ts +3 -6
- package/dist/cjs/core/tasks/transactionOutcome.js +3 -4
- package/dist/cjs/core/tasks/transactionOutcome.js.map +1 -1
- package/dist/cjs/errors/parseSolanaErrors.d.ts +1 -4
- package/dist/cjs/errors/parseSolanaErrors.js +7 -5
- package/dist/cjs/errors/parseSolanaErrors.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/rpc/jito/api/getBundleStatuses.d.ts +1 -4
- package/dist/cjs/rpc/jito/api/getTipAccounts.d.ts +1 -4
- package/dist/cjs/rpc/jito/api/sendBundle.d.ts +1 -4
- package/dist/cjs/rpc/jito/api/simulateBundle.d.ts +1 -4
- package/dist/cjs/rpc/jito/createJitoRpc.d.ts +1 -4
- package/dist/cjs/rpc/jito/createJitoRpc.js +1 -2
- package/dist/cjs/rpc/jito/types.d.ts +1 -4
- package/dist/cjs/rpc/registry.d.ts +1 -4
- package/dist/cjs/rpc/registry.js +1 -2
- package/dist/cjs/rpc/types.d.ts +1 -4
- package/dist/cjs/rpc/utils.d.ts +1 -4
- package/dist/cjs/rpc/utils.js +1 -2
- package/dist/cjs/types.d.ts +1 -4
- package/dist/cjs/types.js +1 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/utils/KeypairWallet.unit.helpers.d.ts +1 -4
- package/dist/cjs/utils/KeypairWallet.unit.helpers.js +1 -2
- package/dist/cjs/utils/KeypairWalletAdapter.d.ts +1 -4
- package/dist/cjs/utils/KeypairWalletAdapter.js +1 -2
- package/dist/cjs/utils/KeypairWalletAdapter.js.map +1 -1
- package/dist/cjs/utils/base64ToUint8Array.d.ts +1 -4
- package/dist/cjs/utils/base64ToUint8Array.js +1 -2
- package/dist/cjs/utils/getTransactionLifetime.d.ts +1 -4
- package/dist/cjs/utils/getTransactionLifetime.js +1 -2
- package/dist/cjs/utils/getWalletFeature.d.ts +1 -4
- package/dist/cjs/utils/getWalletFeature.js +1 -2
- package/dist/cjs/utils/getWalletFeature.js.map +1 -1
- package/dist/cjs/utils/solanaErrorCause.d.ts +1 -4
- package/dist/cjs/utils/solanaErrorCause.js +1 -2
- package/dist/cjs/utils/solanaErrorCause.js.map +1 -1
- package/dist/cjs/utils/storedTransactions.d.ts +1 -4
- package/dist/cjs/utils/storedTransactions.js +1 -2
- package/dist/cjs/version.d.ts +1 -4
- package/dist/cjs/version.js +2 -3
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/SolanaProvider.d.ts +0 -2
- package/dist/esm/SolanaProvider.d.ts.map +1 -1
- package/dist/esm/SolanaProvider.js +1 -2
- package/dist/esm/actions/getSNSAddress.d.ts +0 -2
- package/dist/esm/actions/getSNSAddress.d.ts.map +1 -1
- package/dist/esm/actions/getSNSAddress.js +1 -2
- package/dist/esm/actions/getSolanaBalance.d.ts +0 -2
- package/dist/esm/actions/getSolanaBalance.d.ts.map +1 -1
- package/dist/esm/actions/getSolanaBalance.js +1 -2
- package/dist/esm/actions/lookupSignatureStatus.d.ts +0 -2
- package/dist/esm/actions/lookupSignatureStatus.d.ts.map +1 -1
- package/dist/esm/actions/lookupSignatureStatus.js +2 -3
- package/dist/esm/actions/resolveSolanaAddress.d.ts +0 -2
- package/dist/esm/actions/resolveSolanaAddress.d.ts.map +1 -1
- package/dist/esm/actions/resolveSolanaAddress.js +1 -2
- package/dist/esm/actions/sendAndConfirmBundle.d.ts +0 -2
- package/dist/esm/actions/sendAndConfirmBundle.d.ts.map +1 -1
- package/dist/esm/actions/sendAndConfirmBundle.js +3 -4
- package/dist/esm/actions/sendAndConfirmTransaction.d.ts +1 -3
- package/dist/esm/actions/sendAndConfirmTransaction.d.ts.map +1 -1
- package/dist/esm/actions/sendAndConfirmTransaction.js +3 -4
- package/dist/esm/confirmation/abortableSleep.d.ts +0 -2
- package/dist/esm/confirmation/abortableSleep.d.ts.map +1 -1
- package/dist/esm/confirmation/abortableSleep.js +1 -2
- package/dist/esm/confirmation/confirmBundle.d.ts +1 -3
- package/dist/esm/confirmation/confirmBundle.d.ts.map +1 -1
- package/dist/esm/confirmation/confirmBundle.js +1 -2
- package/dist/esm/confirmation/confirmSignature.d.ts +1 -3
- package/dist/esm/confirmation/confirmSignature.d.ts.map +1 -1
- package/dist/esm/confirmation/confirmSignature.js +2 -3
- package/dist/esm/confirmation/createConfirmationDeadline.d.ts +0 -2
- package/dist/esm/confirmation/createConfirmationDeadline.d.ts.map +1 -1
- package/dist/esm/confirmation/createConfirmationDeadline.js +1 -2
- package/dist/esm/confirmation/pollUntilDeadline.d.ts +1 -3
- package/dist/esm/confirmation/pollUntilDeadline.d.ts.map +1 -1
- package/dist/esm/confirmation/pollUntilDeadline.js +1 -2
- package/dist/esm/confirmation/raceRpcs.d.ts +0 -2
- package/dist/esm/confirmation/raceRpcs.d.ts.map +1 -1
- package/dist/esm/confirmation/raceRpcs.js +1 -2
- package/dist/esm/confirmation/raceRpcs.js.map +1 -1
- package/dist/esm/confirmation/types.d.ts +0 -2
- package/dist/esm/confirmation/types.d.ts.map +1 -1
- package/dist/esm/confirmation/types.js +1 -2
- package/dist/esm/core/SolanaStepExecutor.d.ts +0 -2
- package/dist/esm/core/SolanaStepExecutor.d.ts.map +1 -1
- package/dist/esm/core/SolanaStepExecutor.js +1 -2
- package/dist/esm/core/SolanaStepExecutor.js.map +1 -1
- package/dist/esm/core/tasks/SolanaJitoWaitForTransactionTask.d.ts +0 -2
- package/dist/esm/core/tasks/SolanaJitoWaitForTransactionTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/SolanaJitoWaitForTransactionTask.js +4 -5
- package/dist/esm/core/tasks/SolanaSignAndExecuteTask.d.ts +0 -2
- package/dist/esm/core/tasks/SolanaSignAndExecuteTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/SolanaSignAndExecuteTask.js +1 -2
- package/dist/esm/core/tasks/SolanaStandardWaitForTransactionTask.d.ts +0 -2
- package/dist/esm/core/tasks/SolanaStandardWaitForTransactionTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/SolanaStandardWaitForTransactionTask.js +4 -5
- package/dist/esm/core/tasks/SolanaWaitForTransactionTask.d.ts +0 -2
- package/dist/esm/core/tasks/SolanaWaitForTransactionTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/SolanaWaitForTransactionTask.js +1 -2
- package/dist/esm/core/tasks/confirmationError.d.ts +0 -2
- package/dist/esm/core/tasks/confirmationError.d.ts.map +1 -1
- package/dist/esm/core/tasks/confirmationError.js +1 -2
- package/dist/esm/core/tasks/readSignature.d.ts +0 -2
- package/dist/esm/core/tasks/readSignature.d.ts.map +1 -1
- package/dist/esm/core/tasks/readSignature.js +1 -2
- package/dist/esm/core/tasks/resumeFromStore.d.ts +1 -3
- package/dist/esm/core/tasks/resumeFromStore.d.ts.map +1 -1
- package/dist/esm/core/tasks/resumeFromStore.js +3 -4
- package/dist/esm/core/tasks/resumeFromStore.js.map +1 -1
- package/dist/esm/core/tasks/transactionOutcome.d.ts +2 -4
- package/dist/esm/core/tasks/transactionOutcome.d.ts.map +1 -1
- package/dist/esm/core/tasks/transactionOutcome.js +3 -4
- package/dist/esm/core/tasks/transactionOutcome.js.map +1 -1
- package/dist/esm/errors/parseSolanaErrors.d.ts +0 -2
- package/dist/esm/errors/parseSolanaErrors.d.ts.map +1 -1
- package/dist/esm/errors/parseSolanaErrors.js +7 -5
- package/dist/esm/errors/parseSolanaErrors.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/rpc/jito/api/getBundleStatuses.d.ts +0 -2
- package/dist/esm/rpc/jito/api/getBundleStatuses.d.ts.map +1 -1
- package/dist/esm/rpc/jito/api/getTipAccounts.d.ts +0 -2
- package/dist/esm/rpc/jito/api/getTipAccounts.d.ts.map +1 -1
- package/dist/esm/rpc/jito/api/sendBundle.d.ts +0 -2
- package/dist/esm/rpc/jito/api/sendBundle.d.ts.map +1 -1
- package/dist/esm/rpc/jito/api/simulateBundle.d.ts +0 -2
- package/dist/esm/rpc/jito/api/simulateBundle.d.ts.map +1 -1
- package/dist/esm/rpc/jito/createJitoRpc.d.ts +0 -2
- package/dist/esm/rpc/jito/createJitoRpc.d.ts.map +1 -1
- package/dist/esm/rpc/jito/createJitoRpc.js +1 -2
- package/dist/esm/rpc/jito/types.d.ts +0 -2
- package/dist/esm/rpc/jito/types.d.ts.map +1 -1
- package/dist/esm/rpc/registry.d.ts +0 -2
- package/dist/esm/rpc/registry.d.ts.map +1 -1
- package/dist/esm/rpc/registry.js +1 -2
- package/dist/esm/rpc/types.d.ts +0 -2
- package/dist/esm/rpc/types.d.ts.map +1 -1
- package/dist/esm/rpc/utils.d.ts +0 -2
- package/dist/esm/rpc/utils.d.ts.map +1 -1
- package/dist/esm/rpc/utils.js +1 -2
- package/dist/esm/types.d.ts +0 -2
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/types.js +1 -2
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils/KeypairWallet.unit.helpers.d.ts +0 -2
- package/dist/esm/utils/KeypairWallet.unit.helpers.d.ts.map +1 -1
- package/dist/esm/utils/KeypairWallet.unit.helpers.js +1 -2
- package/dist/esm/utils/KeypairWalletAdapter.d.ts +0 -2
- package/dist/esm/utils/KeypairWalletAdapter.d.ts.map +1 -1
- package/dist/esm/utils/KeypairWalletAdapter.js +1 -2
- package/dist/esm/utils/KeypairWalletAdapter.js.map +1 -1
- package/dist/esm/utils/base64ToUint8Array.d.ts +0 -2
- package/dist/esm/utils/base64ToUint8Array.d.ts.map +1 -1
- package/dist/esm/utils/base64ToUint8Array.js +1 -2
- package/dist/esm/utils/getTransactionLifetime.d.ts +0 -2
- package/dist/esm/utils/getTransactionLifetime.d.ts.map +1 -1
- package/dist/esm/utils/getTransactionLifetime.js +1 -2
- package/dist/esm/utils/getWalletFeature.d.ts +0 -2
- package/dist/esm/utils/getWalletFeature.d.ts.map +1 -1
- package/dist/esm/utils/getWalletFeature.js +1 -2
- package/dist/esm/utils/getWalletFeature.js.map +1 -1
- package/dist/esm/utils/solanaErrorCause.d.ts +0 -2
- package/dist/esm/utils/solanaErrorCause.d.ts.map +1 -1
- package/dist/esm/utils/solanaErrorCause.js +1 -2
- package/dist/esm/utils/solanaErrorCause.js.map +1 -1
- package/dist/esm/utils/storedTransactions.d.ts +0 -2
- package/dist/esm/utils/storedTransactions.d.ts.map +1 -1
- package/dist/esm/utils/storedTransactions.js +1 -2
- package/dist/esm/version.d.ts +1 -3
- package/dist/esm/version.d.ts.map +1 -1
- package/dist/esm/version.js +2 -3
- package/dist/esm/version.js.map +1 -1
- package/package.json +3 -3
- package/src/confirmation/raceRpcs.ts +4 -3
- package/src/core/tasks/resumeFromStore.ts +1 -1
- package/src/core/tasks/transactionOutcome.ts +1 -1
- package/src/errors/parseSolanaErrors.ts +12 -3
- package/src/index.ts +1 -5
- package/src/types.ts +1 -2
- package/src/utils/getWalletFeature.ts +1 -0
- package/src/version.ts +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { UnconfirmedRaceResult } from "../../confirmation/raceRpcs.js";
|
|
2
2
|
import { RPCError, TransactionError } from "@lifi/sdk";
|
|
3
|
-
//#region src/core/tasks/confirmationError.d.ts
|
|
4
3
|
/** Only the nouns differ between the standard and bundle paths. */
|
|
5
4
|
export type ConfirmationMessages = {
|
|
6
5
|
/** Every branch failed: an outage, not a verdict about the transaction. */
|
|
@@ -25,5 +24,4 @@ export type ConfirmationMessages = {
|
|
|
25
24
|
* final "dropped" needs, so the final marker is theirs to add.
|
|
26
25
|
*/
|
|
27
26
|
export declare function confirmationError(result: UnconfirmedRaceResult, messages: ConfirmationMessages): RPCError | TransactionError;
|
|
28
|
-
//#endregion
|
|
29
27
|
//# sourceMappingURL=confirmationError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirmationError.d.ts","names":[],"sources":["../../../../src/core/tasks/confirmationError.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"confirmationError.d.ts","names":[],"sources":["../../../../src/core/tasks/confirmationError.ts"],"mappings":";;;YAIY;;EAEV;;;EAGA;;EAEA;;EAEA;;;;;;;;;;;;;wBAyBc,kBACd,QAAQ,uBACR,UAAU,uBACT,WAAW"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LiFiErrorCode, RPCError, TransactionError } from "@lifi/sdk";
|
|
2
|
-
|
|
2
|
+
// src/core/tasks/confirmationError.ts
|
|
3
3
|
/** `cause` is the first collected error on purpose: `BaseError` overwrites its
|
|
4
4
|
* stack with `getRootCause(cause).stack`, and an `AggregateError` has no
|
|
5
5
|
* `cause`, so without it the stack would point at this file. */
|
|
@@ -19,7 +19,6 @@ function confirmationError(result, messages) {
|
|
|
19
19
|
if (result.kind === "rpc-unavailable") return new RPCError(LiFiErrorCode.RpcUnavailable, messages.rpcUnavailable, chainErrors(result.errors, messages.allRpcsFailed));
|
|
20
20
|
return new TransactionError(LiFiErrorCode.TransactionExpired, messages.notConfirmed, chainErrors(result.errors, messages.someRpcsFailed));
|
|
21
21
|
}
|
|
22
|
-
//#endregion
|
|
23
22
|
export { confirmationError };
|
|
24
23
|
|
|
25
24
|
//# sourceMappingURL=confirmationError.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Signature, Transaction } from "@solana/kit";
|
|
2
|
-
//#region src/core/tasks/readSignature.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Reads a signed transaction's signature, restating a `@solana/kit` failure as
|
|
5
4
|
* a `TransactionError`.
|
|
@@ -12,5 +11,4 @@ import { Signature, Transaction } from "@solana/kit";
|
|
|
12
11
|
* unwrapped throw lands in the unknown bucket.
|
|
13
12
|
*/
|
|
14
13
|
export declare function readSignature(transaction: Transaction): Signature;
|
|
15
|
-
//#endregion
|
|
16
14
|
//# sourceMappingURL=readSignature.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readSignature.d.ts","names":[],"sources":["../../../../src/core/tasks/readSignature.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"readSignature.d.ts","names":[],"sources":["../../../../src/core/tasks/readSignature.ts"],"mappings":";;;;;;;;;;;;wBAkBgB,cAAc,aAAa,cAAc"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LiFiErrorCode, TransactionError } from "@lifi/sdk";
|
|
2
2
|
import { getSignatureFromTransaction } from "@solana/kit";
|
|
3
|
-
|
|
3
|
+
// src/core/tasks/readSignature.ts
|
|
4
4
|
/**
|
|
5
5
|
* Reads a signed transaction's signature, restating a `@solana/kit` failure as
|
|
6
6
|
* a `TransactionError`.
|
|
@@ -19,7 +19,6 @@ function readSignature(transaction) {
|
|
|
19
19
|
throw new TransactionError(LiFiErrorCode.TransactionUnprepared, "Unable to prepare transaction. The signed transaction carries no fee payer signature.", error);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
//#endregion
|
|
23
22
|
export { readSignature };
|
|
24
23
|
|
|
25
24
|
//# sourceMappingURL=readSignature.js.map
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { SolanaStepExecutorContext } from "../../types.js";
|
|
2
2
|
import { TransactionLifetime } from "../../utils/getTransactionLifetime.js";
|
|
3
|
-
import { ConfirmationMessages } from "./confirmationError.js";
|
|
4
3
|
import { StoredTransactions } from "../../utils/storedTransactions.js";
|
|
4
|
+
import { ConfirmationMessages } from "./confirmationError.js";
|
|
5
5
|
import { ExecutionAction, TaskResult } from "@lifi/sdk";
|
|
6
|
-
//#region src/core/tasks/resumeFromStore.d.ts
|
|
7
6
|
/**
|
|
8
7
|
* Resume mode of both wait tasks: the sign task did not run in this session,
|
|
9
8
|
* so the transaction comes from the action.
|
|
@@ -27,5 +26,4 @@ export declare function resumeFromStore(context: SolanaStepExecutorContext, acti
|
|
|
27
26
|
* funds it already spent, would fail the simulation falsely. */
|
|
28
27
|
send: (stored: StoredTransactions, lifetimes: TransactionLifetime[]) => Promise<TaskResult>;
|
|
29
28
|
}): Promise<TaskResult>;
|
|
30
|
-
//#endregion
|
|
31
29
|
//# sourceMappingURL=resumeFromStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resumeFromStore.d.ts","names":[],"sources":["../../../../src/core/tasks/resumeFromStore.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"resumeFromStore.d.ts","names":[],"sources":["../../../../src/core/tasks/resumeFromStore.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;wBAyFsB,gBACpB,SAAS,2BACT,QAAQ,iBACR;EACE,UAAU;;;;EAIV,OACE,QAAQ,oBACR,WAAW,0BACR,QAAQ;IAEd,QAAQ"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { lookupSignatureStatus } from "../../actions/lookupSignatureStatus.js";
|
|
2
2
|
import { isConfirmedCommitment } from "../../confirmation/types.js";
|
|
3
3
|
import { getTransactionLifetime } from "../../utils/getTransactionLifetime.js";
|
|
4
|
-
import {
|
|
4
|
+
import { decodeStoredTransactions } from "../../utils/storedTransactions.js";
|
|
5
5
|
import { confirmationError } from "./confirmationError.js";
|
|
6
6
|
import { canResendStored, clearStoredTransactions, failureOf, recordLanded, resolveUnconfirmed } from "./transactionOutcome.js";
|
|
7
7
|
import { LiFiErrorCode, TransactionError } from "@lifi/sdk";
|
|
8
|
-
|
|
8
|
+
// src/core/tasks/resumeFromStore.ts
|
|
9
9
|
function readResumeSource(context, action) {
|
|
10
10
|
if (action.txHex) {
|
|
11
11
|
const stored = decodeStoredTransactions(action.txHex);
|
|
@@ -74,7 +74,6 @@ async function resumeFromStore(context, action, options) {
|
|
|
74
74
|
failure: failureOf(status)
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
-
//#endregion
|
|
78
77
|
export { resumeFromStore };
|
|
79
78
|
|
|
80
79
|
//# sourceMappingURL=resumeFromStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resumeFromStore.js","names":[],"sources":["../../../../src/core/tasks/resumeFromStore.ts"],"sourcesContent":["import {\n type ExecutionAction,\n LiFiErrorCode,\n type TaskResult,\n TransactionError,\n} from '@lifi/sdk'\nimport type { Signature } from '@solana/kit'\nimport { lookupSignatureStatus } from '../../actions/lookupSignatureStatus.js'\nimport { isConfirmedCommitment } from '../../confirmation/types.js'\nimport type { SolanaStepExecutorContext } from '../../types.js'\nimport {\n getTransactionLifetime,\n type TransactionLifetime,\n} from '../../utils/getTransactionLifetime.js'\nimport {\n decodeStoredTransactions,\n type StoredTransactions,\n} from '../../utils/storedTransactions.js'\nimport {\n type ConfirmationMessages,\n
|
|
1
|
+
{"version":3,"file":"resumeFromStore.js","names":[],"sources":["../../../../src/core/tasks/resumeFromStore.ts"],"sourcesContent":["import {\n type ExecutionAction,\n LiFiErrorCode,\n type TaskResult,\n TransactionError,\n} from '@lifi/sdk'\nimport type { Signature } from '@solana/kit'\nimport { lookupSignatureStatus } from '../../actions/lookupSignatureStatus.js'\nimport { isConfirmedCommitment } from '../../confirmation/types.js'\nimport type { SolanaStepExecutorContext } from '../../types.js'\nimport {\n getTransactionLifetime,\n type TransactionLifetime,\n} from '../../utils/getTransactionLifetime.js'\nimport {\n decodeStoredTransactions,\n type StoredTransactions,\n} from '../../utils/storedTransactions.js'\nimport {\n confirmationError,\n type ConfirmationMessages,\n} from './confirmationError.js'\nimport {\n canResendStored,\n clearStoredTransactions,\n failureOf,\n recordLanded,\n resolveUnconfirmed,\n} from './transactionOutcome.js'\n\n/** What a resumed wait task can work from. */\ntype ResumeSource =\n /** Signed bytes that may still need to be sent. */\n | { kind: 'bytes'; stored: StoredTransactions }\n /** A broadcast signature alone: a route stored before the upgrade, or\n * bytes that no longer decode. */\n | { kind: 'hash'; signature: Signature }\n /** Bytes whose first signature is not the stored txHash (damaged\n * storage). They prove nothing about that transaction, and they may have\n * been sent: nothing is sent and nothing is dropped. */\n | { kind: 'mismatch'; signature: Signature }\n\nfunction readResumeSource(\n context: SolanaStepExecutorContext,\n action: ExecutionAction\n): ResumeSource {\n if (action.txHex) {\n const stored = decodeStoredTransactions(action.txHex)\n if (stored) {\n if (action.txHash && action.txHash !== stored.signature) {\n return { kind: 'mismatch', signature: action.txHash as Signature }\n }\n return { kind: 'bytes', stored }\n }\n // The sign task stores only bytes that decode, so these were damaged\n // after the write - by the integrator's storage, say. They would fail\n // every resume the same way.\n clearStoredTransactions(context, action)\n }\n\n if (action.txHash) {\n return { kind: 'hash', signature: action.txHash as Signature }\n }\n\n // Without a hash no RPC ever accepted a send - `txHash` is written on the\n // first accepted one - so nothing can land. No final marker: \"Try again\"\n // signs again.\n throw new TransactionError(\n LiFiErrorCode.TransactionUnprepared,\n 'Unable to prepare transaction. Signed transactions are not found.'\n )\n}\n\n/**\n * Resume mode of both wait tasks: the sign task did not run in this session,\n * so the transaction comes from the action.\n *\n * 1. Look the signature up on every RPC. A confirmed status goes straight to\n * the result rules: the transaction may have landed after the page closed.\n * This look only has to find, so it asks for no canary.\n * 2. Otherwise resend the stored bytes through `send` when that is allowed -\n * the task's normal send path, without simulation.\n * 3. Otherwise - a hash alone, or bytes past the resend age cap - nothing is\n * sent, and only the dropped rule can make the outcome final.\n *\n * Bytes that are not the stored txHash's transaction are never sent, and the\n * dropped rule never runs for them: the outcome stays unknown unless the\n * lookup by txHash finds it confirmed.\n */\nexport async function resumeFromStore(\n context: SolanaStepExecutorContext,\n action: ExecutionAction,\n options: {\n messages: ConfirmationMessages\n /** Sends the stored bytes and applies the result rules, as the first\n * run does, but never simulates: a transaction that already landed, or\n * funds it already spent, would fail the simulation falsely. */\n send: (\n stored: StoredTransactions,\n lifetimes: TransactionLifetime[]\n ) => Promise<TaskResult>\n }\n): Promise<TaskResult> {\n const { client, step } = context\n const source = readResumeSource(context, action)\n const signature =\n source.kind === 'bytes' ? source.stored.signature : source.signature\n\n const lookup = await lookupSignatureStatus(client, signature)\n if (\n lookup.kind === 'found' &&\n isConfirmedCommitment(lookup.status.confirmationStatus)\n ) {\n return recordLanded(context, action, {\n signature,\n failure: failureOf(lookup.status),\n })\n }\n\n const lifetimes =\n source.kind === 'bytes'\n ? await Promise.all(\n source.stored.transactions.map((transaction) =>\n getTransactionLifetime(transaction)\n )\n )\n : []\n\n // A `processed` status resends too: a signature executes at most once.\n if (\n source.kind === 'bytes' &&\n canResendStored(lifetimes, step.execution?.signedAt)\n ) {\n return options.send(source.stored, lifetimes)\n }\n\n // No RPC answered at all: an outage, as today. Otherwise the transaction\n // was simply not seen.\n const silent = lookup.kind === 'unknown' && !lookup.answered\n const error = confirmationError(\n silent\n ? { kind: 'rpc-unavailable', errors: lookup.errors }\n : { kind: 'not-confirmed', errors: [] },\n options.messages\n )\n if (source.kind === 'mismatch') {\n // Damaged storage: no dropped rule, so the outcome stays unknown.\n throw error\n }\n const status = await resolveUnconfirmed(context, action, {\n signature,\n error,\n expiredAtSlot: undefined,\n messages: options.messages,\n })\n return recordLanded(context, action, {\n signature,\n failure: failureOf(status),\n })\n}\n"],"mappings":";;;;;;;;AA0CA,SAAS,iBACP,SACA,QACc;CACd,IAAI,OAAO,OAAO;EAChB,MAAM,SAAS,yBAAyB,OAAO,KAAK;EACpD,IAAI,QAAQ;GACV,IAAI,OAAO,UAAU,OAAO,WAAW,OAAO,WAC5C,OAAO;IAAE,MAAM;IAAY,WAAW,OAAO;GAAoB;GAEnE,OAAO;IAAE,MAAM;IAAS;GAAO;EACjC;EAIA,wBAAwB,SAAS,MAAM;CACzC;CAEA,IAAI,OAAO,QACT,OAAO;EAAE,MAAM;EAAQ,WAAW,OAAO;CAAoB;CAM/D,MAAM,IAAI,iBACR,cAAc,uBACd,mEACF;AACF;;;;;;;;;;;;;;;;;AAkBA,eAAsB,gBACpB,SACA,QACA,SAUqB;CACrB,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,SAAS,iBAAiB,SAAS,MAAM;CAC/C,MAAM,YACJ,OAAO,SAAS,UAAU,OAAO,OAAO,YAAY,OAAO;CAE7D,MAAM,SAAS,MAAM,sBAAsB,QAAQ,SAAS;CAC5D,IACE,OAAO,SAAS,WAChB,sBAAsB,OAAO,OAAO,kBAAkB,GAEtD,OAAO,aAAa,SAAS,QAAQ;EACnC;EACA,SAAS,UAAU,OAAO,MAAM;CAClC,CAAC;CAGH,MAAM,YACJ,OAAO,SAAS,UACZ,MAAM,QAAQ,IACZ,OAAO,OAAO,aAAa,KAAK,gBAC9B,uBAAuB,WAAW,CACpC,CACF,IACA,CAAC;CAGP,IACE,OAAO,SAAS,WAChB,gBAAgB,WAAW,KAAK,WAAW,QAAQ,GAEnD,OAAO,QAAQ,KAAK,OAAO,QAAQ,SAAS;CAK9C,MAAM,SAAS,OAAO,SAAS,aAAa,CAAC,OAAO;CACpD,MAAM,QAAQ,kBACZ,SACI;EAAE,MAAM;EAAmB,QAAQ,OAAO;CAAO,IACjD;EAAE,MAAM;EAAiB,QAAQ,CAAC;CAAE,GACxC,QAAQ,QACV;CACA,IAAI,OAAO,SAAS,YAElB,MAAM;CAER,MAAM,SAAS,MAAM,mBAAmB,SAAS,QAAQ;EACvD;EACA;EACA,eAAe,KAAA;EACf,UAAU,QAAQ;CACpB,CAAC;CACD,OAAO,aAAa,SAAS,QAAQ;EACnC;EACA,SAAS,UAAU,MAAM;CAC3B,CAAC;AACH"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RaceResult } from "../../confirmation/raceRpcs.js";
|
|
2
2
|
import { SignatureStatus } from "../../confirmation/types.js";
|
|
3
|
+
import { SolanaStepExecutorContext } from "../../types.js";
|
|
3
4
|
import { TransactionLifetime } from "../../utils/getTransactionLifetime.js";
|
|
4
|
-
import { RaceResult } from "../../confirmation/raceRpcs.js";
|
|
5
5
|
import { ConfirmationMessages } from "./confirmationError.js";
|
|
6
6
|
import { ExecutionAction, TaskResult } from "@lifi/sdk";
|
|
7
7
|
import { Signature } from "@solana/kit";
|
|
8
|
-
//#region src/core/tasks/transactionOutcome.d.ts
|
|
9
8
|
/** Explorer link for a signature, as both wait tasks write it. */
|
|
10
9
|
export declare function getTxLink(context: Pick<SolanaStepExecutorContext, "fromChain">, signature: string): string;
|
|
11
10
|
/**
|
|
@@ -103,5 +102,4 @@ export declare function sendAndSettle<T>(context: SolanaStepExecutorContext, act
|
|
|
103
102
|
resuming: boolean;
|
|
104
103
|
messages: ConfirmationMessages;
|
|
105
104
|
}): Promise<TaskResult>;
|
|
106
|
-
//#endregion
|
|
107
105
|
//# sourceMappingURL=transactionOutcome.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transactionOutcome.d.ts","names":[],"sources":["../../../../src/core/tasks/transactionOutcome.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"transactionOutcome.d.ts","names":[],"sources":["../../../../src/core/tasks/transactionOutcome.ts"],"mappings":";;;;;;;;wBA0BgB,UACd,SAAS,KAAK,yCACd;;;;;;;;wBAYc,gBACd,WAAW,uBACX,8BACA;;;;;;;;;;;;;;;wBAsBc,kBAAkB;EAChC;EACA;EACA;;;wBAMc,wBACd,SAAS,2BACT,QAAQ;;wBAQM,UACd,QAAQ,KAAK;EACV;;;;;;;;;;wBAYW,aACd,SAAS,2BACT,QAAQ,iBACR;EAAW,WAAW;EAAW;IAAW;;IAC3C;;;;;;;;;;;;;wBAuCmB,mBACpB,SAAS,2BACT,QAAQ,iBACR;EACE,WAAW;;EAEX;;EAEA;EACA,UAAU;IAEX,QAAQ;;;;;;;;;;;;;;;;wBA8DW,cAAc,GAClC,SAAS,2BACT,QAAQ,iBACR;EACE,WAAW;;;EAGX,YAAY,QAAQ,WAAW;;EAE/B,mBAAmB,OAAO;IAAQ;;;EAElC;EACA,UAAU;IAEX,QAAQ"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { isConfirmedCommitment } from "../../confirmation/types.js";
|
|
2
1
|
import { lookupSignatureStatus } from "../../actions/lookupSignatureStatus.js";
|
|
3
|
-
import {
|
|
2
|
+
import { isConfirmedCommitment } from "../../confirmation/types.js";
|
|
4
3
|
import { SolanaTransactionDetailsError } from "../../utils/solanaErrorCause.js";
|
|
4
|
+
import { confirmationError } from "./confirmationError.js";
|
|
5
5
|
import { CLOCK_SKEW_MARGIN_MS, LiFiErrorCode, TransactionError, isKnownToStatusApi, isOldEnoughToDrop, isResendAllowed } from "@lifi/sdk";
|
|
6
|
-
|
|
6
|
+
// src/core/tasks/transactionOutcome.ts
|
|
7
7
|
/** Explorer link for a signature, as both wait tasks write it. */
|
|
8
8
|
function getTxLink(context, signature) {
|
|
9
9
|
return `${context.fromChain.metamask.blockExplorerUrls[0]}tx/${signature}`;
|
|
@@ -144,7 +144,6 @@ async function sendAndSettle(context, action, options) {
|
|
|
144
144
|
});
|
|
145
145
|
return settleUnconfirmed(confirmationError(result, messages), result.kind === "expired" ? result.slot : void 0);
|
|
146
146
|
}
|
|
147
|
-
//#endregion
|
|
148
147
|
export { canResendStored, cannotLandAnymore, clearStoredTransactions, failureOf, getTxLink, recordLanded, resolveUnconfirmed, sendAndSettle };
|
|
149
148
|
|
|
150
149
|
//# sourceMappingURL=transactionOutcome.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transactionOutcome.js","names":[],"sources":["../../../../src/core/tasks/transactionOutcome.ts"],"sourcesContent":["import {\n CLOCK_SKEW_MARGIN_MS,\n type ExecutionAction,\n isKnownToStatusApi,\n isOldEnoughToDrop,\n isResendAllowed,\n LiFiErrorCode,\n type TaskResult,\n TransactionError,\n} from '@lifi/sdk'\nimport type { Signature } from '@solana/kit'\nimport { lookupSignatureStatus } from '../../actions/lookupSignatureStatus.js'\nimport type { RaceResult } from '../../confirmation/raceRpcs.js'\nimport {\n isConfirmedCommitment,\n type SignatureStatus,\n} from '../../confirmation/types.js'\nimport type { SolanaStepExecutorContext } from '../../types.js'\nimport type { TransactionLifetime } from '../../utils/getTransactionLifetime.js'\nimport { SolanaTransactionDetailsError } from '../../utils/solanaErrorCause.js'\nimport {\n type ConfirmationMessages,\n confirmationError,\n} from './confirmationError.js'\n\n/** Explorer link for a signature, as both wait tasks write it. */\nexport function getTxLink(\n context: Pick<SolanaStepExecutorContext, 'fromChain'>,\n signature: string\n): string {\n return `${context.fromChain.metamask.blockExplorerUrls[0]}tx/${signature}`\n}\n\n/**\n * May stored bytes be sent (again)? A blockhash transaction always: the\n * chain rejects it once the blockhash dies, and the deadline's probe tells\n * when. Anything else - a durable nonce, a lifetime that did not decode -\n * only inside the resend age cap, so a page load hours later cannot execute\n * a swap on an old quote.\n */\nexport function canResendStored(\n lifetimes: TransactionLifetime[],\n signedAt: number | undefined,\n now?: number\n): boolean {\n const expiresOnItsOwn =\n lifetimes.length > 0 &&\n lifetimes.every((lifetime) => lifetime.kind === 'blockhash')\n return expiresOnItsOwn || isResendAllowed(signedAt, now)\n}\n\n/**\n * Condition (a) of the dropped rule in `resolveUnconfirmed`: the chain says\n * the transaction can no longer land.\n *\n * - An `expired` verdict: the blockhash probe saw it dead.\n * - Without a verdict, `isOldEnoughToDrop` for every lifetime. For a\n * blockhash transaction that is the five-minute time fallback. For a\n * durable nonce or an undecodable lifetime it is the age cap passed plus a\n * margin: sends stop at the cap, and the three minutes after it put the\n * lookup's current-slot head safely past any slot the transaction could\n * still land in.\n *\n * An unknown signing time never holds by time.\n */\nexport function cannotLandAnymore(options: {\n expired: boolean\n signedAt: number | undefined\n now?: number\n}): boolean {\n return options.expired || isOldEnoughToDrop(options.signedAt, options.now)\n}\n\n/** Drops the stored bytes: never sent, landed, or final. */\nexport function clearStoredTransactions(\n context: SolanaStepExecutorContext,\n action: ExecutionAction\n): void {\n context.statusManager.updateAction(context.step, action.type, 'PENDING', {\n txHex: undefined,\n })\n}\n\n/** A signature status's `err` as the failure `recordLanded` takes. */\nexport function failureOf(\n status: Pick<SignatureStatus, 'err'>\n): { err: unknown } | undefined {\n return status.err ? { err: status.err } : undefined\n}\n\n/**\n * Result rule for a transaction the chain has: writes `txHash` and `txLink`,\n * clears the stored bytes, then completes - or throws the final\n * `TransactionFailed` for one that failed on chain.\n *\n * The hash is written for a failed transaction too: it exists on chain, and\n * a resume that found it by lookup has no `txHash` yet.\n */\nexport function recordLanded(\n context: SolanaStepExecutorContext,\n action: ExecutionAction,\n options: { signature: Signature; failure: { err: unknown } | undefined }\n): TaskResult {\n const { step, statusManager, isBridgeExecution } = context\n const { signature, failure } = options\n\n statusManager.updateAction(step, action.type, 'PENDING', {\n txHash: signature,\n txLink: getTxLink(context, signature),\n txHex: undefined,\n })\n\n if (failure) {\n const cause = new SolanaTransactionDetailsError(failure.err)\n throw new TransactionError(\n LiFiErrorCode.TransactionFailed,\n `Transaction failed: ${cause.message}`,\n cause,\n { final: true }\n )\n }\n\n if (isBridgeExecution) {\n statusManager.updateAction(step, action.type, 'DONE')\n }\n\n return { status: 'COMPLETED' }\n}\n\n/**\n * Decides what a transaction that did not confirm is: landed after all\n * (returns its status), dropped (throws a final `TransactionExpired`), or\n * unknown (rethrows `error`, the error the task built for today's outcome).\n *\n * Dropped (see the resume rules in `transactionState.ts`) = (a)\n * `cannotLandAnymore`, AND (b) a lookup that proves the absence - a covering\n * RPC whose head is past the landing window answered `null` in the same\n * response, and no RPC has the transaction - AND (c) the status API does not\n * know the hash. The status API only vetoes: it answers 404 for landed\n * transactions it does not index too, so a miss there proves nothing.\n */\nexport async function resolveUnconfirmed(\n context: SolanaStepExecutorContext,\n action: ExecutionAction,\n options: {\n signature: Signature\n /** What the integrator sees when the outcome stays unknown. */\n error: unknown\n /** The slot of the `expired` verdict; `undefined` without one. */\n expiredAtSlot: bigint | undefined\n messages: ConfirmationMessages\n }\n): Promise<SignatureStatus> {\n const { client, step } = context\n const { signature, error, expiredAtSlot } = options\n const signedAt = step.execution?.signedAt\n\n // (a) The local check runs first, so a young transaction costs no request.\n if (!cannotLandAnymore({ expired: expiredAtSlot !== undefined, signedAt })) {\n throw error\n }\n // Without a signing time there is no anchor, so no canary can prove that a\n // node's history covers the transaction.\n if (signedAt === undefined) {\n throw error\n }\n\n // (b) Absence, proven by the same response that proves coverage and head.\n // Every other lookup result - also `unknown` with `answered: false`, an\n // outage - keeps the outcome unknown.\n const lookup = await lookupSignatureStatus(client, signature, {\n anchor: signedAt - CLOCK_SKEW_MARGIN_MS,\n expiredAtSlot,\n })\n if (\n lookup.kind === 'found' &&\n isConfirmedCommitment(lookup.status.confirmationStatus)\n ) {\n return lookup.status\n }\n if (lookup.kind !== 'not-found') {\n throw error\n }\n\n // (c) The veto.\n if (await isKnownToStatusApi(client, step, signature)) {\n throw error\n }\n\n clearStoredTransactions(context, action)\n // Today's expiry code and text: only the marker is new.\n throw new TransactionError(\n LiFiErrorCode.TransactionExpired,\n options.messages.notConfirmed,\n error instanceof Error ? error : undefined,\n { final: true }\n )\n}\n\n/**\n * The send-and-settle tail both wait tasks share: runs `send`, then applies\n * the result rules to what it reports.\n *\n * - A confirmation goes to `recordLanded`, with `confirmedFailure` reading\n * its on-chain failure.\n * - Every other result - `rpc-unavailable` included - goes to\n * `resolveUnconfirmed`. Only an `expired` verdict passes its slot: the\n * dropped check reads any defined slot as a verdict.\n * - A rejection comes before the first send of this run. On the first run\n * nothing ever left the SDK, so the bytes are cleared and the error is\n * rethrown: \"Try again\" signs again. On a resume an earlier run may have\n * sent the same bytes: they stay, and only the chain can make the outcome\n * final.\n */\nexport async function sendAndSettle<T>(\n context: SolanaStepExecutorContext,\n action: ExecutionAction,\n options: {\n signature: Signature\n /** Sends and races the confirmation. Rejects only before its first\n * send; the race itself never rejects. */\n send: () => Promise<RaceResult<T>>\n /** The on-chain failure of a confirmed value. */\n confirmedFailure: (value: T) => { err: unknown } | undefined\n /** An earlier run may already have sent these bytes. */\n resuming: boolean\n messages: ConfirmationMessages\n }\n): Promise<TaskResult> {\n const { signature, messages } = options\n\n /** `resolveUnconfirmed` throws for an unknown or dropped outcome, so only\n * a confirmed status reaches `recordLanded`. */\n const settleUnconfirmed = async (\n error: unknown,\n expiredAtSlot: bigint | undefined\n ): Promise<TaskResult> => {\n const status = await resolveUnconfirmed(context, action, {\n signature,\n error,\n expiredAtSlot,\n messages,\n })\n return recordLanded(context, action, {\n signature,\n failure: failureOf(status),\n })\n }\n\n let result: RaceResult<T>\n try {\n result = await options.send()\n } catch (error) {\n if (!options.resuming) {\n clearStoredTransactions(context, action)\n throw error\n }\n return settleUnconfirmed(error, undefined)\n }\n\n if (result.kind === 'confirmed') {\n return recordLanded(context, action, {\n signature,\n failure: options.confirmedFailure(result.value),\n })\n }\n\n return settleUnconfirmed(\n confirmationError(result, messages),\n // The head a covering RPC has to reach before its `null` counts.\n result.kind === 'expired' ? result.slot : undefined\n )\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"transactionOutcome.js","names":[],"sources":["../../../../src/core/tasks/transactionOutcome.ts"],"sourcesContent":["import {\n CLOCK_SKEW_MARGIN_MS,\n type ExecutionAction,\n isKnownToStatusApi,\n isOldEnoughToDrop,\n isResendAllowed,\n LiFiErrorCode,\n type TaskResult,\n TransactionError,\n} from '@lifi/sdk'\nimport type { Signature } from '@solana/kit'\nimport { lookupSignatureStatus } from '../../actions/lookupSignatureStatus.js'\nimport type { RaceResult } from '../../confirmation/raceRpcs.js'\nimport {\n isConfirmedCommitment,\n type SignatureStatus,\n} from '../../confirmation/types.js'\nimport type { SolanaStepExecutorContext } from '../../types.js'\nimport type { TransactionLifetime } from '../../utils/getTransactionLifetime.js'\nimport { SolanaTransactionDetailsError } from '../../utils/solanaErrorCause.js'\nimport {\n confirmationError,\n type ConfirmationMessages,\n} from './confirmationError.js'\n\n/** Explorer link for a signature, as both wait tasks write it. */\nexport function getTxLink(\n context: Pick<SolanaStepExecutorContext, 'fromChain'>,\n signature: string\n): string {\n return `${context.fromChain.metamask.blockExplorerUrls[0]}tx/${signature}`\n}\n\n/**\n * May stored bytes be sent (again)? A blockhash transaction always: the\n * chain rejects it once the blockhash dies, and the deadline's probe tells\n * when. Anything else - a durable nonce, a lifetime that did not decode -\n * only inside the resend age cap, so a page load hours later cannot execute\n * a swap on an old quote.\n */\nexport function canResendStored(\n lifetimes: TransactionLifetime[],\n signedAt: number | undefined,\n now?: number\n): boolean {\n const expiresOnItsOwn =\n lifetimes.length > 0 &&\n lifetimes.every((lifetime) => lifetime.kind === 'blockhash')\n return expiresOnItsOwn || isResendAllowed(signedAt, now)\n}\n\n/**\n * Condition (a) of the dropped rule in `resolveUnconfirmed`: the chain says\n * the transaction can no longer land.\n *\n * - An `expired` verdict: the blockhash probe saw it dead.\n * - Without a verdict, `isOldEnoughToDrop` for every lifetime. For a\n * blockhash transaction that is the five-minute time fallback. For a\n * durable nonce or an undecodable lifetime it is the age cap passed plus a\n * margin: sends stop at the cap, and the three minutes after it put the\n * lookup's current-slot head safely past any slot the transaction could\n * still land in.\n *\n * An unknown signing time never holds by time.\n */\nexport function cannotLandAnymore(options: {\n expired: boolean\n signedAt: number | undefined\n now?: number\n}): boolean {\n return options.expired || isOldEnoughToDrop(options.signedAt, options.now)\n}\n\n/** Drops the stored bytes: never sent, landed, or final. */\nexport function clearStoredTransactions(\n context: SolanaStepExecutorContext,\n action: ExecutionAction\n): void {\n context.statusManager.updateAction(context.step, action.type, 'PENDING', {\n txHex: undefined,\n })\n}\n\n/** A signature status's `err` as the failure `recordLanded` takes. */\nexport function failureOf(\n status: Pick<SignatureStatus, 'err'>\n): { err: unknown } | undefined {\n return status.err ? { err: status.err } : undefined\n}\n\n/**\n * Result rule for a transaction the chain has: writes `txHash` and `txLink`,\n * clears the stored bytes, then completes - or throws the final\n * `TransactionFailed` for one that failed on chain.\n *\n * The hash is written for a failed transaction too: it exists on chain, and\n * a resume that found it by lookup has no `txHash` yet.\n */\nexport function recordLanded(\n context: SolanaStepExecutorContext,\n action: ExecutionAction,\n options: { signature: Signature; failure: { err: unknown } | undefined }\n): TaskResult {\n const { step, statusManager, isBridgeExecution } = context\n const { signature, failure } = options\n\n statusManager.updateAction(step, action.type, 'PENDING', {\n txHash: signature,\n txLink: getTxLink(context, signature),\n txHex: undefined,\n })\n\n if (failure) {\n const cause = new SolanaTransactionDetailsError(failure.err)\n throw new TransactionError(\n LiFiErrorCode.TransactionFailed,\n `Transaction failed: ${cause.message}`,\n cause,\n { final: true }\n )\n }\n\n if (isBridgeExecution) {\n statusManager.updateAction(step, action.type, 'DONE')\n }\n\n return { status: 'COMPLETED' }\n}\n\n/**\n * Decides what a transaction that did not confirm is: landed after all\n * (returns its status), dropped (throws a final `TransactionExpired`), or\n * unknown (rethrows `error`, the error the task built for today's outcome).\n *\n * Dropped (see the resume rules in `transactionState.ts`) = (a)\n * `cannotLandAnymore`, AND (b) a lookup that proves the absence - a covering\n * RPC whose head is past the landing window answered `null` in the same\n * response, and no RPC has the transaction - AND (c) the status API does not\n * know the hash. The status API only vetoes: it answers 404 for landed\n * transactions it does not index too, so a miss there proves nothing.\n */\nexport async function resolveUnconfirmed(\n context: SolanaStepExecutorContext,\n action: ExecutionAction,\n options: {\n signature: Signature\n /** What the integrator sees when the outcome stays unknown. */\n error: unknown\n /** The slot of the `expired` verdict; `undefined` without one. */\n expiredAtSlot: bigint | undefined\n messages: ConfirmationMessages\n }\n): Promise<SignatureStatus> {\n const { client, step } = context\n const { signature, error, expiredAtSlot } = options\n const signedAt = step.execution?.signedAt\n\n // (a) The local check runs first, so a young transaction costs no request.\n if (!cannotLandAnymore({ expired: expiredAtSlot !== undefined, signedAt })) {\n throw error\n }\n // Without a signing time there is no anchor, so no canary can prove that a\n // node's history covers the transaction.\n if (signedAt === undefined) {\n throw error\n }\n\n // (b) Absence, proven by the same response that proves coverage and head.\n // Every other lookup result - also `unknown` with `answered: false`, an\n // outage - keeps the outcome unknown.\n const lookup = await lookupSignatureStatus(client, signature, {\n anchor: signedAt - CLOCK_SKEW_MARGIN_MS,\n expiredAtSlot,\n })\n if (\n lookup.kind === 'found' &&\n isConfirmedCommitment(lookup.status.confirmationStatus)\n ) {\n return lookup.status\n }\n if (lookup.kind !== 'not-found') {\n throw error\n }\n\n // (c) The veto.\n if (await isKnownToStatusApi(client, step, signature)) {\n throw error\n }\n\n clearStoredTransactions(context, action)\n // Today's expiry code and text: only the marker is new.\n throw new TransactionError(\n LiFiErrorCode.TransactionExpired,\n options.messages.notConfirmed,\n error instanceof Error ? error : undefined,\n { final: true }\n )\n}\n\n/**\n * The send-and-settle tail both wait tasks share: runs `send`, then applies\n * the result rules to what it reports.\n *\n * - A confirmation goes to `recordLanded`, with `confirmedFailure` reading\n * its on-chain failure.\n * - Every other result - `rpc-unavailable` included - goes to\n * `resolveUnconfirmed`. Only an `expired` verdict passes its slot: the\n * dropped check reads any defined slot as a verdict.\n * - A rejection comes before the first send of this run. On the first run\n * nothing ever left the SDK, so the bytes are cleared and the error is\n * rethrown: \"Try again\" signs again. On a resume an earlier run may have\n * sent the same bytes: they stay, and only the chain can make the outcome\n * final.\n */\nexport async function sendAndSettle<T>(\n context: SolanaStepExecutorContext,\n action: ExecutionAction,\n options: {\n signature: Signature\n /** Sends and races the confirmation. Rejects only before its first\n * send; the race itself never rejects. */\n send: () => Promise<RaceResult<T>>\n /** The on-chain failure of a confirmed value. */\n confirmedFailure: (value: T) => { err: unknown } | undefined\n /** An earlier run may already have sent these bytes. */\n resuming: boolean\n messages: ConfirmationMessages\n }\n): Promise<TaskResult> {\n const { signature, messages } = options\n\n /** `resolveUnconfirmed` throws for an unknown or dropped outcome, so only\n * a confirmed status reaches `recordLanded`. */\n const settleUnconfirmed = async (\n error: unknown,\n expiredAtSlot: bigint | undefined\n ): Promise<TaskResult> => {\n const status = await resolveUnconfirmed(context, action, {\n signature,\n error,\n expiredAtSlot,\n messages,\n })\n return recordLanded(context, action, {\n signature,\n failure: failureOf(status),\n })\n }\n\n let result: RaceResult<T>\n try {\n result = await options.send()\n } catch (error) {\n if (!options.resuming) {\n clearStoredTransactions(context, action)\n throw error\n }\n return settleUnconfirmed(error, undefined)\n }\n\n if (result.kind === 'confirmed') {\n return recordLanded(context, action, {\n signature,\n failure: options.confirmedFailure(result.value),\n })\n }\n\n return settleUnconfirmed(\n confirmationError(result, messages),\n // The head a covering RPC has to reach before its `null` counts.\n result.kind === 'expired' ? result.slot : undefined\n )\n}\n"],"mappings":"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"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { ExecutionAction, LiFiStep, SDKError } from "@lifi/sdk";
|
|
2
|
-
//#region src/errors/parseSolanaErrors.d.ts
|
|
3
2
|
export declare const parseSolanaErrors: (e: Error, step?: LiFiStep, action?: ExecutionAction) => Promise<SDKError>;
|
|
4
|
-
//#endregion
|
|
5
3
|
//# sourceMappingURL=parseSolanaErrors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseSolanaErrors.d.ts","names":[],"sources":["../../../src/errors/parseSolanaErrors.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"parseSolanaErrors.d.ts","names":[],"sources":["../../../src/errors/parseSolanaErrors.ts"],"mappings":";qBAWa,oBACX,GAAG,OACH,OAAO,UACP,SAAS,oBACR,QAAQ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseError, ErrorMessage, LiFiErrorCode, SDKError, TransactionError, UnknownError } from "@lifi/sdk";
|
|
2
|
-
|
|
2
|
+
// src/errors/parseSolanaErrors.ts
|
|
3
3
|
const parseSolanaErrors = async (e, step, action) => {
|
|
4
4
|
if (e instanceof SDKError) {
|
|
5
5
|
e.step = e.step ?? step;
|
|
@@ -10,13 +10,16 @@ const parseSolanaErrors = async (e, step, action) => {
|
|
|
10
10
|
return new SDKError(baseError, step, action);
|
|
11
11
|
};
|
|
12
12
|
const userRejectionMessage = /(^|\W)user\W+(has\W+)?(rejected|denied|cancell?ed)|\b(rejected|denied|cancell?ed)\W+by\W+(the\W+)?user\b/i;
|
|
13
|
+
const walletCancelMessage = /^transaction (was )?cancell?ed\.?$/i;
|
|
13
14
|
/**
|
|
14
15
|
* The SDK calls the Wallet Standard features directly, so a wallet's own error
|
|
15
16
|
* arrives here unwrapped. Wallets report a rejection with the EIP-1193 code
|
|
16
|
-
* 4001 or only with a message.
|
|
17
|
-
*
|
|
17
|
+
* 4001 or only with a message. A wallet cancel is a rejection too: the prompt
|
|
18
|
+
* was open and the wallet sent nothing, as with `WalletSignTransactionError`.
|
|
19
|
+
* An `AbortError` is not a rejection: nothing says the user caused it. The
|
|
20
|
+
* SDK's own errors keep their code.
|
|
18
21
|
*/
|
|
19
|
-
const isUserRejection = (e) => !(e instanceof BaseError) && (e.code === 4001 || typeof e.message === "string" && userRejectionMessage.test(e.message));
|
|
22
|
+
const isUserRejection = (e) => !(e instanceof BaseError) && (e.code === 4001 || typeof e.message === "string" && (userRejectionMessage.test(e.message) || walletCancelMessage.test(e.message.trim())));
|
|
20
23
|
const handleSpecificErrors = (e) => {
|
|
21
24
|
if (e.name === "WalletSignTransactionError") return new TransactionError(LiFiErrorCode.SignatureRejected, e.message, e);
|
|
22
25
|
if (e.name === "SendTransactionError") return new TransactionError(LiFiErrorCode.TransactionFailed, e.message, e);
|
|
@@ -26,7 +29,6 @@ const handleSpecificErrors = (e) => {
|
|
|
26
29
|
if (e instanceof BaseError) return e;
|
|
27
30
|
return new UnknownError(e.message || ErrorMessage.UnknownError, e);
|
|
28
31
|
};
|
|
29
|
-
//#endregion
|
|
30
32
|
export { parseSolanaErrors };
|
|
31
33
|
|
|
32
34
|
//# sourceMappingURL=parseSolanaErrors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseSolanaErrors.js","names":[],"sources":["../../../src/errors/parseSolanaErrors.ts"],"sourcesContent":["import {\n BaseError,\n ErrorMessage,\n type ExecutionAction,\n LiFiErrorCode,\n type LiFiStep,\n SDKError,\n TransactionError,\n UnknownError,\n} from '@lifi/sdk'\n\nexport const parseSolanaErrors = async (\n e: Error,\n step?: LiFiStep,\n action?: ExecutionAction\n): Promise<SDKError> => {\n if (e instanceof SDKError) {\n e.step = e.step ?? step\n e.action = e.action ?? action\n return e\n }\n\n const baseError = handleSpecificErrors(e)\n\n return new SDKError(baseError, step, action)\n}\n\n// Same pattern as bigmi's `isUserRejection`. It is anchored on \"user\", so a\n// refusal by a node or a host does not count as a rejection.\nconst userRejectionMessage =\n /(^|\\W)user\\W+(has\\W+)?(rejected|denied|cancell?ed)|\\b(rejected|denied|cancell?ed)\\W+by\\W+(the\\W+)?user\\b/i\n\n/**\n * The SDK calls the Wallet Standard features directly, so a wallet's own error\n * arrives here unwrapped. Wallets report a rejection with the EIP-1193 code\n * 4001 or only with a message. An `AbortError` is not a rejection: nothing
|
|
1
|
+
{"version":3,"file":"parseSolanaErrors.js","names":[],"sources":["../../../src/errors/parseSolanaErrors.ts"],"sourcesContent":["import {\n BaseError,\n ErrorMessage,\n type ExecutionAction,\n LiFiErrorCode,\n type LiFiStep,\n SDKError,\n TransactionError,\n UnknownError,\n} from '@lifi/sdk'\n\nexport const parseSolanaErrors = async (\n e: Error,\n step?: LiFiStep,\n action?: ExecutionAction\n): Promise<SDKError> => {\n if (e instanceof SDKError) {\n e.step = e.step ?? step\n e.action = e.action ?? action\n return e\n }\n\n const baseError = handleSpecificErrors(e)\n\n return new SDKError(baseError, step, action)\n}\n\n// Same pattern as bigmi's `isUserRejection`. It is anchored on \"user\", so a\n// refusal by a node or a host does not count as a rejection.\nconst userRejectionMessage =\n /(^|\\W)user\\W+(has\\W+)?(rejected|denied|cancell?ed)|\\b(rejected|denied|cancell?ed)\\W+by\\W+(the\\W+)?user\\b/i\n\n// Some wallets report a Cancel on the sign prompt only with this text (an\n// Android in-app wallet). The whole message must match, so a longer error that\n// starts with these words does not count.\nconst walletCancelMessage = /^transaction (was )?cancell?ed\\.?$/i\n\n/**\n * The SDK calls the Wallet Standard features directly, so a wallet's own error\n * arrives here unwrapped. Wallets report a rejection with the EIP-1193 code\n * 4001 or only with a message. A wallet cancel is a rejection too: the prompt\n * was open and the wallet sent nothing, as with `WalletSignTransactionError`.\n * An `AbortError` is not a rejection: nothing says the user caused it. The\n * SDK's own errors keep their code.\n */\nconst isUserRejection = (e: any): boolean =>\n !(e instanceof BaseError) &&\n (e.code === 4001 ||\n (typeof e.message === 'string' &&\n (userRejectionMessage.test(e.message) ||\n walletCancelMessage.test(e.message.trim()))))\n\nconst handleSpecificErrors = (e: any) => {\n if (e.name === 'WalletSignTransactionError') {\n return new TransactionError(LiFiErrorCode.SignatureRejected, e.message, e)\n }\n\n if (e.name === 'SendTransactionError') {\n return new TransactionError(LiFiErrorCode.TransactionFailed, e.message, e)\n }\n\n if (e.name === 'TransactionExpiredBlockheightExceededError') {\n return new TransactionError(LiFiErrorCode.TransactionExpired, e.message, e)\n }\n\n // After the name checks: a known error keeps its code, even when its\n // message quotes program logs that look like a rejection.\n if (isUserRejection(e)) {\n return new TransactionError(LiFiErrorCode.SignatureRejected, e.message, e)\n }\n\n if (e.message?.includes('simulate')) {\n return new TransactionError(\n LiFiErrorCode.TransactionSimulationFailed,\n e.message,\n e\n )\n }\n\n if (e instanceof BaseError) {\n return e\n }\n\n return new UnknownError(e.message || ErrorMessage.UnknownError, e)\n}\n"],"mappings":";;AAWA,MAAa,oBAAoB,OAC/B,GACA,MACA,WACsB;CACtB,IAAI,aAAa,UAAU;EACzB,EAAE,OAAO,EAAE,QAAQ;EACnB,EAAE,SAAS,EAAE,UAAU;EACvB,OAAO;CACT;CAEA,MAAM,YAAY,qBAAqB,CAAC;CAExC,OAAO,IAAI,SAAS,WAAW,MAAM,MAAM;AAC7C;AAIA,MAAM,uBACJ;AAKF,MAAM,sBAAsB;;;;;;;;;AAU5B,MAAM,mBAAmB,MACvB,EAAE,aAAa,eACd,EAAE,SAAS,QACT,OAAO,EAAE,YAAY,aACnB,qBAAqB,KAAK,EAAE,OAAO,KAClC,oBAAoB,KAAK,EAAE,QAAQ,KAAK,CAAC;AAEjD,MAAM,wBAAwB,MAAW;CACvC,IAAI,EAAE,SAAS,8BACb,OAAO,IAAI,iBAAiB,cAAc,mBAAmB,EAAE,SAAS,CAAC;CAG3E,IAAI,EAAE,SAAS,wBACb,OAAO,IAAI,iBAAiB,cAAc,mBAAmB,EAAE,SAAS,CAAC;CAG3E,IAAI,EAAE,SAAS,8CACb,OAAO,IAAI,iBAAiB,cAAc,oBAAoB,EAAE,SAAS,CAAC;CAK5E,IAAI,gBAAgB,CAAC,GACnB,OAAO,IAAI,iBAAiB,cAAc,mBAAmB,EAAE,SAAS,CAAC;CAG3E,IAAI,EAAE,SAAS,SAAS,UAAU,GAChC,OAAO,IAAI,iBACT,cAAc,6BACd,EAAE,SACF,CACF;CAGF,IAAI,aAAa,WACf,OAAO;CAGT,OAAO,IAAI,aAAa,EAAE,WAAW,aAAa,cAAc,CAAC;AACnE"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SolanaProviderOptions, SolanaSDKProvider, isSolanaProvider } from "./types.js";
|
|
2
1
|
import { SolanaProvider } from "./SolanaProvider.js";
|
|
2
|
+
import { SolanaProviderOptions, SolanaSDKProvider, isSolanaProvider } from "./types.js";
|
|
3
3
|
import { KeypairWalletAdapter } from "./utils/KeypairWalletAdapter.js";
|
|
4
4
|
import { SolanaTransactionDetailsError } from "./utils/solanaErrorCause.js";
|
|
5
5
|
import { address as toAddress } from "@solana/kit";
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SolanaTransactionDetailsError } from "./utils/solanaErrorCause.js";
|
|
2
1
|
import { SolanaProvider } from "./SolanaProvider.js";
|
|
3
2
|
import { isSolanaProvider } from "./types.js";
|
|
4
3
|
import { KeypairWalletAdapter } from "./utils/KeypairWalletAdapter.js";
|
|
4
|
+
import { SolanaTransactionDetailsError } from "./utils/solanaErrorCause.js";
|
|
5
5
|
import { address as toAddress } from "@solana/kit";
|
|
6
6
|
export { KeypairWalletAdapter, SolanaProvider, SolanaTransactionDetailsError, isSolanaProvider, toAddress };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { JitoRegion } from "../types.js";
|
|
2
2
|
import { Signature } from "@solana/kit";
|
|
3
|
-
//#region src/rpc/jito/api/getBundleStatuses.d.ts
|
|
4
3
|
type BundleStatus = {
|
|
5
4
|
bundle_id: string;
|
|
6
5
|
/** Optional: unvalidated wire data, so the reader must handle its absence. */
|
|
@@ -23,6 +22,5 @@ export type GetBundleStatusesApi = {
|
|
|
23
22
|
*/
|
|
24
23
|
getBundleStatuses(bundleIds: string[], region?: JitoRegion): GetBundleStatusesResponse;
|
|
25
24
|
};
|
|
26
|
-
//#endregion
|
|
27
25
|
export {};
|
|
28
26
|
//# sourceMappingURL=getBundleStatuses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBundleStatuses.d.ts","names":[],"sources":["../../../../../src/rpc/jito/api/getBundleStatuses.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getBundleStatuses.d.ts","names":[],"sources":["../../../../../src/rpc/jito/api/getBundleStatuses.ts"],"mappings":";;KAIK;EACH;;EAEA,eAAe;EACf;EACA;EACA;;KAGG;EACH;IACE;;;EAGF,QAAQ;;YAGE;;;;;EAKV,kBAEE,qBAEA,SAAS,aACR"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { JitoRegion } from "../types.js";
|
|
2
|
-
//#region src/rpc/jito/api/getTipAccounts.d.ts
|
|
3
2
|
/** Array of tip account addresses (Solana public keys) */
|
|
4
3
|
type GetTipAccountsResponse = string[];
|
|
5
4
|
export type GetTipAccountsApi = {
|
|
@@ -10,6 +9,5 @@ export type GetTipAccountsApi = {
|
|
|
10
9
|
*/
|
|
11
10
|
getTipAccounts(region?: JitoRegion): GetTipAccountsResponse;
|
|
12
11
|
};
|
|
13
|
-
//#endregion
|
|
14
12
|
export {};
|
|
15
13
|
//# sourceMappingURL=getTipAccounts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTipAccounts.d.ts","names":[],"sources":["../../../../../src/rpc/jito/api/getTipAccounts.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getTipAccounts.d.ts","names":[],"sources":["../../../../../src/rpc/jito/api/getTipAccounts.ts"],"mappings":";;KAGK;YAEO;;;;;;EAMV,eAEE,SAAS,aACR"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { JitoRegion } from "../types.js";
|
|
2
2
|
import { Base64EncodedWireTransaction } from "@solana/kit";
|
|
3
|
-
//#region src/rpc/jito/api/sendBundle.d.ts
|
|
4
3
|
/** Bundle ID returned on successful submission */
|
|
5
4
|
type SendBundleResponse = string;
|
|
6
5
|
export type SendBundleApi = {
|
|
@@ -17,6 +16,5 @@ export type SendBundleApi = {
|
|
|
17
16
|
*/
|
|
18
17
|
sendBundle(transactions: Array<Base64EncodedWireTransaction>, region?: JitoRegion): SendBundleResponse;
|
|
19
18
|
};
|
|
20
|
-
//#endregion
|
|
21
19
|
export {};
|
|
22
20
|
//# sourceMappingURL=sendBundle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendBundle.d.ts","names":[],"sources":["../../../../../src/rpc/jito/api/sendBundle.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sendBundle.d.ts","names":[],"sources":["../../../../../src/rpc/jito/api/sendBundle.ts"],"mappings":";;;KAKK;YAEO;;;;;;;;;;;;EAYV,WAEE,cAAc,MAAM,+BAEpB,SAAS,aACR"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Base64EncodedWireTransaction } from "@solana/kit";
|
|
2
|
-
//#region src/rpc/jito/api/simulateBundle.d.ts
|
|
3
2
|
type AccountConfig = {
|
|
4
3
|
accountIndex: number;
|
|
5
4
|
addresses: string[];
|
|
@@ -56,6 +55,5 @@ export type SimulateBundleApi = {
|
|
|
56
55
|
postExecutionAccountsConfigs?: AccountConfig[];
|
|
57
56
|
}>): SimulateBundleResponse;
|
|
58
57
|
};
|
|
59
|
-
//#endregion
|
|
60
58
|
export {};
|
|
61
59
|
//# sourceMappingURL=simulateBundle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulateBundle.d.ts","names":[],"sources":["../../../../../src/rpc/jito/api/simulateBundle.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"simulateBundle.d.ts","names":[],"sources":["../../../../../src/rpc/jito/api/simulateBundle.ts"],"mappings":";KAEK;EACH;EACA;;KAGG;EACH;EACA;EACA;EACA;EACA;;KAGG;EACH;IACE;IACA;;EAEF;IACE;MAAyB;QAAU;QAAgB;;;IACnD,oBAAoB;MAClB;MACA;MACA;MACA;QACE;QACA;;MAEF,sBAAsB;MACtB,uBAAuB;;;;YAKjB;;;;;EAKV,eACE,QAAQ;IACN,qBAAqB,MAAM;MAE7B,SAAS;;IAEP;;IAEA;;IAEA;;IAEA,8BAA8B;;IAE9B,+BAA+B;OAEhC"}
|
|
@@ -3,10 +3,8 @@ import { GetTipAccountsApi } from "./api/getTipAccounts.js";
|
|
|
3
3
|
import { SendBundleApi } from "./api/sendBundle.js";
|
|
4
4
|
import { SimulateBundleApi } from "./api/simulateBundle.js";
|
|
5
5
|
import { ClusterUrl, Rpc, RpcTransport, SolanaRpcApi, createDefaultRpcTransport } from "@solana/kit";
|
|
6
|
-
//#region src/rpc/jito/createJitoRpc.d.ts
|
|
7
6
|
export type JitoBundleApi = GetBundleStatusesApi & GetTipAccountsApi & SendBundleApi & SimulateBundleApi;
|
|
8
7
|
export type JitoRpcApi = JitoBundleApi & SolanaRpcApi;
|
|
9
8
|
export declare function createJitoRpcFromTransport<TTransport extends RpcTransport>(transport: TTransport): Rpc<JitoRpcApi>;
|
|
10
9
|
export declare function createJitoRpc<TClusterUrl extends ClusterUrl>(clusterUrl: TClusterUrl, config?: Omit<Parameters<typeof createDefaultRpcTransport<TClusterUrl>>[0], "url">): Rpc<JitoRpcApi>;
|
|
11
|
-
//#endregion
|
|
12
10
|
//# sourceMappingURL=createJitoRpc.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createJitoRpc.d.ts","names":[],"sources":["../../../../src/rpc/jito/createJitoRpc.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"createJitoRpc.d.ts","names":[],"sources":["../../../../src/rpc/jito/createJitoRpc.ts"],"mappings":";;;;;YAeY,gBAAgB,uBAC1B,oBACA,gBACA;YAGU,aAAa,gBAAgB;wBAQzB,2BAA2B,mBAAmB,cAC5D,WAAW,aACV,IAAI;wBAQS,cAAc,oBAAoB,YAChD,YAAY,aACZ,SAAS,KACP,kBAAkB,0BAA0B,2BAG7C,IAAI"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createDefaultRpcTransport, createRpc, createSolanaRpcApi } from "@solana/kit";
|
|
2
|
-
|
|
2
|
+
// src/rpc/jito/createJitoRpc.ts
|
|
3
3
|
function createJitoRpcApi() {
|
|
4
4
|
return createSolanaRpcApi();
|
|
5
5
|
}
|
|
@@ -15,7 +15,6 @@ function createJitoRpc(clusterUrl, config) {
|
|
|
15
15
|
...config
|
|
16
16
|
}));
|
|
17
17
|
}
|
|
18
|
-
//#endregion
|
|
19
18
|
export { createJitoRpc, createJitoRpcFromTransport };
|
|
20
19
|
|
|
21
20
|
//# sourceMappingURL=createJitoRpc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/rpc/jito/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/rpc/jito/types.ts"],"mappings":";;;YAGY"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { JitoRpcType, SolanaRpcType } from "./types.js";
|
|
2
2
|
import { SDKClient } from "@lifi/sdk";
|
|
3
|
-
//#region src/rpc/registry.d.ts
|
|
4
3
|
/** Both leave the endpoint out of the Jito list, but only `unsupported` is a
|
|
5
4
|
* configuration gap the integrator can act on. */
|
|
6
5
|
export type JitoProbeOutcome = "supported" | "unsupported" | "unreachable";
|
|
@@ -65,5 +64,4 @@ export declare const getJitoCapableRpcs: (rpcUrls: string[]) => Promise<{
|
|
|
65
64
|
rpcs: JitoRpcType[];
|
|
66
65
|
unreachable: number;
|
|
67
66
|
}>;
|
|
68
|
-
//#endregion
|
|
69
67
|
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","names":[],"sources":["../../../src/rpc/registry.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.d.ts","names":[],"sources":["../../../src/rpc/registry.ts"],"mappings":";;;;YAyBY;;;;YAKA;EACV,SAAS;;EAET;;;;;qBAMW;;;;;;;;qBASA;;;;;;;qBA+EA,eACX,mBACC,QAAQ;;;;;qBAyHE,gBACX,QAAQ,cACP,QAAQ;;;;;;;;qBAWE,qBAAsB,sBAAoB;;;;;;qBAU1C,cACX,QAAQ,cACP;EAAU,MAAM;EAAe;;;;;;;;;;qBAarB,qBACX,sBACC;EAAU,MAAM;EAAe"}
|
package/dist/esm/rpc/registry.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createJitoRpc } from "./jito/createJitoRpc.js";
|
|
2
2
|
import { ChainId, LruMap, withDedupe } from "@lifi/sdk";
|
|
3
3
|
import { createSolanaRpc } from "@solana/kit";
|
|
4
|
-
|
|
4
|
+
// src/rpc/registry.ts
|
|
5
5
|
const solanaRpcs = new LruMap(64);
|
|
6
6
|
const jitoRpcs = new LruMap(64);
|
|
7
7
|
/**
|
|
@@ -186,7 +186,6 @@ const getJitoCapableRpcs = async (rpcUrls) => {
|
|
|
186
186
|
unreachable
|
|
187
187
|
};
|
|
188
188
|
};
|
|
189
|
-
//#endregion
|
|
190
189
|
export { JITO_PROBE_GATEWAY_RETRY_MS, JITO_PROBE_RETRY_MS, getJitoCapableRpcs, getJitoRpcs, getSolanaRpcs, getSolanaWriteRpcs, probeJitoRpc };
|
|
191
190
|
|
|
192
191
|
//# sourceMappingURL=registry.js.map
|
package/dist/esm/rpc/types.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { JitoRpcApi } from "./jito/createJitoRpc.js";
|
|
2
2
|
import { Rpc, createSolanaRpc } from "@solana/kit";
|
|
3
|
-
//#region src/rpc/types.d.ts
|
|
4
3
|
export type SolanaRpcType = ReturnType<typeof createSolanaRpc>;
|
|
5
4
|
export type JitoRpcType = Rpc<JitoRpcApi>;
|
|
6
|
-
//#endregion
|
|
7
5
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -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":";;YAGY,gBAAgB,kBAAkB;YAClC,cAAc,IAAI"}
|
package/dist/esm/rpc/utils.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { JitoRpcType, SolanaRpcType } from "./types.js";
|
|
2
2
|
import { SDKClient } from "@lifi/sdk";
|
|
3
|
-
//#region src/rpc/utils.d.ts
|
|
4
3
|
type RetryFn<Rpc> = <R>(client: SDKClient, fn: (rpc: Rpc) => Promise<R>) => Promise<R>;
|
|
5
4
|
/**
|
|
6
5
|
* Calls a function on RPC instances with retry logic.
|
|
@@ -61,6 +60,5 @@ export declare const callSolanaRpcsWithRetry: RetryFn<SolanaRpcType>;
|
|
|
61
60
|
* ```
|
|
62
61
|
*/
|
|
63
62
|
export declare const callJitoRpcsWithRetry: RetryFn<JitoRpcType>;
|
|
64
|
-
//#endregion
|
|
65
63
|
export {};
|
|
66
64
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;wBAsBS,cAAc,GAAG,GACrC,MAAM,KACN,KAAK,KAAK,MAAM,QAAQ,KACvB,QAAQ;;;;;;;;;;;;;;;;;;;qBA8CE,yBAAyB,QAAQ;;;;;;;;;;;;;;;;;;;qBAqBjC,uBAAuB,QAAQ"}
|
package/dist/esm/rpc/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getJitoRpcs, getSolanaRpcs } from "./registry.js";
|
|
2
|
-
|
|
2
|
+
// src/rpc/utils.ts
|
|
3
3
|
/**
|
|
4
4
|
* Calls a function on RPC instances with retry logic.
|
|
5
5
|
* Tries each RPC in sequence until one succeeds.
|
|
@@ -75,7 +75,6 @@ const callSolanaRpcsWithRetry = createRetryFn(getSolanaRpcs);
|
|
|
75
75
|
* ```
|
|
76
76
|
*/
|
|
77
77
|
const callJitoRpcsWithRetry = createRetryFn(async (client) => (await getJitoRpcs(client)).rpcs);
|
|
78
|
-
//#endregion
|
|
79
78
|
export { callJitoRpcsWithRetry, callSolanaRpcsWithRetry, callWithRetry };
|
|
80
79
|
|
|
81
80
|
//# sourceMappingURL=utils.js.map
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { LiFiStepExtended, SDKProvider, StepExecutorContext, StepExecutorOptions } from "@lifi/sdk";
|
|
2
2
|
import { Transaction } from "@solana/kit";
|
|
3
3
|
import { Wallet, WalletAccount } from "@wallet-standard/base";
|
|
4
|
-
//#region src/types.d.ts
|
|
5
4
|
export interface SolanaProviderOptions {
|
|
6
5
|
getWallet?: () => Promise<Wallet>;
|
|
7
6
|
skipSimulation?: boolean;
|
|
@@ -38,5 +37,4 @@ export interface SolanaStepExecutorOptions extends StepExecutorOptions {
|
|
|
38
37
|
wallet: Wallet;
|
|
39
38
|
skipSimulation?: boolean;
|
|
40
39
|
}
|
|
41
|
-
//#endregion
|
|
42
40
|
//# sourceMappingURL=types.d.ts.map
|
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":";;;iBAUiB;EACf,kBAAkB,QAAQ;EAC1B;;iBAGe;;;;;EAKf,qBAAqB;;;;;;EAMrB;;iBAGe,kCACP,qBAAqB;EAC7B,QAAQ;;;;;;;EAOR,mBAAmB,MAAM,qBAAqB;EAC9C;;iBAGe,0BAA0B;EACzC,WAAW,SAAS;;wBAGN,iBACd,UAAU,cACT,YAAY;iBAIE,kCAAkC;EACjD,QAAQ;EACR"}
|
package/dist/esm/types.js
CHANGED