@lifi/sdk-provider-solana 4.3.5 → 4.3.6

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 (56) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/actions/sendAndConfirmBundle.d.ts +8 -7
  3. package/dist/cjs/actions/sendAndConfirmBundle.js +22 -16
  4. package/dist/cjs/actions/sendAndConfirmBundle.js.map +1 -1
  5. package/dist/cjs/confirmation/confirmBundle.d.ts +18 -19
  6. package/dist/cjs/confirmation/confirmBundle.js +10 -23
  7. package/dist/cjs/confirmation/confirmBundle.js.map +1 -1
  8. package/dist/cjs/confirmation/confirmSignature.d.ts +2 -2
  9. package/dist/cjs/confirmation/confirmSignature.js +2 -2
  10. package/dist/cjs/confirmation/confirmSignature.js.map +1 -1
  11. package/dist/cjs/confirmation/createConfirmationDeadline.d.ts +1 -1
  12. package/dist/cjs/confirmation/createConfirmationDeadline.js.map +1 -1
  13. package/dist/cjs/confirmation/types.d.ts +1 -1
  14. package/dist/cjs/confirmation/types.js.map +1 -1
  15. package/dist/cjs/core/tasks/SolanaJitoWaitForTransactionTask.js +9 -18
  16. package/dist/cjs/core/tasks/SolanaJitoWaitForTransactionTask.js.map +1 -1
  17. package/dist/cjs/rpc/registry.d.ts +4 -3
  18. package/dist/cjs/rpc/registry.js +4 -3
  19. package/dist/cjs/rpc/registry.js.map +1 -1
  20. package/dist/cjs/version.d.ts +1 -1
  21. package/dist/cjs/version.js +1 -1
  22. package/dist/cjs/version.js.map +1 -1
  23. package/dist/esm/actions/sendAndConfirmBundle.d.ts +8 -7
  24. package/dist/esm/actions/sendAndConfirmBundle.d.ts.map +1 -1
  25. package/dist/esm/actions/sendAndConfirmBundle.js +24 -18
  26. package/dist/esm/actions/sendAndConfirmBundle.js.map +1 -1
  27. package/dist/esm/confirmation/confirmBundle.d.ts +18 -19
  28. package/dist/esm/confirmation/confirmBundle.d.ts.map +1 -1
  29. package/dist/esm/confirmation/confirmBundle.js +10 -23
  30. package/dist/esm/confirmation/confirmBundle.js.map +1 -1
  31. package/dist/esm/confirmation/confirmSignature.d.ts +2 -2
  32. package/dist/esm/confirmation/confirmSignature.js +2 -2
  33. package/dist/esm/confirmation/confirmSignature.js.map +1 -1
  34. package/dist/esm/confirmation/createConfirmationDeadline.d.ts +1 -1
  35. package/dist/esm/confirmation/createConfirmationDeadline.js.map +1 -1
  36. package/dist/esm/confirmation/types.d.ts +1 -1
  37. package/dist/esm/confirmation/types.js.map +1 -1
  38. package/dist/esm/core/tasks/SolanaJitoWaitForTransactionTask.d.ts.map +1 -1
  39. package/dist/esm/core/tasks/SolanaJitoWaitForTransactionTask.js +10 -19
  40. package/dist/esm/core/tasks/SolanaJitoWaitForTransactionTask.js.map +1 -1
  41. package/dist/esm/rpc/registry.d.ts +4 -3
  42. package/dist/esm/rpc/registry.d.ts.map +1 -1
  43. package/dist/esm/rpc/registry.js +4 -3
  44. package/dist/esm/rpc/registry.js.map +1 -1
  45. package/dist/esm/version.d.ts +1 -1
  46. package/dist/esm/version.js +1 -1
  47. package/dist/esm/version.js.map +1 -1
  48. package/package.json +2 -2
  49. package/src/actions/sendAndConfirmBundle.ts +48 -48
  50. package/src/confirmation/confirmBundle.ts +34 -69
  51. package/src/confirmation/confirmSignature.ts +2 -2
  52. package/src/confirmation/createConfirmationDeadline.ts +1 -1
  53. package/src/confirmation/types.ts +1 -1
  54. package/src/core/tasks/SolanaJitoWaitForTransactionTask.ts +13 -27
  55. package/src/rpc/registry.ts +4 -3
  56. package/src/version.ts +1 -1
@@ -20,45 +20,29 @@ import { resumeFromStore } from './resumeFromStore.js'
20
20
  import {
21
21
  canResendStored,
22
22
  clearStoredTransactions,
23
+ failureOf,
23
24
  getTxLink,
24
25
  sendAndSettle,
25
26
  } from './transactionOutcome.js'
26
27
 
27
28
  // The `rpc-unavailable` message is distinct from the empty-list throw inside
28
29
  // `sendAndConfirmBundle`: RPCs were configured and every one of them failed.
29
- // That is an outage, and the collected branch errors say what each endpoint
30
- // did.
30
+ // Every read RPC confirms and waits for the one shared submission, so a
31
+ // refused submission fails every branch with the same error.
31
32
  const MESSAGES: ConfirmationMessages = {
32
- rpcUnavailable: 'Unable to confirm bundle: every configured Jito RPC failed.',
33
+ rpcUnavailable:
34
+ 'Unable to confirm bundle: every configured Solana RPC failed.',
33
35
  notConfirmed: 'Bundle was not confirmed before the SDK stopped waiting.',
34
- allRpcsFailed: 'All Jito RPCs failed',
36
+ allRpcsFailed: 'All Solana RPCs failed',
35
37
  someRpcsFailed:
36
- 'Some Jito RPCs failed while the confirmation window was open',
38
+ 'Some Solana RPCs failed while the confirmation window was open',
37
39
  }
38
40
 
39
- /** Jito encodes `err` as a Rust `Result`: a landed bundle carries
40
- * `{ Ok: null }`, so only an explicit `{ Err: … }` counts as a failure. */
41
- function getBundleFailure(err: unknown): { failure: unknown } | undefined {
42
- if (typeof err !== 'object' || err === null || !('Err' in err)) {
43
- return undefined
44
- }
45
- return { failure: (err as { Err: unknown }).Err }
46
- }
47
-
48
- /** The failure of a landed bundle, if any. A `null` in `signatureResults` is
49
- * indexing lag, never failure. The bundle-level `err` is checked first: it
50
- * survives a failed `getSignatureStatuses` read. */
41
+ /** The failure of a landed bundle, if any: the first transaction `err`. */
51
42
  function bundleFailureOf(
52
43
  confirmation: BundleConfirmation
53
44
  ): { err: unknown } | undefined {
54
- const bundleFailure = getBundleFailure(confirmation.bundleErr)
55
- if (bundleFailure) {
56
- return { err: bundleFailure.failure }
57
- }
58
- const failedResult = confirmation.signatureResults.find(
59
- (signatureResult) => signatureResult?.err
60
- )
61
- return failedResult?.err ? { err: failedResult.err } : undefined
45
+ return confirmation.signatureResults.map(failureOf).find(Boolean)
62
46
  }
63
47
 
64
48
  export class SolanaJitoWaitForTransactionTask extends BaseStepExecutionTask {
@@ -126,8 +110,10 @@ export class SolanaJitoWaitForTransactionTask extends BaseStepExecutionTask {
126
110
 
127
111
  /**
128
112
  * Submits the signed bundle once, confirms it and applies the result rules
129
- * of `sendAndSettle`, on the first run and on a resume alike. A bundle lands
130
- * whole or not at all, so the first transaction's signature stands for it.
113
+ * of `sendAndSettle`, on the first run and on a resume alike. A Jito bundle
114
+ * lands whole or not at all, so the first transaction's signature stands for
115
+ * it. A sender that is not Jito can land the transactions one by one; a
116
+ * lookup by the first signature then misses a partial landing.
131
117
  */
132
118
  function sendSigned(
133
119
  context: SolanaStepExecutorContext,
@@ -120,9 +120,10 @@ const readProbeFailure = (error: unknown): JitoProbeResult => {
120
120
  const PROBE_TIMEOUT_MS = 5_000
121
121
 
122
122
  /**
123
- * Probes with `getBundleStatuses` rather than `getTipAccounts`: it is the
124
- * method bundle confirmation actually uses, and providers such as Helius
125
- * support it without exposing `getTipAccounts`.
123
+ * Picks the RPCs that may submit a bundle; confirmation reads signatures on
124
+ * every read RPC. Probes with `getBundleStatuses` rather than
125
+ * `getTipAccounts`: providers such as Helius support it without exposing
126
+ * `getTipAccounts`.
126
127
  */
127
128
  export const probeJitoRpc = async (
128
129
  rpcUrl: string
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export const name = '@lifi/sdk-provider-solana'
2
- export const version = '4.3.5'
2
+ export const version = '4.3.6'