@typus/typus-sdk 1.5.7 → 1.5.8-split-coins
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.
|
@@ -57,6 +57,7 @@ exports.playGuessTx = playGuessTx;
|
|
|
57
57
|
exports.newGamePlayGuessTx = newGamePlayGuessTx;
|
|
58
58
|
exports.getConsumeExpCoinStakedTx = getConsumeExpCoinStakedTx;
|
|
59
59
|
exports.getConsumeExpCoinUnstakedTx = getConsumeExpCoinUnstakedTx;
|
|
60
|
+
var utils_1 = require("../../src/utils");
|
|
60
61
|
/**
|
|
61
62
|
public(friend) entry fun new_game<TOKEN>(
|
|
62
63
|
registry: &mut Registry,
|
|
@@ -68,7 +69,7 @@ exports.getConsumeExpCoinUnstakedTx = getConsumeExpCoinUnstakedTx;
|
|
|
68
69
|
*/
|
|
69
70
|
function newGameTx(config, tx, input) {
|
|
70
71
|
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
-
var registry;
|
|
72
|
+
var registry, coin;
|
|
72
73
|
return __generator(this, function (_a) {
|
|
73
74
|
registry = "";
|
|
74
75
|
switch (input.module) {
|
|
@@ -81,15 +82,11 @@ function newGameTx(config, tx, input) {
|
|
|
81
82
|
default:
|
|
82
83
|
break;
|
|
83
84
|
}
|
|
85
|
+
coin = (0, utils_1.splitCoins)(tx, input.typeArguments[0], input.coins, input.amount);
|
|
84
86
|
tx.moveCall({
|
|
85
87
|
target: "".concat(config.package.dice, "::").concat(input.module, "::new_game"),
|
|
86
88
|
typeArguments: input.typeArguments,
|
|
87
|
-
arguments: [
|
|
88
|
-
tx.object(registry),
|
|
89
|
-
tx.pure.u64(input.index),
|
|
90
|
-
tx.makeMoveVec({ elements: input.coins.map(function (id) { return tx.object(id); }) }),
|
|
91
|
-
tx.pure.u64(input.amount),
|
|
92
|
-
],
|
|
89
|
+
arguments: [tx.object(registry), tx.pure.u64(input.index), tx.makeMoveVec({ elements: [coin] }), tx.pure.u64(input.amount)],
|
|
93
90
|
});
|
|
94
91
|
return [2 /*return*/, tx];
|
|
95
92
|
});
|
|
@@ -494,6 +494,9 @@ function parseTxHistory(datas, vaults) {
|
|
|
494
494
|
Amount = "".concat((0, bignumber_js_1.default)(profit).toFixed(), " ").concat(d_token);
|
|
495
495
|
break;
|
|
496
496
|
case "RedeemEvent":
|
|
497
|
+
if (event.type == "0xc654c3634a10567b329de1226c2629cae39cdc16ec5d594897d87b250d46e958::typus_dov_single::RedeemEvent") {
|
|
498
|
+
break;
|
|
499
|
+
}
|
|
497
500
|
token = (0, constants_1.typeArgToAsset)("0x" + event.parsedJson.token.name);
|
|
498
501
|
amount = Number(event.parsedJson.amount) / Math.pow(10, (0, constants_1.assetToDecimal)(token));
|
|
499
502
|
Action = "Harvest Reward";
|
|
@@ -29,6 +29,7 @@ exports.getCompoundWithRedeemTx = getCompoundWithRedeemTx;
|
|
|
29
29
|
var bcs_1 = require("@mysten/sui/bcs");
|
|
30
30
|
var transactions_1 = require("@mysten/sui/transactions");
|
|
31
31
|
var constants_1 = require("../../src/constants");
|
|
32
|
+
var utils_1 = require("../../src/utils");
|
|
32
33
|
/**
|
|
33
34
|
public fun public_raise_fund<D_TOKEN, B_TOKEN>(
|
|
34
35
|
typus_ecosystem_version: &TypusEcosystemVersion,
|
|
@@ -45,32 +46,12 @@ var constants_1 = require("../../src/constants");
|
|
|
45
46
|
): (TypusDepositReceipt, vector<u64>) {
|
|
46
47
|
*/
|
|
47
48
|
function getRaiseFundTx(config, tx, input) {
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
tx.pure.address(input.user),
|
|
55
|
-
tx.makeMoveVec({
|
|
56
|
-
type: "0x2::coin::Coin<".concat(input.typeArguments[0], ">"),
|
|
57
|
-
elements: [tx.splitCoins(tx.gas, [tx.pure.u64(input.raiseAmount)])],
|
|
58
|
-
}),
|
|
59
|
-
tx.pure.u64(input.raiseAmount),
|
|
60
|
-
],
|
|
61
|
-
})
|
|
62
|
-
: tx.moveCall({
|
|
63
|
-
target: "".concat(config.package.framework, "::utils::delegate_extract_balance"),
|
|
64
|
-
typeArguments: [input.typeArguments[0]],
|
|
65
|
-
arguments: [
|
|
66
|
-
tx.pure.address(input.user),
|
|
67
|
-
tx.makeMoveVec({
|
|
68
|
-
type: "0x2::coin::Coin<".concat(input.typeArguments[0], ">"),
|
|
69
|
-
elements: input.raiseCoins.map(function (coin) { return tx.object(coin); }),
|
|
70
|
-
}),
|
|
71
|
-
tx.pure.u64(input.raiseAmount),
|
|
72
|
-
],
|
|
73
|
-
});
|
|
49
|
+
var coin = (0, utils_1.splitCoins)(tx, input.typeArguments[0], input.raiseCoins, input.raiseAmount);
|
|
50
|
+
var raiseBalance = tx.moveCall({
|
|
51
|
+
target: "0x2::coin::into_balance",
|
|
52
|
+
typeArguments: [input.typeArguments[0]],
|
|
53
|
+
arguments: [tx.object(coin)],
|
|
54
|
+
});
|
|
74
55
|
var result = tx.moveCall({
|
|
75
56
|
target: "".concat(config.package.dovSingle, "::tds_user_entry::public_raise_fund"),
|
|
76
57
|
typeArguments: input.typeArguments,
|
|
@@ -223,16 +204,7 @@ function getNewBidTx(config, tx, input) {
|
|
|
223
204
|
});
|
|
224
205
|
}
|
|
225
206
|
else {
|
|
226
|
-
var
|
|
227
|
-
target: "".concat(config.package.framework, "::utils::extract_balance"),
|
|
228
|
-
typeArguments: [input.typeArguments[1]],
|
|
229
|
-
arguments: [tx.makeMoveVec({ elements: input.coins.map(function (coin) { return tx.object(coin); }) }), tx.pure.u64(input.premium_required)],
|
|
230
|
-
});
|
|
231
|
-
var coin = tx.moveCall({
|
|
232
|
-
target: "0x2::coin::from_balance",
|
|
233
|
-
typeArguments: [input.typeArguments[1]],
|
|
234
|
-
arguments: [tx.object(balance)],
|
|
235
|
-
});
|
|
207
|
+
var coin = (0, utils_1.splitCoins)(tx, input.typeArguments[1], input.coins, input.premium_required);
|
|
236
208
|
var result = tx.moveCall({
|
|
237
209
|
target: "".concat(config.package.dovSingle, "::tds_user_entry::public_bid"),
|
|
238
210
|
typeArguments: input.typeArguments,
|
|
@@ -23,33 +23,13 @@ var utils_1 = require("../../src/utils");
|
|
|
23
23
|
) {
|
|
24
24
|
*/
|
|
25
25
|
function getRaiseFundTx(config, tx, input) {
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
tx.makeMoveVec({
|
|
34
|
-
type: "0x2::coin::Coin<".concat(input.typeArguments[0], ">"),
|
|
35
|
-
elements: [tx.splitCoins(tx.gas, [tx.pure.u64(input.raiseAmount)])],
|
|
36
|
-
}),
|
|
37
|
-
tx.pure.u64(input.raiseAmount),
|
|
38
|
-
],
|
|
39
|
-
})
|
|
40
|
-
: tx.moveCall({
|
|
41
|
-
target: "".concat(config.package.framework, "::utils::delegate_extract_balance"),
|
|
42
|
-
typeArguments: [input.typeArguments[0]],
|
|
43
|
-
arguments: [
|
|
44
|
-
tx.pure.address(input.user),
|
|
45
|
-
tx.makeMoveVec({
|
|
46
|
-
type: "0x2::coin::Coin<".concat(input.typeArguments[0], ">"),
|
|
47
|
-
elements: input.raiseCoins.map(function (coin) { return tx.object(coin); }),
|
|
48
|
-
}),
|
|
49
|
-
tx.pure.u64(input.raiseAmount),
|
|
50
|
-
],
|
|
51
|
-
});
|
|
52
|
-
var result = tx.moveCall({
|
|
26
|
+
var coin = (0, utils_1.splitCoins)(tx, input.typeArguments[0], input.raiseCoins, input.raiseAmount);
|
|
27
|
+
var raiseBalance = tx.moveCall({
|
|
28
|
+
target: "0x2::coin::into_balance",
|
|
29
|
+
typeArguments: [input.typeArguments[0]],
|
|
30
|
+
arguments: [tx.object(coin)],
|
|
31
|
+
});
|
|
32
|
+
tx.moveCall({
|
|
53
33
|
target: "".concat(config.package.safu, "::safu::raise_fund"),
|
|
54
34
|
typeArguments: input.typeArguments,
|
|
55
35
|
arguments: [
|