@augustdigital/sdk 8.3.2 → 8.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/abis/ERC20_Bytes32.d.ts +4 -0
- package/lib/abis/ERC20_Bytes32.js +4 -0
- package/lib/abis/ERC4626.d.ts +1 -0
- package/lib/abis/ERC4626.js +1 -0
- package/lib/abis/ERC721.d.ts +1 -0
- package/lib/abis/ERC721.js +1 -0
- package/lib/abis/FeeOracle.js +1 -0
- package/lib/abis/LendingPool.js +1 -0
- package/lib/abis/LendingPoolV2.js +1 -0
- package/lib/abis/Multicall3.js +3 -0
- package/lib/abis/OFT.d.ts +20 -0
- package/lib/abis/OFT.js +20 -0
- package/lib/abis/SmartAccount.d.ts +1 -0
- package/lib/abis/SmartAccount.js +3 -0
- package/lib/abis/SwapRouter.d.ts +1 -0
- package/lib/abis/SwapRouter.js +1 -0
- package/lib/abis/UniversalSignatureValidator.js +3 -0
- package/lib/abis/index.d.ts +5 -0
- package/lib/abis/index.js +5 -0
- package/lib/adapters/evm/getters.d.ts +17 -2
- package/lib/adapters/evm/getters.js +35 -3
- package/lib/adapters/evm/index.d.ts +262 -0
- package/lib/adapters/evm/index.js +268 -1
- package/lib/adapters/evm/utils.d.ts +6 -0
- package/lib/adapters/evm/utils.js +7 -0
- package/lib/adapters/solana/constants.js +4 -1
- package/lib/adapters/solana/getters.d.ts +8 -0
- package/lib/adapters/solana/getters.js +21 -0
- package/lib/adapters/solana/idl/vault-idl.js +9 -0
- package/lib/adapters/solana/index.d.ts +55 -0
- package/lib/adapters/solana/index.js +57 -0
- package/lib/adapters/solana/utils.d.ts +28 -0
- package/lib/adapters/solana/utils.js +79 -4
- package/lib/adapters/solana/vault.actions.d.ts +19 -0
- package/lib/adapters/solana/vault.actions.js +47 -3
- package/lib/adapters/stellar/actions.d.ts +25 -0
- package/lib/adapters/stellar/actions.js +33 -0
- package/lib/adapters/stellar/constants.d.ts +26 -0
- package/lib/adapters/stellar/constants.js +29 -0
- package/lib/adapters/stellar/getters.d.ts +56 -0
- package/lib/adapters/stellar/getters.js +81 -0
- package/lib/adapters/stellar/index.d.ts +48 -0
- package/lib/adapters/stellar/index.js +48 -0
- package/lib/adapters/stellar/soroban.d.ts +20 -0
- package/lib/adapters/stellar/soroban.js +46 -0
- package/lib/adapters/stellar/submit.d.ts +12 -0
- package/lib/adapters/stellar/submit.js +19 -0
- package/lib/adapters/stellar/types.d.ts +27 -0
- package/lib/adapters/stellar/types.js +3 -0
- package/lib/adapters/stellar/utils.d.ts +10 -0
- package/lib/adapters/stellar/utils.js +10 -0
- package/lib/adapters/sui/getters.d.ts +6 -0
- package/lib/adapters/sui/getters.js +6 -0
- package/lib/adapters/sui/index.d.ts +15 -0
- package/lib/adapters/sui/index.js +15 -0
- package/lib/adapters/sui/transformer.d.ts +6 -0
- package/lib/adapters/sui/transformer.js +6 -0
- package/lib/adapters/sui/utils.d.ts +6 -0
- package/lib/adapters/sui/utils.js +6 -0
- package/lib/core/analytics/chain-name.d.ts +8 -0
- package/lib/core/analytics/chain-name.js +8 -0
- package/lib/core/analytics/constants.d.ts +4 -0
- package/lib/core/analytics/constants.js +4 -0
- package/lib/core/analytics/env.d.ts +25 -0
- package/lib/core/analytics/env.js +26 -0
- package/lib/core/analytics/index.d.ts +26 -0
- package/lib/core/analytics/index.js +35 -0
- package/lib/core/analytics/instrumentation.d.ts +26 -0
- package/lib/core/analytics/instrumentation.js +66 -2
- package/lib/core/analytics/method-taxonomy.d.ts +16 -0
- package/lib/core/analytics/method-taxonomy.js +18 -0
- package/lib/core/analytics/metrics.d.ts +23 -0
- package/lib/core/analytics/metrics.js +40 -0
- package/lib/core/analytics/sanitize.d.ts +38 -0
- package/lib/core/analytics/sanitize.js +46 -0
- package/lib/core/analytics/sentry-runtime.d.ts +11 -0
- package/lib/core/analytics/sentry-runtime.js +19 -0
- package/lib/core/analytics/sentry.d.ts +45 -0
- package/lib/core/analytics/sentry.js +115 -2
- package/lib/core/analytics/types.d.ts +27 -0
- package/lib/core/analytics/user-identity.d.ts +34 -0
- package/lib/core/analytics/user-identity.js +42 -0
- package/lib/core/analytics/version.d.ts +6 -1
- package/lib/core/analytics/version.js +6 -1
- package/lib/core/auth/verify.js +5 -0
- package/lib/core/base.class.d.ts +75 -0
- package/lib/core/base.class.js +56 -0
- package/lib/core/cache.d.ts +5 -0
- package/lib/core/cache.js +6 -0
- package/lib/core/constants/adapters.d.ts +15 -0
- package/lib/core/constants/adapters.js +28 -8
- package/lib/core/constants/core.d.ts +12 -1
- package/lib/core/constants/core.js +12 -0
- package/lib/core/constants/swap-router.d.ts +46 -0
- package/lib/core/constants/swap-router.js +50 -0
- package/lib/core/constants/vaults.d.ts +56 -0
- package/lib/core/constants/vaults.js +66 -1
- package/lib/core/constants/web3.d.ts +3 -0
- package/lib/core/constants/web3.js +18 -5
- package/lib/core/errors/index.d.ts +36 -0
- package/lib/core/errors/index.js +29 -0
- package/lib/core/fetcher.d.ts +134 -0
- package/lib/core/fetcher.js +191 -5
- package/lib/core/helpers/adapters.d.ts +9 -0
- package/lib/core/helpers/adapters.js +11 -0
- package/lib/core/helpers/chain-address.d.ts +10 -0
- package/lib/core/helpers/chain-address.js +11 -0
- package/lib/core/helpers/core.d.ts +42 -0
- package/lib/core/helpers/core.js +66 -1
- package/lib/core/helpers/explorer-link.d.ts +14 -0
- package/lib/core/helpers/explorer-link.js +14 -0
- package/lib/core/helpers/signer.d.ts +26 -0
- package/lib/core/helpers/signer.js +39 -0
- package/lib/core/helpers/swap-router.d.ts +32 -0
- package/lib/core/helpers/swap-router.js +32 -0
- package/lib/core/helpers/vault-version.d.ts +1 -0
- package/lib/core/helpers/vault-version.js +2 -0
- package/lib/core/helpers/vaults.d.ts +8 -0
- package/lib/core/helpers/vaults.js +22 -8
- package/lib/core/helpers/web3.d.ts +152 -0
- package/lib/core/helpers/web3.js +183 -6
- package/lib/core/logger/index.d.ts +55 -0
- package/lib/core/logger/index.js +19 -0
- package/lib/core/logger/slack.d.ts +3 -0
- package/lib/core/logger/slack.js +3 -0
- package/lib/core/vault-metadata.d.ts +6 -0
- package/lib/core/vault-metadata.js +6 -0
- package/lib/core/version-check.d.ts +52 -0
- package/lib/core/version-check.js +81 -0
- package/lib/evm/methods/crossChainVault.d.ts +90 -0
- package/lib/evm/methods/crossChainVault.js +186 -1
- package/lib/evm/methods/crossChainVaultRegistry.d.ts +93 -0
- package/lib/evm/methods/crossChainVaultRegistry.js +240 -0
- package/lib/evm/methods/index.d.ts +1 -0
- package/lib/evm/methods/index.js +1 -0
- package/lib/evm/types/crossChain.d.ts +202 -0
- package/lib/evm/types/crossChain.js +11 -0
- package/lib/index.d.ts +16 -0
- package/lib/index.js +19 -0
- package/lib/main.d.ts +288 -5
- package/lib/main.js +305 -0
- package/lib/modules/api/index.d.ts +1 -0
- package/lib/modules/api/index.js +6 -0
- package/lib/modules/api/main.d.ts +52 -0
- package/lib/modules/api/main.js +130 -0
- package/lib/modules/sub-accounts/fetcher.d.ts +15 -0
- package/lib/modules/sub-accounts/fetcher.js +15 -0
- package/lib/modules/sub-accounts/main.d.ts +33 -0
- package/lib/modules/sub-accounts/main.js +38 -0
- package/lib/modules/sub-accounts/utils.d.ts +3 -0
- package/lib/modules/sub-accounts/utils.js +3 -0
- package/lib/modules/vaults/adapter.helpers.d.ts +18 -0
- package/lib/modules/vaults/adapter.helpers.js +34 -0
- package/lib/modules/vaults/fetcher.d.ts +20 -0
- package/lib/modules/vaults/fetcher.js +40 -3
- package/lib/modules/vaults/getters.d.ts +295 -0
- package/lib/modules/vaults/getters.js +552 -12
- package/lib/modules/vaults/index.d.ts +12 -0
- package/lib/modules/vaults/index.js +12 -0
- package/lib/modules/vaults/main.d.ts +292 -4
- package/lib/modules/vaults/main.js +379 -7
- package/lib/modules/vaults/read.actions.d.ts +168 -0
- package/lib/modules/vaults/read.actions.js +143 -0
- package/lib/modules/vaults/types.d.ts +34 -0
- package/lib/modules/vaults/utils/call-data-decoder.d.ts +47 -0
- package/lib/modules/vaults/utils/call-data-decoder.js +56 -0
- package/lib/modules/vaults/utils/date-utils.d.ts +39 -0
- package/lib/modules/vaults/utils/date-utils.js +47 -1
- package/lib/modules/vaults/utils.d.ts +69 -0
- package/lib/modules/vaults/utils.js +104 -5
- package/lib/modules/vaults/write.actions.d.ts +363 -3
- package/lib/modules/vaults/write.actions.js +364 -2
- package/lib/polyfills.js +2 -0
- package/lib/sdk.d.ts +23705 -0
- package/lib/services/coingecko/fetcher.d.ts +13 -0
- package/lib/services/coingecko/fetcher.js +17 -0
- package/lib/services/debank/fetcher.d.ts +14 -0
- package/lib/services/debank/fetcher.js +12 -0
- package/lib/services/debank/utils.js +17 -0
- package/lib/services/layerzero/deposits.d.ts +11 -0
- package/lib/services/layerzero/deposits.js +34 -11
- package/lib/services/layerzero/redeems.d.ts +10 -0
- package/lib/services/layerzero/redeems.js +13 -0
- package/lib/services/layerzero/utils.d.ts +8 -0
- package/lib/services/layerzero/utils.js +11 -0
- package/lib/services/octavfi/fetcher.d.ts +7 -0
- package/lib/services/octavfi/fetcher.js +25 -0
- package/lib/services/octavfi/utils.d.ts +12 -0
- package/lib/services/octavfi/utils.js +44 -10
- package/lib/services/subgraph/fetcher.js +4 -2
- package/lib/services/subgraph/vaults.d.ts +12 -0
- package/lib/services/subgraph/vaults.js +43 -2
- package/lib/services/swap-quotes/index.d.ts +71 -0
- package/lib/services/swap-quotes/index.js +25 -0
- package/lib/services/swap-quotes/paraswap.d.ts +17 -0
- package/lib/services/swap-quotes/paraswap.js +14 -0
- package/lib/types/pools.d.ts +3 -0
- package/lib/types/typed-contract.d.ts +64 -0
- package/lib/types/vaults.d.ts +137 -2
- package/lib/types/vaults.js +10 -0
- package/lib/types/web3.d.ts +8 -0
- package/lib/types/web3.js +1 -0
- package/lib/types/webserver.d.ts +45 -0
- package/package.json +6 -5
|
@@ -5,7 +5,12 @@ exports.isStellarAddress = isStellarAddress;
|
|
|
5
5
|
exports.isSuiAddress = isSuiAddress;
|
|
6
6
|
const ethers_1 = require("ethers");
|
|
7
7
|
const web3_js_1 = require("@solana/web3.js");
|
|
8
|
+
/** Stellar uses RFC 4648 base32; 56 chars, prefixed by G (public key) or C (contract/Soroban). */
|
|
8
9
|
const STELLAR_ADDRESS_RE = /^[A-Z2-7]{56}$/;
|
|
10
|
+
/**
|
|
11
|
+
* Check if a string is a valid Solana base58 address (including PDAs).
|
|
12
|
+
* Returns `false` for EVM hex addresses.
|
|
13
|
+
*/
|
|
9
14
|
function isSolanaAddress(address) {
|
|
10
15
|
if (!address)
|
|
11
16
|
return false;
|
|
@@ -19,6 +24,11 @@ function isSolanaAddress(address) {
|
|
|
19
24
|
return false;
|
|
20
25
|
}
|
|
21
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Check if a string is a valid Stellar address.
|
|
29
|
+
* Muxed accounts (M prefix, per SEP-0023) are intentionally excluded — they are
|
|
30
|
+
* not valid vault or contract addresses.
|
|
31
|
+
*/
|
|
22
32
|
function isStellarAddress(address) {
|
|
23
33
|
if (!address || typeof address !== 'string')
|
|
24
34
|
return false;
|
|
@@ -28,6 +38,7 @@ function isStellarAddress(address) {
|
|
|
28
38
|
return false;
|
|
29
39
|
return STELLAR_ADDRESS_RE.test(address);
|
|
30
40
|
}
|
|
41
|
+
/** Check if a string is a valid Sui address (0x + 64 hex chars). */
|
|
31
42
|
function isSuiAddress(address) {
|
|
32
43
|
if (!address || typeof address !== 'string')
|
|
33
44
|
return false;
|
|
@@ -1,23 +1,65 @@
|
|
|
1
1
|
import type { INormalizedNumber } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Table of Contents
|
|
4
|
+
* - Formatters
|
|
5
|
+
* - Datetime
|
|
6
|
+
* - Arrays
|
|
7
|
+
* - Caching
|
|
8
|
+
*/
|
|
2
9
|
export declare function toNormalizedBn(value: string | bigint | number, decimals?: number | bigint): INormalizedNumber;
|
|
10
|
+
/**
|
|
11
|
+
* Get fallback RPC URLs for a specific chain
|
|
12
|
+
*/
|
|
3
13
|
export declare function getFallbackRpcUrls(chainId: number): string[];
|
|
4
14
|
export declare const filterOutBySize: (usdAmount: number) => boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Formatters
|
|
17
|
+
*/
|
|
5
18
|
export declare function toTitleCase(str: string, type?: 'camel'): string;
|
|
6
19
|
export declare function truncate(s: string, amount?: number): string;
|
|
20
|
+
/**
|
|
21
|
+
* @function round formats any type number value to a standard
|
|
22
|
+
*
|
|
23
|
+
* @param value amount to be formatted
|
|
24
|
+
* @param options.showing amount of decimals to cut off at
|
|
25
|
+
* @param options.usd if wanting to display USD value
|
|
26
|
+
* @param options.decimals if passing type bigint, how many decimals to parse to
|
|
27
|
+
*
|
|
28
|
+
* @returns standardized string type value
|
|
29
|
+
*/
|
|
7
30
|
export declare function round(value: number | string | bigint, options?: {
|
|
8
31
|
showing?: number | 'all';
|
|
9
32
|
usd?: boolean;
|
|
10
33
|
decimals?: number;
|
|
11
34
|
}): string;
|
|
12
35
|
export declare function loanStateToReadable(loanState: number | bigint): "PREAPPROVED" | "FUNDING_REQUIRED" | "FUNDED" | "ACTIVE" | "CANCELLED" | "MATURED" | "CLOSED";
|
|
36
|
+
/**
|
|
37
|
+
* Datetime
|
|
38
|
+
*/
|
|
13
39
|
export declare function dateToUnix(date: Date): number;
|
|
14
40
|
export declare function unixToDate(epoch: number): Date;
|
|
15
41
|
export declare function isEarlierThanNow(startTime: Date): boolean;
|
|
16
42
|
export declare function daysAgo(days: number): Date;
|
|
17
43
|
export declare function prepareDateForDb(date: string | Date): string;
|
|
44
|
+
/**
|
|
45
|
+
* Arrays
|
|
46
|
+
*/
|
|
18
47
|
export declare function orderObjArrByDate(objectArray: any[], options?: {
|
|
19
48
|
key?: string;
|
|
20
49
|
order?: 'asc' | 'desc';
|
|
21
50
|
}): any[];
|
|
51
|
+
/**
|
|
52
|
+
* Calculate weights based on a specific property in array of objects
|
|
53
|
+
* @param {Array<Object>} data - Array of objects to calculate weights for
|
|
54
|
+
* @param {string} weightProperty - Property name to base weights on
|
|
55
|
+
* @returns {Array<Object>} Original data with weights added
|
|
56
|
+
*/
|
|
22
57
|
export declare function calculateWeights(data?: Array<any>, weightProperty?: string): any[];
|
|
58
|
+
/**
|
|
59
|
+
* Calculate weighted average for array of objects
|
|
60
|
+
* @param {Array<Object>} data - Array of objects with values
|
|
61
|
+
* @param {string} valueProperty - Property name containing the value to average
|
|
62
|
+
* @param {string} [weightProperty] - Optional property to base weights on
|
|
63
|
+
* @returns {number} Weighted average
|
|
64
|
+
*/
|
|
23
65
|
export declare function calculateWeightedAverage(data?: Array<any>, valueProperty?: string, weightProperty?: string): any;
|
package/lib/core/helpers/core.js
CHANGED
|
@@ -17,23 +17,36 @@ exports.calculateWeights = calculateWeights;
|
|
|
17
17
|
exports.calculateWeightedAverage = calculateWeightedAverage;
|
|
18
18
|
const web3_1 = require("../constants/web3");
|
|
19
19
|
const ethers_1 = require("ethers");
|
|
20
|
+
/**
|
|
21
|
+
* Table of Contents
|
|
22
|
+
* - Formatters
|
|
23
|
+
* - Datetime
|
|
24
|
+
* - Arrays
|
|
25
|
+
* - Caching
|
|
26
|
+
*/
|
|
20
27
|
function toNormalizedBn(value, decimals = 18) {
|
|
21
28
|
if (!value)
|
|
22
29
|
return { normalized: '0', raw: BigInt(0).toString() };
|
|
23
30
|
const sanitize = (val, decimals) => {
|
|
24
31
|
const [whole, frac = ''] = val.split('.');
|
|
25
|
-
const trimmedFrac = frac.slice(0, decimals);
|
|
32
|
+
const trimmedFrac = frac.slice(0, decimals); // trim to allowed precision
|
|
26
33
|
return trimmedFrac ? `${whole}.${trimmedFrac}` : whole;
|
|
27
34
|
};
|
|
35
|
+
// Convert number or exponential string to fixed decimal string
|
|
28
36
|
const toFixedDecimalString = (val) => {
|
|
29
37
|
const strRep = typeof val === 'number' ? String(val) : val;
|
|
38
|
+
// Check if the string representation contains exponential notation
|
|
30
39
|
if (strRep.includes('e') || strRep.includes('E')) {
|
|
40
|
+
// Parse as number and use toFixed with high precision to convert exponential to fixed decimal
|
|
41
|
+
// 100 decimals should handle even extremely small numbers like 1e-20
|
|
31
42
|
const num = typeof val === 'number' ? val : parseFloat(strRep);
|
|
32
43
|
return num.toFixed(100).replace(/\.?0+$/, '');
|
|
33
44
|
}
|
|
45
|
+
// For regular numbers/strings, return as is
|
|
34
46
|
return strRep;
|
|
35
47
|
};
|
|
36
48
|
if (typeof value === 'string' || typeof value === 'number') {
|
|
49
|
+
// Convert to fixed decimal string to avoid exponential notation
|
|
37
50
|
const strVal = toFixedDecimalString(value);
|
|
38
51
|
const safeVal = sanitize(strVal, Number(decimals));
|
|
39
52
|
return {
|
|
@@ -48,11 +61,17 @@ function toNormalizedBn(value, decimals = 18) {
|
|
|
48
61
|
};
|
|
49
62
|
}
|
|
50
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Get fallback RPC URLs for a specific chain
|
|
66
|
+
*/
|
|
51
67
|
function getFallbackRpcUrls(chainId) {
|
|
52
68
|
return web3_1.FALLBACK_RPC_URLS[chainId] || [];
|
|
53
69
|
}
|
|
54
70
|
const filterOutBySize = (usdAmount) => usdAmount > 3000;
|
|
55
71
|
exports.filterOutBySize = filterOutBySize;
|
|
72
|
+
/**
|
|
73
|
+
* Formatters
|
|
74
|
+
*/
|
|
56
75
|
function toTitleCase(str, type) {
|
|
57
76
|
if (!str)
|
|
58
77
|
return;
|
|
@@ -60,9 +79,11 @@ function toTitleCase(str, type) {
|
|
|
60
79
|
case 'camel': {
|
|
61
80
|
const words = Array.from(str)
|
|
62
81
|
.map((letter) => {
|
|
82
|
+
// letter is uppercase
|
|
63
83
|
if (letter === letter.toUpperCase()) {
|
|
64
84
|
return ` ${letter}`;
|
|
65
85
|
}
|
|
86
|
+
// else
|
|
66
87
|
return letter;
|
|
67
88
|
})
|
|
68
89
|
.join('');
|
|
@@ -83,6 +104,11 @@ function toTitleCase(str, type) {
|
|
|
83
104
|
}
|
|
84
105
|
function truncate(s, amount) {
|
|
85
106
|
if (typeof s !== 'string') {
|
|
107
|
+
// Leaf string util: importing Logger here would create an import cycle
|
|
108
|
+
// (helpers/core → logger/index → slack → helpers/core) that the madge CI
|
|
109
|
+
// check forbids (CLAUDE.md §9). Keep a direct console.error for this
|
|
110
|
+
// defensive type-guard diagnostic.
|
|
111
|
+
// biome-ignore lint/suspicious/noConsole: leaf util cannot import Logger without a cycle (CLAUDE.md §9); keep a direct console.error for this defensive type-guard diagnostic.
|
|
86
112
|
if (s !== undefined)
|
|
87
113
|
console.error('#truncate: not a string', s);
|
|
88
114
|
return '';
|
|
@@ -93,16 +119,29 @@ function truncate(s, amount) {
|
|
|
93
119
|
return s;
|
|
94
120
|
return `${s.slice(0, amount ? amount : 4)}...${s.slice(amount ? amount * -1 : -4)}`;
|
|
95
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* @function round formats any type number value to a standard
|
|
124
|
+
*
|
|
125
|
+
* @param value amount to be formatted
|
|
126
|
+
* @param options.showing amount of decimals to cut off at
|
|
127
|
+
* @param options.usd if wanting to display USD value
|
|
128
|
+
* @param options.decimals if passing type bigint, how many decimals to parse to
|
|
129
|
+
*
|
|
130
|
+
* @returns standardized string type value
|
|
131
|
+
*/
|
|
96
132
|
function round(value, options) {
|
|
133
|
+
// standardize to string
|
|
97
134
|
let _value;
|
|
98
135
|
if (typeof value === 'bigint') {
|
|
99
136
|
_value = toNormalizedBn(value, options.decimals ?? web3_1.FALLBACK_DECIMALS).normalized;
|
|
100
137
|
}
|
|
101
138
|
else {
|
|
102
139
|
_value = String(value);
|
|
140
|
+
// if string passed includes something like a symbol (i.e. 0.1 ETH --> 0.1)
|
|
103
141
|
if (_value.includes(' '))
|
|
104
142
|
_value = _value.split(' ')[0];
|
|
105
143
|
}
|
|
144
|
+
// if wanting USD value
|
|
106
145
|
if (options?.usd) {
|
|
107
146
|
const usdFormatter = new Intl.NumberFormat('en-US', {
|
|
108
147
|
style: 'currency',
|
|
@@ -113,6 +152,7 @@ function round(value, options) {
|
|
|
113
152
|
? usdFormatter.format(valueNumber)
|
|
114
153
|
: '0';
|
|
115
154
|
}
|
|
155
|
+
// else slice if decimal places is more than 6 and display
|
|
116
156
|
if (_value === '0' || _value === '0.0')
|
|
117
157
|
return '0.000';
|
|
118
158
|
if (options?.showing === 'all') {
|
|
@@ -157,6 +197,9 @@ function loanStateToReadable(loanState) {
|
|
|
157
197
|
return 'CLOSED';
|
|
158
198
|
}
|
|
159
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Datetime
|
|
202
|
+
*/
|
|
160
203
|
function dateToUnix(date) {
|
|
161
204
|
if (!date)
|
|
162
205
|
return Math.floor(new Date().getTime());
|
|
@@ -181,28 +224,49 @@ function daysAgo(days) {
|
|
|
181
224
|
function prepareDateForDb(date) {
|
|
182
225
|
return new Date(date).toISOString();
|
|
183
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* Arrays
|
|
229
|
+
*/
|
|
184
230
|
function orderObjArrByDate(objectArray, options) {
|
|
185
231
|
const selectedOrder = options?.order ?? 'desc';
|
|
186
232
|
const selectedKey = options?.key ?? 'date';
|
|
187
233
|
return objectArray.sort((a, b) => {
|
|
234
|
+
// Turn your strings into dates, and then subtract them
|
|
235
|
+
// to get a value that is either negative, positive, or zero.
|
|
188
236
|
if (selectedOrder === 'asc')
|
|
189
237
|
return (new Date(a[selectedKey]).valueOf() - new Date(b[selectedKey]).valueOf());
|
|
190
238
|
return (new Date(b[selectedKey]).valueOf() - new Date(a[selectedKey]).valueOf());
|
|
191
239
|
});
|
|
192
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* Calculate weights based on a specific property in array of objects
|
|
243
|
+
* @param {Array<Object>} data - Array of objects to calculate weights for
|
|
244
|
+
* @param {string} weightProperty - Property name to base weights on
|
|
245
|
+
* @returns {Array<Object>} Original data with weights added
|
|
246
|
+
*/
|
|
193
247
|
function calculateWeights(data, weightProperty) {
|
|
194
248
|
if (!data || data.length === 0 || !weightProperty)
|
|
195
249
|
return [];
|
|
250
|
+
// Get total of the property we're using for weight calculation
|
|
196
251
|
const total = data.reduce((sum, item) => sum + item[weightProperty], 0);
|
|
252
|
+
// Add weight property to each item
|
|
197
253
|
return data.map((item) => ({
|
|
198
254
|
...item,
|
|
199
255
|
weight: item[weightProperty] / total,
|
|
200
256
|
}));
|
|
201
257
|
}
|
|
258
|
+
/**
|
|
259
|
+
* Calculate weighted average for array of objects
|
|
260
|
+
* @param {Array<Object>} data - Array of objects with values
|
|
261
|
+
* @param {string} valueProperty - Property name containing the value to average
|
|
262
|
+
* @param {string} [weightProperty] - Optional property to base weights on
|
|
263
|
+
* @returns {number} Weighted average
|
|
264
|
+
*/
|
|
202
265
|
function calculateWeightedAverage(data, valueProperty, weightProperty) {
|
|
203
266
|
if (!data || data.length === 0 || !valueProperty)
|
|
204
267
|
return 0;
|
|
205
268
|
let weightedData = data;
|
|
269
|
+
// If no weightProperty specified, use equal weights
|
|
206
270
|
if (!weightProperty) {
|
|
207
271
|
weightedData = data.map((item) => ({
|
|
208
272
|
...item,
|
|
@@ -212,6 +276,7 @@ function calculateWeightedAverage(data, valueProperty, weightProperty) {
|
|
|
212
276
|
else {
|
|
213
277
|
weightedData = calculateWeights(data, weightProperty);
|
|
214
278
|
}
|
|
279
|
+
// Calculate weighted average
|
|
215
280
|
const weightedAverage = weightedData.reduce((acc, item) => acc + item[valueProperty] * item.weight, 0);
|
|
216
281
|
return weightedAverage;
|
|
217
282
|
}
|
|
@@ -1,2 +1,16 @@
|
|
|
1
1
|
import { IAddress, IChainId, IExplorerType } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Generate a block-explorer URL for an address or transaction hash.
|
|
4
|
+
*
|
|
5
|
+
* Returns an empty string when `chain` is falsy or unknown so the return
|
|
6
|
+
* type stays assignable to `string` — preserves the historical public
|
|
7
|
+
* shape from before the file split out of `web3.ts`, where the SDK's
|
|
8
|
+
* `strictNullChecks: false` masked the implicit `undefined` branch and
|
|
9
|
+
* consumers pinned to `string` via the emitted `.d.ts`.
|
|
10
|
+
*
|
|
11
|
+
* @param hex Address or transaction hash
|
|
12
|
+
* @param chain Chain ID
|
|
13
|
+
* @param type Explorer view type (`address`, `tx`, `block`)
|
|
14
|
+
* @returns Full explorer URL, or `''` when `chain` is falsy / unknown.
|
|
15
|
+
*/
|
|
2
16
|
export declare const explorerLink: (hex: IAddress, chain: IChainId, type: IExplorerType) => string;
|
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.explorerLink = void 0;
|
|
4
4
|
const web3_1 = require("../constants/web3");
|
|
5
|
+
/**
|
|
6
|
+
* Generate a block-explorer URL for an address or transaction hash.
|
|
7
|
+
*
|
|
8
|
+
* Returns an empty string when `chain` is falsy or unknown so the return
|
|
9
|
+
* type stays assignable to `string` — preserves the historical public
|
|
10
|
+
* shape from before the file split out of `web3.ts`, where the SDK's
|
|
11
|
+
* `strictNullChecks: false` masked the implicit `undefined` branch and
|
|
12
|
+
* consumers pinned to `string` via the emitted `.d.ts`.
|
|
13
|
+
*
|
|
14
|
+
* @param hex Address or transaction hash
|
|
15
|
+
* @param chain Chain ID
|
|
16
|
+
* @param type Explorer view type (`address`, `tx`, `block`)
|
|
17
|
+
* @returns Full explorer URL, or `''` when `chain` is falsy / unknown.
|
|
18
|
+
*/
|
|
5
19
|
const explorerLink = (hex, chain, type) => {
|
|
6
20
|
const network = chain ? web3_1.NETWORKS[chain] : undefined;
|
|
7
21
|
if (!network)
|
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
import { Signer, Wallet } from 'ethers';
|
|
2
|
+
/**
|
|
3
|
+
* Signer Compatibility Helpers
|
|
4
|
+
*
|
|
5
|
+
* Utilities for supporting both ethers and viem/wagmi signers.
|
|
6
|
+
* Provides conversion layer from viem WalletClient to ethers Signer.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Type guard to check if a signer is from viem/wagmi
|
|
10
|
+
* @param signer The signer to check
|
|
11
|
+
* @returns True if the signer is a viem WalletClient
|
|
12
|
+
*/
|
|
2
13
|
export declare function isViemWalletClient(signer: any): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Convert a viem WalletClient to an ethers-compatible Signer
|
|
16
|
+
* Uses the walletClient as a provider and wraps it for ethers compatibility
|
|
17
|
+
* @param walletClient Viem WalletClient from wagmi or viem
|
|
18
|
+
* @returns Ethers Signer that can be used with the SDK
|
|
19
|
+
*/
|
|
3
20
|
export declare function viemToEthersSigner(walletClient: any): Promise<Signer | Wallet>;
|
|
21
|
+
/**
|
|
22
|
+
* Normalize a signer to ensure it's ethers-compatible
|
|
23
|
+
* Accepts both ethers Signer and viem WalletClient
|
|
24
|
+
* @param signer Either an ethers Signer or viem WalletClient
|
|
25
|
+
* @returns Ethers-compatible Signer
|
|
26
|
+
*/
|
|
4
27
|
export declare function normalizeSigner(signer: Signer | Wallet | any): Promise<Signer | Wallet>;
|
|
28
|
+
/**
|
|
29
|
+
* Type that represents either an ethers signer or a viem wallet client
|
|
30
|
+
*/
|
|
5
31
|
export type CompatibleSigner = Signer | Wallet | any;
|
|
@@ -4,7 +4,19 @@ exports.isViemWalletClient = isViemWalletClient;
|
|
|
4
4
|
exports.viemToEthersSigner = viemToEthersSigner;
|
|
5
5
|
exports.normalizeSigner = normalizeSigner;
|
|
6
6
|
const ethers_1 = require("ethers");
|
|
7
|
+
/**
|
|
8
|
+
* Signer Compatibility Helpers
|
|
9
|
+
*
|
|
10
|
+
* Utilities for supporting both ethers and viem/wagmi signers.
|
|
11
|
+
* Provides conversion layer from viem WalletClient to ethers Signer.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Type guard to check if a signer is from viem/wagmi
|
|
15
|
+
* @param signer The signer to check
|
|
16
|
+
* @returns True if the signer is a viem WalletClient
|
|
17
|
+
*/
|
|
7
18
|
function isViemWalletClient(signer) {
|
|
19
|
+
// Viem WalletClient has specific properties that ethers Signer doesn't
|
|
8
20
|
return !!(signer &&
|
|
9
21
|
typeof signer === 'object' &&
|
|
10
22
|
'account' in signer &&
|
|
@@ -12,17 +24,27 @@ function isViemWalletClient(signer) {
|
|
|
12
24
|
'transport' in signer &&
|
|
13
25
|
typeof signer.writeContract === 'function');
|
|
14
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Convert a viem WalletClient to an ethers-compatible Signer
|
|
29
|
+
* Uses the walletClient as a provider and wraps it for ethers compatibility
|
|
30
|
+
* @param walletClient Viem WalletClient from wagmi or viem
|
|
31
|
+
* @returns Ethers Signer that can be used with the SDK
|
|
32
|
+
*/
|
|
15
33
|
async function viemToEthersSigner(walletClient) {
|
|
16
34
|
if (!walletClient) {
|
|
17
35
|
throw new Error('WalletClient is required');
|
|
18
36
|
}
|
|
37
|
+
// Create an EIP-1193 provider from the wallet client
|
|
19
38
|
const { account, chain, transport } = walletClient;
|
|
20
39
|
if (!account) {
|
|
21
40
|
throw new Error('WalletClient must have an account');
|
|
22
41
|
}
|
|
42
|
+
// Create a custom transport that uses the walletClient
|
|
23
43
|
const provider = new ethers_1.BrowserProvider({
|
|
24
44
|
request: async ({ method, params }) => {
|
|
45
|
+
// Use the wallet client's transport for all requests
|
|
25
46
|
if (method === 'eth_sendTransaction') {
|
|
47
|
+
// For transactions, use writeContract or sendTransaction
|
|
26
48
|
const [tx] = params;
|
|
27
49
|
return walletClient.sendTransaction({
|
|
28
50
|
...tx,
|
|
@@ -30,25 +52,42 @@ async function viemToEthersSigner(walletClient) {
|
|
|
30
52
|
chain,
|
|
31
53
|
});
|
|
32
54
|
}
|
|
55
|
+
// For all other requests, use the transport directly
|
|
33
56
|
return transport({ chain }).request({ method, params });
|
|
34
57
|
},
|
|
35
58
|
}, chain?.id);
|
|
59
|
+
// Get the signer from the provider
|
|
36
60
|
return provider.getSigner(account.address);
|
|
37
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Type guard to check if a signer is from ethers
|
|
64
|
+
* @param signer The signer to check
|
|
65
|
+
* @returns True if the signer is an ethers Signer or Wallet
|
|
66
|
+
*/
|
|
38
67
|
function isEthersSigner(signer) {
|
|
68
|
+
// Check for ethers Signer/Wallet properties
|
|
39
69
|
return (signer &&
|
|
40
70
|
typeof signer === 'object' &&
|
|
41
71
|
typeof signer.signMessage === 'function' &&
|
|
42
72
|
typeof signer.signTransaction === 'function' &&
|
|
43
73
|
(signer.provider !== undefined || signer._isSigner === true));
|
|
44
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Normalize a signer to ensure it's ethers-compatible
|
|
77
|
+
* Accepts both ethers Signer and viem WalletClient
|
|
78
|
+
* @param signer Either an ethers Signer or viem WalletClient
|
|
79
|
+
* @returns Ethers-compatible Signer
|
|
80
|
+
*/
|
|
45
81
|
async function normalizeSigner(signer) {
|
|
82
|
+
// If it's already an ethers signer, return as-is
|
|
46
83
|
if (isEthersSigner(signer)) {
|
|
47
84
|
return signer;
|
|
48
85
|
}
|
|
86
|
+
// If it's a viem wallet client, convert it
|
|
49
87
|
if (isViemWalletClient(signer)) {
|
|
50
88
|
return viemToEthersSigner(signer);
|
|
51
89
|
}
|
|
90
|
+
// If we can't determine the type, throw an error
|
|
52
91
|
throw new Error('Invalid signer type. Expected ethers Signer, ethers Wallet, or viem WalletClient');
|
|
53
92
|
}
|
|
54
93
|
//# sourceMappingURL=signer.js.map
|
|
@@ -1,4 +1,36 @@
|
|
|
1
1
|
import { IAddress } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the `SwapRouter` address for a chain.
|
|
4
|
+
*
|
|
5
|
+
* @param chainId - EVM chain ID.
|
|
6
|
+
* @returns The router address, or `undefined` if no SwapRouter is deployed.
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const router = getSwapRouterAddress(1);
|
|
10
|
+
* // '0xAC771209FF2b71EECfF6E85a9AD01db8Ff2618B0'
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
2
13
|
export declare function getSwapRouterAddress(chainId: number): IAddress | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Whether a vault has been registered on a `SwapRouter` and should route
|
|
16
|
+
* its deposits through it. Address comparison is case-insensitive.
|
|
17
|
+
*
|
|
18
|
+
* @param vaultAddress - August vault address.
|
|
19
|
+
* @returns `true` when the vault is in {@link VAULTS_USING_SWAP_ROUTER}.
|
|
20
|
+
*/
|
|
3
21
|
export declare function vaultUsesSwapRouter(vaultAddress: IAddress): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Normalize an optional origin code to the value to send on-chain.
|
|
24
|
+
*
|
|
25
|
+
* Returns the caller-supplied code when present, otherwise the default
|
|
26
|
+
* (all-zero) sentinel from {@link ORIGIN_CODES}. Validates that any
|
|
27
|
+
* supplied code is exactly 32 bytes (66 chars including the `0x` prefix);
|
|
28
|
+
* the on-chain SwapRouter reverts with `InvalidOrigin` otherwise, but
|
|
29
|
+
* surfacing the failure here as a typed SDK error gives partners a
|
|
30
|
+
* grepable Sentry event instead of a generic `execution reverted`.
|
|
31
|
+
*
|
|
32
|
+
* @param provided - Optional caller-supplied origin code.
|
|
33
|
+
* @returns The 32-byte origin code to pass to the router.
|
|
34
|
+
* @throws {@link AugustValidationError} when `provided` is not a 32-byte hex string.
|
|
35
|
+
*/
|
|
4
36
|
export declare function resolveOriginCode(provided?: `0x${string}`): `0x${string}`;
|
|
@@ -5,12 +5,44 @@ exports.vaultUsesSwapRouter = vaultUsesSwapRouter;
|
|
|
5
5
|
exports.resolveOriginCode = resolveOriginCode;
|
|
6
6
|
const swap_router_1 = require("../constants/swap-router");
|
|
7
7
|
const errors_1 = require("../errors");
|
|
8
|
+
/**
|
|
9
|
+
* Resolve the `SwapRouter` address for a chain.
|
|
10
|
+
*
|
|
11
|
+
* @param chainId - EVM chain ID.
|
|
12
|
+
* @returns The router address, or `undefined` if no SwapRouter is deployed.
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const router = getSwapRouterAddress(1);
|
|
16
|
+
* // '0xAC771209FF2b71EECfF6E85a9AD01db8Ff2618B0'
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
8
19
|
function getSwapRouterAddress(chainId) {
|
|
9
20
|
return swap_router_1.SWAP_ROUTER_ADDRESSES[chainId];
|
|
10
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Whether a vault has been registered on a `SwapRouter` and should route
|
|
24
|
+
* its deposits through it. Address comparison is case-insensitive.
|
|
25
|
+
*
|
|
26
|
+
* @param vaultAddress - August vault address.
|
|
27
|
+
* @returns `true` when the vault is in {@link VAULTS_USING_SWAP_ROUTER}.
|
|
28
|
+
*/
|
|
11
29
|
function vaultUsesSwapRouter(vaultAddress) {
|
|
12
30
|
return swap_router_1.VAULTS_USING_SWAP_ROUTER.has(vaultAddress.toLowerCase());
|
|
13
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Normalize an optional origin code to the value to send on-chain.
|
|
34
|
+
*
|
|
35
|
+
* Returns the caller-supplied code when present, otherwise the default
|
|
36
|
+
* (all-zero) sentinel from {@link ORIGIN_CODES}. Validates that any
|
|
37
|
+
* supplied code is exactly 32 bytes (66 chars including the `0x` prefix);
|
|
38
|
+
* the on-chain SwapRouter reverts with `InvalidOrigin` otherwise, but
|
|
39
|
+
* surfacing the failure here as a typed SDK error gives partners a
|
|
40
|
+
* grepable Sentry event instead of a generic `execution reverted`.
|
|
41
|
+
*
|
|
42
|
+
* @param provided - Optional caller-supplied origin code.
|
|
43
|
+
* @returns The 32-byte origin code to pass to the router.
|
|
44
|
+
* @throws {@link AugustValidationError} when `provided` is not a 32-byte hex string.
|
|
45
|
+
*/
|
|
14
46
|
function resolveOriginCode(provided) {
|
|
15
47
|
if (provided === undefined)
|
|
16
48
|
return swap_router_1.ORIGIN_CODES.default;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ITokenizedVault, IVaultVersion, ChainType } from '../../types';
|
|
2
|
+
/** Classify an address by chain family (evm / solana / stellar / sui). */
|
|
2
3
|
export declare function getAddressChainType(address: string): ChainType;
|
|
3
4
|
export declare function getVaultVersion(vault: string): IVaultVersion | undefined;
|
|
4
5
|
export declare function getVaultVersionV2(vault: ITokenizedVault): IVaultVersion | undefined;
|
|
@@ -6,6 +6,7 @@ exports.getVaultVersionV2 = getVaultVersionV2;
|
|
|
6
6
|
const ethers_1 = require("ethers");
|
|
7
7
|
const vaults_1 = require("../constants/vaults");
|
|
8
8
|
const chain_address_1 = require("./chain-address");
|
|
9
|
+
/** Classify an address by chain family (evm / solana / stellar / sui). */
|
|
9
10
|
function getAddressChainType(address) {
|
|
10
11
|
if ((0, chain_address_1.isStellarAddress)(address))
|
|
11
12
|
return 'stellar';
|
|
@@ -15,6 +16,7 @@ function getAddressChainType(address) {
|
|
|
15
16
|
return 'sui';
|
|
16
17
|
return 'evm';
|
|
17
18
|
}
|
|
19
|
+
// @todo: move to backend
|
|
18
20
|
function getVaultVersion(vault) {
|
|
19
21
|
if (!vault)
|
|
20
22
|
return;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { IAddress, IContractRunner } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Bad transactions that should be ignored
|
|
4
|
+
* these transactions are usually from tests and can skew data
|
|
5
|
+
*/
|
|
2
6
|
export declare const isBadTransaction: (hash: string, chainId: number) => boolean;
|
|
3
7
|
export declare const isBadVault: (address?: string) => boolean;
|
|
4
8
|
import { getAddressChainType, getVaultVersion, getVaultVersionV2 } from './vault-version';
|
|
@@ -6,6 +10,10 @@ export { getAddressChainType, getVaultVersion, getVaultVersionV2 };
|
|
|
6
10
|
export declare const REWARD_DISTRIBUTOR_ADDRESS: (chainId: number) => string[];
|
|
7
11
|
export declare const AVAX_PRICE_FEED_ADDRESS: (chainId: number) => "0xFF3EEb22B5E3dE6e705b44749C2559d704923FD7" | "0x";
|
|
8
12
|
export declare function getVaultSymbol(vault: IAddress, provider: IContractRunner): Promise<string | undefined>;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated
|
|
15
|
+
* Replaced by SUBGRAPH_VAULT_URLS which are subgraphs deployed on Goldsky.
|
|
16
|
+
*/
|
|
9
17
|
export declare const SUBGRAPH_POOL_URLS: (apiKey: string, chainId?: number, pool?: IAddress) => {
|
|
10
18
|
1: string;
|
|
11
19
|
8453: string;
|
|
@@ -8,10 +8,16 @@ const web3_1 = require("./web3");
|
|
|
8
8
|
const chain_address_1 = require("./chain-address");
|
|
9
9
|
const vault_metadata_1 = require("../vault-metadata");
|
|
10
10
|
const logger_1 = require("../logger");
|
|
11
|
+
/** @internal */
|
|
11
12
|
const VAULT_SYMBOLS_LOWERCASE = Object.fromEntries(Object.entries(vaults_1.VAULT_SYMBOLS).map(([k, v]) => [k.toLowerCase(), v]));
|
|
13
|
+
/**
|
|
14
|
+
* Bad transactions that should be ignored
|
|
15
|
+
* these transactions are usually from tests and can skew data
|
|
16
|
+
*/
|
|
12
17
|
const isBadTransaction = (hash, chainId) => {
|
|
13
18
|
const badTxs = {
|
|
14
19
|
1: [
|
|
20
|
+
// farmBOLD deposit test tx due to a decimal error
|
|
15
21
|
'0xaba75b16e74a7a2457bfdcded853edd2bb4d3b305919baf84fb1f6b54b864889',
|
|
16
22
|
'0xc4c30185198672cbc91a95520d1bf91634ece37c199b2f1f15d29e8290c7ed4b',
|
|
17
23
|
'0x8e319576413897d1750f16bb93c7f59759b5bbafcb5bd9ef956f6bc0b0314aef',
|
|
@@ -36,21 +42,21 @@ const isBadVault = (address) => {
|
|
|
36
42
|
case (0, ethers_1.getAddress)('0x706162790b601A8514c18718d0c63C9D1268e89C'):
|
|
37
43
|
return true;
|
|
38
44
|
case (0, ethers_1.getAddress)('0xd684AF965b1c17D628ee0d77cae94259c41260F4'):
|
|
39
|
-
return true;
|
|
45
|
+
return true; // ETH: sUSDe
|
|
40
46
|
case (0, ethers_1.getAddress)('0xB78dAf3fD674B81ebeaaa88d711506fa069E1C5E'):
|
|
41
|
-
return true;
|
|
47
|
+
return true; // ETH: ETH Optimizer
|
|
42
48
|
case (0, ethers_1.getAddress)('0x4e2D90f0307A93b54ACA31dc606F93FE6b9132d2'):
|
|
43
|
-
return true;
|
|
49
|
+
return true; // Base: LBTC
|
|
44
50
|
case (0, ethers_1.getAddress)('0x18a5a3D575F34e5eBa92ac99B0976dBe26f9F869'):
|
|
45
|
-
return true;
|
|
51
|
+
return true; // ETH: LBTC
|
|
46
52
|
case (0, ethers_1.getAddress)('0xD0b717ef23817b1a127139830Cf0FcD449ef74F0'):
|
|
47
|
-
return true;
|
|
53
|
+
return true; // BNB: Sienna USDT Tulipa
|
|
48
54
|
case (0, ethers_1.getAddress)('0xeb402fc96C7ed2f889d837C9976D6d821c1B5f01'):
|
|
49
|
-
return true;
|
|
55
|
+
return true; // ETH: Kelp TAC Vault
|
|
50
56
|
case (0, ethers_1.getAddress)('0xEBac5e50003d4B17Be422ff9775043cD61002f7f'):
|
|
51
|
-
return true;
|
|
57
|
+
return true; // ETH: Upshift BTC
|
|
52
58
|
case (0, ethers_1.getAddress)('0x419386E3Ef42368e602720CC458e00c0B28c47A7'):
|
|
53
|
-
return true;
|
|
59
|
+
return true; // ETH: Kelp TAC Vault
|
|
54
60
|
default:
|
|
55
61
|
return false;
|
|
56
62
|
}
|
|
@@ -60,6 +66,7 @@ const vault_version_1 = require("./vault-version");
|
|
|
60
66
|
Object.defineProperty(exports, "getAddressChainType", { enumerable: true, get: function () { return vault_version_1.getAddressChainType; } });
|
|
61
67
|
Object.defineProperty(exports, "getVaultVersion", { enumerable: true, get: function () { return vault_version_1.getVaultVersion; } });
|
|
62
68
|
Object.defineProperty(exports, "getVaultVersionV2", { enumerable: true, get: function () { return vault_version_1.getVaultVersionV2; } });
|
|
69
|
+
// Used for Upshift
|
|
63
70
|
const REWARD_DISTRIBUTOR_ADDRESS = (chainId) => {
|
|
64
71
|
switch (chainId) {
|
|
65
72
|
case 43114:
|
|
@@ -72,6 +79,7 @@ const REWARD_DISTRIBUTOR_ADDRESS = (chainId) => {
|
|
|
72
79
|
}
|
|
73
80
|
};
|
|
74
81
|
exports.REWARD_DISTRIBUTOR_ADDRESS = REWARD_DISTRIBUTOR_ADDRESS;
|
|
82
|
+
// Used for Upshift
|
|
75
83
|
const AVAX_PRICE_FEED_ADDRESS = (chainId) => {
|
|
76
84
|
switch (chainId) {
|
|
77
85
|
case 1:
|
|
@@ -108,16 +116,22 @@ async function getVaultSymbol(vault, provider) {
|
|
|
108
116
|
const symbol = await (0, web3_1.getSymbol)(provider, vault);
|
|
109
117
|
return symbol;
|
|
110
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* @deprecated
|
|
121
|
+
* Replaced by SUBGRAPH_VAULT_URLS which are subgraphs deployed on Goldsky.
|
|
122
|
+
*/
|
|
111
123
|
const SUBGRAPH_POOL_URLS = (apiKey, chainId, pool) => {
|
|
112
124
|
if (chainId === 999) {
|
|
113
125
|
if (!pool) {
|
|
114
126
|
throw new Error(`Pool address is required for chainId ${chainId}`);
|
|
115
127
|
}
|
|
116
128
|
switch (pool) {
|
|
129
|
+
// hbHYPE
|
|
117
130
|
case '0x96C6cBB6251Ee1c257b2162ca0f39AA5Fa44B1FB':
|
|
118
131
|
return {
|
|
119
132
|
999: 'https://api.goldsky.com/api/public/project_cm9g0xy3o4j6v01vd34r3hvv9/subgraphs/august-hyperevm-hyperbeat/1.0.0/gn',
|
|
120
133
|
};
|
|
134
|
+
// hbBTC
|
|
121
135
|
case '0xc061d38903b99aC12713B550C2CB44B221674F94':
|
|
122
136
|
return {
|
|
123
137
|
999: 'https://api.goldsky.com/api/public/project_cm9g0xy3o4j6v01vd34r3hvv9/subgraphs/august-hyperevm-hbBTC/1.0.0/gn',
|