upshift-finance 1.0.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/LICENSE +21 -0
- package/README.md +349 -0
- package/lib/abis/AddressResolver.d.ts +28 -0
- package/lib/abis/AddressResolver.js +23 -0
- package/lib/abis/ChainlinkV3.d.ts +87 -0
- package/lib/abis/ChainlinkV3.js +117 -0
- package/lib/abis/ERC20.d.ts +168 -0
- package/lib/abis/ERC20.js +226 -0
- package/lib/abis/ERC20_Bytes32.d.ts +139 -0
- package/lib/abis/ERC20_Bytes32.js +196 -0
- package/lib/abis/ERC4626.d.ts +364 -0
- package/lib/abis/ERC4626.js +507 -0
- package/lib/abis/ERC721.d.ts +231 -0
- package/lib/abis/ERC721.js +321 -0
- package/lib/abis/FeeOracle.d.ts +120 -0
- package/lib/abis/FeeOracle.js +162 -0
- package/lib/abis/LendingPool.d.ts +1393 -0
- package/lib/abis/LendingPool.js +1807 -0
- package/lib/abis/LendingPoolV2.d.ts +1413 -0
- package/lib/abis/LendingPoolV2.js +1833 -0
- package/lib/abis/LendingPoolV3.d.ts +1677 -0
- package/lib/abis/LendingPoolV3.js +1160 -0
- package/lib/abis/Loan.d.ts +837 -0
- package/lib/abis/Loan.js +1080 -0
- package/lib/abis/MultiAssetNativeDepositWrapper.d.ts +137 -0
- package/lib/abis/MultiAssetNativeDepositWrapper.js +125 -0
- package/lib/abis/Multicall3.d.ts +30 -0
- package/lib/abis/Multicall3.js +97 -0
- package/lib/abis/OFT.d.ts +116 -0
- package/lib/abis/OFT.js +85 -0
- package/lib/abis/PoolAdapter.d.ts +36 -0
- package/lib/abis/PoolAdapter.js +51 -0
- package/lib/abis/RewardDistributor.d.ts +267 -0
- package/lib/abis/RewardDistributor.js +352 -0
- package/lib/abis/RwaRedeemSubaccount.d.ts +747 -0
- package/lib/abis/RwaRedeemSubaccount.js +548 -0
- package/lib/abis/SmartAccount.d.ts +17 -0
- package/lib/abis/SmartAccount.js +19 -0
- package/lib/abis/SwapRouter.d.ts +1043 -0
- package/lib/abis/SwapRouter.js +740 -0
- package/lib/abis/TextResolver.d.ts +16 -0
- package/lib/abis/TextResolver.js +16 -0
- package/lib/abis/TokenizedVaultV2.d.ts +1364 -0
- package/lib/abis/TokenizedVaultV2.js +1041 -0
- package/lib/abis/TokenizedVaultV2DepositWithPermit.d.ts +1456 -0
- package/lib/abis/TokenizedVaultV2DepositWithPermit.js +1878 -0
- package/lib/abis/TokenizedVaultV2Receipt.d.ts +1568 -0
- package/lib/abis/TokenizedVaultV2Receipt.js +1061 -0
- package/lib/abis/TokenizedVaultV2SenderAllocationWhitelist.d.ts +454 -0
- package/lib/abis/TokenizedVaultV2SenderAllocationWhitelist.js +327 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAllocation.d.ts +1466 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAllocation.js +1092 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAssets.d.ts +274 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAssets.js +167 -0
- package/lib/abis/UniversalResolverResolve.d.ts +69 -0
- package/lib/abis/UniversalResolverResolve.js +35 -0
- package/lib/abis/UniversalSignatureValidator.d.ts +17 -0
- package/lib/abis/UniversalSignatureValidator.js +30 -0
- package/lib/abis/WrapperAdapter.d.ts +71 -0
- package/lib/abis/WrapperAdapter.js +77 -0
- package/lib/abis/index.d.ts +34 -0
- package/lib/abis/index.js +51 -0
- package/lib/adapters/evm/getters.d.ts +19 -0
- package/lib/adapters/evm/getters.js +209 -0
- package/lib/adapters/evm/index.d.ts +353 -0
- package/lib/adapters/evm/index.js +434 -0
- package/lib/adapters/evm/utils.d.ts +8 -0
- package/lib/adapters/evm/utils.js +51 -0
- package/lib/adapters/solana/constants.d.ts +33 -0
- package/lib/adapters/solana/constants.js +52 -0
- package/lib/adapters/solana/getters.d.ts +11 -0
- package/lib/adapters/solana/getters.js +165 -0
- package/lib/adapters/solana/idl/vault-idl.d.ts +272 -0
- package/lib/adapters/solana/idl/vault-idl.js +1084 -0
- package/lib/adapters/solana/index.d.ts +233 -0
- package/lib/adapters/solana/index.js +291 -0
- package/lib/adapters/solana/types.d.ts +67 -0
- package/lib/adapters/solana/types.js +3 -0
- package/lib/adapters/solana/utils.d.ts +141 -0
- package/lib/adapters/solana/utils.js +595 -0
- package/lib/adapters/solana/vault.actions.d.ts +57 -0
- package/lib/adapters/solana/vault.actions.js +379 -0
- package/lib/adapters/stellar/actions.d.ts +28 -0
- package/lib/adapters/stellar/actions.js +77 -0
- package/lib/adapters/stellar/constants.d.ts +43 -0
- package/lib/adapters/stellar/constants.js +53 -0
- package/lib/adapters/stellar/getters.d.ts +68 -0
- package/lib/adapters/stellar/getters.js +290 -0
- package/lib/adapters/stellar/index.d.ts +114 -0
- package/lib/adapters/stellar/index.js +175 -0
- package/lib/adapters/stellar/soroban.d.ts +123 -0
- package/lib/adapters/stellar/soroban.js +613 -0
- package/lib/adapters/stellar/submit.d.ts +34 -0
- package/lib/adapters/stellar/submit.js +149 -0
- package/lib/adapters/stellar/types.d.ts +58 -0
- package/lib/adapters/stellar/types.js +6 -0
- package/lib/adapters/stellar/utils.d.ts +24 -0
- package/lib/adapters/stellar/utils.js +34 -0
- package/lib/adapters/sui/constants.d.ts +14 -0
- package/lib/adapters/sui/constants.js +29 -0
- package/lib/adapters/sui/getters.d.ts +9 -0
- package/lib/adapters/sui/getters.js +60 -0
- package/lib/adapters/sui/index.d.ts +45 -0
- package/lib/adapters/sui/index.js +101 -0
- package/lib/adapters/sui/transformer.d.ts +10 -0
- package/lib/adapters/sui/transformer.js +107 -0
- package/lib/adapters/sui/types.d.ts +66 -0
- package/lib/adapters/sui/types.js +3 -0
- package/lib/adapters/sui/utils.d.ts +10 -0
- package/lib/adapters/sui/utils.js +29 -0
- package/lib/core/analytics/chain-name.d.ts +9 -0
- package/lib/core/analytics/chain-name.js +34 -0
- package/lib/core/analytics/constants.d.ts +5 -0
- package/lib/core/analytics/constants.js +9 -0
- package/lib/core/analytics/env.d.ts +29 -0
- package/lib/core/analytics/env.js +59 -0
- package/lib/core/analytics/index.d.ts +36 -0
- package/lib/core/analytics/index.js +79 -0
- package/lib/core/analytics/instrumentation.d.ts +29 -0
- package/lib/core/analytics/instrumentation.js +277 -0
- package/lib/core/analytics/method-taxonomy.d.ts +19 -0
- package/lib/core/analytics/method-taxonomy.js +128 -0
- package/lib/core/analytics/metrics.d.ts +33 -0
- package/lib/core/analytics/metrics.js +116 -0
- package/lib/core/analytics/sanitize.d.ts +44 -0
- package/lib/core/analytics/sanitize.js +260 -0
- package/lib/core/analytics/sentry-runtime.d.ts +15 -0
- package/lib/core/analytics/sentry-runtime.js +97 -0
- package/lib/core/analytics/sentry.d.ts +67 -0
- package/lib/core/analytics/sentry.js +613 -0
- package/lib/core/analytics/types.d.ts +48 -0
- package/lib/core/analytics/types.js +3 -0
- package/lib/core/analytics/user-identity.d.ts +41 -0
- package/lib/core/analytics/user-identity.js +141 -0
- package/lib/core/analytics/version.d.ts +6 -0
- package/lib/core/analytics/version.js +10 -0
- package/lib/core/attribution.d.ts +111 -0
- package/lib/core/attribution.js +142 -0
- package/lib/core/auth/index.d.ts +1 -0
- package/lib/core/auth/index.js +18 -0
- package/lib/core/auth/verify.d.ts +2 -0
- package/lib/core/auth/verify.js +31 -0
- package/lib/core/base.class.d.ts +152 -0
- package/lib/core/base.class.js +172 -0
- package/lib/core/cache.d.ts +9 -0
- package/lib/core/cache.js +31 -0
- package/lib/core/constants/adapters.d.ts +103 -0
- package/lib/core/constants/adapters.js +180 -0
- package/lib/core/constants/core.d.ts +133 -0
- package/lib/core/constants/core.js +209 -0
- package/lib/core/constants/swap-router.d.ts +150 -0
- package/lib/core/constants/swap-router.js +169 -0
- package/lib/core/constants/vaults.d.ts +93 -0
- package/lib/core/constants/vaults.js +273 -0
- package/lib/core/constants/web3.d.ts +91 -0
- package/lib/core/constants/web3.js +229 -0
- package/lib/core/errors/index.d.ts +114 -0
- package/lib/core/errors/index.js +183 -0
- package/lib/core/fetcher.d.ts +198 -0
- package/lib/core/fetcher.js +903 -0
- package/lib/core/helpers/adapters.d.ts +13 -0
- package/lib/core/helpers/adapters.js +39 -0
- package/lib/core/helpers/chain-address.d.ts +13 -0
- package/lib/core/helpers/chain-address.js +47 -0
- package/lib/core/helpers/chain-error.d.ts +207 -0
- package/lib/core/helpers/chain-error.js +682 -0
- package/lib/core/helpers/chain-support.d.ts +80 -0
- package/lib/core/helpers/chain-support.js +115 -0
- package/lib/core/helpers/core.d.ts +68 -0
- package/lib/core/helpers/core.js +285 -0
- package/lib/core/helpers/explorer-link.d.ts +16 -0
- package/lib/core/helpers/explorer-link.js +26 -0
- package/lib/core/helpers/multicall.d.ts +68 -0
- package/lib/core/helpers/multicall.js +103 -0
- package/lib/core/helpers/revert-decode.d.ts +248 -0
- package/lib/core/helpers/revert-decode.js +515 -0
- package/lib/core/helpers/signer.d.ts +52 -0
- package/lib/core/helpers/signer.js +145 -0
- package/lib/core/helpers/swap-router.d.ts +211 -0
- package/lib/core/helpers/swap-router.js +480 -0
- package/lib/core/helpers/vault-version.d.ts +23 -0
- package/lib/core/helpers/vault-version.js +75 -0
- package/lib/core/helpers/vaults.d.ts +89 -0
- package/lib/core/helpers/vaults.js +235 -0
- package/lib/core/helpers/web3.d.ts +353 -0
- package/lib/core/helpers/web3.js +992 -0
- package/lib/core/index.d.ts +23 -0
- package/lib/core/index.js +40 -0
- package/lib/core/logger/index.d.ts +98 -0
- package/lib/core/logger/index.js +144 -0
- package/lib/core/logger/slack.d.ts +16 -0
- package/lib/core/logger/slack.js +57 -0
- package/lib/core/vault-metadata.d.ts +12 -0
- package/lib/core/vault-metadata.js +42 -0
- package/lib/core/version-check.d.ts +58 -0
- package/lib/core/version-check.js +182 -0
- package/lib/evm/index.d.ts +2 -0
- package/lib/evm/index.js +19 -0
- package/lib/evm/methods/crossChainVault.d.ts +128 -0
- package/lib/evm/methods/crossChainVault.js +853 -0
- package/lib/evm/methods/crossChainVaultRegistry.d.ts +93 -0
- package/lib/evm/methods/crossChainVaultRegistry.js +240 -0
- package/lib/evm/methods/index.d.ts +2 -0
- package/lib/evm/methods/index.js +19 -0
- package/lib/evm/types/crossChain.d.ts +363 -0
- package/lib/evm/types/crossChain.js +20 -0
- package/lib/evm/types/index.d.ts +1 -0
- package/lib/evm/types/index.js +18 -0
- package/lib/index.d.ts +30 -0
- package/lib/index.js +52 -0
- package/lib/main.d.ts +527 -0
- package/lib/main.js +601 -0
- package/lib/modules/api/fetcher.d.ts +82 -0
- package/lib/modules/api/fetcher.js +150 -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 +313 -0
- package/lib/modules/api/main.js +479 -0
- package/lib/modules/sub-accounts/fetcher.d.ts +53 -0
- package/lib/modules/sub-accounts/fetcher.js +120 -0
- package/lib/modules/sub-accounts/index.d.ts +2 -0
- package/lib/modules/sub-accounts/index.js +19 -0
- package/lib/modules/sub-accounts/main.d.ts +243 -0
- package/lib/modules/sub-accounts/main.js +205 -0
- package/lib/modules/sub-accounts/utils.d.ts +106 -0
- package/lib/modules/sub-accounts/utils.js +112 -0
- package/lib/modules/vaults/adapter.helpers.d.ts +64 -0
- package/lib/modules/vaults/adapter.helpers.js +184 -0
- package/lib/modules/vaults/fetcher.d.ts +147 -0
- package/lib/modules/vaults/fetcher.js +368 -0
- package/lib/modules/vaults/getters.d.ts +570 -0
- package/lib/modules/vaults/getters.js +3051 -0
- package/lib/modules/vaults/index.d.ts +20 -0
- package/lib/modules/vaults/index.js +44 -0
- package/lib/modules/vaults/main.d.ts +601 -0
- package/lib/modules/vaults/main.js +1623 -0
- package/lib/modules/vaults/prefetch.d.ts +65 -0
- package/lib/modules/vaults/prefetch.js +120 -0
- package/lib/modules/vaults/read.actions.d.ts +225 -0
- package/lib/modules/vaults/read.actions.js +596 -0
- package/lib/modules/vaults/types.d.ts +71 -0
- package/lib/modules/vaults/types.js +3 -0
- package/lib/modules/vaults/utils/call-data-decoder.d.ts +61 -0
- package/lib/modules/vaults/utils/call-data-decoder.js +194 -0
- package/lib/modules/vaults/utils/date-utils.d.ts +50 -0
- package/lib/modules/vaults/utils/date-utils.js +84 -0
- package/lib/modules/vaults/utils.d.ts +140 -0
- package/lib/modules/vaults/utils.js +799 -0
- package/lib/modules/vaults/write.actions.d.ts +529 -0
- package/lib/modules/vaults/write.actions.js +1749 -0
- package/lib/polyfills.d.ts +1 -0
- package/lib/polyfills.js +12 -0
- package/lib/sdk.d.ts +26721 -0
- package/lib/services/coingecko/fetcher.d.ts +15 -0
- package/lib/services/coingecko/fetcher.js +67 -0
- package/lib/services/coingecko/index.d.ts +2 -0
- package/lib/services/coingecko/index.js +19 -0
- package/lib/services/coingecko/utils.d.ts +1 -0
- package/lib/services/coingecko/utils.js +24 -0
- package/lib/services/debank/fetcher.d.ts +126 -0
- package/lib/services/debank/fetcher.js +47 -0
- package/lib/services/debank/index.d.ts +2 -0
- package/lib/services/debank/index.js +19 -0
- package/lib/services/debank/utils.d.ts +38 -0
- package/lib/services/debank/utils.js +297 -0
- package/lib/services/layerzero/deposits.d.ts +49 -0
- package/lib/services/layerzero/deposits.js +166 -0
- package/lib/services/layerzero/redeems.d.ts +20 -0
- package/lib/services/layerzero/redeems.js +92 -0
- package/lib/services/layerzero/utils.d.ts +9 -0
- package/lib/services/layerzero/utils.js +22 -0
- package/lib/services/octavfi/fetcher.d.ts +9 -0
- package/lib/services/octavfi/fetcher.js +103 -0
- package/lib/services/octavfi/index.d.ts +3 -0
- package/lib/services/octavfi/index.js +20 -0
- package/lib/services/octavfi/types.d.ts +34 -0
- package/lib/services/octavfi/types.js +3 -0
- package/lib/services/octavfi/utils.d.ts +16 -0
- package/lib/services/octavfi/utils.js +212 -0
- package/lib/services/subgraph/fetcher.d.ts +2 -0
- package/lib/services/subgraph/fetcher.js +61 -0
- package/lib/services/subgraph/index.d.ts +2 -0
- package/lib/services/subgraph/index.js +19 -0
- package/lib/services/subgraph/schema.d.ts +45 -0
- package/lib/services/subgraph/schema.js +75 -0
- package/lib/services/subgraph/vaults.d.ts +25 -0
- package/lib/services/subgraph/vaults.js +1106 -0
- package/lib/services/swap-quotes/index.d.ts +105 -0
- package/lib/services/swap-quotes/index.js +77 -0
- package/lib/services/swap-quotes/paraswap.d.ts +51 -0
- package/lib/services/swap-quotes/paraswap.js +138 -0
- package/lib/types/api.d.ts +280 -0
- package/lib/types/api.js +3 -0
- package/lib/types/index.d.ts +12 -0
- package/lib/types/index.js +28 -0
- package/lib/types/points.d.ts +28 -0
- package/lib/types/points.js +3 -0
- package/lib/types/pools.d.ts +144 -0
- package/lib/types/pools.js +3 -0
- package/lib/types/staking.d.ts +28 -0
- package/lib/types/staking.js +3 -0
- package/lib/types/sub-accounts.d.ts +140 -0
- package/lib/types/sub-accounts.js +3 -0
- package/lib/types/subgraph.d.ts +74 -0
- package/lib/types/subgraph.js +3 -0
- package/lib/types/typed-contract.d.ts +102 -0
- package/lib/types/typed-contract.js +3 -0
- package/lib/types/user.d.ts +1 -0
- package/lib/types/user.js +3 -0
- package/lib/types/vaults.d.ts +714 -0
- package/lib/types/vaults.js +24 -0
- package/lib/types/web3.d.ts +51 -0
- package/lib/types/web3.js +14 -0
- package/lib/types/webserver.d.ts +698 -0
- package/lib/types/webserver.js +3 -0
- package/package.json +78 -0
package/lib/main.js
ADDED
|
@@ -0,0 +1,601 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The main August SDK class.
|
|
4
|
+
*
|
|
5
|
+
* @module AugustSDK
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
41
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
42
|
+
};
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.AugustSDK = void 0;
|
|
45
|
+
const solana_1 = __importDefault(require("./adapters/solana"));
|
|
46
|
+
const sui_1 = __importDefault(require("./adapters/sui"));
|
|
47
|
+
const stellar_1 = __importDefault(require("./adapters/stellar"));
|
|
48
|
+
const evm_1 = __importDefault(require("./adapters/evm"));
|
|
49
|
+
const core_1 = require("./core");
|
|
50
|
+
const vaults_1 = require("./modules/vaults");
|
|
51
|
+
const analytics_1 = require("./core/analytics");
|
|
52
|
+
const sub_accounts_1 = require("./modules/sub-accounts");
|
|
53
|
+
const api_1 = require("./modules/api");
|
|
54
|
+
/**
|
|
55
|
+
* Main SDK class for interacting with August Digital vaults and services.
|
|
56
|
+
* Provides unified access to EVM, Solana, Sui, and Stellar blockchain adapters.
|
|
57
|
+
*/
|
|
58
|
+
class AugustSDK extends core_1.AugustBase {
|
|
59
|
+
vaults;
|
|
60
|
+
subaccounts;
|
|
61
|
+
api;
|
|
62
|
+
solana;
|
|
63
|
+
sui;
|
|
64
|
+
stellar;
|
|
65
|
+
evm;
|
|
66
|
+
/**
|
|
67
|
+
* Initialize the August SDK with provider configuration.
|
|
68
|
+
* Automatically sets up EVM adapter and optionally initializes Solana if RPC URL is provided.
|
|
69
|
+
*/
|
|
70
|
+
constructor(baseConfig) {
|
|
71
|
+
super(baseConfig);
|
|
72
|
+
// @todo: change this later when august key is required
|
|
73
|
+
this.authorized = true;
|
|
74
|
+
// EVM adapter is always available
|
|
75
|
+
this.evm = new evm_1.default();
|
|
76
|
+
// @solana: handle solana service initialization
|
|
77
|
+
//
|
|
78
|
+
// Two accepted entry points, treated as exclusive sources so url+network
|
|
79
|
+
// can never come from different configs:
|
|
80
|
+
// 1) `baseConfig.solana = { rpcUrl, network }` — preferred. Both fields
|
|
81
|
+
// come from the same place; the caller controls the network.
|
|
82
|
+
// 2) `baseConfig.providers[-1] = rpcUrl` — legacy "Solana as another
|
|
83
|
+
// EVM chain" shape. Network is derived from the URL substring.
|
|
84
|
+
//
|
|
85
|
+
// Without one of these `this.solana` stays undefined and every Solana
|
|
86
|
+
// vault is silently dropped from getVaults / getVaultPositions (the
|
|
87
|
+
// filter in modules/vaults/main.ts gates on `!!this.solanaService`).
|
|
88
|
+
const solanaConfig = (() => {
|
|
89
|
+
if (baseConfig.solana?.rpcUrl) {
|
|
90
|
+
return {
|
|
91
|
+
rpcUrl: baseConfig.solana.rpcUrl,
|
|
92
|
+
network: baseConfig.solana.network,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
const legacyRpcUrl = baseConfig.providers?.[core_1.SPECIAL_CHAINS.solana.chainId];
|
|
96
|
+
if (legacyRpcUrl) {
|
|
97
|
+
return {
|
|
98
|
+
rpcUrl: legacyRpcUrl,
|
|
99
|
+
network: legacyRpcUrl.includes('devnet')
|
|
100
|
+
? 'devnet'
|
|
101
|
+
: 'mainnet-beta',
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
})();
|
|
106
|
+
if (solanaConfig) {
|
|
107
|
+
this.solana = new solana_1.default(solanaConfig.rpcUrl, solanaConfig.network);
|
|
108
|
+
(0, analytics_1.instrumentClass)(this.solana, () => core_1.SPECIAL_CHAINS.solana.chainId);
|
|
109
|
+
}
|
|
110
|
+
this.sui = new sui_1.default();
|
|
111
|
+
// @stellar: mirror the Solana injection — the consumer may supply a keyed
|
|
112
|
+
// Soroban RPC (e.g. Alchemy) via `baseConfig.stellar`; otherwise the adapter
|
|
113
|
+
// uses its built-in public endpoints. Endpoint is injected, not hardcoded.
|
|
114
|
+
this.stellar = new stellar_1.default(baseConfig.stellar?.network, {
|
|
115
|
+
sorobanRpcUrl: baseConfig.stellar?.rpcUrl,
|
|
116
|
+
});
|
|
117
|
+
this.vaults = new vaults_1.AugustVaults(baseConfig, this.solana, this.sui);
|
|
118
|
+
this.subaccounts = new sub_accounts_1.AugustSubAccounts(baseConfig);
|
|
119
|
+
this.api = new api_1.AugustApi(baseConfig);
|
|
120
|
+
// Instrument all SDK methods for analytics tracking
|
|
121
|
+
(0, analytics_1.instrumentClass)(this, () => this.activeNetwork?.chainId);
|
|
122
|
+
(0, analytics_1.instrumentClass)(this.evm, () => this.activeNetwork?.chainId);
|
|
123
|
+
(0, analytics_1.instrumentClass)(this.sui, () => this.activeNetwork?.chainId);
|
|
124
|
+
(0, analytics_1.instrumentClass)(this.stellar, () => core_1.SPECIAL_CHAINS.stellar?.chainId);
|
|
125
|
+
(0, analytics_1.instrumentClass)(this.vaults, () => this.activeNetwork?.chainId);
|
|
126
|
+
(0, analytics_1.instrumentClass)(this.subaccounts, () => this.activeNetwork?.chainId);
|
|
127
|
+
(0, analytics_1.instrumentClass)(this.api, () => this.activeNetwork?.chainId);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Get the Sub-Accounts module instance.
|
|
131
|
+
*/
|
|
132
|
+
get subAccountsModule() {
|
|
133
|
+
return this.subaccounts;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Get the Vaults module instance.
|
|
137
|
+
*/
|
|
138
|
+
get vaultsModule() {
|
|
139
|
+
return this.vaults;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Get the backend API module instance ({@link AugustApi}) — read-only
|
|
143
|
+
* access to backend-computed data with no on-chain equivalent
|
|
144
|
+
* (unrealized-PnL series).
|
|
145
|
+
*/
|
|
146
|
+
get apiModule() {
|
|
147
|
+
return this.api;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Switch the active network for vault operations.
|
|
151
|
+
* Updates the SDK's active chain and RPC provider.
|
|
152
|
+
*/
|
|
153
|
+
switchNetwork(chainId) {
|
|
154
|
+
super.switchNetwork(chainId);
|
|
155
|
+
this.vaults.switchNetwork(chainId);
|
|
156
|
+
// Track network switch for analytics
|
|
157
|
+
(0, analytics_1.trackNetworkSwitch)(chainId);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Set the active wallet address for tracking user-specific vault data.
|
|
161
|
+
* Updates monitoring headers with the wallet address.
|
|
162
|
+
*/
|
|
163
|
+
updateWallet(address) {
|
|
164
|
+
if (!address)
|
|
165
|
+
return;
|
|
166
|
+
if (this.monitoring) {
|
|
167
|
+
this.monitoring['x-user-id'] = address;
|
|
168
|
+
}
|
|
169
|
+
this.vaults.updateWallet(address);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Clear the active wallet address from the SDK state and monitoring headers.
|
|
173
|
+
*/
|
|
174
|
+
clearWallet() {
|
|
175
|
+
if (this.monitoring) {
|
|
176
|
+
this.monitoring['x-user-id'] = undefined;
|
|
177
|
+
}
|
|
178
|
+
this.vaults.clearWallet();
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Pricing and Market Data
|
|
182
|
+
*/
|
|
183
|
+
/**
|
|
184
|
+
* Get the current USD price of a token by symbol or contract address.
|
|
185
|
+
* Falls back to CoinGecko if primary price source fails.
|
|
186
|
+
*
|
|
187
|
+
* @param symbol - Token symbol or contract address
|
|
188
|
+
* @returns Current price in USD
|
|
189
|
+
*/
|
|
190
|
+
async getPrice(symbol) {
|
|
191
|
+
if (!this.authorized)
|
|
192
|
+
throw new Error('Not authorized.');
|
|
193
|
+
if (!symbol)
|
|
194
|
+
throw new Error(`Symbol input parameter is not defined.`);
|
|
195
|
+
return await (0, core_1.fetchTokenPrice)(symbol, null, this.keys?.coingecko);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Vault Data and Operations
|
|
199
|
+
*/
|
|
200
|
+
/**
|
|
201
|
+
* Fetch all available vaults across configured networks.
|
|
202
|
+
* Optionally filter by chain IDs and include loan/allocation data.
|
|
203
|
+
* @param options - Configuration for filtering and enriching vault data
|
|
204
|
+
* @returns Array of vault objects with metadata and optional position data
|
|
205
|
+
*/
|
|
206
|
+
async getVaults(options) {
|
|
207
|
+
return await this.vaults.getVaults(options);
|
|
208
|
+
}
|
|
209
|
+
async getTotalDeposited(options) {
|
|
210
|
+
return await this.vaults.getTotalDeposited(options);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Fetch all available vaults across configured networks.
|
|
214
|
+
* Optionally filter by chain IDs and include loan/allocation data.
|
|
215
|
+
* @param options - Configuration for filtering and enriching vault data
|
|
216
|
+
* @returns Array of vault objects with metadata and optional position data
|
|
217
|
+
*/
|
|
218
|
+
async vaultDeposit(signer, options) {
|
|
219
|
+
return await this.vaults.vaultDeposit(signer, options);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Fetch detailed information for a specific vault.
|
|
223
|
+
* @param props - Vault address, chain ID, and optional enrichment options
|
|
224
|
+
* @returns Single vault object with full metadata
|
|
225
|
+
*/
|
|
226
|
+
async getVault(props) {
|
|
227
|
+
return await this.vaults.getVault(props);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Get active loans deployed from a vault.
|
|
231
|
+
* @param props - Vault address and chain ID
|
|
232
|
+
* @returns Array of loan details including borrower, principal, APR
|
|
233
|
+
*/
|
|
234
|
+
async getVaultLoans(props) {
|
|
235
|
+
return await this.vaults.getVaultLoans(props);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Get vault asset allocations across DeFi protocols, CeFi, and OTC positions.
|
|
239
|
+
* @param props - Vault address and chain ID
|
|
240
|
+
* @returns Detailed breakdown of vault allocations by category
|
|
241
|
+
*/
|
|
242
|
+
async getVaultAllocations(props) {
|
|
243
|
+
return await this.vaults.getVaultAllocations(props);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Get current or historical APY for a vault.
|
|
247
|
+
*
|
|
248
|
+
* @deprecated use getVaultHistoricalTimeseries instead
|
|
249
|
+
*
|
|
250
|
+
* @param props - Vault address and optional historical lookback period
|
|
251
|
+
* @returns APY data including rewards breakdown
|
|
252
|
+
*/
|
|
253
|
+
async getVaultApy(props) {
|
|
254
|
+
return await this.vaults.getVaultApy(props);
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Get current or historical TVL for a vault.
|
|
258
|
+
* @param props - Vault address and optional historical parameters
|
|
259
|
+
* @returns TVL in vault's base asset units
|
|
260
|
+
*/
|
|
261
|
+
async getVaultTvl(props) {
|
|
262
|
+
return await this.vaults.getVaultTvl(props);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Get historical timeseries data for a vault.
|
|
266
|
+
* @param props - Vault address and optional number of days
|
|
267
|
+
* @returns Historical timeseries data with TVL, APY, PnL, share price, and other metrics
|
|
268
|
+
*/
|
|
269
|
+
async getVaultHistoricalTimeseries(props) {
|
|
270
|
+
return await this.vaults.getVaultHistoricalTimeseries(props);
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Get the timestamp when yield was last realized for a vault.
|
|
274
|
+
* @param props - Vault address and optional chain ID
|
|
275
|
+
* @returns Timestamp (Unix timestamp in seconds) when yield was last realized
|
|
276
|
+
*/
|
|
277
|
+
async getYieldLastRealizedOn(props) {
|
|
278
|
+
return await this.vaults.getYieldLastRealizedOn(props);
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Get redemption requests that are ready to be claimed.
|
|
282
|
+
* @param props - Vault address, chain ID, and optional wallet filter
|
|
283
|
+
* @returns Array of available redemption requests with amounts and timestamps
|
|
284
|
+
*/
|
|
285
|
+
async getVaultAvailableRedemptions(props) {
|
|
286
|
+
return await this.vaults.getVaultAvailableRedemptions(props);
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Get historical redemption requests for a vault (settled, cancelled,
|
|
290
|
+
* pending-but-out-of-window), optionally filtered to one wallet.
|
|
291
|
+
*
|
|
292
|
+
* @param props - Vault address, chain ID, optional wallet, and an
|
|
293
|
+
* optional `lookbackBlocks` for how far back to scan.
|
|
294
|
+
* @returns Historical redemption records, newest first.
|
|
295
|
+
*/
|
|
296
|
+
async getVaultRedemptionHistory(props) {
|
|
297
|
+
return await this.vaults.getVaultRedemptionHistory(props);
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Get user positions across vaults including shares and claimable redemptions.
|
|
301
|
+
* Supports both EVM and Solana vaults.
|
|
302
|
+
* @param props - Wallet address, chain ID, and optional vault filter
|
|
303
|
+
* @returns Array of positions with balances and pending redemptions
|
|
304
|
+
*/
|
|
305
|
+
async getVaultPositions(props) {
|
|
306
|
+
return await this.vaults.getVaultPositions(props);
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Get user's historical vault interactions including deposits and withdrawals.
|
|
310
|
+
* @param props - Wallet address and optional vault/chain filters
|
|
311
|
+
* @returns Array of historical transactions with amounts and timestamps
|
|
312
|
+
*/
|
|
313
|
+
async getVaultUserHistory(props) {
|
|
314
|
+
return await this.vaults.getUserHistory(props);
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Get user's vault share transfer history from subgraph.
|
|
318
|
+
* @param props - Wallet address and optional vault/chain filters
|
|
319
|
+
* @returns Array of transfer events
|
|
320
|
+
*/
|
|
321
|
+
async getVaultUserTransfers(props) {
|
|
322
|
+
return await this.vaults.getUserTransfers(props);
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Get a vault's deposit/withdrawal activity across every participant.
|
|
326
|
+
*
|
|
327
|
+
* The vault-wide counterpart to {@link AugustSDK.getVaultUserHistory} — use
|
|
328
|
+
* it to answer flow questions ("how many deposits in the last 7 days", "net
|
|
329
|
+
* flow this week") that point-in-time TVL cannot. Reads from the Goldsky
|
|
330
|
+
* subgraph, paginated so busy vaults are not truncated; a `sinceTs` window
|
|
331
|
+
* keeps short lookbacks cheap.
|
|
332
|
+
* @param props - Vault address, optional chain id, optional `sinceTs`/`untilTs`
|
|
333
|
+
* Unix-second bounds, and an optional `types` filter.
|
|
334
|
+
* @returns Array of activity items (oldest-first) with normalized amounts,
|
|
335
|
+
* actor addresses, event type, and transaction hashes.
|
|
336
|
+
* @throws If `vault` is not a valid address or no chain id can be resolved.
|
|
337
|
+
* @example
|
|
338
|
+
* ```ts
|
|
339
|
+
* const weekAgo = Math.floor(Date.now() / 1000) - 7 * 86_400;
|
|
340
|
+
* const items = await sdk.getVaultActivity({ vault, chainId: 143, sinceTs: weekAgo });
|
|
341
|
+
* ```
|
|
342
|
+
*/
|
|
343
|
+
async getVaultActivity(props) {
|
|
344
|
+
return await this.vaults.getVaultActivity(props);
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Resolve the ERC-20 tokens currently whitelisted for the `SwapRouter` on a
|
|
348
|
+
* chain — the any-token set a deposit UI can offer as swap-and-deposit inputs.
|
|
349
|
+
*
|
|
350
|
+
* Delegates to {@link AugustVaults.getSwapRouterWhitelistedTokens}, which
|
|
351
|
+
* reconstructs the set from the router's `TokenEnabled` events and verifies
|
|
352
|
+
* each against the on-chain `whitelistedTokens` mapping (not enumerable).
|
|
353
|
+
* Returns `[]` when no router is deployed on `chainId` or no provider is
|
|
354
|
+
* configured for it.
|
|
355
|
+
*
|
|
356
|
+
* @param chainId - EVM chain ID to resolve the allowlist for.
|
|
357
|
+
* @param options - Optional `fromBlock` to override the deploy-block scan floor.
|
|
358
|
+
* @returns Checksummed whitelisted token addresses; `[]` when unavailable.
|
|
359
|
+
* @throws AugustSDKError when an `eth_getLogs` scan chunk fails.
|
|
360
|
+
* @example
|
|
361
|
+
* ```ts
|
|
362
|
+
* const tokens = await augustSdk.getSwapRouterWhitelistedTokens(1);
|
|
363
|
+
* ```
|
|
364
|
+
*/
|
|
365
|
+
async getSwapRouterWhitelistedTokens(chainId, options) {
|
|
366
|
+
return await this.vaults.getSwapRouterWhitelistedTokens(chainId, options);
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Resolve the vaults currently eligible for the any-token `SwapRouter`
|
|
370
|
+
* deposit surface on a chain — every vault the router has `enableVault`-ed
|
|
371
|
+
* whose on-chain registration is still live.
|
|
372
|
+
*
|
|
373
|
+
* Delegates to {@link AugustVaults.getSwapRouterEligibleVaults}, which
|
|
374
|
+
* reconstructs the set from the router's `VaultEnabled` events and verifies
|
|
375
|
+
* each vault's current `vaultInfo` registration (not enumerable). Returns
|
|
376
|
+
* `[]` when no router is deployed on `chainId` or no provider is configured
|
|
377
|
+
* for it. On-chain eligibility only — app-level policy (e.g. OVault
|
|
378
|
+
* exclusions) remains the caller's responsibility.
|
|
379
|
+
*
|
|
380
|
+
* @param chainId - EVM chain ID to resolve eligible vaults for.
|
|
381
|
+
* @param options - Optional `fromBlock` to override the deploy-block scan floor.
|
|
382
|
+
* @returns Checksummed eligible vault addresses; `[]` when unavailable.
|
|
383
|
+
* @throws AugustSDKError when an `eth_getLogs` scan chunk fails.
|
|
384
|
+
* @example
|
|
385
|
+
* ```ts
|
|
386
|
+
* const vaults = await augustSdk.getSwapRouterEligibleVaults(1);
|
|
387
|
+
* ```
|
|
388
|
+
*/
|
|
389
|
+
async getSwapRouterEligibleVaults(chainId, options) {
|
|
390
|
+
return await this.vaults.getSwapRouterEligibleVaults(chainId, options);
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Get lifetime PnL for a user in a specific vault.
|
|
394
|
+
* Calculates realized and unrealized PnL based on deposit/withdrawal history and current position.
|
|
395
|
+
* @param props - Vault address, wallet address, and optional chain ID
|
|
396
|
+
* @returns Lifetime PnL data including realized and unrealized PnL in both native token and USD
|
|
397
|
+
*/
|
|
398
|
+
async getVaultUserLifetimePnl(props) {
|
|
399
|
+
return await this.vaults.getVaultUserLifetimePnl(props);
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Get PnL for a vault (vault-level, not user-specific).
|
|
403
|
+
* Returns the vault's overall profit and loss across all users.
|
|
404
|
+
* @param props - Vault address and optional chain ID
|
|
405
|
+
* @returns Vault PnL in USD and notional value
|
|
406
|
+
*/
|
|
407
|
+
async getVaultPnl(props) {
|
|
408
|
+
return await this.vaults.getVaultPnl(props);
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Get user's staking positions for vault receipt tokens.
|
|
412
|
+
* @param props - Wallet address and optional chain ID
|
|
413
|
+
* @returns Array of staking positions with rewards
|
|
414
|
+
*/
|
|
415
|
+
async getVaultStakingPositions(props) {
|
|
416
|
+
return await this.vaults.getStakingPositions(props.wallet, props.chainId);
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Get the borrower's health factor by vault.
|
|
420
|
+
*
|
|
421
|
+
* Pass `vault` whenever the caller knows which pool it cares about — it
|
|
422
|
+
* skips the all-vaults cross-chain fanout and only reads the loans for
|
|
423
|
+
* that one pool. The response map is keyed by **lowercased** vault
|
|
424
|
+
* address; look entries up with `address.toLowerCase()`.
|
|
425
|
+
*
|
|
426
|
+
* @param props.chainId Optional chain to scope the read to.
|
|
427
|
+
* @param props.vault Optional vault address. When provided alongside
|
|
428
|
+
* `chainId`, only that vault's borrower-health-factor data is fetched.
|
|
429
|
+
* @returns Object containing the borrower's health factor by vault.
|
|
430
|
+
*/
|
|
431
|
+
async getVaultBorrowerHealthFactor(props) {
|
|
432
|
+
return await this.vaults.getVaultBorrowerHealthFactor(props?.chainId, props?.vault);
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Get user points from the backend API.
|
|
436
|
+
* This fetches processed points data directly from the backend,
|
|
437
|
+
* removing the need for client-side points calculation.
|
|
438
|
+
* @param userAddress - User wallet address
|
|
439
|
+
* @returns Points data from the backend API
|
|
440
|
+
*/
|
|
441
|
+
async getUserPoints(userAddress) {
|
|
442
|
+
return await this.vaults.getUserPoints(userAddress);
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Register a user for the points program, authenticated by a wallet signature.
|
|
446
|
+
*
|
|
447
|
+
* The caller produces a personal_sign signature over a canonical message
|
|
448
|
+
* containing the user address, referrer (or `"none"`), chain, nonce, and
|
|
449
|
+
* expiry — see `AugustVaults.registerUserForPoints` for the exact template.
|
|
450
|
+
*
|
|
451
|
+
* @param userAddress - EVM wallet address being registered.
|
|
452
|
+
* @param referrerAddress - Optional EVM referrer address.
|
|
453
|
+
* @param chainId - Chain on which the wallet signed; powers the EIP-1271
|
|
454
|
+
* fallback for smart-contract wallets and pins the signature cross-chain.
|
|
455
|
+
* @param signature - 0x-prefixed personal_sign signature over the canonical message.
|
|
456
|
+
* @param nonce - Single-use random string (8–128 chars).
|
|
457
|
+
* @param expiry - Unix seconds; must be in the future, within the backend's TTL.
|
|
458
|
+
* @returns Raw `Response` from the backend.
|
|
459
|
+
*/
|
|
460
|
+
async registerUserForPoints(userAddress, referrerAddress, chainId, signature, nonce, expiry) {
|
|
461
|
+
return await this.vaults.registerUserForPoints(userAddress, referrerAddress, chainId, signature, nonce, expiry);
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Fetch the points leaderboard data.
|
|
465
|
+
* @param params - Optional parameters for pagination and sorting
|
|
466
|
+
* @returns Leaderboard response data
|
|
467
|
+
*/
|
|
468
|
+
async fetchPointsLeaderboard(params) {
|
|
469
|
+
return await this.vaults.fetchPointsLeaderboard(params);
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Fetch the historical unrealized-PnL series for a vault, newest first.
|
|
473
|
+
* Delegates to {@link AugustApi.getVaultUnrealizedPnlHistory} — see it for
|
|
474
|
+
* parameter semantics and thrown errors.
|
|
475
|
+
*/
|
|
476
|
+
async getVaultUnrealizedPnlHistory(params) {
|
|
477
|
+
return await this.api.getVaultUnrealizedPnlHistory(params);
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Fetch the latest unrealized-PnL snapshot for every tracked vault.
|
|
481
|
+
* Delegates to {@link AugustApi.getLatestUnrealizedPnl} — see it for
|
|
482
|
+
* return shape and thrown errors.
|
|
483
|
+
*/
|
|
484
|
+
async getLatestUnrealizedPnl() {
|
|
485
|
+
return await this.api.getLatestUnrealizedPnl();
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Get annualized APY metrics for a vault.
|
|
489
|
+
*
|
|
490
|
+
* Supported Vaults: cUSDO, tETH, wstETH, rsETH
|
|
491
|
+
*
|
|
492
|
+
* @deprecated The `hgETH30dLiquidAPY` and `hgETH7dLiquidAPY` response fields are deprecated.
|
|
493
|
+
* These fields will be removed on 2026-01-01.
|
|
494
|
+
* Use `liquidAPY30Day` and `liquidAPY7Day` fields instead.
|
|
495
|
+
*
|
|
496
|
+
* @param props - Vault address
|
|
497
|
+
* @returns Annualized APY data including liquidity APY
|
|
498
|
+
*/
|
|
499
|
+
async getVaultAnnualizedApy(props) {
|
|
500
|
+
return await this.vaults.getVaultAnnualizedApy(props.vault);
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Get summary data for a vault (name, type, chain, recent returns).
|
|
504
|
+
* @param props - Vault address
|
|
505
|
+
* @returns Vault summary data
|
|
506
|
+
*/
|
|
507
|
+
async getVaultSummary(props) {
|
|
508
|
+
return await this.vaults.getVaultSummary(props.vault);
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Get withdrawal summary and pending queue for a vault.
|
|
512
|
+
* @param props - Vault address and optional chain ID
|
|
513
|
+
* @returns Withdrawal summary and pending queue
|
|
514
|
+
*/
|
|
515
|
+
async getVaultWithdrawals(props) {
|
|
516
|
+
return await this.vaults.getVaultWithdrawals(props.vault, props.chainId);
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Preview the amount of assets that would be received for redeeming shares (queued redemption).
|
|
520
|
+
* @param props - Vault contract address, shares amount, and optional chain ID
|
|
521
|
+
* @returns The amount of assets as {@link INormalizedNumber}
|
|
522
|
+
*/
|
|
523
|
+
async previewRedemption(props) {
|
|
524
|
+
return await this.vaults.previewRedemption(props);
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Query LayerZero USDC deposits from the august-layerzero subgraphs.
|
|
528
|
+
* Returns all deposits or filters by sender wallet address if provided.
|
|
529
|
+
*
|
|
530
|
+
* **Important Notes:**
|
|
531
|
+
* - Only deposit transactions are tracked (not withdrawals or other operations)
|
|
532
|
+
* - Sender and recipient addresses are stored in bytes32 format in the subgraph
|
|
533
|
+
* - Timestamps are available from the subgraph
|
|
534
|
+
*
|
|
535
|
+
* **Supported Vaults:**
|
|
536
|
+
* - `upusdc`: 0x80E1048eDE66ec4c364b4F22C8768fc657FF6A42
|
|
537
|
+
* - `coreusdc`: 0xE9B725010A9E419412ed67d0fA5f3A5f40159D32
|
|
538
|
+
* - `earnausd`: 0x36eDbF0C834591BFdfCaC0Ef9605528c75c406aA
|
|
539
|
+
*
|
|
540
|
+
* @param props - Receipt token type ('upusdc', 'coreusdc', or 'earnausd') and optional wallet address to filter by sender
|
|
541
|
+
* @returns Array of deposit events with the following structure:
|
|
542
|
+
* - `assetAmt`: Amount of assets deposited (as string)
|
|
543
|
+
* - `shareAmt`: Amount of shares received (as string)
|
|
544
|
+
* - `sender`: Sender address in bytes32 format
|
|
545
|
+
* - `recipient`: Recipient address in bytes32 format
|
|
546
|
+
* - `dstEid`: Destination endpoint ID (LayerZero chain identifier)
|
|
547
|
+
* - `transactionHash_`: Transaction hash
|
|
548
|
+
*
|
|
549
|
+
* @throws Error if receipt token is invalid or GraphQL request fails
|
|
550
|
+
*
|
|
551
|
+
* @example
|
|
552
|
+
* ```typescript
|
|
553
|
+
* // Get all coreUSDC deposits
|
|
554
|
+
* const allDeposits = await sdk.getLayerZeroDeposits({
|
|
555
|
+
* receiptToken: 'coreusdc'
|
|
556
|
+
* });
|
|
557
|
+
*
|
|
558
|
+
* // Get deposits for a specific wallet
|
|
559
|
+
* const userDeposits = await sdk.getLayerZeroDeposits({
|
|
560
|
+
* receiptToken: 'upusdc',
|
|
561
|
+
* wallet: '0xb0280B58F541131b29D1B33319CD440a99eA0305'
|
|
562
|
+
* });
|
|
563
|
+
* ```
|
|
564
|
+
*/
|
|
565
|
+
async getLayerZeroDeposits(props) {
|
|
566
|
+
// Runtime validation for receipt token
|
|
567
|
+
const validTokens = ['upusdc', 'coreusdc', 'earnausd'];
|
|
568
|
+
if (!validTokens.includes(props.receiptToken)) {
|
|
569
|
+
throw new Error(`Invalid receiptToken: ${props.receiptToken}. Must be 'upusdc', 'coreusdc', or 'earnausd'.`);
|
|
570
|
+
}
|
|
571
|
+
const { queryLayerZeroDeposits } = await Promise.resolve().then(() => __importStar(require('./services/layerzero/deposits')));
|
|
572
|
+
// Map receipt token to vault key
|
|
573
|
+
const vaultKeyMap = {
|
|
574
|
+
upusdc: 'upUSDC',
|
|
575
|
+
coreusdc: 'coreUSDC',
|
|
576
|
+
earnausd: 'earnAUSD',
|
|
577
|
+
};
|
|
578
|
+
const vaultKey = vaultKeyMap[props.receiptToken];
|
|
579
|
+
return await queryLayerZeroDeposits(vaultKey, props.wallet);
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Get LayerZero redeems for earnAUSD vault
|
|
583
|
+
*
|
|
584
|
+
* @example
|
|
585
|
+
* ```typescript
|
|
586
|
+
* // Get all earnAUSD redeems
|
|
587
|
+
* const allRedeems = await sdk.getLayerZeroRedeems();
|
|
588
|
+
*
|
|
589
|
+
* // Get redeems for a specific wallet
|
|
590
|
+
* const userRedeems = await sdk.getLayerZeroRedeems({
|
|
591
|
+
* wallet: '0x2de1DCB8EaAd40fAd327fa3eE3F48774b8e20649'
|
|
592
|
+
* });
|
|
593
|
+
* ```
|
|
594
|
+
*/
|
|
595
|
+
async getLayerZeroRedeems(props) {
|
|
596
|
+
const { queryLayerZeroRedeems } = await Promise.resolve().then(() => __importStar(require('./services/layerzero/redeems')));
|
|
597
|
+
return await queryLayerZeroRedeems(props?.wallet);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
exports.AugustSDK = AugustSDK;
|
|
601
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type IFetchAugustOptions } from '../../core';
|
|
2
|
+
import type { ICollateralExcessOrDeficit, ICollateralSimulationInput, ICollateralSimulationResults, ICuratorWhitelistStatus, IDiscountFactorLadder, ILoanBookInfo, IOracleClassification, IOtcMarginRequirement, IOtcPositionRead, IRevertReason, ITimelockRequest, IVaultPerformanceFees, IWSSubaccountListItem } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Fetch the global loan-book aggregate (admin-only `GET /dashboard/loans`).
|
|
5
|
+
*/
|
|
6
|
+
export declare const fetchDashboardLoans: (augustKey: string, headers?: IFetchAugustOptions["headers"]) => Promise<ILoanBookInfo[]>;
|
|
7
|
+
/**
|
|
8
|
+
* Fetch every token discount-factor ladder (`GET /risk/discount_factors`).
|
|
9
|
+
*/
|
|
10
|
+
export declare const fetchDiscountFactors: (augustKey: string, headers?: IFetchAugustOptions["headers"]) => Promise<IDiscountFactorLadder[]>;
|
|
11
|
+
/**
|
|
12
|
+
* Fetch a subaccount's collateral excess/deficit for one token
|
|
13
|
+
* (`GET /risk/collateral_excess_or_deficit`).
|
|
14
|
+
*/
|
|
15
|
+
export declare const fetchCollateralExcessOrDeficit: (params: {
|
|
16
|
+
subaccount: string;
|
|
17
|
+
tokenAddress: string;
|
|
18
|
+
tokenChain: number;
|
|
19
|
+
targetHealthFactor?: number;
|
|
20
|
+
}, augustKey: string, headers?: IFetchAugustOptions["headers"]) => Promise<ICollateralExcessOrDeficit>;
|
|
21
|
+
/**
|
|
22
|
+
* Run a collateral simulation (`POST /risk/collateral_simulation`). This is a
|
|
23
|
+
* pure, read-only simulation — the backend computes required collateral for a
|
|
24
|
+
* hypothetical loan and changes no state.
|
|
25
|
+
*/
|
|
26
|
+
export declare const fetchCollateralSimulation: (body: ICollateralSimulationInput, augustKey: string, headers?: IFetchAugustOptions["headers"]) => Promise<ICollateralSimulationResults>;
|
|
27
|
+
/**
|
|
28
|
+
* Fetch the decoded revert reason(s) for a transaction from the public
|
|
29
|
+
* `GET /revert_reason` endpoint. No API key required.
|
|
30
|
+
*/
|
|
31
|
+
export declare const fetchRevertReason: (txHash: string, chain: number, headers?: IFetchAugustOptions["headers"]) => Promise<IRevertReason>;
|
|
32
|
+
/**
|
|
33
|
+
* Fetch all OTC positions (admin-only `GET /otc/position`).
|
|
34
|
+
*/
|
|
35
|
+
export declare const fetchOtcPositions: (augustKey: string, headers?: IFetchAugustOptions["headers"]) => Promise<IOtcPositionRead[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Fetch OTC margin requirements (admin-only `GET /otc/margin_requirement`),
|
|
38
|
+
* optionally filtered by counterparty id and/or payer.
|
|
39
|
+
*/
|
|
40
|
+
export declare const fetchOtcMarginRequirements: (filters: {
|
|
41
|
+
otcCounterpartyId?: string;
|
|
42
|
+
payer?: string;
|
|
43
|
+
}, augustKey: string, headers?: IFetchAugustOptions["headers"]) => Promise<IOtcMarginRequirement[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Fetch the subaccounts linked to a vault (curator-or-admin
|
|
46
|
+
* `GET /curator/vaults/{vault_address}/subaccounts`).
|
|
47
|
+
*/
|
|
48
|
+
export declare const fetchCuratorVaultSubaccounts: (vaultAddress: string, augustKey: string, headers?: IFetchAugustOptions["headers"]) => Promise<IWSSubaccountListItem[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Fetch on-chain whitelist status for a vault's subaccounts (curator-or-admin
|
|
51
|
+
* `GET /curator/vaults/{vault_address}/whitelist`). EVM vaults only — the
|
|
52
|
+
* backend 400s for non-EVM vaults.
|
|
53
|
+
*/
|
|
54
|
+
export declare const fetchCuratorVaultWhitelist: (vaultAddress: string, augustKey: string, headers?: IFetchAugustOptions["headers"]) => Promise<ICuratorWhitelistStatus[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Fetch timelock requests for a vault on a chain (`GET /timelock-requests`),
|
|
57
|
+
* optionally filtered by status.
|
|
58
|
+
*/
|
|
59
|
+
export declare const fetchTimelockRequests: (params: {
|
|
60
|
+
vaultAddress: string;
|
|
61
|
+
chainId: number;
|
|
62
|
+
status?: string;
|
|
63
|
+
}, augustKey: string, headers?: IFetchAugustOptions["headers"]) => Promise<ITimelockRequest[]>;
|
|
64
|
+
/**
|
|
65
|
+
* Fetch a vault's performance-fee computation
|
|
66
|
+
* (`GET /metrics/vault_performance_fees`). Slow first call (pandas over full
|
|
67
|
+
* snapshot history); 20-minute server-side cache.
|
|
68
|
+
*/
|
|
69
|
+
export declare const fetchVaultPerformanceFees: (params: {
|
|
70
|
+
vaultAddress: string;
|
|
71
|
+
annualizedFeesPct: number;
|
|
72
|
+
nativeDenominated: boolean;
|
|
73
|
+
calculationPeriod: string;
|
|
74
|
+
startDate?: string;
|
|
75
|
+
endDate?: string;
|
|
76
|
+
}, augustKey: string, headers?: IFetchAugustOptions["headers"]) => Promise<IVaultPerformanceFees>;
|
|
77
|
+
/**
|
|
78
|
+
* Fetch a vault's NAV-oracle classification table from the public
|
|
79
|
+
* `GET /upshift/oracle_classification/{vault_address}` endpoint. No API key
|
|
80
|
+
* required.
|
|
81
|
+
*/
|
|
82
|
+
export declare const fetchVaultOracleClassification: (vaultAddress: string, chainId: number, headers?: IFetchAugustOptions["headers"]) => Promise<IOracleClassification>;
|