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

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 (151) hide show
  1. package/dist/cjs/client.js +1 -1
  2. package/dist/cjs/client.js.map +1 -1
  3. package/dist/esm/client.js +1 -1
  4. package/dist/esm/client.js.map +1 -1
  5. package/package.json +1 -1
  6. package/dist/esm/instructions/memory.d.ts +0 -8
  7. package/dist/esm/instructions/memory.d.ts.map +0 -1
  8. package/dist/esm/instructions/memory.js +0 -234
  9. package/dist/esm/instructions/memory.js.map +0 -1
  10. package/dist/types/constants/addresses.d.ts +0 -117
  11. package/dist/types/constants/addresses.d.ts.map +0 -1
  12. package/dist/types/constants/index.d.ts +0 -31
  13. package/dist/types/constants/index.d.ts.map +0 -1
  14. package/dist/types/constants/limits.d.ts +0 -149
  15. package/dist/types/constants/limits.d.ts.map +0 -1
  16. package/dist/types/constants/network.d.ts +0 -81
  17. package/dist/types/constants/network.d.ts.map +0 -1
  18. package/dist/types/constants/payments.d.ts +0 -121
  19. package/dist/types/constants/payments.d.ts.map +0 -1
  20. package/dist/types/constants/programs.d.ts +0 -69
  21. package/dist/types/constants/programs.d.ts.map +0 -1
  22. package/dist/types/constants/seeds.d.ts +0 -82
  23. package/dist/types/constants/seeds.d.ts.map +0 -1
  24. package/dist/types/core/client.d.ts +0 -467
  25. package/dist/types/core/client.d.ts.map +0 -1
  26. package/dist/types/core/connection.d.ts +0 -305
  27. package/dist/types/core/connection.d.ts.map +0 -1
  28. package/dist/types/core/index.d.ts +0 -20
  29. package/dist/types/core/index.d.ts.map +0 -1
  30. package/dist/types/errors/index.d.ts +0 -335
  31. package/dist/types/errors/index.d.ts.map +0 -1
  32. package/dist/types/events/geyser.d.ts +0 -150
  33. package/dist/types/events/geyser.d.ts.map +0 -1
  34. package/dist/types/events/index.d.ts +0 -248
  35. package/dist/types/events/index.d.ts.map +0 -1
  36. package/dist/types/idl/index.d.ts +0 -70
  37. package/dist/types/idl/index.d.ts.map +0 -1
  38. package/dist/types/index.d.ts +0 -86
  39. package/dist/types/index.d.ts.map +0 -1
  40. package/dist/types/modules/agent.d.ts +0 -156
  41. package/dist/types/modules/agent.d.ts.map +0 -1
  42. package/dist/types/modules/attestation.d.ts +0 -96
  43. package/dist/types/modules/attestation.d.ts.map +0 -1
  44. package/dist/types/modules/base.d.ts +0 -215
  45. package/dist/types/modules/base.d.ts.map +0 -1
  46. package/dist/types/modules/escrow-v2.d.ts +0 -285
  47. package/dist/types/modules/escrow-v2.d.ts.map +0 -1
  48. package/dist/types/modules/feedback.d.ts +0 -105
  49. package/dist/types/modules/feedback.d.ts.map +0 -1
  50. package/dist/types/modules/index.d.ts +0 -27
  51. package/dist/types/modules/index.d.ts.map +0 -1
  52. package/dist/types/modules/indexing.d.ts +0 -200
  53. package/dist/types/modules/indexing.d.ts.map +0 -1
  54. package/dist/types/modules/ledger.d.ts +0 -150
  55. package/dist/types/modules/ledger.d.ts.map +0 -1
  56. package/dist/types/modules/receipt.d.ts +0 -91
  57. package/dist/types/modules/receipt.d.ts.map +0 -1
  58. package/dist/types/modules/staking.d.ts +0 -51
  59. package/dist/types/modules/staking.d.ts.map +0 -1
  60. package/dist/types/modules/subscription.d.ts +0 -33
  61. package/dist/types/modules/subscription.d.ts.map +0 -1
  62. package/dist/types/modules/tools.d.ts +0 -172
  63. package/dist/types/modules/tools.d.ts.map +0 -1
  64. package/dist/types/modules/vault.d.ts +0 -240
  65. package/dist/types/modules/vault.d.ts.map +0 -1
  66. package/dist/types/parser/client.d.ts +0 -123
  67. package/dist/types/parser/client.d.ts.map +0 -1
  68. package/dist/types/parser/complete.d.ts +0 -90
  69. package/dist/types/parser/complete.d.ts.map +0 -1
  70. package/dist/types/parser/index.d.ts +0 -40
  71. package/dist/types/parser/index.d.ts.map +0 -1
  72. package/dist/types/parser/inner.d.ts +0 -114
  73. package/dist/types/parser/inner.d.ts.map +0 -1
  74. package/dist/types/parser/instructions.d.ts +0 -76
  75. package/dist/types/parser/instructions.d.ts.map +0 -1
  76. package/dist/types/parser/transaction.d.ts +0 -77
  77. package/dist/types/parser/transaction.d.ts.map +0 -1
  78. package/dist/types/parser/types.d.ts +0 -154
  79. package/dist/types/parser/types.d.ts.map +0 -1
  80. package/dist/types/pda/index.d.ts +0 -527
  81. package/dist/types/pda/index.d.ts.map +0 -1
  82. package/dist/types/plugin/index.d.ts +0 -171
  83. package/dist/types/plugin/index.d.ts.map +0 -1
  84. package/dist/types/plugin/protocols.d.ts +0 -152
  85. package/dist/types/plugin/protocols.d.ts.map +0 -1
  86. package/dist/types/plugin/schemas.d.ts +0 -829
  87. package/dist/types/plugin/schemas.d.ts.map +0 -1
  88. package/dist/types/postgres/adapter.d.ts +0 -355
  89. package/dist/types/postgres/adapter.d.ts.map +0 -1
  90. package/dist/types/postgres/index.d.ts +0 -24
  91. package/dist/types/postgres/index.d.ts.map +0 -1
  92. package/dist/types/postgres/serializers.d.ts +0 -30
  93. package/dist/types/postgres/serializers.d.ts.map +0 -1
  94. package/dist/types/postgres/sync.d.ts +0 -156
  95. package/dist/types/postgres/sync.d.ts.map +0 -1
  96. package/dist/types/postgres/types.d.ts +0 -167
  97. package/dist/types/postgres/types.d.ts.map +0 -1
  98. package/dist/types/registries/builder.d.ts +0 -333
  99. package/dist/types/registries/builder.d.ts.map +0 -1
  100. package/dist/types/registries/discovery.d.ts +0 -333
  101. package/dist/types/registries/discovery.d.ts.map +0 -1
  102. package/dist/types/registries/fairscale.d.ts +0 -680
  103. package/dist/types/registries/fairscale.d.ts.map +0 -1
  104. package/dist/types/registries/index.d.ts +0 -52
  105. package/dist/types/registries/index.d.ts.map +0 -1
  106. package/dist/types/registries/metaplex-bridge.d.ts +0 -488
  107. package/dist/types/registries/metaplex-bridge.d.ts.map +0 -1
  108. package/dist/types/registries/session.d.ts +0 -317
  109. package/dist/types/registries/session.d.ts.map +0 -1
  110. package/dist/types/registries/x402.d.ts +0 -523
  111. package/dist/types/registries/x402.d.ts.map +0 -1
  112. package/dist/types/types/accounts.d.ts +0 -817
  113. package/dist/types/types/accounts.d.ts.map +0 -1
  114. package/dist/types/types/common.d.ts +0 -166
  115. package/dist/types/types/common.d.ts.map +0 -1
  116. package/dist/types/types/endpoint.d.ts +0 -161
  117. package/dist/types/types/endpoint.d.ts.map +0 -1
  118. package/dist/types/types/enums.d.ts +0 -353
  119. package/dist/types/types/enums.d.ts.map +0 -1
  120. package/dist/types/types/index.d.ts +0 -29
  121. package/dist/types/types/index.d.ts.map +0 -1
  122. package/dist/types/types/instructions.d.ts +0 -400
  123. package/dist/types/types/instructions.d.ts.map +0 -1
  124. package/dist/types/utils/anchor-errors.d.ts +0 -61
  125. package/dist/types/utils/anchor-errors.d.ts.map +0 -1
  126. package/dist/types/utils/endpoint-validator.d.ts +0 -110
  127. package/dist/types/utils/endpoint-validator.d.ts.map +0 -1
  128. package/dist/types/utils/escrow-validation.d.ts +0 -145
  129. package/dist/types/utils/escrow-validation.d.ts.map +0 -1
  130. package/dist/types/utils/hash.d.ts +0 -75
  131. package/dist/types/utils/hash.d.ts.map +0 -1
  132. package/dist/types/utils/index.d.ts +0 -36
  133. package/dist/types/utils/index.d.ts.map +0 -1
  134. package/dist/types/utils/merchant-validator.d.ts +0 -176
  135. package/dist/types/utils/merchant-validator.d.ts.map +0 -1
  136. package/dist/types/utils/network-normalizer.d.ts +0 -120
  137. package/dist/types/utils/network-normalizer.d.ts.map +0 -1
  138. package/dist/types/utils/priority-fee.d.ts +0 -205
  139. package/dist/types/utils/priority-fee.d.ts.map +0 -1
  140. package/dist/types/utils/rpc-strategy.d.ts +0 -179
  141. package/dist/types/utils/rpc-strategy.d.ts.map +0 -1
  142. package/dist/types/utils/schemas.d.ts +0 -351
  143. package/dist/types/utils/schemas.d.ts.map +0 -1
  144. package/dist/types/utils/serialization.d.ts +0 -69
  145. package/dist/types/utils/serialization.d.ts.map +0 -1
  146. package/dist/types/utils/validation.d.ts +0 -29
  147. package/dist/types/utils/validation.d.ts.map +0 -1
  148. package/dist/types/utils/volume-curve.d.ts +0 -60
  149. package/dist/types/utils/volume-curve.d.ts.map +0 -1
  150. package/dist/types/utils/x402-direct.d.ts +0 -114
  151. package/dist/types/utils/x402-direct.d.ts.map +0 -1
@@ -1,305 +0,0 @@
1
- /**
2
- * @module core/connection
3
- * @description RPC connection factory for SAP v2 SDK.
4
- *
5
- * Provides a high-level, synapse-client-sdk–compatible entry point
6
- * for creating {@link SapClient} instances from an RPC URL and wallet.
7
- *
8
- * @category Core
9
- * @since v0.1.0
10
- *
11
- * @example
12
- * ```ts
13
- * import { SapConnection } from "@synapse-sap/sdk";
14
- *
15
- * // Quick start — RPC URL + Keypair
16
- * const sap = SapConnection.fromKeypair("https://api.devnet.solana.com", keypair);
17
- * const agent = await sap.client.agent.fetch();
18
- *
19
- * // Or build step-by-step
20
- * const conn = new SapConnection({
21
- * rpcUrl: "https://us-1-mainnet.oobeprotocol.ai/rpc?api_key=xxx",
22
- * cluster: "mainnet-beta",
23
- * commitment: "confirmed",
24
- * });
25
- * const client = conn.createClient(wallet);
26
- * ```
27
- */
28
- import { Connection, type Commitment, Keypair, type PublicKey, type Transaction, type VersionedTransaction } from "@solana/web3.js";
29
- import { SapClient } from "./client";
30
- /**
31
- * @interface SapWallet
32
- * @description Minimal wallet/signer interface compatible with
33
- * Anchor's `AnchorProvider`. Avoids importing `Wallet` from
34
- * `@coral-xyz/anchor` which is absent in ESM builds.
35
- * @category Core
36
- * @since v0.4.1
37
- */
38
- export interface SapWallet {
39
- readonly publicKey: PublicKey;
40
- signTransaction<T extends Transaction | VersionedTransaction>(tx: T): Promise<T>;
41
- signAllTransactions<T extends Transaction | VersionedTransaction>(txs: T[]): Promise<T[]>;
42
- }
43
- /**
44
- * @name KeypairWallet
45
- * @description Simple wallet wrapper around a `Keypair`.
46
- * Drop-in replacement for Anchor's `NodeWallet` / `Wallet` class.
47
- * @category Core
48
- * @since v0.4.1
49
- */
50
- export declare class KeypairWallet implements SapWallet {
51
- readonly payer: Keypair;
52
- readonly publicKey: PublicKey;
53
- constructor(payer: Keypair);
54
- signTransaction<T extends Transaction | VersionedTransaction>(tx: T): Promise<T>;
55
- signAllTransactions<T extends Transaction | VersionedTransaction>(txs: T[]): Promise<T[]>;
56
- }
57
- /**
58
- * @name SapCluster
59
- * @description Supported Solana cluster names used to select the RPC endpoint
60
- * and corresponding SAP program ID.
61
- * @category Core
62
- * @since v0.1.0
63
- */
64
- export type SapCluster = "mainnet-beta" | "devnet" | "localnet";
65
- /**
66
- * @interface SapConnectionConfig
67
- * @description Configuration object used to initialise a {@link SapConnection}.
68
- * @category Core
69
- * @since v0.1.0
70
- * @see {@link SapConnection}
71
- */
72
- export interface SapConnectionConfig {
73
- /**
74
- * @property {string} rpcUrl
75
- * @description Solana JSON-RPC endpoint URL (e.g. `https://api.devnet.solana.com`).
76
- */
77
- rpcUrl: string;
78
- /**
79
- * @property {string} [wsUrl]
80
- * @description WebSocket endpoint URL. When omitted the SDK derives it
81
- * automatically from {@link rpcUrl} by swapping the protocol scheme.
82
- */
83
- wsUrl?: string;
84
- /**
85
- * @property {Commitment} [commitment]
86
- * @description Commitment level for queries and transaction confirmations.
87
- * Defaults to `"confirmed"` when not provided.
88
- */
89
- commitment?: Commitment;
90
- /**
91
- * @property {SapCluster} [cluster]
92
- * @description Cluster hint (`mainnet-beta` | `devnet` | `localnet`).
93
- * When omitted the SDK infers it from {@link rpcUrl} via
94
- * {@link SapConnection.detectCluster}.
95
- */
96
- cluster?: SapCluster;
97
- }
98
- /**
99
- * @name SapConnection
100
- * @description Lightweight RPC connection wrapper that creates
101
- * properly-configured {@link SapClient} instances.
102
- *
103
- * Compatible with the `synapse-client-sdk` connection model:
104
- * start from an RPC URL, attach a wallet, get a typed client.
105
- *
106
- * @category Core
107
- * @since v0.1.0
108
- * @see {@link SapClient}
109
- * @see {@link SapConnectionConfig}
110
- *
111
- * @example
112
- * ```ts
113
- * // Factory shortcut for devnet
114
- * const conn = SapConnection.devnet();
115
- * const client = conn.createClient(wallet);
116
- *
117
- * // One-liner with Keypair
118
- * const { client } = SapConnection.fromKeypair(
119
- * "https://api.devnet.solana.com",
120
- * keypair,
121
- * );
122
- * ```
123
- */
124
- export declare class SapConnection {
125
- /**
126
- * @readonly
127
- * @description Raw Solana {@link Connection}. Exposed for advanced
128
- * use-cases that need direct RPC access.
129
- */
130
- readonly connection: Connection;
131
- /**
132
- * @readonly
133
- * @description The resolved Solana cluster for this connection,
134
- * either explicitly provided or auto-detected from the RPC URL.
135
- */
136
- readonly cluster: SapCluster;
137
- /**
138
- * @readonly
139
- * @description Commitment level used for all queries and
140
- * transaction confirmations on this connection.
141
- */
142
- readonly commitment: Commitment;
143
- /**
144
- * @readonly
145
- * @description The SAP on-chain program {@link PublicKey} resolved
146
- * for the current {@link cluster}.
147
- * @see {@link SapConnection.programIdForCluster}
148
- */
149
- readonly programId: PublicKey;
150
- constructor(config: SapConnectionConfig);
151
- /**
152
- * Create a {@link SapConnection} for **devnet** with sensible defaults.
153
- *
154
- * @static
155
- * @param {Commitment} [commitment="confirmed"] — Commitment level.
156
- * @returns {SapConnection} A connection targeting Solana devnet.
157
- * @since v0.1.0
158
- *
159
- * @example
160
- * ```ts
161
- * const conn = SapConnection.devnet();
162
- * ```
163
- */
164
- static devnet(commitment?: Commitment): SapConnection;
165
- /**
166
- * Create a {@link SapConnection} for **mainnet-beta** with sensible defaults.
167
- *
168
- * @static
169
- * @param {string} [rpcUrl="https://api.mainnet-beta.solana.com"] — Custom RPC URL.
170
- * @param {Commitment} [commitment="confirmed"] — Commitment level.
171
- * @returns {SapConnection} A connection targeting Solana mainnet-beta.
172
- * @since v0.1.0
173
- *
174
- * @example
175
- * ```ts
176
- * const conn = SapConnection.mainnet("https://my-rpc.example.com");
177
- * ```
178
- */
179
- static mainnet(rpcUrl?: string, commitment?: Commitment): SapConnection;
180
- /**
181
- * Create a {@link SapConnection} for **localnet** (`localhost:8899`).
182
- *
183
- * @static
184
- * @param {Commitment} [commitment="confirmed"] — Commitment level.
185
- * @returns {SapConnection} A connection targeting a local validator.
186
- * @since v0.1.0
187
- *
188
- * @example
189
- * ```ts
190
- * const conn = SapConnection.localnet();
191
- * ```
192
- */
193
- static localnet(commitment?: Commitment): SapConnection;
194
- /**
195
- * One-liner: create a {@link SapConnection} + {@link SapClient} from
196
- * an RPC URL and a `Keypair`. Perfect for scripts and CLI tools.
197
- *
198
- * @static
199
- * @param {string} rpcUrl — Solana JSON-RPC endpoint.
200
- * @param {Keypair} keypair — Signer keypair.
201
- * @param {object} [opts] — Optional overrides.
202
- * @param {Commitment} [opts.commitment] — Commitment level.
203
- * @param {SapCluster} [opts.cluster] — Explicit cluster hint.
204
- * @returns {SapConnection & { readonly client: SapClient }} Connection with an attached client.
205
- * @since v0.1.0
206
- *
207
- * @example
208
- * ```ts
209
- * const { client, connection } = SapConnection.fromKeypair(
210
- * "https://api.devnet.solana.com",
211
- * Keypair.generate(),
212
- * );
213
- * ```
214
- */
215
- static fromKeypair(rpcUrl: string, keypair: Keypair, opts?: {
216
- commitment?: Commitment;
217
- cluster?: SapCluster;
218
- }): SapConnection & {
219
- readonly client: SapClient;
220
- };
221
- /**
222
- * Create a {@link SapClient} from a {@link SapWallet} (signer).
223
- *
224
- * @param {SapWallet} wallet — A wallet/signer implementing {@link SapWallet}.
225
- * @returns {SapClient} A fully-configured SAP client.
226
- * @since v0.1.0
227
- *
228
- * @example
229
- * ```ts
230
- * const client = conn.createClient(new KeypairWallet(keypair));
231
- * ```
232
- */
233
- createClient(wallet: SapWallet): SapClient;
234
- /**
235
- * Create a {@link SapClient} from a raw {@link Keypair}.
236
- *
237
- * @param {Keypair} keypair — The signer keypair.
238
- * @returns {SapClient} A fully-configured SAP client.
239
- * @since v0.1.0
240
- *
241
- * @example
242
- * ```ts
243
- * const client = conn.fromKeypair(Keypair.generate());
244
- * ```
245
- */
246
- fromKeypair(keypair: Keypair): SapClient;
247
- /**
248
- * Request an airdrop (devnet / localnet only).
249
- *
250
- * @param {PublicKey} to — Recipient public key.
251
- * @param {number} solAmount — Amount of SOL to airdrop.
252
- * @returns {Promise<string>} The confirmed transaction signature.
253
- * @throws {Error} If the airdrop request or confirmation fails (e.g. on mainnet).
254
- * @since v0.1.0
255
- *
256
- * @example
257
- * ```ts
258
- * const sig = await conn.airdrop(wallet.publicKey, 2);
259
- * ```
260
- */
261
- airdrop(to: PublicKey, solAmount: number): Promise<string>;
262
- /**
263
- * Get the SOL balance of an address in **lamports**.
264
- *
265
- * @param {PublicKey} address — The account to query.
266
- * @returns {Promise<number>} Balance in lamports.
267
- * @since v0.1.0
268
- */
269
- getBalance(address: PublicKey): Promise<number>;
270
- /**
271
- * Get the SOL balance of an address in **SOL** (human-readable).
272
- *
273
- * @param {PublicKey} address — The account to query.
274
- * @returns {Promise<number>} Balance in SOL.
275
- * @since v0.1.0
276
- *
277
- * @example
278
- * ```ts
279
- * const sol = await conn.getBalanceSol(wallet.publicKey);
280
- * console.log(`Balance: ${sol} SOL`);
281
- * ```
282
- */
283
- getBalanceSol(address: PublicKey): Promise<number>;
284
- /**
285
- * Infer the {@link SapCluster} from an RPC URL by inspecting
286
- * well-known substrings (`devnet`, `localhost`, `:8899`).
287
- *
288
- * @static
289
- * @param {string} rpcUrl — The RPC endpoint to inspect.
290
- * @returns {SapCluster} The detected cluster, defaulting to `"mainnet-beta"`.
291
- * @since v0.1.0
292
- */
293
- static detectCluster(rpcUrl: string): SapCluster;
294
- /**
295
- * Map a {@link SapCluster} to the canonical SAP on-chain program ID.
296
- *
297
- * @static
298
- * @param {SapCluster} cluster — Target cluster.
299
- * @returns {PublicKey} The program {@link PublicKey} for the given cluster.
300
- * @since v0.1.0
301
- * @see {@link SAP_PROGRAM_ID}
302
- */
303
- static programIdForCluster(cluster: SapCluster): PublicKey;
304
- }
305
- //# sourceMappingURL=connection.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/core/connection.ts"],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OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IAIrD;;;;;;;;;;;;OAYG;IACG,aAAa,CAAC,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IASxD;;;;;;;;OAQG;IACH,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU;IAYhD;;;;;;;;OAQG;IACH,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS;CAY3D"}
@@ -1,20 +0,0 @@
1
- /**
2
- * @module core
3
- * @description Core infrastructure — client creation and RPC connection.
4
- *
5
- * @example
6
- * ```ts
7
- * import { SapClient, SapConnection } from "@synapse-sap/sdk";
8
- *
9
- * // From Anchor provider
10
- * const client = SapClient.from(provider);
11
- *
12
- * // From RPC URL + keypair (synapse-client-sdk compatible)
13
- * const conn = SapConnection.devnet();
14
- * const client2 = conn.fromKeypair(keypair);
15
- * ```
16
- */
17
- export { SapClient } from "./client";
18
- export { SapConnection, KeypairWallet } from "./connection";
19
- export type { SapCluster, SapConnectionConfig, SapWallet } from "./connection";
20
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC5D,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
@@ -1,335 +0,0 @@
1
- /**
2
- * @module errors
3
- * @description Typed error classes for the SAP v2 SDK.
4
- *
5
- * All SDK errors extend {@link SapError} to allow catch-all handling,
6
- * while concrete subclasses enable fine-grained error matching.
7
- *
8
- * @category Errors
9
- * @since v0.1.0
10
- *
11
- * @example
12
- * ```ts
13
- * import { SapError, SapRpcError, SapAccountNotFoundError } from "@synapse-sap/sdk/errors";
14
- *
15
- * try {
16
- * const agent = await client.agent.fetch();
17
- * } catch (err) {
18
- * if (err instanceof SapAccountNotFoundError) {
19
- * console.log("Agent not registered yet");
20
- * } else if (err instanceof SapRpcError) {
21
- * console.error("RPC failure:", err.rpcCode);
22
- * } else if (err instanceof SapError) {
23
- * console.error("SAP error:", err.message);
24
- * }
25
- * }
26
- * ```
27
- *
28
- * @see {@link SapError}
29
- * @see {@link SapValidationError}
30
- * @see {@link SapRpcError}
31
- * @see {@link SapAccountNotFoundError}
32
- * @see {@link SapTimeoutError}
33
- * @see {@link SapPermissionError}
34
- */
35
- /**
36
- * @name SapError
37
- * @description Base class for all SAP SDK errors.
38
- *
39
- * Extends `Error` and sets `name` automatically so `instanceof`
40
- * checks work correctly in both CJS and ESM environments.
41
- *
42
- * @category Errors
43
- * @since v0.1.0
44
- * @extends {Error}
45
- *
46
- * @example
47
- * ```ts
48
- * try {
49
- * await client.agent.fetch();
50
- * } catch (err) {
51
- * if (err instanceof SapError) {
52
- * console.error(`[${err.code}] ${err.message}`);
53
- * }
54
- * }
55
- * ```
56
- *
57
- * @see {@link SapValidationError}
58
- * @see {@link SapRpcError}
59
- * @see {@link SapAccountNotFoundError}
60
- * @see {@link SapTimeoutError}
61
- * @see {@link SapPermissionError}
62
- */
63
- export declare class SapError extends Error {
64
- /**
65
- * @description Machine-readable error code for programmatic handling.
66
- * @readonly
67
- */
68
- readonly code: string;
69
- /**
70
- * @param message - A human-readable description of the error.
71
- * @param code - Machine-readable error code (defaults to `"SAP_ERROR"`).
72
- */
73
- constructor(message: string, code?: string);
74
- }
75
- /**
76
- * @name SapValidationError
77
- * @description Thrown when SDK-side input validation fails before sending a
78
- * transaction or making an RPC call.
79
- *
80
- * @category Errors
81
- * @since v0.1.0
82
- * @extends {SapError}
83
- *
84
- * @example
85
- * ```ts
86
- * try {
87
- * await client.agent.register({ name: "" });
88
- * } catch (err) {
89
- * if (err instanceof SapValidationError) {
90
- * console.error(`Validation failed on field "${err.field}": ${err.message}`);
91
- * }
92
- * }
93
- * ```
94
- *
95
- * @see {@link SapError}
96
- */
97
- export declare class SapValidationError extends SapError {
98
- /**
99
- * @description Field or parameter that failed validation (if applicable).
100
- * @readonly
101
- */
102
- readonly field?: string;
103
- /**
104
- * @param message - A human-readable description of the validation failure.
105
- * @param field - The name of the field or parameter that failed validation.
106
- */
107
- constructor(message: string, field?: string);
108
- }
109
- /**
110
- * @name SapRpcError
111
- * @description Wraps Solana RPC or Anchor transaction errors with additional
112
- * context (error code, logs).
113
- *
114
- * @category Errors
115
- * @since v0.1.0
116
- * @extends {SapError}
117
- *
118
- * @example
119
- * ```ts
120
- * try {
121
- * await client.agent.register(params);
122
- * } catch (err) {
123
- * if (err instanceof SapRpcError) {
124
- * console.error(`RPC error ${err.rpcCode}: ${err.message}`);
125
- * err.logs?.forEach((log) => console.debug(log));
126
- * }
127
- * }
128
- * ```
129
- *
130
- * @see {@link SapRpcError.fromAnchor}
131
- * @see {@link SapError}
132
- */
133
- export declare class SapRpcError extends SapError {
134
- /**
135
- * @description Anchor / program error code, if available.
136
- * @readonly
137
- */
138
- readonly rpcCode?: number;
139
- /**
140
- * @description Transaction logs returned by the RPC node.
141
- * @readonly
142
- */
143
- readonly logs?: readonly string[];
144
- /**
145
- * @param message - A human-readable description of the RPC or transaction error.
146
- * @param opts - Optional additional context.
147
- * @param opts.rpcCode - Anchor or Solana program error code.
148
- * @param opts.logs - Raw transaction logs from the RPC node.
149
- */
150
- constructor(message: string, opts?: {
151
- rpcCode?: number;
152
- logs?: readonly string[];
153
- });
154
- /**
155
- * @static
156
- * @description Create a {@link SapRpcError} from an Anchor-style error object.
157
- * Extracts `code` and `logs` automatically from the Anchor error shape.
158
- *
159
- * @param err - The raw Anchor or Solana error object.
160
- * @returns A new {@link SapRpcError} populated with extracted code, logs, and message.
161
- *
162
- * @example
163
- * ```ts
164
- * try {
165
- * await program.methods.registerAgent(args).rpc();
166
- * } catch (raw) {
167
- * throw SapRpcError.fromAnchor(raw);
168
- * }
169
- * ```
170
- *
171
- * @see {@link SapRpcError}
172
- */
173
- static fromAnchor(err: any): SapRpcError;
174
- }
175
- /**
176
- * @name SapAccountNotFoundError
177
- * @description Thrown when an expected on-chain account does not exist or has
178
- * been closed.
179
- *
180
- * @category Errors
181
- * @since v0.1.0
182
- * @extends {SapError}
183
- *
184
- * @example
185
- * ```ts
186
- * try {
187
- * const agent = await client.agent.fetch(agentPda);
188
- * } catch (err) {
189
- * if (err instanceof SapAccountNotFoundError) {
190
- * console.warn(`Missing ${err.accountType ?? "account"}: ${err.address}`);
191
- * }
192
- * }
193
- * ```
194
- *
195
- * @see {@link SapError}
196
- */
197
- export declare class SapAccountNotFoundError extends SapError {
198
- /**
199
- * @description The base-58 encoded account address that was not found.
200
- * @readonly
201
- */
202
- readonly address: string;
203
- /**
204
- * @description The expected account type (e.g. `"AgentRecord"`, `"VaultAccount"`).
205
- * @readonly
206
- */
207
- readonly accountType?: string;
208
- /**
209
- * @param address - The base-58 encoded address of the missing account.
210
- * @param accountType - Optional label for the expected account type.
211
- */
212
- constructor(address: string, accountType?: string);
213
- }
214
- /**
215
- * @name SapTimeoutError
216
- * @description Thrown when an operation (e.g., transaction confirmation) exceeds
217
- * the configured timeout.
218
- *
219
- * @category Errors
220
- * @since v0.1.0
221
- * @extends {SapError}
222
- *
223
- * @example
224
- * ```ts
225
- * try {
226
- * await client.agent.register(params, { timeoutMs: 30_000 });
227
- * } catch (err) {
228
- * if (err instanceof SapTimeoutError) {
229
- * console.error(`Timed out after ${err.timeoutMs}ms: ${err.message}`);
230
- * }
231
- * }
232
- * ```
233
- *
234
- * @see {@link SapError}
235
- */
236
- export declare class SapTimeoutError extends SapError {
237
- /**
238
- * @description Timeout duration in milliseconds that was exceeded.
239
- * @readonly
240
- */
241
- readonly timeoutMs: number;
242
- /**
243
- * @param message - A human-readable description of the timeout.
244
- * @param timeoutMs - The timeout threshold in milliseconds.
245
- */
246
- constructor(message: string, timeoutMs: number);
247
- }
248
- /**
249
- * @name SapPermissionError
250
- * @description Thrown when the current wallet lacks the required permission
251
- * (authority, delegate, etc.) for an operation.
252
- *
253
- * @category Errors
254
- * @since v0.1.0
255
- * @extends {SapError}
256
- *
257
- * @example
258
- * ```ts
259
- * try {
260
- * await client.agent.update(agentPda, updates);
261
- * } catch (err) {
262
- * if (err instanceof SapPermissionError) {
263
- * console.error(`Permission denied: ${err.message}`);
264
- * }
265
- * }
266
- * ```
267
- *
268
- * @see {@link SapError}
269
- */
270
- export declare class SapPermissionError extends SapError {
271
- /**
272
- * @param message - A human-readable description of the permission failure.
273
- */
274
- constructor(message: string);
275
- }
276
- /**
277
- * @name SapTransientError
278
- * @description Wraps RPC failures that are *retryable* — network errors,
279
- * 429 rate limits, 5xx, blockhash-not-found, node-behind, fetch-failed.
280
- *
281
- * SDK fetch helpers (`safeFetch`) auto-retry these with exponential backoff
282
- * before re-throwing. Callers can also catch and retry at higher layers.
283
- *
284
- * @category Errors
285
- * @since v0.13.1
286
- * @extends {SapError}
287
- */
288
- export declare class SapTransientError extends SapError {
289
- readonly attempt: number;
290
- readonly cause?: unknown;
291
- constructor(message: string, opts?: {
292
- attempt?: number;
293
- cause?: unknown;
294
- });
295
- }
296
- /**
297
- * @name SapAlreadyExistsError
298
- * @description Thrown when an `init` instruction would collide with an
299
- * already-existing PDA. Detected by SDK preflight — prevents a wasted tx
300
- * and surfaces an idempotent success path to callers.
301
- *
302
- * @category Errors
303
- * @since v0.13.1
304
- * @extends {SapError}
305
- */
306
- export declare class SapAlreadyExistsError extends SapError {
307
- readonly address: string;
308
- readonly accountType?: string;
309
- constructor(address: string, accountType?: string, hint?: string);
310
- }
311
- /**
312
- * @name SapIdempotencyError
313
- * @description Thrown by `safeRpc` when a transaction would replay an action
314
- * that has already been recorded on-chain (e.g. settlement-receipt PDA already
315
- * exists). Treat as a non-fatal idempotent success and drop the queued action.
316
- *
317
- * @category Errors
318
- * @since v0.13.1
319
- * @extends {SapError}
320
- */
321
- export declare class SapIdempotencyError extends SapError {
322
- readonly receiptAddress?: string;
323
- constructor(message: string, receiptAddress?: string);
324
- }
325
- /**
326
- * @name isTransientRpcError
327
- * @description Heuristic classifier for RPC errors. Returns `true` for
328
- * network failures, rate limits, 5xx, blockhash-not-found, node-behind,
329
- * fetch-failed, ECONNRESET, ETIMEDOUT, socket hang up.
330
- *
331
- * @category Errors
332
- * @since v0.13.1
333
- */
334
- export declare function isTransientRpcError(err: unknown): boolean;
335
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/errors/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAMH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACjC;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;OAGG;gBACS,OAAO,EAAE,MAAM,EAAE,IAAI,SAAc;CAOhD;AAMD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,kBAAmB,SAAQ,QAAQ;IAC9C;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;gBACS,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;CAK5C;AAMD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,WAAY,SAAQ,QAAQ;IACvC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAElC;;;;;OAKG;gBAED,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EA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