@typus/typus-sdk 1.4.82 → 1.4.83
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/constants/token.js +3 -0
- package/dist/src/typus-launch/airdrop/authority-entry.d.ts +33 -0
- package/dist/src/typus-launch/airdrop/authority-entry.js +117 -0
- package/dist/src/typus-launch/airdrop/index.d.ts +3 -0
- package/dist/src/typus-launch/airdrop/index.js +19 -0
- package/dist/src/typus-launch/airdrop/user-entry.d.ts +16 -0
- package/dist/src/typus-launch/airdrop/user-entry.js +24 -0
- package/dist/src/typus-launch/airdrop/view-function.d.ts +15 -0
- package/dist/src/typus-launch/airdrop/view-function.js +78 -0
- package/dist/src/typus-launch/improvement-proposal/authority-entry.d.ts +119 -0
- package/dist/src/typus-launch/improvement-proposal/authority-entry.js +227 -0
- package/dist/src/typus-launch/improvement-proposal/index.d.ts +3 -0
- package/dist/src/typus-launch/improvement-proposal/index.js +19 -0
- package/dist/src/typus-launch/improvement-proposal/user-entry.d.ts +27 -0
- package/dist/src/typus-launch/improvement-proposal/user-entry.js +49 -0
- package/dist/src/typus-launch/improvement-proposal/view-function.d.ts +49 -0
- package/dist/src/typus-launch/improvement-proposal/view-function.js +241 -0
- package/dist/src/utils/typusConfig.d.ts +9 -2
- package/dist/src/utils/typusConfig.js +28 -1
- package/package.json +1 -1
|
@@ -41,6 +41,8 @@ function typeArgToAsset(typeArg) {
|
|
|
41
41
|
return "HIPPO";
|
|
42
42
|
case "0x83556891f4a0f233ce7b05cfe7f957d4020492a34f5405b2cb9377d060bef4bf":
|
|
43
43
|
return "sSUI";
|
|
44
|
+
case "0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e":
|
|
45
|
+
return "sSCA";
|
|
44
46
|
case "0x949572061c09bbedef3ac4ffc42e58632291616f0605117cec86d840e09bf519":
|
|
45
47
|
if (typeArgs[1] === "usdc") {
|
|
46
48
|
return "wUSDC";
|
|
@@ -79,6 +81,7 @@ function assetToDecimal(asset) {
|
|
|
79
81
|
case "HIPPO":
|
|
80
82
|
case "TYPUS":
|
|
81
83
|
case "BLUE":
|
|
84
|
+
case "sSCA":
|
|
82
85
|
return 9;
|
|
83
86
|
case "BTC":
|
|
84
87
|
case "WBTC":
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
+
import { TypusConfig } from "../../../src/utils";
|
|
3
|
+
/**
|
|
4
|
+
entry fun set_airdrop<TOKEN>(
|
|
5
|
+
version: &Version,
|
|
6
|
+
registry: &mut Registry,
|
|
7
|
+
key: String,
|
|
8
|
+
coin: Coin<TOKEN>,
|
|
9
|
+
users: vector<address>,
|
|
10
|
+
values: vector<u64>,
|
|
11
|
+
ctx: &mut TxContext,
|
|
12
|
+
) {
|
|
13
|
+
*/
|
|
14
|
+
export declare function setAirdrop(config: TypusConfig, tx: TransactionBlock, input: {
|
|
15
|
+
typeArguments: string[];
|
|
16
|
+
key: string;
|
|
17
|
+
coins: string[];
|
|
18
|
+
amount: string;
|
|
19
|
+
users: string[];
|
|
20
|
+
values: string[];
|
|
21
|
+
}): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
entry fun remove_airdrop<TOKEN>(
|
|
24
|
+
version: &Version,
|
|
25
|
+
registry: &mut Registry,
|
|
26
|
+
key: String,
|
|
27
|
+
ctx: &mut TxContext,
|
|
28
|
+
) {
|
|
29
|
+
*/
|
|
30
|
+
export declare function removeAirdrop(config: TypusConfig, tx: TransactionBlock, input: {
|
|
31
|
+
typeArguments: string[];
|
|
32
|
+
key: string;
|
|
33
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
39
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
40
|
+
if (!m) return o;
|
|
41
|
+
var i = m.call(o), r, ar = [], e;
|
|
42
|
+
try {
|
|
43
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
44
|
+
}
|
|
45
|
+
catch (error) { e = { error: error }; }
|
|
46
|
+
finally {
|
|
47
|
+
try {
|
|
48
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
49
|
+
}
|
|
50
|
+
finally { if (e) throw e.error; }
|
|
51
|
+
}
|
|
52
|
+
return ar;
|
|
53
|
+
};
|
|
54
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
+
exports.setAirdrop = setAirdrop;
|
|
56
|
+
exports.removeAirdrop = removeAirdrop;
|
|
57
|
+
var structs_1 = require("../../../src/_dependencies/source/0x2/sui/structs");
|
|
58
|
+
/**
|
|
59
|
+
entry fun set_airdrop<TOKEN>(
|
|
60
|
+
version: &Version,
|
|
61
|
+
registry: &mut Registry,
|
|
62
|
+
key: String,
|
|
63
|
+
coin: Coin<TOKEN>,
|
|
64
|
+
users: vector<address>,
|
|
65
|
+
values: vector<u64>,
|
|
66
|
+
ctx: &mut TxContext,
|
|
67
|
+
) {
|
|
68
|
+
*/
|
|
69
|
+
function setAirdrop(config, tx, input) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
+
var _a, coin;
|
|
72
|
+
return __generator(this, function (_b) {
|
|
73
|
+
_a = __read((0, structs_1.isSUI)(input.typeArguments[0])
|
|
74
|
+
? tx.splitCoins(tx.gas, [tx.pure(input.amount)])
|
|
75
|
+
: (function () {
|
|
76
|
+
var coin = input.coins.pop();
|
|
77
|
+
if (input.coins.length > 0) {
|
|
78
|
+
tx.mergeCoins(tx.object(coin), input.coins.map(function (id) { return tx.object(id); }));
|
|
79
|
+
}
|
|
80
|
+
return tx.splitCoins(tx.object(coin), [tx.pure(input.amount)]);
|
|
81
|
+
})(), 1), coin = _a[0];
|
|
82
|
+
tx.moveCall({
|
|
83
|
+
target: "".concat(config.package.launch.airdrop, "::airdrop::set_airdrop"),
|
|
84
|
+
typeArguments: input.typeArguments,
|
|
85
|
+
arguments: [
|
|
86
|
+
tx.object(config.version.launch.airdrop),
|
|
87
|
+
tx.object(config.registry.launch.airdrop),
|
|
88
|
+
tx.pure(input.key),
|
|
89
|
+
tx.object(coin),
|
|
90
|
+
tx.pure(input.users),
|
|
91
|
+
tx.pure(input.values),
|
|
92
|
+
],
|
|
93
|
+
});
|
|
94
|
+
return [2 /*return*/];
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
entry fun remove_airdrop<TOKEN>(
|
|
100
|
+
version: &Version,
|
|
101
|
+
registry: &mut Registry,
|
|
102
|
+
key: String,
|
|
103
|
+
ctx: &mut TxContext,
|
|
104
|
+
) {
|
|
105
|
+
*/
|
|
106
|
+
function removeAirdrop(config, tx, input) {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
108
|
+
return __generator(this, function (_a) {
|
|
109
|
+
tx.moveCall({
|
|
110
|
+
target: "".concat(config.package.launch.airdrop, "::airdrop::remove_airdrop"),
|
|
111
|
+
typeArguments: input.typeArguments,
|
|
112
|
+
arguments: [tx.object(config.version.launch.airdrop), tx.object(config.registry.launch.airdrop), tx.pure(input.key)],
|
|
113
|
+
});
|
|
114
|
+
return [2 /*return*/];
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./authority-entry"), exports);
|
|
18
|
+
__exportStar(require("./user-entry"), exports);
|
|
19
|
+
__exportStar(require("./view-function"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
+
import { TypusConfig } from "../../../src/utils";
|
|
3
|
+
/**
|
|
4
|
+
entry fun claim_airdrop<TOKEN>(
|
|
5
|
+
version: &Version,
|
|
6
|
+
registry: &mut Registry,
|
|
7
|
+
key: String,
|
|
8
|
+
recipient: address,
|
|
9
|
+
ctx: &mut TxContext,
|
|
10
|
+
) {
|
|
11
|
+
*/
|
|
12
|
+
export declare function claimAirdrop(config: TypusConfig, tx: TransactionBlock, input: {
|
|
13
|
+
typeArguments: string[];
|
|
14
|
+
key: string;
|
|
15
|
+
recipient: string;
|
|
16
|
+
}): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.claimAirdrop = claimAirdrop;
|
|
4
|
+
/**
|
|
5
|
+
entry fun claim_airdrop<TOKEN>(
|
|
6
|
+
version: &Version,
|
|
7
|
+
registry: &mut Registry,
|
|
8
|
+
key: String,
|
|
9
|
+
recipient: address,
|
|
10
|
+
ctx: &mut TxContext,
|
|
11
|
+
) {
|
|
12
|
+
*/
|
|
13
|
+
function claimAirdrop(config, tx, input) {
|
|
14
|
+
tx.moveCall({
|
|
15
|
+
target: "".concat(config.package.launch.airdrop, "::airdrop::claim_airdrop"),
|
|
16
|
+
typeArguments: input.typeArguments,
|
|
17
|
+
arguments: [
|
|
18
|
+
tx.object(config.version.launch.airdrop),
|
|
19
|
+
tx.object(config.registry.launch.airdrop),
|
|
20
|
+
tx.pure(input.key),
|
|
21
|
+
tx.pure(input.recipient),
|
|
22
|
+
],
|
|
23
|
+
});
|
|
24
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TypusConfig } from "../../../src/utils";
|
|
2
|
+
export interface Airdrop {
|
|
3
|
+
key: string;
|
|
4
|
+
token: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
public(package) fun get_airdrop_bcs(
|
|
9
|
+
registry: &Registry,
|
|
10
|
+
user: address,
|
|
11
|
+
): vector<u8> {
|
|
12
|
+
*/
|
|
13
|
+
export declare function getAirdrop(config: TypusConfig, input: {
|
|
14
|
+
user: string;
|
|
15
|
+
}): Promise<Airdrop[]>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getAirdrop = getAirdrop;
|
|
40
|
+
var transactions_1 = require("@mysten/sui.js/transactions");
|
|
41
|
+
var client_1 = require("@mysten/sui.js/client");
|
|
42
|
+
var bcs_1 = require("@mysten/bcs");
|
|
43
|
+
var constants_1 = require("../../../src/constants");
|
|
44
|
+
/**
|
|
45
|
+
public(package) fun get_airdrop_bcs(
|
|
46
|
+
registry: &Registry,
|
|
47
|
+
user: address,
|
|
48
|
+
): vector<u8> {
|
|
49
|
+
*/
|
|
50
|
+
function getAirdrop(config, input) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
52
|
+
var provider, transactionBlock, bytes, reader;
|
|
53
|
+
return __generator(this, function (_a) {
|
|
54
|
+
switch (_a.label) {
|
|
55
|
+
case 0:
|
|
56
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
57
|
+
transactionBlock = new transactions_1.TransactionBlock();
|
|
58
|
+
transactionBlock.moveCall({
|
|
59
|
+
target: "".concat(config.package.launch.airdrop, "::airdrop::get_airdrop_bcs"),
|
|
60
|
+
arguments: [transactionBlock.pure(config.registry.launch.airdrop), transactionBlock.pure(input.user)],
|
|
61
|
+
});
|
|
62
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transactionBlock })];
|
|
63
|
+
case 1:
|
|
64
|
+
bytes = (_a.sent()).results[0].returnValues[0][0];
|
|
65
|
+
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
66
|
+
reader.readULEB();
|
|
67
|
+
return [2 /*return*/, reader.readVec(function (reader) {
|
|
68
|
+
reader.readULEB();
|
|
69
|
+
return {
|
|
70
|
+
key: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8()))),
|
|
71
|
+
token: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8()))),
|
|
72
|
+
value: reader.read64(),
|
|
73
|
+
};
|
|
74
|
+
})];
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
+
import { TypusConfig } from "../../../src/utils";
|
|
3
|
+
/**
|
|
4
|
+
entry fun new_tip(
|
|
5
|
+
version: &Version,
|
|
6
|
+
registry: &mut Registry,
|
|
7
|
+
description: String,
|
|
8
|
+
image_url: String,
|
|
9
|
+
proposal: String,
|
|
10
|
+
config: vector<u64>,
|
|
11
|
+
ctx: &mut TxContext,
|
|
12
|
+
) {
|
|
13
|
+
*/
|
|
14
|
+
export declare function newTip(config: TypusConfig, tx: TransactionBlock, input: {
|
|
15
|
+
description: string;
|
|
16
|
+
image_url: string;
|
|
17
|
+
proposal: string;
|
|
18
|
+
config: string[];
|
|
19
|
+
}): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
entry fun update_registry_setting(
|
|
22
|
+
version: &Version,
|
|
23
|
+
registry: &mut Registry,
|
|
24
|
+
setting_index: u64,
|
|
25
|
+
value: u64,
|
|
26
|
+
ctx: &TxContext,
|
|
27
|
+
) {
|
|
28
|
+
*/
|
|
29
|
+
export declare function updateRegistrySetting(config: TypusConfig, tx: TransactionBlock, input: {
|
|
30
|
+
settingIndex: string;
|
|
31
|
+
value: string;
|
|
32
|
+
}): void;
|
|
33
|
+
/**
|
|
34
|
+
entry fun update_display(
|
|
35
|
+
version: &Version,
|
|
36
|
+
registry: &mut Registry,
|
|
37
|
+
index: u64,
|
|
38
|
+
description: Option<String>,
|
|
39
|
+
image_url: Option<String>,
|
|
40
|
+
proposal: Option<String>,
|
|
41
|
+
ctx: &TxContext,
|
|
42
|
+
) {
|
|
43
|
+
*/
|
|
44
|
+
export declare function updateDisplay(config: TypusConfig, tx: TransactionBlock, input: {
|
|
45
|
+
index: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
image_url?: string;
|
|
48
|
+
proposal?: string;
|
|
49
|
+
}): void;
|
|
50
|
+
/**
|
|
51
|
+
entry fun update_info(
|
|
52
|
+
version: &Version,
|
|
53
|
+
registry: &mut Registry,
|
|
54
|
+
index: u64,
|
|
55
|
+
info_index: u64,
|
|
56
|
+
value: u64,
|
|
57
|
+
ctx: &TxContext,
|
|
58
|
+
) {
|
|
59
|
+
*/
|
|
60
|
+
export declare function updateInfo(config: TypusConfig, tx: TransactionBlock, input: {
|
|
61
|
+
index: string;
|
|
62
|
+
infoIndex: string;
|
|
63
|
+
value: string;
|
|
64
|
+
}): void;
|
|
65
|
+
/**
|
|
66
|
+
entry fun update_config(
|
|
67
|
+
version: &Version,
|
|
68
|
+
registry: &mut Registry,
|
|
69
|
+
index: u64,
|
|
70
|
+
config_index: u64,
|
|
71
|
+
value: u64,
|
|
72
|
+
ctx: &TxContext,
|
|
73
|
+
) {
|
|
74
|
+
*/
|
|
75
|
+
export declare function updateConfig(config: TypusConfig, tx: TransactionBlock, input: {
|
|
76
|
+
index: string;
|
|
77
|
+
configIndex: string;
|
|
78
|
+
value: string;
|
|
79
|
+
}): void;
|
|
80
|
+
/**
|
|
81
|
+
entry fun set_reward<TOKEN>(
|
|
82
|
+
version: &Version,
|
|
83
|
+
registry: &mut Registry,
|
|
84
|
+
index: u64,
|
|
85
|
+
amount: u64,
|
|
86
|
+
ctx: &TxContext,
|
|
87
|
+
) {
|
|
88
|
+
*/
|
|
89
|
+
export declare function setReward(config: TypusConfig, tx: TransactionBlock, input: {
|
|
90
|
+
typeArguments: string[];
|
|
91
|
+
index: string;
|
|
92
|
+
amount: string;
|
|
93
|
+
}): void;
|
|
94
|
+
/**
|
|
95
|
+
entry fun remove_reward(
|
|
96
|
+
version: &Version,
|
|
97
|
+
registry: &mut Registry,
|
|
98
|
+
index: u64,
|
|
99
|
+
reward_index: u64,
|
|
100
|
+
ctx: &TxContext,
|
|
101
|
+
) {
|
|
102
|
+
*/
|
|
103
|
+
export declare function removeReward(config: TypusConfig, tx: TransactionBlock, input: {
|
|
104
|
+
index: string;
|
|
105
|
+
rewardIndex: string;
|
|
106
|
+
}): void;
|
|
107
|
+
/**
|
|
108
|
+
entry fun count_votes(
|
|
109
|
+
version: &Version,
|
|
110
|
+
registry: &mut Registry,
|
|
111
|
+
index: u64,
|
|
112
|
+
ve_typus_registry: &VeTypusRegistry,
|
|
113
|
+
clock: &Clock,
|
|
114
|
+
ctx: &TxContext,
|
|
115
|
+
) {
|
|
116
|
+
*/
|
|
117
|
+
export declare function countVotes(config: TypusConfig, tx: TransactionBlock, input: {
|
|
118
|
+
index: string;
|
|
119
|
+
}): void;
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.newTip = newTip;
|
|
40
|
+
exports.updateRegistrySetting = updateRegistrySetting;
|
|
41
|
+
exports.updateDisplay = updateDisplay;
|
|
42
|
+
exports.updateInfo = updateInfo;
|
|
43
|
+
exports.updateConfig = updateConfig;
|
|
44
|
+
exports.setReward = setReward;
|
|
45
|
+
exports.removeReward = removeReward;
|
|
46
|
+
exports.countVotes = countVotes;
|
|
47
|
+
var constants_1 = require("../../../src/constants");
|
|
48
|
+
/**
|
|
49
|
+
entry fun new_tip(
|
|
50
|
+
version: &Version,
|
|
51
|
+
registry: &mut Registry,
|
|
52
|
+
description: String,
|
|
53
|
+
image_url: String,
|
|
54
|
+
proposal: String,
|
|
55
|
+
config: vector<u64>,
|
|
56
|
+
ctx: &mut TxContext,
|
|
57
|
+
) {
|
|
58
|
+
*/
|
|
59
|
+
function newTip(config, tx, input) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
61
|
+
return __generator(this, function (_a) {
|
|
62
|
+
tx.moveCall({
|
|
63
|
+
target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::new_tip"),
|
|
64
|
+
arguments: [
|
|
65
|
+
tx.object(config.version.launch.improvementProposal),
|
|
66
|
+
tx.object(config.registry.launch.improvementProposal),
|
|
67
|
+
tx.pure(input.description),
|
|
68
|
+
tx.pure(input.image_url),
|
|
69
|
+
tx.pure(input.proposal),
|
|
70
|
+
tx.pure(input.config),
|
|
71
|
+
],
|
|
72
|
+
});
|
|
73
|
+
return [2 /*return*/];
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
entry fun update_registry_setting(
|
|
79
|
+
version: &Version,
|
|
80
|
+
registry: &mut Registry,
|
|
81
|
+
setting_index: u64,
|
|
82
|
+
value: u64,
|
|
83
|
+
ctx: &TxContext,
|
|
84
|
+
) {
|
|
85
|
+
*/
|
|
86
|
+
function updateRegistrySetting(config, tx, input) {
|
|
87
|
+
tx.moveCall({
|
|
88
|
+
target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::update_registry_setting"),
|
|
89
|
+
arguments: [
|
|
90
|
+
tx.object(config.version.launch.improvementProposal),
|
|
91
|
+
tx.object(config.registry.launch.improvementProposal),
|
|
92
|
+
tx.pure(input.settingIndex),
|
|
93
|
+
tx.pure(input.value),
|
|
94
|
+
],
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
entry fun update_display(
|
|
99
|
+
version: &Version,
|
|
100
|
+
registry: &mut Registry,
|
|
101
|
+
index: u64,
|
|
102
|
+
description: Option<String>,
|
|
103
|
+
image_url: Option<String>,
|
|
104
|
+
proposal: Option<String>,
|
|
105
|
+
ctx: &TxContext,
|
|
106
|
+
) {
|
|
107
|
+
*/
|
|
108
|
+
function updateDisplay(config, tx, input) {
|
|
109
|
+
tx.moveCall({
|
|
110
|
+
target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::update_display"),
|
|
111
|
+
arguments: [
|
|
112
|
+
tx.object(config.version.launch.improvementProposal),
|
|
113
|
+
tx.object(config.registry.launch.improvementProposal),
|
|
114
|
+
tx.pure(input.index),
|
|
115
|
+
tx.pure(input.description ? [input.description] : []),
|
|
116
|
+
tx.pure(input.image_url ? [input.image_url] : []),
|
|
117
|
+
tx.pure(input.proposal ? [input.proposal] : []),
|
|
118
|
+
],
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
entry fun update_info(
|
|
123
|
+
version: &Version,
|
|
124
|
+
registry: &mut Registry,
|
|
125
|
+
index: u64,
|
|
126
|
+
info_index: u64,
|
|
127
|
+
value: u64,
|
|
128
|
+
ctx: &TxContext,
|
|
129
|
+
) {
|
|
130
|
+
*/
|
|
131
|
+
function updateInfo(config, tx, input) {
|
|
132
|
+
tx.moveCall({
|
|
133
|
+
target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::update_info"),
|
|
134
|
+
arguments: [
|
|
135
|
+
tx.object(config.version.launch.improvementProposal),
|
|
136
|
+
tx.object(config.registry.launch.improvementProposal),
|
|
137
|
+
tx.pure(input.index),
|
|
138
|
+
tx.pure(input.infoIndex),
|
|
139
|
+
tx.pure(input.value),
|
|
140
|
+
],
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
entry fun update_config(
|
|
145
|
+
version: &Version,
|
|
146
|
+
registry: &mut Registry,
|
|
147
|
+
index: u64,
|
|
148
|
+
config_index: u64,
|
|
149
|
+
value: u64,
|
|
150
|
+
ctx: &TxContext,
|
|
151
|
+
) {
|
|
152
|
+
*/
|
|
153
|
+
function updateConfig(config, tx, input) {
|
|
154
|
+
tx.moveCall({
|
|
155
|
+
target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::update_config"),
|
|
156
|
+
arguments: [
|
|
157
|
+
tx.object(config.version.launch.improvementProposal),
|
|
158
|
+
tx.object(config.registry.launch.improvementProposal),
|
|
159
|
+
tx.pure(input.index),
|
|
160
|
+
tx.pure(input.configIndex),
|
|
161
|
+
tx.pure(input.value),
|
|
162
|
+
],
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
entry fun set_reward<TOKEN>(
|
|
167
|
+
version: &Version,
|
|
168
|
+
registry: &mut Registry,
|
|
169
|
+
index: u64,
|
|
170
|
+
amount: u64,
|
|
171
|
+
ctx: &TxContext,
|
|
172
|
+
) {
|
|
173
|
+
*/
|
|
174
|
+
function setReward(config, tx, input) {
|
|
175
|
+
tx.moveCall({
|
|
176
|
+
target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::set_reward"),
|
|
177
|
+
typeArguments: input.typeArguments,
|
|
178
|
+
arguments: [
|
|
179
|
+
tx.object(config.version.launch.improvementProposal),
|
|
180
|
+
tx.object(config.registry.launch.improvementProposal),
|
|
181
|
+
tx.pure(input.index),
|
|
182
|
+
tx.pure(input.amount),
|
|
183
|
+
],
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
entry fun remove_reward(
|
|
188
|
+
version: &Version,
|
|
189
|
+
registry: &mut Registry,
|
|
190
|
+
index: u64,
|
|
191
|
+
reward_index: u64,
|
|
192
|
+
ctx: &TxContext,
|
|
193
|
+
) {
|
|
194
|
+
*/
|
|
195
|
+
function removeReward(config, tx, input) {
|
|
196
|
+
tx.moveCall({
|
|
197
|
+
target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::remove_reward"),
|
|
198
|
+
arguments: [
|
|
199
|
+
tx.object(config.version.launch.improvementProposal),
|
|
200
|
+
tx.object(config.registry.launch.improvementProposal),
|
|
201
|
+
tx.pure(input.index),
|
|
202
|
+
tx.pure(input.rewardIndex),
|
|
203
|
+
],
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
entry fun count_votes(
|
|
208
|
+
version: &Version,
|
|
209
|
+
registry: &mut Registry,
|
|
210
|
+
index: u64,
|
|
211
|
+
ve_typus_registry: &VeTypusRegistry,
|
|
212
|
+
clock: &Clock,
|
|
213
|
+
ctx: &TxContext,
|
|
214
|
+
) {
|
|
215
|
+
*/
|
|
216
|
+
function countVotes(config, tx, input) {
|
|
217
|
+
tx.moveCall({
|
|
218
|
+
target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::count_votes"),
|
|
219
|
+
arguments: [
|
|
220
|
+
tx.object(config.version.launch.improvementProposal),
|
|
221
|
+
tx.object(config.registry.launch.improvementProposal),
|
|
222
|
+
tx.pure(input.index),
|
|
223
|
+
tx.object(config.registry.launch.veTypus),
|
|
224
|
+
tx.object(constants_1.CLOCK),
|
|
225
|
+
],
|
|
226
|
+
});
|
|
227
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./authority-entry"), exports);
|
|
18
|
+
__exportStar(require("./user-entry"), exports);
|
|
19
|
+
__exportStar(require("./view-function"), exports);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
+
import { TypusConfig } from "../../../src/utils";
|
|
3
|
+
/**
|
|
4
|
+
public fun vote(
|
|
5
|
+
version: &Version,
|
|
6
|
+
registry: &mut Registry,
|
|
7
|
+
ve_typus_registry: &VeTypusRegistry,
|
|
8
|
+
index: u64,
|
|
9
|
+
yes: bool,
|
|
10
|
+
clock: &Clock,
|
|
11
|
+
ctx: &TxContext,
|
|
12
|
+
) {
|
|
13
|
+
*/
|
|
14
|
+
export declare function vote(config: TypusConfig, tx: TransactionBlock, input: {
|
|
15
|
+
index: string;
|
|
16
|
+
yes: boolean;
|
|
17
|
+
}): void;
|
|
18
|
+
/**
|
|
19
|
+
public fun update_votes(
|
|
20
|
+
version: &Version,
|
|
21
|
+
registry: &mut Registry,
|
|
22
|
+
ve_typus_registry: &VeTypusRegistry,
|
|
23
|
+
clock: &Clock,
|
|
24
|
+
ctx: &TxContext,
|
|
25
|
+
) {
|
|
26
|
+
*/
|
|
27
|
+
export declare function updateVotes(config: TypusConfig, tx: TransactionBlock): void;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.vote = vote;
|
|
4
|
+
exports.updateVotes = updateVotes;
|
|
5
|
+
var constants_1 = require("../../../src/constants");
|
|
6
|
+
/**
|
|
7
|
+
public fun vote(
|
|
8
|
+
version: &Version,
|
|
9
|
+
registry: &mut Registry,
|
|
10
|
+
ve_typus_registry: &VeTypusRegistry,
|
|
11
|
+
index: u64,
|
|
12
|
+
yes: bool,
|
|
13
|
+
clock: &Clock,
|
|
14
|
+
ctx: &TxContext,
|
|
15
|
+
) {
|
|
16
|
+
*/
|
|
17
|
+
function vote(config, tx, input) {
|
|
18
|
+
tx.moveCall({
|
|
19
|
+
target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::vote"),
|
|
20
|
+
arguments: [
|
|
21
|
+
tx.object(config.version.launch.improvementProposal),
|
|
22
|
+
tx.object(config.registry.launch.improvementProposal),
|
|
23
|
+
tx.object(config.registry.launch.veTypus),
|
|
24
|
+
tx.pure(input.index),
|
|
25
|
+
tx.pure(input.yes),
|
|
26
|
+
tx.object(constants_1.CLOCK),
|
|
27
|
+
],
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
public fun update_votes(
|
|
32
|
+
version: &Version,
|
|
33
|
+
registry: &mut Registry,
|
|
34
|
+
ve_typus_registry: &VeTypusRegistry,
|
|
35
|
+
clock: &Clock,
|
|
36
|
+
ctx: &TxContext,
|
|
37
|
+
) {
|
|
38
|
+
*/
|
|
39
|
+
function updateVotes(config, tx) {
|
|
40
|
+
tx.moveCall({
|
|
41
|
+
target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::update_votes"),
|
|
42
|
+
arguments: [
|
|
43
|
+
tx.object(config.version.launch.improvementProposal),
|
|
44
|
+
tx.object(config.registry.launch.improvementProposal),
|
|
45
|
+
tx.object(config.registry.launch.veTypus),
|
|
46
|
+
tx.object(constants_1.CLOCK),
|
|
47
|
+
],
|
|
48
|
+
});
|
|
49
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { TypusConfig } from "../../../src/utils";
|
|
2
|
+
export interface Tip {
|
|
3
|
+
id: any;
|
|
4
|
+
index: any;
|
|
5
|
+
description: any;
|
|
6
|
+
imageUrl: any;
|
|
7
|
+
proposal: any;
|
|
8
|
+
info: any;
|
|
9
|
+
config: any;
|
|
10
|
+
rewards: any;
|
|
11
|
+
votes: any;
|
|
12
|
+
u64Padding: any;
|
|
13
|
+
bcsPadding: any;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
public(package) fun get_ongoing_tips_bcs(
|
|
17
|
+
registry: &Registry,
|
|
18
|
+
): vector<u8> {
|
|
19
|
+
*/
|
|
20
|
+
export declare function getOngoingTips(config: TypusConfig): Promise<Tip[]>;
|
|
21
|
+
/**
|
|
22
|
+
public(package) fun get_ended_tips_bcs(
|
|
23
|
+
registry: &Registry,
|
|
24
|
+
): vector<u8> {
|
|
25
|
+
*/
|
|
26
|
+
export declare function getEndedTips(config: TypusConfig): Promise<Tip[]>;
|
|
27
|
+
export interface Vote {
|
|
28
|
+
index: string;
|
|
29
|
+
yes: string;
|
|
30
|
+
no: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
public(package) fun get_ongoing_tip_votes_bcs(
|
|
34
|
+
registry: &Registry,
|
|
35
|
+
user: address,
|
|
36
|
+
): vector<u8> {
|
|
37
|
+
*/
|
|
38
|
+
export declare function getOngoingTipVotes(config: TypusConfig, input: {
|
|
39
|
+
user: string;
|
|
40
|
+
}): Promise<Vote[]>;
|
|
41
|
+
/**
|
|
42
|
+
public(package) fun get_ended_tip_votes_bcs(
|
|
43
|
+
registry: &Registry,
|
|
44
|
+
user: address,
|
|
45
|
+
): vector<u8> {
|
|
46
|
+
*/
|
|
47
|
+
export declare function getEndedTipVotes(config: TypusConfig, input: {
|
|
48
|
+
user: string;
|
|
49
|
+
}): Promise<Vote[]>;
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getOngoingTips = getOngoingTips;
|
|
40
|
+
exports.getEndedTips = getEndedTips;
|
|
41
|
+
exports.getOngoingTipVotes = getOngoingTipVotes;
|
|
42
|
+
exports.getEndedTipVotes = getEndedTipVotes;
|
|
43
|
+
var transactions_1 = require("@mysten/sui.js/transactions");
|
|
44
|
+
var client_1 = require("@mysten/sui.js/client");
|
|
45
|
+
var bcs_1 = require("@mysten/bcs");
|
|
46
|
+
var utils_1 = require("../../../src/utils");
|
|
47
|
+
var constants_1 = require("../../../src/constants");
|
|
48
|
+
/**
|
|
49
|
+
public(package) fun get_ongoing_tips_bcs(
|
|
50
|
+
registry: &Registry,
|
|
51
|
+
): vector<u8> {
|
|
52
|
+
*/
|
|
53
|
+
function getOngoingTips(config) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
55
|
+
var provider, transactionBlock, bytes, reader;
|
|
56
|
+
return __generator(this, function (_a) {
|
|
57
|
+
switch (_a.label) {
|
|
58
|
+
case 0:
|
|
59
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
60
|
+
transactionBlock = new transactions_1.TransactionBlock();
|
|
61
|
+
transactionBlock.moveCall({
|
|
62
|
+
target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::get_ongoing_tips_bcs"),
|
|
63
|
+
arguments: [transactionBlock.object(config.registry.launch.improvementProposal)],
|
|
64
|
+
});
|
|
65
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transactionBlock })];
|
|
66
|
+
case 1:
|
|
67
|
+
bytes = (_a.sent()).results[0].returnValues[0][0];
|
|
68
|
+
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
69
|
+
reader.readULEB();
|
|
70
|
+
return [2 /*return*/, reader.readVec(function (reader) {
|
|
71
|
+
reader.readULEB();
|
|
72
|
+
return {
|
|
73
|
+
id: (0, utils_1.AddressFromBytes)(reader.readBytes(32)),
|
|
74
|
+
index: reader.read64(),
|
|
75
|
+
description: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8()))),
|
|
76
|
+
imageUrl: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8()))),
|
|
77
|
+
proposal: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8()))),
|
|
78
|
+
info: reader.readVec(function (reader) {
|
|
79
|
+
return reader.read64();
|
|
80
|
+
}),
|
|
81
|
+
config: reader.readVec(function (reader) {
|
|
82
|
+
return reader.read64();
|
|
83
|
+
}),
|
|
84
|
+
rewards: reader.readVec(function (reader) {
|
|
85
|
+
return {
|
|
86
|
+
token: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8()))),
|
|
87
|
+
amount: reader.read64(),
|
|
88
|
+
};
|
|
89
|
+
}),
|
|
90
|
+
votes: {
|
|
91
|
+
id: (0, utils_1.AddressFromBytes)(reader.readBytes(32)),
|
|
92
|
+
key_type: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8()))),
|
|
93
|
+
value_type: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8()))),
|
|
94
|
+
slice_idx: reader.read16(),
|
|
95
|
+
slice_size: reader.read32(),
|
|
96
|
+
length: reader.read64(),
|
|
97
|
+
},
|
|
98
|
+
u64Padding: reader.readVec(function (reader) {
|
|
99
|
+
return reader.read64();
|
|
100
|
+
}),
|
|
101
|
+
bcsPadding: reader.readVec(function (reader) {
|
|
102
|
+
return reader.read8();
|
|
103
|
+
}),
|
|
104
|
+
};
|
|
105
|
+
})];
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
public(package) fun get_ended_tips_bcs(
|
|
112
|
+
registry: &Registry,
|
|
113
|
+
): vector<u8> {
|
|
114
|
+
*/
|
|
115
|
+
function getEndedTips(config) {
|
|
116
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
117
|
+
var provider, transactionBlock, bytes, reader;
|
|
118
|
+
return __generator(this, function (_a) {
|
|
119
|
+
switch (_a.label) {
|
|
120
|
+
case 0:
|
|
121
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
122
|
+
transactionBlock = new transactions_1.TransactionBlock();
|
|
123
|
+
transactionBlock.moveCall({
|
|
124
|
+
target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::get_ended_tips_bcs"),
|
|
125
|
+
arguments: [transactionBlock.object(config.registry.launch.improvementProposal)],
|
|
126
|
+
});
|
|
127
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transactionBlock })];
|
|
128
|
+
case 1:
|
|
129
|
+
bytes = (_a.sent()).results[0].returnValues[0][0];
|
|
130
|
+
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
131
|
+
reader.readULEB();
|
|
132
|
+
return [2 /*return*/, reader.readVec(function (reader) {
|
|
133
|
+
reader.readULEB();
|
|
134
|
+
return {
|
|
135
|
+
id: (0, utils_1.AddressFromBytes)(reader.readBytes(32)),
|
|
136
|
+
index: reader.read64(),
|
|
137
|
+
description: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8()))),
|
|
138
|
+
imageUrl: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8()))),
|
|
139
|
+
proposal: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8()))),
|
|
140
|
+
info: reader.readVec(function (reader) {
|
|
141
|
+
return reader.read64();
|
|
142
|
+
}),
|
|
143
|
+
config: reader.readVec(function (reader) {
|
|
144
|
+
return reader.read64();
|
|
145
|
+
}),
|
|
146
|
+
rewards: reader.readVec(function (reader) {
|
|
147
|
+
return {
|
|
148
|
+
token: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8()))),
|
|
149
|
+
amount: reader.read64(),
|
|
150
|
+
};
|
|
151
|
+
}),
|
|
152
|
+
votes: {
|
|
153
|
+
id: (0, utils_1.AddressFromBytes)(reader.readBytes(32)),
|
|
154
|
+
key_type: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8()))),
|
|
155
|
+
value_type: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8()))),
|
|
156
|
+
slice_idx: reader.read16(),
|
|
157
|
+
slice_size: reader.read32(),
|
|
158
|
+
length: reader.read64(),
|
|
159
|
+
},
|
|
160
|
+
u64Padding: reader.readVec(function (reader) {
|
|
161
|
+
return reader.read64();
|
|
162
|
+
}),
|
|
163
|
+
bcsPadding: reader.readVec(function (reader) {
|
|
164
|
+
return reader.read8();
|
|
165
|
+
}),
|
|
166
|
+
};
|
|
167
|
+
})];
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
public(package) fun get_ongoing_tip_votes_bcs(
|
|
174
|
+
registry: &Registry,
|
|
175
|
+
user: address,
|
|
176
|
+
): vector<u8> {
|
|
177
|
+
*/
|
|
178
|
+
function getOngoingTipVotes(config, input) {
|
|
179
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
180
|
+
var provider, transactionBlock, bytes, reader;
|
|
181
|
+
return __generator(this, function (_a) {
|
|
182
|
+
switch (_a.label) {
|
|
183
|
+
case 0:
|
|
184
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
185
|
+
transactionBlock = new transactions_1.TransactionBlock();
|
|
186
|
+
transactionBlock.moveCall({
|
|
187
|
+
target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::get_ongoing_tip_votes_bcs"),
|
|
188
|
+
arguments: [transactionBlock.object(config.registry.launch.improvementProposal), transactionBlock.pure(input.user)],
|
|
189
|
+
});
|
|
190
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transactionBlock })];
|
|
191
|
+
case 1:
|
|
192
|
+
bytes = (_a.sent()).results[0].returnValues[0][0];
|
|
193
|
+
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
194
|
+
reader.readULEB();
|
|
195
|
+
return [2 /*return*/, reader.readVec(function (reader) {
|
|
196
|
+
reader.readULEB();
|
|
197
|
+
return {
|
|
198
|
+
index: reader.read64(),
|
|
199
|
+
yes: reader.read64(),
|
|
200
|
+
no: reader.read64(),
|
|
201
|
+
};
|
|
202
|
+
})];
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
public(package) fun get_ended_tip_votes_bcs(
|
|
209
|
+
registry: &Registry,
|
|
210
|
+
user: address,
|
|
211
|
+
): vector<u8> {
|
|
212
|
+
*/
|
|
213
|
+
function getEndedTipVotes(config, input) {
|
|
214
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
215
|
+
var provider, transactionBlock, bytes, reader;
|
|
216
|
+
return __generator(this, function (_a) {
|
|
217
|
+
switch (_a.label) {
|
|
218
|
+
case 0:
|
|
219
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
220
|
+
transactionBlock = new transactions_1.TransactionBlock();
|
|
221
|
+
transactionBlock.moveCall({
|
|
222
|
+
target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::get_ended_tip_votes_bcs"),
|
|
223
|
+
arguments: [transactionBlock.object(config.registry.launch.improvementProposal), transactionBlock.pure(input.user)],
|
|
224
|
+
});
|
|
225
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transactionBlock })];
|
|
226
|
+
case 1:
|
|
227
|
+
bytes = (_a.sent()).results[0].returnValues[0][0];
|
|
228
|
+
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
229
|
+
reader.readULEB();
|
|
230
|
+
return [2 /*return*/, reader.readVec(function (reader) {
|
|
231
|
+
reader.readULEB();
|
|
232
|
+
return {
|
|
233
|
+
index: reader.read64(),
|
|
234
|
+
yes: reader.read64(),
|
|
235
|
+
no: reader.read64(),
|
|
236
|
+
};
|
|
237
|
+
})];
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
}
|
|
@@ -8,6 +8,7 @@ export declare class TypusConfig {
|
|
|
8
8
|
oracle: Oracle;
|
|
9
9
|
token: Token;
|
|
10
10
|
static parse(json: any): TypusConfig;
|
|
11
|
+
static local(path: any): TypusConfig;
|
|
11
12
|
static default(network: "MAINNET" | "TESTNET", customRpcEndpoint: string | null, branch?: string): Promise<TypusConfig>;
|
|
12
13
|
}
|
|
13
14
|
export interface Package {
|
|
@@ -20,9 +21,11 @@ export interface Package {
|
|
|
20
21
|
safu: string;
|
|
21
22
|
typus: string;
|
|
22
23
|
launch: {
|
|
24
|
+
airdrop: string;
|
|
23
25
|
auction: string;
|
|
24
|
-
optionAirdrop: string;
|
|
25
26
|
fundingVault: string;
|
|
27
|
+
improvementProposal: string;
|
|
28
|
+
optionAirdrop: string;
|
|
26
29
|
veTypus: string;
|
|
27
30
|
};
|
|
28
31
|
}
|
|
@@ -31,9 +34,11 @@ export interface Version {
|
|
|
31
34
|
safu: string;
|
|
32
35
|
typus: string;
|
|
33
36
|
launch: {
|
|
37
|
+
airdrop: string;
|
|
34
38
|
auction: string;
|
|
35
|
-
optionAirdrop: string;
|
|
36
39
|
fundingVault: string;
|
|
40
|
+
improvementProposal: string;
|
|
41
|
+
optionAirdrop: string;
|
|
37
42
|
veTypus: string;
|
|
38
43
|
};
|
|
39
44
|
}
|
|
@@ -71,7 +76,9 @@ export interface Registry {
|
|
|
71
76
|
user: string;
|
|
72
77
|
};
|
|
73
78
|
launch: {
|
|
79
|
+
airdrop: string;
|
|
74
80
|
fundingVault: string;
|
|
81
|
+
improvementProposal: string;
|
|
75
82
|
veTypus: string;
|
|
76
83
|
};
|
|
77
84
|
}
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -38,12 +61,16 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
61
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
62
|
exports.TypusConfig = void 0;
|
|
40
63
|
var camelcaseKeysDeep = require("camelcase-keys-deep");
|
|
64
|
+
var fs = __importStar(require("fs"));
|
|
41
65
|
var TypusConfig = /** @class */ (function () {
|
|
42
66
|
function TypusConfig() {
|
|
43
67
|
}
|
|
44
68
|
TypusConfig.parse = function (json) {
|
|
45
69
|
return JSON.parse(JSON.stringify(camelcaseKeysDeep(json)));
|
|
46
70
|
};
|
|
71
|
+
TypusConfig.local = function (path) {
|
|
72
|
+
return TypusConfig.parse(JSON.parse(fs.readFileSync(path, "utf-8")));
|
|
73
|
+
};
|
|
47
74
|
TypusConfig.default = function (network_1, customRpcEndpoint_1) {
|
|
48
75
|
return __awaiter(this, arguments, void 0, function (network, customRpcEndpoint, branch) {
|
|
49
76
|
var _a, typusConfig, _b, _c, _d, _e, _f, typusConfig, _g, _h, _j, _k, _l;
|
|
@@ -90,7 +117,7 @@ var TypusConfig = /** @class */ (function () {
|
|
|
90
117
|
}());
|
|
91
118
|
exports.TypusConfig = TypusConfig;
|
|
92
119
|
// (async () => {
|
|
93
|
-
// let config =
|
|
120
|
+
// let config = TypusConfig.local("../typus-config/config-testnet.json");
|
|
94
121
|
// console.log(config);
|
|
95
122
|
// console.log(config.rpcEndpoint);
|
|
96
123
|
// })();
|