@oobe-protocol-labs/synapse-sap-sdk 0.3.0 → 0.4.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 (91) hide show
  1. package/dist/cjs/constants/addresses.js +143 -0
  2. package/dist/cjs/constants/addresses.js.map +1 -0
  3. package/dist/cjs/constants/index.js +11 -1
  4. package/dist/cjs/constants/index.js.map +1 -1
  5. package/dist/cjs/constants/programs.js +1 -1
  6. package/dist/cjs/constants/seeds.js +2 -0
  7. package/dist/cjs/constants/seeds.js.map +1 -1
  8. package/dist/cjs/core/client.js +1 -1
  9. package/dist/cjs/core/connection.js +37 -6
  10. package/dist/cjs/core/connection.js.map +1 -1
  11. package/dist/cjs/core/index.js +2 -1
  12. package/dist/cjs/core/index.js.map +1 -1
  13. package/dist/cjs/index.js +4 -3
  14. package/dist/cjs/index.js.map +1 -1
  15. package/dist/cjs/modules/agent.js +2 -2
  16. package/dist/cjs/modules/attestation.js +1 -1
  17. package/dist/cjs/modules/escrow.js +1 -1
  18. package/dist/cjs/modules/feedback.js +1 -1
  19. package/dist/cjs/modules/indexing.js +2 -2
  20. package/dist/cjs/modules/tools.js +2 -2
  21. package/dist/cjs/modules/vault.js +1 -1
  22. package/dist/cjs/pda/index.js +101 -1
  23. package/dist/cjs/pda/index.js.map +1 -1
  24. package/dist/cjs/plugin/index.js +1 -1
  25. package/dist/cjs/plugin/index.js.map +1 -1
  26. package/dist/esm/constants/addresses.js +140 -0
  27. package/dist/esm/constants/addresses.js.map +1 -0
  28. package/dist/esm/constants/index.js +2 -0
  29. package/dist/esm/constants/index.js.map +1 -1
  30. package/dist/esm/constants/programs.js +1 -1
  31. package/dist/esm/constants/seeds.js +2 -0
  32. package/dist/esm/constants/seeds.js.map +1 -1
  33. package/dist/esm/core/client.js +1 -1
  34. package/dist/esm/core/connection.js +36 -6
  35. package/dist/esm/core/connection.js.map +1 -1
  36. package/dist/esm/core/index.js +1 -1
  37. package/dist/esm/core/index.js.map +1 -1
  38. package/dist/esm/index.js +2 -2
  39. package/dist/esm/index.js.map +1 -1
  40. package/dist/esm/modules/agent.js +2 -2
  41. package/dist/esm/modules/attestation.js +1 -1
  42. package/dist/esm/modules/escrow.js +1 -1
  43. package/dist/esm/modules/feedback.js +1 -1
  44. package/dist/esm/modules/indexing.js +2 -2
  45. package/dist/esm/modules/tools.js +2 -2
  46. package/dist/esm/modules/vault.js +1 -1
  47. package/dist/esm/pda/index.js +95 -0
  48. package/dist/esm/pda/index.js.map +1 -1
  49. package/dist/esm/plugin/index.js +1 -1
  50. package/dist/esm/plugin/index.js.map +1 -1
  51. package/dist/types/constants/addresses.d.ts +117 -0
  52. package/dist/types/constants/addresses.d.ts.map +1 -0
  53. package/dist/types/constants/index.d.ts +1 -0
  54. package/dist/types/constants/index.d.ts.map +1 -1
  55. package/dist/types/constants/programs.d.ts +1 -1
  56. package/dist/types/constants/seeds.d.ts +2 -0
  57. package/dist/types/constants/seeds.d.ts.map +1 -1
  58. package/dist/types/core/client.d.ts +1 -1
  59. package/dist/types/core/connection.d.ts +32 -6
  60. package/dist/types/core/connection.d.ts.map +1 -1
  61. package/dist/types/core/index.d.ts +2 -2
  62. package/dist/types/core/index.d.ts.map +1 -1
  63. package/dist/types/index.d.ts +3 -3
  64. package/dist/types/index.d.ts.map +1 -1
  65. package/dist/types/modules/agent.d.ts +2 -2
  66. package/dist/types/modules/attestation.d.ts +1 -1
  67. package/dist/types/modules/escrow.d.ts +1 -1
  68. package/dist/types/modules/feedback.d.ts +1 -1
  69. package/dist/types/modules/indexing.d.ts +2 -2
  70. package/dist/types/modules/tools.d.ts +2 -2
  71. package/dist/types/modules/vault.d.ts +1 -1
  72. package/dist/types/pda/index.d.ts +79 -0
  73. package/dist/types/pda/index.d.ts.map +1 -1
  74. package/package.json +1 -1
  75. package/src/constants/addresses.ts +162 -0
  76. package/src/constants/index.ts +11 -0
  77. package/src/constants/programs.ts +1 -1
  78. package/src/constants/seeds.ts +2 -0
  79. package/src/core/client.ts +1 -1
  80. package/src/core/connection.ts +59 -7
  81. package/src/core/index.ts +2 -2
  82. package/src/index.ts +3 -3
  83. package/src/modules/agent.ts +2 -2
  84. package/src/modules/attestation.ts +1 -1
  85. package/src/modules/escrow.ts +1 -1
  86. package/src/modules/feedback.ts +1 -1
  87. package/src/modules/indexing.ts +2 -2
  88. package/src/modules/tools.ts +2 -2
  89. package/src/modules/vault.ts +1 -1
  90. package/src/pda/index.ts +140 -0
  91. package/src/plugin/index.ts +1 -1
@@ -15,7 +15,7 @@ import { BaseModule } from "./base";
15
15
  import type { MemoryVaultData, SessionLedgerData, EpochPageData, VaultDelegateData, InscribeMemoryArgs, CompactInscribeArgs } from "../types";
16
16
  /**
17
17
  * @name VaultModule
18
- * @description Manages encrypted memory vaults for the Solana Agent Protocol.
18
+ * @description Manages encrypted memory vaults for the Synapse Agent Protocol.
19
19
  * Provides methods to initialise vaults, open/close sessions, inscribe
20
20
  * encrypted data, manage delegates (hot wallets), rotate nonces, and
21
21
  * fetch all related account types.
@@ -292,5 +292,84 @@ export declare const deriveLedger: (sessionPda: PublicKey, programId?: PublicKey
292
292
  * @see LedgerPage
293
293
  */
294
294
  export declare const deriveLedgerPage: (ledgerPda: PublicKey, pageIndex: number, programId?: PublicKey) => PdaResult;
295
+ /**
296
+ * Derive the **MemoryBuffer** PDA for a session at a given page index.
297
+ *
298
+ * Seeds: `["sap_buffer", session_pda, page_index_u32_le]`
299
+ *
300
+ * @name deriveBuffer
301
+ * @description Computes the buffer page PDA for chunked memory writes within a session.
302
+ * @param sessionPda - The parent session's PDA.
303
+ * @param pageIndex - Zero-based page index.
304
+ * @param programId - Override program ID (defaults to {@link SAP_PROGRAM_ID}).
305
+ * @returns {PdaResult} `[pda, bump]` tuple.
306
+ * @category PDA
307
+ * @since v0.3.1
308
+ * @see MemoryBuffer
309
+ */
310
+ export declare const deriveBuffer: (sessionPda: PublicKey, pageIndex: number, programId?: PublicKey) => PdaResult;
311
+ /**
312
+ * Derive the **SessionDigest** PDA for a session.
313
+ *
314
+ * Seeds: `["sap_digest", session_pda]`
315
+ *
316
+ * @name deriveDigest
317
+ * @description Computes the digest PDA that stores a compact hash summary of a session.
318
+ * @param sessionPda - The parent session's PDA.
319
+ * @param programId - Override program ID (defaults to {@link SAP_PROGRAM_ID}).
320
+ * @returns {PdaResult} `[pda, bump]` tuple.
321
+ * @category PDA
322
+ * @since v0.3.1
323
+ * @see SessionDigest
324
+ */
325
+ export declare const deriveDigest: (sessionPda: PublicKey, programId?: PublicKey) => PdaResult;
326
+ /**
327
+ * Derive the **PluginConfig** PDA for an agent and plugin type.
328
+ *
329
+ * Seeds: `["sap_plugin", agent_pda, plugin_type_u8]`
330
+ *
331
+ * @name derivePlugin
332
+ * @description Computes the plugin configuration PDA scoped to an agent and plugin type.
333
+ * @param agentPda - The owning agent's PDA.
334
+ * @param pluginType - The `u8` plugin type discriminant.
335
+ * @param programId - Override program ID (defaults to {@link SAP_PROGRAM_ID}).
336
+ * @returns {PdaResult} `[pda, bump]` tuple.
337
+ * @category PDA
338
+ * @since v0.3.1
339
+ * @see PluginConfig
340
+ */
341
+ export declare const derivePlugin: (agentPda: PublicKey, pluginType: number, programId?: PublicKey) => PdaResult;
342
+ /**
343
+ * Derive the **MemoryEntry** PDA for an agent and entry hash.
344
+ *
345
+ * Seeds: `["sap_memory", agent_pda, entry_hash]`
346
+ *
347
+ * @name deriveMemoryEntry
348
+ * @description Computes the memory entry PDA for legacy key-value memory storage.
349
+ * @param agentPda - The owning agent's PDA.
350
+ * @param entryHash - SHA-256 hash of the entry key (32 bytes).
351
+ * @param programId - Override program ID (defaults to {@link SAP_PROGRAM_ID}).
352
+ * @returns {PdaResult} `[pda, bump]` tuple.
353
+ * @category PDA
354
+ * @since v0.3.1
355
+ * @see MemoryEntry
356
+ */
357
+ export declare const deriveMemoryEntry: (agentPda: PublicKey, entryHash: Uint8Array, programId?: PublicKey) => PdaResult;
358
+ /**
359
+ * Derive the **MemoryChunk** PDA for a memory entry at a given chunk index.
360
+ *
361
+ * Seeds: `["sap_mem_chunk", memory_entry_pda, chunk_index_u8]`
362
+ *
363
+ * @name deriveMemoryChunk
364
+ * @description Computes the chunk PDA for fragmented memory entry data.
365
+ * @param memoryEntryPda - The parent memory entry's PDA.
366
+ * @param chunkIndex - Zero-based chunk index (0–255).
367
+ * @param programId - Override program ID (defaults to {@link SAP_PROGRAM_ID}).
368
+ * @returns {PdaResult} `[pda, bump]` tuple.
369
+ * @category PDA
370
+ * @since v0.3.1
371
+ * @see MemoryChunk
372
+ */
373
+ export declare const deriveMemoryChunk: (memoryEntryPda: PublicKey, chunkIndex: number, programId?: PublicKey) => PdaResult;
295
374
  export {};
296
375
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pda/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C;;;;;;;;GAQG;AACH,KAAK,SAAS,GAAG,SAAS,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAoDzD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oBAAoB,GAC/B,qBAA0B,KACzB,SAC4C,CAAC;AAEhD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW,GACtB,QAAQ,SAAS,EACjB,qBAA0B,KACzB,SAC8D,CAAC;AAElE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,GAC3B,UAAU,SAAS,EACnB,qBAA0B,KACzB,SACgE,CAAC;AAMpE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,GACzB,UAAU,SAAS,EACnB,UAAU,SAAS,EACnB,qBAA0B,KACzB,SAIA,CAAC;AAMJ;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,GAChC,gBAAgB,UAAU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EACjB,qBAA0B,KACzB,SAIA,CAAC;AAMJ;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,GACvB,YAAY,SAAS,EACrB,qBAA0B,KACzB,SACmE,CAAC;AAMvE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY,GACvB,UAAU,SAAS,EACnB,YAAY,MAAM,EAClB,qBAA0B,KACzB,SAIA,CAAC;AAMJ;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,GAC5B,UAAU,SAAS,EACnB,WAAW,UAAU,EACrB,qBAA0B,KACzB,SAIA,CAAC;AAEJ;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,GAC5B,gBAAgB,SAAS,EACzB,YAAY,MAAM,EAClB,qBAA0B,KACzB,SAQA,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oobe-protocol-labs/synapse-sap-sdk",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "TypeScript SDK for the Synapse Agent Protocol (SAP v2) on Solana",
5
5
  "license": "MIT",
6
6
  "main": "dist/cjs/index.js",
@@ -0,0 +1,162 @@
1
+ /**
2
+ * @module constants/addresses
3
+ * @description Pre-computed mainnet addresses for singleton PDAs and protocol infrastructure.
4
+ *
5
+ * These addresses are deterministic — derived from the canonical program ID
6
+ * and fixed seeds. They are provided for convenience so consumers can
7
+ * reference well-known accounts without re-deriving them.
8
+ *
9
+ * @category Constants
10
+ * @since v0.3.1
11
+ */
12
+
13
+ import { PublicKey } from "@solana/web3.js";
14
+
15
+ // ═══════════════════════════════════════════════════════════════════
16
+ // Program & Authority
17
+ // ═══════════════════════════════════════════════════════════════════
18
+
19
+ /**
20
+ * SAP v2 program ID on mainnet-beta (base58).
21
+ *
22
+ * @name SAP_PROGRAM
23
+ * @description The deployed and verified SAP v2 program address.
24
+ * @category Constants
25
+ * @since v0.3.1
26
+ */
27
+ export const SAP_PROGRAM = new PublicKey(
28
+ "SAPpUhsWLJG1FfkGRcXagEDMrMsWGjbky7AyhGpFETZ",
29
+ );
30
+
31
+ /**
32
+ * Upgrade authority for the SAP v2 program.
33
+ *
34
+ * @name SAP_UPGRADE_AUTHORITY
35
+ * @description The wallet that holds upgrade authority over the deployed program.
36
+ * @category Constants
37
+ * @since v0.3.1
38
+ */
39
+ export const SAP_UPGRADE_AUTHORITY = new PublicKey(
40
+ "GBLQznn1QMnx64zHXcDguP9yNW9ZfYCVdrY8eDovBvPk",
41
+ );
42
+
43
+ // ═══════════════════════════════════════════════════════════════════
44
+ // Singleton PDAs
45
+ // ═══════════════════════════════════════════════════════════════════
46
+
47
+ /**
48
+ * **GlobalRegistry** PDA — the protocol singleton.
49
+ *
50
+ * Seeds: `["sap_global"]` · Bump: `255`
51
+ *
52
+ * Tracks total agent count, active agent count, and protocol-level
53
+ * counters. Must be initialized once before any agent can register.
54
+ *
55
+ * @name GLOBAL_REGISTRY_ADDRESS
56
+ * @category Constants
57
+ * @since v0.3.1
58
+ */
59
+ export const GLOBAL_REGISTRY_ADDRESS = new PublicKey(
60
+ "9odFrYBBZq6UQC6aGyzMPNXWJQn55kMtfigzhLg6S6L5",
61
+ );
62
+
63
+ /**
64
+ * Bump seed for the GlobalRegistry PDA.
65
+ * @name GLOBAL_REGISTRY_BUMP
66
+ * @category Constants
67
+ * @since v0.3.1
68
+ */
69
+ export const GLOBAL_REGISTRY_BUMP = 255;
70
+
71
+ // ═══════════════════════════════════════════════════════════════════
72
+ // IDL Account (program-metadata format)
73
+ // ═══════════════════════════════════════════════════════════════════
74
+
75
+ /**
76
+ * IDL metadata account derived via the `program-metadata` standard.
77
+ *
78
+ * Seeds: `["idl", program_id]` under `pmetaypqG6SiB47xMigYVMAkuHDWeSDXcv3zzDrJJvA`.
79
+ *
80
+ * Contains the Anchor IDL JSON, queryable by explorers like Solscan.
81
+ *
82
+ * @name IDL_ACCOUNT_ADDRESS
83
+ * @category Constants
84
+ * @since v0.3.1
85
+ */
86
+ export const IDL_ACCOUNT_ADDRESS = new PublicKey(
87
+ "ENs7L1NFuoP7dur8cqGGE6b98CQHfNeDZPWPSjRzhc4f",
88
+ );
89
+
90
+ /**
91
+ * The `program-metadata` program used to store the IDL.
92
+ *
93
+ * @name PROGRAM_METADATA_PROGRAM
94
+ * @category Constants
95
+ * @since v0.3.1
96
+ */
97
+ export const PROGRAM_METADATA_PROGRAM = new PublicKey(
98
+ "pmetaypqG6SiB47xMigYVMAkuHDWeSDXcv3zzDrJJvA",
99
+ );
100
+
101
+ // ═══════════════════════════════════════════════════════════════════
102
+ // Tool Category Index PDAs (pre-computed for categories 0–9)
103
+ // ═══════════════════════════════════════════════════════════════════
104
+
105
+ /**
106
+ * Pre-computed Tool Category Index PDAs for each `ToolCategory` variant.
107
+ *
108
+ * Seeds: `["sap_tool_cat", category_byte]`
109
+ *
110
+ * Each entry corresponds to a `ToolCategory` enum discriminant:
111
+ *
112
+ * | Index | Category | Address |
113
+ * |-------|------------|----------------------------------------------------|
114
+ * | 0 | Swap | `5H8yn9RuRgZWqkDiWbKNaCHzTMjqSpwbNQKMPLtUXx2G` |
115
+ * | 1 | Lend | `5Lqqk6VtFWnYq3h4Ae4FuUAKnFzw1Nm1DaSdt2cjcTDj` |
116
+ * | 2 | Stake | `kC8oAiVUcFMXEnmMNu1h2sdAc3dWKcwV5qVKRFYMmQD` |
117
+ * | 3 | Nft | `2zNWR9J3znvGQ5J6xDfJyZkd12Gi66mjErRDkgPeKbyF` |
118
+ * | 4 | Payment | `Eh7MwxJYWRN8bzAmY3ZPTRXYjWpWypokBf1STixu2dy9` |
119
+ * | 5 | Data | `AwpVxehQUZCVTAJ9icZfS6oRbF66jNo32duXaL11B5df` |
120
+ * | 6 | Governance | `2573WjZzV9QtbqtM6Z86YGivkk1kdvJa4gK3tZRQ2jkN` |
121
+ * | 7 | Bridge | `664nyr6kBeeFiE1ij5gtdncNCVHrXqrk2uBhnKmUREvK` |
122
+ * | 8 | Analytics | `4DFsiTZ6h6RoCZuUeMTpaoQguepnPUMJBLJuwwjKg5GL` |
123
+ * | 9 | Custom | `3Nk5dvFWEyWPEArdG9cCdab6C6ym36mSWUSB8HzN35ZM` |
124
+ *
125
+ * @name TOOL_CATEGORY_ADDRESSES
126
+ * @category Constants
127
+ * @since v0.3.1
128
+ */
129
+ export const TOOL_CATEGORY_ADDRESSES = {
130
+ Swap: new PublicKey("5H8yn9RuRgZWqkDiWbKNaCHzTMjqSpwbNQKMPLtUXx2G"),
131
+ Lend: new PublicKey("5Lqqk6VtFWnYq3h4Ae4FuUAKnFzw1Nm1DaSdt2cjcTDj"),
132
+ Stake: new PublicKey("kC8oAiVUcFMXEnmMNu1h2sdAc3dWKcwV5qVKRFYMmQD"),
133
+ Nft: new PublicKey("2zNWR9J3znvGQ5J6xDfJyZkd12Gi66mjErRDkgPeKbyF"),
134
+ Payment: new PublicKey("Eh7MwxJYWRN8bzAmY3ZPTRXYjWpWypokBf1STixu2dy9"),
135
+ Data: new PublicKey("AwpVxehQUZCVTAJ9icZfS6oRbF66jNo32duXaL11B5df"),
136
+ Governance: new PublicKey("2573WjZzV9QtbqtM6Z86YGivkk1kdvJa4gK3tZRQ2jkN"),
137
+ Bridge: new PublicKey("664nyr6kBeeFiE1ij5gtdncNCVHrXqrk2uBhnKmUREvK"),
138
+ Analytics: new PublicKey("4DFsiTZ6h6RoCZuUeMTpaoQguepnPUMJBLJuwwjKg5GL"),
139
+ Custom: new PublicKey("3Nk5dvFWEyWPEArdG9cCdab6C6ym36mSWUSB8HzN35ZM"),
140
+ } as const;
141
+
142
+ /**
143
+ * Array-indexed version of {@link TOOL_CATEGORY_ADDRESSES}.
144
+ *
145
+ * `TOOL_CATEGORY_ADDRESS_LIST[0]` = Swap, `[1]` = Lend, etc.
146
+ *
147
+ * @name TOOL_CATEGORY_ADDRESS_LIST
148
+ * @category Constants
149
+ * @since v0.3.1
150
+ */
151
+ export const TOOL_CATEGORY_ADDRESS_LIST: readonly PublicKey[] = [
152
+ TOOL_CATEGORY_ADDRESSES.Swap,
153
+ TOOL_CATEGORY_ADDRESSES.Lend,
154
+ TOOL_CATEGORY_ADDRESSES.Stake,
155
+ TOOL_CATEGORY_ADDRESSES.Nft,
156
+ TOOL_CATEGORY_ADDRESSES.Payment,
157
+ TOOL_CATEGORY_ADDRESSES.Data,
158
+ TOOL_CATEGORY_ADDRESSES.Governance,
159
+ TOOL_CATEGORY_ADDRESSES.Bridge,
160
+ TOOL_CATEGORY_ADDRESSES.Analytics,
161
+ TOOL_CATEGORY_ADDRESSES.Custom,
162
+ ] as const;
@@ -42,3 +42,14 @@ export {
42
42
  TOOL_CATEGORY_VALUES,
43
43
  HTTP_METHOD_VALUES,
44
44
  } from "./limits";
45
+ // ── Mainnet Addresses ────────────────────────────────────────
46
+ export {
47
+ SAP_PROGRAM,
48
+ SAP_UPGRADE_AUTHORITY,
49
+ GLOBAL_REGISTRY_ADDRESS,
50
+ GLOBAL_REGISTRY_BUMP,
51
+ IDL_ACCOUNT_ADDRESS,
52
+ PROGRAM_METADATA_PROGRAM,
53
+ TOOL_CATEGORY_ADDRESSES,
54
+ TOOL_CATEGORY_ADDRESS_LIST,
55
+ } from "./addresses";
@@ -19,7 +19,7 @@ import { PublicKey } from "@solana/web3.js";
19
19
  /**
20
20
  * SAP v2 program address string (base58).
21
21
  *
22
- * Vanity keypair derived from the `SAPTU7a…` prefix.
22
+ * Vanity keypair derived from the `SAPpUh…` prefix.
23
23
  *
24
24
  * @name SAP_PROGRAM_ADDRESS
25
25
  * @description The canonical on-chain program address shared by all Solana clusters.
@@ -52,6 +52,8 @@ export const SEEDS = {
52
52
  ATTESTATION: "sap_attest",
53
53
  LEDGER: "sap_ledger",
54
54
  LEDGER_PAGE: "sap_page",
55
+ BUFFER: "sap_buffer",
56
+ DIGEST: "sap_digest",
55
57
  } as const;
56
58
 
57
59
  /**
@@ -50,7 +50,7 @@ type SapProgram = Program<any>;
50
50
 
51
51
  /**
52
52
  * @name SapClient
53
- * @description Root entry point for the Solana Agent Protocol v2 TypeScript SDK.
53
+ * @description Root entry point for the Synapse Agent Protocol v2 TypeScript SDK.
54
54
  *
55
55
  * Each protocol domain is exposed as a lazily-instantiated module:
56
56
  * `agent`, `feedback`, `indexing`, `tools`, `vault`, `escrow`,
@@ -31,9 +31,11 @@ import {
31
31
  type Commitment,
32
32
  Keypair,
33
33
  type PublicKey,
34
+ type Transaction,
35
+ type VersionedTransaction,
34
36
  LAMPORTS_PER_SOL,
35
37
  } from "@solana/web3.js";
36
- import { AnchorProvider, Wallet } from "@coral-xyz/anchor";
38
+ import { AnchorProvider } from "@coral-xyz/anchor";
37
39
  import {
38
40
  SAP_PROGRAM_ID,
39
41
  MAINNET_SAP_PROGRAM_ID,
@@ -42,6 +44,56 @@ import {
42
44
  } from "../constants";
43
45
  import { SapClient } from "./client";
44
46
 
47
+ // ═══════════════════════════════════════════════════════════════════
48
+ // Wallet interface (replaces Anchor's Wallet which is not
49
+ // exported from the ESM bundle of @coral-xyz/anchor)
50
+ // ═══════════════════════════════════════════════════════════════════
51
+
52
+ /**
53
+ * @interface SapWallet
54
+ * @description Minimal wallet/signer interface compatible with
55
+ * Anchor's `AnchorProvider`. Avoids importing `Wallet` from
56
+ * `@coral-xyz/anchor` which is absent in ESM builds.
57
+ * @category Core
58
+ * @since v0.4.1
59
+ */
60
+ export interface SapWallet {
61
+ readonly publicKey: PublicKey;
62
+ signTransaction<T extends Transaction | VersionedTransaction>(tx: T): Promise<T>;
63
+ signAllTransactions<T extends Transaction | VersionedTransaction>(txs: T[]): Promise<T[]>;
64
+ }
65
+
66
+ /**
67
+ * @name KeypairWallet
68
+ * @description Simple wallet wrapper around a `Keypair`.
69
+ * Drop-in replacement for Anchor's `NodeWallet` / `Wallet` class.
70
+ * @category Core
71
+ * @since v0.4.1
72
+ */
73
+ export class KeypairWallet implements SapWallet {
74
+ readonly publicKey: PublicKey;
75
+
76
+ constructor(readonly payer: Keypair) {
77
+ this.publicKey = payer.publicKey;
78
+ }
79
+
80
+ async signTransaction<T extends Transaction | VersionedTransaction>(tx: T): Promise<T> {
81
+ if ("partialSign" in tx) {
82
+ (tx as Transaction).partialSign(this.payer);
83
+ } else {
84
+ (tx as VersionedTransaction).sign([this.payer]);
85
+ }
86
+ return tx;
87
+ }
88
+
89
+ async signAllTransactions<T extends Transaction | VersionedTransaction>(txs: T[]): Promise<T[]> {
90
+ for (const tx of txs) {
91
+ await this.signTransaction(tx);
92
+ }
93
+ return txs;
94
+ }
95
+ }
96
+
45
97
  // ═══════════════════════════════════════════════════════════════════
46
98
  // Types
47
99
  // ═══════════════════════════════════════════════════════════════════
@@ -261,7 +313,7 @@ export class SapConnection {
261
313
  commitment: opts?.commitment,
262
314
  cluster: opts?.cluster,
263
315
  });
264
- const client = conn.createClient(new Wallet(keypair));
316
+ const client = conn.createClient(new KeypairWallet(keypair));
265
317
  return Object.assign(conn, { client });
266
318
  }
267
319
 
@@ -270,18 +322,18 @@ export class SapConnection {
270
322
  // ─────────────────────────────────────────────
271
323
 
272
324
  /**
273
- * Create a {@link SapClient} from an Anchor {@link Wallet} (signer).
325
+ * Create a {@link SapClient} from a {@link SapWallet} (signer).
274
326
  *
275
- * @param {Wallet} wallet — An Anchor-compatible wallet/signer.
327
+ * @param {SapWallet} wallet — A wallet/signer implementing {@link SapWallet}.
276
328
  * @returns {SapClient} A fully-configured SAP client.
277
329
  * @since v0.1.0
278
330
  *
279
331
  * @example
280
332
  * ```ts
281
- * const client = conn.createClient(new Wallet(keypair));
333
+ * const client = conn.createClient(new KeypairWallet(keypair));
282
334
  * ```
283
335
  */
284
- createClient(wallet: Wallet): SapClient {
336
+ createClient(wallet: SapWallet): SapClient {
285
337
  const provider = new AnchorProvider(this.connection, wallet, {
286
338
  commitment: this.commitment,
287
339
  });
@@ -301,7 +353,7 @@ export class SapConnection {
301
353
  * ```
302
354
  */
303
355
  fromKeypair(keypair: Keypair): SapClient {
304
- return this.createClient(new Wallet(keypair));
356
+ return this.createClient(new KeypairWallet(keypair));
305
357
  }
306
358
 
307
359
  // ─────────────────────────────────────────────
package/src/core/index.ts CHANGED
@@ -16,5 +16,5 @@
16
16
  */
17
17
 
18
18
  export { SapClient } from "./client";
19
- export { SapConnection } from "./connection";
20
- export type { SapCluster, SapConnectionConfig } from "./connection";
19
+ export { SapConnection, KeypairWallet } from "./connection";
20
+ export type { SapCluster, SapConnectionConfig, SapWallet } from "./connection";
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @synapse-sap/sdk — TypeScript SDK for SAP v2 (Solana Agent Protocol)
2
+ * @synapse-sap/sdk — TypeScript SDK for SAP v2 (Synapse Agent Protocol)
3
3
  *
4
4
  * Modular architecture:
5
5
  *
@@ -44,8 +44,8 @@
44
44
  */
45
45
 
46
46
  // ── Core ─────────────────────────────────────────────
47
- export { SapClient, SapConnection } from "./core";
48
- export type { SapCluster, SapConnectionConfig } from "./core";
47
+ export { SapClient, SapConnection, KeypairWallet } from "./core";
48
+ export type { SapCluster, SapConnectionConfig, SapWallet } from "./core";
49
49
 
50
50
  // ── Types ────────────────────────────────────────────
51
51
  export type {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @module agent
3
- * @description Agent lifecycle operations for the Solana Agent Protocol.
3
+ * @description Agent lifecycle operations for the Synapse Agent Protocol.
4
4
  *
5
5
  * Covers: register, update, deactivate, reactivate, close,
6
6
  * report calls, update reputation metrics, and account fetching.
@@ -22,7 +22,7 @@ import type {
22
22
 
23
23
  /**
24
24
  * @name AgentModule
25
- * @description Manages the full agent lifecycle on the Solana Agent Protocol.
25
+ * @description Manages the full agent lifecycle on the Synapse Agent Protocol.
26
26
  * Provides methods to register, update, deactivate, reactivate, and close
27
27
  * agent identities, as well as self-report call metrics and reputation data.
28
28
  *
@@ -18,7 +18,7 @@ import type { AgentAttestationData, CreateAttestationArgs } from "../types";
18
18
 
19
19
  /**
20
20
  * @name AttestationModule
21
- * @description Manages on-chain attestations for the Solana Agent Protocol.
21
+ * @description Manages on-chain attestations for the Synapse Agent Protocol.
22
22
  * Provides methods to create, revoke, close, and fetch attestation PDAs
23
23
  * that form the web-of-trust layer.
24
24
  *
@@ -34,7 +34,7 @@ import type {
34
34
  * @name EscrowModule
35
35
  * @description Manages x402-compatible escrow accounts for agent micropayments.
36
36
  * Provides methods to create, fund, settle, withdraw, batch-settle, close,
37
- * and fetch escrow PDAs on the Solana Agent Protocol.
37
+ * and fetch escrow PDAs on the Synapse Agent Protocol.
38
38
  *
39
39
  * @category Modules
40
40
  * @since v0.1.0
@@ -18,7 +18,7 @@ import type { FeedbackAccountData, GiveFeedbackArgs, UpdateFeedbackArgs } from "
18
18
 
19
19
  /**
20
20
  * @name FeedbackModule
21
- * @description Manages on-chain feedback entries for the Solana Agent Protocol.
21
+ * @description Manages on-chain feedback entries for the Synapse Agent Protocol.
22
22
  * Provides methods to give, update, revoke, close, and fetch feedback PDAs
23
23
  * that form the trustless reputation layer.
24
24
  *
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @module indexing
3
3
  * @description Scalable discovery layer — capability indexes, protocol indexes,
4
- * and tool category indexes for the Solana Agent Protocol.
4
+ * and tool category indexes for the Synapse Agent Protocol.
5
5
  *
6
6
  * Indexes are shared PDA-based registries that map agents and tools to
7
7
  * discovery dimensions, enabling efficient on-chain lookups.
@@ -29,7 +29,7 @@ import { sha256, hashToArray } from "../utils";
29
29
 
30
30
  /**
31
31
  * @name IndexingModule
32
- * @description Manages on-chain discovery indexes for the Solana Agent Protocol.
32
+ * @description Manages on-chain discovery indexes for the Synapse Agent Protocol.
33
33
  * Provides methods to create, populate, prune, close, and fetch capability
34
34
  * indexes, protocol indexes, and tool category indexes.
35
35
  *
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @module tools
3
3
  * @description Tool schema registry and session checkpoints for the
4
- * Solana Agent Protocol.
4
+ * Synapse Agent Protocol.
5
5
  *
6
6
  * Covers: publish, inscribe schema, update, deactivate/reactivate,
7
7
  * close, report invocations, and session checkpoint management.
@@ -31,7 +31,7 @@ import { sha256, hashToArray } from "../utils";
31
31
  /**
32
32
  * @name ToolsModule
33
33
  * @description Manages tool descriptors and session checkpoints for the
34
- * Solana Agent Protocol. Provides methods to publish, update, deactivate,
34
+ * Synapse Agent Protocol. Provides methods to publish, update, deactivate,
35
35
  * reactivate, close, and fetch tool descriptors, as well as inscribe
36
36
  * JSON schemas into TX logs and manage session checkpoints.
37
37
  *
@@ -32,7 +32,7 @@ import type {
32
32
 
33
33
  /**
34
34
  * @name VaultModule
35
- * @description Manages encrypted memory vaults for the Solana Agent Protocol.
35
+ * @description Manages encrypted memory vaults for the Synapse Agent Protocol.
36
36
  * Provides methods to initialise vaults, open/close sessions, inscribe
37
37
  * encrypted data, manage delegates (hot wallets), rotate nonces, and
38
38
  * fetch all related account types.