@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,172 @@
|
|
|
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, type Commitment, PublicKey, type TransactionSignature } from "@solana/web3.js";
|
|
20
|
+
/**
|
|
21
|
+
* @interface RpcConfig
|
|
22
|
+
* @description Configuration for dual-connection RPC strategy.
|
|
23
|
+
* @category Utils
|
|
24
|
+
* @since v0.6.0
|
|
25
|
+
*/
|
|
26
|
+
export interface RpcConfig {
|
|
27
|
+
/** Primary RPC URL (for SAP program calls). */
|
|
28
|
+
readonly primaryUrl: string;
|
|
29
|
+
/** Fallback RPC URL (for SPL token ops, public RPCs). */
|
|
30
|
+
readonly fallbackUrl?: string;
|
|
31
|
+
/** Commitment level. */
|
|
32
|
+
readonly commitment?: Commitment;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @interface DualConnection
|
|
36
|
+
* @description Dual RPC connections: primary for SAP, fallback for tokens.
|
|
37
|
+
* @category Utils
|
|
38
|
+
* @since v0.6.0
|
|
39
|
+
*/
|
|
40
|
+
export interface DualConnection {
|
|
41
|
+
/** Primary connection for SAP program calls. */
|
|
42
|
+
readonly primary: Connection;
|
|
43
|
+
/** Fallback connection for SPL token operations. */
|
|
44
|
+
readonly fallback: Connection;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @name getRpcUrl
|
|
48
|
+
* @description Get the primary RPC URL from environment or config.
|
|
49
|
+
*
|
|
50
|
+
* Resolution order:
|
|
51
|
+
* 1. Explicit `config.primaryUrl`
|
|
52
|
+
* 2. `SOLANA_RPC_URL` env var
|
|
53
|
+
* 3. Cluster-appropriate public RPC
|
|
54
|
+
*
|
|
55
|
+
* @param config - Optional RPC configuration.
|
|
56
|
+
* @param cluster - Cluster hint (defaults to "mainnet-beta").
|
|
57
|
+
* @returns The resolved primary RPC URL.
|
|
58
|
+
*
|
|
59
|
+
* @category Utils
|
|
60
|
+
* @since v0.6.0
|
|
61
|
+
*/
|
|
62
|
+
export declare function getRpcUrl(config?: Partial<RpcConfig>, cluster?: string): string;
|
|
63
|
+
/**
|
|
64
|
+
* @name getFallbackRpcUrl
|
|
65
|
+
* @description Get the fallback RPC URL for SPL token operations.
|
|
66
|
+
*
|
|
67
|
+
* This avoids the WebSocket-400 loop when the primary RPC is
|
|
68
|
+
* an authenticated endpoint that rejects token-related WebSocket
|
|
69
|
+
* subscriptions.
|
|
70
|
+
*
|
|
71
|
+
* @param config - Optional RPC configuration.
|
|
72
|
+
* @param cluster - Cluster hint (defaults to "mainnet-beta").
|
|
73
|
+
* @returns The resolved fallback RPC URL.
|
|
74
|
+
*
|
|
75
|
+
* @category Utils
|
|
76
|
+
* @since v0.6.0
|
|
77
|
+
*/
|
|
78
|
+
export declare function getFallbackRpcUrl(config?: Partial<RpcConfig>, cluster?: string): string;
|
|
79
|
+
/**
|
|
80
|
+
* @name createDualConnection
|
|
81
|
+
* @description Create a dual-connection pair: primary for SAP program calls,
|
|
82
|
+
* fallback for SPL token operations.
|
|
83
|
+
*
|
|
84
|
+
* @param config - RPC configuration.
|
|
85
|
+
* @param cluster - Cluster hint.
|
|
86
|
+
* @returns A {@link DualConnection} with both connections.
|
|
87
|
+
*
|
|
88
|
+
* @category Utils
|
|
89
|
+
* @since v0.6.0
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* const { primary, fallback } = createDualConnection({
|
|
94
|
+
* primaryUrl: "https://my-rpc.example.com",
|
|
95
|
+
* }, "mainnet-beta");
|
|
96
|
+
*
|
|
97
|
+
* // Use primary for SAP calls
|
|
98
|
+
* const provider = new AnchorProvider(primary, wallet, {});
|
|
99
|
+
*
|
|
100
|
+
* // Use fallback for SPL token account creation
|
|
101
|
+
* const ata = await getOrCreateATA(fallback, mint, owner);
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export declare function createDualConnection(config: Partial<RpcConfig>, cluster?: string): DualConnection;
|
|
105
|
+
/**
|
|
106
|
+
* @interface AtaResult
|
|
107
|
+
* @description Result of idempotent ATA creation attempt.
|
|
108
|
+
* @category Utils
|
|
109
|
+
* @since v0.6.0
|
|
110
|
+
*/
|
|
111
|
+
export interface AtaResult {
|
|
112
|
+
/** The ATA public key (exists or newly created). */
|
|
113
|
+
readonly address: PublicKey;
|
|
114
|
+
/** Whether the ATA already existed. */
|
|
115
|
+
readonly existed: boolean;
|
|
116
|
+
/** Transaction signature (only if newly created). */
|
|
117
|
+
readonly txSignature?: TransactionSignature;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* @name findATA
|
|
121
|
+
* @description Derive the Associated Token Account address.
|
|
122
|
+
* Uses the standard ATA PDA derivation without importing the full
|
|
123
|
+
* `@solana/spl-token` package.
|
|
124
|
+
*
|
|
125
|
+
* @param owner - The token account owner.
|
|
126
|
+
* @param mint - The token mint.
|
|
127
|
+
* @param programId - Token program ID (defaults to TOKEN_PROGRAM_ID).
|
|
128
|
+
* @returns The derived ATA public key.
|
|
129
|
+
*
|
|
130
|
+
* @category Utils
|
|
131
|
+
* @since v0.6.0
|
|
132
|
+
*/
|
|
133
|
+
export declare function findATA(owner: PublicKey, mint: PublicKey, programId?: PublicKey): PublicKey;
|
|
134
|
+
/**
|
|
135
|
+
* @name classifyAnchorError
|
|
136
|
+
* @description Convert an Anchor error code into a friendly, actionable message.
|
|
137
|
+
*
|
|
138
|
+
* @param errorCode - The numeric Anchor error code.
|
|
139
|
+
* @returns A human-readable error message, or a generic message for unknown codes.
|
|
140
|
+
*
|
|
141
|
+
* @category Utils
|
|
142
|
+
* @since v0.6.0
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```ts
|
|
146
|
+
* try {
|
|
147
|
+
* await client.escrow.create(...);
|
|
148
|
+
* } catch (err) {
|
|
149
|
+
* const code = extractAnchorErrorCode(err);
|
|
150
|
+
* if (code !== null) {
|
|
151
|
+
* console.error(classifyAnchorError(code));
|
|
152
|
+
* }
|
|
153
|
+
* }
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
export declare function classifyAnchorError(errorCode: number): string;
|
|
157
|
+
/**
|
|
158
|
+
* @name extractAnchorErrorCode
|
|
159
|
+
* @description Attempt to extract an Anchor error code from an Error object.
|
|
160
|
+
*
|
|
161
|
+
* Anchor errors typically have the structure `{ code: number, msg: string }`.
|
|
162
|
+
* This function handles both the direct `error.code` pattern and the
|
|
163
|
+
* `error.error.errorCode.number` nested pattern.
|
|
164
|
+
*
|
|
165
|
+
* @param err - The caught error object.
|
|
166
|
+
* @returns The numeric error code, or `null` if not an Anchor error.
|
|
167
|
+
*
|
|
168
|
+
* @category Utils
|
|
169
|
+
* @since v0.6.0
|
|
170
|
+
*/
|
|
171
|
+
export declare function extractAnchorErrorCode(err: unknown): number | null;
|
|
172
|
+
//# sourceMappingURL=rpc-strategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rpc-strategy.d.ts","sourceRoot":"","sources":["../../../src/utils/rpc-strategy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,UAAU,EACV,KAAK,UAAU,EACf,SAAS,EACT,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AAMzB;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,+CAA+C;IAC/C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,yDAAyD;IACzD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,wBAAwB;IACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;CAClC;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,gDAAgD;IAChD,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,oDAAoD;IACpD,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;CAC/B;AAiBD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CACvB,MAAM,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,EAC3B,OAAO,GAAE,MAAuB,GAC/B,MAAM,CASR;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,EAC3B,OAAO,GAAE,MAAuB,GAC/B,MAAM,CAWR;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,EAC1B,OAAO,GAAE,MAAuB,GAC/B,cAAc,CAShB;AAMD;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,oDAAoD;IACpD,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,uCAAuC;IACvC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,qDAAqD;IACrD,QAAQ,CAAC,WAAW,CAAC,EAAE,oBAAoB,CAAC;CAC7C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CACrB,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,SAAS,EACf,SAAS,GAAE,SAAwE,GAClF,SAAS,CAUX;AAiCD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAK7D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAyBlE"}
|
|
@@ -0,0 +1,351 @@
|
|
|
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
|
+
* @name createEnvSchema
|
|
17
|
+
* @description Create a Zod schema for SAP SDK environment variables.
|
|
18
|
+
* Validates that all required env vars are present and correctly typed.
|
|
19
|
+
*
|
|
20
|
+
* @returns A Zod schema object for env validation.
|
|
21
|
+
*
|
|
22
|
+
* @category Utils
|
|
23
|
+
* @since v0.6.0
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { createEnvSchema } from "@synapse-sap/sdk";
|
|
28
|
+
*
|
|
29
|
+
* const schema = createEnvSchema();
|
|
30
|
+
* const env = schema.parse(process.env);
|
|
31
|
+
* // env.SOLANA_CLUSTER is typed as "mainnet-beta" | "devnet" | "localnet"
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function createEnvSchema(): import("zod").ZodObject<{
|
|
35
|
+
SOLANA_CLUSTER: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
36
|
+
"mainnet-beta": "mainnet-beta";
|
|
37
|
+
devnet: "devnet";
|
|
38
|
+
localnet: "localnet";
|
|
39
|
+
}>>;
|
|
40
|
+
SOLANA_RPC_URL: import("zod").ZodOptional<import("zod").ZodString>;
|
|
41
|
+
SOLANA_FALLBACK_RPC_URL: import("zod").ZodOptional<import("zod").ZodString>;
|
|
42
|
+
SOLANA_WS_URL: import("zod").ZodOptional<import("zod").ZodString>;
|
|
43
|
+
WALLET_KEYPAIR_PATH: import("zod").ZodOptional<import("zod").ZodString>;
|
|
44
|
+
WALLET_PRIVATE_KEY: import("zod").ZodOptional<import("zod").ZodString>;
|
|
45
|
+
SAP_PROGRAM_ID: import("zod").ZodOptional<import("zod").ZodString>;
|
|
46
|
+
DATABASE_URL: import("zod").ZodOptional<import("zod").ZodString>;
|
|
47
|
+
LOG_LEVEL: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
48
|
+
error: "error";
|
|
49
|
+
debug: "debug";
|
|
50
|
+
info: "info";
|
|
51
|
+
warn: "warn";
|
|
52
|
+
}>>;
|
|
53
|
+
X402_ENDPOINT: import("zod").ZodOptional<import("zod").ZodString>;
|
|
54
|
+
AGENT_URI: import("zod").ZodOptional<import("zod").ZodString>;
|
|
55
|
+
}, import("zod/v4/core").$strip>;
|
|
56
|
+
/**
|
|
57
|
+
* @name createEndpointDescriptorSchema
|
|
58
|
+
* @description Zod schema for {@link EndpointDescriptor}.
|
|
59
|
+
* @returns A Zod schema for endpoint descriptor validation.
|
|
60
|
+
* @category Utils
|
|
61
|
+
* @since v0.6.0
|
|
62
|
+
*/
|
|
63
|
+
export declare function createEndpointDescriptorSchema(): import("zod").ZodObject<{
|
|
64
|
+
url: import("zod").ZodString;
|
|
65
|
+
method: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
66
|
+
GET: "GET";
|
|
67
|
+
POST: "POST";
|
|
68
|
+
PUT: "PUT";
|
|
69
|
+
DELETE: "DELETE";
|
|
70
|
+
}>>;
|
|
71
|
+
contentType: import("zod").ZodDefault<import("zod").ZodString>;
|
|
72
|
+
requiresAuth: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
73
|
+
authType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
74
|
+
bearer: "bearer";
|
|
75
|
+
"api-key": "api-key";
|
|
76
|
+
x402: "x402";
|
|
77
|
+
none: "none";
|
|
78
|
+
}>>;
|
|
79
|
+
requiresCSRF: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
80
|
+
requiresCookies: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
81
|
+
corsOrigins: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
82
|
+
requiredHeaders: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
83
|
+
}, import("zod/v4/core").$strip>;
|
|
84
|
+
/**
|
|
85
|
+
* @name createHealthCheckSchema
|
|
86
|
+
* @description Zod schema for {@link HealthCheckDescriptor}.
|
|
87
|
+
* @returns A Zod schema for health check validation.
|
|
88
|
+
* @category Utils
|
|
89
|
+
* @since v0.6.0
|
|
90
|
+
*/
|
|
91
|
+
export declare function createHealthCheckSchema(): import("zod").ZodObject<{
|
|
92
|
+
url: import("zod").ZodString;
|
|
93
|
+
expectedStatus: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
94
|
+
timeoutMs: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
95
|
+
method: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
96
|
+
GET: "GET";
|
|
97
|
+
HEAD: "HEAD";
|
|
98
|
+
}>>;
|
|
99
|
+
}, import("zod/v4/core").$strip>;
|
|
100
|
+
/**
|
|
101
|
+
* @name createToolManifestEntrySchema
|
|
102
|
+
* @description Zod schema for a single tool in an agent manifest.
|
|
103
|
+
* @returns A Zod schema for tool manifest entry validation.
|
|
104
|
+
* @category Utils
|
|
105
|
+
* @since v0.6.0
|
|
106
|
+
*/
|
|
107
|
+
export declare function createToolManifestEntrySchema(): import("zod").ZodObject<{
|
|
108
|
+
name: import("zod").ZodString;
|
|
109
|
+
description: import("zod").ZodString;
|
|
110
|
+
protocol: import("zod").ZodString;
|
|
111
|
+
category: import("zod").ZodString;
|
|
112
|
+
inputSchema: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>;
|
|
113
|
+
outputSchema: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>;
|
|
114
|
+
httpMethod: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
115
|
+
GET: "GET";
|
|
116
|
+
POST: "POST";
|
|
117
|
+
PUT: "PUT";
|
|
118
|
+
DELETE: "DELETE";
|
|
119
|
+
COMPOUND: "COMPOUND";
|
|
120
|
+
}>>;
|
|
121
|
+
paymentMode: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
122
|
+
x402: "x402";
|
|
123
|
+
free: "free";
|
|
124
|
+
prepaid: "prepaid";
|
|
125
|
+
subscription: "subscription";
|
|
126
|
+
}>>;
|
|
127
|
+
pricePerCall: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
128
|
+
requiredArgs: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
129
|
+
prerequisites: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
130
|
+
endpointOverride: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
131
|
+
url: import("zod").ZodString;
|
|
132
|
+
method: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
133
|
+
GET: "GET";
|
|
134
|
+
POST: "POST";
|
|
135
|
+
PUT: "PUT";
|
|
136
|
+
DELETE: "DELETE";
|
|
137
|
+
}>>;
|
|
138
|
+
contentType: import("zod").ZodDefault<import("zod").ZodString>;
|
|
139
|
+
requiresAuth: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
140
|
+
authType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
141
|
+
bearer: "bearer";
|
|
142
|
+
"api-key": "api-key";
|
|
143
|
+
x402: "x402";
|
|
144
|
+
none: "none";
|
|
145
|
+
}>>;
|
|
146
|
+
requiresCSRF: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
147
|
+
requiresCookies: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
148
|
+
corsOrigins: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
149
|
+
requiredHeaders: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
150
|
+
}, import("zod/v4/core").$strip>>;
|
|
151
|
+
}, import("zod/v4/core").$strip>;
|
|
152
|
+
/**
|
|
153
|
+
* @name createAgentManifestSchema
|
|
154
|
+
* @description Zod schema for a complete agent manifest.
|
|
155
|
+
* @returns A Zod schema for manifest validation.
|
|
156
|
+
* @category Utils
|
|
157
|
+
* @since v0.6.0
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* import { createAgentManifestSchema } from "@synapse-sap/sdk";
|
|
162
|
+
*
|
|
163
|
+
* const schema = createAgentManifestSchema();
|
|
164
|
+
* const manifest = schema.parse(JSON.parse(fs.readFileSync("manifest.json", "utf-8")));
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
export declare function createAgentManifestSchema(): import("zod").ZodObject<{
|
|
168
|
+
version: import("zod").ZodLiteral<"1.0.0">;
|
|
169
|
+
wallet: import("zod").ZodString;
|
|
170
|
+
name: import("zod").ZodString;
|
|
171
|
+
description: import("zod").ZodString;
|
|
172
|
+
endpoint: import("zod").ZodObject<{
|
|
173
|
+
url: import("zod").ZodString;
|
|
174
|
+
method: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
175
|
+
GET: "GET";
|
|
176
|
+
POST: "POST";
|
|
177
|
+
PUT: "PUT";
|
|
178
|
+
DELETE: "DELETE";
|
|
179
|
+
}>>;
|
|
180
|
+
contentType: import("zod").ZodDefault<import("zod").ZodString>;
|
|
181
|
+
requiresAuth: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
182
|
+
authType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
183
|
+
bearer: "bearer";
|
|
184
|
+
"api-key": "api-key";
|
|
185
|
+
x402: "x402";
|
|
186
|
+
none: "none";
|
|
187
|
+
}>>;
|
|
188
|
+
requiresCSRF: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
189
|
+
requiresCookies: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
190
|
+
corsOrigins: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
191
|
+
requiredHeaders: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
192
|
+
}, import("zod/v4/core").$strip>;
|
|
193
|
+
healthCheck: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
194
|
+
url: import("zod").ZodString;
|
|
195
|
+
expectedStatus: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
196
|
+
timeoutMs: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
197
|
+
method: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
198
|
+
GET: "GET";
|
|
199
|
+
HEAD: "HEAD";
|
|
200
|
+
}>>;
|
|
201
|
+
}, import("zod/v4/core").$strip>>;
|
|
202
|
+
tools: import("zod").ZodArray<import("zod").ZodObject<{
|
|
203
|
+
name: import("zod").ZodString;
|
|
204
|
+
description: import("zod").ZodString;
|
|
205
|
+
protocol: import("zod").ZodString;
|
|
206
|
+
category: import("zod").ZodString;
|
|
207
|
+
inputSchema: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>;
|
|
208
|
+
outputSchema: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>;
|
|
209
|
+
httpMethod: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
210
|
+
GET: "GET";
|
|
211
|
+
POST: "POST";
|
|
212
|
+
PUT: "PUT";
|
|
213
|
+
DELETE: "DELETE";
|
|
214
|
+
COMPOUND: "COMPOUND";
|
|
215
|
+
}>>;
|
|
216
|
+
paymentMode: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
217
|
+
x402: "x402";
|
|
218
|
+
free: "free";
|
|
219
|
+
prepaid: "prepaid";
|
|
220
|
+
subscription: "subscription";
|
|
221
|
+
}>>;
|
|
222
|
+
pricePerCall: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
223
|
+
requiredArgs: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
224
|
+
prerequisites: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
225
|
+
endpointOverride: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
226
|
+
url: import("zod").ZodString;
|
|
227
|
+
method: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
228
|
+
GET: "GET";
|
|
229
|
+
POST: "POST";
|
|
230
|
+
PUT: "PUT";
|
|
231
|
+
DELETE: "DELETE";
|
|
232
|
+
}>>;
|
|
233
|
+
contentType: import("zod").ZodDefault<import("zod").ZodString>;
|
|
234
|
+
requiresAuth: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
235
|
+
authType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
236
|
+
bearer: "bearer";
|
|
237
|
+
"api-key": "api-key";
|
|
238
|
+
x402: "x402";
|
|
239
|
+
none: "none";
|
|
240
|
+
}>>;
|
|
241
|
+
requiresCSRF: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
242
|
+
requiresCookies: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
243
|
+
corsOrigins: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
244
|
+
requiredHeaders: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
245
|
+
}, import("zod/v4/core").$strip>>;
|
|
246
|
+
}, import("zod/v4/core").$strip>>;
|
|
247
|
+
supportedNetworks: import("zod").ZodArray<import("zod").ZodString>;
|
|
248
|
+
generatedAt: import("zod").ZodString;
|
|
249
|
+
}, import("zod/v4/core").$strip>;
|
|
250
|
+
/**
|
|
251
|
+
* @name createPreparePaymentSchema
|
|
252
|
+
* @description Zod schema for x402 payment preparation parameters.
|
|
253
|
+
* @returns A Zod schema for payment option validation.
|
|
254
|
+
* @category Utils
|
|
255
|
+
* @since v0.6.0
|
|
256
|
+
*/
|
|
257
|
+
export declare function createPreparePaymentSchema(): import("zod").ZodObject<{
|
|
258
|
+
pricePerCall: import("zod").ZodUnion<readonly [import("zod").ZodNumber, import("zod").ZodString, import("zod").ZodBigInt]>;
|
|
259
|
+
maxCalls: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodNumber, import("zod").ZodString, import("zod").ZodBigInt]>>;
|
|
260
|
+
deposit: import("zod").ZodUnion<readonly [import("zod").ZodNumber, import("zod").ZodString, import("zod").ZodBigInt]>;
|
|
261
|
+
expiresAt: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodNumber, import("zod").ZodString, import("zod").ZodBigInt]>>;
|
|
262
|
+
volumeCurve: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
263
|
+
afterCalls: import("zod").ZodNumber;
|
|
264
|
+
pricePerCall: import("zod").ZodUnion<readonly [import("zod").ZodNumber, import("zod").ZodString, import("zod").ZodBigInt]>;
|
|
265
|
+
}, import("zod/v4/core").$strip>>>;
|
|
266
|
+
tokenMint: import("zod").ZodOptional<import("zod").ZodString>;
|
|
267
|
+
tokenDecimals: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
268
|
+
networkIdentifier: import("zod").ZodOptional<import("zod").ZodString>;
|
|
269
|
+
}, import("zod/v4/core").$strip>;
|
|
270
|
+
/**
|
|
271
|
+
* @name createRegisterAgentSchema
|
|
272
|
+
* @description Zod schema for agent registration arguments.
|
|
273
|
+
* @returns A Zod schema for registration validation.
|
|
274
|
+
* @category Utils
|
|
275
|
+
* @since v0.6.0
|
|
276
|
+
*/
|
|
277
|
+
export declare function createRegisterAgentSchema(): import("zod").ZodObject<{
|
|
278
|
+
name: import("zod").ZodString;
|
|
279
|
+
description: import("zod").ZodString;
|
|
280
|
+
agentId: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
|
|
281
|
+
agentUri: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
|
|
282
|
+
x402Endpoint: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
|
|
283
|
+
capabilities: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
|
|
284
|
+
id: import("zod").ZodString;
|
|
285
|
+
description: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
286
|
+
protocolId: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
287
|
+
version: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
288
|
+
}, import("zod/v4/core").$strip>>>;
|
|
289
|
+
protocols: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
290
|
+
pricing: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
|
|
291
|
+
tierId: import("zod").ZodString;
|
|
292
|
+
pricePerCall: import("zod").ZodUnion<readonly [import("zod").ZodNumber, import("zod").ZodString]>;
|
|
293
|
+
rateLimit: import("zod").ZodNumber;
|
|
294
|
+
tokenType: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
295
|
+
sol: "sol";
|
|
296
|
+
usdc: "usdc";
|
|
297
|
+
spl: "spl";
|
|
298
|
+
}>>;
|
|
299
|
+
settlementMode: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
300
|
+
x402: "x402";
|
|
301
|
+
instant: "instant";
|
|
302
|
+
escrow: "escrow";
|
|
303
|
+
batched: "batched";
|
|
304
|
+
}>>;
|
|
305
|
+
}, import("zod/v4/core").$strip>>>;
|
|
306
|
+
}, import("zod/v4/core").$strip>;
|
|
307
|
+
/**
|
|
308
|
+
* @name createCallArgsSchema
|
|
309
|
+
* @description Zod schema for `npm run call` script arguments.
|
|
310
|
+
* Ensures all required fields are present before executing an x402 call.
|
|
311
|
+
*
|
|
312
|
+
* @returns A Zod schema for call argument validation.
|
|
313
|
+
* @category Utils
|
|
314
|
+
* @since v0.6.0
|
|
315
|
+
*/
|
|
316
|
+
export declare function createCallArgsSchema(): import("zod").ZodObject<{
|
|
317
|
+
agentWallet: import("zod").ZodString;
|
|
318
|
+
tool: import("zod").ZodString;
|
|
319
|
+
args: import("zod").ZodDefault<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
|
|
320
|
+
endpoint: import("zod").ZodOptional<import("zod").ZodString>;
|
|
321
|
+
network: import("zod").ZodOptional<import("zod").ZodString>;
|
|
322
|
+
maxRetries: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
323
|
+
timeoutMs: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
324
|
+
}, import("zod/v4/core").$strip>;
|
|
325
|
+
/**
|
|
326
|
+
* @name validateOrThrow
|
|
327
|
+
* @description Validate a value against a Zod schema, throwing a SapValidationError
|
|
328
|
+
* with a friendly message if validation fails.
|
|
329
|
+
*
|
|
330
|
+
* @param schema - A Zod schema.
|
|
331
|
+
* @param value - The value to validate.
|
|
332
|
+
* @param label - A label for error messages (e.g. "environment", "call args").
|
|
333
|
+
* @returns The parsed and typed value.
|
|
334
|
+
* @throws {Error} With formatted validation errors.
|
|
335
|
+
*
|
|
336
|
+
* @category Utils
|
|
337
|
+
* @since v0.6.0
|
|
338
|
+
*/
|
|
339
|
+
export declare function validateOrThrow<T>(schema: {
|
|
340
|
+
parse: (v: unknown) => T;
|
|
341
|
+
safeParse: (v: unknown) => {
|
|
342
|
+
success: boolean;
|
|
343
|
+
error?: {
|
|
344
|
+
issues: Array<{
|
|
345
|
+
path: Array<string | number>;
|
|
346
|
+
message: string;
|
|
347
|
+
}>;
|
|
348
|
+
};
|
|
349
|
+
};
|
|
350
|
+
}, value: unknown, label: string): T;
|
|
351
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/utils/schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA2BH;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe;;;;;;;;;;;;;;;;;;;;;iCAsD9B;AAMD;;;;;;GAMG;AACH,wBAAgB,8BAA8B;;;;;;;;;;;;;;;;;;;;iCAc7C;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB;;;;;;;;iCAStC;AAMD;;;;;;GAMG;AACH,wBAAgB,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAiB5C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAcxC;AAMD;;;;;;GAMG;AACH,wBAAgB,0BAA0B;;;;;;;;;;;;iCAoBzC;AAMD;;;;;;GAMG;AACH,wBAAgB,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAkCxC;AAMD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB;;;;;;;;iCAYnC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAC/B,MAAM,EAAE;IAAE,KAAK,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,CAAC,CAAC;IAAC,SAAS,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE;YAAE,MAAM,EAAE,KAAK,CAAC;gBAAE,IAAI,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;gBAAC,OAAO,EAAE,MAAM,CAAA;aAAE,CAAC,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,EACnK,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,MAAM,GACZ,CAAC,CAYH"}
|
package/package.json
CHANGED
package/src/constants/index.ts
CHANGED
|
@@ -42,6 +42,10 @@ export {
|
|
|
42
42
|
TOOL_CATEGORY_VALUES,
|
|
43
43
|
HTTP_METHOD_VALUES,
|
|
44
44
|
} from "./limits";
|
|
45
|
+
// ── Network Identifiers (x402) ───────────────────────────────
|
|
46
|
+
export { SapNetwork } from "./network";
|
|
47
|
+
export type { SapNetworkId } from "./network";
|
|
48
|
+
|
|
45
49
|
// ── Mainnet Addresses ────────────────────────────────────────
|
|
46
50
|
export {
|
|
47
51
|
SAP_PROGRAM,
|
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
36
|
+
// SAP Network Identifiers
|
|
37
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @name SapNetwork
|
|
41
|
+
* @description Network identifier strings for x402 `X-Payment-Network` headers.
|
|
42
|
+
*
|
|
43
|
+
* Two mainnet forms exist because x402 providers disagree on the canonical
|
|
44
|
+
* identifier:
|
|
45
|
+
*
|
|
46
|
+
* | Constant | Value | Accepted by |
|
|
47
|
+
* |-------------------------|----------------------------------------------|----------------------|
|
|
48
|
+
* | `SOLANA_MAINNET` | `solana:mainnet-beta` | Coinbase, Phantom |
|
|
49
|
+
* | `SOLANA_MAINNET_GENESIS`| `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` | Kamiyo, Helius x402 |
|
|
50
|
+
* | `SOLANA_DEVNET` | `solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1` | Devnet providers |
|
|
51
|
+
* | `SOLANA_DEVNET_NAMED` | `solana:devnet` | Local / test flows |
|
|
52
|
+
*
|
|
53
|
+
* If your provider requires a different format, pass a raw string instead.
|
|
54
|
+
*
|
|
55
|
+
* @category Constants
|
|
56
|
+
* @since v0.4.3
|
|
57
|
+
*/
|
|
58
|
+
export const SapNetwork = {
|
|
59
|
+
/**
|
|
60
|
+
* Mainnet-beta, human-readable cluster name.
|
|
61
|
+
* Default value used by the SDK prior to v0.4.3.
|
|
62
|
+
*/
|
|
63
|
+
SOLANA_MAINNET: "solana:mainnet-beta",
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Mainnet-beta, genesis-hash form (CAIP-2 compliant).
|
|
67
|
+
* Required by Kamiyo, Helius x402, and other providers that validate
|
|
68
|
+
* against the Solana genesis hash.
|
|
69
|
+
*/
|
|
70
|
+
SOLANA_MAINNET_GENESIS: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Devnet, genesis-hash form (CAIP-2 compliant).
|
|
74
|
+
*/
|
|
75
|
+
SOLANA_DEVNET: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Devnet, human-readable cluster name.
|
|
79
|
+
* Useful for local development and test validators.
|
|
80
|
+
*/
|
|
81
|
+
SOLANA_DEVNET_NAMED: "solana:devnet",
|
|
82
|
+
} as const;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @name SapNetworkId
|
|
86
|
+
* @description Union type of all known {@link SapNetwork} values.
|
|
87
|
+
* Accept `SapNetworkId | string` where custom identifiers are allowed.
|
|
88
|
+
*/
|
|
89
|
+
export type SapNetworkId = (typeof SapNetwork)[keyof typeof SapNetwork];
|