@typus/typus-sdk 1.5.5 → 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.
@@ -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 reduce_fund<D_TOKEN>(
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 reduce_fund<D_TOKEN>(
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
- reader.readBytes(32); // id
104
- reader.readBytes(reader.read8()); // element_type
105
- reader.read64(); // slice_idx
106
- reader.read32(); // slice_size
107
- reader.read64(); // length
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,
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",
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",