@typus/typus-sdk 1.2.99 → 1.2.100
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/lib/config.json
CHANGED
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
"TYPUS": "0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a"
|
|
16
16
|
},
|
|
17
17
|
"PACKAGE": {
|
|
18
|
-
"DOV_SINGLE": "
|
|
19
|
-
"FRAMEWORK": "
|
|
18
|
+
"DOV_SINGLE": "0x011840332be097b422abb8336970b0be1d7333df22134cd5c3be9d9a1cb956d0",
|
|
19
|
+
"FRAMEWORK": "0x8638b586ad122d2887d0685d1996a88adc1b7a8a81906fc7f68b25dcbac25cb5",
|
|
20
20
|
"MFUD": "0xd8f04cd2a16c19c17428c3b4c22b01dd06740423b93fb7ee88fbe2676a82849d",
|
|
21
21
|
"NFT": "0xba06aae31d9b7c9f651e783272c7e4f776fb5ae17e89d525b75a17b099f58202",
|
|
22
22
|
"ORACLE": "0x978f65df8570a075298598a9965c18de9087f9e888eb3430fe20334f5c554cfd",
|
|
23
|
-
"TYPUS": "
|
|
23
|
+
"TYPUS": "0x019fe3a0a4a831515a6801c51fdf0800e2428777b4e29cbc8355b7939a009893"
|
|
24
24
|
},
|
|
25
25
|
"REGISTRY": {
|
|
26
26
|
"AIRDROP": "0x4b451f4632bd64af82d5e6fe46e20705c9468bd46d6758a0f7093fde2930d084",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
"TESTNET": {
|
|
55
|
-
"RPC_ENDPOINT": "https://
|
|
55
|
+
"RPC_ENDPOINT": "https://sui-testnet.blastapi.io:443/7f446a12-c4ab-4e3c-b2d8-ebb0fcbe5cdd",
|
|
56
56
|
"TYPUS_VERSION": "0x2edc980f55e31ba3c660f4e2650e915fd47fb33b524b01a52a116719adac8be7",
|
|
57
57
|
"TGLD_COIN_METADATA": "0xf77f8aabe64dccef0e568f2ef58a6ca74bdfb31786507cc35b7626a4df0d0ebc",
|
|
58
58
|
"TGLD_TOKEN_POLICY": "0x17875c2f772053cd148bd2b8b8a40160db3f841825d8963192f8394d5c18974c",
|
package/lib/mainnet.json
CHANGED
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"SCALLOP_MARKET": "0xa757975255146dc9686aa823b7838b507f315d704f428cbadad2f4ea061939d9",
|
|
31
31
|
"SCALLOP_REWARD_POOL_FOR_SUI": "0x162250ef72393a4ad3d46294c4e1bdfcb03f04c869d390e7efbfc995353a7ee9",
|
|
32
32
|
"SCALLOP_REWARD_POOL_FOR_USDC": "0xf4268cc9b9413b9bfe09e8966b8de650494c9e5784bf0930759cfef4904daff8",
|
|
33
|
-
"VERSION": "2.
|
|
33
|
+
"VERSION": "2.25.0",
|
|
34
34
|
"EXP_GUESS_PACKAGE": "0x32d670520a10a87b8c042d2259c2d1f7c319329bafcf6f893ad9aaf01a43db8b",
|
|
35
35
|
"EXP_GUESS_PACKAGE_ORIGIN": "0x32d670520a10a87b8c042d2259c2d1f7c319329bafcf6f893ad9aaf01a43db8b",
|
|
36
36
|
"EXP_GUESS_REGISTRY": "0x70c6cbe6764b315cee1b24f483a0fc8307f047f1fab2a0d4438624845e6ba3f2",
|
|
37
37
|
"FRAMEWORK_PACKAGE": "0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274",
|
|
38
|
-
"SINGLE_COLLATERAL_PACKAGE": "
|
|
38
|
+
"SINGLE_COLLATERAL_PACKAGE": "0x011840332be097b422abb8336970b0be1d7333df22134cd5c3be9d9a1cb956d0",
|
|
39
39
|
"SINGLE_COLLATERAL_PACKAGE_ORIGIN": "0x321848bf1ae327a9e022ccb3701940191e02fa193ab160d9c0e49cd3c003de3a",
|
|
40
40
|
"SINGLE_COLLATERAL_REGISTRY": "0x3d70b09359e3ca8301ae0abeda4f2fdf72ce313ba58c919ce568e5f535fd2ea8",
|
|
41
41
|
"SINGLE_COLLATERAL_PORTFOLIO_VAULT_REGISTRY": "0xa1a186d050e3172ef4701c16048c99b11f785969874fa2642b9cbcf59cde7fc0",
|
|
@@ -29,45 +29,58 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
exports.getDepositorCashFlows = void 0;
|
|
31
31
|
function getDepositorCashFlows(userHistory) {
|
|
32
|
-
var e_1, _a, e_2, _b;
|
|
33
|
-
var
|
|
32
|
+
var e_1, _a, e_2, _b, e_3, _c;
|
|
33
|
+
var _d, _e, _f, _g, _h;
|
|
34
34
|
var depositorCashFlows = new Map();
|
|
35
35
|
try {
|
|
36
36
|
for (var userHistory_1 = __values(userHistory), userHistory_1_1 = userHistory_1.next(); !userHistory_1_1.done; userHistory_1_1 = userHistory_1.next()) {
|
|
37
37
|
var history_1 = userHistory_1_1.value;
|
|
38
38
|
var index = history_1.Index;
|
|
39
39
|
if (history_1.Action.startsWith("Harvest Reward")) {
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
var historyAmounts = (_d = history_1.Amount) === null || _d === void 0 ? void 0 : _d.split("\n");
|
|
41
|
+
try {
|
|
42
|
+
for (var historyAmounts_1 = (e_2 = void 0, __values(historyAmounts)), historyAmounts_1_1 = historyAmounts_1.next(); !historyAmounts_1_1.done; historyAmounts_1_1 = historyAmounts_1.next()) {
|
|
43
|
+
var historyAmount = historyAmounts_1_1.value;
|
|
44
|
+
var _j = __read(historyAmount.split(" "), 2), amount = _j[0], token = _j[1];
|
|
45
|
+
if (depositorCashFlows.has(index)) {
|
|
46
|
+
var depositorCashFlow = depositorCashFlows.get(index);
|
|
47
|
+
var totalHarvest = depositorCashFlow.totalHarvest;
|
|
48
|
+
if (totalHarvest.has(token)) {
|
|
49
|
+
var sum = totalHarvest.get(token);
|
|
50
|
+
totalHarvest.set(token, sum + Number(amount));
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
totalHarvest.set(token, Number(amount));
|
|
54
|
+
}
|
|
55
|
+
depositorCashFlow.totalHarvest = totalHarvest;
|
|
56
|
+
depositorCashFlows.set(index, depositorCashFlow);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
var totalHarvest = new Map();
|
|
60
|
+
totalHarvest.set(token, Number(amount));
|
|
61
|
+
var depositorCashFlow = {
|
|
62
|
+
D_TOKEN: undefined,
|
|
63
|
+
totalDeposit: 0,
|
|
64
|
+
totalWithdraw: 0,
|
|
65
|
+
totalClaim: 0,
|
|
66
|
+
totalCompound: 0,
|
|
67
|
+
netDeposit: undefined,
|
|
68
|
+
totalHarvest: totalHarvest,
|
|
69
|
+
};
|
|
70
|
+
depositorCashFlows.set(index, depositorCashFlow);
|
|
71
|
+
}
|
|
50
72
|
}
|
|
51
|
-
depositorCashFlow.totalHarvest = totalHarvest;
|
|
52
|
-
depositorCashFlows.set(index, depositorCashFlow);
|
|
53
73
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
totalWithdraw: 0,
|
|
61
|
-
totalClaim: 0,
|
|
62
|
-
totalCompound: 0,
|
|
63
|
-
netDeposit: undefined,
|
|
64
|
-
totalHarvest: totalHarvest,
|
|
65
|
-
};
|
|
66
|
-
depositorCashFlows.set(index, depositorCashFlow);
|
|
74
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
75
|
+
finally {
|
|
76
|
+
try {
|
|
77
|
+
if (historyAmounts_1_1 && !historyAmounts_1_1.done && (_b = historyAmounts_1.return)) _b.call(historyAmounts_1);
|
|
78
|
+
}
|
|
79
|
+
finally { if (e_2) throw e_2.error; }
|
|
67
80
|
}
|
|
68
81
|
}
|
|
69
82
|
else if (history_1.Action.startsWith("Deposit")) {
|
|
70
|
-
var
|
|
83
|
+
var _k = __read((_e = history_1.Amount) === null || _e === void 0 ? void 0 : _e.split(" "), 2), amount = _k[0], token = _k[1];
|
|
71
84
|
if (depositorCashFlows.has(index)) {
|
|
72
85
|
var depositorCashFlow = depositorCashFlows.get(index);
|
|
73
86
|
depositorCashFlow.D_TOKEN = token;
|
|
@@ -88,7 +101,7 @@ function getDepositorCashFlows(userHistory) {
|
|
|
88
101
|
}
|
|
89
102
|
}
|
|
90
103
|
else if (history_1.Action.startsWith("Withdraw")) {
|
|
91
|
-
var
|
|
104
|
+
var _l = __read((_f = history_1.Amount) === null || _f === void 0 ? void 0 : _f.split(" "), 2), amount = _l[0], token = _l[1];
|
|
92
105
|
if (depositorCashFlows.has(index)) {
|
|
93
106
|
var depositorCashFlow = depositorCashFlows.get(index);
|
|
94
107
|
depositorCashFlow.D_TOKEN = token;
|
|
@@ -109,7 +122,7 @@ function getDepositorCashFlows(userHistory) {
|
|
|
109
122
|
}
|
|
110
123
|
}
|
|
111
124
|
else if (history_1.Action == "Claim") {
|
|
112
|
-
var
|
|
125
|
+
var _m = __read((_g = history_1.Amount) === null || _g === void 0 ? void 0 : _g.split(" "), 2), amount = _m[0], token = _m[1];
|
|
113
126
|
if (depositorCashFlows.has(index)) {
|
|
114
127
|
var depositorCashFlow = depositorCashFlows.get(index);
|
|
115
128
|
depositorCashFlow.D_TOKEN = token;
|
|
@@ -130,7 +143,7 @@ function getDepositorCashFlows(userHistory) {
|
|
|
130
143
|
}
|
|
131
144
|
}
|
|
132
145
|
else if (history_1.Action == "Compound") {
|
|
133
|
-
var
|
|
146
|
+
var _o = __read((_h = history_1.Amount) === null || _h === void 0 ? void 0 : _h.split(" "), 2), amount = _o[0], token = _o[1];
|
|
134
147
|
if (depositorCashFlows.has(index)) {
|
|
135
148
|
var depositorCashFlow = depositorCashFlows.get(index);
|
|
136
149
|
depositorCashFlow.D_TOKEN = token;
|
|
@@ -161,18 +174,18 @@ function getDepositorCashFlows(userHistory) {
|
|
|
161
174
|
}
|
|
162
175
|
try {
|
|
163
176
|
// console.log(depositorCashFlows);
|
|
164
|
-
for (var
|
|
165
|
-
var
|
|
177
|
+
for (var _p = __values(depositorCashFlows.entries()), _q = _p.next(); !_q.done; _q = _p.next()) {
|
|
178
|
+
var _r = __read(_q.value, 2), index = _r[0], share = _r[1];
|
|
166
179
|
share.netDeposit = share.totalDeposit + share.totalCompound - share.totalWithdraw - share.totalClaim;
|
|
167
180
|
depositorCashFlows.set(index, share);
|
|
168
181
|
}
|
|
169
182
|
}
|
|
170
|
-
catch (
|
|
183
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
171
184
|
finally {
|
|
172
185
|
try {
|
|
173
|
-
if (
|
|
186
|
+
if (_q && !_q.done && (_c = _p.return)) _c.call(_p);
|
|
174
187
|
}
|
|
175
|
-
finally { if (
|
|
188
|
+
finally { if (e_3) throw e_3.error; }
|
|
176
189
|
}
|
|
177
190
|
return depositorCashFlows;
|
|
178
191
|
}
|
|
@@ -324,7 +324,7 @@ function parseTxHistory(datas, originPackage, vaults) {
|
|
|
324
324
|
}
|
|
325
325
|
if (event.parsedJson.log[6] > 0 && event.parsedJson.log[10] > 0) {
|
|
326
326
|
// Harvest d token and i token
|
|
327
|
-
Action = "Harvest";
|
|
327
|
+
Action = "Harvest Reward";
|
|
328
328
|
b_token_name = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.b_token.name);
|
|
329
329
|
b_token_amount = Number(event.parsedJson.log[6]) / Math.pow(10, (0, token_1.assetToDecimal)(b_token_name));
|
|
330
330
|
i_token_name = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.i_token.name);
|
|
@@ -350,7 +350,7 @@ function parseTxHistory(datas, originPackage, vaults) {
|
|
|
350
350
|
else {
|
|
351
351
|
if (event.parsedJson.log[6] > 0) {
|
|
352
352
|
// harvest
|
|
353
|
-
Action = "Harvest";
|
|
353
|
+
Action = "Harvest Reward";
|
|
354
354
|
token = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.b_token.name);
|
|
355
355
|
amount = Number(event.parsedJson.log[6]) / Math.pow(10, (0, token_1.assetToDecimal)(token));
|
|
356
356
|
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
|