@typus/typus-sdk 1.5.8 → 1.5.9

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
  });
@@ -140,8 +137,8 @@ function playGuessTx(config, tx, input) {
140
137
  }
141
138
  function newGamePlayGuessTx(config, tx, input) {
142
139
  return __awaiter(this, void 0, void 0, function () {
143
- var registry, _a, coin;
144
- return __generator(this, function (_b) {
140
+ var registry, coin;
141
+ return __generator(this, function (_a) {
145
142
  registry = "";
146
143
  switch (input.module) {
147
144
  case "tails_exp":
@@ -153,43 +150,20 @@ function newGamePlayGuessTx(config, tx, input) {
153
150
  default:
154
151
  break;
155
152
  }
156
- if (input.typeArguments[0] == "0x2::sui::SUI" ||
157
- input.typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI") {
158
- _a = __read(tx.splitCoins(tx.gas, [tx.pure.u64(input.amount)]), 1), coin = _a[0];
159
- tx.moveCall({
160
- target: "".concat(config.package.dice, "::").concat(input.module, "::new_game"),
161
- typeArguments: input.typeArguments,
162
- arguments: input.module == "combo_dice"
163
- ? [
164
- tx.object(config.registry.dice.comboDice),
165
- tx.object(config.registry.dice.tailsExp),
166
- tx.pure.u64(input.index),
167
- tx.makeMoveVec({ elements: [coin] }),
168
- tx.pure.u64(input.amount),
169
- ]
170
- : [tx.object(registry), tx.pure.u64(input.index), tx.makeMoveVec({ elements: [coin] }), tx.pure.u64(input.amount)],
171
- });
172
- }
173
- else {
174
- tx.moveCall({
175
- target: "".concat(config.package.dice, "::").concat(input.module, "::new_game"),
176
- typeArguments: input.typeArguments,
177
- arguments: input.module == "combo_dice"
178
- ? [
179
- tx.object(config.registry.dice.comboDice),
180
- tx.object(config.registry.dice.tailsExp),
181
- tx.pure.u64(input.index),
182
- tx.makeMoveVec({ elements: input.coins.map(function (id) { return tx.object(id); }) }),
183
- tx.pure.u64(input.amount),
184
- ]
185
- : [
186
- tx.object(registry),
187
- tx.pure.u64(input.index),
188
- tx.makeMoveVec({ elements: input.coins.map(function (id) { return tx.object(id); }) }),
189
- tx.pure.u64(input.amount),
190
- ],
191
- });
192
- }
153
+ coin = (0, utils_1.splitCoins)(tx, input.typeArguments[0], input.coins, input.amount);
154
+ tx.moveCall({
155
+ target: "".concat(config.package.dice, "::").concat(input.module, "::new_game"),
156
+ typeArguments: input.typeArguments,
157
+ arguments: input.module == "combo_dice"
158
+ ? [
159
+ tx.object(config.registry.dice.comboDice),
160
+ tx.object(config.registry.dice.tailsExp),
161
+ tx.pure.u64(input.index),
162
+ tx.makeMoveVec({ elements: [coin] }),
163
+ tx.pure.u64(input.amount),
164
+ ]
165
+ : [tx.object(registry), tx.pure.u64(input.index), tx.makeMoveVec({ elements: [coin] }), tx.pure.u64(input.amount)],
166
+ });
193
167
  // tx.moveCall({
194
168
  // target: `${config.package.dice}::${input.module}::play_guess`,
195
169
  // typeArguments: [],
@@ -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 raiseBalance = input.typeArguments[0] == "0x2::sui::SUI" ||
49
- input.typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"
50
- ? tx.moveCall({
51
- target: "".concat(config.package.framework, "::utils::delegate_extract_balance"),
52
- typeArguments: [input.typeArguments[0]],
53
- arguments: [
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 balance = tx.moveCall({
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 raiseBalance = input.typeArguments[0] == "0x2::sui::SUI" ||
27
- input.typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"
28
- ? tx.moveCall({
29
- target: "".concat(config.package.framework, "::utils::delegate_extract_balance"),
30
- typeArguments: [input.typeArguments[0]],
31
- arguments: [
32
- tx.pure.address(input.user),
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: [
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.8",
5
+ "version": "1.5.9",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.11.1",
8
8
  "@mysten/kiosk": "0.9.34",