@typus/typus-sdk 1.6.2 → 1.6.4-tk
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 +5 -60
- package/dist/src/constants/token.d.ts +21 -56
- package/dist/src/constants/token.js +222 -163
- package/dist/src/typus-dov-single-v2/history/user-history.d.ts +2 -1
- package/dist/src/typus-dov-single-v2/token-user-entry.d.ts +1 -0
- package/dist/src/typus-dov-single-v2/token-user-entry.js +14 -65
- package/dist/src/typus-safu/user-entry.js +1 -1
- package/dist/src/utils/api/sentio/events.js +1 -1
- package/dist/src/utils/api/sentio/leader-board.js +1 -1
- package/dist/src/utils/api/sentio/reward-generated.js +1 -1
- package/dist/src/utils/api/sentio/vault-history.d.ts +1 -1
- package/dist/src/utils/api/sentio/vault-history.js +5 -5
- package/dist/src/utils/tools.js +21 -9
- package/dist/src/utils/typusConfig.d.ts +1 -64
- package/package.json +2 -3
|
@@ -20,22 +20,9 @@ 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");
|
|
23
24
|
function getTokenNewStrategyTx(config, tx, input) {
|
|
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
|
-
}
|
|
25
|
+
var typusTokenRegistry = (0, token_user_entry_1.getTokenRegistry)(config, input.typusTokenType);
|
|
39
26
|
var tToken = tx.moveCall({
|
|
40
27
|
target: "".concat(input.typusTokenType.split("::")[0], "::").concat(input.typusTokenType.split("::")[1], "::mint"),
|
|
41
28
|
arguments: [
|
|
@@ -62,21 +49,7 @@ function getTokenNewStrategyTx(config, tx, input) {
|
|
|
62
49
|
return tx;
|
|
63
50
|
}
|
|
64
51
|
function getTokenUpdateStrategyTx(config, tx, input) {
|
|
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
|
-
}
|
|
52
|
+
var typusTokenRegistry = (0, token_user_entry_1.getTokenRegistry)(config, input.typusTokenType);
|
|
80
53
|
var _a = __read(tx.moveCall({
|
|
81
54
|
target: "".concat(input.typusTokenType.split("::")[0], "::").concat(input.typusTokenType.split("::")[1], "::mint"),
|
|
82
55
|
arguments: [
|
|
@@ -104,21 +77,7 @@ function getTokenUpdateStrategyTx(config, tx, input) {
|
|
|
104
77
|
return tx;
|
|
105
78
|
}
|
|
106
79
|
function getTokenCloseStrategyTx(config, tx, input) {
|
|
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
|
-
}
|
|
80
|
+
var typusTokenRegistry = (0, token_user_entry_1.getTokenRegistry)(config, input.typusTokenType);
|
|
122
81
|
var _a = __read(tx.moveCall({
|
|
123
82
|
target: "".concat(config.package.dovSingle, "::auto_bid::close_strategy"),
|
|
124
83
|
typeArguments: input.typeArguments,
|
|
@@ -153,21 +112,7 @@ function getTokenCloseStrategyTx(config, tx, input) {
|
|
|
153
112
|
return tx;
|
|
154
113
|
}
|
|
155
114
|
function getTokenWithdrawProfitStrategyTx(config, tx, input) {
|
|
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
|
-
}
|
|
115
|
+
var typusTokenRegistry = (0, token_user_entry_1.getTokenRegistry)(config, input.typusTokenType);
|
|
171
116
|
var d_token = tx.moveCall({
|
|
172
117
|
target: "".concat(config.package.dovSingle, "::auto_bid::withdraw_profit"),
|
|
173
118
|
typeArguments: input.typeArguments,
|
|
@@ -1,63 +1,28 @@
|
|
|
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): TOKEN;
|
|
3
|
+
export declare function assetToDecimal(asset: TOKEN): number | undefined;
|
|
4
4
|
export declare const tokenType: {
|
|
5
|
-
SUI: string;
|
|
6
5
|
MAINNET: {
|
|
7
|
-
|
|
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;
|
|
6
|
+
[key in TOKEN]: string;
|
|
34
7
|
};
|
|
35
8
|
TESTNET: {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
USDC: string;
|
|
55
|
-
BLUB: string;
|
|
56
|
-
MBLUB: string;
|
|
57
|
-
TYPUS: string;
|
|
9
|
+
[key in TOKEN]: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export type TOKEN = "SUI" | "CETUS" | "TURBOS" | "NAVX" | "SCA" | "DEEP" | "BLUE" | "TYPUS" | "FUD" | "BLUB" | "LIQ" | "HIPPO" | "MFUD" | "MBLUB" | "MLIQ" | "BUCK" | "USDY" | "AUSD" | "USDC" | "wSOL" | "wAPT" | "wBTC" | "wETH" | "wUSDC" | "wUSDT" | "sbETH" | "sbUSDT" | "VSUI" | "HASUI" | "AFSUI" | "SPSUI" | "INJ" | "JUP" | "SEI" | "sSCA" | "TEXP";
|
|
13
|
+
export declare const oracle: {
|
|
14
|
+
MAINNET: {
|
|
15
|
+
[key in TOKEN]?: string;
|
|
16
|
+
};
|
|
17
|
+
TESTNET: {
|
|
18
|
+
[key in TOKEN]?: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare const tokenRegistry: {
|
|
22
|
+
MAINNET: {
|
|
23
|
+
[key in TOKEN]?: string;
|
|
24
|
+
};
|
|
25
|
+
TESTNET: {
|
|
26
|
+
[key in TOKEN]?: string;
|
|
58
27
|
};
|
|
59
28
|
};
|
|
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,39 +1,9 @@
|
|
|
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
|
-
};
|
|
29
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.tokenType = void 0;
|
|
3
|
+
exports.tokenRegistry = exports.oracle = exports.tokenType = void 0;
|
|
31
4
|
exports.typeArgsToAssets = typeArgsToAssets;
|
|
32
5
|
exports.typeArgToAsset = typeArgToAsset;
|
|
33
6
|
exports.assetToDecimal = assetToDecimal;
|
|
34
|
-
exports.typeArgToToken = typeArgToToken;
|
|
35
|
-
exports.tokenTypeToAsset = tokenTypeToAsset;
|
|
36
|
-
exports.assetToTokenType = assetToTokenType;
|
|
37
7
|
var utils_1 = require("@mysten/sui/utils");
|
|
38
8
|
function typeArgsToAssets(typeArgs) {
|
|
39
9
|
var assets = typeArgs.map(function (x) { return typeArgToAsset(x); });
|
|
@@ -41,66 +11,150 @@ function typeArgsToAssets(typeArgs) {
|
|
|
41
11
|
}
|
|
42
12
|
function typeArgToAsset(typeArg) {
|
|
43
13
|
var typeArgs = typeArg.split("::");
|
|
44
|
-
switch ((0, utils_1.normalizeSuiAddress)(typeArgs[0])) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
case "
|
|
48
|
-
return "
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
case "
|
|
52
|
-
return "
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
case "
|
|
56
|
-
return "USDT";
|
|
57
|
-
case "0x5d1f47ea69bb0de31c313d7acf89b890dbb8991ea8e03c6c355171f84bb1ba4a":
|
|
14
|
+
switch ("".concat((0, utils_1.normalizeSuiAddress)(typeArgs[0]), "::").concat(typeArgs[1], "::").concat(typeArgs[2])) {
|
|
15
|
+
// native
|
|
16
|
+
// SUI
|
|
17
|
+
case "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI":
|
|
18
|
+
return "SUI";
|
|
19
|
+
// CETUS
|
|
20
|
+
case "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS": // MAINNET
|
|
21
|
+
case "0xb69a412ba4b22137088183da5e5042d37ba17580897884f00f959d4135d3e1a7::cetus::CETUS": // TESTNET
|
|
22
|
+
return "CETUS";
|
|
23
|
+
// TURBOS
|
|
24
|
+
case "0x5d1f47ea69bb0de31c313d7acf89b890dbb8991ea8e03c6c355171f84bb1ba4a::turbos::TURBOS": // MAINNET
|
|
25
|
+
case "0xebc68999f399a5ba121f8e59c0940eaa0e074e30454403357b93b25af9f30117::turbos::TURBOS": // TESTNET
|
|
58
26
|
return "TURBOS";
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
case "
|
|
64
|
-
|
|
65
|
-
case "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6":
|
|
27
|
+
// NAVX
|
|
28
|
+
case "0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX":
|
|
29
|
+
return "NAVX";
|
|
30
|
+
// SCA
|
|
31
|
+
case "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA":
|
|
32
|
+
case "0xd33ea459d9e667c112f5168464a885a654d7bc3fd6903720aaa8cf495a32a77e::sca::SCA":
|
|
66
33
|
return "SCA";
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
|
48
|
+
return "FUD";
|
|
49
|
+
// MFUD
|
|
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":
|
|
70
69
|
return "HIPPO";
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
case "
|
|
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":
|
|
129
|
+
return "AFSUI";
|
|
130
|
+
// SPSUI
|
|
131
|
+
case "0x83556891f4a0f233ce7b05cfe7f957d4020492a34f5405b2cb9377d060bef4bf::spring_sui::SPRING_SUI":
|
|
132
|
+
return "SPSUI";
|
|
133
|
+
// INJ
|
|
134
|
+
case "0xcac46c81bbe1e516c65f4c3e5da81e7092cc2e70218deafb31f1c8d5fcc9dae3::inj::INJ": // MAINNET
|
|
135
|
+
case "0xfd3d56e007e3ae44d74b6a6840de0bd04a3724360abd89ae683ca7d592bbb49e::inj::INJ": // TESTNET
|
|
136
|
+
return "INJ";
|
|
137
|
+
// JUP
|
|
138
|
+
case "0x3dc8710253682b53706bd110d51fd9b298d5bb923b535fb7bca88e049208c508::jup::JUP": // MAINNET
|
|
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":
|
|
74
146
|
return "sSCA";
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
}
|
|
147
|
+
// TEXP
|
|
148
|
+
case "0x37816d28c34cc0df82655ca97b3f066112a5f3c202cbb4aaa76c8af54e779750::tails_exp::TAILS_EXP":
|
|
149
|
+
return "TEXP";
|
|
87
150
|
default:
|
|
88
|
-
|
|
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];
|
|
151
|
+
throw new Error("Unknown typeArg: ".concat(typeArg));
|
|
98
152
|
}
|
|
99
153
|
}
|
|
100
154
|
function assetToDecimal(asset) {
|
|
101
155
|
switch (asset) {
|
|
102
156
|
case "SUI":
|
|
103
|
-
case "
|
|
157
|
+
case "SPSUI":
|
|
104
158
|
case "CETUS":
|
|
105
159
|
case "TURBOS":
|
|
106
160
|
case "BUCK":
|
|
@@ -114,20 +168,19 @@ function assetToDecimal(asset) {
|
|
|
114
168
|
case "BLUE":
|
|
115
169
|
case "sSCA":
|
|
116
170
|
return 9;
|
|
117
|
-
case "
|
|
118
|
-
case "
|
|
119
|
-
case "
|
|
120
|
-
case "
|
|
121
|
-
case "
|
|
122
|
-
case "WSOL":
|
|
123
|
-
case "APT":
|
|
171
|
+
case "wBTC":
|
|
172
|
+
case "sbETH":
|
|
173
|
+
case "wETH":
|
|
174
|
+
case "wSOL":
|
|
175
|
+
case "wAPT":
|
|
124
176
|
case "INJ":
|
|
125
177
|
case "SEI":
|
|
126
178
|
case "JUP":
|
|
127
179
|
return 8;
|
|
128
180
|
case "USDC":
|
|
129
181
|
case "wUSDC":
|
|
130
|
-
case "
|
|
182
|
+
case "wUSDT":
|
|
183
|
+
case "sbUSDT":
|
|
131
184
|
case "USDY":
|
|
132
185
|
case "AUSD":
|
|
133
186
|
case "DEEP":
|
|
@@ -143,18 +196,17 @@ function assetToDecimal(asset) {
|
|
|
143
196
|
}
|
|
144
197
|
}
|
|
145
198
|
exports.tokenType = {
|
|
146
|
-
SUI: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
|
|
147
199
|
MAINNET: {
|
|
148
200
|
SUI: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
|
|
149
|
-
|
|
150
|
-
|
|
201
|
+
wBTC: "0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN",
|
|
202
|
+
wETH: "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN",
|
|
151
203
|
wUSDC: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN",
|
|
152
|
-
|
|
204
|
+
wUSDT: "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN",
|
|
205
|
+
wSOL: "0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8::coin::COIN",
|
|
206
|
+
wAPT: "0x3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37::coin::COIN",
|
|
153
207
|
CETUS: "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS",
|
|
154
208
|
BUCK: "0xce7ff77a83ea0cb6fd39bd8748e2ec89a3f41e8efdc3f4eb123e0ca37b184db2::buck::BUCK",
|
|
155
|
-
SOL: "0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8::coin::COIN",
|
|
156
209
|
TURBOS: "0x5d1f47ea69bb0de31c313d7acf89b890dbb8991ea8e03c6c355171f84bb1ba4a::turbos::TURBOS",
|
|
157
|
-
APT: "0x3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37::coin::COIN",
|
|
158
210
|
FUD: "0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1::fud::FUD",
|
|
159
211
|
MFUD: "0xd8f04cd2a16c19c17428c3b4c22b01dd06740423b93fb7ee88fbe2676a82849d::mfud::MFUD",
|
|
160
212
|
INJ: "0xcac46c81bbe1e516c65f4c3e5da81e7092cc2e70218deafb31f1c8d5fcc9dae3::inj::INJ",
|
|
@@ -172,92 +224,99 @@ exports.tokenType = {
|
|
|
172
224
|
MLIQ: "9614657c9d7e8799be4f49781ef1a9247b83ee178976df6c92d29b6026b9dadf::mliq::MLIQ",
|
|
173
225
|
BLUE: "0xe1b45a0e641b9955a20aa0ad1c1f4ad86aad8afb07296d4085e349a50e90bdca::blue::BLUE",
|
|
174
226
|
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",
|
|
175
236
|
},
|
|
176
237
|
TESTNET: {
|
|
177
238
|
SUI: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
|
|
178
239
|
CETUS: "0xb69a412ba4b22137088183da5e5042d37ba17580897884f00f959d4135d3e1a7::cetus::CETUS",
|
|
179
240
|
BUCK: "0x879cd4804fe865897090e26eceb9f7a7cfda7dda1b2529a81631fa567e67375c::buck::BUCK",
|
|
180
|
-
|
|
241
|
+
wSOL: "0x879cd4804fe865897090e26eceb9f7a7cfda7dda1b2529a81631fa567e67375c::sol::SOL",
|
|
181
242
|
TURBOS: "0xebc68999f399a5ba121f8e59c0940eaa0e074e30454403357b93b25af9f30117::turbos::TURBOS",
|
|
182
|
-
|
|
243
|
+
wAPT: "0xdede697a5748d20ebff2aabf3f2fd5bd9e41afb1a624b636cddc6df69078bd22::apt::APT",
|
|
183
244
|
FUD: "0x461efa7ee5aa1b27e44450d79e2104e7fc0991461e9eb1c2a3fc1f44cd554856::fud::FUD",
|
|
184
245
|
MFUD: "0x7755ff79f0f27256c73e6c197e25b407ef6d4b9bd6e1af8cdd50fef28f84712c::mfud::MFUD",
|
|
185
|
-
|
|
246
|
+
wUSDT: "0xa38dad920880f81ea514de6db007d3a84e9116a29c60b3e69bbe418c2d9f553c::usdt::USDT",
|
|
186
247
|
AFSUI: "0xd31923b6821fb7ba32d23e514b43d307da6ef991f9ef1af2cc4e26a0992ac87a::afsui::AFSUI",
|
|
187
248
|
INJ: "0xfd3d56e007e3ae44d74b6a6840de0bd04a3724360abd89ae683ca7d592bbb49e::inj::INJ",
|
|
188
249
|
SEI: "0xfd3d56e007e3ae44d74b6a6840de0bd04a3724360abd89ae683ca7d592bbb49e::sei::SEI",
|
|
189
250
|
USDY: "0x579809c614d4388ed821c9f304bb741715cdf4a718707eb7c6fcf7b7189870ef::usdy::USDY",
|
|
190
251
|
TEXP: "0x9b43ee208a3b235810c145bca1161d1a71d08bfe76b1e55bb3db319ea95d0149::tails_exp::TAILS_EXP",
|
|
191
252
|
SCA: "0xd33ea459d9e667c112f5168464a885a654d7bc3fd6903720aaa8cf495a32a77e::sca::SCA",
|
|
192
|
-
|
|
193
|
-
|
|
253
|
+
wBTC: "0x949572061c09bbedef3ac4ffc42e58632291616f0605117cec86d840e09bf519::btc::BTC",
|
|
254
|
+
wETH: "0x949572061c09bbedef3ac4ffc42e58632291616f0605117cec86d840e09bf519::eth::ETH",
|
|
194
255
|
wUSDC: "0x949572061c09bbedef3ac4ffc42e58632291616f0605117cec86d840e09bf519::usdc::USDC",
|
|
195
256
|
USDC: "0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC",
|
|
196
257
|
BLUB: "0x94b8f6dcceeb2be160f6837089cc7502458f4f070fa0814380737acb0c41fd5b::blub::BLUB",
|
|
197
258
|
MBLUB: "0x4b5d0a097ee8a309a89bb2bc589403a4a9a39de639d576495b697be2a60f69bb::mblub::MBLUB",
|
|
198
259
|
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",
|
|
199
321
|
},
|
|
200
322
|
};
|
|
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,5 +1,6 @@
|
|
|
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";
|
|
3
4
|
export { getNewBidFromSentio, getExerciseFromSentio } from "../../../src/utils/api/sentio/events";
|
|
4
5
|
export declare function getUserEvents(provider: SuiClient, sender: string, cursor?: EventId | null): Promise<[SuiEvent[], EventId | null | undefined]>;
|
|
5
6
|
export declare function getAutoBidEvents(provider: SuiClient, originPackage: string, startTimeMs: number): Promise<SuiEvent[]>;
|
|
@@ -20,7 +21,7 @@ export declare function parseTxHistory(datas: Array<any>, vaults: {
|
|
|
20
21
|
}): Promise<Array<TxHistory>>;
|
|
21
22
|
export declare function parseVaultInfo(vaults: {
|
|
22
23
|
[key: string]: Vault;
|
|
23
|
-
}, Index: string, action: string):
|
|
24
|
+
}, Index: string, action: string): [string | undefined, string | undefined, string | undefined, TOKEN | undefined, TOKEN | undefined, TOKEN | undefined];
|
|
24
25
|
export declare function getDepositorCashFlows(userHistory: TxHistory[]): Map<string, DepositorCashFlow>;
|
|
25
26
|
export interface DepositorCashFlow {
|
|
26
27
|
D_TOKEN: string | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
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;
|
|
3
4
|
export declare function getTokenRaiseFundTx(config: TypusConfig, tx: Transaction, input: {
|
|
4
5
|
typeArguments: string[];
|
|
5
6
|
typusTokenType: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTokenRegistry = getTokenRegistry;
|
|
3
4
|
exports.getTokenRaiseFundTx = getTokenRaiseFundTx;
|
|
4
5
|
exports.getTokenReduceFundTx = getTokenReduceFundTx;
|
|
5
6
|
exports.getTokenNewBidTx = getTokenNewBidTx;
|
|
@@ -7,22 +8,26 @@ exports.getTokenExerciseTx = getTokenExerciseTx;
|
|
|
7
8
|
exports.getTokenRebateTx = getTokenRebateTx;
|
|
8
9
|
exports.getTokenCompoundWithRedeemTx = getTokenCompoundWithRedeemTx;
|
|
9
10
|
var constants_1 = require("../../src/constants");
|
|
10
|
-
function
|
|
11
|
+
function getTokenRegistry(config, typusTokenType) {
|
|
11
12
|
var typusTokenRegistry = "";
|
|
12
|
-
switch (
|
|
13
|
+
switch (typusTokenType.split("::")[1]) {
|
|
13
14
|
case "mfud":
|
|
14
|
-
typusTokenRegistry = config.
|
|
15
|
+
typusTokenRegistry = constants_1.tokenRegistry[config.network].MFUD;
|
|
15
16
|
break;
|
|
16
17
|
case "mblub":
|
|
17
|
-
typusTokenRegistry = config.
|
|
18
|
+
typusTokenRegistry = constants_1.tokenRegistry[config.network].MBLUB;
|
|
18
19
|
break;
|
|
19
20
|
case "mliq":
|
|
20
|
-
typusTokenRegistry = config.
|
|
21
|
+
typusTokenRegistry = constants_1.tokenRegistry[config.network].MLIQ;
|
|
21
22
|
break;
|
|
22
23
|
default:
|
|
23
24
|
console.log("No such token exists!");
|
|
24
25
|
break;
|
|
25
26
|
}
|
|
27
|
+
return typusTokenRegistry;
|
|
28
|
+
}
|
|
29
|
+
function getTokenRaiseFundTx(config, tx, input) {
|
|
30
|
+
var typusTokenRegistry = getTokenRegistry(config, input.typusTokenType);
|
|
26
31
|
var typusTokenBalance = input.raiseCoins.length > 0
|
|
27
32
|
? tx.moveCall({
|
|
28
33
|
target: "0x2::coin::into_balance",
|
|
@@ -66,21 +71,7 @@ function getTokenRaiseFundTx(config, tx, input) {
|
|
|
66
71
|
return tx;
|
|
67
72
|
}
|
|
68
73
|
function getTokenReduceFundTx(config, tx, input) {
|
|
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
|
-
}
|
|
74
|
+
var typusTokenRegistry = getTokenRegistry(config, input.typusTokenType);
|
|
84
75
|
var result = tx.moveCall({
|
|
85
76
|
target: "".concat(config.package.dovSingle, "::tds_user_entry::public_reduce_fund"),
|
|
86
77
|
typeArguments: input.typeArguments,
|
|
@@ -166,21 +157,7 @@ function getTokenReduceFundTx(config, tx, input) {
|
|
|
166
157
|
return tx;
|
|
167
158
|
}
|
|
168
159
|
function getTokenNewBidTx(config, tx, input) {
|
|
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
|
-
}
|
|
160
|
+
var typusTokenRegistry = getTokenRegistry(config, input.typusTokenType);
|
|
184
161
|
var mToken = tx.moveCall({
|
|
185
162
|
target: "".concat(input.typusTokenType.split("::")[0], "::").concat(input.typusTokenType.split("::")[1], "::mint"),
|
|
186
163
|
arguments: [
|
|
@@ -213,21 +190,7 @@ function getTokenNewBidTx(config, tx, input) {
|
|
|
213
190
|
return tx;
|
|
214
191
|
}
|
|
215
192
|
function getTokenExerciseTx(config, tx, input) {
|
|
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
|
-
}
|
|
193
|
+
var typusTokenRegistry = getTokenRegistry(config, input.typusTokenType);
|
|
231
194
|
var result = tx.moveCall({
|
|
232
195
|
target: "".concat(config.package.dovSingle, "::tds_user_entry::exercise"),
|
|
233
196
|
typeArguments: input.typeArguments,
|
|
@@ -253,21 +216,7 @@ function getTokenExerciseTx(config, tx, input) {
|
|
|
253
216
|
return tx;
|
|
254
217
|
}
|
|
255
218
|
function getTokenRebateTx(config, tx, input) {
|
|
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
|
-
}
|
|
219
|
+
var typusTokenRegistry = getTokenRegistry(config, input.typusTokenType);
|
|
271
220
|
var result = tx.moveCall({
|
|
272
221
|
target: "".concat(config.package.dovSingle, "::tds_user_entry::rebate"),
|
|
273
222
|
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.SUI, [], input.feeAmount)),
|
|
82
|
+
tx.object((0, utils_1.splitCoins)(tx, constants_1.tokenType.MAINNET.SUI, [], input.feeAmount)),
|
|
83
83
|
tx.object(constants_1.CLOCK),
|
|
84
84
|
],
|
|
85
85
|
});
|
|
@@ -59,7 +59,7 @@ exports.getExerciseFromSentio = getExerciseFromSentio;
|
|
|
59
59
|
var typus_dov_single_v2_1 = require("../../../../src/typus-dov-single-v2");
|
|
60
60
|
var constants_1 = require("../../../../src/constants");
|
|
61
61
|
var headers = {
|
|
62
|
-
"api-key": "
|
|
62
|
+
"api-key": "RIobs1PpAZ4SmHxY2InErtz0pL5LqHTtY",
|
|
63
63
|
"Content-Type": "application/json",
|
|
64
64
|
};
|
|
65
65
|
function getFromSentio(event, userAddress, startTimestamp) {
|
|
@@ -50,7 +50,7 @@ function getExpLeaderBoardWithOwner(expLeaderBoard, ownerMap) {
|
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
var headers = {
|
|
53
|
-
"api-key": "
|
|
53
|
+
"api-key": "RIobs1PpAZ4SmHxY2InErtz0pL5LqHTtY",
|
|
54
54
|
"Content-Type": "application/json",
|
|
55
55
|
};
|
|
56
56
|
function getExpLeaderBoard(startTimestamp, endTimestamp) {
|
|
@@ -55,7 +55,7 @@ exports.getAccumulatedUser = getAccumulatedUser;
|
|
|
55
55
|
exports.getAccumulatedNotionalVolumeUSD = getAccumulatedNotionalVolumeUSD;
|
|
56
56
|
exports.getSafuAccumulatedRewardGeneratedUSD = getSafuAccumulatedRewardGeneratedUSD;
|
|
57
57
|
var headers = {
|
|
58
|
-
"api-key": "
|
|
58
|
+
"api-key": "RIobs1PpAZ4SmHxY2InErtz0pL5LqHTtY",
|
|
59
59
|
"Content-Type": "application/json",
|
|
60
60
|
};
|
|
61
61
|
function getTotalDepositorIncentive() {
|
|
@@ -10,7 +10,7 @@ interface VaultHistorySummary {
|
|
|
10
10
|
TotalOptionProfit: number;
|
|
11
11
|
TotalSell: string;
|
|
12
12
|
}
|
|
13
|
-
export declare function getVaultHistory(
|
|
13
|
+
export declare function getVaultHistory(indices: string[], limit?: number): Promise<VaultHistory[]>;
|
|
14
14
|
interface VaultHistory {
|
|
15
15
|
ActivationDate: string;
|
|
16
16
|
BidderPNL: string;
|
|
@@ -40,7 +40,7 @@ exports.getVaultHistorySummary = getVaultHistorySummary;
|
|
|
40
40
|
exports.getFilledSummary = getFilledSummary;
|
|
41
41
|
exports.getVaultHistory = getVaultHistory;
|
|
42
42
|
var headers = {
|
|
43
|
-
"api-key": "
|
|
43
|
+
"api-key": "RIobs1PpAZ4SmHxY2InErtz0pL5LqHTtY",
|
|
44
44
|
"Content-Type": "application/json",
|
|
45
45
|
};
|
|
46
46
|
function getVaultHistorySummary(startTimestamp) {
|
|
@@ -117,8 +117,8 @@ function getFilledSummary(startTimestamp) {
|
|
|
117
117
|
});
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
|
-
function getVaultHistory(
|
|
121
|
-
return __awaiter(this, arguments, void 0, function (
|
|
120
|
+
function getVaultHistory(indices_1) {
|
|
121
|
+
return __awaiter(this, arguments, void 0, function (indices, limit) {
|
|
122
122
|
var apiUrl, requestData, jsonData, response, data, result;
|
|
123
123
|
if (limit === void 0) { limit = 100; }
|
|
124
124
|
return __generator(this, function (_a) {
|
|
@@ -127,7 +127,7 @@ function getVaultHistory(index_1) {
|
|
|
127
127
|
apiUrl = "https://app.sentio.xyz/api/v1/analytics/typus/typus_v2/sql/execute";
|
|
128
128
|
requestData = {
|
|
129
129
|
sqlQuery: {
|
|
130
|
-
sql: "\n WITH hourly_price_table AS (\n SELECT\n symbol,\n toStartOfHour(time) AS hour,\n argMax(price, time) AS hourly_price -- Get the most recent price before or at the hour\n FROM\n token.prices\n GROUP BY\n symbol, hour\n ),\n safu_otc_aggregated AS (\n SELECT\n index,\n round,\n AVG(delivery_price) AS delivery_price,\n SUM(delivery_size) AS delivery_size,\n SUM(bidder_bid_value) AS bidder_bid_value\n FROM SafuOtc\n GROUP BY index, round\n )\n SELECT\n Settle.timestamp as timestamp,\n Settle.index as Index,\n Settle.round as Round,\n NewAuction.start_ts_ms as ActivationDate,\n COALESCE(NULLIF(UpdateStrike.strikes, ''), NewAuction.strikes) AS Strikes, -- \u5982\u679C UpdateStrike.strikes \u662F\u7A7A\u5B57\u7B26\u4E32\uFF0C\u5C31\u4F7F\u7528 NewAuction.strikes\n Settle.oracle_price as SettlePrice,\n -- Settle.share_price as share_price,\n -- Settle.settle_balance as SettleBalance,\n Activate.deposit_balance as DepositAmount,\n DepositAmount * Settle.price_d_token as DepositAmountUSD,\n Delivery.max_size as MaxSize,\n (safu_otc_aggregated.delivery_size + Delivery.delivery_size) as TotalSell,\n CASE WHEN MaxSize != 0 THEN TotalSell / MaxSize ELSE 0 END AS Filled,\n Delivery.delivery_size as DeliverySize,\n Delivery.delivery_price as DeliveryPrice,\n safu_otc_aggregated.delivery_size as OtcSize,\n safu_otc_aggregated.delivery_price as OtcPrice,\n Delivery.bidder_bid_value as BidderPremium,\n BidderPremium * Delivery.price_b_token as BidderPremiumUSD,\n Delivery.incentive_bid_value as IncentivePremium,\n safu_otc_aggregated.bidder_bid_value as OtcPremium,\n (Delivery.bidder_bid_value + Delivery.incentive_bid_value + safu_otc_aggregated.bidder_bid_value) AS Premium, -- Total Premium b_token\n Premium * Delivery.price_b_token AS PremiumUSD,\n Delivery.depositor_incentive_value as BpIncentive, -- SUI or SCA based on o_token\n BpIncentive * Delivery.price_o_token as BpIncentiveUSD,\n Delivery.fixed_incentive_amount as FixedIncentive, -- SUI\n FixedIncentive * hourly_price_table.hourly_price as FixedIncentiveUSD,\n (1 - Settle.share_price) as LossPecentage,\n (Settle.settle_balance - Settle.settled_balance) as OptionProfit, -- d_token\n OptionProfit * Settle.price_d_token as OptionProfitUSD,\n PremiumUSD + BpIncentiveUSD + FixedIncentiveUSD - OptionProfitUSD as DepositorPNL,\n -- CASE WHEN DepositAmountUSD != 0 THEN DepositorPNL / DepositAmountUSD ELSE 0 END AS DepositorROI,\n OptionProfitUSD - BidderPremiumUSD as BidderPNL,\n CASE WHEN BidderPremiumUSD != 0 THEN BidderPNL / BidderPremiumUSD ELSE 0 END AS BidderROI,\n Settle.d_token as d_token,\n Delivery.b_token as b_token,\n Delivery.o_token as o_token\n FROM Settle\n JOIN Activate ON Settle.index = Activate.index AND Settle.round = Activate.round\n JOIN NewAuction ON Settle.index = NewAuction.index AND Settle.round = NewAuction.round\n LEFT JOIN UpdateStrike ON Settle.index = UpdateStrike.index AND Settle.round = UpdateStrike.round\n JOIN Delivery ON Settle.index = Delivery.index AND Settle.round = Delivery.round\n LEFT JOIN safu_otc_aggregated ON Settle.index = safu_otc_aggregated.index AND Settle.round = safu_otc_aggregated.round\n -- LEFT JOIN hourly_price_table ON LOWER(Settle.d_token) = hourly_price_table.symbol AND toStartOfHour(Settle.timestamp) = hourly_price_table.hour\n LEFT JOIN hourly_price_table ON 'sui' = hourly_price_table.symbol AND toStartOfHour(Settle.timestamp) = hourly_price_table.hour\n WHERE Settle.index
|
|
130
|
+
sql: "\n WITH hourly_price_table AS (\n SELECT\n symbol,\n toStartOfHour(time) AS hour,\n argMax(price, time) AS hourly_price -- Get the most recent price before or at the hour\n FROM\n token.prices\n GROUP BY\n symbol, hour\n ),\n safu_otc_aggregated AS (\n SELECT\n index,\n round,\n AVG(delivery_price) AS delivery_price,\n SUM(delivery_size) AS delivery_size,\n SUM(bidder_bid_value) AS bidder_bid_value\n FROM SafuOtc\n GROUP BY index, round\n )\n SELECT\n Settle.timestamp as timestamp,\n Settle.index as Index,\n Settle.round as Round,\n NewAuction.start_ts_ms as ActivationDate,\n COALESCE(NULLIF(UpdateStrike.strikes, ''), NewAuction.strikes) AS Strikes, -- \u5982\u679C UpdateStrike.strikes \u662F\u7A7A\u5B57\u7B26\u4E32\uFF0C\u5C31\u4F7F\u7528 NewAuction.strikes\n Settle.oracle_price as SettlePrice,\n -- Settle.share_price as share_price,\n -- Settle.settle_balance as SettleBalance,\n Activate.deposit_balance as DepositAmount,\n DepositAmount * Settle.price_d_token as DepositAmountUSD,\n Delivery.max_size as MaxSize,\n (safu_otc_aggregated.delivery_size + Delivery.delivery_size) as TotalSell,\n CASE WHEN MaxSize != 0 THEN TotalSell / MaxSize ELSE 0 END AS Filled,\n Delivery.delivery_size as DeliverySize,\n Delivery.delivery_price as DeliveryPrice,\n safu_otc_aggregated.delivery_size as OtcSize,\n safu_otc_aggregated.delivery_price as OtcPrice,\n Delivery.bidder_bid_value as BidderPremium,\n BidderPremium * Delivery.price_b_token as BidderPremiumUSD,\n Delivery.incentive_bid_value as IncentivePremium,\n safu_otc_aggregated.bidder_bid_value as OtcPremium,\n (Delivery.bidder_bid_value + Delivery.incentive_bid_value + safu_otc_aggregated.bidder_bid_value) AS Premium, -- Total Premium b_token\n Premium * Delivery.price_b_token AS PremiumUSD,\n Delivery.depositor_incentive_value as BpIncentive, -- SUI or SCA based on o_token\n BpIncentive * Delivery.price_o_token as BpIncentiveUSD,\n Delivery.fixed_incentive_amount as FixedIncentive, -- SUI\n FixedIncentive * hourly_price_table.hourly_price as FixedIncentiveUSD,\n (1 - Settle.share_price) as LossPecentage,\n (Settle.settle_balance - Settle.settled_balance) as OptionProfit, -- d_token\n OptionProfit * Settle.price_d_token as OptionProfitUSD,\n PremiumUSD + BpIncentiveUSD + FixedIncentiveUSD - OptionProfitUSD as DepositorPNL,\n -- CASE WHEN DepositAmountUSD != 0 THEN DepositorPNL / DepositAmountUSD ELSE 0 END AS DepositorROI,\n OptionProfitUSD - BidderPremiumUSD as BidderPNL,\n CASE WHEN BidderPremiumUSD != 0 THEN BidderPNL / BidderPremiumUSD ELSE 0 END AS BidderROI,\n Settle.d_token as d_token,\n Delivery.b_token as b_token,\n Delivery.o_token as o_token\n FROM Settle\n JOIN Activate ON Settle.index = Activate.index AND Settle.round = Activate.round\n JOIN NewAuction ON Settle.index = NewAuction.index AND Settle.round = NewAuction.round\n LEFT JOIN UpdateStrike ON Settle.index = UpdateStrike.index AND Settle.round = UpdateStrike.round\n JOIN Delivery ON Settle.index = Delivery.index AND Settle.round = Delivery.round\n LEFT JOIN safu_otc_aggregated ON Settle.index = safu_otc_aggregated.index AND Settle.round = safu_otc_aggregated.round\n -- LEFT JOIN hourly_price_table ON LOWER(Settle.d_token) = hourly_price_table.symbol AND toStartOfHour(Settle.timestamp) = hourly_price_table.hour\n LEFT JOIN hourly_price_table ON 'sui' = hourly_price_table.symbol AND toStartOfHour(Settle.timestamp) = hourly_price_table.hour\n WHERE Settle.index IN (".concat(indices.join(","), ")\n ORDER BY ActivationDate DESC;\n "),
|
|
131
131
|
size: limit,
|
|
132
132
|
},
|
|
133
133
|
};
|
|
@@ -153,4 +153,4 @@ function getVaultHistory(index_1) {
|
|
|
153
153
|
// console.log(quarterly_timestamp);
|
|
154
154
|
// getVaultHistorySummary();
|
|
155
155
|
// getFilledSummary(quarterly_timestamp);
|
|
156
|
-
// getVaultHistory("78",
|
|
156
|
+
// getVaultHistory(["78", "79"], 2);
|
package/dist/src/utils/tools.js
CHANGED
|
@@ -69,14 +69,26 @@ var countFloating = function (value) {
|
|
|
69
69
|
};
|
|
70
70
|
exports.countFloating = countFloating;
|
|
71
71
|
function splitCoins(tx, token, coins, amount) {
|
|
72
|
-
var _a
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
})
|
|
72
|
+
var _a, _b;
|
|
73
|
+
var coin;
|
|
74
|
+
if (coins.length == 0) {
|
|
75
|
+
// support zero coin input for closing position
|
|
76
|
+
_a = __read(tx.moveCall({
|
|
77
|
+
target: "0x2::coin::zero",
|
|
78
|
+
typeArguments: [token],
|
|
79
|
+
arguments: [],
|
|
80
|
+
}), 1), coin = _a[0];
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
_b = __read((0, utils_1.normalizeStructTag)(token) == constants_1.tokenType.MAINNET.SUI
|
|
84
|
+
? tx.splitCoins(tx.gas, [tx.pure.u64(amount)])
|
|
85
|
+
: (function () {
|
|
86
|
+
var coin = coins.pop();
|
|
87
|
+
if (coins.length > 0) {
|
|
88
|
+
tx.mergeCoins(tx.object(coin), coins.map(function (id) { return tx.object(id); }));
|
|
89
|
+
}
|
|
90
|
+
return tx.splitCoins(tx.object(coin), [tx.pure.u64(amount)]);
|
|
91
|
+
})(), 1), coin = _b[0];
|
|
92
|
+
}
|
|
81
93
|
return coin;
|
|
82
94
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
export declare class TypusConfig {
|
|
2
|
+
network: "MAINNET" | "TESTNET";
|
|
2
3
|
rpcEndpoint: string;
|
|
3
4
|
packageOrigin: Package;
|
|
4
5
|
package: Package;
|
|
5
6
|
version: Version;
|
|
6
7
|
registry: Registry;
|
|
7
8
|
object: Object;
|
|
8
|
-
oracle: Oracle;
|
|
9
|
-
token: Token;
|
|
10
9
|
static parse(json: any): TypusConfig;
|
|
11
10
|
static local(path: any): TypusConfig;
|
|
12
11
|
static default(network: "MAINNET" | "TESTNET", customRpcEndpoint: string | null, branch?: string): Promise<TypusConfig>;
|
|
@@ -67,13 +66,6 @@ export interface Registry {
|
|
|
67
66
|
safu: {
|
|
68
67
|
safu: string;
|
|
69
68
|
};
|
|
70
|
-
token: {
|
|
71
|
-
inj: string;
|
|
72
|
-
mfud: string;
|
|
73
|
-
sei: string;
|
|
74
|
-
mblub: string;
|
|
75
|
-
mliq: string;
|
|
76
|
-
};
|
|
77
69
|
typus: {
|
|
78
70
|
airdrop: string;
|
|
79
71
|
leaderboard: string;
|
|
@@ -97,58 +89,3 @@ export interface Object {
|
|
|
97
89
|
launchAuction: string;
|
|
98
90
|
launchSnapshot: string;
|
|
99
91
|
}
|
|
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.4-tk",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@mysten/bcs": "^0.11.1",
|
|
8
8
|
"@mysten/kiosk": "0.9.34",
|
|
@@ -15,8 +15,7 @@
|
|
|
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"
|
|
19
|
-
"slack": "^11.0.2"
|
|
18
|
+
"moment": "^2.30.1"
|
|
20
19
|
},
|
|
21
20
|
"devDependencies": {
|
|
22
21
|
"@types/bs58": "^4.0.1",
|