@oobe-protocol-labs/synapse-sap-sdk 0.1.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 (315) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +882 -0
  3. package/dist/cjs/constants/index.js +43 -0
  4. package/dist/cjs/constants/index.js.map +1 -0
  5. package/dist/cjs/constants/limits.js +161 -0
  6. package/dist/cjs/constants/limits.js.map +1 -0
  7. package/dist/cjs/constants/programs.js +78 -0
  8. package/dist/cjs/constants/programs.js.map +1 -0
  9. package/dist/cjs/constants/seeds.js +57 -0
  10. package/dist/cjs/constants/seeds.js.map +1 -0
  11. package/dist/cjs/core/client.js +391 -0
  12. package/dist/cjs/core/client.js.map +1 -0
  13. package/dist/cjs/core/connection.js +319 -0
  14. package/dist/cjs/core/connection.js.map +1 -0
  15. package/dist/cjs/core/index.js +24 -0
  16. package/dist/cjs/core/index.js.map +1 -0
  17. package/dist/cjs/errors/index.js +334 -0
  18. package/dist/cjs/errors/index.js.map +1 -0
  19. package/dist/cjs/events/index.js +136 -0
  20. package/dist/cjs/events/index.js.map +1 -0
  21. package/dist/cjs/idl/index.js +63 -0
  22. package/dist/cjs/idl/index.js.map +1 -0
  23. package/dist/cjs/idl/synapse_agent_sap.json +9710 -0
  24. package/dist/cjs/index.js +147 -0
  25. package/dist/cjs/index.js.map +1 -0
  26. package/dist/cjs/modules/agent.js +272 -0
  27. package/dist/cjs/modules/agent.js.map +1 -0
  28. package/dist/cjs/modules/attestation.js +147 -0
  29. package/dist/cjs/modules/attestation.js.map +1 -0
  30. package/dist/cjs/modules/base.js +128 -0
  31. package/dist/cjs/modules/base.js.map +1 -0
  32. package/dist/cjs/modules/escrow.js +246 -0
  33. package/dist/cjs/modules/escrow.js.map +1 -0
  34. package/dist/cjs/modules/feedback.js +166 -0
  35. package/dist/cjs/modules/feedback.js.map +1 -0
  36. package/dist/cjs/modules/index.js +35 -0
  37. package/dist/cjs/modules/index.js.map +1 -0
  38. package/dist/cjs/modules/indexing.js +375 -0
  39. package/dist/cjs/modules/indexing.js.map +1 -0
  40. package/dist/cjs/modules/ledger.js +234 -0
  41. package/dist/cjs/modules/ledger.js.map +1 -0
  42. package/dist/cjs/modules/tools.js +319 -0
  43. package/dist/cjs/modules/tools.js.map +1 -0
  44. package/dist/cjs/modules/vault.js +410 -0
  45. package/dist/cjs/modules/vault.js.map +1 -0
  46. package/dist/cjs/pda/index.js +377 -0
  47. package/dist/cjs/pda/index.js.map +1 -0
  48. package/dist/cjs/plugin/index.js +934 -0
  49. package/dist/cjs/plugin/index.js.map +1 -0
  50. package/dist/cjs/plugin/protocols.js +282 -0
  51. package/dist/cjs/plugin/protocols.js.map +1 -0
  52. package/dist/cjs/plugin/schemas.js +831 -0
  53. package/dist/cjs/plugin/schemas.js.map +1 -0
  54. package/dist/cjs/postgres/adapter.js +715 -0
  55. package/dist/cjs/postgres/adapter.js.map +1 -0
  56. package/dist/cjs/postgres/index.js +50 -0
  57. package/dist/cjs/postgres/index.js.map +1 -0
  58. package/dist/cjs/postgres/serializers.js +381 -0
  59. package/dist/cjs/postgres/serializers.js.map +1 -0
  60. package/dist/cjs/postgres/sync.js +221 -0
  61. package/dist/cjs/postgres/sync.js.map +1 -0
  62. package/dist/cjs/postgres/types.js +44 -0
  63. package/dist/cjs/postgres/types.js.map +1 -0
  64. package/dist/cjs/registries/builder.js +414 -0
  65. package/dist/cjs/registries/builder.js.map +1 -0
  66. package/dist/cjs/registries/discovery.js +362 -0
  67. package/dist/cjs/registries/discovery.js.map +1 -0
  68. package/dist/cjs/registries/index.js +51 -0
  69. package/dist/cjs/registries/index.js.map +1 -0
  70. package/dist/cjs/registries/session.js +433 -0
  71. package/dist/cjs/registries/session.js.map +1 -0
  72. package/dist/cjs/registries/x402.js +577 -0
  73. package/dist/cjs/registries/x402.js.map +1 -0
  74. package/dist/cjs/types/accounts.js +13 -0
  75. package/dist/cjs/types/accounts.js.map +1 -0
  76. package/dist/cjs/types/common.js +13 -0
  77. package/dist/cjs/types/common.js.map +1 -0
  78. package/dist/cjs/types/enums.js +174 -0
  79. package/dist/cjs/types/enums.js.map +1 -0
  80. package/dist/cjs/types/index.js +36 -0
  81. package/dist/cjs/types/index.js.map +1 -0
  82. package/dist/cjs/types/instructions.js +92 -0
  83. package/dist/cjs/types/instructions.js.map +1 -0
  84. package/dist/cjs/utils/hash.js +58 -0
  85. package/dist/cjs/utils/hash.js.map +1 -0
  86. package/dist/cjs/utils/index.js +27 -0
  87. package/dist/cjs/utils/index.js.map +1 -0
  88. package/dist/cjs/utils/serialization.js +105 -0
  89. package/dist/cjs/utils/serialization.js.map +1 -0
  90. package/dist/cjs/utils/validation.js +36 -0
  91. package/dist/cjs/utils/validation.js.map +1 -0
  92. package/dist/esm/constants/index.js +29 -0
  93. package/dist/esm/constants/index.js.map +1 -0
  94. package/dist/esm/constants/limits.js +158 -0
  95. package/dist/esm/constants/limits.js.map +1 -0
  96. package/dist/esm/constants/programs.js +75 -0
  97. package/dist/esm/constants/programs.js.map +1 -0
  98. package/dist/esm/constants/seeds.js +54 -0
  99. package/dist/esm/constants/seeds.js.map +1 -0
  100. package/dist/esm/core/client.js +384 -0
  101. package/dist/esm/core/client.js.map +1 -0
  102. package/dist/esm/core/connection.js +315 -0
  103. package/dist/esm/core/connection.js.map +1 -0
  104. package/dist/esm/core/index.js +19 -0
  105. package/dist/esm/core/index.js.map +1 -0
  106. package/dist/esm/errors/index.js +325 -0
  107. package/dist/esm/errors/index.js.map +1 -0
  108. package/dist/esm/events/index.js +132 -0
  109. package/dist/esm/events/index.js.map +1 -0
  110. package/dist/esm/idl/index.js +57 -0
  111. package/dist/esm/idl/index.js.map +1 -0
  112. package/dist/esm/idl/synapse_agent_sap.json +9710 -0
  113. package/dist/esm/index.js +70 -0
  114. package/dist/esm/index.js.map +1 -0
  115. package/dist/esm/modules/agent.js +268 -0
  116. package/dist/esm/modules/agent.js.map +1 -0
  117. package/dist/esm/modules/attestation.js +143 -0
  118. package/dist/esm/modules/attestation.js.map +1 -0
  119. package/dist/esm/modules/base.js +124 -0
  120. package/dist/esm/modules/base.js.map +1 -0
  121. package/dist/esm/modules/escrow.js +242 -0
  122. package/dist/esm/modules/escrow.js.map +1 -0
  123. package/dist/esm/modules/feedback.js +162 -0
  124. package/dist/esm/modules/feedback.js.map +1 -0
  125. package/dist/esm/modules/index.js +23 -0
  126. package/dist/esm/modules/index.js.map +1 -0
  127. package/dist/esm/modules/indexing.js +371 -0
  128. package/dist/esm/modules/indexing.js.map +1 -0
  129. package/dist/esm/modules/ledger.js +230 -0
  130. package/dist/esm/modules/ledger.js.map +1 -0
  131. package/dist/esm/modules/tools.js +315 -0
  132. package/dist/esm/modules/tools.js.map +1 -0
  133. package/dist/esm/modules/vault.js +406 -0
  134. package/dist/esm/modules/vault.js.map +1 -0
  135. package/dist/esm/pda/index.js +357 -0
  136. package/dist/esm/pda/index.js.map +1 -0
  137. package/dist/esm/plugin/index.js +927 -0
  138. package/dist/esm/plugin/index.js.map +1 -0
  139. package/dist/esm/plugin/protocols.js +279 -0
  140. package/dist/esm/plugin/protocols.js.map +1 -0
  141. package/dist/esm/plugin/schemas.js +828 -0
  142. package/dist/esm/plugin/schemas.js.map +1 -0
  143. package/dist/esm/postgres/adapter.js +678 -0
  144. package/dist/esm/postgres/adapter.js.map +1 -0
  145. package/dist/esm/postgres/index.js +27 -0
  146. package/dist/esm/postgres/index.js.map +1 -0
  147. package/dist/esm/postgres/serializers.js +362 -0
  148. package/dist/esm/postgres/serializers.js.map +1 -0
  149. package/dist/esm/postgres/sync.js +217 -0
  150. package/dist/esm/postgres/sync.js.map +1 -0
  151. package/dist/esm/postgres/types.js +41 -0
  152. package/dist/esm/postgres/types.js.map +1 -0
  153. package/dist/esm/registries/builder.js +410 -0
  154. package/dist/esm/registries/builder.js.map +1 -0
  155. package/dist/esm/registries/discovery.js +358 -0
  156. package/dist/esm/registries/discovery.js.map +1 -0
  157. package/dist/esm/registries/index.js +44 -0
  158. package/dist/esm/registries/index.js.map +1 -0
  159. package/dist/esm/registries/session.js +429 -0
  160. package/dist/esm/registries/session.js.map +1 -0
  161. package/dist/esm/registries/x402.js +573 -0
  162. package/dist/esm/registries/x402.js.map +1 -0
  163. package/dist/esm/types/accounts.js +12 -0
  164. package/dist/esm/types/accounts.js.map +1 -0
  165. package/dist/esm/types/common.js +12 -0
  166. package/dist/esm/types/common.js.map +1 -0
  167. package/dist/esm/types/enums.js +171 -0
  168. package/dist/esm/types/enums.js.map +1 -0
  169. package/dist/esm/types/index.js +25 -0
  170. package/dist/esm/types/index.js.map +1 -0
  171. package/dist/esm/types/instructions.js +89 -0
  172. package/dist/esm/types/instructions.js.map +1 -0
  173. package/dist/esm/utils/hash.js +53 -0
  174. package/dist/esm/utils/hash.js.map +1 -0
  175. package/dist/esm/utils/index.js +19 -0
  176. package/dist/esm/utils/index.js.map +1 -0
  177. package/dist/esm/utils/serialization.js +98 -0
  178. package/dist/esm/utils/serialization.js.map +1 -0
  179. package/dist/esm/utils/validation.js +33 -0
  180. package/dist/esm/utils/validation.js.map +1 -0
  181. package/dist/types/constants/index.d.ts +27 -0
  182. package/dist/types/constants/index.d.ts.map +1 -0
  183. package/dist/types/constants/limits.d.ts +149 -0
  184. package/dist/types/constants/limits.d.ts.map +1 -0
  185. package/dist/types/constants/programs.d.ts +69 -0
  186. package/dist/types/constants/programs.d.ts.map +1 -0
  187. package/dist/types/constants/seeds.d.ts +61 -0
  188. package/dist/types/constants/seeds.d.ts.map +1 -0
  189. package/dist/types/core/client.d.ts +323 -0
  190. package/dist/types/core/client.d.ts.map +1 -0
  191. package/dist/types/core/connection.d.ts +279 -0
  192. package/dist/types/core/connection.d.ts.map +1 -0
  193. package/dist/types/core/index.d.ts +20 -0
  194. package/dist/types/core/index.d.ts.map +1 -0
  195. package/dist/types/errors/index.d.ts +276 -0
  196. package/dist/types/errors/index.d.ts.map +1 -0
  197. package/dist/types/events/index.d.ts +248 -0
  198. package/dist/types/events/index.d.ts.map +1 -0
  199. package/dist/types/idl/index.d.ts +70 -0
  200. package/dist/types/idl/index.d.ts.map +1 -0
  201. package/dist/types/index.d.ts +68 -0
  202. package/dist/types/index.d.ts.map +1 -0
  203. package/dist/types/modules/agent.d.ts +166 -0
  204. package/dist/types/modules/agent.d.ts.map +1 -0
  205. package/dist/types/modules/attestation.d.ts +96 -0
  206. package/dist/types/modules/attestation.d.ts.map +1 -0
  207. package/dist/types/modules/base.d.ts +126 -0
  208. package/dist/types/modules/base.d.ts.map +1 -0
  209. package/dist/types/modules/escrow.d.ts +151 -0
  210. package/dist/types/modules/escrow.d.ts.map +1 -0
  211. package/dist/types/modules/feedback.d.ts +105 -0
  212. package/dist/types/modules/feedback.d.ts.map +1 -0
  213. package/dist/types/modules/index.d.ts +24 -0
  214. package/dist/types/modules/index.d.ts.map +1 -0
  215. package/dist/types/modules/indexing.d.ts +200 -0
  216. package/dist/types/modules/indexing.d.ts.map +1 -0
  217. package/dist/types/modules/ledger.d.ts +150 -0
  218. package/dist/types/modules/ledger.d.ts.map +1 -0
  219. package/dist/types/modules/tools.d.ts +182 -0
  220. package/dist/types/modules/tools.d.ts.map +1 -0
  221. package/dist/types/modules/vault.d.ts +240 -0
  222. package/dist/types/modules/vault.d.ts.map +1 -0
  223. package/dist/types/pda/index.d.ts +296 -0
  224. package/dist/types/pda/index.d.ts.map +1 -0
  225. package/dist/types/plugin/index.d.ts +171 -0
  226. package/dist/types/plugin/index.d.ts.map +1 -0
  227. package/dist/types/plugin/protocols.d.ts +152 -0
  228. package/dist/types/plugin/protocols.d.ts.map +1 -0
  229. package/dist/types/plugin/schemas.d.ts +823 -0
  230. package/dist/types/plugin/schemas.d.ts.map +1 -0
  231. package/dist/types/postgres/adapter.d.ts +355 -0
  232. package/dist/types/postgres/adapter.d.ts.map +1 -0
  233. package/dist/types/postgres/index.d.ts +24 -0
  234. package/dist/types/postgres/index.d.ts.map +1 -0
  235. package/dist/types/postgres/serializers.d.ts +30 -0
  236. package/dist/types/postgres/serializers.d.ts.map +1 -0
  237. package/dist/types/postgres/sync.d.ts +132 -0
  238. package/dist/types/postgres/sync.d.ts.map +1 -0
  239. package/dist/types/postgres/types.d.ts +167 -0
  240. package/dist/types/postgres/types.d.ts.map +1 -0
  241. package/dist/types/registries/builder.d.ts +340 -0
  242. package/dist/types/registries/builder.d.ts.map +1 -0
  243. package/dist/types/registries/discovery.d.ts +333 -0
  244. package/dist/types/registries/discovery.d.ts.map +1 -0
  245. package/dist/types/registries/index.d.ts +48 -0
  246. package/dist/types/registries/index.d.ts.map +1 -0
  247. package/dist/types/registries/session.d.ts +323 -0
  248. package/dist/types/registries/session.d.ts.map +1 -0
  249. package/dist/types/registries/x402.d.ts +463 -0
  250. package/dist/types/registries/x402.d.ts.map +1 -0
  251. package/dist/types/types/accounts.d.ts +565 -0
  252. package/dist/types/types/accounts.d.ts.map +1 -0
  253. package/dist/types/types/common.d.ts +166 -0
  254. package/dist/types/types/common.d.ts.map +1 -0
  255. package/dist/types/types/enums.d.ts +238 -0
  256. package/dist/types/types/enums.d.ts.map +1 -0
  257. package/dist/types/types/index.d.ts +28 -0
  258. package/dist/types/types/index.d.ts.map +1 -0
  259. package/dist/types/types/instructions.d.ts +366 -0
  260. package/dist/types/types/instructions.d.ts.map +1 -0
  261. package/dist/types/utils/hash.d.ts +48 -0
  262. package/dist/types/utils/hash.d.ts.map +1 -0
  263. package/dist/types/utils/index.d.ts +19 -0
  264. package/dist/types/utils/index.d.ts.map +1 -0
  265. package/dist/types/utils/serialization.d.ts +69 -0
  266. package/dist/types/utils/serialization.d.ts.map +1 -0
  267. package/dist/types/utils/validation.d.ts +29 -0
  268. package/dist/types/utils/validation.d.ts.map +1 -0
  269. package/package.json +178 -0
  270. package/src/constants/index.ts +44 -0
  271. package/src/constants/limits.ts +165 -0
  272. package/src/constants/programs.ts +83 -0
  273. package/src/constants/seeds.ts +66 -0
  274. package/src/core/client.ts +416 -0
  275. package/src/core/connection.ts +409 -0
  276. package/src/core/index.ts +20 -0
  277. package/src/errors/index.ts +346 -0
  278. package/src/events/index.ts +335 -0
  279. package/src/idl/index.ts +76 -0
  280. package/src/idl/synapse_agent_sap.json +9710 -0
  281. package/src/index.ts +253 -0
  282. package/src/modules/agent.ts +319 -0
  283. package/src/modules/attestation.ts +168 -0
  284. package/src/modules/base.ts +158 -0
  285. package/src/modules/escrow.ts +308 -0
  286. package/src/modules/feedback.ts +186 -0
  287. package/src/modules/index.ts +24 -0
  288. package/src/modules/indexing.ts +444 -0
  289. package/src/modules/ledger.ts +262 -0
  290. package/src/modules/tools.ts +411 -0
  291. package/src/modules/vault.ts +533 -0
  292. package/src/pda/index.ts +512 -0
  293. package/src/plugin/index.ts +1202 -0
  294. package/src/plugin/protocols.ts +404 -0
  295. package/src/plugin/schemas.ts +909 -0
  296. package/src/postgres/adapter.ts +904 -0
  297. package/src/postgres/index.ts +59 -0
  298. package/src/postgres/schema.sql +683 -0
  299. package/src/postgres/serializers.ts +485 -0
  300. package/src/postgres/sync.ts +254 -0
  301. package/src/postgres/types.ts +245 -0
  302. package/src/registries/builder.ts +607 -0
  303. package/src/registries/discovery.ts +572 -0
  304. package/src/registries/index.ts +77 -0
  305. package/src/registries/session.ts +613 -0
  306. package/src/registries/x402.ts +906 -0
  307. package/src/types/accounts.ts +618 -0
  308. package/src/types/common.ts +187 -0
  309. package/src/types/enums.ts +214 -0
  310. package/src/types/index.ts +92 -0
  311. package/src/types/instructions.ts +413 -0
  312. package/src/utils/hash.ts +57 -0
  313. package/src/utils/index.ts +19 -0
  314. package/src/utils/serialization.ts +98 -0
  315. package/src/utils/validation.ts +36 -0
@@ -0,0 +1,166 @@
1
+ /**
2
+ * @module types/common
3
+ * @description Shared helper structs used across accounts and instructions.
4
+ *
5
+ * These types appear as nested fields in both on-chain account data
6
+ * and instruction argument DTOs.
7
+ *
8
+ * @category Types
9
+ * @since v0.1.0
10
+ */
11
+ import type { PublicKey } from "@solana/web3.js";
12
+ import type BN from "bn.js";
13
+ import type { PluginTypeKind, SettlementModeKind, TokenTypeKind } from "./enums";
14
+ /**
15
+ * @interface Capability
16
+ * @description Agent capability descriptor declaring what the agent can do.
17
+ *
18
+ * Capabilities use a namespaced identifier format (e.g. `"jupiter:swap"`).
19
+ * They are indexed on-chain via the `CapabilityIndex` PDA for scalable discovery.
20
+ *
21
+ * @category Types
22
+ * @since v0.1.0
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const cap: Capability = {
27
+ * id: "jupiter:swap",
28
+ * description: "Token swap via Jupiter aggregator",
29
+ * protocolId: "jupiter",
30
+ * version: "1.0",
31
+ * };
32
+ * ```
33
+ */
34
+ export interface Capability {
35
+ /** Unique identifier (e.g. `"jupiter:swap"`). */
36
+ readonly id: string;
37
+ /** Human-readable description of the capability. */
38
+ readonly description: string | null;
39
+ /** Protocol namespace this capability belongs to. */
40
+ readonly protocolId: string | null;
41
+ /** Semantic version of the capability. */
42
+ readonly version: string | null;
43
+ }
44
+ /**
45
+ * @interface VolumeCurveBreakpoint
46
+ * @description A single breakpoint in a volume-based pricing curve.
47
+ *
48
+ * After a consumer exceeds `afterCalls` total invocations, the effective
49
+ * price drops to `pricePerCall`. Multiple breakpoints form a tiered
50
+ * discount schedule (ERC-8004–style).
51
+ *
52
+ * @category Types
53
+ * @since v0.1.0
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * const curve: VolumeCurveBreakpoint[] = [
58
+ * { afterCalls: 100, pricePerCall: new BN(90_000) },
59
+ * { afterCalls: 500, pricePerCall: new BN(70_000) },
60
+ * ];
61
+ * ```
62
+ */
63
+ export interface VolumeCurveBreakpoint {
64
+ /** Number of cumulative calls after which this price tier activates. */
65
+ readonly afterCalls: number;
66
+ /** Price per call (in token base units) once `afterCalls` is exceeded. */
67
+ readonly pricePerCall: BN;
68
+ }
69
+ /**
70
+ * @interface PricingTier
71
+ * @description Full pricing tier for agent services, including rate limits,
72
+ * supported token, settlement mode, and optional volume discounts.
73
+ *
74
+ * Agents can expose multiple tiers (e.g. free, pro) each with independent
75
+ * rate-limiting and pricing parameters.
76
+ *
77
+ * @category Types
78
+ * @since v0.1.0
79
+ * @see {@link SettlementMode} for settlement strategies.
80
+ * @see {@link VolumeCurveBreakpoint} for volume-based discounts.
81
+ *
82
+ * @example
83
+ * ```ts
84
+ * import { TokenType, SettlementMode } from "@synapse-sap/sdk";
85
+ *
86
+ * const tier: PricingTier = {
87
+ * tierId: "pro",
88
+ * pricePerCall: new BN(100_000),
89
+ * minPricePerCall: null,
90
+ * maxPricePerCall: null,
91
+ * rateLimit: 60,
92
+ * maxCallsPerSession: 1000,
93
+ * burstLimit: 10,
94
+ * tokenType: TokenType.Usdc,
95
+ * tokenMint: USDC_MINT,
96
+ * tokenDecimals: 6,
97
+ * settlementMode: SettlementMode.Escrow,
98
+ * minEscrowDeposit: new BN(1_000_000),
99
+ * batchIntervalSec: null,
100
+ * volumeCurve: null,
101
+ * };
102
+ * ```
103
+ */
104
+ export interface PricingTier {
105
+ /** Unique identifier for this tier (e.g. `"free"`, `"pro"`). */
106
+ readonly tierId: string;
107
+ /** Default price per call in token base units. */
108
+ readonly pricePerCall: BN;
109
+ /** Floor price guard (optional). */
110
+ readonly minPricePerCall: BN | null;
111
+ /** Ceiling price guard (optional). */
112
+ readonly maxPricePerCall: BN | null;
113
+ /** Maximum calls per second allowed. */
114
+ readonly rateLimit: number;
115
+ /** Maximum calls allowed within a single session. */
116
+ readonly maxCallsPerSession: number;
117
+ /** Burst capacity above steady-state rate limit. */
118
+ readonly burstLimit: number | null;
119
+ /** Token type accepted for payment. */
120
+ readonly tokenType: TokenTypeKind;
121
+ /** SPL token mint address (required when `tokenType` is `Spl`). */
122
+ readonly tokenMint: PublicKey | null;
123
+ /** Decimal places for the token. */
124
+ readonly tokenDecimals: number | null;
125
+ /** Settlement strategy for this tier. */
126
+ readonly settlementMode: SettlementModeKind | null;
127
+ /** Minimum escrow deposit required (for escrow settlement). */
128
+ readonly minEscrowDeposit: BN | null;
129
+ /** Batch settlement interval in seconds (for batched settlement). */
130
+ readonly batchIntervalSec: number | null;
131
+ /** Optional volume discount breakpoints. */
132
+ readonly volumeCurve: VolumeCurveBreakpoint[] | null;
133
+ }
134
+ /**
135
+ * @interface PluginRef
136
+ * @description Reference to an active plugin PDA attached to an agent.
137
+ *
138
+ * Stored in the agent's `activePlugins` array to track which extensions
139
+ * are currently enabled.
140
+ *
141
+ * @category Types
142
+ * @since v0.1.0
143
+ */
144
+ export interface PluginRef {
145
+ /** Discriminant identifying the plugin extension type. */
146
+ readonly pluginType: PluginTypeKind;
147
+ /** PDA address of the plugin account. */
148
+ readonly pda: PublicKey;
149
+ }
150
+ /**
151
+ * @interface Settlement
152
+ * @description Individual settlement entry used in batch settlement instructions.
153
+ *
154
+ * Each entry describes how many calls to settle for a given service, identified
155
+ * by its 32-byte hash.
156
+ *
157
+ * @category Types
158
+ * @since v0.1.0
159
+ */
160
+ export interface Settlement {
161
+ /** Number of calls to settle in this batch entry. */
162
+ readonly callsToSettle: BN;
163
+ /** SHA-256 hash identifying the service being settled. */
164
+ readonly serviceHash: number[];
165
+ }
166
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/types/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAMjF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,UAAU;IACzB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,qDAAqD;IACrD,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,0CAA0C;IAC1C,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAMD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,qBAAqB;IACpC,wEAAwE;IACxE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,0EAA0E;IAC1E,QAAQ,CAAC,YAAY,EAAE,EAAE,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,WAAW,WAAW;IAC1B,gEAAgE;IAChE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kDAAkD;IAClD,QAAQ,CAAC,YAAY,EAAE,EAAE,CAAC;IAC1B,oCAAoC;IACpC,QAAQ,CAAC,eAAe,EAAE,EAAE,GAAG,IAAI,CAAC;IACpC,sCAAsC;IACtC,QAAQ,CAAC,eAAe,EAAE,EAAE,GAAG,IAAI,CAAC;IACpC,wCAAwC;IACxC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,qDAAqD;IACrD,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,oDAAoD;IACpD,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,uCAAuC;IACvC,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;IAClC,mEAAmE;IACnE,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IACrC,oCAAoC;IACpC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,yCAAyC;IACzC,QAAQ,CAAC,cAAc,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACnD,+DAA+D;IAC/D,QAAQ,CAAC,gBAAgB,EAAE,EAAE,GAAG,IAAI,CAAC;IACrC,qEAAqE;IACrE,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,4CAA4C;IAC5C,QAAQ,CAAC,WAAW,EAAE,qBAAqB,EAAE,GAAG,IAAI,CAAC;CACtD;AAMD;;;;;;;;;GASG;AACH,MAAM,WAAW,SAAS;IACxB,0DAA0D;IAC1D,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,yCAAyC;IACzC,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;CACzB;AAMD;;;;;;;;;GASG;AACH,MAAM,WAAW,UAAU;IACzB,qDAAqD;IACrD,QAAQ,CAAC,aAAa,EAAE,EAAE,CAAC;IAC3B,0DAA0D;IAC1D,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;CAChC"}
@@ -0,0 +1,238 @@
1
+ /**
2
+ * @module types/enums
3
+ * @description Anchor-compatible enum variant objects for SAP v2.
4
+ *
5
+ * Each enum mirrors the Rust discriminant format used by Anchor:
6
+ * `{ variant: {} }` — e.g. `{ sol: {} }` for `TokenType::Sol`.
7
+ *
8
+ * Use the `*Kind` types for function signatures.
9
+ *
10
+ * @category Types
11
+ * @since v0.1.0
12
+ * @see {@link https://solana.com/docs | Solana Docs}
13
+ */
14
+ /**
15
+ * @name TokenType
16
+ * @description Anchor-compatible enum variants for token types accepted by agent pricing and escrow.
17
+ *
18
+ * - `Sol` — Native SOL.
19
+ * - `Usdc` — USDC stablecoin.
20
+ * - `Spl` — Arbitrary SPL token (requires `tokenMint`).
21
+ *
22
+ * @category Types
23
+ * @since v0.1.0
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * import { TokenType } from "@synapse-sap/sdk";
28
+ *
29
+ * const tier = { tokenType: TokenType.Sol };
30
+ * ```
31
+ */
32
+ export declare const TokenType: {
33
+ readonly Sol: {
34
+ readonly sol: {};
35
+ };
36
+ readonly Usdc: {
37
+ readonly usdc: {};
38
+ };
39
+ readonly Spl: {
40
+ readonly spl: {};
41
+ };
42
+ };
43
+ /**
44
+ * @name TokenTypeKind
45
+ * @description Union of all {@link TokenType} variant shapes.
46
+ * Use this as the type for any parameter that accepts a token type discriminant.
47
+ */
48
+ export type TokenTypeKind = (typeof TokenType)[keyof typeof TokenType];
49
+ /**
50
+ * @name PluginType
51
+ * @description Anchor-compatible enum variants for plugin extension types.
52
+ *
53
+ * Plugins extend agent functionality and are feature-gated on-chain.
54
+ *
55
+ * - `Memory` — Encrypted memory / vault storage.
56
+ * - `Validation` — Custom validation logic.
57
+ * - `Delegation` — Hot-wallet delegation.
58
+ * - `Analytics` — Metrics & analytics.
59
+ * - `Governance` — DAO / governance participation.
60
+ * - `Custom` — User-defined plugin type.
61
+ *
62
+ * @category Types
63
+ * @since v0.1.0
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * import { PluginType } from "@synapse-sap/sdk";
68
+ *
69
+ * const ref = { pluginType: PluginType.Memory, pda: vaultPda };
70
+ * ```
71
+ */
72
+ export declare const PluginType: {
73
+ readonly Memory: {
74
+ readonly memory: {};
75
+ };
76
+ readonly Validation: {
77
+ readonly validation: {};
78
+ };
79
+ readonly Delegation: {
80
+ readonly delegation: {};
81
+ };
82
+ readonly Analytics: {
83
+ readonly analytics: {};
84
+ };
85
+ readonly Governance: {
86
+ readonly governance: {};
87
+ };
88
+ readonly Custom: {
89
+ readonly custom: {};
90
+ };
91
+ };
92
+ /**
93
+ * @name PluginTypeKind
94
+ * @description Union of all {@link PluginType} variant shapes.
95
+ */
96
+ export type PluginTypeKind = (typeof PluginType)[keyof typeof PluginType];
97
+ /**
98
+ * @name SettlementMode
99
+ * @description Anchor-compatible enum variants for payment settlement strategies.
100
+ *
101
+ * - `Instant` — Pay-per-call, settled immediately on invocation.
102
+ * - `Escrow` — Pre-funded escrow account with per-call drawdown.
103
+ * - `Batched` — Aggregated settlement at fixed intervals.
104
+ * - `X402` — HTTP 402-based micropayment protocol settlement.
105
+ *
106
+ * @category Types
107
+ * @since v0.1.0
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * import { SettlementMode } from "@synapse-sap/sdk";
112
+ *
113
+ * const tier = { settlementMode: SettlementMode.Escrow };
114
+ * ```
115
+ */
116
+ export declare const SettlementMode: {
117
+ readonly Instant: {
118
+ readonly instant: {};
119
+ };
120
+ readonly Escrow: {
121
+ readonly escrow: {};
122
+ };
123
+ readonly Batched: {
124
+ readonly batched: {};
125
+ };
126
+ readonly X402: {
127
+ readonly x402: {};
128
+ };
129
+ };
130
+ /**
131
+ * @name SettlementModeKind
132
+ * @description Union of all {@link SettlementMode} variant shapes.
133
+ */
134
+ export type SettlementModeKind = (typeof SettlementMode)[keyof typeof SettlementMode];
135
+ /**
136
+ * @name ToolHttpMethod
137
+ * @description Anchor-compatible enum variants for the HTTP method exposed by a tool.
138
+ *
139
+ * - `Get` / `Post` / `Put` / `Delete` — Standard REST verbs.
140
+ * - `Compound` — Multi-step tool (calls several sub-operations).
141
+ *
142
+ * @category Types
143
+ * @since v0.1.0
144
+ *
145
+ * @example
146
+ * ```ts
147
+ * import { ToolHttpMethod } from "@synapse-sap/sdk";
148
+ *
149
+ * const args = { httpMethod: ToolHttpMethod.Post };
150
+ * ```
151
+ */
152
+ export declare const ToolHttpMethod: {
153
+ readonly Get: {
154
+ readonly get: {};
155
+ };
156
+ readonly Post: {
157
+ readonly post: {};
158
+ };
159
+ readonly Put: {
160
+ readonly put: {};
161
+ };
162
+ readonly Delete: {
163
+ readonly delete: {};
164
+ };
165
+ readonly Compound: {
166
+ readonly compound: {};
167
+ };
168
+ };
169
+ /**
170
+ * @name ToolHttpMethodKind
171
+ * @description Union of all {@link ToolHttpMethod} variant shapes.
172
+ */
173
+ export type ToolHttpMethodKind = (typeof ToolHttpMethod)[keyof typeof ToolHttpMethod];
174
+ /**
175
+ * @name ToolCategory
176
+ * @description Anchor-compatible enum variants for classifying tools in the on-chain registry.
177
+ *
178
+ * Categories power cross-agent tool discovery via the `ToolCategoryIndex` PDA.
179
+ *
180
+ * - `Swap` — Token swap / DEX tools.
181
+ * - `Lend` — Lending protocol tools.
182
+ * - `Stake` — Staking / validator tools.
183
+ * - `Nft` — NFT minting / marketplace tools.
184
+ * - `Payment` — Payment & invoicing tools.
185
+ * - `Data` — Data feeds / oracles.
186
+ * - `Governance` — DAO & governance tools.
187
+ * - `Bridge` — Cross-chain bridge tools.
188
+ * - `Analytics` — On-chain analytics.
189
+ * - `Custom` — User-defined category.
190
+ *
191
+ * @category Types
192
+ * @since v0.1.0
193
+ *
194
+ * @example
195
+ * ```ts
196
+ * import { ToolCategory } from "@synapse-sap/sdk";
197
+ *
198
+ * const args = { category: ToolCategory.Swap };
199
+ * ```
200
+ */
201
+ export declare const ToolCategory: {
202
+ readonly Swap: {
203
+ readonly swap: {};
204
+ };
205
+ readonly Lend: {
206
+ readonly lend: {};
207
+ };
208
+ readonly Stake: {
209
+ readonly stake: {};
210
+ };
211
+ readonly Nft: {
212
+ readonly nft: {};
213
+ };
214
+ readonly Payment: {
215
+ readonly payment: {};
216
+ };
217
+ readonly Data: {
218
+ readonly data: {};
219
+ };
220
+ readonly Governance: {
221
+ readonly governance: {};
222
+ };
223
+ readonly Bridge: {
224
+ readonly bridge: {};
225
+ };
226
+ readonly Analytics: {
227
+ readonly analytics: {};
228
+ };
229
+ readonly Custom: {
230
+ readonly custom: {};
231
+ };
232
+ };
233
+ /**
234
+ * @name ToolCategoryKind
235
+ * @description Union of all {@link ToolCategory} variant shapes.
236
+ */
237
+ export type ToolCategoryKind = (typeof ToolCategory)[keyof typeof ToolCategory];
238
+ //# sourceMappingURL=enums.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../src/types/enums.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;CAIZ,CAAC;AAEX;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAMvE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;CAOb,CAAC;AAEX;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAM1E;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;CAKjB,CAAC;AAEX;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAC5B,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAMvD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;CAMjB,CAAC;AAEX;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAC5B,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAMvD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWf,CAAC;AAEX;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAC1B,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @module types
3
+ * @description Strongly-typed domain models for SAP v2.
4
+ *
5
+ * Every type mirrors the onchain Rust struct / enum exactly.
6
+ * Types are organized into four layers:
7
+ *
8
+ * - **enums** — Anchor-style enum variant objects (`TokenType`, `ToolCategory`, …)
9
+ * - **common** — Shared helper structs (`Capability`, `PricingTier`, `Settlement`, …)
10
+ * - **accounts** — Deserialized on-chain PDA account data (`AgentAccountData`, …)
11
+ * - **instructions** — Instruction argument DTOs + permission/schema helpers
12
+ *
13
+ * @category Types
14
+ * @since v0.1.0
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * import type { AgentAccountData, RegisterAgentArgs } from "@synapse-sap/sdk/types";
19
+ * import { TokenType, SettlementMode } from "@synapse-sap/sdk/types";
20
+ * ```
21
+ */
22
+ export { TokenType, PluginType, SettlementMode, ToolHttpMethod, ToolCategory, } from "./enums";
23
+ export type { TokenTypeKind, PluginTypeKind, SettlementModeKind, ToolHttpMethodKind, ToolCategoryKind, } from "./enums";
24
+ export type { Capability, VolumeCurveBreakpoint, PricingTier, PluginRef, Settlement, } from "./common";
25
+ export type { AgentAccountData, AgentStatsData, FeedbackAccountData, CapabilityIndexData, ProtocolIndexData, ToolCategoryIndexData, GlobalRegistryData, MemoryVaultData, SessionLedgerData, EpochPageData, VaultDelegateData, SessionCheckpointData, ToolDescriptorData, EscrowAccountData, AgentAttestationData, MemoryLedgerData, LedgerPageData, } from "./accounts";
26
+ export type { RegisterAgentArgs, UpdateAgentArgs, GiveFeedbackArgs, UpdateFeedbackArgs, PublishToolArgs, UpdateToolArgs, InscribeToolSchemaArgs, InscribeMemoryArgs, CompactInscribeArgs, CreateEscrowArgs, CreateAttestationArgs, DelegatePermissionBit, SchemaTypeValue, CompressionTypeValue, } from "./instructions";
27
+ export { DelegatePermission, SchemaType, CompressionType, } from "./instructions";
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EACL,SAAS,EACT,UAAU,EACV,cAAc,EACd,cAAc,EACd,YAAY,GACb,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,UAAU,EACV,qBAAqB,EACrB,WAAW,EACX,SAAS,EACT,UAAU,GACX,MAAM,UAAU,CAAC;AAGlB,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,GACf,MAAM,YAAY,CAAC;AAGpB,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,eAAe,GAChB,MAAM,gBAAgB,CAAC"}