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