@typus/typus-sdk 1.5.5-b → 1.5.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/constants/token.d.ts +56 -5
- package/dist/src/constants/token.js +162 -173
- package/dist/src/typus-dov-single-v2/history/user-history.d.ts +1 -2
- package/dist/src/typus-launch/airdrop/authority-entry.js +3 -29
- package/dist/src/utils/load_env.js +1 -2
- package/dist/src/utils/tools.d.ts +5 -0
- package/dist/src/utils/tools.js +31 -0
- package/package.json +3 -2
|
@@ -1,12 +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
|
-
|
|
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;
|
|
10
58
|
};
|
|
11
59
|
};
|
|
12
|
-
export type TOKEN = "SUI" | "CETUS" | "
|
|
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
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,149 +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
|
-
return "AUSD";
|
|
82
|
-
// USDC
|
|
83
|
-
case "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC":
|
|
84
|
-
case "0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC":
|
|
85
|
-
return "USDC";
|
|
86
|
-
// wormhole bridge
|
|
87
|
-
// wBTC
|
|
88
|
-
case "0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN": // MAINNET
|
|
89
|
-
case "0x949572061c09bbedef3ac4ffc42e58632291616f0605117cec86d840e09bf519::btc::BTC": // TESTNET
|
|
90
|
-
return "wBTC";
|
|
91
|
-
// wETH
|
|
92
|
-
case "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN": // MAINNET
|
|
93
|
-
case "0x949572061c09bbedef3ac4ffc42e58632291616f0605117cec86d840e09bf519::eth::ETH": // TESTNET
|
|
94
|
-
return "wETH";
|
|
95
|
-
// wUSDC
|
|
96
|
-
case "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN": // MAINNET
|
|
97
|
-
case "0x949572061c09bbedef3ac4ffc42e58632291616f0605117cec86d840e09bf519::usdc::USDC": // TESTNET
|
|
98
|
-
return "wUSDC";
|
|
99
|
-
// wUSDT
|
|
100
|
-
case "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN": // MAINNET
|
|
101
|
-
case "0xa38dad920880f81ea514de6db007d3a84e9116a29c60b3e69bbe418c2d9f553c::usdt::USDT": // TESTNET
|
|
102
|
-
return "wUSDT";
|
|
103
|
-
// wSOL
|
|
104
|
-
case "0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8::coin::COIN": // MAINNET
|
|
105
|
-
case "0x879cd4804fe865897090e26eceb9f7a7cfda7dda1b2529a81631fa567e67375c::sol::SOL": // TESTNET
|
|
106
|
-
return "wSOL";
|
|
107
|
-
// wAPT
|
|
108
|
-
case "0x3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37::coin::COIN": // MAINNET
|
|
109
|
-
case "0xdede697a5748d20ebff2aabf3f2fd5bd9e41afb1a624b636cddc6df69078bd22::apt::APT": // TESTNET
|
|
110
|
-
return "wAPT";
|
|
111
|
-
// native bridge
|
|
112
|
-
// sbETH
|
|
113
|
-
case "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH":
|
|
114
|
-
return "sbETH";
|
|
115
|
-
// sbUSDT
|
|
116
|
-
case "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT":
|
|
117
|
-
return "sbUSDT";
|
|
118
|
-
// LST
|
|
119
|
-
// VSUI
|
|
120
|
-
case "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT":
|
|
121
|
-
return "VSUI";
|
|
122
|
-
// HASUI
|
|
123
|
-
case "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI":
|
|
124
|
-
return "HASUI";
|
|
125
|
-
// AFSUI
|
|
126
|
-
case "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI":
|
|
127
|
-
case "0xd31923b6821fb7ba32d23e514b43d307da6ef991f9ef1af2cc4e26a0992ac87a::afsui::AFSUI":
|
|
63
|
+
case "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc":
|
|
128
64
|
return "AFSUI";
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
case "
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
case "
|
|
138
|
-
return "JUP";
|
|
139
|
-
// SEI
|
|
140
|
-
case "0xcac46c81bbe1e516c65f4c3e5da81e7092cc2e70218deafb31f1c8d5fcc9dae3::sei::SEI": // MAINNET
|
|
141
|
-
case "0xfd3d56e007e3ae44d74b6a6840de0bd04a3724360abd89ae683ca7d592bbb49e::sei::SEI": // TESTNET
|
|
142
|
-
return "SEI";
|
|
143
|
-
// sSCA
|
|
144
|
-
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":
|
|
145
74
|
return "sSCA";
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
+
}
|
|
149
87
|
default:
|
|
150
|
-
|
|
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];
|
|
151
98
|
}
|
|
152
99
|
}
|
|
153
100
|
function assetToDecimal(asset) {
|
|
154
101
|
switch (asset) {
|
|
155
102
|
case "SUI":
|
|
156
|
-
case "
|
|
103
|
+
case "sSUI":
|
|
157
104
|
case "CETUS":
|
|
158
105
|
case "TURBOS":
|
|
159
106
|
case "BUCK":
|
|
@@ -167,19 +114,20 @@ function assetToDecimal(asset) {
|
|
|
167
114
|
case "BLUE":
|
|
168
115
|
case "sSCA":
|
|
169
116
|
return 9;
|
|
170
|
-
case "
|
|
171
|
-
case "
|
|
172
|
-
case "
|
|
173
|
-
case "
|
|
174
|
-
case "
|
|
117
|
+
case "BTC":
|
|
118
|
+
case "WBTC":
|
|
119
|
+
case "ETH":
|
|
120
|
+
case "WETH":
|
|
121
|
+
case "SOL":
|
|
122
|
+
case "WSOL":
|
|
123
|
+
case "APT":
|
|
175
124
|
case "INJ":
|
|
176
125
|
case "SEI":
|
|
177
126
|
case "JUP":
|
|
178
127
|
return 8;
|
|
179
128
|
case "USDC":
|
|
180
129
|
case "wUSDC":
|
|
181
|
-
case "
|
|
182
|
-
case "sbUSDT":
|
|
130
|
+
case "USDT":
|
|
183
131
|
case "USDY":
|
|
184
132
|
case "AUSD":
|
|
185
133
|
case "DEEP":
|
|
@@ -195,17 +143,18 @@ function assetToDecimal(asset) {
|
|
|
195
143
|
}
|
|
196
144
|
}
|
|
197
145
|
exports.tokenType = {
|
|
146
|
+
SUI: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
|
|
198
147
|
MAINNET: {
|
|
199
148
|
SUI: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
|
|
200
|
-
|
|
201
|
-
|
|
149
|
+
BTC: "0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN",
|
|
150
|
+
ETH: "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN",
|
|
202
151
|
wUSDC: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN",
|
|
203
|
-
|
|
204
|
-
wSOL: "0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8::coin::COIN",
|
|
205
|
-
wAPT: "0x3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37::coin::COIN",
|
|
152
|
+
USDT: "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN",
|
|
206
153
|
CETUS: "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS",
|
|
207
154
|
BUCK: "0xce7ff77a83ea0cb6fd39bd8748e2ec89a3f41e8efdc3f4eb123e0ca37b184db2::buck::BUCK",
|
|
155
|
+
SOL: "0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8::coin::COIN",
|
|
208
156
|
TURBOS: "0x5d1f47ea69bb0de31c313d7acf89b890dbb8991ea8e03c6c355171f84bb1ba4a::turbos::TURBOS",
|
|
157
|
+
APT: "0x3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37::coin::COIN",
|
|
209
158
|
FUD: "0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1::fud::FUD",
|
|
210
159
|
MFUD: "0xd8f04cd2a16c19c17428c3b4c22b01dd06740423b93fb7ee88fbe2676a82849d::mfud::MFUD",
|
|
211
160
|
INJ: "0xcac46c81bbe1e516c65f4c3e5da81e7092cc2e70218deafb31f1c8d5fcc9dae3::inj::INJ",
|
|
@@ -223,52 +172,92 @@ exports.tokenType = {
|
|
|
223
172
|
MLIQ: "9614657c9d7e8799be4f49781ef1a9247b83ee178976df6c92d29b6026b9dadf::mliq::MLIQ",
|
|
224
173
|
BLUE: "0xe1b45a0e641b9955a20aa0ad1c1f4ad86aad8afb07296d4085e349a50e90bdca::blue::BLUE",
|
|
225
174
|
TYPUS: "0xf82dc05634970553615eef6112a1ac4fb7bf10272bf6cbe0f80ef44a6c489385::typus::TYPUS",
|
|
226
|
-
DEEP: "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP",
|
|
227
|
-
BLUB: "0xfa7ac3951fdca92c5200d468d31a365eb03b2be9936fde615e69f0c1274ad3a0::BLUB::BLUB",
|
|
228
|
-
MBLUB: "0x494e1772851793ed39e2aee9990740fe3fc4d50476572b6192adea9268e8b40c::mblub::MBLUB",
|
|
229
|
-
AUSD: "0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD",
|
|
230
|
-
USDC: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
|
|
231
|
-
sbETH: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH",
|
|
232
|
-
sbUSDT: "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT",
|
|
233
|
-
SPSUI: "0x83556891f4a0f233ce7b05cfe7f957d4020492a34f5405b2cb9377d060bef4bf::spring_sui::SPRING_SUI",
|
|
234
|
-
sSCA: "0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA",
|
|
235
175
|
},
|
|
236
176
|
TESTNET: {
|
|
237
177
|
SUI: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
|
|
238
178
|
CETUS: "0xb69a412ba4b22137088183da5e5042d37ba17580897884f00f959d4135d3e1a7::cetus::CETUS",
|
|
239
179
|
BUCK: "0x879cd4804fe865897090e26eceb9f7a7cfda7dda1b2529a81631fa567e67375c::buck::BUCK",
|
|
240
|
-
|
|
180
|
+
SOL: "0x879cd4804fe865897090e26eceb9f7a7cfda7dda1b2529a81631fa567e67375c::sol::SOL",
|
|
241
181
|
TURBOS: "0xebc68999f399a5ba121f8e59c0940eaa0e074e30454403357b93b25af9f30117::turbos::TURBOS",
|
|
242
|
-
|
|
182
|
+
APT: "0xdede697a5748d20ebff2aabf3f2fd5bd9e41afb1a624b636cddc6df69078bd22::apt::APT",
|
|
243
183
|
FUD: "0x461efa7ee5aa1b27e44450d79e2104e7fc0991461e9eb1c2a3fc1f44cd554856::fud::FUD",
|
|
244
184
|
MFUD: "0x7755ff79f0f27256c73e6c197e25b407ef6d4b9bd6e1af8cdd50fef28f84712c::mfud::MFUD",
|
|
245
|
-
|
|
185
|
+
USDT: "0xa38dad920880f81ea514de6db007d3a84e9116a29c60b3e69bbe418c2d9f553c::usdt::USDT",
|
|
246
186
|
AFSUI: "0xd31923b6821fb7ba32d23e514b43d307da6ef991f9ef1af2cc4e26a0992ac87a::afsui::AFSUI",
|
|
247
187
|
INJ: "0xfd3d56e007e3ae44d74b6a6840de0bd04a3724360abd89ae683ca7d592bbb49e::inj::INJ",
|
|
248
188
|
SEI: "0xfd3d56e007e3ae44d74b6a6840de0bd04a3724360abd89ae683ca7d592bbb49e::sei::SEI",
|
|
249
189
|
USDY: "0x579809c614d4388ed821c9f304bb741715cdf4a718707eb7c6fcf7b7189870ef::usdy::USDY",
|
|
250
190
|
TEXP: "0x9b43ee208a3b235810c145bca1161d1a71d08bfe76b1e55bb3db319ea95d0149::tails_exp::TAILS_EXP",
|
|
251
191
|
SCA: "0xd33ea459d9e667c112f5168464a885a654d7bc3fd6903720aaa8cf495a32a77e::sca::SCA",
|
|
252
|
-
|
|
253
|
-
|
|
192
|
+
BTC: "0x949572061c09bbedef3ac4ffc42e58632291616f0605117cec86d840e09bf519::btc::BTC",
|
|
193
|
+
ETH: "0x949572061c09bbedef3ac4ffc42e58632291616f0605117cec86d840e09bf519::eth::ETH",
|
|
254
194
|
wUSDC: "0x949572061c09bbedef3ac4ffc42e58632291616f0605117cec86d840e09bf519::usdc::USDC",
|
|
255
195
|
USDC: "0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC",
|
|
256
196
|
BLUB: "0x94b8f6dcceeb2be160f6837089cc7502458f4f070fa0814380737acb0c41fd5b::blub::BLUB",
|
|
257
197
|
MBLUB: "0x4b5d0a097ee8a309a89bb2bc589403a4a9a39de639d576495b697be2a60f69bb::mblub::MBLUB",
|
|
258
198
|
TYPUS: "0xaded0918624ba1a31a9818ae73ccb557d46f35cb0d754b34597356ce38e6004d::typus::TYPUS",
|
|
259
|
-
NAVX: "",
|
|
260
|
-
DEEP: "",
|
|
261
|
-
BLUE: "",
|
|
262
|
-
LIQ: "",
|
|
263
|
-
HIPPO: "",
|
|
264
|
-
MLIQ: "",
|
|
265
|
-
AUSD: "",
|
|
266
|
-
sbETH: "",
|
|
267
|
-
sbUSDT: "",
|
|
268
|
-
VSUI: "",
|
|
269
|
-
HASUI: "",
|
|
270
|
-
SPSUI: "",
|
|
271
|
-
JUP: "",
|
|
272
|
-
sSCA: "",
|
|
273
199
|
},
|
|
274
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;
|
|
@@ -35,25 +35,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
39
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
40
|
-
if (!m) return o;
|
|
41
|
-
var i = m.call(o), r, ar = [], e;
|
|
42
|
-
try {
|
|
43
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
44
|
-
}
|
|
45
|
-
catch (error) { e = { error: error }; }
|
|
46
|
-
finally {
|
|
47
|
-
try {
|
|
48
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
49
|
-
}
|
|
50
|
-
finally { if (e) throw e.error; }
|
|
51
|
-
}
|
|
52
|
-
return ar;
|
|
53
|
-
};
|
|
54
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
39
|
exports.setAirdrop = setAirdrop;
|
|
56
40
|
exports.removeAirdrop = removeAirdrop;
|
|
41
|
+
var utils_1 = require("../../../src/utils");
|
|
57
42
|
/**
|
|
58
43
|
entry fun set_airdrop<TOKEN>(
|
|
59
44
|
version: &Version,
|
|
@@ -67,18 +52,7 @@ exports.removeAirdrop = removeAirdrop;
|
|
|
67
52
|
*/
|
|
68
53
|
function setAirdrop(config, tx, input) {
|
|
69
54
|
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
-
|
|
71
|
-
return __generator(this, function (_b) {
|
|
72
|
-
_a = __read(input.typeArguments[0] == "0x2::sui::SUI" ||
|
|
73
|
-
input.typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"
|
|
74
|
-
? tx.splitCoins(tx.gas, [tx.pure.u64(input.amount)])
|
|
75
|
-
: (function () {
|
|
76
|
-
var coin = input.coins.pop();
|
|
77
|
-
if (input.coins.length > 0) {
|
|
78
|
-
tx.mergeCoins(tx.object(coin), input.coins.map(function (id) { return tx.object(id); }));
|
|
79
|
-
}
|
|
80
|
-
return tx.splitCoins(tx.object(coin), [tx.pure.u64(input.amount)]);
|
|
81
|
-
})(), 1), coin = _a[0];
|
|
55
|
+
return __generator(this, function (_a) {
|
|
82
56
|
tx.moveCall({
|
|
83
57
|
target: "".concat(config.package.launch.airdrop, "::airdrop::set_airdrop"),
|
|
84
58
|
typeArguments: input.typeArguments,
|
|
@@ -86,7 +60,7 @@ function setAirdrop(config, tx, input) {
|
|
|
86
60
|
tx.object(config.version.launch.airdrop),
|
|
87
61
|
tx.object(config.registry.launch.airdrop),
|
|
88
62
|
tx.pure.string(input.key),
|
|
89
|
-
tx.object(
|
|
63
|
+
tx.object((0, utils_1.splitCoins)(tx, input.typeArguments[0], input.coins, input.amount)),
|
|
90
64
|
tx.pure.vector("address", input.users),
|
|
91
65
|
tx.pure.vector("u64", input.values),
|
|
92
66
|
],
|
|
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var path_1 = __importDefault(require("path"));
|
|
7
6
|
var dotenv_1 = __importDefault(require("dotenv"));
|
|
8
7
|
// import .env file if exists
|
|
9
|
-
dotenv_1.default.config(
|
|
8
|
+
dotenv_1.default.config();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import BigNumber from "bignumber.js";
|
|
2
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
2
3
|
export declare const sleep: (ms: number) => Promise<unknown>;
|
|
3
4
|
export declare const prettify_big_number: (value: any, decimal: any) => string;
|
|
4
5
|
export declare function U64FromBytes(x: any): bigint;
|
|
@@ -6,3 +7,7 @@ export declare function AddressFromBytes(x: any): string;
|
|
|
6
7
|
export declare const insertAt: (str: string, sub: string, pos: number) => string;
|
|
7
8
|
export declare const checkNumber: (str: any) => boolean;
|
|
8
9
|
export declare const countFloating: (value: number | BigNumber) => number;
|
|
10
|
+
export declare function splitCoins(tx: Transaction, token: string, coins: string[], amount: string): {
|
|
11
|
+
$kind: "NestedResult";
|
|
12
|
+
NestedResult: [number, number];
|
|
13
|
+
};
|
package/dist/src/utils/tools.js
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
+
if (!m) return o;
|
|
5
|
+
var i = m.call(o), r, ar = [], e;
|
|
6
|
+
try {
|
|
7
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
+
}
|
|
9
|
+
catch (error) { e = { error: error }; }
|
|
10
|
+
finally {
|
|
11
|
+
try {
|
|
12
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
+
}
|
|
14
|
+
finally { if (e) throw e.error; }
|
|
15
|
+
}
|
|
16
|
+
return ar;
|
|
17
|
+
};
|
|
2
18
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
19
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
20
|
};
|
|
@@ -6,7 +22,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
22
|
exports.countFloating = exports.checkNumber = exports.insertAt = exports.prettify_big_number = exports.sleep = void 0;
|
|
7
23
|
exports.U64FromBytes = U64FromBytes;
|
|
8
24
|
exports.AddressFromBytes = AddressFromBytes;
|
|
25
|
+
exports.splitCoins = splitCoins;
|
|
9
26
|
var bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
27
|
+
var constants_1 = require("../../src/constants");
|
|
28
|
+
var utils_1 = require("@mysten/sui/utils");
|
|
10
29
|
var sleep = function (ms) { return new Promise(function (resolve) { return setTimeout(resolve, ms); }); };
|
|
11
30
|
exports.sleep = sleep;
|
|
12
31
|
var prettify_big_number = function (value, decimal) {
|
|
@@ -49,3 +68,15 @@ var countFloating = function (value) {
|
|
|
49
68
|
return num.split(".")[1].length;
|
|
50
69
|
};
|
|
51
70
|
exports.countFloating = countFloating;
|
|
71
|
+
function splitCoins(tx, token, coins, amount) {
|
|
72
|
+
var _a = __read((0, utils_1.normalizeSuiAddress)(token) == constants_1.tokenType.SUI
|
|
73
|
+
? tx.splitCoins(tx.gas, [tx.pure.u64(amount)])
|
|
74
|
+
: (function () {
|
|
75
|
+
var coin = coins.pop();
|
|
76
|
+
if (coins.length > 0) {
|
|
77
|
+
tx.mergeCoins(tx.object(coin), coins.map(function (id) { return tx.object(id); }));
|
|
78
|
+
}
|
|
79
|
+
return tx.splitCoins(tx.object(coin), [tx.pure.u64(amount)]);
|
|
80
|
+
})(), 1), coin = _a[0];
|
|
81
|
+
return coin;
|
|
82
|
+
}
|
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.5.5
|
|
5
|
+
"version": "1.5.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",
|