keyring-agent-core 0.3.13 → 0.3.14
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 +655 -538
- package/dist/index.js +69 -69
- package/dist/index.native.js +170 -170
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3311,12 +3311,382 @@ declare function registerMaybeNoForm(registry: {
|
|
|
3311
3311
|
register: (tool: Tool) => void;
|
|
3312
3312
|
}, tool: Tool, messages?: NoFormToolMessages): void;
|
|
3313
3313
|
|
|
3314
|
+
/**
|
|
3315
|
+
* Shared ABI / hex types for the codec layer.
|
|
3316
|
+
*
|
|
3317
|
+
* Deliberately STRUCTURAL and loose (every field but `type` optional) rather
|
|
3318
|
+
* than viem's fully-inferred `Abi` generics: this core hand-writes its ABIs as
|
|
3319
|
+
* plain object literals — some without `as const` — and a strict type would
|
|
3320
|
+
* reject them at every call site for no runtime benefit. Validation happens
|
|
3321
|
+
* where it matters, at runtime, in {@link file://./signature.ts}.
|
|
3322
|
+
*/
|
|
3323
|
+
/** A 0x-prefixed hex string. */
|
|
3324
|
+
type Hex = `0x${string}`;
|
|
3325
|
+
/** A 0x-prefixed 20-byte address. */
|
|
3326
|
+
type Address = `0x${string}`;
|
|
3327
|
+
/** One ABI input/output parameter; `components` is present for tuples. */
|
|
3328
|
+
interface AbiParameter {
|
|
3329
|
+
readonly name?: string;
|
|
3330
|
+
readonly type: string;
|
|
3331
|
+
readonly internalType?: string;
|
|
3332
|
+
readonly components?: readonly AbiParameter[];
|
|
3333
|
+
/** Events only — whether the parameter is a topic. */
|
|
3334
|
+
readonly indexed?: boolean;
|
|
3335
|
+
}
|
|
3336
|
+
/** One ABI entry: function, event, error, constructor, fallback or receive. */
|
|
3337
|
+
interface AbiItem {
|
|
3338
|
+
readonly type?: string;
|
|
3339
|
+
readonly name?: string;
|
|
3340
|
+
readonly inputs?: readonly AbiParameter[];
|
|
3341
|
+
readonly outputs?: readonly AbiParameter[];
|
|
3342
|
+
readonly stateMutability?: string;
|
|
3343
|
+
readonly anonymous?: boolean;
|
|
3344
|
+
}
|
|
3345
|
+
/** A contract ABI. */
|
|
3346
|
+
type Abi = readonly AbiItem[];
|
|
3347
|
+
|
|
3348
|
+
/**
|
|
3349
|
+
* Chain shape — viem's `Chain`, plus a `hexId` because this core identifies
|
|
3350
|
+
* chains by hex id (`0x2105`) everywhere: in tool arguments, in `UserContext`,
|
|
3351
|
+
* and in the wallet payloads it hands the app.
|
|
3352
|
+
*/
|
|
3353
|
+
|
|
3354
|
+
/** A contract deployed at a known address on a chain. */
|
|
3355
|
+
interface ChainContract {
|
|
3356
|
+
address: Address;
|
|
3357
|
+
/** Block the contract was deployed at, when known — reads before it can't work. */
|
|
3358
|
+
blockCreated?: number;
|
|
3359
|
+
}
|
|
3360
|
+
/** The chain's one native coin (everything else on it is a token). */
|
|
3361
|
+
interface ChainNativeCurrency {
|
|
3362
|
+
name: string;
|
|
3363
|
+
symbol: string;
|
|
3364
|
+
decimals: number;
|
|
3365
|
+
}
|
|
3366
|
+
interface Chain {
|
|
3367
|
+
/** Decimal chain id (`8453`). */
|
|
3368
|
+
id: number;
|
|
3369
|
+
/** Canonical hex chain id (`0x2105`) — this core's primary key for a chain. */
|
|
3370
|
+
hexId: Hex;
|
|
3371
|
+
/** Display name, as shown to users. */
|
|
3372
|
+
name: string;
|
|
3373
|
+
nativeCurrency: ChainNativeCurrency;
|
|
3374
|
+
rpcUrls: {
|
|
3375
|
+
default: {
|
|
3376
|
+
http: readonly string[];
|
|
3377
|
+
};
|
|
3378
|
+
};
|
|
3379
|
+
blockExplorers?: {
|
|
3380
|
+
default: {
|
|
3381
|
+
name: string;
|
|
3382
|
+
url: string;
|
|
3383
|
+
};
|
|
3384
|
+
};
|
|
3385
|
+
/** Well-known contracts; `multicall3` is what the batching layer needs. */
|
|
3386
|
+
contracts?: {
|
|
3387
|
+
multicall3?: ChainContract;
|
|
3388
|
+
};
|
|
3389
|
+
testnet?: boolean;
|
|
3390
|
+
}
|
|
3391
|
+
|
|
3392
|
+
/**
|
|
3393
|
+
* The 12 EVM chains this core supports, as viem-shaped {@link Chain} objects.
|
|
3394
|
+
*
|
|
3395
|
+
* One definition per chain carries everything the stack needs — decimal id, hex
|
|
3396
|
+
* id, display name, native coin, default public RPC and the Multicall3
|
|
3397
|
+
* deployment — so nothing has to be threaded through call sites or duplicated in
|
|
3398
|
+
* a second table.
|
|
3399
|
+
*
|
|
3400
|
+
* Multicall3 sits at the SAME deterministic address on every one of them
|
|
3401
|
+
* (verified on-chain via `eth_getCode`), but each chain still spells it out: a
|
|
3402
|
+
* chain that ever ships it elsewhere is then a one-line change here.
|
|
3403
|
+
*
|
|
3404
|
+
* `blockCreated` is advisory metadata — it only gates reads pinned to a
|
|
3405
|
+
* HISTORICAL block (a read at `latest`, the default, never consults it) — and is
|
|
3406
|
+
* left out where the deployment block isn't confirmed.
|
|
3407
|
+
*
|
|
3408
|
+
* `rpcUrls.default.http` is an ORDERED PREFERENCE LIST, not a single endpoint:
|
|
3409
|
+
* the first entry is the one normally used, and the rest are fixed backups the
|
|
3410
|
+
* {@link file://../transports/fallback.ts} transport walks down when a request
|
|
3411
|
+
* fails transiently (rate limit, 5xx, timeout). A public endpoint rejecting the
|
|
3412
|
+
* odd method — eth.llamarpc.com answering `eth_gasPrice` with HTTP 525, say —
|
|
3413
|
+
* therefore degrades to a slower answer rather than no answer.
|
|
3414
|
+
*/
|
|
3415
|
+
|
|
3416
|
+
/** Canonical Multicall3 address, identical on every supported chain. */
|
|
3417
|
+
declare const MULTICALL3_ADDRESS: "0xcA11bde05977b3631167028862bE2a173976CA11";
|
|
3418
|
+
/** Every supported chain, in the core's canonical order. */
|
|
3419
|
+
declare const chains: readonly Chain[];
|
|
3420
|
+
|
|
3421
|
+
/**
|
|
3422
|
+
* Domain-level batched reads, on top of the chain stack
|
|
3423
|
+
* ({@link file://../chain/index.ts}).
|
|
3424
|
+
*
|
|
3425
|
+
* The Multicall3 plumbing this file used to carry — the hand-written
|
|
3426
|
+
* `aggregate3` encoder, the `(bool,bytes)[]` reader, the chunking loop — now
|
|
3427
|
+
* lives in `chain/actions/multicall.ts` and `chain/actions/multicallRaw.ts`,
|
|
3428
|
+
* where it is ABI-driven and reusable. What remains here are the three helpers
|
|
3429
|
+
* the core's services actually ask for, with their signatures and their
|
|
3430
|
+
* never-throws, positionally-aligned contracts unchanged:
|
|
3431
|
+
*
|
|
3432
|
+
* - {@link multicallRead} raw calldata in, raw return data out
|
|
3433
|
+
* - {@link multicallErc20Metadata} symbol + decimals, incl. legacy bytes32 tokens
|
|
3434
|
+
* - {@link multicallTokenUris} ERC-721 `tokenURI` for many NFTs
|
|
3435
|
+
*
|
|
3436
|
+
* For anything new, prefer the client directly — `getPublicClient(chainId)` then
|
|
3437
|
+
* `.multicall({ contracts })` — which decodes results and reports typed
|
|
3438
|
+
* per-entry errors instead of `null`.
|
|
3439
|
+
*/
|
|
3440
|
+
|
|
3441
|
+
/** One read in a {@link multicallRead} batch: a target contract + full calldata. */
|
|
3442
|
+
interface MulticallRequest {
|
|
3443
|
+
/** Contract to call. A malformed address yields a `null` result. */
|
|
3444
|
+
target: string;
|
|
3445
|
+
/** Encoded calldata — selector + ABI-encoded args, 0x-prefixed. */
|
|
3446
|
+
callData: string;
|
|
3447
|
+
}
|
|
3448
|
+
|
|
3449
|
+
/**
|
|
3450
|
+
* USD valuation for yield-bearing wallet tokens.
|
|
3451
|
+
*
|
|
3452
|
+
* A wallet's token list shows a balance and a price, and normally the USD value
|
|
3453
|
+
* is just the product of the two. For yield-bearing tokens that is wrong often
|
|
3454
|
+
* enough to matter, and the reason splits the tagged tokens into two kinds:
|
|
3455
|
+
*
|
|
3456
|
+
* - **Share-based vaults** (`spark`, `spark-ethereum`, `morpho-v2`) — `balanceOf`
|
|
3457
|
+
* returns ERC-4626 SHARES, while the price the token API quotes belongs to the
|
|
3458
|
+
* vault's UNDERLYING asset. A share is worth more than one unit of underlying
|
|
3459
|
+
* and drifts further up as yield accrues (measured live: 1 steakUSDC = 1.0354
|
|
3460
|
+
* USDC, 1 Spark sUSDC = 1.1051 USDC). The two are not even in the same unit —
|
|
3461
|
+
* shares carry the vault's own decimals, usually 18, against the underlying's
|
|
3462
|
+
* 6 for USDC. `convertToAssets(shares)` answers both problems at once: it
|
|
3463
|
+
* returns the position denominated in exactly what the price describes.
|
|
3464
|
+
*
|
|
3465
|
+
* - **Rebasing tokens** (`aave-v3`, `compound-v3`) — the balance is ALREADY the
|
|
3466
|
+
* underlying (their decimals match it) and yield arrives as a growing
|
|
3467
|
+
* `balanceOf`. Converting these would be a bug, so they are left untouched.
|
|
3468
|
+
*
|
|
3469
|
+
* - **Oracle-priced shares** (`spark-l2-susds`) — share-based like the first
|
|
3470
|
+
* group, but with no `convertToAssets` to ask: bridged sUSDS is a plain ERC-20
|
|
3471
|
+
* on its chain (the vault stays on Ethereum), so the conversion reads the SSR
|
|
3472
|
+
* oracle's ray-scaled rate and multiplies. Still ONE call per token, decoded
|
|
3473
|
+
* differently — see {@link YieldConversionPlan.rateKeys}. Needs
|
|
3474
|
+
* {@link YieldTokenInput.chain}, since the oracle is per chain.
|
|
3475
|
+
*
|
|
3476
|
+
* Which side a token falls on is decided by an explicit allow-list of
|
|
3477
|
+
* share-based protocols, mirroring the wallet app's own `LENDING_PLATFORMS`.
|
|
3478
|
+
* The protocol classes encode the same split as `balanceIsUnderlying`, but that
|
|
3479
|
+
* flag is reached through `protocolFor`, which falls back to an ERC-4626
|
|
3480
|
+
* protocol for types it doesn't recognise — a safe default for listing lending
|
|
3481
|
+
* markets, and the wrong one here, where a mistaken conversion silently
|
|
3482
|
+
* corrupts a balance. An allow-list fails closed instead.
|
|
3483
|
+
*
|
|
3484
|
+
* ## Why this returns calls instead of making them
|
|
3485
|
+
*
|
|
3486
|
+
* Same reasoning as {@link LendingProtocol}: the caller owns the transport. The
|
|
3487
|
+
* wallet app already has its own RPC stack — ranked endpoints, failover, a
|
|
3488
|
+
* Multicall3 batcher, and rate-limit-aware pacing for chains without Multicall3 —
|
|
3489
|
+
* and duplicating it here would mean a second, worse copy. So
|
|
3490
|
+
* {@link planYieldTokenConversions} declares the reads, the caller executes them
|
|
3491
|
+
* however it likes, and {@link applyYieldConversions} folds the answers back in.
|
|
3492
|
+
* Both halves are pure and synchronous, which also makes them trivial to test.
|
|
3493
|
+
*/
|
|
3494
|
+
|
|
3495
|
+
/**
|
|
3496
|
+
* Whether a `yieldProtocol` denominates balances in vault SHARES rather than the
|
|
3497
|
+
* underlying asset.
|
|
3498
|
+
*
|
|
3499
|
+
* Exported so callers can explain a decision — logging why a tagged token was
|
|
3500
|
+
* skipped, say — without keeping their own copy of the list, which would drift.
|
|
3501
|
+
* This answers only the protocol question: use {@link isShareBasedYieldToken}
|
|
3502
|
+
* for whether a specific token is actually convertible, since that also needs a
|
|
3503
|
+
* price and the underlying's decimals.
|
|
3504
|
+
*/
|
|
3505
|
+
declare function isShareBasedProtocol(yieldProtocol?: string | null): yieldProtocol is string;
|
|
3506
|
+
/**
|
|
3507
|
+
* The price ONE unit of a token's underlying is valued at.
|
|
3508
|
+
*
|
|
3509
|
+
* Two sources, in order:
|
|
3510
|
+
*
|
|
3511
|
+
* 1. `yieldAsset.fixedPrice` — the API stating that this underlying is valued
|
|
3512
|
+
* at a fixed rate rather than at its market print. It sends `1` for USDC
|
|
3513
|
+
* vaults (verified live on Base for both `spark` sUSDC and `compound-v3`
|
|
3514
|
+
* cUSDCv3), which is the redemption rate a holder actually gets.
|
|
3515
|
+
* 2. `priceUSD` — the market quote, for everything else.
|
|
3516
|
+
*
|
|
3517
|
+
* ## Why a fixed price is the better number when the API sends one
|
|
3518
|
+
*
|
|
3519
|
+
* `convertToAssets` returns an amount of the UNDERLYING, and for a dollar
|
|
3520
|
+
* stablecoin that amount IS the dollar figure: redemption is 1:1 by
|
|
3521
|
+
* construction. The market quote for the same asset is a live print — 0.99993
|
|
3522
|
+
* one refresh, 1.00007 the next — and because it multiplies the whole position,
|
|
3523
|
+
* that noise lands on the total: a $50,000 holding drifts by several dollars
|
|
3524
|
+
* between refreshes with nothing having happened on chain. Two screens
|
|
3525
|
+
* refreshing seconds apart then disagree, which reads as a bug in the balance
|
|
3526
|
+
* rather than as noise in a feed.
|
|
3527
|
+
*
|
|
3528
|
+
* ## Why the API owns this decision
|
|
3529
|
+
*
|
|
3530
|
+
* Which assets are fixed-price is a question about the ASSET, and the API is
|
|
3531
|
+
* already the authority on every other fact about it (`address`, `decimals`).
|
|
3532
|
+
* Deciding it here would mean a hard-coded address table per chain — one that
|
|
3533
|
+
* must be extended for every new stablecoin and every bridged variant, that
|
|
3534
|
+
* silently does nothing when an address is missed, and that no test can catch
|
|
3535
|
+
* drifting from the API's own view. Reading the field instead means a new
|
|
3536
|
+
* fixed-price asset needs no client release at all.
|
|
3537
|
+
*
|
|
3538
|
+
* ## Scope
|
|
3539
|
+
*
|
|
3540
|
+
* This applies to any token whose `yieldAsset` carries the field, share-based
|
|
3541
|
+
* or rebasing alike — a `compound-v3` receipt is already denominated in its
|
|
3542
|
+
* underlying, so valuing that underlying at par is the same statement about the
|
|
3543
|
+
* same dollars. A plain wallet token has no `yieldAsset` and is unaffected: it
|
|
3544
|
+
* keeps its market quote, which is the honest number for something the user can
|
|
3545
|
+
* sell right now.
|
|
3546
|
+
*
|
|
3547
|
+
* One consequence is deliberate: a fixed price makes a vault valuable even when
|
|
3548
|
+
* the API returns NO market quote, because the price no longer depends on one.
|
|
3549
|
+
* Such a token used to be skipped entirely and shown at `balance × 0`.
|
|
3550
|
+
*/
|
|
3551
|
+
declare function effectivePriceUSD(token: YieldTokenInput): number;
|
|
3552
|
+
/**
|
|
3553
|
+
* A wallet token as the caller already knows it. Field names mirror what the
|
|
3554
|
+
* Keyring/Pantograph token API returns, so a caller can pass its rows nearly
|
|
3555
|
+
* as-is.
|
|
3556
|
+
*/
|
|
3557
|
+
interface YieldTokenInput {
|
|
3558
|
+
/** Caller's own identifier, echoed back untouched so results can be re-joined. */
|
|
3559
|
+
key: string;
|
|
3560
|
+
/** The token contract — the vault itself for a share-based position. */
|
|
3561
|
+
address: string;
|
|
3562
|
+
/** Raw on-chain balance, unscaled. */
|
|
3563
|
+
rawBalance: bigint;
|
|
3564
|
+
/** The token's own decimals (vault share decimals, usually 18). */
|
|
3565
|
+
decimals: number;
|
|
3566
|
+
/**
|
|
3567
|
+
* Price quoted by the token API — for a vault, the UNDERLYING's price.
|
|
3568
|
+
* Missing, zero or non-finite disables conversion for this token; see
|
|
3569
|
+
* {@link isShareBasedYieldToken}.
|
|
3570
|
+
*/
|
|
3571
|
+
priceUSD: number;
|
|
3572
|
+
/** `yieldProtocol` from the token API; anything untagged is left alone. */
|
|
3573
|
+
yieldProtocol?: string | null;
|
|
3574
|
+
/**
|
|
3575
|
+
* `yieldAsset` from the token API — the underlying this token is denominated
|
|
3576
|
+
* in once converted.
|
|
3577
|
+
*
|
|
3578
|
+
* `fixedPrice` is the API declaring that this underlying is valued at a fixed
|
|
3579
|
+
* rate rather than at its market quote (it sends `1` for USDC). When present
|
|
3580
|
+
* it takes precedence over {@link priceUSD}; see {@link effectivePriceUSD}.
|
|
3581
|
+
*/
|
|
3582
|
+
yieldAsset?: {
|
|
3583
|
+
address?: string;
|
|
3584
|
+
decimals?: number;
|
|
3585
|
+
fixedPrice?: number | string | null;
|
|
3586
|
+
} | null;
|
|
3587
|
+
/**
|
|
3588
|
+
* Chain id — hex (`'0x2105'`) or decimal (`8453`), both accepted. Needed ONLY
|
|
3589
|
+
* by `spark-l2-susds`, whose conversion goes to that chain's SSR oracle rather
|
|
3590
|
+
* than to the token, and whose oracle address is per chain.
|
|
3591
|
+
*
|
|
3592
|
+
* Optional so existing callers are unaffected: every ERC-4626 type converts
|
|
3593
|
+
* against the token itself and never reads this. A sUSDS row without it is
|
|
3594
|
+
* passed through unconverted rather than converted against a guessed oracle.
|
|
3595
|
+
*/
|
|
3596
|
+
chain?: string | number | null;
|
|
3597
|
+
}
|
|
3598
|
+
/** One declared `convertToAssets` read, tagged with the token it belongs to. */
|
|
3599
|
+
interface YieldConversionCall extends MulticallRequest {
|
|
3600
|
+
/** {@link YieldTokenInput.key} of the token this call resolves. */
|
|
3601
|
+
key: string;
|
|
3602
|
+
}
|
|
3603
|
+
/** What {@link planYieldTokenConversions} worked out, ready to execute. */
|
|
3604
|
+
interface YieldConversionPlan {
|
|
3605
|
+
/** Reads to perform, in order. Empty when nothing needs converting. */
|
|
3606
|
+
calls: YieldConversionCall[];
|
|
3607
|
+
/**
|
|
3608
|
+
* Keys in {@link calls} whose read returns a ray-scaled RATE rather than an
|
|
3609
|
+
* amount — cross-chain sUSDS, which has no `convertToAssets` and is valued
|
|
3610
|
+
* against its chain's SSR oracle instead.
|
|
3611
|
+
*
|
|
3612
|
+
* Exposed so {@link applyYieldConversions} can tell the two apart: decoding a
|
|
3613
|
+
* ray as though it were assets would report a ~10^27 balance. Callers execute
|
|
3614
|
+
* the plan exactly as before and need not consult this — it stays a single
|
|
3615
|
+
* round-trip, and there is no second phase to forget.
|
|
3616
|
+
*/
|
|
3617
|
+
rateKeys: string[];
|
|
3618
|
+
}
|
|
3619
|
+
/** A token's corrected valuation. */
|
|
3620
|
+
interface YieldTokenValue {
|
|
3621
|
+
/** Position size in UNDERLYING units (e.g. USDC), not shares. */
|
|
3622
|
+
underlyingAmount: number;
|
|
3623
|
+
/** `underlyingAmount × priceUSD`. */
|
|
3624
|
+
valueUSD: number;
|
|
3625
|
+
/**
|
|
3626
|
+
* Value per SHARE — `valueUSD / balanceFormatted`.
|
|
3627
|
+
*
|
|
3628
|
+
* Worth storing alongside the total: it keeps a row's displayed unit price
|
|
3629
|
+
* consistent with its total, and lets a later balance-only refresh recompute
|
|
3630
|
+
* `balance × price` correctly without re-reading the chain.
|
|
3631
|
+
*/
|
|
3632
|
+
pricePerTokenUSD: number;
|
|
3633
|
+
/** True when an on-chain conversion produced this. See {@link applyYieldConversions}. */
|
|
3634
|
+
converted: boolean;
|
|
3635
|
+
}
|
|
3636
|
+
/**
|
|
3637
|
+
* True when a token's balance is ERC-4626 shares that must be converted.
|
|
3638
|
+
*
|
|
3639
|
+
* These are the same three conditions the wallet app (`coinpool-v2`) gates its
|
|
3640
|
+
* own portfolio conversion on, in the same order:
|
|
3641
|
+
*
|
|
3642
|
+
* 1. a known share-based protocol — its `LENDING_PLATFORMS` allow-list. Note
|
|
3643
|
+
* this is deliberately stricter than {@link protocolFor} alone, which falls
|
|
3644
|
+
* back to an ERC-4626 protocol for unrecognised types: the right default when
|
|
3645
|
+
* listing lending markets, but not here, where guessing wrong silently
|
|
3646
|
+
* corrupts a balance. Rebasing receipts (`aave-v3`, `compound-v3`) are
|
|
3647
|
+
* already underlying and are excluded by the list, exactly as they are there.
|
|
3648
|
+
* 2. `yieldAsset.decimals`, the scale the returned assets must be read at —
|
|
3649
|
+
* without it the result is an unscaled integer, not an amount;
|
|
3650
|
+
* 3. a usable `priceUSD` (finite and > 0). The conversion's whole purpose is to
|
|
3651
|
+
* produce a USD value, and with no price there is none to produce — the
|
|
3652
|
+
* read would cost an RPC call to compute `x × 0`. Worse, reporting a
|
|
3653
|
+
* converted price of 0 would overwrite the caller's own last-known-price
|
|
3654
|
+
* fallback, turning a priced row into a valueless one that dust filters then
|
|
3655
|
+
* hide. Leaving it untouched keeps whatever the caller already had.
|
|
3656
|
+
*
|
|
3657
|
+
* Anything failing these — rebasing, untagged, unpriced, or incompletely
|
|
3658
|
+
* described — is passed through on its existing `balance × price`.
|
|
3659
|
+
*/
|
|
3660
|
+
declare function isShareBasedYieldToken(token: YieldTokenInput): boolean;
|
|
3661
|
+
/**
|
|
3662
|
+
* Declare the `convertToAssets` reads needed to value `tokens` correctly.
|
|
3663
|
+
*
|
|
3664
|
+
* Only share-based holdings with a non-zero balance produce a call, so a wallet
|
|
3665
|
+
* holding no vault tokens plans nothing and costs no RPC.
|
|
3666
|
+
*/
|
|
3667
|
+
declare function planYieldTokenConversions(tokens: YieldTokenInput[]): YieldConversionPlan;
|
|
3668
|
+
/**
|
|
3669
|
+
* Fold executed conversion results back into per-token valuations.
|
|
3670
|
+
*
|
|
3671
|
+
* `returns` must align with {@link YieldConversionPlan.calls} — entry `i` is the
|
|
3672
|
+
* raw return data of call `i`, or `null` if that read failed. The returned map is
|
|
3673
|
+
* keyed by {@link YieldTokenInput.key} and contains an entry for every input
|
|
3674
|
+
* token, converted or not, so the caller can apply it uniformly.
|
|
3675
|
+
*
|
|
3676
|
+
* A failed or undecodable read is never destructive: that token falls back to
|
|
3677
|
+
* `balance × price` — the value it would have had anyway — and is reported with
|
|
3678
|
+
* `converted: false`, so a flaky RPC understates a position at worst instead of
|
|
3679
|
+
* zeroing it.
|
|
3680
|
+
*/
|
|
3681
|
+
declare function applyYieldConversions(tokens: YieldTokenInput[], plan: YieldConversionPlan, returns: Array<string | null>): Map<string, YieldTokenValue>;
|
|
3682
|
+
|
|
3314
3683
|
/**
|
|
3315
3684
|
* MoralisService — Moralis Web3 API + Cortex AI proxy.
|
|
3316
3685
|
*
|
|
3317
3686
|
* Adapted from keyring-chatbot-agent-sdk moralis service.
|
|
3318
3687
|
* Uses native fetch — no SDK dependencies.
|
|
3319
3688
|
*/
|
|
3689
|
+
|
|
3320
3690
|
interface MoralisServiceConfig {
|
|
3321
3691
|
/** Base URL for Moralis proxy (default: https://nft.keyring.app) */
|
|
3322
3692
|
baseUrl?: string;
|
|
@@ -4704,6 +5074,13 @@ declare class MoralisService {
|
|
|
4704
5074
|
minMarketCap?: number;
|
|
4705
5075
|
securityScore?: number;
|
|
4706
5076
|
}): Promise<MoralisApiResponse<TopGainerToken[]>>;
|
|
5077
|
+
/**
|
|
5078
|
+
* USD price of each yield token's UNDERLYING, from this service's own
|
|
5079
|
+
* Pantograph host — see {@link fetchUnderlyingPricesUSD}. Public so the
|
|
5080
|
+
* single-token price reader (`readTokenUsdPrice`) values a vault against the
|
|
5081
|
+
* same host the balance path does.
|
|
5082
|
+
*/
|
|
5083
|
+
getUnderlyingPricesUSD(chain: string | undefined, yieldAssets: YieldTokenInput['yieldAsset'][]): Promise<Map<string, number>>;
|
|
4707
5084
|
/** Enrich token balances with price/logo data. Delegates to PantographService. */
|
|
4708
5085
|
private enrichTokenPrices;
|
|
4709
5086
|
/**
|
|
@@ -5924,141 +6301,6 @@ interface ApyEndpoints {
|
|
|
5924
6301
|
morphoApiUrl: string;
|
|
5925
6302
|
}
|
|
5926
6303
|
|
|
5927
|
-
/**
|
|
5928
|
-
* Shared ABI / hex types for the codec layer.
|
|
5929
|
-
*
|
|
5930
|
-
* Deliberately STRUCTURAL and loose (every field but `type` optional) rather
|
|
5931
|
-
* than viem's fully-inferred `Abi` generics: this core hand-writes its ABIs as
|
|
5932
|
-
* plain object literals — some without `as const` — and a strict type would
|
|
5933
|
-
* reject them at every call site for no runtime benefit. Validation happens
|
|
5934
|
-
* where it matters, at runtime, in {@link file://./signature.ts}.
|
|
5935
|
-
*/
|
|
5936
|
-
/** A 0x-prefixed hex string. */
|
|
5937
|
-
type Hex = `0x${string}`;
|
|
5938
|
-
/** A 0x-prefixed 20-byte address. */
|
|
5939
|
-
type Address = `0x${string}`;
|
|
5940
|
-
/** One ABI input/output parameter; `components` is present for tuples. */
|
|
5941
|
-
interface AbiParameter {
|
|
5942
|
-
readonly name?: string;
|
|
5943
|
-
readonly type: string;
|
|
5944
|
-
readonly internalType?: string;
|
|
5945
|
-
readonly components?: readonly AbiParameter[];
|
|
5946
|
-
/** Events only — whether the parameter is a topic. */
|
|
5947
|
-
readonly indexed?: boolean;
|
|
5948
|
-
}
|
|
5949
|
-
/** One ABI entry: function, event, error, constructor, fallback or receive. */
|
|
5950
|
-
interface AbiItem {
|
|
5951
|
-
readonly type?: string;
|
|
5952
|
-
readonly name?: string;
|
|
5953
|
-
readonly inputs?: readonly AbiParameter[];
|
|
5954
|
-
readonly outputs?: readonly AbiParameter[];
|
|
5955
|
-
readonly stateMutability?: string;
|
|
5956
|
-
readonly anonymous?: boolean;
|
|
5957
|
-
}
|
|
5958
|
-
/** A contract ABI. */
|
|
5959
|
-
type Abi = readonly AbiItem[];
|
|
5960
|
-
|
|
5961
|
-
/**
|
|
5962
|
-
* Chain shape — viem's `Chain`, plus a `hexId` because this core identifies
|
|
5963
|
-
* chains by hex id (`0x2105`) everywhere: in tool arguments, in `UserContext`,
|
|
5964
|
-
* and in the wallet payloads it hands the app.
|
|
5965
|
-
*/
|
|
5966
|
-
|
|
5967
|
-
/** A contract deployed at a known address on a chain. */
|
|
5968
|
-
interface ChainContract {
|
|
5969
|
-
address: Address;
|
|
5970
|
-
/** Block the contract was deployed at, when known — reads before it can't work. */
|
|
5971
|
-
blockCreated?: number;
|
|
5972
|
-
}
|
|
5973
|
-
/** The chain's one native coin (everything else on it is a token). */
|
|
5974
|
-
interface ChainNativeCurrency {
|
|
5975
|
-
name: string;
|
|
5976
|
-
symbol: string;
|
|
5977
|
-
decimals: number;
|
|
5978
|
-
}
|
|
5979
|
-
interface Chain {
|
|
5980
|
-
/** Decimal chain id (`8453`). */
|
|
5981
|
-
id: number;
|
|
5982
|
-
/** Canonical hex chain id (`0x2105`) — this core's primary key for a chain. */
|
|
5983
|
-
hexId: Hex;
|
|
5984
|
-
/** Display name, as shown to users. */
|
|
5985
|
-
name: string;
|
|
5986
|
-
nativeCurrency: ChainNativeCurrency;
|
|
5987
|
-
rpcUrls: {
|
|
5988
|
-
default: {
|
|
5989
|
-
http: readonly string[];
|
|
5990
|
-
};
|
|
5991
|
-
};
|
|
5992
|
-
blockExplorers?: {
|
|
5993
|
-
default: {
|
|
5994
|
-
name: string;
|
|
5995
|
-
url: string;
|
|
5996
|
-
};
|
|
5997
|
-
};
|
|
5998
|
-
/** Well-known contracts; `multicall3` is what the batching layer needs. */
|
|
5999
|
-
contracts?: {
|
|
6000
|
-
multicall3?: ChainContract;
|
|
6001
|
-
};
|
|
6002
|
-
testnet?: boolean;
|
|
6003
|
-
}
|
|
6004
|
-
|
|
6005
|
-
/**
|
|
6006
|
-
* The 12 EVM chains this core supports, as viem-shaped {@link Chain} objects.
|
|
6007
|
-
*
|
|
6008
|
-
* One definition per chain carries everything the stack needs — decimal id, hex
|
|
6009
|
-
* id, display name, native coin, default public RPC and the Multicall3
|
|
6010
|
-
* deployment — so nothing has to be threaded through call sites or duplicated in
|
|
6011
|
-
* a second table.
|
|
6012
|
-
*
|
|
6013
|
-
* Multicall3 sits at the SAME deterministic address on every one of them
|
|
6014
|
-
* (verified on-chain via `eth_getCode`), but each chain still spells it out: a
|
|
6015
|
-
* chain that ever ships it elsewhere is then a one-line change here.
|
|
6016
|
-
*
|
|
6017
|
-
* `blockCreated` is advisory metadata — it only gates reads pinned to a
|
|
6018
|
-
* HISTORICAL block (a read at `latest`, the default, never consults it) — and is
|
|
6019
|
-
* left out where the deployment block isn't confirmed.
|
|
6020
|
-
*
|
|
6021
|
-
* `rpcUrls.default.http` is an ORDERED PREFERENCE LIST, not a single endpoint:
|
|
6022
|
-
* the first entry is the one normally used, and the rest are fixed backups the
|
|
6023
|
-
* {@link file://../transports/fallback.ts} transport walks down when a request
|
|
6024
|
-
* fails transiently (rate limit, 5xx, timeout). A public endpoint rejecting the
|
|
6025
|
-
* odd method — eth.llamarpc.com answering `eth_gasPrice` with HTTP 525, say —
|
|
6026
|
-
* therefore degrades to a slower answer rather than no answer.
|
|
6027
|
-
*/
|
|
6028
|
-
|
|
6029
|
-
/** Canonical Multicall3 address, identical on every supported chain. */
|
|
6030
|
-
declare const MULTICALL3_ADDRESS: "0xcA11bde05977b3631167028862bE2a173976CA11";
|
|
6031
|
-
/** Every supported chain, in the core's canonical order. */
|
|
6032
|
-
declare const chains: readonly Chain[];
|
|
6033
|
-
|
|
6034
|
-
/**
|
|
6035
|
-
* Domain-level batched reads, on top of the chain stack
|
|
6036
|
-
* ({@link file://../chain/index.ts}).
|
|
6037
|
-
*
|
|
6038
|
-
* The Multicall3 plumbing this file used to carry — the hand-written
|
|
6039
|
-
* `aggregate3` encoder, the `(bool,bytes)[]` reader, the chunking loop — now
|
|
6040
|
-
* lives in `chain/actions/multicall.ts` and `chain/actions/multicallRaw.ts`,
|
|
6041
|
-
* where it is ABI-driven and reusable. What remains here are the three helpers
|
|
6042
|
-
* the core's services actually ask for, with their signatures and their
|
|
6043
|
-
* never-throws, positionally-aligned contracts unchanged:
|
|
6044
|
-
*
|
|
6045
|
-
* - {@link multicallRead} raw calldata in, raw return data out
|
|
6046
|
-
* - {@link multicallErc20Metadata} symbol + decimals, incl. legacy bytes32 tokens
|
|
6047
|
-
* - {@link multicallTokenUris} ERC-721 `tokenURI` for many NFTs
|
|
6048
|
-
*
|
|
6049
|
-
* For anything new, prefer the client directly — `getPublicClient(chainId)` then
|
|
6050
|
-
* `.multicall({ contracts })` — which decodes results and reports typed
|
|
6051
|
-
* per-entry errors instead of `null`.
|
|
6052
|
-
*/
|
|
6053
|
-
|
|
6054
|
-
/** One read in a {@link multicallRead} batch: a target contract + full calldata. */
|
|
6055
|
-
interface MulticallRequest {
|
|
6056
|
-
/** Contract to call. A malformed address yields a `null` result. */
|
|
6057
|
-
target: string;
|
|
6058
|
-
/** Encoded calldata — selector + ABI-encoded args, 0x-prefixed. */
|
|
6059
|
-
callData: string;
|
|
6060
|
-
}
|
|
6061
|
-
|
|
6062
6304
|
/**
|
|
6063
6305
|
* Address helpers — EIP-55 checksumming and validation, matching viem's
|
|
6064
6306
|
* `isAddress` / `getAddress` / `isAddressEqual`.
|
|
@@ -10985,6 +11227,17 @@ interface SpendableBalance {
|
|
|
10985
11227
|
*
|
|
10986
11228
|
* `null` on every failure, and for a price of zero: see {@link usablePrice} for
|
|
10987
11229
|
* why an unpriced token must not be reported as a worthless one.
|
|
11230
|
+
*
|
|
11231
|
+
* A yield token is priced in the unit its balance is in, as the wallet's token
|
|
11232
|
+
* list and its own balance rows (`getWalletTokenBalances`) price it:
|
|
11233
|
+
* - share-based vault → the price of ONE SHARE, converted on-chain. The API's
|
|
11234
|
+
* `usd_price` for a vault is its UNDERLYING's, so reading it raw undervalues
|
|
11235
|
+
* each share by the accrued yield — "swap $100 of a vault" then sold ~5%
|
|
11236
|
+
* (Morpho USDC) to ~18% (syrupUSDC) more shares than $100. `null` when the
|
|
11237
|
+
* read fails: the raw price is in the wrong unit, so none beats it.
|
|
11238
|
+
* - rebasing receipt → the underlying's unit price (`fixedPrice` when sent).
|
|
11239
|
+
* The identity rides on the metadata row already fetched, so a plain token
|
|
11240
|
+
* costs nothing extra, and a vault one multicall.
|
|
10988
11241
|
*/
|
|
10989
11242
|
declare function readTokenUsdPrice(input: {
|
|
10990
11243
|
moralis?: MoralisService;
|
|
@@ -12553,238 +12806,258 @@ declare function createX402SignatureProvider(opts: {
|
|
|
12553
12806
|
}): X402RetryHandler;
|
|
12554
12807
|
|
|
12555
12808
|
/**
|
|
12556
|
-
*
|
|
12557
|
-
*
|
|
12558
|
-
* A wallet's token list shows a balance and a price, and normally the USD value
|
|
12559
|
-
* is just the product of the two. For yield-bearing tokens that is wrong often
|
|
12560
|
-
* enough to matter, and the reason splits the tagged tokens into two kinds:
|
|
12561
|
-
*
|
|
12562
|
-
* - **Share-based vaults** (`spark`, `spark-ethereum`, `morpho-v2`) — `balanceOf`
|
|
12563
|
-
* returns ERC-4626 SHARES, while the price the token API quotes belongs to the
|
|
12564
|
-
* vault's UNDERLYING asset. A share is worth more than one unit of underlying
|
|
12565
|
-
* and drifts further up as yield accrues (measured live: 1 steakUSDC = 1.0354
|
|
12566
|
-
* USDC, 1 Spark sUSDC = 1.1051 USDC). The two are not even in the same unit —
|
|
12567
|
-
* shares carry the vault's own decimals, usually 18, against the underlying's
|
|
12568
|
-
* 6 for USDC. `convertToAssets(shares)` answers both problems at once: it
|
|
12569
|
-
* returns the position denominated in exactly what the price describes.
|
|
12570
|
-
*
|
|
12571
|
-
* - **Rebasing tokens** (`aave-v3`, `compound-v3`) — the balance is ALREADY the
|
|
12572
|
-
* underlying (their decimals match it) and yield arrives as a growing
|
|
12573
|
-
* `balanceOf`. Converting these would be a bug, so they are left untouched.
|
|
12574
|
-
*
|
|
12575
|
-
* - **Oracle-priced shares** (`spark-l2-susds`) — share-based like the first
|
|
12576
|
-
* group, but with no `convertToAssets` to ask: bridged sUSDS is a plain ERC-20
|
|
12577
|
-
* on its chain (the vault stays on Ethereum), so the conversion reads the SSR
|
|
12578
|
-
* oracle's ray-scaled rate and multiplies. Still ONE call per token, decoded
|
|
12579
|
-
* differently — see {@link YieldConversionPlan.rateKeys}. Needs
|
|
12580
|
-
* {@link YieldTokenInput.chain}, since the oracle is per chain.
|
|
12581
|
-
*
|
|
12582
|
-
* Which side a token falls on is decided by an explicit allow-list of
|
|
12583
|
-
* share-based protocols, mirroring the wallet app's own `LENDING_PLATFORMS`.
|
|
12584
|
-
* The protocol classes encode the same split as `balanceIsUnderlying`, but that
|
|
12585
|
-
* flag is reached through `protocolFor`, which falls back to an ERC-4626
|
|
12586
|
-
* protocol for types it doesn't recognise — a safe default for listing lending
|
|
12587
|
-
* markets, and the wrong one here, where a mistaken conversion silently
|
|
12588
|
-
* corrupts a balance. An allow-list fails closed instead.
|
|
12589
|
-
*
|
|
12590
|
-
* ## Why this returns calls instead of making them
|
|
12591
|
-
*
|
|
12592
|
-
* Same reasoning as {@link LendingProtocol}: the caller owns the transport. The
|
|
12593
|
-
* wallet app already has its own RPC stack — ranked endpoints, failover, a
|
|
12594
|
-
* Multicall3 batcher, and rate-limit-aware pacing for chains without Multicall3 —
|
|
12595
|
-
* and duplicating it here would mean a second, worse copy. So
|
|
12596
|
-
* {@link planYieldTokenConversions} declares the reads, the caller executes them
|
|
12597
|
-
* however it likes, and {@link applyYieldConversions} folds the answers back in.
|
|
12598
|
-
* Both halves are pure and synchronous, which also makes them trivial to test.
|
|
12599
|
-
*/
|
|
12600
|
-
|
|
12601
|
-
/**
|
|
12602
|
-
* Whether a `yieldProtocol` denominates balances in vault SHARES rather than the
|
|
12603
|
-
* underlying asset.
|
|
12604
|
-
*
|
|
12605
|
-
* Exported so callers can explain a decision — logging why a tagged token was
|
|
12606
|
-
* skipped, say — without keeping their own copy of the list, which would drift.
|
|
12607
|
-
* This answers only the protocol question: use {@link isShareBasedYieldToken}
|
|
12608
|
-
* for whether a specific token is actually convertible, since that also needs a
|
|
12609
|
-
* price and the underlying's decimals.
|
|
12610
|
-
*/
|
|
12611
|
-
declare function isShareBasedProtocol(yieldProtocol?: string | null): yieldProtocol is string;
|
|
12612
|
-
/**
|
|
12613
|
-
* The price ONE unit of a token's underlying is valued at.
|
|
12614
|
-
*
|
|
12615
|
-
* Two sources, in order:
|
|
12616
|
-
*
|
|
12617
|
-
* 1. `yieldAsset.fixedPrice` — the API stating that this underlying is valued
|
|
12618
|
-
* at a fixed rate rather than at its market print. It sends `1` for USDC
|
|
12619
|
-
* vaults (verified live on Base for both `spark` sUSDC and `compound-v3`
|
|
12620
|
-
* cUSDCv3), which is the redemption rate a holder actually gets.
|
|
12621
|
-
* 2. `priceUSD` — the market quote, for everything else.
|
|
12622
|
-
*
|
|
12623
|
-
* ## Why a fixed price is the better number when the API sends one
|
|
12624
|
-
*
|
|
12625
|
-
* `convertToAssets` returns an amount of the UNDERLYING, and for a dollar
|
|
12626
|
-
* stablecoin that amount IS the dollar figure: redemption is 1:1 by
|
|
12627
|
-
* construction. The market quote for the same asset is a live print — 0.99993
|
|
12628
|
-
* one refresh, 1.00007 the next — and because it multiplies the whole position,
|
|
12629
|
-
* that noise lands on the total: a $50,000 holding drifts by several dollars
|
|
12630
|
-
* between refreshes with nothing having happened on chain. Two screens
|
|
12631
|
-
* refreshing seconds apart then disagree, which reads as a bug in the balance
|
|
12632
|
-
* rather than as noise in a feed.
|
|
12809
|
+
* The yield identity of a RAW token API row — `yieldProtocol` + `yieldAsset` —
|
|
12810
|
+
* out of the two shapes the API can send each field in.
|
|
12633
12811
|
*
|
|
12634
|
-
*
|
|
12812
|
+
* The token API is migrating both fields:
|
|
12635
12813
|
*
|
|
12636
|
-
*
|
|
12637
|
-
*
|
|
12638
|
-
*
|
|
12639
|
-
* must be extended for every new stablecoin and every bridged variant, that
|
|
12640
|
-
* silently does nothing when an address is missed, and that no test can catch
|
|
12641
|
-
* drifting from the API's own view. Reading the field instead means a new
|
|
12642
|
-
* fixed-price asset needs no client release at all.
|
|
12814
|
+
* - protocol: `yieldProtocolV2` (new) → `yieldProtocol` (legacy)
|
|
12815
|
+
* - asset: `newConfig.yieldInfo` `{ assetToken, assetDecimals, assetFixedPrice }`
|
|
12816
|
+
* (new) → `yieldAsset` `{ address, decimals, fixedPrice }` (legacy)
|
|
12643
12817
|
*
|
|
12644
|
-
*
|
|
12818
|
+
* Today both are sent side by side, so reading only the legacy field happens to
|
|
12819
|
+
* work. The day the backend drops one, a reader that knows only the other stops
|
|
12820
|
+
* seeing the vault at all: its balance is then valued as if it were the
|
|
12821
|
+
* underlying, understating it by exactly the yield accrued.
|
|
12645
12822
|
*
|
|
12646
|
-
* This
|
|
12647
|
-
*
|
|
12648
|
-
*
|
|
12649
|
-
* same dollars. A plain wallet token has no `yieldAsset` and is unaffected: it
|
|
12650
|
-
* keeps its market quote, which is the honest number for something the user can
|
|
12651
|
-
* sell right now.
|
|
12823
|
+
* This is the same precedence the wallet applies (`resolveApiYieldProtocol` /
|
|
12824
|
+
* `resolveApiYieldAsset` in the app's `constants/lending`). Both must stay in
|
|
12825
|
+
* step, or the in-chat agent and the wallet screens value one vault differently.
|
|
12652
12826
|
*
|
|
12653
|
-
*
|
|
12654
|
-
*
|
|
12655
|
-
*
|
|
12827
|
+
* The three-state protocol answer is preserved rather than collapsed:
|
|
12828
|
+
* - `undefined` — neither field present: never answered, ask again later;
|
|
12829
|
+
* - `null` — answered "not a vault";
|
|
12830
|
+
* - a string — the tag.
|
|
12656
12831
|
*/
|
|
12657
|
-
|
|
12832
|
+
/** The underlying a yield token is denominated in — the shape valuation reads. */
|
|
12833
|
+
interface YieldAssetInfo {
|
|
12834
|
+
address?: string;
|
|
12835
|
+
decimals?: number;
|
|
12836
|
+
fixedPrice?: number | string | null;
|
|
12837
|
+
}
|
|
12838
|
+
/** A token API row, as far as its yield identity is concerned. */
|
|
12839
|
+
interface RawYieldIdentityRow {
|
|
12840
|
+
yieldProtocol?: string | null;
|
|
12841
|
+
yieldProtocolV2?: string | null;
|
|
12842
|
+
yieldAsset?: YieldAssetInfo | null;
|
|
12843
|
+
newConfig?: {
|
|
12844
|
+
yieldInfo?: {
|
|
12845
|
+
assetToken?: string | null;
|
|
12846
|
+
assetDecimals?: number | string | null;
|
|
12847
|
+
assetFixedPrice?: number | string | null;
|
|
12848
|
+
} | null;
|
|
12849
|
+
} | null;
|
|
12850
|
+
}
|
|
12851
|
+
/** The protocol tag of a raw row — `yieldProtocolV2` first, then `yieldProtocol`. */
|
|
12852
|
+
declare function resolveRawYieldProtocol(row: RawYieldIdentityRow | null | undefined): string | null | undefined;
|
|
12853
|
+
/** The underlying of a raw row — `newConfig.yieldInfo` first, then `yieldAsset`. */
|
|
12854
|
+
declare function resolveRawYieldAsset(row: RawYieldIdentityRow | null | undefined): YieldAssetInfo | null | undefined;
|
|
12658
12855
|
/**
|
|
12659
|
-
*
|
|
12660
|
-
*
|
|
12661
|
-
* as-is.
|
|
12856
|
+
* Both halves at once, or `null` when the row says nothing about yield at all —
|
|
12857
|
+
* so a caller keeping a map of identities records only rows that answered.
|
|
12662
12858
|
*/
|
|
12663
|
-
|
|
12664
|
-
|
|
12665
|
-
|
|
12666
|
-
|
|
12667
|
-
|
|
12668
|
-
|
|
12669
|
-
|
|
12670
|
-
|
|
12671
|
-
|
|
12859
|
+
declare function resolveRawYieldIdentity(row: RawYieldIdentityRow | null | undefined): {
|
|
12860
|
+
yieldProtocol: string | null | undefined;
|
|
12861
|
+
yieldAsset: YieldAssetInfo | null | undefined;
|
|
12862
|
+
} | null;
|
|
12863
|
+
|
|
12864
|
+
/**
|
|
12865
|
+
* PantographService — Pantograph API client.
|
|
12866
|
+
*
|
|
12867
|
+
* Handles token price/logo enrichment, token search, and token metadata
|
|
12868
|
+
* lookups via the Pantograph wallet API.
|
|
12869
|
+
*/
|
|
12870
|
+
|
|
12871
|
+
interface PantographServiceConfig {
|
|
12872
|
+
/** Pantograph API base URL (default: https://wallet-api.pantograph.app) */
|
|
12873
|
+
baseUrl?: string;
|
|
12874
|
+
}
|
|
12875
|
+
/** Maps hex chain ID → Pantograph chain name */
|
|
12876
|
+
declare const HEX_TO_PANTOGRAPH: Record<string, string>;
|
|
12877
|
+
/**
|
|
12878
|
+
* Default tokens to always surface in the trending list per chain (keyed by hex
|
|
12879
|
+
* chain ID). Mirrors the SDK's `tokenTrendingDefault`: these are prepended to
|
|
12880
|
+
* the top-gainers feed so staple assets (WETH/WBTC/…) appear even when they are
|
|
12881
|
+
* not currently "gaining". Addresses are lowercased for matching.
|
|
12882
|
+
*/
|
|
12883
|
+
declare const TRENDING_DEFAULT_BY_HEX_CHAIN: Record<string, string[]>;
|
|
12884
|
+
declare function toPantographChain(hexChain: string): string;
|
|
12885
|
+
/** Raw token shape returned by Pantograph list endpoints (pre-normalization). */
|
|
12886
|
+
interface PantographRawToken extends RawYieldIdentityRow {
|
|
12887
|
+
address?: string;
|
|
12888
|
+
token_address?: string;
|
|
12889
|
+
price?: number | string;
|
|
12890
|
+
icon_image?: string;
|
|
12891
|
+
decimals?: number | string;
|
|
12672
12892
|
/**
|
|
12673
|
-
*
|
|
12674
|
-
*
|
|
12675
|
-
*
|
|
12893
|
+
* Yield identity, carried through verbatim rather than normalised.
|
|
12894
|
+
*
|
|
12895
|
+
* These decide whether a balance is vault SHARES (which must be converted
|
|
12896
|
+
* on-chain before it can be valued) or already the underlying, so the
|
|
12897
|
+
* distinction between an ABSENT tag and a tag of `null` matters to callers:
|
|
12898
|
+
* absent means the question was never answered and should be re-asked, null
|
|
12899
|
+
* means answered "not a vault". Defaulting either one here would erase that.
|
|
12900
|
+
*
|
|
12901
|
+
* Each also has a newer field (`yieldProtocolV2`, `newConfig.yieldInfo`,
|
|
12902
|
+
* declared on {@link RawYieldIdentityRow}); read the pair through
|
|
12903
|
+
* `resolveRawYieldIdentity`, never field by field.
|
|
12676
12904
|
*/
|
|
12677
|
-
priceUSD: number;
|
|
12678
|
-
/** `yieldProtocol` from the token API; anything untagged is left alone. */
|
|
12679
12905
|
yieldProtocol?: string | null;
|
|
12906
|
+
yieldAsset?: {
|
|
12907
|
+
address?: string;
|
|
12908
|
+
decimals?: number;
|
|
12909
|
+
fixedPrice?: number | string | null;
|
|
12910
|
+
} | null;
|
|
12680
12911
|
/**
|
|
12681
|
-
* `
|
|
12682
|
-
*
|
|
12683
|
-
*
|
|
12684
|
-
* `fixedPrice` is the API declaring that this underlying is valued at a fixed
|
|
12685
|
-
* rate rather than at its market quote (it sends `1` for USDC). When present
|
|
12686
|
-
* it takes precedence over {@link priceUSD}; see {@link effectivePriceUSD}.
|
|
12912
|
+
* The contract's own `symbol()`, as the index read it. `null` (or absent) when
|
|
12913
|
+
* the index never resolved one — see {@link TokenMetadata.symbolOnchain}.
|
|
12687
12914
|
*/
|
|
12915
|
+
symbolOnchain?: string | null;
|
|
12916
|
+
}
|
|
12917
|
+
/**
|
|
12918
|
+
* The yield half of a token API row — what decides whether a quoted price
|
|
12919
|
+
* belongs to the unit a balance is denominated in.
|
|
12920
|
+
*
|
|
12921
|
+
* Split out of {@link PantographRawToken} so {@link
|
|
12922
|
+
* PantographService.enrichTokenPrices} can hand it back without exposing the
|
|
12923
|
+
* rest of that private wire shape.
|
|
12924
|
+
*/
|
|
12925
|
+
interface PantographYieldIdentity {
|
|
12926
|
+
yieldProtocol?: string | null;
|
|
12688
12927
|
yieldAsset?: {
|
|
12689
12928
|
address?: string;
|
|
12690
12929
|
decimals?: number;
|
|
12691
12930
|
fixedPrice?: number | string | null;
|
|
12692
12931
|
} | null;
|
|
12932
|
+
}
|
|
12933
|
+
declare class PantographService {
|
|
12934
|
+
private baseUrl;
|
|
12935
|
+
constructor(config?: PantographServiceConfig);
|
|
12693
12936
|
/**
|
|
12694
|
-
*
|
|
12695
|
-
*
|
|
12696
|
-
*
|
|
12937
|
+
* Build the unified token metadata + price endpoint for a chain:
|
|
12938
|
+
* `/keyrings/tokens/all/{chainId}?addresses=…`, where `{chainId}` is the
|
|
12939
|
+
* DECIMAL chain id (hex → number). One route serves every chain — no per-chain
|
|
12940
|
+
* slug — so token lookups work the same on Ethereum, Gnosis, or any other EVM.
|
|
12941
|
+
*/
|
|
12942
|
+
private tokensUrl;
|
|
12943
|
+
/**
|
|
12944
|
+
* Fetch token metadata + price rows for any number of contracts on one chain,
|
|
12945
|
+
* split across as many `/keyrings/tokens/all/{chainId}` requests as needed.
|
|
12697
12946
|
*
|
|
12698
|
-
*
|
|
12699
|
-
*
|
|
12700
|
-
*
|
|
12947
|
+
* Batches run in parallel and their rows are concatenated, so the caller sees
|
|
12948
|
+
* one flat list and cannot tell how many requests produced it. A batch that
|
|
12949
|
+
* fails contributes nothing rather than failing the whole call: every caller
|
|
12950
|
+
* here degrades per token (a missing row means no price, not an error), so
|
|
12951
|
+
* losing one chunk of a large wallet is strictly better than losing all of it.
|
|
12952
|
+
*
|
|
12953
|
+
* `chainId` is the DECIMAL id this route is keyed by; callers holding a hex
|
|
12954
|
+
* chain convert before calling.
|
|
12701
12955
|
*/
|
|
12702
|
-
|
|
12703
|
-
}
|
|
12704
|
-
/** One declared `convertToAssets` read, tagged with the token it belongs to. */
|
|
12705
|
-
interface YieldConversionCall extends MulticallRequest {
|
|
12706
|
-
/** {@link YieldTokenInput.key} of the token this call resolves. */
|
|
12707
|
-
key: string;
|
|
12708
|
-
}
|
|
12709
|
-
/** What {@link planYieldTokenConversions} worked out, ready to execute. */
|
|
12710
|
-
interface YieldConversionPlan {
|
|
12711
|
-
/** Reads to perform, in order. Empty when nothing needs converting. */
|
|
12712
|
-
calls: YieldConversionCall[];
|
|
12956
|
+
private fetchTokensAll;
|
|
12713
12957
|
/**
|
|
12714
|
-
*
|
|
12715
|
-
*
|
|
12716
|
-
* against its chain's SSR oracle instead.
|
|
12958
|
+
* Enrich token balances with price and logo data from Pantograph.
|
|
12959
|
+
* Mutates the array in-place. Non-fatal: silently skips on failure.
|
|
12717
12960
|
*
|
|
12718
|
-
*
|
|
12719
|
-
*
|
|
12720
|
-
*
|
|
12721
|
-
*
|
|
12961
|
+
* Also RETURNS the yield identity of each row it saw, keyed by lower-cased
|
|
12962
|
+
* address. The `usd_value` written here is `balance × price`, which is the
|
|
12963
|
+
* wrong arithmetic for a share-based vault: the balance is ERC-4626 SHARES
|
|
12964
|
+
* while the price quotes the UNDERLYING. Correcting that needs an on-chain
|
|
12965
|
+
* `convertToAssets`, which this method cannot do — it is the price-and-logo
|
|
12966
|
+
* pass, not an RPC one — so it hands the caller what the fix requires instead.
|
|
12967
|
+
*
|
|
12968
|
+
* Returned rather than folded onto the tokens because {@link TokenBalance} is
|
|
12969
|
+
* the Moralis wire shape and these are Pantograph's fields; and returned
|
|
12970
|
+
* rather than re-fetched by the caller because a second request to the same
|
|
12971
|
+
* endpoint would cost a round-trip to learn what this one already parsed.
|
|
12722
12972
|
*/
|
|
12723
|
-
|
|
12724
|
-
}
|
|
12725
|
-
/** A token's corrected valuation. */
|
|
12726
|
-
interface YieldTokenValue {
|
|
12727
|
-
/** Position size in UNDERLYING units (e.g. USDC), not shares. */
|
|
12728
|
-
underlyingAmount: number;
|
|
12729
|
-
/** `underlyingAmount × priceUSD`. */
|
|
12730
|
-
valueUSD: number;
|
|
12973
|
+
enrichTokenPrices(tokens: TokenBalance[], moralisChain: string): Promise<Map<string, PantographYieldIdentity>>;
|
|
12731
12974
|
/**
|
|
12732
|
-
*
|
|
12975
|
+
* Raw pricing rows for specific contracts, with their yield identity intact.
|
|
12733
12976
|
*
|
|
12734
|
-
*
|
|
12735
|
-
*
|
|
12736
|
-
*
|
|
12977
|
+
* Separate from {@link enrichTokenPrices} because that one answers a different
|
|
12978
|
+
* question: it folds a price and a logo onto balances it was handed, dropping
|
|
12979
|
+
* everything else. Yield valuation needs the fields it drops — `decimals`, and
|
|
12980
|
+
* the `yieldProtocol` / `yieldAsset` pair that decides whether the quoted price
|
|
12981
|
+
* even belongs to the unit the balance is in.
|
|
12982
|
+
*
|
|
12983
|
+
* Rows are returned VERBATIM rather than normalised: `decimals` arrives as a
|
|
12984
|
+
* string on some tokens and an absent `yieldProtocol` must stay absent (see
|
|
12985
|
+
* {@link PantographRawToken}), so coercing here would destroy the very
|
|
12986
|
+
* distinctions the caller reads.
|
|
12987
|
+
*
|
|
12988
|
+
* Accepts a decimal or hex chain id — this route is keyed by the decimal id and
|
|
12989
|
+
* serves every EVM chain, so no per-chain slug is involved. Never throws: a
|
|
12990
|
+
* failed request yields an empty array, and the caller degrades per token.
|
|
12737
12991
|
*/
|
|
12738
|
-
|
|
12739
|
-
/**
|
|
12740
|
-
|
|
12992
|
+
getYieldPricingTokens(chainId: string | number, addresses: string[]): Promise<Array<PantographRawToken>>;
|
|
12993
|
+
/**
|
|
12994
|
+
* Fetch metadata + price for a single token from Pantograph.
|
|
12995
|
+
* Returns null if the token is not found or the request fails.
|
|
12996
|
+
*/
|
|
12997
|
+
getTokenMetadata(address: string, moralisChain: string): Promise<TokenMetadata | null>;
|
|
12998
|
+
getTokensMetadata(addresses: string[], moralisChain: string): Promise<Record<string, TokenMetadata>>;
|
|
12999
|
+
/**
|
|
13000
|
+
* Search for tokens by symbol or name keyword on a specific chain.
|
|
13001
|
+
* Uses the Pantograph /token-list/all endpoint.
|
|
13002
|
+
*/
|
|
13003
|
+
searchTokensByKey(params: {
|
|
13004
|
+
key: string;
|
|
13005
|
+
chain?: string;
|
|
13006
|
+
}): Promise<MoralisApiResponse<TokenMetadata[]>>;
|
|
13007
|
+
/**
|
|
13008
|
+
* List trending tokens on a chain via Pantograph's top-gainers endpoint:
|
|
13009
|
+
* `GET /token-list/all/top-gainers?chainId={chainId}&duration=24h&limit=N`.
|
|
13010
|
+
*
|
|
13011
|
+
* Mirrors the SDK's trending view: the chain's staple tokens
|
|
13012
|
+
* ({@link TRENDING_DEFAULT_BY_HEX_CHAIN}, e.g. WETH/WBTC) are fetched in
|
|
13013
|
+
* parallel and prepended to the top-gainers feed, then the merged list is
|
|
13014
|
+
* de-duplicated by address. This guarantees the default tokens always show
|
|
13015
|
+
* up even when they are not currently "gaining".
|
|
13016
|
+
*
|
|
13017
|
+
* `limit` behaviour:
|
|
13018
|
+
* - omitted → ALL default tokens + 5 top gainers (no cap).
|
|
13019
|
+
* - given N → exactly N tokens TOTAL (defaults + gainers, capped to N).
|
|
13020
|
+
*
|
|
13021
|
+
* Returns the canonical {@link TrendingToken} shape so it is a drop-in
|
|
13022
|
+
* replacement for `MoralisService.getTrendingTokens` — consumers reading
|
|
13023
|
+
* `symbol`, `name`, `usdPrice`, `pricePercentChange['24h']` and
|
|
13024
|
+
* `tokenAddress` work unchanged.
|
|
13025
|
+
*
|
|
13026
|
+
* Pantograph scopes results to a single chain (it has no cross-chain feed),
|
|
13027
|
+
* so when no `chain` is given we fall back to {@link DEFAULT_CHAIN} (Ethereum).
|
|
13028
|
+
*/
|
|
13029
|
+
getTrendingTokens(params?: {
|
|
13030
|
+
chain?: string;
|
|
13031
|
+
limit?: number;
|
|
13032
|
+
}): Promise<MoralisApiResponse<TrendingToken[]>>;
|
|
13033
|
+
/**
|
|
13034
|
+
* Fill missing `marketCap` / `totalVolume` on trending tokens via a single
|
|
13035
|
+
* `/keyrings/tokens/{chain}/v2` batch. Non-fatal: leaves fields null on error.
|
|
13036
|
+
*/
|
|
13037
|
+
private enrichTrendingMarketData;
|
|
13038
|
+
/** Fetch and normalize the raw top-gainers feed for a hex chain. */
|
|
13039
|
+
private fetchTopGainers;
|
|
13040
|
+
/**
|
|
13041
|
+
* List the top-gaining tokens on a chain via Pantograph's top-gainers feed:
|
|
13042
|
+
* `GET /token-list/all/top-gainers?chainId={chainId}&duration={duration}&limit=N`.
|
|
13043
|
+
*
|
|
13044
|
+
* Unlike {@link getTrendingTokens}, this does NOT prepend the chain's staple
|
|
13045
|
+
* tokens — it returns the raw gainers ranking only, so it answers "biggest
|
|
13046
|
+
* pumps" questions directly. Results are enriched with market cap / 24h volume
|
|
13047
|
+
* via a batched metadata call (the gainers feed omits those fields), then
|
|
13048
|
+
* returned in the canonical {@link TrendingToken} shape.
|
|
13049
|
+
*
|
|
13050
|
+
* Pantograph scopes results to a single chain (no cross-chain feed), so when
|
|
13051
|
+
* no `chain` is given we fall back to {@link DEFAULT_CHAIN} (Ethereum).
|
|
13052
|
+
*
|
|
13053
|
+
* `duration` accepts Pantograph windows: "1h", "24h", "7d", "30d".
|
|
13054
|
+
*/
|
|
13055
|
+
getTopGainers(params?: {
|
|
13056
|
+
chain?: string;
|
|
13057
|
+
limit?: number;
|
|
13058
|
+
duration?: string;
|
|
13059
|
+
}): Promise<MoralisApiResponse<TrendingToken[]>>;
|
|
12741
13060
|
}
|
|
12742
|
-
/**
|
|
12743
|
-
* True when a token's balance is ERC-4626 shares that must be converted.
|
|
12744
|
-
*
|
|
12745
|
-
* These are the same three conditions the wallet app (`coinpool-v2`) gates its
|
|
12746
|
-
* own portfolio conversion on, in the same order:
|
|
12747
|
-
*
|
|
12748
|
-
* 1. a known share-based protocol — its `LENDING_PLATFORMS` allow-list. Note
|
|
12749
|
-
* this is deliberately stricter than {@link protocolFor} alone, which falls
|
|
12750
|
-
* back to an ERC-4626 protocol for unrecognised types: the right default when
|
|
12751
|
-
* listing lending markets, but not here, where guessing wrong silently
|
|
12752
|
-
* corrupts a balance. Rebasing receipts (`aave-v3`, `compound-v3`) are
|
|
12753
|
-
* already underlying and are excluded by the list, exactly as they are there.
|
|
12754
|
-
* 2. `yieldAsset.decimals`, the scale the returned assets must be read at —
|
|
12755
|
-
* without it the result is an unscaled integer, not an amount;
|
|
12756
|
-
* 3. a usable `priceUSD` (finite and > 0). The conversion's whole purpose is to
|
|
12757
|
-
* produce a USD value, and with no price there is none to produce — the
|
|
12758
|
-
* read would cost an RPC call to compute `x × 0`. Worse, reporting a
|
|
12759
|
-
* converted price of 0 would overwrite the caller's own last-known-price
|
|
12760
|
-
* fallback, turning a priced row into a valueless one that dust filters then
|
|
12761
|
-
* hide. Leaving it untouched keeps whatever the caller already had.
|
|
12762
|
-
*
|
|
12763
|
-
* Anything failing these — rebasing, untagged, unpriced, or incompletely
|
|
12764
|
-
* described — is passed through on its existing `balance × price`.
|
|
12765
|
-
*/
|
|
12766
|
-
declare function isShareBasedYieldToken(token: YieldTokenInput): boolean;
|
|
12767
|
-
/**
|
|
12768
|
-
* Declare the `convertToAssets` reads needed to value `tokens` correctly.
|
|
12769
|
-
*
|
|
12770
|
-
* Only share-based holdings with a non-zero balance produce a call, so a wallet
|
|
12771
|
-
* holding no vault tokens plans nothing and costs no RPC.
|
|
12772
|
-
*/
|
|
12773
|
-
declare function planYieldTokenConversions(tokens: YieldTokenInput[]): YieldConversionPlan;
|
|
12774
|
-
/**
|
|
12775
|
-
* Fold executed conversion results back into per-token valuations.
|
|
12776
|
-
*
|
|
12777
|
-
* `returns` must align with {@link YieldConversionPlan.calls} — entry `i` is the
|
|
12778
|
-
* raw return data of call `i`, or `null` if that read failed. The returned map is
|
|
12779
|
-
* keyed by {@link YieldTokenInput.key} and contains an entry for every input
|
|
12780
|
-
* token, converted or not, so the caller can apply it uniformly.
|
|
12781
|
-
*
|
|
12782
|
-
* A failed or undecodable read is never destructive: that token falls back to
|
|
12783
|
-
* `balance × price` — the value it would have had anyway — and is reported with
|
|
12784
|
-
* `converted: false`, so a flaky RPC understates a position at worst instead of
|
|
12785
|
-
* zeroing it.
|
|
12786
|
-
*/
|
|
12787
|
-
declare function applyYieldConversions(tokens: YieldTokenInput[], plan: YieldConversionPlan, returns: Array<string | null>): Map<string, YieldTokenValue>;
|
|
12788
13061
|
|
|
12789
13062
|
/**
|
|
12790
13063
|
* Executing half of the yield-token valuation — the transport `yieldTokenValue`
|
|
@@ -12864,6 +13137,37 @@ interface YieldPricingOptions {
|
|
|
12864
13137
|
* it, so a caller mixing chains in one array is not silently re-pointed.
|
|
12865
13138
|
*/
|
|
12866
13139
|
declare function valueYieldTokens(chainId: string | number, tokens: YieldTokenInput[], options?: YieldPricingOptions): Promise<Map<string, YieldTokenValue>>;
|
|
13140
|
+
type YieldAsset = YieldTokenInput['yieldAsset'];
|
|
13141
|
+
/**
|
|
13142
|
+
* USD price of each UNDERLYING (`yieldAsset.address`), keyed by lowercased
|
|
13143
|
+
* address — ONE batched token-API lookup per chain.
|
|
13144
|
+
*
|
|
13145
|
+
* Needed because the vault's OWN quote is not a usable unit price. The API
|
|
13146
|
+
* prices vaults inconsistently: most at the underlying's price, but some
|
|
13147
|
+
* already at the per-SHARE price (measured on Ethereum: syrupUSDT +14%, sUSDS
|
|
13148
|
+
* +11%, spETH +2.9% over their underlying) and at least one below it (aEthsDAI
|
|
13149
|
+
* $0.9998 against sDAI's $1.18). Multiplying `convertToAssets` by a per-share
|
|
13150
|
+
* quote counts the yield twice; valuing a rebasing receipt at a wrong quote
|
|
13151
|
+
* misprices the whole balance. The underlying's own row has neither problem.
|
|
13152
|
+
*
|
|
13153
|
+
* A fixed-price asset needs no lookup and is skipped. Best-effort: a failed
|
|
13154
|
+
* lookup yields an empty map and {@link unitPriceUSD} falls back to the vault's
|
|
13155
|
+
* quote, which is what every token was valued at before this existed.
|
|
13156
|
+
*
|
|
13157
|
+
* Same rule as the wallet's `fetchAssetPrices` / `unitPriceOf` — both must stay
|
|
13158
|
+
* in step, or the agent and the wallet screens value one vault differently.
|
|
13159
|
+
*/
|
|
13160
|
+
declare function fetchUnderlyingPricesUSD(chainId: string | number, yieldAssets: YieldAsset[], pantograph?: PantographService): Promise<Map<string, number>>;
|
|
13161
|
+
/**
|
|
13162
|
+
* Price of ONE unit of a yield token's underlying, in the order the wallet
|
|
13163
|
+
* uses: `yieldAsset.fixedPrice` → the underlying's own API price (from
|
|
13164
|
+
* {@link fetchUnderlyingPricesUSD}) → `fallback`, the vault's own quote.
|
|
13165
|
+
*
|
|
13166
|
+
* This is what a {@link YieldTokenInput.priceUSD} must be set to. `fixedPrice`
|
|
13167
|
+
* still outranks it downstream through {@link effectivePriceUSD}, so the two
|
|
13168
|
+
* never disagree.
|
|
13169
|
+
*/
|
|
13170
|
+
declare function unitPriceUSD(yieldAsset: YieldAsset, underlyingPrices: Map<string, number>, fallback: number | string | null | undefined): number;
|
|
12867
13171
|
/**
|
|
12868
13172
|
* The USD price of ONE unit of a token, in the unit its balance is actually
|
|
12869
13173
|
* denominated in.
|
|
@@ -12878,9 +13182,11 @@ declare function valueYieldTokens(chainId: string | number, tokens: YieldTokenIn
|
|
|
12878
13182
|
* token they are swapping INTO, say.
|
|
12879
13183
|
*
|
|
12880
13184
|
* Returns:
|
|
12881
|
-
* - the API price unchanged, and NO RPC, for every plain token
|
|
12882
|
-
*
|
|
12883
|
-
*
|
|
13185
|
+
* - the API price unchanged, and NO RPC, for every plain token;
|
|
13186
|
+
* - the underlying's unit price (`yieldAsset.fixedPrice` when sent, the API
|
|
13187
|
+
* price otherwise), and NO RPC, for a rebasing receipt (`aave-v3`,
|
|
13188
|
+
* `compound-v3`), whose balance is already the underlying — the same price
|
|
13189
|
+
* the balance path values it at;
|
|
12884
13190
|
* - the per-SHARE price for a share-based vault that converted;
|
|
12885
13191
|
* - `null` when there is no usable price, INCLUDING when a share-based vault's
|
|
12886
13192
|
* read fails. That last case is deliberate: the API price is known to be in
|
|
@@ -12900,7 +13206,12 @@ declare function resolveTokenPriceUSD(chainId: string | number, token: YieldPric
|
|
|
12900
13206
|
interface YieldPricingToken {
|
|
12901
13207
|
address?: string | null;
|
|
12902
13208
|
decimals?: number | string | null;
|
|
12903
|
-
/**
|
|
13209
|
+
/**
|
|
13210
|
+
* For a plain token, the API's quote. For a yield token, the price of ONE
|
|
13211
|
+
* unit of the UNDERLYING — {@link unitPriceUSD}, not the vault's own quote,
|
|
13212
|
+
* which the API sometimes already states per share (valuing on it would
|
|
13213
|
+
* count the yield twice). `yieldAsset.fixedPrice`, when sent, outranks it.
|
|
13214
|
+
*/
|
|
12904
13215
|
price?: number | string | null;
|
|
12905
13216
|
yieldProtocol?: string | null;
|
|
12906
13217
|
/** See {@link YieldTokenInput.yieldAsset}: `fixedPrice` outranks `price`. */
|
|
@@ -12992,200 +13303,6 @@ interface YieldPricingToken {
|
|
|
12992
13303
|
*/
|
|
12993
13304
|
declare function psm3For(chain: string | number | null | undefined): string | null;
|
|
12994
13305
|
|
|
12995
|
-
/**
|
|
12996
|
-
* PantographService — Pantograph API client.
|
|
12997
|
-
*
|
|
12998
|
-
* Handles token price/logo enrichment, token search, and token metadata
|
|
12999
|
-
* lookups via the Pantograph wallet API.
|
|
13000
|
-
*/
|
|
13001
|
-
|
|
13002
|
-
interface PantographServiceConfig {
|
|
13003
|
-
/** Pantograph API base URL (default: https://wallet-api.pantograph.app) */
|
|
13004
|
-
baseUrl?: string;
|
|
13005
|
-
}
|
|
13006
|
-
/** Maps hex chain ID → Pantograph chain name */
|
|
13007
|
-
declare const HEX_TO_PANTOGRAPH: Record<string, string>;
|
|
13008
|
-
/**
|
|
13009
|
-
* Default tokens to always surface in the trending list per chain (keyed by hex
|
|
13010
|
-
* chain ID). Mirrors the SDK's `tokenTrendingDefault`: these are prepended to
|
|
13011
|
-
* the top-gainers feed so staple assets (WETH/WBTC/…) appear even when they are
|
|
13012
|
-
* not currently "gaining". Addresses are lowercased for matching.
|
|
13013
|
-
*/
|
|
13014
|
-
declare const TRENDING_DEFAULT_BY_HEX_CHAIN: Record<string, string[]>;
|
|
13015
|
-
declare function toPantographChain(hexChain: string): string;
|
|
13016
|
-
/** Raw token shape returned by Pantograph list endpoints (pre-normalization). */
|
|
13017
|
-
interface PantographRawToken {
|
|
13018
|
-
address?: string;
|
|
13019
|
-
token_address?: string;
|
|
13020
|
-
price?: number | string;
|
|
13021
|
-
icon_image?: string;
|
|
13022
|
-
decimals?: number | string;
|
|
13023
|
-
/**
|
|
13024
|
-
* Yield identity, carried through verbatim rather than normalised.
|
|
13025
|
-
*
|
|
13026
|
-
* These decide whether a balance is vault SHARES (which must be converted
|
|
13027
|
-
* on-chain before it can be valued) or already the underlying, so the
|
|
13028
|
-
* distinction between an ABSENT tag and a tag of `null` matters to callers:
|
|
13029
|
-
* absent means the question was never answered and should be re-asked, null
|
|
13030
|
-
* means answered "not a vault". Defaulting either one here would erase that.
|
|
13031
|
-
*/
|
|
13032
|
-
yieldProtocol?: string | null;
|
|
13033
|
-
yieldAsset?: {
|
|
13034
|
-
address?: string;
|
|
13035
|
-
decimals?: number;
|
|
13036
|
-
fixedPrice?: number | string | null;
|
|
13037
|
-
} | null;
|
|
13038
|
-
/**
|
|
13039
|
-
* The contract's own `symbol()`, as the index read it. `null` (or absent) when
|
|
13040
|
-
* the index never resolved one — see {@link TokenMetadata.symbolOnchain}.
|
|
13041
|
-
*/
|
|
13042
|
-
symbolOnchain?: string | null;
|
|
13043
|
-
}
|
|
13044
|
-
/**
|
|
13045
|
-
* The yield half of a token API row — what decides whether a quoted price
|
|
13046
|
-
* belongs to the unit a balance is denominated in.
|
|
13047
|
-
*
|
|
13048
|
-
* Split out of {@link PantographRawToken} so {@link
|
|
13049
|
-
* PantographService.enrichTokenPrices} can hand it back without exposing the
|
|
13050
|
-
* rest of that private wire shape.
|
|
13051
|
-
*/
|
|
13052
|
-
interface PantographYieldIdentity {
|
|
13053
|
-
yieldProtocol?: string | null;
|
|
13054
|
-
yieldAsset?: {
|
|
13055
|
-
address?: string;
|
|
13056
|
-
decimals?: number;
|
|
13057
|
-
fixedPrice?: number | string | null;
|
|
13058
|
-
} | null;
|
|
13059
|
-
}
|
|
13060
|
-
declare class PantographService {
|
|
13061
|
-
private baseUrl;
|
|
13062
|
-
constructor(config?: PantographServiceConfig);
|
|
13063
|
-
/**
|
|
13064
|
-
* Build the unified token metadata + price endpoint for a chain:
|
|
13065
|
-
* `/keyrings/tokens/all/{chainId}?addresses=…`, where `{chainId}` is the
|
|
13066
|
-
* DECIMAL chain id (hex → number). One route serves every chain — no per-chain
|
|
13067
|
-
* slug — so token lookups work the same on Ethereum, Gnosis, or any other EVM.
|
|
13068
|
-
*/
|
|
13069
|
-
private tokensUrl;
|
|
13070
|
-
/**
|
|
13071
|
-
* Fetch token metadata + price rows for any number of contracts on one chain,
|
|
13072
|
-
* split across as many `/keyrings/tokens/all/{chainId}` requests as needed.
|
|
13073
|
-
*
|
|
13074
|
-
* Batches run in parallel and their rows are concatenated, so the caller sees
|
|
13075
|
-
* one flat list and cannot tell how many requests produced it. A batch that
|
|
13076
|
-
* fails contributes nothing rather than failing the whole call: every caller
|
|
13077
|
-
* here degrades per token (a missing row means no price, not an error), so
|
|
13078
|
-
* losing one chunk of a large wallet is strictly better than losing all of it.
|
|
13079
|
-
*
|
|
13080
|
-
* `chainId` is the DECIMAL id this route is keyed by; callers holding a hex
|
|
13081
|
-
* chain convert before calling.
|
|
13082
|
-
*/
|
|
13083
|
-
private fetchTokensAll;
|
|
13084
|
-
/**
|
|
13085
|
-
* Enrich token balances with price and logo data from Pantograph.
|
|
13086
|
-
* Mutates the array in-place. Non-fatal: silently skips on failure.
|
|
13087
|
-
*
|
|
13088
|
-
* Also RETURNS the yield identity of each row it saw, keyed by lower-cased
|
|
13089
|
-
* address. The `usd_value` written here is `balance × price`, which is the
|
|
13090
|
-
* wrong arithmetic for a share-based vault: the balance is ERC-4626 SHARES
|
|
13091
|
-
* while the price quotes the UNDERLYING. Correcting that needs an on-chain
|
|
13092
|
-
* `convertToAssets`, which this method cannot do — it is the price-and-logo
|
|
13093
|
-
* pass, not an RPC one — so it hands the caller what the fix requires instead.
|
|
13094
|
-
*
|
|
13095
|
-
* Returned rather than folded onto the tokens because {@link TokenBalance} is
|
|
13096
|
-
* the Moralis wire shape and these are Pantograph's fields; and returned
|
|
13097
|
-
* rather than re-fetched by the caller because a second request to the same
|
|
13098
|
-
* endpoint would cost a round-trip to learn what this one already parsed.
|
|
13099
|
-
*/
|
|
13100
|
-
enrichTokenPrices(tokens: TokenBalance[], moralisChain: string): Promise<Map<string, PantographYieldIdentity>>;
|
|
13101
|
-
/**
|
|
13102
|
-
* Raw pricing rows for specific contracts, with their yield identity intact.
|
|
13103
|
-
*
|
|
13104
|
-
* Separate from {@link enrichTokenPrices} because that one answers a different
|
|
13105
|
-
* question: it folds a price and a logo onto balances it was handed, dropping
|
|
13106
|
-
* everything else. Yield valuation needs the fields it drops — `decimals`, and
|
|
13107
|
-
* the `yieldProtocol` / `yieldAsset` pair that decides whether the quoted price
|
|
13108
|
-
* even belongs to the unit the balance is in.
|
|
13109
|
-
*
|
|
13110
|
-
* Rows are returned VERBATIM rather than normalised: `decimals` arrives as a
|
|
13111
|
-
* string on some tokens and an absent `yieldProtocol` must stay absent (see
|
|
13112
|
-
* {@link PantographRawToken}), so coercing here would destroy the very
|
|
13113
|
-
* distinctions the caller reads.
|
|
13114
|
-
*
|
|
13115
|
-
* Accepts a decimal or hex chain id — this route is keyed by the decimal id and
|
|
13116
|
-
* serves every EVM chain, so no per-chain slug is involved. Never throws: a
|
|
13117
|
-
* failed request yields an empty array, and the caller degrades per token.
|
|
13118
|
-
*/
|
|
13119
|
-
getYieldPricingTokens(chainId: string | number, addresses: string[]): Promise<Array<PantographRawToken>>;
|
|
13120
|
-
/**
|
|
13121
|
-
* Fetch metadata + price for a single token from Pantograph.
|
|
13122
|
-
* Returns null if the token is not found or the request fails.
|
|
13123
|
-
*/
|
|
13124
|
-
getTokenMetadata(address: string, moralisChain: string): Promise<TokenMetadata | null>;
|
|
13125
|
-
getTokensMetadata(addresses: string[], moralisChain: string): Promise<Record<string, TokenMetadata>>;
|
|
13126
|
-
/**
|
|
13127
|
-
* Search for tokens by symbol or name keyword on a specific chain.
|
|
13128
|
-
* Uses the Pantograph /token-list/all endpoint.
|
|
13129
|
-
*/
|
|
13130
|
-
searchTokensByKey(params: {
|
|
13131
|
-
key: string;
|
|
13132
|
-
chain?: string;
|
|
13133
|
-
}): Promise<MoralisApiResponse<TokenMetadata[]>>;
|
|
13134
|
-
/**
|
|
13135
|
-
* List trending tokens on a chain via Pantograph's top-gainers endpoint:
|
|
13136
|
-
* `GET /token-list/all/top-gainers?chainId={chainId}&duration=24h&limit=N`.
|
|
13137
|
-
*
|
|
13138
|
-
* Mirrors the SDK's trending view: the chain's staple tokens
|
|
13139
|
-
* ({@link TRENDING_DEFAULT_BY_HEX_CHAIN}, e.g. WETH/WBTC) are fetched in
|
|
13140
|
-
* parallel and prepended to the top-gainers feed, then the merged list is
|
|
13141
|
-
* de-duplicated by address. This guarantees the default tokens always show
|
|
13142
|
-
* up even when they are not currently "gaining".
|
|
13143
|
-
*
|
|
13144
|
-
* `limit` behaviour:
|
|
13145
|
-
* - omitted → ALL default tokens + 5 top gainers (no cap).
|
|
13146
|
-
* - given N → exactly N tokens TOTAL (defaults + gainers, capped to N).
|
|
13147
|
-
*
|
|
13148
|
-
* Returns the canonical {@link TrendingToken} shape so it is a drop-in
|
|
13149
|
-
* replacement for `MoralisService.getTrendingTokens` — consumers reading
|
|
13150
|
-
* `symbol`, `name`, `usdPrice`, `pricePercentChange['24h']` and
|
|
13151
|
-
* `tokenAddress` work unchanged.
|
|
13152
|
-
*
|
|
13153
|
-
* Pantograph scopes results to a single chain (it has no cross-chain feed),
|
|
13154
|
-
* so when no `chain` is given we fall back to {@link DEFAULT_CHAIN} (Ethereum).
|
|
13155
|
-
*/
|
|
13156
|
-
getTrendingTokens(params?: {
|
|
13157
|
-
chain?: string;
|
|
13158
|
-
limit?: number;
|
|
13159
|
-
}): Promise<MoralisApiResponse<TrendingToken[]>>;
|
|
13160
|
-
/**
|
|
13161
|
-
* Fill missing `marketCap` / `totalVolume` on trending tokens via a single
|
|
13162
|
-
* `/keyrings/tokens/{chain}/v2` batch. Non-fatal: leaves fields null on error.
|
|
13163
|
-
*/
|
|
13164
|
-
private enrichTrendingMarketData;
|
|
13165
|
-
/** Fetch and normalize the raw top-gainers feed for a hex chain. */
|
|
13166
|
-
private fetchTopGainers;
|
|
13167
|
-
/**
|
|
13168
|
-
* List the top-gaining tokens on a chain via Pantograph's top-gainers feed:
|
|
13169
|
-
* `GET /token-list/all/top-gainers?chainId={chainId}&duration={duration}&limit=N`.
|
|
13170
|
-
*
|
|
13171
|
-
* Unlike {@link getTrendingTokens}, this does NOT prepend the chain's staple
|
|
13172
|
-
* tokens — it returns the raw gainers ranking only, so it answers "biggest
|
|
13173
|
-
* pumps" questions directly. Results are enriched with market cap / 24h volume
|
|
13174
|
-
* via a batched metadata call (the gainers feed omits those fields), then
|
|
13175
|
-
* returned in the canonical {@link TrendingToken} shape.
|
|
13176
|
-
*
|
|
13177
|
-
* Pantograph scopes results to a single chain (no cross-chain feed), so when
|
|
13178
|
-
* no `chain` is given we fall back to {@link DEFAULT_CHAIN} (Ethereum).
|
|
13179
|
-
*
|
|
13180
|
-
* `duration` accepts Pantograph windows: "1h", "24h", "7d", "30d".
|
|
13181
|
-
*/
|
|
13182
|
-
getTopGainers(params?: {
|
|
13183
|
-
chain?: string;
|
|
13184
|
-
limit?: number;
|
|
13185
|
-
duration?: string;
|
|
13186
|
-
}): Promise<MoralisApiResponse<TrendingToken[]>>;
|
|
13187
|
-
}
|
|
13188
|
-
|
|
13189
13306
|
/**
|
|
13190
13307
|
* Deterministic Uniswap V3 pool-address derivation (CREATE2).
|
|
13191
13308
|
*
|
|
@@ -13520,4 +13637,4 @@ declare class AbortError extends Error {
|
|
|
13520
13637
|
*/
|
|
13521
13638
|
declare function isAbortError(err: unknown): boolean;
|
|
13522
13639
|
|
|
13523
|
-
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, type ApprovalTx, ApproveTokenTool, type ApyPoint, BaseNftAiTool, BaseSwapProvider, BaseTool, BaseWalletActionTool, type BlockParameters, type BlockTag, type BuildApprovalsParams, type BuyTokenSide, BuyTokenTool, CachedResource, 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, CoinpoolConfigApi, type ConfirmAddLiquidityTxProps, type ContractFunctionParameters, type CortexResponse, DEFAULT_CHAIN, DEFAULT_PROVIDER, DEFAULT_RPC_BY_CHAIN, DEFILLAMA_EXTRA_SIGNALS, DEFILLAMA_POOL_CHAIN_HEXES, DEFILLAMA_POOL_CHAIN_PARAM_DESCRIPTION, DebridgeProvider, type DecodedCall, type DecodedEvent, type DecodedParam, type DefaultSubagentName, DefiLlamaEstimatePoolYieldTool, type DefiLlamaEstimatePoolYieldToolConfig, type DefiLlamaPool, DefiLlamaPoolByAddressTool, type DefiLlamaPoolByAddressToolConfig, DefiLlamaPoolCandidateResolver, DefiLlamaPoolDetailTool, type DefiLlamaPoolDetailToolConfig, DefiLlamaPoolSearchTool, type DefiLlamaPoolSearchToolConfig, DefiLlamaPoolService, type DefiLlamaPoolServiceConfig, type DefiLlamaProtocolVersion, type DefiLlamaServiceResponse, type DefiLlamaSortBy, DefiLlamaTopPoolsTool, type DefiLlamaTopPoolsToolConfig, type DefiPosition, type DefiPositionDetails, type DefiPositionToken, type DefiProtocolSummary, type EIP1193RequestFn, EstimatePoolYieldTool, type EstimatePoolYieldToolConfig, type FeeContext, type FormattedDefiLlamaPool, GeminiProvider, GeminiSearchAiTool, type GeminiSearchAiToolConfig, HEX_TO_PANTOGRAPH, type Hex, type HolderChangePeriod, type HolderSupplyTier, type HttpMethod, type IngestKnowledgeBaseInput, type IngestKnowledgeBaseResult, type InputTokenInfo, type KBSearchResult, KeyringSettingApi, KnowledgeBase, type KnowledgeBaseEntry, type KnowledgeBaseProvider, type LLMProvider, type LLMProviderConfig, type LLMResponse, type LLMToolCall, type LendingMarket, type LendingMarketCardProps, LendingMarketDetailTool, type LendingMarketDetailToolConfig, type LendingMarketListProps, type LendingMarketOverview, LendingMarketsTool, type LendingMarketsToolConfig, type LendingProtocolType, LendingReadService, LendingService, type LendingServiceConfig, type LendingSupplyPosition, LendingSupplyService, MULTICALL3_ADDRESS, ManageLiquidityRedirectTool, type MarketplaceLink, type MoralisApiResponse, MoralisService, type MoralisServiceConfig, type MulticallParameters, type MulticallRawParameters, type MulticallResult, NATIVE_GAS_LIMIT, 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 NativeActionKind, type NativeGasGap, type NativeTokenInfo, NfcBuyTool, NfcInfoTool, type NftTransferLastSale, NoFormTool, type NoFormToolMessages, OpenAddLiquidityFormTool, type OpenAddLiquidityFormToolConfig, OpenSupplyFormTool, type OpenSupplyFormToolConfig, POOL_UNISWAP_AGENT_TOOL_NAMES, PantographService, type PantographServiceConfig, type PantographYieldIdentity, type PaymentToken, PoolByAddressTool, type PoolByAddressToolConfig, PoolDetailTool, type PoolDetailToolConfig, type PoolDisplayInfo, PoolFallbackAiTool, type PoolFallbackAiToolConfig, type PoolOnchainInfo, PoolPriceRangesTool, type PoolPriceRangesToolConfig, PoolSearchTool, type PoolSearchToolConfig, PoolService, type PoolServiceConfig, PoolSwapRouter, type PresetInputs, PreviewAddLiquidityTool, type PreviewAddLiquidityToolConfig, type PriceBounds, type PriceRangePrefill, type ProviderName, PublicClient, type PublicClientConfig, type QuickRate, type QuoteGas, type RangePreset, type ReActPhase, type ReActStep, type ReActTrace, type ReadContractParameters, RelayProvider, type ResolvedRange, Router, type RouterAssignment, type RouterDecision, SUPPLIABLE_TYPES, SUPPORTED_CHAINS, SUPPORTED_CHAINS_LABEL, SWAP_PROVIDER_CONFIG, SendNativeTool, SendNftTool, SendTokenTool, type SpendableBalance, 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 SuppliableMarket, type SupplyProtocolType, type SupplyUsdcProps, type SupportedChainId, type SupportedChainName, type SwapProviderConfig, type SwapProviderConfigMap, SwapProviderFactory, type SwapQuoteParams, type SwapQuoteResult, type SwapRoute, type SwapRouteRequest, SwapRouter, SwapRouterRegistry, type SwapTokenFormProps, 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, UNRESOLVED_ASSET, type UnsignedTx, type UpstashEmbedStrategy, type UpstashFusionAlgorithm, type UpstashKBUpsertEntry, UpstashKnowledgeBase, type UpstashKnowledgeBaseConfig, type UserContext, UserSwapRouter, 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 YieldPricingOptions, type YieldPricingToken, type YieldTokenInput, type YieldTokenValue, ZERO_ADDRESS, amazonDomainForLanguage, apiClient, applyYieldConversions, buildApprovals, buildChallenge, buildRangePresets, buildUniswapPoolUrl, call, canDeriveV3PoolAddress, chains, checkNativeGasAffordable, checksumAddress, clampTick, clearPublicClientCache, coinpoolConfigApi, compareDecimal, completeX402, configureSupportedChains, configureSwapProvider, convertSusdsShares, createAiAgent, createDefaultSubagents, createNfcAgent, createNftAgent, createPoolUniswapAgent, createPublicClient, createTokenAgent, createTransport, createWalletActionAgent, createWalletAgent, createX402SignatureProvider, decodeAbiParameters, decodeErrorResult, decodeFunctionData, decodeFunctionResult, defiLlamaPoolInfoScope, defiLlamaPoolSupportsLabel, deriveV3PoolAddress, displayFromChallenge, effectivePriceUSD, encodeAbiParameters, encodeApprove, encodeErrorResult, encodeFunctionData, encodeSignedHeader, erc1155Abi, erc20Abi, erc20Abi_bytes32, erc721Abi, estimateGas, estimateNativeGasReserveWei, estimateTransactionFeeWei, ethCallAt, ethCallByChain, exactAmountString, extractOutRaw, extractQuoteError, fallback, feeWeiToNative, fetchTopMarketplaces, floorToDecimals, formatDefiLlamaPool, getAbiItem, getAddress, getBalance, getBlock, getBlockNumber, getChain, getChainContractAddress, getChainId, getChainMeta, getCode, getDefaultRpcUrl, getGasPrice, getNativeTokenInfo, getPublicClient, getRevertReason, getRpcOverrides, getStorageAt, getTokenPriceUSD, getTransactionCount, http, humanToWei, ingestKnowledgeBase, isAbortError, isAddress, isAddressEqual, isPaymentRequired, isShareBasedProtocol, isShareBasedYieldToken, isSupplyChain, keyringSettingApi, listCandidateChains, listSupplyChains, mulDivFloor, multicall, multicall3Abi, multicallRaw, nativeGasShortfall, nfcAmazonSearchUrl, normaliseCountry, normalizeDecimal, normalizePriceRangeToPool, parseAbi, parseAbiItem, parseAbiParameters, pickLogo, planYieldTokenConversions, priceToTick, protocolLabelFor, psm3For, readContract, readPaymentError, readPaymentRequired, readProtocolFeeWei, readReceipt, readSpendableBalance, readTokenUsdPrice, registerMaybeNoForm, requestWithX402, resolveGasLimit, resolveNfcShopLinks, resolveRpcUrl, resolveRpcUrls, resolveTokenPriceUSD, roundTickToSpacing, rpcCall, setRpcOverrides, spendableNative, swapProviderFactory, swapRouterRegistry, tickToPrice, toEventSelector, toFunctionSelector, toPantographChain, toPlainDecimal, valueYieldTokens, weiToHuman };
|
|
13640
|
+
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, type ApprovalTx, ApproveTokenTool, type ApyPoint, BaseNftAiTool, BaseSwapProvider, BaseTool, BaseWalletActionTool, type BlockParameters, type BlockTag, type BuildApprovalsParams, type BuyTokenSide, BuyTokenTool, CachedResource, 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, CoinpoolConfigApi, type ConfirmAddLiquidityTxProps, type ContractFunctionParameters, type CortexResponse, DEFAULT_CHAIN, DEFAULT_PROVIDER, DEFAULT_RPC_BY_CHAIN, DEFILLAMA_EXTRA_SIGNALS, DEFILLAMA_POOL_CHAIN_HEXES, DEFILLAMA_POOL_CHAIN_PARAM_DESCRIPTION, DebridgeProvider, type DecodedCall, type DecodedEvent, type DecodedParam, type DefaultSubagentName, DefiLlamaEstimatePoolYieldTool, type DefiLlamaEstimatePoolYieldToolConfig, type DefiLlamaPool, DefiLlamaPoolByAddressTool, type DefiLlamaPoolByAddressToolConfig, DefiLlamaPoolCandidateResolver, DefiLlamaPoolDetailTool, type DefiLlamaPoolDetailToolConfig, DefiLlamaPoolSearchTool, type DefiLlamaPoolSearchToolConfig, DefiLlamaPoolService, type DefiLlamaPoolServiceConfig, type DefiLlamaProtocolVersion, type DefiLlamaServiceResponse, type DefiLlamaSortBy, DefiLlamaTopPoolsTool, type DefiLlamaTopPoolsToolConfig, type DefiPosition, type DefiPositionDetails, type DefiPositionToken, type DefiProtocolSummary, type EIP1193RequestFn, EstimatePoolYieldTool, type EstimatePoolYieldToolConfig, type FeeContext, type FormattedDefiLlamaPool, GeminiProvider, GeminiSearchAiTool, type GeminiSearchAiToolConfig, HEX_TO_PANTOGRAPH, type Hex, type HolderChangePeriod, type HolderSupplyTier, type HttpMethod, type IngestKnowledgeBaseInput, type IngestKnowledgeBaseResult, type InputTokenInfo, type KBSearchResult, KeyringSettingApi, KnowledgeBase, type KnowledgeBaseEntry, type KnowledgeBaseProvider, type LLMProvider, type LLMProviderConfig, type LLMResponse, type LLMToolCall, type LendingMarket, type LendingMarketCardProps, LendingMarketDetailTool, type LendingMarketDetailToolConfig, type LendingMarketListProps, type LendingMarketOverview, LendingMarketsTool, type LendingMarketsToolConfig, type LendingProtocolType, LendingReadService, LendingService, type LendingServiceConfig, type LendingSupplyPosition, LendingSupplyService, MULTICALL3_ADDRESS, ManageLiquidityRedirectTool, type MarketplaceLink, type MoralisApiResponse, MoralisService, type MoralisServiceConfig, type MulticallParameters, type MulticallRawParameters, type MulticallResult, NATIVE_GAS_LIMIT, 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 NativeActionKind, type NativeGasGap, type NativeTokenInfo, NfcBuyTool, NfcInfoTool, type NftTransferLastSale, NoFormTool, type NoFormToolMessages, OpenAddLiquidityFormTool, type OpenAddLiquidityFormToolConfig, OpenSupplyFormTool, type OpenSupplyFormToolConfig, POOL_UNISWAP_AGENT_TOOL_NAMES, PantographService, type PantographServiceConfig, type PantographYieldIdentity, type PaymentToken, PoolByAddressTool, type PoolByAddressToolConfig, PoolDetailTool, type PoolDetailToolConfig, type PoolDisplayInfo, PoolFallbackAiTool, type PoolFallbackAiToolConfig, type PoolOnchainInfo, PoolPriceRangesTool, type PoolPriceRangesToolConfig, PoolSearchTool, type PoolSearchToolConfig, PoolService, type PoolServiceConfig, PoolSwapRouter, type PresetInputs, PreviewAddLiquidityTool, type PreviewAddLiquidityToolConfig, type PriceBounds, type PriceRangePrefill, type ProviderName, PublicClient, type PublicClientConfig, type QuickRate, type QuoteGas, type RangePreset, type RawYieldIdentityRow, type ReActPhase, type ReActStep, type ReActTrace, type ReadContractParameters, RelayProvider, type ResolvedRange, Router, type RouterAssignment, type RouterDecision, SUPPLIABLE_TYPES, SUPPORTED_CHAINS, SUPPORTED_CHAINS_LABEL, SWAP_PROVIDER_CONFIG, SendNativeTool, SendNftTool, SendTokenTool, type SpendableBalance, 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 SuppliableMarket, type SupplyProtocolType, type SupplyUsdcProps, type SupportedChainId, type SupportedChainName, type SwapProviderConfig, type SwapProviderConfigMap, SwapProviderFactory, type SwapQuoteParams, type SwapQuoteResult, type SwapRoute, type SwapRouteRequest, SwapRouter, SwapRouterRegistry, type SwapTokenFormProps, 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, UNRESOLVED_ASSET, type UnsignedTx, type UpstashEmbedStrategy, type UpstashFusionAlgorithm, type UpstashKBUpsertEntry, UpstashKnowledgeBase, type UpstashKnowledgeBaseConfig, type UserContext, UserSwapRouter, 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 YieldAssetInfo, type YieldConversionCall, type YieldConversionPlan, type YieldPricingOptions, type YieldPricingToken, type YieldTokenInput, type YieldTokenValue, ZERO_ADDRESS, amazonDomainForLanguage, apiClient, applyYieldConversions, buildApprovals, buildChallenge, buildRangePresets, buildUniswapPoolUrl, call, canDeriveV3PoolAddress, chains, checkNativeGasAffordable, checksumAddress, clampTick, clearPublicClientCache, coinpoolConfigApi, compareDecimal, completeX402, configureSupportedChains, configureSwapProvider, convertSusdsShares, createAiAgent, createDefaultSubagents, createNfcAgent, createNftAgent, createPoolUniswapAgent, createPublicClient, createTokenAgent, createTransport, createWalletActionAgent, createWalletAgent, createX402SignatureProvider, decodeAbiParameters, decodeErrorResult, decodeFunctionData, decodeFunctionResult, defiLlamaPoolInfoScope, defiLlamaPoolSupportsLabel, deriveV3PoolAddress, displayFromChallenge, effectivePriceUSD, encodeAbiParameters, encodeApprove, encodeErrorResult, encodeFunctionData, encodeSignedHeader, erc1155Abi, erc20Abi, erc20Abi_bytes32, erc721Abi, estimateGas, estimateNativeGasReserveWei, estimateTransactionFeeWei, ethCallAt, ethCallByChain, exactAmountString, extractOutRaw, extractQuoteError, fallback, feeWeiToNative, fetchTopMarketplaces, fetchUnderlyingPricesUSD, floorToDecimals, formatDefiLlamaPool, getAbiItem, getAddress, getBalance, getBlock, getBlockNumber, getChain, getChainContractAddress, getChainId, getChainMeta, getCode, getDefaultRpcUrl, getGasPrice, getNativeTokenInfo, getPublicClient, getRevertReason, getRpcOverrides, getStorageAt, getTokenPriceUSD, getTransactionCount, http, humanToWei, ingestKnowledgeBase, isAbortError, isAddress, isAddressEqual, isPaymentRequired, isShareBasedProtocol, isShareBasedYieldToken, isSupplyChain, keyringSettingApi, listCandidateChains, listSupplyChains, mulDivFloor, multicall, multicall3Abi, multicallRaw, nativeGasShortfall, nfcAmazonSearchUrl, normaliseCountry, normalizeDecimal, normalizePriceRangeToPool, parseAbi, parseAbiItem, parseAbiParameters, pickLogo, planYieldTokenConversions, priceToTick, protocolLabelFor, psm3For, readContract, readPaymentError, readPaymentRequired, readProtocolFeeWei, readReceipt, readSpendableBalance, readTokenUsdPrice, registerMaybeNoForm, requestWithX402, resolveGasLimit, resolveNfcShopLinks, resolveRawYieldAsset, resolveRawYieldIdentity, resolveRawYieldProtocol, resolveRpcUrl, resolveRpcUrls, resolveTokenPriceUSD, roundTickToSpacing, rpcCall, setRpcOverrides, spendableNative, swapProviderFactory, swapRouterRegistry, tickToPrice, toEventSelector, toFunctionSelector, toPantographChain, toPlainDecimal, unitPriceUSD, valueYieldTokens, weiToHuman };
|