@augustdigital/sdk 8.15.0 → 8.16.1

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
@@ -18210,6 +18210,15 @@ declare function assertNotStellar(address: string, operation: string): void;
18210
18210
  */
18211
18211
  export declare const getDefaultSubgraphUrl: (_network: string, _symbol: string) => string | undefined;
18212
18212
 
18213
+ /**
18214
+ * Program ids for `network`, or `undefined` when the canonical program has no
18215
+ * deployment there (currently `testnet`). Callers must handle `undefined` —
18216
+ * silently substituting a default would hand back a dead address.
18217
+ */
18218
+ declare function getDeployedProgramIds(network: ISolanaNetwork): {
18219
+ vault: string;
18220
+ } | undefined;
18221
+
18213
18222
  /**
18214
18223
  * Fetches the total amount deposited by an address on a whitelist contract
18215
18224
  * @param signer - signer / provider object
@@ -18977,6 +18986,15 @@ declare function assertNotStellar(address: string, operation: string): void;
18977
18986
  * 2. Fetch user's current assets (balanceOf * sharePrice via convertToAssets)
18978
18987
  * 3. Calculate PnL = assets withdrawn + current assets - assets deposited
18979
18988
  *
18989
+ * `totalDeposited` is the face value of what the user actually paid in
18990
+ * (each deposited asset's raw amount, rescaled to the vault's decimals — no
18991
+ * live price conversion), so any entry/exit fee the vault charges is
18992
+ * automatically counted as a cost against PnL rather than excluded from it.
18993
+ * Pre-deposit multi-asset vaults are assumed to only accept dollar-pegged
18994
+ * stablecoins into a dollar-denominated vault; a vault accepting a
18995
+ * non-pegged deposit asset would need deposit-time price conversion, which
18996
+ * this function does not perform.
18997
+ *
18980
18998
  * @param vault - Vault contract address
18981
18999
  * @param wallet - User wallet address
18982
19000
  * @param options - RPC configuration and service options
@@ -20794,6 +20812,9 @@ declare function assertNotStellar(address: string, operation: string): void;
20794
20812
  network?: ISolanaNetwork_2;
20795
20813
  }
20796
20814
 
20815
+ /** Solana networks the canonical august_vault program is actually deployed on. */
20816
+ declare type ISolanaDeployedNetwork = keyof typeof programIds;
20817
+
20797
20818
  export declare type ISolanaNetwork = 'devnet' | 'mainnet-beta' | 'testnet' | 'localnet';
20798
20819
 
20799
20820
  declare type ISolanaNetwork_2 = 'devnet' | 'mainnet-beta' | 'testnet' | 'localnet';
@@ -21489,6 +21510,12 @@ declare function assertNotStellar(address: string, operation: string): void;
21489
21510
  daily_pnl_per_share: Record<string, number>;
21490
21511
  latest_reported_tvl: number | null;
21491
21512
  cached_at?: string | null;
21513
+ /**
21514
+ * Per-vault provenance timestamps (APY recompute, newest share-price snapshot,
21515
+ * response assembly). Absent on older/cached responses predating the backend
21516
+ * change that added it.
21517
+ */
21518
+ freshness?: ITokenizedVaultFreshness | null;
21492
21519
  instant_redeem_config: null | {
21493
21520
  subaccount_address: string;
21494
21521
  output_asset_symbol: string;
@@ -21512,6 +21539,48 @@ declare function assertNotStellar(address: string, operation: string): void;
21512
21539
  name: string;
21513
21540
  }
21514
21541
 
21542
+ /**
21543
+ * Per-vault provenance timestamps returned by the backend on every tokenized-vault
21544
+ * read (list and single-vault, on both the `api.augustdigital.io/tokenized_vault`
21545
+ * and `api.upshift.finance/tokenized_vaults` surfaces).
21546
+ *
21547
+ * The three stamps describe *different* pipelines and are independently nullable —
21548
+ * one of them cannot stand in for another. Consumers use the ordering between them
21549
+ * to detect that the vault's share price has moved ahead of its APY: a
21550
+ * `share_ratio_snapshot_at` later than `apy_computed_at` means a share-price
21551
+ * snapshot has landed that the APY has not yet been recomputed from.
21552
+ *
21553
+ * All values are RFC 3339 UTC strings with a trailing `Z` (e.g.
21554
+ * `'2026-07-25T00:01:46Z'`). The trailing `Z` matters: `new Date()` parses an
21555
+ * offset-less date-time as *local* time, which would silently shift the stamp by
21556
+ * the viewer's UTC offset.
21557
+ *
21558
+ * @see ITokenizedVault.freshness
21559
+ */
21560
+ export declare interface ITokenizedVaultFreshness {
21561
+ /**
21562
+ * When `historical_apy`, TVL and drawdown were last recomputed, or null if they
21563
+ * have never been computed for this vault.
21564
+ */
21565
+ apy_computed_at: string | null;
21566
+ /**
21567
+ * `snapshot_datetime` of the newest persisted share-price snapshot, or null when
21568
+ * the vault has no snapshot yet.
21569
+ *
21570
+ * The backend stamps this from a scalar `max(snapshot_datetime)`, so it is
21571
+ * populated independently of `load_snapshots` — including on the basic and
21572
+ * sub-accounts views (`load_snapshots=false`), which is what every app call site
21573
+ * sends. Never substitute another timestamp for it.
21574
+ */
21575
+ share_ratio_snapshot_at: string | null;
21576
+ /**
21577
+ * When the backend assembled the response body, before it entered the backend's
21578
+ * own response cache. Distinct from the top-level `cached_at` only in scope:
21579
+ * this one travels with the vault object.
21580
+ */
21581
+ cached_at: string | null;
21582
+ }
21583
+
21515
21584
  export declare interface ITokenizedVaultOperator {
21516
21585
  address: `0x${string}`;
21517
21586
  operator_type: IOperatorTypeEnum;
@@ -21749,6 +21818,13 @@ declare function assertNotStellar(address: string, operation: string): void;
21749
21818
  defaultApyHorizon?: 7 | 30 | null;
21750
21819
  latest_reported_tvl?: number | null;
21751
21820
  cachedAt?: string | null;
21821
+ /**
21822
+ * Provenance timestamps for the vault's server-side data — when its APY was last
21823
+ * recomputed, when its newest share-price snapshot was taken, and when the
21824
+ * backend built the response. Null (or a null member) when the backend did not
21825
+ * report that stamp; see {@link IVaultFreshness}.
21826
+ */
21827
+ freshness?: IVaultFreshness | null;
21752
21828
  showCapFilled?: boolean | null;
21753
21829
  /** Controls how the vault's APY is displayed; null when the backend has not set an override. */
21754
21830
  apyOverride?: IApyOverride | null;
@@ -21835,14 +21911,38 @@ declare function assertNotStellar(address: string, operation: string): void;
21835
21911
  liquidAPY30Day?: number;
21836
21912
  }
21837
21913
 
21914
+ /**
21915
+ * A vault's APY breakdown.
21916
+ *
21917
+ * **Unit contract: every rate on this type is a PERCENTAGE, not a decimal
21918
+ * fraction.** `7.95` means 7.95%. The backend reports these as decimal fractions
21919
+ * (`0.0795`); the SDK multiplies by 100 exactly once, uniformly across every rate
21920
+ * field, before returning them. Consumers must therefore divide by 100 at most once
21921
+ * — and must apply the same treatment to `apy`, `liquidApy`, `pointsApy`,
21922
+ * `campaignApy` and `underlyingApy`, because they all arrive in the same unit.
21923
+ *
21924
+ * This is stated explicitly because the convention going undocumented let a
21925
+ * consumer scale a subset of these fields twice, making them contribute 1/100th of
21926
+ * their value to a displayed total (AUGUST-6967). The unit is uniform here by
21927
+ * design; treating some of these fields as decimals and others as percentages is
21928
+ * always a bug on the consumer side.
21929
+ */
21838
21930
  export declare interface IVaultApy {
21931
+ /** Base vault APY as a percentage (7.95 = 7.95%). */
21839
21932
  apy: number;
21933
+ /** Human-readable note on how the APY is derived; empty or null when unset. */
21840
21934
  explainer: string;
21935
+ /** Liquid-yield component as a percentage. */
21841
21936
  liquidApy: number;
21937
+ /** Points-program APY as a percentage, or null when the vault has no points. */
21842
21938
  pointsApy: number | null;
21939
+ /** Campaign-boost APY as a percentage, or null when no campaign is running. */
21843
21940
  campaignApy: number | null;
21941
+ /** Claimable rewards, in the reward token's own units — not a percentage. */
21844
21942
  rewardsClaimable: number;
21943
+ /** Compounded rewards, in the reward token's own units — not a percentage. */
21845
21944
  rewardsCompounded: number;
21945
+ /** Underlying-asset APY as a percentage (e.g. staking yield on the deposit asset). */
21846
21946
  underlyingApy: number;
21847
21947
  }
21848
21948
 
@@ -21938,6 +22038,64 @@ declare function assertNotStellar(address: string, operation: string): void;
21938
22038
  symbol: string;
21939
22039
  };
21940
22040
 
22041
+ /**
22042
+ * Provenance timestamps for a vault's server-side data, mapped from the backend
22043
+ * `freshness` object.
22044
+ *
22045
+ * A vault's share price and its APY come from two different pipelines: the SDK
22046
+ * reads share price live from chain (`totalAssets()/totalSupply()`), while APY is a
22047
+ * backend column recomputed on a schedule. These stamps make the remaining gap
22048
+ * visible so a UI can render "data as of X" instead of implying both numbers are
22049
+ * equally current.
22050
+ *
22051
+ * The three fields are **independently nullable and independently meaningful** —
22052
+ * none of them is a fallback for another. In particular, when
22053
+ * `shareRatioSnapshotAt` is later than `apyComputedAt`, a share-price snapshot has
22054
+ * landed that the APY has not yet been recomputed from: that ordering is the
22055
+ * staleness signal.
22056
+ *
22057
+ * Every value is an RFC 3339 UTC string with a trailing `Z`, exactly as the backend
22058
+ * sends it — the SDK does not reformat or reinterpret them. Keep the `Z` if you
22059
+ * pass these anywhere: `new Date('2026-07-25T00:01:46')` (no `Z`) is parsed as
22060
+ * *local* time and silently shifts by the viewer's UTC offset.
22061
+ *
22062
+ * @example
22063
+ * ```ts
22064
+ * const vault = await sdk.vaults.getVault(address);
22065
+ * const { apyComputedAt, shareRatioSnapshotAt } = vault.freshness ?? {};
22066
+ * // Only comparable when BOTH are present.
22067
+ * const apyLagsSharePrice =
22068
+ * !!apyComputedAt &&
22069
+ * !!shareRatioSnapshotAt &&
22070
+ * new Date(shareRatioSnapshotAt) > new Date(apyComputedAt);
22071
+ * ```
22072
+ */
22073
+ export declare interface IVaultFreshness {
22074
+ /**
22075
+ * When the backend last recomputed `historical_apy`, TVL and drawdown for this
22076
+ * vault. Null if never computed.
22077
+ */
22078
+ apyComputedAt: string | null;
22079
+ /**
22080
+ * Timestamp of the newest persisted share-price snapshot the backend holds. Null
22081
+ * only when the vault has no snapshot yet.
22082
+ *
22083
+ * Populated regardless of whether the read loaded snapshots — the backend stamps
22084
+ * it from a scalar `max(snapshot_datetime)`, so it is present even on
22085
+ * `load_snapshots=false` reads (the basic and sub-accounts views). When it is
22086
+ * null, treat it as absent: do not fall back to `apyComputedAt` or `cachedAt` in
22087
+ * its place.
22088
+ */
22089
+ shareRatioSnapshotAt: string | null;
22090
+ /**
22091
+ * When the backend assembled the response body this vault came from, before its
22092
+ * own response cache. Note this does **not** account for the SDK's client-side
22093
+ * LRU (10–15 min on `fetchTokenizedVault` / `fetchTokenizedVaults`), so a vault
22094
+ * served from that cache can be older than this stamp suggests is possible.
22095
+ */
22096
+ cachedAt: string | null;
22097
+ }
22098
+
21941
22099
  export declare type IVaultHistoricalParams = {
21942
22100
  daysAgo?: number;
21943
22101
  order?: IVaultOrderParam;
@@ -22860,6 +23018,25 @@ declare function assertNotStellar(address: string, operation: string): void;
22860
23018
  website_url: string;
22861
23019
  }[];
22862
23020
 
23021
+ /**
23022
+ * Map the backend `freshness` object onto the camelCased {@link IVaultFreshness}
23023
+ * shape carried on `IVault`. Shared across all chain adapters (EVM, Solana,
23024
+ * Stellar) so every surface reports provenance identically.
23025
+ *
23026
+ * Each of the three stamps is passed through independently: a missing member
23027
+ * becomes `null` and is never defaulted from one of the others. That is the point
23028
+ * of the object — `apy_computed_at` and `share_ratio_snapshot_at` describe two
23029
+ * different pipelines, and collapsing them would erase the very staleness signal
23030
+ * (snapshot newer than APY) the field exists to expose.
23031
+ *
23032
+ * @param tokenizedVault - Backend tokenized-vault payload. `freshness` is absent on
23033
+ * responses predating the backend change, and may be explicitly null.
23034
+ * @returns The mapped freshness object, or `null` when the backend reported none.
23035
+ * Values are the backend's RFC 3339 UTC strings verbatim — no reformatting, so
23036
+ * the trailing `Z` is preserved.
23037
+ */
23038
+ export declare function mapVaultFreshness(tokenizedVault: ITokenizedVault | undefined | null): IVaultFreshness | null;
23039
+
22863
23040
  /**
22864
23041
  * Max fee ceiling in stroops (1_000_000 stroops = 0.1 XLM).
22865
23042
  * assembleTransaction adjusts to the actual fee from simulation.
@@ -23107,9 +23284,6 @@ declare function assertNotStellar(address: string, operation: string): void;
23107
23284
  "mainnet-beta": {
23108
23285
  vault: string;
23109
23286
  };
23110
- testnet: {
23111
- vault: string;
23112
- };
23113
23287
  localnet: {
23114
23288
  vault: string;
23115
23289
  };
@@ -24315,7 +24489,7 @@ declare function assertNotStellar(address: string, operation: string): void;
24315
24489
  isSolanaAddress: isSolanaAddress;
24316
24490
  isSolana: (signature: string) => boolean;
24317
24491
  getProgram: ({ provider, idl, programId, network, }: {
24318
- idl: any;
24492
+ idl?: any;
24319
24493
  programId?: string;
24320
24494
  } & ISolanaConnectionOptions) => Program<any>;
24321
24495
  getProvider: ({ connection, publicKey, signTransaction, }: {
@@ -24379,9 +24553,6 @@ declare function assertNotStellar(address: string, operation: string): void;
24379
24553
  "mainnet-beta": {
24380
24554
  vault: string;
24381
24555
  };
24382
- testnet: {
24383
- vault: string;
24384
- };
24385
24556
  localnet: {
24386
24557
  vault: string;
24387
24558
  };
@@ -24433,1516 +24604,1516 @@ declare function assertNotStellar(address: string, operation: string): void;
24433
24604
  get connection(): web3.Connection;
24434
24605
  get provider(): AnchorProvider;
24435
24606
  setWalletProvider(_publicKey: PublicKey | string, signTransaction: (<T extends Transaction | web3.VersionedTransaction>(transaction: T) => Promise<T>) | undefined): void;
24436
- getProgram(programIdl: any): Program<any>;
24437
- getVaultState(vaultProgramId: PublicKey | string, idl: any, vaultAddress?: PublicKey | string): Promise<{
24438
- vaultState: unknown | null;
24439
- depositMintDecimals: number | null;
24440
- }>;
24441
- getVaultStateReadOnly(vaultProgramId: PublicKey | string, idl: any, vaultAddress?: PublicKey | string): Promise<{
24442
- vaultState: ISolanaVaultState | null;
24443
- depositMintDecimals: number | null;
24444
- }>;
24445
- getToken(mintAddress: string | PublicKey): Promise<{
24446
- address: string;
24447
- symbol: string;
24448
- decimals: number;
24449
- name: string;
24450
- image: string;
24451
- }>;
24452
- getTokenSymbol(mintAddress: string | PublicKey): Promise<string>;
24453
- fetchUserTokenBalance(publicKey: PublicKey | string, depositMint: PublicKey | string): Promise<any>;
24454
- fetchUserShareBalance(publicKey: PublicKey | string, shareMint: PublicKey | string): Promise<any>;
24455
- /**
24456
- * BigInt-safe variant of {@link fetchUserShareBalance}. Returns the raw u64
24457
- * `amount` (as a base-units string) plus the mint's `decimals` (or `null`
24458
- * when the scale can't be determined — see Returns), so the caller can
24459
- * produce a correct `INormalizedNumber` without losing precision.
24460
- *
24461
- * Prefer this anywhere the result feeds BigInt math — positions, max-
24462
- * actions, redemption sizing, allowance checks. `fetchUserShareBalance`
24463
- * returns a JS-number `uiAmount` which silently encodes against 18 decimals
24464
- * when passed through `toNormalizedBn(value)` without an explicit decimals
24465
- * argument; that's exactly how the jitoSOL "missing position" regression
24466
- * manifested.
24467
- *
24468
- * RPC cost: 1 `getParsedTokenAccountsByOwner` call. Worst case ~150ms on a
24469
- * healthy mainnet endpoint.
24470
- *
24471
- * @param publicKey Wallet owner (PublicKey or base58 string).
24472
- * @param shareMint The vault's share-token mint (PublicKey or base58).
24473
- * @returns
24474
- * `{ amount, decimals }`. Three observable shapes:
24475
- * - `{ amount: '<u64>', decimals: <number> }` — token account exists.
24476
- * - `{ amount: '0', decimals: null }` — no token account for this mint
24477
- * under this wallet, OR `tokenAmount` was missing from the response,
24478
- * OR `publicKey`/`shareMint` was not supplied. Distinguishable from a
24479
- * genuine zero-balance account (`decimals` would be set there).
24480
- * - `{ amount: '0', decimals: null }` — RPC threw (error is logged).
24481
- *
24482
- * `decimals === null` means "we could not determine the scale" — callers
24483
- * that need an `INormalizedNumber` must fall back to a known decimals
24484
- * value (typically the deposit mint's decimals from backend metadata)
24485
- * before normalizing. Never throws.
24486
- */
24487
- fetchUserShareBalanceRaw(publicKey: PublicKey | string, shareMint: PublicKey | string): Promise<{
24488
- amount: string;
24489
- decimals: number | null;
24490
- }>;
24491
24607
  /**
24492
- * Deposit funds into a Solana August vault.
24493
- * @param depositAmount `bigint` (raw on-chain units) or `number` (UI amount).
24494
- */
24495
- vaultDeposit(vaultProgramId: PublicKey | string, idl: any, publicKey: PublicKey | string, depositAmount: number | bigint, sendTransaction: (transaction: Transaction | web3.VersionedTransaction, connection: Connection, options?: SendTransactionOptions) => Promise<web3.TransactionSignature>, vaultAddress?: PublicKey | string): Promise<any>;
24496
- /**
24497
- * Redeem vault shares from a Solana August vault.
24498
- * @param redeemShares `bigint` (raw share units) or `number` (UI amount).
24499
- */
24500
- vaultRedeem(vaultProgramId: PublicKey | string, idl: any, publicKey: PublicKey | string, redeemShares: number | bigint, sendTransaction: (transaction: Transaction | web3.VersionedTransaction, connection: Connection, options?: SendTransactionOptions) => Promise<web3.TransactionSignature>, vaultAddress?: PublicKey | string): Promise<any>;
24501
- getProgramId(type: 'vault'): string;
24502
- }
24503
-
24504
- declare namespace SolanaConstants {
24505
- export {
24506
- fallbackDecimals,
24507
- fallbackNetwork,
24508
- fallbackRpcEndpoints,
24509
- programIds,
24510
- vaultIdl
24511
- }
24512
- }
24513
-
24514
- declare namespace SolanaGetters {
24515
- export {
24516
- getSolanaVault
24517
- }
24518
- }
24519
-
24520
- declare const SOROBAN_RPC_URLS: Record<IStellarNetwork, string>;
24521
-
24522
- export declare const SPECIAL_CHAINS: {
24523
- solana: {
24524
- name: string;
24525
- chainId: number;
24526
- explorer: string;
24527
- };
24528
- stellar: {
24529
- name: string;
24530
- chainId: number;
24531
- explorer: string;
24532
- };
24533
- };
24534
-
24535
- export declare const Stellar: {
24536
- utils: {
24537
- isStellarAddress: isStellarAddress;
24538
- getExplorerLink: getExplorerLink;
24539
- assertNotStellar: assertNotStellar;
24540
- };
24541
- constants: typeof StellarConstants;
24542
- actions: typeof StellarActions;
24543
- submit: typeof StellarSubmit;
24544
- getters: typeof StellarGetters;
24545
- };
24546
-
24547
- declare const STELLAR_CHAIN: {
24548
- name: string;
24549
- chainId: number;
24550
- explorer: string;
24551
- };
24552
-
24553
- declare const STELLAR_CHAIN_ID: number;
24554
-
24555
- declare const STELLAR_FALLBACK_DECIMALS = 7;
24556
-
24557
- declare namespace StellarActions {
24558
- export {
24559
- handleStellarDeposit,
24560
- handleStellarRedeem
24561
- }
24562
- }
24563
-
24564
- /**
24565
- * Stellar Adapter for August SDK
24566
- *
24567
- * @example
24568
- * ```
24569
- * const adapter = new StellarAdapter('testnet');
24570
- * const xdr = await adapter.vaultDeposit({
24571
- * contractId: 'CBGWW5...',
24572
- * amount: '1000000',
24573
- * senderAddress: 'GDLZ...',
24574
- * });
24575
- * // Sign xdr with wallet (e.g. Freighter), then submit via adapter.submitTransaction()
24576
- * ```
24577
- */
24578
- export declare class StellarAdapter {
24579
- private _network;
24580
- /**
24581
- * Optional consumer-supplied Soroban RPC endpoint (e.g. a keyed Alchemy URL).
24582
- * When set it is the primary, with the SDK's public endpoints as failover.
24583
- */
24584
- private _sorobanRpcUrl?;
24585
- /**
24586
- * @param network - Stellar network to operate on; defaults to `'mainnet'`.
24587
- * @param options - Optional adapter configuration. Its `sorobanRpcUrl` field
24588
- * overrides the Soroban RPC endpoint (e.g. a keyed Alchemy URL): it becomes
24589
- * the primary with the SDK's built-in public endpoints kept behind it as
24590
- * failover, and a per-call `sorobanRpcUrl` (on the deposit/redeem params)
24591
- * takes precedence over this adapter-level one.
24592
- */
24593
- constructor(network?: IStellarNetwork, options?: {
24594
- sorobanRpcUrl?: string;
24595
- });
24596
- get network(): IStellarNetwork;
24597
- isStellarAddress(address: string): boolean;
24598
- getExplorerLink(id: string, type?: 'contract' | 'account' | 'tx'): string;
24599
- /**
24600
- * Build an unsigned deposit transaction for a Stellar vault.
24601
- * @returns Base64-encoded XDR of the unsigned transaction.
24602
- */
24603
- vaultDeposit(params: Omit<IStellarDepositParams, 'network'>): Promise<string>;
24604
- /**
24605
- * Build an unsigned redeem transaction for a Stellar vault.
24606
- * @returns Base64-encoded XDR of the unsigned transaction.
24607
- */
24608
- vaultRedeem(params: Omit<IStellarRedeemParams, 'network'>): Promise<string>;
24609
- /**
24610
- * Submit a signed Soroban transaction and poll until the network confirms it.
24608
+ * Build an Anchor `Program` bound to this adapter's provider and network.
24611
24609
  *
24612
- * Submits on the network this adapter was constructed with, so `signedXdr`
24613
- * must be signed for that same network.
24610
+ * The program id is resolved as: explicit `programId` the `address` carried
24611
+ * by a custom `programIdl` → the canonical deployment for this adapter's
24612
+ * network. A copy of the SDK's bundled `vaultIdl` defers to the network
24613
+ * default (its embedded `address` is a build stamp, not network-aware), so
24614
+ * forwarding it on devnet never silently targets the mainnet program.
24614
24615
  *
24615
- * @param signedXdr - Base64-encoded XDR of the signed transaction.
24616
- * @returns The transaction hash once the network confirms it as successful.
24617
- * @throws {@link AugustTimeoutError} when the transaction is not confirmed
24618
- * within the poll budget (`MAX_POLL_ATTEMPTS`).
24619
- * @throws {@link AugustSDKError} when the RPC rejects the submission or the
24620
- * transaction confirms as failed. Its `context` carries `{ network, status }`
24621
- * plus, when the result XDR decodes, a `resultCode` string holding the
24622
- * transaction-level reason (e.g. `"txBadSeq"`, `"txTooLate"`); `resultCode`
24623
- * is `undefined` when the code cannot be decoded.
24624
- * @example
24625
- * ```ts
24626
- * try {
24627
- * const hash = await adapter.submitTransaction(signedXdr);
24628
- * } catch (err) {
24629
- * if (err instanceof AugustSDKError && err.context?.resultCode === 'txBadSeq') {
24630
- * // stale sequence number — rebuild the transaction and resubmit
24631
- * }
24632
- * }
24633
- * ```
24634
- */
24635
- submitTransaction(signedXdr: string): Promise<string>;
24636
- /**
24637
- * Get user's vault share balance.
24638
- *
24639
- * @returns The position `{ shares, decimals, decimalsFromFallback }`, or null
24640
- * if the balance read fails. When `decimalsFromFallback` is `true` the
24641
- * `decimals()` read failed and `decimals` is the fallback (7) — callers sizing
24642
- * a redeem MUST refuse rather than trust it (see AUGUST-6381).
24643
- */
24644
- getUserPosition(vaultAddress: string, walletAddress: string): Promise<IStellarUserPosition | null>;
24645
- /**
24646
- * Preview how many vault shares a deposit amount would yield.
24647
- * @param vaultAddress Stellar contract ID (C… address)
24648
- * @param rawAmount Deposit amount in the deposit token's smallest unit
24649
- * @returns Raw share amount as a string, or null if query fails.
24616
+ * @param programIdl - Anchor IDL to bind. Defaults to the SDK's bundled
24617
+ * `august_vault` IDL. A custom IDL's `address` is honoured when it differs
24618
+ * from the bundled build stamp.
24619
+ * @param programId - Base58 program id that overrides both the IDL's address
24620
+ * and the network default. Use this to target a non-canonical deployment.
24621
+ * @returns An Anchor `Program` for the resolved program id. No RPC is made —
24622
+ * construction is offline.
24623
+ * @throws {@link AugustValidationError} if no program id can be resolved
24624
+ * because this adapter's network has no canonical deployment (e.g.
24625
+ * `testnet`) and neither `programId` nor a custom IDL address was supplied.
24626
+ *
24627
+ * @example
24628
+ * ```ts
24629
+ * // canonical program on the adapter's network
24630
+ * const program = sdk.solana.getProgram();
24631
+ *
24632
+ * // a different deployment, same interface
24633
+ * const legacy = sdk.solana.getProgram(vaultIdl, '7B8n9vL51b6ibqRAd1adZsi3x3kxtq5NZaondh22Vkyq');
24634
+ * ```
24635
+ */
24636
+ getProgram(programIdl?: any, programId?: string): Program<any>;
24637
+ getVaultState(vaultProgramId: PublicKey | string, idl: any, vaultAddress?: PublicKey | string): Promise<{
24638
+ vaultState: unknown | null;
24639
+ depositMintDecimals: number | null;
24640
+ }>;
24641
+ getVaultStateReadOnly(vaultProgramId: PublicKey | string, idl: any, vaultAddress?: PublicKey | string): Promise<{
24642
+ vaultState: ISolanaVaultState | null;
24643
+ depositMintDecimals: number | null;
24644
+ }>;
24645
+ getToken(mintAddress: string | PublicKey): Promise<{
24646
+ address: string;
24647
+ symbol: string;
24648
+ decimals: number;
24649
+ name: string;
24650
+ image: string;
24651
+ }>;
24652
+ getTokenSymbol(mintAddress: string | PublicKey): Promise<string>;
24653
+ fetchUserTokenBalance(publicKey: PublicKey | string, depositMint: PublicKey | string): Promise<any>;
24654
+ fetchUserShareBalance(publicKey: PublicKey | string, shareMint: PublicKey | string): Promise<any>;
24655
+ /**
24656
+ * BigInt-safe variant of {@link fetchUserShareBalance}. Returns the raw u64
24657
+ * `amount` (as a base-units string) plus the mint's `decimals` (or `null`
24658
+ * when the scale can't be determined — see Returns), so the caller can
24659
+ * produce a correct `INormalizedNumber` without losing precision.
24660
+ *
24661
+ * Prefer this anywhere the result feeds BigInt math — positions, max-
24662
+ * actions, redemption sizing, allowance checks. `fetchUserShareBalance`
24663
+ * returns a JS-number `uiAmount` which silently encodes against 18 decimals
24664
+ * when passed through `toNormalizedBn(value)` without an explicit decimals
24665
+ * argument; that's exactly how the jitoSOL "missing position" regression
24666
+ * manifested.
24667
+ *
24668
+ * RPC cost: 1 `getParsedTokenAccountsByOwner` call. Worst case ~150ms on a
24669
+ * healthy mainnet endpoint.
24670
+ *
24671
+ * @param publicKey Wallet owner (PublicKey or base58 string).
24672
+ * @param shareMint The vault's share-token mint (PublicKey or base58).
24673
+ * @returns
24674
+ * `{ amount, decimals }`. Three observable shapes:
24675
+ * - `{ amount: '<u64>', decimals: <number> }` — token account exists.
24676
+ * - `{ amount: '0', decimals: null }` — no token account for this mint
24677
+ * under this wallet, OR `tokenAmount` was missing from the response,
24678
+ * OR `publicKey`/`shareMint` was not supplied. Distinguishable from a
24679
+ * genuine zero-balance account (`decimals` would be set there).
24680
+ * - `{ amount: '0', decimals: null }` — RPC threw (error is logged).
24681
+ *
24682
+ * `decimals === null` means "we could not determine the scale" — callers
24683
+ * that need an `INormalizedNumber` must fall back to a known decimals
24684
+ * value (typically the deposit mint's decimals from backend metadata)
24685
+ * before normalizing. Never throws.
24686
+ */
24687
+ fetchUserShareBalanceRaw(publicKey: PublicKey | string, shareMint: PublicKey | string): Promise<{
24688
+ amount: string;
24689
+ decimals: number | null;
24690
+ }>;
24691
+ /**
24692
+ * Deposit funds into a Solana August vault.
24693
+ * @param depositAmount `bigint` (raw on-chain units) or `number` (UI amount).
24694
+ */
24695
+ vaultDeposit(vaultProgramId: PublicKey | string, idl: any, publicKey: PublicKey | string, depositAmount: number | bigint, sendTransaction: (transaction: Transaction | web3.VersionedTransaction, connection: Connection, options?: SendTransactionOptions) => Promise<web3.TransactionSignature>, vaultAddress?: PublicKey | string): Promise<any>;
24696
+ /**
24697
+ * Redeem vault shares from a Solana August vault.
24698
+ * @param redeemShares `bigint` (raw share units) or `number` (UI amount).
24699
+ */
24700
+ vaultRedeem(vaultProgramId: PublicKey | string, idl: any, publicKey: PublicKey | string, redeemShares: number | bigint, sendTransaction: (transaction: Transaction | web3.VersionedTransaction, connection: Connection, options?: SendTransactionOptions) => Promise<web3.TransactionSignature>, vaultAddress?: PublicKey | string): Promise<any>;
24701
+ /**
24702
+ * Canonical program id for a program type on this adapter's network.
24703
+ *
24704
+ * @param type - Program to look up. Only `'vault'` (august_vault) exists today.
24705
+ * @returns The base58 program id.
24706
+ * @throws {@link AugustValidationError} if the canonical program is not
24707
+ * deployed on this adapter's network (e.g. `testnet`). Previously an
24708
+ * unmapped network threw a bare `TypeError`.
24650
24709
  */
24651
- convertToShares(vaultAddress: string, rawAmount: string): Promise<string | null>;
24710
+ getProgramId(type: 'vault'): string;
24652
24711
  }
24653
24712
 
24654
- declare namespace StellarConstants {
24713
+ declare namespace SolanaConstants {
24655
24714
  export {
24656
- STELLAR_CHAIN_ID,
24657
- STELLAR_CHAIN,
24658
- SOROBAN_RPC_URLS,
24659
- NETWORK_PASSPHRASES,
24660
- STELLAR_FALLBACK_DECIMALS,
24661
- TX_TIMEOUT_SECONDS,
24662
- QUERY_TIMEOUT_SECONDS,
24663
- MAX_FEE_STROOPS,
24664
- POLL_INTERVAL_MS,
24665
- POLL_INTERVAL_MAX_MS,
24666
- POLL_INTERVAL_BACKOFF,
24667
- MAX_POLL_ATTEMPTS
24715
+ fallbackDecimals,
24716
+ fallbackNetwork,
24717
+ fallbackRpcEndpoints,
24718
+ getDeployedProgramIds,
24719
+ programIds,
24720
+ vaultIdl,
24721
+ ISolanaDeployedNetwork
24668
24722
  }
24669
24723
  }
24670
24724
 
24671
- declare namespace StellarGetters {
24725
+ declare namespace SolanaGetters {
24672
24726
  export {
24673
- getStellarVault,
24674
- getStellarUserPosition,
24675
- convertToShares
24727
+ getSolanaVault
24676
24728
  }
24677
24729
  }
24678
24730
 
24679
- declare namespace StellarSubmit {
24731
+ declare const SOROBAN_RPC_URLS: Record<IStellarNetwork, string>;
24732
+
24733
+ export declare const SPECIAL_CHAINS: {
24734
+ solana: {
24735
+ name: string;
24736
+ chainId: number;
24737
+ explorer: string;
24738
+ };
24739
+ stellar: {
24740
+ name: string;
24741
+ chainId: number;
24742
+ explorer: string;
24743
+ };
24744
+ };
24745
+
24746
+ export declare const Stellar: {
24747
+ utils: {
24748
+ isStellarAddress: isStellarAddress;
24749
+ getExplorerLink: getExplorerLink;
24750
+ assertNotStellar: assertNotStellar;
24751
+ };
24752
+ constants: typeof StellarConstants;
24753
+ actions: typeof StellarActions;
24754
+ submit: typeof StellarSubmit;
24755
+ getters: typeof StellarGetters;
24756
+ };
24757
+
24758
+ declare const STELLAR_CHAIN: {
24759
+ name: string;
24760
+ chainId: number;
24761
+ explorer: string;
24762
+ };
24763
+
24764
+ declare const STELLAR_CHAIN_ID: number;
24765
+
24766
+ declare const STELLAR_FALLBACK_DECIMALS = 7;
24767
+
24768
+ declare namespace StellarActions {
24680
24769
  export {
24681
- submitStellarTransaction
24770
+ handleStellarDeposit,
24771
+ handleStellarRedeem
24682
24772
  }
24683
24773
  }
24684
24774
 
24685
24775
  /**
24686
- * @deprecated
24687
- * Replaced by SUBGRAPH_VAULT_URLS which are subgraphs deployed on Goldsky.
24776
+ * Stellar Adapter for August SDK
24777
+ *
24778
+ * @example
24779
+ * ```
24780
+ * const adapter = new StellarAdapter('testnet');
24781
+ * const xdr = await adapter.vaultDeposit({
24782
+ * contractId: 'CBGWW5...',
24783
+ * amount: '1000000',
24784
+ * senderAddress: 'GDLZ...',
24785
+ * });
24786
+ * // Sign xdr with wallet (e.g. Freighter), then submit via adapter.submitTransaction()
24787
+ * ```
24688
24788
  */
24689
- export declare const SUBGRAPH_POOL_URLS: (apiKey: string, chainId?: number, pool?: IAddress) => {
24690
- 1: string;
24691
- 8453: string;
24692
- 43114: string;
24693
- 42161: string;
24694
- 56: string;
24695
- } | {
24696
- 999: string;
24697
- };
24789
+ export declare class StellarAdapter {
24790
+ private _network;
24791
+ /**
24792
+ * Optional consumer-supplied Soroban RPC endpoint (e.g. a keyed Alchemy URL).
24793
+ * When set it is the primary, with the SDK's public endpoints as failover.
24794
+ */
24795
+ private _sorobanRpcUrl?;
24796
+ /**
24797
+ * @param network - Stellar network to operate on; defaults to `'mainnet'`.
24798
+ * @param options - Optional adapter configuration. Its `sorobanRpcUrl` field
24799
+ * overrides the Soroban RPC endpoint (e.g. a keyed Alchemy URL): it becomes
24800
+ * the primary with the SDK's built-in public endpoints kept behind it as
24801
+ * failover, and a per-call `sorobanRpcUrl` (on the deposit/redeem params)
24802
+ * takes precedence over this adapter-level one.
24803
+ */
24804
+ constructor(network?: IStellarNetwork, options?: {
24805
+ sorobanRpcUrl?: string;
24806
+ });
24807
+ get network(): IStellarNetwork;
24808
+ isStellarAddress(address: string): boolean;
24809
+ getExplorerLink(id: string, type?: 'contract' | 'account' | 'tx'): string;
24810
+ /**
24811
+ * Build an unsigned deposit transaction for a Stellar vault.
24812
+ * @returns Base64-encoded XDR of the unsigned transaction.
24813
+ */
24814
+ vaultDeposit(params: Omit<IStellarDepositParams, 'network'>): Promise<string>;
24815
+ /**
24816
+ * Build an unsigned redeem transaction for a Stellar vault.
24817
+ * @returns Base64-encoded XDR of the unsigned transaction.
24818
+ */
24819
+ vaultRedeem(params: Omit<IStellarRedeemParams, 'network'>): Promise<string>;
24820
+ /**
24821
+ * Submit a signed Soroban transaction and poll until the network confirms it.
24822
+ *
24823
+ * Submits on the network this adapter was constructed with, so `signedXdr`
24824
+ * must be signed for that same network.
24825
+ *
24826
+ * @param signedXdr - Base64-encoded XDR of the signed transaction.
24827
+ * @returns The transaction hash once the network confirms it as successful.
24828
+ * @throws {@link AugustTimeoutError} when the transaction is not confirmed
24829
+ * within the poll budget (`MAX_POLL_ATTEMPTS`).
24830
+ * @throws {@link AugustSDKError} when the RPC rejects the submission or the
24831
+ * transaction confirms as failed. Its `context` carries `{ network, status }`
24832
+ * plus, when the result XDR decodes, a `resultCode` string holding the
24833
+ * transaction-level reason (e.g. `"txBadSeq"`, `"txTooLate"`); `resultCode`
24834
+ * is `undefined` when the code cannot be decoded.
24835
+ * @example
24836
+ * ```ts
24837
+ * try {
24838
+ * const hash = await adapter.submitTransaction(signedXdr);
24839
+ * } catch (err) {
24840
+ * if (err instanceof AugustSDKError && err.context?.resultCode === 'txBadSeq') {
24841
+ * // stale sequence number — rebuild the transaction and resubmit
24842
+ * }
24843
+ * }
24844
+ * ```
24845
+ */
24846
+ submitTransaction(signedXdr: string): Promise<string>;
24847
+ /**
24848
+ * Get user's vault share balance.
24849
+ *
24850
+ * @returns The position `{ shares, decimals, decimalsFromFallback }`, or null
24851
+ * if the balance read fails. When `decimalsFromFallback` is `true` the
24852
+ * `decimals()` read failed and `decimals` is the fallback (7) — callers sizing
24853
+ * a redeem MUST refuse rather than trust it (see AUGUST-6381).
24854
+ */
24855
+ getUserPosition(vaultAddress: string, walletAddress: string): Promise<IStellarUserPosition | null>;
24856
+ /**
24857
+ * Preview how many vault shares a deposit amount would yield.
24858
+ * @param vaultAddress Stellar contract ID (C… address)
24859
+ * @param rawAmount Deposit amount in the deposit token's smallest unit
24860
+ * @returns Raw share amount as a string, or null if query fails.
24861
+ */
24862
+ convertToShares(vaultAddress: string, rawAmount: string): Promise<string | null>;
24863
+ }
24698
24864
 
24699
- /**
24700
- * Subgraph URLs
24701
- * @deprecated use getVaultMetadata to fetch subgraph URLs from the backend
24702
- */
24703
- export declare const SUBGRAPH_VAULT_URLS: Record<VaultSymbols, string>;
24865
+ declare namespace StellarConstants {
24866
+ export {
24867
+ STELLAR_CHAIN_ID,
24868
+ STELLAR_CHAIN,
24869
+ SOROBAN_RPC_URLS,
24870
+ NETWORK_PASSPHRASES,
24871
+ STELLAR_FALLBACK_DECIMALS,
24872
+ TX_TIMEOUT_SECONDS,
24873
+ QUERY_TIMEOUT_SECONDS,
24874
+ MAX_FEE_STROOPS,
24875
+ POLL_INTERVAL_MS,
24876
+ POLL_INTERVAL_MAX_MS,
24877
+ POLL_INTERVAL_BACKOFF,
24878
+ MAX_POLL_ATTEMPTS
24879
+ }
24880
+ }
24704
24881
 
24705
- /**
24706
- * Submit a signed Soroban transaction and poll until confirmed.
24707
- *
24708
- * @param signedXdr - Base64-encoded XDR of the signed transaction
24709
- * @param network - Stellar network name
24710
- * @param sorobanRpcUrl - Optional override Soroban RPC endpoint (e.g. a keyed
24711
- * Alchemy URL); becomes the primary with the SDK's public endpoints kept as
24712
- * failover. Omit to use the public endpoints.
24713
- * @returns The transaction hash once the network confirms it as successful
24714
- * @throws {@link AugustTimeoutError} when the transaction is not confirmed
24715
- * within the poll budget (`MAX_POLL_ATTEMPTS`).
24716
- * @throws {@link AugustSDKError} when the RPC rejects the submission or the
24717
- * transaction confirms as failed. Its `context` carries `{ network, status }`
24718
- * plus, when the result XDR decodes, a `resultCode` string holding the
24719
- * transaction-level reason (e.g. `"txBadSeq"`, `"txTooLate"`); `resultCode`
24720
- * is `undefined` when the code cannot be decoded.
24721
- * @example
24722
- * ```ts
24723
- * try {
24724
- * const hash = await submitStellarTransaction(signedXdr, 'mainnet');
24725
- * } catch (err) {
24726
- * if (err instanceof AugustSDKError && err.context?.resultCode === 'txBadSeq') {
24727
- * // stale sequence number — rebuild the transaction and resubmit
24728
- * }
24729
- * }
24730
- * ```
24731
- */
24732
- declare function submitStellarTransaction(signedXdr: string, network: IStellarNetwork, sorobanRpcUrl?: string): Promise<string>;
24882
+ declare namespace StellarGetters {
24883
+ export {
24884
+ getStellarVault,
24885
+ getStellarUserPosition,
24886
+ convertToShares
24887
+ }
24888
+ }
24733
24889
 
24734
- /**
24735
- * Sui Adapter for August SDK
24736
- *
24737
- * @example
24738
- * To access the Sui adapter instance
24739
- * ```
24740
- * const sdk = new AugustSDK()
24741
- * sdk.sui.getEmberVaults()
24742
- * ```
24743
- */
24744
- declare class SuiAdapter {
24745
- private _apiBaseUrl;
24746
- private _chainId;
24747
- constructor(apiBaseUrl?: string, chainId?: number);
24748
- get apiBaseUrl(): string;
24749
- get chainId(): number;
24750
- getEmberVaults(options?: IFetchEmberVaultsOptions): Promise<IEmberVault[]>;
24751
- getEmberTVL(limit?: number): Promise<number>;
24752
- convertFromE9(value: string | number): number;
24753
- calculateUtilization(current: string | number, maximum: string | number): number;
24754
- isSuiAddress(address: string): boolean;
24755
- isSuiVault(chainId: number): boolean;
24756
- transformEmberVaultToIVault(emberVault: IEmberVault): IVault;
24757
- transformEmberVaultsToIVaults(emberVaults: IEmberVault[]): IVault[];
24890
+ declare namespace StellarSubmit {
24891
+ export {
24892
+ submitStellarTransaction
24893
+ }
24758
24894
  }
24759
24895
 
24760
24896
  /**
24761
- * Address of the `SwapRouter` periphery contract on each supported chain.
24762
- *
24763
- * Missing keys mean no SwapRouter is deployed on that chain — callers
24764
- * should fall back to legacy adapter paths.
24765
- *
24766
- * @see {@link getSwapRouterAddress} for the typed lookup helper.
24897
+ * @deprecated
24898
+ * Replaced by SUBGRAPH_VAULT_URLS which are subgraphs deployed on Goldsky.
24767
24899
  */
24768
- export declare const SWAP_ROUTER_ADDRESSES: Readonly<Record<number, IAddress>>;
24900
+ export declare const SUBGRAPH_POOL_URLS: (apiKey: string, chainId?: number, pool?: IAddress) => {
24901
+ 1: string;
24902
+ 8453: string;
24903
+ 43114: string;
24904
+ 42161: string;
24905
+ 56: string;
24906
+ } | {
24907
+ 999: string;
24908
+ };
24769
24909
 
24770
24910
  /**
24771
- * Block at which each chain's `SwapRouter` was deployed/configured — the safe
24772
- * lower bound for scanning its `TokenEnabled` / `VaultEnabled` log history.
24773
- *
24774
- * The router stores its allowlist as `mapping(address => bool) whitelistedTokens`
24775
- * with no on-chain enumeration, so {@link getSwapRouterWhitelistedTokens} must
24776
- * reconstruct the candidate set from `TokenEnabled` events before verifying each
24777
- * against the current mapping. Starting the `eth_getLogs` scan here (rather than
24778
- * from genesis) bounds it to the router's own lifetime — a few chunks — instead
24779
- * of the whole chain.
24780
- *
24781
- * Mainnet value is the router's deployment block (its first emitted event, the
24782
- * constructor `OwnershipTransferred`). A too-low value only costs extra empty
24783
- * log ranges; a value ABOVE the first `TokenEnabled` would silently miss tokens,
24784
- * so err on the side of earlier.
24911
+ * Subgraph URLs
24912
+ * @deprecated use getVaultMetadata to fetch subgraph URLs from the backend
24785
24913
  */
24786
- export declare const SWAP_ROUTER_DEPLOY_BLOCKS: Readonly<Record<number, number>>;
24914
+ export declare const SUBGRAPH_VAULT_URLS: Record<VaultSymbols, string>;
24787
24915
 
24788
24916
  /**
24789
- * The DEX aggregator whitelisted on each chain's `SwapRouter` via
24790
- * `enableRouter`, plus the single aggregator contract method every swap leg is
24791
- * pinned to and that method's 4-byte selector.
24792
- *
24793
- * This is the single source of truth tying the off-chain swap-leg builder to
24794
- * the on-chain router whitelist. The two MUST agree or `swapAndDeposit` reverts
24795
- * with `InvalidRouter()` (router not whitelisted) or `InvalidNotWhitelisted()`
24796
- * (selector not authorized). It is consumed in three places:
24797
- *
24798
- * - `dispatchViaSwapRouter` asks {@link fetchSwapQuote} to pin the aggregator to
24799
- * `contractMethod`, then asserts the returned quote's `router` and payload
24800
- * selector match this entry before broadcasting — failing closed rather than
24801
- * letting the user pay gas for a transaction the contract will reject.
24802
- * - The CI check `scripts/verify-swap-router-aggregator.mjs` asserts the
24803
- * deployed `SwapRouter` actually has `tokenTransferProxies[router] != 0` and
24804
- * `isAuthorizedSelector(router, selector) == true` for every entry here, so
24805
- * config drift is caught at release time, not by a user's failed deposit.
24806
- *
24807
- * Pinning to one generic method matters: the aggregator otherwise picks a route
24808
- * method per quote (e.g. a direct `swapExactAmountInOnUniswapV3`) that varies
24809
- * with market conditions, producing a different selector each time. Pinning
24810
- * collapses that to one stable selector so the on-chain whitelist needs only
24811
- * that selector and never drifts as routing changes.
24917
+ * Submit a signed Soroban transaction and poll until confirmed.
24812
24918
  *
24813
- * `router` is the address the aggregator's calldata targets (ParaSwap v6.2
24814
- * pulls tokens to the Augustus contract itself, so the SwapRouter's
24815
- * `tokenTransferProxies[router]` is the router address). `selector` is
24816
- * `bytes4(keccak256("<contractMethod>(...)"))`. Verify both against the
24817
- * deployed router before adding a chain — a wrong value reverts at deposit time.
24818
- */
24819
- export declare const SWAP_ROUTER_DEX_AGGREGATOR: Readonly<Record<number, {
24820
- router: IAddress;
24821
- contractMethod: string;
24822
- selector: `0x${string}`;
24823
- /** Human-readable aggregator name for display; never derive routing logic from it. */
24824
- name: string;
24825
- }>>;
24919
+ * @param signedXdr - Base64-encoded XDR of the signed transaction
24920
+ * @param network - Stellar network name
24921
+ * @param sorobanRpcUrl - Optional override Soroban RPC endpoint (e.g. a keyed
24922
+ * Alchemy URL); becomes the primary with the SDK's public endpoints kept as
24923
+ * failover. Omit to use the public endpoints.
24924
+ * @returns The transaction hash once the network confirms it as successful
24925
+ * @throws {@link AugustTimeoutError} when the transaction is not confirmed
24926
+ * within the poll budget (`MAX_POLL_ATTEMPTS`).
24927
+ * @throws {@link AugustSDKError} when the RPC rejects the submission or the
24928
+ * transaction confirms as failed. Its `context` carries `{ network, status }`
24929
+ * plus, when the result XDR decodes, a `resultCode` string holding the
24930
+ * transaction-level reason (e.g. `"txBadSeq"`, `"txTooLate"`); `resultCode`
24931
+ * is `undefined` when the code cannot be decoded.
24932
+ * @example
24933
+ * ```ts
24934
+ * try {
24935
+ * const hash = await submitStellarTransaction(signedXdr, 'mainnet');
24936
+ * } catch (err) {
24937
+ * if (err instanceof AugustSDKError && err.context?.resultCode === 'txBadSeq') {
24938
+ * // stale sequence number — rebuild the transaction and resubmit
24939
+ * }
24940
+ * }
24941
+ * ```
24942
+ */
24943
+ declare function submitStellarTransaction(signedXdr: string, network: IStellarNetwork, sorobanRpcUrl?: string): Promise<string>;
24826
24944
 
24827
- /**
24828
- * Vaults whose UI **may offer the any-token SwapRouter deposit surface** —
24829
- * i.e. the SwapRouter is `enableVault`-ed for them on-chain.
24830
- *
24831
- * This is *eligibility metadata only*. It is consumed by:
24832
- * - the app UI, to decide whether to render the (flag-gated) swap-router
24833
- * deposit surface for a vault; and
24834
- * - {@link swapRouterDeposit}, optionally, as a fail-fast eligibility check.
24835
- *
24836
- * It is deliberately **NOT** read by {@link vaultDeposit}: `vaultDeposit` is the
24837
- * native/multiasset/adapter path and never routes through the SwapRouter. That
24838
- * separation is what stops a natively-accepted asset from being silently
24839
- * swapped — the regression that implicit auto-routing caused. Any-token swap
24840
- * deposits are the explicit, opt-in job of {@link swapRouterDeposit}.
24841
- *
24842
- * Membership requires the vault to be registered on-chain
24843
- * (`vaultInfo[addr].referenceAsset != 0`) — an unregistered vault reverts with
24844
- * `InvalidVault` at deposit time. A listed vault's natively-accepted assets
24845
- * (for a multi-asset vault, its whole deposit-asset set) still deposit via
24846
- * `vaultDeposit`; only tokens OUTSIDE that set go through `swapRouterDeposit`.
24847
- *
24848
- * Lowercase comparison is required when checking — use
24849
- * {@link isSwapRouterEligible} rather than reading this set directly.
24850
- *
24851
- * @deprecated Superseded by {@link getSwapRouterEligibleVaults}, which derives
24852
- * the eligible set from the router's on-chain `VaultEnabled` history and
24853
- * verifies each vault's current registration (`vaultInfo.referenceAsset != 0`)
24854
- * — so new enablements surface without an SDK release. This static set stays
24855
- * functional as the zero-RPC fallback seed (e.g. TanStack Query `initialData`)
24856
- * and for SDK-internal sync consumers.
24857
- */
24858
- export declare const SWAP_ROUTER_ELIGIBLE_VAULTS: ReadonlySet<string>;
24945
+ /**
24946
+ * Sui Adapter for August SDK
24947
+ *
24948
+ * @example
24949
+ * To access the Sui adapter instance
24950
+ * ```
24951
+ * const sdk = new AugustSDK()
24952
+ * sdk.sui.getEmberVaults()
24953
+ * ```
24954
+ */
24955
+ declare class SuiAdapter {
24956
+ private _apiBaseUrl;
24957
+ private _chainId;
24958
+ constructor(apiBaseUrl?: string, chainId?: number);
24959
+ get apiBaseUrl(): string;
24960
+ get chainId(): number;
24961
+ getEmberVaults(options?: IFetchEmberVaultsOptions): Promise<IEmberVault[]>;
24962
+ getEmberTVL(limit?: number): Promise<number>;
24963
+ convertFromE9(value: string | number): number;
24964
+ calculateUtilization(current: string | number, maximum: string | number): number;
24965
+ isSuiAddress(address: string): boolean;
24966
+ isSuiVault(chainId: number): boolean;
24967
+ transformEmberVaultToIVault(emberVault: IEmberVault): IVault;
24968
+ transformEmberVaultsToIVaults(emberVaults: IEmberVault[]): IVault[];
24969
+ }
24859
24970
 
24860
- /**
24861
- * Maximum number of swap legs the contract accepts in a single
24862
- * `swapAndDeposit` call. Mirrors the on-chain `MAX_SWAPS` constant; reading
24863
- * the on-chain value at call time would add an RPC for no gain.
24864
- *
24865
- * Kept here so the SDK can reject oversize inputs at the boundary rather
24866
- * than wait for the on-chain `TooManySwaps` revert.
24867
- */
24868
- export declare const SWAP_ROUTER_MAX_SWAPS = 9;
24971
+ /**
24972
+ * Sum a wallet's per-asset deposits into the vault's own decimals, at face
24973
+ * value 1 unit of any deposited asset is treated as 1 unit of the vault's
24974
+ * reporting currency, with no live price conversion.
24975
+ *
24976
+ * Used by {@link getVaultUserLifetimePnl} for `totalDeposited`. Pre-deposit
24977
+ * multi-asset vaults only accept dollar-pegged stablecoins (USDC, USDT, DAI,
24978
+ * USDS, RLUSD, etc.) into a dollar-denominated vault, so face value is a
24979
+ * reasonable stand-in for USD value. This intentionally does NOT re-quote
24980
+ * through a live price oracle: doing so priced a historical deposit at
24981
+ * today's market rate, so `totalDeposited` (and lifetimePnl) drifted between
24982
+ * calls purely from stablecoin peg noise, and approximately re-inflated
24983
+ * deposits back toward face value — which silently excluded the vault's
24984
+ * entry fee from PnL. The fee is money the user actually paid, so PnL must
24985
+ * be computed net of it.
24986
+ *
24987
+ * @param depositsByAsset - Raw deposited amount per asset, keyed by
24988
+ * lowercased asset address (or `'default'` / `'lz-default'` for
24989
+ * single-asset / cross-chain rows).
24990
+ * @param assetDecimals - Decimals for each key in `depositsByAsset`.
24991
+ * @param vaultDecimals - The vault's own decimals — the target scale every
24992
+ * asset is rescaled to.
24993
+ * @returns Total deposited, in raw base units at `vaultDecimals`.
24994
+ */
24995
+ export declare function sumDepositsAtFaceValue(depositsByAsset: Map<string, bigint>, assetDecimals: Map<string, number>, vaultDecimals: number): bigint;
24869
24996
 
24870
- /**
24871
- * Human-readable display name of the `SwapRouter` periphery contract on each
24872
- * supported chain.
24873
- *
24874
- * The contract exposes no on-chain name (no `@title` accessor), so UIs that
24875
- * want to show *which contract* performed the swap-and-deposit — rather than a
24876
- * bare address read it from here. Display metadata only: never derive
24877
- * routing or eligibility logic from it.
24878
- *
24879
- * Missing keys mean no SwapRouter is deployed on that chain.
24880
- *
24881
- * @see {@link getSwapRouterName} for the typed lookup helper.
24882
- */
24883
- export declare const SWAP_ROUTER_NAMES: Readonly<Record<number, string>>;
24997
+ /**
24998
+ * Address of the `SwapRouter` periphery contract on each supported chain.
24999
+ *
25000
+ * Missing keys mean no SwapRouter is deployed on that chain — callers
25001
+ * should fall back to legacy adapter paths.
25002
+ *
25003
+ * @see {@link getSwapRouterAddress} for the typed lookup helper.
25004
+ */
25005
+ export declare const SWAP_ROUTER_ADDRESSES: Readonly<Record<number, IAddress>>;
24884
25006
 
24885
- /**
24886
- * Wrapped-native ERC-20 per chain that has a SwapRouter deployment. Mirrors
24887
- * the on-chain `wrappedNativeTokenAddress()` view to avoid an extra RPC on
24888
- * every dispatch. Used to validate that native-token deposits target a
24889
- * vault whose reference asset is the wrapped native the only configuration
24890
- * the contract's `depositNativeToken` / `swapAndDepositNativeToken` accept.
24891
- */
24892
- export declare const SWAP_ROUTER_WRAPPED_NATIVE: Readonly<Record<number, IAddress>>;
25007
+ /**
25008
+ * Block at which each chain's `SwapRouter` was deployed/configured the safe
25009
+ * lower bound for scanning its `TokenEnabled` / `VaultEnabled` log history.
25010
+ *
25011
+ * The router stores its allowlist as `mapping(address => bool) whitelistedTokens`
25012
+ * with no on-chain enumeration, so {@link getSwapRouterWhitelistedTokens} must
25013
+ * reconstruct the candidate set from `TokenEnabled` events before verifying each
25014
+ * against the current mapping. Starting the `eth_getLogs` scan here (rather than
25015
+ * from genesis) bounds it to the router's own lifetime — a few chunks — instead
25016
+ * of the whole chain.
25017
+ *
25018
+ * Mainnet value is the router's deployment block (its first emitted event, the
25019
+ * constructor `OwnershipTransferred`). A too-low value only costs extra empty
25020
+ * log ranges; a value ABOVE the first `TokenEnabled` would silently miss tokens,
25021
+ * so err on the side of earlier.
25022
+ */
25023
+ export declare const SWAP_ROUTER_DEPLOY_BLOCKS: Readonly<Record<number, number>>;
24893
25024
 
24894
- /**
24895
- * Swap one or more whitelisted ERC-20s into a vault's reference asset via
24896
- * the on-chain SwapRouter, then deposit the proceeds into the vault.
24897
- *
24898
- * Approval is sent automatically when the caller's allowance on each
24899
- * `swaps[i].tokenIn` against the SwapRouter is below `amountIn`.
24900
- *
24901
- * @param signer - ethers `Signer` or `Wallet` with the EOA that holds the input tokens.
24902
- * @param options - {@link ISwapAndDepositOptions}.
24903
- * @returns The transaction hash of the `swapAndDeposit` call.
24904
- *
24905
- * @throws {@link AugustValidationError} for unsupported chains, invalid
24906
- * addresses, empty/oversized swap arrays.
24907
- * @throws {@link AugustSDKError} on unrecoverable contract or RPC failure.
24908
- *
24909
- * @example
24910
- * ```ts
24911
- * const quote = await fetchSwapQuote({
24912
- * chainId: 1,
24913
- * srcToken: WBTC,
24914
- * srcDecimals: 8,
24915
- * destToken: USDC,
24916
- * destDecimals: 6,
24917
- * amount: 100_000_000n,
24918
- * receiver: SWAP_ROUTER_ADDRESSES[1]!,
24919
- * });
24920
- * const hash = await swapAndDeposit(signer, {
24921
- * chainId: 1,
24922
- * vault: '0x8AcA0841993ef4C87244d519166e767f49362C21',
24923
- * receiver: wallet,
24924
- * swaps: [{
24925
- * tokenIn: WBTC,
24926
- * tokenOut: USDC,
24927
- * amountIn: 100_000_000n,
24928
- * minAmountOut: quote.minAmountOut,
24929
- * router: quote.router,
24930
- * payload: quote.payload,
24931
- * }],
24932
- * });
24933
- * ```
24934
- */
24935
- export declare function swapAndDeposit(signer: Signer | Wallet, options: ISwapAndDepositOptions): Promise<string>;
25025
+ /**
25026
+ * The DEX aggregator whitelisted on each chain's `SwapRouter` via
25027
+ * `enableRouter`, plus the single aggregator contract method every swap leg is
25028
+ * pinned to and that method's 4-byte selector.
25029
+ *
25030
+ * This is the single source of truth tying the off-chain swap-leg builder to
25031
+ * the on-chain router whitelist. The two MUST agree or `swapAndDeposit` reverts
25032
+ * with `InvalidRouter()` (router not whitelisted) or `InvalidNotWhitelisted()`
25033
+ * (selector not authorized). It is consumed in three places:
25034
+ *
25035
+ * - `dispatchViaSwapRouter` asks {@link fetchSwapQuote} to pin the aggregator to
25036
+ * `contractMethod`, then asserts the returned quote's `router` and payload
25037
+ * selector match this entry before broadcasting — failing closed rather than
25038
+ * letting the user pay gas for a transaction the contract will reject.
25039
+ * - The CI check `scripts/verify-swap-router-aggregator.mjs` asserts the
25040
+ * deployed `SwapRouter` actually has `tokenTransferProxies[router] != 0` and
25041
+ * `isAuthorizedSelector(router, selector) == true` for every entry here, so
25042
+ * config drift is caught at release time, not by a user's failed deposit.
25043
+ *
25044
+ * Pinning to one generic method matters: the aggregator otherwise picks a route
25045
+ * method per quote (e.g. a direct `swapExactAmountInOnUniswapV3`) that varies
25046
+ * with market conditions, producing a different selector each time. Pinning
25047
+ * collapses that to one stable selector so the on-chain whitelist needs only
25048
+ * that selector and never drifts as routing changes.
25049
+ *
25050
+ * `router` is the address the aggregator's calldata targets (ParaSwap v6.2
25051
+ * pulls tokens to the Augustus contract itself, so the SwapRouter's
25052
+ * `tokenTransferProxies[router]` is the router address). `selector` is
25053
+ * `bytes4(keccak256("<contractMethod>(...)"))`. Verify both against the
25054
+ * deployed router before adding a chain — a wrong value reverts at deposit time.
25055
+ */
25056
+ export declare const SWAP_ROUTER_DEX_AGGREGATOR: Readonly<Record<number, {
25057
+ router: IAddress;
25058
+ contractMethod: string;
25059
+ selector: `0x${string}`;
25060
+ /** Human-readable aggregator name — for display; never derive routing logic from it. */
25061
+ name: string;
25062
+ }>>;
24936
25063
 
24937
25064
  /**
24938
- * Deposit into an August vault through the on-chain `SwapRouter`, selecting the
24939
- * correct router path from the deposit asset. This is the high-level, explicit
24940
- * counterpart to the SwapRouter branch inside {@link vaultDeposit}.
25065
+ * Vaults whose UI **may offer the any-token SwapRouter deposit surface** —
25066
+ * i.e. the SwapRouter is `enableVault`-ed for them on-chain.
24941
25067
  *
24942
- * Where `vaultDeposit` decides whether to use the SwapRouter from the
24943
- * `VAULTS_USING_SWAP_ROUTER` allowlist, this function always routes through the
24944
- * SwapRouter because the caller asked it to. Making the intent explicit is the
24945
- * point: a native-deposit vault (e.g. a multi-asset Tokenized Vault V2 whose
24946
- * non-reference assets are accepted directly) is never accidentally swapped —
24947
- * the regression that implicit, allowlist-driven routing caused. Use
24948
- * `vaultDeposit` for native / adapter deposits and this for SwapRouter deposits.
25068
+ * This is *eligibility metadata only*. It is consumed by:
25069
+ * - the app UI, to decide whether to render the (flag-gated) swap-router
25070
+ * deposit surface for a vault; and
25071
+ * - {@link swapRouterDeposit}, optionally, as a fail-fast eligibility check.
24949
25072
  *
24950
- * The vault's reference asset and its decimals are read on-chain (never trusted
24951
- * from the caller a wrong reference asset would mis-route the swap). The path
24952
- * is then chosen from `depositAsset`:
24953
- * - equals the reference asset direct router deposit, no swap
24954
- * ({@link depositViaSwapRouter});
24955
- * - the zero address → native-token deposit ({@link depositNativeViaSwapRouter}),
24956
- * valid only when the reference asset is the chain's wrapped-native token;
24957
- * - any other ERC-20 → a swap to the reference asset (Paraswap quote pinned to
24958
- * the chain's whitelisted aggregator, fail-closed on router/selector drift)
24959
- * bundled into {@link swapAndDeposit}.
25073
+ * It is deliberately **NOT** read by {@link vaultDeposit}: `vaultDeposit` is the
25074
+ * native/multiasset/adapter path and never routes through the SwapRouter. That
25075
+ * separation is what stops a natively-accepted asset from being silently
25076
+ * swapped the regression that implicit auto-routing caused. Any-token swap
25077
+ * deposits are the explicit, opt-in job of {@link swapRouterDeposit}.
24960
25078
  *
24961
- * Side effects: reads tokenized-vault metadata, the vault's reference asset and
24962
- * decimals, and (on the swap path) one Paraswap quote; sends one ERC-20
24963
- * `approve` to the SwapRouter when allowance is short, then the deposit tx.
25079
+ * Membership requires the vault to be registered on-chain
25080
+ * (`vaultInfo[addr].referenceAsset != 0`) an unregistered vault reverts with
25081
+ * `InvalidVault` at deposit time. A listed vault's natively-accepted assets
25082
+ * (for a multi-asset vault, its whole deposit-asset set) still deposit via
25083
+ * `vaultDeposit`; only tokens OUTSIDE that set go through `swapRouterDeposit`.
24964
25084
  *
24965
- * @param signer - ethers `Signer` or `Wallet` that signs the approval + deposit.
24966
- * @param options - {@link ISwapRouterDepositOptions}.
24967
- * @returns The transaction hash of the router deposit call.
24968
- * @throws {@link AugustValidationError} for an unsupported chain (no SwapRouter
24969
- * deployment), an invalid vault or deposit-asset address, a missing or zero
24970
- * amount, a native deposit into a non-wrapped-native vault, or drift between
24971
- * the aggregator quote and the on-chain router whitelist.
24972
- * @worstCaseRpcCalls 5 on the swap path tokenized-vault metadata, reference
24973
- * asset + decimals, deposit-token decimals, the quote, and the allowance read.
24974
- * @example
24975
- * ```ts
24976
- * // USDT deposited into a USDC-reference vault → swapped to USDC en route.
24977
- * const hash = await augustSdk.evm.swapRouterDeposit({
24978
- * chainId: 1,
24979
- * vault: '0xe9b725010a9e419412ed67d0fa5f3a5f40159d32',
24980
- * depositAsset: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
24981
- * amount: '100',
24982
- * slippageBps: 50,
24983
- * });
24984
- * ```
24985
- */
24986
- export declare function swapRouterDeposit(signer: Signer | Wallet, options: ISwapRouterDepositOptions): Promise<string>;
24987
-
24988
- /**
24989
- * Numeric vault-type tag used by the on-chain `SwapRouter` to branch between
24990
- * the ERC-4626 (`deposit(uint256, address)`) and multi-asset
24991
- * (`deposit(address, uint256, address)`) deposit interfaces.
24992
- *
24993
- * Values match the contract's `VAULT_TYPE_ERC4626` / `VAULT_TYPE_TOKENIZED_VAULT_V2`
24994
- * constants exactly. Set by an admin per-vault via `enableVault` and looked
24995
- * up via `vaultInfo(vaultAddr).vaultType`. SDK callers normally do not pass
24996
- * this the router resolves it internally.
24997
- */
24998
- export declare enum SwapRouterVaultType {
24999
- ERC4626 = 1,
25000
- TokenizedVaultV2 = 2
25001
- }
25002
-
25003
- /**
25004
- * Table of Contents
25005
- * - Formatters
25006
- * - Datetime
25007
- * - Arrays
25008
- * - Caching
25009
- */
25010
- export declare function toNormalizedBn(value: string | bigint | number, decimals?: number | bigint): INormalizedNumber;
25011
-
25012
- /**
25013
- * Formatters
25014
- */
25015
- export declare function toTitleCase(str: string, type?: 'camel'): string;
25016
-
25017
- /**
25018
- * Track API response times and status.
25019
- *
25020
- * @param endpoint - The API endpoint called
25021
- * @param method - HTTP method used
25022
- * @param startTime - Start timestamp from performance.now()
25023
- * @param status - HTTP response status code (0 for network errors)
25024
- * @param server - Server identifier (production, staging, etc.)
25025
- */
25026
- export declare function trackApiCall(endpoint: string, method: string, startTime: number, status: number, server: string): void;
25027
-
25028
- /**
25029
- * Track chain/network switches for usage distribution analysis.
25030
- *
25031
- * @param chainId - The chain ID being switched to
25032
- */
25033
- export declare function trackNetworkSwitch(chainId: number): void;
25034
-
25035
- export declare function truncate(s: string, amount?: number): string;
25036
-
25037
- /* Excluded from this release type: tryRecoverTxHash */
25038
-
25039
- /**
25040
- * Vault addresses to exclude from `getTotalDeposited` TVL aggregation.
25041
- * Addresses are lowercased so EVM, Solana, Sui and Stellar vaults can be
25042
- * checked uniformly (don't wrap them with `getAddress` — non-EVM addresses
25043
- * would throw). Add an address here to drop its `latest_reported_tvl` from
25044
- * the headline number — e.g. closed pre-deposit vaults, test vaults, or
25045
- * migrated v1 pools that are double-counted by a v2 successor.
25046
- */
25047
- export declare const TVL_EXCLUDED_VAULTS: ReadonlySet<string>;
25048
-
25049
- /**
25050
- * Validity window for a submitted Soroban invocation (seconds).
25051
- *
25052
- * This becomes the transaction's `maxTime`. Validators reject a tx whose
25053
- * `maxTime` has passed (`txTOO_LATE`), so the window must outlast the slowest
25054
- * realistic sign-then-submit path: hardware wallets, careful manual review,
25055
- * and institutional approval flows (e.g. Fordefi) that don't sign instantly.
25056
- * 10 minutes comfortably covers those while staying well inside the Soroban
25057
- * footprint/ledger-entry TTL, so the simulated footprint can't go stale first.
25058
- *
25059
- * The window is anchored to the *network* clock (see `getNetworkCloseTime` in
25060
- * soroban.ts), not the signer's `Date.now()`, so a skewed device clock can't
25061
- * make the deadline expire early.
25062
- */
25063
- declare const TX_TIMEOUT_SECONDS = 600;
25064
-
25065
- export declare type TypedContract<TAbi extends Abi> = Omit<BaseContract, 'getFunction' | 'getEvent'> & {
25066
- [Method in ExtractAbiFunctionNames<TAbi>]: TypedContractFunction<TAbi, Method>;
25067
- } & {
25068
- /**
25069
- * Return the function for a given name. This is useful when a contract
25070
- * method name conflicts with a JavaScript name such as ``prototype`` or
25071
- * when using a Contract programatically.
25072
- */
25073
- getFunction<T extends ExtractAbiFunctionNames<TAbi>>(key: T | TypedFragment<TAbi, T>): TypedContractFunction<TAbi, T>;
25074
- /**
25075
- * Return the event for a given name. This is useful when a contract
25076
- * event name conflicts with a JavaScript name such as ``prototype`` or
25077
- * when using a Contract programatically.
25078
- */
25079
- getEvent<T extends ExtractAbiEventNames<TAbi>>(key: T | EventFragment): TypedContractEvent<TAbi, T>;
25080
- /**
25081
- * All the Events available on this contract.
25082
- */
25083
- filters: {
25084
- [EventName in ExtractAbiEventNames<TAbi>]: TypedContractEvent<TAbi, EventName>;
25085
- };
25086
- };
25087
-
25088
- export declare interface TypedContractEvent<TAbi extends Abi, TEventName extends string, TEvent extends ExtractAbiEvents<TAbi> = ExtractAbiEvent<TAbi, TEventName>, TEventArgs extends readonly unknown[] = AsArray<Partial<AbiParametersToPrimitiveTypes<TEvent['inputs']>>>> {
25089
- (...args: [...TEventArgs]): DeferredTopicFilter;
25090
- /**
25091
- * The name of the Contract event.
25092
- */
25093
- name: TEventName;
25094
- /**
25095
- * The fragment of the Contract event. This will throw on ambiguous
25096
- * method names.
25097
- */
25098
- fragment: EventFragment;
25099
- /**
25100
- * Returns the fragment constrained by %%args%%. This can be used to
25101
- * resolve ambiguous event names.
25102
- */
25103
- getFragment(...args: [...TEventArgs]): EventFragment;
25104
- }
25105
-
25106
- export declare interface TypedContractFunction<TAbi extends Abi, TFunctionName extends string, TFunction extends ExtractAbiFunctions<TAbi> = ExtractAbiFunction<TAbi, TFunctionName>, TInputArgs extends readonly unknown[] = AsArray<AbiParametersToPrimitiveTypes<TFunction['inputs']>>, TResult = TypedContractFunctionResult<TAbi, TFunctionName>, TFragment = TypedFragment<TAbi, TFunctionName>> {
25107
- (...args: [...TInputArgs, overrides?: Overrides]): Promise<TFunction['stateMutability'] extends 'view' | 'pure' ? TResult : ContractTransactionResponse>;
25108
- /**
25109
- * The name of the Contract method.
25110
- */
25111
- name: TFunctionName;
25112
- /**
25113
- * The fragment of the Contract method. This will throw on ambiguous
25114
- * method names.
25115
- */
25116
- fragment: TFragment;
25117
- /**
25118
- * Returns the fragment constrained by %%args%%. This can be used to
25119
- * resolve ambiguous method names.
25120
- */
25121
- getFragment(...args: [...TInputArgs]): TFragment;
25122
- /**
25123
- * Returns a populated transaction that can be used to perform the
25124
- * contract method with %%args%%.
25125
- */
25126
- populateTransaction(...args: [...TInputArgs, overrides?: Overrides]): Promise<ContractTransaction>;
25085
+ * Lowercase comparison is required when checking use
25086
+ * {@link isSwapRouterEligible} rather than reading this set directly.
25087
+ *
25088
+ * @deprecated Superseded by {@link getSwapRouterEligibleVaults}, which derives
25089
+ * the eligible set from the router's on-chain `VaultEnabled` history and
25090
+ * verifies each vault's current registration (`vaultInfo.referenceAsset != 0`)
25091
+ * so new enablements surface without an SDK release. This static set stays
25092
+ * functional as the zero-RPC fallback seed (e.g. TanStack Query `initialData`)
25093
+ * and for SDK-internal sync consumers.
25094
+ */
25095
+ export declare const SWAP_ROUTER_ELIGIBLE_VAULTS: ReadonlySet<string>;
25096
+
25097
+ /**
25098
+ * Maximum number of swap legs the contract accepts in a single
25099
+ * `swapAndDeposit` call. Mirrors the on-chain `MAX_SWAPS` constant; reading
25100
+ * the on-chain value at call time would add an RPC for no gain.
25101
+ *
25102
+ * Kept here so the SDK can reject oversize inputs at the boundary rather
25103
+ * than wait for the on-chain `TooManySwaps` revert.
25104
+ */
25105
+ export declare const SWAP_ROUTER_MAX_SWAPS = 9;
25106
+
25107
+ /**
25108
+ * Human-readable display name of the `SwapRouter` periphery contract on each
25109
+ * supported chain.
25110
+ *
25111
+ * The contract exposes no on-chain name (no `@title` accessor), so UIs that
25112
+ * want to show *which contract* performed the swap-and-deposit — rather than a
25113
+ * bare address read it from here. Display metadata only: never derive
25114
+ * routing or eligibility logic from it.
25115
+ *
25116
+ * Missing keys mean no SwapRouter is deployed on that chain.
25117
+ *
25118
+ * @see {@link getSwapRouterName} for the typed lookup helper.
25119
+ */
25120
+ export declare const SWAP_ROUTER_NAMES: Readonly<Record<number, string>>;
25121
+
25122
+ /**
25123
+ * Wrapped-native ERC-20 per chain that has a SwapRouter deployment. Mirrors
25124
+ * the on-chain `wrappedNativeTokenAddress()` view to avoid an extra RPC on
25125
+ * every dispatch. Used to validate that native-token deposits target a
25126
+ * vault whose reference asset is the wrapped native — the only configuration
25127
+ * the contract's `depositNativeToken` / `swapAndDepositNativeToken` accept.
25128
+ */
25129
+ export declare const SWAP_ROUTER_WRAPPED_NATIVE: Readonly<Record<number, IAddress>>;
25130
+
25131
+ /**
25132
+ * Swap one or more whitelisted ERC-20s into a vault's reference asset via
25133
+ * the on-chain SwapRouter, then deposit the proceeds into the vault.
25134
+ *
25135
+ * Approval is sent automatically when the caller's allowance on each
25136
+ * `swaps[i].tokenIn` against the SwapRouter is below `amountIn`.
25137
+ *
25138
+ * @param signer - ethers `Signer` or `Wallet` with the EOA that holds the input tokens.
25139
+ * @param options - {@link ISwapAndDepositOptions}.
25140
+ * @returns The transaction hash of the `swapAndDeposit` call.
25141
+ *
25142
+ * @throws {@link AugustValidationError} for unsupported chains, invalid
25143
+ * addresses, empty/oversized swap arrays.
25144
+ * @throws {@link AugustSDKError} on unrecoverable contract or RPC failure.
25145
+ *
25146
+ * @example
25147
+ * ```ts
25148
+ * const quote = await fetchSwapQuote({
25149
+ * chainId: 1,
25150
+ * srcToken: WBTC,
25151
+ * srcDecimals: 8,
25152
+ * destToken: USDC,
25153
+ * destDecimals: 6,
25154
+ * amount: 100_000_000n,
25155
+ * receiver: SWAP_ROUTER_ADDRESSES[1]!,
25156
+ * });
25157
+ * const hash = await swapAndDeposit(signer, {
25158
+ * chainId: 1,
25159
+ * vault: '0x8AcA0841993ef4C87244d519166e767f49362C21',
25160
+ * receiver: wallet,
25161
+ * swaps: [{
25162
+ * tokenIn: WBTC,
25163
+ * tokenOut: USDC,
25164
+ * amountIn: 100_000_000n,
25165
+ * minAmountOut: quote.minAmountOut,
25166
+ * router: quote.router,
25167
+ * payload: quote.payload,
25168
+ * }],
25169
+ * });
25170
+ * ```
25171
+ */
25172
+ export declare function swapAndDeposit(signer: Signer | Wallet, options: ISwapAndDepositOptions): Promise<string>;
25173
+
25127
25174
  /**
25128
- * Call the contract method with %%args%% and return the value.
25175
+ * Deposit into an August vault through the on-chain `SwapRouter`, selecting the
25176
+ * correct router path from the deposit asset. This is the high-level, explicit
25177
+ * counterpart to the SwapRouter branch inside {@link vaultDeposit}.
25129
25178
  *
25130
- * If the return value is a single type, it will be dereferenced and
25131
- * returned directly, otherwise the full Result will be returned.
25132
- */
25133
- staticCall(...args: [...TInputArgs, overrides?: Overrides]): Promise<TResult>;
25134
- /**
25135
- * Send a transaction for the contract method with %%args%%.
25136
- */
25137
- send(...args: [...TInputArgs, overrides?: Overrides]): Promise<ContractTransactionResponse>;
25138
- /**
25139
- * Estimate the gas to send the contract method with %%args%%.
25140
- */
25141
- estimateGas(...args: [...TInputArgs, overrides?: Overrides]): Promise<bigint>;
25142
- /**
25143
- * Call the contract method with %%args%% and return the Result
25144
- * without any dereferencing.
25145
- */
25146
- staticCallResult(...args: [...TInputArgs, overrides?: Overrides]): Promise<Result>;
25147
- }
25148
-
25149
- export declare type TypedContractFunctionResult<TAbi extends Abi, TFunctionName extends string, TOutputArgs = AbiParametersToPrimitiveTypes<ExtractAbiFunction<TAbi, TFunctionName>['outputs']>> = TOutputArgs extends readonly [] ? void : TOutputArgs extends readonly [infer Arg] ? Arg : TOutputArgs;
25150
-
25151
- export declare type TypedFragment<TAbi extends Abi, TFunctionName extends string, TFunction extends ExtractAbiFunctions<TAbi> = ExtractAbiFunction<TAbi, TFunctionName>> = Omit<FunctionFragment, 'inputs' | 'outputs' | 'stateMutability' | 'name' | 'type'> & {
25152
- name: TFunction['name'];
25153
- type: TFunction['type'];
25154
- inputs: TFunction['inputs'];
25155
- outputs: TFunction['outputs'];
25156
- stateMutability: TFunction['stateMutability'];
25157
- };
25158
-
25159
- export declare function unixToDate(epoch: number): Date;
25160
-
25161
- /**
25162
- * Update the current user identity in Sentry.
25163
- * Called when wallet address changes.
25164
- *
25165
- * @param walletAddress - New wallet address (or undefined to clear)
25166
- * @param environment - Current environment
25167
- */
25168
- export declare function updateUser(walletAddress?: string, environment?: IEnv): void;
25169
-
25170
- /* Excluded from this release type: validateAmountPrecision */
25171
-
25172
- /**
25173
- * Vault adapter configurations mapping vault addresses to their adapter settings
25174
- */
25175
- export declare const VAULT_ADAPTER_CONFIGS: Record<IAddress, IVaultAdapterConfig>;
25176
-
25177
- export declare const VAULT_ADDRESSES: Record<"musd" | "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" | "earnausd" | "alpineusdcflagship" | "alpinecoinshiftusdc" | "upbtc" | "upstrbtc" | "maxiusr" | "upgammausdc" | "xhype" | "wildusd" | "alpinebtc" | "prenusd" | "upyzusd" | "upnusd" | "hlpe" | "nemo eth yield", `0x${string}`>;
25178
-
25179
- /**
25180
- * Hardcoded subaccount addresses for specific vaults allocations
25181
- */
25182
- export declare const VAULT_ALLOCATION_SUBACCOUNTS: {
25183
- AgoraAUSD: {
25184
- address: IAddress;
25185
- subaccount: IAddress;
25186
- useDebank: boolean;
25187
- };
25188
- earnAUSD: {
25189
- address: IAddress;
25190
- subaccount: IAddress;
25191
- useDebank: boolean;
25192
- };
25193
- MonarqXRP: {
25194
- address: IAddress;
25195
- subaccount: IAddress;
25196
- useDebank: boolean;
25197
- };
25198
- };
25199
-
25200
- /**
25201
- * The functions to call on the vault contract
25202
- * @returns The functions to call
25203
- */
25204
- export declare const VAULT_FUNCTIONS_V1: IPoolFunctions[];
25205
-
25206
- export declare const VAULT_FUNCTIONS_V2: IPoolFunctions[];
25207
-
25208
- export declare const VAULT_FUNCTIONS_V2_RECEIPT: IPoolFunctions[];
25209
-
25210
- export declare const VAULT_FUNCTIONS_V2_WHITELISTED_ASSETS: IPoolFunctions[];
25211
-
25212
- /**
25213
- * Vault Symbols Mapping
25214
- * @deprecated use getVaultMetadata to fetch vault symbols from the backend
25215
- */
25216
- export declare const VAULT_SYMBOLS: Record<IAddress, string>;
25217
-
25218
- /**
25219
- * Vault Symbols Reverse Mapping
25220
- * @deprecated use getVaultMetadata to fetch vault symbols from the backend
25221
- */
25222
- export declare const VAULT_SYMBOLS_REVERSE: Record<VaultSymbols, IAddress>;
25223
-
25224
- /**
25225
- * Address type for vault contracts across all supported chains.
25226
- * EVM vaults use `0x`-prefixed hex addresses, Solana vaults use base58,
25227
- * and Stellar vaults use 56-character base32 addresses (G/C prefix).
25228
- *
25229
- * Use this instead of `IAddress` when the address may belong to any chain.
25230
- */
25231
- export declare type VaultAddress = string;
25232
-
25233
- /**
25234
- * allowance checks user's current allowance per pool
25235
- * @param signer - signer / provider object
25236
- * @param options - object including pool contract address, user wallet address
25237
- * @returns normalized number object of the user's current allowance
25238
- */
25239
- export declare function vaultAllowance(signer: IContractRunner, options: IContractWriteOptions): Promise<INormalizedNumber>;
25240
-
25241
- /**
25242
- * Approve a vault (or the appropriate adapter wrapper) to spend a token
25243
- * ahead of a separate deposit call. Spender routing mirrors
25244
- * {@link vaultDeposit} (multi-asset vault, adapter wrapper, standard
25245
- * vault). Returns `undefined` when the existing allowance already covers
25246
- * `amount` **or** when the deposit asset is native.
25247
- *
25248
- * @returns Transaction hash when an approval was sent, `undefined` when
25249
- * the existing allowance already covers `amount` or the deposit asset is
25250
- * native (no ERC-20 allowance applies). Use {@link approve} for a
25251
- * discriminated `ApproveResult` if you need to tell those two cases apart.
25252
- * @throws AugustValidationError on invalid wallet/target/amount.
25253
- *
25254
- * @example
25255
- * ```ts
25256
- * const hash = await augustSdk.evm.vaultApprove({
25257
- * target: '0x...', // vault contract address
25258
- * wallet: walletAddress,
25259
- * amount: '100', // 100 of the deposit token (UI units)
25260
- * wait: true, // wait for the approval to confirm
25261
- * });
25262
- * if (hash) console.log('approve tx', hash);
25263
- * // hash === undefined means the on-chain allowance already covers the
25264
- * // amount, or the deposit asset is native (msg.value, no allowance).
25265
- * ```
25266
- */
25267
- export declare function vaultApprove(signer: Signer | Wallet, options: IContractWriteOptions): Promise<string | undefined>;
25268
-
25269
- /**
25270
- * Deposit underlying token into the specified vault. Auto-routes to the
25271
- * correct contract path (single-asset ERC-4626, EVM-2 multi-asset,
25272
- * Paraswap adapter, native-token wrapper, depositWithPermit) based on the
25273
- * vault version and `depositAsset`.
25274
- *
25275
- * Amounts are encoded against the **deposit token's** decimals, not the
25276
- * vault's share decimals. The SDK reads the appropriate decimals via the
25277
- * vault metadata and the asset's ERC-20.
25278
- *
25279
- * Approval is handled automatically: if the existing allowance doesn't
25280
- * cover `amount`, an `approve` is sent and **always waited for** (regardless
25281
- * of the caller's `wait` flag) so the deposit tx can't be re-ordered ahead
25282
- * of the approval on Monad-style RPCs.
25283
- *
25284
- * @param signer ethers Signer / Wallet (or viem WalletClient via {@link setSigner})
25285
- * @param options Vault address, wallet, amount, optional `depositAsset` for
25286
- * adapter routes, optional `wait` to wait for the deposit receipt.
25287
- * @returns Deposit transaction hash.
25288
- * @throws AugustValidationError on invalid wallet/target/amount or missing
25289
- * adapter config when `depositAsset` differs from the vault underlying.
25290
- * @throws AugustSDKError when the deposit submission or on-chain call fails.
25291
- *
25292
- * @example
25293
- * ```ts
25294
- * const hash = await augustSdk.evm.vaultDeposit({
25295
- * target: '0xE9B725010A9E419412ed67d0fA5f3A5f40159D32', // vault
25296
- * wallet: walletAddress,
25297
- * amount: '100', // 100 USDC (UI units)
25298
- * wait: true, // wait for the deposit receipt
25299
- * });
25300
- * ```
25301
- *
25302
- * @example Adapter deposit (different deposit asset than the vault's underlying)
25303
- * ```ts
25304
- * await augustSdk.evm.vaultDeposit({
25305
- * target: vaultAddress,
25306
- * wallet: walletAddress,
25307
- * amount: '0.5',
25308
- * depositAsset: WETH_ADDRESS, // swap WETH -> vault underlying via the adapter
25309
- * chainId: 1,
25310
- * });
25311
- * ```
25312
- */
25313
- export declare function vaultDeposit(signer: Signer | Wallet, options: IContractWriteOptions): Promise<string>;
25314
-
25315
- /**
25316
- * Check if vault has adapter support
25317
- */
25318
- export declare function vaultHasAdapter(vaultAddress: IAddress): boolean;
25319
-
25320
- declare const vaultIdl: {
25321
- address: string;
25322
- metadata: {
25323
- name: string;
25324
- version: string;
25325
- spec: string;
25326
- description: string;
25327
- };
25328
- instructions: ({
25329
- name: string;
25330
- docs: string[];
25331
- discriminator: number[];
25332
- accounts: ({
25333
- name: string;
25334
- writable: boolean;
25335
- pda: {
25336
- seeds: {
25337
- kind: string;
25338
- value: number[];
25339
- }[];
25340
- };
25341
- signer?: undefined;
25342
- address?: undefined;
25343
- } | {
25344
- name: string;
25345
- signer: boolean;
25346
- writable?: undefined;
25347
- pda?: undefined;
25348
- address?: undefined;
25349
- } | {
25350
- name: string;
25351
- writable: boolean;
25352
- pda?: undefined;
25353
- signer?: undefined;
25354
- address?: undefined;
25355
- } | {
25356
- name: string;
25357
- address: string;
25358
- writable?: undefined;
25359
- pda?: undefined;
25360
- signer?: undefined;
25361
- })[];
25362
- args: any[];
25363
- } | {
25364
- name: string;
25365
- docs: string[];
25366
- discriminator: number[];
25367
- accounts: ({
25368
- name: string;
25369
- writable: boolean;
25370
- signer: boolean;
25371
- docs?: undefined;
25372
- pda?: undefined;
25373
- address?: undefined;
25374
- } | {
25375
- name: string;
25376
- docs: string[];
25377
- writable: boolean;
25378
- signer: boolean;
25379
- pda?: undefined;
25380
- address?: undefined;
25381
- } | {
25382
- name: string;
25383
- docs: string[];
25384
- writable: boolean;
25385
- pda: {
25386
- seeds: {
25387
- kind: string;
25388
- value: number[];
25389
- }[];
25390
- program?: undefined;
25391
- };
25392
- signer?: undefined;
25393
- address?: undefined;
25394
- } | {
25395
- name: string;
25396
- docs: string[];
25397
- writable: boolean;
25398
- signer?: undefined;
25399
- pda?: undefined;
25400
- address?: undefined;
25401
- } | {
25402
- name: string;
25403
- writable: boolean;
25404
- pda: {
25405
- seeds: ({
25406
- kind: string;
25407
- value: number[];
25408
- path?: undefined;
25409
- } | {
25410
- kind: string;
25411
- path: string;
25412
- value?: undefined;
25413
- })[];
25414
- program: {
25415
- kind: string;
25416
- value: number[];
25417
- };
25418
- };
25419
- signer?: undefined;
25420
- docs?: undefined;
25421
- address?: undefined;
25422
- } | {
25423
- name: string;
25424
- address: string;
25425
- writable?: undefined;
25426
- signer?: undefined;
25427
- docs?: undefined;
25428
- pda?: undefined;
25429
- })[];
25430
- args: {
25431
- name: string;
25432
- type: string;
25433
- }[];
25434
- } | {
25435
- name: string;
25436
- docs: string[];
25437
- discriminator: number[];
25438
- accounts: ({
25439
- name: string;
25440
- writable: boolean;
25441
- pda: {
25442
- seeds: ({
25443
- kind: string;
25444
- value: number[];
25445
- path?: undefined;
25446
- } | {
25447
- kind: string;
25448
- path: string;
25449
- value?: undefined;
25450
- })[];
25451
- };
25452
- signer?: undefined;
25453
- } | {
25454
- name: string;
25455
- writable: boolean;
25456
- pda?: undefined;
25457
- signer?: undefined;
25458
- } | {
25459
- name: string;
25460
- writable: boolean;
25461
- signer: boolean;
25462
- pda?: undefined;
25463
- } | {
25464
- name: string;
25465
- writable?: undefined;
25466
- pda?: undefined;
25467
- signer?: undefined;
25468
- })[];
25469
- args: {
25470
- name: string;
25471
- type: string;
25472
- }[];
25473
- } | {
25474
- name: string;
25475
- docs: string[];
25476
- discriminator: number[];
25477
- accounts: ({
25478
- name: string;
25479
- writable: boolean;
25480
- pda: {
25481
- seeds: ({
25482
- kind: string;
25483
- value: number[];
25484
- path?: undefined;
25485
- } | {
25486
- kind: string;
25487
- path: string;
25488
- value?: undefined;
25489
- })[];
25490
- };
25491
- signer?: undefined;
25492
- address?: undefined;
25493
- } | {
25494
- name: string;
25495
- writable?: undefined;
25496
- pda?: undefined;
25497
- signer?: undefined;
25498
- address?: undefined;
25499
- } | {
25500
- name: string;
25501
- writable: boolean;
25502
- signer: boolean;
25503
- pda?: undefined;
25504
- address?: undefined;
25505
- } | {
25506
- name: string;
25507
- address: string;
25508
- writable?: undefined;
25509
- pda?: undefined;
25510
- signer?: undefined;
25511
- })[];
25512
- args: {
25513
- name: string;
25514
- type: string;
25515
- }[];
25516
- } | {
25517
- name: string;
25518
- docs: string[];
25519
- discriminator: number[];
25520
- accounts: ({
25521
- name: string;
25522
- writable: boolean;
25523
- pda: {
25524
- seeds: {
25525
- kind: string;
25526
- value: number[];
25527
- }[];
25528
- };
25529
- signer?: undefined;
25530
- address?: undefined;
25531
- } | {
25532
- name: string;
25533
- signer: boolean;
25534
- writable?: undefined;
25535
- pda?: undefined;
25536
- address?: undefined;
25537
- } | {
25538
- name: string;
25539
- writable: boolean;
25540
- signer: boolean;
25541
- pda?: undefined;
25542
- address?: undefined;
25543
- } | {
25544
- name: string;
25545
- address: string;
25546
- writable?: undefined;
25547
- pda?: undefined;
25548
- signer?: undefined;
25549
- })[];
25550
- args: {
25551
- name: string;
25552
- type: string;
25553
- }[];
25554
- } | {
25555
- name: string;
25556
- docs: string[];
25557
- discriminator: number[];
25558
- accounts: ({
25559
- name: string;
25560
- writable: boolean;
25561
- pda: {
25562
- seeds: ({
25563
- kind: string;
25564
- value: number[];
25565
- path?: undefined;
25566
- } | {
25567
- kind: string;
25568
- path: string;
25569
- value?: undefined;
25570
- })[];
25571
- program?: undefined;
25572
- };
25573
- signer?: undefined;
25574
- } | {
25575
- name: string;
25576
- writable: boolean;
25577
- pda: {
25578
- seeds: ({
25579
- kind: string;
25580
- path: string;
25581
- value?: undefined;
25582
- } | {
25583
- kind: string;
25584
- value: number[];
25585
- path?: undefined;
25586
- })[];
25587
- program: {
25588
- kind: string;
25589
- value: number[];
25590
- };
25591
- };
25592
- signer?: undefined;
25593
- } | {
25594
- name: string;
25595
- writable: boolean;
25596
- pda?: undefined;
25597
- signer?: undefined;
25598
- } | {
25599
- name: string;
25600
- signer: boolean;
25601
- writable?: undefined;
25602
- pda?: undefined;
25603
- } | {
25604
- name: string;
25605
- writable?: undefined;
25606
- pda?: undefined;
25607
- signer?: undefined;
25608
- })[];
25609
- args: {
25610
- name: string;
25611
- type: string;
25612
- }[];
25613
- })[];
25614
- accounts: {
25615
- name: string;
25616
- discriminator: number[];
25617
- }[];
25618
- events: {
25619
- name: string;
25620
- discriminator: number[];
25621
- }[];
25622
- errors: {
25623
- code: number;
25624
- name: string;
25625
- msg: string;
25626
- }[];
25627
- types: ({
25628
- name: string;
25629
- serialization: string;
25630
- repr: {
25631
- kind: string;
25632
- };
25633
- type: {
25634
- kind: string;
25635
- fields: {
25636
- name: string;
25637
- type: string;
25638
- }[];
25639
- };
25640
- } | {
25641
- name: string;
25642
- type: {
25643
- kind: string;
25644
- fields: ({
25645
- name: string;
25646
- type: string;
25647
- } | {
25648
- name: string;
25649
- type: {
25650
- array: (string | number)[];
25651
- };
25652
- })[];
25653
- };
25654
- serialization?: undefined;
25655
- repr?: undefined;
25656
- })[];
25657
- };
25658
-
25659
- /**
25660
- * @TODO
25661
- * @description withdraw funds from the specified pool including accrued rewards
25662
- * @param signer signer / wallet object
25663
- * @param options object including pool contract address, user wallet address, and more
25664
- * @returns claim tx hash
25665
- */
25666
- export declare function vaultRedeem(signer: Signer | Wallet, options: IContractWriteOptions & {
25667
- year: string;
25668
- month: string;
25669
- day: string;
25670
- receiverIndex: string;
25671
- }): Promise<string>;
25672
-
25673
- export declare enum VaultRedemptionStatus {
25674
- AWAITING_COOLDOWN = "awaiting_cooldown",
25675
- READY_TO_CLAIM = "ready_to_claim"
25676
- }
25677
-
25678
- /**
25679
- * Request to redeem vault shares. For EVM-1 vaults this queues a standard
25680
- * redemption (claimable later via `vaultRedeem`); for EVM-2 vaults this
25681
- * also handles the receipt-token allowance automatically. Pass
25682
- * `isInstantRedeem: true` for vaults that support instant settlement.
25683
- *
25684
- * Approval of the receipt token (EVM-2) is always waited on before the
25685
- * redeem call, regardless of the caller's `wait` flag.
25686
- *
25687
- * @param signer ethers Signer / Wallet (or viem WalletClient via {@link setSigner})
25688
- * @param options Vault address, wallet, amount, optional `isInstantRedeem`,
25689
- * optional `wait` to wait for the redeem receipt.
25690
- * @returns Redeem transaction hash.
25691
- * @throws AugustValidationError on invalid wallet/target/amount.
25692
- * @throws AugustSDKError when the redeem submission or on-chain call fails.
25693
- *
25694
- * @example
25695
- * ```ts
25696
- * const hash = await augustSdk.evm.vaultRequestRedeem({
25697
- * target: vaultAddress,
25698
- * wallet: walletAddress,
25699
- * amount: '10', // 10 shares (UI units)
25700
- * wait: true,
25701
- * });
25702
- * ```
25703
- *
25704
- * @example Instant redemption
25705
- * ```ts
25706
- * await augustSdk.evm.vaultRequestRedeem({
25707
- * target: vaultAddress,
25708
- * wallet: walletAddress,
25709
- * amount: '10',
25710
- * isInstantRedeem: true,
25711
- * });
25712
- * ```
25713
- */
25714
- export declare function vaultRequestRedeem(signer: Signer | Wallet, options: IContractWriteOptions): Promise<string>;
25715
-
25716
- /**
25717
- * @deprecated Renamed to {@link SWAP_ROUTER_ELIGIBLE_VAULTS} (itself now
25718
- * superseded by {@link getSwapRouterEligibleVaults}, the on-chain-derived
25719
- * resolver), and the semantics changed: this set no longer drives
25720
- * `vaultDeposit` auto-routing (that branch was removed) — it only marks vaults
25721
- * whose UI may offer the swap-router deposit surface. Kept as an alias for one
25722
- * release; migrate to the async resolver.
25723
- */
25724
- export declare const VAULTS_USING_SWAP_ROUTER: ReadonlySet<string>;
25725
-
25726
- /**
25727
- * Vault Receipt Symbol Mapping
25728
- * @deprecated use getVaultMetadata to fetch vault symbols from the backend
25729
- */
25730
- 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';
25731
-
25732
- /**
25733
- * @deprecated Renamed to {@link isSwapRouterEligible} (itself now superseded by
25734
- * {@link getSwapRouterEligibleVaults}, the on-chain-derived resolver). The
25735
- * meaning also changed: it no longer implies `vaultDeposit` routes the vault
25736
- * through the SwapRouter (that behavior was removed) — it only reports
25737
- * swap-router *eligibility* for the opt-in deposit surface. Kept as an alias
25738
- * for one release; migrate to the async resolver.
25739
- */
25740
- export declare const vaultUsesSwapRouter: typeof isSwapRouterEligible;
25741
-
25742
- export declare function verifyAugustKey(key: string): Promise<boolean>;
25743
-
25744
- export declare function verifyInfuraKey(key: string): Promise<boolean>;
25745
-
25746
- /**
25747
- * Convert a viem WalletClient to an ethers-compatible Signer
25748
- * Uses the walletClient as a provider and wraps it for ethers compatibility
25749
- * @param walletClient Viem WalletClient from wagmi or viem
25750
- * @returns Ethers Signer that can be used with the SDK
25751
- */
25752
- export declare function viemToEthersSigner(walletClient: any): Promise<Signer | Wallet>;
25753
-
25754
- /**
25755
- * @param walletClient a wagmi-derived client (from useWalletClient)
25756
- * @returns An ethers JsonRpcSigner object used in sdk.evm.setSigner
25757
- */
25758
- export declare function walletClientToSigner(walletClient: WalletClient): Promise<ethers.JsonRpcSigner>;
25759
-
25760
- export declare const WEBSERVER_ENDPOINTS: {
25761
- default: {
25762
- hello: string;
25763
- protected: string;
25764
- };
25765
- auth: {
25766
- verify: string;
25767
- sign: string;
25768
- login: string;
25769
- nonce: string;
25770
- refresh: string;
25771
- };
25772
- subaccount: {
25773
- list: (offset?: number, limit?: number) => string;
25774
- rewards: (subaccount: IAddress) => string;
25775
- tokens: (subaccount: IAddress) => string;
25776
- twap: {
25777
- create: (subaccount: IAddress) => string;
25778
- stop: (subaccount: IAddress, id: string) => string;
25779
- fills: (subaccount: IAddress, id: string) => string;
25780
- };
25781
- debank: (subaccount: IAddress) => string;
25782
- health_factor: (subaccount: IAddress) => string;
25783
- summary: (subaccount: IAddress) => string;
25784
- batch: (subaccount: IAddress) => string;
25785
- loans: (subaccount: IAddress, side?: "BORROWER" | "LENDER" | "BOTH", active?: boolean) => string;
25786
- cefi: (subaccount: IAddress) => string;
25787
- otc_positions: (subaccount: IAddress) => string;
25788
- loanByAddress: (loanAddress: string, chainId: number) => string;
25789
- _: (subaccount: IAddress) => string;
25790
- };
25791
- transactions: {
25792
- v2: (subaccount: string, startTime?: string, endTime?: string) => string;
25793
- };
25794
- otc: {
25795
- positions: string;
25796
- marginRequirements: (otcCounterpartyId?: string, payer?: string) => string;
25797
- };
25798
- curator: {
25799
- vaultSubaccounts: (vaultAddress: string) => string;
25800
- vaultWhitelist: (vaultAddress: string) => string;
25801
- };
25802
- timelockRequests: (vaultAddress: string, chainId: number, status?: string) => string;
25803
- users: {
25804
- get: string;
25805
- };
25806
- dashboard: {
25807
- loans: string;
25808
- };
25809
- risk: {
25810
- discountFactors: string;
25811
- collateralExcessOrDeficit: (subaccount: string, tokenAddress: string, tokenChain: number, targetHealthFactor?: number) => string;
25812
- collateralSimulation: string;
25813
- };
25814
- prices: (symbol: string) => string;
25815
- metrics: {
25816
- pnl: (subaccount: IAddress, startTime?: string, endTime?: string) => string;
25817
- vaultPerformanceFees: (params: {
25818
- vaultAddress: string;
25819
- annualizedFeesPct: number;
25820
- nativeDenominated: boolean;
25821
- calculationPeriod: string;
25822
- startDate?: string;
25823
- endDate?: string;
25824
- }) => string;
25825
- };
25826
- public: {
25827
- integrations: {
25828
- morpho: {
25829
- apy: (subaccount: IAddress, vaultAddress: IAddress) => string;
25830
- };
25831
- };
25832
- tokenizedVault: {
25833
- loans: (vaultAddress: VaultAddress, chainId: number, active: boolean) => string;
25834
- subaccountLoans: (vaultAddress: VaultAddress, chainId: number, active: boolean) => string;
25835
- list: string;
25836
- byVaultAddress: (vaultAddress: VaultAddress) => string;
25837
- historicalApy: (vaultAddress: IAddress) => string;
25838
- historicalTimeseries: (vaultAddress: IAddress, nDays?: number) => string;
25839
- annualizedApy: (vaultAddress: IAddress) => string;
25840
- summary: (vaultAddress: IAddress) => string;
25841
- withdrawals: (chain: string, vaultAddress: IAddress) => string;
25842
- debank: (vaultAddress: IAddress) => string;
25843
- userHistory: (vaultAddress: IAddress, wallet: IAddress) => string;
25844
- archivedVaults: string;
25845
- };
25846
- points: {
25847
- byUserAddress: (userAddress: IAddress) => string;
25848
- register: string;
25849
- leaderboard: string;
25850
- };
25851
- vaults: {
25852
- pendingRedemptions: (vaultAddress: IAddress) => string;
25853
- };
25854
- pnl: {
25855
- unrealizedHistory: (vaultAddress: VaultAddress, limit?: number) => string;
25856
- unrealizedLatest: string;
25857
- };
25858
- revertReason: (txHash: string, chain: number) => string;
25859
- oracleClassification: (vaultAddress: string, chainId: number) => string;
25860
- };
25861
- upshift: {
25862
- vaults: {
25863
- metadata: string;
25864
- };
25865
- };
25866
- };
25867
-
25868
- export declare const WEBSERVER_URL: {
25869
- production: string;
25870
- staging: string;
25871
- development: string;
25872
- localhost: string;
25873
- qa: string;
25874
- public: string;
25875
- upshift: string;
25876
- };
25877
-
25878
- /**
25879
- * Withdrawal request with computed claimable date and current processing status.
25880
- * The unique identifier is (receiver, claimableDate).
25881
- *
25882
- * @interface WithdrawalRequestStatus
25883
- */
25884
- export declare interface WithdrawalRequestStatus {
25885
- /** Transaction hash of the withdrawal request */
25886
- transactionHash: string;
25887
- /** Block timestamp when the withdrawal was requested (seconds, UTC) */
25888
- requestTimestamp: number;
25889
- /** Shares amount being redeemed */
25890
- shares: bigint;
25891
- /** Receiver address for the withdrawal */
25892
- receiver: string;
25893
- /** Computed claimable date in UTC (year, month, day) */
25894
- claimableDate: {
25895
- year: number;
25896
- month: number;
25897
- day: number;
25898
- };
25899
- /** Epoch timestamp when this withdrawal becomes claimable */
25900
- claimableEpoch: number;
25901
- /** Current status of the withdrawal */
25902
- status: 'pending' | 'ready_to_claim' | 'processed';
25903
- /** Transaction hash of the processing transaction (if processed) */
25904
- processedTransactionHash?: string;
25905
- /** Assets received (if processed) */
25906
- assetsReceived?: bigint;
25907
- }
25908
-
25909
- /**
25910
- * Higher-order function to wrap SDK methods with performance tracking.
25911
- * Tracks method calls, timing, chain usage, and errors.
25912
- *
25913
- * @param methodName - Name of the method being wrapped
25914
- * @param method - The original async method
25915
- * @param getChainId - Function to get current chain ID
25916
- * @returns Wrapped method with tracking
25917
- */
25918
- export declare function withMethodTracking<T extends (...args: unknown[]) => Promise<unknown>>(methodName: string, method: T, getChainId?: () => number | undefined): T;
25919
-
25920
- /**
25921
- * Wrap async operations with exponential backoff retry logic.
25922
- * Retries on network errors with increasing delays between attempts.
25923
- * @param fn - Async function to execute with retry logic
25924
- * @param maxRetries - Maximum number of retry attempts
25925
- * @param baseDelay - Initial delay in milliseconds (doubles each retry)
25926
- * @param shouldRetry - Custom function to determine if error is retryable
25927
- * @returns Result of successful function execution
25928
- * @throws Last error if all retries exhausted
25929
- */
25930
- export declare function withRetry<T>(fn: () => Promise<T>, maxRetries?: number, baseDelay?: number, shouldRetry?: (error: Error) => boolean): Promise<T>;
25931
-
25932
- /**
25933
- * Higher-order function to wrap synchronous SDK methods with tracking.
25934
- * Uses breadcrumbs for tracking since spans require async context.
25935
- *
25936
- * @param methodName - Name of the method being wrapped
25937
- * @param method - The original sync method
25938
- * @param getChainId - Function to get current chain ID
25939
- * @returns Wrapped method with tracking
25940
- */
25941
- export declare function withSyncMethodTracking<T extends (...args: unknown[]) => unknown>(methodName: string, method: T, getChainId?: () => number | undefined): T;
25942
-
25943
- export declare const WRAPPER_ADAPTOR: {
25944
- 43114: IAddress;
25945
- 1: IAddress;
25946
- };
25947
-
25948
- export { }
25179
+ * Where `vaultDeposit` decides whether to use the SwapRouter from the
25180
+ * `VAULTS_USING_SWAP_ROUTER` allowlist, this function always routes through the
25181
+ * SwapRouter because the caller asked it to. Making the intent explicit is the
25182
+ * point: a native-deposit vault (e.g. a multi-asset Tokenized Vault V2 whose
25183
+ * non-reference assets are accepted directly) is never accidentally swapped —
25184
+ * the regression that implicit, allowlist-driven routing caused. Use
25185
+ * `vaultDeposit` for native / adapter deposits and this for SwapRouter deposits.
25186
+ *
25187
+ * The vault's reference asset and its decimals are read on-chain (never trusted
25188
+ * from the caller a wrong reference asset would mis-route the swap). The path
25189
+ * is then chosen from `depositAsset`:
25190
+ * - equals the reference asset → direct router deposit, no swap
25191
+ * ({@link depositViaSwapRouter});
25192
+ * - the zero address native-token deposit ({@link depositNativeViaSwapRouter}),
25193
+ * valid only when the reference asset is the chain's wrapped-native token;
25194
+ * - any other ERC-20 → a swap to the reference asset (Paraswap quote pinned to
25195
+ * the chain's whitelisted aggregator, fail-closed on router/selector drift)
25196
+ * bundled into {@link swapAndDeposit}.
25197
+ *
25198
+ * Side effects: reads tokenized-vault metadata, the vault's reference asset and
25199
+ * decimals, and (on the swap path) one Paraswap quote; sends one ERC-20
25200
+ * `approve` to the SwapRouter when allowance is short, then the deposit tx.
25201
+ *
25202
+ * @param signer - ethers `Signer` or `Wallet` that signs the approval + deposit.
25203
+ * @param options - {@link ISwapRouterDepositOptions}.
25204
+ * @returns The transaction hash of the router deposit call.
25205
+ * @throws {@link AugustValidationError} for an unsupported chain (no SwapRouter
25206
+ * deployment), an invalid vault or deposit-asset address, a missing or zero
25207
+ * amount, a native deposit into a non-wrapped-native vault, or drift between
25208
+ * the aggregator quote and the on-chain router whitelist.
25209
+ * @worstCaseRpcCalls 5 on the swap path — tokenized-vault metadata, reference
25210
+ * asset + decimals, deposit-token decimals, the quote, and the allowance read.
25211
+ * @example
25212
+ * ```ts
25213
+ * // USDT deposited into a USDC-reference vault → swapped to USDC en route.
25214
+ * const hash = await augustSdk.evm.swapRouterDeposit({
25215
+ * chainId: 1,
25216
+ * vault: '0xe9b725010a9e419412ed67d0fa5f3a5f40159d32',
25217
+ * depositAsset: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
25218
+ * amount: '100',
25219
+ * slippageBps: 50,
25220
+ * });
25221
+ * ```
25222
+ */
25223
+ export declare function swapRouterDeposit(signer: Signer | Wallet, options: ISwapRouterDepositOptions): Promise<string>;
25224
+
25225
+ /**
25226
+ * Numeric vault-type tag used by the on-chain `SwapRouter` to branch between
25227
+ * the ERC-4626 (`deposit(uint256, address)`) and multi-asset
25228
+ * (`deposit(address, uint256, address)`) deposit interfaces.
25229
+ *
25230
+ * Values match the contract's `VAULT_TYPE_ERC4626` / `VAULT_TYPE_TOKENIZED_VAULT_V2`
25231
+ * constants exactly. Set by an admin per-vault via `enableVault` and looked
25232
+ * up via `vaultInfo(vaultAddr).vaultType`. SDK callers normally do not pass
25233
+ * this — the router resolves it internally.
25234
+ */
25235
+ export declare enum SwapRouterVaultType {
25236
+ ERC4626 = 1,
25237
+ TokenizedVaultV2 = 2
25238
+ }
25239
+
25240
+ /**
25241
+ * Table of Contents
25242
+ * - Formatters
25243
+ * - Datetime
25244
+ * - Arrays
25245
+ * - Caching
25246
+ */
25247
+ export declare function toNormalizedBn(value: string | bigint | number, decimals?: number | bigint): INormalizedNumber;
25248
+
25249
+ /**
25250
+ * Formatters
25251
+ */
25252
+ export declare function toTitleCase(str: string, type?: 'camel'): string;
25253
+
25254
+ /**
25255
+ * Track API response times and status.
25256
+ *
25257
+ * @param endpoint - The API endpoint called
25258
+ * @param method - HTTP method used
25259
+ * @param startTime - Start timestamp from performance.now()
25260
+ * @param status - HTTP response status code (0 for network errors)
25261
+ * @param server - Server identifier (production, staging, etc.)
25262
+ */
25263
+ export declare function trackApiCall(endpoint: string, method: string, startTime: number, status: number, server: string): void;
25264
+
25265
+ /**
25266
+ * Track chain/network switches for usage distribution analysis.
25267
+ *
25268
+ * @param chainId - The chain ID being switched to
25269
+ */
25270
+ export declare function trackNetworkSwitch(chainId: number): void;
25271
+
25272
+ export declare function truncate(s: string, amount?: number): string;
25273
+
25274
+ /* Excluded from this release type: tryRecoverTxHash */
25275
+
25276
+ /**
25277
+ * Vault addresses to exclude from `getTotalDeposited` TVL aggregation.
25278
+ * Addresses are lowercased so EVM, Solana, Sui and Stellar vaults can be
25279
+ * checked uniformly (don't wrap them with `getAddress` — non-EVM addresses
25280
+ * would throw). Add an address here to drop its `latest_reported_tvl` from
25281
+ * the headline number — e.g. closed pre-deposit vaults, test vaults, or
25282
+ * migrated v1 pools that are double-counted by a v2 successor.
25283
+ */
25284
+ export declare const TVL_EXCLUDED_VAULTS: ReadonlySet<string>;
25285
+
25286
+ /**
25287
+ * Validity window for a submitted Soroban invocation (seconds).
25288
+ *
25289
+ * This becomes the transaction's `maxTime`. Validators reject a tx whose
25290
+ * `maxTime` has passed (`txTOO_LATE`), so the window must outlast the slowest
25291
+ * realistic sign-then-submit path: hardware wallets, careful manual review,
25292
+ * and institutional approval flows (e.g. Fordefi) that don't sign instantly.
25293
+ * 10 minutes comfortably covers those while staying well inside the Soroban
25294
+ * footprint/ledger-entry TTL, so the simulated footprint can't go stale first.
25295
+ *
25296
+ * The window is anchored to the *network* clock (see `getNetworkCloseTime` in
25297
+ * soroban.ts), not the signer's `Date.now()`, so a skewed device clock can't
25298
+ * make the deadline expire early.
25299
+ */
25300
+ declare const TX_TIMEOUT_SECONDS = 600;
25301
+
25302
+ export declare type TypedContract<TAbi extends Abi> = Omit<BaseContract, 'getFunction' | 'getEvent'> & {
25303
+ [Method in ExtractAbiFunctionNames<TAbi>]: TypedContractFunction<TAbi, Method>;
25304
+ } & {
25305
+ /**
25306
+ * Return the function for a given name. This is useful when a contract
25307
+ * method name conflicts with a JavaScript name such as ``prototype`` or
25308
+ * when using a Contract programatically.
25309
+ */
25310
+ getFunction<T extends ExtractAbiFunctionNames<TAbi>>(key: T | TypedFragment<TAbi, T>): TypedContractFunction<TAbi, T>;
25311
+ /**
25312
+ * Return the event for a given name. This is useful when a contract
25313
+ * event name conflicts with a JavaScript name such as ``prototype`` or
25314
+ * when using a Contract programatically.
25315
+ */
25316
+ getEvent<T extends ExtractAbiEventNames<TAbi>>(key: T | EventFragment): TypedContractEvent<TAbi, T>;
25317
+ /**
25318
+ * All the Events available on this contract.
25319
+ */
25320
+ filters: {
25321
+ [EventName in ExtractAbiEventNames<TAbi>]: TypedContractEvent<TAbi, EventName>;
25322
+ };
25323
+ };
25324
+
25325
+ export declare interface TypedContractEvent<TAbi extends Abi, TEventName extends string, TEvent extends ExtractAbiEvents<TAbi> = ExtractAbiEvent<TAbi, TEventName>, TEventArgs extends readonly unknown[] = AsArray<Partial<AbiParametersToPrimitiveTypes<TEvent['inputs']>>>> {
25326
+ (...args: [...TEventArgs]): DeferredTopicFilter;
25327
+ /**
25328
+ * The name of the Contract event.
25329
+ */
25330
+ name: TEventName;
25331
+ /**
25332
+ * The fragment of the Contract event. This will throw on ambiguous
25333
+ * method names.
25334
+ */
25335
+ fragment: EventFragment;
25336
+ /**
25337
+ * Returns the fragment constrained by %%args%%. This can be used to
25338
+ * resolve ambiguous event names.
25339
+ */
25340
+ getFragment(...args: [...TEventArgs]): EventFragment;
25341
+ }
25342
+
25343
+ export declare interface TypedContractFunction<TAbi extends Abi, TFunctionName extends string, TFunction extends ExtractAbiFunctions<TAbi> = ExtractAbiFunction<TAbi, TFunctionName>, TInputArgs extends readonly unknown[] = AsArray<AbiParametersToPrimitiveTypes<TFunction['inputs']>>, TResult = TypedContractFunctionResult<TAbi, TFunctionName>, TFragment = TypedFragment<TAbi, TFunctionName>> {
25344
+ (...args: [...TInputArgs, overrides?: Overrides]): Promise<TFunction['stateMutability'] extends 'view' | 'pure' ? TResult : ContractTransactionResponse>;
25345
+ /**
25346
+ * The name of the Contract method.
25347
+ */
25348
+ name: TFunctionName;
25349
+ /**
25350
+ * The fragment of the Contract method. This will throw on ambiguous
25351
+ * method names.
25352
+ */
25353
+ fragment: TFragment;
25354
+ /**
25355
+ * Returns the fragment constrained by %%args%%. This can be used to
25356
+ * resolve ambiguous method names.
25357
+ */
25358
+ getFragment(...args: [...TInputArgs]): TFragment;
25359
+ /**
25360
+ * Returns a populated transaction that can be used to perform the
25361
+ * contract method with %%args%%.
25362
+ */
25363
+ populateTransaction(...args: [...TInputArgs, overrides?: Overrides]): Promise<ContractTransaction>;
25364
+ /**
25365
+ * Call the contract method with %%args%% and return the value.
25366
+ *
25367
+ * If the return value is a single type, it will be dereferenced and
25368
+ * returned directly, otherwise the full Result will be returned.
25369
+ */
25370
+ staticCall(...args: [...TInputArgs, overrides?: Overrides]): Promise<TResult>;
25371
+ /**
25372
+ * Send a transaction for the contract method with %%args%%.
25373
+ */
25374
+ send(...args: [...TInputArgs, overrides?: Overrides]): Promise<ContractTransactionResponse>;
25375
+ /**
25376
+ * Estimate the gas to send the contract method with %%args%%.
25377
+ */
25378
+ estimateGas(...args: [...TInputArgs, overrides?: Overrides]): Promise<bigint>;
25379
+ /**
25380
+ * Call the contract method with %%args%% and return the Result
25381
+ * without any dereferencing.
25382
+ */
25383
+ staticCallResult(...args: [...TInputArgs, overrides?: Overrides]): Promise<Result>;
25384
+ }
25385
+
25386
+ export declare type TypedContractFunctionResult<TAbi extends Abi, TFunctionName extends string, TOutputArgs = AbiParametersToPrimitiveTypes<ExtractAbiFunction<TAbi, TFunctionName>['outputs']>> = TOutputArgs extends readonly [] ? void : TOutputArgs extends readonly [infer Arg] ? Arg : TOutputArgs;
25387
+
25388
+ export declare type TypedFragment<TAbi extends Abi, TFunctionName extends string, TFunction extends ExtractAbiFunctions<TAbi> = ExtractAbiFunction<TAbi, TFunctionName>> = Omit<FunctionFragment, 'inputs' | 'outputs' | 'stateMutability' | 'name' | 'type'> & {
25389
+ name: TFunction['name'];
25390
+ type: TFunction['type'];
25391
+ inputs: TFunction['inputs'];
25392
+ outputs: TFunction['outputs'];
25393
+ stateMutability: TFunction['stateMutability'];
25394
+ };
25395
+
25396
+ export declare function unixToDate(epoch: number): Date;
25397
+
25398
+ /**
25399
+ * Update the current user identity in Sentry.
25400
+ * Called when wallet address changes.
25401
+ *
25402
+ * @param walletAddress - New wallet address (or undefined to clear)
25403
+ * @param environment - Current environment
25404
+ */
25405
+ export declare function updateUser(walletAddress?: string, environment?: IEnv): void;
25406
+
25407
+ /* Excluded from this release type: validateAmountPrecision */
25408
+
25409
+ /**
25410
+ * Vault adapter configurations mapping vault addresses to their adapter settings
25411
+ */
25412
+ export declare const VAULT_ADAPTER_CONFIGS: Record<IAddress, IVaultAdapterConfig>;
25413
+
25414
+ export declare const VAULT_ADDRESSES: Record<"musd" | "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" | "earnausd" | "alpineusdcflagship" | "alpinecoinshiftusdc" | "upbtc" | "upstrbtc" | "maxiusr" | "upgammausdc" | "xhype" | "wildusd" | "alpinebtc" | "prenusd" | "upyzusd" | "upnusd" | "hlpe" | "nemo eth yield", `0x${string}`>;
25415
+
25416
+ /**
25417
+ * Hardcoded subaccount addresses for specific vaults allocations
25418
+ */
25419
+ export declare const VAULT_ALLOCATION_SUBACCOUNTS: {
25420
+ AgoraAUSD: {
25421
+ address: IAddress;
25422
+ subaccount: IAddress;
25423
+ useDebank: boolean;
25424
+ };
25425
+ earnAUSD: {
25426
+ address: IAddress;
25427
+ subaccount: IAddress;
25428
+ useDebank: boolean;
25429
+ };
25430
+ MonarqXRP: {
25431
+ address: IAddress;
25432
+ subaccount: IAddress;
25433
+ useDebank: boolean;
25434
+ };
25435
+ };
25436
+
25437
+ /**
25438
+ * The functions to call on the vault contract
25439
+ * @returns The functions to call
25440
+ */
25441
+ export declare const VAULT_FUNCTIONS_V1: IPoolFunctions[];
25442
+
25443
+ export declare const VAULT_FUNCTIONS_V2: IPoolFunctions[];
25444
+
25445
+ export declare const VAULT_FUNCTIONS_V2_RECEIPT: IPoolFunctions[];
25446
+
25447
+ export declare const VAULT_FUNCTIONS_V2_WHITELISTED_ASSETS: IPoolFunctions[];
25448
+
25449
+ /**
25450
+ * Vault Symbols Mapping
25451
+ * @deprecated use getVaultMetadata to fetch vault symbols from the backend
25452
+ */
25453
+ export declare const VAULT_SYMBOLS: Record<IAddress, string>;
25454
+
25455
+ /**
25456
+ * Vault Symbols Reverse Mapping
25457
+ * @deprecated use getVaultMetadata to fetch vault symbols from the backend
25458
+ */
25459
+ export declare const VAULT_SYMBOLS_REVERSE: Record<VaultSymbols, IAddress>;
25460
+
25461
+ /**
25462
+ * Address type for vault contracts across all supported chains.
25463
+ * EVM vaults use `0x`-prefixed hex addresses, Solana vaults use base58,
25464
+ * and Stellar vaults use 56-character base32 addresses (G/C prefix).
25465
+ *
25466
+ * Use this instead of `IAddress` when the address may belong to any chain.
25467
+ */
25468
+ export declare type VaultAddress = string;
25469
+
25470
+ /**
25471
+ * allowance checks user's current allowance per pool
25472
+ * @param signer - signer / provider object
25473
+ * @param options - object including pool contract address, user wallet address
25474
+ * @returns normalized number object of the user's current allowance
25475
+ */
25476
+ export declare function vaultAllowance(signer: IContractRunner, options: IContractWriteOptions): Promise<INormalizedNumber>;
25477
+
25478
+ /**
25479
+ * Approve a vault (or the appropriate adapter wrapper) to spend a token
25480
+ * ahead of a separate deposit call. Spender routing mirrors
25481
+ * {@link vaultDeposit} (multi-asset → vault, adapter → wrapper, standard →
25482
+ * vault). Returns `undefined` when the existing allowance already covers
25483
+ * `amount` **or** when the deposit asset is native.
25484
+ *
25485
+ * @returns Transaction hash when an approval was sent, `undefined` when
25486
+ * the existing allowance already covers `amount` or the deposit asset is
25487
+ * native (no ERC-20 allowance applies). Use {@link approve} for a
25488
+ * discriminated `ApproveResult` if you need to tell those two cases apart.
25489
+ * @throws AugustValidationError on invalid wallet/target/amount.
25490
+ *
25491
+ * @example
25492
+ * ```ts
25493
+ * const hash = await augustSdk.evm.vaultApprove({
25494
+ * target: '0x...', // vault contract address
25495
+ * wallet: walletAddress,
25496
+ * amount: '100', // 100 of the deposit token (UI units)
25497
+ * wait: true, // wait for the approval to confirm
25498
+ * });
25499
+ * if (hash) console.log('approve tx', hash);
25500
+ * // hash === undefined means the on-chain allowance already covers the
25501
+ * // amount, or the deposit asset is native (msg.value, no allowance).
25502
+ * ```
25503
+ */
25504
+ export declare function vaultApprove(signer: Signer | Wallet, options: IContractWriteOptions): Promise<string | undefined>;
25505
+
25506
+ /**
25507
+ * Deposit underlying token into the specified vault. Auto-routes to the
25508
+ * correct contract path (single-asset ERC-4626, EVM-2 multi-asset,
25509
+ * Paraswap adapter, native-token wrapper, depositWithPermit) based on the
25510
+ * vault version and `depositAsset`.
25511
+ *
25512
+ * Amounts are encoded against the **deposit token's** decimals, not the
25513
+ * vault's share decimals. The SDK reads the appropriate decimals via the
25514
+ * vault metadata and the asset's ERC-20.
25515
+ *
25516
+ * Approval is handled automatically: if the existing allowance doesn't
25517
+ * cover `amount`, an `approve` is sent and **always waited for** (regardless
25518
+ * of the caller's `wait` flag) so the deposit tx can't be re-ordered ahead
25519
+ * of the approval on Monad-style RPCs.
25520
+ *
25521
+ * @param signer ethers Signer / Wallet (or viem WalletClient via {@link setSigner})
25522
+ * @param options Vault address, wallet, amount, optional `depositAsset` for
25523
+ * adapter routes, optional `wait` to wait for the deposit receipt.
25524
+ * @returns Deposit transaction hash.
25525
+ * @throws AugustValidationError on invalid wallet/target/amount or missing
25526
+ * adapter config when `depositAsset` differs from the vault underlying.
25527
+ * @throws AugustSDKError when the deposit submission or on-chain call fails.
25528
+ *
25529
+ * @example
25530
+ * ```ts
25531
+ * const hash = await augustSdk.evm.vaultDeposit({
25532
+ * target: '0xE9B725010A9E419412ed67d0fA5f3A5f40159D32', // vault
25533
+ * wallet: walletAddress,
25534
+ * amount: '100', // 100 USDC (UI units)
25535
+ * wait: true, // wait for the deposit receipt
25536
+ * });
25537
+ * ```
25538
+ *
25539
+ * @example Adapter deposit (different deposit asset than the vault's underlying)
25540
+ * ```ts
25541
+ * await augustSdk.evm.vaultDeposit({
25542
+ * target: vaultAddress,
25543
+ * wallet: walletAddress,
25544
+ * amount: '0.5',
25545
+ * depositAsset: WETH_ADDRESS, // swap WETH -> vault underlying via the adapter
25546
+ * chainId: 1,
25547
+ * });
25548
+ * ```
25549
+ */
25550
+ export declare function vaultDeposit(signer: Signer | Wallet, options: IContractWriteOptions): Promise<string>;
25551
+
25552
+ /**
25553
+ * Check if vault has adapter support
25554
+ */
25555
+ export declare function vaultHasAdapter(vaultAddress: IAddress): boolean;
25556
+
25557
+ /**
25558
+ * august_vault program IDL (Anchor).
25559
+ *
25560
+ * GENERATED — do not edit by hand. The versioned multi-vault interface the SDK
25561
+ * targets, generated from the devnet on-chain IDL of `C8B1…` — the only
25562
+ * deployment that publishes one matching this file. Refresh with
25563
+ * `anchor idl fetch C8B1… -u devnet`.
25564
+ *
25565
+ * At runtime the SDK targets the canonical `up12…` instead, whose own published
25566
+ * IDL is STALE (an Anchor IDL upload is not refreshed by a program upgrade), so
25567
+ * it can't be used as the generation source. The solana-idl-drift check (CI)
25568
+ * therefore validates `up12…` by pinning its deployed binary and by decoding
25569
+ * live VaultState accounts against this file — see
25570
+ * tests/vaults/solana-idl-drift.test.ts.
25571
+ *
25572
+ * `address` is a build stamp (the mainnet id), NOT network-aware. Never rely on
25573
+ * it: SolanaAdapter/getProgram resolve the real program id per network from
25574
+ * programIds, or from an explicit `programId` override.
25575
+ */
25576
+ declare const vaultIdl: {
25577
+ accounts: {
25578
+ discriminator: number[];
25579
+ name: string;
25580
+ }[];
25581
+ address: string;
25582
+ errors: {
25583
+ code: number;
25584
+ msg: string;
25585
+ name: string;
25586
+ }[];
25587
+ events: {
25588
+ discriminator: number[];
25589
+ name: string;
25590
+ }[];
25591
+ instructions: ({
25592
+ accounts: ({
25593
+ name: string;
25594
+ signer: boolean;
25595
+ writable: boolean;
25596
+ docs?: undefined;
25597
+ pda?: undefined;
25598
+ address?: undefined;
25599
+ } | {
25600
+ docs: string[];
25601
+ name: string;
25602
+ signer: boolean;
25603
+ writable: boolean;
25604
+ pda?: undefined;
25605
+ address?: undefined;
25606
+ } | {
25607
+ docs: string[];
25608
+ name: string;
25609
+ writable: boolean;
25610
+ signer?: undefined;
25611
+ pda?: undefined;
25612
+ address?: undefined;
25613
+ } | {
25614
+ docs: string[];
25615
+ name: string;
25616
+ signer?: undefined;
25617
+ writable?: undefined;
25618
+ pda?: undefined;
25619
+ address?: undefined;
25620
+ } | {
25621
+ name: string;
25622
+ pda: {
25623
+ program: {
25624
+ kind: string;
25625
+ value: number[];
25626
+ };
25627
+ seeds: ({
25628
+ kind: string;
25629
+ value: number[];
25630
+ path?: undefined;
25631
+ } | {
25632
+ kind: string;
25633
+ path: string;
25634
+ value?: undefined;
25635
+ })[];
25636
+ };
25637
+ writable: boolean;
25638
+ signer?: undefined;
25639
+ docs?: undefined;
25640
+ address?: undefined;
25641
+ } | {
25642
+ address: string;
25643
+ name: string;
25644
+ signer?: undefined;
25645
+ writable?: undefined;
25646
+ docs?: undefined;
25647
+ pda?: undefined;
25648
+ })[];
25649
+ args: {
25650
+ name: string;
25651
+ type: string;
25652
+ }[];
25653
+ discriminator: number[];
25654
+ docs: string[];
25655
+ name: string;
25656
+ } | {
25657
+ accounts: ({
25658
+ name: string;
25659
+ writable: boolean;
25660
+ signer?: undefined;
25661
+ address?: undefined;
25662
+ } | {
25663
+ name: string;
25664
+ writable?: undefined;
25665
+ signer?: undefined;
25666
+ address?: undefined;
25667
+ } | {
25668
+ name: string;
25669
+ signer: boolean;
25670
+ writable?: undefined;
25671
+ address?: undefined;
25672
+ } | {
25673
+ name: string;
25674
+ signer: boolean;
25675
+ writable: boolean;
25676
+ address?: undefined;
25677
+ } | {
25678
+ address: string;
25679
+ name: string;
25680
+ writable?: undefined;
25681
+ signer?: undefined;
25682
+ })[];
25683
+ args: {
25684
+ name: string;
25685
+ type: string;
25686
+ }[];
25687
+ discriminator: number[];
25688
+ docs: string[];
25689
+ name: string;
25690
+ } | {
25691
+ accounts: ({
25692
+ name: string;
25693
+ writable: boolean;
25694
+ pda?: undefined;
25695
+ signer?: undefined;
25696
+ } | {
25697
+ name: string;
25698
+ pda: {
25699
+ program: {
25700
+ kind: string;
25701
+ value: number[];
25702
+ };
25703
+ seeds: ({
25704
+ kind: string;
25705
+ path: string;
25706
+ value?: undefined;
25707
+ } | {
25708
+ kind: string;
25709
+ value: number[];
25710
+ path?: undefined;
25711
+ })[];
25712
+ };
25713
+ writable: boolean;
25714
+ signer?: undefined;
25715
+ } | {
25716
+ name: string;
25717
+ signer: boolean;
25718
+ writable?: undefined;
25719
+ pda?: undefined;
25720
+ } | {
25721
+ name: string;
25722
+ writable?: undefined;
25723
+ pda?: undefined;
25724
+ signer?: undefined;
25725
+ })[];
25726
+ args: {
25727
+ name: string;
25728
+ type: string;
25729
+ }[];
25730
+ discriminator: number[];
25731
+ docs: string[];
25732
+ name: string;
25733
+ } | {
25734
+ accounts: ({
25735
+ docs: string[];
25736
+ name: string;
25737
+ signer: boolean;
25738
+ writable?: undefined;
25739
+ pda?: undefined;
25740
+ address?: undefined;
25741
+ } | {
25742
+ docs: string[];
25743
+ name: string;
25744
+ writable: boolean;
25745
+ signer?: undefined;
25746
+ pda?: undefined;
25747
+ address?: undefined;
25748
+ } | {
25749
+ docs: string[];
25750
+ name: string;
25751
+ signer?: undefined;
25752
+ writable?: undefined;
25753
+ pda?: undefined;
25754
+ address?: undefined;
25755
+ } | {
25756
+ name: string;
25757
+ pda: {
25758
+ program: {
25759
+ kind: string;
25760
+ value: number[];
25761
+ };
25762
+ seeds: ({
25763
+ kind: string;
25764
+ value: number[];
25765
+ path?: undefined;
25766
+ } | {
25767
+ kind: string;
25768
+ path: string;
25769
+ value?: undefined;
25770
+ })[];
25771
+ };
25772
+ writable: boolean;
25773
+ docs?: undefined;
25774
+ signer?: undefined;
25775
+ address?: undefined;
25776
+ } | {
25777
+ address: string;
25778
+ name: string;
25779
+ docs?: undefined;
25780
+ signer?: undefined;
25781
+ writable?: undefined;
25782
+ pda?: undefined;
25783
+ })[];
25784
+ args: {
25785
+ name: string;
25786
+ type: string;
25787
+ }[];
25788
+ discriminator: number[];
25789
+ docs: string[];
25790
+ name: string;
25791
+ })[];
25792
+ metadata: {
25793
+ description: string;
25794
+ name: string;
25795
+ spec: string;
25796
+ version: string;
25797
+ };
25798
+ types: ({
25799
+ name: string;
25800
+ repr: {
25801
+ kind: string;
25802
+ };
25803
+ serialization: string;
25804
+ type: {
25805
+ fields: {
25806
+ name: string;
25807
+ type: string;
25808
+ }[];
25809
+ kind: string;
25810
+ };
25811
+ } | {
25812
+ name: string;
25813
+ type: {
25814
+ fields: ({
25815
+ name: string;
25816
+ type: string;
25817
+ } | {
25818
+ name: string;
25819
+ type: {
25820
+ array: (string | number)[];
25821
+ };
25822
+ })[];
25823
+ kind: string;
25824
+ };
25825
+ repr?: undefined;
25826
+ serialization?: undefined;
25827
+ })[];
25828
+ };
25829
+
25830
+ /**
25831
+ * @TODO
25832
+ * @description withdraw funds from the specified pool including accrued rewards
25833
+ * @param signer signer / wallet object
25834
+ * @param options object including pool contract address, user wallet address, and more
25835
+ * @returns claim tx hash
25836
+ */
25837
+ export declare function vaultRedeem(signer: Signer | Wallet, options: IContractWriteOptions & {
25838
+ year: string;
25839
+ month: string;
25840
+ day: string;
25841
+ receiverIndex: string;
25842
+ }): Promise<string>;
25843
+
25844
+ export declare enum VaultRedemptionStatus {
25845
+ AWAITING_COOLDOWN = "awaiting_cooldown",
25846
+ READY_TO_CLAIM = "ready_to_claim"
25847
+ }
25848
+
25849
+ /**
25850
+ * Request to redeem vault shares. For EVM-1 vaults this queues a standard
25851
+ * redemption (claimable later via `vaultRedeem`); for EVM-2 vaults this
25852
+ * also handles the receipt-token allowance automatically. Pass
25853
+ * `isInstantRedeem: true` for vaults that support instant settlement.
25854
+ *
25855
+ * Approval of the receipt token (EVM-2) is always waited on before the
25856
+ * redeem call, regardless of the caller's `wait` flag.
25857
+ *
25858
+ * @param signer ethers Signer / Wallet (or viem WalletClient via {@link setSigner})
25859
+ * @param options Vault address, wallet, amount, optional `isInstantRedeem`,
25860
+ * optional `wait` to wait for the redeem receipt.
25861
+ * @returns Redeem transaction hash.
25862
+ * @throws AugustValidationError on invalid wallet/target/amount.
25863
+ * @throws AugustSDKError when the redeem submission or on-chain call fails.
25864
+ *
25865
+ * @example
25866
+ * ```ts
25867
+ * const hash = await augustSdk.evm.vaultRequestRedeem({
25868
+ * target: vaultAddress,
25869
+ * wallet: walletAddress,
25870
+ * amount: '10', // 10 shares (UI units)
25871
+ * wait: true,
25872
+ * });
25873
+ * ```
25874
+ *
25875
+ * @example Instant redemption
25876
+ * ```ts
25877
+ * await augustSdk.evm.vaultRequestRedeem({
25878
+ * target: vaultAddress,
25879
+ * wallet: walletAddress,
25880
+ * amount: '10',
25881
+ * isInstantRedeem: true,
25882
+ * });
25883
+ * ```
25884
+ */
25885
+ export declare function vaultRequestRedeem(signer: Signer | Wallet, options: IContractWriteOptions): Promise<string>;
25886
+
25887
+ /**
25888
+ * @deprecated Renamed to {@link SWAP_ROUTER_ELIGIBLE_VAULTS} (itself now
25889
+ * superseded by {@link getSwapRouterEligibleVaults}, the on-chain-derived
25890
+ * resolver), and the semantics changed: this set no longer drives
25891
+ * `vaultDeposit` auto-routing (that branch was removed) it only marks vaults
25892
+ * whose UI may offer the swap-router deposit surface. Kept as an alias for one
25893
+ * release; migrate to the async resolver.
25894
+ */
25895
+ export declare const VAULTS_USING_SWAP_ROUTER: ReadonlySet<string>;
25896
+
25897
+ /**
25898
+ * Vault Receipt Symbol Mapping
25899
+ * @deprecated use getVaultMetadata to fetch vault symbols from the backend
25900
+ */
25901
+ 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';
25902
+
25903
+ /**
25904
+ * @deprecated Renamed to {@link isSwapRouterEligible} (itself now superseded by
25905
+ * {@link getSwapRouterEligibleVaults}, the on-chain-derived resolver). The
25906
+ * meaning also changed: it no longer implies `vaultDeposit` routes the vault
25907
+ * through the SwapRouter (that behavior was removed) it only reports
25908
+ * swap-router *eligibility* for the opt-in deposit surface. Kept as an alias
25909
+ * for one release; migrate to the async resolver.
25910
+ */
25911
+ export declare const vaultUsesSwapRouter: typeof isSwapRouterEligible;
25912
+
25913
+ export declare function verifyAugustKey(key: string): Promise<boolean>;
25914
+
25915
+ export declare function verifyInfuraKey(key: string): Promise<boolean>;
25916
+
25917
+ /**
25918
+ * Convert a viem WalletClient to an ethers-compatible Signer
25919
+ * Uses the walletClient as a provider and wraps it for ethers compatibility
25920
+ * @param walletClient Viem WalletClient from wagmi or viem
25921
+ * @returns Ethers Signer that can be used with the SDK
25922
+ */
25923
+ export declare function viemToEthersSigner(walletClient: any): Promise<Signer | Wallet>;
25924
+
25925
+ /**
25926
+ * @param walletClient a wagmi-derived client (from useWalletClient)
25927
+ * @returns An ethers JsonRpcSigner object used in sdk.evm.setSigner
25928
+ */
25929
+ export declare function walletClientToSigner(walletClient: WalletClient): Promise<ethers.JsonRpcSigner>;
25930
+
25931
+ export declare const WEBSERVER_ENDPOINTS: {
25932
+ default: {
25933
+ hello: string;
25934
+ protected: string;
25935
+ };
25936
+ auth: {
25937
+ verify: string;
25938
+ sign: string;
25939
+ login: string;
25940
+ nonce: string;
25941
+ refresh: string;
25942
+ };
25943
+ subaccount: {
25944
+ list: (offset?: number, limit?: number) => string;
25945
+ rewards: (subaccount: IAddress) => string;
25946
+ tokens: (subaccount: IAddress) => string;
25947
+ twap: {
25948
+ create: (subaccount: IAddress) => string;
25949
+ stop: (subaccount: IAddress, id: string) => string;
25950
+ fills: (subaccount: IAddress, id: string) => string;
25951
+ };
25952
+ debank: (subaccount: IAddress) => string;
25953
+ health_factor: (subaccount: IAddress) => string;
25954
+ summary: (subaccount: IAddress) => string;
25955
+ batch: (subaccount: IAddress) => string;
25956
+ loans: (subaccount: IAddress, side?: "BORROWER" | "LENDER" | "BOTH", active?: boolean) => string;
25957
+ cefi: (subaccount: IAddress) => string;
25958
+ otc_positions: (subaccount: IAddress) => string;
25959
+ loanByAddress: (loanAddress: string, chainId: number) => string;
25960
+ _: (subaccount: IAddress) => string;
25961
+ };
25962
+ transactions: {
25963
+ v2: (subaccount: string, startTime?: string, endTime?: string) => string;
25964
+ };
25965
+ otc: {
25966
+ positions: string;
25967
+ marginRequirements: (otcCounterpartyId?: string, payer?: string) => string;
25968
+ };
25969
+ curator: {
25970
+ vaultSubaccounts: (vaultAddress: string) => string;
25971
+ vaultWhitelist: (vaultAddress: string) => string;
25972
+ };
25973
+ timelockRequests: (vaultAddress: string, chainId: number, status?: string) => string;
25974
+ users: {
25975
+ get: string;
25976
+ };
25977
+ dashboard: {
25978
+ loans: string;
25979
+ };
25980
+ risk: {
25981
+ discountFactors: string;
25982
+ collateralExcessOrDeficit: (subaccount: string, tokenAddress: string, tokenChain: number, targetHealthFactor?: number) => string;
25983
+ collateralSimulation: string;
25984
+ };
25985
+ prices: (symbol: string) => string;
25986
+ metrics: {
25987
+ pnl: (subaccount: IAddress, startTime?: string, endTime?: string) => string;
25988
+ vaultPerformanceFees: (params: {
25989
+ vaultAddress: string;
25990
+ annualizedFeesPct: number;
25991
+ nativeDenominated: boolean;
25992
+ calculationPeriod: string;
25993
+ startDate?: string;
25994
+ endDate?: string;
25995
+ }) => string;
25996
+ };
25997
+ public: {
25998
+ integrations: {
25999
+ morpho: {
26000
+ apy: (subaccount: IAddress, vaultAddress: IAddress) => string;
26001
+ };
26002
+ };
26003
+ tokenizedVault: {
26004
+ loans: (vaultAddress: VaultAddress, chainId: number, active: boolean) => string;
26005
+ subaccountLoans: (vaultAddress: VaultAddress, chainId: number, active: boolean) => string;
26006
+ list: string;
26007
+ byVaultAddress: (vaultAddress: VaultAddress) => string;
26008
+ historicalApy: (vaultAddress: IAddress) => string;
26009
+ historicalTimeseries: (vaultAddress: IAddress, nDays?: number) => string;
26010
+ annualizedApy: (vaultAddress: IAddress) => string;
26011
+ summary: (vaultAddress: IAddress) => string;
26012
+ withdrawals: (chain: string, vaultAddress: IAddress) => string;
26013
+ debank: (vaultAddress: IAddress) => string;
26014
+ userHistory: (vaultAddress: IAddress, wallet: IAddress) => string;
26015
+ archivedVaults: string;
26016
+ };
26017
+ points: {
26018
+ byUserAddress: (userAddress: IAddress) => string;
26019
+ register: string;
26020
+ leaderboard: string;
26021
+ };
26022
+ vaults: {
26023
+ pendingRedemptions: (vaultAddress: IAddress) => string;
26024
+ };
26025
+ pnl: {
26026
+ unrealizedHistory: (vaultAddress: VaultAddress, limit?: number) => string;
26027
+ unrealizedLatest: string;
26028
+ };
26029
+ revertReason: (txHash: string, chain: number) => string;
26030
+ oracleClassification: (vaultAddress: string, chainId: number) => string;
26031
+ };
26032
+ upshift: {
26033
+ vaults: {
26034
+ metadata: string;
26035
+ };
26036
+ };
26037
+ };
26038
+
26039
+ export declare const WEBSERVER_URL: {
26040
+ production: string;
26041
+ staging: string;
26042
+ development: string;
26043
+ localhost: string;
26044
+ qa: string;
26045
+ public: string;
26046
+ upshift: string;
26047
+ };
26048
+
26049
+ /**
26050
+ * Withdrawal request with computed claimable date and current processing status.
26051
+ * The unique identifier is (receiver, claimableDate).
26052
+ *
26053
+ * @interface WithdrawalRequestStatus
26054
+ */
26055
+ export declare interface WithdrawalRequestStatus {
26056
+ /** Transaction hash of the withdrawal request */
26057
+ transactionHash: string;
26058
+ /** Block timestamp when the withdrawal was requested (seconds, UTC) */
26059
+ requestTimestamp: number;
26060
+ /** Shares amount being redeemed */
26061
+ shares: bigint;
26062
+ /** Receiver address for the withdrawal */
26063
+ receiver: string;
26064
+ /** Computed claimable date in UTC (year, month, day) */
26065
+ claimableDate: {
26066
+ year: number;
26067
+ month: number;
26068
+ day: number;
26069
+ };
26070
+ /** Epoch timestamp when this withdrawal becomes claimable */
26071
+ claimableEpoch: number;
26072
+ /** Current status of the withdrawal */
26073
+ status: 'pending' | 'ready_to_claim' | 'processed';
26074
+ /** Transaction hash of the processing transaction (if processed) */
26075
+ processedTransactionHash?: string;
26076
+ /** Assets received (if processed) */
26077
+ assetsReceived?: bigint;
26078
+ }
26079
+
26080
+ /**
26081
+ * Higher-order function to wrap SDK methods with performance tracking.
26082
+ * Tracks method calls, timing, chain usage, and errors.
26083
+ *
26084
+ * @param methodName - Name of the method being wrapped
26085
+ * @param method - The original async method
26086
+ * @param getChainId - Function to get current chain ID
26087
+ * @returns Wrapped method with tracking
26088
+ */
26089
+ export declare function withMethodTracking<T extends (...args: unknown[]) => Promise<unknown>>(methodName: string, method: T, getChainId?: () => number | undefined): T;
26090
+
26091
+ /**
26092
+ * Wrap async operations with exponential backoff retry logic.
26093
+ * Retries on network errors with increasing delays between attempts.
26094
+ * @param fn - Async function to execute with retry logic
26095
+ * @param maxRetries - Maximum number of retry attempts
26096
+ * @param baseDelay - Initial delay in milliseconds (doubles each retry)
26097
+ * @param shouldRetry - Custom function to determine if error is retryable
26098
+ * @returns Result of successful function execution
26099
+ * @throws Last error if all retries exhausted
26100
+ */
26101
+ export declare function withRetry<T>(fn: () => Promise<T>, maxRetries?: number, baseDelay?: number, shouldRetry?: (error: Error) => boolean): Promise<T>;
26102
+
26103
+ /**
26104
+ * Higher-order function to wrap synchronous SDK methods with tracking.
26105
+ * Uses breadcrumbs for tracking since spans require async context.
26106
+ *
26107
+ * @param methodName - Name of the method being wrapped
26108
+ * @param method - The original sync method
26109
+ * @param getChainId - Function to get current chain ID
26110
+ * @returns Wrapped method with tracking
26111
+ */
26112
+ export declare function withSyncMethodTracking<T extends (...args: unknown[]) => unknown>(methodName: string, method: T, getChainId?: () => number | undefined): T;
26113
+
26114
+ export declare const WRAPPER_ADAPTOR: {
26115
+ 43114: IAddress;
26116
+ 1: IAddress;
26117
+ };
26118
+
26119
+ export { }