@typus/typus-sdk 1.5.1 → 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.
- package/dist/src/typus-launch/airdrop/view-function.js +3 -3
- package/dist/src/typus-launch/improvement-proposal/view-function.d.ts +10 -0
- package/dist/src/typus-launch/improvement-proposal/view-function.js +49 -9
- package/dist/src/typus-launch/ve-typus/view-function.js +3 -3
- package/package.json +1 -1
|
@@ -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:
|
|
@@ -61,8 +61,8 @@ function getAirdrop(config, input) {
|
|
|
61
61
|
});
|
|
62
62
|
return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transaction })];
|
|
63
63
|
case 1:
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
devInspectTransactionBlockResult = _a.sent();
|
|
65
|
+
bytes = devInspectTransactionBlockResult.results[0].returnValues[0][0];
|
|
66
66
|
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
67
67
|
reader.readULEB();
|
|
68
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");
|
|
@@ -123,7 +124,7 @@ function getOngoingTips(config, input) {
|
|
|
123
124
|
*/
|
|
124
125
|
function getEndedTips(config) {
|
|
125
126
|
return __awaiter(this, void 0, void 0, function () {
|
|
126
|
-
var provider, transaction, bytes, reader;
|
|
127
|
+
var provider, transaction, devInspectTransactionBlockResult, bytes, reader;
|
|
127
128
|
return __generator(this, function (_a) {
|
|
128
129
|
switch (_a.label) {
|
|
129
130
|
case 0:
|
|
@@ -135,8 +136,8 @@ function getEndedTips(config) {
|
|
|
135
136
|
});
|
|
136
137
|
return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transaction })];
|
|
137
138
|
case 1:
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
devInspectTransactionBlockResult = _a.sent();
|
|
140
|
+
bytes = devInspectTransactionBlockResult.results[0].returnValues[0][0];
|
|
140
141
|
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
141
142
|
reader.readULEB();
|
|
142
143
|
return [2 /*return*/, reader.readVec(function (reader) {
|
|
@@ -187,7 +188,7 @@ function getEndedTips(config) {
|
|
|
187
188
|
*/
|
|
188
189
|
function getOngoingTipVotes(config, input) {
|
|
189
190
|
return __awaiter(this, void 0, void 0, function () {
|
|
190
|
-
var provider, transaction, bytes, reader;
|
|
191
|
+
var provider, transaction, devInspectTransactionBlockResult, bytes, reader;
|
|
191
192
|
return __generator(this, function (_a) {
|
|
192
193
|
switch (_a.label) {
|
|
193
194
|
case 0:
|
|
@@ -199,14 +200,15 @@ function getOngoingTipVotes(config, input) {
|
|
|
199
200
|
});
|
|
200
201
|
return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transaction })];
|
|
201
202
|
case 1:
|
|
202
|
-
|
|
203
|
-
|
|
203
|
+
devInspectTransactionBlockResult = _a.sent();
|
|
204
|
+
bytes = devInspectTransactionBlockResult.results[0].returnValues[0][0];
|
|
204
205
|
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
205
206
|
reader.readULEB();
|
|
206
207
|
return [2 /*return*/, reader.readVec(function (reader) {
|
|
207
208
|
reader.readULEB();
|
|
208
209
|
return {
|
|
209
210
|
index: reader.read64(),
|
|
211
|
+
user: input.user,
|
|
210
212
|
yes: reader.read64(),
|
|
211
213
|
no: reader.read64(),
|
|
212
214
|
};
|
|
@@ -223,7 +225,7 @@ function getOngoingTipVotes(config, input) {
|
|
|
223
225
|
*/
|
|
224
226
|
function getEndedTipVotes(config, input) {
|
|
225
227
|
return __awaiter(this, void 0, void 0, function () {
|
|
226
|
-
var provider, transaction, bytes, reader;
|
|
228
|
+
var provider, transaction, devInspectTransactionBlockResult, bytes, reader;
|
|
227
229
|
return __generator(this, function (_a) {
|
|
228
230
|
switch (_a.label) {
|
|
229
231
|
case 0:
|
|
@@ -235,14 +237,52 @@ function getEndedTipVotes(config, input) {
|
|
|
235
237
|
});
|
|
236
238
|
return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transaction })];
|
|
237
239
|
case 1:
|
|
238
|
-
|
|
239
|
-
|
|
240
|
+
devInspectTransactionBlockResult = _a.sent();
|
|
241
|
+
bytes = devInspectTransactionBlockResult.results[0].returnValues[0][0];
|
|
240
242
|
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
241
243
|
reader.readULEB();
|
|
242
244
|
return [2 /*return*/, reader.readVec(function (reader) {
|
|
243
245
|
reader.readULEB();
|
|
244
246
|
return {
|
|
245
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)),
|
|
246
286
|
yes: reader.read64(),
|
|
247
287
|
no: reader.read64(),
|
|
248
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:
|
|
@@ -57,8 +57,8 @@ function getVeTypus(config, input) {
|
|
|
57
57
|
});
|
|
58
58
|
return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transaction })];
|
|
59
59
|
case 1:
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
devInspectTransactionBlockResult = _a.sent();
|
|
61
|
+
bytes = devInspectTransactionBlockResult.results[0].returnValues[0][0];
|
|
62
62
|
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
63
63
|
reader.readULEB();
|
|
64
64
|
return [2 /*return*/, reader.readVec(function (reader) {
|