@augustdigital/sdk 8.3.2 → 8.5.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/abis/ERC20_Bytes32.d.ts +4 -0
- package/lib/abis/ERC20_Bytes32.js +4 -0
- package/lib/abis/ERC4626.d.ts +1 -0
- package/lib/abis/ERC4626.js +1 -0
- package/lib/abis/ERC721.d.ts +1 -0
- package/lib/abis/ERC721.js +1 -0
- package/lib/abis/FeeOracle.js +1 -0
- package/lib/abis/LendingPool.js +1 -0
- package/lib/abis/LendingPoolV2.js +1 -0
- package/lib/abis/Multicall3.js +3 -0
- package/lib/abis/OFT.d.ts +20 -0
- package/lib/abis/OFT.js +20 -0
- package/lib/abis/SmartAccount.d.ts +1 -0
- package/lib/abis/SmartAccount.js +3 -0
- package/lib/abis/SwapRouter.d.ts +1 -0
- package/lib/abis/SwapRouter.js +1 -0
- package/lib/abis/UniversalSignatureValidator.js +3 -0
- package/lib/abis/index.d.ts +5 -0
- package/lib/abis/index.js +5 -0
- package/lib/adapters/evm/getters.d.ts +17 -2
- package/lib/adapters/evm/getters.js +35 -3
- package/lib/adapters/evm/index.d.ts +262 -0
- package/lib/adapters/evm/index.js +268 -1
- package/lib/adapters/evm/utils.d.ts +6 -0
- package/lib/adapters/evm/utils.js +7 -0
- package/lib/adapters/solana/constants.js +4 -1
- package/lib/adapters/solana/getters.d.ts +8 -0
- package/lib/adapters/solana/getters.js +21 -0
- package/lib/adapters/solana/idl/vault-idl.js +9 -0
- package/lib/adapters/solana/index.d.ts +55 -0
- package/lib/adapters/solana/index.js +57 -0
- package/lib/adapters/solana/utils.d.ts +28 -0
- package/lib/adapters/solana/utils.js +79 -4
- package/lib/adapters/solana/vault.actions.d.ts +19 -0
- package/lib/adapters/solana/vault.actions.js +47 -3
- package/lib/adapters/stellar/actions.d.ts +25 -0
- package/lib/adapters/stellar/actions.js +33 -0
- package/lib/adapters/stellar/constants.d.ts +26 -0
- package/lib/adapters/stellar/constants.js +29 -0
- package/lib/adapters/stellar/getters.d.ts +56 -0
- package/lib/adapters/stellar/getters.js +81 -0
- package/lib/adapters/stellar/index.d.ts +48 -0
- package/lib/adapters/stellar/index.js +48 -0
- package/lib/adapters/stellar/soroban.d.ts +20 -0
- package/lib/adapters/stellar/soroban.js +46 -0
- package/lib/adapters/stellar/submit.d.ts +12 -0
- package/lib/adapters/stellar/submit.js +19 -0
- package/lib/adapters/stellar/types.d.ts +27 -0
- package/lib/adapters/stellar/types.js +3 -0
- package/lib/adapters/stellar/utils.d.ts +10 -0
- package/lib/adapters/stellar/utils.js +10 -0
- package/lib/adapters/sui/getters.d.ts +6 -0
- package/lib/adapters/sui/getters.js +6 -0
- package/lib/adapters/sui/index.d.ts +15 -0
- package/lib/adapters/sui/index.js +15 -0
- package/lib/adapters/sui/transformer.d.ts +6 -0
- package/lib/adapters/sui/transformer.js +6 -0
- package/lib/adapters/sui/utils.d.ts +6 -0
- package/lib/adapters/sui/utils.js +6 -0
- package/lib/core/analytics/chain-name.d.ts +8 -0
- package/lib/core/analytics/chain-name.js +8 -0
- package/lib/core/analytics/constants.d.ts +4 -0
- package/lib/core/analytics/constants.js +4 -0
- package/lib/core/analytics/env.d.ts +25 -0
- package/lib/core/analytics/env.js +26 -0
- package/lib/core/analytics/index.d.ts +26 -0
- package/lib/core/analytics/index.js +35 -0
- package/lib/core/analytics/instrumentation.d.ts +26 -0
- package/lib/core/analytics/instrumentation.js +66 -2
- package/lib/core/analytics/method-taxonomy.d.ts +16 -0
- package/lib/core/analytics/method-taxonomy.js +18 -0
- package/lib/core/analytics/metrics.d.ts +23 -0
- package/lib/core/analytics/metrics.js +40 -0
- package/lib/core/analytics/sanitize.d.ts +38 -0
- package/lib/core/analytics/sanitize.js +46 -0
- package/lib/core/analytics/sentry-runtime.d.ts +11 -0
- package/lib/core/analytics/sentry-runtime.js +19 -0
- package/lib/core/analytics/sentry.d.ts +45 -0
- package/lib/core/analytics/sentry.js +115 -2
- package/lib/core/analytics/types.d.ts +27 -0
- package/lib/core/analytics/user-identity.d.ts +34 -0
- package/lib/core/analytics/user-identity.js +42 -0
- package/lib/core/analytics/version.d.ts +6 -1
- package/lib/core/analytics/version.js +6 -1
- package/lib/core/auth/verify.js +5 -0
- package/lib/core/base.class.d.ts +75 -0
- package/lib/core/base.class.js +56 -0
- package/lib/core/cache.d.ts +5 -0
- package/lib/core/cache.js +6 -0
- package/lib/core/constants/adapters.d.ts +15 -0
- package/lib/core/constants/adapters.js +28 -8
- package/lib/core/constants/core.d.ts +12 -1
- package/lib/core/constants/core.js +12 -0
- package/lib/core/constants/swap-router.d.ts +46 -0
- package/lib/core/constants/swap-router.js +50 -0
- package/lib/core/constants/vaults.d.ts +56 -0
- package/lib/core/constants/vaults.js +66 -1
- package/lib/core/constants/web3.d.ts +3 -0
- package/lib/core/constants/web3.js +18 -5
- package/lib/core/errors/index.d.ts +36 -0
- package/lib/core/errors/index.js +29 -0
- package/lib/core/fetcher.d.ts +134 -0
- package/lib/core/fetcher.js +191 -5
- package/lib/core/helpers/adapters.d.ts +9 -0
- package/lib/core/helpers/adapters.js +11 -0
- package/lib/core/helpers/chain-address.d.ts +10 -0
- package/lib/core/helpers/chain-address.js +11 -0
- package/lib/core/helpers/core.d.ts +42 -0
- package/lib/core/helpers/core.js +66 -1
- package/lib/core/helpers/explorer-link.d.ts +14 -0
- package/lib/core/helpers/explorer-link.js +14 -0
- package/lib/core/helpers/signer.d.ts +26 -0
- package/lib/core/helpers/signer.js +39 -0
- package/lib/core/helpers/swap-router.d.ts +32 -0
- package/lib/core/helpers/swap-router.js +32 -0
- package/lib/core/helpers/vault-version.d.ts +1 -0
- package/lib/core/helpers/vault-version.js +2 -0
- package/lib/core/helpers/vaults.d.ts +8 -0
- package/lib/core/helpers/vaults.js +22 -8
- package/lib/core/helpers/web3.d.ts +152 -0
- package/lib/core/helpers/web3.js +183 -6
- package/lib/core/logger/index.d.ts +55 -0
- package/lib/core/logger/index.js +19 -0
- package/lib/core/logger/slack.d.ts +3 -0
- package/lib/core/logger/slack.js +3 -0
- package/lib/core/vault-metadata.d.ts +6 -0
- package/lib/core/vault-metadata.js +6 -0
- package/lib/core/version-check.d.ts +52 -0
- package/lib/core/version-check.js +81 -0
- package/lib/evm/methods/crossChainVault.d.ts +90 -0
- package/lib/evm/methods/crossChainVault.js +186 -1
- package/lib/evm/methods/crossChainVaultRegistry.d.ts +93 -0
- package/lib/evm/methods/crossChainVaultRegistry.js +240 -0
- package/lib/evm/methods/index.d.ts +1 -0
- package/lib/evm/methods/index.js +1 -0
- package/lib/evm/types/crossChain.d.ts +202 -0
- package/lib/evm/types/crossChain.js +11 -0
- package/lib/index.d.ts +16 -0
- package/lib/index.js +19 -0
- package/lib/main.d.ts +288 -5
- package/lib/main.js +305 -0
- package/lib/modules/api/index.d.ts +1 -0
- package/lib/modules/api/index.js +6 -0
- package/lib/modules/api/main.d.ts +52 -0
- package/lib/modules/api/main.js +130 -0
- package/lib/modules/sub-accounts/fetcher.d.ts +15 -0
- package/lib/modules/sub-accounts/fetcher.js +15 -0
- package/lib/modules/sub-accounts/main.d.ts +33 -0
- package/lib/modules/sub-accounts/main.js +38 -0
- package/lib/modules/sub-accounts/utils.d.ts +3 -0
- package/lib/modules/sub-accounts/utils.js +3 -0
- package/lib/modules/vaults/adapter.helpers.d.ts +18 -0
- package/lib/modules/vaults/adapter.helpers.js +34 -0
- package/lib/modules/vaults/fetcher.d.ts +20 -0
- package/lib/modules/vaults/fetcher.js +40 -3
- package/lib/modules/vaults/getters.d.ts +295 -0
- package/lib/modules/vaults/getters.js +552 -12
- package/lib/modules/vaults/index.d.ts +12 -0
- package/lib/modules/vaults/index.js +12 -0
- package/lib/modules/vaults/main.d.ts +292 -4
- package/lib/modules/vaults/main.js +379 -7
- package/lib/modules/vaults/read.actions.d.ts +168 -0
- package/lib/modules/vaults/read.actions.js +143 -0
- package/lib/modules/vaults/types.d.ts +34 -0
- package/lib/modules/vaults/utils/call-data-decoder.d.ts +47 -0
- package/lib/modules/vaults/utils/call-data-decoder.js +56 -0
- package/lib/modules/vaults/utils/date-utils.d.ts +39 -0
- package/lib/modules/vaults/utils/date-utils.js +47 -1
- package/lib/modules/vaults/utils.d.ts +69 -0
- package/lib/modules/vaults/utils.js +104 -5
- package/lib/modules/vaults/write.actions.d.ts +363 -3
- package/lib/modules/vaults/write.actions.js +364 -2
- package/lib/polyfills.js +2 -0
- package/lib/sdk.d.ts +23705 -0
- package/lib/services/coingecko/fetcher.d.ts +13 -0
- package/lib/services/coingecko/fetcher.js +17 -0
- package/lib/services/debank/fetcher.d.ts +14 -0
- package/lib/services/debank/fetcher.js +12 -0
- package/lib/services/debank/utils.js +17 -0
- package/lib/services/layerzero/deposits.d.ts +11 -0
- package/lib/services/layerzero/deposits.js +34 -11
- package/lib/services/layerzero/redeems.d.ts +10 -0
- package/lib/services/layerzero/redeems.js +13 -0
- package/lib/services/layerzero/utils.d.ts +8 -0
- package/lib/services/layerzero/utils.js +11 -0
- package/lib/services/octavfi/fetcher.d.ts +7 -0
- package/lib/services/octavfi/fetcher.js +25 -0
- package/lib/services/octavfi/utils.d.ts +12 -0
- package/lib/services/octavfi/utils.js +44 -10
- package/lib/services/subgraph/fetcher.js +4 -2
- package/lib/services/subgraph/vaults.d.ts +12 -0
- package/lib/services/subgraph/vaults.js +43 -2
- package/lib/services/swap-quotes/index.d.ts +71 -0
- package/lib/services/swap-quotes/index.js +25 -0
- package/lib/services/swap-quotes/paraswap.d.ts +17 -0
- package/lib/services/swap-quotes/paraswap.js +14 -0
- package/lib/types/pools.d.ts +3 -0
- package/lib/types/typed-contract.d.ts +64 -0
- package/lib/types/vaults.d.ts +137 -2
- package/lib/types/vaults.js +10 -0
- package/lib/types/web3.d.ts +8 -0
- package/lib/types/web3.js +1 -0
- package/lib/types/webserver.d.ts +45 -0
- package/package.json +6 -5
|
@@ -6,21 +6,62 @@ export type IContractWriteOptions = {
|
|
|
6
6
|
wallet: IAddress;
|
|
7
7
|
amount?: string | bigint | number;
|
|
8
8
|
wait?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Optional: Token to deposit (defaults to vault's underlying asset)
|
|
11
|
+
* If different from underlying, will use adapter logic
|
|
12
|
+
*/
|
|
9
13
|
depositAsset?: IAddress;
|
|
14
|
+
/**
|
|
15
|
+
* Optional: Chain ID for the vault (used for adapter routing)
|
|
16
|
+
*/
|
|
10
17
|
chainId?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Optional: Pool/vault name for adapter routing
|
|
20
|
+
*/
|
|
11
21
|
poolName?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Optional: boolean for instant redeem
|
|
24
|
+
*/
|
|
12
25
|
isInstantRedeem?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Optional: boolean for depositWithPermit
|
|
28
|
+
*/
|
|
13
29
|
isDepositWithPermit?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Optional: address that receives the vault shares. Defaults to `wallet`.
|
|
32
|
+
* Only honored on the SwapRouter dispatch path; legacy adapters mint to `wallet`.
|
|
33
|
+
*/
|
|
14
34
|
receiver?: IAddress;
|
|
35
|
+
/**
|
|
36
|
+
* Optional: slippage tolerance in bps (1 bp = 0.01%) applied to any swap
|
|
37
|
+
* quote the SwapRouter dispatch path fetches when `depositAsset` differs
|
|
38
|
+
* from the vault's reference asset. Must be in `[0, 10_000)`. Defaults to
|
|
39
|
+
* `100` (1%). Ignored for same-asset deposits and legacy adapter paths.
|
|
40
|
+
*/
|
|
15
41
|
slippageBps?: number;
|
|
16
42
|
};
|
|
17
43
|
export type INativeDepositOptions = {
|
|
44
|
+
/**
|
|
45
|
+
* MultiAssetNativeDepositWrapper contract address
|
|
46
|
+
*/
|
|
18
47
|
wrapperAddress: IAddress;
|
|
48
|
+
/**
|
|
49
|
+
* Optional: Receiver address for the deposit (defaults to signer address)
|
|
50
|
+
* If not provided, uses the overload without receiver parameter
|
|
51
|
+
*/
|
|
19
52
|
receiver?: IAddress;
|
|
53
|
+
/**
|
|
54
|
+
* Amount of native token (ETH/AVAX/etc) to deposit
|
|
55
|
+
*/
|
|
20
56
|
amount: string | bigint | number;
|
|
57
|
+
/**
|
|
58
|
+
* Optional: Wait for transaction confirmation
|
|
59
|
+
*/
|
|
21
60
|
wait?: boolean;
|
|
22
61
|
};
|
|
62
|
+
/** @internal */
|
|
23
63
|
export declare function safeBigInt(value: unknown, context?: string): bigint;
|
|
64
|
+
/** @internal */
|
|
24
65
|
export declare function resolveDepositTokenDecimals(args: {
|
|
25
66
|
actualDepositAsset: IAddress;
|
|
26
67
|
underlyingAsset: IAddress;
|
|
@@ -29,6 +70,7 @@ export declare function resolveDepositTokenDecimals(args: {
|
|
|
29
70
|
vaultDecimals: number;
|
|
30
71
|
readErc20Decimals: (address: IAddress) => Promise<number>;
|
|
31
72
|
}): Promise<number>;
|
|
73
|
+
/** @internal */
|
|
32
74
|
export declare function resolveSpender(args: {
|
|
33
75
|
target: IAddress;
|
|
34
76
|
isMultiAssetVault: boolean;
|
|
@@ -36,45 +78,363 @@ export declare function resolveSpender(args: {
|
|
|
36
78
|
adapterWrapperAddress?: IAddress;
|
|
37
79
|
swapRouterAddress?: IAddress;
|
|
38
80
|
}): IAddress;
|
|
81
|
+
/** @internal */
|
|
39
82
|
export declare function validateAmountPrecision(amount: string | bigint | number): void;
|
|
83
|
+
/** @internal */
|
|
40
84
|
export declare function isNonceParsing(error: unknown): boolean;
|
|
85
|
+
/** @internal */
|
|
41
86
|
export declare function safeWaitForTx(tx: TransactionResponse): Promise<import("ethers").TransactionReceipt>;
|
|
87
|
+
/**
|
|
88
|
+
* Wraps an ethers contract call that returns a TransactionResponse.
|
|
89
|
+
* Some RPCs (e.g. Monad) return malformed pending tx fields like `nonce: "undefined"`,
|
|
90
|
+
* which causes ethers.js to throw during response parsing before safeWaitForTx runs.
|
|
91
|
+
* This wrapper catches that error, extracts the tx hash from the error context, and
|
|
92
|
+
* falls back to provider.waitForTransaction().
|
|
93
|
+
*/
|
|
94
|
+
/** @internal */
|
|
42
95
|
export declare function safeSendTx(contractCall: () => Promise<TransactionResponse>, provider: Signer | Wallet, shouldWait?: boolean): Promise<{
|
|
43
96
|
tx: TransactionResponse | null;
|
|
44
97
|
hash: string;
|
|
45
98
|
}>;
|
|
99
|
+
/**
|
|
100
|
+
* Shared nonce-recovery helper for catch blocks. When an RPC returns a
|
|
101
|
+
* malformed nonce and ethers throws, try to extract the tx hash from the
|
|
102
|
+
* error payload. Optionally waits for confirmation (with status check).
|
|
103
|
+
*
|
|
104
|
+
* Returns the recovered hash, or null if this error is not a nonce-parse error
|
|
105
|
+
* or if no hash could be extracted (caller should re-throw the original error).
|
|
106
|
+
*/
|
|
107
|
+
/** @internal */
|
|
46
108
|
export declare function tryRecoverTxHash(error: unknown, signer: Signer | Wallet, wait?: boolean): Promise<string | null>;
|
|
47
|
-
|
|
109
|
+
/**
|
|
110
|
+
* Discriminated union returned by {@link approve}. Lets callers tell apart
|
|
111
|
+
* "we sent a tx" / "existing allowance already covers it" / "native token, no
|
|
112
|
+
* allowance applies" without re-reading on-chain state.
|
|
113
|
+
*/
|
|
114
|
+
export type ApproveResult =
|
|
115
|
+
/** An `approve` transaction was sent. `hash` is the tx hash. */
|
|
116
|
+
{
|
|
48
117
|
kind: 'sent';
|
|
49
118
|
hash: string;
|
|
50
|
-
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Existing allowance already covers `amount`; no tx sent. `existing` is
|
|
122
|
+
* the on-chain allowance (raw bigint, in deposit-token units).
|
|
123
|
+
*/
|
|
124
|
+
| {
|
|
51
125
|
kind: 'sufficient';
|
|
52
126
|
existing: bigint;
|
|
53
|
-
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The resolved deposit asset is the native token — it travels as
|
|
130
|
+
* `msg.value`, so no ERC-20 allowance applies. No tx sent.
|
|
131
|
+
*/
|
|
132
|
+
| {
|
|
54
133
|
kind: 'native';
|
|
55
134
|
};
|
|
135
|
+
/**
|
|
136
|
+
* Approve a vault (or the appropriate adapter wrapper) to spend a token
|
|
137
|
+
* ahead of a separate deposit call. Spender routing mirrors
|
|
138
|
+
* {@link vaultDeposit} (multi-asset → vault, adapter → wrapper, standard →
|
|
139
|
+
* vault). Returns `undefined` when the existing allowance already covers
|
|
140
|
+
* `amount` **or** when the deposit asset is native.
|
|
141
|
+
*
|
|
142
|
+
* @returns Transaction hash when an approval was sent, `undefined` when
|
|
143
|
+
* the existing allowance already covers `amount` or the deposit asset is
|
|
144
|
+
* native (no ERC-20 allowance applies). Use {@link approve} for a
|
|
145
|
+
* discriminated `ApproveResult` if you need to tell those two cases apart.
|
|
146
|
+
* @throws AugustValidationError on invalid wallet/target/amount.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```ts
|
|
150
|
+
* const hash = await augustSdk.evm.vaultApprove({
|
|
151
|
+
* target: '0x...', // vault contract address
|
|
152
|
+
* wallet: walletAddress,
|
|
153
|
+
* amount: '100', // 100 of the deposit token (UI units)
|
|
154
|
+
* wait: true, // wait for the approval to confirm
|
|
155
|
+
* });
|
|
156
|
+
* if (hash) console.log('approve tx', hash);
|
|
157
|
+
* // hash === undefined means the on-chain allowance already covers the
|
|
158
|
+
* // amount, or the deposit asset is native (msg.value, no allowance).
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
56
161
|
export declare function vaultApprove(signer: Signer | Wallet, options: IContractWriteOptions): Promise<string | undefined>;
|
|
162
|
+
/**
|
|
163
|
+
* Same approval logic as {@link vaultApprove} but returns a discriminated
|
|
164
|
+
* union so callers can tell `sent` apart from `sufficient` and `native`
|
|
165
|
+
* without re-reading on-chain state. Preferred shape for new integrations.
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```ts
|
|
169
|
+
* const r = await augustSdk.evm.approve({
|
|
170
|
+
* target: vaultAddress,
|
|
171
|
+
* wallet: walletAddress,
|
|
172
|
+
* amount: '100',
|
|
173
|
+
* wait: true,
|
|
174
|
+
* });
|
|
175
|
+
* switch (r.kind) {
|
|
176
|
+
* case 'sent':
|
|
177
|
+
* showToast('Approval submitted', r.hash);
|
|
178
|
+
* break;
|
|
179
|
+
* case 'sufficient':
|
|
180
|
+
* // r.existing is the existing on-chain allowance (raw bigint)
|
|
181
|
+
* break;
|
|
182
|
+
* case 'native':
|
|
183
|
+
* // No allowance needed; native token will travel as msg.value
|
|
184
|
+
* break;
|
|
185
|
+
* }
|
|
186
|
+
* ```
|
|
187
|
+
*
|
|
188
|
+
* @throws AugustValidationError on invalid wallet/target/amount.
|
|
189
|
+
* @throws AugustSDKError when the approval submission fails.
|
|
190
|
+
*/
|
|
57
191
|
export declare function approve(signer: Signer | Wallet, options: IContractWriteOptions): Promise<ApproveResult>;
|
|
192
|
+
/**
|
|
193
|
+
* Deposit underlying token into the specified vault. Auto-routes to the
|
|
194
|
+
* correct contract path (single-asset ERC-4626, EVM-2 multi-asset,
|
|
195
|
+
* Paraswap adapter, native-token wrapper, depositWithPermit) based on the
|
|
196
|
+
* vault version and `depositAsset`.
|
|
197
|
+
*
|
|
198
|
+
* Amounts are encoded against the **deposit token's** decimals, not the
|
|
199
|
+
* vault's share decimals. The SDK reads the appropriate decimals via the
|
|
200
|
+
* vault metadata and the asset's ERC-20.
|
|
201
|
+
*
|
|
202
|
+
* Approval is handled automatically: if the existing allowance doesn't
|
|
203
|
+
* cover `amount`, an `approve` is sent and **always waited for** (regardless
|
|
204
|
+
* of the caller's `wait` flag) so the deposit tx can't be re-ordered ahead
|
|
205
|
+
* of the approval on Monad-style RPCs.
|
|
206
|
+
*
|
|
207
|
+
* @param signer ethers Signer / Wallet (or viem WalletClient via {@link setSigner})
|
|
208
|
+
* @param options Vault address, wallet, amount, optional `depositAsset` for
|
|
209
|
+
* adapter routes, optional `wait` to wait for the deposit receipt.
|
|
210
|
+
* @returns Deposit transaction hash.
|
|
211
|
+
* @throws AugustValidationError on invalid wallet/target/amount or missing
|
|
212
|
+
* adapter config when `depositAsset` differs from the vault underlying.
|
|
213
|
+
* @throws AugustSDKError when the deposit submission or on-chain call fails.
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```ts
|
|
217
|
+
* const hash = await augustSdk.evm.vaultDeposit({
|
|
218
|
+
* target: '0xE9B725010A9E419412ed67d0fA5f3A5f40159D32', // vault
|
|
219
|
+
* wallet: walletAddress,
|
|
220
|
+
* amount: '100', // 100 USDC (UI units)
|
|
221
|
+
* wait: true, // wait for the deposit receipt
|
|
222
|
+
* });
|
|
223
|
+
* ```
|
|
224
|
+
*
|
|
225
|
+
* @example Adapter deposit (different deposit asset than the vault's underlying)
|
|
226
|
+
* ```ts
|
|
227
|
+
* await augustSdk.evm.vaultDeposit({
|
|
228
|
+
* target: vaultAddress,
|
|
229
|
+
* wallet: walletAddress,
|
|
230
|
+
* amount: '0.5',
|
|
231
|
+
* depositAsset: WETH_ADDRESS, // swap WETH -> vault underlying via the adapter
|
|
232
|
+
* chainId: 1,
|
|
233
|
+
* });
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
58
236
|
export declare function vaultDeposit(signer: Signer | Wallet, options: IContractWriteOptions): Promise<string>;
|
|
237
|
+
/**
|
|
238
|
+
* Request to redeem vault shares. For EVM-1 vaults this queues a standard
|
|
239
|
+
* redemption (claimable later via `vaultRedeem`); for EVM-2 vaults this
|
|
240
|
+
* also handles the receipt-token allowance automatically. Pass
|
|
241
|
+
* `isInstantRedeem: true` for vaults that support instant settlement.
|
|
242
|
+
*
|
|
243
|
+
* Approval of the receipt token (EVM-2) is always waited on before the
|
|
244
|
+
* redeem call, regardless of the caller's `wait` flag.
|
|
245
|
+
*
|
|
246
|
+
* @param signer ethers Signer / Wallet (or viem WalletClient via {@link setSigner})
|
|
247
|
+
* @param options Vault address, wallet, amount, optional `isInstantRedeem`,
|
|
248
|
+
* optional `wait` to wait for the redeem receipt.
|
|
249
|
+
* @returns Redeem transaction hash.
|
|
250
|
+
* @throws AugustValidationError on invalid wallet/target/amount.
|
|
251
|
+
* @throws AugustSDKError when the redeem submission or on-chain call fails.
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```ts
|
|
255
|
+
* const hash = await augustSdk.evm.vaultRequestRedeem({
|
|
256
|
+
* target: vaultAddress,
|
|
257
|
+
* wallet: walletAddress,
|
|
258
|
+
* amount: '10', // 10 shares (UI units)
|
|
259
|
+
* wait: true,
|
|
260
|
+
* });
|
|
261
|
+
* ```
|
|
262
|
+
*
|
|
263
|
+
* @example Instant redemption
|
|
264
|
+
* ```ts
|
|
265
|
+
* await augustSdk.evm.vaultRequestRedeem({
|
|
266
|
+
* target: vaultAddress,
|
|
267
|
+
* wallet: walletAddress,
|
|
268
|
+
* amount: '10',
|
|
269
|
+
* isInstantRedeem: true,
|
|
270
|
+
* });
|
|
271
|
+
* ```
|
|
272
|
+
*/
|
|
59
273
|
export declare function vaultRequestRedeem(signer: Signer | Wallet, options: IContractWriteOptions): Promise<string>;
|
|
274
|
+
/**
|
|
275
|
+
* @TODO
|
|
276
|
+
* @description withdraw funds from the specified pool including accrued rewards
|
|
277
|
+
* @param signer signer / wallet object
|
|
278
|
+
* @param options object including pool contract address, user wallet address, and more
|
|
279
|
+
* @returns claim tx hash
|
|
280
|
+
*/
|
|
60
281
|
export declare function vaultRedeem(signer: Signer | Wallet, options: IContractWriteOptions & {
|
|
61
282
|
year: string;
|
|
62
283
|
month: string;
|
|
63
284
|
day: string;
|
|
64
285
|
receiverIndex: string;
|
|
65
286
|
}): Promise<string>;
|
|
287
|
+
/**
|
|
288
|
+
* Deposit a native token (ETH / AVAX / etc.) into a vault via the
|
|
289
|
+
* `MultiAssetNativeDepositWrapper`. The wrapper forwards `msg.value` to
|
|
290
|
+
* the vault as the deposit underlying — no allowance is required.
|
|
291
|
+
*
|
|
292
|
+
* `amount` is the **raw on-chain value in wei-equivalent** (18 decimals
|
|
293
|
+
* for ETH-family natives). If you have a UI-shaped amount in ether, scale
|
|
294
|
+
* it first.
|
|
295
|
+
*
|
|
296
|
+
* @param signer ethers Signer / Wallet
|
|
297
|
+
* @param options `wrapperAddress` is the deployed wrapper contract;
|
|
298
|
+
* `receiver` defaults to the signer's address; `amount` is the native
|
|
299
|
+
* amount in wei; `wait` waits for the deposit receipt.
|
|
300
|
+
* @returns Deposit transaction hash.
|
|
301
|
+
* @throws AugustValidationError on invalid wrapper / receiver / amount.
|
|
302
|
+
* @throws AugustSDKError when the deposit submission or on-chain call fails.
|
|
303
|
+
*
|
|
304
|
+
* @example
|
|
305
|
+
* ```ts
|
|
306
|
+
* import { parseEther } from 'ethers';
|
|
307
|
+
*
|
|
308
|
+
* await augustSdk.evm.depositNative({
|
|
309
|
+
* wrapperAddress: nativeWrapperAddress,
|
|
310
|
+
* amount: parseEther('0.5'), // 0.5 ETH in wei
|
|
311
|
+
* wait: true,
|
|
312
|
+
* });
|
|
313
|
+
* ```
|
|
314
|
+
*/
|
|
66
315
|
export declare function depositNative(signer: Signer | Wallet, options: INativeDepositOptions): Promise<string>;
|
|
67
316
|
export type IRwaRedeemOptions = {
|
|
317
|
+
/** RwaRedeemSubaccount contract address */
|
|
68
318
|
target: IAddress;
|
|
319
|
+
/** User wallet address */
|
|
69
320
|
wallet: IAddress;
|
|
321
|
+
/** Redeemable asset address (e.g. USDC, USDT) */
|
|
70
322
|
asset: IAddress;
|
|
323
|
+
/** Amount of vault shares to redeem */
|
|
71
324
|
amount: string | bigint | number;
|
|
325
|
+
/** Minimum output amount (slippage protection), in output asset decimals */
|
|
72
326
|
minOut: string | bigint | number;
|
|
327
|
+
/** Decimals of the vault share token */
|
|
73
328
|
decimals: number;
|
|
329
|
+
/** Decimals of the output/redeemable asset */
|
|
74
330
|
outputDecimals: number;
|
|
331
|
+
/** Wait for transaction confirmation */
|
|
75
332
|
wait?: boolean;
|
|
76
333
|
};
|
|
334
|
+
/**
|
|
335
|
+
* Redeem vault shares for an underlying asset via the RwaRedeemSubaccount.
|
|
336
|
+
* Caller must approve the **vault share token** (not the output asset) to
|
|
337
|
+
* the subaccount beforehand — it pulls shares via `transferFrom`.
|
|
338
|
+
*
|
|
339
|
+
* Pass `minOut` to enforce slippage protection (in `outputDecimals` units).
|
|
340
|
+
* The SDK does not currently compute `minOut` from a slippage percentage —
|
|
341
|
+
* the caller is responsible for choosing a safe lower bound.
|
|
342
|
+
*
|
|
343
|
+
* @throws AugustValidationError on invalid addresses or amount inputs.
|
|
344
|
+
* @throws AugustSDKError when the redeem submission or on-chain call fails.
|
|
345
|
+
*
|
|
346
|
+
* @example
|
|
347
|
+
* ```ts
|
|
348
|
+
* // 1. Approve the vault share token to the subaccount first.
|
|
349
|
+
* await augustSdk.evm.vaultApprove({
|
|
350
|
+
* target: subaccountAddress,
|
|
351
|
+
* wallet: walletAddress,
|
|
352
|
+
* amount: '10',
|
|
353
|
+
* wait: true,
|
|
354
|
+
* });
|
|
355
|
+
*
|
|
356
|
+
* // 2. Redeem 10 shares for USDC, requiring at least 9.5 USDC out.
|
|
357
|
+
* await augustSdk.evm.rwaRedeemAsset({
|
|
358
|
+
* target: subaccountAddress,
|
|
359
|
+
* wallet: walletAddress,
|
|
360
|
+
* asset: USDC_ADDRESS,
|
|
361
|
+
* amount: '10',
|
|
362
|
+
* minOut: '9.5',
|
|
363
|
+
* decimals: 18, // vault share decimals
|
|
364
|
+
* outputDecimals: 6, // USDC decimals
|
|
365
|
+
* wait: true,
|
|
366
|
+
* });
|
|
367
|
+
* ```
|
|
368
|
+
*/
|
|
77
369
|
export declare function rwaRedeemAsset(signer: Signer | Wallet, options: IRwaRedeemOptions): Promise<string>;
|
|
370
|
+
/**
|
|
371
|
+
* Swap one or more whitelisted ERC-20s into a vault's reference asset via
|
|
372
|
+
* the on-chain SwapRouter, then deposit the proceeds into the vault.
|
|
373
|
+
*
|
|
374
|
+
* Approval is sent automatically when the caller's allowance on each
|
|
375
|
+
* `swaps[i].tokenIn` against the SwapRouter is below `amountIn`.
|
|
376
|
+
*
|
|
377
|
+
* @param signer - ethers `Signer` or `Wallet` with the EOA that holds the input tokens.
|
|
378
|
+
* @param options - {@link ISwapAndDepositOptions}.
|
|
379
|
+
* @returns The transaction hash of the `swapAndDeposit` call.
|
|
380
|
+
*
|
|
381
|
+
* @throws {@link AugustValidationError} for unsupported chains, invalid
|
|
382
|
+
* addresses, empty/oversized swap arrays.
|
|
383
|
+
* @throws {@link AugustSDKError} on unrecoverable contract or RPC failure.
|
|
384
|
+
*
|
|
385
|
+
* @example
|
|
386
|
+
* ```ts
|
|
387
|
+
* const quote = await fetchSwapQuote({
|
|
388
|
+
* chainId: 1,
|
|
389
|
+
* srcToken: WBTC,
|
|
390
|
+
* srcDecimals: 8,
|
|
391
|
+
* destToken: USDC,
|
|
392
|
+
* destDecimals: 6,
|
|
393
|
+
* amount: 100_000_000n,
|
|
394
|
+
* receiver: SWAP_ROUTER_ADDRESSES[1]!,
|
|
395
|
+
* });
|
|
396
|
+
* const hash = await swapAndDeposit(signer, {
|
|
397
|
+
* chainId: 1,
|
|
398
|
+
* vault: '0x8AcA0841993ef4C87244d519166e767f49362C21',
|
|
399
|
+
* receiver: wallet,
|
|
400
|
+
* swaps: [{
|
|
401
|
+
* tokenIn: WBTC,
|
|
402
|
+
* tokenOut: USDC,
|
|
403
|
+
* amountIn: 100_000_000n,
|
|
404
|
+
* minAmountOut: quote.minAmountOut,
|
|
405
|
+
* router: quote.router,
|
|
406
|
+
* payload: quote.payload,
|
|
407
|
+
* }],
|
|
408
|
+
* });
|
|
409
|
+
* ```
|
|
410
|
+
*/
|
|
78
411
|
export declare function swapAndDeposit(signer: Signer | Wallet, options: ISwapAndDepositOptions): Promise<string>;
|
|
412
|
+
/**
|
|
413
|
+
* Deposit a vault's reference asset directly through the SwapRouter — no
|
|
414
|
+
* swap. Useful when the caller already holds the reference asset but wants
|
|
415
|
+
* the origin/referral fee accounting that only the SwapRouter path provides.
|
|
416
|
+
*
|
|
417
|
+
* @param signer - ethers `Signer` or `Wallet`.
|
|
418
|
+
* @param options - {@link ISwapRouterDirectDepositOptions}.
|
|
419
|
+
* @returns The transaction hash of the `deposit` call.
|
|
420
|
+
*
|
|
421
|
+
* @throws {@link AugustValidationError} for unsupported chains, invalid
|
|
422
|
+
* addresses, or zero amount.
|
|
423
|
+
*/
|
|
79
424
|
export declare function depositViaSwapRouter(signer: Signer | Wallet, options: ISwapRouterDirectDepositOptions): Promise<string>;
|
|
425
|
+
/**
|
|
426
|
+
* Deposit native ETH (or chain-native equivalent) into a vault via the
|
|
427
|
+
* SwapRouter. The router wraps `amount` to the chain's wrapped-native token
|
|
428
|
+
* before depositing — only valid when the vault's reference asset equals
|
|
429
|
+
* the wrapped-native token.
|
|
430
|
+
*
|
|
431
|
+
* No ERC-20 approval is needed; `amount` travels as `msg.value`.
|
|
432
|
+
*
|
|
433
|
+
* @param signer - ethers `Signer` or `Wallet`.
|
|
434
|
+
* @param options - {@link ISwapRouterNativeDepositOptions}.
|
|
435
|
+
* @returns The transaction hash of the `depositNativeToken` call.
|
|
436
|
+
*
|
|
437
|
+
* @throws {@link AugustValidationError} for unsupported chains, invalid
|
|
438
|
+
* addresses, or zero amount.
|
|
439
|
+
*/
|
|
80
440
|
export declare function depositNativeViaSwapRouter(signer: Signer | Wallet, options: ISwapRouterNativeDepositOptions): Promise<string>;
|