@typus/typus-sdk 1.2.98 → 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": "0x8b65b817e7d819ab810bf50eaaa521ceea39d85cd46ab58180cfe287ce6f8ef0",
19
- "FRAMEWORK": "0x946d188d91cabd4fe15ef763e463a6738db1965814d3fd790085b4720cf90e28",
18
+ "DOV_SINGLE": "0x011840332be097b422abb8336970b0be1d7333df22134cd5c3be9d9a1cb956d0",
19
+ "FRAMEWORK": "0x8638b586ad122d2887d0685d1996a88adc1b7a8a81906fc7f68b25dcbac25cb5",
20
20
  "MFUD": "0xd8f04cd2a16c19c17428c3b4c22b01dd06740423b93fb7ee88fbe2676a82849d",
21
21
  "NFT": "0xba06aae31d9b7c9f651e783272c7e4f776fb5ae17e89d525b75a17b099f58202",
22
22
  "ORACLE": "0x978f65df8570a075298598a9965c18de9087f9e888eb3430fe20334f5c554cfd",
23
- "TYPUS": "0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a"
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://fullnode.testnet.sui.io:443",
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.24.0",
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": "0x8b65b817e7d819ab810bf50eaaa521ceea39d85cd46ab58180cfe287ce6f8ef0",
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 _c, _d, _e, _f, _g;
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 _h = __read((_c = history_1.Amount) === null || _c === void 0 ? void 0 : _c.split(" "), 2), amount = _h[0], token = _h[1];
41
- if (depositorCashFlows.has(index)) {
42
- var depositorCashFlow = depositorCashFlows.get(index);
43
- var totalHarvest = depositorCashFlow.totalHarvest;
44
- if (totalHarvest.has(token)) {
45
- var sum = totalHarvest.get(token);
46
- totalHarvest.set(token, sum + Number(amount));
47
- }
48
- else {
49
- totalHarvest.set(token, Number(amount));
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
- else {
55
- var totalHarvest = new Map();
56
- totalHarvest.set(token, Number(amount));
57
- var depositorCashFlow = {
58
- D_TOKEN: undefined,
59
- totalDeposit: 0,
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 _j = __read((_d = history_1.Amount) === null || _d === void 0 ? void 0 : _d.split(" "), 2), amount = _j[0], token = _j[1];
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 _k = __read((_e = history_1.Amount) === null || _e === void 0 ? void 0 : _e.split(" "), 2), amount = _k[0], token = _k[1];
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 _l = __read((_f = history_1.Amount) === null || _f === void 0 ? void 0 : _f.split(" "), 2), amount = _l[0], token = _l[1];
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 _m = __read((_g = history_1.Amount) === null || _g === void 0 ? void 0 : _g.split(" "), 2), amount = _m[0], token = _m[1];
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 _o = __values(depositorCashFlows.entries()), _p = _o.next(); !_p.done; _p = _o.next()) {
165
- var _q = __read(_p.value, 2), index = _q[0], share = _q[1];
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 (e_2_1) { e_2 = { error: e_2_1 }; }
183
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
171
184
  finally {
172
185
  try {
173
- if (_p && !_p.done && (_b = _o.return)) _b.call(_o);
186
+ if (_q && !_q.done && (_c = _p.return)) _c.call(_p);
174
187
  }
175
- finally { if (e_2) throw e_2.error; }
188
+ finally { if (e_3) throw e_3.error; }
176
189
  }
177
190
  return depositorCashFlows;
178
191
  }
@@ -107,3 +107,20 @@ export declare function getCloseStrategyTx(gasBudget: number, packageId: string,
107
107
  registry: string, strategy_pool: string, vault_index: string, signal_index: string, strategy_index: string, mfudPackageId: string, mfudRegistry: string, sender: string): TransactionBlock;
108
108
  export declare function getWithdrawProfitStrategyTx(gasBudget: number, packageId: string, typeArguments: string[], // D_TOKEN, B_TOKEN
109
109
  registry: string, strategy_pool: string, vault_index: string, signal_index: string, strategy_index: string, mfudPackageId: string, mfudRegistry: string, sender: string, txBlock?: TransactionBlock): TransactionBlock;
110
+ export declare function getCompoundWithRedeemTx(input: {
111
+ tx: TransactionBlock;
112
+ typusEcosystemVersion: string;
113
+ typusUserRegistry: string;
114
+ typusLeaderboardRegistry: string;
115
+ typusFrameworkOriginPackageId: string;
116
+ typusFrameworkPackageId: string;
117
+ typusDovSinglePackageId: string;
118
+ typusDovSingleRegistry: string;
119
+ typeArguments: string[];
120
+ typusTokenPackageId: string;
121
+ typusTokenRegistry: string;
122
+ typusTokenType: string;
123
+ index: string;
124
+ receipts: string[] | TransactionObjectArgument[];
125
+ user: string;
126
+ }): TransactionBlock;
@@ -16,7 +16,7 @@ var __read = (this && this.__read) || function (o, n) {
16
16
  return ar;
17
17
  };
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.getWithdrawProfitStrategyTx = exports.getCloseStrategyTx = exports.getUpdateStrategyTx = exports.getNewStrategyTx = exports.getRebateTx = exports.getExerciseTx = exports.getNewBidTx = exports.getDepositTx = exports.getReduceFundTx = exports.getRaiseFundTx = void 0;
19
+ exports.getCompoundWithRedeemTx = exports.getWithdrawProfitStrategyTx = exports.getCloseStrategyTx = exports.getUpdateStrategyTx = exports.getNewStrategyTx = exports.getRebateTx = exports.getExerciseTx = exports.getNewBidTx = exports.getDepositTx = exports.getReduceFundTx = exports.getRaiseFundTx = void 0;
20
20
  var transactions_1 = require("@mysten/sui.js/transactions");
21
21
  var constants_1 = require("../../constants");
22
22
  function getRaiseFundTx(input) {
@@ -375,3 +375,52 @@ registry, strategy_pool, vault_index, signal_index, strategy_index, mfudPackageI
375
375
  return tx;
376
376
  }
377
377
  exports.getWithdrawProfitStrategyTx = getWithdrawProfitStrategyTx;
378
+ function getCompoundWithRedeemTx(input) {
379
+ var raiseBalance = input.tx.moveCall({
380
+ target: "0x2::balance::zero",
381
+ typeArguments: [input.typeArguments[0]],
382
+ arguments: [],
383
+ });
384
+ var result = input.tx.moveCall({
385
+ target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::public_raise_fund"),
386
+ typeArguments: [input.typeArguments[0], input.typeArguments[1]],
387
+ arguments: [
388
+ input.tx.object(input.typusEcosystemVersion),
389
+ input.tx.object(input.typusUserRegistry),
390
+ input.tx.object(input.typusLeaderboardRegistry),
391
+ input.tx.object(input.typusDovSingleRegistry),
392
+ input.tx.pure(input.index),
393
+ input.tx.makeMoveVec({
394
+ type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
395
+ objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
396
+ }),
397
+ input.tx.object(raiseBalance),
398
+ input.tx.pure(true),
399
+ input.tx.pure(false),
400
+ input.tx.object(constants_1.CLOCK),
401
+ ],
402
+ });
403
+ return getReduceFundTx({
404
+ tx: input.tx,
405
+ typusEcosystemVersion: input.typusEcosystemVersion,
406
+ typusUserRegistry: input.typusUserRegistry,
407
+ typusLeaderboardRegistry: input.typusLeaderboardRegistry,
408
+ typusFrameworkOriginPackageId: input.typusFrameworkOriginPackageId,
409
+ typusFrameworkPackageId: input.typusFrameworkPackageId,
410
+ typusDovSinglePackageId: input.typusDovSinglePackageId,
411
+ typusDovSingleRegistry: input.typusDovSingleRegistry,
412
+ typeArguments: input.typeArguments,
413
+ typusTokenPackageId: input.typusTokenPackageId,
414
+ typusTokenRegistry: input.typusTokenRegistry,
415
+ typusTokenType: input.typusTokenType,
416
+ index: input.index,
417
+ receipts: [result[0]],
418
+ reduceFromWarmup: "0",
419
+ reduceFromActive: "0",
420
+ reduceFromPremium: false,
421
+ reduceFromInactive: false,
422
+ reduceFromIncentive: true,
423
+ user: input.user,
424
+ });
425
+ }
426
+ exports.getCompoundWithRedeemTx = getCompoundWithRedeemTx;
@@ -398,7 +398,6 @@ function getCompoundWithRedeemTx(input) {
398
398
  input.tx.object(constants_1.CLOCK),
399
399
  ],
400
400
  });
401
- input.tx.transferObjects([input.tx.object(result[0])], input.user);
402
401
  return getReduceFundTx({
403
402
  tx: input.tx,
404
403
  typusEcosystemVersion: input.typusEcosystemVersion,
@@ -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);
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.2.98",
5
+ "version": "1.2.100",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.11.1",
8
8
  "@mysten/kiosk": "0.8.10",