@oobe-protocol-labs/synapse-sap-sdk 0.4.2 → 0.6.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/dist/cjs/constants/index.js +4 -1
- package/dist/cjs/constants/index.js.map +1 -1
- package/dist/cjs/constants/network.js +81 -0
- package/dist/cjs/constants/network.js.map +1 -0
- package/dist/cjs/index.js +36 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/registries/x402.js +8 -3
- package/dist/cjs/registries/x402.js.map +1 -1
- package/dist/cjs/types/endpoint.js +15 -0
- package/dist/cjs/types/endpoint.js.map +1 -0
- package/dist/cjs/utils/endpoint-validator.js +232 -0
- package/dist/cjs/utils/endpoint-validator.js.map +1 -0
- package/dist/cjs/utils/index.js +30 -1
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/network-normalizer.js +236 -0
- package/dist/cjs/utils/network-normalizer.js.map +1 -0
- package/dist/cjs/utils/rpc-strategy.js +239 -0
- package/dist/cjs/utils/rpc-strategy.js.map +1 -0
- package/dist/cjs/utils/schemas.js +331 -0
- package/dist/cjs/utils/schemas.js.map +1 -0
- package/dist/esm/constants/index.js +2 -0
- package/dist/esm/constants/index.js.map +1 -1
- package/dist/esm/constants/network.js +78 -0
- package/dist/esm/constants/network.js.map +1 -0
- package/dist/esm/index.js +9 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/registries/x402.js +8 -3
- package/dist/esm/registries/x402.js.map +1 -1
- package/dist/esm/types/endpoint.js +14 -0
- package/dist/esm/types/endpoint.js.map +1 -0
- package/dist/esm/utils/endpoint-validator.js +226 -0
- package/dist/esm/utils/endpoint-validator.js.map +1 -0
- package/dist/esm/utils/index.js +5 -0
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/network-normalizer.js +229 -0
- package/dist/esm/utils/network-normalizer.js.map +1 -0
- package/dist/esm/utils/rpc-strategy.js +231 -0
- package/dist/esm/utils/rpc-strategy.js.map +1 -0
- package/dist/esm/utils/schemas.js +320 -0
- package/dist/esm/utils/schemas.js.map +1 -0
- package/dist/types/constants/index.d.ts +2 -0
- package/dist/types/constants/index.d.ts.map +1 -1
- package/dist/types/constants/network.d.ts +81 -0
- package/dist/types/constants/network.d.ts.map +1 -0
- package/dist/types/index.d.ts +9 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/plugin/schemas.d.ts +6 -6
- package/dist/types/registries/x402.d.ts +35 -2
- package/dist/types/registries/x402.d.ts.map +1 -1
- package/dist/types/types/endpoint.d.ts +161 -0
- package/dist/types/types/endpoint.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/utils/endpoint-validator.d.ts +110 -0
- package/dist/types/utils/endpoint-validator.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +6 -0
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/network-normalizer.d.ts +120 -0
- package/dist/types/utils/network-normalizer.d.ts.map +1 -0
- package/dist/types/utils/rpc-strategy.d.ts +172 -0
- package/dist/types/utils/rpc-strategy.d.ts.map +1 -0
- package/dist/types/utils/schemas.d.ts +351 -0
- package/dist/types/utils/schemas.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/constants/index.ts +4 -0
- package/src/constants/network.ts +89 -0
- package/src/index.ts +50 -0
- package/src/registries/x402.ts +43 -4
- package/src/types/endpoint.ts +181 -0
- package/src/types/index.ts +9 -0
- package/src/utils/endpoint-validator.ts +300 -0
- package/src/utils/index.ts +39 -0
- package/src/utils/network-normalizer.ts +240 -0
- package/src/utils/rpc-strategy.ts +322 -0
- package/src/utils/schemas.ts +359 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module utils/rpc-strategy
|
|
3
|
+
* @description Dual-connection RPC strategy and idempotent ATA creation.
|
|
4
|
+
*
|
|
5
|
+
* Solves two interoperability problems:
|
|
6
|
+
*
|
|
7
|
+
* 1. **WebSocket 400 loop**: Some authenticated RPCs reject WebSocket
|
|
8
|
+
* connections for SPL token operations. This module exposes a
|
|
9
|
+
* dual-connection strategy: primary RPC for SAP program calls,
|
|
10
|
+
* fallback public RPC for token operations.
|
|
11
|
+
*
|
|
12
|
+
* 2. **Idempotent ATA creation**: Wraps `getOrCreateAssociatedTokenAccount`
|
|
13
|
+
* with retries so "account already exists" doesn't surface as a
|
|
14
|
+
* hard error.
|
|
15
|
+
*
|
|
16
|
+
* @category Utils
|
|
17
|
+
* @since v0.6.0
|
|
18
|
+
*/
|
|
19
|
+
import { Connection, PublicKey, } from "@solana/web3.js";
|
|
20
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
21
|
+
// Default Public RPCs
|
|
22
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
23
|
+
/** Well-known public fallback RPCs by cluster. */
|
|
24
|
+
const PUBLIC_RPCS = {
|
|
25
|
+
"mainnet-beta": "https://api.mainnet-beta.solana.com",
|
|
26
|
+
devnet: "https://api.devnet.solana.com",
|
|
27
|
+
localnet: "http://localhost:8899",
|
|
28
|
+
};
|
|
29
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
30
|
+
// Public API
|
|
31
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
32
|
+
/**
|
|
33
|
+
* @name getRpcUrl
|
|
34
|
+
* @description Get the primary RPC URL from environment or config.
|
|
35
|
+
*
|
|
36
|
+
* Resolution order:
|
|
37
|
+
* 1. Explicit `config.primaryUrl`
|
|
38
|
+
* 2. `SOLANA_RPC_URL` env var
|
|
39
|
+
* 3. Cluster-appropriate public RPC
|
|
40
|
+
*
|
|
41
|
+
* @param config - Optional RPC configuration.
|
|
42
|
+
* @param cluster - Cluster hint (defaults to "mainnet-beta").
|
|
43
|
+
* @returns The resolved primary RPC URL.
|
|
44
|
+
*
|
|
45
|
+
* @category Utils
|
|
46
|
+
* @since v0.6.0
|
|
47
|
+
*/
|
|
48
|
+
export function getRpcUrl(config, cluster = "mainnet-beta") {
|
|
49
|
+
if (config?.primaryUrl)
|
|
50
|
+
return config.primaryUrl;
|
|
51
|
+
// Environment variable
|
|
52
|
+
const envUrl = typeof process !== "undefined" ? process.env?.SOLANA_RPC_URL : undefined;
|
|
53
|
+
if (envUrl)
|
|
54
|
+
return envUrl;
|
|
55
|
+
return PUBLIC_RPCS[cluster] ?? PUBLIC_RPCS["mainnet-beta"];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @name getFallbackRpcUrl
|
|
59
|
+
* @description Get the fallback RPC URL for SPL token operations.
|
|
60
|
+
*
|
|
61
|
+
* This avoids the WebSocket-400 loop when the primary RPC is
|
|
62
|
+
* an authenticated endpoint that rejects token-related WebSocket
|
|
63
|
+
* subscriptions.
|
|
64
|
+
*
|
|
65
|
+
* @param config - Optional RPC configuration.
|
|
66
|
+
* @param cluster - Cluster hint (defaults to "mainnet-beta").
|
|
67
|
+
* @returns The resolved fallback RPC URL.
|
|
68
|
+
*
|
|
69
|
+
* @category Utils
|
|
70
|
+
* @since v0.6.0
|
|
71
|
+
*/
|
|
72
|
+
export function getFallbackRpcUrl(config, cluster = "mainnet-beta") {
|
|
73
|
+
if (config?.fallbackUrl)
|
|
74
|
+
return config.fallbackUrl;
|
|
75
|
+
// Env fallback
|
|
76
|
+
const envUrl = typeof process !== "undefined"
|
|
77
|
+
? process.env?.SOLANA_FALLBACK_RPC_URL
|
|
78
|
+
: undefined;
|
|
79
|
+
if (envUrl)
|
|
80
|
+
return envUrl;
|
|
81
|
+
return PUBLIC_RPCS[cluster] ?? PUBLIC_RPCS["mainnet-beta"];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @name createDualConnection
|
|
85
|
+
* @description Create a dual-connection pair: primary for SAP program calls,
|
|
86
|
+
* fallback for SPL token operations.
|
|
87
|
+
*
|
|
88
|
+
* @param config - RPC configuration.
|
|
89
|
+
* @param cluster - Cluster hint.
|
|
90
|
+
* @returns A {@link DualConnection} with both connections.
|
|
91
|
+
*
|
|
92
|
+
* @category Utils
|
|
93
|
+
* @since v0.6.0
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* const { primary, fallback } = createDualConnection({
|
|
98
|
+
* primaryUrl: "https://my-rpc.example.com",
|
|
99
|
+
* }, "mainnet-beta");
|
|
100
|
+
*
|
|
101
|
+
* // Use primary for SAP calls
|
|
102
|
+
* const provider = new AnchorProvider(primary, wallet, {});
|
|
103
|
+
*
|
|
104
|
+
* // Use fallback for SPL token account creation
|
|
105
|
+
* const ata = await getOrCreateATA(fallback, mint, owner);
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export function createDualConnection(config, cluster = "mainnet-beta") {
|
|
109
|
+
const commitment = config.commitment ?? "confirmed";
|
|
110
|
+
const primaryUrl = getRpcUrl(config, cluster);
|
|
111
|
+
const fallbackUrl = getFallbackRpcUrl(config, cluster);
|
|
112
|
+
return {
|
|
113
|
+
primary: new Connection(primaryUrl, { commitment }),
|
|
114
|
+
fallback: new Connection(fallbackUrl, { commitment }),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* @name findATA
|
|
119
|
+
* @description Derive the Associated Token Account address.
|
|
120
|
+
* Uses the standard ATA PDA derivation without importing the full
|
|
121
|
+
* `@solana/spl-token` package.
|
|
122
|
+
*
|
|
123
|
+
* @param owner - The token account owner.
|
|
124
|
+
* @param mint - The token mint.
|
|
125
|
+
* @param programId - Token program ID (defaults to TOKEN_PROGRAM_ID).
|
|
126
|
+
* @returns The derived ATA public key.
|
|
127
|
+
*
|
|
128
|
+
* @category Utils
|
|
129
|
+
* @since v0.6.0
|
|
130
|
+
*/
|
|
131
|
+
export function findATA(owner, mint, programId = new PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA")) {
|
|
132
|
+
const ASSOCIATED_TOKEN_PROGRAM_ID = new PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");
|
|
133
|
+
const [ata] = PublicKey.findProgramAddressSync([owner.toBuffer(), programId.toBuffer(), mint.toBuffer()], ASSOCIATED_TOKEN_PROGRAM_ID);
|
|
134
|
+
return ata;
|
|
135
|
+
}
|
|
136
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
137
|
+
// Error Classification
|
|
138
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
139
|
+
/**
|
|
140
|
+
* Anchor error code to friendly message mapping.
|
|
141
|
+
* Converts cryptic Anchor errors into actionable messages.
|
|
142
|
+
*/
|
|
143
|
+
const ANCHOR_ERROR_MESSAGES = {
|
|
144
|
+
6000: "Agent already registered for this wallet",
|
|
145
|
+
6001: "Agent not found — register first",
|
|
146
|
+
6002: "Name exceeds maximum length (64 bytes)",
|
|
147
|
+
6003: "Description exceeds maximum length (256 bytes)",
|
|
148
|
+
6004: "Too many capabilities (max 10)",
|
|
149
|
+
6005: "Too many pricing tiers (max 5)",
|
|
150
|
+
6006: "Too many protocols (max 5)",
|
|
151
|
+
6007: "Feedback score out of range (0-1000)",
|
|
152
|
+
6008: "Unauthorized — only the agent owner can perform this action",
|
|
153
|
+
6009: "Escrow expired",
|
|
154
|
+
6010: "Insufficient escrow balance",
|
|
155
|
+
6011: "Max calls exceeded",
|
|
156
|
+
6012: "Invalid settlement — calls must be > 0",
|
|
157
|
+
6013: "Escrow not empty — withdraw balance before closing",
|
|
158
|
+
6014: "Invalid token program — make sure you passed TOKEN_PROGRAM_ID as the 3rd remaining account",
|
|
159
|
+
6015: "Vault already initialized",
|
|
160
|
+
6016: "Session already exists",
|
|
161
|
+
6017: "Session closed — cannot write to closed session",
|
|
162
|
+
6018: "Data exceeds maximum write size (750 bytes)",
|
|
163
|
+
6019: "Ring buffer overflow — seal before writing more",
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* @name classifyAnchorError
|
|
167
|
+
* @description Convert an Anchor error code into a friendly, actionable message.
|
|
168
|
+
*
|
|
169
|
+
* @param errorCode - The numeric Anchor error code.
|
|
170
|
+
* @returns A human-readable error message, or a generic message for unknown codes.
|
|
171
|
+
*
|
|
172
|
+
* @category Utils
|
|
173
|
+
* @since v0.6.0
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```ts
|
|
177
|
+
* try {
|
|
178
|
+
* await client.escrow.create(...);
|
|
179
|
+
* } catch (err) {
|
|
180
|
+
* const code = extractAnchorErrorCode(err);
|
|
181
|
+
* if (code !== null) {
|
|
182
|
+
* console.error(classifyAnchorError(code));
|
|
183
|
+
* }
|
|
184
|
+
* }
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
export function classifyAnchorError(errorCode) {
|
|
188
|
+
return (ANCHOR_ERROR_MESSAGES[errorCode] ??
|
|
189
|
+
`Unknown SAP program error (code ${errorCode}). Check the IDL for details.`);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* @name extractAnchorErrorCode
|
|
193
|
+
* @description Attempt to extract an Anchor error code from an Error object.
|
|
194
|
+
*
|
|
195
|
+
* Anchor errors typically have the structure `{ code: number, msg: string }`.
|
|
196
|
+
* This function handles both the direct `error.code` pattern and the
|
|
197
|
+
* `error.error.errorCode.number` nested pattern.
|
|
198
|
+
*
|
|
199
|
+
* @param err - The caught error object.
|
|
200
|
+
* @returns The numeric error code, or `null` if not an Anchor error.
|
|
201
|
+
*
|
|
202
|
+
* @category Utils
|
|
203
|
+
* @since v0.6.0
|
|
204
|
+
*/
|
|
205
|
+
export function extractAnchorErrorCode(err) {
|
|
206
|
+
if (err == null || typeof err !== "object")
|
|
207
|
+
return null;
|
|
208
|
+
// Direct code property
|
|
209
|
+
const direct = err.code;
|
|
210
|
+
if (typeof direct === "number")
|
|
211
|
+
return direct;
|
|
212
|
+
// Nested Anchor format: error.error.errorCode.number
|
|
213
|
+
const nested = err.error;
|
|
214
|
+
if (nested && typeof nested === "object") {
|
|
215
|
+
const errorCode = nested.errorCode;
|
|
216
|
+
if (errorCode && typeof errorCode === "object") {
|
|
217
|
+
const num = errorCode.number;
|
|
218
|
+
if (typeof num === "number")
|
|
219
|
+
return num;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
// AnchorError pattern: { logs: [...], error: { errorCode: { number } } }
|
|
223
|
+
const msg = err.message;
|
|
224
|
+
if (typeof msg === "string") {
|
|
225
|
+
const match = msg.match(/custom program error:\s*0x([0-9a-fA-F]+)/);
|
|
226
|
+
if (match?.[1])
|
|
227
|
+
return parseInt(match[1], 16);
|
|
228
|
+
}
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=rpc-strategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rpc-strategy.js","sourceRoot":"","sources":["../../../src/utils/rpc-strategy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,UAAU,EAEV,SAAS,GAEV,MAAM,iBAAiB,CAAC;AAkCzB,sEAAsE;AACtE,uBAAuB;AACvB,sEAAsE;AAEtE,kDAAkD;AAClD,MAAM,WAAW,GAA2B;IAC1C,cAAc,EAAE,qCAAqC;IACrD,MAAM,EAAE,+BAA+B;IACvC,QAAQ,EAAE,uBAAuB;CAClC,CAAC;AAEF,sEAAsE;AACtE,cAAc;AACd,sEAAsE;AAEtE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,SAAS,CACvB,MAA2B,EAC3B,UAAkB,cAAc;IAEhC,IAAI,MAAM,EAAE,UAAU;QAAE,OAAO,MAAM,CAAC,UAAU,CAAC;IAEjD,uBAAuB;IACvB,MAAM,MAAM,GACV,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3E,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAE1B,OAAO,WAAW,CAAC,OAAO,CAAC,IAAI,WAAW,CAAC,cAAc,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B,CAAC,KAAK,CAAC;IACtD,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QACzC,MAAM,SAAS,GAAI,MAAkC,CAAC,SAAS,CAAC;QAChE,IAAI,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;YAC/C,MAAM,GAAG,GAAI,SAAqC,CAAC,MAAM,CAAC;YAC1D,IAAI,OAAO,GAAG,KAAK,QAAQ;gBAAE,OAAO,GAAG,CAAC;QAC1C,CAAC;IACH,CAAC;IAED,yEAAyE;IACzE,MAAM,GAAG,GAAI,GAAa,CAAC,OAAO,CAAC;IACnC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;QACpE,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC;YAAE,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module utils/schemas
|
|
3
|
+
* @description Zod schemas for runtime validation of environment variables,
|
|
4
|
+
* tool arguments, agent manifests, and x402 payment parameters.
|
|
5
|
+
*
|
|
6
|
+
* These schemas enforce correctness at the boundary: CLI scripts refuse
|
|
7
|
+
* to run if required fields are missing or mis-typed, and SDK methods
|
|
8
|
+
* validate inputs before hitting the chain.
|
|
9
|
+
*
|
|
10
|
+
* Zod is a peer dependency — these schemas are tree-shaken if not imported.
|
|
11
|
+
*
|
|
12
|
+
* @category Utils
|
|
13
|
+
* @since v0.6.0
|
|
14
|
+
*/
|
|
15
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
16
|
+
// Dynamic Zod import (peer dependency)
|
|
17
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
18
|
+
// We use a lazy getter pattern to avoid hard failures when zod is not installed
|
|
19
|
+
let _z = null;
|
|
20
|
+
function getZod() {
|
|
21
|
+
if (!_z) {
|
|
22
|
+
try {
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
24
|
+
_z = require("zod");
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
throw new Error("[SAP SDK] Zod is required for schema validation. Install it: npm install zod");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return _z;
|
|
31
|
+
}
|
|
32
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
33
|
+
// Environment Schemas
|
|
34
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
35
|
+
/**
|
|
36
|
+
* @name createEnvSchema
|
|
37
|
+
* @description Create a Zod schema for SAP SDK environment variables.
|
|
38
|
+
* Validates that all required env vars are present and correctly typed.
|
|
39
|
+
*
|
|
40
|
+
* @returns A Zod schema object for env validation.
|
|
41
|
+
*
|
|
42
|
+
* @category Utils
|
|
43
|
+
* @since v0.6.0
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* import { createEnvSchema } from "@synapse-sap/sdk";
|
|
48
|
+
*
|
|
49
|
+
* const schema = createEnvSchema();
|
|
50
|
+
* const env = schema.parse(process.env);
|
|
51
|
+
* // env.SOLANA_CLUSTER is typed as "mainnet-beta" | "devnet" | "localnet"
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export function createEnvSchema() {
|
|
55
|
+
const z = getZod();
|
|
56
|
+
return z.object({
|
|
57
|
+
SOLANA_CLUSTER: z
|
|
58
|
+
.enum(["mainnet-beta", "devnet", "localnet"])
|
|
59
|
+
.default("devnet")
|
|
60
|
+
.describe("Solana cluster"),
|
|
61
|
+
SOLANA_RPC_URL: z
|
|
62
|
+
.string()
|
|
63
|
+
.url()
|
|
64
|
+
.optional()
|
|
65
|
+
.describe("Primary RPC endpoint URL"),
|
|
66
|
+
SOLANA_FALLBACK_RPC_URL: z
|
|
67
|
+
.string()
|
|
68
|
+
.url()
|
|
69
|
+
.optional()
|
|
70
|
+
.describe("Fallback RPC for SPL token ops"),
|
|
71
|
+
SOLANA_WS_URL: z
|
|
72
|
+
.string()
|
|
73
|
+
.url()
|
|
74
|
+
.optional()
|
|
75
|
+
.describe("WebSocket endpoint URL"),
|
|
76
|
+
WALLET_KEYPAIR_PATH: z
|
|
77
|
+
.string()
|
|
78
|
+
.optional()
|
|
79
|
+
.describe("Path to keypair JSON file"),
|
|
80
|
+
WALLET_PRIVATE_KEY: z
|
|
81
|
+
.string()
|
|
82
|
+
.optional()
|
|
83
|
+
.describe("Base58 private key (alternative to file)"),
|
|
84
|
+
SAP_PROGRAM_ID: z
|
|
85
|
+
.string()
|
|
86
|
+
.optional()
|
|
87
|
+
.describe("Custom SAP program ID override"),
|
|
88
|
+
DATABASE_URL: z
|
|
89
|
+
.string()
|
|
90
|
+
.optional()
|
|
91
|
+
.describe("PostgreSQL connection URL"),
|
|
92
|
+
LOG_LEVEL: z
|
|
93
|
+
.enum(["debug", "info", "warn", "error"])
|
|
94
|
+
.default("info")
|
|
95
|
+
.describe("Log level"),
|
|
96
|
+
X402_ENDPOINT: z
|
|
97
|
+
.string()
|
|
98
|
+
.url()
|
|
99
|
+
.optional()
|
|
100
|
+
.describe("Agent x402 payment endpoint"),
|
|
101
|
+
AGENT_URI: z
|
|
102
|
+
.string()
|
|
103
|
+
.url()
|
|
104
|
+
.optional()
|
|
105
|
+
.describe("Agent public API URI"),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
109
|
+
// Endpoint Schemas
|
|
110
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
111
|
+
/**
|
|
112
|
+
* @name createEndpointDescriptorSchema
|
|
113
|
+
* @description Zod schema for {@link EndpointDescriptor}.
|
|
114
|
+
* @returns A Zod schema for endpoint descriptor validation.
|
|
115
|
+
* @category Utils
|
|
116
|
+
* @since v0.6.0
|
|
117
|
+
*/
|
|
118
|
+
export function createEndpointDescriptorSchema() {
|
|
119
|
+
const z = getZod();
|
|
120
|
+
return z.object({
|
|
121
|
+
url: z.string().url(),
|
|
122
|
+
method: z.enum(["GET", "POST", "PUT", "DELETE"]).default("POST"),
|
|
123
|
+
contentType: z.string().default("application/json"),
|
|
124
|
+
requiresAuth: z.boolean().default(false),
|
|
125
|
+
authType: z.enum(["bearer", "api-key", "x402", "none"]).optional(),
|
|
126
|
+
requiresCSRF: z.boolean().default(false),
|
|
127
|
+
requiresCookies: z.boolean().default(false),
|
|
128
|
+
corsOrigins: z.array(z.string()).optional(),
|
|
129
|
+
requiredHeaders: z.record(z.string(), z.string()).optional(),
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* @name createHealthCheckSchema
|
|
134
|
+
* @description Zod schema for {@link HealthCheckDescriptor}.
|
|
135
|
+
* @returns A Zod schema for health check validation.
|
|
136
|
+
* @category Utils
|
|
137
|
+
* @since v0.6.0
|
|
138
|
+
*/
|
|
139
|
+
export function createHealthCheckSchema() {
|
|
140
|
+
const z = getZod();
|
|
141
|
+
return z.object({
|
|
142
|
+
url: z.string().url(),
|
|
143
|
+
expectedStatus: z.number().int().min(100).max(599).default(200),
|
|
144
|
+
timeoutMs: z.number().int().min(100).max(60_000).default(5000),
|
|
145
|
+
method: z.enum(["GET", "HEAD"]).default("GET"),
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
149
|
+
// Tool Manifest Schemas
|
|
150
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
151
|
+
/**
|
|
152
|
+
* @name createToolManifestEntrySchema
|
|
153
|
+
* @description Zod schema for a single tool in an agent manifest.
|
|
154
|
+
* @returns A Zod schema for tool manifest entry validation.
|
|
155
|
+
* @category Utils
|
|
156
|
+
* @since v0.6.0
|
|
157
|
+
*/
|
|
158
|
+
export function createToolManifestEntrySchema() {
|
|
159
|
+
const z = getZod();
|
|
160
|
+
return z.object({
|
|
161
|
+
name: z.string().min(1).max(64),
|
|
162
|
+
description: z.string().max(256),
|
|
163
|
+
protocol: z.string().min(1).max(64),
|
|
164
|
+
category: z.string().min(1),
|
|
165
|
+
inputSchema: z.record(z.string(), z.unknown()),
|
|
166
|
+
outputSchema: z.record(z.string(), z.unknown()),
|
|
167
|
+
httpMethod: z.enum(["GET", "POST", "PUT", "DELETE", "COMPOUND"]).default("POST"),
|
|
168
|
+
paymentMode: z.enum(["x402", "free", "prepaid", "subscription"]).default("x402"),
|
|
169
|
+
pricePerCall: z.number().int().min(0).default(0),
|
|
170
|
+
requiredArgs: z.array(z.string()).default([]),
|
|
171
|
+
prerequisites: z.array(z.string()).default([]),
|
|
172
|
+
endpointOverride: createEndpointDescriptorSchema().optional(),
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* @name createAgentManifestSchema
|
|
177
|
+
* @description Zod schema for a complete agent manifest.
|
|
178
|
+
* @returns A Zod schema for manifest validation.
|
|
179
|
+
* @category Utils
|
|
180
|
+
* @since v0.6.0
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```ts
|
|
184
|
+
* import { createAgentManifestSchema } from "@synapse-sap/sdk";
|
|
185
|
+
*
|
|
186
|
+
* const schema = createAgentManifestSchema();
|
|
187
|
+
* const manifest = schema.parse(JSON.parse(fs.readFileSync("manifest.json", "utf-8")));
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
export function createAgentManifestSchema() {
|
|
191
|
+
const z = getZod();
|
|
192
|
+
return z.object({
|
|
193
|
+
version: z.literal("1.0.0"),
|
|
194
|
+
wallet: z.string().min(32).max(50),
|
|
195
|
+
name: z.string().min(1).max(64),
|
|
196
|
+
description: z.string().max(256),
|
|
197
|
+
endpoint: createEndpointDescriptorSchema(),
|
|
198
|
+
healthCheck: createHealthCheckSchema().optional(),
|
|
199
|
+
tools: z.array(createToolManifestEntrySchema()),
|
|
200
|
+
supportedNetworks: z.array(z.string()).min(1),
|
|
201
|
+
generatedAt: z.string().datetime(),
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
205
|
+
// x402 Payment Schemas
|
|
206
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
207
|
+
/**
|
|
208
|
+
* @name createPreparePaymentSchema
|
|
209
|
+
* @description Zod schema for x402 payment preparation parameters.
|
|
210
|
+
* @returns A Zod schema for payment option validation.
|
|
211
|
+
* @category Utils
|
|
212
|
+
* @since v0.6.0
|
|
213
|
+
*/
|
|
214
|
+
export function createPreparePaymentSchema() {
|
|
215
|
+
const z = getZod();
|
|
216
|
+
return z.object({
|
|
217
|
+
pricePerCall: z.union([z.number(), z.string(), z.bigint()]),
|
|
218
|
+
maxCalls: z.union([z.number(), z.string(), z.bigint()]).optional(),
|
|
219
|
+
deposit: z.union([z.number(), z.string(), z.bigint()]),
|
|
220
|
+
expiresAt: z.union([z.number(), z.string(), z.bigint()]).optional(),
|
|
221
|
+
volumeCurve: z
|
|
222
|
+
.array(z.object({
|
|
223
|
+
afterCalls: z.number().int().min(1),
|
|
224
|
+
pricePerCall: z.union([z.number(), z.string(), z.bigint()]),
|
|
225
|
+
}))
|
|
226
|
+
.optional(),
|
|
227
|
+
tokenMint: z.string().optional(),
|
|
228
|
+
tokenDecimals: z.number().int().min(0).max(18).default(9),
|
|
229
|
+
networkIdentifier: z.string().optional(),
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
233
|
+
// Agent Registration Schemas
|
|
234
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
235
|
+
/**
|
|
236
|
+
* @name createRegisterAgentSchema
|
|
237
|
+
* @description Zod schema for agent registration arguments.
|
|
238
|
+
* @returns A Zod schema for registration validation.
|
|
239
|
+
* @category Utils
|
|
240
|
+
* @since v0.6.0
|
|
241
|
+
*/
|
|
242
|
+
export function createRegisterAgentSchema() {
|
|
243
|
+
const z = getZod();
|
|
244
|
+
return z.object({
|
|
245
|
+
name: z.string().min(1).max(64),
|
|
246
|
+
description: z.string().min(1).max(256),
|
|
247
|
+
agentId: z.string().max(128).optional().nullable(),
|
|
248
|
+
agentUri: z.string().max(256).optional().nullable(),
|
|
249
|
+
x402Endpoint: z.string().url().max(256).optional().nullable(),
|
|
250
|
+
capabilities: z
|
|
251
|
+
.array(z.object({
|
|
252
|
+
id: z.string().min(1),
|
|
253
|
+
description: z.string().nullable().optional(),
|
|
254
|
+
protocolId: z.string().nullable().optional(),
|
|
255
|
+
version: z.string().nullable().optional(),
|
|
256
|
+
}))
|
|
257
|
+
.max(10)
|
|
258
|
+
.default([]),
|
|
259
|
+
protocols: z.array(z.string()).max(5).default([]),
|
|
260
|
+
pricing: z
|
|
261
|
+
.array(z.object({
|
|
262
|
+
tierId: z.string().min(1),
|
|
263
|
+
pricePerCall: z.union([z.number(), z.string()]),
|
|
264
|
+
rateLimit: z.number().int().min(0),
|
|
265
|
+
tokenType: z.enum(["sol", "usdc", "spl"]).default("sol"),
|
|
266
|
+
settlementMode: z.enum(["instant", "escrow", "batched", "x402"]).default("x402"),
|
|
267
|
+
}))
|
|
268
|
+
.max(5)
|
|
269
|
+
.default([]),
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
273
|
+
// CLI Script Argument Schemas
|
|
274
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
275
|
+
/**
|
|
276
|
+
* @name createCallArgsSchema
|
|
277
|
+
* @description Zod schema for `npm run call` script arguments.
|
|
278
|
+
* Ensures all required fields are present before executing an x402 call.
|
|
279
|
+
*
|
|
280
|
+
* @returns A Zod schema for call argument validation.
|
|
281
|
+
* @category Utils
|
|
282
|
+
* @since v0.6.0
|
|
283
|
+
*/
|
|
284
|
+
export function createCallArgsSchema() {
|
|
285
|
+
const z = getZod();
|
|
286
|
+
return z.object({
|
|
287
|
+
agentWallet: z.string().min(32).max(50).describe("Agent wallet (base58)"),
|
|
288
|
+
tool: z.string().min(1).describe("Tool name to invoke"),
|
|
289
|
+
args: z.record(z.string(), z.unknown()).default({}).describe("Tool arguments (JSON)"),
|
|
290
|
+
endpoint: z.string().url().optional().describe("Endpoint URL override"),
|
|
291
|
+
network: z.string().optional().describe("Network identifier override"),
|
|
292
|
+
maxRetries: z.number().int().min(0).max(10).default(2),
|
|
293
|
+
timeoutMs: z.number().int().min(1000).max(120_000).default(30_000),
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* @name validateOrThrow
|
|
298
|
+
* @description Validate a value against a Zod schema, throwing a SapValidationError
|
|
299
|
+
* with a friendly message if validation fails.
|
|
300
|
+
*
|
|
301
|
+
* @param schema - A Zod schema.
|
|
302
|
+
* @param value - The value to validate.
|
|
303
|
+
* @param label - A label for error messages (e.g. "environment", "call args").
|
|
304
|
+
* @returns The parsed and typed value.
|
|
305
|
+
* @throws {Error} With formatted validation errors.
|
|
306
|
+
*
|
|
307
|
+
* @category Utils
|
|
308
|
+
* @since v0.6.0
|
|
309
|
+
*/
|
|
310
|
+
export function validateOrThrow(schema, value, label) {
|
|
311
|
+
const result = schema.safeParse(value);
|
|
312
|
+
if (result.success)
|
|
313
|
+
return schema.parse(value);
|
|
314
|
+
const issues = result.error?.issues ?? [];
|
|
315
|
+
const formatted = issues
|
|
316
|
+
.map((i) => ` • ${i.path.join(".")}: ${i.message}`)
|
|
317
|
+
.join("\n");
|
|
318
|
+
throw new Error(`[SAP SDK] Invalid ${label}:\n${formatted}`);
|
|
319
|
+
}
|
|
320
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../src/utils/schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,sEAAsE;AACtE,wCAAwC;AACxC,sEAAsE;AAEtE,gFAAgF;AAChF,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C,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QACtD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;KACnE,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,eAAe,CAC7B,MAAmK,EACnK,KAAc,EACd,KAAa;IAEb,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACvC,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAE/C,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,MAAM,IAAI,EAAE,CAAC;IAC1C,MAAM,SAAS,GAAG,MAAM;SACrB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;SACnD,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,MAAM,IAAI,KAAK,CACb,qBAAqB,KAAK,MAAM,SAAS,EAAE,CAC5C,CAAC;AACJ,CAAC"}
|
|
@@ -24,5 +24,7 @@ export { SAP_PROGRAM_ADDRESS, MAINNET_SAP_PROGRAM_ID, DEVNET_SAP_PROGRAM_ID, LOC
|
|
|
24
24
|
export { SEEDS } from "./seeds";
|
|
25
25
|
export type { SeedKey } from "./seeds";
|
|
26
26
|
export { LIMITS, AGENT_VERSION, VAULT_PROTOCOL_VERSION, TOOL_CATEGORY_VALUES, HTTP_METHOD_VALUES, } from "./limits";
|
|
27
|
+
export { SapNetwork } from "./network";
|
|
28
|
+
export type { SapNetworkId } from "./network";
|
|
27
29
|
export { SAP_PROGRAM, SAP_UPGRADE_AUTHORITY, GLOBAL_REGISTRY_ADDRESS, GLOBAL_REGISTRY_BUMP, IDL_ACCOUNT_ADDRESS, PROGRAM_METADATA_PROGRAM, TOOL_CATEGORY_ADDRESSES, TOOL_CATEGORY_ADDRESS_LIST, } from "./addresses";
|
|
28
30
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,GACf,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGvC,OAAO,EACL,MAAM,EACN,aAAa,EACb,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,GACf,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGvC,OAAO,EACL,MAAM,EACN,aAAa,EACb,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAG9C,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module constants/network
|
|
3
|
+
* @description Solana network identifiers for x402 payment headers.
|
|
4
|
+
*
|
|
5
|
+
* x402 providers validate the `X-Payment-Network` header against their
|
|
6
|
+
* own network identifier. Some providers (e.g. Coinbase, Phantom) accept
|
|
7
|
+
* the human-readable cluster name (`solana:mainnet-beta`), while others
|
|
8
|
+
* (e.g. Kamiyo, Helius x402) require the Solana genesis-hash form
|
|
9
|
+
* (`solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`).
|
|
10
|
+
*
|
|
11
|
+
* Use {@link SapNetwork} to select the correct format, or pass any
|
|
12
|
+
* custom string where needed.
|
|
13
|
+
*
|
|
14
|
+
* @category Constants
|
|
15
|
+
* @since v0.4.3
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { SapNetwork } from "@synapse-sap/sdk";
|
|
20
|
+
*
|
|
21
|
+
* // Standard cluster name (default)
|
|
22
|
+
* const ctx = await x402.preparePayment(agentWallet, {
|
|
23
|
+
* pricePerCall: 1000, deposit: 100_000,
|
|
24
|
+
* networkIdentifier: SapNetwork.SOLANA_MAINNET,
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* // Genesis-hash form for providers that require it
|
|
28
|
+
* const ctx2 = await x402.preparePayment(agentWallet, {
|
|
29
|
+
* pricePerCall: 1000, deposit: 100_000,
|
|
30
|
+
* networkIdentifier: SapNetwork.SOLANA_MAINNET_GENESIS,
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* @name SapNetwork
|
|
36
|
+
* @description Network identifier strings for x402 `X-Payment-Network` headers.
|
|
37
|
+
*
|
|
38
|
+
* Two mainnet forms exist because x402 providers disagree on the canonical
|
|
39
|
+
* identifier:
|
|
40
|
+
*
|
|
41
|
+
* | Constant | Value | Accepted by |
|
|
42
|
+
* |-------------------------|----------------------------------------------|----------------------|
|
|
43
|
+
* | `SOLANA_MAINNET` | `solana:mainnet-beta` | Coinbase, Phantom |
|
|
44
|
+
* | `SOLANA_MAINNET_GENESIS`| `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` | Kamiyo, Helius x402 |
|
|
45
|
+
* | `SOLANA_DEVNET` | `solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1` | Devnet providers |
|
|
46
|
+
* | `SOLANA_DEVNET_NAMED` | `solana:devnet` | Local / test flows |
|
|
47
|
+
*
|
|
48
|
+
* If your provider requires a different format, pass a raw string instead.
|
|
49
|
+
*
|
|
50
|
+
* @category Constants
|
|
51
|
+
* @since v0.4.3
|
|
52
|
+
*/
|
|
53
|
+
export declare const SapNetwork: {
|
|
54
|
+
/**
|
|
55
|
+
* Mainnet-beta, human-readable cluster name.
|
|
56
|
+
* Default value used by the SDK prior to v0.4.3.
|
|
57
|
+
*/
|
|
58
|
+
readonly SOLANA_MAINNET: "solana:mainnet-beta";
|
|
59
|
+
/**
|
|
60
|
+
* Mainnet-beta, genesis-hash form (CAIP-2 compliant).
|
|
61
|
+
* Required by Kamiyo, Helius x402, and other providers that validate
|
|
62
|
+
* against the Solana genesis hash.
|
|
63
|
+
*/
|
|
64
|
+
readonly SOLANA_MAINNET_GENESIS: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
65
|
+
/**
|
|
66
|
+
* Devnet, genesis-hash form (CAIP-2 compliant).
|
|
67
|
+
*/
|
|
68
|
+
readonly SOLANA_DEVNET: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1";
|
|
69
|
+
/**
|
|
70
|
+
* Devnet, human-readable cluster name.
|
|
71
|
+
* Useful for local development and test validators.
|
|
72
|
+
*/
|
|
73
|
+
readonly SOLANA_DEVNET_NAMED: "solana:devnet";
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* @name SapNetworkId
|
|
77
|
+
* @description Union type of all known {@link SapNetwork} values.
|
|
78
|
+
* Accept `SapNetworkId | string` where custom identifiers are allowed.
|
|
79
|
+
*/
|
|
80
|
+
export type SapNetworkId = (typeof SapNetwork)[keyof typeof SapNetwork];
|
|
81
|
+
//# sourceMappingURL=network.d.ts.map
|