@alphafi/alphafi-sdk 0.0.2 → 0.0.3
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 +47 -1
- package/dist/getAllVaults.d.ts +3 -0
- package/dist/getAllVaults.d.ts.map +1 -0
- package/package.json +5 -2
- package/.babelrc +0 -6
- package/.eslintrc.json +0 -30
- package/jest.config.js +0 -14
- package/src/common/cetus_mainnet_config.ts +0 -72
- package/src/common/coins.ts +0 -126
- package/src/common/constants.ts +0 -820
- package/src/common/maps.ts +0 -200
- package/src/common/pyth.ts +0 -23
- package/src/common/types.ts +0 -446
- package/src/functions.ts +0 -299
- package/src/getVaultBalances.ts +0 -128
- package/src/getVaults.ts +0 -63
- package/src/index.ts +0 -13
- package/src/portfolioAmount.ts +0 -365
- package/src/price.ts +0 -397
- package/tsconfig.json +0 -21
- package/webpack.config.js +0 -59
package/src/common/maps.ts
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { conf, CONF_ENV } from "./constants";
|
|
2
|
-
import { PoolReceipt } from "./types";
|
|
3
|
-
|
|
4
|
-
export const cetusPoolMap: { [key: string]: string } = {
|
|
5
|
-
"USDC-SUI": conf[CONF_ENV].USDC_SUI_CETUS_POOL_ID,
|
|
6
|
-
"CETUS-SUI": conf[CONF_ENV].CETUS_SUI_CETUS_POOL_ID,
|
|
7
|
-
"USDT-USDC": conf[CONF_ENV].USDT_USDC_CETUS_POOL_ID,
|
|
8
|
-
"USDY-USDC": conf[CONF_ENV].USDY_USDC_CETUS_POOL_ID,
|
|
9
|
-
"HASUI-SUI": conf[CONF_ENV].HASUI_SUI_CETUS_POOL_ID,
|
|
10
|
-
"ALPHA-SUI": conf[CONF_ENV].ALPHA_SUI_CETUS_POOL_ID,
|
|
11
|
-
"WETH-USDC": conf[CONF_ENV].WETH_USDC_CETUS_POOL_ID,
|
|
12
|
-
"USDC-WBTC": conf[CONF_ENV].USDC_WBTC_CETUS_POOL_ID,
|
|
13
|
-
"VSUI-SUI": conf[CONF_ENV].VSUI_SUI_CETUS_POOL_ID,
|
|
14
|
-
"NAVX-SUI": conf[CONF_ENV].NAVX_SUI_CETUS_POOL_ID,
|
|
15
|
-
"USDC-CETUS": conf[CONF_ENV].USDC_CETUS_CETUS_POOL_ID,
|
|
16
|
-
"BUCK-USDC": conf[CONF_ENV].BUCK_USDC_CETUS_POOL_ID,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const cetusInvestorMap: { [key: string]: string } = {
|
|
20
|
-
ALPHA: conf[CONF_ENV].ALPHA_CETUS_INVESTOR,
|
|
21
|
-
"USDT-USDC": conf[CONF_ENV].USDT_USDC_CETUS_INVESTOR,
|
|
22
|
-
"ALPHA-SUI": conf[CONF_ENV].ALPHA_SUI_CETUS_INVESTOR,
|
|
23
|
-
"HASUI-SUI": conf[CONF_ENV].HASUI_SUI_CETUS_INVESTOR,
|
|
24
|
-
"USDY-USDC": conf[CONF_ENV].USDY_USDC_CETUS_INVESTOR,
|
|
25
|
-
"USDC-SUI": conf[CONF_ENV].USDC_SUI_CETUS_INVESTOR,
|
|
26
|
-
"WETH-USDC": conf[CONF_ENV].WETH_USDC_CETUS_INVESTOR,
|
|
27
|
-
"USDC-WBTC": conf[CONF_ENV].USDC_WBTC_CETUS_INVESTOR,
|
|
28
|
-
"NAVX-SUI": conf[CONF_ENV].NAVX_SUI_CETUS_INVESTOR,
|
|
29
|
-
"BUCK-USDC": conf[CONF_ENV].BUCK_USDC_CETUS_INVESTOR,
|
|
30
|
-
"CETUS-SUI": conf[CONF_ENV].CETUS_SUI_CETUS_INVESTOR,
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const poolMap: { [key: string]: string } = {
|
|
34
|
-
ALPHA: conf[CONF_ENV].ALPHA_POOL,
|
|
35
|
-
"ALPHA-SUI": conf[CONF_ENV].ALPHA_SUI_POOL,
|
|
36
|
-
"USDT-USDC": conf[CONF_ENV].USDC_USDT_POOL,
|
|
37
|
-
"HASUI-SUI": conf[CONF_ENV].HASUI_SUI_POOL,
|
|
38
|
-
"USDY-USDC": conf[CONF_ENV].USDY_USDC_POOL,
|
|
39
|
-
"USDC-SUI": conf[CONF_ENV].USDC_SUI_POOL,
|
|
40
|
-
"WETH-USDC": conf[CONF_ENV].WETH_USDC_POOL,
|
|
41
|
-
"USDC-WBTC": conf[CONF_ENV].USDC_WBTC_POOL,
|
|
42
|
-
"NAVX-SUI": conf[CONF_ENV].NAVX_SUI_POOL,
|
|
43
|
-
"BUCK-USDC": conf[CONF_ENV].BUCK_USDC_POOL,
|
|
44
|
-
"CETUS-SUI": conf[CONF_ENV].CETUS_SUI_POOL,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export const receiptNameMap: { [key in string]: string } = {
|
|
48
|
-
ALPHA: conf[CONF_ENV].ALPHA_POOL_RECEIPT_NAME,
|
|
49
|
-
"ALPHA-SUI": conf[CONF_ENV].ALPHA_SUI_POOL_RECEIPT_NAME,
|
|
50
|
-
"USDT-USDC": conf[CONF_ENV].USDT_USDC_POOL_RECEIPT_NAME,
|
|
51
|
-
"HASUI-SUI": conf[CONF_ENV].HASUI_SUI_POOL_RECEIPT_NAME,
|
|
52
|
-
"USDY-USDC": conf[CONF_ENV].USDY_USDC_POOL_RECEIPT_NAME,
|
|
53
|
-
"USDC-SUI": conf[CONF_ENV].USDC_SUI_POOL_RECEIPT_NAME,
|
|
54
|
-
"WETH-USDC": conf[CONF_ENV].WETH_USDC_POOL_RECEIPT_NAME,
|
|
55
|
-
"USDC-WBTC": conf[CONF_ENV].USDC_WBTC_POOL_RECEIPT_NAME,
|
|
56
|
-
"BUCK-USDC": conf[CONF_ENV].BUCK_USDC_POOL_RECEIPT_NAME,
|
|
57
|
-
"CETUS-SUI": conf[CONF_ENV].CETUS_SUI_POOL_RECEIPT_NAME,
|
|
58
|
-
"NAVI-VSUI": conf[CONF_ENV].NAVI_VSUI_POOL_RECEIPT_NAME,
|
|
59
|
-
"NAVI-SUI": conf[CONF_ENV].NAVI_SUI_POOL_RECEIPT_NAME,
|
|
60
|
-
"NAVI-HASUI": conf[CONF_ENV].NAVI_HASUI_POOL_RECEIPT_NAME,
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export const poolPairMap: {
|
|
64
|
-
[key in string]: { pool1: string; pool2: string };
|
|
65
|
-
} = {
|
|
66
|
-
"USDT-USDC": { pool1: "USDT", pool2: "USDC" },
|
|
67
|
-
"ALPHA-SUI": { pool1: "ALPHA", pool2: "SUI" },
|
|
68
|
-
"HASUI-SUI": { pool1: "HASUI", pool2: "SUI" },
|
|
69
|
-
"USDY-USDC": { pool1: "USDY", pool2: "USDC" },
|
|
70
|
-
"USDC-SUI": { pool1: "USDC", pool2: "SUI" },
|
|
71
|
-
"WETH-USDC": { pool1: "WETH", pool2: "USDC" },
|
|
72
|
-
"USDC-WBTC": { pool1: "USDC", pool2: "WBTC" },
|
|
73
|
-
"NAVX-SUI": { pool1: "NAVX", pool2: "SUI" },
|
|
74
|
-
"BUCK-USDC": { pool1: "BUCK", pool2: "USDC" },
|
|
75
|
-
"CETUS-SUI": { pool1: "CETUS", pool2: "SUI" },
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export const poolInfo: {
|
|
79
|
-
[key: string]: {
|
|
80
|
-
parentProtocolName: string;
|
|
81
|
-
parentPoolId: string;
|
|
82
|
-
poolId: string;
|
|
83
|
-
investorId: string;
|
|
84
|
-
receiptName: string;
|
|
85
|
-
receiptType: PoolReceipt;
|
|
86
|
-
};
|
|
87
|
-
} = {
|
|
88
|
-
"NAVI-SUI": {
|
|
89
|
-
parentProtocolName: "NAVI",
|
|
90
|
-
parentPoolId: conf[CONF_ENV].NAVI_SUI_POOL,
|
|
91
|
-
poolId: conf[CONF_ENV].ALPHAFI_NAVI_SUI_POOL,
|
|
92
|
-
investorId: conf[CONF_ENV].NAVI_SUI_INVESTOR,
|
|
93
|
-
receiptName: conf[CONF_ENV].NAVI_SUI_POOL_RECEIPT_NAME,
|
|
94
|
-
receiptType: conf[CONF_ENV].NAVI_SUI_POOL_RECEIPT,
|
|
95
|
-
},
|
|
96
|
-
"NAVI-VSUI": {
|
|
97
|
-
parentProtocolName: "NAVI",
|
|
98
|
-
parentPoolId: conf[CONF_ENV].NAVI_VSUI_POOL,
|
|
99
|
-
poolId: conf[CONF_ENV].ALPHAFI_NAVI_VSUI_POOL,
|
|
100
|
-
investorId: conf[CONF_ENV].NAVI_VSUI_INVESTOR,
|
|
101
|
-
receiptName: conf[CONF_ENV].NAVI_VSUI_POOL_RECEIPT_NAME,
|
|
102
|
-
receiptType: conf[CONF_ENV].NAVI_VSUI_POOL_RECEIPT,
|
|
103
|
-
},
|
|
104
|
-
"NAVI-WETH": {
|
|
105
|
-
parentProtocolName: "NAVI",
|
|
106
|
-
parentPoolId: conf[CONF_ENV].NAVI_WETH_POOL,
|
|
107
|
-
poolId: conf[CONF_ENV].ALPHAFI_NAVI_WETH_POOL,
|
|
108
|
-
investorId: conf[CONF_ENV].NAVI_WETH_INVESTOR,
|
|
109
|
-
receiptName: conf[CONF_ENV].NAVI_WETH_POOL_RECEIPT_NAME,
|
|
110
|
-
receiptType: conf[CONF_ENV].NAVI_WETH_POOL_RECEIPT,
|
|
111
|
-
},
|
|
112
|
-
"NAVI-USDT": {
|
|
113
|
-
parentProtocolName: "NAVI",
|
|
114
|
-
parentPoolId: conf[CONF_ENV].NAVI_USDT_POOL,
|
|
115
|
-
poolId: conf[CONF_ENV].ALPHAFI_NAVI_USDT_POOL,
|
|
116
|
-
investorId: conf[CONF_ENV].NAVI_USDT_INVESTOR,
|
|
117
|
-
receiptName: conf[CONF_ENV].NAVI_USDT_POOL_RECEIPT_NAME,
|
|
118
|
-
receiptType: conf[CONF_ENV].NAVI_USDT_POOL_RECEIPT,
|
|
119
|
-
},
|
|
120
|
-
"NAVI-USDC": {
|
|
121
|
-
parentProtocolName: "NAVI",
|
|
122
|
-
parentPoolId: conf[CONF_ENV].NAVI_USDC_POOL,
|
|
123
|
-
poolId: conf[CONF_ENV].ALPHAFI_NAVI_USDC_POOL,
|
|
124
|
-
investorId: conf[CONF_ENV].NAVI_USDC_INVESTOR,
|
|
125
|
-
receiptName: conf[CONF_ENV].NAVI_USDC_POOL_RECEIPT_NAME,
|
|
126
|
-
receiptType: conf[CONF_ENV].NAVI_USDC_POOL_RECEIPT,
|
|
127
|
-
},
|
|
128
|
-
ALPHA: {
|
|
129
|
-
parentProtocolName: "ALPHAFI",
|
|
130
|
-
parentPoolId: conf[CONF_ENV].ALPHA_POOL,
|
|
131
|
-
poolId: conf[CONF_ENV].ALPHA_POOL,
|
|
132
|
-
investorId: conf[CONF_ENV].ALPHA_POOL,
|
|
133
|
-
receiptName: conf[CONF_ENV].ALPHA_POOL_RECEIPT_NAME,
|
|
134
|
-
receiptType: conf[CONF_ENV].ALPHA_POOL_RECEIPT,
|
|
135
|
-
},
|
|
136
|
-
"ALPHA-SUI": {
|
|
137
|
-
parentProtocolName: "CETUS",
|
|
138
|
-
parentPoolId: conf[CONF_ENV].ALPHA_SUI_CETUS_POOL_ID,
|
|
139
|
-
poolId: conf[CONF_ENV].ALPHA_SUI_POOL,
|
|
140
|
-
investorId: conf[CONF_ENV].ALPHA_SUI_CETUS_INVESTOR,
|
|
141
|
-
receiptName: conf[CONF_ENV].ALPHA_SUI_POOL_RECEIPT_NAME,
|
|
142
|
-
receiptType: conf[CONF_ENV].ALPHA_SUI_POOL_RECEIPT,
|
|
143
|
-
},
|
|
144
|
-
"HASUI-SUI": {
|
|
145
|
-
parentProtocolName: "CETUS",
|
|
146
|
-
parentPoolId: conf[CONF_ENV].HASUI_SUI_CETUS_POOL_ID,
|
|
147
|
-
poolId: conf[CONF_ENV].HASUI_SUI_POOL,
|
|
148
|
-
investorId: conf[CONF_ENV].HASUI_SUI_CETUS_INVESTOR,
|
|
149
|
-
receiptName: conf[CONF_ENV].HASUI_SUI_POOL_RECEIPT_NAME,
|
|
150
|
-
receiptType: conf[CONF_ENV].HASUI_SUI_POOL_RECEIPT,
|
|
151
|
-
},
|
|
152
|
-
"USDT-USDC": {
|
|
153
|
-
parentProtocolName: "CETUS",
|
|
154
|
-
parentPoolId: conf[CONF_ENV].USDT_USDC_CETUS_POOL_ID,
|
|
155
|
-
poolId: conf[CONF_ENV].USDC_USDT_POOL,
|
|
156
|
-
investorId: conf[CONF_ENV].USDT_USDC_CETUS_INVESTOR,
|
|
157
|
-
receiptName: conf[CONF_ENV].USDT_USDC_POOL_RECEIPT_NAME,
|
|
158
|
-
receiptType: conf[CONF_ENV].USDT_USDC_POOL_RECEIPT,
|
|
159
|
-
},
|
|
160
|
-
"USDY-USDC": {
|
|
161
|
-
parentProtocolName: "CETUS",
|
|
162
|
-
parentPoolId: conf[CONF_ENV].USDY_USDC_CETUS_POOL_ID,
|
|
163
|
-
poolId: conf[CONF_ENV].USDY_USDC_POOL,
|
|
164
|
-
investorId: conf[CONF_ENV].USDY_USDC_CETUS_INVESTOR,
|
|
165
|
-
receiptName: conf[CONF_ENV].USDY_USDC_POOL_RECEIPT_NAME,
|
|
166
|
-
receiptType: conf[CONF_ENV].USDY_USDC_POOL_RECEIPT,
|
|
167
|
-
},
|
|
168
|
-
"USDC-SUI": {
|
|
169
|
-
parentProtocolName: "CETUS",
|
|
170
|
-
parentPoolId: conf[CONF_ENV].USDC_SUI_CETUS_POOL_ID,
|
|
171
|
-
poolId: conf[CONF_ENV].USDC_SUI_POOL,
|
|
172
|
-
investorId: conf[CONF_ENV].USDC_SUI_CETUS_INVESTOR,
|
|
173
|
-
receiptName: conf[CONF_ENV].USDC_SUI_POOL_RECEIPT_NAME,
|
|
174
|
-
receiptType: conf[CONF_ENV].USDC_SUI_POOL_RECEIPT,
|
|
175
|
-
},
|
|
176
|
-
"WETH-USDC": {
|
|
177
|
-
parentProtocolName: "CETUS",
|
|
178
|
-
parentPoolId: conf[CONF_ENV].WETH_USDC_CETUS_POOL_ID,
|
|
179
|
-
poolId: conf[CONF_ENV].WETH_USDC_POOL,
|
|
180
|
-
investorId: conf[CONF_ENV].WETH_USDC_CETUS_INVESTOR,
|
|
181
|
-
receiptName: conf[CONF_ENV].WETH_USDC_POOL_RECEIPT_NAME,
|
|
182
|
-
receiptType: conf[CONF_ENV].WETH_USDC_POOL_RECEIPT,
|
|
183
|
-
},
|
|
184
|
-
"USDC-WBTC": {
|
|
185
|
-
parentProtocolName: "CETUS",
|
|
186
|
-
parentPoolId: conf[CONF_ENV].USDC_WBTC_CETUS_POOL_ID,
|
|
187
|
-
poolId: conf[CONF_ENV].USDC_WBTC_POOL,
|
|
188
|
-
investorId: conf[CONF_ENV].USDC_WBTC_CETUS_INVESTOR,
|
|
189
|
-
receiptName: conf[CONF_ENV].USDC_WBTC_POOL_RECEIPT_NAME,
|
|
190
|
-
receiptType: conf[CONF_ENV].USDC_WBTC_POOL_RECEIPT,
|
|
191
|
-
},
|
|
192
|
-
"NAVX-SUI": {
|
|
193
|
-
parentProtocolName: "CETUS",
|
|
194
|
-
parentPoolId: conf[CONF_ENV].NAVX_SUI_CETUS_POOL_ID,
|
|
195
|
-
poolId: conf[CONF_ENV].NAVX_SUI_POOL,
|
|
196
|
-
investorId: conf[CONF_ENV].NAVX_SUI_CETUS_INVESTOR,
|
|
197
|
-
receiptName: conf[CONF_ENV].NAVX_SUI_POOL_RECEIPT_NAME,
|
|
198
|
-
receiptType: conf[CONF_ENV].NAVX_SUI_POOL_RECEIPT,
|
|
199
|
-
},
|
|
200
|
-
};
|
package/src/common/pyth.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export type PythPriceFeed = {
|
|
2
|
-
[key: string]: { [key in "symbol" | "priceId" | "name"]: string };
|
|
3
|
-
};
|
|
4
|
-
|
|
5
|
-
export type PythPriceIdPair =
|
|
6
|
-
| "SUI/USD"
|
|
7
|
-
| "VSUI/USD"
|
|
8
|
-
| "AFSUI/USD"
|
|
9
|
-
| "HASUI/USD"
|
|
10
|
-
| "USDC/USD"
|
|
11
|
-
| "USDT/USD"
|
|
12
|
-
| "CETUS/USD"
|
|
13
|
-
| "TURBO/USD"
|
|
14
|
-
| "SCA/USD"
|
|
15
|
-
| "CELO/USD"
|
|
16
|
-
| "WBTC/USD"
|
|
17
|
-
| "SLP/USD"
|
|
18
|
-
| "SOL/USD"
|
|
19
|
-
| "APT/USD"
|
|
20
|
-
| "WETH/USD"
|
|
21
|
-
| "ALPHA/USD"
|
|
22
|
-
| "USDY/USD"
|
|
23
|
-
| "NAVX/USD";
|
package/src/common/types.ts
DELETED
|
@@ -1,446 +0,0 @@
|
|
|
1
|
-
import BN from "bn.js";
|
|
2
|
-
import { conf, CONF_ENV } from "./constants";
|
|
3
|
-
|
|
4
|
-
export type PoolName =
|
|
5
|
-
| "ALPHA"
|
|
6
|
-
| "HASUI-SUI"
|
|
7
|
-
| "USDY-USDC"
|
|
8
|
-
| "ALPHA-SUI"
|
|
9
|
-
| "USDT-USDC"
|
|
10
|
-
| "USDC-SUI"
|
|
11
|
-
| "USDC-WBTC"
|
|
12
|
-
| "WETH-USDC"
|
|
13
|
-
| "NAVI-SUI"
|
|
14
|
-
| "NAVI-VSUI"
|
|
15
|
-
| "NAVX-SUI"
|
|
16
|
-
| "NAVI-WETH"
|
|
17
|
-
| "NAVI-USDT"
|
|
18
|
-
| "NAVI-USDC";
|
|
19
|
-
|
|
20
|
-
export type CoinName =
|
|
21
|
-
| "ALPHA"
|
|
22
|
-
| "SUI"
|
|
23
|
-
| "USDC"
|
|
24
|
-
| "USDT"
|
|
25
|
-
| "VSUI"
|
|
26
|
-
| "NAVX"
|
|
27
|
-
| "SCA"
|
|
28
|
-
| "CETUS"
|
|
29
|
-
| "AFSUI"
|
|
30
|
-
| "WETH"
|
|
31
|
-
| "APT"
|
|
32
|
-
| "SOL"
|
|
33
|
-
| "SLP"
|
|
34
|
-
| "WBTC"
|
|
35
|
-
| "CELO"
|
|
36
|
-
| "TURBOS"
|
|
37
|
-
| "HASUI"
|
|
38
|
-
| "USDY";
|
|
39
|
-
|
|
40
|
-
export interface Coin {
|
|
41
|
-
name: CoinName;
|
|
42
|
-
type: CoinType;
|
|
43
|
-
icon: Icon;
|
|
44
|
-
expo: number;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export type Icon =
|
|
48
|
-
| "https://coinmeta.polymedia.app/img/coins/0x0000000000000000000000000000000000000000000000000000000000000002-sui-SUI.svg"
|
|
49
|
-
| "https://coinmeta.polymedia.app/img/coins/0x0000000000000000000000000000000000000000000000000000000000000002-sui-SUI.svg"
|
|
50
|
-
| "https://coinmeta.polymedia.app/img/coins/0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf-coin-COIN.webp"
|
|
51
|
-
| "https://coinmeta.polymedia.app/img/coins/0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c-coin-COIN.webp"
|
|
52
|
-
| "https://coinmeta.polymedia.app/img/coins/0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55-cert-CERT.webp"
|
|
53
|
-
| "https://coinmeta.polymedia.app/img/coins/0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5-navx-NAVX.webp"
|
|
54
|
-
| "https://suivision.xyz/images/coin-default.png"
|
|
55
|
-
| "https://coinmeta.polymedia.app/img/coins/0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6-sca-SCA.webp"
|
|
56
|
-
| "https://coinmeta.polymedia.app/img/coins/0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc-afsui-AFSUI.webp"
|
|
57
|
-
| "https://coinmeta.polymedia.app/img/coins/0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5-coin-COIN.webp"
|
|
58
|
-
| "https://coinmeta.polymedia.app/img/coins/0x3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37-coin-COIN.webp"
|
|
59
|
-
| "https://coinmeta.polymedia.app/img/coins/0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8-coin-COIN.webp"
|
|
60
|
-
| "https://coinmeta.polymedia.app/img/coins/0xc44d97a4bc4e5a33ca847b72b123172c88a6328196b71414f32c3070233604b2-slp-SLP.webp"
|
|
61
|
-
| "https://coinmeta.polymedia.app/img/coins/0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881-coin-COIN.webp"
|
|
62
|
-
| "https://coinmeta.polymedia.app/img/coins/0xa198f3be41cda8c07b3bf3fee02263526e535d682499806979a111e88a5a8d0f-coin-COIN.webp"
|
|
63
|
-
| "https://coinmeta.polymedia.app/img/coins/0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b-cetus-CETUS.webp"
|
|
64
|
-
| "https://coinmeta.polymedia.app/img/coins/0x5d1f47ea69bb0de31c313d7acf89b890dbb8991ea8e03c6c355171f84bb1ba4a-turbos-TURBOS.svg"
|
|
65
|
-
| "https://7taj6jfau6n3dri7agspzfnva7qbj5sizz5xc3lb56nmxpsyoiba.arweave.net/_MCfJKCnm7HFHwGk_JW1B-AU9kjOe3FtYe-ay75YcgI"
|
|
66
|
-
| "https://coinmeta.polymedia.app/img/coins/0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d-hasui-HASUI.svg"
|
|
67
|
-
| "https://coinmeta.polymedia.app/img/coins/0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb-usdy-USDY.svg";
|
|
68
|
-
|
|
69
|
-
export type CoinType =
|
|
70
|
-
| "0xfe3afec26c59e874f3c1d60b8203cb3852d2bb2aa415df9548b8d688e6683f93::alpha::ALPHA"
|
|
71
|
-
| "0x2::sui::SUI"
|
|
72
|
-
| "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT"
|
|
73
|
-
| "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN"
|
|
74
|
-
| "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN"
|
|
75
|
-
| "0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX"
|
|
76
|
-
| "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA"
|
|
77
|
-
| "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI"
|
|
78
|
-
| "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN"
|
|
79
|
-
| "0x3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37::coin::COIN"
|
|
80
|
-
| "0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8::coin::COIN"
|
|
81
|
-
| "0xc44d97a4bc4e5a33ca847b72b123172c88a6328196b71414f32c3070233604b2::slp::SLP"
|
|
82
|
-
| "0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN"
|
|
83
|
-
| "0xa198f3be41cda8c07b3bf3fee02263526e535d682499806979a111e88a5a8d0f::coin::COIN"
|
|
84
|
-
| "0x6864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS"
|
|
85
|
-
| "0x5d1f47ea69bb0de31c313d7acf89b890dbb8991ea8e03c6c355171f84bb1ba4a::turbos::TURBOS"
|
|
86
|
-
| "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI"
|
|
87
|
-
| "0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY";
|
|
88
|
-
|
|
89
|
-
const ALPHA_SUI_POOL_RECEIPT = conf[CONF_ENV].ALPHA_SUI_POOL_RECEIPT;
|
|
90
|
-
const USDY_USDC_POOL_RECEIPT = conf[CONF_ENV].USDY_USDC_POOL_RECEIPT;
|
|
91
|
-
const USDT_USDC_POOL_RECEIPT = conf[CONF_ENV].USDT_USDC_POOL_RECEIPT;
|
|
92
|
-
const ALPHA_POOL_RECEIPT = conf[CONF_ENV].ALPHA_POOL_RECEIPT;
|
|
93
|
-
const HASUI_SUI_POOL_RECEIPT = conf[CONF_ENV].HASUI_SUI_POOL_RECEIPT;
|
|
94
|
-
const USDC_SUI_POOL_RECEIPT = conf[CONF_ENV].USDC_SUI_POOL_RECEIPT;
|
|
95
|
-
const USDC_WBTC_POOL_RECEIPT = conf[CONF_ENV].USDC_WBTC_POOL_RECEIPT;
|
|
96
|
-
const WETH_USDC_POOL_RECEIPT = conf[CONF_ENV].WETH_USDC_POOL_RECEIPT;
|
|
97
|
-
const NAVI_SUI_POOL_RECEIPT = conf[CONF_ENV].NAVI_SUI_POOL_RECEIPT;
|
|
98
|
-
const NAVI_VSUI_POOL_RECEIPT = conf[CONF_ENV].NAVI_VSUI_POOL_RECEIPT;
|
|
99
|
-
const NAVX_SUI_POOL_RECEIPT = conf[CONF_ENV].NAVX_SUI_POOL_RECEIPT;
|
|
100
|
-
const NAVI_WETH_POOL_RECEIPT = conf[CONF_ENV].NAVI_WETH_POOL_RECEIPT;
|
|
101
|
-
const NAVI_USDT_POOL_RECEIPT = conf[CONF_ENV].NAVI_USDT_POOL_RECEIPT;
|
|
102
|
-
const NAVI_USDC_POOL_RECEIPT = conf[CONF_ENV].NAVI_USDC_POOL_RECEIPT;
|
|
103
|
-
export type PoolReceipt =
|
|
104
|
-
| typeof ALPHA_SUI_POOL_RECEIPT
|
|
105
|
-
| typeof USDY_USDC_POOL_RECEIPT
|
|
106
|
-
| typeof USDT_USDC_POOL_RECEIPT
|
|
107
|
-
| typeof ALPHA_POOL_RECEIPT
|
|
108
|
-
| typeof HASUI_SUI_POOL_RECEIPT
|
|
109
|
-
| typeof USDC_SUI_POOL_RECEIPT
|
|
110
|
-
| typeof USDC_WBTC_POOL_RECEIPT
|
|
111
|
-
| typeof WETH_USDC_POOL_RECEIPT
|
|
112
|
-
| typeof NAVI_SUI_POOL_RECEIPT
|
|
113
|
-
| typeof NAVI_VSUI_POOL_RECEIPT
|
|
114
|
-
| typeof NAVX_SUI_POOL_RECEIPT
|
|
115
|
-
| typeof NAVI_WETH_POOL_RECEIPT
|
|
116
|
-
| typeof NAVI_USDT_POOL_RECEIPT
|
|
117
|
-
| typeof NAVI_USDC_POOL_RECEIPT;
|
|
118
|
-
|
|
119
|
-
export type CoinAmounts = {
|
|
120
|
-
coinA: BN;
|
|
121
|
-
coinB: BN;
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
export type CetusInvestor = {
|
|
125
|
-
objectId: string;
|
|
126
|
-
version: string;
|
|
127
|
-
digest: string;
|
|
128
|
-
type: string;
|
|
129
|
-
content: {
|
|
130
|
-
dataType: string;
|
|
131
|
-
type: string;
|
|
132
|
-
hasPublicTransfer: boolean;
|
|
133
|
-
fields: {
|
|
134
|
-
free_balance_a: string;
|
|
135
|
-
free_balance_b: string;
|
|
136
|
-
id: {
|
|
137
|
-
id: string;
|
|
138
|
-
};
|
|
139
|
-
lower_tick: string;
|
|
140
|
-
performance_fee: string;
|
|
141
|
-
performance_fee_max_cap: string;
|
|
142
|
-
upper_tick: string;
|
|
143
|
-
};
|
|
144
|
-
};
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
export type CetusPoolType = {
|
|
148
|
-
objectId: string;
|
|
149
|
-
version: string;
|
|
150
|
-
digest: string;
|
|
151
|
-
content: {
|
|
152
|
-
dataType: string;
|
|
153
|
-
type: string;
|
|
154
|
-
hasPublicTransfer: boolean;
|
|
155
|
-
fields: {
|
|
156
|
-
xTokenSupply: string;
|
|
157
|
-
tokensInvested: string;
|
|
158
|
-
coin_a: string;
|
|
159
|
-
coin_b: string;
|
|
160
|
-
current_sqrt_price: string;
|
|
161
|
-
current_tick_index: {
|
|
162
|
-
fields: { bits: number };
|
|
163
|
-
type: string;
|
|
164
|
-
};
|
|
165
|
-
fee_growth_global_a: string;
|
|
166
|
-
fee_growth_global_b: string;
|
|
167
|
-
fee_protocol_coin_a: string;
|
|
168
|
-
fee_protocol_coin_b: string;
|
|
169
|
-
fee_rate: string;
|
|
170
|
-
id: { id: string };
|
|
171
|
-
index: string;
|
|
172
|
-
is_pause: boolean;
|
|
173
|
-
liquidity: string;
|
|
174
|
-
position_manager: {
|
|
175
|
-
fields: {
|
|
176
|
-
position_index: string;
|
|
177
|
-
positions: {
|
|
178
|
-
fields: {
|
|
179
|
-
head: string;
|
|
180
|
-
id: { id: string };
|
|
181
|
-
size: string;
|
|
182
|
-
tail: string;
|
|
183
|
-
};
|
|
184
|
-
type: string;
|
|
185
|
-
};
|
|
186
|
-
tick_spacing: number;
|
|
187
|
-
};
|
|
188
|
-
type: string;
|
|
189
|
-
};
|
|
190
|
-
// reward_manager: {};
|
|
191
|
-
// tick_manager: {};
|
|
192
|
-
tick_spacing: number;
|
|
193
|
-
url: string;
|
|
194
|
-
};
|
|
195
|
-
};
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
export type Receipt = {
|
|
199
|
-
objectId: string;
|
|
200
|
-
version: string;
|
|
201
|
-
digest: string;
|
|
202
|
-
type: string;
|
|
203
|
-
content: {
|
|
204
|
-
dataType: string;
|
|
205
|
-
type: string;
|
|
206
|
-
hasPublicTransfer: boolean;
|
|
207
|
-
fields: {
|
|
208
|
-
creator: string;
|
|
209
|
-
id: { id: string };
|
|
210
|
-
image_url: string;
|
|
211
|
-
last_acc_reward_per_xtoken: {
|
|
212
|
-
type: string;
|
|
213
|
-
fields: {
|
|
214
|
-
contents: [
|
|
215
|
-
{
|
|
216
|
-
type: string;
|
|
217
|
-
fields: {
|
|
218
|
-
value: string;
|
|
219
|
-
key: {
|
|
220
|
-
type: string;
|
|
221
|
-
fields: {
|
|
222
|
-
name: string;
|
|
223
|
-
};
|
|
224
|
-
};
|
|
225
|
-
};
|
|
226
|
-
},
|
|
227
|
-
];
|
|
228
|
-
};
|
|
229
|
-
};
|
|
230
|
-
locked_balance: {
|
|
231
|
-
type: string;
|
|
232
|
-
fields: {
|
|
233
|
-
head: string;
|
|
234
|
-
id: { id: string };
|
|
235
|
-
size: string;
|
|
236
|
-
tail: string;
|
|
237
|
-
};
|
|
238
|
-
};
|
|
239
|
-
name: string;
|
|
240
|
-
owner: string;
|
|
241
|
-
pending_rewards: {
|
|
242
|
-
type: string;
|
|
243
|
-
fields: {
|
|
244
|
-
contents: [
|
|
245
|
-
{
|
|
246
|
-
fields: {
|
|
247
|
-
key: {
|
|
248
|
-
type: string;
|
|
249
|
-
fields: {
|
|
250
|
-
name: string;
|
|
251
|
-
};
|
|
252
|
-
};
|
|
253
|
-
value: string;
|
|
254
|
-
};
|
|
255
|
-
type: string;
|
|
256
|
-
},
|
|
257
|
-
];
|
|
258
|
-
};
|
|
259
|
-
};
|
|
260
|
-
pool_id: string;
|
|
261
|
-
xTokenBalance: string;
|
|
262
|
-
unlocked_xtokens: string;
|
|
263
|
-
};
|
|
264
|
-
};
|
|
265
|
-
};
|
|
266
|
-
export type PoolType = {
|
|
267
|
-
objectId: string;
|
|
268
|
-
version: string;
|
|
269
|
-
digest: string;
|
|
270
|
-
content: {
|
|
271
|
-
dataType: string;
|
|
272
|
-
type: string;
|
|
273
|
-
hasPublicTransfer: boolean;
|
|
274
|
-
fields: {
|
|
275
|
-
id: { id: string };
|
|
276
|
-
xTokenSupply: string;
|
|
277
|
-
tokensInvested: string;
|
|
278
|
-
// rewards: Bag,
|
|
279
|
-
acc_rewards_per_xtoken: {
|
|
280
|
-
type: string;
|
|
281
|
-
fields: {
|
|
282
|
-
contents: [
|
|
283
|
-
{
|
|
284
|
-
type: string;
|
|
285
|
-
fields: {
|
|
286
|
-
value: string;
|
|
287
|
-
key: {
|
|
288
|
-
type: string;
|
|
289
|
-
fields: {
|
|
290
|
-
name: string;
|
|
291
|
-
};
|
|
292
|
-
};
|
|
293
|
-
};
|
|
294
|
-
},
|
|
295
|
-
];
|
|
296
|
-
};
|
|
297
|
-
};
|
|
298
|
-
locked_period_in_days: string;
|
|
299
|
-
locking_start_day: string;
|
|
300
|
-
alpha_bal: string;
|
|
301
|
-
locked_balance_withdrawal_fee: string;
|
|
302
|
-
deposit_fee: string;
|
|
303
|
-
deposit_fee_max_cap: string;
|
|
304
|
-
withdrawal_fee: string;
|
|
305
|
-
withdraw_fee_max_cap: string;
|
|
306
|
-
weight: string;
|
|
307
|
-
alphaUnlockedPerSecond: string;
|
|
308
|
-
};
|
|
309
|
-
};
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
export type AlphaPoolType = {
|
|
313
|
-
objectId: string;
|
|
314
|
-
version: string;
|
|
315
|
-
digest: string;
|
|
316
|
-
content: {
|
|
317
|
-
dataType: string;
|
|
318
|
-
type: string;
|
|
319
|
-
hasPublicTransfer: boolean;
|
|
320
|
-
fields: {
|
|
321
|
-
// acc_rewards_per_xtoken: VecMap<TypeName,u256>,
|
|
322
|
-
alpha_bal: string;
|
|
323
|
-
deposit_fee: string;
|
|
324
|
-
deposit_fee_max_cap: string;
|
|
325
|
-
id: { id: string };
|
|
326
|
-
// image_url: string;
|
|
327
|
-
instant_withdraw_fee: string;
|
|
328
|
-
instant_withdraw_fee_max_cap: string;
|
|
329
|
-
locked_period_in_days: string;
|
|
330
|
-
locking_start_day: string;
|
|
331
|
-
acc_rewards_per_xtoken: {
|
|
332
|
-
type: string;
|
|
333
|
-
fields: {
|
|
334
|
-
contents: [
|
|
335
|
-
{
|
|
336
|
-
type: string;
|
|
337
|
-
fields: {
|
|
338
|
-
value: string;
|
|
339
|
-
key: {
|
|
340
|
-
type: string;
|
|
341
|
-
fields: {
|
|
342
|
-
name: string;
|
|
343
|
-
};
|
|
344
|
-
};
|
|
345
|
-
};
|
|
346
|
-
},
|
|
347
|
-
];
|
|
348
|
-
};
|
|
349
|
-
};
|
|
350
|
-
// name: string;
|
|
351
|
-
// rewards: Bag,
|
|
352
|
-
tokensInvested: string;
|
|
353
|
-
withdraw_fee_max_cap: string;
|
|
354
|
-
withdrawal_fee: string;
|
|
355
|
-
xTokenSupply: string;
|
|
356
|
-
};
|
|
357
|
-
};
|
|
358
|
-
};
|
|
359
|
-
|
|
360
|
-
export class SimpleCache<T> {
|
|
361
|
-
private cache: { [key: string]: { value: T; expiry: number } } = {};
|
|
362
|
-
private defaultTTL: number;
|
|
363
|
-
|
|
364
|
-
constructor(defaultTTL: number = 60000) {
|
|
365
|
-
// Default TTL is 60 seconds
|
|
366
|
-
this.defaultTTL = defaultTTL;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
get(key: string): T | null {
|
|
370
|
-
const cacheEntry = this.cache[key];
|
|
371
|
-
if (cacheEntry && cacheEntry.expiry > Date.now()) {
|
|
372
|
-
return cacheEntry.value;
|
|
373
|
-
} else {
|
|
374
|
-
// If the entry has expired, delete it
|
|
375
|
-
this.delete(key);
|
|
376
|
-
return null;
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
set(key: string, value: T, ttl?: number): void {
|
|
381
|
-
const expiry = Date.now() + (ttl || this.defaultTTL);
|
|
382
|
-
this.cache[key] = { value, expiry };
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
delete(key: string): void {
|
|
386
|
-
delete this.cache[key];
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
clear(): void {
|
|
390
|
-
this.cache = {};
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
export interface CoinPair {
|
|
395
|
-
coinA: Coin;
|
|
396
|
-
coinB: Coin;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
export type SwapOptions = {
|
|
400
|
-
pair: CoinPair;
|
|
401
|
-
senderAddress: string;
|
|
402
|
-
slippage: number;
|
|
403
|
-
} & ({ inAmount: BN; outAmount?: never } | { outAmount: BN; inAmount?: never });
|
|
404
|
-
|
|
405
|
-
export type CetusSwapOptions = SwapOptions;
|
|
406
|
-
|
|
407
|
-
export type TickSpacing = 2 | 10 | 60 | 200;
|
|
408
|
-
|
|
409
|
-
export type CreatePoolOptions = {
|
|
410
|
-
tickSpacing: TickSpacing;
|
|
411
|
-
initializePrice: number;
|
|
412
|
-
imageUrl: string;
|
|
413
|
-
coinNameA: CoinName;
|
|
414
|
-
coinNameB: CoinName;
|
|
415
|
-
amount: number;
|
|
416
|
-
isAmountA: boolean;
|
|
417
|
-
};
|
|
418
|
-
|
|
419
|
-
export type AlphaFiVault = {
|
|
420
|
-
poolId: string | null;
|
|
421
|
-
poolName: string | null;
|
|
422
|
-
receiptName: string | null;
|
|
423
|
-
receiptType: string | null;
|
|
424
|
-
coinTypeA: string | null;
|
|
425
|
-
coinTypeB: string | null;
|
|
426
|
-
};
|
|
427
|
-
|
|
428
|
-
export type AlphaVaultBalance = {
|
|
429
|
-
lockedAlphaCoins: string | null;
|
|
430
|
-
lockedAlphaCoinsInUSD: string | null;
|
|
431
|
-
unlockedAlphaCoins: string | null;
|
|
432
|
-
unlockedAlphaCoinsInUSD: string | null;
|
|
433
|
-
totalAlphaCoins: string | null;
|
|
434
|
-
totalAlphaCoinsInUSD: string | null;
|
|
435
|
-
};
|
|
436
|
-
|
|
437
|
-
export type DoubleAssetVaultBalance = {
|
|
438
|
-
coinA: string | null;
|
|
439
|
-
coinB: string | null;
|
|
440
|
-
valueInUSD: string | null;
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
export type SingleAssetVaultBalance = {
|
|
444
|
-
coin: string | null;
|
|
445
|
-
valueInUSD: string | null;
|
|
446
|
-
};
|