@augustdigital/sdk 8.3.2 → 8.6.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/README.md +207 -117
- 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 +266 -4
- package/lib/adapters/evm/index.js +270 -1
- package/lib/adapters/evm/utils.d.ts +6 -0
- package/lib/adapters/evm/utils.js +7 -0
- package/lib/adapters/solana/constants.d.ts +1 -1
- package/lib/adapters/solana/constants.js +4 -1
- package/lib/adapters/solana/getters.d.ts +9 -1
- 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 +59 -4
- package/lib/adapters/solana/index.js +61 -0
- package/lib/adapters/solana/types.d.ts +1 -1
- package/lib/adapters/solana/utils.d.ts +31 -3
- package/lib/adapters/solana/utils.js +79 -4
- package/lib/adapters/solana/vault.actions.d.ts +23 -4
- package/lib/adapters/solana/vault.actions.js +47 -3
- package/lib/adapters/stellar/actions.d.ts +26 -1
- 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 +70 -0
- package/lib/adapters/stellar/index.js +71 -0
- package/lib/adapters/stellar/soroban.d.ts +21 -1
- package/lib/adapters/stellar/soroban.js +47 -1
- package/lib/adapters/stellar/submit.d.ts +29 -0
- package/lib/adapters/stellar/submit.js +90 -5
- 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 +7 -1
- package/lib/adapters/sui/getters.js +6 -0
- package/lib/adapters/sui/index.d.ts +16 -1
- package/lib/adapters/sui/index.js +17 -0
- package/lib/adapters/sui/transformer.d.ts +8 -2
- package/lib/adapters/sui/transformer.js +7 -0
- package/lib/adapters/sui/types.d.ts +1 -1
- 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 +20 -1
- package/lib/core/analytics/sentry.d.ts +47 -2
- package/lib/core/analytics/sentry.js +115 -2
- package/lib/core/analytics/types.d.ts +28 -1
- package/lib/core/analytics/user-identity.d.ts +36 -2
- package/lib/core/analytics/user-identity.js +43 -1
- 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 +78 -3
- package/lib/core/base.class.js +66 -4
- package/lib/core/cache.d.ts +5 -0
- package/lib/core/cache.js +6 -0
- package/lib/core/constants/adapters.d.ts +16 -1
- package/lib/core/constants/adapters.js +28 -8
- package/lib/core/constants/core.d.ts +14 -1
- package/lib/core/constants/core.js +18 -0
- package/lib/core/constants/swap-router.d.ts +83 -1
- package/lib/core/constants/swap-router.js +91 -1
- package/lib/core/constants/vaults.d.ts +57 -1
- package/lib/core/constants/vaults.js +66 -1
- package/lib/core/constants/web3.d.ts +4 -1
- package/lib/core/constants/web3.js +15 -5
- package/lib/core/errors/index.d.ts +38 -2
- package/lib/core/errors/index.js +38 -0
- package/lib/core/fetcher.d.ts +136 -2
- package/lib/core/fetcher.js +229 -25
- package/lib/core/helpers/adapters.d.ts +10 -1
- 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 +49 -4
- package/lib/core/helpers/core.js +74 -7
- package/lib/core/helpers/explorer-link.d.ts +15 -1
- package/lib/core/helpers/explorer-link.js +14 -0
- package/lib/core/helpers/signer.d.ts +27 -1
- package/lib/core/helpers/signer.js +39 -0
- package/lib/core/helpers/swap-router.d.ts +33 -1
- package/lib/core/helpers/swap-router.js +32 -0
- package/lib/core/helpers/vault-version.d.ts +2 -1
- package/lib/core/helpers/vault-version.js +2 -0
- package/lib/core/helpers/vaults.d.ts +9 -1
- package/lib/core/helpers/vaults.js +22 -8
- package/lib/core/helpers/web3.d.ts +154 -2
- package/lib/core/helpers/web3.js +192 -15
- 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 +7 -1
- package/lib/core/vault-metadata.js +6 -0
- package/lib/core/version-check.d.ts +52 -0
- package/lib/core/version-check.js +82 -1
- package/lib/evm/methods/crossChainVault.d.ts +90 -0
- package/lib/evm/methods/crossChainVault.js +187 -2
- 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 +12 -1
- package/lib/index.d.ts +16 -0
- package/lib/index.js +19 -0
- package/lib/main.d.ts +289 -6
- package/lib/main.js +312 -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 +17 -2
- package/lib/modules/sub-accounts/fetcher.js +15 -0
- package/lib/modules/sub-accounts/main.d.ts +35 -2
- package/lib/modules/sub-accounts/main.js +39 -1
- package/lib/modules/sub-accounts/utils.d.ts +4 -1
- package/lib/modules/sub-accounts/utils.js +3 -0
- package/lib/modules/vaults/adapter.helpers.d.ts +21 -3
- package/lib/modules/vaults/adapter.helpers.js +34 -0
- package/lib/modules/vaults/fetcher.d.ts +45 -0
- package/lib/modules/vaults/fetcher.js +91 -4
- package/lib/modules/vaults/getters.d.ts +295 -0
- package/lib/modules/vaults/getters.js +567 -26
- 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 +382 -8
- package/lib/modules/vaults/read.actions.d.ts +170 -2
- 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 +48 -1
- 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 +85 -0
- package/lib/modules/vaults/utils.js +139 -7
- package/lib/modules/vaults/write.actions.d.ts +363 -3
- package/lib/modules/vaults/write.actions.js +399 -3
- package/lib/polyfills.js +4 -2
- package/lib/sdk.d.ts +23847 -0
- package/lib/services/coingecko/fetcher.d.ts +15 -1
- package/lib/services/coingecko/fetcher.js +30 -9
- package/lib/services/debank/fetcher.d.ts +15 -1
- package/lib/services/debank/fetcher.js +12 -0
- package/lib/services/debank/utils.d.ts +1 -1
- package/lib/services/debank/utils.js +18 -1
- package/lib/services/layerzero/deposits.d.ts +12 -1
- package/lib/services/layerzero/deposits.js +34 -11
- package/lib/services/layerzero/redeems.d.ts +11 -1
- 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 +8 -1
- package/lib/services/octavfi/fetcher.js +25 -0
- package/lib/services/octavfi/types.d.ts +1 -1
- package/lib/services/octavfi/utils.d.ts +14 -2
- 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 +119 -2
- package/lib/services/swap-quotes/index.d.ts +80 -0
- package/lib/services/swap-quotes/index.js +27 -1
- package/lib/services/swap-quotes/paraswap.d.ts +25 -0
- package/lib/services/swap-quotes/paraswap.js +22 -0
- package/lib/types/pools.d.ts +5 -2
- package/lib/types/staking.d.ts +1 -1
- package/lib/types/sub-accounts.d.ts +1 -1
- package/lib/types/subgraph.d.ts +10 -1
- package/lib/types/typed-contract.d.ts +64 -0
- package/lib/types/vaults.d.ts +163 -2
- package/lib/types/vaults.js +10 -0
- package/lib/types/web3.d.ts +9 -1
- package/lib/types/web3.js +1 -0
- package/lib/types/webserver.d.ts +47 -2
- package/package.json +6 -5
package/lib/abis/index.d.ts
CHANGED
package/lib/abis/index.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Contract ABI definitions for interacting with August/Upshift smart contracts.
|
|
4
|
+
*
|
|
5
|
+
* @module ABIs
|
|
6
|
+
*/
|
|
2
7
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
8
|
if (k2 === undefined) k2 = k;
|
|
4
9
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
import { ITokenizedVault } from '../../types';
|
|
2
|
-
import { IVaultBaseOptions } from '../../modules/vaults/types';
|
|
1
|
+
import type { ITokenizedVault } from '../../types';
|
|
2
|
+
import type { IVaultBaseOptions } from '../../modules/vaults/types';
|
|
3
|
+
/**
|
|
4
|
+
* Fetch EVM vault data for v1 vault contracts (legacy format).
|
|
5
|
+
* Queries on-chain state and combines with backend metadata.
|
|
6
|
+
* @param tokenizedVault Vault metadata from backend
|
|
7
|
+
* @param options RPC configuration and chain details
|
|
8
|
+
* @returns Formatted vault object or null if closed/invisible
|
|
9
|
+
*/
|
|
3
10
|
export declare const getEvmVaultV1: (tokenizedVault: ITokenizedVault, options: IVaultBaseOptions) => Promise<import("../../types").IVault>;
|
|
11
|
+
/**
|
|
12
|
+
* Fetch EVM vault data for v2 vault contracts (current format).
|
|
13
|
+
* V2 vaults use separate contracts for vault, receipt token, and whitelist.
|
|
14
|
+
* Queries all three contracts and combines results.
|
|
15
|
+
* @param tokenizedVault Vault metadata from backend
|
|
16
|
+
* @param options RPC configuration and chain details
|
|
17
|
+
* @returns Formatted vault object or null if closed/invisible
|
|
18
|
+
*/
|
|
4
19
|
export declare const getEvmVaultV2: (tokenizedVault: ITokenizedVault, options: IVaultBaseOptions) => Promise<import("../../types").IVault>;
|
|
@@ -6,17 +6,29 @@ const core_1 = require("../../core");
|
|
|
6
6
|
const utils_1 = require("../../modules/vaults/utils");
|
|
7
7
|
const TokenizedVaultV2_1 = require("../../abis/TokenizedVaultV2");
|
|
8
8
|
const TokenizedVaultV2Receipt_1 = require("../../abis/TokenizedVaultV2Receipt");
|
|
9
|
+
/**
|
|
10
|
+
* Fetch EVM vault data for v1 vault contracts (legacy format).
|
|
11
|
+
* Queries on-chain state and combines with backend metadata.
|
|
12
|
+
* @param tokenizedVault Vault metadata from backend
|
|
13
|
+
* @param options RPC configuration and chain details
|
|
14
|
+
* @returns Formatted vault object or null if closed/invisible
|
|
15
|
+
*/
|
|
9
16
|
const getEvmVaultV1 = async (tokenizedVault, options) => {
|
|
10
17
|
const vault = tokenizedVault.address;
|
|
11
18
|
if (!vault) {
|
|
12
19
|
throw new Error('Vault address is undefined');
|
|
13
20
|
}
|
|
21
|
+
// Skip closed staging vaults that shouldn't be displayed — unless the caller
|
|
22
|
+
// explicitly opts in (portfolio mode), where a user's position in a closed,
|
|
23
|
+
// invisible vault must still resolve its metadata.
|
|
14
24
|
if (tokenizedVault.status === 'closed' &&
|
|
15
|
-
tokenizedVault.is_visible === false
|
|
25
|
+
tokenizedVault.is_visible === false &&
|
|
26
|
+
!options?.includeClosed) {
|
|
16
27
|
core_1.Logger.log.warn('getEvmVaultV1', `closed: ${tokenizedVault.vault_name}`);
|
|
17
28
|
return null;
|
|
18
29
|
}
|
|
19
30
|
const provider = (0, core_1.createProvider)(options.rpcUrl);
|
|
31
|
+
// Batch fetch all vault contract data
|
|
20
32
|
const vaultContract = (0, core_1.createContract)({
|
|
21
33
|
address: vault,
|
|
22
34
|
abi: abis_1.ABI_LENDING_POOL_V2,
|
|
@@ -45,6 +57,7 @@ const getEvmVaultV1 = async (tokenizedVault, options) => {
|
|
|
45
57
|
}
|
|
46
58
|
return vaultContract[f]();
|
|
47
59
|
}));
|
|
60
|
+
// Normalize contract call results into typed object
|
|
48
61
|
const formattedContractCalls = vaultContractCalls.reduce((acc, curr, i) => {
|
|
49
62
|
let val;
|
|
50
63
|
if (core_1.VAULT_FUNCTIONS_V1[i] === 'maxDepositAmount') {
|
|
@@ -69,6 +82,7 @@ const getEvmVaultV1 = async (tokenizedVault, options) => {
|
|
|
69
82
|
val = Number(curr.toString());
|
|
70
83
|
}
|
|
71
84
|
else if (core_1.VAULT_FUNCTIONS_V1[i] === 'loansOperator') {
|
|
85
|
+
// TODO: hardcoded as we cannot pull the real strategist
|
|
72
86
|
val = '0x4DCb388488622e47683EAd1a147947140a31e485';
|
|
73
87
|
}
|
|
74
88
|
else {
|
|
@@ -76,21 +90,35 @@ const getEvmVaultV1 = async (tokenizedVault, options) => {
|
|
|
76
90
|
}
|
|
77
91
|
return { ...acc, [core_1.VAULT_FUNCTIONS_V1[i]]: val };
|
|
78
92
|
}, {});
|
|
93
|
+
// Combine on-chain and backend data into unified vault object
|
|
79
94
|
const returnObj = await (0, utils_1.buildFormattedVault)(provider, tokenizedVault, formattedContractCalls);
|
|
80
95
|
return returnObj;
|
|
81
96
|
};
|
|
82
97
|
exports.getEvmVaultV1 = getEvmVaultV1;
|
|
98
|
+
/**
|
|
99
|
+
* Fetch EVM vault data for v2 vault contracts (current format).
|
|
100
|
+
* V2 vaults use separate contracts for vault, receipt token, and whitelist.
|
|
101
|
+
* Queries all three contracts and combines results.
|
|
102
|
+
* @param tokenizedVault Vault metadata from backend
|
|
103
|
+
* @param options RPC configuration and chain details
|
|
104
|
+
* @returns Formatted vault object or null if closed/invisible
|
|
105
|
+
*/
|
|
83
106
|
const getEvmVaultV2 = async (tokenizedVault, options) => {
|
|
84
107
|
const provider = (0, core_1.createProvider)(options.rpcUrl);
|
|
85
108
|
const vault = tokenizedVault.address;
|
|
86
109
|
if (!vault) {
|
|
87
110
|
throw new Error('Vault address is undefined');
|
|
88
111
|
}
|
|
112
|
+
// Skip closed staging vaults that shouldn't be displayed — unless the caller
|
|
113
|
+
// explicitly opts in (portfolio mode), where a user's position in a closed,
|
|
114
|
+
// invisible vault must still resolve its metadata.
|
|
89
115
|
if (tokenizedVault.status === 'closed' &&
|
|
90
|
-
tokenizedVault.is_visible === false
|
|
116
|
+
tokenizedVault.is_visible === false &&
|
|
117
|
+
!options?.includeClosed) {
|
|
91
118
|
core_1.Logger.log.warn('getEvmVaultV2', `closed: ${tokenizedVault.vault_name}`);
|
|
92
119
|
return null;
|
|
93
120
|
}
|
|
121
|
+
// Fetch vault contract state
|
|
94
122
|
const vaultContract = (0, core_1.createContract)({
|
|
95
123
|
address: vault,
|
|
96
124
|
abi: TokenizedVaultV2_1.ABI_TOKENIZED_VAULT_V2,
|
|
@@ -110,7 +138,7 @@ const getEvmVaultV2 = async (tokenizedVault, options) => {
|
|
|
110
138
|
const receiptAddress = vaultContractCalls[core_1.VAULT_FUNCTIONS_V2.length - 1];
|
|
111
139
|
const whitelistedAssetsAddress = vaultContractCalls[0];
|
|
112
140
|
const reciptContract = (0, core_1.createContract)({
|
|
113
|
-
address: receiptAddress,
|
|
141
|
+
address: receiptAddress, // lpTokenAddress
|
|
114
142
|
abi: TokenizedVaultV2Receipt_1.ABI_TOKENIZED_VAULT_V2_RECEIPT,
|
|
115
143
|
provider,
|
|
116
144
|
});
|
|
@@ -127,6 +155,7 @@ const getEvmVaultV2 = async (tokenizedVault, options) => {
|
|
|
127
155
|
(0, core_1.getWhitelistedAssets)(provider, whitelistedAssetsAddress),
|
|
128
156
|
]);
|
|
129
157
|
const whitelistedAssetsContractCalls = [whitelistedList];
|
|
158
|
+
// Merge all contract call results
|
|
130
159
|
const combinedCalls = [
|
|
131
160
|
...vaultContractCalls,
|
|
132
161
|
...receiptContractCalls,
|
|
@@ -137,6 +166,7 @@ const getEvmVaultV2 = async (tokenizedVault, options) => {
|
|
|
137
166
|
...core_1.VAULT_FUNCTIONS_V2_RECEIPT,
|
|
138
167
|
...core_1.VAULT_FUNCTIONS_V2_WHITELISTED_ASSETS,
|
|
139
168
|
];
|
|
169
|
+
// Normalize all contract results with proper decimal handling
|
|
140
170
|
const formattedContractCalls = combinedCalls.reduce((acc, curr, i) => {
|
|
141
171
|
let val;
|
|
142
172
|
if (combinedFunctions[i] === 'depositCap') {
|
|
@@ -163,6 +193,7 @@ const getEvmVaultV2 = async (tokenizedVault, options) => {
|
|
|
163
193
|
val = Number(curr.toString());
|
|
164
194
|
}
|
|
165
195
|
else if (combinedFunctions[i] === 'loansOperator') {
|
|
196
|
+
// @hardcoded: we cannot pull the real strategist
|
|
166
197
|
val = '0x4DCb388488622e47683EAd1a147947140a31e485';
|
|
167
198
|
}
|
|
168
199
|
else {
|
|
@@ -170,6 +201,7 @@ const getEvmVaultV2 = async (tokenizedVault, options) => {
|
|
|
170
201
|
}
|
|
171
202
|
return { ...acc, [combinedFunctions[i]]: val };
|
|
172
203
|
}, {});
|
|
204
|
+
// Combine on-chain and backend data into unified vault object
|
|
173
205
|
const returnObj = await (0, utils_1.buildFormattedVault)(provider, tokenizedVault, formattedContractCalls);
|
|
174
206
|
return returnObj;
|
|
175
207
|
};
|
|
@@ -1,24 +1,225 @@
|
|
|
1
|
-
import { IContractWriteOptions, INativeDepositOptions, ApproveResult } from '../../modules/vaults/write.actions';
|
|
1
|
+
import { type IContractWriteOptions, type INativeDepositOptions, type ApproveResult } from '../../modules/vaults/write.actions';
|
|
2
2
|
import type { ISwapAndDepositOptions, ISwapRouterDirectDepositOptions, ISwapRouterNativeDepositOptions } from '../../types';
|
|
3
|
-
import { IPreviewDepositOptions, IPreviewRedeemOptions, IAllowanceOptions, IBalanceOfOptions, IMaxDepositOptions } from '../../modules/vaults/read.actions';
|
|
4
|
-
import { CompatibleSigner } from '../../core/helpers/signer';
|
|
5
|
-
import { IAddress } from '../../types';
|
|
3
|
+
import { type IPreviewDepositOptions, type IPreviewRedeemOptions, type IAllowanceOptions, type IBalanceOfOptions, type IMaxDepositOptions } from '../../modules/vaults/read.actions';
|
|
4
|
+
import { type CompatibleSigner } from '../../core/helpers/signer';
|
|
5
|
+
import type { IAddress } from '../../types';
|
|
6
6
|
export * from './getters';
|
|
7
|
+
/**
|
|
8
|
+
* EVM Adapter for August SDK
|
|
9
|
+
* Supports both ethers Signer/Wallet and wagmi/viem WalletClient
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* To access the EVM adapter instance
|
|
13
|
+
* ```
|
|
14
|
+
* const sdk = new AugustSDK()
|
|
15
|
+
* sdk.evm.vaultRedeem()
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
7
18
|
declare class EVMAdapter {
|
|
8
19
|
private signer?;
|
|
9
20
|
private rawSigner?;
|
|
10
21
|
constructor(signer?: CompatibleSigner);
|
|
22
|
+
/**
|
|
23
|
+
* Set a new signer (supports both ethers and viem/wagmi)
|
|
24
|
+
* @param signer - Either an ethers Signer/Wallet or viem WalletClient
|
|
25
|
+
*/
|
|
11
26
|
setSigner(signer: CompatibleSigner): void;
|
|
27
|
+
/**
|
|
28
|
+
* Get the normalized ethers-compatible signer
|
|
29
|
+
* Converts viem WalletClient to ethers Signer if needed
|
|
30
|
+
*/
|
|
12
31
|
private getSigner;
|
|
13
32
|
vaultApprove(options: IContractWriteOptions): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Approve a vault to spend a deposit token, returning a discriminated
|
|
35
|
+
* {@link ApproveResult} so callers can tell `sent` from `sufficient`
|
|
36
|
+
* (existing allowance covers) and `native` (no allowance applies).
|
|
37
|
+
* Prefer this over {@link vaultApprove} for new integrations.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* const r = await augustSdk.evm.approve({
|
|
42
|
+
* target: vaultAddress,
|
|
43
|
+
* wallet: walletAddress,
|
|
44
|
+
* amount: '100',
|
|
45
|
+
* wait: true,
|
|
46
|
+
* });
|
|
47
|
+
* if (r.kind === 'sent') console.log('approve tx', r.hash);
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
14
50
|
approve(options: IContractWriteOptions): Promise<ApproveResult>;
|
|
51
|
+
/**
|
|
52
|
+
* Read the ERC-20 allowance the wallet has granted the vault to spend its
|
|
53
|
+
* underlying asset, returned as a normalized number. For the newer typed
|
|
54
|
+
* read that returns a raw `bigint` and accepts an explicit `asset` override,
|
|
55
|
+
* use {@link EVMAdapter.allowance}.
|
|
56
|
+
*
|
|
57
|
+
* Only `target` (vault address) and `wallet` are read from `options`; the
|
|
58
|
+
* remaining {@link IContractWriteOptions} fields are ignored.
|
|
59
|
+
*
|
|
60
|
+
* @param options - `{ target, wallet }` (other fields ignored).
|
|
61
|
+
* @returns Normalized allowance (`{ raw, normalized }`), or `undefined` when
|
|
62
|
+
* `target` / `wallet` fail address validation.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* const a = await augustSdk.evm.vaultAllowance({
|
|
67
|
+
* target: vaultAddress,
|
|
68
|
+
* wallet: walletAddress,
|
|
69
|
+
* });
|
|
70
|
+
* console.log(a?.normalized);
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
15
73
|
vaultAllowance(options: IContractWriteOptions): Promise<import("../../types").INormalizedNumber>;
|
|
74
|
+
/**
|
|
75
|
+
* Deposit into an August vault. Routes automatically: V1 single-asset vaults
|
|
76
|
+
* deposit the underlying directly; V2 multi-asset vaults route through the
|
|
77
|
+
* adapter for non-underlying `depositAsset`. If allowance is insufficient
|
|
78
|
+
* the method submits an approve transaction first (the approve step always
|
|
79
|
+
* waits for confirmation to close a race window, regardless of `wait`).
|
|
80
|
+
*
|
|
81
|
+
* @param options - {@link IContractWriteOptions}. `target` and `wallet` are
|
|
82
|
+
* required; pass `amount`, `depositAsset` (defaults to the vault's
|
|
83
|
+
* underlying), `chainId`, `poolName`, `wait`, and `isDepositWithPermit`
|
|
84
|
+
* as needed.
|
|
85
|
+
* @returns The deposit `TransactionResponse`, or `undefined` if an
|
|
86
|
+
* approval-only path was taken and no deposit transaction was sent.
|
|
87
|
+
* @throws AugustValidationError on invalid inputs (bad address, bad amount).
|
|
88
|
+
* @throws AugustSDKError on RPC / contract revert during the deposit.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* const tx = await augustSdk.evm.vaultDeposit({
|
|
93
|
+
* target: vaultAddress,
|
|
94
|
+
* wallet: walletAddress,
|
|
95
|
+
* amount: '100',
|
|
96
|
+
* wait: true,
|
|
97
|
+
* });
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
16
100
|
vaultDeposit(options: IContractWriteOptions): Promise<string>;
|
|
101
|
+
/**
|
|
102
|
+
* Submit a redemption request against a vault. Shares are escrowed and the
|
|
103
|
+
* underlying assets are released asynchronously by the protocol; callers
|
|
104
|
+
* collect the matured assets via {@link EVMAdapter.vaultRedeem}, or use the
|
|
105
|
+
* instant-redeem variant by setting `isInstantRedeem: true`.
|
|
106
|
+
*
|
|
107
|
+
* @param options - {@link IContractWriteOptions}. `target`, `wallet`, and
|
|
108
|
+
* `amount` (in shares) are required. Set `isInstantRedeem: true` to take
|
|
109
|
+
* the instant-redeem path when the vault supports it.
|
|
110
|
+
* @returns The request `TransactionResponse`, or `undefined` if the request
|
|
111
|
+
* could not be built (validation failure).
|
|
112
|
+
* @throws AugustValidationError on invalid inputs.
|
|
113
|
+
* @throws AugustSDKError on RPC / contract revert.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* const tx = await augustSdk.evm.vaultRequestRedeem({
|
|
118
|
+
* target: vaultAddress,
|
|
119
|
+
* wallet: walletAddress,
|
|
120
|
+
* amount: shareAmount,
|
|
121
|
+
* wait: true,
|
|
122
|
+
* });
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
17
125
|
vaultRequestRedeem(options: IContractWriteOptions): Promise<string>;
|
|
126
|
+
/**
|
|
127
|
+
* Deposit the chain's native asset (ETH / AVAX / etc.) into a vault by
|
|
128
|
+
* routing through the `MultiAssetNativeDepositWrapper`. The wrapper handles
|
|
129
|
+
* native-to-wrapped conversion and the subsequent vault deposit in a single
|
|
130
|
+
* transaction.
|
|
131
|
+
*
|
|
132
|
+
* @param options - {@link INativeDepositOptions}: `wrapperAddress`, `amount`
|
|
133
|
+
* (native, scaled by the chain's native decimals), optional `receiver`
|
|
134
|
+
* (defaults to the signer), and optional `wait`.
|
|
135
|
+
* @returns The deposit `TransactionResponse`.
|
|
136
|
+
* @throws AugustValidationError on invalid inputs.
|
|
137
|
+
* @throws AugustSDKError on RPC / contract revert.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* const tx = await augustSdk.evm.depositNative({
|
|
142
|
+
* wrapperAddress: nativeWrapperAddress,
|
|
143
|
+
* amount: parseEther('1'),
|
|
144
|
+
* wait: true,
|
|
145
|
+
* });
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
18
148
|
depositNative(options: INativeDepositOptions): Promise<string>;
|
|
149
|
+
/**
|
|
150
|
+
* Swap one or more whitelisted ERC-20s into a vault's reference asset via
|
|
151
|
+
* the on-chain `SwapRouter` and deposit the proceeds. The router handles
|
|
152
|
+
* fee accrual, slippage protection, and the v1/v3 vs v2 deposit-interface
|
|
153
|
+
* branching. Approval is sent automatically for each `swaps[i].tokenIn`
|
|
154
|
+
* when the caller's allowance against the SwapRouter is below `amountIn`.
|
|
155
|
+
*
|
|
156
|
+
* @param options - {@link ISwapAndDepositOptions}.
|
|
157
|
+
* @returns The transaction hash of the `swapAndDeposit` call.
|
|
158
|
+
* @throws AugustValidationError on invalid inputs (bad chain, empty swaps).
|
|
159
|
+
* @throws AugustSDKError on RPC / contract revert.
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```ts
|
|
163
|
+
* const quote = await fetchSwapQuote({
|
|
164
|
+
* chainId: 1, srcToken: WBTC, srcDecimals: 8,
|
|
165
|
+
* destToken: USDC, destDecimals: 6, amount: 100_000_000n,
|
|
166
|
+
* receiver: SWAP_ROUTER_ADDRESSES[1]!,
|
|
167
|
+
* });
|
|
168
|
+
* const hash = await augustSdk.evm.swapAndDeposit({
|
|
169
|
+
* chainId: 1, vault, receiver: wallet,
|
|
170
|
+
* swaps: [{ tokenIn: WBTC, tokenOut: USDC, amountIn: 100_000_000n,
|
|
171
|
+
* minAmountOut: quote.minAmountOut, router: quote.router, payload: quote.payload }],
|
|
172
|
+
* });
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
19
175
|
swapAndDeposit(options: ISwapAndDepositOptions): Promise<string>;
|
|
176
|
+
/**
|
|
177
|
+
* Deposit a vault's reference asset through the SwapRouter — no swap.
|
|
178
|
+
* Use this when the caller already holds the reference asset but wants
|
|
179
|
+
* the origin/referral fee accounting that the SwapRouter path provides.
|
|
180
|
+
*
|
|
181
|
+
* @param options - {@link ISwapRouterDirectDepositOptions}.
|
|
182
|
+
* @returns The transaction hash of the `deposit` call.
|
|
183
|
+
*/
|
|
20
184
|
depositViaSwapRouter(options: ISwapRouterDirectDepositOptions): Promise<string>;
|
|
185
|
+
/**
|
|
186
|
+
* Deposit native ETH (or chain-native equivalent) into a vault via the
|
|
187
|
+
* SwapRouter. Only valid when the vault's reference asset is the chain's
|
|
188
|
+
* wrapped-native token — the SwapRouter wraps `amount` and deposits.
|
|
189
|
+
*
|
|
190
|
+
* @param options - {@link ISwapRouterNativeDepositOptions}.
|
|
191
|
+
* @returns The transaction hash of the `depositNativeToken` call.
|
|
192
|
+
*/
|
|
21
193
|
depositNativeViaSwapRouter(options: ISwapRouterNativeDepositOptions): Promise<string>;
|
|
194
|
+
/**
|
|
195
|
+
* Claim assets from a matured redemption request on a dated-redemption
|
|
196
|
+
* (RWA-style) vault. The `year`, `month`, `day`, and `receiverIndex` tuple
|
|
197
|
+
* identifies which batch of the user's matured requests to redeem from —
|
|
198
|
+
* these are emitted at request-time and indexed by the subgraph.
|
|
199
|
+
*
|
|
200
|
+
* For non-dated vaults that complete their redemption via `instantRedeem`,
|
|
201
|
+
* see {@link EVMAdapter.vaultRequestRedeem} with `isInstantRedeem: true`.
|
|
202
|
+
*
|
|
203
|
+
* @param options - {@link IContractWriteOptions} plus `year` / `month` /
|
|
204
|
+
* `day` / `receiverIndex` identifying the matured batch to claim.
|
|
205
|
+
* @returns The redeem `TransactionResponse`.
|
|
206
|
+
* @throws AugustValidationError on invalid inputs.
|
|
207
|
+
* @throws AugustSDKError on RPC / contract revert.
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```ts
|
|
211
|
+
* const tx = await augustSdk.evm.vaultRedeem({
|
|
212
|
+
* target: vaultAddress,
|
|
213
|
+
* wallet: walletAddress,
|
|
214
|
+
* amount: shareAmount,
|
|
215
|
+
* year: '2026',
|
|
216
|
+
* month: '06',
|
|
217
|
+
* day: '02',
|
|
218
|
+
* receiverIndex: '0',
|
|
219
|
+
* wait: true,
|
|
220
|
+
* });
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
22
223
|
vaultRedeem(options: IContractWriteOptions & {
|
|
23
224
|
year: string;
|
|
24
225
|
month: string;
|
|
@@ -43,10 +244,71 @@ declare class EVMAdapter {
|
|
|
43
244
|
vault: IAddress;
|
|
44
245
|
depositCapAmount?: bigint;
|
|
45
246
|
}): Promise<import("../../types").INormalizedNumber>;
|
|
247
|
+
/**
|
|
248
|
+
* Preview the share output of a deposit without broadcasting a transaction.
|
|
249
|
+
* See {@link readPreviewDeposit} for the routing details (EVM-1 vs EVM-2
|
|
250
|
+
* multi-asset vaults).
|
|
251
|
+
*
|
|
252
|
+
* @returns Shares minted in raw on-chain units (share-token decimals).
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* ```ts
|
|
256
|
+
* const shares = await augustSdk.evm.previewDeposit({
|
|
257
|
+
* vault: '0x...',
|
|
258
|
+
* amount: 1_000_000n,
|
|
259
|
+
* });
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
46
262
|
previewDeposit(options: IPreviewDepositOptions): Promise<bigint>;
|
|
263
|
+
/**
|
|
264
|
+
* Preview the assets returned by redeeming a number of shares, without
|
|
265
|
+
* broadcasting a transaction.
|
|
266
|
+
*
|
|
267
|
+
* @returns Assets returned in raw on-chain units (asset decimals).
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* ```ts
|
|
271
|
+
* const assets = await augustSdk.evm.previewRedeem({
|
|
272
|
+
* vault: '0x...',
|
|
273
|
+
* shares: 1_000_000_000_000_000_000n,
|
|
274
|
+
* });
|
|
275
|
+
* ```
|
|
276
|
+
*/
|
|
47
277
|
previewRedeem(options: IPreviewRedeemOptions): Promise<bigint>;
|
|
278
|
+
/**
|
|
279
|
+
* Read the ERC-20 allowance an owner has granted the vault. Defaults to the
|
|
280
|
+
* vault's underlying asset; pass `asset` to override.
|
|
281
|
+
*
|
|
282
|
+
* @returns Allowance as a raw `bigint`.
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* ```ts
|
|
286
|
+
* const raw = await augustSdk.evm.allowance({ vault, owner });
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
48
289
|
allowance(options: IAllowanceOptions): Promise<bigint>;
|
|
290
|
+
/**
|
|
291
|
+
* Read an ERC-20 token balance.
|
|
292
|
+
*
|
|
293
|
+
* @returns Balance as a raw `bigint`.
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* ```ts
|
|
297
|
+
* const raw = await augustSdk.evm.balanceOf({ asset: usdcAddress, owner });
|
|
298
|
+
* ```
|
|
299
|
+
*/
|
|
49
300
|
balanceOf(options: IBalanceOfOptions): Promise<bigint>;
|
|
301
|
+
/**
|
|
302
|
+
* Read the maximum deposit accepted by the vault for the supplied
|
|
303
|
+
* receiver. Useful for "vault is full" gates.
|
|
304
|
+
*
|
|
305
|
+
* @returns Max deposit as a raw `bigint`.
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```ts
|
|
309
|
+
* const cap = await augustSdk.evm.maxDeposit({ vault });
|
|
310
|
+
* ```
|
|
311
|
+
*/
|
|
50
312
|
maxDeposit(options: IMaxDepositOptions): Promise<bigint>;
|
|
51
313
|
}
|
|
52
314
|
export default EVMAdapter;
|