@typus/typus-sdk 1.2.91 → 1.2.93

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
@@ -68,7 +68,7 @@
68
68
  "LOCKED_VAULT": "0xe79b7ba69b750d30ac7ae171483a4064d0bb34090493fef3c844a11b05818d79"
69
69
  },
70
70
  "PACKAGE": {
71
- "DOV_SINGLE": "0x2f532cee2587915e76c790b28b132f8fce877037de6af1e6c6a77c91563ca7ed",
71
+ "DOV_SINGLE": "0x37c6a2425e87fcad23faeae753a01a98c0880346f3b81ba412de1edb2a9d3f81",
72
72
  "FRAMEWORK": "0xa304e225551b619b07c06d8965462b268138b2c5774fd22ad8853ef91fbb9771",
73
73
  "MFUD": "0x7755ff79f0f27256c73e6c197e25b407ef6d4b9bd6e1af8cdd50fef28f84712c",
74
74
  "NFT": "0x0f5162014f18686640b8d0adefd60c3fe5b377413ec4f1e77001c67d96f8501a",
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.22.3",
33
+ "VERSION": "2.24.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": "0x1ee07392805d5b26a1c248b5739b768d426579ac1f4aeb50152f7ca06d3e2a00",
38
+ "SINGLE_COLLATERAL_PACKAGE": "0x8b65b817e7d819ab810bf50eaaa521ceea39d85cd46ab58180cfe287ce6f8ef0",
39
39
  "SINGLE_COLLATERAL_PACKAGE_ORIGIN": "0x321848bf1ae327a9e022ccb3701940191e02fa193ab160d9c0e49cd3c003de3a",
40
40
  "SINGLE_COLLATERAL_REGISTRY": "0x3d70b09359e3ca8301ae0abeda4f2fdf72ce313ba58c919ce568e5f535fd2ea8",
41
41
  "SINGLE_COLLATERAL_PORTFOLIO_VAULT_REGISTRY": "0xa1a186d050e3172ef4701c16048c99b11f785969874fa2642b9cbcf59cde7fc0",
@@ -42,7 +42,10 @@ function getRaiseFundTx(input) {
42
42
  typeArguments: [input.typeArguments[0]],
43
43
  arguments: [
44
44
  input.tx.pure(input.user),
45
- input.tx.makeMoveVec({ objects: [input.tx.splitCoins(input.tx.gas, [input.tx.pure(input.raiseAmount)])] }),
45
+ input.tx.makeMoveVec({
46
+ type: "0x2::coin::Coin<".concat(input.typeArguments[0], ">"),
47
+ objects: [input.tx.splitCoins(input.tx.gas, [input.tx.pure(input.raiseAmount)])],
48
+ }),
46
49
  input.tx.pure(input.raiseAmount),
47
50
  ],
48
51
  })
@@ -51,7 +54,10 @@ function getRaiseFundTx(input) {
51
54
  typeArguments: [input.typeArguments[0]],
52
55
  arguments: [
53
56
  input.tx.pure(input.user),
54
- input.tx.makeMoveVec({ objects: input.raiseCoins.map(function (coin) { return input.tx.object(coin); }) }),
57
+ input.tx.makeMoveVec({
58
+ type: "0x2::coin::Coin<".concat(input.typeArguments[0], ">"),
59
+ objects: input.raiseCoins.map(function (coin) { return input.tx.object(coin); }),
60
+ }),
55
61
  input.tx.pure(input.raiseAmount),
56
62
  ],
57
63
  });
@@ -149,15 +149,15 @@ function parseTxHistory(datas, originPackage, vaults) {
149
149
  }
150
150
  })
151
151
  .reduce(function (promise, event) { return __awaiter(_this, void 0, void 0, function () {
152
- var txHistory, functionType, action, Action, Amount, Index, Period, Vault, RiskLevel, Tails, Exp, d_token, b_token, o_token, i, i, i, token, amount, deposit_amount, deposit_amount, balance, balance, profit, profit, token, amount, amount, token, amount, size, token, amount, token, amount, size, bidder_balance;
153
- var _a;
154
- var _b;
155
- return __generator(this, function (_c) {
156
- switch (_c.label) {
152
+ var txHistory, functionType, action, Action, Amount, Index, Period, Vault, RiskLevel, Tails, Exp, d_token, b_token, o_token, i, i, i, token, amount, token, amount, amount, token, amount, token, amount, token, amount, token, amount, token, amount, deposit_amount, deposit_amount, balance, balance, profit, profit, token, amount, amount, token, amount, size, token, amount, token, amount, size, bidder_balance;
153
+ var _a, _b, _c;
154
+ var _d;
155
+ return __generator(this, function (_e) {
156
+ switch (_e.label) {
157
157
  case 0: return [4 /*yield*/, promise];
158
158
  case 1:
159
- txHistory = _c.sent();
160
- functionType = (_b = new RegExp("^([^::]+)::([^::]+)::([^<]+)").exec(event.type)) === null || _b === void 0 ? void 0 : _b.slice(1, 4);
159
+ txHistory = _e.sent();
160
+ functionType = (_d = new RegExp("^([^::]+)::([^::]+)::([^<]+)").exec(event.type)) === null || _d === void 0 ? void 0 : _d.slice(1, 4);
161
161
  action = functionType[2];
162
162
  Tails = undefined;
163
163
  Index = event.parsedJson.index || event.parsedJson.vault_index;
@@ -245,6 +245,122 @@ function parseTxHistory(datas, originPackage, vaults) {
245
245
  return [2 /*return*/, txHistory];
246
246
  }
247
247
  break;
248
+ case "RaiseFundEvent":
249
+ Index = event.parsedJson.log[0];
250
+ _b = __read(parseVaultInfo(vaults, Index, action), 6), Period = _b[0], Vault = _b[1], RiskLevel = _b[2], d_token = _b[3], b_token = _b[4], o_token = _b[5];
251
+ token = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.token.name);
252
+ if (event.parsedJson.log[4] > 0) {
253
+ // deposit
254
+ Action = "Deposit";
255
+ amount = Number(event.parsedJson.log[4]) / Math.pow(10, (0, token_1.assetToDecimal)(token));
256
+ Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
257
+ }
258
+ else if (event.parsedJson.log[5] > 0) {
259
+ // compound
260
+ Action = "Compound";
261
+ amount = Number(event.parsedJson.log[5]) / Math.pow(10, (0, token_1.assetToDecimal)(token));
262
+ Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
263
+ }
264
+ break;
265
+ case "ReduceFundEvent":
266
+ Index = event.parsedJson.log[0];
267
+ _c = __read(parseVaultInfo(vaults, Index, action), 6), Period = _c[0], Vault = _c[1], RiskLevel = _c[2], d_token = _c[3], b_token = _c[4], o_token = _c[5];
268
+ if (event.parsedJson.log[4] > 0) {
269
+ // withdraw
270
+ Action = "Withdraw";
271
+ token = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.d_token.name);
272
+ amount = Number(event.parsedJson.log[4]) / Math.pow(10, (0, token_1.assetToDecimal)(token));
273
+ Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
274
+ txHistory.push({
275
+ Index: Index,
276
+ Period: Period,
277
+ Action: Action,
278
+ Amount: Amount,
279
+ Vault: Vault,
280
+ RiskLevel: RiskLevel,
281
+ Tails: Tails,
282
+ Exp: Exp,
283
+ Date: new Date(Number(event.timestampMs)),
284
+ txDigest: event.id.txDigest,
285
+ });
286
+ }
287
+ if (event.parsedJson.log[5] > 0) {
288
+ // unsubscribe
289
+ Action = "Unsubscribe";
290
+ token = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.d_token.name);
291
+ amount = Number(event.parsedJson.log[5]) / Math.pow(10, (0, token_1.assetToDecimal)(token));
292
+ Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
293
+ txHistory.push({
294
+ Index: Index,
295
+ Period: Period,
296
+ Action: Action,
297
+ Amount: Amount,
298
+ Vault: Vault,
299
+ RiskLevel: RiskLevel,
300
+ Tails: Tails,
301
+ Exp: Exp,
302
+ Date: new Date(Number(event.timestampMs)),
303
+ txDigest: event.id.txDigest,
304
+ });
305
+ }
306
+ if (event.parsedJson.log[6] > 0) {
307
+ // harvest
308
+ Action = "Harvest";
309
+ token = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.b_token.name);
310
+ amount = Number(event.parsedJson.log[6]) / Math.pow(10, (0, token_1.assetToDecimal)(token));
311
+ Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
312
+ txHistory.push({
313
+ Index: Index,
314
+ Period: Period,
315
+ Action: Action,
316
+ Amount: Amount,
317
+ Vault: Vault,
318
+ RiskLevel: RiskLevel,
319
+ Tails: Tails,
320
+ Exp: Exp,
321
+ Date: new Date(Number(event.timestampMs)),
322
+ txDigest: event.id.txDigest,
323
+ });
324
+ }
325
+ if (event.parsedJson.log[9] > 0) {
326
+ // claim
327
+ Action = "Claim";
328
+ token = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.d_token.name);
329
+ amount = Number(event.parsedJson.log[9]) / Math.pow(10, (0, token_1.assetToDecimal)(token));
330
+ Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
331
+ txHistory.push({
332
+ Index: Index,
333
+ Period: Period,
334
+ Action: Action,
335
+ Amount: Amount,
336
+ Vault: Vault,
337
+ RiskLevel: RiskLevel,
338
+ Tails: Tails,
339
+ Exp: Exp,
340
+ Date: new Date(Number(event.timestampMs)),
341
+ txDigest: event.id.txDigest,
342
+ });
343
+ }
344
+ if (event.parsedJson.log[10] > 0) {
345
+ // redeem
346
+ Action = "Redeem";
347
+ token = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.i_token.name);
348
+ amount = Number(event.parsedJson.log[10]) / Math.pow(10, (0, token_1.assetToDecimal)(token));
349
+ Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
350
+ txHistory.push({
351
+ Index: Index,
352
+ Period: Period,
353
+ Action: Action,
354
+ Amount: Amount,
355
+ Vault: Vault,
356
+ RiskLevel: RiskLevel,
357
+ Tails: Tails,
358
+ Exp: Exp,
359
+ Date: new Date(Number(event.timestampMs)),
360
+ txDigest: event.id.txDigest,
361
+ });
362
+ }
363
+ return [2 /*return*/, txHistory];
248
364
  case "NewStrategyEventV2":
249
365
  Action = "Create Strategy";
250
366
  deposit_amount = Number(event.parsedJson.deposit_amount) / Math.pow(10, (0, token_1.assetToDecimal)(b_token));
@@ -164,6 +164,11 @@ export interface Bid {
164
164
  tsMs: string;
165
165
  }
166
166
  export declare function getAuctionBids(provider: SuiClient, packageId: string, registry: string, index: string, sender?: string): Promise<Bid[]>;
167
+ export interface DepositSnapshot {
168
+ snapshots: string[];
169
+ totalDeposit: string;
170
+ snapshotTsMs: string;
171
+ }
167
172
  export interface DepositShare {
168
173
  index: string;
169
174
  activeSubVaultUserShare: string;
@@ -173,8 +178,17 @@ export interface DepositShare {
173
178
  premiumSubVaultUserShare: string;
174
179
  incentiveShare: string;
175
180
  }
176
- export declare function getDepositShares(provider: SuiClient, typusFrameworkPackageId: string, packageId: string, registry: string, receipts: string[], sender?: string): Promise<{
177
- [key: string]: DepositShare;
181
+ export interface RRR {
182
+ a: {
183
+ [key: string]: DepositShare;
184
+ };
185
+ b: DepositSnapshot;
186
+ }
187
+ export declare function getDepositShares(provider: SuiClient, typusFrameworkPackageId: string, packageId: string, registry: string, receipts: string[], user: string, sender?: string): Promise<{
188
+ depositShare: {
189
+ [key: string]: DepositShare;
190
+ };
191
+ depositSnapshot: DepositSnapshot;
178
192
  }>;
179
193
  export interface BidVault {
180
194
  id: string;
@@ -398,9 +398,9 @@ function getAuctionBids(provider_1, packageId_1, registry_1, index_1) {
398
398
  });
399
399
  }
400
400
  exports.getAuctionBids = getAuctionBids;
401
- function getDepositShares(provider_1, typusFrameworkPackageId_1, packageId_1, registry_1, receipts_1) {
402
- return __awaiter(this, arguments, void 0, function (provider, typusFrameworkPackageId, packageId, registry, receipts, sender) {
403
- var transactionBlock, target, transactionBlockArguments, results, bytes, reader, result;
401
+ function getDepositShares(provider_1, typusFrameworkPackageId_1, packageId_1, registry_1, receipts_1, user_1) {
402
+ return __awaiter(this, arguments, void 0, function (provider, typusFrameworkPackageId, packageId, registry, receipts, user, sender) {
403
+ var transactionBlock, target, transactionBlockArguments, results, bytes, reader, depositShare, depositSnapshot;
404
404
  if (sender === void 0) { sender = exports.SENDER; }
405
405
  return __generator(this, function (_a) {
406
406
  switch (_a.label) {
@@ -413,6 +413,7 @@ function getDepositShares(provider_1, typusFrameworkPackageId_1, packageId_1, re
413
413
  type: "".concat(typusFrameworkPackageId, "::vault::TypusDepositReceipt"),
414
414
  objects: receipts.map(function (id) { return transactionBlock.object(id); }),
415
415
  }),
416
+ transactionBlock.pure(user),
416
417
  ];
417
418
  transactionBlock.moveCall({
418
419
  target: target,
@@ -424,32 +425,46 @@ function getDepositShares(provider_1, typusFrameworkPackageId_1, packageId_1, re
424
425
  results = (_a.sent()).results;
425
426
  bytes = results[results.length - 1].returnValues[0][0];
426
427
  reader = new bcs_1.BcsReader(new Uint8Array(bytes));
427
- result = Array.from(new Map()).reduce(function (map, _a) {
428
+ depositShare = Array.from(new Map()).reduce(function (map, _a) {
428
429
  var _b = __read(_a, 2), key = _b[0], value = _b[1];
429
430
  map[key] = value;
430
431
  return map;
431
432
  }, {});
433
+ depositSnapshot = {};
434
+ // console.log(bytes);
432
435
  reader.readVec(function (reader, i) {
433
- reader.read8();
434
- var index = reader.read64();
435
- var activeSubVaultUserShare = reader.read64();
436
- var deactivatingSubVaultUserShare = reader.read64();
437
- var inactiveSubVaultUserShare = reader.read64();
438
- var warmupSubVaultUserShare = reader.read64();
439
- var premiumSubVaultUserShare = reader.read64();
440
- var incentiveShare = reader.read64();
441
- result[index] = {
442
- index: index,
443
- activeSubVaultUserShare: activeSubVaultUserShare,
444
- deactivatingSubVaultUserShare: deactivatingSubVaultUserShare,
445
- inactiveSubVaultUserShare: inactiveSubVaultUserShare,
446
- warmupSubVaultUserShare: warmupSubVaultUserShare,
447
- premiumSubVaultUserShare: premiumSubVaultUserShare,
448
- incentiveShare: incentiveShare,
449
- };
436
+ if (i == 0) {
437
+ reader.readULEB();
438
+ depositSnapshot = {
439
+ snapshots: reader.readVec(function (reader) {
440
+ return reader.read64();
441
+ }),
442
+ totalDeposit: reader.read64(),
443
+ snapshotTsMs: reader.read64(),
444
+ };
445
+ }
446
+ else {
447
+ reader.readULEB();
448
+ var index = reader.read64();
449
+ var activeSubVaultUserShare = reader.read64();
450
+ var deactivatingSubVaultUserShare = reader.read64();
451
+ var inactiveSubVaultUserShare = reader.read64();
452
+ var warmupSubVaultUserShare = reader.read64();
453
+ var premiumSubVaultUserShare = reader.read64();
454
+ var incentiveShare = reader.read64();
455
+ depositShare[index] = {
456
+ index: index,
457
+ activeSubVaultUserShare: activeSubVaultUserShare,
458
+ deactivatingSubVaultUserShare: deactivatingSubVaultUserShare,
459
+ inactiveSubVaultUserShare: inactiveSubVaultUserShare,
460
+ warmupSubVaultUserShare: warmupSubVaultUserShare,
461
+ premiumSubVaultUserShare: premiumSubVaultUserShare,
462
+ incentiveShare: incentiveShare,
463
+ };
464
+ }
450
465
  });
451
466
  // @ts-ignore
452
- return [2 /*return*/, result];
467
+ return [2 /*return*/, { depositShare: depositShare, depositSnapshot: depositSnapshot }];
453
468
  }
454
469
  });
455
470
  });
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.91",
5
+ "version": "1.2.93",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.11.1",
8
8
  "@mysten/kiosk": "0.8.10",