@oobe-protocol-labs/synapse-sap-sdk 0.15.0 → 0.16.0

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 (153) hide show
  1. package/dist/cjs/client.js +1 -1
  2. package/dist/cjs/client.js.map +1 -1
  3. package/dist/cjs/idl/synapse_agent_sap.json +2475 -898
  4. package/dist/esm/client.js +1 -1
  5. package/dist/esm/client.js.map +1 -1
  6. package/dist/esm/idl/synapse_agent_sap.json +2475 -898
  7. package/package.json +1 -1
  8. package/dist/esm/instructions/memory.d.ts +0 -8
  9. package/dist/esm/instructions/memory.d.ts.map +0 -1
  10. package/dist/esm/instructions/memory.js +0 -234
  11. package/dist/esm/instructions/memory.js.map +0 -1
  12. package/dist/types/constants/addresses.d.ts +0 -117
  13. package/dist/types/constants/addresses.d.ts.map +0 -1
  14. package/dist/types/constants/index.d.ts +0 -31
  15. package/dist/types/constants/index.d.ts.map +0 -1
  16. package/dist/types/constants/limits.d.ts +0 -149
  17. package/dist/types/constants/limits.d.ts.map +0 -1
  18. package/dist/types/constants/network.d.ts +0 -81
  19. package/dist/types/constants/network.d.ts.map +0 -1
  20. package/dist/types/constants/payments.d.ts +0 -121
  21. package/dist/types/constants/payments.d.ts.map +0 -1
  22. package/dist/types/constants/programs.d.ts +0 -69
  23. package/dist/types/constants/programs.d.ts.map +0 -1
  24. package/dist/types/constants/seeds.d.ts +0 -82
  25. package/dist/types/constants/seeds.d.ts.map +0 -1
  26. package/dist/types/core/client.d.ts +0 -467
  27. package/dist/types/core/client.d.ts.map +0 -1
  28. package/dist/types/core/connection.d.ts +0 -305
  29. package/dist/types/core/connection.d.ts.map +0 -1
  30. package/dist/types/core/index.d.ts +0 -20
  31. package/dist/types/core/index.d.ts.map +0 -1
  32. package/dist/types/errors/index.d.ts +0 -335
  33. package/dist/types/errors/index.d.ts.map +0 -1
  34. package/dist/types/events/geyser.d.ts +0 -150
  35. package/dist/types/events/geyser.d.ts.map +0 -1
  36. package/dist/types/events/index.d.ts +0 -248
  37. package/dist/types/events/index.d.ts.map +0 -1
  38. package/dist/types/idl/index.d.ts +0 -70
  39. package/dist/types/idl/index.d.ts.map +0 -1
  40. package/dist/types/index.d.ts +0 -86
  41. package/dist/types/index.d.ts.map +0 -1
  42. package/dist/types/modules/agent.d.ts +0 -156
  43. package/dist/types/modules/agent.d.ts.map +0 -1
  44. package/dist/types/modules/attestation.d.ts +0 -96
  45. package/dist/types/modules/attestation.d.ts.map +0 -1
  46. package/dist/types/modules/base.d.ts +0 -215
  47. package/dist/types/modules/base.d.ts.map +0 -1
  48. package/dist/types/modules/escrow-v2.d.ts +0 -285
  49. package/dist/types/modules/escrow-v2.d.ts.map +0 -1
  50. package/dist/types/modules/feedback.d.ts +0 -105
  51. package/dist/types/modules/feedback.d.ts.map +0 -1
  52. package/dist/types/modules/index.d.ts +0 -27
  53. package/dist/types/modules/index.d.ts.map +0 -1
  54. package/dist/types/modules/indexing.d.ts +0 -200
  55. package/dist/types/modules/indexing.d.ts.map +0 -1
  56. package/dist/types/modules/ledger.d.ts +0 -150
  57. package/dist/types/modules/ledger.d.ts.map +0 -1
  58. package/dist/types/modules/receipt.d.ts +0 -91
  59. package/dist/types/modules/receipt.d.ts.map +0 -1
  60. package/dist/types/modules/staking.d.ts +0 -51
  61. package/dist/types/modules/staking.d.ts.map +0 -1
  62. package/dist/types/modules/subscription.d.ts +0 -33
  63. package/dist/types/modules/subscription.d.ts.map +0 -1
  64. package/dist/types/modules/tools.d.ts +0 -172
  65. package/dist/types/modules/tools.d.ts.map +0 -1
  66. package/dist/types/modules/vault.d.ts +0 -240
  67. package/dist/types/modules/vault.d.ts.map +0 -1
  68. package/dist/types/parser/client.d.ts +0 -123
  69. package/dist/types/parser/client.d.ts.map +0 -1
  70. package/dist/types/parser/complete.d.ts +0 -90
  71. package/dist/types/parser/complete.d.ts.map +0 -1
  72. package/dist/types/parser/index.d.ts +0 -40
  73. package/dist/types/parser/index.d.ts.map +0 -1
  74. package/dist/types/parser/inner.d.ts +0 -114
  75. package/dist/types/parser/inner.d.ts.map +0 -1
  76. package/dist/types/parser/instructions.d.ts +0 -76
  77. package/dist/types/parser/instructions.d.ts.map +0 -1
  78. package/dist/types/parser/transaction.d.ts +0 -77
  79. package/dist/types/parser/transaction.d.ts.map +0 -1
  80. package/dist/types/parser/types.d.ts +0 -154
  81. package/dist/types/parser/types.d.ts.map +0 -1
  82. package/dist/types/pda/index.d.ts +0 -527
  83. package/dist/types/pda/index.d.ts.map +0 -1
  84. package/dist/types/plugin/index.d.ts +0 -171
  85. package/dist/types/plugin/index.d.ts.map +0 -1
  86. package/dist/types/plugin/protocols.d.ts +0 -152
  87. package/dist/types/plugin/protocols.d.ts.map +0 -1
  88. package/dist/types/plugin/schemas.d.ts +0 -829
  89. package/dist/types/plugin/schemas.d.ts.map +0 -1
  90. package/dist/types/postgres/adapter.d.ts +0 -355
  91. package/dist/types/postgres/adapter.d.ts.map +0 -1
  92. package/dist/types/postgres/index.d.ts +0 -24
  93. package/dist/types/postgres/index.d.ts.map +0 -1
  94. package/dist/types/postgres/serializers.d.ts +0 -30
  95. package/dist/types/postgres/serializers.d.ts.map +0 -1
  96. package/dist/types/postgres/sync.d.ts +0 -156
  97. package/dist/types/postgres/sync.d.ts.map +0 -1
  98. package/dist/types/postgres/types.d.ts +0 -167
  99. package/dist/types/postgres/types.d.ts.map +0 -1
  100. package/dist/types/registries/builder.d.ts +0 -333
  101. package/dist/types/registries/builder.d.ts.map +0 -1
  102. package/dist/types/registries/discovery.d.ts +0 -333
  103. package/dist/types/registries/discovery.d.ts.map +0 -1
  104. package/dist/types/registries/fairscale.d.ts +0 -680
  105. package/dist/types/registries/fairscale.d.ts.map +0 -1
  106. package/dist/types/registries/index.d.ts +0 -52
  107. package/dist/types/registries/index.d.ts.map +0 -1
  108. package/dist/types/registries/metaplex-bridge.d.ts +0 -488
  109. package/dist/types/registries/metaplex-bridge.d.ts.map +0 -1
  110. package/dist/types/registries/session.d.ts +0 -317
  111. package/dist/types/registries/session.d.ts.map +0 -1
  112. package/dist/types/registries/x402.d.ts +0 -523
  113. package/dist/types/registries/x402.d.ts.map +0 -1
  114. package/dist/types/types/accounts.d.ts +0 -817
  115. package/dist/types/types/accounts.d.ts.map +0 -1
  116. package/dist/types/types/common.d.ts +0 -166
  117. package/dist/types/types/common.d.ts.map +0 -1
  118. package/dist/types/types/endpoint.d.ts +0 -161
  119. package/dist/types/types/endpoint.d.ts.map +0 -1
  120. package/dist/types/types/enums.d.ts +0 -353
  121. package/dist/types/types/enums.d.ts.map +0 -1
  122. package/dist/types/types/index.d.ts +0 -29
  123. package/dist/types/types/index.d.ts.map +0 -1
  124. package/dist/types/types/instructions.d.ts +0 -400
  125. package/dist/types/types/instructions.d.ts.map +0 -1
  126. package/dist/types/utils/anchor-errors.d.ts +0 -61
  127. package/dist/types/utils/anchor-errors.d.ts.map +0 -1
  128. package/dist/types/utils/endpoint-validator.d.ts +0 -110
  129. package/dist/types/utils/endpoint-validator.d.ts.map +0 -1
  130. package/dist/types/utils/escrow-validation.d.ts +0 -145
  131. package/dist/types/utils/escrow-validation.d.ts.map +0 -1
  132. package/dist/types/utils/hash.d.ts +0 -75
  133. package/dist/types/utils/hash.d.ts.map +0 -1
  134. package/dist/types/utils/index.d.ts +0 -36
  135. package/dist/types/utils/index.d.ts.map +0 -1
  136. package/dist/types/utils/merchant-validator.d.ts +0 -176
  137. package/dist/types/utils/merchant-validator.d.ts.map +0 -1
  138. package/dist/types/utils/network-normalizer.d.ts +0 -120
  139. package/dist/types/utils/network-normalizer.d.ts.map +0 -1
  140. package/dist/types/utils/priority-fee.d.ts +0 -205
  141. package/dist/types/utils/priority-fee.d.ts.map +0 -1
  142. package/dist/types/utils/rpc-strategy.d.ts +0 -179
  143. package/dist/types/utils/rpc-strategy.d.ts.map +0 -1
  144. package/dist/types/utils/schemas.d.ts +0 -351
  145. package/dist/types/utils/schemas.d.ts.map +0 -1
  146. package/dist/types/utils/serialization.d.ts +0 -69
  147. package/dist/types/utils/serialization.d.ts.map +0 -1
  148. package/dist/types/utils/validation.d.ts +0 -29
  149. package/dist/types/utils/validation.d.ts.map +0 -1
  150. package/dist/types/utils/volume-curve.d.ts +0 -60
  151. package/dist/types/utils/volume-curve.d.ts.map +0 -1
  152. package/dist/types/utils/x402-direct.d.ts +0 -114
  153. package/dist/types/utils/x402-direct.d.ts.map +0 -1
@@ -1,205 +0,0 @@
1
- /**
2
- * @module utils/priority-fee
3
- * @description Compute budget and priority fee utilities for SAP transactions.
4
- *
5
- * Solana transactions that include a priority fee (via the Compute Budget program)
6
- * land faster because validators prefer higher-fee transactions. This module
7
- * provides a clean, composable API for building priority-fee instructions
8
- * that can be prepended to any Anchor method builder via `.preInstructions()`.
9
- *
10
- * Typical use: x402 settlement transactions where the receiving agent's RPC
11
- * has a short confirmation window (e.g., 30 seconds).
12
- *
13
- * @category Utils
14
- * @since v0.6.2
15
- *
16
- * @example
17
- * ```ts
18
- * import { buildPriorityFeeIxs, DEFAULT_SETTLE_PRIORITY } from "@synapse-sap/sdk";
19
- *
20
- * // Append to any Anchor method builder:
21
- * await program.methods
22
- * .settleCalls(calls, hash)
23
- * .accounts({ ... })
24
- * .preInstructions(buildPriorityFeeIxs({ priorityFeeMicroLamports: 5000 }))
25
- * .rpc({ skipPreflight: true });
26
- * ```
27
- */
28
- import { type TransactionInstruction } from "@solana/web3.js";
29
- /**
30
- * Default priority fee for settlement transactions (in microlamports).
31
- * 5000 µL ≈ 0.0005 SOL per 200k CU — fast enough for most agent RPCs.
32
- *
33
- * @since v0.6.2
34
- */
35
- export declare const DEFAULT_SETTLE_PRIORITY_FEE = 5000;
36
- /**
37
- * Default compute unit limit for settlement transactions.
38
- * `settle_calls` uses ~60k CU; 100k provides a safe margin.
39
- *
40
- * @since v0.6.2
41
- */
42
- export declare const DEFAULT_SETTLE_COMPUTE_UNITS = 100000;
43
- /**
44
- * Default compute unit limit for batch settlement transactions.
45
- * `settle_batch` with 10 entries uses ~200k CU; 300k provides margin.
46
- *
47
- * @since v0.6.2
48
- */
49
- export declare const DEFAULT_BATCH_SETTLE_COMPUTE_UNITS = 300000;
50
- /**
51
- * @name computeBatchSettleCu
52
- * @description Compute the CU limit needed by `settle_batch` for a
53
- * given entry count. Returned value is safe to pass to
54
- * `ComputeBudgetProgram.setComputeUnitLimit`.
55
- *
56
- * Formula: `60_000 + n * 25_000`, clamped to 1.2M.
57
- *
58
- * @param entryCount - Number of settlements in the batch (1..N).
59
- * @returns CU limit suitable for `setComputeUnitLimit`.
60
- *
61
- * @example
62
- * ```ts
63
- * const cu = computeBatchSettleCu(20); // 560_000
64
- * ```
65
- *
66
- * @category Utils
67
- * @since v0.11.0
68
- */
69
- export declare function computeBatchSettleCu(entryCount: number): number;
70
- /**
71
- * @interface PriorityFeeConfig
72
- * @description Configuration for building compute budget instructions.
73
- * @category Utils
74
- * @since v0.6.2
75
- */
76
- export interface PriorityFeeConfig {
77
- /**
78
- * Priority fee in microlamports per compute unit.
79
- * Higher values = faster confirmation.
80
- *
81
- * Common values:
82
- * - `1000` — low priority (~0.0001 SOL)
83
- * - `5000` — medium priority (~0.0005 SOL) ← recommended for settle
84
- * - `50000` — high priority (~0.005 SOL)
85
- * - `0` — no priority fee (default Solana behavior)
86
- *
87
- * @default 0
88
- */
89
- readonly priorityFeeMicroLamports?: number;
90
- /**
91
- * Maximum compute units the transaction may consume.
92
- * Setting an explicit limit avoids overpaying for unused CU.
93
- *
94
- * @default 200_000 (Solana default)
95
- */
96
- readonly computeUnits?: number;
97
- }
98
- /**
99
- * @interface SettleOptions
100
- * @description Options for x402 settlement transactions.
101
- * Controls priority fees, compute budget, and RPC behavior
102
- * to optimize confirmation speed for time-sensitive settlements.
103
- *
104
- * @category Registries
105
- * @since v0.6.2
106
- *
107
- * @example
108
- * ```ts
109
- * // Fast settlement with priority fee
110
- * const receipt = await x402.settle(depositor, 1, "data", {
111
- * priorityFeeMicroLamports: 5000,
112
- * computeUnits: 100_000,
113
- * skipPreflight: true,
114
- * });
115
- *
116
- * // Use the convenience preset
117
- * import { FAST_SETTLE_OPTIONS } from "@synapse-sap/sdk";
118
- * const receipt = await x402.settle(depositor, 1, "data", FAST_SETTLE_OPTIONS);
119
- * ```
120
- */
121
- export interface SettleOptions extends PriorityFeeConfig {
122
- /**
123
- * Skip Solana simulation before submitting.
124
- * Saves ~400ms but loses pre-flight error detection.
125
- *
126
- * Recommended for settlements where the escrow state
127
- * has already been pre-fetched and validated.
128
- *
129
- * @default false
130
- */
131
- readonly skipPreflight?: boolean;
132
- /**
133
- * Transaction commitment level override.
134
- * Uses the provider's default when omitted.
135
- *
136
- * - `"processed"` — fastest, least reliable
137
- * - `"confirmed"` — balanced (recommended)
138
- * - `"finalized"` — slowest, most reliable
139
- */
140
- readonly commitment?: "processed" | "confirmed" | "finalized";
141
- /**
142
- * Maximum number of RPC retry attempts.
143
- * @default provider default (usually 3)
144
- */
145
- readonly maxRetries?: number;
146
- }
147
- /**
148
- * Recommended preset for fast x402 settlements.
149
- * Priority fee 5000 µL, 100k CU, skip preflight, confirmed commitment.
150
- *
151
- * @since v0.6.2
152
- */
153
- export declare const FAST_SETTLE_OPTIONS: Readonly<SettleOptions>;
154
- /**
155
- * Recommended preset for fast batch settlements.
156
- * Priority fee 5000 µL, 300k CU, skip preflight, confirmed commitment.
157
- *
158
- * @since v0.6.2
159
- */
160
- export declare const FAST_BATCH_SETTLE_OPTIONS: Readonly<SettleOptions>;
161
- /**
162
- * @name buildPriorityFeeIxs
163
- * @description Build compute budget instructions for priority fee transactions.
164
- *
165
- * Returns an array of 0–2 `TransactionInstruction`s:
166
- * - `SetComputeUnitPrice` (if `priorityFeeMicroLamports > 0`)
167
- * - `SetComputeUnitLimit` (if `computeUnits` provided)
168
- *
169
- * The returned array is designed to be passed directly to
170
- * Anchor's `.preInstructions()` builder method.
171
- *
172
- * @param config - Priority fee configuration.
173
- * @returns Array of compute budget instructions (may be empty).
174
- *
175
- * @category Utils
176
- * @since v0.6.2
177
- *
178
- * @example
179
- * ```ts
180
- * const ixs = buildPriorityFeeIxs({
181
- * priorityFeeMicroLamports: 5000,
182
- * computeUnits: 100_000,
183
- * });
184
- *
185
- * await program.methods
186
- * .settleCalls(calls, hash)
187
- * .accounts({ ... })
188
- * .preInstructions(ixs)
189
- * .rpc({ skipPreflight: true });
190
- * ```
191
- */
192
- export declare function buildPriorityFeeIxs(config?: PriorityFeeConfig): TransactionInstruction[];
193
- /**
194
- * @name buildRpcOptions
195
- * @description Build Anchor `.rpc()` options from {@link SettleOptions}.
196
- *
197
- * @param opts - Settle options.
198
- * @returns Options object suitable for Anchor `.rpc(opts)`.
199
- *
200
- * @category Utils
201
- * @since v0.6.2
202
- * @internal
203
- */
204
- export declare function buildRpcOptions(opts?: SettleOptions): Record<string, unknown> | undefined;
205
- //# sourceMappingURL=priority-fee.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"priority-fee.d.ts","sourceRoot":"","sources":["../../../src/utils/priority-fee.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,iBAAiB,CAAC;AAMzB;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,OAAQ,CAAC;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,SAAU,CAAC;AAEpD;;;;;GAKG;AACH,eAAO,MAAM,kCAAkC,SAAU,CAAC;AA8B1D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAM/D;AAMD;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAE3C;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD;;;;;;;;OAQG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IAEjC;;;;;;;OAOG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;IAE9D;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAMD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,aAAa,CAKtD,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,aAAa,CAK5D,CAAC;AAMH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,CAAC,EAAE,iBAAiB,GACzB,sBAAsB,EAAE,CAwB1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,IAAI,CAAC,EAAE,aAAa,GACnB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAgBrC"}
@@ -1,179 +0,0 @@
1
- /**
2
- * @module utils/rpc-strategy
3
- * @description Dual-connection RPC strategy and idempotent ATA creation.
4
- *
5
- * Solves two interoperability problems:
6
- *
7
- * 1. **WebSocket 400 loop**: Some authenticated RPCs reject WebSocket
8
- * connections for SPL token operations. This module exposes a
9
- * dual-connection strategy: primary RPC for SAP program calls,
10
- * fallback public RPC for token operations.
11
- *
12
- * 2. **Idempotent ATA creation**: Wraps `getOrCreateAssociatedTokenAccount`
13
- * with retries so "account already exists" doesn't surface as a
14
- * hard error.
15
- *
16
- * @category Utils
17
- * @since v0.6.0
18
- */
19
- import { Connection, type Commitment, PublicKey, type TransactionSignature } from "@solana/web3.js";
20
- /**
21
- * @interface RpcConfig
22
- * @description Configuration for dual-connection RPC strategy.
23
- * @category Utils
24
- * @since v0.6.0
25
- */
26
- export interface RpcConfig {
27
- /** Primary RPC URL (for SAP program calls). */
28
- readonly primaryUrl: string;
29
- /** Fallback RPC URL (for SPL token ops, public RPCs). */
30
- readonly fallbackUrl?: string;
31
- /** Commitment level. */
32
- readonly commitment?: Commitment;
33
- }
34
- /**
35
- * @interface DualConnection
36
- * @description Dual RPC connections: primary for SAP, fallback for tokens.
37
- * @category Utils
38
- * @since v0.6.0
39
- */
40
- export interface DualConnection {
41
- /** Primary connection for SAP program calls. */
42
- readonly primary: Connection;
43
- /** Fallback connection for SPL token operations. */
44
- readonly fallback: Connection;
45
- }
46
- /**
47
- * @name getRpcUrl
48
- * @description Get the primary RPC URL from environment or config.
49
- *
50
- * Resolution order:
51
- * 1. Explicit `config.primaryUrl`
52
- * 2. `SOLANA_RPC_URL` env var
53
- * 3. Cluster-appropriate public RPC
54
- *
55
- * @param config - Optional RPC configuration.
56
- * @param cluster - Cluster hint (defaults to "mainnet-beta").
57
- * @returns The resolved primary RPC URL.
58
- *
59
- * @category Utils
60
- * @since v0.6.0
61
- */
62
- export declare function getRpcUrl(config?: Partial<RpcConfig>, cluster?: string): string;
63
- /**
64
- * @name getFallbackRpcUrl
65
- * @description Get the fallback RPC URL for SPL token operations.
66
- *
67
- * This avoids the WebSocket-400 loop when the primary RPC is
68
- * an authenticated endpoint that rejects token-related WebSocket
69
- * subscriptions.
70
- *
71
- * @param config - Optional RPC configuration.
72
- * @param cluster - Cluster hint (defaults to "mainnet-beta").
73
- * @returns The resolved fallback RPC URL.
74
- *
75
- * @category Utils
76
- * @since v0.6.0
77
- */
78
- export declare function getFallbackRpcUrl(config?: Partial<RpcConfig>, cluster?: string): string;
79
- /**
80
- * @name createDualConnection
81
- * @description Create a dual-connection pair: primary for SAP program calls,
82
- * fallback for SPL token operations.
83
- *
84
- * @param config - RPC configuration.
85
- * @param cluster - Cluster hint.
86
- * @returns A {@link DualConnection} with both connections.
87
- *
88
- * @category Utils
89
- * @since v0.6.0
90
- *
91
- * @example
92
- * ```ts
93
- * const { primary, fallback } = createDualConnection({
94
- * primaryUrl: "https://my-rpc.example.com",
95
- * }, "mainnet-beta");
96
- *
97
- * // Use primary for SAP calls
98
- * const provider = new AnchorProvider(primary, wallet, {});
99
- *
100
- * // Use fallback for SPL token account creation
101
- * const ata = await getOrCreateATA(fallback, mint, owner);
102
- * ```
103
- */
104
- export declare function createDualConnection(config: Partial<RpcConfig>, cluster?: string): DualConnection;
105
- /**
106
- * @interface AtaResult
107
- * @description Result of idempotent ATA creation attempt.
108
- * @category Utils
109
- * @since v0.6.0
110
- */
111
- export interface AtaResult {
112
- /** The ATA public key (exists or newly created). */
113
- readonly address: PublicKey;
114
- /** Whether the ATA already existed. */
115
- readonly existed: boolean;
116
- /** Transaction signature (only if newly created). */
117
- readonly txSignature?: TransactionSignature;
118
- }
119
- /**
120
- * @name findATA
121
- * @description Derive the Associated Token Account address.
122
- * Uses the standard ATA PDA derivation without importing the full
123
- * `@solana/spl-token` package.
124
- *
125
- * @param owner - The token account owner.
126
- * @param mint - The token mint.
127
- * @param programId - Token program ID (defaults to TOKEN_PROGRAM_ID).
128
- * @returns The derived ATA public key.
129
- *
130
- * @category Utils
131
- * @since v0.6.0
132
- */
133
- export declare function findATA(owner: PublicKey, mint: PublicKey, programId?: PublicKey): PublicKey;
134
- /**
135
- * @name classifyAnchorError
136
- * @description Convert an Anchor error code into a friendly, actionable message.
137
- *
138
- * @param errorCode - The numeric Anchor error code.
139
- * @returns A human-readable error message, or a generic message for unknown codes.
140
- *
141
- * @category Utils
142
- * @since v0.6.0
143
- *
144
- * @example
145
- * ```ts
146
- * try {
147
- * await client.escrow.create(...);
148
- * } catch (err) {
149
- * const code = extractAnchorErrorCode(err);
150
- * if (code !== null) {
151
- * console.error(classifyAnchorError(code));
152
- * }
153
- * }
154
- * ```
155
- */
156
- export declare function classifyAnchorError(errorCode: number): string;
157
- /**
158
- * @name extractAnchorErrorCode
159
- * @description Attempt to extract an Anchor error code from an Error object.
160
- *
161
- * Anchor errors typically have the structure `{ code: number, msg: string }`.
162
- * This function handles both the direct `error.code` pattern and the
163
- * `error.error.errorCode.number` nested pattern.
164
- *
165
- * @param err - The caught error object.
166
- * @returns The numeric error code, or `null` if not an Anchor error.
167
- *
168
- * @category Utils
169
- * @since v0.6.0
170
- */
171
- export declare function extractAnchorErrorCode(err: unknown): number | null;
172
- export interface SafeRpcOptions {
173
- readonly rpcOpts?: Parameters<typeof Object>[0];
174
- readonly maxAttempts?: number;
175
- readonly skipRetry?: boolean;
176
- readonly idempotencyHint?: string;
177
- }
178
- export declare function safeRpc(builder: any, label: string, opts?: SafeRpcOptions): Promise<TransactionSignature>;
179
- //# sourceMappingURL=rpc-strategy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rpc-strategy.d.ts","sourceRoot":"","sources":["../../../src/utils/rpc-strategy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,UAAU,EACV,KAAK,UAAU,EACf,SAAS,EACT,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AAazB;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,+CAA+C;IAC/C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,yDAAyD;IACzD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,wBAAwB;IACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;CAClC;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,gDAAgD;IAChD,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,oDAAoD;IACpD,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;CAC/B;AAiBD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CACvB,MAAM,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,EAC3B,OAAO,GAAE,MAAuB,GAC/B,MAAM,CASR;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,EAC3B,OAAO,GAAE,MAAuB,GAC/B,MAAM,CAWR;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,EAC1B,OAAO,GAAE,MAAuB,GAC/B,cAAc,CAShB;AAMD;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,oDAAoD;IACpD,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,uCAAuC;IACvC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,qDAAqD;IACrD,QAAQ,CAAC,WAAW,CAAC,EAAE,oBAAoB,CAAC;CAC7C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CACrB,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,SAAS,EACf,SAAS,GAAE,SAAwE,GAClF,SAAS,CAUX;AAiCD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAK7D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAyBlE;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAGD,wBAAsB,OAAO,CAC3B,OAAO,EAAE,GAAG,EACZ,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,cAAc,GACpB,OAAO,CAAC,oBAAoB,CAAC,CAqD/B"}