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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/dist/cjs/client.js +1 -1
  2. package/dist/cjs/client.js.map +1 -1
  3. package/dist/cjs/idl/synapse_agent_sap.json +2475 -898
  4. package/dist/esm/client.js +1 -1
  5. package/dist/esm/client.js.map +1 -1
  6. package/dist/esm/idl/synapse_agent_sap.json +2475 -898
  7. package/package.json +1 -1
  8. package/dist/esm/instructions/memory.d.ts +0 -8
  9. package/dist/esm/instructions/memory.d.ts.map +0 -1
  10. package/dist/esm/instructions/memory.js +0 -234
  11. package/dist/esm/instructions/memory.js.map +0 -1
  12. package/dist/types/constants/addresses.d.ts +0 -117
  13. package/dist/types/constants/addresses.d.ts.map +0 -1
  14. package/dist/types/constants/index.d.ts +0 -31
  15. package/dist/types/constants/index.d.ts.map +0 -1
  16. package/dist/types/constants/limits.d.ts +0 -149
  17. package/dist/types/constants/limits.d.ts.map +0 -1
  18. package/dist/types/constants/network.d.ts +0 -81
  19. package/dist/types/constants/network.d.ts.map +0 -1
  20. package/dist/types/constants/payments.d.ts +0 -121
  21. package/dist/types/constants/payments.d.ts.map +0 -1
  22. package/dist/types/constants/programs.d.ts +0 -69
  23. package/dist/types/constants/programs.d.ts.map +0 -1
  24. package/dist/types/constants/seeds.d.ts +0 -82
  25. package/dist/types/constants/seeds.d.ts.map +0 -1
  26. package/dist/types/core/client.d.ts +0 -467
  27. package/dist/types/core/client.d.ts.map +0 -1
  28. package/dist/types/core/connection.d.ts +0 -305
  29. package/dist/types/core/connection.d.ts.map +0 -1
  30. package/dist/types/core/index.d.ts +0 -20
  31. package/dist/types/core/index.d.ts.map +0 -1
  32. package/dist/types/errors/index.d.ts +0 -335
  33. package/dist/types/errors/index.d.ts.map +0 -1
  34. package/dist/types/events/geyser.d.ts +0 -150
  35. package/dist/types/events/geyser.d.ts.map +0 -1
  36. package/dist/types/events/index.d.ts +0 -248
  37. package/dist/types/events/index.d.ts.map +0 -1
  38. package/dist/types/idl/index.d.ts +0 -70
  39. package/dist/types/idl/index.d.ts.map +0 -1
  40. package/dist/types/index.d.ts +0 -86
  41. package/dist/types/index.d.ts.map +0 -1
  42. package/dist/types/modules/agent.d.ts +0 -156
  43. package/dist/types/modules/agent.d.ts.map +0 -1
  44. package/dist/types/modules/attestation.d.ts +0 -96
  45. package/dist/types/modules/attestation.d.ts.map +0 -1
  46. package/dist/types/modules/base.d.ts +0 -215
  47. package/dist/types/modules/base.d.ts.map +0 -1
  48. package/dist/types/modules/escrow-v2.d.ts +0 -285
  49. package/dist/types/modules/escrow-v2.d.ts.map +0 -1
  50. package/dist/types/modules/feedback.d.ts +0 -105
  51. package/dist/types/modules/feedback.d.ts.map +0 -1
  52. package/dist/types/modules/index.d.ts +0 -27
  53. package/dist/types/modules/index.d.ts.map +0 -1
  54. package/dist/types/modules/indexing.d.ts +0 -200
  55. package/dist/types/modules/indexing.d.ts.map +0 -1
  56. package/dist/types/modules/ledger.d.ts +0 -150
  57. package/dist/types/modules/ledger.d.ts.map +0 -1
  58. package/dist/types/modules/receipt.d.ts +0 -91
  59. package/dist/types/modules/receipt.d.ts.map +0 -1
  60. package/dist/types/modules/staking.d.ts +0 -51
  61. package/dist/types/modules/staking.d.ts.map +0 -1
  62. package/dist/types/modules/subscription.d.ts +0 -33
  63. package/dist/types/modules/subscription.d.ts.map +0 -1
  64. package/dist/types/modules/tools.d.ts +0 -172
  65. package/dist/types/modules/tools.d.ts.map +0 -1
  66. package/dist/types/modules/vault.d.ts +0 -240
  67. package/dist/types/modules/vault.d.ts.map +0 -1
  68. package/dist/types/parser/client.d.ts +0 -123
  69. package/dist/types/parser/client.d.ts.map +0 -1
  70. package/dist/types/parser/complete.d.ts +0 -90
  71. package/dist/types/parser/complete.d.ts.map +0 -1
  72. package/dist/types/parser/index.d.ts +0 -40
  73. package/dist/types/parser/index.d.ts.map +0 -1
  74. package/dist/types/parser/inner.d.ts +0 -114
  75. package/dist/types/parser/inner.d.ts.map +0 -1
  76. package/dist/types/parser/instructions.d.ts +0 -76
  77. package/dist/types/parser/instructions.d.ts.map +0 -1
  78. package/dist/types/parser/transaction.d.ts +0 -77
  79. package/dist/types/parser/transaction.d.ts.map +0 -1
  80. package/dist/types/parser/types.d.ts +0 -154
  81. package/dist/types/parser/types.d.ts.map +0 -1
  82. package/dist/types/pda/index.d.ts +0 -527
  83. package/dist/types/pda/index.d.ts.map +0 -1
  84. package/dist/types/plugin/index.d.ts +0 -171
  85. package/dist/types/plugin/index.d.ts.map +0 -1
  86. package/dist/types/plugin/protocols.d.ts +0 -152
  87. package/dist/types/plugin/protocols.d.ts.map +0 -1
  88. package/dist/types/plugin/schemas.d.ts +0 -829
  89. package/dist/types/plugin/schemas.d.ts.map +0 -1
  90. package/dist/types/postgres/adapter.d.ts +0 -355
  91. package/dist/types/postgres/adapter.d.ts.map +0 -1
  92. package/dist/types/postgres/index.d.ts +0 -24
  93. package/dist/types/postgres/index.d.ts.map +0 -1
  94. package/dist/types/postgres/serializers.d.ts +0 -30
  95. package/dist/types/postgres/serializers.d.ts.map +0 -1
  96. package/dist/types/postgres/sync.d.ts +0 -156
  97. package/dist/types/postgres/sync.d.ts.map +0 -1
  98. package/dist/types/postgres/types.d.ts +0 -167
  99. package/dist/types/postgres/types.d.ts.map +0 -1
  100. package/dist/types/registries/builder.d.ts +0 -333
  101. package/dist/types/registries/builder.d.ts.map +0 -1
  102. package/dist/types/registries/discovery.d.ts +0 -333
  103. package/dist/types/registries/discovery.d.ts.map +0 -1
  104. package/dist/types/registries/fairscale.d.ts +0 -680
  105. package/dist/types/registries/fairscale.d.ts.map +0 -1
  106. package/dist/types/registries/index.d.ts +0 -52
  107. package/dist/types/registries/index.d.ts.map +0 -1
  108. package/dist/types/registries/metaplex-bridge.d.ts +0 -488
  109. package/dist/types/registries/metaplex-bridge.d.ts.map +0 -1
  110. package/dist/types/registries/session.d.ts +0 -317
  111. package/dist/types/registries/session.d.ts.map +0 -1
  112. package/dist/types/registries/x402.d.ts +0 -523
  113. package/dist/types/registries/x402.d.ts.map +0 -1
  114. package/dist/types/types/accounts.d.ts +0 -817
  115. package/dist/types/types/accounts.d.ts.map +0 -1
  116. package/dist/types/types/common.d.ts +0 -166
  117. package/dist/types/types/common.d.ts.map +0 -1
  118. package/dist/types/types/endpoint.d.ts +0 -161
  119. package/dist/types/types/endpoint.d.ts.map +0 -1
  120. package/dist/types/types/enums.d.ts +0 -353
  121. package/dist/types/types/enums.d.ts.map +0 -1
  122. package/dist/types/types/index.d.ts +0 -29
  123. package/dist/types/types/index.d.ts.map +0 -1
  124. package/dist/types/types/instructions.d.ts +0 -400
  125. package/dist/types/types/instructions.d.ts.map +0 -1
  126. package/dist/types/utils/anchor-errors.d.ts +0 -61
  127. package/dist/types/utils/anchor-errors.d.ts.map +0 -1
  128. package/dist/types/utils/endpoint-validator.d.ts +0 -110
  129. package/dist/types/utils/endpoint-validator.d.ts.map +0 -1
  130. package/dist/types/utils/escrow-validation.d.ts +0 -145
  131. package/dist/types/utils/escrow-validation.d.ts.map +0 -1
  132. package/dist/types/utils/hash.d.ts +0 -75
  133. package/dist/types/utils/hash.d.ts.map +0 -1
  134. package/dist/types/utils/index.d.ts +0 -36
  135. package/dist/types/utils/index.d.ts.map +0 -1
  136. package/dist/types/utils/merchant-validator.d.ts +0 -176
  137. package/dist/types/utils/merchant-validator.d.ts.map +0 -1
  138. package/dist/types/utils/network-normalizer.d.ts +0 -120
  139. package/dist/types/utils/network-normalizer.d.ts.map +0 -1
  140. package/dist/types/utils/priority-fee.d.ts +0 -205
  141. package/dist/types/utils/priority-fee.d.ts.map +0 -1
  142. package/dist/types/utils/rpc-strategy.d.ts +0 -179
  143. package/dist/types/utils/rpc-strategy.d.ts.map +0 -1
  144. package/dist/types/utils/schemas.d.ts +0 -351
  145. package/dist/types/utils/schemas.d.ts.map +0 -1
  146. package/dist/types/utils/serialization.d.ts +0 -69
  147. package/dist/types/utils/serialization.d.ts.map +0 -1
  148. package/dist/types/utils/validation.d.ts +0 -29
  149. package/dist/types/utils/validation.d.ts.map +0 -1
  150. package/dist/types/utils/volume-curve.d.ts +0 -60
  151. package/dist/types/utils/volume-curve.d.ts.map +0 -1
  152. package/dist/types/utils/x402-direct.d.ts +0 -114
  153. package/dist/types/utils/x402-direct.d.ts.map +0 -1
@@ -1,156 +0,0 @@
1
- /**
2
- * @module agent
3
- * @description Agent lifecycle operations for the Synapse Agent Protocol.
4
- *
5
- * Covers: register, update, deactivate, reactivate, close,
6
- * report calls, update reputation metrics, and account fetching.
7
- *
8
- * @category Modules
9
- * @since v0.1.0
10
- * @packageDocumentation
11
- */
12
- import { type PublicKey, type TransactionSignature } from "@solana/web3.js";
13
- import { BaseModule } from "./base";
14
- import type { AgentAccountData, AgentStatsData, RegisterAgentArgs, UpdateAgentArgs } from "../types";
15
- /**
16
- * @name AgentModule
17
- * @description Manages the full agent lifecycle on the Synapse Agent Protocol.
18
- * Provides methods to register, update, deactivate, reactivate, and close
19
- * agent identities, as well as self-report call metrics and reputation data.
20
- *
21
- * @category Modules
22
- * @since v0.1.0
23
- * @extends BaseModule
24
- *
25
- * @example
26
- * ```ts
27
- * const sap = new SapClient(provider);
28
- * // Register a new agent
29
- * const sig = await sap.agent.register({
30
- * name: "my-agent",
31
- * description: "An example agent",
32
- * capabilities: [0, 1],
33
- * pricing: { free: {} },
34
- * protocols: [0],
35
- * });
36
- * // Fetch agent data
37
- * const data = await sap.agent.fetch();
38
- * ```
39
- */
40
- export declare class AgentModule extends BaseModule {
41
- /**
42
- * @name deriveAgent
43
- * @description Derive the `AgentAccount` PDA for a wallet.
44
- * @param wallet - The wallet public key. Defaults to the connected wallet.
45
- * @returns A tuple of `[PublicKey, bump]` for the agent PDA.
46
- * @see {@link deriveAgent} from `pda/` module for the underlying derivation.
47
- * @since v0.1.0
48
- */
49
- deriveAgent(wallet?: PublicKey): readonly [PublicKey, number];
50
- /**
51
- * @name deriveStats
52
- * @description Derive the `AgentStats` PDA for a given agent.
53
- * @param agentPda - The agent account PDA.
54
- * @returns A tuple of `[PublicKey, bump]` for the stats PDA.
55
- * @see {@link deriveAgentStats} from `pda/` module for the underlying derivation.
56
- * @since v0.1.0
57
- */
58
- deriveStats(agentPda: PublicKey): readonly [PublicKey, number];
59
- /**
60
- * @name derivePricingMenu
61
- * @description Derive the `AgentPricingMenu` PDA for a given agent.
62
- * @param agentPda - The agent account PDA.
63
- * @returns A tuple of `[PublicKey, bump]` for the pricing menu PDA.
64
- * @see {@link derivePricingMenu} from `pda/` module for the underlying derivation.
65
- * @since v0.12.0
66
- */
67
- derivePricingMenu(agentPda: PublicKey): readonly [PublicKey, number];
68
- /**
69
- * @name register
70
- * @description Register a new agent identity on-chain. Creates the
71
- * `AgentAccount`, `AgentStats`, and updates the `GlobalRegistry`.
72
- * @param args - Registration parameters (name, description, capabilities, pricing, protocols, etc.).
73
- * @returns {Promise<TransactionSignature>} The transaction signature.
74
- * @since v0.1.0
75
- */
76
- register(args: RegisterAgentArgs): Promise<TransactionSignature>;
77
- /**
78
- * @name update
79
- * @description Update an existing agent's metadata fields. All fields
80
- * are optional — only non-null values are written.
81
- * @param args - Partial update parameters.
82
- * @returns {Promise<TransactionSignature>} The transaction signature.
83
- * @since v0.1.0
84
- */
85
- update(args: UpdateAgentArgs): Promise<TransactionSignature>;
86
- /**
87
- * @name deactivate
88
- * @description Deactivate an agent, setting `is_active = false`.
89
- * The agent remains on-chain but is excluded from active discovery.
90
- * @returns {Promise<TransactionSignature>} The transaction signature.
91
- * @since v0.1.0
92
- */
93
- deactivate(): Promise<TransactionSignature>;
94
- /**
95
- * @name reactivate
96
- * @description Reactivate a previously deactivated agent, restoring
97
- * it to active status.
98
- * @returns {Promise<TransactionSignature>} The transaction signature.
99
- * @since v0.1.0
100
- */
101
- reactivate(): Promise<TransactionSignature>;
102
- /**
103
- * @name close
104
- * @description Close an agent PDA and its associated stats PDA.
105
- * Rent is returned to the owner wallet.
106
- * @returns {Promise<TransactionSignature>} The transaction signature.
107
- * @since v0.1.0
108
- */
109
- close(): Promise<TransactionSignature>;
110
- /**
111
- * @name fetch
112
- * @description Fetch the deserialized `AgentAccount` data for a wallet.
113
- * @param wallet - The wallet public key. Defaults to the connected wallet.
114
- * @returns {Promise<AgentAccountData>} The agent account data.
115
- * @throws Will throw if the agent account does not exist.
116
- * @since v0.1.0
117
- */
118
- fetch(wallet?: PublicKey): Promise<AgentAccountData>;
119
- /**
120
- * @name fetchNullable
121
- * @description Fetch the deserialized `AgentAccount` data, or `null`
122
- * if the account doesn't exist on-chain.
123
- * @param wallet - The wallet public key. Defaults to the connected wallet.
124
- * @returns {Promise<AgentAccountData | null>} The agent data or `null`.
125
- * @since v0.1.0
126
- */
127
- fetchNullable(wallet?: PublicKey): Promise<AgentAccountData | null>;
128
- /**
129
- * @name fetchStats
130
- * @description Fetch the deserialized `AgentStats` data for an agent.
131
- * @param agentPda - The agent account PDA.
132
- * @returns {Promise<AgentStatsData>} The agent stats data.
133
- * @throws Will throw if the stats account does not exist.
134
- * @since v0.1.0
135
- */
136
- fetchStats(agentPda: PublicKey): Promise<AgentStatsData>;
137
- /**
138
- * @name fetchStatsNullable
139
- * @description Fetch the deserialized `AgentStats` data, or `null`
140
- * if the account doesn't exist on-chain.
141
- * @param agentPda - The agent account PDA.
142
- * @returns {Promise<AgentStatsData | null>} The stats data or `null`.
143
- * @since v0.1.0
144
- */
145
- fetchStatsNullable(agentPda: PublicKey): Promise<AgentStatsData | null>;
146
- /**
147
- * @name fetchGlobalRegistry
148
- * @description Fetch the `GlobalRegistry` singleton account that tracks
149
- * aggregate protocol statistics.
150
- * @returns {Promise<GlobalRegistryData>} The global registry data.
151
- * @throws Will throw if the registry has not been initialized.
152
- * @since v0.1.0
153
- */
154
- fetchGlobalRegistry(): Promise<import("../types").GlobalRegistryData>;
155
- }
156
- //# sourceMappingURL=agent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":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AgB,GAAG,IAAI,CAAC;IAKzE;;;;;;;OAOG;IACG,UAAU,CAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC;IAK9D;;;;;;;OAOG;IACG,kBAAkB,CAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAK7E;;;;;;;OAOG;IACG,mBAAmB,IAAI,OAAO,CAAC,OAAO,UAAU,EAAE,kBAAkB,CAAC;CAI5E"}
@@ -1,96 +0,0 @@
1
- /**
2
- * @module attestation
3
- * @description Web-of-trust attestations — create, revoke, and close
4
- * on-chain attestations that vouch for agent trustworthiness.
5
- *
6
- * Attestations are signed endorsements from one wallet to an agent,
7
- * forming a composable trust graph on Solana.
8
- *
9
- * @category Modules
10
- * @since v0.1.0
11
- * @packageDocumentation
12
- */
13
- import { type PublicKey, type TransactionSignature } from "@solana/web3.js";
14
- import { BaseModule } from "./base";
15
- import type { AgentAttestationData, CreateAttestationArgs } from "../types";
16
- /**
17
- * @name AttestationModule
18
- * @description Manages on-chain attestations for the Synapse Agent Protocol.
19
- * Provides methods to create, revoke, close, and fetch attestation PDAs
20
- * that form the web-of-trust layer.
21
- *
22
- * @category Modules
23
- * @since v0.1.0
24
- * @extends BaseModule
25
- *
26
- * @example
27
- * ```ts
28
- * const sap = new SapClient(provider);
29
- * // Create an attestation for an agent
30
- * const sig = await sap.attestation.create(agentWallet, {
31
- * attestationType: { identity: {} },
32
- * metadataHash: [...],
33
- * expiresAt: null,
34
- * });
35
- * ```
36
- */
37
- export declare class AttestationModule extends BaseModule {
38
- /**
39
- * @name deriveAttestation
40
- * @description Derive the `AgentAttestation` PDA for a given agent and attester.
41
- * @param agentPda - The agent account PDA to attest.
42
- * @param attester - The attester wallet. Defaults to the connected wallet.
43
- * @returns A tuple of `[PublicKey, bump]` for the attestation PDA.
44
- * @see {@link deriveAttestation} from `pda/` module for the underlying derivation.
45
- * @since v0.1.0
46
- */
47
- deriveAttestation(agentPda: PublicKey, attester?: PublicKey): readonly [PublicKey, number];
48
- /**
49
- * @name create
50
- * @description Create an on-chain attestation vouching for an agent.
51
- * The connected wallet becomes the attester.
52
- * @param agentWallet - The wallet that owns the target agent.
53
- * @param args - Attestation parameters (type, metadata hash, optional expiry).
54
- * @returns {Promise<TransactionSignature>} The transaction signature.
55
- * @since v0.1.0
56
- */
57
- create(agentWallet: PublicKey, args: CreateAttestationArgs): Promise<TransactionSignature>;
58
- /**
59
- * @name revoke
60
- * @description Revoke a previously issued attestation. Only the original
61
- * attester may revoke.
62
- * @param agentWallet - The wallet of the attested agent.
63
- * @returns {Promise<TransactionSignature>} The transaction signature.
64
- * @since v0.1.0
65
- */
66
- revoke(agentWallet: PublicKey): Promise<TransactionSignature>;
67
- /**
68
- * @name close
69
- * @description Close a revoked attestation PDA and reclaim rent to the attester.
70
- * @param agentWallet - The wallet of the attested agent.
71
- * @returns {Promise<TransactionSignature>} The transaction signature.
72
- * @since v0.1.0
73
- */
74
- close(agentWallet: PublicKey): Promise<TransactionSignature>;
75
- /**
76
- * @name fetch
77
- * @description Fetch a deserialized `AgentAttestation` account.
78
- * @param agentPda - The agent account PDA.
79
- * @param attester - The attester wallet. Defaults to the connected wallet.
80
- * @returns {Promise<AgentAttestationData>} The attestation account data.
81
- * @throws Will throw if the attestation account does not exist.
82
- * @since v0.1.0
83
- */
84
- fetch(agentPda: PublicKey, attester?: PublicKey): Promise<AgentAttestationData>;
85
- /**
86
- * @name fetchNullable
87
- * @description Fetch a deserialized `AgentAttestation` account, or `null`
88
- * if it does not exist on-chain.
89
- * @param agentPda - The agent account PDA.
90
- * @param attester - The attester wallet. Defaults to the connected wallet.
91
- * @returns {Promise<AgentAttestationData | null>} The attestation data or `null`.
92
- * @since v0.1.0
93
- */
94
- fetchNullable(agentPda: PublicKey, attester?: PublicKey): Promise<AgentAttestationData | null>;
95
- }
96
- //# sourceMappingURL=attestation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attestation.d.ts","sourceRoot":"","sources":["../../../src/modules/attestation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAiB,KAAK,SAAS,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,iBAAkB,SAAQ,UAAU;IAG/C;;;;;;;;OAQG;IACH,iBAAiB,CACf,QAAQ,EAAE,SAAS,EACnB,QAAQ,CAAC,EAAE,SAAS,GACnB,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;IAM/B;;;;;;;;OAQG;IACG,MAAM,CACV,WAAW,EAAE,SAAS,EACtB,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,oBAAoB,CAAC;IAuBhC;;;;;;;OAOG;IACG,MAAM,CAAC,WAAW,EAAE,SAAS,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAanE;;;;;;OAMG;IACG,KAAK,CAAC,WAAW,EAAE,SAAS,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAiBlE;;;;;;;;OAQG;IACG,KAAK,CACT,QAAQ,EAAE,SAAS,EACnB,QAAQ,CAAC,EAAE,SAAS,GACnB,OAAO,CAAC,oBAAoB,CAAC;IAKhC;;;;;;;;OAQG;IACG,aAAa,CACjB,QAAQ,EAAE,SAAS,EACnB,QAAQ,CAAC,EAAE,SAAS,GACnB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;CAIxC"}
@@ -1,215 +0,0 @@
1
- /**
2
- * @module base
3
- * @description Abstract base class for all SDK modules.
4
- *
5
- * Provides shared access to the Anchor program, provider,
6
- * and typed `fetch` / `fetchNullable` helpers.
7
- *
8
- * @category Modules
9
- * @since v0.1.0
10
- * @packageDocumentation
11
- */
12
- import { type AnchorProvider, type Program, BN } from "@coral-xyz/anchor";
13
- import type { PublicKey, TransactionSignature } from "@solana/web3.js";
14
- import { SAP_ERROR_BY_NAME } from "../utils/anchor-errors";
15
- /**
16
- * Anchor `Program` instance typed for the Synapse Agent SAP IDL.
17
- *
18
- * @name SapProgram
19
- * @description Alias for `Program<any>` — the Anchor program reference
20
- * used as the backbone of every module in the SDK.
21
- * @category Modules
22
- * @since v0.1.0
23
- */
24
- export type SapProgram = Program<any>;
25
- /**
26
- * @name SapTransactionResult
27
- * @description Instruction builder return type — a ready-to-send transaction.
28
- * Contains the finalized transaction signature after RPC submission.
29
- * @category Modules
30
- * @since v0.1.0
31
- */
32
- export interface SapTransactionResult {
33
- /** The base-58 encoded transaction signature returned by the RPC node. */
34
- readonly signature: TransactionSignature;
35
- }
36
- /**
37
- * @name BaseModule
38
- * @description Abstract base module inherited by every domain module in the SDK.
39
- * Encapsulates the Anchor program reference, provider access, and common
40
- * helpers for account fetching and BN construction.
41
- *
42
- * @abstract
43
- * @category Modules
44
- * @since v0.1.0
45
- *
46
- * @example
47
- * ```ts
48
- * class MyModule extends BaseModule {
49
- * async doSomething() {
50
- * const data = await this.fetchAccount<MyData>("myAccount", pda);
51
- * }
52
- * }
53
- * ```
54
- */
55
- export declare abstract class BaseModule {
56
- protected readonly program: SapProgram;
57
- /**
58
- * Create a new module instance.
59
- *
60
- * @param program - The Anchor `Program` instance for the SAP IDL.
61
- * @protected
62
- */
63
- constructor(program: SapProgram);
64
- /**
65
- * @name methods
66
- * @description Instruction method namespace — bypasses `noUncheckedIndexedAccess`
67
- * on `Program<any>` where every property is `T | undefined`.
68
- * Used internally by subclasses to build and send instructions.
69
- * @returns The Anchor program `methods` object for chaining instruction builders.
70
- * @protected
71
- * @since v0.1.0
72
- */
73
- protected get methods(): any;
74
- /**
75
- * @name provider
76
- * @description The AnchorProvider from the program, giving access to
77
- * the connection and wallet for signing transactions.
78
- * @returns {AnchorProvider} The Anchor provider instance.
79
- * @protected
80
- * @since v0.1.0
81
- */
82
- protected get provider(): AnchorProvider;
83
- /**
84
- * @name walletPubkey
85
- * @description Convenience accessor for the signer wallet's public key.
86
- * @returns {PublicKey} The public key of the connected wallet.
87
- * @protected
88
- * @since v0.1.0
89
- */
90
- protected get walletPubkey(): PublicKey;
91
- /**
92
- * @name fetchAccount
93
- * @description Generic account fetch — deserializes the on-chain account
94
- * data into the given type `T`, or throws if the account does not exist.
95
- * @typeParam T - The expected deserialized account data type.
96
- * @param accountName - The Anchor account discriminator name (e.g. `"agentAccount"`).
97
- * @param address - The public key of the account to fetch.
98
- * @returns {Promise<T>} The deserialized account data.
99
- * @throws Will throw if the account does not exist on-chain.
100
- * @protected
101
- * @since v0.1.0
102
- */
103
- protected fetchAccount<T>(accountName: string, address: PublicKey): Promise<T>;
104
- /**
105
- * @name fetchAccountNullable
106
- * @description Generic nullable account fetch — deserializes the on-chain
107
- * account data into type `T`, or returns `null` if the account does not exist.
108
- * @typeParam T - The expected deserialized account data type.
109
- * @param accountName - The Anchor account discriminator name (e.g. `"agentAccount"`).
110
- * @param address - The public key of the account to fetch.
111
- * @returns {Promise<T | null>} The deserialized account data, or `null`.
112
- * @protected
113
- * @since v0.1.0
114
- */
115
- protected fetchAccountNullable<T>(accountName: string, address: PublicKey): Promise<T | null>;
116
- /**
117
- * @name safeFetch
118
- * @description Internal fetch with retry-on-transient-error. Used by
119
- * {@link fetchAccount} and {@link fetchAccountNullable}. Retries up to
120
- * 3 times on `SapTransientError`-classified failures with exponential
121
- * backoff (100ms → 250ms → 600ms). Re-throws as {@link SapTransientError}
122
- * after the final attempt.
123
- * @protected
124
- * @since v0.13.1
125
- */
126
- protected safeFetch<T>(accountName: string, address: PublicKey, opts?: {
127
- nullable: boolean;
128
- maxAttempts?: number;
129
- }): Promise<T>;
130
- /**
131
- * @name bn
132
- * @description Create an Anchor `BN` from a number, bigint, or existing BN.
133
- * Passes through values that are already `BN` instances.
134
- * @param value - The numeric value to convert.
135
- * @returns {BN} An Anchor-compatible big number.
136
- * @protected
137
- * @since v0.1.0
138
- */
139
- protected bn(value: number | bigint | BN): BN;
140
- /**
141
- * @name requireAccountExists
142
- * @description Fetch a required account; throw a {@link SapPreflightError}
143
- * with an actionable message if it does not exist.
144
- * @typeParam T - Expected account type.
145
- * @param accountName - Anchor account discriminator name.
146
- * @param address - PDA to fetch.
147
- * @param onMissing - `{ predicted, hint }` describing the on-chain rejection
148
- * that would otherwise occur.
149
- * @protected
150
- * @since v0.13.0
151
- */
152
- protected requireAccountExists<T>(accountName: string, address: PublicKey, onMissing: {
153
- predicted: keyof typeof SAP_ERROR_BY_NAME;
154
- hint?: string;
155
- }): Promise<T>;
156
- /**
157
- * @name requireAccountAbsent
158
- * @description Verify a PDA does not yet exist on-chain. Used before any
159
- * `init` instruction to catch `account already in use` early.
160
- * @protected
161
- * @since v0.13.0
162
- */
163
- protected requireAccountAbsent(accountName: string, address: PublicKey, hint: string): Promise<void>;
164
- /**
165
- * @name simulateOrThrow
166
- * @description Run `simulate()` on a method builder. If the simulation
167
- * reports a SAP program error, throw it as a {@link SapPreflightError}
168
- * with the decoded name + friendly hint *before* the user pays fees.
169
- * Returns the simulation logs on success for inspection.
170
- * @protected
171
- * @since v0.13.0
172
- */
173
- protected simulateOrThrow(builder: any, label: string): Promise<readonly string[]>;
174
- /**
175
- * @name safeRpc
176
- * @description Centralized `.rpc()` wrapper used by every fund-touching
177
- * instruction. Adds:
178
- *
179
- * 1. **Transient retry**: classifies network/blockhash/rate-limit
180
- * errors via {@link isTransientRpcError} and retries with bounded
181
- * exponential backoff (default 3 attempts, 250 → 600 → 1500 ms).
182
- * 2. **Idempotency translation**: maps Solana's
183
- * `Allocate: account already in use` (custom 0x0 mid-tx) into a
184
- * typed {@link SapIdempotencyError} so callers can drop the
185
- * queued action instead of retrying.
186
- * 3. **Anchor decoding**: translates raw `0x...` codes into
187
- * {@link SapPreflightError} carrying the SAP error name + friendly
188
- * hint, so consumers never see opaque hex codes.
189
- * 4. **Fall-through**: any error not classified above is wrapped in
190
- * {@link SapRpcError} with logs preserved.
191
- *
192
- * Pass `opts.skipRetry = true` for non-idempotent flows where retry
193
- * would double-charge (e.g. `settle_calls_v2` without a receipt PDA).
194
- *
195
- * @protected
196
- * @since v0.13.1
197
- */
198
- protected safeRpc(builder: any, label: string, opts?: {
199
- rpcOpts?: Parameters<typeof Object>[0];
200
- maxAttempts?: number;
201
- skipRetry?: boolean;
202
- idempotencyHint?: string;
203
- }): Promise<TransactionSignature>;
204
- /**
205
- * @name requireUnique
206
- * @description Convenience wrapper around {@link requireAccountAbsent}
207
- * that throws a typed {@link SapAlreadyExistsError} (instead of a
208
- * {@link SapPreflightError}). Use when an `init` instruction requires
209
- * the PDA to be brand new.
210
- * @protected
211
- * @since v0.13.1
212
- */
213
- protected requireUnique(accountName: string, address: PublicKey, hint?: string): Promise<void>;
214
- }
215
- //# sourceMappingURL=base.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/modules/base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAIL,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAShC;;;;;;;;GAQG;AAEH,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;AAOtC;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,0EAA0E;IAC1E,QAAQ,CAAC,SAAS,EAAE,oBAAoB,CAAC;CAC1C;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,8BAAsB,UAAU;IAOlB,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU;IANlD;;;;;OAKG;gBAC4B,OAAO,EAAE,UAAU;IAElD;;;;;;;;OAQG;IA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