@typus/typus-sdk 1.5.5-c → 1.5.6-feat-safu-fee
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 -174
- 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/typus-safu/user-entry.d.ts +4 -2
- package/dist/src/typus-safu/user-entry.js +5 -2
- package/dist/src/typus-safu/view-function.d.ts +9 -0
- package/dist/src/typus-safu/view-function.js +43 -5
- 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,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,52 +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
199
|
},
|
|
275
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
|
],
|
|
@@ -27,16 +27,17 @@ export declare function getRaiseFundTx(config: TypusConfig, tx: Transaction, inp
|
|
|
27
27
|
user: string;
|
|
28
28
|
}): Transaction;
|
|
29
29
|
/**
|
|
30
|
-
public fun
|
|
30
|
+
public fun reduce_fund_v2<D_TOKEN>(
|
|
31
31
|
typus_version: &TypusVersion,
|
|
32
32
|
typus_leaderboard_registry: &mut TypusLeaderboardRegistry,
|
|
33
33
|
typus_user_registry: &mut TypusUserRegistry,
|
|
34
|
-
version: &Version,
|
|
34
|
+
version: &mut Version,
|
|
35
35
|
registry: &mut Registry,
|
|
36
36
|
index: u64,
|
|
37
37
|
reduce_from_warmup: u64,
|
|
38
38
|
reduce_from_active: u64,
|
|
39
39
|
reduce_from_inactive: u64,
|
|
40
|
+
coin: Coin<SUI>,
|
|
40
41
|
clock: &Clock,
|
|
41
42
|
ctx: &mut TxContext,
|
|
42
43
|
): Balance<D_TOKEN> {
|
|
@@ -47,6 +48,7 @@ export declare function getReduceFundTx(config: TypusConfig, tx: Transaction, in
|
|
|
47
48
|
reduceFromWarmup: string;
|
|
48
49
|
reduceFromActive: string;
|
|
49
50
|
reduceFromInactive: string;
|
|
51
|
+
feeAmount: string;
|
|
50
52
|
user: string;
|
|
51
53
|
}): Transaction;
|
|
52
54
|
/**
|
|
@@ -5,6 +5,7 @@ exports.getReduceFundTx = getReduceFundTx;
|
|
|
5
5
|
exports.getClaimRewardTx = getClaimRewardTx;
|
|
6
6
|
exports.getSnapshotTx = getSnapshotTx;
|
|
7
7
|
var constants_1 = require("../../src/constants");
|
|
8
|
+
var utils_1 = require("../../src/utils");
|
|
8
9
|
/**
|
|
9
10
|
public fun raise_fund<D_TOKEN>(
|
|
10
11
|
typus_version: &TypusVersion,
|
|
@@ -69,16 +70,17 @@ function getRaiseFundTx(config, tx, input) {
|
|
|
69
70
|
return tx;
|
|
70
71
|
}
|
|
71
72
|
/**
|
|
72
|
-
public fun
|
|
73
|
+
public fun reduce_fund_v2<D_TOKEN>(
|
|
73
74
|
typus_version: &TypusVersion,
|
|
74
75
|
typus_leaderboard_registry: &mut TypusLeaderboardRegistry,
|
|
75
76
|
typus_user_registry: &mut TypusUserRegistry,
|
|
76
|
-
version: &Version,
|
|
77
|
+
version: &mut Version,
|
|
77
78
|
registry: &mut Registry,
|
|
78
79
|
index: u64,
|
|
79
80
|
reduce_from_warmup: u64,
|
|
80
81
|
reduce_from_active: u64,
|
|
81
82
|
reduce_from_inactive: u64,
|
|
83
|
+
coin: Coin<SUI>,
|
|
82
84
|
clock: &Clock,
|
|
83
85
|
ctx: &mut TxContext,
|
|
84
86
|
): Balance<D_TOKEN> {
|
|
@@ -97,6 +99,7 @@ function getReduceFundTx(config, tx, input) {
|
|
|
97
99
|
tx.pure.u64(input.reduceFromWarmup),
|
|
98
100
|
tx.pure.u64(input.reduceFromActive),
|
|
99
101
|
tx.pure.u64(input.reduceFromInactive),
|
|
102
|
+
tx.object((0, utils_1.splitCoins)(tx, constants_1.tokenType.SUI, [], input.feeAmount)),
|
|
100
103
|
tx.object(constants_1.CLOCK),
|
|
101
104
|
],
|
|
102
105
|
});
|
|
@@ -6,6 +6,7 @@ export interface Vault {
|
|
|
6
6
|
rewardToken: string[];
|
|
7
7
|
info: Info;
|
|
8
8
|
config: Config;
|
|
9
|
+
share: BigVector;
|
|
9
10
|
shareSupply: ShareSupply;
|
|
10
11
|
u64Padding: string[];
|
|
11
12
|
bcsPadding: string[];
|
|
@@ -42,6 +43,14 @@ export interface ShareSupply {
|
|
|
42
43
|
snapshot_share: string;
|
|
43
44
|
reward_share: string[];
|
|
44
45
|
}
|
|
46
|
+
export interface BigVector {
|
|
47
|
+
id: string;
|
|
48
|
+
element_type: string;
|
|
49
|
+
slice_idx: string;
|
|
50
|
+
slice_size: number;
|
|
51
|
+
length: string;
|
|
52
|
+
}
|
|
53
|
+
export declare function getBigVectorData(config: TypusConfig, bigVector: BigVector): Promise<any[]>;
|
|
45
54
|
export declare function getVaultData(config: TypusConfig, input: {
|
|
46
55
|
indexes: string[];
|
|
47
56
|
}): Promise<{
|
|
@@ -36,6 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getBigVectorData = getBigVectorData;
|
|
39
40
|
exports.getVaultData = getVaultData;
|
|
40
41
|
exports.getShareData = getShareData;
|
|
41
42
|
var transactions_1 = require("@mysten/sui/transactions");
|
|
@@ -43,6 +44,39 @@ var client_1 = require("@mysten/sui/client");
|
|
|
43
44
|
var bcs_1 = require("@mysten/bcs");
|
|
44
45
|
var utils_1 = require("../../src/utils");
|
|
45
46
|
var constants_1 = require("../../src/constants");
|
|
47
|
+
function getBigVectorData(config, bigVector) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
49
|
+
var provider, results, i, df, result;
|
|
50
|
+
var _a;
|
|
51
|
+
return __generator(this, function (_b) {
|
|
52
|
+
switch (_b.label) {
|
|
53
|
+
case 0:
|
|
54
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
55
|
+
results = [];
|
|
56
|
+
i = 0;
|
|
57
|
+
_b.label = 1;
|
|
58
|
+
case 1:
|
|
59
|
+
if (!(i <= Number(bigVector.slice_idx))) return [3 /*break*/, 4];
|
|
60
|
+
return [4 /*yield*/, provider.getDynamicFieldObject({
|
|
61
|
+
parentId: bigVector.id,
|
|
62
|
+
name: {
|
|
63
|
+
type: "u64",
|
|
64
|
+
value: "".concat(i),
|
|
65
|
+
},
|
|
66
|
+
})];
|
|
67
|
+
case 2:
|
|
68
|
+
df = _b.sent();
|
|
69
|
+
result = (_a = df.data) === null || _a === void 0 ? void 0 : _a.content.fields.value.fields.vector.map(function (x) { return x.fields; });
|
|
70
|
+
results = results.concat(result);
|
|
71
|
+
_b.label = 3;
|
|
72
|
+
case 3:
|
|
73
|
+
i++;
|
|
74
|
+
return [3 /*break*/, 1];
|
|
75
|
+
case 4: return [2 /*return*/, results];
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}
|
|
46
80
|
function getVaultData(config, input) {
|
|
47
81
|
return __awaiter(this, void 0, void 0, function () {
|
|
48
82
|
var provider, transaction, results, bytes, reader, result;
|
|
@@ -100,11 +134,13 @@ function getVaultData(config, input) {
|
|
|
100
134
|
incentive_fixed: configArray[7],
|
|
101
135
|
};
|
|
102
136
|
// skip BigVector
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
137
|
+
var bigVector = {
|
|
138
|
+
id: (0, utils_1.AddressFromBytes)(reader.readBytes(32)),
|
|
139
|
+
element_type: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))), // element_type
|
|
140
|
+
slice_idx: reader.read64(), // slice_idx
|
|
141
|
+
slice_size: reader.read32(), // slice_size
|
|
142
|
+
length: reader.read64(), // length
|
|
143
|
+
};
|
|
108
144
|
var shareSupplyArray = reader.readVec(function (reader) {
|
|
109
145
|
return reader.read64();
|
|
110
146
|
});
|
|
@@ -131,6 +167,7 @@ function getVaultData(config, input) {
|
|
|
131
167
|
rewardToken: rewardToken,
|
|
132
168
|
info: info,
|
|
133
169
|
config: config,
|
|
170
|
+
share: bigVector,
|
|
134
171
|
shareSupply: shareSupply,
|
|
135
172
|
u64Padding: u64Padding,
|
|
136
173
|
bcsPadding: bcsPadding,
|
|
@@ -154,6 +191,7 @@ function getVaultData(config, input) {
|
|
|
154
191
|
rewardToken: rewardToken,
|
|
155
192
|
info: info,
|
|
156
193
|
config: config,
|
|
194
|
+
share: bigVector,
|
|
157
195
|
shareSupply: shareSupply,
|
|
158
196
|
u64Padding: u64Padding,
|
|
159
197
|
bcsPadding: bcsPadding,
|
|
@@ -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
|
+
"version": "1.5.6-feat-safu-fee",
|
|
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",
|