@augustdigital/sdk 8.3.1 → 8.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/abis/ERC20_Bytes32.d.ts +4 -0
- package/lib/abis/ERC20_Bytes32.js +4 -0
- package/lib/abis/ERC4626.d.ts +1 -0
- package/lib/abis/ERC4626.js +1 -0
- package/lib/abis/ERC721.d.ts +1 -0
- package/lib/abis/ERC721.js +1 -0
- package/lib/abis/FeeOracle.js +1 -0
- package/lib/abis/LendingPool.js +1 -0
- package/lib/abis/LendingPoolV2.js +1 -0
- package/lib/abis/Multicall3.js +3 -0
- package/lib/abis/OFT.d.ts +20 -0
- package/lib/abis/OFT.js +20 -0
- package/lib/abis/SmartAccount.d.ts +1 -0
- package/lib/abis/SmartAccount.js +3 -0
- package/lib/abis/SwapRouter.d.ts +1 -0
- package/lib/abis/SwapRouter.js +1 -0
- package/lib/abis/UniversalSignatureValidator.js +3 -0
- package/lib/abis/index.d.ts +5 -0
- package/lib/abis/index.js +5 -0
- package/lib/adapters/evm/getters.d.ts +17 -2
- package/lib/adapters/evm/getters.js +35 -3
- package/lib/adapters/evm/index.d.ts +262 -0
- package/lib/adapters/evm/index.js +268 -1
- package/lib/adapters/evm/utils.d.ts +6 -0
- package/lib/adapters/evm/utils.js +7 -0
- package/lib/adapters/solana/constants.js +4 -1
- package/lib/adapters/solana/getters.d.ts +8 -0
- package/lib/adapters/solana/getters.js +21 -0
- package/lib/adapters/solana/idl/vault-idl.js +9 -0
- package/lib/adapters/solana/index.d.ts +55 -0
- package/lib/adapters/solana/index.js +57 -0
- package/lib/adapters/solana/utils.d.ts +28 -0
- package/lib/adapters/solana/utils.js +79 -4
- package/lib/adapters/solana/vault.actions.d.ts +19 -0
- package/lib/adapters/solana/vault.actions.js +47 -3
- package/lib/adapters/stellar/actions.d.ts +25 -0
- package/lib/adapters/stellar/actions.js +33 -0
- package/lib/adapters/stellar/constants.d.ts +26 -0
- package/lib/adapters/stellar/constants.js +29 -0
- package/lib/adapters/stellar/getters.d.ts +56 -0
- package/lib/adapters/stellar/getters.js +81 -0
- package/lib/adapters/stellar/index.d.ts +48 -0
- package/lib/adapters/stellar/index.js +48 -0
- package/lib/adapters/stellar/soroban.d.ts +20 -0
- package/lib/adapters/stellar/soroban.js +46 -0
- package/lib/adapters/stellar/submit.d.ts +12 -0
- package/lib/adapters/stellar/submit.js +19 -0
- package/lib/adapters/stellar/types.d.ts +27 -0
- package/lib/adapters/stellar/types.js +3 -0
- package/lib/adapters/stellar/utils.d.ts +10 -0
- package/lib/adapters/stellar/utils.js +10 -0
- package/lib/adapters/sui/getters.d.ts +6 -0
- package/lib/adapters/sui/getters.js +6 -0
- package/lib/adapters/sui/index.d.ts +15 -0
- package/lib/adapters/sui/index.js +15 -0
- package/lib/adapters/sui/transformer.d.ts +6 -0
- package/lib/adapters/sui/transformer.js +7 -0
- package/lib/adapters/sui/utils.d.ts +6 -0
- package/lib/adapters/sui/utils.js +6 -0
- package/lib/core/analytics/chain-name.d.ts +8 -0
- package/lib/core/analytics/chain-name.js +8 -0
- package/lib/core/analytics/constants.d.ts +4 -0
- package/lib/core/analytics/constants.js +4 -0
- package/lib/core/analytics/env.d.ts +25 -0
- package/lib/core/analytics/env.js +26 -0
- package/lib/core/analytics/index.d.ts +26 -0
- package/lib/core/analytics/index.js +35 -0
- package/lib/core/analytics/instrumentation.d.ts +26 -0
- package/lib/core/analytics/instrumentation.js +66 -2
- package/lib/core/analytics/method-taxonomy.d.ts +16 -0
- package/lib/core/analytics/method-taxonomy.js +18 -0
- package/lib/core/analytics/metrics.d.ts +23 -0
- package/lib/core/analytics/metrics.js +40 -0
- package/lib/core/analytics/sanitize.d.ts +38 -0
- package/lib/core/analytics/sanitize.js +46 -0
- package/lib/core/analytics/sentry-runtime.d.ts +11 -0
- package/lib/core/analytics/sentry-runtime.js +19 -0
- package/lib/core/analytics/sentry.d.ts +45 -0
- package/lib/core/analytics/sentry.js +115 -2
- package/lib/core/analytics/types.d.ts +27 -0
- package/lib/core/analytics/user-identity.d.ts +34 -0
- package/lib/core/analytics/user-identity.js +42 -0
- package/lib/core/analytics/version.d.ts +6 -1
- package/lib/core/analytics/version.js +6 -1
- package/lib/core/auth/verify.js +5 -0
- package/lib/core/base.class.d.ts +75 -0
- package/lib/core/base.class.js +56 -0
- package/lib/core/cache.d.ts +5 -0
- package/lib/core/cache.js +6 -0
- package/lib/core/constants/adapters.d.ts +15 -0
- package/lib/core/constants/adapters.js +28 -8
- package/lib/core/constants/core.d.ts +12 -1
- package/lib/core/constants/core.js +12 -0
- package/lib/core/constants/swap-router.d.ts +46 -0
- package/lib/core/constants/swap-router.js +50 -0
- package/lib/core/constants/vaults.d.ts +56 -0
- package/lib/core/constants/vaults.js +66 -1
- package/lib/core/constants/web3.d.ts +3 -0
- package/lib/core/constants/web3.js +18 -5
- package/lib/core/errors/index.d.ts +36 -0
- package/lib/core/errors/index.js +29 -0
- package/lib/core/fetcher.d.ts +134 -0
- package/lib/core/fetcher.js +191 -5
- package/lib/core/helpers/adapters.d.ts +9 -0
- package/lib/core/helpers/adapters.js +11 -0
- package/lib/core/helpers/chain-address.d.ts +10 -0
- package/lib/core/helpers/chain-address.js +11 -0
- package/lib/core/helpers/core.d.ts +42 -0
- package/lib/core/helpers/core.js +66 -1
- package/lib/core/helpers/explorer-link.d.ts +14 -0
- package/lib/core/helpers/explorer-link.js +14 -0
- package/lib/core/helpers/signer.d.ts +26 -0
- package/lib/core/helpers/signer.js +39 -0
- package/lib/core/helpers/swap-router.d.ts +32 -0
- package/lib/core/helpers/swap-router.js +32 -0
- package/lib/core/helpers/vault-version.d.ts +1 -0
- package/lib/core/helpers/vault-version.js +2 -0
- package/lib/core/helpers/vaults.d.ts +8 -0
- package/lib/core/helpers/vaults.js +22 -8
- package/lib/core/helpers/web3.d.ts +152 -0
- package/lib/core/helpers/web3.js +183 -6
- package/lib/core/logger/index.d.ts +55 -0
- package/lib/core/logger/index.js +19 -0
- package/lib/core/logger/slack.d.ts +3 -0
- package/lib/core/logger/slack.js +3 -0
- package/lib/core/vault-metadata.d.ts +6 -0
- package/lib/core/vault-metadata.js +6 -0
- package/lib/core/version-check.d.ts +52 -0
- package/lib/core/version-check.js +81 -0
- package/lib/evm/methods/crossChainVault.d.ts +90 -0
- package/lib/evm/methods/crossChainVault.js +186 -1
- package/lib/evm/methods/crossChainVaultRegistry.d.ts +93 -0
- package/lib/evm/methods/crossChainVaultRegistry.js +240 -0
- package/lib/evm/methods/index.d.ts +1 -0
- package/lib/evm/methods/index.js +1 -0
- package/lib/evm/types/crossChain.d.ts +202 -0
- package/lib/evm/types/crossChain.js +11 -0
- package/lib/index.d.ts +16 -0
- package/lib/index.js +19 -0
- package/lib/main.d.ts +288 -5
- package/lib/main.js +305 -0
- package/lib/modules/api/index.d.ts +1 -0
- package/lib/modules/api/index.js +6 -0
- package/lib/modules/api/main.d.ts +52 -0
- package/lib/modules/api/main.js +130 -0
- package/lib/modules/sub-accounts/fetcher.d.ts +15 -0
- package/lib/modules/sub-accounts/fetcher.js +15 -0
- package/lib/modules/sub-accounts/main.d.ts +33 -0
- package/lib/modules/sub-accounts/main.js +38 -0
- package/lib/modules/sub-accounts/utils.d.ts +3 -0
- package/lib/modules/sub-accounts/utils.js +3 -0
- package/lib/modules/vaults/adapter.helpers.d.ts +18 -0
- package/lib/modules/vaults/adapter.helpers.js +34 -0
- package/lib/modules/vaults/fetcher.d.ts +20 -0
- package/lib/modules/vaults/fetcher.js +40 -3
- package/lib/modules/vaults/getters.d.ts +295 -0
- package/lib/modules/vaults/getters.js +552 -12
- package/lib/modules/vaults/index.d.ts +12 -0
- package/lib/modules/vaults/index.js +12 -0
- package/lib/modules/vaults/main.d.ts +292 -4
- package/lib/modules/vaults/main.js +379 -7
- package/lib/modules/vaults/read.actions.d.ts +168 -0
- package/lib/modules/vaults/read.actions.js +143 -0
- package/lib/modules/vaults/types.d.ts +34 -0
- package/lib/modules/vaults/utils/call-data-decoder.d.ts +47 -0
- package/lib/modules/vaults/utils/call-data-decoder.js +56 -0
- package/lib/modules/vaults/utils/date-utils.d.ts +39 -0
- package/lib/modules/vaults/utils/date-utils.js +47 -1
- package/lib/modules/vaults/utils.d.ts +70 -0
- package/lib/modules/vaults/utils.js +108 -5
- package/lib/modules/vaults/write.actions.d.ts +363 -3
- package/lib/modules/vaults/write.actions.js +364 -2
- package/lib/polyfills.js +2 -0
- package/lib/sdk.d.ts +23705 -0
- package/lib/services/coingecko/fetcher.d.ts +13 -0
- package/lib/services/coingecko/fetcher.js +17 -0
- package/lib/services/debank/fetcher.d.ts +14 -0
- package/lib/services/debank/fetcher.js +12 -0
- package/lib/services/debank/utils.js +17 -0
- package/lib/services/layerzero/deposits.d.ts +11 -0
- package/lib/services/layerzero/deposits.js +34 -11
- package/lib/services/layerzero/redeems.d.ts +10 -0
- package/lib/services/layerzero/redeems.js +13 -0
- package/lib/services/layerzero/utils.d.ts +8 -0
- package/lib/services/layerzero/utils.js +11 -0
- package/lib/services/octavfi/fetcher.d.ts +7 -0
- package/lib/services/octavfi/fetcher.js +25 -0
- package/lib/services/octavfi/utils.d.ts +12 -0
- package/lib/services/octavfi/utils.js +44 -10
- package/lib/services/subgraph/fetcher.js +4 -2
- package/lib/services/subgraph/vaults.d.ts +12 -0
- package/lib/services/subgraph/vaults.js +43 -2
- package/lib/services/swap-quotes/index.d.ts +71 -0
- package/lib/services/swap-quotes/index.js +25 -0
- package/lib/services/swap-quotes/paraswap.d.ts +17 -0
- package/lib/services/swap-quotes/paraswap.js +14 -0
- package/lib/types/pools.d.ts +3 -0
- package/lib/types/typed-contract.d.ts +64 -0
- package/lib/types/vaults.d.ts +139 -2
- package/lib/types/vaults.js +10 -0
- package/lib/types/web3.d.ts +8 -0
- package/lib/types/web3.js +1 -0
- package/lib/types/webserver.d.ts +45 -0
- package/package.json +6 -5
|
@@ -1,17 +1,67 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
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
|
+
/**
|
|
5
|
+
* Address of the `SwapRouter` periphery contract on each supported chain.
|
|
6
|
+
*
|
|
7
|
+
* Missing keys mean no SwapRouter is deployed on that chain — callers
|
|
8
|
+
* should fall back to legacy adapter paths.
|
|
9
|
+
*
|
|
10
|
+
* @see {@link getSwapRouterAddress} for the typed lookup helper.
|
|
11
|
+
*/
|
|
4
12
|
exports.SWAP_ROUTER_ADDRESSES = {
|
|
5
13
|
1: '0xAC771209FF2b71EECfF6E85a9AD01db8Ff2618B0',
|
|
6
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Vault addresses registered on a `SwapRouter` via `enableVault`. The
|
|
17
|
+
* presence of a vault here is the signal to route its deposits through the
|
|
18
|
+
* SwapRouter rather than the legacy adapter path.
|
|
19
|
+
*
|
|
20
|
+
* Entries mirror the on-chain `vaultInfo[addr].referenceAsset != 0` state of
|
|
21
|
+
* the `SwapRouter` deployment. Verify against the deployed contract before
|
|
22
|
+
* adding a new entry — a vault that is not registered on-chain will revert
|
|
23
|
+
* with `InvalidVault` at deposit time.
|
|
24
|
+
*
|
|
25
|
+
* Lowercase comparison is required when checking — use
|
|
26
|
+
* {@link vaultUsesSwapRouter} rather than reading this set directly.
|
|
27
|
+
*/
|
|
7
28
|
exports.VAULTS_USING_SWAP_ROUTER = new Set([
|
|
29
|
+
// Upshift Core USDC — ERC-4626 vault, reference asset USDC. Enabled on
|
|
30
|
+
// the mainnet SwapRouter at vaultType=1 (VAULT_TYPE_ERC4626).
|
|
8
31
|
'0xe9b725010a9e419412ed67d0fa5f3a5f40159d32',
|
|
32
|
+
// Sentora USD — Tokenized Vault V2, reference asset USDC. Enabled on the
|
|
33
|
+
// mainnet SwapRouter at vaultType=2 (VAULT_TYPE_TOKENIZED_VAULT_V2).
|
|
9
34
|
'0x74ad2f789ed583dbd141bbdafc673fe1f033718b',
|
|
10
35
|
]);
|
|
36
|
+
/**
|
|
37
|
+
* 32-byte origin codes registered on the `SwapRouter` via `addOrigin`.
|
|
38
|
+
* Drives origin/referral-fee accrual. The on-chain admin must register a
|
|
39
|
+
* code before it can be used — calls with an unknown code revert with
|
|
40
|
+
* `InvalidOrigin`.
|
|
41
|
+
*
|
|
42
|
+
* `default` is the all-zero sentinel — the SwapRouter treats it as "no
|
|
43
|
+
* origin fee" and skips the origin-fee transfer.
|
|
44
|
+
*/
|
|
11
45
|
exports.ORIGIN_CODES = {
|
|
46
|
+
/** All-zero sentinel — no origin fee. */
|
|
12
47
|
default: '0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
13
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* Maximum number of swap legs the contract accepts in a single
|
|
51
|
+
* `swapAndDeposit` call. Mirrors the on-chain `MAX_SWAPS` constant; reading
|
|
52
|
+
* the on-chain value at call time would add an RPC for no gain.
|
|
53
|
+
*
|
|
54
|
+
* Kept here so the SDK can reject oversize inputs at the boundary rather
|
|
55
|
+
* than wait for the on-chain `TooManySwaps` revert.
|
|
56
|
+
*/
|
|
14
57
|
exports.SWAP_ROUTER_MAX_SWAPS = 9;
|
|
58
|
+
/**
|
|
59
|
+
* Wrapped-native ERC-20 per chain that has a SwapRouter deployment. Mirrors
|
|
60
|
+
* the on-chain `wrappedNativeTokenAddress()` view to avoid an extra RPC on
|
|
61
|
+
* every dispatch. Used to validate that native-token deposits target a
|
|
62
|
+
* vault whose reference asset is the wrapped native — the only configuration
|
|
63
|
+
* the contract's `depositNativeToken` / `swapAndDepositNativeToken` accept.
|
|
64
|
+
*/
|
|
15
65
|
exports.SWAP_ROUTER_WRAPPED_NATIVE = {
|
|
16
66
|
1: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
17
67
|
};
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { IAddress, IPoolFunctions } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Table of Contents
|
|
4
|
+
* - Hardcoded Addresses
|
|
5
|
+
* - Vault Functions to Call
|
|
6
|
+
* - Subgraph URLs
|
|
7
|
+
* - Vault Receipt Symbol Mapping
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Hardcoded subaccount addresses for specific vaults allocations
|
|
11
|
+
*/
|
|
2
12
|
export declare const VAULT_ALLOCATION_SUBACCOUNTS: {
|
|
3
13
|
AgoraAUSD: {
|
|
4
14
|
address: IAddress;
|
|
@@ -11,22 +21,68 @@ export declare const VAULT_ALLOCATION_SUBACCOUNTS: {
|
|
|
11
21
|
useDebank: boolean;
|
|
12
22
|
};
|
|
13
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated use the backend responses /tokenized_vault internal_type field to determine if the vault is an old lending pool
|
|
26
|
+
* @todo use the backend responses /tokenized_vault internal_type field to determine if the vault is an old lending pool
|
|
27
|
+
*/
|
|
14
28
|
export declare const MULTI_ASSET_VAULTS: `0x${string}`[];
|
|
15
29
|
export declare const WRAPPER_ADAPTOR: {
|
|
16
30
|
43114: IAddress;
|
|
17
31
|
1: IAddress;
|
|
18
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated use the backend responses /tokenized_vault internal_type field to determine if the vault is an old lending pool
|
|
35
|
+
* @todo use the backend responses /tokenized_vault internal_type field to determine if the vault is an old lending pool
|
|
36
|
+
*/
|
|
19
37
|
export declare const OLD_LENDING_POOLS: `0x${string}`[];
|
|
20
38
|
export declare const IDLE_CAPITAL_BORROWER_ADDRESS: `0x${string}`[];
|
|
39
|
+
/**
|
|
40
|
+
* Vault addresses to exclude from `getTotalDeposited` TVL aggregation.
|
|
41
|
+
* Addresses are lowercased so EVM, Solana, Sui and Stellar vaults can be
|
|
42
|
+
* checked uniformly (don't wrap them with `getAddress` — non-EVM addresses
|
|
43
|
+
* would throw). Add an address here to drop its `latest_reported_tvl` from
|
|
44
|
+
* the headline number — e.g. closed pre-deposit vaults, test vaults, or
|
|
45
|
+
* migrated v1 pools that are double-counted by a v2 successor.
|
|
46
|
+
*/
|
|
21
47
|
export declare const TVL_EXCLUDED_VAULTS: ReadonlySet<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Vault Functions to Call
|
|
50
|
+
*/
|
|
51
|
+
/**
|
|
52
|
+
* The functions to call on the vault contract
|
|
53
|
+
* @returns The functions to call
|
|
54
|
+
*/
|
|
22
55
|
export declare const VAULT_FUNCTIONS_V1: IPoolFunctions[];
|
|
23
56
|
export declare const VAULT_FUNCTIONS_V2: IPoolFunctions[];
|
|
24
57
|
export declare const VAULT_FUNCTIONS_V2_RECEIPT: IPoolFunctions[];
|
|
25
58
|
export declare const VAULT_FUNCTIONS_V2_WHITELISTED_ASSETS: IPoolFunctions[];
|
|
59
|
+
/**
|
|
60
|
+
* NEMO ETH Yield vault address (lowercase for comparisons)
|
|
61
|
+
*/
|
|
26
62
|
export declare const NEMO_VAULT_ADDRESS = "0xa422c3018c46ba90a14acd14f96cb60616f5c91b";
|
|
63
|
+
/**
|
|
64
|
+
* Subgraph base URL
|
|
65
|
+
* @deprecated use getVaultMetadata to fetch subgraph URLs from the backend
|
|
66
|
+
*/
|
|
27
67
|
export declare const GOLDSKY_BASE_URL = "https://api.goldsky.com/api/private/project_cm9g0xy3o4j6v01vd34r3hvv9/subgraphs";
|
|
68
|
+
/**
|
|
69
|
+
* Subgraph URLs
|
|
70
|
+
* @deprecated use getVaultMetadata to fetch subgraph URLs from the backend
|
|
71
|
+
*/
|
|
28
72
|
export declare const SUBGRAPH_VAULT_URLS: Record<VaultSymbols, string>;
|
|
73
|
+
/**
|
|
74
|
+
* Vault Receipt Symbol Mapping
|
|
75
|
+
* @deprecated use getVaultMetadata to fetch vault symbols from the backend
|
|
76
|
+
*/
|
|
29
77
|
type VaultSymbols = 'predlp' | 'sentusd' | 'pregrid' | 'repouscc' | 'earnxrp' | 'tivkbtc' | 'tivusdt0' | 'supermon' | 'earnmon' | 'k3europ' | 'wmon/ausd' | 'wbtc/ausd' | 'earnausd_monad' | 'sausd' | 'farmbold' | 'sentuscc' | 'sentbtc' | 'svusdc' | 'apusdc' | 'testwethtsa' | 'tacusr' | 'upinjusdt' | 'tac-teth' | 'upausd' | 'taccbbtc' | 'xupusdc' | 'uptbtc' | 'gteth' | 'ageth' | 'upusdc' | 'hgeth' | 'upssylva' | 'hbbtc' | 'hbhype' | 'upazt' | 'susdt' | 'upedge' | 'coreusdc' | 'upcusdo' | 'shifteth' | 'upsusde' | 'uplbtc' | 'upavax' | 'tacrseth' | 'musd' | 'earnausd' | 'alpineusdcflagship' | 'alpinecoinshiftusdc' | 'upbtc' | 'upstrbtc' | 'maxiusr' | 'upgammausdc' | 'xhype' | 'wildusd' | 'alpinebtc' | 'prenusd' | 'upyzusd' | 'upnusd' | 'hlpe' | 'nemo eth yield';
|
|
78
|
+
/**
|
|
79
|
+
* Vault Symbols Mapping
|
|
80
|
+
* @deprecated use getVaultMetadata to fetch vault symbols from the backend
|
|
81
|
+
*/
|
|
30
82
|
export declare const VAULT_SYMBOLS: Record<IAddress, string>;
|
|
83
|
+
/**
|
|
84
|
+
* Vault Symbols Reverse Mapping
|
|
85
|
+
* @deprecated use getVaultMetadata to fetch vault symbols from the backend
|
|
86
|
+
*/
|
|
31
87
|
export declare const VAULT_SYMBOLS_REVERSE: Record<VaultSymbols, IAddress>;
|
|
32
88
|
export {};
|
|
@@ -2,33 +2,63 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VAULT_SYMBOLS_REVERSE = exports.VAULT_SYMBOLS = exports.SUBGRAPH_VAULT_URLS = exports.GOLDSKY_BASE_URL = exports.NEMO_VAULT_ADDRESS = exports.VAULT_FUNCTIONS_V2_WHITELISTED_ASSETS = exports.VAULT_FUNCTIONS_V2_RECEIPT = exports.VAULT_FUNCTIONS_V2 = exports.VAULT_FUNCTIONS_V1 = exports.TVL_EXCLUDED_VAULTS = exports.IDLE_CAPITAL_BORROWER_ADDRESS = exports.OLD_LENDING_POOLS = exports.WRAPPER_ADAPTOR = exports.MULTI_ASSET_VAULTS = exports.VAULT_ALLOCATION_SUBACCOUNTS = void 0;
|
|
4
4
|
const ethers_1 = require("ethers");
|
|
5
|
+
/**
|
|
6
|
+
* Table of Contents
|
|
7
|
+
* - Hardcoded Addresses
|
|
8
|
+
* - Vault Functions to Call
|
|
9
|
+
* - Subgraph URLs
|
|
10
|
+
* - Vault Receipt Symbol Mapping
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Hardcoded subaccount addresses for specific vaults allocations
|
|
14
|
+
*/
|
|
5
15
|
exports.VAULT_ALLOCATION_SUBACCOUNTS = {
|
|
16
|
+
// For the Agora AUSD vault, fetch the vault allocations from the Caleb subaccount
|
|
6
17
|
AgoraAUSD: {
|
|
7
18
|
address: (0, ethers_1.getAddress)('0x828BC5895b78b2fb591018Ca5bDC2064742D6D0f'),
|
|
8
19
|
subaccount: (0, ethers_1.getAddress)('0xFff71B0b66f076C60Fa2f176a34a6EA709ccF21B'),
|
|
9
20
|
useDebank: false,
|
|
10
21
|
},
|
|
22
|
+
// For the Earn AUSD (Monad) vault, fetch the vault loans from the RockawayX subaccount
|
|
23
|
+
// fetch the rest of the exposures from Debank
|
|
11
24
|
earnAUSD: {
|
|
12
25
|
address: (0, ethers_1.getAddress)('0x36eDbF0C834591BFdfCaC0Ef9605528c75c406aA'),
|
|
13
26
|
subaccount: (0, ethers_1.getAddress)('0xC8c0Ffb8Ff3BDA26321224e800B3B38AEaB48799'),
|
|
14
27
|
useDebank: true,
|
|
15
28
|
},
|
|
16
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated use the backend responses /tokenized_vault internal_type field to determine if the vault is an old lending pool
|
|
32
|
+
* @todo use the backend responses /tokenized_vault internal_type field to determine if the vault is an old lending pool
|
|
33
|
+
*/
|
|
17
34
|
exports.MULTI_ASSET_VAULTS = [
|
|
35
|
+
//Wild
|
|
18
36
|
(0, ethers_1.getAddress)('0x18EE038C114a07f4B08b420fb1E4149a4F357249'),
|
|
37
|
+
//Yuzu
|
|
19
38
|
(0, ethers_1.getAddress)('0x517677A19D8ae6FF600FB86C3C7bFCCD651e3eec'),
|
|
39
|
+
//HyENA
|
|
20
40
|
(0, ethers_1.getAddress)('0x8fFDcd8A96d293f45aA044d10b899F9D71897E8a'),
|
|
41
|
+
//SingularV
|
|
21
42
|
(0, ethers_1.getAddress)('0xd411aCaE2Bc7019322277A21ff005d94705661C5'),
|
|
43
|
+
//Neutrl
|
|
22
44
|
(0, ethers_1.getAddress)('0xAEEb2fB279a5aA837367B9D2582F898a63b06ca1'),
|
|
45
|
+
// HCL Stroom
|
|
23
46
|
(0, ethers_1.getAddress)('0x0C949AAf28bF0318bAa5f2cbF2F2D970f57879aB'),
|
|
47
|
+
//Aptos Aave
|
|
24
48
|
(0, ethers_1.getAddress)('0xA38d92eC538e9aa3edb980b89701A9d38a1FE015'),
|
|
49
|
+
// Sentora USCC
|
|
25
50
|
(0, ethers_1.getAddress)('0x63C5d615e937697a80606788965E209414738820'),
|
|
51
|
+
// Sentora wBTC
|
|
26
52
|
(0, ethers_1.getAddress)('0x3cC0D33B1AEac3d23eA89214b3AC5B4607032167'),
|
|
27
53
|
];
|
|
28
54
|
exports.WRAPPER_ADAPTOR = {
|
|
29
55
|
43114: (0, ethers_1.getAddress)('0xb2C57614B93c41A7Ec3B91980C0Bb7453904c6e8'),
|
|
30
56
|
1: (0, ethers_1.getAddress)('0x044155804b2ef8fc53C69E3661ceA9b905EDE7Bc'),
|
|
31
57
|
};
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated use the backend responses /tokenized_vault internal_type field to determine if the vault is an old lending pool
|
|
60
|
+
* @todo use the backend responses /tokenized_vault internal_type field to determine if the vault is an old lending pool
|
|
61
|
+
*/
|
|
32
62
|
exports.OLD_LENDING_POOLS = [
|
|
33
63
|
(0, ethers_1.getAddress)('0xe1B4d34E8754600962Cd944B535180Bd758E6c2e'),
|
|
34
64
|
(0, ethers_1.getAddress)('0xEBac5e50003d4B17Be422ff9775043cD61002f7f'),
|
|
@@ -38,9 +68,25 @@ exports.IDLE_CAPITAL_BORROWER_ADDRESS = [
|
|
|
38
68
|
(0, ethers_1.getAddress)('0x2151C90C93F52bE82186f162c86DaEABc8911188'),
|
|
39
69
|
(0, ethers_1.getAddress)('0xb74c137E5f976dbdCC638Ec9fd3e05d6D9124E55'),
|
|
40
70
|
];
|
|
71
|
+
/**
|
|
72
|
+
* Vault addresses to exclude from `getTotalDeposited` TVL aggregation.
|
|
73
|
+
* Addresses are lowercased so EVM, Solana, Sui and Stellar vaults can be
|
|
74
|
+
* checked uniformly (don't wrap them with `getAddress` — non-EVM addresses
|
|
75
|
+
* would throw). Add an address here to drop its `latest_reported_tvl` from
|
|
76
|
+
* the headline number — e.g. closed pre-deposit vaults, test vaults, or
|
|
77
|
+
* migrated v1 pools that are double-counted by a v2 successor.
|
|
78
|
+
*/
|
|
41
79
|
exports.TVL_EXCLUDED_VAULTS = new Set([
|
|
42
|
-
'0x3299A525986D2e94B3FC6c641C158f5e12dB912d',
|
|
80
|
+
'0x3299A525986D2e94B3FC6c641C158f5e12dB912d', // Fluent Pre Deposit Vault (migrated to fluent mainnet)
|
|
81
|
+
// '0x866C6c6627303Be103814150fC0e886BE5D9ea83', // Neutrl Pre Deposit Vault (migrated to Neutrl mainnet)
|
|
43
82
|
].map((a) => a.toLowerCase()));
|
|
83
|
+
/**
|
|
84
|
+
* Vault Functions to Call
|
|
85
|
+
*/
|
|
86
|
+
/**
|
|
87
|
+
* The functions to call on the vault contract
|
|
88
|
+
* @returns The functions to call
|
|
89
|
+
*/
|
|
44
90
|
exports.VAULT_FUNCTIONS_V1 = [
|
|
45
91
|
'decimals',
|
|
46
92
|
'asset',
|
|
@@ -70,8 +116,19 @@ exports.VAULT_FUNCTIONS_V2_RECEIPT = [
|
|
|
70
116
|
exports.VAULT_FUNCTIONS_V2_WHITELISTED_ASSETS = [
|
|
71
117
|
'getWhitelistedAssets',
|
|
72
118
|
];
|
|
119
|
+
/**
|
|
120
|
+
* NEMO ETH Yield vault address (lowercase for comparisons)
|
|
121
|
+
*/
|
|
73
122
|
exports.NEMO_VAULT_ADDRESS = '0xa422c3018c46ba90a14acd14f96cb60616f5c91b';
|
|
123
|
+
/**
|
|
124
|
+
* Subgraph base URL
|
|
125
|
+
* @deprecated use getVaultMetadata to fetch subgraph URLs from the backend
|
|
126
|
+
*/
|
|
74
127
|
exports.GOLDSKY_BASE_URL = 'https://api.goldsky.com/api/private/project_cm9g0xy3o4j6v01vd34r3hvv9/subgraphs';
|
|
128
|
+
/**
|
|
129
|
+
* Subgraph URLs
|
|
130
|
+
* @deprecated use getVaultMetadata to fetch subgraph URLs from the backend
|
|
131
|
+
*/
|
|
75
132
|
exports.SUBGRAPH_VAULT_URLS = {
|
|
76
133
|
testwethtsa: ``,
|
|
77
134
|
tacusr: `${exports.GOLDSKY_BASE_URL}/august-eth-tacUSR/1.0.0/gn`,
|
|
@@ -134,6 +191,10 @@ exports.SUBGRAPH_VAULT_URLS = {
|
|
|
134
191
|
predlp: `${exports.GOLDSKY_BASE_URL}/august-eth-preDLP/1.0.0/gn`,
|
|
135
192
|
'nemo eth yield': `${exports.GOLDSKY_BASE_URL}/august-mainnet-nemo-eth-yield/1.0.0/gn`,
|
|
136
193
|
};
|
|
194
|
+
/**
|
|
195
|
+
* Vault Symbols Mapping
|
|
196
|
+
* @deprecated use getVaultMetadata to fetch vault symbols from the backend
|
|
197
|
+
*/
|
|
137
198
|
exports.VAULT_SYMBOLS = {
|
|
138
199
|
'0xaBC578B79892FC0Dc2906Ab5749862622aD38695': 'preDLP',
|
|
139
200
|
'0x74aD2F789Ed583DBd141bbdafC673fE1F033718b': 'sentUSD',
|
|
@@ -197,5 +258,9 @@ exports.VAULT_SYMBOLS = {
|
|
|
197
258
|
'0xb2FdA773822E5a04c8A70348d66257DD5Cf442DB': 'farmBOLD',
|
|
198
259
|
'0xA422C3018C46ba90a14AcD14f96CB60616F5c91B': 'NEMO ETH Yield',
|
|
199
260
|
};
|
|
261
|
+
/**
|
|
262
|
+
* Vault Symbols Reverse Mapping
|
|
263
|
+
* @deprecated use getVaultMetadata to fetch vault symbols from the backend
|
|
264
|
+
*/
|
|
200
265
|
exports.VAULT_SYMBOLS_REVERSE = Object.fromEntries(Object.entries(exports.VAULT_SYMBOLS).map(([key, value]) => [value, key]));
|
|
201
266
|
//# sourceMappingURL=vaults.js.map
|
|
@@ -30,6 +30,9 @@ export declare const ORACLE_CONTRACTS: {
|
|
|
30
30
|
};
|
|
31
31
|
export declare const NETWORKS: Record<IChainId, IChainObj>;
|
|
32
32
|
export declare const AVAILABLE_CHAINS: IChainId[];
|
|
33
|
+
/**
|
|
34
|
+
* Fallbacks
|
|
35
|
+
*/
|
|
33
36
|
export declare const FALLBACK_DECIMALS = 18;
|
|
34
37
|
export declare const FALLBACK_CHAINID = 42161;
|
|
35
38
|
export declare const FALLBACK_RPC_URLS: Record<number, string[]>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FALLBACK_RPC_URLS = exports.FALLBACK_CHAINID = exports.FALLBACK_DECIMALS = exports.AVAILABLE_CHAINS = exports.NETWORKS = exports.ORACLE_CONTRACTS = exports.MIN_ABIS = exports.NATIVE_ADDRESS = exports.SPECIAL_CHAINS = void 0;
|
|
4
|
+
// Special Chains
|
|
4
5
|
exports.SPECIAL_CHAINS = {
|
|
5
6
|
solana: {
|
|
6
7
|
name: 'Solana',
|
|
@@ -13,6 +14,7 @@ exports.SPECIAL_CHAINS = {
|
|
|
13
14
|
explorer: 'https://stellar.expert',
|
|
14
15
|
},
|
|
15
16
|
};
|
|
17
|
+
// General
|
|
16
18
|
exports.NATIVE_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
|
|
17
19
|
exports.MIN_ABIS = {
|
|
18
20
|
name: 'function name() view returns (string)',
|
|
@@ -23,13 +25,17 @@ exports.MIN_ABIS = {
|
|
|
23
25
|
allowance: 'function allowance(address owner, address spender) external view returns (uint256)',
|
|
24
26
|
managementFeePercent: 'function managementFeePercent() view returns (uint256)',
|
|
25
27
|
};
|
|
28
|
+
// Search: New Chain
|
|
26
29
|
exports.ORACLE_CONTRACTS = {
|
|
27
|
-
1: '0xA4E24C498D5B28517787D8407eFdcB157A4FbF50',
|
|
28
|
-
43114: '0x755537Cb5C76E06Bb492CF7c73567e252769c5f5',
|
|
29
|
-
42161: '0x24F7BC5CA6E4b53cF7311dE1f5bF8Ba528400E1e',
|
|
30
|
-
8453: '0x07858dF2D8D9aB1DCAAA8b743eb80C6250DFA947',
|
|
31
|
-
10: '0xe0049eBCCB23Cb81c3d4C9Fa175b32876b70C2AB',
|
|
30
|
+
1: '0xA4E24C498D5B28517787D8407eFdcB157A4FbF50', // mainnet
|
|
31
|
+
43114: '0x755537Cb5C76E06Bb492CF7c73567e252769c5f5', // avax
|
|
32
|
+
42161: '0x24F7BC5CA6E4b53cF7311dE1f5bF8Ba528400E1e', // arbitrum
|
|
33
|
+
8453: '0x07858dF2D8D9aB1DCAAA8b743eb80C6250DFA947', // base
|
|
34
|
+
10: '0xe0049eBCCB23Cb81c3d4C9Fa175b32876b70C2AB', // OP
|
|
32
35
|
};
|
|
36
|
+
// Networks
|
|
37
|
+
// Search: New Chain
|
|
38
|
+
// @todo: this should be used for wagmi configs
|
|
33
39
|
exports.NETWORKS = {
|
|
34
40
|
1: {
|
|
35
41
|
name: 'Ethereum',
|
|
@@ -113,9 +119,13 @@ exports.NETWORKS = {
|
|
|
113
119
|
},
|
|
114
120
|
};
|
|
115
121
|
exports.AVAILABLE_CHAINS = Object.keys(exports.NETWORKS).map((c) => Number(c));
|
|
122
|
+
/**
|
|
123
|
+
* Fallbacks
|
|
124
|
+
*/
|
|
116
125
|
exports.FALLBACK_DECIMALS = 18;
|
|
117
126
|
exports.FALLBACK_CHAINID = 42161;
|
|
118
127
|
exports.FALLBACK_RPC_URLS = {
|
|
128
|
+
// Ethereum Mainnet
|
|
119
129
|
1: ['https://ethereum-rpc.publicnode.com'],
|
|
120
130
|
42161: ['https://arbitrum-one-rpc.publicnode.com'],
|
|
121
131
|
8453: ['https://base-rpc.publicnode.com'],
|
|
@@ -135,5 +145,8 @@ exports.FALLBACK_RPC_URLS = {
|
|
|
135
145
|
747474: ['https://rpc.katana.network'],
|
|
136
146
|
4114: ['https://rpc.mainnet.citrea.xyz'],
|
|
137
147
|
25363: ['https://rpc.fluent.xyz'],
|
|
148
|
+
// [-1]: [
|
|
149
|
+
// "https://devnet.helius-rpc.com/?api-key=5f652958-74ed-42e4-a874-0ac8056ac02c"
|
|
150
|
+
// ]
|
|
138
151
|
};
|
|
139
152
|
//# sourceMappingURL=web3.js.map
|
|
@@ -1,40 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error class hierarchy for the SDK. All subclasses extend `AugustSDKError`,
|
|
3
|
+
* which extends the native `Error`.
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { AugustAuthError, AugustTimeoutError } from '@augustdigital/sdk';
|
|
7
|
+
*
|
|
8
|
+
* try {
|
|
9
|
+
* await sdk.getVault(...);
|
|
10
|
+
* } catch (err) {
|
|
11
|
+
* if (err instanceof AugustAuthError) refreshKey();
|
|
12
|
+
* else if (err instanceof AugustTimeoutError) retry();
|
|
13
|
+
* else throw err;
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
/** Stable error codes attached to SDK errors. */
|
|
1
18
|
export type AugustErrorCode = 'AUTH_MISSING_KEY' | 'AUTH_INVALID_KEY' | 'AUTH_FORBIDDEN' | 'AUTH_UNAUTHORIZED' | 'INVALID_URL' | 'INVALID_INPUT' | 'INVALID_CHAIN' | 'INVALID_ADDRESS' | 'NETWORK_ERROR' | 'TIMEOUT' | 'RATE_LIMITED' | 'SERVER_ERROR' | 'UNKNOWN';
|
|
19
|
+
/** Options accepted by every SDK error constructor. */
|
|
2
20
|
export interface AugustErrorOptions {
|
|
21
|
+
/** Original error preserved for stack-trace chaining. */
|
|
3
22
|
cause?: unknown;
|
|
23
|
+
/** Set from the response `x-correlation-id` header when available. */
|
|
4
24
|
correlationId?: string;
|
|
25
|
+
/** Structured context attached to the error for logging. */
|
|
5
26
|
context?: Record<string, unknown>;
|
|
6
27
|
}
|
|
28
|
+
/** Base class for all SDK errors. */
|
|
7
29
|
export declare class AugustSDKError extends Error {
|
|
8
30
|
readonly code: AugustErrorCode;
|
|
9
31
|
readonly correlationId?: string;
|
|
10
32
|
readonly context?: Record<string, unknown>;
|
|
11
33
|
constructor(code: AugustErrorCode, message: string, options?: AugustErrorOptions);
|
|
34
|
+
/**
|
|
35
|
+
* Serialize own properties to a plain object. Native `Error` enumerates
|
|
36
|
+
* nothing, so `JSON.stringify(err)` returns `"{}"` without this.
|
|
37
|
+
*/
|
|
12
38
|
toJSON(): Record<string, unknown>;
|
|
13
39
|
}
|
|
40
|
+
/** Authentication/authorization failure: missing key, invalid key, forbidden. */
|
|
14
41
|
export declare class AugustAuthError extends AugustSDKError {
|
|
15
42
|
constructor(code: Extract<AugustErrorCode, 'AUTH_MISSING_KEY' | 'AUTH_INVALID_KEY' | 'AUTH_FORBIDDEN' | 'AUTH_UNAUTHORIZED'>, message: string, options?: AugustErrorOptions);
|
|
16
43
|
}
|
|
44
|
+
/** Network-level failure: connection refused, DNS, fetch failed. */
|
|
17
45
|
export declare class AugustNetworkError extends AugustSDKError {
|
|
18
46
|
constructor(message: string, options?: AugustErrorOptions);
|
|
19
47
|
}
|
|
48
|
+
/** Request exceeded its deadline. */
|
|
20
49
|
export declare class AugustTimeoutError extends AugustSDKError {
|
|
50
|
+
/** Time elapsed (ms) before the request was aborted. */
|
|
21
51
|
readonly timeoutMs: number;
|
|
22
52
|
constructor(message: string, timeoutMs: number, options?: AugustErrorOptions);
|
|
23
53
|
toJSON(): Record<string, unknown>;
|
|
24
54
|
}
|
|
55
|
+
/** Caller-side input failed validation. */
|
|
25
56
|
export declare class AugustValidationError extends AugustSDKError {
|
|
26
57
|
constructor(code: Extract<AugustErrorCode, 'INVALID_URL' | 'INVALID_INPUT' | 'INVALID_CHAIN' | 'INVALID_ADDRESS'>, message: string, options?: AugustErrorOptions);
|
|
27
58
|
}
|
|
59
|
+
/** Backend rate-limited the request (HTTP 429 or equivalent). */
|
|
28
60
|
export declare class AugustRateLimitError extends AugustSDKError {
|
|
61
|
+
/** Suggested wait before retrying, in milliseconds. */
|
|
29
62
|
readonly retryAfterMs?: number;
|
|
30
63
|
constructor(message: string, options?: AugustErrorOptions & {
|
|
31
64
|
retryAfterMs?: number;
|
|
32
65
|
});
|
|
33
66
|
toJSON(): Record<string, unknown>;
|
|
34
67
|
}
|
|
68
|
+
/** Backend returned a non-OK status that isn't auth, rate-limit, or timeout. */
|
|
35
69
|
export declare class AugustServerError extends AugustSDKError {
|
|
70
|
+
/** HTTP status code returned by the backend. */
|
|
36
71
|
readonly status: number;
|
|
37
72
|
constructor(status: number, message: string, options?: AugustErrorOptions);
|
|
38
73
|
toJSON(): Record<string, unknown>;
|
|
39
74
|
}
|
|
75
|
+
/** Type guard. Works across realms (e.g. Web Worker / VM contexts). */
|
|
40
76
|
export declare function isAugustSDKError(err: unknown): err is AugustSDKError;
|
package/lib/core/errors/index.js
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Error class hierarchy for the SDK. All subclasses extend `AugustSDKError`,
|
|
4
|
+
* which extends the native `Error`.
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { AugustAuthError, AugustTimeoutError } from '@augustdigital/sdk';
|
|
8
|
+
*
|
|
9
|
+
* try {
|
|
10
|
+
* await sdk.getVault(...);
|
|
11
|
+
* } catch (err) {
|
|
12
|
+
* if (err instanceof AugustAuthError) refreshKey();
|
|
13
|
+
* else if (err instanceof AugustTimeoutError) retry();
|
|
14
|
+
* else throw err;
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
2
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
19
|
exports.AugustServerError = exports.AugustRateLimitError = exports.AugustValidationError = exports.AugustTimeoutError = exports.AugustNetworkError = exports.AugustAuthError = exports.AugustSDKError = void 0;
|
|
4
20
|
exports.isAugustSDKError = isAugustSDKError;
|
|
21
|
+
/** Base class for all SDK errors. */
|
|
5
22
|
class AugustSDKError extends Error {
|
|
6
23
|
constructor(code, message, options = {}) {
|
|
7
24
|
super(message);
|
|
@@ -12,8 +29,13 @@ class AugustSDKError extends Error {
|
|
|
12
29
|
if (options.cause !== undefined) {
|
|
13
30
|
this.cause = options.cause;
|
|
14
31
|
}
|
|
32
|
+
// Restore prototype chain for transpilation targets that downlevel `extends Error`.
|
|
15
33
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
16
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Serialize own properties to a plain object. Native `Error` enumerates
|
|
37
|
+
* nothing, so `JSON.stringify(err)` returns `"{}"` without this.
|
|
38
|
+
*/
|
|
17
39
|
toJSON() {
|
|
18
40
|
const out = {
|
|
19
41
|
name: this.name,
|
|
@@ -37,6 +59,7 @@ class AugustSDKError extends Error {
|
|
|
37
59
|
}
|
|
38
60
|
}
|
|
39
61
|
exports.AugustSDKError = AugustSDKError;
|
|
62
|
+
/** Authentication/authorization failure: missing key, invalid key, forbidden. */
|
|
40
63
|
class AugustAuthError extends AugustSDKError {
|
|
41
64
|
constructor(code, message, options) {
|
|
42
65
|
super(code, message, options);
|
|
@@ -44,6 +67,7 @@ class AugustAuthError extends AugustSDKError {
|
|
|
44
67
|
}
|
|
45
68
|
}
|
|
46
69
|
exports.AugustAuthError = AugustAuthError;
|
|
70
|
+
/** Network-level failure: connection refused, DNS, fetch failed. */
|
|
47
71
|
class AugustNetworkError extends AugustSDKError {
|
|
48
72
|
constructor(message, options) {
|
|
49
73
|
super('NETWORK_ERROR', message, options);
|
|
@@ -51,6 +75,7 @@ class AugustNetworkError extends AugustSDKError {
|
|
|
51
75
|
}
|
|
52
76
|
}
|
|
53
77
|
exports.AugustNetworkError = AugustNetworkError;
|
|
78
|
+
/** Request exceeded its deadline. */
|
|
54
79
|
class AugustTimeoutError extends AugustSDKError {
|
|
55
80
|
constructor(message, timeoutMs, options) {
|
|
56
81
|
super('TIMEOUT', message, options);
|
|
@@ -62,6 +87,7 @@ class AugustTimeoutError extends AugustSDKError {
|
|
|
62
87
|
}
|
|
63
88
|
}
|
|
64
89
|
exports.AugustTimeoutError = AugustTimeoutError;
|
|
90
|
+
/** Caller-side input failed validation. */
|
|
65
91
|
class AugustValidationError extends AugustSDKError {
|
|
66
92
|
constructor(code, message, options) {
|
|
67
93
|
super(code, message, options);
|
|
@@ -69,6 +95,7 @@ class AugustValidationError extends AugustSDKError {
|
|
|
69
95
|
}
|
|
70
96
|
}
|
|
71
97
|
exports.AugustValidationError = AugustValidationError;
|
|
98
|
+
/** Backend rate-limited the request (HTTP 429 or equivalent). */
|
|
72
99
|
class AugustRateLimitError extends AugustSDKError {
|
|
73
100
|
constructor(message, options) {
|
|
74
101
|
super('RATE_LIMITED', message, options);
|
|
@@ -83,6 +110,7 @@ class AugustRateLimitError extends AugustSDKError {
|
|
|
83
110
|
}
|
|
84
111
|
}
|
|
85
112
|
exports.AugustRateLimitError = AugustRateLimitError;
|
|
113
|
+
/** Backend returned a non-OK status that isn't auth, rate-limit, or timeout. */
|
|
86
114
|
class AugustServerError extends AugustSDKError {
|
|
87
115
|
constructor(status, message, options) {
|
|
88
116
|
super('SERVER_ERROR', message, options);
|
|
@@ -94,6 +122,7 @@ class AugustServerError extends AugustSDKError {
|
|
|
94
122
|
}
|
|
95
123
|
}
|
|
96
124
|
exports.AugustServerError = AugustServerError;
|
|
125
|
+
/** Type guard. Works across realms (e.g. Web Worker / VM contexts). */
|
|
97
126
|
function isAugustSDKError(err) {
|
|
98
127
|
return (err instanceof AugustSDKError ||
|
|
99
128
|
(err instanceof Error &&
|