@typus/typus-sdk 1.6.4-tk → 1.6.5
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/dist/src/auto-bid/token-user-entry.js +60 -5
- package/dist/src/constants/token.d.ts +56 -21
- package/dist/src/constants/token.js +163 -222
- package/dist/src/typus-dov-single-v2/history/user-history.d.ts +1 -2
- package/dist/src/typus-dov-single-v2/history/user-history.js +1 -1
- package/dist/src/typus-dov-single-v2/token-user-entry.d.ts +0 -1
- package/dist/src/typus-dov-single-v2/token-user-entry.js +65 -14
- package/dist/src/typus-safu/user-entry.js +1 -1
- package/dist/src/utils/tools.js +1 -1
- package/dist/src/utils/typusConfig.d.ts +64 -1
- package/package.json +3 -2
|
@@ -20,9 +20,22 @@ exports.getTokenNewStrategyTx = getTokenNewStrategyTx;
|
|
|
20
20
|
exports.getTokenUpdateStrategyTx = getTokenUpdateStrategyTx;
|
|
21
21
|
exports.getTokenCloseStrategyTx = getTokenCloseStrategyTx;
|
|
22
22
|
exports.getTokenWithdrawProfitStrategyTx = getTokenWithdrawProfitStrategyTx;
|
|
23
|
-
var token_user_entry_1 = require("../../src/typus-dov-single-v2/token-user-entry");
|
|
24
23
|
function getTokenNewStrategyTx(config, tx, input) {
|
|
25
|
-
var typusTokenRegistry =
|
|
24
|
+
var typusTokenRegistry = "";
|
|
25
|
+
switch (input.typusTokenType.split("::")[1]) {
|
|
26
|
+
case "mfud":
|
|
27
|
+
typusTokenRegistry = config.registry.token.mfud;
|
|
28
|
+
break;
|
|
29
|
+
case "mblub":
|
|
30
|
+
typusTokenRegistry = config.registry.token.mblub;
|
|
31
|
+
break;
|
|
32
|
+
case "mliq":
|
|
33
|
+
typusTokenRegistry = config.registry.token.mliq;
|
|
34
|
+
break;
|
|
35
|
+
default:
|
|
36
|
+
console.log("No such token exists!");
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
26
39
|
var tToken = tx.moveCall({
|
|
27
40
|
target: "".concat(input.typusTokenType.split("::")[0], "::").concat(input.typusTokenType.split("::")[1], "::mint"),
|
|
28
41
|
arguments: [
|
|
@@ -49,7 +62,21 @@ function getTokenNewStrategyTx(config, tx, input) {
|
|
|
49
62
|
return tx;
|
|
50
63
|
}
|
|
51
64
|
function getTokenUpdateStrategyTx(config, tx, input) {
|
|
52
|
-
var typusTokenRegistry =
|
|
65
|
+
var typusTokenRegistry = "";
|
|
66
|
+
switch (input.typusTokenType.split("::")[1]) {
|
|
67
|
+
case "mfud":
|
|
68
|
+
typusTokenRegistry = config.registry.token.mfud;
|
|
69
|
+
break;
|
|
70
|
+
case "mblub":
|
|
71
|
+
typusTokenRegistry = config.registry.token.mblub;
|
|
72
|
+
break;
|
|
73
|
+
case "mliq":
|
|
74
|
+
typusTokenRegistry = config.registry.token.mliq;
|
|
75
|
+
break;
|
|
76
|
+
default:
|
|
77
|
+
console.log("No such token exists!");
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
53
80
|
var _a = __read(tx.moveCall({
|
|
54
81
|
target: "".concat(input.typusTokenType.split("::")[0], "::").concat(input.typusTokenType.split("::")[1], "::mint"),
|
|
55
82
|
arguments: [
|
|
@@ -77,7 +104,21 @@ function getTokenUpdateStrategyTx(config, tx, input) {
|
|
|
77
104
|
return tx;
|
|
78
105
|
}
|
|
79
106
|
function getTokenCloseStrategyTx(config, tx, input) {
|
|
80
|
-
var typusTokenRegistry =
|
|
107
|
+
var typusTokenRegistry = "";
|
|
108
|
+
switch (input.typusTokenType.split("::")[1]) {
|
|
109
|
+
case "mfud":
|
|
110
|
+
typusTokenRegistry = config.registry.token.mfud;
|
|
111
|
+
break;
|
|
112
|
+
case "mblub":
|
|
113
|
+
typusTokenRegistry = config.registry.token.mblub;
|
|
114
|
+
break;
|
|
115
|
+
case "mliq":
|
|
116
|
+
typusTokenRegistry = config.registry.token.mliq;
|
|
117
|
+
break;
|
|
118
|
+
default:
|
|
119
|
+
console.log("No such token exists!");
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
81
122
|
var _a = __read(tx.moveCall({
|
|
82
123
|
target: "".concat(config.package.dovSingle, "::auto_bid::close_strategy"),
|
|
83
124
|
typeArguments: input.typeArguments,
|
|
@@ -112,7 +153,21 @@ function getTokenCloseStrategyTx(config, tx, input) {
|
|
|
112
153
|
return tx;
|
|
113
154
|
}
|
|
114
155
|
function getTokenWithdrawProfitStrategyTx(config, tx, input) {
|
|
115
|
-
var typusTokenRegistry =
|
|
156
|
+
var typusTokenRegistry = "";
|
|
157
|
+
switch (input.typusTokenType.split("::")[1]) {
|
|
158
|
+
case "mfud":
|
|
159
|
+
typusTokenRegistry = config.registry.token.mfud;
|
|
160
|
+
break;
|
|
161
|
+
case "mblub":
|
|
162
|
+
typusTokenRegistry = config.registry.token.mblub;
|
|
163
|
+
break;
|
|
164
|
+
case "mliq":
|
|
165
|
+
typusTokenRegistry = config.registry.token.mliq;
|
|
166
|
+
break;
|
|
167
|
+
default:
|
|
168
|
+
console.log("No such token exists!");
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
116
171
|
var d_token = tx.moveCall({
|
|
117
172
|
target: "".concat(config.package.dovSingle, "::auto_bid::withdraw_profit"),
|
|
118
173
|
typeArguments: input.typeArguments,
|
|
@@ -1,28 +1,63 @@
|
|
|
1
1
|
export declare function typeArgsToAssets(typeArgs: string[]): string[];
|
|
2
|
-
export declare function typeArgToAsset(typeArg: string):
|
|
3
|
-
export declare function assetToDecimal(asset:
|
|
2
|
+
export declare function typeArgToAsset(typeArg: string): string;
|
|
3
|
+
export declare function assetToDecimal(asset: string): number | undefined;
|
|
4
4
|
export declare const tokenType: {
|
|
5
|
+
SUI: string;
|
|
5
6
|
MAINNET: {
|
|
6
|
-
|
|
7
|
+
SUI: string;
|
|
8
|
+
BTC: string;
|
|
9
|
+
ETH: string;
|
|
10
|
+
wUSDC: string;
|
|
11
|
+
USDT: string;
|
|
12
|
+
CETUS: string;
|
|
13
|
+
BUCK: string;
|
|
14
|
+
SOL: string;
|
|
15
|
+
TURBOS: string;
|
|
16
|
+
APT: string;
|
|
17
|
+
FUD: string;
|
|
18
|
+
MFUD: string;
|
|
19
|
+
INJ: string;
|
|
20
|
+
SEI: string;
|
|
21
|
+
AFSUI: string;
|
|
22
|
+
JUP: string;
|
|
23
|
+
NAVX: string;
|
|
24
|
+
USDY: string;
|
|
25
|
+
TEXP: string;
|
|
26
|
+
SCA: string;
|
|
27
|
+
VSUI: string;
|
|
28
|
+
HASUI: string;
|
|
29
|
+
LIQ: string;
|
|
30
|
+
HIPPO: string;
|
|
31
|
+
MLIQ: string;
|
|
32
|
+
BLUE: string;
|
|
33
|
+
TYPUS: string;
|
|
7
34
|
};
|
|
8
35
|
TESTNET: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
36
|
+
SUI: string;
|
|
37
|
+
CETUS: string;
|
|
38
|
+
BUCK: string;
|
|
39
|
+
SOL: string;
|
|
40
|
+
TURBOS: string;
|
|
41
|
+
APT: string;
|
|
42
|
+
FUD: string;
|
|
43
|
+
MFUD: string;
|
|
44
|
+
USDT: string;
|
|
45
|
+
AFSUI: string;
|
|
46
|
+
INJ: string;
|
|
47
|
+
SEI: string;
|
|
48
|
+
USDY: string;
|
|
49
|
+
TEXP: string;
|
|
50
|
+
SCA: string;
|
|
51
|
+
BTC: string;
|
|
52
|
+
ETH: string;
|
|
53
|
+
wUSDC: string;
|
|
54
|
+
USDC: string;
|
|
55
|
+
BLUB: string;
|
|
56
|
+
MBLUB: string;
|
|
57
|
+
TYPUS: string;
|
|
27
58
|
};
|
|
28
59
|
};
|
|
60
|
+
export type TOKEN = "SUI" | "CETUS" | "BUCK" | "SOL" | "TURBOS" | "APT" | "FUD" | "MFUD" | "BLUB" | "MBLUB" | "USDT" | "AFSUI" | "INJ" | "SEI" | "USDY" | "TEXP" | "SCA" | "BTC" | "ETH" | "USDC" | "LIQ" | "MLIQ" | "HIPPO" | "DEEP" | "BLUE" | "wUSDC" | "TYPUS";
|
|
61
|
+
export declare function typeArgToToken(typeArg: string): string;
|
|
62
|
+
export declare function tokenTypeToAsset(env: 'MAINNET' | 'TESTNET', tokenAddress: string): string | undefined;
|
|
63
|
+
export declare function assetToTokenType(env: 'MAINNET' | 'TESTNET', token: string): string;
|
|
@@ -1,9 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __values = (this && this.__values) || function(o) {
|
|
3
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
4
|
+
if (m) return m.call(o);
|
|
5
|
+
if (o && typeof o.length === "number") return {
|
|
6
|
+
next: function () {
|
|
7
|
+
if (o && i >= o.length) o = void 0;
|
|
8
|
+
return { value: o && o[i++], done: !o };
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
12
|
+
};
|
|
13
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
14
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
+
if (!m) return o;
|
|
16
|
+
var i = m.call(o), r, ar = [], e;
|
|
17
|
+
try {
|
|
18
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
+
}
|
|
20
|
+
catch (error) { e = { error: error }; }
|
|
21
|
+
finally {
|
|
22
|
+
try {
|
|
23
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
+
}
|
|
25
|
+
finally { if (e) throw e.error; }
|
|
26
|
+
}
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
2
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
30
|
+
exports.tokenType = void 0;
|
|
4
31
|
exports.typeArgsToAssets = typeArgsToAssets;
|
|
5
32
|
exports.typeArgToAsset = typeArgToAsset;
|
|
6
33
|
exports.assetToDecimal = assetToDecimal;
|
|
34
|
+
exports.typeArgToToken = typeArgToToken;
|
|
35
|
+
exports.tokenTypeToAsset = tokenTypeToAsset;
|
|
36
|
+
exports.assetToTokenType = assetToTokenType;
|
|
7
37
|
var utils_1 = require("@mysten/sui/utils");
|
|
8
38
|
function typeArgsToAssets(typeArgs) {
|
|
9
39
|
var assets = typeArgs.map(function (x) { return typeArgToAsset(x); });
|
|
@@ -11,150 +41,66 @@ function typeArgsToAssets(typeArgs) {
|
|
|
11
41
|
}
|
|
12
42
|
function typeArgToAsset(typeArg) {
|
|
13
43
|
var typeArgs = typeArg.split("::");
|
|
14
|
-
switch (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
case "
|
|
18
|
-
return "
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
case "
|
|
22
|
-
return "
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
case "
|
|
44
|
+
switch ((0, utils_1.normalizeSuiAddress)(typeArgs[0])) {
|
|
45
|
+
case "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55":
|
|
46
|
+
return "VSUI";
|
|
47
|
+
case "0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881":
|
|
48
|
+
return "WBTC";
|
|
49
|
+
case "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5":
|
|
50
|
+
return "WETH";
|
|
51
|
+
case "0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8":
|
|
52
|
+
return "WSOL";
|
|
53
|
+
case "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf":
|
|
54
|
+
return "wUSDC";
|
|
55
|
+
case "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c":
|
|
56
|
+
return "USDT";
|
|
57
|
+
case "0x5d1f47ea69bb0de31c313d7acf89b890dbb8991ea8e03c6c355171f84bb1ba4a":
|
|
26
58
|
return "TURBOS";
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// SCA
|
|
31
|
-
case "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA":
|
|
32
|
-
case "0xd33ea459d9e667c112f5168464a885a654d7bc3fd6903720aaa8cf495a32a77e::sca::SCA":
|
|
33
|
-
return "SCA";
|
|
34
|
-
// DEEP
|
|
35
|
-
case "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP":
|
|
36
|
-
return "DEEP";
|
|
37
|
-
// BLUE
|
|
38
|
-
case "0xe1b45a0e641b9955a20aa0ad1c1f4ad86aad8afb07296d4085e349a50e90bdca::blue::BLUE":
|
|
39
|
-
return "BLUE";
|
|
40
|
-
// TYPUS
|
|
41
|
-
case "0xf82dc05634970553615eef6112a1ac4fb7bf10272bf6cbe0f80ef44a6c489385::typus::TYPUS":
|
|
42
|
-
case "0xaded0918624ba1a31a9818ae73ccb557d46f35cb0d754b34597356ce38e6004d::typus::TYPUS":
|
|
43
|
-
return "TYPUS";
|
|
44
|
-
// meme
|
|
45
|
-
// FUD
|
|
46
|
-
case "0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1::fud::FUD": // MAINNET
|
|
47
|
-
case "0x461efa7ee5aa1b27e44450d79e2104e7fc0991461e9eb1c2a3fc1f44cd554856::fud::FUD": // TESTNET
|
|
59
|
+
case "0x3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37":
|
|
60
|
+
return "APT";
|
|
61
|
+
case "0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1":
|
|
48
62
|
return "FUD";
|
|
49
|
-
|
|
50
|
-
case "0xd8f04cd2a16c19c17428c3b4c22b01dd06740423b93fb7ee88fbe2676a82849d::mfud::MFUD": // MAINNET
|
|
51
|
-
case "0x7755ff79f0f27256c73e6c197e25b407ef6d4b9bd6e1af8cdd50fef28f84712c::mfud::MFUD": // TESTNET
|
|
52
|
-
return "MFUD";
|
|
53
|
-
// BLUB
|
|
54
|
-
case "0xfa7ac3951fdca92c5200d468d31a365eb03b2be9936fde615e69f0c1274ad3a0::BLUB::BLUB":
|
|
55
|
-
case "0x94b8f6dcceeb2be160f6837089cc7502458f4f070fa0814380737acb0c41fd5b::BLUB::BLUB":
|
|
56
|
-
return "BLUB";
|
|
57
|
-
// MBLUB
|
|
58
|
-
case "0x494e1772851793ed39e2aee9990740fe3fc4d50476572b6192adea9268e8b40c::mblub::MBLUB":
|
|
59
|
-
case "0x4b5d0a097ee8a309a89bb2bc589403a4a9a39de639d576495b697be2a60f69bb::mblub::MBLUB":
|
|
60
|
-
return "MBLUB";
|
|
61
|
-
// LIQ
|
|
62
|
-
case "0x9c86d1926a0a39e906f20674d6a35f337be8625ebcb6b799ee8ff011f328bee2::liq::LIQ":
|
|
63
|
-
return "LIQ";
|
|
64
|
-
// MLIQ
|
|
65
|
-
case "9614657c9d7e8799be4f49781ef1a9247b83ee178976df6c92d29b6026b9dadf::mliq::MLIQ":
|
|
66
|
-
return "MLIQ";
|
|
67
|
-
// HIPPO
|
|
68
|
-
case "0x8993129d72e733985f7f1a00396cbd055bad6f817fee36576ce483c8bbb8b87b::sudeng::SUDENG":
|
|
69
|
-
return "HIPPO";
|
|
70
|
-
// native USD
|
|
71
|
-
// BUCK
|
|
72
|
-
case "0xce7ff77a83ea0cb6fd39bd8748e2ec89a3f41e8efdc3f4eb123e0ca37b184db2::buck::BUCK": // MAINNET
|
|
73
|
-
case "0x879cd4804fe865897090e26eceb9f7a7cfda7dda1b2529a81631fa567e67375c::buck::BUCK": // TESTNET
|
|
74
|
-
return "BUCK";
|
|
75
|
-
// USDY
|
|
76
|
-
case "0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY": // MAINNET
|
|
77
|
-
case "0x579809c614d4388ed821c9f304bb741715cdf4a718707eb7c6fcf7b7189870ef::usdy::USDY": // TESTNET
|
|
78
|
-
return "USDY";
|
|
79
|
-
// AUSD
|
|
80
|
-
case "0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD": // MAINNET
|
|
81
|
-
case "0x087653e9ffcc8ffe85e0e20523388aa27af2a5997ae64224444f0d98a2ba8279::ausd::AUSD": // TESTNET
|
|
82
|
-
return "AUSD";
|
|
83
|
-
// USDC
|
|
84
|
-
case "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC":
|
|
85
|
-
case "0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC":
|
|
86
|
-
return "USDC";
|
|
87
|
-
// wormhole bridge
|
|
88
|
-
// wBTC
|
|
89
|
-
case "0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN": // MAINNET
|
|
90
|
-
case "0x949572061c09bbedef3ac4ffc42e58632291616f0605117cec86d840e09bf519::btc::BTC": // TESTNET
|
|
91
|
-
return "wBTC";
|
|
92
|
-
// wETH
|
|
93
|
-
case "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN": // MAINNET
|
|
94
|
-
case "0x949572061c09bbedef3ac4ffc42e58632291616f0605117cec86d840e09bf519::eth::ETH": // TESTNET
|
|
95
|
-
return "wETH";
|
|
96
|
-
// wUSDC
|
|
97
|
-
case "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN": // MAINNET
|
|
98
|
-
case "0x949572061c09bbedef3ac4ffc42e58632291616f0605117cec86d840e09bf519::usdc::USDC": // TESTNET
|
|
99
|
-
return "wUSDC";
|
|
100
|
-
// wUSDT
|
|
101
|
-
case "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN": // MAINNET
|
|
102
|
-
case "0xa38dad920880f81ea514de6db007d3a84e9116a29c60b3e69bbe418c2d9f553c::usdt::USDT": // TESTNET
|
|
103
|
-
return "wUSDT";
|
|
104
|
-
// wSOL
|
|
105
|
-
case "0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8::coin::COIN": // MAINNET
|
|
106
|
-
case "0x879cd4804fe865897090e26eceb9f7a7cfda7dda1b2529a81631fa567e67375c::sol::SOL": // TESTNET
|
|
107
|
-
return "wSOL";
|
|
108
|
-
// wAPT
|
|
109
|
-
case "0x3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37::coin::COIN": // MAINNET
|
|
110
|
-
case "0xdede697a5748d20ebff2aabf3f2fd5bd9e41afb1a624b636cddc6df69078bd22::apt::APT": // TESTNET
|
|
111
|
-
return "wAPT";
|
|
112
|
-
// native bridge
|
|
113
|
-
// sbETH
|
|
114
|
-
case "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH":
|
|
115
|
-
return "sbETH";
|
|
116
|
-
// sbUSDT
|
|
117
|
-
case "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT":
|
|
118
|
-
return "sbUSDT";
|
|
119
|
-
// LST
|
|
120
|
-
// VSUI
|
|
121
|
-
case "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT":
|
|
122
|
-
return "VSUI";
|
|
123
|
-
// HASUI
|
|
124
|
-
case "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI":
|
|
125
|
-
return "HASUI";
|
|
126
|
-
// AFSUI
|
|
127
|
-
case "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI":
|
|
128
|
-
case "0xd31923b6821fb7ba32d23e514b43d307da6ef991f9ef1af2cc4e26a0992ac87a::afsui::AFSUI":
|
|
63
|
+
case "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc":
|
|
129
64
|
return "AFSUI";
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
case "
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
case "
|
|
139
|
-
return "JUP";
|
|
140
|
-
// SEI
|
|
141
|
-
case "0xcac46c81bbe1e516c65f4c3e5da81e7092cc2e70218deafb31f1c8d5fcc9dae3::sei::SEI": // MAINNET
|
|
142
|
-
case "0xfd3d56e007e3ae44d74b6a6840de0bd04a3724360abd89ae683ca7d592bbb49e::sei::SEI": // TESTNET
|
|
143
|
-
return "SEI";
|
|
144
|
-
// sSCA
|
|
145
|
-
case "0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA":
|
|
65
|
+
case "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6":
|
|
66
|
+
return "SCA";
|
|
67
|
+
case "0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb":
|
|
68
|
+
return "USDY";
|
|
69
|
+
case "0x8993129d72e733985f7f1a00396cbd055bad6f817fee36576ce483c8bbb8b87b":
|
|
70
|
+
return "HIPPO";
|
|
71
|
+
case "0x83556891f4a0f233ce7b05cfe7f957d4020492a34f5405b2cb9377d060bef4bf":
|
|
72
|
+
return "sSUI";
|
|
73
|
+
case "0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e":
|
|
146
74
|
return "sSCA";
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
75
|
+
case "0x0000000000000000000000000000000000000000000000000000000000000002":
|
|
76
|
+
return "SUI";
|
|
77
|
+
case "0x949572061c09bbedef3ac4ffc42e58632291616f0605117cec86d840e09bf519":
|
|
78
|
+
if (typeArgs[1] === "usdc") {
|
|
79
|
+
return "wUSDC";
|
|
80
|
+
}
|
|
81
|
+
else if (typeArgs[1] === "btc") {
|
|
82
|
+
return "WBTC";
|
|
83
|
+
}
|
|
84
|
+
else if (typeArgs[1] === "eth") {
|
|
85
|
+
return "WETH";
|
|
86
|
+
}
|
|
150
87
|
default:
|
|
151
|
-
|
|
88
|
+
if (typeArgs[2] == "BTC") {
|
|
89
|
+
return "WBTC";
|
|
90
|
+
}
|
|
91
|
+
else if (typeArgs[2] == "ETH") {
|
|
92
|
+
return "WETH";
|
|
93
|
+
}
|
|
94
|
+
else if (typeArgs[2] == "SOL") {
|
|
95
|
+
return "WSOL";
|
|
96
|
+
}
|
|
97
|
+
return typeArgs[2];
|
|
152
98
|
}
|
|
153
99
|
}
|
|
154
100
|
function assetToDecimal(asset) {
|
|
155
101
|
switch (asset) {
|
|
156
102
|
case "SUI":
|
|
157
|
-
case "
|
|
103
|
+
case "sSUI":
|
|
158
104
|
case "CETUS":
|
|
159
105
|
case "TURBOS":
|
|
160
106
|
case "BUCK":
|
|
@@ -168,19 +114,20 @@ function assetToDecimal(asset) {
|
|
|
168
114
|
case "BLUE":
|
|
169
115
|
case "sSCA":
|
|
170
116
|
return 9;
|
|
171
|
-
case "
|
|
172
|
-
case "
|
|
173
|
-
case "
|
|
174
|
-
case "
|
|
175
|
-
case "
|
|
117
|
+
case "BTC":
|
|
118
|
+
case "WBTC":
|
|
119
|
+
case "ETH":
|
|
120
|
+
case "WETH":
|
|
121
|
+
case "SOL":
|
|
122
|
+
case "WSOL":
|
|
123
|
+
case "APT":
|
|
176
124
|
case "INJ":
|
|
177
125
|
case "SEI":
|
|
178
126
|
case "JUP":
|
|
179
127
|
return 8;
|
|
180
128
|
case "USDC":
|
|
181
129
|
case "wUSDC":
|
|
182
|
-
case "
|
|
183
|
-
case "sbUSDT":
|
|
130
|
+
case "USDT":
|
|
184
131
|
case "USDY":
|
|
185
132
|
case "AUSD":
|
|
186
133
|
case "DEEP":
|
|
@@ -196,17 +143,18 @@ function assetToDecimal(asset) {
|
|
|
196
143
|
}
|
|
197
144
|
}
|
|
198
145
|
exports.tokenType = {
|
|
146
|
+
SUI: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
|
|
199
147
|
MAINNET: {
|
|
200
148
|
SUI: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
|
|
201
|
-
|
|
202
|
-
|
|
149
|
+
BTC: "0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN",
|
|
150
|
+
ETH: "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN",
|
|
203
151
|
wUSDC: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN",
|
|
204
|
-
|
|
205
|
-
wSOL: "0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8::coin::COIN",
|
|
206
|
-
wAPT: "0x3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37::coin::COIN",
|
|
152
|
+
USDT: "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN",
|
|
207
153
|
CETUS: "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS",
|
|
208
154
|
BUCK: "0xce7ff77a83ea0cb6fd39bd8748e2ec89a3f41e8efdc3f4eb123e0ca37b184db2::buck::BUCK",
|
|
155
|
+
SOL: "0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8::coin::COIN",
|
|
209
156
|
TURBOS: "0x5d1f47ea69bb0de31c313d7acf89b890dbb8991ea8e03c6c355171f84bb1ba4a::turbos::TURBOS",
|
|
157
|
+
APT: "0x3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37::coin::COIN",
|
|
210
158
|
FUD: "0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1::fud::FUD",
|
|
211
159
|
MFUD: "0xd8f04cd2a16c19c17428c3b4c22b01dd06740423b93fb7ee88fbe2676a82849d::mfud::MFUD",
|
|
212
160
|
INJ: "0xcac46c81bbe1e516c65f4c3e5da81e7092cc2e70218deafb31f1c8d5fcc9dae3::inj::INJ",
|
|
@@ -224,99 +172,92 @@ exports.tokenType = {
|
|
|
224
172
|
MLIQ: "9614657c9d7e8799be4f49781ef1a9247b83ee178976df6c92d29b6026b9dadf::mliq::MLIQ",
|
|
225
173
|
BLUE: "0xe1b45a0e641b9955a20aa0ad1c1f4ad86aad8afb07296d4085e349a50e90bdca::blue::BLUE",
|
|
226
174
|
TYPUS: "0xf82dc05634970553615eef6112a1ac4fb7bf10272bf6cbe0f80ef44a6c489385::typus::TYPUS",
|
|
227
|
-
DEEP: "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP",
|
|
228
|
-
BLUB: "0xfa7ac3951fdca92c5200d468d31a365eb03b2be9936fde615e69f0c1274ad3a0::BLUB::BLUB",
|
|
229
|
-
MBLUB: "0x494e1772851793ed39e2aee9990740fe3fc4d50476572b6192adea9268e8b40c::mblub::MBLUB",
|
|
230
|
-
AUSD: "0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD",
|
|
231
|
-
USDC: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
|
|
232
|
-
sbETH: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH",
|
|
233
|
-
sbUSDT: "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT",
|
|
234
|
-
SPSUI: "0x83556891f4a0f233ce7b05cfe7f957d4020492a34f5405b2cb9377d060bef4bf::spring_sui::SPRING_SUI",
|
|
235
|
-
sSCA: "0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA",
|
|
236
175
|
},
|
|
237
176
|
TESTNET: {
|
|
238
177
|
SUI: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
|
|
239
178
|
CETUS: "0xb69a412ba4b22137088183da5e5042d37ba17580897884f00f959d4135d3e1a7::cetus::CETUS",
|
|
240
179
|
BUCK: "0x879cd4804fe865897090e26eceb9f7a7cfda7dda1b2529a81631fa567e67375c::buck::BUCK",
|
|
241
|
-
|
|
180
|
+
SOL: "0x879cd4804fe865897090e26eceb9f7a7cfda7dda1b2529a81631fa567e67375c::sol::SOL",
|
|
242
181
|
TURBOS: "0xebc68999f399a5ba121f8e59c0940eaa0e074e30454403357b93b25af9f30117::turbos::TURBOS",
|
|
243
|
-
|
|
182
|
+
APT: "0xdede697a5748d20ebff2aabf3f2fd5bd9e41afb1a624b636cddc6df69078bd22::apt::APT",
|
|
244
183
|
FUD: "0x461efa7ee5aa1b27e44450d79e2104e7fc0991461e9eb1c2a3fc1f44cd554856::fud::FUD",
|
|
245
184
|
MFUD: "0x7755ff79f0f27256c73e6c197e25b407ef6d4b9bd6e1af8cdd50fef28f84712c::mfud::MFUD",
|
|
246
|
-
|
|
185
|
+
USDT: "0xa38dad920880f81ea514de6db007d3a84e9116a29c60b3e69bbe418c2d9f553c::usdt::USDT",
|
|
247
186
|
AFSUI: "0xd31923b6821fb7ba32d23e514b43d307da6ef991f9ef1af2cc4e26a0992ac87a::afsui::AFSUI",
|
|
248
187
|
INJ: "0xfd3d56e007e3ae44d74b6a6840de0bd04a3724360abd89ae683ca7d592bbb49e::inj::INJ",
|
|
249
188
|
SEI: "0xfd3d56e007e3ae44d74b6a6840de0bd04a3724360abd89ae683ca7d592bbb49e::sei::SEI",
|
|
250
189
|
USDY: "0x579809c614d4388ed821c9f304bb741715cdf4a718707eb7c6fcf7b7189870ef::usdy::USDY",
|
|
251
190
|
TEXP: "0x9b43ee208a3b235810c145bca1161d1a71d08bfe76b1e55bb3db319ea95d0149::tails_exp::TAILS_EXP",
|
|
252
191
|
SCA: "0xd33ea459d9e667c112f5168464a885a654d7bc3fd6903720aaa8cf495a32a77e::sca::SCA",
|
|
253
|
-
|
|
254
|
-
|
|
192
|
+
BTC: "0x949572061c09bbedef3ac4ffc42e58632291616f0605117cec86d840e09bf519::btc::BTC",
|
|
193
|
+
ETH: "0x949572061c09bbedef3ac4ffc42e58632291616f0605117cec86d840e09bf519::eth::ETH",
|
|
255
194
|
wUSDC: "0x949572061c09bbedef3ac4ffc42e58632291616f0605117cec86d840e09bf519::usdc::USDC",
|
|
256
195
|
USDC: "0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC",
|
|
257
196
|
BLUB: "0x94b8f6dcceeb2be160f6837089cc7502458f4f070fa0814380737acb0c41fd5b::blub::BLUB",
|
|
258
197
|
MBLUB: "0x4b5d0a097ee8a309a89bb2bc589403a4a9a39de639d576495b697be2a60f69bb::mblub::MBLUB",
|
|
259
198
|
TYPUS: "0xaded0918624ba1a31a9818ae73ccb557d46f35cb0d754b34597356ce38e6004d::typus::TYPUS",
|
|
260
|
-
NAVX: "",
|
|
261
|
-
DEEP: "",
|
|
262
|
-
BLUE: "",
|
|
263
|
-
LIQ: "",
|
|
264
|
-
HIPPO: "",
|
|
265
|
-
MLIQ: "",
|
|
266
|
-
AUSD: "0x087653e9ffcc8ffe85e0e20523388aa27af2a5997ae64224444f0d98a2ba8279::ausd::AUSD",
|
|
267
|
-
sbETH: "",
|
|
268
|
-
sbUSDT: "",
|
|
269
|
-
VSUI: "",
|
|
270
|
-
HASUI: "",
|
|
271
|
-
SPSUI: "",
|
|
272
|
-
JUP: "",
|
|
273
|
-
sSCA: "",
|
|
274
|
-
},
|
|
275
|
-
};
|
|
276
|
-
exports.oracle = {
|
|
277
|
-
MAINNET: {},
|
|
278
|
-
TESTNET: {
|
|
279
|
-
SUI: "0x7b30b7740b4d3975eca8ef4dd3723853ac676acbc334e5a64bb5aab3bcfd06a8",
|
|
280
|
-
USDC: "0xaee20b37552f4c74e8c391479a21560022453c3b72544acaec8e5b69e90747eb",
|
|
281
|
-
wUSDT: "0xcc0233a4ad637b479931cfbba64bab61647787215b10e0bd57998228cff4cd5e",
|
|
282
|
-
wBTC: "0x4321fc6ec1bcff91f8064296ac44d240b2812b81619c52b2c649c5452fdbaca9",
|
|
283
|
-
wETH: "0xbc0410a38f6cb069eee34d2519a5beea667d5a43d61b7e355f4b7ed8d705efda",
|
|
284
|
-
wSOL: "0xb6ea41a8212a35621256446c6df68741831c4b801d811a0f3ebfe8a842794b9f",
|
|
285
|
-
CETUS: "0xc4128130b7f3fed9893df8cfa372bdb1b30794e365e16e93f8617d3a9a578a9a",
|
|
286
|
-
TURBOS: "0x6818486c76eabaa24156ccd84cd1a3df188c94ccc19bb601e7c3589d9766f7a8",
|
|
287
|
-
SCA: "0xb59cb2a1df03bdbdb9af858d883dc5ea3a90dd1d616497e244a8e7f3165fe929",
|
|
288
|
-
SEI: "0x5de032cf3643705efbc749ddd271bd783f5cedc3e6555ebea70b681ad305a848",
|
|
289
|
-
INJ: "0x77fb65d1e1d3b30428ef624af83d40dc5d5240c882795a05d862b7d17b6df62b",
|
|
290
|
-
AFSUI: "0xe1a840db2b433946837a724a12f8152d9812428227684f59886b4e32a8d96bda",
|
|
291
|
-
MFUD: "0xa360c6637e84b3182545c6cb8029cbb189a1a447ee2871112ffbb7b5fb42dabe",
|
|
292
|
-
MBLUB: "0x7852083dafac5dddf42e46912114a87c81c092268e18412f4bb9ec7ec4a255d2",
|
|
293
|
-
TYPUS: "0x70253c784b82c61cb1341d6e5589f969324ac2e325278fa071ed27cbb33d7a37",
|
|
294
|
-
},
|
|
295
|
-
};
|
|
296
|
-
exports.tokenRegistry = {
|
|
297
|
-
MAINNET: {
|
|
298
|
-
MFUD: "0xb8d7e7ab783e56700c0212bd9f0938bba9dd3e7241c149e6c52b21334ec45ece",
|
|
299
|
-
MBLUB: "0x37c31cfd324a8fdafc6dff5a083822c65b360c9dc04e2b6c4453f051754c7c3a",
|
|
300
|
-
MLIQ: "0x70acdb4a2978d2d99edf9ce0297e34e314cd097fd243a7ddbc00af1eb77f2454",
|
|
301
|
-
},
|
|
302
|
-
TESTNET: {
|
|
303
|
-
wBTC: "0xcf5184b85f47cb1ffe421249e48b2cd34807534e1a4b4ad384009295bbbd3bf4",
|
|
304
|
-
wETH: "0x5cd3726a1d1ef32bffaaeb2ec4964f0ffac56cfb919f7d13d4672aed5059bfa1",
|
|
305
|
-
wSOL: "0x1186a198ebd006e4f444ff88334307d6b376c02a040cfdad380ca06090f52472",
|
|
306
|
-
wAPT: "0xf8d1edd32c4847c6d2c0e5fbf61291ae393092540e5e0723e7c6cf52089d670f",
|
|
307
|
-
wUSDT: "0xc0bd93d1c77ff19bef3f3cd55564aa55acb46cbcc77905d2fa4893ac16cffea7",
|
|
308
|
-
wUSDC: "0xf7df3c68a7d3ffc54065565c94a9fa3f5342957340bce78be74373846241a833",
|
|
309
|
-
CETUS: "0x24a7a5297a3656ebea71ed72a4974a7710943d9a598fda60fe60b44262da9f27",
|
|
310
|
-
BUCK: "0x441cf46a499c6e4d0560c4c9000351f34a928e53018d65857a1591ca1aa2bd58",
|
|
311
|
-
TURBOS: "0x45179ff4beedfc94c29044081f3722d34ba36813b99d416bb868d1769a85bb57",
|
|
312
|
-
FUD: "0x694d47bedc6a80b405fc5c1051f065e33b2a3c5f7b79f76cb2905233b2a8c885",
|
|
313
|
-
AFSUI: "0xfee32f5338f70a782f25fabf7fa934130b43715ad6fa2aefbf91305c825c3e23",
|
|
314
|
-
INJ: "0xcfd839650442dce7ec74b2c2b2f0c5ee0d8fe1bc542d1c71062ae34192c4514c",
|
|
315
|
-
SEI: "0x2b2015fa8cad497e9673734d66ac66f411dadf2ee11be6d370ab8418331c0132",
|
|
316
|
-
SCA: "0xdb322211ad67d01232dc296fc9a1dae89fcf6188b1e6cf16e7a48e4061d23b78",
|
|
317
|
-
BLUB: "0xd470dbb74ae3f4cea5b39f1edaf729145fcdc8da023c81346fce1c1de046e6e4",
|
|
318
|
-
AUSD: "0xd87ea623f4f2635d66f59d7defaeb96e0147e0cdd8f5406756433d8d8849f785",
|
|
319
|
-
MFUD: "0x7ad87901531693f1baa541712947860dcc543617e11b14993ad70d20daf159c6",
|
|
320
|
-
MBLUB: "0x7c36d8c1b2b569676d9a3f4c73487ec49b483111cc0abf4b0d5654e026ac3d3a",
|
|
321
199
|
},
|
|
322
200
|
};
|
|
201
|
+
function typeArgToToken(typeArg) {
|
|
202
|
+
// console.log(typeArg);
|
|
203
|
+
var typeArgs = typeArg.split("::");
|
|
204
|
+
switch ((0, utils_1.normalizeSuiAddress)(typeArgs[0])) {
|
|
205
|
+
case "0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881":
|
|
206
|
+
return "BTC";
|
|
207
|
+
case "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5":
|
|
208
|
+
return "ETH";
|
|
209
|
+
case "0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8":
|
|
210
|
+
return "SOL";
|
|
211
|
+
case "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf":
|
|
212
|
+
return "wUSDC";
|
|
213
|
+
case "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c":
|
|
214
|
+
return "USDT";
|
|
215
|
+
case "0x5d1f47ea69bb0de31c313d7acf89b890dbb8991ea8e03c6c355171f84bb1ba4a":
|
|
216
|
+
return "TURBOS";
|
|
217
|
+
case "0x3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37":
|
|
218
|
+
return "APT";
|
|
219
|
+
case "0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1":
|
|
220
|
+
return "FUD";
|
|
221
|
+
case "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc":
|
|
222
|
+
return "AFSUI";
|
|
223
|
+
case "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6":
|
|
224
|
+
return "SCA";
|
|
225
|
+
case "0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb":
|
|
226
|
+
return "USDY";
|
|
227
|
+
case "0x9c86d1926a0a39e906f20674d6a35f337be8625ebcb6b799ee8ff011f328bee2":
|
|
228
|
+
return "LIQ";
|
|
229
|
+
case "0x8993129d72e733985f7f1a00396cbd055bad6f817fee36576ce483c8bbb8b87b":
|
|
230
|
+
return "HIPPO";
|
|
231
|
+
case "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270":
|
|
232
|
+
return "DEEP";
|
|
233
|
+
case "0xe1b45a0e641b9955a20aa0ad1c1f4ad86aad8afb07296d4085e349a50e90bdca":
|
|
234
|
+
return "BLUE";
|
|
235
|
+
default:
|
|
236
|
+
return typeArgs[2];
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function tokenTypeToAsset(env, tokenAddress) {
|
|
240
|
+
var e_1, _a;
|
|
241
|
+
var normalizedTokenAddress = (0, utils_1.normalizeSuiAddress)(tokenAddress);
|
|
242
|
+
var tokens = exports.tokenType[env];
|
|
243
|
+
try {
|
|
244
|
+
for (var _b = __values(Object.entries(tokens)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
245
|
+
var _d = __read(_c.value, 2), token = _d[0], address = _d[1];
|
|
246
|
+
if (address === normalizedTokenAddress) {
|
|
247
|
+
return token;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
252
|
+
finally {
|
|
253
|
+
try {
|
|
254
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
255
|
+
}
|
|
256
|
+
finally { if (e_1) throw e_1.error; }
|
|
257
|
+
}
|
|
258
|
+
// not found => return undefined
|
|
259
|
+
return undefined;
|
|
260
|
+
}
|
|
261
|
+
function assetToTokenType(env, token) {
|
|
262
|
+
return exports.tokenType[env][token];
|
|
263
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EventId, SuiClient, SuiEvent } from "@mysten/sui/client";
|
|
2
2
|
import { Vault } from "../../../src/typus-dov-single-v2";
|
|
3
|
-
import { TOKEN } from "../../../src/constants";
|
|
4
3
|
export { getNewBidFromSentio, getExerciseFromSentio } from "../../../src/utils/api/sentio/events";
|
|
5
4
|
export declare function getUserEvents(provider: SuiClient, sender: string, cursor?: EventId | null): Promise<[SuiEvent[], EventId | null | undefined]>;
|
|
6
5
|
export declare function getAutoBidEvents(provider: SuiClient, originPackage: string, startTimeMs: number): Promise<SuiEvent[]>;
|
|
@@ -21,7 +20,7 @@ export declare function parseTxHistory(datas: Array<any>, vaults: {
|
|
|
21
20
|
}): Promise<Array<TxHistory>>;
|
|
22
21
|
export declare function parseVaultInfo(vaults: {
|
|
23
22
|
[key: string]: Vault;
|
|
24
|
-
}, Index: string, action: string):
|
|
23
|
+
}, Index: string, action: string): (string | undefined)[];
|
|
25
24
|
export declare function getDepositorCashFlows(userHistory: TxHistory[]): Map<string, DepositorCashFlow>;
|
|
26
25
|
export interface DepositorCashFlow {
|
|
27
26
|
D_TOKEN: string | undefined;
|
|
@@ -510,7 +510,7 @@ function parseTxHistory(datas, vaults) {
|
|
|
510
510
|
break;
|
|
511
511
|
case "ExerciseEvent":
|
|
512
512
|
token = (0, constants_1.typeArgToAsset)("0x" + event.parsedJson.token.name);
|
|
513
|
-
amount = Number(event.parsedJson.amount) / Math.pow(10,
|
|
513
|
+
amount = Number(event.parsedJson.amount) / Math.pow(10, (0, constants_1.assetToDecimal)(token));
|
|
514
514
|
Action = "Exercise";
|
|
515
515
|
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
|
|
516
516
|
if (event.parsedJson.u64_padding[0]) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
2
2
|
import { TypusConfig } from "../../src/utils";
|
|
3
|
-
export declare function getTokenRegistry(config: TypusConfig, typusTokenType: string): string;
|
|
4
3
|
export declare function getTokenRaiseFundTx(config: TypusConfig, tx: Transaction, input: {
|
|
5
4
|
typeArguments: string[];
|
|
6
5
|
typusTokenType: string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTokenRegistry = getTokenRegistry;
|
|
4
3
|
exports.getTokenRaiseFundTx = getTokenRaiseFundTx;
|
|
5
4
|
exports.getTokenReduceFundTx = getTokenReduceFundTx;
|
|
6
5
|
exports.getTokenNewBidTx = getTokenNewBidTx;
|
|
@@ -8,26 +7,22 @@ exports.getTokenExerciseTx = getTokenExerciseTx;
|
|
|
8
7
|
exports.getTokenRebateTx = getTokenRebateTx;
|
|
9
8
|
exports.getTokenCompoundWithRedeemTx = getTokenCompoundWithRedeemTx;
|
|
10
9
|
var constants_1 = require("../../src/constants");
|
|
11
|
-
function
|
|
10
|
+
function getTokenRaiseFundTx(config, tx, input) {
|
|
12
11
|
var typusTokenRegistry = "";
|
|
13
|
-
switch (typusTokenType.split("::")[1]) {
|
|
12
|
+
switch (input.typusTokenType.split("::")[1]) {
|
|
14
13
|
case "mfud":
|
|
15
|
-
typusTokenRegistry =
|
|
14
|
+
typusTokenRegistry = config.registry.token.mfud;
|
|
16
15
|
break;
|
|
17
16
|
case "mblub":
|
|
18
|
-
typusTokenRegistry =
|
|
17
|
+
typusTokenRegistry = config.registry.token.mblub;
|
|
19
18
|
break;
|
|
20
19
|
case "mliq":
|
|
21
|
-
typusTokenRegistry =
|
|
20
|
+
typusTokenRegistry = config.registry.token.mliq;
|
|
22
21
|
break;
|
|
23
22
|
default:
|
|
24
23
|
console.log("No such token exists!");
|
|
25
24
|
break;
|
|
26
25
|
}
|
|
27
|
-
return typusTokenRegistry;
|
|
28
|
-
}
|
|
29
|
-
function getTokenRaiseFundTx(config, tx, input) {
|
|
30
|
-
var typusTokenRegistry = getTokenRegistry(config, input.typusTokenType);
|
|
31
26
|
var typusTokenBalance = input.raiseCoins.length > 0
|
|
32
27
|
? tx.moveCall({
|
|
33
28
|
target: "0x2::coin::into_balance",
|
|
@@ -71,7 +66,21 @@ function getTokenRaiseFundTx(config, tx, input) {
|
|
|
71
66
|
return tx;
|
|
72
67
|
}
|
|
73
68
|
function getTokenReduceFundTx(config, tx, input) {
|
|
74
|
-
var typusTokenRegistry =
|
|
69
|
+
var typusTokenRegistry = "";
|
|
70
|
+
switch (input.typusTokenType.split("::")[1]) {
|
|
71
|
+
case "mfud":
|
|
72
|
+
typusTokenRegistry = config.registry.token.mfud;
|
|
73
|
+
break;
|
|
74
|
+
case "mblub":
|
|
75
|
+
typusTokenRegistry = config.registry.token.mblub;
|
|
76
|
+
break;
|
|
77
|
+
case "mliq":
|
|
78
|
+
typusTokenRegistry = config.registry.token.mliq;
|
|
79
|
+
break;
|
|
80
|
+
default:
|
|
81
|
+
console.log("No such token exists!");
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
75
84
|
var result = tx.moveCall({
|
|
76
85
|
target: "".concat(config.package.dovSingle, "::tds_user_entry::public_reduce_fund"),
|
|
77
86
|
typeArguments: input.typeArguments,
|
|
@@ -157,7 +166,21 @@ function getTokenReduceFundTx(config, tx, input) {
|
|
|
157
166
|
return tx;
|
|
158
167
|
}
|
|
159
168
|
function getTokenNewBidTx(config, tx, input) {
|
|
160
|
-
var typusTokenRegistry =
|
|
169
|
+
var typusTokenRegistry = "";
|
|
170
|
+
switch (input.typusTokenType.split("::")[1]) {
|
|
171
|
+
case "mfud":
|
|
172
|
+
typusTokenRegistry = config.registry.token.mfud;
|
|
173
|
+
break;
|
|
174
|
+
case "mblub":
|
|
175
|
+
typusTokenRegistry = config.registry.token.mblub;
|
|
176
|
+
break;
|
|
177
|
+
case "mliq":
|
|
178
|
+
typusTokenRegistry = config.registry.token.mliq;
|
|
179
|
+
break;
|
|
180
|
+
default:
|
|
181
|
+
console.log("No such token exists!");
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
161
184
|
var mToken = tx.moveCall({
|
|
162
185
|
target: "".concat(input.typusTokenType.split("::")[0], "::").concat(input.typusTokenType.split("::")[1], "::mint"),
|
|
163
186
|
arguments: [
|
|
@@ -190,7 +213,21 @@ function getTokenNewBidTx(config, tx, input) {
|
|
|
190
213
|
return tx;
|
|
191
214
|
}
|
|
192
215
|
function getTokenExerciseTx(config, tx, input) {
|
|
193
|
-
var typusTokenRegistry =
|
|
216
|
+
var typusTokenRegistry = "";
|
|
217
|
+
switch (input.typusTokenType.split("::")[1]) {
|
|
218
|
+
case "mfud":
|
|
219
|
+
typusTokenRegistry = config.registry.token.mfud;
|
|
220
|
+
break;
|
|
221
|
+
case "mblub":
|
|
222
|
+
typusTokenRegistry = config.registry.token.mblub;
|
|
223
|
+
break;
|
|
224
|
+
case "mliq":
|
|
225
|
+
typusTokenRegistry = config.registry.token.mliq;
|
|
226
|
+
break;
|
|
227
|
+
default:
|
|
228
|
+
console.log("No such token exists!");
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
194
231
|
var result = tx.moveCall({
|
|
195
232
|
target: "".concat(config.package.dovSingle, "::tds_user_entry::exercise"),
|
|
196
233
|
typeArguments: input.typeArguments,
|
|
@@ -216,7 +253,21 @@ function getTokenExerciseTx(config, tx, input) {
|
|
|
216
253
|
return tx;
|
|
217
254
|
}
|
|
218
255
|
function getTokenRebateTx(config, tx, input) {
|
|
219
|
-
var typusTokenRegistry =
|
|
256
|
+
var typusTokenRegistry = "";
|
|
257
|
+
switch (input.typusTokenType.split("::")[1]) {
|
|
258
|
+
case "mfud":
|
|
259
|
+
typusTokenRegistry = config.registry.token.mfud;
|
|
260
|
+
break;
|
|
261
|
+
case "mblub":
|
|
262
|
+
typusTokenRegistry = config.registry.token.mblub;
|
|
263
|
+
break;
|
|
264
|
+
case "mliq":
|
|
265
|
+
typusTokenRegistry = config.registry.token.mliq;
|
|
266
|
+
break;
|
|
267
|
+
default:
|
|
268
|
+
console.log("No such token exists!");
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
220
271
|
var result = tx.moveCall({
|
|
221
272
|
target: "".concat(config.package.dovSingle, "::tds_user_entry::rebate"),
|
|
222
273
|
typeArguments: [input.typeArgument],
|
|
@@ -79,7 +79,7 @@ function getReduceFundTx(config, tx, input) {
|
|
|
79
79
|
tx.pure.u64(input.reduceFromWarmup),
|
|
80
80
|
tx.pure.u64(input.reduceFromActive),
|
|
81
81
|
tx.pure.u64(input.reduceFromInactive),
|
|
82
|
-
tx.object((0, utils_1.splitCoins)(tx, constants_1.tokenType.
|
|
82
|
+
tx.object((0, utils_1.splitCoins)(tx, constants_1.tokenType.SUI, [], input.feeAmount)),
|
|
83
83
|
tx.object(constants_1.CLOCK),
|
|
84
84
|
],
|
|
85
85
|
});
|
package/dist/src/utils/tools.js
CHANGED
|
@@ -80,7 +80,7 @@ function splitCoins(tx, token, coins, amount) {
|
|
|
80
80
|
}), 1), coin = _a[0];
|
|
81
81
|
}
|
|
82
82
|
else {
|
|
83
|
-
_b = __read((0, utils_1.normalizeStructTag)(token) == constants_1.tokenType.
|
|
83
|
+
_b = __read((0, utils_1.normalizeStructTag)(token) == constants_1.tokenType.SUI
|
|
84
84
|
? tx.splitCoins(tx.gas, [tx.pure.u64(amount)])
|
|
85
85
|
: (function () {
|
|
86
86
|
var coin = coins.pop();
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
export declare class TypusConfig {
|
|
2
|
-
network: "MAINNET" | "TESTNET";
|
|
3
2
|
rpcEndpoint: string;
|
|
4
3
|
packageOrigin: Package;
|
|
5
4
|
package: Package;
|
|
6
5
|
version: Version;
|
|
7
6
|
registry: Registry;
|
|
8
7
|
object: Object;
|
|
8
|
+
oracle: Oracle;
|
|
9
|
+
token: Token;
|
|
9
10
|
static parse(json: any): TypusConfig;
|
|
10
11
|
static local(path: any): TypusConfig;
|
|
11
12
|
static default(network: "MAINNET" | "TESTNET", customRpcEndpoint: string | null, branch?: string): Promise<TypusConfig>;
|
|
@@ -66,6 +67,13 @@ export interface Registry {
|
|
|
66
67
|
safu: {
|
|
67
68
|
safu: string;
|
|
68
69
|
};
|
|
70
|
+
token: {
|
|
71
|
+
inj: string;
|
|
72
|
+
mfud: string;
|
|
73
|
+
sei: string;
|
|
74
|
+
mblub: string;
|
|
75
|
+
mliq: string;
|
|
76
|
+
};
|
|
69
77
|
typus: {
|
|
70
78
|
airdrop: string;
|
|
71
79
|
leaderboard: string;
|
|
@@ -89,3 +97,58 @@ export interface Object {
|
|
|
89
97
|
launchAuction: string;
|
|
90
98
|
launchSnapshot: string;
|
|
91
99
|
}
|
|
100
|
+
export interface Oracle {
|
|
101
|
+
afsui: string;
|
|
102
|
+
apt: string;
|
|
103
|
+
buck: string;
|
|
104
|
+
cetus: string;
|
|
105
|
+
inj: string;
|
|
106
|
+
jup: string;
|
|
107
|
+
navx: string;
|
|
108
|
+
sca: string;
|
|
109
|
+
sei: string;
|
|
110
|
+
sol: string;
|
|
111
|
+
sui: string;
|
|
112
|
+
turbos: string;
|
|
113
|
+
usdy: string;
|
|
114
|
+
btc: string;
|
|
115
|
+
eth: string;
|
|
116
|
+
mliq: string;
|
|
117
|
+
hippo: string;
|
|
118
|
+
deep: string;
|
|
119
|
+
}
|
|
120
|
+
export interface Token {
|
|
121
|
+
afsui: string;
|
|
122
|
+
apt: string;
|
|
123
|
+
ausd: string;
|
|
124
|
+
blub: string;
|
|
125
|
+
btc: string;
|
|
126
|
+
buck: string;
|
|
127
|
+
cetus: string;
|
|
128
|
+
eth: string;
|
|
129
|
+
fud: string;
|
|
130
|
+
hasui: string;
|
|
131
|
+
inj: string;
|
|
132
|
+
jup: string;
|
|
133
|
+
mblub: string;
|
|
134
|
+
mfud: string;
|
|
135
|
+
navx: string;
|
|
136
|
+
sca: string;
|
|
137
|
+
sei: string;
|
|
138
|
+
sol: string;
|
|
139
|
+
sui: string;
|
|
140
|
+
texp: string;
|
|
141
|
+
tgld: string;
|
|
142
|
+
tlp: string;
|
|
143
|
+
turbos: string;
|
|
144
|
+
usd: string;
|
|
145
|
+
usdc: string;
|
|
146
|
+
usdt: string;
|
|
147
|
+
usdy: string;
|
|
148
|
+
vsui: string;
|
|
149
|
+
wusdc: string;
|
|
150
|
+
mliq: string;
|
|
151
|
+
hippo: string;
|
|
152
|
+
deep: string;
|
|
153
|
+
typus: string;
|
|
154
|
+
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typus/typus-sdk",
|
|
3
3
|
"author": "Typus",
|
|
4
4
|
"description": "typus sdk",
|
|
5
|
-
"version": "1.6.
|
|
5
|
+
"version": "1.6.5",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@mysten/bcs": "^0.11.1",
|
|
8
8
|
"@mysten/kiosk": "0.9.34",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"camelcase-keys-deep": "^0.1.0",
|
|
16
16
|
"dotenv": "^16.4.7",
|
|
17
17
|
"lodash": "^4.17.21",
|
|
18
|
-
"moment": "^2.30.1"
|
|
18
|
+
"moment": "^2.30.1",
|
|
19
|
+
"slack": "^11.0.2"
|
|
19
20
|
},
|
|
20
21
|
"devDependencies": {
|
|
21
22
|
"@types/bs58": "^4.0.1",
|