@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/adapters/solana/constants.d.ts +12 -4
- package/lib/adapters/solana/constants.js +23 -6
- package/lib/adapters/solana/idl/vault-idl.d.ts +103 -169
- package/lib/adapters/solana/idl/vault-idl.js +461 -475
- package/lib/adapters/solana/index.d.ts +40 -5
- package/lib/adapters/solana/index.js +47 -3
- package/lib/adapters/solana/utils.d.ts +1 -4
- package/lib/adapters/solana/utils.js +24 -10
- package/lib/core/analytics/method-taxonomy.js +4 -0
- package/lib/core/analytics/version.d.ts +1 -1
- package/lib/core/analytics/version.js +1 -1
- package/lib/modules/vaults/getters.d.ts +34 -0
- package/lib/modules/vaults/getters.js +57 -41
- package/lib/modules/vaults/utils.d.ts +19 -1
- package/lib/modules/vaults/utils.js +30 -0
- package/lib/sdk.d.ts +1645 -1474
- package/lib/types/vaults.d.ts +88 -0
- package/lib/types/webserver.d.ts +47 -0
- package/package.json +2 -1
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
|
|
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
|
-
*
|
|
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
|
-
*
|
|
24613
|
-
*
|
|
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
|
|
24616
|
-
*
|
|
24617
|
-
*
|
|
24618
|
-
|
|
24619
|
-
|
|
24620
|
-
|
|
24621
|
-
|
|
24622
|
-
|
|
24623
|
-
|
|
24624
|
-
|
|
24625
|
-
|
|
24626
|
-
|
|
24627
|
-
|
|
24628
|
-
|
|
24629
|
-
|
|
24630
|
-
|
|
24631
|
-
|
|
24632
|
-
|
|
24633
|
-
|
|
24634
|
-
|
|
24635
|
-
|
|
24636
|
-
|
|
24637
|
-
|
|
24638
|
-
|
|
24639
|
-
|
|
24640
|
-
|
|
24641
|
-
|
|
24642
|
-
|
|
24643
|
-
|
|
24644
|
-
|
|
24645
|
-
|
|
24646
|
-
|
|
24647
|
-
|
|
24648
|
-
|
|
24649
|
-
|
|
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
|
-
|
|
24710
|
+
getProgramId(type: 'vault'): string;
|
|
24652
24711
|
}
|
|
24653
24712
|
|
|
24654
|
-
declare namespace
|
|
24713
|
+
declare namespace SolanaConstants {
|
|
24655
24714
|
export {
|
|
24656
|
-
|
|
24657
|
-
|
|
24658
|
-
|
|
24659
|
-
|
|
24660
|
-
|
|
24661
|
-
|
|
24662
|
-
|
|
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
|
|
24725
|
+
declare namespace SolanaGetters {
|
|
24672
24726
|
export {
|
|
24673
|
-
|
|
24674
|
-
getStellarUserPosition,
|
|
24675
|
-
convertToShares
|
|
24727
|
+
getSolanaVault
|
|
24676
24728
|
}
|
|
24677
24729
|
}
|
|
24678
24730
|
|
|
24679
|
-
declare
|
|
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
|
-
|
|
24770
|
+
handleStellarDeposit,
|
|
24771
|
+
handleStellarRedeem
|
|
24682
24772
|
}
|
|
24683
24773
|
}
|
|
24684
24774
|
|
|
24685
24775
|
/**
|
|
24686
|
-
*
|
|
24687
|
-
*
|
|
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
|
|
24690
|
-
|
|
24691
|
-
|
|
24692
|
-
|
|
24693
|
-
|
|
24694
|
-
|
|
24695
|
-
|
|
24696
|
-
|
|
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
|
-
|
|
24701
|
-
|
|
24702
|
-
|
|
24703
|
-
|
|
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
|
-
|
|
24707
|
-
|
|
24708
|
-
|
|
24709
|
-
|
|
24710
|
-
|
|
24711
|
-
|
|
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
|
-
|
|
24736
|
-
|
|
24737
|
-
|
|
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
|
-
*
|
|
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
|
|
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
|
-
*
|
|
24772
|
-
*
|
|
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
|
|
24914
|
+
export declare const SUBGRAPH_VAULT_URLS: Record<VaultSymbols, string>;
|
|
24787
24915
|
|
|
24788
24916
|
/**
|
|
24789
|
-
*
|
|
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
|
-
*
|
|
24814
|
-
*
|
|
24815
|
-
*
|
|
24816
|
-
*
|
|
24817
|
-
*
|
|
24818
|
-
|
|
24819
|
-
|
|
24820
|
-
|
|
24821
|
-
|
|
24822
|
-
|
|
24823
|
-
|
|
24824
|
-
|
|
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
|
-
|
|
24829
|
-
|
|
24830
|
-
|
|
24831
|
-
|
|
24832
|
-
|
|
24833
|
-
|
|
24834
|
-
|
|
24835
|
-
|
|
24836
|
-
|
|
24837
|
-
|
|
24838
|
-
|
|
24839
|
-
|
|
24840
|
-
|
|
24841
|
-
|
|
24842
|
-
|
|
24843
|
-
|
|
24844
|
-
|
|
24845
|
-
|
|
24846
|
-
|
|
24847
|
-
|
|
24848
|
-
|
|
24849
|
-
|
|
24850
|
-
|
|
24851
|
-
|
|
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
|
-
|
|
24862
|
-
|
|
24863
|
-
|
|
24864
|
-
|
|
24865
|
-
|
|
24866
|
-
|
|
24867
|
-
|
|
24868
|
-
|
|
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
|
-
|
|
24872
|
-
|
|
24873
|
-
|
|
24874
|
-
|
|
24875
|
-
|
|
24876
|
-
|
|
24877
|
-
|
|
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
|
-
|
|
24887
|
-
|
|
24888
|
-
|
|
24889
|
-
|
|
24890
|
-
|
|
24891
|
-
|
|
24892
|
-
|
|
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
|
-
|
|
24896
|
-
|
|
24897
|
-
|
|
24898
|
-
|
|
24899
|
-
|
|
24900
|
-
|
|
24901
|
-
|
|
24902
|
-
|
|
24903
|
-
|
|
24904
|
-
|
|
24905
|
-
|
|
24906
|
-
|
|
24907
|
-
|
|
24908
|
-
|
|
24909
|
-
|
|
24910
|
-
|
|
24911
|
-
|
|
24912
|
-
|
|
24913
|
-
|
|
24914
|
-
|
|
24915
|
-
|
|
24916
|
-
|
|
24917
|
-
|
|
24918
|
-
|
|
24919
|
-
|
|
24920
|
-
|
|
24921
|
-
|
|
24922
|
-
|
|
24923
|
-
|
|
24924
|
-
|
|
24925
|
-
|
|
24926
|
-
|
|
24927
|
-
|
|
24928
|
-
|
|
24929
|
-
|
|
24930
|
-
|
|
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
|
-
*
|
|
24939
|
-
*
|
|
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
|
-
*
|
|
24943
|
-
*
|
|
24944
|
-
*
|
|
24945
|
-
*
|
|
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
|
-
*
|
|
24951
|
-
*
|
|
24952
|
-
* is
|
|
24953
|
-
*
|
|
24954
|
-
*
|
|
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
|
-
*
|
|
24962
|
-
*
|
|
24963
|
-
* `
|
|
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
|
-
*
|
|
24966
|
-
* @
|
|
24967
|
-
*
|
|
24968
|
-
* @
|
|
24969
|
-
|
|
24970
|
-
|
|
24971
|
-
|
|
24972
|
-
|
|
24973
|
-
|
|
24974
|
-
|
|
24975
|
-
|
|
24976
|
-
|
|
24977
|
-
|
|
24978
|
-
|
|
24979
|
-
|
|
24980
|
-
|
|
24981
|
-
|
|
24982
|
-
|
|
24983
|
-
|
|
24984
|
-
|
|
24985
|
-
|
|
24986
|
-
|
|
24987
|
-
|
|
24988
|
-
|
|
24989
|
-
|
|
24990
|
-
|
|
24991
|
-
|
|
24992
|
-
|
|
24993
|
-
|
|
24994
|
-
|
|
24995
|
-
|
|
24996
|
-
|
|
24997
|
-
|
|
24998
|
-
|
|
24999
|
-
|
|
25000
|
-
|
|
25001
|
-
|
|
25002
|
-
|
|
25003
|
-
|
|
25004
|
-
|
|
25005
|
-
|
|
25006
|
-
|
|
25007
|
-
|
|
25008
|
-
|
|
25009
|
-
|
|
25010
|
-
|
|
25011
|
-
|
|
25012
|
-
|
|
25013
|
-
|
|
25014
|
-
|
|
25015
|
-
|
|
25016
|
-
|
|
25017
|
-
|
|
25018
|
-
|
|
25019
|
-
|
|
25020
|
-
|
|
25021
|
-
|
|
25022
|
-
|
|
25023
|
-
|
|
25024
|
-
|
|
25025
|
-
|
|
25026
|
-
|
|
25027
|
-
|
|
25028
|
-
|
|
25029
|
-
|
|
25030
|
-
|
|
25031
|
-
|
|
25032
|
-
|
|
25033
|
-
|
|
25034
|
-
|
|
25035
|
-
|
|
25036
|
-
|
|
25037
|
-
|
|
25038
|
-
|
|
25039
|
-
|
|
25040
|
-
|
|
25041
|
-
|
|
25042
|
-
|
|
25043
|
-
|
|
25044
|
-
|
|
25045
|
-
|
|
25046
|
-
|
|
25047
|
-
|
|
25048
|
-
|
|
25049
|
-
|
|
25050
|
-
|
|
25051
|
-
|
|
25052
|
-
|
|
25053
|
-
|
|
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
|
-
*
|
|
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
|
-
*
|
|
25131
|
-
*
|
|
25132
|
-
|
|
25133
|
-
|
|
25134
|
-
|
|
25135
|
-
*
|
|
25136
|
-
|
|
25137
|
-
|
|
25138
|
-
|
|
25139
|
-
*
|
|
25140
|
-
|
|
25141
|
-
|
|
25142
|
-
|
|
25143
|
-
*
|
|
25144
|
-
*
|
|
25145
|
-
|
|
25146
|
-
|
|
25147
|
-
|
|
25148
|
-
|
|
25149
|
-
|
|
25150
|
-
|
|
25151
|
-
|
|
25152
|
-
|
|
25153
|
-
|
|
25154
|
-
|
|
25155
|
-
|
|
25156
|
-
|
|
25157
|
-
|
|
25158
|
-
|
|
25159
|
-
|
|
25160
|
-
|
|
25161
|
-
|
|
25162
|
-
|
|
25163
|
-
|
|
25164
|
-
|
|
25165
|
-
|
|
25166
|
-
|
|
25167
|
-
|
|
25168
|
-
|
|
25169
|
-
|
|
25170
|
-
|
|
25171
|
-
|
|
25172
|
-
|
|
25173
|
-
|
|
25174
|
-
|
|
25175
|
-
|
|
25176
|
-
|
|
25177
|
-
|
|
25178
|
-
|
|
25179
|
-
|
|
25180
|
-
|
|
25181
|
-
|
|
25182
|
-
|
|
25183
|
-
|
|
25184
|
-
|
|
25185
|
-
|
|
25186
|
-
|
|
25187
|
-
|
|
25188
|
-
|
|
25189
|
-
|
|
25190
|
-
|
|
25191
|
-
|
|
25192
|
-
|
|
25193
|
-
|
|
25194
|
-
|
|
25195
|
-
|
|
25196
|
-
|
|
25197
|
-
|
|
25198
|
-
|
|
25199
|
-
|
|
25200
|
-
|
|
25201
|
-
|
|
25202
|
-
|
|
25203
|
-
|
|
25204
|
-
|
|
25205
|
-
|
|
25206
|
-
|
|
25207
|
-
|
|
25208
|
-
|
|
25209
|
-
|
|
25210
|
-
|
|
25211
|
-
|
|
25212
|
-
|
|
25213
|
-
|
|
25214
|
-
|
|
25215
|
-
|
|
25216
|
-
|
|
25217
|
-
|
|
25218
|
-
|
|
25219
|
-
|
|
25220
|
-
|
|
25221
|
-
|
|
25222
|
-
|
|
25223
|
-
|
|
25224
|
-
|
|
25225
|
-
|
|
25226
|
-
|
|
25227
|
-
|
|
25228
|
-
|
|
25229
|
-
|
|
25230
|
-
|
|
25231
|
-
|
|
25232
|
-
|
|
25233
|
-
|
|
25234
|
-
|
|
25235
|
-
|
|
25236
|
-
|
|
25237
|
-
|
|
25238
|
-
|
|
25239
|
-
|
|
25240
|
-
|
|
25241
|
-
|
|
25242
|
-
|
|
25243
|
-
|
|
25244
|
-
|
|
25245
|
-
|
|
25246
|
-
|
|
25247
|
-
|
|
25248
|
-
|
|
25249
|
-
|
|
25250
|
-
|
|
25251
|
-
|
|
25252
|
-
|
|
25253
|
-
|
|
25254
|
-
|
|
25255
|
-
|
|
25256
|
-
|
|
25257
|
-
|
|
25258
|
-
|
|
25259
|
-
|
|
25260
|
-
|
|
25261
|
-
|
|
25262
|
-
|
|
25263
|
-
|
|
25264
|
-
|
|
25265
|
-
|
|
25266
|
-
|
|
25267
|
-
|
|
25268
|
-
|
|
25269
|
-
|
|
25270
|
-
|
|
25271
|
-
|
|
25272
|
-
|
|
25273
|
-
|
|
25274
|
-
|
|
25275
|
-
|
|
25276
|
-
|
|
25277
|
-
|
|
25278
|
-
|
|
25279
|
-
|
|
25280
|
-
|
|
25281
|
-
|
|
25282
|
-
|
|
25283
|
-
|
|
25284
|
-
|
|
25285
|
-
|
|
25286
|
-
|
|
25287
|
-
|
|
25288
|
-
|
|
25289
|
-
|
|
25290
|
-
|
|
25291
|
-
|
|
25292
|
-
|
|
25293
|
-
|
|
25294
|
-
|
|
25295
|
-
|
|
25296
|
-
|
|
25297
|
-
|
|
25298
|
-
|
|
25299
|
-
|
|
25300
|
-
|
|
25301
|
-
|
|
25302
|
-
|
|
25303
|
-
|
|
25304
|
-
|
|
25305
|
-
|
|
25306
|
-
|
|
25307
|
-
|
|
25308
|
-
|
|
25309
|
-
|
|
25310
|
-
|
|
25311
|
-
|
|
25312
|
-
|
|
25313
|
-
|
|
25314
|
-
|
|
25315
|
-
|
|
25316
|
-
|
|
25317
|
-
|
|
25318
|
-
|
|
25319
|
-
|
|
25320
|
-
|
|
25321
|
-
|
|
25322
|
-
|
|
25323
|
-
|
|
25324
|
-
|
|
25325
|
-
|
|
25326
|
-
|
|
25327
|
-
|
|
25328
|
-
|
|
25329
|
-
|
|
25330
|
-
|
|
25331
|
-
|
|
25332
|
-
|
|
25333
|
-
|
|
25334
|
-
|
|
25335
|
-
|
|
25336
|
-
|
|
25337
|
-
|
|
25338
|
-
|
|
25339
|
-
|
|
25340
|
-
|
|
25341
|
-
|
|
25342
|
-
|
|
25343
|
-
|
|
25344
|
-
|
|
25345
|
-
|
|
25346
|
-
|
|
25347
|
-
|
|
25348
|
-
|
|
25349
|
-
|
|
25350
|
-
|
|
25351
|
-
|
|
25352
|
-
|
|
25353
|
-
|
|
25354
|
-
|
|
25355
|
-
|
|
25356
|
-
|
|
25357
|
-
|
|
25358
|
-
|
|
25359
|
-
|
|
25360
|
-
|
|
25361
|
-
|
|
25362
|
-
|
|
25363
|
-
|
|
25364
|
-
|
|
25365
|
-
|
|
25366
|
-
|
|
25367
|
-
|
|
25368
|
-
|
|
25369
|
-
|
|
25370
|
-
|
|
25371
|
-
|
|
25372
|
-
|
|
25373
|
-
|
|
25374
|
-
|
|
25375
|
-
|
|
25376
|
-
|
|
25377
|
-
|
|
25378
|
-
|
|
25379
|
-
|
|
25380
|
-
|
|
25381
|
-
|
|
25382
|
-
|
|
25383
|
-
|
|
25384
|
-
|
|
25385
|
-
|
|
25386
|
-
|
|
25387
|
-
|
|
25388
|
-
|
|
25389
|
-
|
|
25390
|
-
|
|
25391
|
-
|
|
25392
|
-
|
|
25393
|
-
|
|
25394
|
-
|
|
25395
|
-
|
|
25396
|
-
|
|
25397
|
-
|
|
25398
|
-
|
|
25399
|
-
|
|
25400
|
-
|
|
25401
|
-
|
|
25402
|
-
|
|
25403
|
-
|
|
25404
|
-
|
|
25405
|
-
|
|
25406
|
-
|
|
25407
|
-
|
|
25408
|
-
|
|
25409
|
-
|
|
25410
|
-
|
|
25411
|
-
|
|
25412
|
-
|
|
25413
|
-
|
|
25414
|
-
|
|
25415
|
-
|
|
25416
|
-
|
|
25417
|
-
|
|
25418
|
-
|
|
25419
|
-
|
|
25420
|
-
|
|
25421
|
-
|
|
25422
|
-
|
|
25423
|
-
|
|
25424
|
-
|
|
25425
|
-
|
|
25426
|
-
|
|
25427
|
-
|
|
25428
|
-
|
|
25429
|
-
|
|
25430
|
-
|
|
25431
|
-
|
|
25432
|
-
|
|
25433
|
-
|
|
25434
|
-
|
|
25435
|
-
|
|
25436
|
-
|
|
25437
|
-
|
|
25438
|
-
|
|
25439
|
-
|
|
25440
|
-
|
|
25441
|
-
|
|
25442
|
-
|
|
25443
|
-
|
|
25444
|
-
|
|
25445
|
-
|
|
25446
|
-
|
|
25447
|
-
|
|
25448
|
-
|
|
25449
|
-
|
|
25450
|
-
|
|
25451
|
-
|
|
25452
|
-
|
|
25453
|
-
|
|
25454
|
-
|
|
25455
|
-
|
|
25456
|
-
|
|
25457
|
-
|
|
25458
|
-
|
|
25459
|
-
|
|
25460
|
-
|
|
25461
|
-
|
|
25462
|
-
|
|
25463
|
-
|
|
25464
|
-
|
|
25465
|
-
|
|
25466
|
-
|
|
25467
|
-
|
|
25468
|
-
|
|
25469
|
-
|
|
25470
|
-
|
|
25471
|
-
|
|
25472
|
-
|
|
25473
|
-
|
|
25474
|
-
|
|
25475
|
-
|
|
25476
|
-
|
|
25477
|
-
|
|
25478
|
-
|
|
25479
|
-
|
|
25480
|
-
|
|
25481
|
-
|
|
25482
|
-
|
|
25483
|
-
|
|
25484
|
-
|
|
25485
|
-
|
|
25486
|
-
|
|
25487
|
-
|
|
25488
|
-
|
|
25489
|
-
|
|
25490
|
-
|
|
25491
|
-
|
|
25492
|
-
|
|
25493
|
-
|
|
25494
|
-
|
|
25495
|
-
|
|
25496
|
-
|
|
25497
|
-
|
|
25498
|
-
|
|
25499
|
-
|
|
25500
|
-
|
|
25501
|
-
|
|
25502
|
-
|
|
25503
|
-
|
|
25504
|
-
|
|
25505
|
-
|
|
25506
|
-
|
|
25507
|
-
|
|
25508
|
-
|
|
25509
|
-
|
|
25510
|
-
|
|
25511
|
-
|
|
25512
|
-
|
|
25513
|
-
|
|
25514
|
-
|
|
25515
|
-
|
|
25516
|
-
|
|
25517
|
-
|
|
25518
|
-
|
|
25519
|
-
|
|
25520
|
-
|
|
25521
|
-
|
|
25522
|
-
|
|
25523
|
-
|
|
25524
|
-
|
|
25525
|
-
|
|
25526
|
-
|
|
25527
|
-
|
|
25528
|
-
|
|
25529
|
-
|
|
25530
|
-
|
|
25531
|
-
|
|
25532
|
-
|
|
25533
|
-
|
|
25534
|
-
|
|
25535
|
-
|
|
25536
|
-
|
|
25537
|
-
|
|
25538
|
-
|
|
25539
|
-
|
|
25540
|
-
|
|
25541
|
-
|
|
25542
|
-
|
|
25543
|
-
|
|
25544
|
-
|
|
25545
|
-
|
|
25546
|
-
|
|
25547
|
-
|
|
25548
|
-
|
|
25549
|
-
|
|
25550
|
-
|
|
25551
|
-
|
|
25552
|
-
|
|
25553
|
-
|
|
25554
|
-
|
|
25555
|
-
|
|
25556
|
-
|
|
25557
|
-
|
|
25558
|
-
|
|
25559
|
-
|
|
25560
|
-
|
|
25561
|
-
|
|
25562
|
-
|
|
25563
|
-
|
|
25564
|
-
|
|
25565
|
-
|
|
25566
|
-
|
|
25567
|
-
|
|
25568
|
-
|
|
25569
|
-
|
|
25570
|
-
|
|
25571
|
-
|
|
25572
|
-
|
|
25573
|
-
|
|
25574
|
-
|
|
25575
|
-
|
|
25576
|
-
|
|
25577
|
-
|
|
25578
|
-
|
|
25579
|
-
|
|
25580
|
-
|
|
25581
|
-
|
|
25582
|
-
|
|
25583
|
-
|
|
25584
|
-
|
|
25585
|
-
|
|
25586
|
-
|
|
25587
|
-
|
|
25588
|
-
|
|
25589
|
-
|
|
25590
|
-
|
|
25591
|
-
|
|
25592
|
-
|
|
25593
|
-
|
|
25594
|
-
|
|
25595
|
-
|
|
25596
|
-
|
|
25597
|
-
|
|
25598
|
-
|
|
25599
|
-
|
|
25600
|
-
|
|
25601
|
-
|
|
25602
|
-
|
|
25603
|
-
|
|
25604
|
-
|
|
25605
|
-
|
|
25606
|
-
|
|
25607
|
-
|
|
25608
|
-
|
|
25609
|
-
|
|
25610
|
-
|
|
25611
|
-
|
|
25612
|
-
|
|
25613
|
-
|
|
25614
|
-
|
|
25615
|
-
|
|
25616
|
-
|
|
25617
|
-
|
|
25618
|
-
|
|
25619
|
-
|
|
25620
|
-
|
|
25621
|
-
|
|
25622
|
-
|
|
25623
|
-
|
|
25624
|
-
|
|
25625
|
-
|
|
25626
|
-
|
|
25627
|
-
|
|
25628
|
-
|
|
25629
|
-
|
|
25630
|
-
|
|
25631
|
-
|
|
25632
|
-
|
|
25633
|
-
|
|
25634
|
-
|
|
25635
|
-
|
|
25636
|
-
|
|
25637
|
-
|
|
25638
|
-
|
|
25639
|
-
|
|
25640
|
-
|
|
25641
|
-
|
|
25642
|
-
|
|
25643
|
-
|
|
25644
|
-
|
|
25645
|
-
|
|
25646
|
-
|
|
25647
|
-
|
|
25648
|
-
|
|
25649
|
-
|
|
25650
|
-
|
|
25651
|
-
|
|
25652
|
-
|
|
25653
|
-
|
|
25654
|
-
|
|
25655
|
-
|
|
25656
|
-
|
|
25657
|
-
|
|
25658
|
-
|
|
25659
|
-
|
|
25660
|
-
|
|
25661
|
-
|
|
25662
|
-
|
|
25663
|
-
|
|
25664
|
-
|
|
25665
|
-
|
|
25666
|
-
|
|
25667
|
-
|
|
25668
|
-
|
|
25669
|
-
|
|
25670
|
-
|
|
25671
|
-
|
|
25672
|
-
|
|
25673
|
-
|
|
25674
|
-
|
|
25675
|
-
|
|
25676
|
-
|
|
25677
|
-
|
|
25678
|
-
|
|
25679
|
-
|
|
25680
|
-
|
|
25681
|
-
|
|
25682
|
-
|
|
25683
|
-
|
|
25684
|
-
|
|
25685
|
-
|
|
25686
|
-
|
|
25687
|
-
|
|
25688
|
-
|
|
25689
|
-
|
|
25690
|
-
|
|
25691
|
-
|
|
25692
|
-
|
|
25693
|
-
|
|
25694
|
-
|
|
25695
|
-
|
|
25696
|
-
|
|
25697
|
-
|
|
25698
|
-
|
|
25699
|
-
|
|
25700
|
-
|
|
25701
|
-
|
|
25702
|
-
|
|
25703
|
-
|
|
25704
|
-
|
|
25705
|
-
|
|
25706
|
-
|
|
25707
|
-
|
|
25708
|
-
|
|
25709
|
-
|
|
25710
|
-
|
|
25711
|
-
|
|
25712
|
-
|
|
25713
|
-
|
|
25714
|
-
|
|
25715
|
-
|
|
25716
|
-
|
|
25717
|
-
|
|
25718
|
-
|
|
25719
|
-
|
|
25720
|
-
|
|
25721
|
-
|
|
25722
|
-
|
|
25723
|
-
|
|
25724
|
-
|
|
25725
|
-
|
|
25726
|
-
|
|
25727
|
-
|
|
25728
|
-
|
|
25729
|
-
|
|
25730
|
-
|
|
25731
|
-
|
|
25732
|
-
|
|
25733
|
-
|
|
25734
|
-
|
|
25735
|
-
|
|
25736
|
-
|
|
25737
|
-
|
|
25738
|
-
|
|
25739
|
-
|
|
25740
|
-
|
|
25741
|
-
|
|
25742
|
-
|
|
25743
|
-
|
|
25744
|
-
|
|
25745
|
-
|
|
25746
|
-
|
|
25747
|
-
|
|
25748
|
-
|
|
25749
|
-
|
|
25750
|
-
|
|
25751
|
-
|
|
25752
|
-
|
|
25753
|
-
|
|
25754
|
-
|
|
25755
|
-
|
|
25756
|
-
|
|
25757
|
-
|
|
25758
|
-
|
|
25759
|
-
|
|
25760
|
-
|
|
25761
|
-
|
|
25762
|
-
|
|
25763
|
-
|
|
25764
|
-
|
|
25765
|
-
|
|
25766
|
-
|
|
25767
|
-
|
|
25768
|
-
|
|
25769
|
-
|
|
25770
|
-
|
|
25771
|
-
|
|
25772
|
-
|
|
25773
|
-
|
|
25774
|
-
|
|
25775
|
-
|
|
25776
|
-
|
|
25777
|
-
|
|
25778
|
-
|
|
25779
|
-
|
|
25780
|
-
|
|
25781
|
-
|
|
25782
|
-
|
|
25783
|
-
|
|
25784
|
-
|
|
25785
|
-
|
|
25786
|
-
|
|
25787
|
-
|
|
25788
|
-
|
|
25789
|
-
|
|
25790
|
-
|
|
25791
|
-
|
|
25792
|
-
|
|
25793
|
-
|
|
25794
|
-
|
|
25795
|
-
|
|
25796
|
-
|
|
25797
|
-
|
|
25798
|
-
|
|
25799
|
-
|
|
25800
|
-
|
|
25801
|
-
|
|
25802
|
-
|
|
25803
|
-
|
|
25804
|
-
|
|
25805
|
-
|
|
25806
|
-
|
|
25807
|
-
|
|
25808
|
-
|
|
25809
|
-
|
|
25810
|
-
|
|
25811
|
-
|
|
25812
|
-
|
|
25813
|
-
|
|
25814
|
-
|
|
25815
|
-
|
|
25816
|
-
|
|
25817
|
-
|
|
25818
|
-
|
|
25819
|
-
|
|
25820
|
-
|
|
25821
|
-
|
|
25822
|
-
|
|
25823
|
-
|
|
25824
|
-
|
|
25825
|
-
|
|
25826
|
-
|
|
25827
|
-
|
|
25828
|
-
|
|
25829
|
-
|
|
25830
|
-
|
|
25831
|
-
|
|
25832
|
-
|
|
25833
|
-
|
|
25834
|
-
|
|
25835
|
-
|
|
25836
|
-
|
|
25837
|
-
|
|
25838
|
-
|
|
25839
|
-
|
|
25840
|
-
|
|
25841
|
-
|
|
25842
|
-
|
|
25843
|
-
|
|
25844
|
-
|
|
25845
|
-
|
|
25846
|
-
|
|
25847
|
-
|
|
25848
|
-
|
|
25849
|
-
|
|
25850
|
-
|
|
25851
|
-
|
|
25852
|
-
|
|
25853
|
-
|
|
25854
|
-
|
|
25855
|
-
|
|
25856
|
-
|
|
25857
|
-
|
|
25858
|
-
|
|
25859
|
-
|
|
25860
|
-
|
|
25861
|
-
|
|
25862
|
-
|
|
25863
|
-
|
|
25864
|
-
|
|
25865
|
-
|
|
25866
|
-
|
|
25867
|
-
|
|
25868
|
-
|
|
25869
|
-
|
|
25870
|
-
|
|
25871
|
-
|
|
25872
|
-
|
|
25873
|
-
|
|
25874
|
-
|
|
25875
|
-
|
|
25876
|
-
|
|
25877
|
-
|
|
25878
|
-
|
|
25879
|
-
|
|
25880
|
-
|
|
25881
|
-
|
|
25882
|
-
|
|
25883
|
-
|
|
25884
|
-
|
|
25885
|
-
|
|
25886
|
-
|
|
25887
|
-
|
|
25888
|
-
|
|
25889
|
-
|
|
25890
|
-
|
|
25891
|
-
|
|
25892
|
-
|
|
25893
|
-
|
|
25894
|
-
|
|
25895
|
-
|
|
25896
|
-
|
|
25897
|
-
|
|
25898
|
-
|
|
25899
|
-
|
|
25900
|
-
|
|
25901
|
-
|
|
25902
|
-
|
|
25903
|
-
|
|
25904
|
-
|
|
25905
|
-
|
|
25906
|
-
|
|
25907
|
-
|
|
25908
|
-
|
|
25909
|
-
|
|
25910
|
-
|
|
25911
|
-
|
|
25912
|
-
|
|
25913
|
-
|
|
25914
|
-
|
|
25915
|
-
|
|
25916
|
-
|
|
25917
|
-
|
|
25918
|
-
|
|
25919
|
-
|
|
25920
|
-
|
|
25921
|
-
|
|
25922
|
-
|
|
25923
|
-
|
|
25924
|
-
|
|
25925
|
-
|
|
25926
|
-
|
|
25927
|
-
|
|
25928
|
-
|
|
25929
|
-
|
|
25930
|
-
|
|
25931
|
-
|
|
25932
|
-
|
|
25933
|
-
|
|
25934
|
-
|
|
25935
|
-
|
|
25936
|
-
|
|
25937
|
-
|
|
25938
|
-
|
|
25939
|
-
|
|
25940
|
-
|
|
25941
|
-
|
|
25942
|
-
|
|
25943
|
-
|
|
25944
|
-
|
|
25945
|
-
|
|
25946
|
-
|
|
25947
|
-
|
|
25948
|
-
|
|
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 { }
|