@temporalabs/treasury 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/NOTICE +4 -2
  2. package/README.md +68 -44
  3. package/THIRD_PARTY_NOTICES.connect-page.md +7420 -0
  4. package/THIRD_PARTY_NOTICES.md +4 -196
  5. package/dist/cli.d.ts +6 -0
  6. package/dist/cli.js +220 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/client.d.ts +224 -239
  9. package/dist/client.js +147 -25
  10. package/dist/client.js.map +1 -1
  11. package/dist/config/earn.d.ts +33 -12
  12. package/dist/config/earn.js +33 -12
  13. package/dist/config/earn.js.map +1 -1
  14. package/dist/connect/ack.d.ts +59 -0
  15. package/dist/connect/ack.js +111 -0
  16. package/dist/connect/ack.js.map +1 -0
  17. package/dist/connect/commands.d.ts +78 -0
  18. package/dist/connect/commands.js +411 -0
  19. package/dist/connect/commands.js.map +1 -0
  20. package/dist/connect/config.d.ts +22 -0
  21. package/dist/connect/config.js +33 -0
  22. package/dist/connect/config.js.map +1 -0
  23. package/dist/connect/gate.d.ts +37 -0
  24. package/dist/connect/gate.js +115 -0
  25. package/dist/connect/gate.js.map +1 -0
  26. package/dist/connect/http.d.ts +54 -0
  27. package/dist/connect/http.js +205 -0
  28. package/dist/connect/http.js.map +1 -0
  29. package/dist/connect/open.d.ts +2 -0
  30. package/dist/connect/open.js +35 -0
  31. package/dist/connect/open.js.map +1 -0
  32. package/dist/connect/page.d.ts +5 -0
  33. package/dist/connect/page.js +69 -0
  34. package/dist/connect/page.js.map +1 -0
  35. package/dist/connect/session.d.ts +16 -0
  36. package/dist/connect/session.js +73 -0
  37. package/dist/connect/session.js.map +1 -0
  38. package/dist/connect/verify.d.ts +37 -0
  39. package/dist/connect/verify.js +89 -0
  40. package/dist/connect/verify.js.map +1 -0
  41. package/dist/connect-page.js +5141 -0
  42. package/dist/disclosures.d.ts +21 -6
  43. package/dist/disclosures.js +32 -7
  44. package/dist/disclosures.js.map +1 -1
  45. package/dist/earn/commands.d.ts +46 -0
  46. package/dist/earn/commands.js +483 -0
  47. package/dist/earn/commands.js.map +1 -0
  48. package/dist/links.d.ts +2 -0
  49. package/dist/links.js +38 -14
  50. package/dist/links.js.map +1 -1
  51. package/dist/position.d.ts +7 -5
  52. package/dist/position.js +35 -18
  53. package/dist/position.js.map +1 -1
  54. package/dist/preflight.d.ts +9 -0
  55. package/dist/preflight.js +14 -3
  56. package/dist/preflight.js.map +1 -1
  57. package/dist/quote.js +24 -7
  58. package/dist/quote.js.map +1 -1
  59. package/dist/redact.d.ts +3 -3
  60. package/dist/redact.js +3 -3
  61. package/dist/redact.js.map +1 -1
  62. package/dist/registry-schema.d.ts +5 -5
  63. package/dist/registry-schema.js +30 -16
  64. package/dist/registry-schema.js.map +1 -1
  65. package/dist/registry.d.ts +29 -6
  66. package/dist/registry.js +76 -13
  67. package/dist/registry.js.map +1 -1
  68. package/dist/{mcp-server.mjs → treasury.mjs} +29276 -44702
  69. package/dist/version.js +1 -1
  70. package/package.json +5 -5
  71. package/registry/vaults.json +105 -4
  72. package/dist/mcp/server.d.ts +0 -8
  73. package/dist/mcp/server.js +0 -368
  74. package/dist/mcp/server.js.map +0 -1
package/dist/client.d.ts CHANGED
@@ -78,240 +78,17 @@ export declare const chains: {
78
78
  formatters: {
79
79
  readonly block: {
80
80
  exclude: [] | undefined;
81
- format: (args: import("viem/chains").OpStackRpcBlock, action?: string | undefined) => {
82
- baseFeePerGas: bigint | null;
83
- blobGasUsed: bigint;
84
- difficulty: bigint;
85
- excessBlobGas: bigint;
86
- extraData: import("viem").Hex;
87
- gasLimit: bigint;
88
- gasUsed: bigint;
89
- hash: `0x${string}` | null;
90
- logsBloom: `0x${string}` | null;
91
- miner: import("viem").Address;
92
- mixHash: import("viem").Hash;
93
- nonce: `0x${string}` | null;
94
- number: bigint | null;
95
- parentBeaconBlockRoot?: `0x${string}` | undefined;
96
- parentHash: import("viem").Hash;
97
- receiptsRoot: import("viem").Hex;
98
- sealFields: import("viem").Hex[];
99
- sha3Uncles: import("viem").Hash;
100
- size: bigint;
101
- stateRoot: import("viem").Hash;
102
- timestamp: bigint;
103
- totalDifficulty: bigint | null;
104
- transactions: `0x${string}`[] | import("viem/chains").OpStackTransaction<boolean>[];
105
- transactionsRoot: import("viem").Hash;
106
- uncles: import("viem").Hash[];
107
- withdrawals?: import("viem").Withdrawal[] | undefined | undefined;
108
- withdrawalsRoot?: `0x${string}` | undefined;
109
- } & {};
81
+ format: (args: import("viem/chains").OpStackRpcBlock, action?: string | undefined) => import("viem/chains").OpStackBlock;
110
82
  type: "block";
111
83
  };
112
84
  readonly transaction: {
113
85
  exclude: [] | undefined;
114
- format: (args: import("viem/chains").OpStackRpcTransaction, action?: string | undefined) => ({
115
- blockHash: `0x${string}` | null;
116
- blockNumber: bigint | null;
117
- blockTimestamp?: bigint | undefined;
118
- from: import("viem").Address;
119
- gas: bigint;
120
- hash: import("viem").Hash;
121
- input: import("viem").Hex;
122
- nonce: number;
123
- r: import("viem").Hex;
124
- s: import("viem").Hex;
125
- to: import("viem").Address | null;
126
- transactionIndex: number | null;
127
- typeHex: import("viem").Hex | null;
128
- v: bigint;
129
- value: bigint;
130
- yParity: number;
131
- gasPrice?: undefined | undefined;
132
- maxFeePerBlobGas?: undefined | undefined;
133
- maxFeePerGas: bigint;
134
- maxPriorityFeePerGas: bigint;
135
- isSystemTx?: boolean;
136
- mint?: bigint | undefined | undefined;
137
- sourceHash: import("viem").Hex;
138
- type: "deposit";
139
- } | {
140
- r: import("viem").Hex;
141
- s: import("viem").Hex;
142
- v: bigint;
143
- to: import("viem").Address | null;
144
- from: import("viem").Address;
145
- gas: bigint;
146
- nonce: number;
147
- value: bigint;
148
- blockHash: `0x${string}` | null;
149
- blockNumber: bigint | null;
150
- blockTimestamp?: bigint | undefined;
151
- hash: import("viem").Hash;
152
- input: import("viem").Hex;
153
- transactionIndex: number | null;
154
- typeHex: import("viem").Hex | null;
155
- accessList?: undefined | undefined;
156
- authorizationList?: undefined | undefined;
157
- blobVersionedHashes?: undefined | undefined;
158
- chainId?: number | undefined;
159
- yParity?: undefined | undefined;
160
- type: "legacy";
161
- gasPrice: bigint;
162
- maxFeePerBlobGas?: undefined | undefined;
163
- maxFeePerGas?: undefined | undefined;
164
- maxPriorityFeePerGas?: undefined | undefined;
165
- isSystemTx?: undefined | undefined;
166
- mint?: undefined | undefined;
167
- sourceHash?: undefined | undefined;
168
- } | {
169
- blockHash: `0x${string}` | null;
170
- blockNumber: bigint | null;
171
- blockTimestamp?: bigint | undefined;
172
- from: import("viem").Address;
173
- gas: bigint;
174
- hash: import("viem").Hash;
175
- input: import("viem").Hex;
176
- nonce: number;
177
- r: import("viem").Hex;
178
- s: import("viem").Hex;
179
- to: import("viem").Address | null;
180
- transactionIndex: number | null;
181
- typeHex: import("viem").Hex | null;
182
- v: bigint;
183
- value: bigint;
184
- yParity: number;
185
- accessList: import("viem").AccessList;
186
- authorizationList?: undefined | undefined;
187
- blobVersionedHashes?: undefined | undefined;
188
- chainId: number;
189
- type: "eip2930";
190
- gasPrice: bigint;
191
- maxFeePerBlobGas?: undefined | undefined;
192
- maxFeePerGas?: undefined | undefined;
193
- maxPriorityFeePerGas?: undefined | undefined;
194
- isSystemTx?: undefined | undefined;
195
- mint?: undefined | undefined;
196
- sourceHash?: undefined | undefined;
197
- } | {
198
- blockHash: `0x${string}` | null;
199
- blockNumber: bigint | null;
200
- blockTimestamp?: bigint | undefined;
201
- from: import("viem").Address;
202
- gas: bigint;
203
- hash: import("viem").Hash;
204
- input: import("viem").Hex;
205
- nonce: number;
206
- r: import("viem").Hex;
207
- s: import("viem").Hex;
208
- to: import("viem").Address | null;
209
- transactionIndex: number | null;
210
- typeHex: import("viem").Hex | null;
211
- v: bigint;
212
- value: bigint;
213
- yParity: number;
214
- accessList: import("viem").AccessList;
215
- authorizationList?: undefined | undefined;
216
- blobVersionedHashes?: undefined | undefined;
217
- chainId: number;
218
- type: "eip1559";
219
- gasPrice?: undefined | undefined;
220
- maxFeePerBlobGas?: undefined | undefined;
221
- maxFeePerGas: bigint;
222
- maxPriorityFeePerGas: bigint;
223
- isSystemTx?: undefined | undefined;
224
- mint?: undefined | undefined;
225
- sourceHash?: undefined | undefined;
226
- } | {
227
- blockHash: `0x${string}` | null;
228
- blockNumber: bigint | null;
229
- blockTimestamp?: bigint | undefined;
230
- from: import("viem").Address;
231
- gas: bigint;
232
- hash: import("viem").Hash;
233
- input: import("viem").Hex;
234
- nonce: number;
235
- r: import("viem").Hex;
236
- s: import("viem").Hex;
237
- to: import("viem").Address | null;
238
- transactionIndex: number | null;
239
- typeHex: import("viem").Hex | null;
240
- v: bigint;
241
- value: bigint;
242
- yParity: number;
243
- accessList: import("viem").AccessList;
244
- authorizationList?: undefined | undefined;
245
- blobVersionedHashes: readonly import("viem").Hex[];
246
- chainId: number;
247
- type: "eip4844";
248
- gasPrice?: undefined | undefined;
249
- maxFeePerBlobGas: bigint;
250
- maxFeePerGas: bigint;
251
- maxPriorityFeePerGas: bigint;
252
- isSystemTx?: undefined | undefined;
253
- mint?: undefined | undefined;
254
- sourceHash?: undefined | undefined;
255
- } | {
256
- blockHash: `0x${string}` | null;
257
- blockNumber: bigint | null;
258
- blockTimestamp?: bigint | undefined;
259
- from: import("viem").Address;
260
- gas: bigint;
261
- hash: import("viem").Hash;
262
- input: import("viem").Hex;
263
- nonce: number;
264
- r: import("viem").Hex;
265
- s: import("viem").Hex;
266
- to: import("viem").Address | null;
267
- transactionIndex: number | null;
268
- typeHex: import("viem").Hex | null;
269
- v: bigint;
270
- value: bigint;
271
- yParity: number;
272
- accessList: import("viem").AccessList;
273
- authorizationList: import("viem").SignedAuthorizationList;
274
- blobVersionedHashes?: undefined | undefined;
275
- chainId: number;
276
- type: "eip7702";
277
- gasPrice?: undefined | undefined;
278
- maxFeePerBlobGas?: undefined | undefined;
279
- maxFeePerGas: bigint;
280
- maxPriorityFeePerGas: bigint;
281
- isSystemTx?: undefined | undefined;
282
- mint?: undefined | undefined;
283
- sourceHash?: undefined | undefined;
284
- }) & {};
86
+ format: (args: import("viem/chains").OpStackRpcTransaction, action?: string | undefined) => import("viem/chains").OpStackTransaction;
285
87
  type: "transaction";
286
88
  };
287
89
  readonly transactionReceipt: {
288
90
  exclude: [] | undefined;
289
- format: (args: import("viem/chains").OpStackRpcTransactionReceipt, action?: string | undefined) => {
290
- blobGasPrice?: bigint | undefined;
291
- blobGasUsed?: bigint | undefined;
292
- blockHash: import("viem").Hash;
293
- blockNumber: bigint;
294
- blockTimestamp?: bigint | undefined;
295
- contractAddress: import("viem").Address | null | undefined;
296
- cumulativeGasUsed: bigint;
297
- effectiveGasPrice: bigint;
298
- from: import("viem").Address;
299
- gasUsed: bigint;
300
- logs: import("viem").Log<bigint, number, false>[];
301
- logsBloom: import("viem").Hex;
302
- root?: `0x${string}` | undefined;
303
- status: "success" | "reverted";
304
- to: import("viem").Address | null;
305
- transactionHash: import("viem").Hash;
306
- transactionIndex: number;
307
- type: import("viem").TransactionType;
308
- depositNonce?: bigint | undefined | undefined;
309
- depositReceiptVersion?: number | undefined | undefined;
310
- l1GasPrice: bigint | null;
311
- l1GasUsed: bigint | null;
312
- l1Fee: bigint | null;
313
- l1FeeScalar: number | null;
314
- } & {};
91
+ format: (args: import("viem/chains").OpStackRpcTransactionReceipt, action?: string | undefined) => import("viem/chains").OpStackTransactionReceipt;
315
92
  type: "transactionReceipt";
316
93
  };
317
94
  };
@@ -329,9 +106,160 @@ export declare const chains: {
329
106
  };
330
107
  verifyHash?: ((client: import("viem").Client, parameters: import("viem").VerifyHashActionParameters) => Promise<import("viem").VerifyHashActionReturnType>) | undefined;
331
108
  };
109
+ readonly 42161: {
110
+ blockExplorers: {
111
+ readonly default: {
112
+ readonly name: "Arbiscan";
113
+ readonly url: "https://arbiscan.io";
114
+ readonly apiUrl: "https://api.arbiscan.io/api";
115
+ };
116
+ };
117
+ blockTime: 250;
118
+ contracts: {
119
+ readonly multicall3: {
120
+ readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
121
+ readonly blockCreated: 7654707;
122
+ };
123
+ };
124
+ ensTlds?: readonly string[] | undefined;
125
+ id: 42161;
126
+ name: "Arbitrum One";
127
+ nativeCurrency: {
128
+ readonly name: "Ether";
129
+ readonly symbol: "ETH";
130
+ readonly decimals: 18;
131
+ };
132
+ experimental_preconfirmationTime?: number | undefined | undefined;
133
+ rpcUrls: {
134
+ readonly default: {
135
+ readonly http: readonly ["https://arb1.arbitrum.io/rpc"];
136
+ };
137
+ };
138
+ sourceId?: number | undefined | undefined;
139
+ supportsTransactionReplacementDetection?: boolean | undefined | undefined;
140
+ testnet?: boolean | undefined | undefined;
141
+ custom?: Record<string, unknown> | undefined;
142
+ extendSchema?: Record<string, unknown> | undefined;
143
+ fees?: import("viem").ChainFees<undefined> | undefined;
144
+ formatters?: undefined;
145
+ prepareTransactionRequest?: ((args: import("viem").PrepareTransactionRequestParameters, options: {
146
+ client: import("viem").Client;
147
+ phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
148
+ }) => Promise<import("viem").PrepareTransactionRequestParameters>) | [fn: ((args: import("viem").PrepareTransactionRequestParameters, options: {
149
+ client: import("viem").Client;
150
+ phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
151
+ }) => Promise<import("viem").PrepareTransactionRequestParameters>) | undefined, options: {
152
+ runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
153
+ }] | undefined;
154
+ serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
155
+ verifyHash?: ((client: import("viem").Client, parameters: import("viem").VerifyHashActionParameters) => Promise<import("viem").VerifyHashActionReturnType>) | undefined;
156
+ };
157
+ readonly 4663: {
158
+ blockExplorers: {
159
+ readonly default: {
160
+ readonly name: "Blockscout";
161
+ readonly url: "https://robinhoodchain.blockscout.com";
162
+ readonly apiUrl: "https://robinhoodchain.blockscout.com/api";
163
+ };
164
+ };
165
+ blockTime: 100;
166
+ contracts: {
167
+ readonly multicall3: {
168
+ readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
169
+ };
170
+ };
171
+ ensTlds?: readonly string[] | undefined;
172
+ id: 4663;
173
+ name: "Robinhood Chain";
174
+ nativeCurrency: {
175
+ readonly name: "Ether";
176
+ readonly symbol: "ETH";
177
+ readonly decimals: 18;
178
+ };
179
+ experimental_preconfirmationTime?: number | undefined | undefined;
180
+ rpcUrls: {
181
+ readonly default: {
182
+ readonly http: readonly ["https://rpc.mainnet.chain.robinhood.com", "https://rpc.ordofi.network"];
183
+ readonly webSocket: readonly ["wss://rpc.ordofi.network"];
184
+ };
185
+ };
186
+ sourceId?: number | undefined | undefined;
187
+ supportsTransactionReplacementDetection?: boolean | undefined | undefined;
188
+ testnet?: boolean | undefined | undefined;
189
+ custom?: Record<string, unknown> | undefined;
190
+ extendSchema?: Record<string, unknown> | undefined;
191
+ fees?: import("viem").ChainFees<undefined> | undefined;
192
+ formatters?: undefined;
193
+ prepareTransactionRequest?: ((args: import("viem").PrepareTransactionRequestParameters, options: {
194
+ client: import("viem").Client;
195
+ phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
196
+ }) => Promise<import("viem").PrepareTransactionRequestParameters>) | [fn: ((args: import("viem").PrepareTransactionRequestParameters, options: {
197
+ client: import("viem").Client;
198
+ phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
199
+ }) => Promise<import("viem").PrepareTransactionRequestParameters>) | undefined, options: {
200
+ runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
201
+ }] | undefined;
202
+ serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
203
+ verifyHash?: ((client: import("viem").Client, parameters: import("viem").VerifyHashActionParameters) => Promise<import("viem").VerifyHashActionReturnType>) | undefined;
204
+ };
332
205
  };
333
206
  export type SupportedChainId = keyof typeof chains;
334
207
  export declare function isSupportedChainId(id: number): id is SupportedChainId;
208
+ /**
209
+ * Everything this client knows about a chain besides viem's own definition: the name a tool caller
210
+ * uses for it (`chain: "arbitrum"`), the name shown to an operator, the environment variables that
211
+ * configure its RPC, and the public endpoint used when none is set.
212
+ *
213
+ * ONE TABLE, so a chain cannot be half-added: `rpcUrlFromEnv`, `logsRpcUrlFromEnv`,
214
+ * `rpcSourceForEnv`, `resolvedRpcSecrets` and `publicRpcHint` all read it, and `Record<
215
+ * SupportedChainId, …>` makes a chain present in `chains` and absent here a compile error.
216
+ * `links.ts` holds the explorer map and is the one place this table does not reach; it fails loudly
217
+ * on a chain it does not know.
218
+ *
219
+ * `rpcEnv` is tried in order. The second name of each pair is the conventional one an operator may
220
+ * already have set. The CLI reads the whole environment it was started in, so both names reach it.
221
+ */
222
+ export interface ChainInfo {
223
+ key: string;
224
+ name: string;
225
+ rpcEnv: readonly string[];
226
+ logsRpcEnv: string;
227
+ publicRpc: string;
228
+ }
229
+ export declare const CHAIN_INFO: {
230
+ readonly 8453: {
231
+ readonly key: "base";
232
+ readonly name: "Base";
233
+ readonly rpcEnv: readonly ["TREASURY_RPC_BASE", "BASE_RPC_URL"];
234
+ readonly logsRpcEnv: "TREASURY_LOGS_RPC_BASE";
235
+ readonly publicRpc: "https://mainnet.base.org";
236
+ };
237
+ readonly 42161: {
238
+ readonly key: "arbitrum";
239
+ readonly name: "Arbitrum One";
240
+ readonly rpcEnv: readonly ["TREASURY_RPC_ARBITRUM", "ARBITRUM_RPC_URL"];
241
+ readonly logsRpcEnv: "TREASURY_LOGS_RPC_ARBITRUM";
242
+ readonly publicRpc: "https://arb1.arbitrum.io/rpc";
243
+ };
244
+ readonly 4663: {
245
+ readonly key: "robinhood";
246
+ readonly name: "Robinhood Chain";
247
+ readonly rpcEnv: readonly ["TREASURY_RPC_ROBINHOOD", "ROBINHOOD_RPC_URL"];
248
+ readonly logsRpcEnv: "TREASURY_LOGS_RPC_ROBINHOOD";
249
+ readonly publicRpc: "https://rpc.mainnet.chain.robinhood.com";
250
+ };
251
+ };
252
+ /** The name a tool caller uses for a chain: `"base"`, `"arbitrum"`, `"robinhood"`. */
253
+ export type ChainKey = (typeof CHAIN_INFO)[SupportedChainId]["key"];
254
+ /**
255
+ * Every supported chain, in the order chains were added: Base first, then Arbitrum One, then Robinhood
256
+ * Chain. Listed rather than read from `Object.keys(chains)`, whose integer keys enumerate in numeric
257
+ * order and would put Robinhood Chain (4663) ahead of Base everywhere a list of chains is shown.
258
+ * `client.unit.test.ts` holds this list equal to the keys of `chains`.
259
+ */
260
+ export declare const supportedChainIds: SupportedChainId[];
261
+ /** `"arbitrum"` → 42161. `undefined` for a name this client does not know — the caller says so. */
262
+ export declare function chainIdForKey(key: string): SupportedChainId | undefined;
335
263
  /**
336
264
  * Read-only client. This module constructs exactly one kind of thing — a public (unsigned)
337
265
  * client from an RPC URL. It never constructs a wallet client: the signer is the consumer's,
@@ -372,29 +300,43 @@ export declare function makePublicClient(chainId: SupportedChainId, rpcUrl: stri
372
300
  /**
373
301
  * An env value counts as an RPC URL only if it parses as one with an http(s) scheme. Anything else —
374
302
  * empty, whitespace, a non-URL, and in particular an UNEXPANDED placeholder like `${TREASURY_RPC_BASE}` —
375
- * is treated as unset. Measured 2026-09-12: Claude Code forwards the plugin's `.mcp.json` value
376
- * `${TREASURY_RPC_BASE}` verbatim when the host variable is unset, and with the old `if (v)` test every
377
- * RPC-touching tool died on "Failed to parse URL from ${TREASURY_RPC_BASE}". `.mcp.json` now also uses
378
- * `${VAR:-}`, but this guard is what makes the server independent of any host's expansion rules.
303
+ * is treated as unset. Measured 2026-09-12, when the plugin still declared an MCP server: Claude Code
304
+ * forwarded the server declaration's value `${TREASURY_RPC_BASE}` verbatim when the host variable was
305
+ * unset, and with the old `if (v)` test every RPC-touching tool died on "Failed to parse URL from
306
+ * ${TREASURY_RPC_BASE}". The plugin now runs the CLI through the shell and declares nothing, but any
307
+ * host or wrapper can still pass a placeholder through, and this guard is what makes the client
308
+ * independent of anyone's expansion rules.
379
309
  */
380
310
  export declare function rpcUrlFromEnvValue(v: string | undefined): string | undefined;
381
311
  /**
382
312
  * Resolves the RPC URL for a chain from the environment. ⚠️ A keyed provider URL IS a secret: it must
383
- * never appear in tool output — every error crossing the tool boundary goes through `describeError`
384
- * (`src/redact.ts`), which strips endpoints. Fallback names after `TREASURY_RPC_BASE`:
385
- * `BASE_RPC_URL`; the plugin's `.mcp.json` passes only the `TREASURY_*` pair through, so under the
386
- * packaged path the fallback is unreachable.
387
- * `TREASURY_LOGS_RPC_BASE`, if set, is preferred for log scans (providers cap eth_getLogs ranges very
388
- * differently: Alchemy free 10 blocks, Base public 2,000) — see `position.ts`.
313
+ * never appear in tool output — every error crossing the tool boundary goes through `redactEndpoints`
314
+ * (`src/redact.ts`), which strips endpoints. The names come from `CHAIN_INFO`: on Base,
315
+ * `TREASURY_RPC_BASE` then `BASE_RPC_URL`; on Arbitrum One, `TREASURY_RPC_ARBITRUM` then
316
+ * `ARBITRUM_RPC_URL`; on Robinhood Chain, `TREASURY_RPC_ROBINHOOD` then `ROBINHOOD_RPC_URL`. The CLI inherits its shell's whole environment, so on every path, the plugin's
317
+ * included, the second name of each pair is used when the first is unset.
318
+ * The chain's logs variable (`TREASURY_LOGS_RPC_BASE`, `TREASURY_LOGS_RPC_ARBITRUM`, `TREASURY_LOGS_RPC_ROBINHOOD`), if set, is
319
+ * preferred for log scans (providers cap eth_getLogs ranges very differently: Alchemy free 10 blocks,
320
+ * Base public 2,000, Infura 10,000 on Arbitrum) — see `position.ts`.
321
+ *
322
+ * 🔴 A chain reads ONLY its own variables. An Arbitrum call never falls back to a Base endpoint: a
323
+ * vault's address has no contract on the other chain, so reads fail with "returned no data" — which
324
+ * reads as a broken vault rather than as a misconfiguration.
389
325
  */
390
326
  export declare function rpcUrlFromEnv(chainId: SupportedChainId): string;
391
327
  /**
392
328
  * The endpoint an event scan falls back to when the configured logs RPC cannot cover the range — and
393
- * the operator's opt-out from it. `TREASURY_LOGS_FALLBACK` unset ⇒ Base's public endpoint; an http(s)
394
- * URL ⇒ that endpoint; ANY other value — `off`, `none`, `disabled`, a typo — ⇒ no fallback at all, and
395
- * the scan degrades to a cut-short window as it did before the fallback existed. It exists because the fallback
329
+ * the operator's opt-out from it. `TREASURY_LOGS_FALLBACK` unset ⇒ the chain's public endpoint; an
330
+ * http(s) URL ⇒ that endpoint, ON BASE ONLY; ANY other value — `off`, `none`, `disabled`, a typo — ⇒ no
331
+ * fallback at all, and the scan degrades to a cut-short window as it did before the fallback existed. It exists because the fallback
396
332
  * otherwise sends a query to a third party the operator never named, which some
397
333
  * deployments cannot accept — and it fails CLOSED for the same reason.
334
+ *
335
+ * 🔴 The variable names ONE endpoint, and that endpoint is on Base. On any other chain a URL there
336
+ * cannot serve the scan — it would answer for the wrong chain — so a SET variable means no fallback
337
+ * on that chain, whatever it holds: either the operator opted out, or they named a Base endpoint and
338
+ * so constrained where this process talks. An operator who wants history on another chain points that
339
+ * chain's logs variable (`TREASURY_LOGS_RPC_ARBITRUM`, `TREASURY_LOGS_RPC_ROBINHOOD`) at a provider with a wide eth_getLogs range.
398
340
  */
399
341
  export declare function logsFallbackUrlFromEnv(chainId: SupportedChainId, logsUrl: string): string | undefined;
400
342
  /** RPC to use for eth_getLogs scans: a dedicated one if configured, else the general one. */
@@ -427,3 +369,46 @@ export declare function resolvedRpcSecrets(): string[];
427
369
  * undefined when a keyed RPC resolved, so a real chain fault is never mislabelled as a setup problem.
428
370
  */
429
371
  export declare function publicRpcHint(chainId: SupportedChainId): string | undefined;
372
+ /** How long a chain-identity probe may take before the endpoint counts as "did not say". */
373
+ export declare const CHAIN_PROBE_MS = 3000;
374
+ /**
375
+ * Which chain does this endpoint say it is? `undefined` when it did not say within
376
+ * `CHAIN_PROBE_MS` — an error, a rate limit, a hang — which is NOT a statement about the chain: the
377
+ * caller reports that as "not verified", never as a match and never as a mismatch.
378
+ *
379
+ * It exists because two chains mean two RPC variables, and the likeliest mistake is one pointed at
380
+ * the other chain. Nothing then errors usefully: a vault's address has no code there, so reads fail
381
+ * with "returned no data" and the failure reads as a broken vault.
382
+ *
383
+ * Bounded on purpose. The transport's own deadline is 10 s and a rate-limited `eth_chainId` is waited
384
+ * out for all of it, which would make a health check that already has its answer wait ten seconds
385
+ * for a second one (measured in review). An answer is remembered per endpoint URL, so a process asks
386
+ * each endpoint once.
387
+ */
388
+ export declare function endpointChainId(client: ReadClient, rpcUrl: string, timeoutMs?: number): Promise<number | undefined>;
389
+ /** An endpoint a tool is about to read through, and the NAME of the variable that supplied it. */
390
+ export interface Endpoint {
391
+ client: ReadClient;
392
+ url: string;
393
+ source: string;
394
+ }
395
+ /**
396
+ * The first of these endpoints that answers for a chain other than `chainId`, or `undefined`.
397
+ * A chain's public endpoint is never asked: it is this client's own constant, so the question
398
+ * would be a request to a third party with a known answer. An endpoint that does not say is not a
399
+ * mismatch.
400
+ */
401
+ export declare function firstEndpointOnWrongChain(chainId: SupportedChainId, endpoints: Endpoint[]): Promise<{
402
+ source: string;
403
+ answersFor: number;
404
+ } | undefined>;
405
+ /** TEST SEAM — forgets what every endpoint said, so one test's mock port cannot answer for the next. NOT re-exported from index.ts. */
406
+ export declare function __forgetEndpointChainsForTests(): void;
407
+ /**
408
+ * Which variable supplied the endpoint `earn_balance` scans events through — the chain's logs
409
+ * variable when it resolves, otherwise whatever supplied the general RPC. The NAME only.
410
+ */
411
+ export declare function logsRpcSourceForEnv(chainId: SupportedChainId): {
412
+ source: string;
413
+ configured: boolean;
414
+ };