@typus/typus-sdk 1.1.46 → 1.1.48

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.
@@ -137,6 +137,16 @@ function getSwitchNftTx(gasBudget, nftPackageId, registry, kiosk, kiosk_cap, nft
137
137
  return __generator(this, function (_b) {
138
138
  tx = new transactions_1.TransactionBlock();
139
139
  _a = __read(tx.splitCoins(tx.gas, [tx.pure(50000000)]), 1), coin = _a[0];
140
+ tx.moveCall({
141
+ target: "".concat(nftPackageId, "::tails_staking::snapshot"),
142
+ typeArguments: [],
143
+ arguments: [tx.object(registry), tx.object(constants_1.CLOCK)],
144
+ });
145
+ tx.moveCall({
146
+ target: "".concat(nftPackageId, "::tails_staking::claim_profit_sharing"),
147
+ typeArguments: ["0x2::sui::SUI"],
148
+ arguments: [tx.object(registry)],
149
+ });
140
150
  tx.moveCall({
141
151
  target: "".concat(nftPackageId, "::tails_staking::switch_nft"),
142
152
  typeArguments: [],
@@ -30,6 +30,7 @@ export interface Game {
30
30
  vrf_input_2: number[] | null;
31
31
  }
32
32
  export declare function getHistory(provider: SuiClient, dicePackage: string, playgrounds: Playground[]): Promise<DrawDisplay[]>;
33
+ export declare function waitHistory(provider: SuiClient, dicePackage: string, onMessage: any): Promise<import("@mysten/sui.js/client").Unsubscribe>;
33
34
  export declare function parseHistory(datas: any, playgrounds: Playground[]): Promise<DrawDisplay[]>;
34
35
  interface DrawDisplay {
35
36
  game_id: string;
@@ -47,7 +47,7 @@ var __values = (this && this.__values) || function(o) {
47
47
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
48
48
  };
49
49
  Object.defineProperty(exports, "__esModule", { value: true });
50
- exports.calculateLevelReward = exports.getProfitSharing = exports.getLeaderBoard = exports.parseHistory = exports.getHistory = exports.getPlaygrounds = void 0;
50
+ exports.calculateLevelReward = exports.getProfitSharing = exports.getLeaderBoard = exports.parseHistory = exports.waitHistory = exports.getHistory = exports.getPlaygrounds = void 0;
51
51
  var token_1 = require("../token");
52
52
  function getPlaygrounds(provider, diceRegistry) {
53
53
  return __awaiter(this, void 0, void 0, function () {
@@ -131,6 +131,27 @@ function getHistory(provider, dicePackage, playgrounds) {
131
131
  });
132
132
  }
133
133
  exports.getHistory = getHistory;
134
+ function waitHistory(provider, dicePackage, onMessage) {
135
+ return __awaiter(this, void 0, void 0, function () {
136
+ var eventFilter, unsubscribe;
137
+ return __generator(this, function (_a) {
138
+ switch (_a.label) {
139
+ case 0:
140
+ eventFilter = {
141
+ MoveEventType: "".concat(dicePackage, "::tails_exp::Draw"),
142
+ };
143
+ return [4 /*yield*/, provider.subscribeEvent({
144
+ filter: eventFilter,
145
+ onMessage: onMessage,
146
+ })];
147
+ case 1:
148
+ unsubscribe = _a.sent();
149
+ return [2 /*return*/, unsubscribe];
150
+ }
151
+ });
152
+ });
153
+ }
154
+ exports.waitHistory = waitHistory;
134
155
  function parseHistory(datas, playgrounds) {
135
156
  return __awaiter(this, void 0, void 0, function () {
136
157
  var result;
@@ -139,3 +139,18 @@ export declare function getExerciseTx(gasBudget: number, typusFrameworkPackageId
139
139
  )
140
140
  */
141
141
  export declare function getRebateTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string): Promise<TransactionBlock>;
142
+ /**
143
+ entry fun new_strategy<B_TOKEN>(
144
+ strategy_pool: &mut StrategyPool,
145
+ vault_index: u64,
146
+ signal_index: u64,
147
+ size: u64,
148
+ price_percentage: u64,
149
+ max_times: u64,
150
+ target_rounds: vector<u64>,
151
+ coin: Coin<B_TOKEN>,
152
+ ctx: &mut TxContext
153
+ )
154
+ */
155
+ export declare function getNewStrategyTx(gasBudget: number, packageId: string, typeArguments: string[], // B_TOKEN
156
+ strategy_pool: string, vault_index: string, signal_index: string, coins: string[], amount: string, size: string, price_percentage: string, max_times: string, target_rounds: string[]): Promise<TransactionBlock>;
@@ -52,7 +52,7 @@ var __read = (this && this.__read) || function (o, n) {
52
52
  return ar;
53
53
  };
54
54
  Object.defineProperty(exports, "__esModule", { value: true });
55
- exports.getRebateTx = exports.getExerciseTx = exports.getTransferBidReceiptTx = exports.getNewBidTx = exports.getCompoundTx = exports.getBatchClaimHarvestWithdrawRedeemTx = exports.getHarvestTx = exports.getClaimTx = exports.getUnsubscribeTx = exports.getWithdrawTx = exports.getDepositTx = void 0;
55
+ exports.getNewStrategyTx = exports.getRebateTx = exports.getExerciseTx = exports.getTransferBidReceiptTx = exports.getNewBidTx = exports.getCompoundTx = exports.getBatchClaimHarvestWithdrawRedeemTx = exports.getHarvestTx = exports.getClaimTx = exports.getUnsubscribeTx = exports.getWithdrawTx = exports.getDepositTx = void 0;
56
56
  var transactions_1 = require("@mysten/sui.js/transactions");
57
57
  var constants_1 = require("../../constants");
58
58
  /**
@@ -490,3 +490,67 @@ function getRebateTx(gasBudget, packageId, typeArguments, registry) {
490
490
  });
491
491
  }
492
492
  exports.getRebateTx = getRebateTx;
493
+ /**
494
+ entry fun new_strategy<B_TOKEN>(
495
+ strategy_pool: &mut StrategyPool,
496
+ vault_index: u64,
497
+ signal_index: u64,
498
+ size: u64,
499
+ price_percentage: u64,
500
+ max_times: u64,
501
+ target_rounds: vector<u64>,
502
+ coin: Coin<B_TOKEN>,
503
+ ctx: &mut TxContext
504
+ )
505
+ */
506
+ function getNewStrategyTx(gasBudget, packageId, typeArguments, // B_TOKEN
507
+ strategy_pool, vault_index, signal_index, coins, amount, size, price_percentage, max_times, target_rounds) {
508
+ return __awaiter(this, void 0, void 0, function () {
509
+ var tx, _a, input_coin, coin, _b, input_coin;
510
+ return __generator(this, function (_c) {
511
+ tx = new transactions_1.TransactionBlock();
512
+ if (typeArguments[0] == "0x2::sui::SUI" ||
513
+ typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI") {
514
+ _a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), input_coin = _a[0];
515
+ tx.moveCall({
516
+ target: "".concat(packageId, "::auto_bid::new_strategy"),
517
+ typeArguments: typeArguments,
518
+ arguments: [
519
+ tx.object(strategy_pool),
520
+ tx.pure(vault_index),
521
+ tx.pure(signal_index),
522
+ tx.pure(size),
523
+ tx.pure(price_percentage),
524
+ tx.pure(max_times),
525
+ tx.pure(target_rounds),
526
+ input_coin,
527
+ ],
528
+ });
529
+ }
530
+ else {
531
+ coin = coins.pop();
532
+ if (coins.length > 0) {
533
+ tx.mergeCoins(tx.object(coin), coins.map(function (id) { return tx.object(id); }));
534
+ }
535
+ _b = __read(tx.splitCoins(tx.object(coin), [tx.pure(amount)]), 1), input_coin = _b[0];
536
+ tx.moveCall({
537
+ target: "".concat(packageId, "::auto_bid::new_strategy"),
538
+ typeArguments: typeArguments,
539
+ arguments: [
540
+ tx.object(strategy_pool),
541
+ tx.pure(vault_index),
542
+ tx.pure(signal_index),
543
+ tx.pure(size),
544
+ tx.pure(price_percentage),
545
+ tx.pure(max_times),
546
+ tx.pure(target_rounds),
547
+ input_coin,
548
+ ],
549
+ });
550
+ }
551
+ tx.setGasBudget(gasBudget);
552
+ return [2 /*return*/, tx];
553
+ });
554
+ });
555
+ }
556
+ exports.getNewStrategyTx = getNewStrategyTx;
@@ -204,7 +204,7 @@ function parseTxHistory(datas, originPackage, vaults) {
204
204
  Tails = "#".concat(event.parsedJson.number);
205
205
  break;
206
206
  case "ExpUpEvent":
207
- i = txHistory.findIndex(function (x) { return x.txDigest == event.id.txDigest && x.Action != "First Deposit"; });
207
+ i = txHistory.findIndex(function (x) { return x.txDigest == event.id.txDigest && x.Action != "First Deposit" && x.Action != "Stake"; });
208
208
  if (i != -1) {
209
209
  txHistory[i].Tails = "#".concat(event.parsedJson.number);
210
210
  txHistory[i].Exp = event.parsedJson.exp_earn;
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.1.46",
5
+ "version": "1.1.48",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.7.3",
8
8
  "@mysten/kiosk": "0.7.11",