@augustdigital/sdk 8.12.0 → 8.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/sdk.d.ts CHANGED
@@ -15771,6 +15771,52 @@ declare class AugustSDK extends AugustBase {
15771
15771
  untilTs?: number;
15772
15772
  types?: ('withdraw-request' | 'deposit' | 'withdraw-processed' | 'redeem')[];
15773
15773
  }): Promise<IVaultUserHistoryItem[]>;
15774
+ /**
15775
+ * Resolve the ERC-20 tokens currently whitelisted for the `SwapRouter` on a
15776
+ * chain — the any-token set a deposit UI can offer as swap-and-deposit inputs.
15777
+ *
15778
+ * Delegates to {@link AugustVaults.getSwapRouterWhitelistedTokens}, which
15779
+ * reconstructs the set from the router's `TokenEnabled` events and verifies
15780
+ * each against the on-chain `whitelistedTokens` mapping (not enumerable).
15781
+ * Returns `[]` when no router is deployed on `chainId` or no provider is
15782
+ * configured for it.
15783
+ *
15784
+ * @param chainId - EVM chain ID to resolve the allowlist for.
15785
+ * @param options - Optional `fromBlock` to override the deploy-block scan floor.
15786
+ * @returns Checksummed whitelisted token addresses; `[]` when unavailable.
15787
+ * @throws AugustSDKError when an `eth_getLogs` scan chunk fails.
15788
+ * @example
15789
+ * ```ts
15790
+ * const tokens = await augustSdk.getSwapRouterWhitelistedTokens(1);
15791
+ * ```
15792
+ */
15793
+ getSwapRouterWhitelistedTokens(chainId: number, options?: {
15794
+ fromBlock?: number;
15795
+ }): Promise<IAddress[]>;
15796
+ /**
15797
+ * Resolve the vaults currently eligible for the any-token `SwapRouter`
15798
+ * deposit surface on a chain — every vault the router has `enableVault`-ed
15799
+ * whose on-chain registration is still live.
15800
+ *
15801
+ * Delegates to {@link AugustVaults.getSwapRouterEligibleVaults}, which
15802
+ * reconstructs the set from the router's `VaultEnabled` events and verifies
15803
+ * each vault's current `vaultInfo` registration (not enumerable). Returns
15804
+ * `[]` when no router is deployed on `chainId` or no provider is configured
15805
+ * for it. On-chain eligibility only — app-level policy (e.g. OVault
15806
+ * exclusions) remains the caller's responsibility.
15807
+ *
15808
+ * @param chainId - EVM chain ID to resolve eligible vaults for.
15809
+ * @param options - Optional `fromBlock` to override the deploy-block scan floor.
15810
+ * @returns Checksummed eligible vault addresses; `[]` when unavailable.
15811
+ * @throws AugustSDKError when an `eth_getLogs` scan chunk fails.
15812
+ * @example
15813
+ * ```ts
15814
+ * const vaults = await augustSdk.getSwapRouterEligibleVaults(1);
15815
+ * ```
15816
+ */
15817
+ getSwapRouterEligibleVaults(chainId: number, options?: {
15818
+ fromBlock?: number;
15819
+ }): Promise<IAddress[]>;
15774
15820
  /**
15775
15821
  * Get lifetime PnL for a user in a specific vault.
15776
15822
  * Calculates realized and unrealized PnL based on deposit/withdrawal history and current position.
@@ -16562,6 +16608,59 @@ export declare class AugustVaults extends AugustBase {
16562
16608
  untilTs?: number;
16563
16609
  types?: IVaultUserHistoryItem['type'][];
16564
16610
  }): Promise<IVaultUserHistoryItem[]>;
16611
+ /**
16612
+ * Resolve the ERC-20 tokens currently whitelisted for the `SwapRouter` on a
16613
+ * chain — the any-token set a deposit UI can offer as swap-and-deposit inputs,
16614
+ * each verified `true` against the router's on-chain allowlist.
16615
+ *
16616
+ * Reconstructs the set from the router's `TokenEnabled` event history and
16617
+ * re-checks `whitelistedTokens(token)` for each (the mapping is not
16618
+ * enumerable). See {@link getSwapRouterWhitelistedTokens} for the full
16619
+ * two-stage behavior and RPC cost. Uses this instance's configured provider
16620
+ * for `chainId`; returns `[]` (no RPC) when no router is deployed there or no
16621
+ * provider is configured.
16622
+ *
16623
+ * @param chainId - EVM chain ID to resolve the allowlist for.
16624
+ * @param options - Optional `fromBlock` to override the deploy-block scan floor.
16625
+ * @returns Checksummed whitelisted token addresses; `[]` when unavailable.
16626
+ * Callers still exclude a target vault's natively-accepted assets (those
16627
+ * deposit without a swap).
16628
+ * @throws AugustSDKError when an `eth_getLogs` scan chunk fails.
16629
+ * @example
16630
+ * ```ts
16631
+ * const tokens = await augustSdk.getSwapRouterWhitelistedTokens(1);
16632
+ * ```
16633
+ */
16634
+ getSwapRouterWhitelistedTokens(chainId: number, options?: {
16635
+ fromBlock?: number;
16636
+ }): Promise<IAddress[]>;
16637
+ /**
16638
+ * Resolve the vaults currently eligible for the any-token `SwapRouter`
16639
+ * deposit surface on a chain — every vault the router has `enableVault`-ed
16640
+ * whose on-chain registration is still live.
16641
+ *
16642
+ * Reconstructs the set from the router's `VaultEnabled` event history and
16643
+ * re-checks `vaultInfo(vault).referenceAsset != 0` for each (the mapping is
16644
+ * not enumerable). See {@link getSwapRouterEligibleVaults} for the full
16645
+ * two-stage behavior and RPC cost. Uses this instance's configured provider
16646
+ * for `chainId`; returns `[]` (no RPC) when no router is deployed there or no
16647
+ * provider is configured.
16648
+ *
16649
+ * On-chain eligibility only — app-level policy (e.g. excluding vaults with
16650
+ * their own OVault deposit flow) remains the caller's responsibility.
16651
+ *
16652
+ * @param chainId - EVM chain ID to resolve eligible vaults for.
16653
+ * @param options - Optional `fromBlock` to override the deploy-block scan floor.
16654
+ * @returns Checksummed eligible vault addresses; `[]` when unavailable.
16655
+ * @throws AugustSDKError when an `eth_getLogs` scan chunk fails.
16656
+ * @example
16657
+ * ```ts
16658
+ * const vaults = await augustSdk.getSwapRouterEligibleVaults(1);
16659
+ * ```
16660
+ */
16661
+ getSwapRouterEligibleVaults(chainId: number, options?: {
16662
+ fromBlock?: number;
16663
+ }): Promise<IAddress[]>;
16565
16664
  /**
16566
16665
  * @function getStakingPositions gets all available reward staking positions
16567
16666
  * @param wallet optionally passed user wallet address
@@ -17073,6 +17172,53 @@ export declare function dateToUnix(date: Date): number;
17073
17172
 
17074
17173
  export declare function daysAgo(days: number): Date;
17075
17174
 
17175
+ /**
17176
+ * Decode a raw EVM revert blob into a named error with arguments.
17177
+ *
17178
+ * Pure and offline — no RPC calls, no network. Handles the three revert
17179
+ * shapes the EVM produces:
17180
+ *
17181
+ * 1. `Error(string)` (`0x08c379a0`) — a `require`/`revert` with a message.
17182
+ * 2. `Panic(uint256)` (`0x4e487b71`) — compiler-inserted checks, with the
17183
+ * numeric code translated to its documented meaning (overflow, division by
17184
+ * zero, …).
17185
+ * 3. Custom errors — matched against a built-in corpus of OpenZeppelin
17186
+ * ERC-6093 / SafeERC20 / ERC4626 / Ownable / Pausable errors, LayerZero V2
17187
+ * OApp/OFT errors, and every `error` fragment in the vault ABIs the SDK
17188
+ * ships (tokenized vaults, SwapRouter, lending pools, …). Callers can
17189
+ * extend the corpus per call via `opts.extraAbis`, which take precedence.
17190
+ *
17191
+ * Truncated input degrades gracefully: when the 4-byte selector matches a
17192
+ * known error but the argument bytes are incomplete (e.g. an alert pipeline
17193
+ * clipped the hex), the result still carries `kind: 'custom'`, `name`, and
17194
+ * `signature`, with `args` omitted and `reason` explaining the truncation.
17195
+ *
17196
+ * @param data - The revert blob as a `0x`-prefixed hex string (the `data`
17197
+ * field of an ethers v6 `CALL_EXCEPTION`). Anything shorter than a 4-byte
17198
+ * selector, or not hex at all, yields `kind: 'unknown'`.
17199
+ * @param opts - Optional settings.
17200
+ * @param opts.extraAbis - Additional ABIs whose `error` fragments are checked
17201
+ * before the built-in corpus.
17202
+ * @returns The decoded revert. Never throws; unrecognized selectors return
17203
+ * `kind: 'unknown'` with the selector preserved so callers can look it up
17204
+ * via {@link lookupSelector}.
17205
+ *
17206
+ * @example
17207
+ * ```ts
17208
+ * const decoded = decodeRevertData('0xe450d38c…');
17209
+ * // {
17210
+ * // kind: 'custom',
17211
+ * // selector: '0xe450d38c',
17212
+ * // name: 'ERC20InsufficientBalance',
17213
+ * // signature: 'ERC20InsufficientBalance(address,uint256,uint256)',
17214
+ * // args: ['0x9281…', 487711967n, 1261711967n],
17215
+ * // }
17216
+ * ```
17217
+ */
17218
+ export declare function decodeRevertData(data: string, opts?: {
17219
+ extraAbis?: InterfaceAbi[];
17220
+ }): IDecodedRevert;
17221
+
17076
17222
  export declare const DEFAULT_FETCH_OPTIONS: {
17077
17223
  readonly method: "GET";
17078
17224
  readonly headers: {
@@ -17582,6 +17728,34 @@ export declare function depositNative(signer: Signer | Wallet, options: INativeD
17582
17728
  */
17583
17729
  export declare const explorerLink: (hex: IAddress, chain: IChainId, type: IExplorerType) => string;
17584
17730
 
17731
+ /**
17732
+ * Parse an ethers v6 error *string* and recover the machine-readable fields
17733
+ * embedded in it.
17734
+ *
17735
+ * ethers v6 serializes rich error objects into a single message of the shape
17736
+ * `… (action="estimateGas", data="0x…", reason=…, transaction={ "data":
17737
+ * "0x…", "from": "0x…", "to": "0x…" }, …, code=CALL_EXCEPTION, version=…)` —
17738
+ * exactly what error-alert pipelines end up carrying once the original error
17739
+ * object is stringified. This helper regex-extracts the revert `data`, the
17740
+ * `action`, the `code`, and the embedded transaction fields.
17741
+ *
17742
+ * Pure and offline. Tolerant of truncation: alert transports often cap
17743
+ * message length mid-hex, so every field is matched without requiring its
17744
+ * closing quote and the result simply omits whatever did not survive.
17745
+ *
17746
+ * @param text - The error text to parse (an ethers v6 `error.message`, or a
17747
+ * log/alert line that embeds one).
17748
+ * @returns The recovered fields; an empty object when nothing matched. Never
17749
+ * throws.
17750
+ *
17751
+ * @example
17752
+ * ```ts
17753
+ * const ctx = extractRevertFromErrorText(alertErrorLine);
17754
+ * if (ctx.revertData) console.log(decodeRevertData(ctx.revertData));
17755
+ * ```
17756
+ */
17757
+ export declare function extractRevertFromErrorText(text: string): IExtractedRevertContext;
17758
+
17585
17759
  export declare const FALLBACK_CHAINID = 42161;
17586
17760
 
17587
17761
  /**
@@ -18285,6 +18459,130 @@ export declare function depositNative(signer: Signer | Wallet, options: INativeD
18285
18459
  */
18286
18460
  export declare function getSwapRouterDepositResult(signer: Signer | Wallet, { txHash, vault }: ISwapRouterDepositResultOptions): Promise<ISwapRouterDepositResult | null>;
18287
18461
 
18462
+ /**
18463
+ * Resolve the vaults currently eligible for the any-token `SwapRouter` deposit
18464
+ * surface on a chain — i.e. every vault the router has `enableVault`-ed that is
18465
+ * still registered on-chain.
18466
+ *
18467
+ * The router stores registrations as `mapping(address => VaultInfo) vaultInfo`
18468
+ * with **no on-chain enumeration**, so (exactly like
18469
+ * {@link getSwapRouterWhitelistedTokens}) this runs in two stages:
18470
+ * 1. Scan the router's `VaultEnabled(address)` event history (from the chain's
18471
+ * {@link SWAP_ROUTER_DEPLOY_BLOCKS} floor, in `eth_getLogs` chunks sized by
18472
+ * {@link determineBlockSkipInternal}) to reconstruct the candidate set of
18473
+ * every vault ever enabled.
18474
+ * 2. Re-read `vaultInfo(vault)` for each candidate — batched via Multicall3
18475
+ * where verified, else per-call — and keep only those whose
18476
+ * `referenceAsset != address(0)` (an unregistered vault reverts with
18477
+ * `InvalidVault` at deposit time). This makes later disables correct
18478
+ * without replaying `VaultDisabled`, and is the fail-closed source of
18479
+ * truth: a vault surfaces only on a definite on-chain registration.
18480
+ *
18481
+ * This is the dynamic successor to the static
18482
+ * {@link SWAP_ROUTER_ELIGIBLE_VAULTS} snapshot / {@link isSwapRouterEligible}.
18483
+ * It reports **on-chain eligibility only** — app-level policy (e.g. excluding
18484
+ * OVault-enabled vaults that have their own deposit flow) remains the caller's
18485
+ * responsibility, as does the flag gating of the UI surface.
18486
+ *
18487
+ * The resolved list is cached per chain for 5 minutes — registrations change
18488
+ * only via an admin `enableVault`/`disableVault` transaction, so a short TTL
18489
+ * keeps the (multi-RPC) scan off the hot path without going stale for long.
18490
+ *
18491
+ * @param chainId - EVM chain ID. Chains without a {@link SWAP_ROUTER_ADDRESSES}
18492
+ * entry resolve to `[]` with no RPC.
18493
+ * @param options - `rpcUrl` (required) must point at `chainId`'s network;
18494
+ * `fromBlock` overrides the default deploy-block scan floor.
18495
+ * @returns Checksummed addresses of the currently-registered eligible vaults,
18496
+ * deduped. Empty when no router is deployed or none are registered.
18497
+ * @throws AugustValidationError when `rpcUrl` is missing/empty.
18498
+ * @throws AugustSDKError when an `eth_getLogs` chunk fails — surfaced (not
18499
+ * swallowed) so a partial scan never masquerades as the complete set.
18500
+ * @worstCaseRpcCalls On mainnet, 1 `eth_blockNumber` + ~4 `eth_getLogs` chunks
18501
+ * (router-lifetime ÷ 50k-block window) + 1 Multicall3 `eth_call` ≈ 6; scales
18502
+ * with the router's on-chain age, not with candidate count.
18503
+ * @example
18504
+ * ```ts
18505
+ * const vaults = await getSwapRouterEligibleVaults(1, {
18506
+ * rpcUrl: 'https://eth-mainnet.example/v2/KEY',
18507
+ * });
18508
+ * // ['0x74aD…718b', '0xE9B7…9D32'] (Sentora USD, Upshift Core USDC)
18509
+ * ```
18510
+ */
18511
+ export declare function getSwapRouterEligibleVaults(chainId: number, options: {
18512
+ rpcUrl: string;
18513
+ fromBlock?: number;
18514
+ }): Promise<IAddress[]>;
18515
+
18516
+ /**
18517
+ * Resolve the human-readable display name of the `SwapRouter` periphery
18518
+ * contract for a chain.
18519
+ *
18520
+ * The contract exposes no name on-chain, so this reads the SDK-maintained
18521
+ * {@link SWAP_ROUTER_NAMES} registry. Intended for UI surfaces that label the
18522
+ * contract a swap-and-deposit routes through (e.g. a "Router" row in a
18523
+ * transaction overview) — display metadata only, never routing logic.
18524
+ *
18525
+ * @param chainId - EVM chain ID.
18526
+ * @returns The display name (e.g. `'Upshift Swap Router'`), or `undefined`
18527
+ * when no SwapRouter is deployed on the chain — callers should omit the
18528
+ * label rather than show an address.
18529
+ * @example
18530
+ * ```ts
18531
+ * const name = getSwapRouterName(1);
18532
+ * // 'Upshift Swap Router'
18533
+ * ```
18534
+ */
18535
+ export declare function getSwapRouterName(chainId: number): string | undefined;
18536
+
18537
+ /**
18538
+ * Resolve the ERC-20 tokens currently whitelisted for the `SwapRouter` on a
18539
+ * chain — the any-token set a UI can offer as swap-and-deposit inputs.
18540
+ *
18541
+ * The router exposes its allowlist only as `mapping(address => bool)
18542
+ * whitelistedTokens` with **no on-chain enumeration**, so this cannot be a
18543
+ * single view call. It runs in two stages:
18544
+ * 1. Scan the router's `TokenEnabled(address)` event history (from the chain's
18545
+ * {@link SWAP_ROUTER_DEPLOY_BLOCKS} floor, in `eth_getLogs` chunks sized by
18546
+ * {@link determineBlockSkipInternal}) to reconstruct the candidate set of
18547
+ * every token ever enabled.
18548
+ * 2. Re-read `whitelistedTokens(token)` for each candidate — batched via
18549
+ * Multicall3 where verified, else per-call — and keep only those the
18550
+ * mapping currently returns `true` for. This step makes later disables (and
18551
+ * disable-then-re-enable) correct without replaying `TokenDisabled`, and is
18552
+ * the fail-closed source of truth: a token surfaces only on a definite
18553
+ * on-chain `true`.
18554
+ *
18555
+ * The resolved list is cached per chain for 5 minutes — the allowlist changes
18556
+ * only via an admin `enableToken`/`disableToken` transaction, so a short TTL
18557
+ * keeps the (multi-RPC) scan off the hot path without going stale for long.
18558
+ *
18559
+ * @param chainId - EVM chain ID. Chains without a {@link SWAP_ROUTER_ADDRESSES}
18560
+ * entry resolve to `[]` with no RPC.
18561
+ * @param options - `rpcUrl` (required) must point at `chainId`'s network;
18562
+ * `fromBlock` overrides the default deploy-block scan floor (e.g. to widen a
18563
+ * scan on a chain missing from {@link SWAP_ROUTER_DEPLOY_BLOCKS}).
18564
+ * @returns Checksummed addresses of the currently-whitelisted tokens, deduped.
18565
+ * Empty when no router is deployed or none are enabled. Callers still filter
18566
+ * out a given vault's natively-accepted assets (those deposit without a swap).
18567
+ * @throws AugustValidationError when `rpcUrl` is missing/empty.
18568
+ * @throws AugustSDKError when an `eth_getLogs` chunk fails — surfaced (not
18569
+ * swallowed) so a partial scan never masquerades as a complete allowlist.
18570
+ * @worstCaseRpcCalls On mainnet, 1 `eth_blockNumber` + ~4 `eth_getLogs` chunks
18571
+ * (router-lifetime ÷ 50k-block window) + 1 Multicall3 `eth_call` ≈ 6; scales
18572
+ * with the router's on-chain age, not with candidate count.
18573
+ * @example
18574
+ * ```ts
18575
+ * const tokens = await getSwapRouterWhitelistedTokens(1, {
18576
+ * rpcUrl: 'https://eth-mainnet.example/v2/KEY',
18577
+ * });
18578
+ * // ['0xA0b8…', '0xdAC1…', '0xC02a…', '0x2260…'] (USDC, USDT, WETH, WBTC)
18579
+ * ```
18580
+ */
18581
+ export declare function getSwapRouterWhitelistedTokens(chainId: number, options: {
18582
+ rpcUrl: string;
18583
+ fromBlock?: number;
18584
+ }): Promise<IAddress[]>;
18585
+
18288
18586
  /**
18289
18587
  * Fetch token symbol from contract.
18290
18588
  * Results are cached to minimize RPC calls.
@@ -18601,6 +18899,21 @@ export declare function depositNative(signer: Signer | Wallet, options: INativeD
18601
18899
  coingeckoKey?: string;
18602
18900
  }): Promise<IVaultUserLifetimePnl>;
18603
18901
 
18902
+ /**
18903
+ * Classify a vault's protocol version from its address alone.
18904
+ *
18905
+ * @deprecated Use {@link getVaultVersionV2} instead. This V1 classifier can only
18906
+ * recognise a multi-asset vault (`evm-2`) if its address is hard-coded in the
18907
+ * static `MULTI_ASSET_VAULTS` list. Any multi-asset vault missing from that list
18908
+ * is silently misclassified as `evm-1`, which broke deposit preview/simulation in
18909
+ * the 2026-07-06 Sentora incident. `getVaultVersionV2` reads the backend
18910
+ * `internal_type` (falling back to the static list only as a safety net), so new
18911
+ * vaults classify correctly without a code change. Retained as a non-breaking
18912
+ * shim; scheduled for removal in the next major.
18913
+ *
18914
+ * @param vault - The vault contract address (EVM `0x…`, Solana, or Stellar).
18915
+ * @returns The vault version slug, or `undefined` for empty/invalid input.
18916
+ */
18604
18917
  export declare function getVaultVersion(vault: string): IVaultVersion | undefined;
18605
18918
 
18606
18919
  export declare function getVaultVersionV2(vault: (Pick<ITokenizedVault, 'address'> & {
@@ -19472,6 +19785,33 @@ export declare function depositNative(signer: Signer | Wallet, options: INativeD
19472
19785
  portfolio_item_list: IDebankPortfolioItemObject[];
19473
19786
  }
19474
19787
 
19788
+ /** Result of decoding a raw revert blob with {@link decodeRevertData}. */
19789
+ export declare interface IDecodedRevert {
19790
+ /**
19791
+ * `'error-string'` for `Error(string)` (a `require` message), `'panic'` for
19792
+ * compiler-inserted `Panic(uint256)`, `'custom'` when the selector matched a
19793
+ * corpus (or caller-supplied) custom error, `'unknown'` when nothing matched.
19794
+ */
19795
+ kind: IRevertKind;
19796
+ /** The 4-byte selector (`0x` + 8 hex chars), always present — even for `'unknown'` so callers can 4byte-lookup it. */
19797
+ selector: string;
19798
+ /** Error name (e.g. `'ERC20InsufficientBalance'`, `'Error'`, `'Panic'`). Absent for `'unknown'`. */
19799
+ name?: string;
19800
+ /** Full error signature (e.g. `'ERC20InsufficientBalance(address,uint256,uint256)'`). Absent for `'unknown'`. */
19801
+ signature?: string;
19802
+ /**
19803
+ * Decoded arguments in declaration order (`bigint` for integers, checksummed
19804
+ * strings for addresses). Absent when the selector matched but the argument
19805
+ * bytes were truncated or malformed — see {@link IDecodedRevert.reason}.
19806
+ */
19807
+ args?: unknown[];
19808
+ /**
19809
+ * Human-readable summary when one exists: the `Error(string)` message, the
19810
+ * named `Panic` code, or a note that the argument data was truncated.
19811
+ */
19812
+ reason?: string;
19813
+ }
19814
+
19475
19815
  /**
19476
19816
  * A token's discount-factor ladder from `GET /risk/discount_factors`
19477
19817
  * (backend `DiscountFactorRead` schema). `steps` are ascending notional
@@ -19564,6 +19904,22 @@ export declare function depositNative(signer: Signer | Wallet, options: INativeD
19564
19904
  loanBalance: number;
19565
19905
  };
19566
19906
 
19907
+ /** Fields recovered from an ethers v6 error string by {@link extractRevertFromErrorText}. */
19908
+ export declare interface IExtractedRevertContext {
19909
+ /** The revert blob from the top-level `data="0x…"` field, when present. */
19910
+ revertData?: string;
19911
+ /** The failed operation from `action="…"` (e.g. `'estimateGas'`, `'call'`). */
19912
+ action?: string;
19913
+ /** The ethers error code from `code=…` (e.g. `'CALL_EXCEPTION'`). */
19914
+ code?: string;
19915
+ /** The embedded `transaction={ … }` fields that survived, when any did. */
19916
+ tx?: {
19917
+ from?: string;
19918
+ to?: string;
19919
+ data?: string;
19920
+ };
19921
+ }
19922
+
19567
19923
  /**
19568
19924
  * API Fetching and Data Utilities
19569
19925
  *
@@ -20160,6 +20516,9 @@ export declare function depositNative(signer: Signer | Wallet, options: INativeD
20160
20516
  refundChainId?: number;
20161
20517
  }
20162
20518
 
20519
+ /** The revert shapes {@link decodeRevertData} distinguishes. */
20520
+ export declare type IRevertKind = 'error-string' | 'panic' | 'custom' | 'unknown';
20521
+
20163
20522
  /**
20164
20523
  * Result of the public `GET /revert_reason` endpoint (backend `RevertResponse`
20165
20524
  * schema) — the decoded failure reasons for a reverted transaction, collected
@@ -20286,6 +20645,23 @@ export declare function depositNative(signer: Signer | Wallet, options: INativeD
20286
20645
  */
20287
20646
  export declare function isHubOnlyReceipt(vault: IAddress): boolean;
20288
20647
 
20648
+ /** Result of an {@link simulateCall} `eth_call` replay. */
20649
+ export declare type ISimulateCallResult = {
20650
+ /** The call succeeded. */
20651
+ ok: true;
20652
+ /** The raw return data of the call, `0x`-prefixed. */
20653
+ returnData: string;
20654
+ } | {
20655
+ /** The call reverted or the node rejected it. */
20656
+ ok: false;
20657
+ /** Fresh, untruncated revert blob when the node returned one. */
20658
+ revertData?: string;
20659
+ /** {@link decodeRevertData} applied to `revertData`, when present. */
20660
+ decoded?: IDecodedRevert;
20661
+ /** The underlying error message, for failures without revert data. */
20662
+ errorMessage: string;
20663
+ };
20664
+
20289
20665
  export declare function isInsufficientFundsError(error: unknown): boolean;
20290
20666
 
20291
20667
  /* Excluded from this release type: isMulticall3Supported */
@@ -20413,6 +20789,11 @@ export declare function depositNative(signer: Signer | Wallet, options: INativeD
20413
20789
  *
20414
20790
  * @param vaultAddress - August vault address.
20415
20791
  * @returns `true` when the vault is in {@link SWAP_ROUTER_ELIGIBLE_VAULTS}.
20792
+ * @deprecated Superseded by {@link getSwapRouterEligibleVaults}, which resolves
20793
+ * eligibility from the router's on-chain `VaultEnabled` history + current
20794
+ * `vaultInfo` registration instead of this static snapshot. Kept functional as
20795
+ * the zero-RPC sync fallback (seed data, fail-fast checks); migrate UI gates
20796
+ * to the async resolver.
20416
20797
  */
20417
20798
  export declare function isSwapRouterEligible(vaultAddress: IAddress): boolean;
20418
20799
 
@@ -21081,6 +21462,26 @@ export declare function depositNative(signer: Signer | Wallet, options: INativeD
21081
21462
  strategist: ITokenizedVaultStrategist;
21082
21463
  }
21083
21464
 
21465
+ /** Snapshot of a holder's token state returned by {@link readTokenState}. */
21466
+ export declare interface ITokenState {
21467
+ /** Token symbol, when the contract implements `symbol()`. */
21468
+ symbol?: string;
21469
+ /** Token decimals, when the contract implements `decimals()`. */
21470
+ decimals?: number;
21471
+ /** The holder's raw balance in base units, when `balanceOf` resolved. */
21472
+ balance?: bigint;
21473
+ /** Raw allowance from holder to `spender`, only probed when `spender` was given. */
21474
+ allowance?: bigint;
21475
+ /**
21476
+ * Whether the holder is frozen/blacklisted by the token issuer, from the
21477
+ * first compliance getter the token implements (`isAccountFrozen` — Agora
21478
+ * AUSD, `isBlacklisted` — USDC-style, `isFrozen`). `undefined` when the
21479
+ * token exposes none of them — which is NOT evidence the holder is clear,
21480
+ * only that the token has no recognized compliance getter.
21481
+ */
21482
+ frozen?: boolean;
21483
+ }
21484
+
21084
21485
  /**
21085
21486
  * One unrealized-PnL snapshot for a vault, computed by the August backend
21086
21487
  * from periodic vault state. `timestamp` is an ISO-8601 datetime; monetary
@@ -22306,6 +22707,28 @@ export declare function depositNative(signer: Signer | Wallet, options: INativeD
22306
22707
  };
22307
22708
  };
22308
22709
 
22710
+ /**
22711
+ * Look up candidate signatures for an unknown 4-byte selector against public
22712
+ * signature databases.
22713
+ *
22714
+ * Network helper — queries [openchain.xyz](https://openchain.xyz) first and
22715
+ * falls back to [4byte.directory](https://www.4byte.directory). Kept separate
22716
+ * from {@link decodeRevertData} so the core decode path stays offline.
22717
+ * Worst case 2 HTTPS requests.
22718
+ *
22719
+ * @param selector - The selector to look up. Longer hex (a full revert blob)
22720
+ * is accepted; only the first 4 bytes are used.
22721
+ * @returns Candidate signatures (e.g. `['ERC20InsufficientBalance(address,uint256,uint256)']`),
22722
+ * most-likely first. Empty when the input is not hex, no database knows the
22723
+ * selector, or both databases were unreachable. Never throws.
22724
+ *
22725
+ * @example
22726
+ * ```ts
22727
+ * const candidates = await lookupSelector('0xe450d38c');
22728
+ * ```
22729
+ */
22730
+ export declare function lookupSelector(selector: string): Promise<string[]>;
22731
+
22309
22732
  /**
22310
22733
  * Map composability integrations from backend format to vault format.
22311
22734
  * Shared across all chain adapters.
@@ -22600,6 +23023,38 @@ export declare function depositNative(signer: Signer | Wallet, options: INativeD
22600
23023
  */
22601
23024
  export declare function readEnv(name: string): string | undefined;
22602
23025
 
23026
+ /**
23027
+ * Read a bounded, fixed set of token-state probes for a holder — the exact
23028
+ * facts needed to explain a failed deposit/transfer: what the token is, what
23029
+ * the holder has, what the spender may pull, and whether the issuer froze the
23030
+ * holder.
23031
+ *
23032
+ * The probe set is deliberately fixed (no arbitrary calldata): `symbol()`,
23033
+ * `decimals()`, `balanceOf(holder)`, `allowance(holder, spender)` when a
23034
+ * spender is given, and the compliance getters tried in order —
23035
+ * `isAccountFrozen(address)` (Agora AUSD, selector `0xe816d97f`),
23036
+ * `isBlacklisted(address)` (USDC-style), `isFrozen(address)`. Probes the
23037
+ * token does not implement resolve to `undefined`; this function never
23038
+ * throws.
23039
+ *
23040
+ * Worst case 7 RPC calls (4 base probes + 3 compliance getters), batched by
23041
+ * the provider where supported.
23042
+ *
23043
+ * @param provider - A connected `JsonRpcProvider` for the token's chain.
23044
+ * @param token - The ERC-20 token contract address.
23045
+ * @param holder - The account whose balance/compliance state to read.
23046
+ * @param spender - Optional spender for the `allowance(holder, spender)`
23047
+ * probe (e.g. the vault a deposit approves).
23048
+ * @returns The token state with every unresolvable probe as `undefined`.
23049
+ *
23050
+ * @example
23051
+ * ```ts
23052
+ * const state = await readTokenState(provider, ausd, eoa, vault);
23053
+ * // { symbol: 'AUSD', decimals: 6, balance: 487711967n, allowance: 0n, frozen: false }
23054
+ * ```
23055
+ */
23056
+ export declare function readTokenState(provider: JsonRpcProvider, token: string, holder: string, spender?: string): Promise<ITokenState>;
23057
+
22603
23058
  /**
22604
23059
  * Register a user for the points program, authenticated by a wallet signature.
22605
23060
  *
@@ -22686,6 +23141,48 @@ export declare function depositNative(signer: Signer | Wallet, options: INativeD
22686
23141
 
22687
23142
  /* Excluded from this release type: resolveDepositTokenDecimals */
22688
23143
 
23144
+ /**
23145
+ * Resolve whether a single fee (management or performance) is currently waived.
23146
+ *
23147
+ * Backend-driven, per AUGUST-5584. This centralizes logic that previously lived —
23148
+ * and diverged — across two upshift-app components. The resolution is deliberately
23149
+ * split between the backend and the SDK:
23150
+ *
23151
+ * - The backend `isFeeWaivedToggle` (`platform_fee_override.is_fee_waived`) is both
23152
+ * the master enable AND the TVL latch. Retool config takes precedence over live
23153
+ * TVL, and the backend flips this flag `false` once live TVL crosses the
23154
+ * configured threshold. That flip is one-way: if TVL later falls back below the
23155
+ * threshold the waiver does NOT re-apply. The SDK therefore does no TVL math and
23156
+ * never reads `latest_reported_tvl` here — trusting the flag preserves the latch.
23157
+ * - The **date** window is time-dependent, so it cannot be a static DB flag; the SDK
23158
+ * evaluates it live against the clock.
23159
+ *
23160
+ * Resolution:
23161
+ * - Toggle off → never waived (also the only "hide" path once TVL trips the latch).
23162
+ * - Toggle on, both date and TVL blank → indefinite manual waiver → waived.
23163
+ * - Toggle on with a date window → waived while `now < waivedUntilDate`.
23164
+ * - Toggle on with a TVL threshold configured → waived (the backend keeps the toggle
23165
+ * on only while live TVL is under the threshold).
23166
+ *
23167
+ * @param isFeeWaivedToggle - Backend master/TVL-latch flag. `false` ⇒ never waived.
23168
+ * @param waivedUntilDate - ISO datetime string the waiver runs until, or `null` for
23169
+ * no date window. An unparseable string yields `NaN`, which is never `> now`, so
23170
+ * it correctly contributes no date-based waiver.
23171
+ * @param waivedUntilTvl - Configured TVL threshold in whole USD, or `null`. Used only
23172
+ * to detect that a TVL-based waiver was set (values `<= 0` are treated as unset);
23173
+ * the threshold comparison itself is owned by the backend.
23174
+ * @param now - Clock, injected for deterministic testing. Defaults to `new Date()`.
23175
+ * @returns `true` if the UI should present this fee as "Fee Waived" right now.
23176
+ * @example
23177
+ * ```ts
23178
+ * // Toggle on, 30-day window still open → waived.
23179
+ * resolveFeeWaived(true, '2099-01-01T00:00:00Z', null); // true
23180
+ * // Toggle off overrides everything → not waived.
23181
+ * resolveFeeWaived(false, '2099-01-01T00:00:00Z', 10_000_000); // false
23182
+ * ```
23183
+ */
23184
+ export declare function resolveFeeWaived(isFeeWaivedToggle: boolean, waivedUntilDate: string | null, waivedUntilTvl: number | null, now?: Date): boolean;
23185
+
22689
23186
  /**
22690
23187
  * Normalize an optional origin code to the value to send on-chain.
22691
23188
  *
@@ -23607,6 +24104,51 @@ export declare function depositNative(signer: Signer | Wallet, options: INativeD
23607
24104
  /** Plug in an `ILogger`. Independent of `setLogger`; pass `null` to clear. */
23608
24105
  declare function setStructuredLogger(custom: ILogger | null): void;
23609
24106
 
24107
+ /**
24108
+ * Replay a call via `eth_call` and decode the revert when it fails.
24109
+ *
24110
+ * The primary use is re-executing a transaction that failed at `estimateGas`
24111
+ * (so no transaction hash ever existed): the node returns the *full* revert
24112
+ * blob, which both confirms the failure still reproduces and recovers
24113
+ * untruncated revert data even when the original error text was clipped in
24114
+ * transit. Passing a historical `blockTag` replays against archival state
24115
+ * (requires an archive-capable RPC).
24116
+ *
24117
+ * Exactly 1 RPC call (`eth_call`).
24118
+ *
24119
+ * @param provider - A connected `JsonRpcProvider` for the target chain, e.g.
24120
+ * from `createProvider(rpcUrl, chainId)`. Note that some listed public RPCs
24121
+ * reject keyless `eth_call` — supply a working endpoint via the SDK's RPC
24122
+ * precedence (constructor `providers` map / `AUGUST_RPC_<chainId>` env).
24123
+ * @param tx - The call to replay: `to` and `data` are required, `from`
24124
+ * matters whenever the target checks `msg.sender`.
24125
+ * @param blockTag - Optional block to execute against (`'latest'` by
24126
+ * default; a number or hex tag replays historical state).
24127
+ * @param opts - Optional settings forwarded to {@link decodeRevertData}.
24128
+ * @param opts.extraAbis - Additional ABIs checked before the built-in corpus
24129
+ * when decoding a revert.
24130
+ * @returns `{ ok: true, returnData }` on success; on failure `{ ok: false }`
24131
+ * with the fresh `revertData` and its decode when the node supplied one.
24132
+ * Never throws on revert — only on programmer error (e.g. no provider).
24133
+ *
24134
+ * @example
24135
+ * ```ts
24136
+ * const result = await simulateCall(provider, {
24137
+ * from: eoa,
24138
+ * to: vault,
24139
+ * data: calldata,
24140
+ * });
24141
+ * if (!result.ok && result.decoded) console.log(result.decoded.signature);
24142
+ * ```
24143
+ */
24144
+ export declare function simulateCall(provider: JsonRpcProvider, tx: {
24145
+ from?: string;
24146
+ to: string;
24147
+ data: string;
24148
+ }, blockTag?: string | number, opts?: {
24149
+ extraAbis?: InterfaceAbi[];
24150
+ }): Promise<ISimulateCallResult>;
24151
+
23610
24152
  /**
23611
24153
  * Simulate contract transaction without executing on-chain.
23612
24154
  * Useful for testing transaction viability before sending.
@@ -24095,6 +24637,24 @@ export declare function depositNative(signer: Signer | Wallet, options: INativeD
24095
24637
  */
24096
24638
  export declare const SWAP_ROUTER_ADDRESSES: Readonly<Record<number, IAddress>>;
24097
24639
 
24640
+ /**
24641
+ * Block at which each chain's `SwapRouter` was deployed/configured — the safe
24642
+ * lower bound for scanning its `TokenEnabled` / `VaultEnabled` log history.
24643
+ *
24644
+ * The router stores its allowlist as `mapping(address => bool) whitelistedTokens`
24645
+ * with no on-chain enumeration, so {@link getSwapRouterWhitelistedTokens} must
24646
+ * reconstruct the candidate set from `TokenEnabled` events before verifying each
24647
+ * against the current mapping. Starting the `eth_getLogs` scan here (rather than
24648
+ * from genesis) bounds it to the router's own lifetime — a few chunks — instead
24649
+ * of the whole chain.
24650
+ *
24651
+ * Mainnet value is the router's deployment block (its first emitted event, the
24652
+ * constructor `OwnershipTransferred`). A too-low value only costs extra empty
24653
+ * log ranges; a value ABOVE the first `TokenEnabled` would silently miss tokens,
24654
+ * so err on the side of earlier.
24655
+ */
24656
+ export declare const SWAP_ROUTER_DEPLOY_BLOCKS: Readonly<Record<number, number>>;
24657
+
24098
24658
  /**
24099
24659
  * The DEX aggregator whitelisted on each chain's `SwapRouter` via
24100
24660
  * `enableRouter`, plus the single aggregator contract method every swap leg is
@@ -24157,6 +24717,13 @@ export declare function depositNative(signer: Signer | Wallet, options: INativeD
24157
24717
  *
24158
24718
  * Lowercase comparison is required when checking — use
24159
24719
  * {@link isSwapRouterEligible} rather than reading this set directly.
24720
+ *
24721
+ * @deprecated Superseded by {@link getSwapRouterEligibleVaults}, which derives
24722
+ * the eligible set from the router's on-chain `VaultEnabled` history and
24723
+ * verifies each vault's current registration (`vaultInfo.referenceAsset != 0`)
24724
+ * — so new enablements surface without an SDK release. This static set stays
24725
+ * functional as the zero-RPC fallback seed (e.g. TanStack Query `initialData`)
24726
+ * and for SDK-internal sync consumers.
24160
24727
  */
24161
24728
  export declare const SWAP_ROUTER_ELIGIBLE_VAULTS: ReadonlySet<string>;
24162
24729
 
@@ -24170,6 +24737,21 @@ export declare function depositNative(signer: Signer | Wallet, options: INativeD
24170
24737
  */
24171
24738
  export declare const SWAP_ROUTER_MAX_SWAPS = 9;
24172
24739
 
24740
+ /**
24741
+ * Human-readable display name of the `SwapRouter` periphery contract on each
24742
+ * supported chain.
24743
+ *
24744
+ * The contract exposes no on-chain name (no `@title` accessor), so UIs that
24745
+ * want to show *which contract* performed the swap-and-deposit — rather than a
24746
+ * bare address — read it from here. Display metadata only: never derive
24747
+ * routing or eligibility logic from it.
24748
+ *
24749
+ * Missing keys mean no SwapRouter is deployed on that chain.
24750
+ *
24751
+ * @see {@link getSwapRouterName} for the typed lookup helper.
24752
+ */
24753
+ export declare const SWAP_ROUTER_NAMES: Readonly<Record<number, string>>;
24754
+
24173
24755
  /**
24174
24756
  * Wrapped-native ERC-20 per chain that has a SwapRouter deployment. Mirrors
24175
24757
  * the on-chain `wrappedNativeTokenAddress()` view to avoid an extra RPC on
@@ -25002,10 +25584,12 @@ export declare function depositNative(signer: Signer | Wallet, options: INativeD
25002
25584
  export declare function vaultRequestRedeem(signer: Signer | Wallet, options: IContractWriteOptions): Promise<string>;
25003
25585
 
25004
25586
  /**
25005
- * @deprecated Renamed to {@link SWAP_ROUTER_ELIGIBLE_VAULTS}, and the semantics
25006
- * changed: this set no longer drives `vaultDeposit` auto-routing (that branch
25007
- * was removed) it now only marks vaults whose UI may offer the swap-router
25008
- * deposit surface. Kept as an alias for one release; migrate to the new name.
25587
+ * @deprecated Renamed to {@link SWAP_ROUTER_ELIGIBLE_VAULTS} (itself now
25588
+ * superseded by {@link getSwapRouterEligibleVaults}, the on-chain-derived
25589
+ * resolver), and the semantics changed: this set no longer drives
25590
+ * `vaultDeposit` auto-routing (that branch was removed) it only marks vaults
25591
+ * whose UI may offer the swap-router deposit surface. Kept as an alias for one
25592
+ * release; migrate to the async resolver.
25009
25593
  */
25010
25594
  export declare const VAULTS_USING_SWAP_ROUTER: ReadonlySet<string>;
25011
25595
 
@@ -25016,10 +25600,12 @@ export declare function depositNative(signer: Signer | Wallet, options: INativeD
25016
25600
  declare type VaultSymbols = 'predlp' | 'sentusd' | 'pregrid' | 'repouscc' | 'earnxrp' | 'tivkbtc' | 'tivusdt0' | 'supermon' | 'earnmon' | 'k3europ' | 'wmon/ausd' | 'wbtc/ausd' | 'earnausd_monad' | 'sausd' | 'farmbold' | 'sentuscc' | 'sentbtc' | 'svusdc' | 'apusdc' | 'testwethtsa' | 'tacusr' | 'upinjusdt' | 'tac-teth' | 'upausd' | 'taccbbtc' | 'xupusdc' | 'uptbtc' | 'gteth' | 'ageth' | 'upusdc' | 'hgeth' | 'upssylva' | 'hbbtc' | 'hbhype' | 'upazt' | 'susdt' | 'upedge' | 'coreusdc' | 'upcusdo' | 'shifteth' | 'upsusde' | 'uplbtc' | 'upavax' | 'tacrseth' | 'musd' | 'earnausd' | 'alpineusdcflagship' | 'alpinecoinshiftusdc' | 'upbtc' | 'upstrbtc' | 'maxiusr' | 'upgammausdc' | 'xhype' | 'wildusd' | 'alpinebtc' | 'prenusd' | 'upyzusd' | 'upnusd' | 'hlpe' | 'nemo eth yield';
25017
25601
 
25018
25602
  /**
25019
- * @deprecated Renamed to {@link isSwapRouterEligible}. The meaning also changed:
25020
- * it no longer implies `vaultDeposit` routes the vault through the SwapRouter
25021
- * (that behavior was removed) it only reports swap-router *eligibility* for
25022
- * the opt-in deposit surface. Kept as an alias for one release.
25603
+ * @deprecated Renamed to {@link isSwapRouterEligible} (itself now superseded by
25604
+ * {@link getSwapRouterEligibleVaults}, the on-chain-derived resolver). The
25605
+ * meaning also changed: it no longer implies `vaultDeposit` routes the vault
25606
+ * through the SwapRouter (that behavior was removed) it only reports
25607
+ * swap-router *eligibility* for the opt-in deposit surface. Kept as an alias
25608
+ * for one release; migrate to the async resolver.
25023
25609
  */
25024
25610
  export declare const vaultUsesSwapRouter: typeof isSwapRouterEligible;
25025
25611