@typus/typus-sdk 1.1.53 → 1.1.55-profit-sharing-fix

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.
@@ -1,3 +1,3 @@
1
1
  import { TransactionBlock } from "@mysten/sui.js/transactions";
2
- export declare function getSetProfitSharingTx(gasBudget: number, packageId: string, registry: string, level_profits: number[], amount: number): Promise<TransactionBlock>;
3
- export declare function getAllocateProfitSharingTx(gasBudget: number, packageId: string, registry: string, users: string[]): Promise<TransactionBlock>;
2
+ export declare function getSetProfitSharingTx(gasBudget: number, packageId: string, registry: string, level_profits: number[], amount: number, coins: string[], typeArguments: string[]): Promise<TransactionBlock>;
3
+ export declare function getAllocateProfitSharingTx(gasBudget: number, packageId: string, registry: string, users: string[], typeArguments: string[]): Promise<TransactionBlock>;
@@ -54,31 +54,46 @@ var __read = (this && this.__read) || function (o, n) {
54
54
  Object.defineProperty(exports, "__esModule", { value: true });
55
55
  exports.getAllocateProfitSharingTx = exports.getSetProfitSharingTx = void 0;
56
56
  var transactions_1 = require("@mysten/sui.js/transactions");
57
- function getSetProfitSharingTx(gasBudget, packageId, registry, level_profits, amount) {
57
+ function getSetProfitSharingTx(gasBudget, packageId, registry, level_profits, amount, coins, typeArguments) {
58
58
  return __awaiter(this, void 0, void 0, function () {
59
- var tx, _a, coin;
60
- return __generator(this, function (_b) {
59
+ var tx, _a, input_coin, coin, _b, input_coin;
60
+ return __generator(this, function (_c) {
61
61
  tx = new transactions_1.TransactionBlock();
62
- _a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), coin = _a[0];
63
- tx.moveCall({
64
- target: "".concat(packageId, "::tails_staking::set_profit_sharing"),
65
- typeArguments: ["0x2::sui::SUI"],
66
- arguments: [tx.object(registry), tx.pure(level_profits), coin],
67
- });
62
+ if (typeArguments[0] == "0x2::sui::SUI" ||
63
+ typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI") {
64
+ _a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), input_coin = _a[0];
65
+ tx.moveCall({
66
+ target: "".concat(packageId, "::tails_staking::set_profit_sharing"),
67
+ typeArguments: typeArguments,
68
+ arguments: [tx.object(registry), tx.pure(level_profits), input_coin],
69
+ });
70
+ }
71
+ else {
72
+ coin = coins.pop();
73
+ if (coins.length > 0) {
74
+ tx.mergeCoins(tx.object(coin), coins.map(function (id) { return tx.object(id); }));
75
+ }
76
+ _b = __read(tx.splitCoins(tx.object(coin), [tx.pure(amount)]), 1), input_coin = _b[0];
77
+ tx.moveCall({
78
+ target: "".concat(packageId, "::tails_staking::set_profit_sharing"),
79
+ typeArguments: typeArguments,
80
+ arguments: [tx.object(registry), tx.pure(level_profits), input_coin],
81
+ });
82
+ }
68
83
  tx.setGasBudget(gasBudget);
69
84
  return [2 /*return*/, tx];
70
85
  });
71
86
  });
72
87
  }
73
88
  exports.getSetProfitSharingTx = getSetProfitSharingTx;
74
- function getAllocateProfitSharingTx(gasBudget, packageId, registry, users) {
89
+ function getAllocateProfitSharingTx(gasBudget, packageId, registry, users, typeArguments) {
75
90
  return __awaiter(this, void 0, void 0, function () {
76
91
  var tx;
77
92
  return __generator(this, function (_a) {
78
93
  tx = new transactions_1.TransactionBlock();
79
94
  tx.moveCall({
80
95
  target: "".concat(packageId, "::tails_staking::allocate_profit_sharing"),
81
- typeArguments: ["0x2::sui::SUI"],
96
+ typeArguments: typeArguments,
82
97
  arguments: [tx.object(registry), tx.pure(users)],
83
98
  });
84
99
  tx.setGasBudget(gasBudget);
@@ -83,4 +83,4 @@ export declare function consumeExpCoinUnstakedTx(gasBudget: number, nftPackageId
83
83
  )
84
84
  */
85
85
  export declare function consumeExpCoinStakedTx(gasBudget: number, nftPackageId: string, typeArguments: string[], registry: string, exp_coins: string[], amount: string): Promise<TransactionBlock>;
86
- export declare function getClaimProfitSharingTx(gasBudget: number, packageId: string, registry: string): Promise<TransactionBlock>;
86
+ export declare function getClaimProfitSharingTx(gasBudget: number, packageId: string, registry: string, typeArguments: string[]): Promise<TransactionBlock>;
@@ -495,14 +495,14 @@ function consumeExpCoinStakedTx(gasBudget, nftPackageId, typeArguments, registry
495
495
  });
496
496
  }
497
497
  exports.consumeExpCoinStakedTx = consumeExpCoinStakedTx;
498
- function getClaimProfitSharingTx(gasBudget, packageId, registry) {
498
+ function getClaimProfitSharingTx(gasBudget, packageId, registry, typeArguments) {
499
499
  return __awaiter(this, void 0, void 0, function () {
500
500
  var tx;
501
501
  return __generator(this, function (_a) {
502
502
  tx = new transactions_1.TransactionBlock();
503
503
  tx.moveCall({
504
504
  target: "".concat(packageId, "::tails_staking::claim_profit_sharing"),
505
- typeArguments: ["0x2::sui::SUI"],
505
+ typeArguments: typeArguments,
506
506
  arguments: [tx.object(registry)],
507
507
  });
508
508
  tx.setGasBudget(gasBudget);
@@ -24,6 +24,10 @@ function typeArgToAsset(typeArg) {
24
24
  return "TURBOS";
25
25
  case "0x3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37":
26
26
  return "APT";
27
+ case "0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1":
28
+ return "FUD";
29
+ case "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc":
30
+ return "AFSUI";
27
31
  default:
28
32
  if (typeArgs[2] == "BTC") {
29
33
  return "WBTC";
package/package.json CHANGED
@@ -2,11 +2,11 @@
2
2
  "name": "@typus/typus-sdk",
3
3
  "author": "Typus",
4
4
  "description": "typus sdk",
5
- "version": "1.1.53",
5
+ "version": "1.1.55-profit-sharing-fix",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.7.3",
8
- "@mysten/kiosk": "0.7.13",
9
- "@mysten/sui.js": "^0.48.1",
8
+ "@mysten/kiosk": "0.7.12",
9
+ "@mysten/sui.js": "0.48.0",
10
10
  "@types/node": "^20.5.7",
11
11
  "aftermath-ts-sdk": "^1.1.14",
12
12
  "bignumber.js": "^9.1.1",