@qntx/wallet-engine 0.5.2 → 0.7.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/README.md +21 -0
- package/dist/contract-CEsgLme3.mjs +277 -0
- package/dist/contract-CEsgLme3.mjs.map +1 -0
- package/dist/gateway-contract.d.mts +285 -0
- package/dist/gateway-contract.mjs +1 -0
- package/dist/idb.d.mts +0 -4
- package/dist/idb.mjs +3 -6
- package/dist/idb.mjs.map +1 -1
- package/dist/index.d.mts +976 -499
- package/dist/index.mjs +2971 -965
- package/dist/index.mjs.map +1 -1
- package/dist/registry-LcFSPrE1.d.mts +23 -0
- package/package.json +14 -8
package/README.md
CHANGED
|
@@ -54,6 +54,27 @@ in-memory state.
|
|
|
54
54
|
group-0 Nostr identity; pull before publish, per-entry last-writer-wins.
|
|
55
55
|
- `engine.backup` — `BackupController` over an injected `CloudStore`.
|
|
56
56
|
|
|
57
|
+
## React Native hosts
|
|
58
|
+
|
|
59
|
+
The engine runs on the RN main runtime (Hermes) with no polyfills. Verified on 2026-11-02 in an
|
|
60
|
+
iOS simulator Release build and on 2026-11-03 in an Android API 30 emulator Release build (both
|
|
61
|
+
RN 0.88.0, Expo 58, Hermes), with and without `react-native-quick-crypto`'s `install()`, using a
|
|
62
|
+
hardware-factor wallet: engine
|
|
63
|
+
creation, the gateway's `/v1/networks`, a Sepolia balance read, a send request prepared and
|
|
64
|
+
rejected, signet and Solana devnet reads through the gateway, `payments.parse`, and a lock that
|
|
65
|
+
invalidates open requests.
|
|
66
|
+
|
|
67
|
+
What the host must provide:
|
|
68
|
+
|
|
69
|
+
- `random`: a CSPRNG, injected as an option. Hermes has no `crypto.getRandomValues`, so use a native
|
|
70
|
+
source such as `react-native-quick-crypto`'s `randomBytes`:
|
|
71
|
+
`random: (n) => new Uint8Array(randomBytes(n))`.
|
|
72
|
+
- Nothing else. `globalThis.crypto`, `crypto.subtle` and `Buffer` are all absent in that run and
|
|
73
|
+
not needed; `fetch`, `TextEncoder`, `URL`, `AbortSignal.timeout` and `structuredClone` are built in.
|
|
74
|
+
|
|
75
|
+
A host that already calls `install()` from `react-native-quick-crypto` (as Meowl does) also works;
|
|
76
|
+
the same smoke passes with those globals installed.
|
|
77
|
+
|
|
57
78
|
## License
|
|
58
79
|
|
|
59
80
|
MIT OR Apache-2.0
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
|
+
// src/gateway/contract/endpoint.ts
|
|
3
|
+
/** One gateway route: its verb, versioned path template, and request/response schemas. */
|
|
4
|
+
function endpoint(method, path, request, response) {
|
|
5
|
+
return {
|
|
6
|
+
method,
|
|
7
|
+
path,
|
|
8
|
+
request,
|
|
9
|
+
response
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/** `value` typed by `schema`, or `undefined` when it does not satisfy it. */
|
|
13
|
+
function parseWith(schema, value) {
|
|
14
|
+
const result = z.safeParse(schema, value);
|
|
15
|
+
return result.success ? result.data : void 0;
|
|
16
|
+
}
|
|
17
|
+
/** Whether `value` satisfies `schema` — lets consumers validate without importing zod. */
|
|
18
|
+
function accepts(schema, value) {
|
|
19
|
+
return z.safeParse(schema, value).success;
|
|
20
|
+
}
|
|
21
|
+
// src/gateway/contract/rpc.ts
|
|
22
|
+
/** One JSON-RPC call plus nothing else: batches may carry at most this many entries. */
|
|
23
|
+
const RPC_BATCH_MAX = 20;
|
|
24
|
+
/** Read-only EVM methods plus `eth_sendRawTransaction`. Anything not listed is rejected. */
|
|
25
|
+
const EVM_RPC_METHODS = [
|
|
26
|
+
"eth_blobBaseFee",
|
|
27
|
+
"eth_blockNumber",
|
|
28
|
+
"eth_call",
|
|
29
|
+
"eth_chainId",
|
|
30
|
+
"eth_createAccessList",
|
|
31
|
+
"eth_estimateGas",
|
|
32
|
+
"eth_feeHistory",
|
|
33
|
+
"eth_gasPrice",
|
|
34
|
+
"eth_getBalance",
|
|
35
|
+
"eth_getBlockByHash",
|
|
36
|
+
"eth_getBlockByNumber",
|
|
37
|
+
"eth_getBlockReceipts",
|
|
38
|
+
"eth_getBlockTransactionCountByHash",
|
|
39
|
+
"eth_getBlockTransactionCountByNumber",
|
|
40
|
+
"eth_getCode",
|
|
41
|
+
"eth_getProof",
|
|
42
|
+
"eth_getStorageAt",
|
|
43
|
+
"eth_getTransactionByBlockHashAndIndex",
|
|
44
|
+
"eth_getTransactionByBlockNumberAndIndex",
|
|
45
|
+
"eth_getTransactionByHash",
|
|
46
|
+
"eth_getTransactionCount",
|
|
47
|
+
"eth_getTransactionReceipt",
|
|
48
|
+
"eth_maxPriorityFeePerGas",
|
|
49
|
+
"eth_sendRawTransaction",
|
|
50
|
+
"net_version",
|
|
51
|
+
"web3_clientVersion"
|
|
52
|
+
];
|
|
53
|
+
/** Read-only Solana methods plus `sendTransaction`. Anything not listed is rejected. */
|
|
54
|
+
const SOLANA_RPC_METHODS = [
|
|
55
|
+
"getAccountInfo",
|
|
56
|
+
"getBalance",
|
|
57
|
+
"getBlock",
|
|
58
|
+
"getBlockHeight",
|
|
59
|
+
"getBlockTime",
|
|
60
|
+
"getEpochInfo",
|
|
61
|
+
"getFeeForMessage",
|
|
62
|
+
"getGenesisHash",
|
|
63
|
+
"getLatestBlockhash",
|
|
64
|
+
"getMinimumBalanceForRentExemption",
|
|
65
|
+
"getMultipleAccounts",
|
|
66
|
+
"getRecentPrioritizationFees",
|
|
67
|
+
"getSignatureStatuses",
|
|
68
|
+
"getSignaturesForAddress",
|
|
69
|
+
"getSlot",
|
|
70
|
+
"getTokenAccountBalance",
|
|
71
|
+
"getTokenAccountsByOwner",
|
|
72
|
+
"getTokenSupply",
|
|
73
|
+
"getTransaction",
|
|
74
|
+
"getVersion",
|
|
75
|
+
"isBlockhashValid",
|
|
76
|
+
"sendTransaction",
|
|
77
|
+
"simulateTransaction"
|
|
78
|
+
];
|
|
79
|
+
const jsonRpcId = z.union([
|
|
80
|
+
z.string(),
|
|
81
|
+
z.number(),
|
|
82
|
+
z.null()
|
|
83
|
+
]);
|
|
84
|
+
const jsonRpcParams = z.optional(z.union([z.array(z.unknown()), z.record(z.string(), z.unknown())]));
|
|
85
|
+
const callSchema = (method) => z.object({
|
|
86
|
+
jsonrpc: z.literal("2.0"),
|
|
87
|
+
id: jsonRpcId,
|
|
88
|
+
method,
|
|
89
|
+
params: jsonRpcParams
|
|
90
|
+
});
|
|
91
|
+
const bodySchema = (call) => z.union([call, z.array(call).check(z.minLength(1), z.maxLength(20))]);
|
|
92
|
+
/** Method-agnostic wire shape of a call or batch (the gateway narrows by family). */
|
|
93
|
+
const rpcRequest = bodySchema(callSchema(z.string()));
|
|
94
|
+
const evmRpcRequest = bodySchema(callSchema(z.enum(EVM_RPC_METHODS)));
|
|
95
|
+
const solanaRpcRequest = bodySchema(callSchema(z.enum(SOLANA_RPC_METHODS)));
|
|
96
|
+
const successResponse = z.object({
|
|
97
|
+
jsonrpc: z.literal("2.0"),
|
|
98
|
+
id: jsonRpcId,
|
|
99
|
+
result: z.unknown()
|
|
100
|
+
});
|
|
101
|
+
const errorResponse = z.object({
|
|
102
|
+
jsonrpc: z.literal("2.0"),
|
|
103
|
+
id: jsonRpcId,
|
|
104
|
+
error: z.object({
|
|
105
|
+
code: z.int(),
|
|
106
|
+
message: z.string(),
|
|
107
|
+
data: z.optional(z.unknown())
|
|
108
|
+
})
|
|
109
|
+
});
|
|
110
|
+
const jsonRpcResponse = z.union([successResponse, errorResponse]);
|
|
111
|
+
const rpcResponse = z.union([jsonRpcResponse, z.array(jsonRpcResponse)]);
|
|
112
|
+
const rpc = endpoint("POST", "/v1/rpc/:caip2", rpcRequest, rpcResponse);
|
|
113
|
+
/** The JSON-RPC URL path for one network. */
|
|
114
|
+
const rpcPath = (caip2) => rpc.path.replace(":caip2", caip2);
|
|
115
|
+
// src/gateway/contract/primitives.ts
|
|
116
|
+
const INSTALL_ID_HEADER = "x-install-id";
|
|
117
|
+
const PROVIDERS_HEADER = "x-gateway-providers";
|
|
118
|
+
/** 128 random bits as lowercase hex — generated once per install, unrelated to wallet secrets. */
|
|
119
|
+
const installId = z.string().check(z.regex(/^[0-9a-f]{32}$/));
|
|
120
|
+
/** CAIP-2 chain id: `namespace:reference`. */
|
|
121
|
+
const caip2 = z.string().check(z.regex(/^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}$/));
|
|
122
|
+
const GATEWAY_ERRORS = [
|
|
123
|
+
"invalid-request",
|
|
124
|
+
"unknown-network",
|
|
125
|
+
"not-found",
|
|
126
|
+
"rate-limited",
|
|
127
|
+
"unavailable",
|
|
128
|
+
"internal"
|
|
129
|
+
];
|
|
130
|
+
const gatewayError = z.object({ error: z.enum(GATEWAY_ERRORS) });
|
|
131
|
+
// src/gateway/contract/health.ts
|
|
132
|
+
const healthRequest = z.undefined();
|
|
133
|
+
const healthResponse = z.object({ status: z.literal("ok") });
|
|
134
|
+
const health = endpoint("GET", "/v1/health", healthRequest, healthResponse);
|
|
135
|
+
// src/gateway/contract/esplora.ts
|
|
136
|
+
const HEX64 = "[0-9a-f]{64}";
|
|
137
|
+
/** The Esplora surface the engine uses; every other path is rejected. */
|
|
138
|
+
const ESPLORA_ROUTES = [
|
|
139
|
+
{
|
|
140
|
+
method: "GET",
|
|
141
|
+
pattern: /^\/block-height\/\d{1,10}$/
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
method: "GET",
|
|
145
|
+
pattern: /^\/fee-estimates$/
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
method: "GET",
|
|
149
|
+
pattern: new RegExp(`^/scripthash/${HEX64}/txs$`)
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
method: "GET",
|
|
153
|
+
pattern: new RegExp(`^/scripthash/${HEX64}/utxo$`)
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
method: "GET",
|
|
157
|
+
pattern: new RegExp(`^/tx/${HEX64}/hex$`)
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
method: "GET",
|
|
161
|
+
pattern: new RegExp(`^/tx/${HEX64}/status$`)
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
method: "POST",
|
|
165
|
+
pattern: /^\/tx$/
|
|
166
|
+
}
|
|
167
|
+
];
|
|
168
|
+
/** `path` is the Esplora path after `/v1/esplora/:caip2`, with a leading slash and no query. */
|
|
169
|
+
const esploraPathAllowed = (method, path) => ESPLORA_ROUTES.some((route) => route.method === method && route.pattern.test(path));
|
|
170
|
+
const esploraGet = endpoint("GET", "/v1/esplora/:caip2/*", z.undefined(), z.unknown());
|
|
171
|
+
/** The Esplora base path for one network; allow-listed paths are appended to it. */
|
|
172
|
+
const esploraBasePath = (caip2) => esploraGet.path.replace(":caip2", caip2).replace(/\/\*$/, "");
|
|
173
|
+
const esploraPost = endpoint("POST", "/v1/esplora/:caip2/tx", z.string(), z.string());
|
|
174
|
+
// src/networks/registry.ts
|
|
175
|
+
const entry = (chainId, name, symbol, testnet, _source) => ({
|
|
176
|
+
id: `eip155:${chainId}`,
|
|
177
|
+
chainId,
|
|
178
|
+
name,
|
|
179
|
+
symbol,
|
|
180
|
+
decimals: 18,
|
|
181
|
+
testnet,
|
|
182
|
+
family: "evm",
|
|
183
|
+
multicall3: "0xcA11bde05977b3631167028862bE2a173976CA11"
|
|
184
|
+
});
|
|
185
|
+
const NETWORKS = [
|
|
186
|
+
entry(1, "Ethereum", "ETH", false, "https://ethereum.org/en/developers/docs/networks/"),
|
|
187
|
+
entry(8453, "Base", "ETH", false, "https://docs.base.org/docs/network-information"),
|
|
188
|
+
entry(42161, "Arbitrum One", "ETH", false, "https://docs.arbitrum.io/for-devs/dev-tools-and-resources/chain-info"),
|
|
189
|
+
entry(10, "OP Mainnet", "ETH", false, "https://docs.optimism.io/chain/networks"),
|
|
190
|
+
entry(137, "Polygon", "POL", false, "https://docs.polygon.technology/pos/reference/rpc-endpoints/"),
|
|
191
|
+
entry(56, "BNB Smart Chain", "BNB", false, "https://docs.bnbchain.org/bnb-smart-chain/developers/json_rpc/"),
|
|
192
|
+
entry(999, "HyperEVM", "HYPE", false, "https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/hyperevm"),
|
|
193
|
+
entry(43114, "Avalanche C-Chain", "AVAX", false, "https://build.avax.network/docs/tooling/rpc-providers"),
|
|
194
|
+
entry(11155111, "Sepolia", "ETH", true, "https://ethereum.org/en/developers/docs/networks/"),
|
|
195
|
+
entry(84532, "Base Sepolia", "ETH", true, "https://docs.base.org/docs/network-information"),
|
|
196
|
+
entry(421614, "Arbitrum Sepolia", "ETH", true, "https://docs.arbitrum.io/for-devs/dev-tools-and-resources/chain-info"),
|
|
197
|
+
entry(11155420, "OP Sepolia", "ETH", true, "https://docs.optimism.io/chain/networks"),
|
|
198
|
+
entry(80002, "Polygon Amoy", "POL", true, "https://docs.polygon.technology/pos/reference/rpc-endpoints/"),
|
|
199
|
+
entry(97, "BNB Smart Chain Testnet", "tBNB", true, "https://docs.bnbchain.org/bnb-smart-chain/developers/json_rpc/"),
|
|
200
|
+
entry(998, "HyperEVM Testnet", "HYPE", true, "https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/hyperevm"),
|
|
201
|
+
entry(43113, "Avalanche Fuji", "AVAX", true, "https://build.avax.network/docs/tooling/rpc-providers")
|
|
202
|
+
];
|
|
203
|
+
const networkById = (id) => [
|
|
204
|
+
...NETWORKS,
|
|
205
|
+
...SOLANA_NETWORKS,
|
|
206
|
+
...BITCOIN_NETWORKS
|
|
207
|
+
].find((n) => n.id === id);
|
|
208
|
+
const BITCOIN_NETWORKS = [
|
|
209
|
+
{
|
|
210
|
+
id: "bip122:000000000019d6689c085ae165831e93",
|
|
211
|
+
chainId: 0,
|
|
212
|
+
name: "Bitcoin",
|
|
213
|
+
symbol: "BTC",
|
|
214
|
+
decimals: 8,
|
|
215
|
+
testnet: false,
|
|
216
|
+
family: "bitcoin",
|
|
217
|
+
genesisHash: "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
id: "bip122:00000000da84f2bafbbc53dee25a72ae",
|
|
221
|
+
chainId: 0,
|
|
222
|
+
name: "Bitcoin Testnet4",
|
|
223
|
+
symbol: "tBTC",
|
|
224
|
+
decimals: 8,
|
|
225
|
+
testnet: true,
|
|
226
|
+
family: "bitcoin",
|
|
227
|
+
genesisHash: "00000000da84f2bafbbc53dee25a72ae507ff4914b867c565be350b0da8bf043"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
id: "bip122:00000008819873e925422c1ff0f99f7c",
|
|
231
|
+
chainId: 0,
|
|
232
|
+
name: "Bitcoin Signet",
|
|
233
|
+
symbol: "sBTC",
|
|
234
|
+
decimals: 8,
|
|
235
|
+
testnet: true,
|
|
236
|
+
family: "bitcoin",
|
|
237
|
+
genesisHash: "00000008819873e925422c1ff0f99f7cc9bbb232af63a077a480a3633bee1ef6"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
id: "bip122:0f9188f13cb7b2c71f2a335e3a4fc328",
|
|
241
|
+
chainId: 0,
|
|
242
|
+
name: "Bitcoin Regtest",
|
|
243
|
+
symbol: "rBTC",
|
|
244
|
+
decimals: 8,
|
|
245
|
+
testnet: true,
|
|
246
|
+
family: "bitcoin",
|
|
247
|
+
genesisHash: "0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"
|
|
248
|
+
}
|
|
249
|
+
];
|
|
250
|
+
const SOLANA_NETWORKS = [{
|
|
251
|
+
id: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
|
|
252
|
+
chainId: 0,
|
|
253
|
+
name: "Solana",
|
|
254
|
+
symbol: "SOL",
|
|
255
|
+
decimals: 9,
|
|
256
|
+
testnet: false,
|
|
257
|
+
family: "solana",
|
|
258
|
+
genesisHash: "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d"
|
|
259
|
+
}, {
|
|
260
|
+
id: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",
|
|
261
|
+
chainId: 0,
|
|
262
|
+
name: "Solana Devnet",
|
|
263
|
+
symbol: "SOL",
|
|
264
|
+
decimals: 9,
|
|
265
|
+
testnet: true,
|
|
266
|
+
family: "solana",
|
|
267
|
+
genesisHash: "EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG"
|
|
268
|
+
}];
|
|
269
|
+
// src/gateway/contract/served.ts
|
|
270
|
+
const servedNetworksRequest = z.undefined();
|
|
271
|
+
/** The networks the gateway actually serves, in its configured order. */
|
|
272
|
+
const servedNetworksResponse = z.object({ networks: z.array(caip2) });
|
|
273
|
+
const servedNetworks = endpoint("GET", "/v1/networks", servedNetworksRequest, servedNetworksResponse);
|
|
274
|
+
const networksPath = servedNetworks.path;
|
|
275
|
+
export { rpcPath as A, EVM_RPC_METHODS as C, jsonRpcId as D, evmRpcRequest as E, endpoint as F, parseWith as I, rpcResponse as M, solanaRpcRequest as N, jsonRpcResponse as O, accepts as P, installId as S, SOLANA_RPC_METHODS as T, GATEWAY_ERRORS as _, BITCOIN_NETWORKS as a, caip2 as b, networkById as c, esploraGet as d, esploraPathAllowed as f, healthResponse as g, healthRequest as h, servedNetworksResponse as i, rpcRequest as j, rpc as k, ESPLORA_ROUTES as l, health as m, servedNetworks as n, NETWORKS as o, esploraPost as p, servedNetworksRequest as r, SOLANA_NETWORKS as s, networksPath as t, esploraBasePath as u, INSTALL_ID_HEADER as v, RPC_BATCH_MAX as w, gatewayError as x, PROVIDERS_HEADER as y };
|
|
276
|
+
|
|
277
|
+
//# sourceMappingURL=contract-CEsgLme3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-CEsgLme3.mjs","names":[],"sources":["../src/gateway/contract/endpoint.ts","../src/gateway/contract/rpc.ts","../src/gateway/contract/primitives.ts","../src/gateway/contract/health.ts","../src/gateway/contract/esplora.ts","../src/networks/registry.ts","../src/gateway/contract/served.ts"],"sourcesContent":["import * as z from \"zod/mini\";\n\nexport type HttpMethod = \"GET\" | \"POST\" | \"DELETE\";\n\nexport type Endpoint<Req extends z.ZodMiniType, Res extends z.ZodMiniType> = {\n readonly method: HttpMethod;\n readonly path: string;\n readonly request: Req;\n readonly response: Res;\n};\n\n/** One gateway route: its verb, versioned path template, and request/response schemas. */\nexport function endpoint<Req extends z.ZodMiniType, Res extends z.ZodMiniType>(\n method: HttpMethod,\n path: `/v1/${string}`,\n request: Req,\n response: Res,\n): Endpoint<Req, Res> {\n return { method, path, request, response };\n}\n\n/** `value` typed by `schema`, or `undefined` when it does not satisfy it. */\nexport function parseWith<S extends z.ZodMiniType>(\n schema: S,\n value: unknown,\n): z.output<S> | undefined {\n const result = z.safeParse(schema, value);\n return result.success ? result.data : undefined;\n}\n\n/** Whether `value` satisfies `schema` — lets consumers validate without importing zod. */\nexport function accepts(schema: z.ZodMiniType, value: unknown): boolean {\n return z.safeParse(schema, value).success;\n}\n","import * as z from \"zod/mini\";\n\nimport { endpoint } from \"./endpoint.ts\";\n\n/** One JSON-RPC call plus nothing else: batches may carry at most this many entries. */\nexport const RPC_BATCH_MAX = 20;\n\n/** Read-only EVM methods plus `eth_sendRawTransaction`. Anything not listed is rejected. */\nexport const EVM_RPC_METHODS = [\n \"eth_blobBaseFee\",\n \"eth_blockNumber\",\n \"eth_call\",\n \"eth_chainId\",\n \"eth_createAccessList\",\n \"eth_estimateGas\",\n \"eth_feeHistory\",\n \"eth_gasPrice\",\n \"eth_getBalance\",\n \"eth_getBlockByHash\",\n \"eth_getBlockByNumber\",\n \"eth_getBlockReceipts\",\n \"eth_getBlockTransactionCountByHash\",\n \"eth_getBlockTransactionCountByNumber\",\n \"eth_getCode\",\n \"eth_getProof\",\n \"eth_getStorageAt\",\n \"eth_getTransactionByBlockHashAndIndex\",\n \"eth_getTransactionByBlockNumberAndIndex\",\n \"eth_getTransactionByHash\",\n \"eth_getTransactionCount\",\n \"eth_getTransactionReceipt\",\n \"eth_maxPriorityFeePerGas\",\n \"eth_sendRawTransaction\",\n \"net_version\",\n \"web3_clientVersion\",\n] as const;\n\n/** Read-only Solana methods plus `sendTransaction`. Anything not listed is rejected. */\nexport const SOLANA_RPC_METHODS = [\n \"getAccountInfo\",\n \"getBalance\",\n \"getBlock\",\n \"getBlockHeight\",\n \"getBlockTime\",\n \"getEpochInfo\",\n \"getFeeForMessage\",\n \"getGenesisHash\",\n \"getLatestBlockhash\",\n \"getMinimumBalanceForRentExemption\",\n \"getMultipleAccounts\",\n \"getRecentPrioritizationFees\",\n \"getSignatureStatuses\",\n \"getSignaturesForAddress\",\n \"getSlot\",\n \"getTokenAccountBalance\",\n \"getTokenAccountsByOwner\",\n \"getTokenSupply\",\n \"getTransaction\",\n \"getVersion\",\n \"isBlockhashValid\",\n \"sendTransaction\",\n \"simulateTransaction\",\n] as const;\n\nexport type EvmRpcMethod = (typeof EVM_RPC_METHODS)[number];\nexport type SolanaRpcMethod = (typeof SOLANA_RPC_METHODS)[number];\n\nexport const jsonRpcId = z.union([z.string(), z.number(), z.null()]);\n\nconst jsonRpcParams = z.optional(\n z.union([z.array(z.unknown()), z.record(z.string(), z.unknown())]),\n);\n\nconst callSchema = <M extends z.ZodMiniType<string>>(method: M) =>\n z.object({ jsonrpc: z.literal(\"2.0\"), id: jsonRpcId, method, params: jsonRpcParams });\n\nconst bodySchema = <C extends z.ZodMiniType>(call: C) =>\n z.union([call, z.array(call).check(z.minLength(1), z.maxLength(RPC_BATCH_MAX))]);\n\n/** Method-agnostic wire shape of a call or batch (the gateway narrows by family). */\nexport const rpcRequest = bodySchema(callSchema(z.string()));\n\nexport const evmRpcRequest = bodySchema(callSchema(z.enum(EVM_RPC_METHODS)));\nexport const solanaRpcRequest = bodySchema(callSchema(z.enum(SOLANA_RPC_METHODS)));\n\nconst successResponse = z.object({\n jsonrpc: z.literal(\"2.0\"),\n id: jsonRpcId,\n result: z.unknown(),\n});\nconst errorResponse = z.object({\n jsonrpc: z.literal(\"2.0\"),\n id: jsonRpcId,\n error: z.object({ code: z.int(), message: z.string(), data: z.optional(z.unknown()) }),\n});\n\nexport const jsonRpcResponse = z.union([successResponse, errorResponse]);\nexport const rpcResponse = z.union([jsonRpcResponse, z.array(jsonRpcResponse)]);\n\nexport const rpc = endpoint(\"POST\", \"/v1/rpc/:caip2\", rpcRequest, rpcResponse);\n\n/** The JSON-RPC URL path for one network. */\nexport const rpcPath = (caip2: string): string => rpc.path.replace(\":caip2\", caip2);\n","import * as z from \"zod/mini\";\n\nexport const INSTALL_ID_HEADER = \"x-install-id\";\nexport const PROVIDERS_HEADER = \"x-gateway-providers\";\n\n/** 128 random bits as lowercase hex — generated once per install, unrelated to wallet secrets. */\nexport const installId = z.string().check(z.regex(/^[0-9a-f]{32}$/));\n\n/** CAIP-2 chain id: `namespace:reference`. */\nexport const caip2 = z.string().check(z.regex(/^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}$/));\n\nexport type Caip2 = z.infer<typeof caip2>;\nexport type InstallId = z.infer<typeof installId>;\n\nexport const GATEWAY_ERRORS = [\n \"invalid-request\",\n \"unknown-network\",\n \"not-found\",\n \"rate-limited\",\n \"unavailable\",\n \"internal\",\n] as const;\n\nexport const gatewayError = z.object({ error: z.enum(GATEWAY_ERRORS) });\n\nexport type GatewayErrorCode = (typeof GATEWAY_ERRORS)[number];\n","import * as z from \"zod/mini\";\n\nimport { endpoint } from \"./endpoint.ts\";\n\nexport const healthRequest = z.undefined();\nexport const healthResponse = z.object({ status: z.literal(\"ok\") });\n\nexport const health = endpoint(\"GET\", \"/v1/health\", healthRequest, healthResponse);\n","import * as z from \"zod/mini\";\n\nimport { endpoint } from \"./endpoint.ts\";\n\nconst HEX64 = \"[0-9a-f]{64}\";\n\ntype EsploraRoute = { readonly method: \"GET\" | \"POST\"; readonly pattern: RegExp };\n\n/** The Esplora surface the engine uses; every other path is rejected. */\nexport const ESPLORA_ROUTES: ReadonlyArray<EsploraRoute> = [\n { method: \"GET\", pattern: /^\\/block-height\\/\\d{1,10}$/ },\n { method: \"GET\", pattern: /^\\/fee-estimates$/ },\n { method: \"GET\", pattern: new RegExp(`^/scripthash/${HEX64}/txs$`) },\n { method: \"GET\", pattern: new RegExp(`^/scripthash/${HEX64}/utxo$`) },\n { method: \"GET\", pattern: new RegExp(`^/tx/${HEX64}/hex$`) },\n { method: \"GET\", pattern: new RegExp(`^/tx/${HEX64}/status$`) },\n { method: \"POST\", pattern: /^\\/tx$/ },\n];\n\n/** `path` is the Esplora path after `/v1/esplora/:caip2`, with a leading slash and no query. */\nexport const esploraPathAllowed = (method: string, path: string): boolean =>\n ESPLORA_ROUTES.some((route) => route.method === method && route.pattern.test(path));\n\nexport const esploraGet = endpoint(\"GET\", \"/v1/esplora/:caip2/*\", z.undefined(), z.unknown());\n\n/** The Esplora base path for one network; allow-listed paths are appended to it. */\nexport const esploraBasePath = (caip2: string): string =>\n esploraGet.path.replace(\":caip2\", caip2).replace(/\\/\\*$/, \"\");\nexport const esploraPost = endpoint(\"POST\", \"/v1/esplora/:caip2/tx\", z.string(), z.string());\n","/**\n * Built-in EVM network registry: the 8 mainnets from chains.mdx plus their main testnets. Each\n * chain id was checked against the chain's official documentation (source URL per entry).\n * Signing-time chainId always comes from this table, never from an RPC endpoint.\n */\n\nexport type NetworkInfo = {\n readonly id: string; // CAIP-2 eip155:<chainId>\n readonly chainId: number;\n readonly name: string;\n readonly symbol: string;\n readonly multicall3?: string;\n /** CAIP-2 family — `solana:<ref>` networks are validated against genesis-hash, not chainId. */\n readonly family: \"evm\" | \"solana\" | \"bitcoin\";\n readonly genesisHash?: string;\n readonly decimals: number;\n readonly testnet: boolean;\n};\n\nconst entry = (\n chainId: number,\n name: string,\n symbol: string,\n testnet: boolean,\n _source: string,\n): NetworkInfo => ({\n id: `eip155:${chainId}`,\n chainId,\n name,\n symbol,\n decimals: 18,\n testnet,\n family: \"evm\",\n // Canonical Multicall3 — https://github.com/mds1/multicall3 deployments (all entries below).\n multicall3: \"0xcA11bde05977b3631167028862bE2a173976CA11\",\n});\n\nexport const NETWORKS: ReadonlyArray<NetworkInfo> = [\n // https://chainlist.org + https://ethereum.org (Ethereum mainnet chainId 1)\n entry(1, \"Ethereum\", \"ETH\", false, \"https://ethereum.org/en/developers/docs/networks/\"),\n // https://docs.base.org — Base Sepolia 84532\n entry(8453, \"Base\", \"ETH\", false, \"https://docs.base.org/docs/network-information\"),\n // https://docs.arbitrum.io — Arbitrum Sepolia 421614\n entry(\n 42161,\n \"Arbitrum One\",\n \"ETH\",\n false,\n \"https://docs.arbitrum.io/for-devs/dev-tools-and-resources/chain-info\",\n ),\n // https://docs.optimism.io — OP Sepolia 11155420\n entry(10, \"OP Mainnet\", \"ETH\", false, \"https://docs.optimism.io/chain/networks\"),\n // https://docs.polygon.technology — Amoy 80002\n entry(\n 137,\n \"Polygon\",\n \"POL\",\n false,\n \"https://docs.polygon.technology/pos/reference/rpc-endpoints/\",\n ),\n // https://docs.bnbchain.org — BSC testnet 97\n entry(\n 56,\n \"BNB Smart Chain\",\n \"BNB\",\n false,\n \"https://docs.bnbchain.org/bnb-smart-chain/developers/json_rpc/\",\n ),\n // https://hyperliquid.gitbook.io — HyperEVM testnet 998\n entry(\n 999,\n \"HyperEVM\",\n \"HYPE\",\n false,\n \"https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/hyperevm\",\n ),\n // https://build.avax.network — Fuji 43113\n entry(\n 43114,\n \"Avalanche C-Chain\",\n \"AVAX\",\n false,\n \"https://build.avax.network/docs/tooling/rpc-providers\",\n ),\n entry(11155111, \"Sepolia\", \"ETH\", true, \"https://ethereum.org/en/developers/docs/networks/\"),\n entry(84532, \"Base Sepolia\", \"ETH\", true, \"https://docs.base.org/docs/network-information\"),\n entry(\n 421614,\n \"Arbitrum Sepolia\",\n \"ETH\",\n true,\n \"https://docs.arbitrum.io/for-devs/dev-tools-and-resources/chain-info\",\n ),\n entry(11155420, \"OP Sepolia\", \"ETH\", true, \"https://docs.optimism.io/chain/networks\"),\n entry(\n 80002,\n \"Polygon Amoy\",\n \"POL\",\n true,\n \"https://docs.polygon.technology/pos/reference/rpc-endpoints/\",\n ),\n entry(\n 97,\n \"BNB Smart Chain Testnet\",\n \"tBNB\",\n true,\n \"https://docs.bnbchain.org/bnb-smart-chain/developers/json_rpc/\",\n ),\n entry(\n 998,\n \"HyperEVM Testnet\",\n \"HYPE\",\n true,\n \"https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/hyperevm\",\n ),\n entry(\n 43113,\n \"Avalanche Fuji\",\n \"AVAX\",\n true,\n \"https://build.avax.network/docs/tooling/rpc-providers\",\n ),\n];\n\nexport const networkById = (id: string): NetworkInfo | undefined =>\n [...NETWORKS, ...SOLANA_NETWORKS, ...BITCOIN_NETWORKS].find((n) => n.id === id);\nexport const BITCOIN_NETWORKS: ReadonlyArray<NetworkInfo> = [\n {\n id: \"bip122:000000000019d6689c085ae165831e93\",\n chainId: 0,\n name: \"Bitcoin\",\n symbol: \"BTC\",\n decimals: 8,\n testnet: false,\n family: \"bitcoin\",\n genesisHash: \"000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f\",\n },\n {\n id: \"bip122:00000000da84f2bafbbc53dee25a72ae\",\n chainId: 0,\n name: \"Bitcoin Testnet4\",\n symbol: \"tBTC\",\n decimals: 8,\n testnet: true,\n family: \"bitcoin\",\n genesisHash: \"00000000da84f2bafbbc53dee25a72ae507ff4914b867c565be350b0da8bf043\",\n },\n {\n id: \"bip122:00000008819873e925422c1ff0f99f7c\",\n chainId: 0,\n name: \"Bitcoin Signet\",\n symbol: \"sBTC\",\n decimals: 8,\n testnet: true,\n family: \"bitcoin\",\n genesisHash: \"00000008819873e925422c1ff0f99f7cc9bbb232af63a077a480a3633bee1ef6\",\n },\n {\n id: \"bip122:0f9188f13cb7b2c71f2a335e3a4fc328\",\n chainId: 0,\n name: \"Bitcoin Regtest\",\n symbol: \"rBTC\",\n decimals: 8,\n testnet: true,\n family: \"bitcoin\",\n genesisHash: \"0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206\",\n },\n];\n\nexport const SOLANA_NETWORKS: ReadonlyArray<NetworkInfo> = [\n {\n id: \"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp\",\n chainId: 0,\n name: \"Solana\",\n symbol: \"SOL\",\n decimals: 9,\n testnet: false,\n family: \"solana\",\n // https://solana.com/docs/references/clusters (mainnet genesis hash)\n genesisHash: \"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d\",\n },\n {\n id: \"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1\",\n chainId: 0,\n name: \"Solana Devnet\",\n symbol: \"SOL\",\n decimals: 9,\n testnet: true,\n family: \"solana\",\n genesisHash: \"EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG\",\n },\n];\n","import * as z from \"zod/mini\";\n\nimport { endpoint } from \"./endpoint.ts\";\nimport { caip2 } from \"./primitives.ts\";\n\nexport const servedNetworksRequest = z.undefined();\n/** The networks the gateway actually serves, in its configured order. */\nexport const servedNetworksResponse = z.object({ networks: z.array(caip2) });\n\nexport const servedNetworks = endpoint(\n \"GET\",\n \"/v1/networks\",\n servedNetworksRequest,\n servedNetworksResponse,\n);\n\nexport const networksPath: string = servedNetworks.path;\n"],"mappings":"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"}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { a as networkById, i as SOLANA_NETWORKS, n as NETWORKS, r as NetworkInfo, t as BITCOIN_NETWORKS } from "./registry-LcFSPrE1.mjs";
|
|
2
|
+
import * as z from "zod/mini";
|
|
3
|
+
export declare const INSTALL_ID_HEADER = "x-install-id";
|
|
4
|
+
export declare const PROVIDERS_HEADER = "x-gateway-providers";
|
|
5
|
+
/** 128 random bits as lowercase hex — generated once per install, unrelated to wallet secrets. */
|
|
6
|
+
export declare const installId: z.ZodMiniString<string>;
|
|
7
|
+
/** CAIP-2 chain id: `namespace:reference`. */
|
|
8
|
+
export declare const caip2: z.ZodMiniString<string>;
|
|
9
|
+
export type Caip2 = z.infer<typeof caip2>;
|
|
10
|
+
export type InstallId = z.infer<typeof installId>;
|
|
11
|
+
export declare const GATEWAY_ERRORS: readonly ["invalid-request", "unknown-network", "not-found", "rate-limited", "unavailable", "internal"];
|
|
12
|
+
export declare const gatewayError: z.ZodMiniObject<{
|
|
13
|
+
error: z.ZodMiniEnum<{
|
|
14
|
+
internal: "internal";
|
|
15
|
+
"invalid-request": "invalid-request";
|
|
16
|
+
"not-found": "not-found";
|
|
17
|
+
"rate-limited": "rate-limited";
|
|
18
|
+
unavailable: "unavailable";
|
|
19
|
+
"unknown-network": "unknown-network";
|
|
20
|
+
}>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
export type GatewayErrorCode = (typeof GATEWAY_ERRORS)[number];
|
|
23
|
+
export type HttpMethod = "GET" | "POST" | "DELETE";
|
|
24
|
+
export type Endpoint<Req extends z.ZodMiniType, Res extends z.ZodMiniType> = {
|
|
25
|
+
readonly method: HttpMethod;
|
|
26
|
+
readonly path: string;
|
|
27
|
+
readonly request: Req;
|
|
28
|
+
readonly response: Res;
|
|
29
|
+
};
|
|
30
|
+
/** One gateway route: its verb, versioned path template, and request/response schemas. */
|
|
31
|
+
export declare function endpoint<Req extends z.ZodMiniType, Res extends z.ZodMiniType>(method: HttpMethod, path: `/v1/${string}`, request: Req, response: Res): Endpoint<Req, Res>;
|
|
32
|
+
/** `value` typed by `schema`, or `undefined` when it does not satisfy it. */
|
|
33
|
+
export declare function parseWith<S extends z.ZodMiniType>(schema: S, value: unknown): z.output<S> | undefined;
|
|
34
|
+
/** Whether `value` satisfies `schema` — lets consumers validate without importing zod. */
|
|
35
|
+
export declare function accepts(schema: z.ZodMiniType, value: unknown): boolean;
|
|
36
|
+
export declare const healthRequest: z.ZodMiniUndefined;
|
|
37
|
+
export declare const healthResponse: z.ZodMiniObject<{
|
|
38
|
+
status: z.ZodMiniLiteral<"ok">;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
export declare const health: Endpoint<z.ZodMiniUndefined, z.ZodMiniObject<{
|
|
41
|
+
status: z.ZodMiniLiteral<"ok">;
|
|
42
|
+
}, z.core.$strip>>;
|
|
43
|
+
/** One JSON-RPC call plus nothing else: batches may carry at most this many entries. */
|
|
44
|
+
export declare const RPC_BATCH_MAX = 20;
|
|
45
|
+
/** Read-only EVM methods plus `eth_sendRawTransaction`. Anything not listed is rejected. */
|
|
46
|
+
export declare const EVM_RPC_METHODS: readonly ["eth_blobBaseFee", "eth_blockNumber", "eth_call", "eth_chainId", "eth_createAccessList", "eth_estimateGas", "eth_feeHistory", "eth_gasPrice", "eth_getBalance", "eth_getBlockByHash", "eth_getBlockByNumber", "eth_getBlockReceipts", "eth_getBlockTransactionCountByHash", "eth_getBlockTransactionCountByNumber", "eth_getCode", "eth_getProof", "eth_getStorageAt", "eth_getTransactionByBlockHashAndIndex", "eth_getTransactionByBlockNumberAndIndex", "eth_getTransactionByHash", "eth_getTransactionCount", "eth_getTransactionReceipt", "eth_maxPriorityFeePerGas", "eth_sendRawTransaction", "net_version", "web3_clientVersion"];
|
|
47
|
+
/** Read-only Solana methods plus `sendTransaction`. Anything not listed is rejected. */
|
|
48
|
+
export declare const SOLANA_RPC_METHODS: readonly ["getAccountInfo", "getBalance", "getBlock", "getBlockHeight", "getBlockTime", "getEpochInfo", "getFeeForMessage", "getGenesisHash", "getLatestBlockhash", "getMinimumBalanceForRentExemption", "getMultipleAccounts", "getRecentPrioritizationFees", "getSignatureStatuses", "getSignaturesForAddress", "getSlot", "getTokenAccountBalance", "getTokenAccountsByOwner", "getTokenSupply", "getTransaction", "getVersion", "isBlockhashValid", "sendTransaction", "simulateTransaction"];
|
|
49
|
+
export type EvmRpcMethod = (typeof EVM_RPC_METHODS)[number];
|
|
50
|
+
export type SolanaRpcMethod = (typeof SOLANA_RPC_METHODS)[number];
|
|
51
|
+
export declare const jsonRpcId: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniNull]>;
|
|
52
|
+
/** Method-agnostic wire shape of a call or batch (the gateway narrows by family). */
|
|
53
|
+
export declare const rpcRequest: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
54
|
+
jsonrpc: z.ZodMiniLiteral<"2.0">;
|
|
55
|
+
id: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniNull]>;
|
|
56
|
+
method: z.ZodMiniString<string>;
|
|
57
|
+
params: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniUnknown>, z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>]>>;
|
|
58
|
+
}, z.core.$strip>, z.ZodMiniArray<z.ZodMiniObject<{
|
|
59
|
+
jsonrpc: z.ZodMiniLiteral<"2.0">;
|
|
60
|
+
id: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniNull]>;
|
|
61
|
+
method: z.ZodMiniString<string>;
|
|
62
|
+
params: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniUnknown>, z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>]>>;
|
|
63
|
+
}, z.core.$strip>>]>;
|
|
64
|
+
export declare const evmRpcRequest: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
65
|
+
jsonrpc: z.ZodMiniLiteral<"2.0">;
|
|
66
|
+
id: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniNull]>;
|
|
67
|
+
method: z.ZodMiniEnum<{
|
|
68
|
+
eth_blobBaseFee: "eth_blobBaseFee";
|
|
69
|
+
eth_blockNumber: "eth_blockNumber";
|
|
70
|
+
eth_call: "eth_call";
|
|
71
|
+
eth_chainId: "eth_chainId";
|
|
72
|
+
eth_createAccessList: "eth_createAccessList";
|
|
73
|
+
eth_estimateGas: "eth_estimateGas";
|
|
74
|
+
eth_feeHistory: "eth_feeHistory";
|
|
75
|
+
eth_gasPrice: "eth_gasPrice";
|
|
76
|
+
eth_getBalance: "eth_getBalance";
|
|
77
|
+
eth_getBlockByHash: "eth_getBlockByHash";
|
|
78
|
+
eth_getBlockByNumber: "eth_getBlockByNumber";
|
|
79
|
+
eth_getBlockReceipts: "eth_getBlockReceipts";
|
|
80
|
+
eth_getBlockTransactionCountByHash: "eth_getBlockTransactionCountByHash";
|
|
81
|
+
eth_getBlockTransactionCountByNumber: "eth_getBlockTransactionCountByNumber";
|
|
82
|
+
eth_getCode: "eth_getCode";
|
|
83
|
+
eth_getProof: "eth_getProof";
|
|
84
|
+
eth_getStorageAt: "eth_getStorageAt";
|
|
85
|
+
eth_getTransactionByBlockHashAndIndex: "eth_getTransactionByBlockHashAndIndex";
|
|
86
|
+
eth_getTransactionByBlockNumberAndIndex: "eth_getTransactionByBlockNumberAndIndex";
|
|
87
|
+
eth_getTransactionByHash: "eth_getTransactionByHash";
|
|
88
|
+
eth_getTransactionCount: "eth_getTransactionCount";
|
|
89
|
+
eth_getTransactionReceipt: "eth_getTransactionReceipt";
|
|
90
|
+
eth_maxPriorityFeePerGas: "eth_maxPriorityFeePerGas";
|
|
91
|
+
eth_sendRawTransaction: "eth_sendRawTransaction";
|
|
92
|
+
net_version: "net_version";
|
|
93
|
+
web3_clientVersion: "web3_clientVersion";
|
|
94
|
+
}>;
|
|
95
|
+
params: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniUnknown>, z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>]>>;
|
|
96
|
+
}, z.core.$strip>, z.ZodMiniArray<z.ZodMiniObject<{
|
|
97
|
+
jsonrpc: z.ZodMiniLiteral<"2.0">;
|
|
98
|
+
id: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniNull]>;
|
|
99
|
+
method: z.ZodMiniEnum<{
|
|
100
|
+
eth_blobBaseFee: "eth_blobBaseFee";
|
|
101
|
+
eth_blockNumber: "eth_blockNumber";
|
|
102
|
+
eth_call: "eth_call";
|
|
103
|
+
eth_chainId: "eth_chainId";
|
|
104
|
+
eth_createAccessList: "eth_createAccessList";
|
|
105
|
+
eth_estimateGas: "eth_estimateGas";
|
|
106
|
+
eth_feeHistory: "eth_feeHistory";
|
|
107
|
+
eth_gasPrice: "eth_gasPrice";
|
|
108
|
+
eth_getBalance: "eth_getBalance";
|
|
109
|
+
eth_getBlockByHash: "eth_getBlockByHash";
|
|
110
|
+
eth_getBlockByNumber: "eth_getBlockByNumber";
|
|
111
|
+
eth_getBlockReceipts: "eth_getBlockReceipts";
|
|
112
|
+
eth_getBlockTransactionCountByHash: "eth_getBlockTransactionCountByHash";
|
|
113
|
+
eth_getBlockTransactionCountByNumber: "eth_getBlockTransactionCountByNumber";
|
|
114
|
+
eth_getCode: "eth_getCode";
|
|
115
|
+
eth_getProof: "eth_getProof";
|
|
116
|
+
eth_getStorageAt: "eth_getStorageAt";
|
|
117
|
+
eth_getTransactionByBlockHashAndIndex: "eth_getTransactionByBlockHashAndIndex";
|
|
118
|
+
eth_getTransactionByBlockNumberAndIndex: "eth_getTransactionByBlockNumberAndIndex";
|
|
119
|
+
eth_getTransactionByHash: "eth_getTransactionByHash";
|
|
120
|
+
eth_getTransactionCount: "eth_getTransactionCount";
|
|
121
|
+
eth_getTransactionReceipt: "eth_getTransactionReceipt";
|
|
122
|
+
eth_maxPriorityFeePerGas: "eth_maxPriorityFeePerGas";
|
|
123
|
+
eth_sendRawTransaction: "eth_sendRawTransaction";
|
|
124
|
+
net_version: "net_version";
|
|
125
|
+
web3_clientVersion: "web3_clientVersion";
|
|
126
|
+
}>;
|
|
127
|
+
params: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniUnknown>, z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>]>>;
|
|
128
|
+
}, z.core.$strip>>]>;
|
|
129
|
+
export declare const solanaRpcRequest: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
130
|
+
jsonrpc: z.ZodMiniLiteral<"2.0">;
|
|
131
|
+
id: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniNull]>;
|
|
132
|
+
method: z.ZodMiniEnum<{
|
|
133
|
+
getAccountInfo: "getAccountInfo";
|
|
134
|
+
getBalance: "getBalance";
|
|
135
|
+
getBlock: "getBlock";
|
|
136
|
+
getBlockHeight: "getBlockHeight";
|
|
137
|
+
getBlockTime: "getBlockTime";
|
|
138
|
+
getEpochInfo: "getEpochInfo";
|
|
139
|
+
getFeeForMessage: "getFeeForMessage";
|
|
140
|
+
getGenesisHash: "getGenesisHash";
|
|
141
|
+
getLatestBlockhash: "getLatestBlockhash";
|
|
142
|
+
getMinimumBalanceForRentExemption: "getMinimumBalanceForRentExemption";
|
|
143
|
+
getMultipleAccounts: "getMultipleAccounts";
|
|
144
|
+
getRecentPrioritizationFees: "getRecentPrioritizationFees";
|
|
145
|
+
getSignatureStatuses: "getSignatureStatuses";
|
|
146
|
+
getSignaturesForAddress: "getSignaturesForAddress";
|
|
147
|
+
getSlot: "getSlot";
|
|
148
|
+
getTokenAccountBalance: "getTokenAccountBalance";
|
|
149
|
+
getTokenAccountsByOwner: "getTokenAccountsByOwner";
|
|
150
|
+
getTokenSupply: "getTokenSupply";
|
|
151
|
+
getTransaction: "getTransaction";
|
|
152
|
+
getVersion: "getVersion";
|
|
153
|
+
isBlockhashValid: "isBlockhashValid";
|
|
154
|
+
sendTransaction: "sendTransaction";
|
|
155
|
+
simulateTransaction: "simulateTransaction";
|
|
156
|
+
}>;
|
|
157
|
+
params: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniUnknown>, z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>]>>;
|
|
158
|
+
}, z.core.$strip>, z.ZodMiniArray<z.ZodMiniObject<{
|
|
159
|
+
jsonrpc: z.ZodMiniLiteral<"2.0">;
|
|
160
|
+
id: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniNull]>;
|
|
161
|
+
method: z.ZodMiniEnum<{
|
|
162
|
+
getAccountInfo: "getAccountInfo";
|
|
163
|
+
getBalance: "getBalance";
|
|
164
|
+
getBlock: "getBlock";
|
|
165
|
+
getBlockHeight: "getBlockHeight";
|
|
166
|
+
getBlockTime: "getBlockTime";
|
|
167
|
+
getEpochInfo: "getEpochInfo";
|
|
168
|
+
getFeeForMessage: "getFeeForMessage";
|
|
169
|
+
getGenesisHash: "getGenesisHash";
|
|
170
|
+
getLatestBlockhash: "getLatestBlockhash";
|
|
171
|
+
getMinimumBalanceForRentExemption: "getMinimumBalanceForRentExemption";
|
|
172
|
+
getMultipleAccounts: "getMultipleAccounts";
|
|
173
|
+
getRecentPrioritizationFees: "getRecentPrioritizationFees";
|
|
174
|
+
getSignatureStatuses: "getSignatureStatuses";
|
|
175
|
+
getSignaturesForAddress: "getSignaturesForAddress";
|
|
176
|
+
getSlot: "getSlot";
|
|
177
|
+
getTokenAccountBalance: "getTokenAccountBalance";
|
|
178
|
+
getTokenAccountsByOwner: "getTokenAccountsByOwner";
|
|
179
|
+
getTokenSupply: "getTokenSupply";
|
|
180
|
+
getTransaction: "getTransaction";
|
|
181
|
+
getVersion: "getVersion";
|
|
182
|
+
isBlockhashValid: "isBlockhashValid";
|
|
183
|
+
sendTransaction: "sendTransaction";
|
|
184
|
+
simulateTransaction: "simulateTransaction";
|
|
185
|
+
}>;
|
|
186
|
+
params: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniUnknown>, z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>]>>;
|
|
187
|
+
}, z.core.$strip>>]>;
|
|
188
|
+
export declare const jsonRpcResponse: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
189
|
+
jsonrpc: z.ZodMiniLiteral<"2.0">;
|
|
190
|
+
id: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniNull]>;
|
|
191
|
+
result: z.ZodMiniUnknown;
|
|
192
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
193
|
+
jsonrpc: z.ZodMiniLiteral<"2.0">;
|
|
194
|
+
id: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniNull]>;
|
|
195
|
+
error: z.ZodMiniObject<{
|
|
196
|
+
code: z.ZodMiniInt;
|
|
197
|
+
message: z.ZodMiniString<string>;
|
|
198
|
+
data: z.ZodMiniOptional<z.ZodMiniUnknown>;
|
|
199
|
+
}, z.core.$strip>;
|
|
200
|
+
}, z.core.$strip>]>;
|
|
201
|
+
export declare const rpcResponse: z.ZodMiniUnion<readonly [z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
202
|
+
jsonrpc: z.ZodMiniLiteral<"2.0">;
|
|
203
|
+
id: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniNull]>;
|
|
204
|
+
result: z.ZodMiniUnknown;
|
|
205
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
206
|
+
jsonrpc: z.ZodMiniLiteral<"2.0">;
|
|
207
|
+
id: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniNull]>;
|
|
208
|
+
error: z.ZodMiniObject<{
|
|
209
|
+
code: z.ZodMiniInt;
|
|
210
|
+
message: z.ZodMiniString<string>;
|
|
211
|
+
data: z.ZodMiniOptional<z.ZodMiniUnknown>;
|
|
212
|
+
}, z.core.$strip>;
|
|
213
|
+
}, z.core.$strip>]>, z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
214
|
+
jsonrpc: z.ZodMiniLiteral<"2.0">;
|
|
215
|
+
id: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniNull]>;
|
|
216
|
+
result: z.ZodMiniUnknown;
|
|
217
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
218
|
+
jsonrpc: z.ZodMiniLiteral<"2.0">;
|
|
219
|
+
id: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniNull]>;
|
|
220
|
+
error: z.ZodMiniObject<{
|
|
221
|
+
code: z.ZodMiniInt;
|
|
222
|
+
message: z.ZodMiniString<string>;
|
|
223
|
+
data: z.ZodMiniOptional<z.ZodMiniUnknown>;
|
|
224
|
+
}, z.core.$strip>;
|
|
225
|
+
}, z.core.$strip>]>>]>;
|
|
226
|
+
export declare const rpc: Endpoint<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
227
|
+
jsonrpc: z.ZodMiniLiteral<"2.0">;
|
|
228
|
+
id: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniNull]>;
|
|
229
|
+
method: z.ZodMiniString<string>;
|
|
230
|
+
params: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniUnknown>, z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>]>>;
|
|
231
|
+
}, z.core.$strip>, z.ZodMiniArray<z.ZodMiniObject<{
|
|
232
|
+
jsonrpc: z.ZodMiniLiteral<"2.0">;
|
|
233
|
+
id: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniNull]>;
|
|
234
|
+
method: z.ZodMiniString<string>;
|
|
235
|
+
params: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniUnknown>, z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>]>>;
|
|
236
|
+
}, z.core.$strip>>]>, z.ZodMiniUnion<readonly [z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
237
|
+
jsonrpc: z.ZodMiniLiteral<"2.0">;
|
|
238
|
+
id: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniNull]>;
|
|
239
|
+
result: z.ZodMiniUnknown;
|
|
240
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
241
|
+
jsonrpc: z.ZodMiniLiteral<"2.0">;
|
|
242
|
+
id: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniNull]>;
|
|
243
|
+
error: z.ZodMiniObject<{
|
|
244
|
+
code: z.ZodMiniInt;
|
|
245
|
+
message: z.ZodMiniString<string>;
|
|
246
|
+
data: z.ZodMiniOptional<z.ZodMiniUnknown>;
|
|
247
|
+
}, z.core.$strip>;
|
|
248
|
+
}, z.core.$strip>]>, z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
249
|
+
jsonrpc: z.ZodMiniLiteral<"2.0">;
|
|
250
|
+
id: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniNull]>;
|
|
251
|
+
result: z.ZodMiniUnknown;
|
|
252
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
253
|
+
jsonrpc: z.ZodMiniLiteral<"2.0">;
|
|
254
|
+
id: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniNumber<number>, z.ZodMiniNull]>;
|
|
255
|
+
error: z.ZodMiniObject<{
|
|
256
|
+
code: z.ZodMiniInt;
|
|
257
|
+
message: z.ZodMiniString<string>;
|
|
258
|
+
data: z.ZodMiniOptional<z.ZodMiniUnknown>;
|
|
259
|
+
}, z.core.$strip>;
|
|
260
|
+
}, z.core.$strip>]>>]>>;
|
|
261
|
+
/** The JSON-RPC URL path for one network. */
|
|
262
|
+
export declare const rpcPath: (caip2: string) => string;
|
|
263
|
+
type EsploraRoute = {
|
|
264
|
+
readonly method: "GET" | "POST";
|
|
265
|
+
readonly pattern: RegExp;
|
|
266
|
+
};
|
|
267
|
+
/** The Esplora surface the engine uses; every other path is rejected. */
|
|
268
|
+
export declare const ESPLORA_ROUTES: ReadonlyArray<EsploraRoute>;
|
|
269
|
+
/** `path` is the Esplora path after `/v1/esplora/:caip2`, with a leading slash and no query. */
|
|
270
|
+
export declare const esploraPathAllowed: (method: string, path: string) => boolean;
|
|
271
|
+
export declare const esploraGet: Endpoint<z.ZodMiniUndefined, z.ZodMiniUnknown>;
|
|
272
|
+
/** The Esplora base path for one network; allow-listed paths are appended to it. */
|
|
273
|
+
export declare const esploraBasePath: (caip2: string) => string;
|
|
274
|
+
export declare const esploraPost: Endpoint<z.ZodMiniString<string>, z.ZodMiniString<string>>;
|
|
275
|
+
export declare const servedNetworksRequest: z.ZodMiniUndefined;
|
|
276
|
+
/** The networks the gateway actually serves, in its configured order. */
|
|
277
|
+
export declare const servedNetworksResponse: z.ZodMiniObject<{
|
|
278
|
+
networks: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
279
|
+
}, z.core.$strip>;
|
|
280
|
+
export declare const servedNetworks: Endpoint<z.ZodMiniUndefined, z.ZodMiniObject<{
|
|
281
|
+
networks: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
282
|
+
}, z.core.$strip>>;
|
|
283
|
+
export declare const networksPath: string;
|
|
284
|
+
export { BITCOIN_NETWORKS, NETWORKS, type NetworkInfo, SOLANA_NETWORKS, networkById };
|
|
285
|
+
//# sourceMappingURL=gateway-contract.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { a as BITCOIN_NETWORKS, l as ESPLORA_ROUTES, C as EVM_RPC_METHODS, _ as GATEWAY_ERRORS, v as INSTALL_ID_HEADER, o as NETWORKS, y as PROVIDERS_HEADER, w as RPC_BATCH_MAX, s as SOLANA_NETWORKS, T as SOLANA_RPC_METHODS, P as accepts, b as caip2, F as endpoint, u as esploraBasePath, d as esploraGet, f as esploraPathAllowed, p as esploraPost, E as evmRpcRequest, x as gatewayError, m as health, h as healthRequest, g as healthResponse, S as installId, D as jsonRpcId, O as jsonRpcResponse, c as networkById, t as networksPath, I as parseWith, k as rpc, A as rpcPath, j as rpcRequest, M as rpcResponse, n as servedNetworks, r as servedNetworksRequest, i as servedNetworksResponse, N as solanaRpcRequest } from "./contract-CEsgLme3.mjs";
|