@lifi/sdk-provider-solana 4.3.6 → 4.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/SolanaProvider.d.ts +1 -4
  3. package/dist/cjs/SolanaProvider.js +1 -2
  4. package/dist/cjs/SolanaProvider.js.map +1 -1
  5. package/dist/cjs/actions/getSNSAddress.d.ts +1 -4
  6. package/dist/cjs/actions/getSNSAddress.js +1 -2
  7. package/dist/cjs/actions/getSolanaBalance.d.ts +1 -4
  8. package/dist/cjs/actions/getSolanaBalance.js +1 -2
  9. package/dist/cjs/actions/lookupSignatureStatus.d.ts +1 -4
  10. package/dist/cjs/actions/lookupSignatureStatus.js +2 -3
  11. package/dist/cjs/actions/resolveSolanaAddress.d.ts +1 -4
  12. package/dist/cjs/actions/resolveSolanaAddress.js +1 -2
  13. package/dist/cjs/actions/sendAndConfirmBundle.d.ts +1 -4
  14. package/dist/cjs/actions/sendAndConfirmBundle.js +3 -4
  15. package/dist/cjs/actions/sendAndConfirmTransaction.d.ts +2 -5
  16. package/dist/cjs/actions/sendAndConfirmTransaction.js +3 -4
  17. package/dist/cjs/confirmation/abortableSleep.d.ts +1 -4
  18. package/dist/cjs/confirmation/abortableSleep.js +1 -2
  19. package/dist/cjs/confirmation/confirmBundle.d.ts +2 -5
  20. package/dist/cjs/confirmation/confirmBundle.js +1 -2
  21. package/dist/cjs/confirmation/confirmSignature.d.ts +2 -5
  22. package/dist/cjs/confirmation/confirmSignature.js +2 -3
  23. package/dist/cjs/confirmation/createConfirmationDeadline.d.ts +1 -4
  24. package/dist/cjs/confirmation/createConfirmationDeadline.js +2 -3
  25. package/dist/cjs/confirmation/createConfirmationDeadline.js.map +1 -1
  26. package/dist/cjs/confirmation/pollUntilDeadline.d.ts +2 -5
  27. package/dist/cjs/confirmation/pollUntilDeadline.js +1 -2
  28. package/dist/cjs/confirmation/raceRpcs.d.ts +1 -4
  29. package/dist/cjs/confirmation/raceRpcs.js +1 -2
  30. package/dist/cjs/confirmation/raceRpcs.js.map +1 -1
  31. package/dist/cjs/confirmation/types.d.ts +1 -3
  32. package/dist/cjs/confirmation/types.js +1 -2
  33. package/dist/cjs/core/SolanaStepExecutor.d.ts +1 -4
  34. package/dist/cjs/core/SolanaStepExecutor.js +1 -2
  35. package/dist/cjs/core/SolanaStepExecutor.js.map +1 -1
  36. package/dist/cjs/core/tasks/SolanaJitoWaitForTransactionTask.d.ts +1 -4
  37. package/dist/cjs/core/tasks/SolanaJitoWaitForTransactionTask.js +4 -5
  38. package/dist/cjs/core/tasks/SolanaJitoWaitForTransactionTask.js.map +1 -1
  39. package/dist/cjs/core/tasks/SolanaSignAndExecuteTask.d.ts +1 -4
  40. package/dist/cjs/core/tasks/SolanaSignAndExecuteTask.js +1 -2
  41. package/dist/cjs/core/tasks/SolanaSignAndExecuteTask.js.map +1 -1
  42. package/dist/cjs/core/tasks/SolanaStandardWaitForTransactionTask.d.ts +1 -4
  43. package/dist/cjs/core/tasks/SolanaStandardWaitForTransactionTask.js +4 -5
  44. package/dist/cjs/core/tasks/SolanaStandardWaitForTransactionTask.js.map +1 -1
  45. package/dist/cjs/core/tasks/SolanaWaitForTransactionTask.d.ts +1 -4
  46. package/dist/cjs/core/tasks/SolanaWaitForTransactionTask.js +1 -2
  47. package/dist/cjs/core/tasks/confirmationError.d.ts +1 -4
  48. package/dist/cjs/core/tasks/confirmationError.js +1 -2
  49. package/dist/cjs/core/tasks/readSignature.d.ts +1 -4
  50. package/dist/cjs/core/tasks/readSignature.js +1 -2
  51. package/dist/cjs/core/tasks/resumeFromStore.d.ts +2 -5
  52. package/dist/cjs/core/tasks/resumeFromStore.js +3 -4
  53. package/dist/cjs/core/tasks/resumeFromStore.js.map +1 -1
  54. package/dist/cjs/core/tasks/transactionOutcome.d.ts +3 -6
  55. package/dist/cjs/core/tasks/transactionOutcome.js +3 -4
  56. package/dist/cjs/core/tasks/transactionOutcome.js.map +1 -1
  57. package/dist/cjs/errors/parseSolanaErrors.d.ts +1 -4
  58. package/dist/cjs/errors/parseSolanaErrors.js +1 -2
  59. package/dist/cjs/index.d.ts +1 -1
  60. package/dist/cjs/index.js +1 -1
  61. package/dist/cjs/rpc/jito/api/getBundleStatuses.d.ts +1 -3
  62. package/dist/cjs/rpc/jito/api/getTipAccounts.d.ts +1 -3
  63. package/dist/cjs/rpc/jito/api/sendBundle.d.ts +1 -3
  64. package/dist/cjs/rpc/jito/api/simulateBundle.d.ts +1 -3
  65. package/dist/cjs/rpc/jito/createJitoRpc.d.ts +1 -4
  66. package/dist/cjs/rpc/jito/createJitoRpc.js +1 -2
  67. package/dist/cjs/rpc/jito/types.d.ts +1 -4
  68. package/dist/cjs/rpc/registry.d.ts +1 -4
  69. package/dist/cjs/rpc/registry.js +1 -2
  70. package/dist/cjs/rpc/types.d.ts +1 -4
  71. package/dist/cjs/rpc/utils.d.ts +1 -3
  72. package/dist/cjs/rpc/utils.js +1 -2
  73. package/dist/cjs/types.d.ts +1 -4
  74. package/dist/cjs/types.js +1 -2
  75. package/dist/cjs/types.js.map +1 -1
  76. package/dist/cjs/utils/KeypairWallet.unit.helpers.d.ts +1 -4
  77. package/dist/cjs/utils/KeypairWallet.unit.helpers.js +1 -2
  78. package/dist/cjs/utils/KeypairWalletAdapter.d.ts +1 -4
  79. package/dist/cjs/utils/KeypairWalletAdapter.js +1 -2
  80. package/dist/cjs/utils/KeypairWalletAdapter.js.map +1 -1
  81. package/dist/cjs/utils/base64ToUint8Array.d.ts +1 -4
  82. package/dist/cjs/utils/base64ToUint8Array.js +1 -2
  83. package/dist/cjs/utils/getTransactionLifetime.d.ts +1 -4
  84. package/dist/cjs/utils/getTransactionLifetime.js +1 -2
  85. package/dist/cjs/utils/getWalletFeature.d.ts +1 -3
  86. package/dist/cjs/utils/getWalletFeature.js +1 -2
  87. package/dist/cjs/utils/getWalletFeature.js.map +1 -1
  88. package/dist/cjs/utils/solanaErrorCause.d.ts +1 -4
  89. package/dist/cjs/utils/solanaErrorCause.js +1 -2
  90. package/dist/cjs/utils/solanaErrorCause.js.map +1 -1
  91. package/dist/cjs/utils/storedTransactions.d.ts +1 -4
  92. package/dist/cjs/utils/storedTransactions.js +1 -2
  93. package/dist/cjs/version.d.ts +1 -4
  94. package/dist/cjs/version.js +2 -3
  95. package/dist/cjs/version.js.map +1 -1
  96. package/dist/esm/SolanaProvider.d.ts +0 -2
  97. package/dist/esm/SolanaProvider.d.ts.map +1 -1
  98. package/dist/esm/SolanaProvider.js +1 -2
  99. package/dist/esm/actions/getSNSAddress.d.ts +0 -2
  100. package/dist/esm/actions/getSNSAddress.d.ts.map +1 -1
  101. package/dist/esm/actions/getSNSAddress.js +1 -2
  102. package/dist/esm/actions/getSolanaBalance.d.ts +0 -2
  103. package/dist/esm/actions/getSolanaBalance.d.ts.map +1 -1
  104. package/dist/esm/actions/getSolanaBalance.js +1 -2
  105. package/dist/esm/actions/lookupSignatureStatus.d.ts +0 -2
  106. package/dist/esm/actions/lookupSignatureStatus.d.ts.map +1 -1
  107. package/dist/esm/actions/lookupSignatureStatus.js +2 -3
  108. package/dist/esm/actions/resolveSolanaAddress.d.ts +0 -2
  109. package/dist/esm/actions/resolveSolanaAddress.d.ts.map +1 -1
  110. package/dist/esm/actions/resolveSolanaAddress.js +1 -2
  111. package/dist/esm/actions/sendAndConfirmBundle.d.ts +0 -2
  112. package/dist/esm/actions/sendAndConfirmBundle.d.ts.map +1 -1
  113. package/dist/esm/actions/sendAndConfirmBundle.js +3 -4
  114. package/dist/esm/actions/sendAndConfirmTransaction.d.ts +1 -3
  115. package/dist/esm/actions/sendAndConfirmTransaction.d.ts.map +1 -1
  116. package/dist/esm/actions/sendAndConfirmTransaction.js +3 -4
  117. package/dist/esm/confirmation/abortableSleep.d.ts +0 -2
  118. package/dist/esm/confirmation/abortableSleep.d.ts.map +1 -1
  119. package/dist/esm/confirmation/abortableSleep.js +1 -2
  120. package/dist/esm/confirmation/confirmBundle.d.ts +1 -3
  121. package/dist/esm/confirmation/confirmBundle.d.ts.map +1 -1
  122. package/dist/esm/confirmation/confirmBundle.js +1 -2
  123. package/dist/esm/confirmation/confirmSignature.d.ts +1 -3
  124. package/dist/esm/confirmation/confirmSignature.d.ts.map +1 -1
  125. package/dist/esm/confirmation/confirmSignature.js +2 -3
  126. package/dist/esm/confirmation/createConfirmationDeadline.d.ts +0 -2
  127. package/dist/esm/confirmation/createConfirmationDeadline.d.ts.map +1 -1
  128. package/dist/esm/confirmation/createConfirmationDeadline.js +2 -3
  129. package/dist/esm/confirmation/createConfirmationDeadline.js.map +1 -1
  130. package/dist/esm/confirmation/pollUntilDeadline.d.ts +1 -3
  131. package/dist/esm/confirmation/pollUntilDeadline.d.ts.map +1 -1
  132. package/dist/esm/confirmation/pollUntilDeadline.js +1 -2
  133. package/dist/esm/confirmation/raceRpcs.d.ts +0 -2
  134. package/dist/esm/confirmation/raceRpcs.d.ts.map +1 -1
  135. package/dist/esm/confirmation/raceRpcs.js +1 -2
  136. package/dist/esm/confirmation/raceRpcs.js.map +1 -1
  137. package/dist/esm/confirmation/types.d.ts +1 -2
  138. package/dist/esm/confirmation/types.d.ts.map +1 -1
  139. package/dist/esm/confirmation/types.js +1 -2
  140. package/dist/esm/core/SolanaStepExecutor.d.ts +0 -2
  141. package/dist/esm/core/SolanaStepExecutor.d.ts.map +1 -1
  142. package/dist/esm/core/SolanaStepExecutor.js +1 -2
  143. package/dist/esm/core/SolanaStepExecutor.js.map +1 -1
  144. package/dist/esm/core/tasks/SolanaJitoWaitForTransactionTask.d.ts +0 -2
  145. package/dist/esm/core/tasks/SolanaJitoWaitForTransactionTask.d.ts.map +1 -1
  146. package/dist/esm/core/tasks/SolanaJitoWaitForTransactionTask.js +4 -5
  147. package/dist/esm/core/tasks/SolanaSignAndExecuteTask.d.ts +0 -2
  148. package/dist/esm/core/tasks/SolanaSignAndExecuteTask.d.ts.map +1 -1
  149. package/dist/esm/core/tasks/SolanaSignAndExecuteTask.js +1 -2
  150. package/dist/esm/core/tasks/SolanaStandardWaitForTransactionTask.d.ts +0 -2
  151. package/dist/esm/core/tasks/SolanaStandardWaitForTransactionTask.d.ts.map +1 -1
  152. package/dist/esm/core/tasks/SolanaStandardWaitForTransactionTask.js +4 -5
  153. package/dist/esm/core/tasks/SolanaWaitForTransactionTask.d.ts +0 -2
  154. package/dist/esm/core/tasks/SolanaWaitForTransactionTask.d.ts.map +1 -1
  155. package/dist/esm/core/tasks/SolanaWaitForTransactionTask.js +1 -2
  156. package/dist/esm/core/tasks/confirmationError.d.ts +0 -2
  157. package/dist/esm/core/tasks/confirmationError.d.ts.map +1 -1
  158. package/dist/esm/core/tasks/confirmationError.js +1 -2
  159. package/dist/esm/core/tasks/readSignature.d.ts +0 -2
  160. package/dist/esm/core/tasks/readSignature.d.ts.map +1 -1
  161. package/dist/esm/core/tasks/readSignature.js +1 -2
  162. package/dist/esm/core/tasks/resumeFromStore.d.ts +1 -3
  163. package/dist/esm/core/tasks/resumeFromStore.d.ts.map +1 -1
  164. package/dist/esm/core/tasks/resumeFromStore.js +3 -4
  165. package/dist/esm/core/tasks/resumeFromStore.js.map +1 -1
  166. package/dist/esm/core/tasks/transactionOutcome.d.ts +2 -4
  167. package/dist/esm/core/tasks/transactionOutcome.d.ts.map +1 -1
  168. package/dist/esm/core/tasks/transactionOutcome.js +3 -4
  169. package/dist/esm/core/tasks/transactionOutcome.js.map +1 -1
  170. package/dist/esm/errors/parseSolanaErrors.d.ts +0 -2
  171. package/dist/esm/errors/parseSolanaErrors.d.ts.map +1 -1
  172. package/dist/esm/errors/parseSolanaErrors.js +1 -2
  173. package/dist/esm/index.d.ts +1 -1
  174. package/dist/esm/index.js +1 -1
  175. package/dist/esm/rpc/jito/api/getBundleStatuses.d.ts +1 -2
  176. package/dist/esm/rpc/jito/api/getBundleStatuses.d.ts.map +1 -1
  177. package/dist/esm/rpc/jito/api/getTipAccounts.d.ts +1 -2
  178. package/dist/esm/rpc/jito/api/getTipAccounts.d.ts.map +1 -1
  179. package/dist/esm/rpc/jito/api/sendBundle.d.ts +1 -2
  180. package/dist/esm/rpc/jito/api/sendBundle.d.ts.map +1 -1
  181. package/dist/esm/rpc/jito/api/simulateBundle.d.ts +1 -2
  182. package/dist/esm/rpc/jito/api/simulateBundle.d.ts.map +1 -1
  183. package/dist/esm/rpc/jito/createJitoRpc.d.ts +0 -2
  184. package/dist/esm/rpc/jito/createJitoRpc.d.ts.map +1 -1
  185. package/dist/esm/rpc/jito/createJitoRpc.js +1 -2
  186. package/dist/esm/rpc/jito/types.d.ts +0 -2
  187. package/dist/esm/rpc/jito/types.d.ts.map +1 -1
  188. package/dist/esm/rpc/registry.d.ts +0 -2
  189. package/dist/esm/rpc/registry.d.ts.map +1 -1
  190. package/dist/esm/rpc/registry.js +1 -2
  191. package/dist/esm/rpc/types.d.ts +0 -2
  192. package/dist/esm/rpc/types.d.ts.map +1 -1
  193. package/dist/esm/rpc/utils.d.ts +1 -2
  194. package/dist/esm/rpc/utils.d.ts.map +1 -1
  195. package/dist/esm/rpc/utils.js +1 -2
  196. package/dist/esm/types.d.ts +0 -2
  197. package/dist/esm/types.d.ts.map +1 -1
  198. package/dist/esm/types.js +1 -2
  199. package/dist/esm/types.js.map +1 -1
  200. package/dist/esm/utils/KeypairWallet.unit.helpers.d.ts +0 -2
  201. package/dist/esm/utils/KeypairWallet.unit.helpers.d.ts.map +1 -1
  202. package/dist/esm/utils/KeypairWallet.unit.helpers.js +1 -2
  203. package/dist/esm/utils/KeypairWalletAdapter.d.ts +0 -2
  204. package/dist/esm/utils/KeypairWalletAdapter.d.ts.map +1 -1
  205. package/dist/esm/utils/KeypairWalletAdapter.js +1 -2
  206. package/dist/esm/utils/KeypairWalletAdapter.js.map +1 -1
  207. package/dist/esm/utils/base64ToUint8Array.d.ts +0 -2
  208. package/dist/esm/utils/base64ToUint8Array.d.ts.map +1 -1
  209. package/dist/esm/utils/base64ToUint8Array.js +1 -2
  210. package/dist/esm/utils/getTransactionLifetime.d.ts +0 -2
  211. package/dist/esm/utils/getTransactionLifetime.d.ts.map +1 -1
  212. package/dist/esm/utils/getTransactionLifetime.js +1 -2
  213. package/dist/esm/utils/getWalletFeature.d.ts +1 -2
  214. package/dist/esm/utils/getWalletFeature.d.ts.map +1 -1
  215. package/dist/esm/utils/getWalletFeature.js +1 -2
  216. package/dist/esm/utils/getWalletFeature.js.map +1 -1
  217. package/dist/esm/utils/solanaErrorCause.d.ts +0 -2
  218. package/dist/esm/utils/solanaErrorCause.d.ts.map +1 -1
  219. package/dist/esm/utils/solanaErrorCause.js +1 -2
  220. package/dist/esm/utils/solanaErrorCause.js.map +1 -1
  221. package/dist/esm/utils/storedTransactions.d.ts +0 -2
  222. package/dist/esm/utils/storedTransactions.d.ts.map +1 -1
  223. package/dist/esm/utils/storedTransactions.js +1 -2
  224. package/dist/esm/version.d.ts +1 -3
  225. package/dist/esm/version.d.ts.map +1 -1
  226. package/dist/esm/version.js +2 -3
  227. package/dist/esm/version.js.map +1 -1
  228. package/package.json +3 -3
  229. package/src/confirmation/raceRpcs.ts +4 -3
  230. package/src/core/tasks/resumeFromStore.ts +1 -1
  231. package/src/core/tasks/transactionOutcome.ts +1 -1
  232. package/src/index.ts +1 -5
  233. package/src/types.ts +1 -2
  234. package/src/utils/getWalletFeature.ts +1 -0
  235. package/src/version.ts +1 -1
@@ -1,7 +1,7 @@
1
- import { getSolanaRpcs } from "../rpc/registry.js";
2
1
  import { isConfirmedCommitment } from "../confirmation/types.js";
2
+ import { getSolanaRpcs } from "../rpc/registry.js";
3
3
  import { isSignature } from "@solana/kit";
4
- //#region src/actions/lookupSignatureStatus.ts
4
+ // src/actions/lookupSignatureStatus.ts
5
5
  /** Budget of each `getSignatureStatuses` call, the status request. A hung
6
6
  * endpoint would otherwise hold the `allSettled` below - and the wait task
7
7
  * with it - open for good. */
@@ -246,7 +246,6 @@ function firstSignatureOf(blocks) {
246
246
  if (canary) return canary;
247
247
  }
248
248
  }
249
- //#endregion
250
249
  export { CANARY_CALL_TIMEOUT_MS, CANARY_SLOT_STEPS, COVERAGE_PROOF_TIMEOUT_MS, SIGNATURE_LOOKUP_TIMEOUT_MS, SLOT_DURATION_MS, lookupSignatureStatus };
251
250
 
252
251
  //# sourceMappingURL=lookupSignatureStatus.js.map
@@ -1,4 +1,2 @@
1
- //#region src/actions/resolveSolanaAddress.d.ts
2
1
  export declare function resolveSolanaAddress(name: string): Promise<string | undefined>;
3
- //#endregion
4
2
  //# sourceMappingURL=resolveSolanaAddress.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolveSolanaAddress.d.ts","names":[],"sources":["../../../src/actions/resolveSolanaAddress.ts"],"mappings":";wBAEsB,qBACpB,eACC"}
1
+ {"version":3,"file":"resolveSolanaAddress.d.ts","names":[],"sources":["../../../src/actions/resolveSolanaAddress.ts"],"mappings":"A,wBAEsB,qBACpB,eACC"}
@@ -1,9 +1,8 @@
1
1
  import { getSNSAddress } from "./getSNSAddress.js";
2
- //#region src/actions/resolveSolanaAddress.ts
2
+ // src/actions/resolveSolanaAddress.ts
3
3
  async function resolveSolanaAddress(name) {
4
4
  return await getSNSAddress(name);
5
5
  }
6
- //#endregion
7
6
  export { resolveSolanaAddress };
8
7
 
9
8
  //# sourceMappingURL=resolveSolanaAddress.js.map
@@ -2,7 +2,6 @@ import { BundleConfirmation } from "../confirmation/confirmBundle.js";
2
2
  import { RaceResult } from "../confirmation/raceRpcs.js";
3
3
  import { SDKClient } from "@lifi/sdk";
4
4
  import { Transaction } from "@solana/kit";
5
- //#region src/actions/sendAndConfirmBundle.d.ts
6
5
  /**
7
6
  * Sends a Jito bundle once and returns as soon as one read RPC sees every
8
7
  * transaction of it confirmed.
@@ -25,5 +24,4 @@ export declare function sendAndConfirmBundle(client: SDKClient, signedTransactio
25
24
  /** Runs once, when the first submit RPC accepts the submission. */
26
25
  onBroadcast?: () => void;
27
26
  }): Promise<RaceResult<BundleConfirmation>>;
28
- //#endregion
29
27
  //# sourceMappingURL=sendAndConfirmBundle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sendAndConfirmBundle.d.ts","names":[],"sources":["../../../src/actions/sendAndConfirmBundle.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;wBAsCsB,qBACpB,QAAQ,WACR,oBAAoB,eACpB;;EAEE;IAED,QAAQ,WAAW"}
1
+ {"version":3,"file":"sendAndConfirmBundle.d.ts","names":[],"sources":["../../../src/actions/sendAndConfirmBundle.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;wBAsCsB,qBACpB,QAAQ,WACR,oBAAoB,eACpB;;EAEE;IAED,QAAQ,WAAW"}
@@ -1,11 +1,11 @@
1
- import { getJitoCapableRpcs, getJitoRpcs, getSolanaRpcs } from "../rpc/registry.js";
2
- import { BRANCH_TIMEOUT_MS } from "../confirmation/createConfirmationDeadline.js";
3
1
  import { confirmBundle } from "../confirmation/confirmBundle.js";
2
+ import { BRANCH_TIMEOUT_MS } from "../confirmation/createConfirmationDeadline.js";
4
3
  import { raceRpcs } from "../confirmation/raceRpcs.js";
4
+ import { getJitoCapableRpcs, getJitoRpcs, getSolanaRpcs } from "../rpc/registry.js";
5
5
  import { getTransactionLifetime } from "../utils/getTransactionLifetime.js";
6
6
  import { ChainId, LiFiErrorCode, RPCError } from "@lifi/sdk";
7
7
  import { getBase64EncodedWireTransaction, getSignatureFromTransaction } from "@solana/kit";
8
- //#region src/actions/sendAndConfirmBundle.ts
8
+ // src/actions/sendAndConfirmBundle.ts
9
9
  /**
10
10
  * Sends a Jito bundle once and returns as soon as one read RPC sees every
11
11
  * transaction of it confirmed.
@@ -80,7 +80,6 @@ async function sendAndConfirmBundle(client, signedTransactions, options) {
80
80
  onBroadcast: reportBroadcast
81
81
  }), { timeoutMs: BRANCH_TIMEOUT_MS });
82
82
  }
83
- //#endregion
84
83
  export { sendAndConfirmBundle };
85
84
 
86
85
  //# sourceMappingURL=sendAndConfirmBundle.js.map
@@ -1,8 +1,7 @@
1
- import { SignatureStatus } from "../confirmation/types.js";
2
1
  import { RaceResult } from "../confirmation/raceRpcs.js";
2
+ import { SignatureStatus } from "../confirmation/types.js";
3
3
  import { SDKClient } from "@lifi/sdk";
4
4
  import { Transaction } from "@solana/kit";
5
- //#region src/actions/sendAndConfirmTransaction.d.ts
6
5
  /**
7
6
  * Sends a Solana transaction to every configured RPC and returns as soon as
8
7
  * one of them confirms it.
@@ -26,5 +25,4 @@ export declare function sendAndConfirmTransaction(client: SDKClient, signedTrans
26
25
  */
27
26
  mayResend?: () => boolean;
28
27
  }): Promise<RaceResult<SignatureStatus>>;
29
- //#endregion
30
28
  //# sourceMappingURL=sendAndConfirmTransaction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sendAndConfirmTransaction.d.ts","names":[],"sources":["../../../src/actions/sendAndConfirmTransaction.ts"],"mappings":";;;;;;;;;;;;;;;;;wBA8BsB,0BACpB,QAAQ,WACR,mBAAmB,aACnB;;EAEE;;;;;;;EAOA;IAED,QAAQ,WAAW"}
1
+ {"version":3,"file":"sendAndConfirmTransaction.d.ts","names":[],"sources":["../../../src/actions/sendAndConfirmTransaction.ts"],"mappings":";;;;;;;;;;;;;;;;wBA8BsB,0BACpB,QAAQ,WACR,mBAAmB,aACnB;;EAEE;;;;;;;EAOA;IAED,QAAQ,WAAW"}
@@ -1,11 +1,11 @@
1
- import { getSolanaRpcs, getSolanaWriteRpcs } from "../rpc/registry.js";
1
+ import { RESEND_INTERVAL_MS, confirmSignature } from "../confirmation/confirmSignature.js";
2
2
  import { BRANCH_TIMEOUT_MS } from "../confirmation/createConfirmationDeadline.js";
3
3
  import { raceRpcs } from "../confirmation/raceRpcs.js";
4
+ import { getSolanaRpcs, getSolanaWriteRpcs } from "../rpc/registry.js";
4
5
  import { getTransactionLifetime } from "../utils/getTransactionLifetime.js";
5
- import { RESEND_INTERVAL_MS, confirmSignature } from "../confirmation/confirmSignature.js";
6
6
  import { ChainId } from "@lifi/sdk";
7
7
  import { getBase64EncodedWireTransaction, getSignatureFromTransaction } from "@solana/kit";
8
- //#region src/actions/sendAndConfirmTransaction.ts
8
+ // src/actions/sendAndConfirmTransaction.ts
9
9
  /**
10
10
  * Sends a Solana transaction to every configured RPC and returns as soon as
11
11
  * one of them confirms it.
@@ -99,7 +99,6 @@ async function sendAndConfirmTransaction(client, signedTransaction, options) {
99
99
  };
100
100
  return result;
101
101
  }
102
- //#endregion
103
102
  export { sendAndConfirmTransaction };
104
103
 
105
104
  //# sourceMappingURL=sendAndConfirmTransaction.js.map
@@ -1,4 +1,3 @@
1
- //#region src/confirmation/abortableSleep.d.ts
2
1
  /**
3
2
  * Sleeps for `ms`, or until `signal` aborts - whichever comes first.
4
3
  *
@@ -12,5 +11,4 @@
12
11
  * condition, so a rejection here would only add a catch to every call site.
13
12
  */
14
13
  export declare function abortableSleep(ms: number, signal: AbortSignal): Promise<void>;
15
- //#endregion
16
14
  //# sourceMappingURL=abortableSleep.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"abortableSleep.d.ts","names":[],"sources":["../../../src/confirmation/abortableSleep.ts"],"mappings":";;;;;;;;;;;;;wBAYgB,eAAe,YAAY,QAAQ,cAAc"}
1
+ {"version":3,"file":"abortableSleep.d.ts","names":[],"sources":["../../../src/confirmation/abortableSleep.ts"],"mappings":";;;;;;;;;;;;wBAYgB,eAAe,YAAY,QAAQ,cAAc"}
@@ -1,4 +1,4 @@
1
- //#region src/confirmation/abortableSleep.ts
1
+ // src/confirmation/abortableSleep.ts
2
2
  /**
3
3
  * Sleeps for `ms`, or until `signal` aborts - whichever comes first.
4
4
  *
@@ -23,7 +23,6 @@ function abortableSleep(ms, signal) {
23
23
  signal.addEventListener("abort", settle, { once: true });
24
24
  });
25
25
  }
26
- //#endregion
27
26
  export { abortableSleep };
28
27
 
29
28
  //# sourceMappingURL=abortableSleep.js.map
@@ -1,8 +1,7 @@
1
1
  import { SolanaRpcType } from "../rpc/types.js";
2
- import { ConfirmationOutcome, SignatureStatus } from "./types.js";
3
2
  import { TransactionLifetime } from "../utils/getTransactionLifetime.js";
3
+ import { ConfirmationOutcome, SignatureStatus } from "./types.js";
4
4
  import { Signature } from "@solana/kit";
5
- //#region src/confirmation/confirmBundle.d.ts
6
5
  /** Slower than the signature poller's 400 ms, to spend fewer requests: the
7
6
  * bundle is never resent, so a slower read delays only the verdict, by 2 s at
8
7
  * most. `STATUS_RETRY_BACKOFF_CAP_MS` is set against this value. */
@@ -37,5 +36,4 @@ export declare function confirmBundle(options: {
37
36
  */
38
37
  onBroadcast?: () => void;
39
38
  }): Promise<ConfirmationOutcome<BundleConfirmation>>;
40
- //#endregion
41
39
  //# sourceMappingURL=confirmBundle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"confirmBundle.d.ts","names":[],"sources":["../../../src/confirmation/confirmBundle.ts"],"mappings":";;;;;;;;qBAca;YAED;;EAEV,2BAA2B;;;;;;;;;;;wBAYP,cAAc;EAClC,KAAK;EACL,QAAQ;;EAER,YAAY;EACZ,WAAW;;;EAGX,YAAY;;;;;;;EAOZ;IACE,QAAQ,oBAAoB"}
1
+ {"version":3,"file":"confirmBundle.d.ts","names":[],"sources":["../../../src/confirmation/confirmBundle.ts"],"mappings":";;;;;;;qBAca;YAED;;EAEV,2BAA2B;;;;;;;;;;;wBAYP,cAAc;EAClC,KAAK;EACL,QAAQ;;EAER,YAAY;EACZ,WAAW;;;EAGX,YAAY;;;;;;;EAOZ;IACE,QAAQ,oBAAoB"}
@@ -1,7 +1,7 @@
1
1
  import { createConfirmationDeadline } from "./createConfirmationDeadline.js";
2
2
  import { pollUntilDeadline } from "./pollUntilDeadline.js";
3
3
  import { isConfirmedCommitment } from "./types.js";
4
- //#region src/confirmation/confirmBundle.ts
4
+ // src/confirmation/confirmBundle.ts
5
5
  /** Slower than the signature poller's 400 ms, to spend fewer requests: the
6
6
  * bundle is never resent, so a slower read delays only the verdict, by 2 s at
7
7
  * most. `STATUS_RETRY_BACKOFF_CAP_MS` is set against this value. */
@@ -36,7 +36,6 @@ async function confirmBundle(options) {
36
36
  subject: "bundle"
37
37
  });
38
38
  }
39
- //#endregion
40
39
  export { BUNDLE_POLL_INTERVAL_MS, confirmBundle };
41
40
 
42
41
  //# sourceMappingURL=confirmBundle.js.map
@@ -1,8 +1,7 @@
1
1
  import { SolanaRpcType } from "../rpc/types.js";
2
- import { ConfirmationOutcome, SignatureStatus } from "./types.js";
3
2
  import { TransactionLifetime } from "../utils/getTransactionLifetime.js";
3
+ import { ConfirmationOutcome, SignatureStatus } from "./types.js";
4
4
  import { Signature } from "@solana/kit";
5
- //#region src/confirmation/confirmSignature.d.ts
6
5
  /** How often each confirmation branch resends the transaction. */
7
6
  export declare const RESEND_INTERVAL_MS = 1e3;
8
7
  /**
@@ -26,5 +25,4 @@ export declare function confirmSignature(options: {
26
25
  */
27
26
  onBroadcast?: () => void;
28
27
  }): Promise<ConfirmationOutcome<SignatureStatus>>;
29
- //#endregion
30
28
  //# sourceMappingURL=confirmSignature.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"confirmSignature.d.ts","names":[],"sources":["../../../src/confirmation/confirmSignature.ts"],"mappings":";;;;;;qBAaa;;;;;;qBAMA;;;wBAIS,iBAAiB;EACrC,KAAK;EACL,QAAQ;EACR,WAAW;EACX,WAAW;EACX,SAAS,KAAK,eAAe,QAAQ,gBAAgB;;;;;;EAMrD;IACE,QAAQ,oBAAoB"}
1
+ {"version":3,"file":"confirmSignature.d.ts","names":[],"sources":["../../../src/confirmation/confirmSignature.ts"],"mappings":";;;;;qBAaa;;;;;;qBAMA;;;wBAIS,iBAAiB;EACrC,KAAK;EACL,QAAQ;EACR,WAAW;EACX,WAAW;EACX,SAAS,KAAK,eAAe,QAAQ,gBAAgB;;;;;;EAMrD;IACE,QAAQ,oBAAoB"}
@@ -1,8 +1,8 @@
1
- import { createConfirmationDeadline } from "./createConfirmationDeadline.js";
2
1
  import { abortableSleep } from "./abortableSleep.js";
2
+ import { createConfirmationDeadline } from "./createConfirmationDeadline.js";
3
3
  import { pollUntilDeadline } from "./pollUntilDeadline.js";
4
4
  import { isConfirmedCommitment } from "./types.js";
5
- //#region src/confirmation/confirmSignature.ts
5
+ // src/confirmation/confirmSignature.ts
6
6
  /** How often each confirmation branch resends the transaction. */
7
7
  const RESEND_INTERVAL_MS = 1e3;
8
8
  /**
@@ -59,7 +59,6 @@ async function confirmSignature(options) {
59
59
  signal.removeEventListener("abort", abortBranch);
60
60
  }
61
61
  }
62
- //#endregion
63
62
  export { RESEND_INTERVAL_MS, SIGNATURE_POLL_INTERVAL_MS, confirmSignature };
64
63
 
65
64
  //# sourceMappingURL=confirmSignature.js.map
@@ -1,6 +1,5 @@
1
1
  import { SolanaRpcType } from "../rpc/types.js";
2
2
  import { TransactionLifetime } from "../utils/getTransactionLifetime.js";
3
- //#region src/confirmation/createConfirmationDeadline.d.ts
4
3
  /** Give-up point for a branch's polling. Read between iterations only, so a
5
4
  * hung RPC call needs `BRANCH_TIMEOUT_MS` to close the gap. */
6
5
  export declare const CONFIRMATION_TIMEOUT_MS = 9e4;
@@ -52,5 +51,4 @@ export declare function createConfirmationDeadline(options: {
52
51
  rpc: BlockhashProbeRpc;
53
52
  now?: () => number;
54
53
  }): ConfirmationDeadline;
55
- //#endregion
56
54
  //# sourceMappingURL=createConfirmationDeadline.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createConfirmationDeadline.d.ts","names":[],"sources":["../../../src/confirmation/createConfirmationDeadline.ts"],"mappings":";;;;;qBAMa;;;qBAGA;;;qBAGA;;;;qBAKA;;;;qBAIA;;;;qBAIA;;;qBAIA;;YAGD,oBAAoB,KAAK;iBAEpB;;EAEf;;;;;;EAMA;;;EAGA,KAAK,QAAQ,cAAc;;;;;;;;;wBAUb,2BAA2B;EACzC,WAAW;EACX,KAAK;EACL;IACE"}
1
+ {"version":3,"file":"createConfirmationDeadline.d.ts","names":[],"sources":["../../../src/confirmation/createConfirmationDeadline.ts"],"mappings":";;;;qBAMa;;;qBAGA;;;qBAGA;;;;qBAKA;;;;qBAIA;;;;qBAIA;;;qBAIA;;YAGD,oBAAoB,KAAK;iBAEpB;;EAEf;;;;;;EAMA;;;EAGA,KAAK,QAAQ,cAAc;;;;;;;;;wBAUb,2BAA2B;EACzC,WAAW;EACX,KAAK;EACL;IACE"}
@@ -1,4 +1,4 @@
1
- //#region src/confirmation/createConfirmationDeadline.ts
1
+ // src/confirmation/createConfirmationDeadline.ts
2
2
  /** Give-up point for a branch's polling. Read between iterations only, so a
3
3
  * hung RPC call needs `BRANCH_TIMEOUT_MS` to close the gap. */
4
4
  const CONFIRMATION_TIMEOUT_MS = 9e4;
@@ -48,7 +48,7 @@ function createConfirmationDeadline(options) {
48
48
  let slot;
49
49
  for (const [blockhash, streak] of expiredStreaks) {
50
50
  const observedAt = expiredSlots.get(blockhash);
51
- if (streak >= EXPIRY_CONFIRMATIONS && observedAt !== void 0 && (slot === void 0 || observedAt > slot)) slot = observedAt;
51
+ if (streak >= 3 && observedAt !== void 0 && (slot === void 0 || observedAt > slot)) slot = observedAt;
52
52
  }
53
53
  return slot;
54
54
  };
@@ -103,7 +103,6 @@ function createConfirmationDeadline(options) {
103
103
  }
104
104
  };
105
105
  }
106
- //#endregion
107
106
  export { BRANCH_TIMEOUT_MS, CONFIRMATION_TIMEOUT_MS, EXPIRY_CONFIRMATIONS, EXPIRY_PROBE_INTERVAL_MS, FINAL_PROBE_MARGIN_MS, MAX_PROBE_ERRORS, NODE_LAG_WINDOW_MS, createConfirmationDeadline };
108
107
 
109
108
  //# sourceMappingURL=createConfirmationDeadline.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createConfirmationDeadline.js","names":[],"sources":["../../../src/confirmation/createConfirmationDeadline.ts"],"sourcesContent":["import type { Blockhash } from '@solana/kit'\nimport type { SolanaRpcType } from '../rpc/types.js'\nimport type { TransactionLifetime } from '../utils/getTransactionLifetime.js'\n\n/** Give-up point for a branch's polling. Read between iterations only, so a\n * hung RPC call needs `BRANCH_TIMEOUT_MS` to close the gap. */\nexport const CONFIRMATION_TIMEOUT_MS = 90_000\n/** Head-room for the final probe after the deadline.\n * `STATUS_RETRY_BACKOFF_CAP_MS` must stay below it. */\nexport const FINAL_PROBE_MARGIN_MS = 5_000\n/** Hard bound on a branch, in-flight requests included. Above the ceiling so\n * an abort cannot pre-empt the final probe. */\nexport const BRANCH_TIMEOUT_MS: number =\n CONFIRMATION_TIMEOUT_MS + FINAL_PROBE_MARGIN_MS\n/** How long a healthy-but-lagging node may need to catch up. A premise, not a\n * knob: `isBlockhashValid` answers `false` for lag and for death alike, so no\n * verdict may land inside this window. */\nexport const NODE_LAG_WINDOW_MS = 12_000\n/** Gap between `isBlockhashValid` probes. Spacing them is what makes the\n * consecutive-`false` rule meaningful: quantized to the 400 ms tick, probes\n * land at 0.4/7.6/14.8 s, so no verdict lands inside `NODE_LAG_WINDOW_MS`. */\nexport const EXPIRY_PROBE_INTERVAL_MS = 7_000\n/** Consecutive `false` results before a blockhash is believed dead. Derived so\n * a change to either premise moves it automatically; `+ 2` keeps the\n * inequality strict when the window divides exactly. */\nexport const EXPIRY_CONFIRMATIONS: number =\n Math.floor(NODE_LAG_WINDOW_MS / EXPIRY_PROBE_INTERVAL_MS) + 2\n/** Probe failures per blockhash before that blockhash stops being probed.\n * Prober-only; the status pollers have `MAX_STATUS_READ_SILENCE_MS`. */\nexport const MAX_PROBE_ERRORS = 5\n\n/** Structural: the deadline needs nothing but `isBlockhashValid`. */\nexport type BlockhashProbeRpc = Pick<SolanaRpcType, 'isBlockhashValid'>\n\nexport interface ConfirmationDeadline {\n /** Checked at the top of every poll iteration. */\n reached(): boolean\n /** The slot at which the blockhash probe confirmed expiry - the highest\n * `context.slot` of the `false` answers in the streak - or `undefined`\n * without a verdict. Tells the two reasons `reached()` fires apart: a dead\n * blockhash may later count as \"dropped\", the wall-clock ceiling never\n * does. */\n expiredAt(): bigint | undefined\n /** Advances the policy; never throws. Probes at most once per\n * `EXPIRY_PROBE_INTERVAL_MS`. */\n tick(signal: AbortSignal): Promise<void>\n}\n\n/**\n * Owns every \"should I stop polling?\" decision.\n *\n * Never reads `getBlockHeight`: at least one default LI.FI RPC answers it with\n * the slot number, making any `lastValidBlockHeight` comparison false on its\n * first evaluation.\n */\nexport function createConfirmationDeadline(options: {\n lifetimes: TransactionLifetime[]\n rpc: BlockhashProbeRpc\n now?: () => number\n}): ConfirmationDeadline {\n const { lifetimes, rpc } = options\n const now = options.now ?? Date.now\n const startedAt = now()\n\n const blockhashLifetimes = lifetimes.filter(\n (\n lifetime\n ): lifetime is Extract<TransactionLifetime, { kind: 'blockhash' }> =>\n lifetime.kind === 'blockhash'\n )\n // A single non-blockhash lifetime disables the early exit for the whole set:\n // we cannot know when such a transaction stops being landable.\n const allProbeable =\n lifetimes.length > 0 && blockhashLifetimes.length === lifetimes.length\n const blockhashes: Blockhash[] = allProbeable\n ? [...new Set(blockhashLifetimes.map((lifetime) => lifetime.blockhash))]\n : []\n\n // Keyed by blockhash: expiry is a property of a blockhash, not of the set.\n const expiredStreaks = new Map<Blockhash, number>()\n // The highest `context.slot` of each blockhash's current `false` streak:\n // where a dropped check has to find a node's head before it trusts a\n // `null`. A reset of the streak deletes it.\n const expiredSlots = new Map<Blockhash, bigint>()\n // Keyed for the same reason: a sibling's broken probe is not evidence about\n // this blockhash, so it must not spend this blockhash's error budget.\n const errorStreaks = new Map<Blockhash, number>()\n // The blockhashes still worth asking about. One leaves this set after\n // MAX_PROBE_ERRORS failures of its own; the others keep being probed.\n const probeable = new Set<Blockhash>(blockhashes)\n let lastProbeAt: number | undefined\n\n /** Derived, not latched: a blockhash that reads valid again zeroes its\n * streak and clears the verdict with it. The highest slot among the expired\n * blockhashes is the strictest head bound. */\n const expiredAt = (): bigint | undefined => {\n let slot: bigint | undefined\n for (const [blockhash, streak] of expiredStreaks) {\n const observedAt = expiredSlots.get(blockhash)\n if (\n streak >= EXPIRY_CONFIRMATIONS &&\n observedAt !== undefined &&\n (slot === undefined || observedAt > slot)\n ) {\n slot = observedAt\n }\n }\n return slot\n }\n\n return {\n reached(): boolean {\n const elapsed = now() - startedAt\n if (elapsed >= CONFIRMATION_TIMEOUT_MS) {\n return true\n }\n return expiredAt() !== undefined\n },\n expiredAt,\n async tick(signal: AbortSignal): Promise<void> {\n if (probeable.size === 0 || signal.aborted) {\n return\n }\n // The cadence is wall-clock, not iteration count, and it uses the\n // injected `now` so the policy stays testable without timers.\n const probeAt = now()\n if (\n lastProbeAt !== undefined &&\n probeAt - lastProbeAt < EXPIRY_PROBE_INTERVAL_MS\n ) {\n return\n }\n lastProbeAt = probeAt\n // `allSettled`, not `all`: `all` rejects on the first failure and\n // discards answers the other probes already produced. All state is keyed\n // by blockhash, so one broken probe cannot disable the early exit for\n // the rest.\n const active = [...probeable]\n const probes = await Promise.allSettled(\n active.map(async (blockhash) => {\n const result = await rpc\n .isBlockhashValid(blockhash, { commitment: 'confirmed' })\n .send({ abortSignal: signal })\n return { value: result?.value, slot: result?.context?.slot }\n })\n )\n\n // A read that produced no usable answer says nothing about this\n // blockhash: it must never spend the expiry streak, only the error\n // budget. Shared by a rejected probe and by a fulfilled one whose\n // response carried no usable verdict.\n const recordFailedProbe = (blockhash: Blockhash): void => {\n expiredStreaks.set(blockhash, 0)\n expiredSlots.delete(blockhash)\n const errors = (errorStreaks.get(blockhash) ?? 0) + 1\n errorStreaks.set(blockhash, errors)\n if (errors >= MAX_PROBE_ERRORS) {\n // Degrade to ceiling-only for this blockhash.\n probeable.delete(blockhash)\n }\n }\n\n probes.forEach((probe, index) => {\n const blockhash = active[index]\n\n if (probe.status === 'rejected') {\n recordFailedProbe(blockhash)\n return\n }\n\n const { value, slot } = probe.value\n\n // `=== true` / `=== false`, never truthiness: a response carrying no\n // `value` is not a `false`, and reading it as one is the only coercion\n // here that can invent an expiry.\n if (value === true) {\n errorStreaks.set(blockhash, 0)\n expiredStreaks.set(blockhash, 0)\n expiredSlots.delete(blockhash)\n return\n }\n\n // A `false` counts only with the slot it was observed at: a verdict\n // without one could not bound the head of the dropped check.\n if (value === false && typeof slot === 'bigint') {\n errorStreaks.set(blockhash, 0)\n expiredStreaks.set(\n blockhash,\n (expiredStreaks.get(blockhash) ?? 0) + 1\n )\n // The highest slot, not the latest: a `false` from a node whose head\n // is behind the others must not lower the bound below the slots\n // where the transaction can still land.\n const previous = expiredSlots.get(blockhash)\n expiredSlots.set(\n blockhash,\n previous === undefined || slot > previous ? slot : previous\n )\n return\n }\n\n recordFailedProbe(blockhash)\n })\n },\n }\n}\n"],"mappings":";;;AAMA,MAAa,0BAA0B;;;AAGvC,MAAa,wBAAwB;;;AAGrC,MAAa,oBACX;;;;AAIF,MAAa,qBAAqB;;;;AAIlC,MAAa,2BAA2B;;;;AAIxC,MAAa,uBACX,KAAK,MAAM,qBAAqB,wBAAwB,IAAI;;;AAG9D,MAAa,mBAAmB;;;;;;;;AA0BhC,SAAgB,2BAA2B,SAIlB;CACvB,MAAM,EAAE,WAAW,QAAQ;CAC3B,MAAM,MAAM,QAAQ,OAAO,KAAK;CAChC,MAAM,YAAY,IAAI;CAEtB,MAAM,qBAAqB,UAAU,QAEjC,aAEA,SAAS,SAAS,WACtB;CAKA,MAAM,cADJ,UAAU,SAAS,KAAK,mBAAmB,WAAW,UAAU,SAE9D,CAAC,GAAG,IAAI,IAAI,mBAAmB,KAAK,aAAa,SAAS,SAAS,CAAC,CAAC,IACrE,CAAC;CAGL,MAAM,iCAAiB,IAAI,IAAuB;CAIlD,MAAM,+BAAe,IAAI,IAAuB;CAGhD,MAAM,+BAAe,IAAI,IAAuB;CAGhD,MAAM,YAAY,IAAI,IAAe,WAAW;CAChD,IAAI;;;;CAKJ,MAAM,kBAAsC;EAC1C,IAAI;EACJ,KAAK,MAAM,CAAC,WAAW,WAAW,gBAAgB;GAChD,MAAM,aAAa,aAAa,IAAI,SAAS;GAC7C,IACE,UAAU,wBACV,eAAe,KAAA,MACd,SAAS,KAAA,KAAa,aAAa,OAEpC,OAAO;EAEX;EACA,OAAO;CACT;CAEA,OAAO;EACL,UAAmB;GAEjB,IADgB,IAAI,IAAI,aAAA,KAEtB,OAAO;GAET,OAAO,UAAU,MAAM,KAAA;EACzB;EACA;EACA,MAAM,KAAK,QAAoC;GAC7C,IAAI,UAAU,SAAS,KAAK,OAAO,SACjC;GAIF,MAAM,UAAU,IAAI;GACpB,IACE,gBAAgB,KAAA,KAChB,UAAU,cAAA,KAEV;GAEF,cAAc;GAKd,MAAM,SAAS,CAAC,GAAG,SAAS;GAC5B,MAAM,SAAS,MAAM,QAAQ,WAC3B,OAAO,IAAI,OAAO,cAAc;IAC9B,MAAM,SAAS,MAAM,IAClB,iBAAiB,WAAW,EAAE,YAAY,YAAY,CAAC,CAAC,CACxD,KAAK,EAAE,aAAa,OAAO,CAAC;IAC/B,OAAO;KAAE,OAAO,QAAQ;KAAO,MAAM,QAAQ,SAAS;IAAK;GAC7D,CAAC,CACH;GAMA,MAAM,qBAAqB,cAA+B;IACxD,eAAe,IAAI,WAAW,CAAC;IAC/B,aAAa,OAAO,SAAS;IAC7B,MAAM,UAAU,aAAa,IAAI,SAAS,KAAK,KAAK;IACpD,aAAa,IAAI,WAAW,MAAM;IAClC,IAAI,UAAA,GAEF,UAAU,OAAO,SAAS;GAE9B;GAEA,OAAO,SAAS,OAAO,UAAU;IAC/B,MAAM,YAAY,OAAO;IAEzB,IAAI,MAAM,WAAW,YAAY;KAC/B,kBAAkB,SAAS;KAC3B;IACF;IAEA,MAAM,EAAE,OAAO,SAAS,MAAM;IAK9B,IAAI,UAAU,MAAM;KAClB,aAAa,IAAI,WAAW,CAAC;KAC7B,eAAe,IAAI,WAAW,CAAC;KAC/B,aAAa,OAAO,SAAS;KAC7B;IACF;IAIA,IAAI,UAAU,SAAS,OAAO,SAAS,UAAU;KAC/C,aAAa,IAAI,WAAW,CAAC;KAC7B,eAAe,IACb,YACC,eAAe,IAAI,SAAS,KAAK,KAAK,CACzC;KAIA,MAAM,WAAW,aAAa,IAAI,SAAS;KAC3C,aAAa,IACX,WACA,aAAa,KAAA,KAAa,OAAO,WAAW,OAAO,QACrD;KACA;IACF;IAEA,kBAAkB,SAAS;GAC7B,CAAC;EACH;CACF;AACF"}
1
+ {"version":3,"file":"createConfirmationDeadline.js","names":[],"sources":["../../../src/confirmation/createConfirmationDeadline.ts"],"sourcesContent":["import type { Blockhash } from '@solana/kit'\nimport type { SolanaRpcType } from '../rpc/types.js'\nimport type { TransactionLifetime } from '../utils/getTransactionLifetime.js'\n\n/** Give-up point for a branch's polling. Read between iterations only, so a\n * hung RPC call needs `BRANCH_TIMEOUT_MS` to close the gap. */\nexport const CONFIRMATION_TIMEOUT_MS = 90_000\n/** Head-room for the final probe after the deadline.\n * `STATUS_RETRY_BACKOFF_CAP_MS` must stay below it. */\nexport const FINAL_PROBE_MARGIN_MS = 5_000\n/** Hard bound on a branch, in-flight requests included. Above the ceiling so\n * an abort cannot pre-empt the final probe. */\nexport const BRANCH_TIMEOUT_MS: number =\n CONFIRMATION_TIMEOUT_MS + FINAL_PROBE_MARGIN_MS\n/** How long a healthy-but-lagging node may need to catch up. A premise, not a\n * knob: `isBlockhashValid` answers `false` for lag and for death alike, so no\n * verdict may land inside this window. */\nexport const NODE_LAG_WINDOW_MS = 12_000\n/** Gap between `isBlockhashValid` probes. Spacing them is what makes the\n * consecutive-`false` rule meaningful: quantized to the 400 ms tick, probes\n * land at 0.4/7.6/14.8 s, so no verdict lands inside `NODE_LAG_WINDOW_MS`. */\nexport const EXPIRY_PROBE_INTERVAL_MS = 7_000\n/** Consecutive `false` results before a blockhash is believed dead. Derived so\n * a change to either premise moves it automatically; `+ 2` keeps the\n * inequality strict when the window divides exactly. */\nexport const EXPIRY_CONFIRMATIONS: number =\n Math.floor(NODE_LAG_WINDOW_MS / EXPIRY_PROBE_INTERVAL_MS) + 2\n/** Probe failures per blockhash before that blockhash stops being probed.\n * Prober-only; the status pollers have `MAX_STATUS_READ_SILENCE_MS`. */\nexport const MAX_PROBE_ERRORS = 5\n\n/** Structural: the deadline needs nothing but `isBlockhashValid`. */\nexport type BlockhashProbeRpc = Pick<SolanaRpcType, 'isBlockhashValid'>\n\nexport interface ConfirmationDeadline {\n /** Checked at the top of every poll iteration. */\n reached(): boolean\n /** The slot at which the blockhash probe confirmed expiry - the highest\n * `context.slot` of the `false` answers in the streak - or `undefined`\n * without a verdict. Tells the two reasons `reached()` fires apart: a dead\n * blockhash may later count as \"dropped\", the wall-clock ceiling never\n * does. */\n expiredAt(): bigint | undefined\n /** Advances the policy; never throws. Probes at most once per\n * `EXPIRY_PROBE_INTERVAL_MS`. */\n tick(signal: AbortSignal): Promise<void>\n}\n\n/**\n * Owns every \"should I stop polling?\" decision.\n *\n * Never reads `getBlockHeight`: at least one default LI.FI RPC answers it with\n * the slot number, making any `lastValidBlockHeight` comparison false on its\n * first evaluation.\n */\nexport function createConfirmationDeadline(options: {\n lifetimes: TransactionLifetime[]\n rpc: BlockhashProbeRpc\n now?: () => number\n}): ConfirmationDeadline {\n const { lifetimes, rpc } = options\n const now = options.now ?? Date.now\n const startedAt = now()\n\n const blockhashLifetimes = lifetimes.filter(\n (\n lifetime\n ): lifetime is Extract<TransactionLifetime, { kind: 'blockhash' }> =>\n lifetime.kind === 'blockhash'\n )\n // A single non-blockhash lifetime disables the early exit for the whole set:\n // we cannot know when such a transaction stops being landable.\n const allProbeable =\n lifetimes.length > 0 && blockhashLifetimes.length === lifetimes.length\n const blockhashes: Blockhash[] = allProbeable\n ? [...new Set(blockhashLifetimes.map((lifetime) => lifetime.blockhash))]\n : []\n\n // Keyed by blockhash: expiry is a property of a blockhash, not of the set.\n const expiredStreaks = new Map<Blockhash, number>()\n // The highest `context.slot` of each blockhash's current `false` streak:\n // where a dropped check has to find a node's head before it trusts a\n // `null`. A reset of the streak deletes it.\n const expiredSlots = new Map<Blockhash, bigint>()\n // Keyed for the same reason: a sibling's broken probe is not evidence about\n // this blockhash, so it must not spend this blockhash's error budget.\n const errorStreaks = new Map<Blockhash, number>()\n // The blockhashes still worth asking about. One leaves this set after\n // MAX_PROBE_ERRORS failures of its own; the others keep being probed.\n const probeable = new Set<Blockhash>(blockhashes)\n let lastProbeAt: number | undefined\n\n /** Derived, not latched: a blockhash that reads valid again zeroes its\n * streak and clears the verdict with it. The highest slot among the expired\n * blockhashes is the strictest head bound. */\n const expiredAt = (): bigint | undefined => {\n let slot: bigint | undefined\n for (const [blockhash, streak] of expiredStreaks) {\n const observedAt = expiredSlots.get(blockhash)\n if (\n streak >= EXPIRY_CONFIRMATIONS &&\n observedAt !== undefined &&\n (slot === undefined || observedAt > slot)\n ) {\n slot = observedAt\n }\n }\n return slot\n }\n\n return {\n reached(): boolean {\n const elapsed = now() - startedAt\n if (elapsed >= CONFIRMATION_TIMEOUT_MS) {\n return true\n }\n return expiredAt() !== undefined\n },\n expiredAt,\n async tick(signal: AbortSignal): Promise<void> {\n if (probeable.size === 0 || signal.aborted) {\n return\n }\n // The cadence is wall-clock, not iteration count, and it uses the\n // injected `now` so the policy stays testable without timers.\n const probeAt = now()\n if (\n lastProbeAt !== undefined &&\n probeAt - lastProbeAt < EXPIRY_PROBE_INTERVAL_MS\n ) {\n return\n }\n lastProbeAt = probeAt\n // `allSettled`, not `all`: `all` rejects on the first failure and\n // discards answers the other probes already produced. All state is keyed\n // by blockhash, so one broken probe cannot disable the early exit for\n // the rest.\n const active = [...probeable]\n const probes = await Promise.allSettled(\n active.map(async (blockhash) => {\n const result = await rpc\n .isBlockhashValid(blockhash, { commitment: 'confirmed' })\n .send({ abortSignal: signal })\n return { value: result?.value, slot: result?.context?.slot }\n })\n )\n\n // A read that produced no usable answer says nothing about this\n // blockhash: it must never spend the expiry streak, only the error\n // budget. Shared by a rejected probe and by a fulfilled one whose\n // response carried no usable verdict.\n const recordFailedProbe = (blockhash: Blockhash): void => {\n expiredStreaks.set(blockhash, 0)\n expiredSlots.delete(blockhash)\n const errors = (errorStreaks.get(blockhash) ?? 0) + 1\n errorStreaks.set(blockhash, errors)\n if (errors >= MAX_PROBE_ERRORS) {\n // Degrade to ceiling-only for this blockhash.\n probeable.delete(blockhash)\n }\n }\n\n probes.forEach((probe, index) => {\n const blockhash = active[index]\n\n if (probe.status === 'rejected') {\n recordFailedProbe(blockhash)\n return\n }\n\n const { value, slot } = probe.value\n\n // `=== true` / `=== false`, never truthiness: a response carrying no\n // `value` is not a `false`, and reading it as one is the only coercion\n // here that can invent an expiry.\n if (value === true) {\n errorStreaks.set(blockhash, 0)\n expiredStreaks.set(blockhash, 0)\n expiredSlots.delete(blockhash)\n return\n }\n\n // A `false` counts only with the slot it was observed at: a verdict\n // without one could not bound the head of the dropped check.\n if (value === false && typeof slot === 'bigint') {\n errorStreaks.set(blockhash, 0)\n expiredStreaks.set(\n blockhash,\n (expiredStreaks.get(blockhash) ?? 0) + 1\n )\n // The highest slot, not the latest: a `false` from a node whose head\n // is behind the others must not lower the bound below the slots\n // where the transaction can still land.\n const previous = expiredSlots.get(blockhash)\n expiredSlots.set(\n blockhash,\n previous === undefined || slot > previous ? slot : previous\n )\n return\n }\n\n recordFailedProbe(blockhash)\n })\n },\n }\n}\n"],"mappings":";;;AAMA,MAAa,0BAA0B;;;AAGvC,MAAa,wBAAwB;;;AAGrC,MAAa,oBACX;;;;AAIF,MAAa,qBAAqB;;;;AAIlC,MAAa,2BAA2B;;;;AAIxC,MAAa,uBACX,KAAK,MAAM,qBAAqB,wBAAwB,IAAI;;;AAG9D,MAAa,mBAAmB;;;;;;;;AA0BhC,SAAgB,2BAA2B,SAIlB;CACvB,MAAM,EAAE,WAAW,QAAQ;CAC3B,MAAM,MAAM,QAAQ,OAAO,KAAK;CAChC,MAAM,YAAY,IAAI;CAEtB,MAAM,qBAAqB,UAAU,QAEjC,aAEA,SAAS,SAAS,WACtB;CAKA,MAAM,cADJ,UAAU,SAAS,KAAK,mBAAmB,WAAW,UAAU,SAE9D,CAAC,GAAG,IAAI,IAAI,mBAAmB,KAAK,aAAa,SAAS,SAAS,CAAC,CAAC,IACrE,CAAC;CAGL,MAAM,iCAAiB,IAAI,IAAuB;CAIlD,MAAM,+BAAe,IAAI,IAAuB;CAGhD,MAAM,+BAAe,IAAI,IAAuB;CAGhD,MAAM,YAAY,IAAI,IAAe,WAAW;CAChD,IAAI;;;;CAKJ,MAAM,kBAAsC;EAC1C,IAAI;EACJ,KAAK,MAAM,CAAC,WAAW,WAAW,gBAAgB;GAChD,MAAM,aAAa,aAAa,IAAI,SAAS;GAC7C,IACE,UAAA,KACA,eAAe,KAAA,MACd,SAAS,KAAA,KAAa,aAAa,OAEpC,OAAO;EAEX;EACA,OAAO;CACT;CAEA,OAAO;EACL,UAAmB;GAEjB,IADgB,IAAI,IAAI,aAAA,KAEtB,OAAO;GAET,OAAO,UAAU,MAAM,KAAA;EACzB;EACA;EACA,MAAM,KAAK,QAAoC;GAC7C,IAAI,UAAU,SAAS,KAAK,OAAO,SACjC;GAIF,MAAM,UAAU,IAAI;GACpB,IACE,gBAAgB,KAAA,KAChB,UAAU,cAAA,KAEV;GAEF,cAAc;GAKd,MAAM,SAAS,CAAC,GAAG,SAAS;GAC5B,MAAM,SAAS,MAAM,QAAQ,WAC3B,OAAO,IAAI,OAAO,cAAc;IAC9B,MAAM,SAAS,MAAM,IAClB,iBAAiB,WAAW,EAAE,YAAY,YAAY,CAAC,CAAC,CACxD,KAAK,EAAE,aAAa,OAAO,CAAC;IAC/B,OAAO;KAAE,OAAO,QAAQ;KAAO,MAAM,QAAQ,SAAS;IAAK;GAC7D,CAAC,CACH;GAMA,MAAM,qBAAqB,cAA+B;IACxD,eAAe,IAAI,WAAW,CAAC;IAC/B,aAAa,OAAO,SAAS;IAC7B,MAAM,UAAU,aAAa,IAAI,SAAS,KAAK,KAAK;IACpD,aAAa,IAAI,WAAW,MAAM;IAClC,IAAI,UAAA,GAEF,UAAU,OAAO,SAAS;GAE9B;GAEA,OAAO,SAAS,OAAO,UAAU;IAC/B,MAAM,YAAY,OAAO;IAEzB,IAAI,MAAM,WAAW,YAAY;KAC/B,kBAAkB,SAAS;KAC3B;IACF;IAEA,MAAM,EAAE,OAAO,SAAS,MAAM;IAK9B,IAAI,UAAU,MAAM;KAClB,aAAa,IAAI,WAAW,CAAC;KAC7B,eAAe,IAAI,WAAW,CAAC;KAC/B,aAAa,OAAO,SAAS;KAC7B;IACF;IAIA,IAAI,UAAU,SAAS,OAAO,SAAS,UAAU;KAC/C,aAAa,IAAI,WAAW,CAAC;KAC7B,eAAe,IACb,YACC,eAAe,IAAI,SAAS,KAAK,KAAK,CACzC;KAIA,MAAM,WAAW,aAAa,IAAI,SAAS;KAC3C,aAAa,IACX,WACA,aAAa,KAAA,KAAa,OAAO,WAAW,OAAO,QACrD;KACA;IACF;IAEA,kBAAkB,SAAS;GAC7B,CAAC;EACH;CACF;AACF"}
@@ -1,6 +1,5 @@
1
- import { ConfirmationOutcome } from "./types.js";
2
1
  import { ConfirmationDeadline } from "./createConfirmationDeadline.js";
3
- //#region src/confirmation/pollUntilDeadline.d.ts
2
+ import { ConfirmationOutcome } from "./types.js";
4
3
  /** Cadence of the detached deadline-advance loop. Independent of the
5
4
  * status-poll interval, which each caller sets for its own rate limits. */
6
5
  export declare const DEADLINE_TICK_INTERVAL_MS = 400;
@@ -53,5 +52,4 @@ export declare function pollUntilDeadline<T>(options: {
53
52
  * Mirrors `createConfirmationDeadline`. */
54
53
  now?: () => number;
55
54
  }): Promise<ConfirmationOutcome<T>>;
56
- //#endregion
57
55
  //# sourceMappingURL=pollUntilDeadline.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pollUntilDeadline.d.ts","names":[],"sources":["../../../src/confirmation/pollUntilDeadline.ts"],"mappings":";;;;;qBAMa;;;;;;qBAMA;;;;;;;;;;;;;;;;;qBAiBA;;;;;;;;;wBAUS,kBAAkB,GAAG;EACzC,UAAU;EACV,QAAQ;;EAER;;EAEA,aAAa,QAAQ;;EAErB;;EAEA;;;EAGA;;;EAGA;IACE,QAAQ,oBAAoB"}
1
+ {"version":3,"file":"pollUntilDeadline.d.ts","names":[],"sources":["../../../src/confirmation/pollUntilDeadline.ts"],"mappings":";;;;qBAMa;;;;;;qBAMA;;;;;;;;;;;;;;;;;qBAiBA;;;;;;;;;wBAUS,kBAAkB,GAAG;EACzC,UAAU;EACV,QAAQ;;EAER;;EAEA,aAAa,QAAQ;;EAErB;;EAEA;;;EAGA;;;EAGA;IACE,QAAQ,oBAAoB"}
@@ -1,5 +1,5 @@
1
1
  import { abortableSleep } from "./abortableSleep.js";
2
- //#region src/confirmation/pollUntilDeadline.ts
2
+ // src/confirmation/pollUntilDeadline.ts
3
3
  /** Cadence of the detached deadline-advance loop. Independent of the
4
4
  * status-poll interval, which each caller sets for its own rate limits. */
5
5
  const DEADLINE_TICK_INTERVAL_MS = 400;
@@ -95,7 +95,6 @@ async function pollUntilDeadline(options) {
95
95
  settled = true;
96
96
  }
97
97
  }
98
- //#endregion
99
98
  export { DEADLINE_TICK_INTERVAL_MS, MAX_STATUS_READ_SILENCE_MS, STATUS_RETRY_BACKOFF_CAP_MS, pollUntilDeadline };
100
99
 
101
100
  //# sourceMappingURL=pollUntilDeadline.js.map
@@ -1,5 +1,4 @@
1
1
  import { ConfirmationOutcome } from "./types.js";
2
- //#region src/confirmation/raceRpcs.d.ts
3
2
  export type RaceResult<T> = {
4
3
  kind: "confirmed";
5
4
  value: T;
@@ -29,5 +28,4 @@ export type UnconfirmedRaceResult = Exclude<RaceResult<unknown>, {
29
28
  export declare function raceRpcs<Rpc, T>(rpcs: Rpc[], run: (rpc: Rpc, signal: AbortSignal) => Promise<ConfirmationOutcome<T>>, options: {
30
29
  timeoutMs: number;
31
30
  }): Promise<RaceResult<T>>;
32
- //#endregion
33
31
  //# sourceMappingURL=raceRpcs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"raceRpcs.d.ts","names":[],"sources":["../../../src/confirmation/raceRpcs.ts"],"mappings":";;YAEY,WAAW;EACjB;EAAmB,OAAO;;EAG1B;EAAiB;EAAc,QAAQ;;EACvC;EAAuB,QAAQ;;EAC/B;EAAyB,QAAQ;;;YAG3B,wBAAwB,QAClC;EACE;;;;;;;;;;wBAoDkB,SAAS,KAAK,GAClC,MAAM,OACN,MAAM,KAAK,KAAK,QAAQ,gBAAgB,QAAQ,oBAAoB,KACpE;EAAW;IACV,QAAQ,WAAW"}
1
+ {"version":3,"file":"raceRpcs.d.ts","names":[],"sources":["../../../src/confirmation/raceRpcs.ts"],"mappings":";YAEY,WAAW;EACjB;EAAmB,OAAO;;EAG1B;EAAiB;EAAc,QAAQ;;EACvC;EAAuB,QAAQ;;EAC/B;EAAyB,QAAQ;;;YAG3B,wBAAwB,QAClC;EACE;;;;;;;;;;wBAoDkB,SAAS,KAAK,GAClC,MAAM,OACN,MAAM,KAAK,KAAK,QAAQ,gBAAgB,QAAQ,oBAAoB,KACpE;EAAW;IACV,QAAQ,WAAW"}
@@ -1,4 +1,4 @@
1
- //#region src/confirmation/raceRpcs.ts
1
+ // src/confirmation/raceRpcs.ts
2
2
  const toError = (reason) => reason instanceof Error ? reason : new Error(String(reason));
3
3
  /**
4
4
  * Aborts when `signal` aborts or `timeoutMs` elapses, whichever is first.
@@ -94,7 +94,6 @@ async function raceRpcs(rpcs, run, options) {
94
94
  branch.dispose();
95
95
  }
96
96
  }
97
- //#endregion
98
97
  export { raceRpcs };
99
98
 
100
99
  //# sourceMappingURL=raceRpcs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"raceRpcs.js","names":[],"sources":["../../../src/confirmation/raceRpcs.ts"],"sourcesContent":["import type { ConfirmationOutcome } from './types.js'\n\nexport type RaceResult<T> =\n | { kind: 'confirmed'; value: T }\n /** `slot`: the highest verdict slot of the branches. The transaction can\n * no longer land after it. */\n | { kind: 'expired'; slot: bigint; errors: Error[] }\n | { kind: 'not-confirmed'; errors: Error[] }\n | { kind: 'rpc-unavailable'; errors: Error[] }\n\n/** Every result that is not a confirmation. Independent of the value type. */\nexport type UnconfirmedRaceResult = Exclude<\n RaceResult<unknown>,\n { kind: 'confirmed' }\n>\n\nconst toError = (reason: unknown): Error =>\n reason instanceof Error ? reason : new Error(String(reason))\n\n/**\n * Aborts when `signal` aborts or `timeoutMs` elapses, whichever is first.\n *\n * Not `AbortSignal.any` + `AbortSignal.timeout`: both are Baseline March 2024,\n * and a published SDK should not raise its runtime floor for a convenience one\n * controller and one timer already cover. The caller's signal is never aborted\n * here, so \"caller aborted\" and \"timeout fired\" stay distinguishable.\n */\nfunction abortAfter(\n signal: AbortSignal,\n timeoutMs: number\n): { signal: AbortSignal; dispose: () => void } {\n const linked = new AbortController()\n const forward = (): void => linked.abort(signal.reason)\n\n const timer = setTimeout(() => {\n linked.abort(new Error(`This RPC did not answer within ${timeoutMs}ms.`))\n }, timeoutMs)\n // A pending timer keeps Node's event loop alive. `dispose` clears it; the\n // unref only covers a path that skips `dispose`.\n const handle = timer as unknown as { unref?: () => void }\n handle.unref?.()\n\n if (signal.aborted) {\n forward()\n } else {\n signal.addEventListener('abort', forward, { once: true })\n }\n\n return {\n signal: linked.signal,\n dispose: (): void => {\n clearTimeout(timer)\n signal.removeEventListener('abort', forward)\n },\n }\n}\n\n/**\n * Runs `run` against every RPC in parallel and reports the first confirmation.\n *\n * Not `Promise.any`: it turns \"polled and saw nothing\" into a thrown sentinel,\n * collapsing the difference between an expired transaction and an RPC that\n * never answered - the defect that reported live swaps as `TransactionExpired`.\n * `timeoutMs` is the caller's; this module holds no confirmation policy.\n */\nexport async function raceRpcs<Rpc, T>(\n rpcs: Rpc[],\n run: (rpc: Rpc, signal: AbortSignal) => Promise<ConfirmationOutcome<T>>,\n options: { timeoutMs: number }\n): Promise<RaceResult<T>> {\n if (rpcs.length === 0) {\n return { kind: 'rpc-unavailable', errors: [] }\n }\n\n const controller = new AbortController()\n // Kept distinct: `controller` means \"another branch confirmed\", the timeout\n // means \"this endpoint never answered\". The timeout aborts the linked signal\n // only.\n const branch = abortAfter(controller.signal, options.timeoutMs)\n\n let resolveConfirmed: ((value: T) => void) | undefined\n const firstConfirmation = new Promise<T>((resolve) => {\n resolveConfirmed = resolve\n })\n\n const settled = Promise.allSettled(\n rpcs.map(async (rpc) => {\n const outcome = await run(rpc, branch.signal)\n if (outcome.kind === 'confirmed') {\n resolveConfirmed?.(outcome.value)\n controller.abort()\n }\n return outcome\n })\n )\n\n const classify = (\n results: PromiseSettledResult<ConfirmationOutcome<T>>[]\n ): RaceResult<T> => {\n let expiredAtSlot: bigint | undefined\n let sawNotConfirmed = false\n const errors: Error[] = []\n\n for (const entry of results) {\n if (entry.status === 'fulfilled') {\n // Unreachable today - `firstConfirmation` always wins - but keeps\n // `classify` correct if that structure changes.\n if (entry.value.kind === 'confirmed') {\n return { kind: 'confirmed', value: entry.value.value }\n }\n if (entry.value.kind === 'expired') {\n // The highest verdict slot: the strictest head a dropped check can\n // demand.\n if (expiredAtSlot === undefined || entry.value.slot > expiredAtSlot) {\n expiredAtSlot = entry.value.slot\n }\n } else {\n sawNotConfirmed = true\n }\n continue\n }\n // Cancelled branches are not failures. A branch the timeout killed is,\n // so its error is collected.\n if (controller.signal.aborted) {\n continue\n }\n errors.push(toError(entry.reason))\n }\n\n // A completed observation outranks a thrown error, but the collected\n // errors still travel with it as the expiry's `cause`.\n //\n // Among the observations, the ceiling outranks an expiry: `expired` may\n // end in a final \"dropped\", so every branch that observed has to agree\n // on it. A stale node alone must not drop a transaction that another\n // endpoint still watched to its ceiling.\n if (sawNotConfirmed) {\n return { kind: 'not-confirmed', errors }\n }\n if (expiredAtSlot !== undefined) {\n return { kind: 'expired', slot: expiredAtSlot, errors }\n }\n return { kind: 'rpc-unavailable', errors }\n }\n\n try {\n const result = await Promise.race([\n firstConfirmation.then(\n (value): RaceResult<T> => ({ kind: 'confirmed', value })\n ),\n settled.then(classify),\n ])\n\n return result\n } finally {\n // Cancels every in-flight branch on every path out, rejections included.\n // Must run before `dispose`, which detaches the listener carrying it.\n controller.abort()\n branch.dispose()\n }\n}\n"],"mappings":";AAgBA,MAAM,WAAW,WACf,kBAAkB,QAAQ,SAAS,IAAI,MAAM,OAAO,MAAM,CAAC;;;;;;;;;AAU7D,SAAS,WACP,QACA,WAC8C;CAC9C,MAAM,SAAS,IAAI,gBAAgB;CACnC,MAAM,gBAAsB,OAAO,MAAM,OAAO,MAAM;CAEtD,MAAM,QAAQ,iBAAiB;EAC7B,OAAO,sBAAM,IAAI,MAAM,kCAAkC,UAAU,IAAI,CAAC;CAC1E,GAAG,SAAS;CAIZ,MAAO,QAAQ;CAEf,IAAI,OAAO,SACT,QAAQ;MAER,OAAO,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;CAG1D,OAAO;EACL,QAAQ,OAAO;EACf,eAAqB;GACnB,aAAa,KAAK;GAClB,OAAO,oBAAoB,SAAS,OAAO;EAC7C;CACF;AACF;;;;;;;;;AAUA,eAAsB,SACpB,MACA,KACA,SACwB;CACxB,IAAI,KAAK,WAAW,GAClB,OAAO;EAAE,MAAM;EAAmB,QAAQ,CAAC;CAAE;CAG/C,MAAM,aAAa,IAAI,gBAAgB;CAIvC,MAAM,SAAS,WAAW,WAAW,QAAQ,QAAQ,SAAS;CAE9D,IAAI;CACJ,MAAM,oBAAoB,IAAI,SAAY,YAAY;EACpD,mBAAmB;CACrB,CAAC;CAED,MAAM,UAAU,QAAQ,WACtB,KAAK,IAAI,OAAO,QAAQ;EACtB,MAAM,UAAU,MAAM,IAAI,KAAK,OAAO,MAAM;EAC5C,IAAI,QAAQ,SAAS,aAAa;GAChC,mBAAmB,QAAQ,KAAK;GAChC,WAAW,MAAM;EACnB;EACA,OAAO;CACT,CAAC,CACH;CAEA,MAAM,YACJ,YACkB;EAClB,IAAI;EACJ,IAAI,kBAAkB;EACtB,MAAM,SAAkB,CAAC;EAEzB,KAAK,MAAM,SAAS,SAAS;GAC3B,IAAI,MAAM,WAAW,aAAa;IAGhC,IAAI,MAAM,MAAM,SAAS,aACvB,OAAO;KAAE,MAAM;KAAa,OAAO,MAAM,MAAM;IAAM;IAEvD,IAAI,MAAM,MAAM,SAAS,WAGnB;SAAA,kBAAkB,KAAA,KAAa,MAAM,MAAM,OAAO,eACpD,gBAAgB,MAAM,MAAM;IAAA,OAG9B,kBAAkB;IAEpB;GACF;GAGA,IAAI,WAAW,OAAO,SACpB;GAEF,OAAO,KAAK,QAAQ,MAAM,MAAM,CAAC;EACnC;EASA,IAAI,iBACF,OAAO;GAAE,MAAM;GAAiB;EAAO;EAEzC,IAAI,kBAAkB,KAAA,GACpB,OAAO;GAAE,MAAM;GAAW,MAAM;GAAe;EAAO;EAExD,OAAO;GAAE,MAAM;GAAmB;EAAO;CAC3C;CAEA,IAAI;EAQF,OAAO,MAPc,QAAQ,KAAK,CAChC,kBAAkB,MACf,WAA0B;GAAE,MAAM;GAAa;EAAM,EACxD,GACA,QAAQ,KAAK,QAAQ,CACvB,CAAC;CAGH,UAAU;EAGR,WAAW,MAAM;EACjB,OAAO,QAAQ;CACjB;AACF"}
1
+ {"version":3,"file":"raceRpcs.js","names":["handle"],"sources":["../../../src/confirmation/raceRpcs.ts"],"sourcesContent":["import type { ConfirmationOutcome } from './types.js'\n\nexport type RaceResult<T> =\n | { kind: 'confirmed'; value: T }\n /** `slot`: the highest verdict slot of the branches. The transaction can\n * no longer land after it. */\n | { kind: 'expired'; slot: bigint; errors: Error[] }\n | { kind: 'not-confirmed'; errors: Error[] }\n | { kind: 'rpc-unavailable'; errors: Error[] }\n\n/** Every result that is not a confirmation. Independent of the value type. */\nexport type UnconfirmedRaceResult = Exclude<\n RaceResult<unknown>,\n { kind: 'confirmed' }\n>\n\nconst toError = (reason: unknown): Error =>\n reason instanceof Error ? reason : new Error(String(reason))\n\n/**\n * Aborts when `signal` aborts or `timeoutMs` elapses, whichever is first.\n *\n * Not `AbortSignal.any` + `AbortSignal.timeout`: both are Baseline March 2024,\n * and a published SDK should not raise its runtime floor for a convenience one\n * controller and one timer already cover. The caller's signal is never aborted\n * here, so \"caller aborted\" and \"timeout fired\" stay distinguishable.\n */\nfunction abortAfter(\n signal: AbortSignal,\n timeoutMs: number\n): { signal: AbortSignal; dispose: () => void } {\n const linked = new AbortController()\n const forward = (): void => linked.abort(signal.reason)\n\n const timer = setTimeout(() => {\n linked.abort(new Error(`This RPC did not answer within ${timeoutMs}ms.`))\n }, timeoutMs)\n // A pending timer keeps Node's event loop alive. `dispose` clears it; the\n // unref only covers a path that skips `dispose`.\n const handle = timer as unknown as { unref?: () => void }\n handle.unref?.()\n\n if (signal.aborted) {\n forward()\n } else {\n signal.addEventListener('abort', forward, { once: true })\n }\n\n return {\n signal: linked.signal,\n dispose: (): void => {\n clearTimeout(timer)\n signal.removeEventListener('abort', forward)\n },\n }\n}\n\n/**\n * Runs `run` against every RPC in parallel and reports the first confirmation.\n *\n * Not `Promise.any`: it turns \"polled and saw nothing\" into a thrown sentinel,\n * collapsing the difference between an expired transaction and an RPC that\n * never answered - the defect that reported live swaps as `TransactionExpired`.\n * `timeoutMs` is the caller's; this module holds no confirmation policy.\n */\nexport async function raceRpcs<Rpc, T>(\n rpcs: Rpc[],\n run: (rpc: Rpc, signal: AbortSignal) => Promise<ConfirmationOutcome<T>>,\n options: { timeoutMs: number }\n): Promise<RaceResult<T>> {\n if (rpcs.length === 0) {\n return { kind: 'rpc-unavailable', errors: [] }\n }\n\n const controller = new AbortController()\n // Kept distinct: `controller` means \"another branch confirmed\", the timeout\n // means \"this endpoint never answered\". The timeout aborts the linked signal\n // only.\n const branch = abortAfter(controller.signal, options.timeoutMs)\n\n let resolveConfirmed: ((value: T) => void) | undefined\n const firstConfirmation = new Promise<T>((resolve) => {\n resolveConfirmed = resolve\n })\n\n const settled = Promise.allSettled(\n rpcs.map(async (rpc) => {\n const outcome = await run(rpc, branch.signal)\n if (outcome.kind === 'confirmed') {\n resolveConfirmed?.(outcome.value)\n controller.abort()\n }\n return outcome\n })\n )\n\n const classify = (\n results: PromiseSettledResult<ConfirmationOutcome<T>>[]\n ): RaceResult<T> => {\n let expiredAtSlot: bigint | undefined\n let sawNotConfirmed = false\n const errors: Error[] = []\n\n for (const entry of results) {\n if (entry.status === 'fulfilled') {\n // Unreachable today - `firstConfirmation` always wins - but keeps\n // `classify` correct if that structure changes.\n if (entry.value.kind === 'confirmed') {\n return { kind: 'confirmed', value: entry.value.value }\n }\n if (entry.value.kind === 'expired') {\n // The highest verdict slot: the strictest head a dropped check can\n // demand.\n if (expiredAtSlot === undefined || entry.value.slot > expiredAtSlot) {\n expiredAtSlot = entry.value.slot\n }\n } else {\n sawNotConfirmed = true\n }\n continue\n }\n // Cancelled branches are not failures. A branch the timeout killed is,\n // so its error is collected.\n if (controller.signal.aborted) {\n continue\n }\n errors.push(toError(entry.reason))\n }\n\n // A completed observation outranks a thrown error, but the collected\n // errors still travel with it as the expiry's `cause`.\n //\n // Among the observations, the ceiling outranks an expiry: `expired` may\n // end in a final \"dropped\", so every branch that observed has to agree\n // on it. A stale node alone must not drop a transaction that another\n // endpoint still watched to its ceiling.\n if (sawNotConfirmed) {\n return { kind: 'not-confirmed', errors }\n }\n if (expiredAtSlot !== undefined) {\n return { kind: 'expired', slot: expiredAtSlot, errors }\n }\n return { kind: 'rpc-unavailable', errors }\n }\n\n try {\n const result = await Promise.race([\n firstConfirmation.then((value): RaceResult<T> => ({\n kind: 'confirmed',\n value,\n })),\n settled.then(classify),\n ])\n\n return result\n } finally {\n // Cancels every in-flight branch on every path out, rejections included.\n // Must run before `dispose`, which detaches the listener carrying it.\n controller.abort()\n branch.dispose()\n }\n}\n"],"mappings":";AAgBA,MAAM,WAAW,WACf,kBAAkB,QAAQ,SAAS,IAAI,MAAM,OAAO,MAAM,CAAC;;;;;;;;;AAU7D,SAAS,WACP,QACA,WAC8C;CAC9C,MAAM,SAAS,IAAI,gBAAgB;CACnC,MAAM,gBAAsB,OAAO,MAAM,OAAO,MAAM;CAEtD,MAAM,QAAQ,iBAAiB;EAC7B,OAAO,sBAAM,IAAI,MAAM,kCAAkC,UAAU,IAAI,CAAC;CAC1E,GAAG,SAAS;CAIZA,MAAO,QAAQ;CAEf,IAAI,OAAO,SACT,QAAQ;MAER,OAAO,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;CAG1D,OAAO;EACL,QAAQ,OAAO;EACf,eAAqB;GACnB,aAAa,KAAK;GAClB,OAAO,oBAAoB,SAAS,OAAO;EAC7C;CACF;AACF;;;;;;;;;AAUA,eAAsB,SACpB,MACA,KACA,SACwB;CACxB,IAAI,KAAK,WAAW,GAClB,OAAO;EAAE,MAAM;EAAmB,QAAQ,CAAC;CAAE;CAG/C,MAAM,aAAa,IAAI,gBAAgB;CAIvC,MAAM,SAAS,WAAW,WAAW,QAAQ,QAAQ,SAAS;CAE9D,IAAI;CACJ,MAAM,oBAAoB,IAAI,SAAY,YAAY;EACpD,mBAAmB;CACrB,CAAC;CAED,MAAM,UAAU,QAAQ,WACtB,KAAK,IAAI,OAAO,QAAQ;EACtB,MAAM,UAAU,MAAM,IAAI,KAAK,OAAO,MAAM;EAC5C,IAAI,QAAQ,SAAS,aAAa;GAChC,mBAAmB,QAAQ,KAAK;GAChC,WAAW,MAAM;EACnB;EACA,OAAO;CACT,CAAC,CACH;CAEA,MAAM,YACJ,YACkB;EAClB,IAAI;EACJ,IAAI,kBAAkB;EACtB,MAAM,SAAkB,CAAC;EAEzB,KAAK,MAAM,SAAS,SAAS;GAC3B,IAAI,MAAM,WAAW,aAAa;IAGhC,IAAI,MAAM,MAAM,SAAS,aACvB,OAAO;KAAE,MAAM;KAAa,OAAO,MAAM,MAAM;IAAM;IAEvD,IAAI,MAAM,MAAM,SAAS,WAGnB;SAAA,kBAAkB,KAAA,KAAa,MAAM,MAAM,OAAO,eACpD,gBAAgB,MAAM,MAAM;IAAA,OAG9B,kBAAkB;IAEpB;GACF;GAGA,IAAI,WAAW,OAAO,SACpB;GAEF,OAAO,KAAK,QAAQ,MAAM,MAAM,CAAC;EACnC;EASA,IAAI,iBACF,OAAO;GAAE,MAAM;GAAiB;EAAO;EAEzC,IAAI,kBAAkB,KAAA,GACpB,OAAO;GAAE,MAAM;GAAW,MAAM;GAAe;EAAO;EAExD,OAAO;GAAE,MAAM;GAAmB;EAAO;CAC3C;CAEA,IAAI;EASF,OAAO,MARc,QAAQ,KAAK,CAChC,kBAAkB,MAAM,WAA0B;GAChD,MAAM;GACN;EACF,EAAE,GACF,QAAQ,KAAK,QAAQ,CACvB,CAAC;CAGH,UAAU;EAGR,WAAW,MAAM;EACjB,OAAO,QAAQ;CACjB;AACF"}
@@ -1,6 +1,5 @@
1
1
  import { SolanaRpcType } from "../rpc/types.js";
2
2
  import { Commitment } from "@solana/kit";
3
- //#region src/confirmation/types.d.ts
4
3
  type SignatureStatusesResponse = Awaited<ReturnType<ReturnType<SolanaRpcType["getSignatureStatuses"]>["send"]>>;
5
4
  /** Derived from the RPC type rather than hand-written, which removes every
6
5
  * `as SignatureStatus` cast. */
@@ -16,5 +15,5 @@ export type ConfirmationOutcome<T> = {
16
15
  kind: "not-confirmed";
17
16
  };
18
17
  export declare function isConfirmedCommitment(status: Commitment | string | null | undefined): boolean;
19
- //#endregion
18
+ export {};
20
19
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/confirmation/types.ts"],"mappings":";;;KAGK,4BAA4B,QAC/B,WAAW,WAAW;;;YAKZ,kBAAkB,YAC5B;;YAIU,oBAAoB;EAC1B;EAAmB,OAAO;;EAI1B;EAAiB;;EAEjB;;wBAEU,sBACd,QAAQ"}
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/confirmation/types.ts"],"mappings":";;KAGK,4BAA4B,QAC/B,WAAW,WAAW;;;YAKZ,kBAAkB,YAC5B;;YAIU,oBAAoB;EAC1B;EAAmB,OAAO;;EAI1B;EAAiB;;EAEjB;;wBAEU,sBACd,QAAQ"}
@@ -1,8 +1,7 @@
1
- //#region src/confirmation/types.ts
1
+ // src/confirmation/types.ts
2
2
  function isConfirmedCommitment(status) {
3
3
  return status === "confirmed" || status === "finalized";
4
4
  }
5
- //#endregion
6
5
  export { isConfirmedCommitment };
7
6
 
8
7
  //# sourceMappingURL=types.js.map
@@ -1,7 +1,6 @@
1
1
  import { SolanaStepExecutorContext, SolanaStepExecutorOptions } from "../types.js";
2
2
  import { BaseStepExecutor, ExecutionAction, LiFiStepExtended, SDKError, StepExecutorBaseContext, TaskPipeline } from "@lifi/sdk";
3
3
  import { WalletAccount } from "@wallet-standard/base";
4
- //#region src/core/SolanaStepExecutor.d.ts
5
4
  export declare class SolanaStepExecutor extends BaseStepExecutor {
6
5
  private wallet;
7
6
  private skipSimulation;
@@ -11,5 +10,4 @@ export declare class SolanaStepExecutor extends BaseStepExecutor {
11
10
  override createContext: (baseContext: StepExecutorBaseContext) => Promise<SolanaStepExecutorContext>;
12
11
  override createPipeline: (context: SolanaStepExecutorContext) => TaskPipeline;
13
12
  }
14
- //#endregion
15
13
  //# sourceMappingURL=SolanaStepExecutor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SolanaStepExecutor.d.ts","names":[],"sources":["../../../src/core/SolanaStepExecutor.ts"],"mappings":";;;;qBAuBa,2BAA2B;UAC9B;UACA;EAER,YAAY,SAAS;EAMrB,mBAAoB,MAAM,qBAAmB;WAepC,cACP,OAAO,OACP,OAAO,kBACP,SAAS,oBACR,QAAQ;WAEF,gBACP,aAAa,4BACZ,QAAQ;WAWF,iBACP,SAAS,8BACR"}
1
+ {"version":3,"file":"SolanaStepExecutor.d.ts","names":[],"sources":["../../../src/core/SolanaStepExecutor.ts"],"mappings":";;;qBAuBa,2BAA2B;UAC9B;UACA;EAER,YAAY,SAAS;EAMrB,mBAAoB,MAAM,qBAAmB;WAepC,cACP,OAAO,OACP,OAAO,kBACP,SAAS,oBACR,QAAQ;WAEF,gBACP,aAAa,4BACZ,QAAQ;WAWF,iBACP,SAAS,8BACR"}
@@ -2,7 +2,7 @@ import { parseSolanaErrors } from "../errors/parseSolanaErrors.js";
2
2
  import { SolanaSignAndExecuteTask } from "./tasks/SolanaSignAndExecuteTask.js";
3
3
  import { SolanaWaitForTransactionTask } from "./tasks/SolanaWaitForTransactionTask.js";
4
4
  import { BaseStepExecutor, CheckBalanceTask, LiFiErrorCode, PrepareTransactionTask, TaskPipeline, TransactionError, WaitForTransactionStatusTask, hasOpenTransaction } from "@lifi/sdk";
5
- //#region src/core/SolanaStepExecutor.ts
5
+ // src/core/SolanaStepExecutor.ts
6
6
  var SolanaStepExecutor = class extends BaseStepExecutor {
7
7
  wallet;
8
8
  skipSimulation;
@@ -42,7 +42,6 @@ var SolanaStepExecutor = class extends BaseStepExecutor {
42
42
  return new TaskPipeline(tasksToRun);
43
43
  };
44
44
  };
45
- //#endregion
46
45
  export { SolanaStepExecutor };
47
46
 
48
47
  //# sourceMappingURL=SolanaStepExecutor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SolanaStepExecutor.js","names":[],"sources":["../../../src/core/SolanaStepExecutor.ts"],"sourcesContent":["import {\n BaseStepExecutor,\n CheckBalanceTask,\n type ExecutionAction,\n hasOpenTransaction,\n LiFiErrorCode,\n type LiFiStepExtended,\n PrepareTransactionTask,\n type SDKError,\n type StepExecutorBaseContext,\n TaskPipeline,\n TransactionError,\n WaitForTransactionStatusTask,\n} from '@lifi/sdk'\nimport type { Wallet, WalletAccount } from '@wallet-standard/base'\nimport { parseSolanaErrors } from '../errors/parseSolanaErrors.js'\nimport type {\n SolanaStepExecutorContext,\n SolanaStepExecutorOptions,\n} from '../types.js'\nimport { SolanaSignAndExecuteTask } from './tasks/SolanaSignAndExecuteTask.js'\nimport { SolanaWaitForTransactionTask } from './tasks/SolanaWaitForTransactionTask.js'\n\nexport class SolanaStepExecutor extends BaseStepExecutor {\n private wallet: Wallet\n private skipSimulation: boolean\n\n constructor(options: SolanaStepExecutorOptions) {\n super(options)\n this.wallet = options.wallet\n this.skipSimulation = options.skipSimulation ?? false\n }\n\n getWalletAccount = (step: LiFiStepExtended): WalletAccount => {\n const account = this.wallet.accounts.find(\n (account) => account.address === step.action.fromAddress\n )\n\n if (!account) {\n throw new TransactionError(\n LiFiErrorCode.WalletChangedDuringExecution,\n 'The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.'\n )\n }\n\n return account\n }\n\n override parseErrors = (\n error: Error,\n step?: LiFiStepExtended,\n action?: ExecutionAction\n ): Promise<SDKError> => parseSolanaErrors(error, step, action)\n\n override createContext = async (\n baseContext: StepExecutorBaseContext\n ): Promise<SolanaStepExecutorContext> => {\n // The account is resolved by the sign task, not here: a resume that only\n // waits must not fail because the wallet has not reconnected yet.\n return {\n ...baseContext,\n wallet: this.wallet,\n getWalletAccount: this.getWalletAccount,\n skipSimulation: this.skipSimulation,\n }\n }\n\n override createPipeline = (\n context: SolanaStepExecutorContext\n ): TaskPipeline => {\n const { step, isBridgeExecution } = context\n\n const tasks = [\n new CheckBalanceTask(),\n new PrepareTransactionTask(),\n new SolanaSignAndExecuteTask(),\n new SolanaWaitForTransactionTask(),\n new WaitForTransactionStatusTask(\n isBridgeExecution ? 'RECEIVING_CHAIN' : 'SWAP'\n ),\n ]\n\n const swapOrBridgeAction = this.statusManager.findAction(\n step,\n isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'\n )\n\n // Three-way, as Stellar and Bitcoin do. An open transaction - a broadcast\n // signature, or signed bytes that may have been sent - resumes at the\n // wait task, which looks it up and resends the same bytes. Starting at\n // CheckBalanceTask would fetch a new quote and sign a second transaction\n // while the first can still land. A same-chain swap stays PENDING with\n // its signature until the LI.FI status is DONE, so this is the common\n // reload.\n const firstTask = hasOpenTransaction(swapOrBridgeAction)\n ? swapOrBridgeAction?.status === 'DONE'\n ? WaitForTransactionStatusTask\n : SolanaWaitForTransactionTask\n : CheckBalanceTask\n\n // Compare classes, not names: a minifier can give two task classes the\n // same name.\n const firstTaskIndex = tasks.findIndex(\n (task) => task.constructor === firstTask\n )\n if (firstTaskIndex === -1) {\n throw new TransactionError(\n LiFiErrorCode.InternalError,\n 'SolanaStepExecutor.createPipeline: first task not found'\n )\n }\n\n const tasksToRun = tasks.slice(firstTaskIndex)\n\n return new TaskPipeline(tasksToRun)\n }\n}\n"],"mappings":";;;;;AAuBA,IAAa,qBAAb,cAAwC,iBAAiB;CACvD;CACA;CAEA,YAAY,SAAoC;EAC9C,MAAM,OAAO;EACb,KAAK,SAAS,QAAQ;EACtB,KAAK,iBAAiB,QAAQ,kBAAkB;CAClD;CAEA,oBAAoB,SAA0C;EAC5D,MAAM,UAAU,KAAK,OAAO,SAAS,MAClC,YAAY,QAAQ,YAAY,KAAK,OAAO,WAC/C;EAEA,IAAI,CAAC,SACH,MAAM,IAAI,iBACR,cAAc,8BACd,mHACF;EAGF,OAAO;CACT;CAEA,eACE,OACA,MACA,WACsB,kBAAkB,OAAO,MAAM,MAAM;CAE7D,gBAAyB,OACvB,gBACuC;EAGvC,OAAO;GACL,GAAG;GACH,QAAQ,KAAK;GACb,kBAAkB,KAAK;GACvB,gBAAgB,KAAK;EACvB;CACF;CAEA,kBACE,YACiB;EACjB,MAAM,EAAE,MAAM,sBAAsB;EAEpC,MAAM,QAAQ;GACZ,IAAI,iBAAiB;GACrB,IAAI,uBAAuB;GAC3B,IAAI,yBAAyB;GAC7B,IAAI,6BAA6B;GACjC,IAAI,6BACF,oBAAoB,oBAAoB,MAC1C;EACF;EAEA,MAAM,qBAAqB,KAAK,cAAc,WAC5C,MACA,oBAAoB,gBAAgB,MACtC;EASA,MAAM,YAAY,mBAAmB,kBAAkB,IACnD,oBAAoB,WAAW,SAC7B,+BACA,+BACF;EAIJ,MAAM,iBAAiB,MAAM,WAC1B,SAAS,KAAK,gBAAgB,SACjC;EACA,IAAI,mBAAmB,IACrB,MAAM,IAAI,iBACR,cAAc,eACd,yDACF;EAGF,MAAM,aAAa,MAAM,MAAM,cAAc;EAE7C,OAAO,IAAI,aAAa,UAAU;CACpC;AACF"}
1
+ {"version":3,"file":"SolanaStepExecutor.js","names":[],"sources":["../../../src/core/SolanaStepExecutor.ts"],"sourcesContent":["import {\n BaseStepExecutor,\n CheckBalanceTask,\n type ExecutionAction,\n hasOpenTransaction,\n LiFiErrorCode,\n type LiFiStepExtended,\n PrepareTransactionTask,\n type SDKError,\n type StepExecutorBaseContext,\n TaskPipeline,\n TransactionError,\n WaitForTransactionStatusTask,\n} from '@lifi/sdk'\nimport type { Wallet, WalletAccount } from '@wallet-standard/base'\nimport { parseSolanaErrors } from '../errors/parseSolanaErrors.js'\nimport type {\n SolanaStepExecutorContext,\n SolanaStepExecutorOptions,\n} from '../types.js'\nimport { SolanaSignAndExecuteTask } from './tasks/SolanaSignAndExecuteTask.js'\nimport { SolanaWaitForTransactionTask } from './tasks/SolanaWaitForTransactionTask.js'\n\nexport class SolanaStepExecutor extends BaseStepExecutor {\n private wallet: Wallet\n private skipSimulation: boolean\n\n constructor(options: SolanaStepExecutorOptions) {\n super(options)\n this.wallet = options.wallet\n this.skipSimulation = options.skipSimulation ?? false\n }\n\n getWalletAccount = (step: LiFiStepExtended): WalletAccount => {\n const account = this.wallet.accounts.find(\n (account) => account.address === step.action.fromAddress\n )\n\n if (!account) {\n throw new TransactionError(\n LiFiErrorCode.WalletChangedDuringExecution,\n 'The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.'\n )\n }\n\n return account\n }\n\n override parseErrors = (\n error: Error,\n step?: LiFiStepExtended,\n action?: ExecutionAction\n ): Promise<SDKError> => parseSolanaErrors(error, step, action)\n\n override createContext = async (\n baseContext: StepExecutorBaseContext\n ): Promise<SolanaStepExecutorContext> => {\n // The account is resolved by the sign task, not here: a resume that only\n // waits must not fail because the wallet has not reconnected yet.\n return {\n ...baseContext,\n wallet: this.wallet,\n getWalletAccount: this.getWalletAccount,\n skipSimulation: this.skipSimulation,\n }\n }\n\n override createPipeline = (\n context: SolanaStepExecutorContext\n ): TaskPipeline => {\n const { step, isBridgeExecution } = context\n\n const tasks = [\n new CheckBalanceTask(),\n new PrepareTransactionTask(),\n new SolanaSignAndExecuteTask(),\n new SolanaWaitForTransactionTask(),\n new WaitForTransactionStatusTask(\n isBridgeExecution ? 'RECEIVING_CHAIN' : 'SWAP'\n ),\n ]\n\n const swapOrBridgeAction = this.statusManager.findAction(\n step,\n isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'\n )\n\n // Three-way, as Stellar and Bitcoin do. An open transaction - a broadcast\n // signature, or signed bytes that may have been sent - resumes at the\n // wait task, which looks it up and resends the same bytes. Starting at\n // CheckBalanceTask would fetch a new quote and sign a second transaction\n // while the first can still land. A same-chain swap stays PENDING with\n // its signature until the LI.FI status is DONE, so this is the common\n // reload.\n const firstTask = hasOpenTransaction(swapOrBridgeAction)\n ? swapOrBridgeAction?.status === 'DONE'\n ? WaitForTransactionStatusTask\n : SolanaWaitForTransactionTask\n : CheckBalanceTask\n\n // Compare classes, not names: a minifier can give two task classes the\n // same name.\n const firstTaskIndex = tasks.findIndex(\n (task) => task.constructor === firstTask\n )\n if (firstTaskIndex === -1) {\n throw new TransactionError(\n LiFiErrorCode.InternalError,\n 'SolanaStepExecutor.createPipeline: first task not found'\n )\n }\n\n const tasksToRun = tasks.slice(firstTaskIndex)\n\n return new TaskPipeline(tasksToRun)\n }\n}\n"],"mappings":";;;;;AAuBA,IAAa,qBAAb,cAAwC,iBAAiB;CAC/C;CACA;CAER,YAAY,SAAoC;EAC9C,MAAM,OAAO;EACb,KAAK,SAAS,QAAQ;EACtB,KAAK,iBAAiB,QAAQ,kBAAkB;CAClD;CAEA,oBAAoB,SAA0C;EAC5D,MAAM,UAAU,KAAK,OAAO,SAAS,MAClC,YAAY,QAAQ,YAAY,KAAK,OAAO,WAC/C;EAEA,IAAI,CAAC,SACH,MAAM,IAAI,iBACR,cAAc,8BACd,mHACF;EAGF,OAAO;CACT;CAES,eACP,OACA,MACA,WACsB,kBAAkB,OAAO,MAAM,MAAM;CAEpD,gBAAgB,OACvB,gBACuC;EAGvC,OAAO;GACL,GAAG;GACH,QAAQ,KAAK;GACb,kBAAkB,KAAK;GACvB,gBAAgB,KAAK;EACvB;CACF;CAES,kBACP,YACiB;EACjB,MAAM,EAAE,MAAM,sBAAsB;EAEpC,MAAM,QAAQ;GACZ,IAAI,iBAAiB;GACrB,IAAI,uBAAuB;GAC3B,IAAI,yBAAyB;GAC7B,IAAI,6BAA6B;GACjC,IAAI,6BACF,oBAAoB,oBAAoB,MAC1C;EACF;EAEA,MAAM,qBAAqB,KAAK,cAAc,WAC5C,MACA,oBAAoB,gBAAgB,MACtC;EASA,MAAM,YAAY,mBAAmB,kBAAkB,IACnD,oBAAoB,WAAW,SAC7B,+BACA,+BACF;EAIJ,MAAM,iBAAiB,MAAM,WAC1B,SAAS,KAAK,gBAAgB,SACjC;EACA,IAAI,mBAAmB,IACrB,MAAM,IAAI,iBACR,cAAc,eACd,yDACF;EAGF,MAAM,aAAa,MAAM,MAAM,cAAc;EAE7C,OAAO,IAAI,aAAa,UAAU;CACpC;AACF"}
@@ -1,8 +1,6 @@
1
1
  import { SolanaStepExecutorContext } from "../../types.js";
2
2
  import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
3
- //#region src/core/tasks/SolanaJitoWaitForTransactionTask.d.ts
4
3
  export declare class SolanaJitoWaitForTransactionTask extends BaseStepExecutionTask {
5
4
  run(context: SolanaStepExecutorContext): Promise<TaskResult>;
6
5
  }
7
- //#endregion
8
6
  //# sourceMappingURL=SolanaJitoWaitForTransactionTask.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SolanaJitoWaitForTransactionTask.d.ts","names":[],"sources":["../../../../src/core/tasks/SolanaJitoWaitForTransactionTask.ts"],"mappings":";;;qBA+Ca,yCAAyC;EACpD,IAAU,SAAS,4BAA4B,QAAQ"}
1
+ {"version":3,"file":"SolanaJitoWaitForTransactionTask.d.ts","names":[],"sources":["../../../../src/core/tasks/SolanaJitoWaitForTransactionTask.ts"],"mappings":";;qBA+Ca,yCAAyC;EAC9C,IAAI,SAAS,4BAA4B,QAAQ"}
@@ -1,10 +1,10 @@
1
- import { readSignature } from "./readSignature.js";
2
- import { getTransactionLifetime } from "../../utils/getTransactionLifetime.js";
3
1
  import { sendAndConfirmBundle } from "../../actions/sendAndConfirmBundle.js";
4
- import { canResendStored, clearStoredTransactions, failureOf, getTxLink, sendAndSettle } from "./transactionOutcome.js";
2
+ import { getTransactionLifetime } from "../../utils/getTransactionLifetime.js";
3
+ import { readSignature } from "./readSignature.js";
5
4
  import { resumeFromStore } from "./resumeFromStore.js";
5
+ import { canResendStored, clearStoredTransactions, failureOf, getTxLink, sendAndSettle } from "./transactionOutcome.js";
6
6
  import { BaseStepExecutionTask, LiFiErrorCode, TransactionError } from "@lifi/sdk";
7
- //#region src/core/tasks/SolanaJitoWaitForTransactionTask.ts
7
+ // src/core/tasks/SolanaJitoWaitForTransactionTask.ts
8
8
  const MESSAGES = {
9
9
  rpcUnavailable: "Unable to confirm bundle: every configured Solana RPC failed.",
10
10
  notConfirmed: "Bundle was not confirmed before the SDK stopped waiting.",
@@ -76,7 +76,6 @@ function sendSigned(context, action, options) {
76
76
  messages: MESSAGES
77
77
  });
78
78
  }
79
- //#endregion
80
79
  export { SolanaJitoWaitForTransactionTask };
81
80
 
82
81
  //# sourceMappingURL=SolanaJitoWaitForTransactionTask.js.map
@@ -1,8 +1,6 @@
1
1
  import { SolanaStepExecutorContext } from "../../types.js";
2
2
  import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
3
- //#region src/core/tasks/SolanaSignAndExecuteTask.d.ts
4
3
  export declare class SolanaSignAndExecuteTask extends BaseStepExecutionTask {
5
4
  run(context: SolanaStepExecutorContext): Promise<TaskResult>;
6
5
  }
7
- //#endregion
8
6
  //# sourceMappingURL=SolanaSignAndExecuteTask.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SolanaSignAndExecuteTask.d.ts","names":[],"sources":["../../../../src/core/tasks/SolanaSignAndExecuteTask.ts"],"mappings":";;;qBAkBa,iCAAiC;EAC5C,IAAU,SAAS,4BAA4B,QAAQ"}
1
+ {"version":3,"file":"SolanaSignAndExecuteTask.d.ts","names":[],"sources":["../../../../src/core/tasks/SolanaSignAndExecuteTask.ts"],"mappings":";;qBAkBa,iCAAiC;EACtC,IAAI,SAAS,4BAA4B,QAAQ"}