@augustdigital/sdk 7.0.1 → 8.2.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/SwapRouter.d.ts +1042 -0
- package/lib/abis/SwapRouter.js +739 -0
- package/lib/abis/index.d.ts +1 -0
- package/lib/abis/index.js +1 -0
- package/lib/adapters/evm/index.d.ts +4 -0
- package/lib/adapters/evm/index.js +12 -0
- package/lib/adapters/stellar/types.d.ts +0 -1
- package/lib/core/analytics/method-taxonomy.js +3 -0
- package/lib/core/analytics/version.d.ts +1 -1
- package/lib/core/analytics/version.js +1 -1
- package/lib/core/base.class.d.ts +0 -1
- package/lib/core/constants/swap-router.d.ts +8 -0
- package/lib/core/constants/swap-router.js +18 -0
- package/lib/core/helpers/swap-router.d.ts +4 -0
- package/lib/core/helpers/swap-router.js +22 -0
- package/lib/core/index.d.ts +2 -0
- package/lib/core/index.js +2 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/main.d.ts +2 -1
- package/lib/main.js +1 -1
- package/lib/modules/vaults/fetcher.js +2 -2
- package/lib/modules/vaults/getters.d.ts +5 -14
- package/lib/modules/vaults/getters.js +54 -13
- package/lib/modules/vaults/main.d.ts +1 -1
- package/lib/modules/vaults/main.js +3 -1
- package/lib/modules/vaults/write.actions.d.ts +7 -0
- package/lib/modules/vaults/write.actions.js +260 -1
- package/lib/services/coingecko/fetcher.js +15 -5
- package/lib/services/debank/fetcher.js +6 -3
- package/lib/services/debank/utils.js +7 -6
- package/lib/services/octavfi/fetcher.js +10 -5
- package/lib/services/subgraph/vaults.js +6 -6
- package/lib/services/swap-quotes/index.d.ts +25 -0
- package/lib/services/swap-quotes/index.js +51 -0
- package/lib/services/swap-quotes/paraswap.d.ts +26 -0
- package/lib/services/swap-quotes/paraswap.js +116 -0
- package/lib/types/vaults.d.ts +40 -0
- package/lib/types/vaults.js +6 -1
- package/lib/types/web3.d.ts +0 -1
- package/package.json +1 -1
package/lib/abis/index.d.ts
CHANGED
package/lib/abis/index.js
CHANGED
|
@@ -42,4 +42,5 @@ __exportStar(require("./MultiAssetNativeDepositWrapper"), exports);
|
|
|
42
42
|
__exportStar(require("./TokenizedVaultV2SenderAllocationWhitelist"), exports);
|
|
43
43
|
__exportStar(require("./RwaRedeemSubaccount"), exports);
|
|
44
44
|
__exportStar(require("./OFT"), exports);
|
|
45
|
+
__exportStar(require("./SwapRouter"), exports);
|
|
45
46
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IContractWriteOptions, INativeDepositOptions, ApproveResult } from '../../modules/vaults/write.actions';
|
|
2
|
+
import type { ISwapAndDepositOptions, ISwapRouterDirectDepositOptions, ISwapRouterNativeDepositOptions } from '../../types';
|
|
2
3
|
import { IPreviewDepositOptions, IPreviewRedeemOptions, IAllowanceOptions, IBalanceOfOptions, IMaxDepositOptions } from '../../modules/vaults/read.actions';
|
|
3
4
|
import { CompatibleSigner } from '../../core/helpers/signer';
|
|
4
5
|
import { IAddress } from '../../types';
|
|
@@ -15,6 +16,9 @@ declare class EVMAdapter {
|
|
|
15
16
|
vaultDeposit(options: IContractWriteOptions): Promise<string>;
|
|
16
17
|
vaultRequestRedeem(options: IContractWriteOptions): Promise<string>;
|
|
17
18
|
depositNative(options: INativeDepositOptions): Promise<string>;
|
|
19
|
+
swapAndDeposit(options: ISwapAndDepositOptions): Promise<string>;
|
|
20
|
+
depositViaSwapRouter(options: ISwapRouterDirectDepositOptions): Promise<string>;
|
|
21
|
+
depositNativeViaSwapRouter(options: ISwapRouterNativeDepositOptions): Promise<string>;
|
|
18
22
|
vaultRedeem(options: IContractWriteOptions & {
|
|
19
23
|
year: string;
|
|
20
24
|
month: string;
|
|
@@ -60,6 +60,18 @@ class EVMAdapter {
|
|
|
60
60
|
const signer = await this.getSigner();
|
|
61
61
|
return (0, write_actions_1.depositNative)(signer, options);
|
|
62
62
|
}
|
|
63
|
+
async swapAndDeposit(options) {
|
|
64
|
+
const signer = await this.getSigner();
|
|
65
|
+
return (0, write_actions_1.swapAndDeposit)(signer, options);
|
|
66
|
+
}
|
|
67
|
+
async depositViaSwapRouter(options) {
|
|
68
|
+
const signer = await this.getSigner();
|
|
69
|
+
return (0, write_actions_1.depositViaSwapRouter)(signer, options);
|
|
70
|
+
}
|
|
71
|
+
async depositNativeViaSwapRouter(options) {
|
|
72
|
+
const signer = await this.getSigner();
|
|
73
|
+
return (0, write_actions_1.depositNativeViaSwapRouter)(signer, options);
|
|
74
|
+
}
|
|
63
75
|
async vaultRedeem(options) {
|
|
64
76
|
const signer = await this.getSigner();
|
|
65
77
|
return (0, write_actions_1.vaultRedeem)(signer, options);
|
|
@@ -65,6 +65,9 @@ exports.METHOD_CATEGORIES = {
|
|
|
65
65
|
maxDeposit: 'read.vault',
|
|
66
66
|
vaultDeposit: 'write.deposit',
|
|
67
67
|
depositNative: 'write.deposit',
|
|
68
|
+
swapAndDeposit: 'write.deposit',
|
|
69
|
+
depositViaSwapRouter: 'write.deposit',
|
|
70
|
+
depositNativeViaSwapRouter: 'write.deposit',
|
|
68
71
|
vaultRedeem: 'write.redeem',
|
|
69
72
|
vaultRequestRedeem: 'write.redeem',
|
|
70
73
|
rwaRedeemAsset: 'write.redeem',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "
|
|
1
|
+
export declare const SDK_VERSION = "8.2.0";
|
package/lib/core/base.class.d.ts
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IAddress } from '../../types';
|
|
2
|
+
export declare const SWAP_ROUTER_ADDRESSES: Readonly<Record<number, IAddress>>;
|
|
3
|
+
export declare const VAULTS_USING_SWAP_ROUTER: ReadonlySet<string>;
|
|
4
|
+
export declare const ORIGIN_CODES: {
|
|
5
|
+
readonly default: `0x${string}`;
|
|
6
|
+
};
|
|
7
|
+
export declare const SWAP_ROUTER_MAX_SWAPS = 9;
|
|
8
|
+
export declare const SWAP_ROUTER_WRAPPED_NATIVE: Readonly<Record<number, IAddress>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SWAP_ROUTER_WRAPPED_NATIVE = exports.SWAP_ROUTER_MAX_SWAPS = exports.ORIGIN_CODES = exports.VAULTS_USING_SWAP_ROUTER = exports.SWAP_ROUTER_ADDRESSES = void 0;
|
|
4
|
+
exports.SWAP_ROUTER_ADDRESSES = {
|
|
5
|
+
1: '0xAC771209FF2b71EECfF6E85a9AD01db8Ff2618B0',
|
|
6
|
+
};
|
|
7
|
+
exports.VAULTS_USING_SWAP_ROUTER = new Set([
|
|
8
|
+
'0xe9b725010a9e419412ed67d0fa5f3a5f40159d32',
|
|
9
|
+
'0x74ad2f789ed583dbd141bbdafc673fe1f033718b',
|
|
10
|
+
]);
|
|
11
|
+
exports.ORIGIN_CODES = {
|
|
12
|
+
default: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
13
|
+
};
|
|
14
|
+
exports.SWAP_ROUTER_MAX_SWAPS = 9;
|
|
15
|
+
exports.SWAP_ROUTER_WRAPPED_NATIVE = {
|
|
16
|
+
1: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=swap-router.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IAddress } from '../../types';
|
|
2
|
+
export declare function getSwapRouterAddress(chainId: number): IAddress | undefined;
|
|
3
|
+
export declare function vaultUsesSwapRouter(vaultAddress: IAddress): boolean;
|
|
4
|
+
export declare function resolveOriginCode(provided?: `0x${string}`): `0x${string}`;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSwapRouterAddress = getSwapRouterAddress;
|
|
4
|
+
exports.vaultUsesSwapRouter = vaultUsesSwapRouter;
|
|
5
|
+
exports.resolveOriginCode = resolveOriginCode;
|
|
6
|
+
const swap_router_1 = require("../constants/swap-router");
|
|
7
|
+
const errors_1 = require("../errors");
|
|
8
|
+
function getSwapRouterAddress(chainId) {
|
|
9
|
+
return swap_router_1.SWAP_ROUTER_ADDRESSES[chainId];
|
|
10
|
+
}
|
|
11
|
+
function vaultUsesSwapRouter(vaultAddress) {
|
|
12
|
+
return swap_router_1.VAULTS_USING_SWAP_ROUTER.has(vaultAddress.toLowerCase());
|
|
13
|
+
}
|
|
14
|
+
function resolveOriginCode(provided) {
|
|
15
|
+
if (provided === undefined)
|
|
16
|
+
return swap_router_1.ORIGIN_CODES.default;
|
|
17
|
+
if (!/^0x[0-9a-fA-F]{64}$/.test(provided)) {
|
|
18
|
+
throw new errors_1.AugustValidationError('INVALID_INPUT', `resolveOriginCode: originCode must be a 32-byte hex string (66 chars incl. 0x), got "${provided}" (${provided.length} chars)`, { context: { provided, expectedLength: 66 } });
|
|
19
|
+
}
|
|
20
|
+
return provided;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=swap-router.js.map
|
package/lib/core/index.d.ts
CHANGED
|
@@ -9,8 +9,10 @@ export * from './constants/adapters';
|
|
|
9
9
|
export * from './constants/core';
|
|
10
10
|
export * from './constants/web3';
|
|
11
11
|
export * from './constants/vaults';
|
|
12
|
+
export * from './constants/swap-router';
|
|
12
13
|
export * from './helpers/web3';
|
|
13
14
|
export * from './helpers/vaults';
|
|
14
15
|
export * from './helpers/core';
|
|
15
16
|
export * from './helpers/adapters';
|
|
16
17
|
export * from './helpers/signer';
|
|
18
|
+
export * from './helpers/swap-router';
|
package/lib/core/index.js
CHANGED
|
@@ -25,9 +25,11 @@ __exportStar(require("./constants/adapters"), exports);
|
|
|
25
25
|
__exportStar(require("./constants/core"), exports);
|
|
26
26
|
__exportStar(require("./constants/web3"), exports);
|
|
27
27
|
__exportStar(require("./constants/vaults"), exports);
|
|
28
|
+
__exportStar(require("./constants/swap-router"), exports);
|
|
28
29
|
__exportStar(require("./helpers/web3"), exports);
|
|
29
30
|
__exportStar(require("./helpers/vaults"), exports);
|
|
30
31
|
__exportStar(require("./helpers/core"), exports);
|
|
31
32
|
__exportStar(require("./helpers/adapters"), exports);
|
|
32
33
|
__exportStar(require("./helpers/signer"), exports);
|
|
34
|
+
__exportStar(require("./helpers/swap-router"), exports);
|
|
33
35
|
//# sourceMappingURL=index.js.map
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -20,6 +20,7 @@ __exportStar(require("./types"), exports);
|
|
|
20
20
|
__exportStar(require("./core"), exports);
|
|
21
21
|
__exportStar(require("./abis"), exports);
|
|
22
22
|
__exportStar(require("./services/debank"), exports);
|
|
23
|
+
__exportStar(require("./services/swap-quotes"), exports);
|
|
23
24
|
__exportStar(require("./modules/vaults"), exports);
|
|
24
25
|
__exportStar(require("./modules/sub-accounts"), exports);
|
|
25
26
|
__exportStar(require("./evm"), exports);
|
package/lib/main.d.ts
CHANGED
|
@@ -138,7 +138,8 @@ export declare class AugustSDK extends AugustBase {
|
|
|
138
138
|
}): Promise<import("./types").IActiveStakingPosition[]>;
|
|
139
139
|
getVaultBorrowerHealthFactor(props?: {
|
|
140
140
|
chainId?: IChainId;
|
|
141
|
-
|
|
141
|
+
vault?: IAddress;
|
|
142
|
+
}): Promise<Record<string, import("./types").IVaultBorrowerHealthFactor[]> | Record<string, import("./types").IVaultBorrowerHealthFactor[]>[]>;
|
|
142
143
|
getUserPoints(userAddress: IAddress): Promise<any>;
|
|
143
144
|
registerUserForPoints(userAddress: IAddress, referrerAddress: IAddress | undefined, chainId: number, signature: string, nonce: string, expiry: number): Promise<Response>;
|
|
144
145
|
fetchPointsLeaderboard(params?: {
|
package/lib/main.js
CHANGED
|
@@ -170,7 +170,7 @@ class AugustSDK extends core_1.AugustBase {
|
|
|
170
170
|
return await this.vaults.getStakingPositions(props.wallet, props.chainId);
|
|
171
171
|
}
|
|
172
172
|
async getVaultBorrowerHealthFactor(props) {
|
|
173
|
-
return await this.vaults.getVaultBorrowerHealthFactor(props?.chainId);
|
|
173
|
+
return await this.vaults.getVaultBorrowerHealthFactor(props?.chainId, props?.vault);
|
|
174
174
|
}
|
|
175
175
|
async getUserPoints(userAddress) {
|
|
176
176
|
return await this.vaults.getUserPoints(userAddress);
|
|
@@ -54,7 +54,7 @@ async function fetchVaultsBatch(vaults, options = {}) {
|
|
|
54
54
|
maxRetries,
|
|
55
55
|
baseDelay,
|
|
56
56
|
});
|
|
57
|
-
if (result.success
|
|
57
|
+
if (result.success) {
|
|
58
58
|
successful.push({
|
|
59
59
|
index: globalIndex,
|
|
60
60
|
data: result.data,
|
|
@@ -64,7 +64,7 @@ async function fetchVaultsBatch(vaults, options = {}) {
|
|
|
64
64
|
else {
|
|
65
65
|
failed.push({
|
|
66
66
|
index: globalIndex,
|
|
67
|
-
error: result.error
|
|
67
|
+
error: result.error ?? new Error('Unknown failure'),
|
|
68
68
|
address: vault.address,
|
|
69
69
|
});
|
|
70
70
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IAddress, IHistoricalTimeseriesResponse, INormalizedNumber, ISubgraphWithdrawProccessed, IVault, IVaultAllocations, IVaultAnnualizedApy, IVaultAvailableRedemption, IVaultLoan, IVaultPosition, IVaultRedemptionHistoryItem, IVaultSummary, IVaultWithdrawals, IVaultPendingRedemptions, IActiveStakingPosition, IVaultHistoricalParams, IVaultUserLifetimePnl, IVaultPnl, VaultAddress } from '../../types';
|
|
1
|
+
import { IAddress, IHistoricalTimeseriesResponse, INormalizedNumber, ISubgraphWithdrawProccessed, IVault, IVaultAllocations, IVaultAnnualizedApy, IVaultAvailableRedemption, IVaultLoan, IVaultPosition, IVaultRedemptionHistoryItem, IVaultSummary, IVaultWithdrawals, IVaultPendingRedemptions, IActiveStakingPosition, IVaultHistoricalParams, IVaultUserLifetimePnl, IVaultBorrowerHealthFactor, IVaultPnl, VaultAddress } from '../../types';
|
|
2
2
|
import { IVaultBaseOptions } from './types';
|
|
3
3
|
export declare function getVault({ vault, loans, allocations, options, loadSubaccounts, loadSnapshots, }: {
|
|
4
4
|
vault: IAddress;
|
|
@@ -60,20 +60,11 @@ export declare function getVaultTvl({ vault, options, historical, }: {
|
|
|
60
60
|
export declare function getVaultBorrowerHealthFactor({ vault, options, }: {
|
|
61
61
|
vault: IAddress;
|
|
62
62
|
options: IVaultBaseOptions;
|
|
63
|
-
}): Promise<
|
|
64
|
-
|
|
65
|
-
loan: IAddress;
|
|
66
|
-
health_factor?: {
|
|
67
|
-
datetime: string;
|
|
68
|
-
health_factor: number;
|
|
69
|
-
id: string;
|
|
70
|
-
total_collateral_value: number;
|
|
71
|
-
total_loan_value: number;
|
|
72
|
-
};
|
|
73
|
-
}[]>;
|
|
74
|
-
export declare function getHealthFactorOfBorrowersByVault({ options, }: {
|
|
63
|
+
}): Promise<IVaultBorrowerHealthFactor[]>;
|
|
64
|
+
export declare function getHealthFactorOfBorrowersByVault({ options, vault, }: {
|
|
75
65
|
options: IVaultBaseOptions;
|
|
76
|
-
|
|
66
|
+
vault?: IAddress;
|
|
67
|
+
}): Promise<Record<string, IVaultBorrowerHealthFactor[]>>;
|
|
77
68
|
export declare function getUserPoints({ userAddress, options, }: {
|
|
78
69
|
userAddress: IAddress;
|
|
79
70
|
options?: IVaultBaseOptions;
|
|
@@ -1281,7 +1281,7 @@ async function getVaultTvl({ vault, options, historical, }) {
|
|
|
1281
1281
|
async function getVaultBorrowerHealthFactor({ vault, options, }) {
|
|
1282
1282
|
const provider = (0, core_1.createProvider)(options.rpcUrl);
|
|
1283
1283
|
const loans = await getVaultLoans(vault, options);
|
|
1284
|
-
const
|
|
1284
|
+
const activeLoanResults = await Promise.allSettled(loans.map(async (l) => {
|
|
1285
1285
|
const loanContract = (0, core_1.createContract)({
|
|
1286
1286
|
provider,
|
|
1287
1287
|
address: l.address,
|
|
@@ -1289,10 +1289,21 @@ async function getVaultBorrowerHealthFactor({ vault, options, }) {
|
|
|
1289
1289
|
});
|
|
1290
1290
|
const loanState = await loanContract.loanState();
|
|
1291
1291
|
if ((0, core_1.loanStateToReadable)(loanState) !== 'ACTIVE')
|
|
1292
|
-
return;
|
|
1292
|
+
return undefined;
|
|
1293
1293
|
return l.address;
|
|
1294
|
-
}))
|
|
1295
|
-
const
|
|
1294
|
+
}));
|
|
1295
|
+
const activeLoans = activeLoanResults
|
|
1296
|
+
.map((r, i) => {
|
|
1297
|
+
if (r.status === 'fulfilled')
|
|
1298
|
+
return r.value;
|
|
1299
|
+
core_1.Logger.log.warn('getVaultBorrowerHealthFactor:loanState', r.reason, {
|
|
1300
|
+
vault,
|
|
1301
|
+
loan: loans[i]?.address,
|
|
1302
|
+
});
|
|
1303
|
+
return undefined;
|
|
1304
|
+
})
|
|
1305
|
+
.filter((l) => l !== undefined);
|
|
1306
|
+
const formattedSettled = await Promise.allSettled(activeLoans.map(async (l) => {
|
|
1296
1307
|
const loanContract = (0, core_1.createContract)({
|
|
1297
1308
|
provider,
|
|
1298
1309
|
address: l,
|
|
@@ -1303,32 +1314,62 @@ async function getVaultBorrowerHealthFactor({ vault, options, }) {
|
|
|
1303
1314
|
loan: l,
|
|
1304
1315
|
};
|
|
1305
1316
|
}));
|
|
1317
|
+
const formattedLoansArray = formattedSettled
|
|
1318
|
+
.map((r, i) => {
|
|
1319
|
+
if (r.status === 'fulfilled')
|
|
1320
|
+
return r.value;
|
|
1321
|
+
core_1.Logger.log.warn('getVaultBorrowerHealthFactor:borrower', r.reason, {
|
|
1322
|
+
vault,
|
|
1323
|
+
loan: activeLoans[i],
|
|
1324
|
+
});
|
|
1325
|
+
return undefined;
|
|
1326
|
+
})
|
|
1327
|
+
.filter((entry) => entry !== undefined);
|
|
1306
1328
|
const uniqueBorrowers = [
|
|
1307
1329
|
...new Set(formattedLoansArray.map((l) => l.borrower)),
|
|
1308
1330
|
];
|
|
1309
1331
|
const borrowerResponses = {};
|
|
1310
1332
|
for (const b of uniqueBorrowers) {
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1333
|
+
try {
|
|
1334
|
+
const response = await (0, core_1.fetchAugustWithKey)(options.augustKey, core_1.WEBSERVER_ENDPOINTS.subaccount.health_factor(b));
|
|
1335
|
+
if (response.status === 200) {
|
|
1336
|
+
borrowerResponses[b] = await response.json();
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
catch (err) {
|
|
1340
|
+
core_1.Logger.log.warn('getVaultBorrowerHealthFactor:health_factor', err, {
|
|
1341
|
+
vault,
|
|
1342
|
+
borrower: b,
|
|
1343
|
+
});
|
|
1314
1344
|
}
|
|
1315
1345
|
}
|
|
1316
|
-
formattedLoansArray
|
|
1346
|
+
formattedLoansArray.forEach((loan) => {
|
|
1317
1347
|
loan.health_factor = borrowerResponses[loan.borrower];
|
|
1318
1348
|
});
|
|
1319
1349
|
return formattedLoansArray;
|
|
1320
1350
|
}
|
|
1321
|
-
async function getHealthFactorOfBorrowersByVault({ options, }) {
|
|
1322
|
-
const vaults =
|
|
1323
|
-
|
|
1351
|
+
async function getHealthFactorOfBorrowersByVault({ options, vault, }) {
|
|
1352
|
+
const vaults = vault
|
|
1353
|
+
? ((await (0, core_1.fetchTokenizedVault)(vault, options?.headers)) ?? [])
|
|
1354
|
+
: await (0, core_1.fetchTokenizedVaults)(undefined, options?.headers, false, false);
|
|
1355
|
+
const healthFactorResults = await Promise.allSettled(vaults.map(async (v) => {
|
|
1324
1356
|
return getVaultBorrowerHealthFactor({
|
|
1325
1357
|
vault: v.address,
|
|
1326
1358
|
options,
|
|
1327
1359
|
});
|
|
1328
1360
|
}));
|
|
1329
1361
|
const healthFactorsByPool = {};
|
|
1330
|
-
vaults.
|
|
1331
|
-
|
|
1362
|
+
vaults.forEach((pool, index) => {
|
|
1363
|
+
const result = healthFactorResults[index];
|
|
1364
|
+
const key = pool.address.toLowerCase();
|
|
1365
|
+
if (result?.status === 'fulfilled') {
|
|
1366
|
+
healthFactorsByPool[key] = result.value;
|
|
1367
|
+
return;
|
|
1368
|
+
}
|
|
1369
|
+
core_1.Logger.log.warn('getHealthFactorOfBorrowersByVault:vault', result?.reason, {
|
|
1370
|
+
vault: pool.address,
|
|
1371
|
+
});
|
|
1372
|
+
healthFactorsByPool[key] = [];
|
|
1332
1373
|
});
|
|
1333
1374
|
return healthFactorsByPool;
|
|
1334
1375
|
}
|
|
@@ -125,7 +125,7 @@ export declare class AugustVaults extends AugustBase {
|
|
|
125
125
|
vault: IAddress;
|
|
126
126
|
chainId?: IChainId;
|
|
127
127
|
}): Promise<number>;
|
|
128
|
-
getVaultBorrowerHealthFactor(chainId?: IChainId): Promise<
|
|
128
|
+
getVaultBorrowerHealthFactor(chainId?: IChainId, vault?: IAddress): Promise<Record<string, import("../../types").IVaultBorrowerHealthFactor[]> | Record<string, import("../../types").IVaultBorrowerHealthFactor[]>[]>;
|
|
129
129
|
getUserPoints(userAddress: IAddress): Promise<any>;
|
|
130
130
|
registerUserForPoints(userAddress: IAddress, referrerAddress: IAddress | undefined, chainId: number, signature: string, nonce: string, expiry: number): Promise<Response>;
|
|
131
131
|
fetchPointsLeaderboard(params?: {
|
|
@@ -740,7 +740,7 @@ class AugustVaults extends core_1.AugustBase {
|
|
|
740
740
|
},
|
|
741
741
|
});
|
|
742
742
|
}
|
|
743
|
-
async getVaultBorrowerHealthFactor(chainId) {
|
|
743
|
+
async getVaultBorrowerHealthFactor(chainId, vault) {
|
|
744
744
|
if (chainId) {
|
|
745
745
|
const health_factors = await (0, getters_1.getHealthFactorOfBorrowersByVault)({
|
|
746
746
|
options: {
|
|
@@ -748,6 +748,7 @@ class AugustVaults extends core_1.AugustBase {
|
|
|
748
748
|
env: this.monitoring?.env,
|
|
749
749
|
augustKey: this.keys?.august,
|
|
750
750
|
},
|
|
751
|
+
vault,
|
|
751
752
|
});
|
|
752
753
|
return health_factors;
|
|
753
754
|
}
|
|
@@ -763,6 +764,7 @@ class AugustVaults extends core_1.AugustBase {
|
|
|
763
764
|
subgraphKey: this.keys?.graph,
|
|
764
765
|
headers: this.headers,
|
|
765
766
|
},
|
|
767
|
+
vault,
|
|
766
768
|
});
|
|
767
769
|
}));
|
|
768
770
|
return health_factors.flat();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Signer, Wallet, TransactionResponse } from 'ethers';
|
|
2
2
|
import { IAddress } from '../../types';
|
|
3
|
+
import type { ISwapAndDepositOptions, ISwapRouterDirectDepositOptions, ISwapRouterNativeDepositOptions } from '../../types';
|
|
3
4
|
export type IContractWriteOptions = {
|
|
4
5
|
target: IAddress;
|
|
5
6
|
wallet: IAddress;
|
|
@@ -10,6 +11,8 @@ export type IContractWriteOptions = {
|
|
|
10
11
|
poolName?: string;
|
|
11
12
|
isInstantRedeem?: boolean;
|
|
12
13
|
isDepositWithPermit?: boolean;
|
|
14
|
+
receiver?: IAddress;
|
|
15
|
+
slippageBps?: number;
|
|
13
16
|
};
|
|
14
17
|
export type INativeDepositOptions = {
|
|
15
18
|
wrapperAddress: IAddress;
|
|
@@ -31,6 +34,7 @@ export declare function resolveSpender(args: {
|
|
|
31
34
|
isMultiAssetVault: boolean;
|
|
32
35
|
isAdapterDeposit: boolean;
|
|
33
36
|
adapterWrapperAddress?: IAddress;
|
|
37
|
+
swapRouterAddress?: IAddress;
|
|
34
38
|
}): IAddress;
|
|
35
39
|
export declare function validateAmountPrecision(amount: string | bigint | number): void;
|
|
36
40
|
export declare function isNonceParsing(error: unknown): boolean;
|
|
@@ -71,3 +75,6 @@ export type IRwaRedeemOptions = {
|
|
|
71
75
|
wait?: boolean;
|
|
72
76
|
};
|
|
73
77
|
export declare function rwaRedeemAsset(signer: Signer | Wallet, options: IRwaRedeemOptions): Promise<string>;
|
|
78
|
+
export declare function swapAndDeposit(signer: Signer | Wallet, options: ISwapAndDepositOptions): Promise<string>;
|
|
79
|
+
export declare function depositViaSwapRouter(signer: Signer | Wallet, options: ISwapRouterDirectDepositOptions): Promise<string>;
|
|
80
|
+
export declare function depositNativeViaSwapRouter(signer: Signer | Wallet, options: ISwapRouterNativeDepositOptions): Promise<string>;
|