@typus/typus-sdk 1.1.12 → 1.1.13
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.
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js";
|
|
2
|
+
/**
|
|
3
|
+
public(friend) entry fun new_game<TOKEN>(
|
|
4
|
+
registry: &mut Registry,
|
|
5
|
+
index: u64,
|
|
6
|
+
coins: vector<Coin<TOKEN>>,
|
|
7
|
+
stake_amount: u64,
|
|
8
|
+
ctx: &mut TxContext
|
|
9
|
+
)
|
|
10
|
+
*/
|
|
11
|
+
export declare function newGameTx(gasBudget: number, packageId: string, typeArguments: string[], // [TOKEN]
|
|
12
|
+
registry: string, index: string, coins: string[], amount: string): Promise<TransactionBlock>;
|
|
13
|
+
/**
|
|
14
|
+
public(friend) entry fun play_guess(
|
|
15
|
+
registry: &mut Registry,
|
|
16
|
+
index: u64,
|
|
17
|
+
game_id: u64,
|
|
18
|
+
guess_1: u64,
|
|
19
|
+
larger_than_1: bool,
|
|
20
|
+
guess_2: u64,
|
|
21
|
+
larger_than_2: bool,
|
|
22
|
+
ctx: &mut TxContext
|
|
23
|
+
)
|
|
24
|
+
*/
|
|
25
|
+
export declare function playGuessTx(gasBudget: number, packageId: string, registry: string, index: string, game_id: string, guess_1: string, larger_than_1: boolean, guess_2: string, larger_than_2: boolean): Promise<TransactionBlock>;
|
|
@@ -0,0 +1,102 @@
|
|
|
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.playGuessTx = exports.newGameTx = void 0;
|
|
40
|
+
var sui_js_1 = require("@mysten/sui.js");
|
|
41
|
+
/**
|
|
42
|
+
public(friend) entry fun new_game<TOKEN>(
|
|
43
|
+
registry: &mut Registry,
|
|
44
|
+
index: u64,
|
|
45
|
+
coins: vector<Coin<TOKEN>>,
|
|
46
|
+
stake_amount: u64,
|
|
47
|
+
ctx: &mut TxContext
|
|
48
|
+
)
|
|
49
|
+
*/
|
|
50
|
+
function newGameTx(gasBudget, packageId, typeArguments, // [TOKEN]
|
|
51
|
+
registry, index, coins, amount) {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
53
|
+
var tx;
|
|
54
|
+
return __generator(this, function (_a) {
|
|
55
|
+
tx = new sui_js_1.TransactionBlock();
|
|
56
|
+
tx.moveCall({
|
|
57
|
+
target: "".concat(packageId, "::tails_exp_dice::new_game"),
|
|
58
|
+
typeArguments: typeArguments,
|
|
59
|
+
arguments: [tx.pure(registry), tx.pure(index), tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }), tx.pure(amount)],
|
|
60
|
+
});
|
|
61
|
+
tx.setGasBudget(gasBudget);
|
|
62
|
+
return [2 /*return*/, tx];
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
exports.newGameTx = newGameTx;
|
|
67
|
+
/**
|
|
68
|
+
public(friend) entry fun play_guess(
|
|
69
|
+
registry: &mut Registry,
|
|
70
|
+
index: u64,
|
|
71
|
+
game_id: u64,
|
|
72
|
+
guess_1: u64,
|
|
73
|
+
larger_than_1: bool,
|
|
74
|
+
guess_2: u64,
|
|
75
|
+
larger_than_2: bool,
|
|
76
|
+
ctx: &mut TxContext
|
|
77
|
+
)
|
|
78
|
+
*/
|
|
79
|
+
function playGuessTx(gasBudget, packageId, registry, index, game_id, guess_1, larger_than_1, guess_2, larger_than_2) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
81
|
+
var tx;
|
|
82
|
+
return __generator(this, function (_a) {
|
|
83
|
+
tx = new sui_js_1.TransactionBlock();
|
|
84
|
+
tx.moveCall({
|
|
85
|
+
target: "".concat(packageId, "::tails_exp_dice::play_guess"),
|
|
86
|
+
typeArguments: [],
|
|
87
|
+
arguments: [
|
|
88
|
+
tx.pure(registry),
|
|
89
|
+
tx.pure(index),
|
|
90
|
+
tx.pure(game_id),
|
|
91
|
+
tx.pure(guess_1),
|
|
92
|
+
tx.pure(larger_than_1),
|
|
93
|
+
tx.pure(guess_2),
|
|
94
|
+
tx.pure(larger_than_2),
|
|
95
|
+
],
|
|
96
|
+
});
|
|
97
|
+
tx.setGasBudget(gasBudget);
|
|
98
|
+
return [2 /*return*/, tx];
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
exports.playGuessTx = playGuessTx;
|
|
@@ -191,6 +191,7 @@ function parseTxHistory(datas, originPackage, vaults) {
|
|
|
191
191
|
case "WithdrawEvent":
|
|
192
192
|
case "UnsubscribeEvent":
|
|
193
193
|
case "ClaimEvent":
|
|
194
|
+
case "CompoundEvent":
|
|
194
195
|
case "HarvestEvent":
|
|
195
196
|
i = txHistory.findIndex(function (x) { return x.txDigest == event.id.txDigest; });
|
|
196
197
|
token = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.token.name);
|