@augustdigital/sdk 8.3.2 → 8.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +207 -117
- package/lib/abis/ERC20_Bytes32.d.ts +4 -0
- package/lib/abis/ERC20_Bytes32.js +4 -0
- package/lib/abis/ERC4626.d.ts +1 -0
- package/lib/abis/ERC4626.js +1 -0
- package/lib/abis/ERC721.d.ts +1 -0
- package/lib/abis/ERC721.js +1 -0
- package/lib/abis/FeeOracle.js +1 -0
- package/lib/abis/LendingPool.js +1 -0
- package/lib/abis/LendingPoolV2.js +1 -0
- package/lib/abis/Multicall3.js +3 -0
- package/lib/abis/OFT.d.ts +20 -0
- package/lib/abis/OFT.js +20 -0
- package/lib/abis/SmartAccount.d.ts +1 -0
- package/lib/abis/SmartAccount.js +3 -0
- package/lib/abis/SwapRouter.d.ts +1 -0
- package/lib/abis/SwapRouter.js +1 -0
- package/lib/abis/UniversalSignatureValidator.js +3 -0
- package/lib/abis/index.d.ts +5 -0
- package/lib/abis/index.js +5 -0
- package/lib/adapters/evm/getters.d.ts +17 -2
- package/lib/adapters/evm/getters.js +35 -3
- package/lib/adapters/evm/index.d.ts +266 -4
- package/lib/adapters/evm/index.js +270 -1
- package/lib/adapters/evm/utils.d.ts +6 -0
- package/lib/adapters/evm/utils.js +7 -0
- package/lib/adapters/solana/constants.d.ts +1 -1
- package/lib/adapters/solana/constants.js +4 -1
- package/lib/adapters/solana/getters.d.ts +9 -1
- package/lib/adapters/solana/getters.js +21 -0
- package/lib/adapters/solana/idl/vault-idl.js +9 -0
- package/lib/adapters/solana/index.d.ts +59 -4
- package/lib/adapters/solana/index.js +61 -0
- package/lib/adapters/solana/types.d.ts +1 -1
- package/lib/adapters/solana/utils.d.ts +31 -3
- package/lib/adapters/solana/utils.js +79 -4
- package/lib/adapters/solana/vault.actions.d.ts +23 -4
- package/lib/adapters/solana/vault.actions.js +47 -3
- package/lib/adapters/stellar/actions.d.ts +26 -1
- package/lib/adapters/stellar/actions.js +33 -0
- package/lib/adapters/stellar/constants.d.ts +26 -0
- package/lib/adapters/stellar/constants.js +29 -0
- package/lib/adapters/stellar/getters.d.ts +56 -0
- package/lib/adapters/stellar/getters.js +81 -0
- package/lib/adapters/stellar/index.d.ts +70 -0
- package/lib/adapters/stellar/index.js +71 -0
- package/lib/adapters/stellar/soroban.d.ts +21 -1
- package/lib/adapters/stellar/soroban.js +47 -1
- package/lib/adapters/stellar/submit.d.ts +29 -0
- package/lib/adapters/stellar/submit.js +90 -5
- package/lib/adapters/stellar/types.d.ts +27 -0
- package/lib/adapters/stellar/types.js +3 -0
- package/lib/adapters/stellar/utils.d.ts +10 -0
- package/lib/adapters/stellar/utils.js +10 -0
- package/lib/adapters/sui/getters.d.ts +7 -1
- package/lib/adapters/sui/getters.js +6 -0
- package/lib/adapters/sui/index.d.ts +16 -1
- package/lib/adapters/sui/index.js +17 -0
- package/lib/adapters/sui/transformer.d.ts +8 -2
- package/lib/adapters/sui/transformer.js +7 -0
- package/lib/adapters/sui/types.d.ts +1 -1
- package/lib/adapters/sui/utils.d.ts +6 -0
- package/lib/adapters/sui/utils.js +6 -0
- package/lib/core/analytics/chain-name.d.ts +8 -0
- package/lib/core/analytics/chain-name.js +8 -0
- package/lib/core/analytics/constants.d.ts +4 -0
- package/lib/core/analytics/constants.js +4 -0
- package/lib/core/analytics/env.d.ts +25 -0
- package/lib/core/analytics/env.js +26 -0
- package/lib/core/analytics/index.d.ts +26 -0
- package/lib/core/analytics/index.js +35 -0
- package/lib/core/analytics/instrumentation.d.ts +26 -0
- package/lib/core/analytics/instrumentation.js +66 -2
- package/lib/core/analytics/method-taxonomy.d.ts +16 -0
- package/lib/core/analytics/method-taxonomy.js +18 -0
- package/lib/core/analytics/metrics.d.ts +23 -0
- package/lib/core/analytics/metrics.js +40 -0
- package/lib/core/analytics/sanitize.d.ts +38 -0
- package/lib/core/analytics/sanitize.js +46 -0
- package/lib/core/analytics/sentry-runtime.d.ts +11 -0
- package/lib/core/analytics/sentry-runtime.js +20 -1
- package/lib/core/analytics/sentry.d.ts +47 -2
- package/lib/core/analytics/sentry.js +115 -2
- package/lib/core/analytics/types.d.ts +28 -1
- package/lib/core/analytics/user-identity.d.ts +36 -2
- package/lib/core/analytics/user-identity.js +43 -1
- package/lib/core/analytics/version.d.ts +6 -1
- package/lib/core/analytics/version.js +6 -1
- package/lib/core/auth/verify.js +5 -0
- package/lib/core/base.class.d.ts +78 -3
- package/lib/core/base.class.js +66 -4
- package/lib/core/cache.d.ts +5 -0
- package/lib/core/cache.js +6 -0
- package/lib/core/constants/adapters.d.ts +16 -1
- package/lib/core/constants/adapters.js +28 -8
- package/lib/core/constants/core.d.ts +14 -1
- package/lib/core/constants/core.js +18 -0
- package/lib/core/constants/swap-router.d.ts +83 -1
- package/lib/core/constants/swap-router.js +91 -1
- package/lib/core/constants/vaults.d.ts +57 -1
- package/lib/core/constants/vaults.js +66 -1
- package/lib/core/constants/web3.d.ts +4 -1
- package/lib/core/constants/web3.js +15 -5
- package/lib/core/errors/index.d.ts +38 -2
- package/lib/core/errors/index.js +38 -0
- package/lib/core/fetcher.d.ts +136 -2
- package/lib/core/fetcher.js +229 -25
- package/lib/core/helpers/adapters.d.ts +10 -1
- package/lib/core/helpers/adapters.js +11 -0
- package/lib/core/helpers/chain-address.d.ts +10 -0
- package/lib/core/helpers/chain-address.js +11 -0
- package/lib/core/helpers/core.d.ts +49 -4
- package/lib/core/helpers/core.js +74 -7
- package/lib/core/helpers/explorer-link.d.ts +15 -1
- package/lib/core/helpers/explorer-link.js +14 -0
- package/lib/core/helpers/signer.d.ts +27 -1
- package/lib/core/helpers/signer.js +39 -0
- package/lib/core/helpers/swap-router.d.ts +33 -1
- package/lib/core/helpers/swap-router.js +32 -0
- package/lib/core/helpers/vault-version.d.ts +2 -1
- package/lib/core/helpers/vault-version.js +2 -0
- package/lib/core/helpers/vaults.d.ts +9 -1
- package/lib/core/helpers/vaults.js +22 -8
- package/lib/core/helpers/web3.d.ts +154 -2
- package/lib/core/helpers/web3.js +192 -15
- package/lib/core/logger/index.d.ts +55 -0
- package/lib/core/logger/index.js +19 -0
- package/lib/core/logger/slack.d.ts +3 -0
- package/lib/core/logger/slack.js +3 -0
- package/lib/core/vault-metadata.d.ts +7 -1
- package/lib/core/vault-metadata.js +6 -0
- package/lib/core/version-check.d.ts +52 -0
- package/lib/core/version-check.js +82 -1
- package/lib/evm/methods/crossChainVault.d.ts +90 -0
- package/lib/evm/methods/crossChainVault.js +187 -2
- package/lib/evm/methods/crossChainVaultRegistry.d.ts +93 -0
- package/lib/evm/methods/crossChainVaultRegistry.js +240 -0
- package/lib/evm/methods/index.d.ts +1 -0
- package/lib/evm/methods/index.js +1 -0
- package/lib/evm/types/crossChain.d.ts +202 -0
- package/lib/evm/types/crossChain.js +12 -1
- package/lib/index.d.ts +16 -0
- package/lib/index.js +19 -0
- package/lib/main.d.ts +289 -6
- package/lib/main.js +312 -0
- package/lib/modules/api/index.d.ts +1 -0
- package/lib/modules/api/index.js +6 -0
- package/lib/modules/api/main.d.ts +52 -0
- package/lib/modules/api/main.js +130 -0
- package/lib/modules/sub-accounts/fetcher.d.ts +17 -2
- package/lib/modules/sub-accounts/fetcher.js +15 -0
- package/lib/modules/sub-accounts/main.d.ts +35 -2
- package/lib/modules/sub-accounts/main.js +39 -1
- package/lib/modules/sub-accounts/utils.d.ts +4 -1
- package/lib/modules/sub-accounts/utils.js +3 -0
- package/lib/modules/vaults/adapter.helpers.d.ts +21 -3
- package/lib/modules/vaults/adapter.helpers.js +34 -0
- package/lib/modules/vaults/fetcher.d.ts +45 -0
- package/lib/modules/vaults/fetcher.js +91 -4
- package/lib/modules/vaults/getters.d.ts +295 -0
- package/lib/modules/vaults/getters.js +567 -26
- package/lib/modules/vaults/index.d.ts +12 -0
- package/lib/modules/vaults/index.js +12 -0
- package/lib/modules/vaults/main.d.ts +292 -4
- package/lib/modules/vaults/main.js +382 -8
- package/lib/modules/vaults/read.actions.d.ts +170 -2
- package/lib/modules/vaults/read.actions.js +143 -0
- package/lib/modules/vaults/types.d.ts +34 -0
- package/lib/modules/vaults/utils/call-data-decoder.d.ts +48 -1
- package/lib/modules/vaults/utils/call-data-decoder.js +56 -0
- package/lib/modules/vaults/utils/date-utils.d.ts +39 -0
- package/lib/modules/vaults/utils/date-utils.js +47 -1
- package/lib/modules/vaults/utils.d.ts +85 -0
- package/lib/modules/vaults/utils.js +139 -7
- package/lib/modules/vaults/write.actions.d.ts +363 -3
- package/lib/modules/vaults/write.actions.js +399 -3
- package/lib/polyfills.js +4 -2
- package/lib/sdk.d.ts +23847 -0
- package/lib/services/coingecko/fetcher.d.ts +15 -1
- package/lib/services/coingecko/fetcher.js +30 -9
- package/lib/services/debank/fetcher.d.ts +15 -1
- package/lib/services/debank/fetcher.js +12 -0
- package/lib/services/debank/utils.d.ts +1 -1
- package/lib/services/debank/utils.js +18 -1
- package/lib/services/layerzero/deposits.d.ts +12 -1
- package/lib/services/layerzero/deposits.js +34 -11
- package/lib/services/layerzero/redeems.d.ts +11 -1
- package/lib/services/layerzero/redeems.js +13 -0
- package/lib/services/layerzero/utils.d.ts +8 -0
- package/lib/services/layerzero/utils.js +11 -0
- package/lib/services/octavfi/fetcher.d.ts +8 -1
- package/lib/services/octavfi/fetcher.js +25 -0
- package/lib/services/octavfi/types.d.ts +1 -1
- package/lib/services/octavfi/utils.d.ts +14 -2
- package/lib/services/octavfi/utils.js +44 -10
- package/lib/services/subgraph/fetcher.js +4 -2
- package/lib/services/subgraph/vaults.d.ts +12 -0
- package/lib/services/subgraph/vaults.js +119 -2
- package/lib/services/swap-quotes/index.d.ts +80 -0
- package/lib/services/swap-quotes/index.js +27 -1
- package/lib/services/swap-quotes/paraswap.d.ts +25 -0
- package/lib/services/swap-quotes/paraswap.js +22 -0
- package/lib/types/pools.d.ts +5 -2
- package/lib/types/staking.d.ts +1 -1
- package/lib/types/sub-accounts.d.ts +1 -1
- package/lib/types/subgraph.d.ts +10 -1
- package/lib/types/typed-contract.d.ts +64 -0
- package/lib/types/vaults.d.ts +163 -2
- package/lib/types/vaults.js +10 -0
- package/lib/types/web3.d.ts +9 -1
- package/lib/types/web3.js +1 -0
- package/lib/types/webserver.d.ts +47 -2
- package/package.json +6 -5
|
@@ -1,23 +1,68 @@
|
|
|
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
|
+
* Formats any numeric value (number, string, or bigint) to a standardized string.
|
|
22
|
+
*
|
|
23
|
+
* @param value - amount to be formatted
|
|
24
|
+
* @param options - formatting options:
|
|
25
|
+
* `showing` is the number of decimals to cut off at (or `'all'`);
|
|
26
|
+
* `usd` toggles USD-value display;
|
|
27
|
+
* `decimals` is how many decimals to parse to when `value` is a bigint.
|
|
28
|
+
*
|
|
29
|
+
* @returns standardized string type value
|
|
30
|
+
*/
|
|
7
31
|
export declare function round(value: number | string | bigint, options?: {
|
|
8
32
|
showing?: number | 'all';
|
|
9
33
|
usd?: boolean;
|
|
10
34
|
decimals?: number;
|
|
11
35
|
}): string;
|
|
12
36
|
export declare function loanStateToReadable(loanState: number | bigint): "PREAPPROVED" | "FUNDING_REQUIRED" | "FUNDED" | "ACTIVE" | "CANCELLED" | "MATURED" | "CLOSED";
|
|
37
|
+
/**
|
|
38
|
+
* Datetime
|
|
39
|
+
*/
|
|
13
40
|
export declare function dateToUnix(date: Date): number;
|
|
14
41
|
export declare function unixToDate(epoch: number): Date;
|
|
15
42
|
export declare function isEarlierThanNow(startTime: Date): boolean;
|
|
16
43
|
export declare function daysAgo(days: number): Date;
|
|
17
44
|
export declare function prepareDateForDb(date: string | Date): string;
|
|
18
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Arrays
|
|
47
|
+
*/
|
|
48
|
+
export declare function orderObjArrByDate<T extends Record<string, unknown>>(objectArray: T[], options?: {
|
|
19
49
|
key?: string;
|
|
20
50
|
order?: 'asc' | 'desc';
|
|
21
|
-
}):
|
|
22
|
-
|
|
23
|
-
|
|
51
|
+
}): T[];
|
|
52
|
+
/**
|
|
53
|
+
* Calculate weights based on a specific property in array of objects.
|
|
54
|
+
* @param data - Array of objects to calculate weights for
|
|
55
|
+
* @param weightProperty - Property name to base weights on
|
|
56
|
+
* @returns Original data with each item's `weight` added
|
|
57
|
+
*/
|
|
58
|
+
export declare function calculateWeights<T extends Record<string, unknown>>(data?: T[], weightProperty?: string): Array<T & {
|
|
59
|
+
weight: number;
|
|
60
|
+
}>;
|
|
61
|
+
/**
|
|
62
|
+
* Calculate weighted average for array of objects.
|
|
63
|
+
* @param data - Array of objects with values
|
|
64
|
+
* @param valueProperty - Property name containing the value to average
|
|
65
|
+
* @param weightProperty - Optional property to base weights on
|
|
66
|
+
* @returns Weighted average
|
|
67
|
+
*/
|
|
68
|
+
export declare function calculateWeightedAverage<T extends Record<string, unknown>>(data?: T[], valueProperty?: string, weightProperty?: string): number;
|
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
|
-
const filterOutBySize = (usdAmount) => usdAmount >
|
|
70
|
+
const filterOutBySize = (usdAmount) => usdAmount > 3_000;
|
|
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,30 @@ 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
|
+
* Formats any numeric value (number, string, or bigint) to a standardized string.
|
|
124
|
+
*
|
|
125
|
+
* @param value - amount to be formatted
|
|
126
|
+
* @param options - formatting options:
|
|
127
|
+
* `showing` is the number of decimals to cut off at (or `'all'`);
|
|
128
|
+
* `usd` toggles USD-value display;
|
|
129
|
+
* `decimals` is how many decimals to parse to when `value` is a bigint.
|
|
130
|
+
*
|
|
131
|
+
* @returns standardized string type value
|
|
132
|
+
*/
|
|
96
133
|
function round(value, options) {
|
|
134
|
+
// standardize to string
|
|
97
135
|
let _value;
|
|
98
136
|
if (typeof value === 'bigint') {
|
|
99
|
-
_value = toNormalizedBn(value, options
|
|
137
|
+
_value = toNormalizedBn(value, options?.decimals ?? web3_1.FALLBACK_DECIMALS).normalized;
|
|
100
138
|
}
|
|
101
139
|
else {
|
|
102
140
|
_value = String(value);
|
|
141
|
+
// if string passed includes something like a symbol (i.e. 0.1 ETH --> 0.1)
|
|
103
142
|
if (_value.includes(' '))
|
|
104
143
|
_value = _value.split(' ')[0];
|
|
105
144
|
}
|
|
145
|
+
// if wanting USD value
|
|
106
146
|
if (options?.usd) {
|
|
107
147
|
const usdFormatter = new Intl.NumberFormat('en-US', {
|
|
108
148
|
style: 'currency',
|
|
@@ -113,6 +153,7 @@ function round(value, options) {
|
|
|
113
153
|
? usdFormatter.format(valueNumber)
|
|
114
154
|
: '0';
|
|
115
155
|
}
|
|
156
|
+
// else slice if decimal places is more than 6 and display
|
|
116
157
|
if (_value === '0' || _value === '0.0')
|
|
117
158
|
return '0.000';
|
|
118
159
|
if (options?.showing === 'all') {
|
|
@@ -157,9 +198,12 @@ function loanStateToReadable(loanState) {
|
|
|
157
198
|
return 'CLOSED';
|
|
158
199
|
}
|
|
159
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* Datetime
|
|
203
|
+
*/
|
|
160
204
|
function dateToUnix(date) {
|
|
161
205
|
if (!date)
|
|
162
|
-
return Math.floor(
|
|
206
|
+
return Math.floor(Date.now());
|
|
163
207
|
return Math.floor(new Date(date).getTime());
|
|
164
208
|
}
|
|
165
209
|
function unixToDate(epoch) {
|
|
@@ -181,28 +225,50 @@ function daysAgo(days) {
|
|
|
181
225
|
function prepareDateForDb(date) {
|
|
182
226
|
return new Date(date).toISOString();
|
|
183
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* Arrays
|
|
230
|
+
*/
|
|
184
231
|
function orderObjArrByDate(objectArray, options) {
|
|
185
232
|
const selectedOrder = options?.order ?? 'desc';
|
|
186
233
|
const selectedKey = options?.key ?? 'date';
|
|
234
|
+
const toTime = (item) => new Date(item[selectedKey]).valueOf();
|
|
187
235
|
return objectArray.sort((a, b) => {
|
|
236
|
+
// Turn your strings into dates, and then subtract them
|
|
237
|
+
// to get a value that is either negative, positive, or zero.
|
|
188
238
|
if (selectedOrder === 'asc')
|
|
189
|
-
return (
|
|
190
|
-
return (
|
|
239
|
+
return toTime(a) - toTime(b);
|
|
240
|
+
return toTime(b) - toTime(a);
|
|
191
241
|
});
|
|
192
242
|
}
|
|
243
|
+
/**
|
|
244
|
+
* Calculate weights based on a specific property in array of objects.
|
|
245
|
+
* @param data - Array of objects to calculate weights for
|
|
246
|
+
* @param weightProperty - Property name to base weights on
|
|
247
|
+
* @returns Original data with each item's `weight` added
|
|
248
|
+
*/
|
|
193
249
|
function calculateWeights(data, weightProperty) {
|
|
194
250
|
if (!data || data.length === 0 || !weightProperty)
|
|
195
251
|
return [];
|
|
252
|
+
// Get total of the property we're using for weight calculation
|
|
196
253
|
const total = data.reduce((sum, item) => sum + item[weightProperty], 0);
|
|
254
|
+
// Add weight property to each item
|
|
197
255
|
return data.map((item) => ({
|
|
198
256
|
...item,
|
|
199
257
|
weight: item[weightProperty] / total,
|
|
200
258
|
}));
|
|
201
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* Calculate weighted average for array of objects.
|
|
262
|
+
* @param data - Array of objects with values
|
|
263
|
+
* @param valueProperty - Property name containing the value to average
|
|
264
|
+
* @param weightProperty - Optional property to base weights on
|
|
265
|
+
* @returns Weighted average
|
|
266
|
+
*/
|
|
202
267
|
function calculateWeightedAverage(data, valueProperty, weightProperty) {
|
|
203
268
|
if (!data || data.length === 0 || !valueProperty)
|
|
204
269
|
return 0;
|
|
205
|
-
let weightedData
|
|
270
|
+
let weightedData;
|
|
271
|
+
// If no weightProperty specified, use equal weights
|
|
206
272
|
if (!weightProperty) {
|
|
207
273
|
weightedData = data.map((item) => ({
|
|
208
274
|
...item,
|
|
@@ -212,6 +278,7 @@ function calculateWeightedAverage(data, valueProperty, weightProperty) {
|
|
|
212
278
|
else {
|
|
213
279
|
weightedData = calculateWeights(data, weightProperty);
|
|
214
280
|
}
|
|
281
|
+
// Calculate weighted average
|
|
215
282
|
const weightedAverage = weightedData.reduce((acc, item) => acc + item[valueProperty] * item.weight, 0);
|
|
216
283
|
return weightedAverage;
|
|
217
284
|
}
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
import { IAddress, IChainId, IExplorerType } from '../../types';
|
|
1
|
+
import type { 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
|
-
import { Signer, Wallet } from 'ethers';
|
|
1
|
+
import { type Signer, type 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
|
-
import { IAddress } from '../../types';
|
|
1
|
+
import type { 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
|
-
import { ITokenizedVault, IVaultVersion, ChainType } from '../../types';
|
|
1
|
+
import type { 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
|
-
import { IAddress, IContractRunner } from '../../types';
|
|
1
|
+
import type { 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',
|