keyring-agent-core 0.2.52 → 0.2.54
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/index.d.ts +1549 -65
- package/dist/index.js +100 -98
- package/dist/index.native.js +214 -212
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -368,6 +368,18 @@ declare class PoolService {
|
|
|
368
368
|
*/
|
|
369
369
|
listAddLiquiditySupportedChains(): Promise<string[]>;
|
|
370
370
|
getPositionManagerAddress(chainId: string): Promise<string | undefined>;
|
|
371
|
+
/**
|
|
372
|
+
* The shared read client for a chain — see {@link file://../chain/index.ts}.
|
|
373
|
+
*
|
|
374
|
+
* Endpoint rules are the core-wide ones, which `getPublicClient` already
|
|
375
|
+
* applies: the shared override first, then the chain's backups behind it. This
|
|
376
|
+
* used to pass {@link getRpcUrl} explicitly, which resolved to the SAME
|
|
377
|
+
* preferred endpoint but pinned it — dropping the backups, so a flaky RPC
|
|
378
|
+
* failed the read instead of falling through. Cached per chain by the client
|
|
379
|
+
* factory, and multicall-batching, so the several reads a pool description
|
|
380
|
+
* needs collapse into one round-trip.
|
|
381
|
+
*/
|
|
382
|
+
private client;
|
|
371
383
|
/** Generic eth_call helper. `data` is the encoded calldata (with selector). */
|
|
372
384
|
ethCall(chainId: string, to: string, data: string): Promise<string>;
|
|
373
385
|
/** Read native balance (wei) */
|
|
@@ -391,7 +403,16 @@ declare class PoolService {
|
|
|
391
403
|
* before quoting "spendable". Mirrors coinpool-v2: gasLimit × gasPrice × 1.8.
|
|
392
404
|
*/
|
|
393
405
|
estimateGasReserveWei(chainId: string): Promise<bigint>;
|
|
394
|
-
/**
|
|
406
|
+
/**
|
|
407
|
+
* Read full pool state in ONE round-trip.
|
|
408
|
+
*
|
|
409
|
+
* The six reads go through Multicall3 (`aggregate3`) with `allowFailure: false`,
|
|
410
|
+
* so a pool address that isn't a V3 pool fails loudly here — as it did when
|
|
411
|
+
* these were six separate `eth_call`s — rather than yielding a half-filled
|
|
412
|
+
* description. Addresses are lower-cased on the way out: the decoder returns
|
|
413
|
+
* EIP-55 checksummed hex, while callers key maps and compare against
|
|
414
|
+
* {@link ZERO_ADDRESS} in lowercase.
|
|
415
|
+
*/
|
|
395
416
|
readPoolOnchain(chainId: string, poolAddress: string): Promise<PoolOnchainInfo>;
|
|
396
417
|
readErc20Decimals(chainId: string, tokenAddress: string): Promise<number>;
|
|
397
418
|
/**
|
|
@@ -468,41 +489,6 @@ declare class PoolService {
|
|
|
468
489
|
value: string;
|
|
469
490
|
minAmountOut: string;
|
|
470
491
|
}>;
|
|
471
|
-
/**
|
|
472
|
-
* Encode a call to the CoinPool gateway's `mint(paymentInfo, exchanges, params)`
|
|
473
|
-
* function. Layout matches coinpool-v2's GatewayAbi.
|
|
474
|
-
*
|
|
475
|
-
* Function signature:
|
|
476
|
-
* mint(
|
|
477
|
-
* PaymentInfo[2] paymentInfo,
|
|
478
|
-
* Exchange[2] exchanges,
|
|
479
|
-
* MintParams params
|
|
480
|
-
* )
|
|
481
|
-
*
|
|
482
|
-
* Where:
|
|
483
|
-
* PaymentInfo = (address tokenIn, uint256 tokenInAmount, address tokenOut, uint256 tokenOutAmount)
|
|
484
|
-
* Exchange = (address to, bytes data, uint256 value)
|
|
485
|
-
* MintParams = (uint24 fee, uint256 amount0Min, uint256 amount1Min, int24 tickLower, int24 tickUpper)
|
|
486
|
-
*/
|
|
487
|
-
encodeMintCalldata(args: {
|
|
488
|
-
paymentInfo: Array<{
|
|
489
|
-
tokenIn: string;
|
|
490
|
-
tokenInAmount: bigint;
|
|
491
|
-
tokenOut: string;
|
|
492
|
-
tokenOutAmount: bigint;
|
|
493
|
-
}>;
|
|
494
|
-
exchanges: Array<{
|
|
495
|
-
to: string;
|
|
496
|
-
data: string;
|
|
497
|
-
value: bigint;
|
|
498
|
-
}>;
|
|
499
|
-
fee: number;
|
|
500
|
-
amount0Min: bigint;
|
|
501
|
-
amount1Min: bigint;
|
|
502
|
-
tickLower: number;
|
|
503
|
-
tickUpper: number;
|
|
504
|
-
}): string;
|
|
505
|
-
_keccak(hex: string): string;
|
|
506
492
|
}
|
|
507
493
|
|
|
508
494
|
/**
|
|
@@ -5231,6 +5217,133 @@ declare class TransactionByHashTool extends BaseTool {
|
|
|
5231
5217
|
}>;
|
|
5232
5218
|
}
|
|
5233
5219
|
|
|
5220
|
+
/**
|
|
5221
|
+
* Shared ABI / hex types for the codec layer.
|
|
5222
|
+
*
|
|
5223
|
+
* Deliberately STRUCTURAL and loose (every field but `type` optional) rather
|
|
5224
|
+
* than viem's fully-inferred `Abi` generics: this core hand-writes its ABIs as
|
|
5225
|
+
* plain object literals — some without `as const` — and a strict type would
|
|
5226
|
+
* reject them at every call site for no runtime benefit. Validation happens
|
|
5227
|
+
* where it matters, at runtime, in {@link file://./signature.ts}.
|
|
5228
|
+
*/
|
|
5229
|
+
/** A 0x-prefixed hex string. */
|
|
5230
|
+
type Hex = `0x${string}`;
|
|
5231
|
+
/** A 0x-prefixed 20-byte address. */
|
|
5232
|
+
type Address = `0x${string}`;
|
|
5233
|
+
/** One ABI input/output parameter; `components` is present for tuples. */
|
|
5234
|
+
interface AbiParameter {
|
|
5235
|
+
readonly name?: string;
|
|
5236
|
+
readonly type: string;
|
|
5237
|
+
readonly internalType?: string;
|
|
5238
|
+
readonly components?: readonly AbiParameter[];
|
|
5239
|
+
/** Events only — whether the parameter is a topic. */
|
|
5240
|
+
readonly indexed?: boolean;
|
|
5241
|
+
}
|
|
5242
|
+
/** One ABI entry: function, event, error, constructor, fallback or receive. */
|
|
5243
|
+
interface AbiItem {
|
|
5244
|
+
readonly type?: string;
|
|
5245
|
+
readonly name?: string;
|
|
5246
|
+
readonly inputs?: readonly AbiParameter[];
|
|
5247
|
+
readonly outputs?: readonly AbiParameter[];
|
|
5248
|
+
readonly stateMutability?: string;
|
|
5249
|
+
readonly anonymous?: boolean;
|
|
5250
|
+
}
|
|
5251
|
+
/** A contract ABI. */
|
|
5252
|
+
type Abi = readonly AbiItem[];
|
|
5253
|
+
|
|
5254
|
+
/**
|
|
5255
|
+
* Chain shape — viem's `Chain`, plus a `hexId` because this core identifies
|
|
5256
|
+
* chains by hex id (`0x2105`) everywhere: in tool arguments, in `UserContext`,
|
|
5257
|
+
* and in the wallet payloads it hands the app.
|
|
5258
|
+
*/
|
|
5259
|
+
|
|
5260
|
+
/** A contract deployed at a known address on a chain. */
|
|
5261
|
+
interface ChainContract {
|
|
5262
|
+
address: Address;
|
|
5263
|
+
/** Block the contract was deployed at, when known — reads before it can't work. */
|
|
5264
|
+
blockCreated?: number;
|
|
5265
|
+
}
|
|
5266
|
+
/** The chain's one native coin (everything else on it is a token). */
|
|
5267
|
+
interface ChainNativeCurrency {
|
|
5268
|
+
name: string;
|
|
5269
|
+
symbol: string;
|
|
5270
|
+
decimals: number;
|
|
5271
|
+
}
|
|
5272
|
+
interface Chain {
|
|
5273
|
+
/** Decimal chain id (`8453`). */
|
|
5274
|
+
id: number;
|
|
5275
|
+
/** Canonical hex chain id (`0x2105`) — this core's primary key for a chain. */
|
|
5276
|
+
hexId: Hex;
|
|
5277
|
+
/** Display name, as shown to users. */
|
|
5278
|
+
name: string;
|
|
5279
|
+
nativeCurrency: ChainNativeCurrency;
|
|
5280
|
+
rpcUrls: {
|
|
5281
|
+
default: {
|
|
5282
|
+
http: readonly string[];
|
|
5283
|
+
};
|
|
5284
|
+
};
|
|
5285
|
+
blockExplorers?: {
|
|
5286
|
+
default: {
|
|
5287
|
+
name: string;
|
|
5288
|
+
url: string;
|
|
5289
|
+
};
|
|
5290
|
+
};
|
|
5291
|
+
/** Well-known contracts; `multicall3` is what the batching layer needs. */
|
|
5292
|
+
contracts?: {
|
|
5293
|
+
multicall3?: ChainContract;
|
|
5294
|
+
};
|
|
5295
|
+
testnet?: boolean;
|
|
5296
|
+
}
|
|
5297
|
+
|
|
5298
|
+
/**
|
|
5299
|
+
* The 12 EVM chains this core supports, as viem-shaped {@link Chain} objects.
|
|
5300
|
+
*
|
|
5301
|
+
* One definition per chain carries everything the stack needs — decimal id, hex
|
|
5302
|
+
* id, display name, native coin, default public RPC and the Multicall3
|
|
5303
|
+
* deployment — so nothing has to be threaded through call sites or duplicated in
|
|
5304
|
+
* a second table.
|
|
5305
|
+
*
|
|
5306
|
+
* Multicall3 sits at the SAME deterministic address on every one of them
|
|
5307
|
+
* (verified on-chain via `eth_getCode`), but each chain still spells it out: a
|
|
5308
|
+
* chain that ever ships it elsewhere is then a one-line change here.
|
|
5309
|
+
*
|
|
5310
|
+
* `blockCreated` is advisory metadata — it only gates reads pinned to a
|
|
5311
|
+
* HISTORICAL block (a read at `latest`, the default, never consults it) — and is
|
|
5312
|
+
* left out where the deployment block isn't confirmed.
|
|
5313
|
+
*
|
|
5314
|
+
* `rpcUrls.default.http` is an ORDERED PREFERENCE LIST, not a single endpoint:
|
|
5315
|
+
* the first entry is the one normally used, and the rest are fixed backups the
|
|
5316
|
+
* {@link file://../transports/fallback.ts} transport walks down when a request
|
|
5317
|
+
* fails transiently (rate limit, 5xx, timeout). A public endpoint rejecting the
|
|
5318
|
+
* odd method — eth.llamarpc.com answering `eth_gasPrice` with HTTP 525, say —
|
|
5319
|
+
* therefore degrades to a slower answer rather than no answer.
|
|
5320
|
+
*/
|
|
5321
|
+
|
|
5322
|
+
/** Canonical Multicall3 address, identical on every supported chain. */
|
|
5323
|
+
declare const MULTICALL3_ADDRESS: "0xcA11bde05977b3631167028862bE2a173976CA11";
|
|
5324
|
+
/** Every supported chain, in the core's canonical order. */
|
|
5325
|
+
declare const chains: readonly Chain[];
|
|
5326
|
+
|
|
5327
|
+
/**
|
|
5328
|
+
* Domain-level batched reads, on top of the chain stack
|
|
5329
|
+
* ({@link file://../chain/index.ts}).
|
|
5330
|
+
*
|
|
5331
|
+
* The Multicall3 plumbing this file used to carry — the hand-written
|
|
5332
|
+
* `aggregate3` encoder, the `(bool,bytes)[]` reader, the chunking loop — now
|
|
5333
|
+
* lives in `chain/actions/multicall.ts` and `chain/actions/multicallRaw.ts`,
|
|
5334
|
+
* where it is ABI-driven and reusable. What remains here are the three helpers
|
|
5335
|
+
* the core's services actually ask for, with their signatures and their
|
|
5336
|
+
* never-throws, positionally-aligned contracts unchanged:
|
|
5337
|
+
*
|
|
5338
|
+
* - {@link multicallRead} raw calldata in, raw return data out
|
|
5339
|
+
* - {@link multicallErc20Metadata} symbol + decimals, incl. legacy bytes32 tokens
|
|
5340
|
+
* - {@link multicallTokenUris} ERC-721 `tokenURI` for many NFTs
|
|
5341
|
+
*
|
|
5342
|
+
* For anything new, prefer the client directly — `getPublicClient(chainId)` then
|
|
5343
|
+
* `.multicall({ contracts })` — which decodes results and reports typed
|
|
5344
|
+
* per-entry errors instead of `null`.
|
|
5345
|
+
*/
|
|
5346
|
+
|
|
5234
5347
|
/** One read in a {@link multicallRead} batch: a target contract + full calldata. */
|
|
5235
5348
|
interface MulticallRequest {
|
|
5236
5349
|
/** Contract to call. A malformed address yields a `null` result. */
|
|
@@ -5264,6 +5377,25 @@ interface MulticallRequest {
|
|
|
5264
5377
|
* step 2. The protocols stay ignorant of batching; the batching stays ignorant
|
|
5265
5378
|
* of protocols.
|
|
5266
5379
|
*
|
|
5380
|
+
* ## Rates that take two calls
|
|
5381
|
+
*
|
|
5382
|
+
* Compound and Spark cannot quote a rate in one read: Compound's `getSupplyRate`
|
|
5383
|
+
* is a function OF `getUtilization()`, and a Spark L2 vault's `getAPR()` lives on
|
|
5384
|
+
* whatever address its `rateProvider()` returns. Both are therefore a CHAIN of
|
|
5385
|
+
* two calls, the second built from the first's answer.
|
|
5386
|
+
*
|
|
5387
|
+
* {@link LendingProtocol.followUpRateCall} expresses that: given phase one's
|
|
5388
|
+
* return data, it declares the follow-up (or null when there is none), and
|
|
5389
|
+
* {@link LendingProtocol.decodeLiveRate} decodes whichever call came last. The
|
|
5390
|
+
* service runs at most two multicall rounds — every market that needs a follow-up
|
|
5391
|
+
* still shares one — so the cost is two round-trips per chain, not two per market.
|
|
5392
|
+
*
|
|
5393
|
+
* These reads exist because the numbers must match the CoinPool app, which reads
|
|
5394
|
+
* the same rates on-chain at render time. An earlier version leaned on the newest
|
|
5395
|
+
* row of CoinPool's history endpoint instead; that row is a snapshot taken hours
|
|
5396
|
+
* earlier, and on a chain whose utilization moves — Compound on Base was 5.33% by
|
|
5397
|
+
* the stored row against 5.21% on chain — it visibly disagrees with the app.
|
|
5398
|
+
*
|
|
5267
5399
|
* The APY half ({@link LendingProtocol.fetchApy}) is a per-market HTTP call to a
|
|
5268
5400
|
* different upstream per protocol, so there is nothing to batch and each class
|
|
5269
5401
|
* simply does the fetch.
|
|
@@ -5474,8 +5606,8 @@ declare class LendingService {
|
|
|
5474
5606
|
*/
|
|
5475
5607
|
private readBalances;
|
|
5476
5608
|
/**
|
|
5477
|
-
* On-chain state of each market,
|
|
5478
|
-
*
|
|
5609
|
+
* On-chain state of each market, aligned with `markets`: its size and its live
|
|
5610
|
+
* supply rate.
|
|
5479
5611
|
*
|
|
5480
5612
|
* This is where the batching lives. Each market's protocol only DECLARES the
|
|
5481
5613
|
* calls it wants ({@link LendingProtocol.sizeCall}, {@link LendingProtocol.liveRateCall});
|
|
@@ -5483,6 +5615,12 @@ declare class LendingService {
|
|
|
5483
5615
|
* its own slice of the result. Twenty markets across four protocols still cost
|
|
5484
5616
|
* one RPC round-trip.
|
|
5485
5617
|
*
|
|
5618
|
+
* Compound and Spark need a SECOND call that depends on the first's answer
|
|
5619
|
+
* (`getSupplyRate` of the utilization just read; `getAPR` on the rate provider
|
|
5620
|
+
* just named), so a second round follows when any market asks for one. Those
|
|
5621
|
+
* follow-ups are batched together too — two round-trips per chain at worst,
|
|
5622
|
+
* never two per market.
|
|
5623
|
+
*
|
|
5486
5624
|
* Either field is null when its call failed or decoded implausibly.
|
|
5487
5625
|
*/
|
|
5488
5626
|
private readMarketState;
|
|
@@ -5627,7 +5765,7 @@ declare class WalletLendingPositionsTool extends BaseTool {
|
|
|
5627
5765
|
totals?: undefined;
|
|
5628
5766
|
} | {
|
|
5629
5767
|
_instructions: string;
|
|
5630
|
-
walletAddress: string
|
|
5768
|
+
walletAddress: `0x${string}`;
|
|
5631
5769
|
chain: string;
|
|
5632
5770
|
positionCount: number;
|
|
5633
5771
|
positions: never[];
|
|
@@ -5637,7 +5775,7 @@ declare class WalletLendingPositionsTool extends BaseTool {
|
|
|
5637
5775
|
totals?: undefined;
|
|
5638
5776
|
} | {
|
|
5639
5777
|
_instructions: string;
|
|
5640
|
-
walletAddress: string
|
|
5778
|
+
walletAddress: `0x${string}`;
|
|
5641
5779
|
chain: string;
|
|
5642
5780
|
chainsQueried: string[];
|
|
5643
5781
|
positionCount: number;
|
|
@@ -6289,7 +6427,13 @@ declare class PoolDetailTool extends BaseTool {
|
|
|
6289
6427
|
* Never throws — returns `[]` on any miss so the detail view is unaffected.
|
|
6290
6428
|
*/
|
|
6291
6429
|
private fetchPriceRanges;
|
|
6292
|
-
/**
|
|
6430
|
+
/**
|
|
6431
|
+
* Trim and enrich the GraphQL payload with derived metrics.
|
|
6432
|
+
*
|
|
6433
|
+
* `lpFeeShare` is the fraction of swap fees left to LPs after the pool's
|
|
6434
|
+
* on-chain protocol fee; pass it so fees/APR are the LP-net figures rather
|
|
6435
|
+
* than the gross `feeTier × volume` headline.
|
|
6436
|
+
*/
|
|
6293
6437
|
private formatPool;
|
|
6294
6438
|
private formatHistorical;
|
|
6295
6439
|
}
|
|
@@ -6368,6 +6512,7 @@ declare class PoolByAddressTool extends BaseTool {
|
|
|
6368
6512
|
tvlChange24hPercent: number | undefined;
|
|
6369
6513
|
volume24hUsd: number | undefined;
|
|
6370
6514
|
fees24hUsd: number | undefined;
|
|
6515
|
+
lpFeeShare: number;
|
|
6371
6516
|
aprPercent: number | undefined;
|
|
6372
6517
|
volumeToTvlRatio: number | undefined;
|
|
6373
6518
|
txCount: number | undefined;
|
|
@@ -6440,6 +6585,7 @@ declare class PoolByAddressTool extends BaseTool {
|
|
|
6440
6585
|
private findTokenByAddress;
|
|
6441
6586
|
private formatToken;
|
|
6442
6587
|
private formatPoolCandidate;
|
|
6588
|
+
/** `lpFeeShare` is the fraction of swap fees LPs keep after the protocol fee. */
|
|
6443
6589
|
private formatPoolDetail;
|
|
6444
6590
|
private formatHistorical;
|
|
6445
6591
|
}
|
|
@@ -8244,39 +8390,591 @@ declare class SendNftTool extends BaseWalletActionTool {
|
|
|
8244
8390
|
}
|
|
8245
8391
|
|
|
8246
8392
|
/**
|
|
8247
|
-
*
|
|
8393
|
+
* JSON-RPC wire types + the EIP-1193 request function every transport exposes.
|
|
8394
|
+
*/
|
|
8395
|
+
|
|
8396
|
+
/** Block selector accepted wherever an RPC call takes one. */
|
|
8397
|
+
type BlockTag = 'latest' | 'earliest' | 'pending' | 'safe' | 'finalized';
|
|
8398
|
+
/** The two ways to name a block; `blockNumber` wins when both are given. */
|
|
8399
|
+
interface BlockParameters {
|
|
8400
|
+
blockNumber?: bigint;
|
|
8401
|
+
blockTag?: BlockTag;
|
|
8402
|
+
}
|
|
8403
|
+
/** A single JSON-RPC request, minus the envelope the transport adds. */
|
|
8404
|
+
interface RpcRequestBody {
|
|
8405
|
+
method: string;
|
|
8406
|
+
params?: unknown;
|
|
8407
|
+
}
|
|
8408
|
+
/** Per-request overrides accepted alongside the RPC body. */
|
|
8409
|
+
interface RequestOverrides {
|
|
8410
|
+
retryCount?: number;
|
|
8411
|
+
retryDelay?: number;
|
|
8412
|
+
}
|
|
8413
|
+
/**
|
|
8414
|
+
* EIP-1193 `request` — the ONE method every transport implements and every
|
|
8415
|
+
* action is written against, which is what makes actions transport-agnostic.
|
|
8416
|
+
*/
|
|
8417
|
+
type EIP1193RequestFn = <TResult = unknown>(args: RpcRequestBody, overrides?: RequestOverrides) => Promise<TResult>;
|
|
8418
|
+
|
|
8419
|
+
/**
|
|
8420
|
+
* Transport contract — how a client reaches a node.
|
|
8421
|
+
*
|
|
8422
|
+
* A transport is a FACTORY, not an object: the client calls it with its own
|
|
8423
|
+
* chain/retry/timeout defaults, and gets back a configured instance. That's what
|
|
8424
|
+
* lets one `http()` value be reused across clients (and what makes
|
|
8425
|
+
* `fallback([...])` composable), exactly as in viem.
|
|
8426
|
+
*/
|
|
8427
|
+
|
|
8428
|
+
/** Settings the client passes down when it instantiates a transport. */
|
|
8429
|
+
interface TransportFactoryParameters {
|
|
8430
|
+
chain?: Chain;
|
|
8431
|
+
retryCount?: number;
|
|
8432
|
+
retryDelay?: number;
|
|
8433
|
+
timeout?: number;
|
|
8434
|
+
}
|
|
8435
|
+
/** The resolved configuration of an instantiated transport. */
|
|
8436
|
+
interface TransportConfig<TType extends string = string> {
|
|
8437
|
+
/** Short machine key (`http`, `fallback`). */
|
|
8438
|
+
key: string;
|
|
8439
|
+
/** Human name for logs/errors. */
|
|
8440
|
+
name: string;
|
|
8441
|
+
/** Transport kind. */
|
|
8442
|
+
type: TType;
|
|
8443
|
+
/** How many times a failed request is retried. */
|
|
8444
|
+
retryCount: number;
|
|
8445
|
+
/** Base delay (ms) between retries; grows exponentially. */
|
|
8446
|
+
retryDelay: number;
|
|
8447
|
+
/** Per-request timeout (ms). */
|
|
8448
|
+
timeout: number;
|
|
8449
|
+
/** The RAW request fn, without the retry wrapper. */
|
|
8450
|
+
request: EIP1193RequestFn;
|
|
8451
|
+
}
|
|
8452
|
+
/** What a transport factory returns. */
|
|
8453
|
+
interface TransportInstance<TType extends string = string, TValue = unknown> {
|
|
8454
|
+
config: TransportConfig<TType>;
|
|
8455
|
+
/** Retry-wrapped, error-normalised request fn — what the client actually calls. */
|
|
8456
|
+
request: EIP1193RequestFn;
|
|
8457
|
+
/** Transport-specific extras (e.g. the resolved `url` for HTTP). */
|
|
8458
|
+
value?: TValue;
|
|
8459
|
+
}
|
|
8460
|
+
type Transport<TType extends string = string, TValue = unknown> = (parameters?: TransportFactoryParameters) => TransportInstance<TType, TValue>;
|
|
8461
|
+
|
|
8462
|
+
/**
|
|
8463
|
+
* The minimal client shape ACTIONS are written against.
|
|
8464
|
+
*
|
|
8465
|
+
* Actions take a `Client`, never the concrete `PublicClient` class — which is
|
|
8466
|
+
* what keeps the dependency arrow pointing one way (client → actions) and lets
|
|
8467
|
+
* an action be called standalone, viem-style:
|
|
8468
|
+
*
|
|
8469
|
+
* ```ts
|
|
8470
|
+
* import { multicall } from './actions/multicall';
|
|
8471
|
+
* await multicall(client, { contracts }); // === client.multicall({ contracts })
|
|
8472
|
+
* ```
|
|
8473
|
+
*/
|
|
8474
|
+
|
|
8475
|
+
/** Client-wide batching policy. */
|
|
8476
|
+
interface ClientBatchConfig {
|
|
8477
|
+
/**
|
|
8478
|
+
* Coalesce eligible `eth_call`s into a single Multicall3 `aggregate3`.
|
|
8479
|
+
* `true` uses the defaults; an object tunes them.
|
|
8480
|
+
*/
|
|
8481
|
+
multicall?: boolean | {
|
|
8482
|
+
/** Max calldata bytes per aggregated call (default 1024). */
|
|
8483
|
+
batchSize?: number;
|
|
8484
|
+
/** Extra ms to keep collecting before sending (default 0 — same tick). */
|
|
8485
|
+
wait?: number;
|
|
8486
|
+
};
|
|
8487
|
+
}
|
|
8488
|
+
interface Client {
|
|
8489
|
+
/** Machine key of the client (`public`). */
|
|
8490
|
+
key: string;
|
|
8491
|
+
/** Human name, used in errors. */
|
|
8492
|
+
name: string;
|
|
8493
|
+
/** Unique per instance — scopes batch queues so two clients never share one. */
|
|
8494
|
+
uid: string;
|
|
8495
|
+
/** The chain this client is bound to, when it has one. */
|
|
8496
|
+
chain?: Chain;
|
|
8497
|
+
/** Resolved transport config (endpoint, retries, timeout). */
|
|
8498
|
+
transport: TransportConfig & Record<string, unknown>;
|
|
8499
|
+
/** EIP-1193 request fn — every action ultimately goes through this. */
|
|
8500
|
+
request: EIP1193RequestFn;
|
|
8501
|
+
/** Optional batching policy (see {@link ClientBatchConfig}). */
|
|
8502
|
+
batch?: ClientBatchConfig;
|
|
8503
|
+
}
|
|
8504
|
+
|
|
8505
|
+
/**
|
|
8506
|
+
* Contract-call shapes shared by `readContract` and `multicall`.
|
|
8507
|
+
*/
|
|
8508
|
+
|
|
8509
|
+
/** One contract read: where, which ABI, which function, which arguments. */
|
|
8510
|
+
interface ContractFunctionParameters {
|
|
8511
|
+
address: Address;
|
|
8512
|
+
abi: Abi;
|
|
8513
|
+
/** Function name, full signature or 4-byte selector. */
|
|
8514
|
+
functionName: string;
|
|
8515
|
+
args?: readonly unknown[];
|
|
8516
|
+
}
|
|
8517
|
+
/**
|
|
8518
|
+
* One entry of a `multicall` result when `allowFailure` is on (the default) —
|
|
8519
|
+
* a discriminated union, so narrowing on `status` gives you a typed `result`
|
|
8520
|
+
* with no non-null assertions, the same ergonomics viem has.
|
|
8521
|
+
*/
|
|
8522
|
+
type MulticallResult<TResult = unknown> = {
|
|
8523
|
+
status: 'success';
|
|
8524
|
+
result: TResult;
|
|
8525
|
+
error?: undefined;
|
|
8526
|
+
} | {
|
|
8527
|
+
status: 'failure';
|
|
8528
|
+
result?: undefined;
|
|
8529
|
+
error: Error;
|
|
8530
|
+
};
|
|
8531
|
+
|
|
8532
|
+
/**
|
|
8533
|
+
* Chain lookup + RPC-endpoint resolution — the single source of truth for
|
|
8534
|
+
* "which node do we talk to for chain X".
|
|
8535
|
+
*
|
|
8536
|
+
* Resolution order, unchanged from before the client rewrite:
|
|
8537
|
+
* 1. a caller-supplied override (`AgentConfig.rpcUrls` → {@link setRpcOverrides}),
|
|
8538
|
+
* 2. the chain definition's default public RPC.
|
|
8539
|
+
*
|
|
8540
|
+
* An override changes only which endpoint is PREFERRED — the chain's built-in
|
|
8541
|
+
* endpoints stay behind it as backups, so a host that configures its own node
|
|
8542
|
+
* still degrades to the public ones instead of losing the chain when that node
|
|
8543
|
+
* is down. {@link resolveRpcUrl} returns just the preferred endpoint (what most
|
|
8544
|
+
* callers want); {@link resolveRpcUrls} returns the whole ordered list, which is
|
|
8545
|
+
* what the client hands to a `fallback` transport.
|
|
8248
8546
|
*
|
|
8249
|
-
*
|
|
8250
|
-
*
|
|
8547
|
+
* Keeping it here (rather than in the old `services/rpc.ts`) means the chain
|
|
8548
|
+
* layer is self-contained: transports, clients and the back-compat facade all
|
|
8549
|
+
* read the same table, and there is no import cycle between them.
|
|
8251
8550
|
*/
|
|
8252
|
-
|
|
8551
|
+
|
|
8552
|
+
/** Look up a chain by hex id, decimal id, or decimal string. `undefined` if unknown. */
|
|
8553
|
+
declare function getChain(chainId: string | number): Chain | undefined;
|
|
8554
|
+
/** Default public RPC endpoint per hex chain id, derived from the definitions. */
|
|
8253
8555
|
declare const DEFAULT_RPC_BY_CHAIN: Record<string, string>;
|
|
8254
|
-
/**
|
|
8255
|
-
declare function getDefaultRpcUrl(chainId: string): string | undefined;
|
|
8556
|
+
/** The built-in public RPC for a chain, ignoring overrides. */
|
|
8557
|
+
declare function getDefaultRpcUrl(chainId: string | number): string | undefined;
|
|
8256
8558
|
/**
|
|
8257
|
-
* Install the shared RPC overrides for the whole core
|
|
8258
|
-
* set. Keys are normalised to lowercase hex
|
|
8259
|
-
* are ignored so a partial map only overrides
|
|
8260
|
-
* Called once by AgentCore
|
|
8559
|
+
* Install the shared RPC overrides for the whole core, replacing any previous
|
|
8560
|
+
* set. Keys are normalised to lowercase hex ids (so `'8453'` and `'0x2105'` both
|
|
8561
|
+
* work); blank or non-string values are ignored, so a partial map only overrides
|
|
8562
|
+
* the chains it actually names. Called once by AgentCore.
|
|
8261
8563
|
*/
|
|
8262
8564
|
declare function setRpcOverrides(overrides?: Record<string, string>): void;
|
|
8565
|
+
/** The currently installed overrides (read-only copy). */
|
|
8566
|
+
declare function getRpcOverrides(): Readonly<Record<string, string>>;
|
|
8567
|
+
/**
|
|
8568
|
+
* Every endpoint for a chain, most-preferred first: the caller-supplied override
|
|
8569
|
+
* (when set) ahead of the chain's own list, which is itself ordered. Duplicates
|
|
8570
|
+
* are dropped, so an override naming an endpoint already in the definition
|
|
8571
|
+
* simply promotes it rather than making it appear twice.
|
|
8572
|
+
*
|
|
8573
|
+
* Empty only when the chain is neither overridden nor known.
|
|
8574
|
+
*/
|
|
8575
|
+
declare function resolveRpcUrls(chainId: string | number): string[];
|
|
8263
8576
|
/**
|
|
8264
|
-
* Resolve a
|
|
8265
|
-
*
|
|
8266
|
-
*
|
|
8577
|
+
* Resolve a chain to its PREFERRED RPC URL: the caller-supplied override first,
|
|
8578
|
+
* else the chain's first default. `undefined` only when the chain is neither
|
|
8579
|
+
* overridden nor known. Callers that can use the backups too want
|
|
8580
|
+
* {@link resolveRpcUrls}.
|
|
8267
8581
|
*/
|
|
8268
|
-
declare function resolveRpcUrl(chainId: string): string | undefined;
|
|
8269
|
-
|
|
8270
|
-
declare function rpcCall<T>(rpcUrl: string, method: string, params: unknown[]): Promise<T>;
|
|
8271
|
-
/** `eth_call` against an explicit RPC URL. `data` is the encoded calldata. */
|
|
8272
|
-
declare function ethCallAt(rpcUrl: string, to: string, data: string): Promise<string>;
|
|
8582
|
+
declare function resolveRpcUrl(chainId: string | number): string | undefined;
|
|
8583
|
+
|
|
8273
8584
|
/**
|
|
8274
|
-
*
|
|
8275
|
-
* overrides (see {@link setRpcOverrides}) before falling back to the default
|
|
8276
|
-
* endpoint. Returns `null` when the chain has no known RPC or the call fails —
|
|
8277
|
-
* callers that need to distinguish errors should use {@link ethCallAt} directly.
|
|
8585
|
+
* Well-known-contract lookup on a chain — viem's `getChainContractAddress`.
|
|
8278
8586
|
*/
|
|
8279
|
-
|
|
8587
|
+
|
|
8588
|
+
/**
|
|
8589
|
+
* The address of a well-known contract (today: `multicall3`) on `chain`.
|
|
8590
|
+
*
|
|
8591
|
+
* Throws {@link ChainDoesNotSupportContractError} when the chain has no such
|
|
8592
|
+
* deployment, or when `blockNumber` predates it — a read pinned before the
|
|
8593
|
+
* deployment block would otherwise come back as a confusing empty result.
|
|
8594
|
+
*/
|
|
8595
|
+
declare function getChainContractAddress({ blockNumber, chain, contract: name, }: {
|
|
8596
|
+
blockNumber?: bigint;
|
|
8597
|
+
chain: Chain;
|
|
8598
|
+
contract: 'multicall3';
|
|
8599
|
+
}): Address;
|
|
8600
|
+
|
|
8601
|
+
/**
|
|
8602
|
+
* Multicall3 — the contract every batched read goes through.
|
|
8603
|
+
*
|
|
8604
|
+
* Restricted to what a READ client needs. `aggregate3` is the one the batching
|
|
8605
|
+
* layer uses: per-call `allowFailure` means one reverting call comes back as
|
|
8606
|
+
* `success: false` instead of reverting the whole batch.
|
|
8607
|
+
*/
|
|
8608
|
+
/**
|
|
8609
|
+
* Multicall3, restricted to what a READ client needs. `aggregate3` is the one the
|
|
8610
|
+
* batching layer uses: per-call `allowFailure` means one reverting call comes back
|
|
8611
|
+
* as `success: false` instead of reverting the whole batch.
|
|
8612
|
+
*/
|
|
8613
|
+
declare const multicall3Abi: readonly [{
|
|
8614
|
+
readonly type: "function";
|
|
8615
|
+
readonly name: "aggregate3";
|
|
8616
|
+
readonly stateMutability: "payable";
|
|
8617
|
+
readonly inputs: readonly [{
|
|
8618
|
+
readonly name: "calls";
|
|
8619
|
+
readonly type: "tuple[]";
|
|
8620
|
+
readonly components: readonly [{
|
|
8621
|
+
readonly name: "target";
|
|
8622
|
+
readonly type: "address";
|
|
8623
|
+
}, {
|
|
8624
|
+
readonly name: "allowFailure";
|
|
8625
|
+
readonly type: "bool";
|
|
8626
|
+
}, {
|
|
8627
|
+
readonly name: "callData";
|
|
8628
|
+
readonly type: "bytes";
|
|
8629
|
+
}];
|
|
8630
|
+
}];
|
|
8631
|
+
readonly outputs: readonly [{
|
|
8632
|
+
readonly name: "returnData";
|
|
8633
|
+
readonly type: "tuple[]";
|
|
8634
|
+
readonly components: readonly [{
|
|
8635
|
+
readonly name: "success";
|
|
8636
|
+
readonly type: "bool";
|
|
8637
|
+
}, {
|
|
8638
|
+
readonly name: "returnData";
|
|
8639
|
+
readonly type: "bytes";
|
|
8640
|
+
}];
|
|
8641
|
+
}];
|
|
8642
|
+
}, {
|
|
8643
|
+
readonly type: "function";
|
|
8644
|
+
readonly name: "getEthBalance";
|
|
8645
|
+
readonly stateMutability: "view";
|
|
8646
|
+
readonly inputs: readonly [{
|
|
8647
|
+
readonly name: "addr";
|
|
8648
|
+
readonly type: "address";
|
|
8649
|
+
}];
|
|
8650
|
+
readonly outputs: readonly [{
|
|
8651
|
+
readonly name: "balance";
|
|
8652
|
+
readonly type: "uint256";
|
|
8653
|
+
}];
|
|
8654
|
+
}, {
|
|
8655
|
+
readonly type: "function";
|
|
8656
|
+
readonly name: "getBlockNumber";
|
|
8657
|
+
readonly stateMutability: "view";
|
|
8658
|
+
readonly inputs: readonly [];
|
|
8659
|
+
readonly outputs: readonly [{
|
|
8660
|
+
readonly name: "blockNumber";
|
|
8661
|
+
readonly type: "uint256";
|
|
8662
|
+
}];
|
|
8663
|
+
}, {
|
|
8664
|
+
readonly type: "function";
|
|
8665
|
+
readonly name: "getCurrentBlockTimestamp";
|
|
8666
|
+
readonly stateMutability: "view";
|
|
8667
|
+
readonly inputs: readonly [];
|
|
8668
|
+
readonly outputs: readonly [{
|
|
8669
|
+
readonly name: "timestamp";
|
|
8670
|
+
readonly type: "uint256";
|
|
8671
|
+
}];
|
|
8672
|
+
}];
|
|
8673
|
+
|
|
8674
|
+
/**
|
|
8675
|
+
* ERC-20 — the fungible-token standard.
|
|
8676
|
+
*
|
|
8677
|
+
* `erc20Abi` is the full standard surface (reads, writes, events); the whole core
|
|
8678
|
+
* encodes and decodes against this one definition.
|
|
8679
|
+
*
|
|
8680
|
+
* `erc20Abi_bytes32` covers the pre-standard tokens (MKR and friends) that answer
|
|
8681
|
+
* `name()` / `symbol()` with a right-padded `bytes32` instead of a `string` — a
|
|
8682
|
+
* metadata reader retries with it when the `string` decode fails.
|
|
8683
|
+
*/
|
|
8684
|
+
/** ERC-20, full standard surface (reads + writes + events). */
|
|
8685
|
+
declare const erc20Abi: readonly [{
|
|
8686
|
+
readonly type: "function";
|
|
8687
|
+
readonly name: "name";
|
|
8688
|
+
readonly stateMutability: "view";
|
|
8689
|
+
readonly inputs: readonly [];
|
|
8690
|
+
readonly outputs: readonly [{
|
|
8691
|
+
readonly name: "";
|
|
8692
|
+
readonly type: "string";
|
|
8693
|
+
}];
|
|
8694
|
+
}, {
|
|
8695
|
+
readonly type: "function";
|
|
8696
|
+
readonly name: "symbol";
|
|
8697
|
+
readonly stateMutability: "view";
|
|
8698
|
+
readonly inputs: readonly [];
|
|
8699
|
+
readonly outputs: readonly [{
|
|
8700
|
+
readonly name: "";
|
|
8701
|
+
readonly type: "string";
|
|
8702
|
+
}];
|
|
8703
|
+
}, {
|
|
8704
|
+
readonly type: "function";
|
|
8705
|
+
readonly name: "decimals";
|
|
8706
|
+
readonly stateMutability: "view";
|
|
8707
|
+
readonly inputs: readonly [];
|
|
8708
|
+
readonly outputs: readonly [{
|
|
8709
|
+
readonly name: "";
|
|
8710
|
+
readonly type: "uint8";
|
|
8711
|
+
}];
|
|
8712
|
+
}, {
|
|
8713
|
+
readonly type: "function";
|
|
8714
|
+
readonly name: "totalSupply";
|
|
8715
|
+
readonly stateMutability: "view";
|
|
8716
|
+
readonly inputs: readonly [];
|
|
8717
|
+
readonly outputs: readonly [{
|
|
8718
|
+
readonly name: "";
|
|
8719
|
+
readonly type: "uint256";
|
|
8720
|
+
}];
|
|
8721
|
+
}, {
|
|
8722
|
+
readonly type: "function";
|
|
8723
|
+
readonly name: "balanceOf";
|
|
8724
|
+
readonly stateMutability: "view";
|
|
8725
|
+
readonly inputs: readonly [{
|
|
8726
|
+
readonly name: "account";
|
|
8727
|
+
readonly type: "address";
|
|
8728
|
+
}];
|
|
8729
|
+
readonly outputs: readonly [{
|
|
8730
|
+
readonly name: "";
|
|
8731
|
+
readonly type: "uint256";
|
|
8732
|
+
}];
|
|
8733
|
+
}, {
|
|
8734
|
+
readonly type: "function";
|
|
8735
|
+
readonly name: "allowance";
|
|
8736
|
+
readonly stateMutability: "view";
|
|
8737
|
+
readonly inputs: readonly [{
|
|
8738
|
+
readonly name: "owner";
|
|
8739
|
+
readonly type: "address";
|
|
8740
|
+
}, {
|
|
8741
|
+
readonly name: "spender";
|
|
8742
|
+
readonly type: "address";
|
|
8743
|
+
}];
|
|
8744
|
+
readonly outputs: readonly [{
|
|
8745
|
+
readonly name: "";
|
|
8746
|
+
readonly type: "uint256";
|
|
8747
|
+
}];
|
|
8748
|
+
}, {
|
|
8749
|
+
readonly type: "function";
|
|
8750
|
+
readonly name: "approve";
|
|
8751
|
+
readonly stateMutability: "nonpayable";
|
|
8752
|
+
readonly inputs: readonly [{
|
|
8753
|
+
readonly name: "spender";
|
|
8754
|
+
readonly type: "address";
|
|
8755
|
+
}, {
|
|
8756
|
+
readonly name: "amount";
|
|
8757
|
+
readonly type: "uint256";
|
|
8758
|
+
}];
|
|
8759
|
+
readonly outputs: readonly [{
|
|
8760
|
+
readonly name: "";
|
|
8761
|
+
readonly type: "bool";
|
|
8762
|
+
}];
|
|
8763
|
+
}, {
|
|
8764
|
+
readonly type: "function";
|
|
8765
|
+
readonly name: "transfer";
|
|
8766
|
+
readonly stateMutability: "nonpayable";
|
|
8767
|
+
readonly inputs: readonly [{
|
|
8768
|
+
readonly name: "to";
|
|
8769
|
+
readonly type: "address";
|
|
8770
|
+
}, {
|
|
8771
|
+
readonly name: "amount";
|
|
8772
|
+
readonly type: "uint256";
|
|
8773
|
+
}];
|
|
8774
|
+
readonly outputs: readonly [{
|
|
8775
|
+
readonly name: "";
|
|
8776
|
+
readonly type: "bool";
|
|
8777
|
+
}];
|
|
8778
|
+
}, {
|
|
8779
|
+
readonly type: "function";
|
|
8780
|
+
readonly name: "transferFrom";
|
|
8781
|
+
readonly stateMutability: "nonpayable";
|
|
8782
|
+
readonly inputs: readonly [{
|
|
8783
|
+
readonly name: "from";
|
|
8784
|
+
readonly type: "address";
|
|
8785
|
+
}, {
|
|
8786
|
+
readonly name: "to";
|
|
8787
|
+
readonly type: "address";
|
|
8788
|
+
}, {
|
|
8789
|
+
readonly name: "amount";
|
|
8790
|
+
readonly type: "uint256";
|
|
8791
|
+
}];
|
|
8792
|
+
readonly outputs: readonly [{
|
|
8793
|
+
readonly name: "";
|
|
8794
|
+
readonly type: "bool";
|
|
8795
|
+
}];
|
|
8796
|
+
}, {
|
|
8797
|
+
readonly type: "event";
|
|
8798
|
+
readonly name: "Transfer";
|
|
8799
|
+
readonly inputs: readonly [{
|
|
8800
|
+
readonly name: "from";
|
|
8801
|
+
readonly type: "address";
|
|
8802
|
+
readonly indexed: true;
|
|
8803
|
+
}, {
|
|
8804
|
+
readonly name: "to";
|
|
8805
|
+
readonly type: "address";
|
|
8806
|
+
readonly indexed: true;
|
|
8807
|
+
}, {
|
|
8808
|
+
readonly name: "value";
|
|
8809
|
+
readonly type: "uint256";
|
|
8810
|
+
readonly indexed: false;
|
|
8811
|
+
}];
|
|
8812
|
+
}, {
|
|
8813
|
+
readonly type: "event";
|
|
8814
|
+
readonly name: "Approval";
|
|
8815
|
+
readonly inputs: readonly [{
|
|
8816
|
+
readonly name: "owner";
|
|
8817
|
+
readonly type: "address";
|
|
8818
|
+
readonly indexed: true;
|
|
8819
|
+
}, {
|
|
8820
|
+
readonly name: "spender";
|
|
8821
|
+
readonly type: "address";
|
|
8822
|
+
readonly indexed: true;
|
|
8823
|
+
}, {
|
|
8824
|
+
readonly name: "value";
|
|
8825
|
+
readonly type: "uint256";
|
|
8826
|
+
readonly indexed: false;
|
|
8827
|
+
}];
|
|
8828
|
+
}];
|
|
8829
|
+
/**
|
|
8830
|
+
* Legacy ERC-20s (MKR and friends) predate the standard's `string` return and
|
|
8831
|
+
* answer `symbol()`/`name()` with a right-padded `bytes32`. Decoding one against
|
|
8832
|
+
* {@link erc20Abi} fails, so metadata readers retry with THIS ABI — the reason
|
|
8833
|
+
* viem ships the same pair.
|
|
8834
|
+
*/
|
|
8835
|
+
declare const erc20Abi_bytes32: readonly [{
|
|
8836
|
+
readonly type: "function";
|
|
8837
|
+
readonly name: "name";
|
|
8838
|
+
readonly stateMutability: "view";
|
|
8839
|
+
readonly inputs: readonly [];
|
|
8840
|
+
readonly outputs: readonly [{
|
|
8841
|
+
readonly name: "";
|
|
8842
|
+
readonly type: "bytes32";
|
|
8843
|
+
}];
|
|
8844
|
+
}, {
|
|
8845
|
+
readonly type: "function";
|
|
8846
|
+
readonly name: "symbol";
|
|
8847
|
+
readonly stateMutability: "view";
|
|
8848
|
+
readonly inputs: readonly [];
|
|
8849
|
+
readonly outputs: readonly [{
|
|
8850
|
+
readonly name: "";
|
|
8851
|
+
readonly type: "bytes32";
|
|
8852
|
+
}];
|
|
8853
|
+
}];
|
|
8854
|
+
|
|
8855
|
+
/**
|
|
8856
|
+
* ERC-721 — non-fungible token standard.
|
|
8857
|
+
*
|
|
8858
|
+
* The read surface plus the metadata extension (`tokenURI`), which is what NFT
|
|
8859
|
+
* image resolution needs.
|
|
8860
|
+
*/
|
|
8861
|
+
/** ERC-721, the read surface plus the metadata extension. */
|
|
8862
|
+
declare const erc721Abi: readonly [{
|
|
8863
|
+
readonly type: "function";
|
|
8864
|
+
readonly name: "balanceOf";
|
|
8865
|
+
readonly stateMutability: "view";
|
|
8866
|
+
readonly inputs: readonly [{
|
|
8867
|
+
readonly name: "owner";
|
|
8868
|
+
readonly type: "address";
|
|
8869
|
+
}];
|
|
8870
|
+
readonly outputs: readonly [{
|
|
8871
|
+
readonly name: "";
|
|
8872
|
+
readonly type: "uint256";
|
|
8873
|
+
}];
|
|
8874
|
+
}, {
|
|
8875
|
+
readonly type: "function";
|
|
8876
|
+
readonly name: "ownerOf";
|
|
8877
|
+
readonly stateMutability: "view";
|
|
8878
|
+
readonly inputs: readonly [{
|
|
8879
|
+
readonly name: "tokenId";
|
|
8880
|
+
readonly type: "uint256";
|
|
8881
|
+
}];
|
|
8882
|
+
readonly outputs: readonly [{
|
|
8883
|
+
readonly name: "";
|
|
8884
|
+
readonly type: "address";
|
|
8885
|
+
}];
|
|
8886
|
+
}, {
|
|
8887
|
+
readonly type: "function";
|
|
8888
|
+
readonly name: "name";
|
|
8889
|
+
readonly stateMutability: "view";
|
|
8890
|
+
readonly inputs: readonly [];
|
|
8891
|
+
readonly outputs: readonly [{
|
|
8892
|
+
readonly name: "";
|
|
8893
|
+
readonly type: "string";
|
|
8894
|
+
}];
|
|
8895
|
+
}, {
|
|
8896
|
+
readonly type: "function";
|
|
8897
|
+
readonly name: "symbol";
|
|
8898
|
+
readonly stateMutability: "view";
|
|
8899
|
+
readonly inputs: readonly [];
|
|
8900
|
+
readonly outputs: readonly [{
|
|
8901
|
+
readonly name: "";
|
|
8902
|
+
readonly type: "string";
|
|
8903
|
+
}];
|
|
8904
|
+
}, {
|
|
8905
|
+
readonly type: "function";
|
|
8906
|
+
readonly name: "tokenURI";
|
|
8907
|
+
readonly stateMutability: "view";
|
|
8908
|
+
readonly inputs: readonly [{
|
|
8909
|
+
readonly name: "tokenId";
|
|
8910
|
+
readonly type: "uint256";
|
|
8911
|
+
}];
|
|
8912
|
+
readonly outputs: readonly [{
|
|
8913
|
+
readonly name: "";
|
|
8914
|
+
readonly type: "string";
|
|
8915
|
+
}];
|
|
8916
|
+
}, {
|
|
8917
|
+
readonly type: "function";
|
|
8918
|
+
readonly name: "totalSupply";
|
|
8919
|
+
readonly stateMutability: "view";
|
|
8920
|
+
readonly inputs: readonly [];
|
|
8921
|
+
readonly outputs: readonly [{
|
|
8922
|
+
readonly name: "";
|
|
8923
|
+
readonly type: "uint256";
|
|
8924
|
+
}];
|
|
8925
|
+
}];
|
|
8926
|
+
|
|
8927
|
+
/**
|
|
8928
|
+
* ERC-1155 — multi-token standard.
|
|
8929
|
+
*
|
|
8930
|
+
* The metadata read (`uri`) plus the per-id balance, for NFT image resolution.
|
|
8931
|
+
*/
|
|
8932
|
+
/** ERC-1155 metadata read, for NFT image resolution. */
|
|
8933
|
+
declare const erc1155Abi: readonly [{
|
|
8934
|
+
readonly type: "function";
|
|
8935
|
+
readonly name: "uri";
|
|
8936
|
+
readonly stateMutability: "view";
|
|
8937
|
+
readonly inputs: readonly [{
|
|
8938
|
+
readonly name: "id";
|
|
8939
|
+
readonly type: "uint256";
|
|
8940
|
+
}];
|
|
8941
|
+
readonly outputs: readonly [{
|
|
8942
|
+
readonly name: "";
|
|
8943
|
+
readonly type: "string";
|
|
8944
|
+
}];
|
|
8945
|
+
}, {
|
|
8946
|
+
readonly type: "function";
|
|
8947
|
+
readonly name: "balanceOf";
|
|
8948
|
+
readonly stateMutability: "view";
|
|
8949
|
+
readonly inputs: readonly [{
|
|
8950
|
+
readonly name: "account";
|
|
8951
|
+
readonly type: "address";
|
|
8952
|
+
}, {
|
|
8953
|
+
readonly name: "id";
|
|
8954
|
+
readonly type: "uint256";
|
|
8955
|
+
}];
|
|
8956
|
+
readonly outputs: readonly [{
|
|
8957
|
+
readonly name: "";
|
|
8958
|
+
readonly type: "uint256";
|
|
8959
|
+
}];
|
|
8960
|
+
}];
|
|
8961
|
+
|
|
8962
|
+
/**
|
|
8963
|
+
* Transport constructor — takes a raw `request` fn and returns the instance a
|
|
8964
|
+
* client consumes: retry-wrapped `request`, plus the resolved config so the
|
|
8965
|
+
* client (and errors) can report which endpoint they used.
|
|
8966
|
+
*/
|
|
8967
|
+
|
|
8968
|
+
interface CreateTransportParameters<TType extends string = string> {
|
|
8969
|
+
key: string;
|
|
8970
|
+
name: string;
|
|
8971
|
+
type: TType;
|
|
8972
|
+
request: EIP1193RequestFn;
|
|
8973
|
+
retryCount?: number;
|
|
8974
|
+
retryDelay?: number;
|
|
8975
|
+
timeout?: number;
|
|
8976
|
+
}
|
|
8977
|
+
declare function createTransport<TType extends string, TValue = unknown>({ key, name, type, request, retryCount, retryDelay, timeout }: CreateTransportParameters<TType>, value?: TValue): TransportInstance<TType, TValue>;
|
|
8280
8978
|
|
|
8281
8979
|
/** Normalized, `fetch`-like response. `data` is the parsed body (JSON when possible). */
|
|
8282
8980
|
interface ApiResponse<T = unknown> {
|
|
@@ -8326,6 +9024,792 @@ declare class ApiClient {
|
|
|
8326
9024
|
/** Shared default client (bot User-Agent, no base URL) for ad-hoc absolute-URL calls. */
|
|
8327
9025
|
declare const apiClient: ApiClient;
|
|
8328
9026
|
|
|
9027
|
+
/**
|
|
9028
|
+
* HTTP transport — `http(url?, config?)`, the default way a client reaches a node.
|
|
9029
|
+
*
|
|
9030
|
+
* Mirrors viem's: an explicit URL wins, otherwise the client's chain supplies one
|
|
9031
|
+
* (already override-aware, see `chains/registry.ts`). With `batch` enabled,
|
|
9032
|
+
* requests raised in the same tick are coalesced into ONE JSON-RPC batch POST —
|
|
9033
|
+
* a separate, lower-level saving than `multicall`, and they compose: a batched
|
|
9034
|
+
* multicall chunk set becomes a single HTTP round-trip.
|
|
9035
|
+
*
|
|
9036
|
+
* ```ts
|
|
9037
|
+
* const client = createPublicClient({ chain: base, transport: http() });
|
|
9038
|
+
* const fast = createPublicClient({ chain: base, transport: http(url, { batch: true }) });
|
|
9039
|
+
* ```
|
|
9040
|
+
*/
|
|
9041
|
+
|
|
9042
|
+
interface HttpTransportConfig {
|
|
9043
|
+
/**
|
|
9044
|
+
* Coalesce requests made in the same tick into one JSON-RPC batch POST.
|
|
9045
|
+
* `true` uses the defaults below; an object tunes them.
|
|
9046
|
+
*/
|
|
9047
|
+
batch?: boolean | {
|
|
9048
|
+
/** Max requests per batch (default 1000). */
|
|
9049
|
+
batchSize?: number;
|
|
9050
|
+
/** Extra ms to keep collecting before sending (default 0 — same tick). */
|
|
9051
|
+
wait?: number;
|
|
9052
|
+
};
|
|
9053
|
+
/** Extra options merged into every HTTP request (headers, signal …). */
|
|
9054
|
+
fetchOptions?: RequestOptions;
|
|
9055
|
+
key?: string;
|
|
9056
|
+
name?: string;
|
|
9057
|
+
/** Retries per request (default 3). */
|
|
9058
|
+
retryCount?: number;
|
|
9059
|
+
/** Base backoff in ms (default 150, doubling each attempt). */
|
|
9060
|
+
retryDelay?: number;
|
|
9061
|
+
/** Per-request timeout in ms (default 10_000). */
|
|
9062
|
+
timeout?: number;
|
|
9063
|
+
}
|
|
9064
|
+
interface HttpTransportValue {
|
|
9065
|
+
url: string;
|
|
9066
|
+
}
|
|
9067
|
+
declare function http(url?: string, config?: HttpTransportConfig): Transport<'http', HttpTransportValue>;
|
|
9068
|
+
|
|
9069
|
+
/**
|
|
9070
|
+
* Fallback transport — `fallback([http(a), http(b)])`.
|
|
9071
|
+
*
|
|
9072
|
+
* Sends to the first transport; if the failure is the ENDPOINT's (a rate limit,
|
|
9073
|
+
* a 5xx, a timeout, or a 401/403 rejecting our key), moves to the next. Errors
|
|
9074
|
+
* that describe a bad request, or a reverting call, are thrown immediately:
|
|
9075
|
+
* trying another node would only produce the same answer more slowly.
|
|
9076
|
+
*
|
|
9077
|
+
* Note this is WIDER than the retry policy: an auth failure is pointless to
|
|
9078
|
+
* retry against the same URL but perfectly worth sending to a different
|
|
9079
|
+
* provider — see `shouldTryNextEndpoint` vs `shouldRetryError`.
|
|
9080
|
+
*
|
|
9081
|
+
* The fallback's own `retryCount` defaults to 0 — each inner transport already
|
|
9082
|
+
* retries itself, and retrying the whole chain on top of that multiplies the
|
|
9083
|
+
* worst-case latency.
|
|
9084
|
+
*/
|
|
9085
|
+
|
|
9086
|
+
interface FallbackTransportConfig {
|
|
9087
|
+
key?: string;
|
|
9088
|
+
name?: string;
|
|
9089
|
+
/** Retries of the WHOLE chain (default 0 — the inner transports retry already). */
|
|
9090
|
+
retryCount?: number;
|
|
9091
|
+
retryDelay?: number;
|
|
9092
|
+
/** Called whenever one transport fails and the next is tried. */
|
|
9093
|
+
onTransportError?: (args: {
|
|
9094
|
+
error: unknown;
|
|
9095
|
+
index: number;
|
|
9096
|
+
method: string;
|
|
9097
|
+
}) => void;
|
|
9098
|
+
}
|
|
9099
|
+
interface FallbackTransportValue {
|
|
9100
|
+
transports: TransportInstance[];
|
|
9101
|
+
}
|
|
9102
|
+
declare function fallback(transports: readonly Transport[], config?: FallbackTransportConfig): Transport<'fallback', FallbackTransportValue>;
|
|
9103
|
+
|
|
9104
|
+
/**
|
|
9105
|
+
* JS values → JSON-RPC wire format.
|
|
9106
|
+
*
|
|
9107
|
+
* The RPC wants hex quantities and no `undefined` members; the action layer wants
|
|
9108
|
+
* plain `bigint`/`number`. These are the only two places that translate, so the
|
|
9109
|
+
* actions stay readable — viem's `formatTransactionRequest` / `serializeStateOverride`.
|
|
9110
|
+
*/
|
|
9111
|
+
|
|
9112
|
+
/** A transaction request as the actions accept it (plain numbers, no hex). */
|
|
9113
|
+
interface TransactionRequest {
|
|
9114
|
+
/** `from` — the sender an `eth_call` is simulated as. */
|
|
9115
|
+
account?: Address;
|
|
9116
|
+
to?: Address;
|
|
9117
|
+
data?: Hex;
|
|
9118
|
+
value?: bigint;
|
|
9119
|
+
gas?: bigint;
|
|
9120
|
+
gasPrice?: bigint;
|
|
9121
|
+
maxFeePerGas?: bigint;
|
|
9122
|
+
maxPriorityFeePerGas?: bigint;
|
|
9123
|
+
nonce?: number;
|
|
9124
|
+
}
|
|
9125
|
+
/** Per-address overrides applied to the state a call runs against. */
|
|
9126
|
+
interface StateOverrideAccount {
|
|
9127
|
+
balance?: bigint;
|
|
9128
|
+
nonce?: number;
|
|
9129
|
+
code?: Hex;
|
|
9130
|
+
/** Replaces the account's WHOLE storage. */
|
|
9131
|
+
state?: Record<Hex, Hex>;
|
|
9132
|
+
/** Patches individual storage slots, leaving the rest intact. */
|
|
9133
|
+
stateDiff?: Record<Hex, Hex>;
|
|
9134
|
+
}
|
|
9135
|
+
/** `eth_call`'s third parameter: address → overrides. */
|
|
9136
|
+
type StateOverride = Record<Address, StateOverrideAccount>;
|
|
9137
|
+
|
|
9138
|
+
/**
|
|
9139
|
+
* `call` — a read-only `eth_call`, and the base every contract read sits on.
|
|
9140
|
+
*
|
|
9141
|
+
* Beyond forwarding the RPC it does two things worth knowing about:
|
|
9142
|
+
*
|
|
9143
|
+
* - AUTOMATIC MULTICALL BATCHING. When the client was created with
|
|
9144
|
+
* `batch: { multicall: true }`, plain reads issued in the same tick are
|
|
9145
|
+
* folded into ONE Multicall3 `aggregate3` — so code that just awaits a dozen
|
|
9146
|
+
* `readContract`s in parallel gets one round-trip without being rewritten.
|
|
9147
|
+
* Anything ineligible (a value transfer, an explicit gas/nonce, a state
|
|
9148
|
+
* override) silently takes the normal path.
|
|
9149
|
+
* - TYPED FAILURES. A revert arrives as an RPC error carrying the revert bytes;
|
|
9150
|
+
* they are kept on the error chain so `readContract`/`multicall` can decode
|
|
9151
|
+
* the reason against the contract's ABI.
|
|
9152
|
+
*/
|
|
9153
|
+
|
|
9154
|
+
interface CallParameters extends TransactionRequest, BlockParameters {
|
|
9155
|
+
/** Temporary state (balances, code, storage) the call is simulated against. */
|
|
9156
|
+
stateOverride?: StateOverride;
|
|
9157
|
+
}
|
|
9158
|
+
interface CallReturnType {
|
|
9159
|
+
/** Return data, or `undefined` when the call returned nothing (`0x`). */
|
|
9160
|
+
data: Hex | undefined;
|
|
9161
|
+
}
|
|
9162
|
+
/**
|
|
9163
|
+
* Execute a read-only call.
|
|
9164
|
+
*
|
|
9165
|
+
* `blockNumber` / `blockTag` pin the height (default `latest`); `stateOverride`
|
|
9166
|
+
* simulates against modified state.
|
|
9167
|
+
*/
|
|
9168
|
+
declare function call(client: Client, args: CallParameters): Promise<CallReturnType>;
|
|
9169
|
+
|
|
9170
|
+
/**
|
|
9171
|
+
* `readContract` — one read: encode the call, send it, decode the return.
|
|
9172
|
+
*
|
|
9173
|
+
* The whole point of the layer: callers name a function and get a JS value back,
|
|
9174
|
+
* with failures already translated into a typed, self-describing error.
|
|
9175
|
+
*/
|
|
9176
|
+
|
|
9177
|
+
interface ReadContractParameters extends ContractFunctionParameters, BlockParameters {
|
|
9178
|
+
/** Sender the read is simulated as (`msg.sender` inside the contract). */
|
|
9179
|
+
account?: Address;
|
|
9180
|
+
stateOverride?: StateOverride;
|
|
9181
|
+
}
|
|
9182
|
+
/**
|
|
9183
|
+
* Call a `view`/`pure` function and return its decoded result.
|
|
9184
|
+
*
|
|
9185
|
+
* The return is unwrapped like viem's: a single output comes back as the value
|
|
9186
|
+
* itself, multiple outputs as an array, no outputs as `undefined`.
|
|
9187
|
+
*
|
|
9188
|
+
* ```ts
|
|
9189
|
+
* const balance = await readContract(client, {
|
|
9190
|
+
* address: usdc, abi: erc20Abi, functionName: 'balanceOf', args: [owner],
|
|
9191
|
+
* }); // bigint
|
|
9192
|
+
* ```
|
|
9193
|
+
*
|
|
9194
|
+
* Throws `ContractFunctionExecutionError`; walk its `cause` for the decoded
|
|
9195
|
+
* revert (`ContractFunctionRevertedError`) or the "returned 0x" case
|
|
9196
|
+
* (`ContractFunctionZeroDataError`).
|
|
9197
|
+
*/
|
|
9198
|
+
declare function readContract<TResult = unknown>(client: Client, parameters: ReadContractParameters): Promise<TResult>;
|
|
9199
|
+
|
|
9200
|
+
/**
|
|
9201
|
+
* `multicall` — many contract reads, one (or a few) RPC round-trips, via
|
|
9202
|
+
* Multicall3's `aggregate3`.
|
|
9203
|
+
*
|
|
9204
|
+
* Feature-for-feature with viem's:
|
|
9205
|
+
*
|
|
9206
|
+
* - `allowFailure` (default `true`) → results are `{ status, result | error }`,
|
|
9207
|
+
* so ONE reverting call never sinks the batch. `false` → plain values, and the
|
|
9208
|
+
* first failure throws.
|
|
9209
|
+
* - `batchSize` (default 1024 BYTES of calldata, or the client's
|
|
9210
|
+
* `batch.multicall.batchSize`) → oversized sets are split into several
|
|
9211
|
+
* `aggregate3` calls that run in parallel, keeping any single `eth_call`
|
|
9212
|
+
* under the node's response/gas limits. `0` disables splitting.
|
|
9213
|
+
* - `multicallAddress` → override the chain's Multicall3 deployment.
|
|
9214
|
+
* - `blockNumber` / `blockTag` → read at a specific height.
|
|
9215
|
+
* - `stateOverride` → simulate the whole batch against modified state.
|
|
9216
|
+
* - results are POSITIONALLY ALIGNED with `contracts`, always, including entries
|
|
9217
|
+
* whose calldata could not even be encoded.
|
|
9218
|
+
*
|
|
9219
|
+
* ```ts
|
|
9220
|
+
* const results = await multicall(client, {
|
|
9221
|
+
* contracts: [
|
|
9222
|
+
* { address: usdc, abi: erc20Abi, functionName: 'symbol' },
|
|
9223
|
+
* { address: usdc, abi: erc20Abi, functionName: 'balanceOf', args: [owner] },
|
|
9224
|
+
* ],
|
|
9225
|
+
* });
|
|
9226
|
+
* // [{ status: 'success', result: 'USDC' }, { status: 'success', result: 123n }]
|
|
9227
|
+
* ```
|
|
9228
|
+
*/
|
|
9229
|
+
|
|
9230
|
+
interface MulticallParameters extends BlockParameters {
|
|
9231
|
+
/** The reads to perform, in order. */
|
|
9232
|
+
contracts: readonly ContractFunctionParameters[];
|
|
9233
|
+
/** Keep going past a failing call (default `true`). */
|
|
9234
|
+
allowFailure?: boolean;
|
|
9235
|
+
/** Max calldata bytes per aggregated call; `0` disables splitting. */
|
|
9236
|
+
batchSize?: number;
|
|
9237
|
+
/** Multicall3 address override — required on a chain the registry doesn't know. */
|
|
9238
|
+
multicallAddress?: Address;
|
|
9239
|
+
/** Sender each read is simulated as. */
|
|
9240
|
+
account?: Address;
|
|
9241
|
+
stateOverride?: StateOverride;
|
|
9242
|
+
}
|
|
9243
|
+
declare function multicall(client: Client, parameters: MulticallParameters & {
|
|
9244
|
+
allowFailure?: true;
|
|
9245
|
+
}): Promise<MulticallResult[]>;
|
|
9246
|
+
declare function multicall(client: Client, parameters: MulticallParameters & {
|
|
9247
|
+
allowFailure: false;
|
|
9248
|
+
}): Promise<unknown[]>;
|
|
9249
|
+
declare function multicall(client: Client, parameters: MulticallParameters): Promise<MulticallResult[] | unknown[]>;
|
|
9250
|
+
|
|
9251
|
+
/**
|
|
9252
|
+
* `multicallRaw` — the ABI-less escape hatch under {@link file://./multicall.ts}.
|
|
9253
|
+
*
|
|
9254
|
+
* Same batching, but calls go in as PRE-ENCODED calldata and come back as raw
|
|
9255
|
+
* return data. Use it when there is no ABI to decode against:
|
|
9256
|
+
* - hand-rolled selectors (`0x70a08231` + a padded address),
|
|
9257
|
+
* - non-standard returns a strict decoder would reject (legacy `bytes32`
|
|
9258
|
+
* symbols, contracts that right-pad their strings),
|
|
9259
|
+
* - anything that wants to inspect the bytes before deciding what they mean.
|
|
9260
|
+
*
|
|
9261
|
+
* Prefer {@link file://./multicall.ts} when you do have an ABI: it decodes and
|
|
9262
|
+
* gives typed per-entry errors. This one only ever reports `success: false`.
|
|
9263
|
+
*
|
|
9264
|
+
* Beyond viem's parameters it takes `maxCalls`, a cap on the number of calls per
|
|
9265
|
+
* batch. viem's `batchSize` bounds the REQUEST (calldata bytes); `maxCalls`
|
|
9266
|
+
* bounds the RESPONSE, which is what matters for reads whose returns are large
|
|
9267
|
+
* and unpredictable — on-chain `data:` token URIs being the case this core hits.
|
|
9268
|
+
*/
|
|
9269
|
+
|
|
9270
|
+
/** One pre-encoded call. */
|
|
9271
|
+
interface RawCall {
|
|
9272
|
+
target: Address;
|
|
9273
|
+
callData: Hex;
|
|
9274
|
+
}
|
|
9275
|
+
/** Multicall3's own per-call outcome, undecoded. */
|
|
9276
|
+
interface RawCallResult {
|
|
9277
|
+
success: boolean;
|
|
9278
|
+
returnData: Hex;
|
|
9279
|
+
}
|
|
9280
|
+
interface MulticallRawParameters extends BlockParameters {
|
|
9281
|
+
calls: readonly RawCall[];
|
|
9282
|
+
/** Max calldata bytes per aggregate3 (default 1024); `0` disables the split. */
|
|
9283
|
+
batchSize?: number;
|
|
9284
|
+
/** Max calls per aggregate3 (default 50) — bounds the RESPONSE size. */
|
|
9285
|
+
maxCalls?: number;
|
|
9286
|
+
multicallAddress?: Address;
|
|
9287
|
+
account?: Address;
|
|
9288
|
+
stateOverride?: StateOverride;
|
|
9289
|
+
}
|
|
9290
|
+
/**
|
|
9291
|
+
* Run pre-encoded calls through `aggregate3`, chunked and in parallel.
|
|
9292
|
+
*
|
|
9293
|
+
* NEVER throws for a partial failure: a chunk whose RPC round-trip fails marks
|
|
9294
|
+
* only ITS OWN entries `success: false`, so one bad batch can't sink the rest.
|
|
9295
|
+
* Results are positionally aligned with `calls`.
|
|
9296
|
+
*
|
|
9297
|
+
* Throws only for a misconfiguration that makes the whole call impossible —
|
|
9298
|
+
* no chain on the client and no `multicallAddress`.
|
|
9299
|
+
*/
|
|
9300
|
+
declare function multicallRaw(client: Client, parameters: MulticallRawParameters): Promise<RawCallResult[]>;
|
|
9301
|
+
|
|
9302
|
+
/**
|
|
9303
|
+
* Thin chain-state reads — the actions that are a single RPC method plus
|
|
9304
|
+
* hex↔bigint conversion, grouped here rather than spread over a file each.
|
|
9305
|
+
*
|
|
9306
|
+
* (`call`, `readContract` and `multicall` earn their own files: they have real
|
|
9307
|
+
* behaviour — batching, encoding, error translation — behind them.)
|
|
9308
|
+
*/
|
|
9309
|
+
|
|
9310
|
+
/** Latest block number. */
|
|
9311
|
+
declare function getBlockNumber(client: Client): Promise<bigint>;
|
|
9312
|
+
/** The chain id the endpoint actually serves — worth checking against `client.chain`. */
|
|
9313
|
+
declare function getChainId(client: Client): Promise<number>;
|
|
9314
|
+
/** Native-coin balance of an address, in wei. */
|
|
9315
|
+
declare function getBalance(client: Client, { address, ...block }: {
|
|
9316
|
+
address: Address;
|
|
9317
|
+
} & BlockParameters): Promise<bigint>;
|
|
9318
|
+
/** Deployed bytecode at an address — `undefined` for an EOA or empty account. */
|
|
9319
|
+
declare function getCode(client: Client, { address, ...block }: {
|
|
9320
|
+
address: Address;
|
|
9321
|
+
} & BlockParameters): Promise<Hex | undefined>;
|
|
9322
|
+
/** Raw storage slot of a contract. */
|
|
9323
|
+
declare function getStorageAt(client: Client, { address, slot, ...block }: {
|
|
9324
|
+
address: Address;
|
|
9325
|
+
slot: Hex;
|
|
9326
|
+
} & BlockParameters): Promise<Hex | undefined>;
|
|
9327
|
+
/** Transaction count of an address — i.e. its next nonce. */
|
|
9328
|
+
declare function getTransactionCount(client: Client, { address, ...block }: {
|
|
9329
|
+
address: Address;
|
|
9330
|
+
} & BlockParameters): Promise<number>;
|
|
9331
|
+
/** Current gas price, in wei. */
|
|
9332
|
+
declare function getGasPrice(client: Client): Promise<bigint>;
|
|
9333
|
+
/** Gas a transaction would consume. */
|
|
9334
|
+
declare function estimateGas(client: Client, { blockNumber, blockTag, ...request }: TransactionRequest & BlockParameters): Promise<bigint>;
|
|
9335
|
+
/** A block, as the node returns it (hex quantities left untouched). */
|
|
9336
|
+
interface RpcBlock {
|
|
9337
|
+
number?: Hex;
|
|
9338
|
+
hash?: Hex;
|
|
9339
|
+
parentHash?: Hex;
|
|
9340
|
+
timestamp?: Hex;
|
|
9341
|
+
gasLimit?: Hex;
|
|
9342
|
+
gasUsed?: Hex;
|
|
9343
|
+
baseFeePerGas?: Hex;
|
|
9344
|
+
transactions?: unknown[];
|
|
9345
|
+
[key: string]: unknown;
|
|
9346
|
+
}
|
|
9347
|
+
/** A block, with the numeric fields decoded. */
|
|
9348
|
+
interface Block extends RpcBlock {
|
|
9349
|
+
blockNumber?: bigint;
|
|
9350
|
+
blockTimestamp?: bigint;
|
|
9351
|
+
baseFee?: bigint;
|
|
9352
|
+
}
|
|
9353
|
+
/** Fetch a block by number/tag. `includeTransactions` returns full tx objects. */
|
|
9354
|
+
declare function getBlock(client: Client, { includeTransactions, ...block }?: {
|
|
9355
|
+
includeTransactions?: boolean;
|
|
9356
|
+
} & BlockParameters): Promise<Block | null>;
|
|
9357
|
+
|
|
9358
|
+
/**
|
|
9359
|
+
* `PublicClient` — the read-only client, and the object most callers hold.
|
|
9360
|
+
*
|
|
9361
|
+
* Same model as viem: a chain + a transport, with the actions exposed as methods.
|
|
9362
|
+
* Written as a CLASS here (rather than viem's object spread) because it is what
|
|
9363
|
+
* this codebase's services look like, and because it makes the surface
|
|
9364
|
+
* discoverable — `client.` lists every read the core can do.
|
|
9365
|
+
*
|
|
9366
|
+
* ```ts
|
|
9367
|
+
* const client = createPublicClient({ chain: base, transport: http() });
|
|
9368
|
+
* const symbol = await client.readContract({ address, abi: erc20Abi, functionName: 'symbol' });
|
|
9369
|
+
* const many = await client.multicall({ contracts });
|
|
9370
|
+
* ```
|
|
9371
|
+
*
|
|
9372
|
+
* Everything on it is READ-ONLY on purpose: this core never holds a private key —
|
|
9373
|
+
* transactions are handed to the wallet app to sign — so there is no
|
|
9374
|
+
* `WalletClient` counterpart, by design rather than omission.
|
|
9375
|
+
*/
|
|
9376
|
+
|
|
9377
|
+
interface PublicClientConfig {
|
|
9378
|
+
/** Chain object, hex id (`'0x2105'`) or decimal id (`8453`). */
|
|
9379
|
+
chain?: Chain | string | number;
|
|
9380
|
+
/** How to reach the node. Defaults to `http()` on the chain's RPC URL. */
|
|
9381
|
+
transport?: Transport;
|
|
9382
|
+
/**
|
|
9383
|
+
* Shortcut for `transport: http(rpcUrl)` — the common case in this core, where
|
|
9384
|
+
* the host app supplies an endpoint per chain.
|
|
9385
|
+
*/
|
|
9386
|
+
rpcUrl?: string;
|
|
9387
|
+
/** Batching policy; `{ multicall: true }` folds parallel reads into aggregate3. */
|
|
9388
|
+
batch?: ClientBatchConfig;
|
|
9389
|
+
key?: string;
|
|
9390
|
+
name?: string;
|
|
9391
|
+
/** Retries per request (default 3). */
|
|
9392
|
+
retryCount?: number;
|
|
9393
|
+
/** Base retry backoff in ms (default 150). */
|
|
9394
|
+
retryDelay?: number;
|
|
9395
|
+
/** Per-request timeout in ms (default 10_000). */
|
|
9396
|
+
timeout?: number;
|
|
9397
|
+
}
|
|
9398
|
+
declare class PublicClient implements Client {
|
|
9399
|
+
readonly key: string;
|
|
9400
|
+
readonly name: string;
|
|
9401
|
+
readonly uid: string;
|
|
9402
|
+
readonly chain?: Chain;
|
|
9403
|
+
readonly transport: TransportConfig & Record<string, unknown>;
|
|
9404
|
+
readonly batch?: ClientBatchConfig;
|
|
9405
|
+
/** EIP-1193 request fn — retry-wrapped by the transport. */
|
|
9406
|
+
readonly request: EIP1193RequestFn;
|
|
9407
|
+
constructor(config?: PublicClientConfig);
|
|
9408
|
+
/** {@link file://../actions/call.ts} */
|
|
9409
|
+
call(parameters: CallParameters): Promise<CallReturnType>;
|
|
9410
|
+
/** {@link file://../actions/readContract.ts} */
|
|
9411
|
+
readContract<TResult = unknown>(parameters: ReadContractParameters): Promise<TResult>;
|
|
9412
|
+
/** {@link file://../actions/multicall.ts} */
|
|
9413
|
+
multicall(parameters: MulticallParameters & {
|
|
9414
|
+
allowFailure?: true;
|
|
9415
|
+
}): Promise<MulticallResult[]>;
|
|
9416
|
+
multicall(parameters: MulticallParameters & {
|
|
9417
|
+
allowFailure: false;
|
|
9418
|
+
}): Promise<unknown[]>;
|
|
9419
|
+
/** {@link file://../actions/multicallRaw.ts} — pre-encoded calldata, raw returns. */
|
|
9420
|
+
multicallRaw(parameters: MulticallRawParameters): Promise<RawCallResult[]>;
|
|
9421
|
+
getBlockNumber(): Promise<bigint>;
|
|
9422
|
+
getChainId(): Promise<number>;
|
|
9423
|
+
getBalance(parameters: {
|
|
9424
|
+
address: Address;
|
|
9425
|
+
} & BlockParameters): Promise<bigint>;
|
|
9426
|
+
getCode(parameters: {
|
|
9427
|
+
address: Address;
|
|
9428
|
+
} & BlockParameters): Promise<Hex | undefined>;
|
|
9429
|
+
getStorageAt(parameters: {
|
|
9430
|
+
address: Address;
|
|
9431
|
+
slot: Hex;
|
|
9432
|
+
} & BlockParameters): Promise<Hex | undefined>;
|
|
9433
|
+
getTransactionCount(parameters: {
|
|
9434
|
+
address: Address;
|
|
9435
|
+
} & BlockParameters): Promise<number>;
|
|
9436
|
+
getGasPrice(): Promise<bigint>;
|
|
9437
|
+
estimateMaxPriorityFeePerGas(): Promise<bigint>;
|
|
9438
|
+
estimateGas(parameters: TransactionRequest & BlockParameters): Promise<bigint>;
|
|
9439
|
+
getBlock(parameters?: {
|
|
9440
|
+
includeTransactions?: boolean;
|
|
9441
|
+
} & BlockParameters): Promise<Block | null>;
|
|
9442
|
+
/** Raw JSON-RPC, for methods this client doesn't wrap. */
|
|
9443
|
+
rpc<TResult = unknown>(method: string, params?: unknown[]): Promise<TResult>;
|
|
9444
|
+
/**
|
|
9445
|
+
* Attach custom actions — viem's `extend`. Returns a NEW client carrying both
|
|
9446
|
+
* the built-ins and whatever `fn` adds, so domain helpers can live on the
|
|
9447
|
+
* client without subclassing it.
|
|
9448
|
+
*
|
|
9449
|
+
* ```ts
|
|
9450
|
+
* const withToken = client.extend((c) => ({
|
|
9451
|
+
* balanceOf: (token, owner) =>
|
|
9452
|
+
* c.readContract({ address: token, abi: erc20Abi, functionName: 'balanceOf', args: [owner] }),
|
|
9453
|
+
* }));
|
|
9454
|
+
* ```
|
|
9455
|
+
*/
|
|
9456
|
+
extend<TExtension extends Record<string, unknown>>(fn: (client: this) => TExtension): this & TExtension;
|
|
9457
|
+
}
|
|
9458
|
+
/**
|
|
9459
|
+
* Create a read-only client — the entry point of the whole chain stack.
|
|
9460
|
+
*
|
|
9461
|
+
* ```ts
|
|
9462
|
+
* createPublicClient({ chain: '0x2105', transport: http() }); // Base, default RPC
|
|
9463
|
+
* createPublicClient({ chain: base, rpcUrl: 'https://…' }); // explicit endpoint
|
|
9464
|
+
* createPublicClient({ chain: base, transport: fallback([http(a), http(b)]) });
|
|
9465
|
+
* createPublicClient({ chain: base, transport: http(), batch: { multicall: true } });
|
|
9466
|
+
* ```
|
|
9467
|
+
*/
|
|
9468
|
+
declare function createPublicClient(config?: PublicClientConfig): PublicClient;
|
|
9469
|
+
|
|
9470
|
+
/**
|
|
9471
|
+
* Per-chain client cache — how the REST of this core gets a client.
|
|
9472
|
+
*
|
|
9473
|
+
* Services shouldn't each construct their own: a client is cheap but not free
|
|
9474
|
+
* (a transport instance, a uid, its own batch queues), and two clients on the
|
|
9475
|
+
* same chain would batch SEPARATELY, silently halving the benefit. One cached
|
|
9476
|
+
* instance per (chain, endpoint, batching) triple fixes both.
|
|
9477
|
+
*
|
|
9478
|
+
* The endpoint is part of the key, so a later {@link setRpcOverrides} simply
|
|
9479
|
+
* yields a different key — no invalidation hook, no stale client pinned to the
|
|
9480
|
+
* old URL.
|
|
9481
|
+
*
|
|
9482
|
+
* Clients built here are RESILIENT by default: a chain that declares several
|
|
9483
|
+
* endpoints gets a {@link fallback} transport over all of them, so a flaky
|
|
9484
|
+
* primary costs a retry rather than the whole read. Pass an explicit `rpcUrl` to
|
|
9485
|
+
* pin one endpoint and opt out.
|
|
9486
|
+
*/
|
|
9487
|
+
|
|
9488
|
+
interface GetPublicClientOptions {
|
|
9489
|
+
/**
|
|
9490
|
+
* PREFERRED endpoint for this client — tried first, with the chain's own
|
|
9491
|
+
* endpoints kept behind it as backups, exactly as a `setRpcOverrides` entry
|
|
9492
|
+
* behaves. A caller-supplied URL going down therefore degrades to the public
|
|
9493
|
+
* endpoints instead of failing the read.
|
|
9494
|
+
*/
|
|
9495
|
+
rpcUrl?: string;
|
|
9496
|
+
/**
|
|
9497
|
+
* Use ONLY `rpcUrl`, with no backups. For the rare caller that must not talk
|
|
9498
|
+
* to any other endpoint (a private or archive node whose answers differ from
|
|
9499
|
+
* a public one's). Ignored when `rpcUrl` is absent.
|
|
9500
|
+
*/
|
|
9501
|
+
pinRpcUrl?: boolean;
|
|
9502
|
+
/** Fold parallel reads into one aggregate3 (default `true` — see below). */
|
|
9503
|
+
batch?: boolean;
|
|
9504
|
+
}
|
|
9505
|
+
/**
|
|
9506
|
+
* The shared client for a chain, created on first use.
|
|
9507
|
+
*
|
|
9508
|
+
* Multicall batching is ON by default here (unlike a bare `createPublicClient`):
|
|
9509
|
+
* the core's tools routinely fire several independent reads per turn, and folding
|
|
9510
|
+
* them into one round-trip is the difference between one RPC hop and a dozen.
|
|
9511
|
+
*
|
|
9512
|
+
* Throws {@link ChainNotFoundError} when the chain is unknown AND no `rpcUrl` was
|
|
9513
|
+
* given — with a URL, an unknown chain still works for plain reads (only
|
|
9514
|
+
* multicall needs a known Multicall3 deployment).
|
|
9515
|
+
*/
|
|
9516
|
+
declare function getPublicClient(chainId: string | number, options?: GetPublicClientOptions): PublicClient;
|
|
9517
|
+
/**
|
|
9518
|
+
* Drop cached clients. Only needed in tests, or after swapping transports at
|
|
9519
|
+
* runtime — override changes are already handled by the cache key.
|
|
9520
|
+
*/
|
|
9521
|
+
declare function clearPublicClientCache(): void;
|
|
9522
|
+
|
|
9523
|
+
/**
|
|
9524
|
+
* Address helpers — EIP-55 checksumming and validation, matching viem's
|
|
9525
|
+
* `isAddress` / `getAddress` / `isAddressEqual`.
|
|
9526
|
+
*
|
|
9527
|
+
* The decoder returns CHECKSUMMED addresses (as viem does), so any comparison
|
|
9528
|
+
* against a lowercase literal must go through {@link isAddressEqual} rather than
|
|
9529
|
+
* `===`.
|
|
9530
|
+
*/
|
|
9531
|
+
|
|
9532
|
+
/** True for a well-formed 20-byte hex address (any casing). */
|
|
9533
|
+
declare function isAddress(value: unknown): value is Address;
|
|
9534
|
+
/**
|
|
9535
|
+
* EIP-55 checksum casing for an address. Assumes a well-formed input — use
|
|
9536
|
+
* {@link getAddress} when the value comes from outside.
|
|
9537
|
+
*/
|
|
9538
|
+
declare function checksumAddress(address: string): Address;
|
|
9539
|
+
/** Validate + checksum an address, throwing on anything malformed. */
|
|
9540
|
+
declare function getAddress(address: string): Address;
|
|
9541
|
+
/** Case-insensitive address comparison — the only correct way to compare two. */
|
|
9542
|
+
declare function isAddressEqual(a: string, b: string): boolean;
|
|
9543
|
+
|
|
9544
|
+
/**
|
|
9545
|
+
* Canonical ABI type formatting + the keccak-derived selectors built from it —
|
|
9546
|
+
* viem's `formatAbiItem` / `toFunctionSelector` / `toEventSelector` /
|
|
9547
|
+
* `toErrorSelector`, plus the array/type parsing the codec shares.
|
|
9548
|
+
*
|
|
9549
|
+
* A selector is keccak256(canonical signature): the signature MUST use canonical
|
|
9550
|
+
* types (`uint` → `uint256`, tuples flattened to `(a,b)`), which is the whole
|
|
9551
|
+
* reason this lives in one place instead of being spelled out at call sites.
|
|
9552
|
+
*/
|
|
9553
|
+
|
|
9554
|
+
/** 4-byte function selector from an ABI item or a signature string. */
|
|
9555
|
+
declare function toFunctionSelector(fn: AbiItem | string): Hex;
|
|
9556
|
+
/** 32-byte event topic0 from an ABI item or a signature string. */
|
|
9557
|
+
declare function toEventSelector(event: AbiItem | string): Hex;
|
|
9558
|
+
/**
|
|
9559
|
+
* Find one item on an ABI — viem's `getAbiItem`.
|
|
9560
|
+
*
|
|
9561
|
+
* `name` accepts three spellings, so callers can be as precise as they need:
|
|
9562
|
+
* a plain name (`'balanceOf'`), a full signature (`'balanceOf(address)'`), or a
|
|
9563
|
+
* 4-byte selector (`'0x70a08231'`). OVERLOADS are resolved with `args`: the
|
|
9564
|
+
* candidate whose input list matches the given arguments wins; without `args`
|
|
9565
|
+
* the first overload is used, exactly as viem does.
|
|
9566
|
+
*
|
|
9567
|
+
* Returns `undefined` rather than throwing — callers that require an item throw
|
|
9568
|
+
* {@link AbiItemNotFoundError} themselves (see {@link requireAbiItem}).
|
|
9569
|
+
*/
|
|
9570
|
+
declare function getAbiItem({ abi, name, args, type, }: {
|
|
9571
|
+
abi: readonly AbiItem[];
|
|
9572
|
+
name: string;
|
|
9573
|
+
args?: readonly unknown[];
|
|
9574
|
+
/** ABI item kind to search; defaults to `function`. */
|
|
9575
|
+
type?: string;
|
|
9576
|
+
}): AbiItem | undefined;
|
|
9577
|
+
|
|
9578
|
+
/**
|
|
9579
|
+
* ABI parameter ENCODER — head/tail layout per the Solidity ABI spec, mirroring
|
|
9580
|
+
* viem's `encodeAbiParameters` (same `PreparedParam` shape, same recursion).
|
|
9581
|
+
*
|
|
9582
|
+
* Sits next to {@link file://../decode/decodeAbiParameters.ts} so the two halves of
|
|
9583
|
+
* the codec share one set of type helpers.
|
|
9584
|
+
*/
|
|
9585
|
+
|
|
9586
|
+
/**
|
|
9587
|
+
* Encode `values` against `params` — the ABI-encoding entry point, positional
|
|
9588
|
+
* like viem's. Tuples accept either an object keyed by component name or a
|
|
9589
|
+
* positional array.
|
|
9590
|
+
*/
|
|
9591
|
+
declare function encodeAbiParameters(params: readonly AbiParameter[], values: readonly unknown[]): Hex;
|
|
9592
|
+
|
|
9593
|
+
/**
|
|
9594
|
+
* Calldata builders: selector + ABI-encoded arguments (viem's
|
|
9595
|
+
* `encodeFunctionData` / `encodeErrorResult`).
|
|
9596
|
+
*/
|
|
9597
|
+
|
|
9598
|
+
interface EncodeFunctionDataParameters {
|
|
9599
|
+
abi: Abi;
|
|
9600
|
+
/** Function name, full signature (`transfer(address,uint256)`) or 4-byte selector. */
|
|
9601
|
+
functionName: string;
|
|
9602
|
+
args?: readonly unknown[];
|
|
9603
|
+
}
|
|
9604
|
+
/**
|
|
9605
|
+
* Encode a function call — `0x` + 4-byte selector + arguments.
|
|
9606
|
+
*
|
|
9607
|
+
* Overloads are resolved from `args` (see `getAbiItem`), so an ABI carrying both
|
|
9608
|
+
* `safeTransferFrom(address,address,uint256)` and its 4-arg variant picks the one
|
|
9609
|
+
* matching what you passed.
|
|
9610
|
+
*/
|
|
9611
|
+
declare function encodeFunctionData({ abi, functionName, args }: EncodeFunctionDataParameters): Hex;
|
|
9612
|
+
interface EncodeErrorResultParameters {
|
|
9613
|
+
abi: Abi;
|
|
9614
|
+
errorName: string;
|
|
9615
|
+
args?: readonly unknown[];
|
|
9616
|
+
}
|
|
9617
|
+
/**
|
|
9618
|
+
* Encode a custom-error revert payload — the shape a reverting contract returns,
|
|
9619
|
+
* useful for tests and for round-tripping {@link file://../decode/decodeErrorResult.ts}.
|
|
9620
|
+
*/
|
|
9621
|
+
declare function encodeErrorResult({ abi, errorName, args }: EncodeErrorResultParameters): Hex;
|
|
9622
|
+
|
|
9623
|
+
/**
|
|
9624
|
+
* ABI parameter DECODER — the exact inverse of
|
|
9625
|
+
* {@link file://../encode/encodeAbiParameters.ts}, matching viem's `decodeAbiParameters`
|
|
9626
|
+
* in both coverage and return shapes:
|
|
9627
|
+
*
|
|
9628
|
+
* - `address` → EIP-55 CHECKSUMMED hex (compare with `isAddressEqual`, not `===`)
|
|
9629
|
+
* - `bool` → boolean
|
|
9630
|
+
* - `string` → string
|
|
9631
|
+
* - `bytes`/`bytesN` → 0x hex
|
|
9632
|
+
* - `(u)intN` → `number` for N ≤ 48, `bigint` above (viem's cut-off: 48 bits is
|
|
9633
|
+
* the largest that always fits a JS number exactly)
|
|
9634
|
+
* - `tuple` → object keyed by component name, or an array when any component
|
|
9635
|
+
* is unnamed
|
|
9636
|
+
* - arrays → arrays, fixed or dynamic, nested to any depth
|
|
9637
|
+
*
|
|
9638
|
+
* Every offset/length read is bounds-checked, so a truncated or non-ABI response
|
|
9639
|
+
* raises {@link AbiDecodingOutOfBoundsError} instead of returning silent garbage —
|
|
9640
|
+
* which is what lets `multicall` mark ONE entry as failed and keep the rest.
|
|
9641
|
+
*/
|
|
9642
|
+
|
|
9643
|
+
/**
|
|
9644
|
+
* Decode ABI-encoded `data` against `params`, positionally.
|
|
9645
|
+
*
|
|
9646
|
+
* Throws {@link AbiDecodingZeroDataError} for `0x` (the classic "not a contract
|
|
9647
|
+
* on this chain" signal) and {@link AbiDecodingDataSizeTooSmallError} /
|
|
9648
|
+
* {@link AbiDecodingOutOfBoundsError} for a payload that can't hold the shape —
|
|
9649
|
+
* never a partially-filled result.
|
|
9650
|
+
*/
|
|
9651
|
+
declare function decodeAbiParameters<T extends readonly unknown[] = readonly unknown[]>(params: readonly AbiParameter[], data: Hex | Uint8Array): T;
|
|
9652
|
+
|
|
9653
|
+
/**
|
|
9654
|
+
* Return-data decoders for a function call — viem's `decodeFunctionResult`, plus
|
|
9655
|
+
* `decodeFunctionData` for the calldata direction.
|
|
9656
|
+
*/
|
|
9657
|
+
|
|
9658
|
+
interface DecodeFunctionResultParameters {
|
|
9659
|
+
abi: Abi;
|
|
9660
|
+
/** Function name, full signature or 4-byte selector. */
|
|
9661
|
+
functionName: string;
|
|
9662
|
+
/** Args of the CALL — only used to pick between overloads. */
|
|
9663
|
+
args?: readonly unknown[];
|
|
9664
|
+
data: Hex;
|
|
9665
|
+
}
|
|
9666
|
+
/**
|
|
9667
|
+
* Decode a call's return data against its ABI outputs.
|
|
9668
|
+
*
|
|
9669
|
+
* Follows viem's unwrapping rule, which is what makes reads ergonomic:
|
|
9670
|
+
* - no outputs → `undefined`
|
|
9671
|
+
* - one output → that value directly (`balanceOf` → `bigint`)
|
|
9672
|
+
* - many outputs → the array of values (a named-tuple output still decodes to
|
|
9673
|
+
* an object, since that is the tuple's own shape)
|
|
9674
|
+
*/
|
|
9675
|
+
declare function decodeFunctionResult({ abi, functionName, args, data }: DecodeFunctionResultParameters): unknown;
|
|
9676
|
+
interface DecodeFunctionDataParameters {
|
|
9677
|
+
abi: Abi;
|
|
9678
|
+
data: Hex;
|
|
9679
|
+
}
|
|
9680
|
+
/**
|
|
9681
|
+
* Decode CALLDATA (selector + args) back into `{ functionName, args }` — the
|
|
9682
|
+
* inverse of `encodeFunctionData`. Handy for explaining a pending transaction to
|
|
9683
|
+
* the user before they sign it.
|
|
9684
|
+
*/
|
|
9685
|
+
declare function decodeFunctionData({ abi, data }: DecodeFunctionDataParameters): {
|
|
9686
|
+
functionName: string;
|
|
9687
|
+
args: readonly unknown[];
|
|
9688
|
+
};
|
|
9689
|
+
|
|
9690
|
+
/**
|
|
9691
|
+
* Revert-payload decoder — viem's `decodeErrorResult`.
|
|
9692
|
+
*
|
|
9693
|
+
* A reverting EVM call returns data in one of three shapes, and this resolves
|
|
9694
|
+
* all three:
|
|
9695
|
+
* - `Error(string)` — `require(cond, "reason")` / `revert("reason")`
|
|
9696
|
+
* - `Panic(uint256)` — compiler-inserted assertions (overflow, /0, bad index …),
|
|
9697
|
+
* whose codes are translated to the human sentences Solidity documents
|
|
9698
|
+
* - a CUSTOM error from the contract's own ABI
|
|
9699
|
+
*
|
|
9700
|
+
* That's what turns "execution reverted" into "ERC20: transfer amount exceeds
|
|
9701
|
+
* balance" in a tool's output, so it is worth having even though multicall marks
|
|
9702
|
+
* the entry failed either way.
|
|
9703
|
+
*/
|
|
9704
|
+
|
|
9705
|
+
interface DecodeErrorResultReturnType {
|
|
9706
|
+
/** Decoded error name (`Error`, `Panic`, or a custom one from the ABI). */
|
|
9707
|
+
errorName: string;
|
|
9708
|
+
/** Decoded arguments, `undefined` when the error takes none. */
|
|
9709
|
+
args?: readonly unknown[];
|
|
9710
|
+
/** The ABI item that matched. */
|
|
9711
|
+
abiItem: AbiItem;
|
|
9712
|
+
}
|
|
9713
|
+
/**
|
|
9714
|
+
* Decode revert data against `abi` plus the two built-in Solidity errors.
|
|
9715
|
+
* Throws when the payload is empty or its selector matches nothing — the caller
|
|
9716
|
+
* (the contract-error layer) then reports the raw data instead.
|
|
9717
|
+
*/
|
|
9718
|
+
declare function decodeErrorResult({ abi, data }: {
|
|
9719
|
+
abi?: Abi;
|
|
9720
|
+
data: Hex;
|
|
9721
|
+
}): DecodeErrorResultReturnType;
|
|
9722
|
+
/**
|
|
9723
|
+
* The one-line human reason for revert data, or `undefined` when it decodes to
|
|
9724
|
+
* nothing meaningful: the `require` string, the panic sentence, or
|
|
9725
|
+
* `CustomError(arg, arg)`.
|
|
9726
|
+
*/
|
|
9727
|
+
declare function getRevertReason({ abi, data }: {
|
|
9728
|
+
abi?: Abi;
|
|
9729
|
+
data: Hex;
|
|
9730
|
+
}): string | undefined;
|
|
9731
|
+
|
|
9732
|
+
/**
|
|
9733
|
+
* Human-readable ABI parser — viem's `parseAbi` / `parseAbiItem` /
|
|
9734
|
+
* `parseAbiParameters`, so an ABI can be written the way it reads in Solidity:
|
|
9735
|
+
*
|
|
9736
|
+
* ```ts
|
|
9737
|
+
* const abi = parseAbi([
|
|
9738
|
+
* 'function balanceOf(address owner) view returns (uint256)',
|
|
9739
|
+
* 'function transfer(address to, uint256 amount) returns (bool)',
|
|
9740
|
+
* 'event Transfer(address indexed from, address indexed to, uint256 value)',
|
|
9741
|
+
* 'error InsufficientBalance(uint256 available, uint256 required)',
|
|
9742
|
+
* ]);
|
|
9743
|
+
* ```
|
|
9744
|
+
*
|
|
9745
|
+
* Supported: functions, events, errors, constructor, fallback, receive; named and
|
|
9746
|
+
* unnamed parameters; `indexed`; data locations (`calldata`/`memory`/`storage`,
|
|
9747
|
+
* ignored as the ABI has no such concept); inline tuples `(uint256 a, bool b)`
|
|
9748
|
+
* with array suffixes at any depth.
|
|
9749
|
+
*
|
|
9750
|
+
* NOT supported (deliberately — it needs a symbol table, and the JSON form is
|
|
9751
|
+
* always available): named `struct` declarations. Write the tuple inline instead.
|
|
9752
|
+
*/
|
|
9753
|
+
|
|
9754
|
+
/** A parameter LIST: `address owner, uint256 amount` (no surrounding parens). */
|
|
9755
|
+
declare function parseAbiParameters(signature: string): AbiParameter[];
|
|
9756
|
+
/** Parse ONE human-readable signature into its ABI item. */
|
|
9757
|
+
declare function parseAbiItem(signature: string): AbiItem;
|
|
9758
|
+
/** Parse a whole human-readable ABI. */
|
|
9759
|
+
declare function parseAbi(signatures: readonly string[]): AbiItem[];
|
|
9760
|
+
|
|
9761
|
+
/**
|
|
9762
|
+
* Public facade over the chain stack ({@link file://../chain/index.ts}).
|
|
9763
|
+
*
|
|
9764
|
+
* Two different things live here, and they age differently:
|
|
9765
|
+
*
|
|
9766
|
+
* - ENDPOINT RESOLUTION — `setRpcOverrides` / `resolveRpcUrl` /
|
|
9767
|
+
* `getDefaultRpcUrl` / `DEFAULT_RPC_BY_CHAIN`. Fully supported, simply
|
|
9768
|
+
* re-exported from `chain/chains/registry.ts`, which now owns the table.
|
|
9769
|
+
* - RAW JSON-RPC HELPERS — `rpcCall` / `ethCallAt` / `ethCallByChain`.
|
|
9770
|
+
* DEPRECATED. Nothing inside the core calls them any more (every on-chain
|
|
9771
|
+
* read goes through a client); they stay because they are part of the
|
|
9772
|
+
* published API.
|
|
9773
|
+
*
|
|
9774
|
+
* New code should take a client instead — it adds ABI encode/decode, multicall
|
|
9775
|
+
* batching and typed errors, none of which the raw helpers provide:
|
|
9776
|
+
*
|
|
9777
|
+
* ```ts
|
|
9778
|
+
* const client = getPublicClient('0x2105');
|
|
9779
|
+
* const balance = await client.readContract({ address, abi: erc20Abi, functionName: 'balanceOf', args: [owner] });
|
|
9780
|
+
* ```
|
|
9781
|
+
*/
|
|
9782
|
+
|
|
9783
|
+
/**
|
|
9784
|
+
* Low-level JSON-RPC call against an explicit endpoint.
|
|
9785
|
+
*
|
|
9786
|
+
* Runs through the shared transport, so it gets exponential backoff on 429/5xx
|
|
9787
|
+
* (honouring `Retry-After`) and typed errors — the hand-rolled 429 loop this
|
|
9788
|
+
* used to carry is gone. Still throws on an RPC `error` member or an absent
|
|
9789
|
+
* result.
|
|
9790
|
+
*
|
|
9791
|
+
* @deprecated Use `getPublicClient(chainId)` and an action —
|
|
9792
|
+
* `client.rpc(method, params)` for a raw call, `client.readContract(…)` for a
|
|
9793
|
+
* decoded one.
|
|
9794
|
+
*/
|
|
9795
|
+
declare function rpcCall<T>(rpcUrl: string, method: string, params?: unknown[]): Promise<T>;
|
|
9796
|
+
/**
|
|
9797
|
+
* `eth_call` against an explicit RPC URL. `data` is the encoded calldata.
|
|
9798
|
+
*
|
|
9799
|
+
* @deprecated Use `getPublicClient(chainId).call({ to, data })`, or
|
|
9800
|
+
* `readContract` when you have an ABI.
|
|
9801
|
+
*/
|
|
9802
|
+
declare function ethCallAt(rpcUrl: string, to: string, data: string): Promise<string>;
|
|
9803
|
+
/**
|
|
9804
|
+
* `eth_call` resolving the endpoint from the hex chain id, honouring the shared
|
|
9805
|
+
* overrides. Returns `null` when the chain has no known RPC or the call fails —
|
|
9806
|
+
* callers that need the reason should use {@link ethCallAt}.
|
|
9807
|
+
*
|
|
9808
|
+
* @deprecated Use `getPublicClient(chainId).readContract(…)` — it decodes the
|
|
9809
|
+
* result and reports WHY a read failed instead of collapsing it to `null`.
|
|
9810
|
+
*/
|
|
9811
|
+
declare function ethCallByChain(chainId: string, to: string, data: string): Promise<string | null>;
|
|
9812
|
+
|
|
8329
9813
|
/**
|
|
8330
9814
|
* Generic x402 (HTTP 402 "pay-per-call") client for the agent core.
|
|
8331
9815
|
*
|
|
@@ -9152,4 +10636,4 @@ declare class AbortError extends Error {
|
|
|
9152
10636
|
*/
|
|
9153
10637
|
declare function isAbortError(err: unknown): boolean;
|
|
9154
10638
|
|
|
9155
|
-
export { AI_AGENT_TOOL_NAMES, AbortError, type AddLiquidityFormProps, type AddLiquiditySummary, type AffiliateFee, type AgentConfig, AgentCore, type AgentResponse, ApproveTokenTool, type ApyPoint, BaseNftAiTool, BaseSwapService, BaseTool, BaseWalletActionTool, type BuyTokenConfirmTxProps, type BuyTokenSide, BuyTokenTool, type ChainMeta, type ChainRef, type ChainSelector, ChatHistory, type ChatMessage, type ChatOptions, type ChatRole, type CheckApprovalParams, type CheckApprovalResult, type ConfirmAddLiquidityTxProps, type CortexResponse, DEFAULT_CHAIN, DEFAULT_PROVIDER, DEFAULT_RPC_BY_CHAIN, DebridgeAdapter, type DecodedCall, type DecodedEvent, type DecodedParam, type DefaultSubagentName, type DefiPosition, type DefiPositionDetails, type DefiPositionToken, type DefiProtocolSummary, EstimatePoolYieldTool, type EstimatePoolYieldToolConfig, type ExchangeProviderConfig, type ExecuteSwapParams, type ExecuteSwapResult, GeminiProvider, GeminiSearchAiTool, type GeminiSearchAiToolConfig, HEX_TO_PANTOGRAPH, type HolderChangePeriod, type HolderSupplyTier, type HttpMethod, type IngestKnowledgeBaseInput, type IngestKnowledgeBaseResult, type InputTokenInfo, type KBSearchResult, KnowledgeBase, type KnowledgeBaseEntry, type KnowledgeBaseProvider, type LLMProvider, type LLMProviderConfig, type LLMResponse, type LLMToolCall, type LendingMarket, type LendingMarketOverview, LendingMarketsTool, type LendingMarketsToolConfig, type LendingProtocolType, LendingService, type LendingServiceConfig, type LendingSupplyPosition, ManageLiquidityRedirectTool, type MarketplaceLink, type MoralisApiResponse, MoralisService, type MoralisServiceConfig, NFC_AGENT_TOOL_NAMES, NFC_AMAZON_DEFAULT_DOMAIN, NFC_AMAZON_DOMAINS, type NFTCollectionItem, NFTContractInfoTool, type NFTContractMetadata, type NFTItem, type NFTLastSale, type NFTMetadata, NFTMetadataTool, NFT_AGENT_TOOL_NAMES, type NativeTokenInfo, NfcBuyTool, NfcInfoTool, type NftTransferLastSale, NoFormTool, type NoFormToolMessages, OpenAddLiquidityFormTool, type OpenAddLiquidityFormToolConfig, OpenSupplyFormTool, type OpenSupplyFormToolConfig, POOL_AGENT_TOOL_NAMES, PantographService, type PantographServiceConfig, type PaymentToken, PoolByAddressTool, type PoolByAddressToolConfig, PoolDetailTool, type PoolDetailToolConfig, type PoolDisplayInfo, PoolFallbackAiTool, type PoolFallbackAiToolConfig, type PoolOnchainInfo, PoolPriceRangesTool, type PoolPriceRangesToolConfig, PoolSearchTool, type PoolSearchToolConfig, PoolService, type PoolServiceConfig, type PresetInputs, PreviewAddLiquidityTool, type PreviewAddLiquidityToolConfig, type PriceBounds, type PriceRangePrefill, type ProviderName, type QuickRate, type RangePreset, type ReActPhase, type ReActStep, type ReActTrace, RelayAdapter, type ResolvedRange, Router, type RouterAssignment, type RouterDecision, SUPPORTED_CHAINS, SUPPORTED_CHAINS_LABEL, SWAP_PROVIDER_CONFIG, SendNativeTool, SendNftTool, SendTokenTool, type StorageProvider, Subagent, type SubagentCard, type SubagentOptions, type SubagentParams, type SubagentResult, type SubagentTask, type SubagentToggles, SubgraphAddPoolTool, type SubgraphAddPoolToolConfig, SubgraphCoinPoolPairsTool, type SubgraphCoinPoolPairsToolConfig, SubgraphPoolByAddressTool, type SubgraphPoolByAddressToolConfig, SubgraphPoolByPositionIdTool, type SubgraphPoolByPositionIdToolConfig, SubgraphPoolSearchTool, type SubgraphPoolSearchToolConfig, SubgraphPositionDetailTool, type SubgraphPositionDetailToolConfig, SubgraphTrendingPoolsTool, type SubgraphTrendingPoolsToolConfig, type SuggestedAction, Summarizer, type SupplyProtocolType, type SupplyUsdcProps, type SupportedChainId, type SupportedChainName, type SwapQuoteParams, type SwapQuoteResult, type SwapServiceConfig, SwapServiceFactory, type SwapTokenConfirmTxProps, SwapTokenTool, type SwapTxData, Synthesizer, TOKEN_AGENT_TOOL_NAMES, TRANSFER_TOPIC, TRENDING_DEFAULT_BY_HEX_CHAIN, type TokenAnalyticsResponse, type TokenAnalyticsTimeframeBuckets, TokenAnalyticsTool, type TokenAnalyticsToolConfig, type TokenApproval, type TokenApprovalSpender, type TokenApprovalToken, type TokenBalance, type TokenDisplay, type TokenHoldersResponse, TokenHoldersTool, type TokenHoldersToolConfig, TokenInfoTool, type TokenInfoToolConfig, type TokenMetadata, type TokenScoreMetrics, type TokenScoreResponse, type TokenScoreSupply, type TokenScoreTimeframeBuckets, TokenScoreTool, type TokenScoreToolConfig, type Tool, type ToolDefinition, type ToolKind, type ToolParameter, ToolRegistry, type ToolResult, type TopGainerTimeFrames, type TopGainerToken, type TopGainersTimeFrame, TopGainersTool, type TopGainersToolConfig, TopPoolsTool, type TopPoolsToolConfig, type TrackStatus, type TrackTransactionParams, type TrackTransactionResult, type TransactionByHashResponse, TransactionByHashTool, type TransactionByHashToolConfig, type TransactionLog, type TransactionReceipt, type TransactionReceiptLog, type TrendingToken, type TrendingTokenTimeframeBuckets, TrendingTokensTool, type TrendingTokensToolConfig, type UIPayload, UNISWAP_CHAIN_SLUG, type UnsignedTx, type UpstashEmbedStrategy, type UpstashFusionAlgorithm, type UpstashKBUpsertEntry, UpstashKnowledgeBase, type UpstashKnowledgeBaseConfig, type UserContext, type VectorKBConfig, WALLET_ACTION_AGENT_TOOL_NAMES, WALLET_AGENT_TOOL_NAMES, type WalletActionProps, type WalletActionType, type WalletApprovalsResponse, WalletApprovalsTool, type WalletApprovalsToolConfig, type WalletDefiPositionSummary, WalletDefiPositionsTool, type WalletDefiPositionsToolConfig, type WalletDefiPositionsV1Response, type WalletDefiProtocolPositionsResponse, WalletDefiProtocolPositionsTool, type WalletDefiProtocolPositionsToolConfig, type WalletDefiProtocolPositionsV1Response, type WalletDefiSummaryResponse, type WalletDefiSummaryV1Response, type WalletHistoryCategory, type WalletHistoryContractInteraction, type WalletHistoryErc20Transfer, type WalletHistoryItem, type WalletHistoryNativeTransfer, type WalletHistoryNftTransfer, type WalletHistoryResponse, WalletHistoryTool, type WalletHistoryToolConfig, WalletLendingPositionsTool, type WalletLendingPositionsToolConfig, WalletNFTsTool, type WalletNFTsToolConfig, type WalletNftCardProps, type WalletNftListProps, type WalletNftTransferItem, type WalletNftTransfersResponse, WalletNftTransfersTool, type WalletNftTransfersToolConfig, type WalletPnlDaysWindow, type WalletPnlResponse, type WalletPnlSummaryResponse, WalletPnlSummaryTool, type WalletPnlSummaryToolConfig, type WalletPnlTokenItem, WalletPnlTool, type WalletPnlToolConfig, WalletTokenBalancesTool, type WalletTokenBalancesToolConfig, type WalletTokenTransferItem, type WalletTokenTransfersResponse, WalletTokenTransfersTool, type WalletTokenTransfersToolConfig, type WebsiteTrustExtraData, type WebsiteTrustInput, WebsiteTrustKeyringAgent, type WebsiteTrustKeyringAgentConfig, type WebsiteTrustResult, type X402Authorization, type X402Challenge, type X402Display, type X402Outcome, type X402PaymentRequiredProps, type X402Receipt, type X402RequestSpec, type X402Requirements, type X402SignRequest, type X402Signer, type X402TypedData, type X402Version, type YieldConversionCall, type YieldConversionPlan, type YieldTokenInput, type YieldTokenValue, ZERO_ADDRESS, amazonDomainForLanguage, apiClient, applyYieldConversions, buildChallenge, buildRangePresets, buildUniswapPoolUrl, clampTick, completeX402, configureSupportedChains, createAiAgent, createDefaultSubagents, createNfcAgent, createNftAgent, createPoolAgent, createTokenAgent, createWalletActionAgent, createWalletAgent, createX402SignatureProvider, displayFromChallenge, encodeSignedHeader, ethCallAt, ethCallByChain, fetchTopMarketplaces, getAffiliateFee, getChainMeta, getDefaultRpcUrl, getGatewayAddress, getGatewayChains, getNativeTokenInfo, getPositionManagerAddress, getProviderByChain, ingestKnowledgeBase, isAbortError, isPaymentRequired, isShareBasedProtocol, isShareBasedYieldToken, nfcAmazonSearchUrl, normaliseCountry, normalizePriceRangeToPool, planYieldTokenConversions, priceToTick, readPaymentError, readPaymentRequired, readReceipt, registerMaybeNoForm, requestWithX402, resolveNfcShopLinks, resolveRpcUrl, roundTickToSpacing, rpcCall, setRpcOverrides, swapServiceFactory, tickToPrice, toPantographChain };
|
|
10639
|
+
export { AI_AGENT_TOOL_NAMES, type Abi, type AbiItem, type AbiParameter, AbortError, type AddLiquidityFormProps, type AddLiquiditySummary, type Address, type AffiliateFee, type AgentConfig, AgentCore, type AgentResponse, ApproveTokenTool, type ApyPoint, BaseNftAiTool, BaseSwapService, BaseTool, BaseWalletActionTool, type BlockParameters, type BlockTag, type BuyTokenConfirmTxProps, type BuyTokenSide, BuyTokenTool, type CallParameters, type Chain, type ChainMeta, type ChainRef, type ChainSelector, ChatHistory, type ChatMessage, type ChatOptions, type ChatRole, type CheckApprovalParams, type CheckApprovalResult, type Client, type ClientBatchConfig, type ConfirmAddLiquidityTxProps, type ContractFunctionParameters, type CortexResponse, DEFAULT_CHAIN, DEFAULT_PROVIDER, DEFAULT_RPC_BY_CHAIN, DebridgeAdapter, type DecodedCall, type DecodedEvent, type DecodedParam, type DefaultSubagentName, type DefiPosition, type DefiPositionDetails, type DefiPositionToken, type DefiProtocolSummary, type EIP1193RequestFn, EstimatePoolYieldTool, type EstimatePoolYieldToolConfig, type ExchangeProviderConfig, type ExecuteSwapParams, type ExecuteSwapResult, GeminiProvider, GeminiSearchAiTool, type GeminiSearchAiToolConfig, HEX_TO_PANTOGRAPH, type Hex, type HolderChangePeriod, type HolderSupplyTier, type HttpMethod, type IngestKnowledgeBaseInput, type IngestKnowledgeBaseResult, type InputTokenInfo, type KBSearchResult, KnowledgeBase, type KnowledgeBaseEntry, type KnowledgeBaseProvider, type LLMProvider, type LLMProviderConfig, type LLMResponse, type LLMToolCall, type LendingMarket, type LendingMarketOverview, LendingMarketsTool, type LendingMarketsToolConfig, type LendingProtocolType, LendingService, type LendingServiceConfig, type LendingSupplyPosition, MULTICALL3_ADDRESS, ManageLiquidityRedirectTool, type MarketplaceLink, type MoralisApiResponse, MoralisService, type MoralisServiceConfig, type MulticallParameters, type MulticallRawParameters, type MulticallResult, NFC_AGENT_TOOL_NAMES, NFC_AMAZON_DEFAULT_DOMAIN, NFC_AMAZON_DOMAINS, type NFTCollectionItem, NFTContractInfoTool, type NFTContractMetadata, type NFTItem, type NFTLastSale, type NFTMetadata, NFTMetadataTool, NFT_AGENT_TOOL_NAMES, type NativeTokenInfo, NfcBuyTool, NfcInfoTool, type NftTransferLastSale, NoFormTool, type NoFormToolMessages, OpenAddLiquidityFormTool, type OpenAddLiquidityFormToolConfig, OpenSupplyFormTool, type OpenSupplyFormToolConfig, POOL_AGENT_TOOL_NAMES, PantographService, type PantographServiceConfig, type PaymentToken, PoolByAddressTool, type PoolByAddressToolConfig, PoolDetailTool, type PoolDetailToolConfig, type PoolDisplayInfo, PoolFallbackAiTool, type PoolFallbackAiToolConfig, type PoolOnchainInfo, PoolPriceRangesTool, type PoolPriceRangesToolConfig, PoolSearchTool, type PoolSearchToolConfig, PoolService, type PoolServiceConfig, type PresetInputs, PreviewAddLiquidityTool, type PreviewAddLiquidityToolConfig, type PriceBounds, type PriceRangePrefill, type ProviderName, PublicClient, type PublicClientConfig, type QuickRate, type RangePreset, type ReActPhase, type ReActStep, type ReActTrace, type ReadContractParameters, RelayAdapter, type ResolvedRange, Router, type RouterAssignment, type RouterDecision, SUPPORTED_CHAINS, SUPPORTED_CHAINS_LABEL, SWAP_PROVIDER_CONFIG, SendNativeTool, SendNftTool, SendTokenTool, type StateOverride, type StorageProvider, Subagent, type SubagentCard, type SubagentOptions, type SubagentParams, type SubagentResult, type SubagentTask, type SubagentToggles, SubgraphAddPoolTool, type SubgraphAddPoolToolConfig, SubgraphCoinPoolPairsTool, type SubgraphCoinPoolPairsToolConfig, SubgraphPoolByAddressTool, type SubgraphPoolByAddressToolConfig, SubgraphPoolByPositionIdTool, type SubgraphPoolByPositionIdToolConfig, SubgraphPoolSearchTool, type SubgraphPoolSearchToolConfig, SubgraphPositionDetailTool, type SubgraphPositionDetailToolConfig, SubgraphTrendingPoolsTool, type SubgraphTrendingPoolsToolConfig, type SuggestedAction, Summarizer, type SupplyProtocolType, type SupplyUsdcProps, type SupportedChainId, type SupportedChainName, type SwapQuoteParams, type SwapQuoteResult, type SwapServiceConfig, SwapServiceFactory, type SwapTokenConfirmTxProps, SwapTokenTool, type SwapTxData, Synthesizer, TOKEN_AGENT_TOOL_NAMES, TRANSFER_TOPIC, TRENDING_DEFAULT_BY_HEX_CHAIN, type TokenAnalyticsResponse, type TokenAnalyticsTimeframeBuckets, TokenAnalyticsTool, type TokenAnalyticsToolConfig, type TokenApproval, type TokenApprovalSpender, type TokenApprovalToken, type TokenBalance, type TokenDisplay, type TokenHoldersResponse, TokenHoldersTool, type TokenHoldersToolConfig, TokenInfoTool, type TokenInfoToolConfig, type TokenMetadata, type TokenScoreMetrics, type TokenScoreResponse, type TokenScoreSupply, type TokenScoreTimeframeBuckets, TokenScoreTool, type TokenScoreToolConfig, type Tool, type ToolDefinition, type ToolKind, type ToolParameter, ToolRegistry, type ToolResult, type TopGainerTimeFrames, type TopGainerToken, type TopGainersTimeFrame, TopGainersTool, type TopGainersToolConfig, TopPoolsTool, type TopPoolsToolConfig, type TrackStatus, type TrackTransactionParams, type TrackTransactionResult, type TransactionByHashResponse, TransactionByHashTool, type TransactionByHashToolConfig, type TransactionLog, type TransactionReceipt, type TransactionReceiptLog, type Transport, type TransportConfig, type TrendingToken, type TrendingTokenTimeframeBuckets, TrendingTokensTool, type TrendingTokensToolConfig, type UIPayload, UNISWAP_CHAIN_SLUG, type UnsignedTx, type UpstashEmbedStrategy, type UpstashFusionAlgorithm, type UpstashKBUpsertEntry, UpstashKnowledgeBase, type UpstashKnowledgeBaseConfig, type UserContext, type VectorKBConfig, WALLET_ACTION_AGENT_TOOL_NAMES, WALLET_AGENT_TOOL_NAMES, type WalletActionProps, type WalletActionType, type WalletApprovalsResponse, WalletApprovalsTool, type WalletApprovalsToolConfig, type WalletDefiPositionSummary, WalletDefiPositionsTool, type WalletDefiPositionsToolConfig, type WalletDefiPositionsV1Response, type WalletDefiProtocolPositionsResponse, WalletDefiProtocolPositionsTool, type WalletDefiProtocolPositionsToolConfig, type WalletDefiProtocolPositionsV1Response, type WalletDefiSummaryResponse, type WalletDefiSummaryV1Response, type WalletHistoryCategory, type WalletHistoryContractInteraction, type WalletHistoryErc20Transfer, type WalletHistoryItem, type WalletHistoryNativeTransfer, type WalletHistoryNftTransfer, type WalletHistoryResponse, WalletHistoryTool, type WalletHistoryToolConfig, WalletLendingPositionsTool, type WalletLendingPositionsToolConfig, WalletNFTsTool, type WalletNFTsToolConfig, type WalletNftCardProps, type WalletNftListProps, type WalletNftTransferItem, type WalletNftTransfersResponse, WalletNftTransfersTool, type WalletNftTransfersToolConfig, type WalletPnlDaysWindow, type WalletPnlResponse, type WalletPnlSummaryResponse, WalletPnlSummaryTool, type WalletPnlSummaryToolConfig, type WalletPnlTokenItem, WalletPnlTool, type WalletPnlToolConfig, WalletTokenBalancesTool, type WalletTokenBalancesToolConfig, type WalletTokenTransferItem, type WalletTokenTransfersResponse, WalletTokenTransfersTool, type WalletTokenTransfersToolConfig, type WebsiteTrustExtraData, type WebsiteTrustInput, WebsiteTrustKeyringAgent, type WebsiteTrustKeyringAgentConfig, type WebsiteTrustResult, type X402Authorization, type X402Challenge, type X402Display, type X402Outcome, type X402PaymentRequiredProps, type X402Receipt, type X402RequestSpec, type X402Requirements, type X402SignRequest, type X402Signer, type X402TypedData, type X402Version, type YieldConversionCall, type YieldConversionPlan, type YieldTokenInput, type YieldTokenValue, ZERO_ADDRESS, amazonDomainForLanguage, apiClient, applyYieldConversions, buildChallenge, buildRangePresets, buildUniswapPoolUrl, call, chains, checksumAddress, clampTick, clearPublicClientCache, completeX402, configureSupportedChains, createAiAgent, createDefaultSubagents, createNfcAgent, createNftAgent, createPoolAgent, createPublicClient, createTokenAgent, createTransport, createWalletActionAgent, createWalletAgent, createX402SignatureProvider, decodeAbiParameters, decodeErrorResult, decodeFunctionData, decodeFunctionResult, displayFromChallenge, encodeAbiParameters, encodeErrorResult, encodeFunctionData, encodeSignedHeader, erc1155Abi, erc20Abi, erc20Abi_bytes32, erc721Abi, estimateGas, ethCallAt, ethCallByChain, fallback, fetchTopMarketplaces, getAbiItem, getAddress, getAffiliateFee, getBalance, getBlock, getBlockNumber, getChain, getChainContractAddress, getChainId, getChainMeta, getCode, getDefaultRpcUrl, getGasPrice, getGatewayAddress, getGatewayChains, getNativeTokenInfo, getPositionManagerAddress, getProviderByChain, getPublicClient, getRevertReason, getRpcOverrides, getStorageAt, getTransactionCount, http, ingestKnowledgeBase, isAbortError, isAddress, isAddressEqual, isPaymentRequired, isShareBasedProtocol, isShareBasedYieldToken, multicall, multicall3Abi, multicallRaw, nfcAmazonSearchUrl, normaliseCountry, normalizePriceRangeToPool, parseAbi, parseAbiItem, parseAbiParameters, planYieldTokenConversions, priceToTick, readContract, readPaymentError, readPaymentRequired, readReceipt, registerMaybeNoForm, requestWithX402, resolveNfcShopLinks, resolveRpcUrl, resolveRpcUrls, roundTickToSpacing, rpcCall, setRpcOverrides, swapServiceFactory, tickToPrice, toEventSelector, toFunctionSelector, toPantographChain };
|