@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.
- package/LICENSE +21 -0
- package/README.md +882 -0
- package/dist/cjs/constants/index.js +43 -0
- package/dist/cjs/constants/index.js.map +1 -0
- package/dist/cjs/constants/limits.js +161 -0
- package/dist/cjs/constants/limits.js.map +1 -0
- package/dist/cjs/constants/programs.js +78 -0
- package/dist/cjs/constants/programs.js.map +1 -0
- package/dist/cjs/constants/seeds.js +57 -0
- package/dist/cjs/constants/seeds.js.map +1 -0
- package/dist/cjs/core/client.js +391 -0
- package/dist/cjs/core/client.js.map +1 -0
- package/dist/cjs/core/connection.js +319 -0
- package/dist/cjs/core/connection.js.map +1 -0
- package/dist/cjs/core/index.js +24 -0
- package/dist/cjs/core/index.js.map +1 -0
- package/dist/cjs/errors/index.js +334 -0
- package/dist/cjs/errors/index.js.map +1 -0
- package/dist/cjs/events/index.js +136 -0
- package/dist/cjs/events/index.js.map +1 -0
- package/dist/cjs/idl/index.js +63 -0
- package/dist/cjs/idl/index.js.map +1 -0
- package/dist/cjs/idl/synapse_agent_sap.json +9710 -0
- package/dist/cjs/index.js +147 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/modules/agent.js +272 -0
- package/dist/cjs/modules/agent.js.map +1 -0
- package/dist/cjs/modules/attestation.js +147 -0
- package/dist/cjs/modules/attestation.js.map +1 -0
- package/dist/cjs/modules/base.js +128 -0
- package/dist/cjs/modules/base.js.map +1 -0
- package/dist/cjs/modules/escrow.js +246 -0
- package/dist/cjs/modules/escrow.js.map +1 -0
- package/dist/cjs/modules/feedback.js +166 -0
- package/dist/cjs/modules/feedback.js.map +1 -0
- package/dist/cjs/modules/index.js +35 -0
- package/dist/cjs/modules/index.js.map +1 -0
- package/dist/cjs/modules/indexing.js +375 -0
- package/dist/cjs/modules/indexing.js.map +1 -0
- package/dist/cjs/modules/ledger.js +234 -0
- package/dist/cjs/modules/ledger.js.map +1 -0
- package/dist/cjs/modules/tools.js +319 -0
- package/dist/cjs/modules/tools.js.map +1 -0
- package/dist/cjs/modules/vault.js +410 -0
- package/dist/cjs/modules/vault.js.map +1 -0
- package/dist/cjs/pda/index.js +377 -0
- package/dist/cjs/pda/index.js.map +1 -0
- package/dist/cjs/plugin/index.js +934 -0
- package/dist/cjs/plugin/index.js.map +1 -0
- package/dist/cjs/plugin/protocols.js +282 -0
- package/dist/cjs/plugin/protocols.js.map +1 -0
- package/dist/cjs/plugin/schemas.js +831 -0
- package/dist/cjs/plugin/schemas.js.map +1 -0
- package/dist/cjs/postgres/adapter.js +715 -0
- package/dist/cjs/postgres/adapter.js.map +1 -0
- package/dist/cjs/postgres/index.js +50 -0
- package/dist/cjs/postgres/index.js.map +1 -0
- package/dist/cjs/postgres/serializers.js +381 -0
- package/dist/cjs/postgres/serializers.js.map +1 -0
- package/dist/cjs/postgres/sync.js +221 -0
- package/dist/cjs/postgres/sync.js.map +1 -0
- package/dist/cjs/postgres/types.js +44 -0
- package/dist/cjs/postgres/types.js.map +1 -0
- package/dist/cjs/registries/builder.js +414 -0
- package/dist/cjs/registries/builder.js.map +1 -0
- package/dist/cjs/registries/discovery.js +362 -0
- package/dist/cjs/registries/discovery.js.map +1 -0
- package/dist/cjs/registries/index.js +51 -0
- package/dist/cjs/registries/index.js.map +1 -0
- package/dist/cjs/registries/session.js +433 -0
- package/dist/cjs/registries/session.js.map +1 -0
- package/dist/cjs/registries/x402.js +577 -0
- package/dist/cjs/registries/x402.js.map +1 -0
- package/dist/cjs/types/accounts.js +13 -0
- package/dist/cjs/types/accounts.js.map +1 -0
- package/dist/cjs/types/common.js +13 -0
- package/dist/cjs/types/common.js.map +1 -0
- package/dist/cjs/types/enums.js +174 -0
- package/dist/cjs/types/enums.js.map +1 -0
- package/dist/cjs/types/index.js +36 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/cjs/types/instructions.js +92 -0
- package/dist/cjs/types/instructions.js.map +1 -0
- package/dist/cjs/utils/hash.js +58 -0
- package/dist/cjs/utils/hash.js.map +1 -0
- package/dist/cjs/utils/index.js +27 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/serialization.js +105 -0
- package/dist/cjs/utils/serialization.js.map +1 -0
- package/dist/cjs/utils/validation.js +36 -0
- package/dist/cjs/utils/validation.js.map +1 -0
- package/dist/esm/constants/index.js +29 -0
- package/dist/esm/constants/index.js.map +1 -0
- package/dist/esm/constants/limits.js +158 -0
- package/dist/esm/constants/limits.js.map +1 -0
- package/dist/esm/constants/programs.js +75 -0
- package/dist/esm/constants/programs.js.map +1 -0
- package/dist/esm/constants/seeds.js +54 -0
- package/dist/esm/constants/seeds.js.map +1 -0
- package/dist/esm/core/client.js +384 -0
- package/dist/esm/core/client.js.map +1 -0
- package/dist/esm/core/connection.js +315 -0
- package/dist/esm/core/connection.js.map +1 -0
- package/dist/esm/core/index.js +19 -0
- package/dist/esm/core/index.js.map +1 -0
- package/dist/esm/errors/index.js +325 -0
- package/dist/esm/errors/index.js.map +1 -0
- package/dist/esm/events/index.js +132 -0
- package/dist/esm/events/index.js.map +1 -0
- package/dist/esm/idl/index.js +57 -0
- package/dist/esm/idl/index.js.map +1 -0
- package/dist/esm/idl/synapse_agent_sap.json +9710 -0
- package/dist/esm/index.js +70 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/modules/agent.js +268 -0
- package/dist/esm/modules/agent.js.map +1 -0
- package/dist/esm/modules/attestation.js +143 -0
- package/dist/esm/modules/attestation.js.map +1 -0
- package/dist/esm/modules/base.js +124 -0
- package/dist/esm/modules/base.js.map +1 -0
- package/dist/esm/modules/escrow.js +242 -0
- package/dist/esm/modules/escrow.js.map +1 -0
- package/dist/esm/modules/feedback.js +162 -0
- package/dist/esm/modules/feedback.js.map +1 -0
- package/dist/esm/modules/index.js +23 -0
- package/dist/esm/modules/index.js.map +1 -0
- package/dist/esm/modules/indexing.js +371 -0
- package/dist/esm/modules/indexing.js.map +1 -0
- package/dist/esm/modules/ledger.js +230 -0
- package/dist/esm/modules/ledger.js.map +1 -0
- package/dist/esm/modules/tools.js +315 -0
- package/dist/esm/modules/tools.js.map +1 -0
- package/dist/esm/modules/vault.js +406 -0
- package/dist/esm/modules/vault.js.map +1 -0
- package/dist/esm/pda/index.js +357 -0
- package/dist/esm/pda/index.js.map +1 -0
- package/dist/esm/plugin/index.js +927 -0
- package/dist/esm/plugin/index.js.map +1 -0
- package/dist/esm/plugin/protocols.js +279 -0
- package/dist/esm/plugin/protocols.js.map +1 -0
- package/dist/esm/plugin/schemas.js +828 -0
- package/dist/esm/plugin/schemas.js.map +1 -0
- package/dist/esm/postgres/adapter.js +678 -0
- package/dist/esm/postgres/adapter.js.map +1 -0
- package/dist/esm/postgres/index.js +27 -0
- package/dist/esm/postgres/index.js.map +1 -0
- package/dist/esm/postgres/serializers.js +362 -0
- package/dist/esm/postgres/serializers.js.map +1 -0
- package/dist/esm/postgres/sync.js +217 -0
- package/dist/esm/postgres/sync.js.map +1 -0
- package/dist/esm/postgres/types.js +41 -0
- package/dist/esm/postgres/types.js.map +1 -0
- package/dist/esm/registries/builder.js +410 -0
- package/dist/esm/registries/builder.js.map +1 -0
- package/dist/esm/registries/discovery.js +358 -0
- package/dist/esm/registries/discovery.js.map +1 -0
- package/dist/esm/registries/index.js +44 -0
- package/dist/esm/registries/index.js.map +1 -0
- package/dist/esm/registries/session.js +429 -0
- package/dist/esm/registries/session.js.map +1 -0
- package/dist/esm/registries/x402.js +573 -0
- package/dist/esm/registries/x402.js.map +1 -0
- package/dist/esm/types/accounts.js +12 -0
- package/dist/esm/types/accounts.js.map +1 -0
- package/dist/esm/types/common.js +12 -0
- package/dist/esm/types/common.js.map +1 -0
- package/dist/esm/types/enums.js +171 -0
- package/dist/esm/types/enums.js.map +1 -0
- package/dist/esm/types/index.js +25 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/esm/types/instructions.js +89 -0
- package/dist/esm/types/instructions.js.map +1 -0
- package/dist/esm/utils/hash.js +53 -0
- package/dist/esm/utils/hash.js.map +1 -0
- package/dist/esm/utils/index.js +19 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/esm/utils/serialization.js +98 -0
- package/dist/esm/utils/serialization.js.map +1 -0
- package/dist/esm/utils/validation.js +33 -0
- package/dist/esm/utils/validation.js.map +1 -0
- package/dist/types/constants/index.d.ts +27 -0
- package/dist/types/constants/index.d.ts.map +1 -0
- package/dist/types/constants/limits.d.ts +149 -0
- package/dist/types/constants/limits.d.ts.map +1 -0
- package/dist/types/constants/programs.d.ts +69 -0
- package/dist/types/constants/programs.d.ts.map +1 -0
- package/dist/types/constants/seeds.d.ts +61 -0
- package/dist/types/constants/seeds.d.ts.map +1 -0
- package/dist/types/core/client.d.ts +323 -0
- package/dist/types/core/client.d.ts.map +1 -0
- package/dist/types/core/connection.d.ts +279 -0
- package/dist/types/core/connection.d.ts.map +1 -0
- package/dist/types/core/index.d.ts +20 -0
- package/dist/types/core/index.d.ts.map +1 -0
- package/dist/types/errors/index.d.ts +276 -0
- package/dist/types/errors/index.d.ts.map +1 -0
- package/dist/types/events/index.d.ts +248 -0
- package/dist/types/events/index.d.ts.map +1 -0
- package/dist/types/idl/index.d.ts +70 -0
- package/dist/types/idl/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +68 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/modules/agent.d.ts +166 -0
- package/dist/types/modules/agent.d.ts.map +1 -0
- package/dist/types/modules/attestation.d.ts +96 -0
- package/dist/types/modules/attestation.d.ts.map +1 -0
- package/dist/types/modules/base.d.ts +126 -0
- package/dist/types/modules/base.d.ts.map +1 -0
- package/dist/types/modules/escrow.d.ts +151 -0
- package/dist/types/modules/escrow.d.ts.map +1 -0
- package/dist/types/modules/feedback.d.ts +105 -0
- package/dist/types/modules/feedback.d.ts.map +1 -0
- package/dist/types/modules/index.d.ts +24 -0
- package/dist/types/modules/index.d.ts.map +1 -0
- package/dist/types/modules/indexing.d.ts +200 -0
- package/dist/types/modules/indexing.d.ts.map +1 -0
- package/dist/types/modules/ledger.d.ts +150 -0
- package/dist/types/modules/ledger.d.ts.map +1 -0
- package/dist/types/modules/tools.d.ts +182 -0
- package/dist/types/modules/tools.d.ts.map +1 -0
- package/dist/types/modules/vault.d.ts +240 -0
- package/dist/types/modules/vault.d.ts.map +1 -0
- package/dist/types/pda/index.d.ts +296 -0
- package/dist/types/pda/index.d.ts.map +1 -0
- package/dist/types/plugin/index.d.ts +171 -0
- package/dist/types/plugin/index.d.ts.map +1 -0
- package/dist/types/plugin/protocols.d.ts +152 -0
- package/dist/types/plugin/protocols.d.ts.map +1 -0
- package/dist/types/plugin/schemas.d.ts +823 -0
- package/dist/types/plugin/schemas.d.ts.map +1 -0
- package/dist/types/postgres/adapter.d.ts +355 -0
- package/dist/types/postgres/adapter.d.ts.map +1 -0
- package/dist/types/postgres/index.d.ts +24 -0
- package/dist/types/postgres/index.d.ts.map +1 -0
- package/dist/types/postgres/serializers.d.ts +30 -0
- package/dist/types/postgres/serializers.d.ts.map +1 -0
- package/dist/types/postgres/sync.d.ts +132 -0
- package/dist/types/postgres/sync.d.ts.map +1 -0
- package/dist/types/postgres/types.d.ts +167 -0
- package/dist/types/postgres/types.d.ts.map +1 -0
- package/dist/types/registries/builder.d.ts +340 -0
- package/dist/types/registries/builder.d.ts.map +1 -0
- package/dist/types/registries/discovery.d.ts +333 -0
- package/dist/types/registries/discovery.d.ts.map +1 -0
- package/dist/types/registries/index.d.ts +48 -0
- package/dist/types/registries/index.d.ts.map +1 -0
- package/dist/types/registries/session.d.ts +323 -0
- package/dist/types/registries/session.d.ts.map +1 -0
- package/dist/types/registries/x402.d.ts +463 -0
- package/dist/types/registries/x402.d.ts.map +1 -0
- package/dist/types/types/accounts.d.ts +565 -0
- package/dist/types/types/accounts.d.ts.map +1 -0
- package/dist/types/types/common.d.ts +166 -0
- package/dist/types/types/common.d.ts.map +1 -0
- package/dist/types/types/enums.d.ts +238 -0
- package/dist/types/types/enums.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +28 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/types/instructions.d.ts +366 -0
- package/dist/types/types/instructions.d.ts.map +1 -0
- package/dist/types/utils/hash.d.ts +48 -0
- package/dist/types/utils/hash.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +19 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/types/utils/serialization.d.ts +69 -0
- package/dist/types/utils/serialization.d.ts.map +1 -0
- package/dist/types/utils/validation.d.ts +29 -0
- package/dist/types/utils/validation.d.ts.map +1 -0
- package/package.json +178 -0
- package/src/constants/index.ts +44 -0
- package/src/constants/limits.ts +165 -0
- package/src/constants/programs.ts +83 -0
- package/src/constants/seeds.ts +66 -0
- package/src/core/client.ts +416 -0
- package/src/core/connection.ts +409 -0
- package/src/core/index.ts +20 -0
- package/src/errors/index.ts +346 -0
- package/src/events/index.ts +335 -0
- package/src/idl/index.ts +76 -0
- package/src/idl/synapse_agent_sap.json +9710 -0
- package/src/index.ts +253 -0
- package/src/modules/agent.ts +319 -0
- package/src/modules/attestation.ts +168 -0
- package/src/modules/base.ts +158 -0
- package/src/modules/escrow.ts +308 -0
- package/src/modules/feedback.ts +186 -0
- package/src/modules/index.ts +24 -0
- package/src/modules/indexing.ts +444 -0
- package/src/modules/ledger.ts +262 -0
- package/src/modules/tools.ts +411 -0
- package/src/modules/vault.ts +533 -0
- package/src/pda/index.ts +512 -0
- package/src/plugin/index.ts +1202 -0
- package/src/plugin/protocols.ts +404 -0
- package/src/plugin/schemas.ts +909 -0
- package/src/postgres/adapter.ts +904 -0
- package/src/postgres/index.ts +59 -0
- package/src/postgres/schema.sql +683 -0
- package/src/postgres/serializers.ts +485 -0
- package/src/postgres/sync.ts +254 -0
- package/src/postgres/types.ts +245 -0
- package/src/registries/builder.ts +607 -0
- package/src/registries/discovery.ts +572 -0
- package/src/registries/index.ts +77 -0
- package/src/registries/session.ts +613 -0
- package/src/registries/x402.ts +906 -0
- package/src/types/accounts.ts +618 -0
- package/src/types/common.ts +187 -0
- package/src/types/enums.ts +214 -0
- package/src/types/index.ts +92 -0
- package/src/types/instructions.ts +413 -0
- package/src/utils/hash.ts +57 -0
- package/src/utils/index.ts +19 -0
- package/src/utils/serialization.ts +98 -0
- package/src/utils/validation.ts +36 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @synapse-sap/sdk — TypeScript SDK for SAP v2 (Solana Agent Protocol)
|
|
4
|
+
*
|
|
5
|
+
* Modular architecture:
|
|
6
|
+
*
|
|
7
|
+
* | Path | Description |
|
|
8
|
+
* |-------------------|-----------------------------------------------|
|
|
9
|
+
* | `core/` | SapClient, SapConnection (RPC factory) |
|
|
10
|
+
* | `types/` | On-chain enums, account data, instruction DTOs|
|
|
11
|
+
* | `constants/` | Program IDs, PDA seeds, size limits |
|
|
12
|
+
* | `pda/` | Deterministic PDA derivation helpers |
|
|
13
|
+
* | `events/` | Transaction-log event parser |
|
|
14
|
+
* | `errors/` | Typed SDK error classes |
|
|
15
|
+
* | `utils/` | Hashing, validation, serialization |
|
|
16
|
+
* | `modules/` | Low-level per-domain instruction wrappers |
|
|
17
|
+
* | `registries/` | High-level abstractions (discovery, x402, …) |
|
|
18
|
+
* | `plugin/` | SynapseAgentKit adapter (52 tools) |
|
|
19
|
+
* | `idl/` | Embedded Anchor IDL |
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { SapClient, SapConnection } from "@synapse-sap/sdk";
|
|
24
|
+
*
|
|
25
|
+
* // Quick start — from Anchor provider
|
|
26
|
+
* const client = SapClient.from(provider);
|
|
27
|
+
*
|
|
28
|
+
* // Or from RPC URL (synapse-client-sdk compatible)
|
|
29
|
+
* const conn = SapConnection.devnet();
|
|
30
|
+
* const client2 = conn.fromKeypair(keypair);
|
|
31
|
+
*
|
|
32
|
+
* // Use domain modules:
|
|
33
|
+
* await client.agent.register({ ... });
|
|
34
|
+
* await client.escrow.create(agentWallet, { ... });
|
|
35
|
+
* await client.ledger.write(sessionPda, data, contentHash);
|
|
36
|
+
*
|
|
37
|
+
* // Use registries (high-level):
|
|
38
|
+
* const agents = await client.discovery.findAgentsByProtocol("jupiter");
|
|
39
|
+
* const ctx = await client.session.start("conv-123");
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @packageDocumentation
|
|
43
|
+
* @category SDK
|
|
44
|
+
* @since v0.1.0
|
|
45
|
+
*/
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
exports.SapAccountNotFoundError = exports.SapRpcError = exports.SapValidationError = exports.SapError = exports.serializeValue = exports.serializeAccount = exports.assert = exports.hashToArray = exports.sha256 = exports.deriveLedgerPage = exports.deriveLedger = exports.deriveAttestation = exports.deriveEscrow = exports.deriveTool = exports.deriveCheckpoint = exports.deriveVaultDelegate = exports.deriveEpochPage = exports.deriveSession = exports.deriveVault = exports.deriveToolCategoryIndex = exports.deriveProtocolIndex = exports.deriveCapabilityIndex = exports.deriveFeedback = exports.deriveAgentStats = exports.deriveAgent = exports.deriveGlobalRegistry = exports.IDL_METADATA = exports.IDL_PROGRAM_ADDRESS = exports.SAP_IDL = exports.HTTP_METHOD_VALUES = exports.TOOL_CATEGORY_VALUES = exports.VAULT_PROTOCOL_VERSION = exports.AGENT_VERSION = exports.LIMITS = exports.SEEDS = exports.LOCALNET_SAP_PROGRAM_ID = exports.DEVNET_SAP_PROGRAM_ID = exports.MAINNET_SAP_PROGRAM_ID = exports.SAP_PROGRAM_ID = exports.SAP_PROGRAM_ADDRESS = exports.CompressionType = exports.SchemaType = exports.DelegatePermission = exports.ToolCategory = exports.ToolHttpMethod = exports.SettlementMode = exports.PluginType = exports.TokenType = exports.SapConnection = exports.SapClient = void 0;
|
|
48
|
+
exports.AgentBuilder = exports.SessionManager = exports.X402Registry = exports.DiscoveryRegistry = exports.SAP_TABLE_MAP = exports.SapSyncEngine = exports.SapPostgres = exports.SAP_PROTOCOLS = exports.SAPPlugin = exports.createSAPPlugin = exports.BaseModule = exports.LedgerModule = exports.AttestationModule = exports.EscrowModule = exports.VaultModule = exports.ToolsModule = exports.IndexingModule = exports.FeedbackModule = exports.AgentModule = exports.SAP_EVENT_NAMES = exports.EventParser = exports.SapPermissionError = exports.SapTimeoutError = void 0;
|
|
49
|
+
// ── Core ─────────────────────────────────────────────
|
|
50
|
+
var core_1 = require("./core");
|
|
51
|
+
Object.defineProperty(exports, "SapClient", { enumerable: true, get: function () { return core_1.SapClient; } });
|
|
52
|
+
Object.defineProperty(exports, "SapConnection", { enumerable: true, get: function () { return core_1.SapConnection; } });
|
|
53
|
+
var types_1 = require("./types");
|
|
54
|
+
Object.defineProperty(exports, "TokenType", { enumerable: true, get: function () { return types_1.TokenType; } });
|
|
55
|
+
Object.defineProperty(exports, "PluginType", { enumerable: true, get: function () { return types_1.PluginType; } });
|
|
56
|
+
Object.defineProperty(exports, "SettlementMode", { enumerable: true, get: function () { return types_1.SettlementMode; } });
|
|
57
|
+
Object.defineProperty(exports, "ToolHttpMethod", { enumerable: true, get: function () { return types_1.ToolHttpMethod; } });
|
|
58
|
+
Object.defineProperty(exports, "ToolCategory", { enumerable: true, get: function () { return types_1.ToolCategory; } });
|
|
59
|
+
Object.defineProperty(exports, "DelegatePermission", { enumerable: true, get: function () { return types_1.DelegatePermission; } });
|
|
60
|
+
Object.defineProperty(exports, "SchemaType", { enumerable: true, get: function () { return types_1.SchemaType; } });
|
|
61
|
+
Object.defineProperty(exports, "CompressionType", { enumerable: true, get: function () { return types_1.CompressionType; } });
|
|
62
|
+
// ── Constants ────────────────────────────────────────
|
|
63
|
+
var constants_1 = require("./constants");
|
|
64
|
+
Object.defineProperty(exports, "SAP_PROGRAM_ADDRESS", { enumerable: true, get: function () { return constants_1.SAP_PROGRAM_ADDRESS; } });
|
|
65
|
+
Object.defineProperty(exports, "SAP_PROGRAM_ID", { enumerable: true, get: function () { return constants_1.SAP_PROGRAM_ID; } });
|
|
66
|
+
Object.defineProperty(exports, "MAINNET_SAP_PROGRAM_ID", { enumerable: true, get: function () { return constants_1.MAINNET_SAP_PROGRAM_ID; } });
|
|
67
|
+
Object.defineProperty(exports, "DEVNET_SAP_PROGRAM_ID", { enumerable: true, get: function () { return constants_1.DEVNET_SAP_PROGRAM_ID; } });
|
|
68
|
+
Object.defineProperty(exports, "LOCALNET_SAP_PROGRAM_ID", { enumerable: true, get: function () { return constants_1.LOCALNET_SAP_PROGRAM_ID; } });
|
|
69
|
+
Object.defineProperty(exports, "SEEDS", { enumerable: true, get: function () { return constants_1.SEEDS; } });
|
|
70
|
+
Object.defineProperty(exports, "LIMITS", { enumerable: true, get: function () { return constants_1.LIMITS; } });
|
|
71
|
+
Object.defineProperty(exports, "AGENT_VERSION", { enumerable: true, get: function () { return constants_1.AGENT_VERSION; } });
|
|
72
|
+
Object.defineProperty(exports, "VAULT_PROTOCOL_VERSION", { enumerable: true, get: function () { return constants_1.VAULT_PROTOCOL_VERSION; } });
|
|
73
|
+
Object.defineProperty(exports, "TOOL_CATEGORY_VALUES", { enumerable: true, get: function () { return constants_1.TOOL_CATEGORY_VALUES; } });
|
|
74
|
+
Object.defineProperty(exports, "HTTP_METHOD_VALUES", { enumerable: true, get: function () { return constants_1.HTTP_METHOD_VALUES; } });
|
|
75
|
+
// ── IDL ──────────────────────────────────────────────
|
|
76
|
+
var index_1 = require("./idl/index");
|
|
77
|
+
Object.defineProperty(exports, "SAP_IDL", { enumerable: true, get: function () { return index_1.SAP_IDL; } });
|
|
78
|
+
Object.defineProperty(exports, "IDL_PROGRAM_ADDRESS", { enumerable: true, get: function () { return index_1.IDL_PROGRAM_ADDRESS; } });
|
|
79
|
+
Object.defineProperty(exports, "IDL_METADATA", { enumerable: true, get: function () { return index_1.IDL_METADATA; } });
|
|
80
|
+
// ── PDA Derivation ───────────────────────────────────
|
|
81
|
+
var pda_1 = require("./pda");
|
|
82
|
+
Object.defineProperty(exports, "deriveGlobalRegistry", { enumerable: true, get: function () { return pda_1.deriveGlobalRegistry; } });
|
|
83
|
+
Object.defineProperty(exports, "deriveAgent", { enumerable: true, get: function () { return pda_1.deriveAgent; } });
|
|
84
|
+
Object.defineProperty(exports, "deriveAgentStats", { enumerable: true, get: function () { return pda_1.deriveAgentStats; } });
|
|
85
|
+
Object.defineProperty(exports, "deriveFeedback", { enumerable: true, get: function () { return pda_1.deriveFeedback; } });
|
|
86
|
+
Object.defineProperty(exports, "deriveCapabilityIndex", { enumerable: true, get: function () { return pda_1.deriveCapabilityIndex; } });
|
|
87
|
+
Object.defineProperty(exports, "deriveProtocolIndex", { enumerable: true, get: function () { return pda_1.deriveProtocolIndex; } });
|
|
88
|
+
Object.defineProperty(exports, "deriveToolCategoryIndex", { enumerable: true, get: function () { return pda_1.deriveToolCategoryIndex; } });
|
|
89
|
+
Object.defineProperty(exports, "deriveVault", { enumerable: true, get: function () { return pda_1.deriveVault; } });
|
|
90
|
+
Object.defineProperty(exports, "deriveSession", { enumerable: true, get: function () { return pda_1.deriveSession; } });
|
|
91
|
+
Object.defineProperty(exports, "deriveEpochPage", { enumerable: true, get: function () { return pda_1.deriveEpochPage; } });
|
|
92
|
+
Object.defineProperty(exports, "deriveVaultDelegate", { enumerable: true, get: function () { return pda_1.deriveVaultDelegate; } });
|
|
93
|
+
Object.defineProperty(exports, "deriveCheckpoint", { enumerable: true, get: function () { return pda_1.deriveCheckpoint; } });
|
|
94
|
+
Object.defineProperty(exports, "deriveTool", { enumerable: true, get: function () { return pda_1.deriveTool; } });
|
|
95
|
+
Object.defineProperty(exports, "deriveEscrow", { enumerable: true, get: function () { return pda_1.deriveEscrow; } });
|
|
96
|
+
Object.defineProperty(exports, "deriveAttestation", { enumerable: true, get: function () { return pda_1.deriveAttestation; } });
|
|
97
|
+
Object.defineProperty(exports, "deriveLedger", { enumerable: true, get: function () { return pda_1.deriveLedger; } });
|
|
98
|
+
Object.defineProperty(exports, "deriveLedgerPage", { enumerable: true, get: function () { return pda_1.deriveLedgerPage; } });
|
|
99
|
+
// ── Utilities ────────────────────────────────────────
|
|
100
|
+
var utils_1 = require("./utils");
|
|
101
|
+
Object.defineProperty(exports, "sha256", { enumerable: true, get: function () { return utils_1.sha256; } });
|
|
102
|
+
Object.defineProperty(exports, "hashToArray", { enumerable: true, get: function () { return utils_1.hashToArray; } });
|
|
103
|
+
Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return utils_1.assert; } });
|
|
104
|
+
var utils_2 = require("./utils");
|
|
105
|
+
Object.defineProperty(exports, "serializeAccount", { enumerable: true, get: function () { return utils_2.serializeAccount; } });
|
|
106
|
+
Object.defineProperty(exports, "serializeValue", { enumerable: true, get: function () { return utils_2.serializeValue; } });
|
|
107
|
+
// ── Errors ───────────────────────────────────────────
|
|
108
|
+
var errors_1 = require("./errors");
|
|
109
|
+
Object.defineProperty(exports, "SapError", { enumerable: true, get: function () { return errors_1.SapError; } });
|
|
110
|
+
Object.defineProperty(exports, "SapValidationError", { enumerable: true, get: function () { return errors_1.SapValidationError; } });
|
|
111
|
+
Object.defineProperty(exports, "SapRpcError", { enumerable: true, get: function () { return errors_1.SapRpcError; } });
|
|
112
|
+
Object.defineProperty(exports, "SapAccountNotFoundError", { enumerable: true, get: function () { return errors_1.SapAccountNotFoundError; } });
|
|
113
|
+
Object.defineProperty(exports, "SapTimeoutError", { enumerable: true, get: function () { return errors_1.SapTimeoutError; } });
|
|
114
|
+
Object.defineProperty(exports, "SapPermissionError", { enumerable: true, get: function () { return errors_1.SapPermissionError; } });
|
|
115
|
+
// ── Events ───────────────────────────────────────────
|
|
116
|
+
var events_1 = require("./events");
|
|
117
|
+
Object.defineProperty(exports, "EventParser", { enumerable: true, get: function () { return events_1.EventParser; } });
|
|
118
|
+
Object.defineProperty(exports, "SAP_EVENT_NAMES", { enumerable: true, get: function () { return events_1.SAP_EVENT_NAMES; } });
|
|
119
|
+
// ── Modules (for advanced usage / tree-shaking) ──────
|
|
120
|
+
var index_2 = require("./modules/index");
|
|
121
|
+
Object.defineProperty(exports, "AgentModule", { enumerable: true, get: function () { return index_2.AgentModule; } });
|
|
122
|
+
Object.defineProperty(exports, "FeedbackModule", { enumerable: true, get: function () { return index_2.FeedbackModule; } });
|
|
123
|
+
Object.defineProperty(exports, "IndexingModule", { enumerable: true, get: function () { return index_2.IndexingModule; } });
|
|
124
|
+
Object.defineProperty(exports, "ToolsModule", { enumerable: true, get: function () { return index_2.ToolsModule; } });
|
|
125
|
+
Object.defineProperty(exports, "VaultModule", { enumerable: true, get: function () { return index_2.VaultModule; } });
|
|
126
|
+
Object.defineProperty(exports, "EscrowModule", { enumerable: true, get: function () { return index_2.EscrowModule; } });
|
|
127
|
+
Object.defineProperty(exports, "AttestationModule", { enumerable: true, get: function () { return index_2.AttestationModule; } });
|
|
128
|
+
Object.defineProperty(exports, "LedgerModule", { enumerable: true, get: function () { return index_2.LedgerModule; } });
|
|
129
|
+
Object.defineProperty(exports, "BaseModule", { enumerable: true, get: function () { return index_2.BaseModule; } });
|
|
130
|
+
// ── Plugin (SynapseAgentKit integration) ─────────────
|
|
131
|
+
var index_3 = require("./plugin/index");
|
|
132
|
+
Object.defineProperty(exports, "createSAPPlugin", { enumerable: true, get: function () { return index_3.createSAPPlugin; } });
|
|
133
|
+
Object.defineProperty(exports, "SAPPlugin", { enumerable: true, get: function () { return index_3.SAPPlugin; } });
|
|
134
|
+
var protocols_1 = require("./plugin/protocols");
|
|
135
|
+
Object.defineProperty(exports, "SAP_PROTOCOLS", { enumerable: true, get: function () { return protocols_1.SAP_PROTOCOLS; } });
|
|
136
|
+
// ── PostgreSQL Adapter (off-chain mirror) ────────────────
|
|
137
|
+
var postgres_1 = require("./postgres");
|
|
138
|
+
Object.defineProperty(exports, "SapPostgres", { enumerable: true, get: function () { return postgres_1.SapPostgres; } });
|
|
139
|
+
Object.defineProperty(exports, "SapSyncEngine", { enumerable: true, get: function () { return postgres_1.SapSyncEngine; } });
|
|
140
|
+
Object.defineProperty(exports, "SAP_TABLE_MAP", { enumerable: true, get: function () { return postgres_1.SAP_TABLE_MAP; } });
|
|
141
|
+
// ── Registries (high-level developer abstractions) ────
|
|
142
|
+
var index_4 = require("./registries/index");
|
|
143
|
+
Object.defineProperty(exports, "DiscoveryRegistry", { enumerable: true, get: function () { return index_4.DiscoveryRegistry; } });
|
|
144
|
+
Object.defineProperty(exports, "X402Registry", { enumerable: true, get: function () { return index_4.X402Registry; } });
|
|
145
|
+
Object.defineProperty(exports, "SessionManager", { enumerable: true, get: function () { return index_4.SessionManager; } });
|
|
146
|
+
Object.defineProperty(exports, "AgentBuilder", { enumerable: true, get: function () { return index_4.AgentBuilder; } });
|
|
147
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;;;;AAEH,wDAAwD;AACxD,+BAAkD;AAAzC,iGAAA,SAAS,OAAA;AAAE,qGAAA,aAAa,OAAA;AAoDjC,iCASiB;AARf,kGAAA,SAAS,OAAA;AACT,mGAAA,UAAU,OAAA;AACV,uGAAA,cAAc,OAAA;AACd,uGAAA,cAAc,OAAA;AACd,qGAAA,YAAY,OAAA;AACZ,2GAAA,kBAAkB,OAAA;AAClB,mGAAA,UAAU,OAAA;AACV,wGAAA,eAAe,OAAA;AAGjB,wDAAwD;AACxD,yCAYqB;AAXnB,gHAAA,mBAAmB,OAAA;AACnB,2GAAA,cAAc,OAAA;AACd,mHAAA,sBAAsB,OAAA;AACtB,kHAAA,qBAAqB,OAAA;AACrB,oHAAA,uBAAuB,OAAA;AACvB,kGAAA,KAAK,OAAA;AACL,mGAAA,MAAM,OAAA;AACN,0GAAA,aAAa,OAAA;AACb,mHAAA,sBAAsB,OAAA;AACtB,iHAAA,oBAAoB,OAAA;AACpB,+GAAA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iBAAiB,OAAA;AACjB,qGAAA,YAAY,OAAA;AACZ,mGAAA,UAAU,OAAA;AAIZ,wDAAwD;AACxD,wCAA4D;AAAnD,wGAAA,eAAe,OAAA;AAAE,kGAAA,SAAS,OAAA;AAYnC,gDAAmD;AAA1C,0GAAA,aAAa,OAAA;AAEtB,4DAA4D;AAC5D,uCAAuE;AAA9D,uGAAA,WAAW,OAAA;AAAE,yGAAA,aAAa,OAAA;AAAE,yGAAA,aAAa,OAAA;AAelD,yDAAyD;AACzD,4CAK4B;AAJ1B,0GAAA,iBAAiB,OAAA;AACjB,qGAAA,YAAY,OAAA;AACZ,uGAAA,cAAc,OAAA;AACd,qGAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module agent
|
|
4
|
+
* @description Agent lifecycle operations for the Solana Agent Protocol.
|
|
5
|
+
*
|
|
6
|
+
* Covers: register, update, deactivate, reactivate, close,
|
|
7
|
+
* report calls, update reputation metrics, and account fetching.
|
|
8
|
+
*
|
|
9
|
+
* @category Modules
|
|
10
|
+
* @since v0.1.0
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.AgentModule = void 0;
|
|
15
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
16
|
+
const base_1 = require("./base");
|
|
17
|
+
const pda_1 = require("../pda");
|
|
18
|
+
/**
|
|
19
|
+
* @name AgentModule
|
|
20
|
+
* @description Manages the full agent lifecycle on the Solana Agent Protocol.
|
|
21
|
+
* Provides methods to register, update, deactivate, reactivate, and close
|
|
22
|
+
* agent identities, as well as self-report call metrics and reputation data.
|
|
23
|
+
*
|
|
24
|
+
* @category Modules
|
|
25
|
+
* @since v0.1.0
|
|
26
|
+
* @extends BaseModule
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* const sap = new SapClient(provider);
|
|
31
|
+
* // Register a new agent
|
|
32
|
+
* const sig = await sap.agent.register({
|
|
33
|
+
* name: "my-agent",
|
|
34
|
+
* description: "An example agent",
|
|
35
|
+
* capabilities: [0, 1],
|
|
36
|
+
* pricing: { free: {} },
|
|
37
|
+
* protocols: [0],
|
|
38
|
+
* });
|
|
39
|
+
* // Fetch agent data
|
|
40
|
+
* const data = await sap.agent.fetch();
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
class AgentModule extends base_1.BaseModule {
|
|
44
|
+
// ── PDA helpers ──────────────────────────────────────
|
|
45
|
+
/**
|
|
46
|
+
* @name deriveAgent
|
|
47
|
+
* @description Derive the `AgentAccount` PDA for a wallet.
|
|
48
|
+
* @param wallet - The wallet public key. Defaults to the connected wallet.
|
|
49
|
+
* @returns A tuple of `[PublicKey, bump]` for the agent PDA.
|
|
50
|
+
* @see {@link deriveAgent} from `pda/` module for the underlying derivation.
|
|
51
|
+
* @since v0.1.0
|
|
52
|
+
*/
|
|
53
|
+
deriveAgent(wallet) {
|
|
54
|
+
return (0, pda_1.deriveAgent)(wallet ?? this.walletPubkey);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* @name deriveStats
|
|
58
|
+
* @description Derive the `AgentStats` PDA for a given agent.
|
|
59
|
+
* @param agentPda - The agent account PDA.
|
|
60
|
+
* @returns A tuple of `[PublicKey, bump]` for the stats PDA.
|
|
61
|
+
* @see {@link deriveAgentStats} from `pda/` module for the underlying derivation.
|
|
62
|
+
* @since v0.1.0
|
|
63
|
+
*/
|
|
64
|
+
deriveStats(agentPda) {
|
|
65
|
+
return (0, pda_1.deriveAgentStats)(agentPda);
|
|
66
|
+
}
|
|
67
|
+
// ── Instructions ─────────────────────────────────────
|
|
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
|
+
async register(args) {
|
|
77
|
+
const [agentPda] = this.deriveAgent();
|
|
78
|
+
const [statsPda] = this.deriveStats(agentPda);
|
|
79
|
+
const [globalPda] = (0, pda_1.deriveGlobalRegistry)();
|
|
80
|
+
return this.methods
|
|
81
|
+
.registerAgent(args.name, args.description, args.capabilities, args.pricing, args.protocols, args.agentId ?? null, args.agentUri ?? null, args.x402Endpoint ?? null)
|
|
82
|
+
.accounts({
|
|
83
|
+
wallet: this.walletPubkey,
|
|
84
|
+
agent: agentPda,
|
|
85
|
+
agentStats: statsPda,
|
|
86
|
+
globalRegistry: globalPda,
|
|
87
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
88
|
+
})
|
|
89
|
+
.rpc();
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* @name update
|
|
93
|
+
* @description Update an existing agent's metadata fields. All fields
|
|
94
|
+
* are optional — only non-null values are written.
|
|
95
|
+
* @param args - Partial update parameters.
|
|
96
|
+
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
97
|
+
* @since v0.1.0
|
|
98
|
+
*/
|
|
99
|
+
async update(args) {
|
|
100
|
+
const [agentPda] = this.deriveAgent();
|
|
101
|
+
return this.methods
|
|
102
|
+
.updateAgent(args.name ?? null, args.description ?? null, args.capabilities ?? null, args.pricing ?? null, args.protocols ?? null, args.agentId ?? null, args.agentUri ?? null, args.x402Endpoint ?? null)
|
|
103
|
+
.accounts({
|
|
104
|
+
wallet: this.walletPubkey,
|
|
105
|
+
agent: agentPda,
|
|
106
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
107
|
+
})
|
|
108
|
+
.rpc();
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* @name deactivate
|
|
112
|
+
* @description Deactivate an agent, setting `is_active = false`.
|
|
113
|
+
* The agent remains on-chain but is excluded from active discovery.
|
|
114
|
+
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
115
|
+
* @since v0.1.0
|
|
116
|
+
*/
|
|
117
|
+
async deactivate() {
|
|
118
|
+
const [agentPda] = this.deriveAgent();
|
|
119
|
+
const [statsPda] = this.deriveStats(agentPda);
|
|
120
|
+
return this.methods
|
|
121
|
+
.deactivateAgent()
|
|
122
|
+
.accounts({
|
|
123
|
+
wallet: this.walletPubkey,
|
|
124
|
+
agent: agentPda,
|
|
125
|
+
agentStats: statsPda,
|
|
126
|
+
})
|
|
127
|
+
.rpc();
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* @name reactivate
|
|
131
|
+
* @description Reactivate a previously deactivated agent, restoring
|
|
132
|
+
* it to active status.
|
|
133
|
+
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
134
|
+
* @since v0.1.0
|
|
135
|
+
*/
|
|
136
|
+
async reactivate() {
|
|
137
|
+
const [agentPda] = this.deriveAgent();
|
|
138
|
+
const [statsPda] = this.deriveStats(agentPda);
|
|
139
|
+
return this.methods
|
|
140
|
+
.reactivateAgent()
|
|
141
|
+
.accounts({
|
|
142
|
+
wallet: this.walletPubkey,
|
|
143
|
+
agent: agentPda,
|
|
144
|
+
agentStats: statsPda,
|
|
145
|
+
})
|
|
146
|
+
.rpc();
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* @name close
|
|
150
|
+
* @description Close an agent PDA and its associated stats PDA.
|
|
151
|
+
* Rent is returned to the owner wallet.
|
|
152
|
+
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
153
|
+
* @since v0.1.0
|
|
154
|
+
*/
|
|
155
|
+
async close() {
|
|
156
|
+
const [agentPda] = this.deriveAgent();
|
|
157
|
+
const [statsPda] = this.deriveStats(agentPda);
|
|
158
|
+
const [globalPda] = (0, pda_1.deriveGlobalRegistry)();
|
|
159
|
+
return this.methods
|
|
160
|
+
.closeAgent()
|
|
161
|
+
.accounts({
|
|
162
|
+
wallet: this.walletPubkey,
|
|
163
|
+
agent: agentPda,
|
|
164
|
+
agentStats: statsPda,
|
|
165
|
+
globalRegistry: globalPda,
|
|
166
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
167
|
+
})
|
|
168
|
+
.rpc();
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* @name reportCalls
|
|
172
|
+
* @description Self-report call metrics for the agent. This updates the
|
|
173
|
+
* `AgentStats` counter but does not affect on-chain reputation.
|
|
174
|
+
* @param callsServed - The number of calls to report.
|
|
175
|
+
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
176
|
+
* @since v0.1.0
|
|
177
|
+
*/
|
|
178
|
+
async reportCalls(callsServed) {
|
|
179
|
+
const [agentPda] = this.deriveAgent();
|
|
180
|
+
const [statsPda] = this.deriveStats(agentPda);
|
|
181
|
+
return this.methods
|
|
182
|
+
.reportCalls(this.bn(callsServed))
|
|
183
|
+
.accounts({
|
|
184
|
+
wallet: this.walletPubkey,
|
|
185
|
+
agent: agentPda,
|
|
186
|
+
agentStats: statsPda,
|
|
187
|
+
})
|
|
188
|
+
.rpc();
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* @name updateReputation
|
|
192
|
+
* @description Update self-reported latency and uptime metrics.
|
|
193
|
+
* These are informational and do not affect on-chain reputation scoring.
|
|
194
|
+
* @param avgLatencyMs - Average response latency in milliseconds.
|
|
195
|
+
* @param uptimePercent - Uptime percentage (0–100).
|
|
196
|
+
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
197
|
+
* @since v0.1.0
|
|
198
|
+
*/
|
|
199
|
+
async updateReputation(avgLatencyMs, uptimePercent) {
|
|
200
|
+
const [agentPda] = this.deriveAgent();
|
|
201
|
+
return this.methods
|
|
202
|
+
.updateReputation(avgLatencyMs, uptimePercent)
|
|
203
|
+
.accounts({
|
|
204
|
+
wallet: this.walletPubkey,
|
|
205
|
+
agent: agentPda,
|
|
206
|
+
})
|
|
207
|
+
.rpc();
|
|
208
|
+
}
|
|
209
|
+
// ── Fetchers ─────────────────────────────────────────
|
|
210
|
+
/**
|
|
211
|
+
* @name fetch
|
|
212
|
+
* @description Fetch the deserialized `AgentAccount` data for a wallet.
|
|
213
|
+
* @param wallet - The wallet public key. Defaults to the connected wallet.
|
|
214
|
+
* @returns {Promise<AgentAccountData>} The agent account data.
|
|
215
|
+
* @throws Will throw if the agent account does not exist.
|
|
216
|
+
* @since v0.1.0
|
|
217
|
+
*/
|
|
218
|
+
async fetch(wallet) {
|
|
219
|
+
const [pda] = this.deriveAgent(wallet ?? this.walletPubkey);
|
|
220
|
+
return this.fetchAccount("agentAccount", pda);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* @name fetchNullable
|
|
224
|
+
* @description Fetch the deserialized `AgentAccount` data, or `null`
|
|
225
|
+
* if the account doesn't exist on-chain.
|
|
226
|
+
* @param wallet - The wallet public key. Defaults to the connected wallet.
|
|
227
|
+
* @returns {Promise<AgentAccountData | null>} The agent data or `null`.
|
|
228
|
+
* @since v0.1.0
|
|
229
|
+
*/
|
|
230
|
+
async fetchNullable(wallet) {
|
|
231
|
+
const [pda] = this.deriveAgent(wallet ?? this.walletPubkey);
|
|
232
|
+
return this.fetchAccountNullable("agentAccount", pda);
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* @name fetchStats
|
|
236
|
+
* @description Fetch the deserialized `AgentStats` data for an agent.
|
|
237
|
+
* @param agentPda - The agent account PDA.
|
|
238
|
+
* @returns {Promise<AgentStatsData>} The agent stats data.
|
|
239
|
+
* @throws Will throw if the stats account does not exist.
|
|
240
|
+
* @since v0.1.0
|
|
241
|
+
*/
|
|
242
|
+
async fetchStats(agentPda) {
|
|
243
|
+
const [pda] = this.deriveStats(agentPda);
|
|
244
|
+
return this.fetchAccount("agentStats", pda);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* @name fetchStatsNullable
|
|
248
|
+
* @description Fetch the deserialized `AgentStats` data, or `null`
|
|
249
|
+
* if the account doesn't exist on-chain.
|
|
250
|
+
* @param agentPda - The agent account PDA.
|
|
251
|
+
* @returns {Promise<AgentStatsData | null>} The stats data or `null`.
|
|
252
|
+
* @since v0.1.0
|
|
253
|
+
*/
|
|
254
|
+
async fetchStatsNullable(agentPda) {
|
|
255
|
+
const [pda] = this.deriveStats(agentPda);
|
|
256
|
+
return this.fetchAccountNullable("agentStats", pda);
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* @name fetchGlobalRegistry
|
|
260
|
+
* @description Fetch the `GlobalRegistry` singleton account that tracks
|
|
261
|
+
* aggregate protocol statistics.
|
|
262
|
+
* @returns {Promise<GlobalRegistryData>} The global registry data.
|
|
263
|
+
* @throws Will throw if the registry has not been initialized.
|
|
264
|
+
* @since v0.1.0
|
|
265
|
+
*/
|
|
266
|
+
async fetchGlobalRegistry() {
|
|
267
|
+
const [pda] = (0, pda_1.deriveGlobalRegistry)();
|
|
268
|
+
return this.fetchAccount("globalRegistry", pda);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
exports.AgentModule = AgentModule;
|
|
272
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../../src/modules/agent.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,6CAA2F;AAC3F,iCAAoC;AACpC,gCAA6E;AAQ7E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAa,WAAY,SAAQ,iBAAU;IACzC,wDAAwD;IAExD;;;;;;;OAOG;IACH,WAAW,CAAC,MAAkB;QAC5B,OAAO,IAAA,iBAAW,EAAC,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;IAClD,CAAC;IAED;;;;;;;OAOG;IACH,WAAW,CAAC,QAAmB;QAC7B,OAAO,IAAA,sBAAgB,EAAC,QAAQ,CAAC,CAAC;IACpC,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AAC;IAClE,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,aAAa,CAAC,MAAkB;QACpC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;QAC5D,OAAO,IAAI,CAAC,oBAAoB,CAAmB,cAAc,EAAE,GAAG,CAAC,CAAC;IAC1E,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,UAAU,CAAC,QAAmB;QAClC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC,YAAY,CAAiB,YAAY,EAAE,GAAG,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,kBAAkB,CAAC,QAAmB;QAC1C,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC,oBAAoB,CAAiB,YAAY,EAAE,GAAG,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,mBAAmB;QACvB,MAAM,CAAC,GAAG,CAAC,GAAG,IAAA,0BAAoB,GAAE,CAAC;QACrC,OAAO,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC;CACF;AA/QD,kCA+QC"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module attestation
|
|
4
|
+
* @description Web-of-trust attestations — create, revoke, and close
|
|
5
|
+
* on-chain attestations that vouch for agent trustworthiness.
|
|
6
|
+
*
|
|
7
|
+
* Attestations are signed endorsements from one wallet to an agent,
|
|
8
|
+
* forming a composable trust graph on Solana.
|
|
9
|
+
*
|
|
10
|
+
* @category Modules
|
|
11
|
+
* @since v0.1.0
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AttestationModule = void 0;
|
|
16
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
17
|
+
const base_1 = require("./base");
|
|
18
|
+
const pda_1 = require("../pda");
|
|
19
|
+
/**
|
|
20
|
+
* @name AttestationModule
|
|
21
|
+
* @description Manages on-chain attestations for the Solana Agent Protocol.
|
|
22
|
+
* Provides methods to create, revoke, close, and fetch attestation PDAs
|
|
23
|
+
* that form the web-of-trust layer.
|
|
24
|
+
*
|
|
25
|
+
* @category Modules
|
|
26
|
+
* @since v0.1.0
|
|
27
|
+
* @extends BaseModule
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const sap = new SapClient(provider);
|
|
32
|
+
* // Create an attestation for an agent
|
|
33
|
+
* const sig = await sap.attestation.create(agentWallet, {
|
|
34
|
+
* attestationType: { identity: {} },
|
|
35
|
+
* metadataHash: [...],
|
|
36
|
+
* expiresAt: null,
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
class AttestationModule extends base_1.BaseModule {
|
|
41
|
+
// ── PDA helpers ──────────────────────────────────────
|
|
42
|
+
/**
|
|
43
|
+
* @name deriveAttestation
|
|
44
|
+
* @description Derive the `AgentAttestation` PDA for a given agent and attester.
|
|
45
|
+
* @param agentPda - The agent account PDA to attest.
|
|
46
|
+
* @param attester - The attester wallet. Defaults to the connected wallet.
|
|
47
|
+
* @returns A tuple of `[PublicKey, bump]` for the attestation PDA.
|
|
48
|
+
* @see {@link deriveAttestation} from `pda/` module for the underlying derivation.
|
|
49
|
+
* @since v0.1.0
|
|
50
|
+
*/
|
|
51
|
+
deriveAttestation(agentPda, attester) {
|
|
52
|
+
return (0, pda_1.deriveAttestation)(agentPda, attester ?? this.walletPubkey);
|
|
53
|
+
}
|
|
54
|
+
// ── Instructions ─────────────────────────────────────
|
|
55
|
+
/**
|
|
56
|
+
* @name create
|
|
57
|
+
* @description Create an on-chain attestation vouching for an agent.
|
|
58
|
+
* The connected wallet becomes the attester.
|
|
59
|
+
* @param agentWallet - The wallet that owns the target agent.
|
|
60
|
+
* @param args - Attestation parameters (type, metadata hash, optional expiry).
|
|
61
|
+
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
62
|
+
* @since v0.1.0
|
|
63
|
+
*/
|
|
64
|
+
async create(agentWallet, args) {
|
|
65
|
+
const [agentPda] = (0, pda_1.deriveAgent)(agentWallet);
|
|
66
|
+
const [attestPda] = this.deriveAttestation(agentPda);
|
|
67
|
+
const [globalPda] = (0, pda_1.deriveGlobalRegistry)();
|
|
68
|
+
return this.methods
|
|
69
|
+
.createAttestation(args.attestationType, args.metadataHash, args.expiresAt)
|
|
70
|
+
.accounts({
|
|
71
|
+
attester: this.walletPubkey,
|
|
72
|
+
agent: agentPda,
|
|
73
|
+
attestation: attestPda,
|
|
74
|
+
globalRegistry: globalPda,
|
|
75
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
76
|
+
})
|
|
77
|
+
.rpc();
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* @name revoke
|
|
81
|
+
* @description Revoke a previously issued attestation. Only the original
|
|
82
|
+
* attester may revoke.
|
|
83
|
+
* @param agentWallet - The wallet of the attested agent.
|
|
84
|
+
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
85
|
+
* @since v0.1.0
|
|
86
|
+
*/
|
|
87
|
+
async revoke(agentWallet) {
|
|
88
|
+
const [agentPda] = (0, pda_1.deriveAgent)(agentWallet);
|
|
89
|
+
const [attestPda] = this.deriveAttestation(agentPda);
|
|
90
|
+
return this.methods
|
|
91
|
+
.revokeAttestation()
|
|
92
|
+
.accounts({
|
|
93
|
+
attester: this.walletPubkey,
|
|
94
|
+
attestation: attestPda,
|
|
95
|
+
})
|
|
96
|
+
.rpc();
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* @name close
|
|
100
|
+
* @description Close a revoked attestation PDA and reclaim rent to the attester.
|
|
101
|
+
* @param agentWallet - The wallet of the attested agent.
|
|
102
|
+
* @returns {Promise<TransactionSignature>} The transaction signature.
|
|
103
|
+
* @since v0.1.0
|
|
104
|
+
*/
|
|
105
|
+
async close(agentWallet) {
|
|
106
|
+
const [agentPda] = (0, pda_1.deriveAgent)(agentWallet);
|
|
107
|
+
const [attestPda] = this.deriveAttestation(agentPda);
|
|
108
|
+
const [globalPda] = (0, pda_1.deriveGlobalRegistry)();
|
|
109
|
+
return this.methods
|
|
110
|
+
.closeAttestation()
|
|
111
|
+
.accounts({
|
|
112
|
+
attester: this.walletPubkey,
|
|
113
|
+
attestation: attestPda,
|
|
114
|
+
globalRegistry: globalPda,
|
|
115
|
+
})
|
|
116
|
+
.rpc();
|
|
117
|
+
}
|
|
118
|
+
// ── Fetchers ─────────────────────────────────────────
|
|
119
|
+
/**
|
|
120
|
+
* @name fetch
|
|
121
|
+
* @description Fetch a deserialized `AgentAttestation` account.
|
|
122
|
+
* @param agentPda - The agent account PDA.
|
|
123
|
+
* @param attester - The attester wallet. Defaults to the connected wallet.
|
|
124
|
+
* @returns {Promise<AgentAttestationData>} The attestation account data.
|
|
125
|
+
* @throws Will throw if the attestation account does not exist.
|
|
126
|
+
* @since v0.1.0
|
|
127
|
+
*/
|
|
128
|
+
async fetch(agentPda, attester) {
|
|
129
|
+
const [pda] = this.deriveAttestation(agentPda, attester);
|
|
130
|
+
return this.fetchAccount("agentAttestation", pda);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* @name fetchNullable
|
|
134
|
+
* @description Fetch a deserialized `AgentAttestation` account, or `null`
|
|
135
|
+
* if it does not exist on-chain.
|
|
136
|
+
* @param agentPda - The agent account PDA.
|
|
137
|
+
* @param attester - The attester wallet. Defaults to the connected wallet.
|
|
138
|
+
* @returns {Promise<AgentAttestationData | null>} The attestation data or `null`.
|
|
139
|
+
* @since v0.1.0
|
|
140
|
+
*/
|
|
141
|
+
async fetchNullable(agentPda, attester) {
|
|
142
|
+
const [pda] = this.deriveAttestation(agentPda, attester);
|
|
143
|
+
return this.fetchAccountNullable("agentAttestation", pda);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.AttestationModule = AttestationModule;
|
|
147
|
+
//# sourceMappingURL=attestation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attestation.js","sourceRoot":"","sources":["../../../src/modules/attestation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH,6CAA2F;AAC3F,iCAAoC;AACpC,gCAA8E;AAG9E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAa,iBAAkB,SAAQ,iBAAU;IAC/C,wDAAwD;IAExD;;;;;;;;OAQG;IACH,iBAAiB,CACf,QAAmB,EACnB,QAAoB;QAEpB,OAAO,IAAA,uBAAiB,EAAC,QAAQ,EAAE,QAAQ,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;IACpE,CAAC;IAED,wDAAwD;IAExD;;;;;;;;OAQG;IACH,KAAK,CAAC,MAAM,CACV,WAAsB,EACtB,IAA2B;QAE3B,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAA,iBAAW,EAAC,WAAW,CAAC,CAAC;QAC5C,MAAM,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACrD,MAAM,CAAC,SAAS,CAAC,GAAG,IAAA,0BAAoB,GAAE,CAAC;QAE3C,OAAO,IAAI,CAAC,OAAO;aAChB,iBAAiB,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC;aAC1E,QAAQ,CAAC;YACR,QAAQ,EAAE,IAAI,CAAC,YAAY;YAC3B,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,SAAS;YACtB,cAAc,EAAE,SAAS;YACzB,aAAa,EAAE,uBAAa,CAAC,SAAS;SACvC,CA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