@typus/typus-sdk 1.5.0 → 1.5.2

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,2 +1,3 @@
1
+ export * from "./bidding";
1
2
  export * from "./token";
2
3
  export * from "./vault";
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- // export * from "./bidding";
17
+ __exportStar(require("./bidding"), exports);
18
18
  __exportStar(require("./token"), exports);
19
19
  __exportStar(require("./vault"), exports);
@@ -49,7 +49,7 @@ var constants_1 = require("../../../src/constants");
49
49
  */
50
50
  function getAirdrop(config, input) {
51
51
  return __awaiter(this, void 0, void 0, function () {
52
- var provider, transaction, bytes, reader;
52
+ var provider, transaction, devInspectTransactionBlockResult, bytes, reader;
53
53
  return __generator(this, function (_a) {
54
54
  switch (_a.label) {
55
55
  case 0:
@@ -59,9 +59,10 @@ function getAirdrop(config, input) {
59
59
  target: "".concat(config.package.launch.airdrop, "::airdrop::get_airdrop_bcs"),
60
60
  arguments: [transaction.object(config.registry.launch.airdrop), transaction.pure.address(input.user)],
61
61
  });
62
- return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transaction: transaction })];
62
+ return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transaction })];
63
63
  case 1:
64
- bytes = (_a.sent()).results[0].returnValues[0][0];
64
+ devInspectTransactionBlockResult = _a.sent();
65
+ bytes = devInspectTransactionBlockResult.results[0].returnValues[0][0];
65
66
  reader = new bcs_1.BcsReader(new Uint8Array(bytes));
66
67
  reader.readULEB();
67
68
  return [2 /*return*/, reader.readVec(function (reader) {
@@ -31,6 +31,7 @@ export declare function getOngoingTips(config: TypusConfig, input: {
31
31
  export declare function getEndedTips(config: TypusConfig): Promise<Tip[]>;
32
32
  export interface Vote {
33
33
  index: string;
34
+ user: string;
34
35
  yes: string;
35
36
  no: string;
36
37
  }
@@ -52,3 +53,12 @@ export declare function getOngoingTipVotes(config: TypusConfig, input: {
52
53
  export declare function getEndedTipVotes(config: TypusConfig, input: {
53
54
  user: string;
54
55
  }): Promise<Vote[]>;
56
+ /**
57
+ public(package) fun get_tip_votes_bcs(
58
+ registry: &Registry,
59
+ index: u64,
60
+ ): vector<u8> {
61
+ */
62
+ export declare function getTipVotes(config: TypusConfig, input: {
63
+ index: string;
64
+ }): Promise<Vote[]>;
@@ -40,6 +40,7 @@ exports.getOngoingTips = getOngoingTips;
40
40
  exports.getEndedTips = getEndedTips;
41
41
  exports.getOngoingTipVotes = getOngoingTipVotes;
42
42
  exports.getEndedTipVotes = getEndedTipVotes;
43
+ exports.getTipVotes = getTipVotes;
43
44
  var transactions_1 = require("@mysten/sui/transactions");
44
45
  var client_1 = require("@mysten/sui/client");
45
46
  var bcs_1 = require("@mysten/bcs");
@@ -54,7 +55,7 @@ var constants_1 = require("../../../src/constants");
54
55
  */
55
56
  function getOngoingTips(config, input) {
56
57
  return __awaiter(this, void 0, void 0, function () {
57
- var provider, transaction, bytes, reader;
58
+ var provider, transaction, results, bytes, reader;
58
59
  return __generator(this, function (_a) {
59
60
  switch (_a.label) {
60
61
  case 0:
@@ -68,9 +69,10 @@ function getOngoingTips(config, input) {
68
69
  transaction.pure.option("address", input.user),
69
70
  ],
70
71
  });
71
- return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transaction: transaction })];
72
+ return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transaction })];
72
73
  case 1:
73
- bytes = (_a.sent()).results[0].returnValues[0][0];
74
+ results = (_a.sent()).results;
75
+ bytes = results[0].returnValues[0][0];
74
76
  reader = new bcs_1.BcsReader(new Uint8Array(bytes));
75
77
  reader.readULEB();
76
78
  return [2 /*return*/, reader.readVec(function (reader) {
@@ -122,7 +124,7 @@ function getOngoingTips(config, input) {
122
124
  */
123
125
  function getEndedTips(config) {
124
126
  return __awaiter(this, void 0, void 0, function () {
125
- var provider, transaction, bytes, reader;
127
+ var provider, transaction, devInspectTransactionBlockResult, bytes, reader;
126
128
  return __generator(this, function (_a) {
127
129
  switch (_a.label) {
128
130
  case 0:
@@ -132,9 +134,10 @@ function getEndedTips(config) {
132
134
  target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::get_ended_tips_bcs"),
133
135
  arguments: [transaction.object(config.registry.launch.improvementProposal)],
134
136
  });
135
- return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transaction: transaction })];
137
+ return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transaction })];
136
138
  case 1:
137
- bytes = (_a.sent()).results[0].returnValues[0][0];
139
+ devInspectTransactionBlockResult = _a.sent();
140
+ bytes = devInspectTransactionBlockResult.results[0].returnValues[0][0];
138
141
  reader = new bcs_1.BcsReader(new Uint8Array(bytes));
139
142
  reader.readULEB();
140
143
  return [2 /*return*/, reader.readVec(function (reader) {
@@ -185,7 +188,7 @@ function getEndedTips(config) {
185
188
  */
186
189
  function getOngoingTipVotes(config, input) {
187
190
  return __awaiter(this, void 0, void 0, function () {
188
- var provider, transaction, bytes, reader;
191
+ var provider, transaction, devInspectTransactionBlockResult, bytes, reader;
189
192
  return __generator(this, function (_a) {
190
193
  switch (_a.label) {
191
194
  case 0:
@@ -195,15 +198,17 @@ function getOngoingTipVotes(config, input) {
195
198
  target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::get_ongoing_tip_votes_bcs"),
196
199
  arguments: [transaction.object(config.registry.launch.improvementProposal), transaction.pure.address(input.user)],
197
200
  });
198
- return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transaction: transaction })];
201
+ return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transaction })];
199
202
  case 1:
200
- bytes = (_a.sent()).results[0].returnValues[0][0];
203
+ devInspectTransactionBlockResult = _a.sent();
204
+ bytes = devInspectTransactionBlockResult.results[0].returnValues[0][0];
201
205
  reader = new bcs_1.BcsReader(new Uint8Array(bytes));
202
206
  reader.readULEB();
203
207
  return [2 /*return*/, reader.readVec(function (reader) {
204
208
  reader.readULEB();
205
209
  return {
206
210
  index: reader.read64(),
211
+ user: input.user,
207
212
  yes: reader.read64(),
208
213
  no: reader.read64(),
209
214
  };
@@ -220,7 +225,7 @@ function getOngoingTipVotes(config, input) {
220
225
  */
221
226
  function getEndedTipVotes(config, input) {
222
227
  return __awaiter(this, void 0, void 0, function () {
223
- var provider, transaction, bytes, reader;
228
+ var provider, transaction, devInspectTransactionBlockResult, bytes, reader;
224
229
  return __generator(this, function (_a) {
225
230
  switch (_a.label) {
226
231
  case 0:
@@ -230,15 +235,54 @@ function getEndedTipVotes(config, input) {
230
235
  target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::get_ended_tip_votes_bcs"),
231
236
  arguments: [transaction.object(config.registry.launch.improvementProposal), transaction.pure.address(input.user)],
232
237
  });
233
- return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transaction: transaction })];
238
+ return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transaction })];
234
239
  case 1:
235
- bytes = (_a.sent()).results[0].returnValues[0][0];
240
+ devInspectTransactionBlockResult = _a.sent();
241
+ bytes = devInspectTransactionBlockResult.results[0].returnValues[0][0];
236
242
  reader = new bcs_1.BcsReader(new Uint8Array(bytes));
237
243
  reader.readULEB();
238
244
  return [2 /*return*/, reader.readVec(function (reader) {
239
245
  reader.readULEB();
240
246
  return {
241
247
  index: reader.read64(),
248
+ user: input.user,
249
+ yes: reader.read64(),
250
+ no: reader.read64(),
251
+ };
252
+ })];
253
+ }
254
+ });
255
+ });
256
+ }
257
+ /**
258
+ public(package) fun get_tip_votes_bcs(
259
+ registry: &Registry,
260
+ index: u64,
261
+ ): vector<u8> {
262
+ */
263
+ function getTipVotes(config, input) {
264
+ return __awaiter(this, void 0, void 0, function () {
265
+ var provider, transaction, devInspectTransactionBlockResult, bytes, reader;
266
+ return __generator(this, function (_a) {
267
+ switch (_a.label) {
268
+ case 0:
269
+ provider = new client_1.SuiClient({ url: config.rpcEndpoint });
270
+ transaction = new transactions_1.Transaction();
271
+ transaction.moveCall({
272
+ target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::get_tip_votes_bcs"),
273
+ arguments: [transaction.object(config.registry.launch.improvementProposal), transaction.pure.u64(input.index)],
274
+ });
275
+ return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transaction })];
276
+ case 1:
277
+ devInspectTransactionBlockResult = _a.sent();
278
+ bytes = devInspectTransactionBlockResult.results[0].returnValues[0][0];
279
+ reader = new bcs_1.BcsReader(new Uint8Array(bytes));
280
+ reader.readULEB();
281
+ return [2 /*return*/, reader.readVec(function (reader) {
282
+ reader.readULEB();
283
+ return {
284
+ index: input.index,
285
+ user: (0, utils_1.AddressFromBytes)(reader.readBytes(32)),
242
286
  yes: reader.read64(),
243
287
  no: reader.read64(),
244
288
  };
@@ -45,7 +45,7 @@ var constants_1 = require("../../../src/constants");
45
45
  var utils_1 = require("../../../src/utils");
46
46
  function getVeTypus(config, input) {
47
47
  return __awaiter(this, void 0, void 0, function () {
48
- var provider, transaction, bytes, reader;
48
+ var provider, transaction, devInspectTransactionBlockResult, bytes, reader;
49
49
  return __generator(this, function (_a) {
50
50
  switch (_a.label) {
51
51
  case 0:
@@ -55,9 +55,10 @@ function getVeTypus(config, input) {
55
55
  target: "".concat(config.package.launch.veTypus, "::ve_typus::get_ve_typus_bcs"),
56
56
  arguments: [transaction.object(config.registry.launch.veTypus), transaction.pure.address(input.user)],
57
57
  });
58
- return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transaction: transaction })];
58
+ return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transaction })];
59
59
  case 1:
60
- bytes = (_a.sent()).results[0].returnValues[0][0];
60
+ devInspectTransactionBlockResult = _a.sent();
61
+ bytes = devInspectTransactionBlockResult.results[0].returnValues[0][0];
61
62
  reader = new bcs_1.BcsReader(new Uint8Array(bytes));
62
63
  reader.readULEB();
63
64
  return [2 /*return*/, reader.readVec(function (reader) {
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.0",
5
+ "version": "1.5.2",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.11.1",
8
8
  "@mysten/kiosk": "0.9.34",