@typus/typus-sdk 1.1.55 → 1.1.56

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.
@@ -1,91 +1,75 @@
1
1
  import { TransactionBlock } from "@mysten/sui.js/transactions";
2
2
  /**
3
- public(friend) entry fun deposit<D_TOKEN, B_TOKEN>(
3
+ public fun deposit<D_TOKEN, B_TOKEN>(
4
4
  registry: &mut Registry,
5
5
  index: u64,
6
6
  coins: vector<Coin<D_TOKEN>>,
7
7
  amount: u64,
8
8
  receipts: vector<TypusDepositReceipt>,
9
+ clock: &Clock,
9
10
  ctx: &mut TxContext,
10
11
  )
11
12
  */
12
- export declare function getDepositTx(gasBudget: number, typusFrameworkPackageId: string, packageId: string, typeArguments: string[], registry: string, index: string, coins: string[], amount: string, receipts: string[], usingSponsoredGasCoin?: boolean): Promise<TransactionBlock>;
13
+ export declare function getDepositTx(tx: TransactionBlock, typusFrameworkOriginPackageId: string, typusFrameworkPackageId: string, packageId: string, typeArguments: string[], registry: string, index: string, coins: string[], amount: string, receipts: string[], user: string, usingSponsoredGasCoin?: boolean): TransactionBlock;
13
14
  /**
14
- public(friend) entry fun withdraw<D_TOKEN, B_TOKEN>(
15
+ public fun withdraw<D_TOKEN, B_TOKEN>(
15
16
  registry: &mut Registry,
16
17
  index: u64,
17
18
  receipts: vector<TypusDepositReceipt>,
18
19
  share: Option<u64>,
20
+ clock: &Clock,
19
21
  ctx: &mut TxContext,
20
22
  )
21
23
  */
22
- export declare function getWithdrawTx(gasBudget: number, typusFrameworkPackageId: string, packageId: string, typeArguments: string[], registry: string, index: string, receipts: string[], share?: string): Promise<TransactionBlock>;
24
+ export declare function getWithdrawTx(tx: TransactionBlock, typusFrameworkOriginPackageId: string, typusFrameworkPackageId: string, packageId: string, typeArguments: string[], registry: string, index: string, receipts: string[], user: string, share?: string): TransactionBlock;
23
25
  /**
24
- public(friend) entry fun unsubscribe<D_TOKEN, B_TOKEN>(
26
+ public fun unsubscribe<D_TOKEN, B_TOKEN>(
25
27
  registry: &mut Registry,
26
28
  index: u64,
27
29
  receipts: vector<TypusDepositReceipt>,
28
30
  share: Option<u64>,
31
+ clock: &Clock,
29
32
  ctx: &mut TxContext,
30
33
  )
31
34
  */
32
- export declare function getUnsubscribeTx(gasBudget: number, typusFrameworkPackageId: string, packageId: string, typeArguments: string[], registry: string, index: string, receipts: string[], share?: string): Promise<TransactionBlock>;
35
+ export declare function getUnsubscribeTx(tx: TransactionBlock, typusFrameworkOriginPackageId: string, typusFrameworkPackageId: string, packageId: string, typeArguments: string[], registry: string, index: string, receipts: string[], user: string, share?: string): TransactionBlock;
33
36
  /**
34
- public(friend) entry fun claim<D_TOKEN, B_TOKEN>(
37
+ public fun compound<D_TOKEN, B_TOKEN>(
35
38
  registry: &mut Registry,
36
39
  index: u64,
37
40
  receipts: vector<TypusDepositReceipt>,
41
+ clock: &Clock,
38
42
  ctx: &mut TxContext,
39
43
  )
40
44
  */
41
- export declare function getClaimTx(gasBudget: number, typusFrameworkPackageId: string, packageId: string, registry: string, requests: {
42
- typeArguments: string[];
43
- index: string;
44
- receipts: string[];
45
- }[]): Promise<TransactionBlock>;
45
+ export declare function getCompoundTx(tx: TransactionBlock, typusFrameworkOriginPackageId: string, typusFrameworkPackageId: string, packageId: string, typeArguments: string[], registry: string, index: string, receipts: string[], user: string): TransactionBlock;
46
46
  /**
47
- public(friend) entry fun harvest<D_TOKEN, B_TOKEN>(
47
+ public fun claim<D_TOKEN, B_TOKEN>(
48
48
  registry: &mut Registry,
49
49
  index: u64,
50
50
  receipts: vector<TypusDepositReceipt>,
51
51
  ctx: &mut TxContext,
52
52
  )
53
53
  */
54
- export declare function getHarvestTx(gasBudget: number, typusFrameworkPackageId: string, packageId: string, registry: string, requests: {
55
- typeArguments: string[];
56
- index: string;
57
- receipts: string[];
58
- }[]): Promise<TransactionBlock>;
59
- export declare function getBatchClaimHarvestWithdrawRedeemTx(gasBudget: number, typusFrameworkPackageId: string, packageId: string, registry: string, claimRequests: {
60
- typeArguments: string[];
61
- index: string;
62
- receipts: string[];
63
- }[], harvestRequests: {
64
- typeArguments: string[];
65
- index: string;
66
- receipts: string[];
67
- }[], withdrawRequests: {
68
- typeArguments: string[];
69
- index: string;
70
- receipts: string[];
71
- }[], redeemRequests: {
72
- typeArguments: string[];
73
- index: string;
74
- receipts: string[];
75
- }[]): Promise<TransactionBlock>;
54
+ export declare function getClaimTx(tx: TransactionBlock, typusFrameworkOriginPackageId: string, typusFrameworkPackageId: string, packageId: string, typeArguments: string[], registry: string, index: string, receipts: string[], user: string): TransactionBlock;
76
55
  /**
77
- public(friend) entry fun compound<D_TOKEN, B_TOKEN>(
56
+ public fun harvest<D_TOKEN, B_TOKEN>(
78
57
  registry: &mut Registry,
79
58
  index: u64,
80
59
  receipts: vector<TypusDepositReceipt>,
81
60
  ctx: &mut TxContext,
82
61
  )
83
62
  */
84
- export declare function getCompoundTx(gasBudget: number, typusFrameworkPackageId: string, packageId: string, registry: string, requests: {
85
- typeArguments: string[];
86
- index: string;
87
- receipts: string[];
88
- }[]): Promise<TransactionBlock>;
63
+ export declare function getHarvestTx(tx: TransactionBlock, typusFrameworkOriginPackageId: string, typusFrameworkPackageId: string, packageId: string, typeArguments: string[], registry: string, index: string, receipts: string[], user: string): TransactionBlock;
64
+ /**
65
+ public fun redeem<D_TOKEN, B_TOKEN, I_TOKEN>(
66
+ registry: &mut Registry,
67
+ index: u64,
68
+ receipts: vector<TypusDepositReceipt>,
69
+ ctx: &mut TxContext,
70
+ )
71
+ */
72
+ export declare function getRedeemTx(tx: TransactionBlock, typusFrameworkOriginPackageId: string, typusFrameworkPackageId: string, packageId: string, typeArguments: string[], registry: string, index: string, receipts: string[], user: string): TransactionBlock;
89
73
  /**
90
74
  public(friend) entry fun new_bid<D_TOKEN, B_TOKEN>(
91
75
  registry: &mut Registry,
@@ -96,8 +80,17 @@ export declare function getCompoundTx(gasBudget: number, typusFrameworkPackageId
96
80
  ctx: &mut TxContext,
97
81
  )
98
82
  */
99
- export declare function getNewBidTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, coins: string[], size: string, premium_required: string, // fe float * b_token_decimal
100
- usingSponsoredGasCoin?: boolean): Promise<TransactionBlock>;
83
+ export declare function getNewBidTx(tx: TransactionBlock, packageId: string, typeArguments: string[], registry: string, index: string, coins: string[], size: string, premium_required: string, // fe float * b_token_decimal
84
+ user: string, usingSponsoredGasCoin?: boolean): TransactionBlock;
85
+ /**
86
+ public(friend) entry fun exercise<D_TOKEN, B_TOKEN>(
87
+ registry: &mut Registry,
88
+ index: u64,
89
+ receipts: vector<TypusBidReceipt>,
90
+ ctx: &mut TxContext,
91
+ )
92
+ */
93
+ export declare function getExerciseTx(tx: TransactionBlock, typusFrameworkOriginPackageId: string, typusFrameworkPackageId: string, packageId: string, typeArguments: string[], registry: string, index: string, receipts: string[], user: string): TransactionBlock;
101
94
  /**
102
95
  public(friend) entry fun transfer_bid_receipt<D_TOKEN, B_TOKEN>(
103
96
  registry: &mut Registry,
@@ -110,7 +103,7 @@ usingSponsoredGasCoin?: boolean): Promise<TransactionBlock>;
110
103
  */
111
104
  export declare function getTransferBidReceiptTx(input: {
112
105
  gasBudget: number;
113
- typusFrameworkPackageId: string;
106
+ typusFrameworkOriginPackageId: string;
114
107
  packageId: string;
115
108
  typeArguments: string[];
116
109
  registry: string;
@@ -118,27 +111,14 @@ export declare function getTransferBidReceiptTx(input: {
118
111
  receipts: string[];
119
112
  share?: string;
120
113
  recipient: string;
121
- }): Promise<TransactionBlock>;
122
- /**
123
- public(friend) entry fun exercise<D_TOKEN, B_TOKEN>(
124
- registry: &mut Registry,
125
- index: u64,
126
- receipts: vector<TypusBidReceipt>,
127
- ctx: &mut TxContext,
128
- )
129
- */
130
- export declare function getExerciseTx(gasBudget: number, typusFrameworkPackageId: string, packageId: string, registry: string, requests: {
131
- typeArguments: string[];
132
- index: string;
133
- receipts: string[];
134
- }[]): Promise<TransactionBlock>;
114
+ }): TransactionBlock;
135
115
  /**
136
116
  public(friend) entry fun refund<TOKEN>(
137
117
  registry: &mut Registry,
138
118
  ctx: &mut TxContext,
139
119
  )
140
120
  */
141
- export declare function getRebateTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string): Promise<TransactionBlock>;
121
+ export declare function getRebateTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string): TransactionBlock;
142
122
  /**
143
123
  entry fun new_strategy<B_TOKEN>(
144
124
  strategy_pool: &mut StrategyPool,
@@ -153,4 +133,4 @@ export declare function getRebateTx(gasBudget: number, packageId: string, typeAr
153
133
  )
154
134
  */
155
135
  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>;
136
+ strategy_pool: string, vault_index: string, signal_index: string, coins: string[], amount: string, size: string, price_percentage: string, max_times: string, target_rounds: string[]): TransactionBlock;
@@ -1,40 +1,4 @@
1
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
2
  var __read = (this && this.__read) || function (o, n) {
39
3
  var m = typeof Symbol === "function" && o[Symbol.iterator];
40
4
  if (!m) return o;
@@ -52,306 +16,272 @@ var __read = (this && this.__read) || function (o, n) {
52
16
  return ar;
53
17
  };
54
18
  Object.defineProperty(exports, "__esModule", { value: true });
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;
19
+ exports.getNewStrategyTx = exports.getRebateTx = exports.getTransferBidReceiptTx = exports.getExerciseTx = exports.getNewBidTx = exports.getRedeemTx = exports.getHarvestTx = exports.getClaimTx = exports.getCompoundTx = exports.getUnsubscribeTx = exports.getWithdrawTx = exports.getDepositTx = void 0;
56
20
  var transactions_1 = require("@mysten/sui.js/transactions");
57
21
  var constants_1 = require("../../constants");
58
22
  /**
59
- public(friend) entry fun deposit<D_TOKEN, B_TOKEN>(
23
+ public fun deposit<D_TOKEN, B_TOKEN>(
60
24
  registry: &mut Registry,
61
25
  index: u64,
62
26
  coins: vector<Coin<D_TOKEN>>,
63
27
  amount: u64,
64
28
  receipts: vector<TypusDepositReceipt>,
29
+ clock: &Clock,
65
30
  ctx: &mut TxContext,
66
31
  )
67
32
  */
68
- function getDepositTx(gasBudget, typusFrameworkPackageId, packageId, typeArguments, registry, index, coins, amount, receipts, usingSponsoredGasCoin) {
33
+ function getDepositTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, coins, amount, receipts, user, usingSponsoredGasCoin) {
69
34
  if (usingSponsoredGasCoin === void 0) { usingSponsoredGasCoin = false; }
70
- return __awaiter(this, void 0, void 0, function () {
71
- var tx, _a, coin;
72
- return __generator(this, function (_b) {
73
- tx = new transactions_1.TransactionBlock();
74
- if (!usingSponsoredGasCoin &&
75
- (typeArguments[0] == "0x2::sui::SUI" ||
76
- typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
77
- _a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), coin = _a[0];
78
- tx.moveCall({
79
- target: "".concat(packageId, "::tails_staking::deposit"),
80
- typeArguments: typeArguments,
81
- arguments: [
82
- tx.object(registry),
83
- tx.pure(index),
84
- tx.makeMoveVec({ objects: [coin] }),
85
- tx.pure(amount),
86
- tx.makeMoveVec({
87
- type: "".concat(typusFrameworkPackageId, "::vault::TypusDepositReceipt"),
88
- objects: receipts.map(function (id) { return tx.object(id); }),
89
- }),
90
- tx.pure(constants_1.CLOCK),
91
- ],
92
- });
93
- }
94
- else {
95
- tx.moveCall({
96
- target: "".concat(packageId, "::tails_staking::deposit"),
97
- typeArguments: typeArguments,
98
- arguments: [
99
- tx.object(registry),
100
- tx.pure(index),
101
- tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
102
- tx.pure(amount),
103
- tx.makeMoveVec({
104
- type: "".concat(typusFrameworkPackageId, "::vault::TypusDepositReceipt"),
105
- objects: receipts.map(function (id) { return tx.object(id); }),
106
- }),
107
- tx.pure(constants_1.CLOCK),
108
- ],
109
- });
110
- }
111
- tx.setGasBudget(gasBudget);
112
- return [2 /*return*/, tx];
35
+ if (!usingSponsoredGasCoin &&
36
+ (typeArguments[0] == "0x2::sui::SUI" ||
37
+ typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
38
+ var _a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), coin = _a[0];
39
+ var result = tx.moveCall({
40
+ target: "".concat(packageId, "::tails_staking::deposit"),
41
+ typeArguments: typeArguments,
42
+ arguments: [
43
+ tx.object(registry),
44
+ tx.pure(index),
45
+ tx.makeMoveVec({ objects: [coin] }),
46
+ tx.pure(amount),
47
+ tx.makeMoveVec({
48
+ type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
49
+ objects: receipts.map(function (id) { return tx.object(id); }),
50
+ }),
51
+ tx.pure(constants_1.CLOCK),
52
+ ],
113
53
  });
114
- });
54
+ tx.moveCall({
55
+ target: "".concat(typusFrameworkPackageId, "::utils::transfer_coins"),
56
+ typeArguments: [typeArguments[0]],
57
+ arguments: [tx.object(result[0]), tx.pure(user)],
58
+ });
59
+ tx.transferObjects([tx.object(result[1])], user);
60
+ }
61
+ else {
62
+ var result = tx.moveCall({
63
+ target: "".concat(packageId, "::tails_staking::deposit"),
64
+ typeArguments: typeArguments,
65
+ arguments: [
66
+ tx.object(registry),
67
+ tx.pure(index),
68
+ tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
69
+ tx.pure(amount),
70
+ tx.makeMoveVec({
71
+ type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
72
+ objects: receipts.map(function (id) { return tx.object(id); }),
73
+ }),
74
+ tx.pure(constants_1.CLOCK),
75
+ ],
76
+ });
77
+ tx.moveCall({
78
+ target: "".concat(typusFrameworkPackageId, "::utils::transfer_coins"),
79
+ typeArguments: [typeArguments[0]],
80
+ arguments: [tx.object(result[0]), tx.pure(user)],
81
+ });
82
+ tx.transferObjects([tx.object(result[1])], user);
83
+ }
84
+ return tx;
115
85
  }
116
86
  exports.getDepositTx = getDepositTx;
117
87
  /**
118
- public(friend) entry fun withdraw<D_TOKEN, B_TOKEN>(
88
+ public fun withdraw<D_TOKEN, B_TOKEN>(
119
89
  registry: &mut Registry,
120
90
  index: u64,
121
91
  receipts: vector<TypusDepositReceipt>,
122
92
  share: Option<u64>,
93
+ clock: &Clock,
123
94
  ctx: &mut TxContext,
124
95
  )
125
96
  */
126
- function getWithdrawTx(gasBudget, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, share) {
127
- return __awaiter(this, void 0, void 0, function () {
128
- var tx;
129
- return __generator(this, function (_a) {
130
- tx = new transactions_1.TransactionBlock();
131
- tx.moveCall({
132
- target: "".concat(packageId, "::tails_staking::withdraw"),
133
- typeArguments: typeArguments,
134
- arguments: [
135
- tx.object(registry),
136
- tx.pure(index),
137
- tx.makeMoveVec({
138
- type: "".concat(typusFrameworkPackageId, "::vault::TypusDepositReceipt"),
139
- objects: receipts.map(function (id) { return tx.object(id); }),
140
- }),
141
- tx.pure(share ? [share] : []),
142
- tx.pure(constants_1.CLOCK),
143
- ],
144
- });
145
- tx.setGasBudget(gasBudget);
146
- return [2 /*return*/, tx];
147
- });
97
+ function getWithdrawTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, user, share) {
98
+ var result = tx.moveCall({
99
+ target: "".concat(packageId, "::tails_staking::withdraw"),
100
+ typeArguments: typeArguments,
101
+ arguments: [
102
+ tx.object(registry),
103
+ tx.pure(index),
104
+ tx.makeMoveVec({
105
+ type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
106
+ objects: receipts.map(function (id) { return tx.object(id); }),
107
+ }),
108
+ tx.pure(share ? [share] : []),
109
+ tx.pure(constants_1.CLOCK),
110
+ ],
111
+ });
112
+ tx.moveCall({
113
+ target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
114
+ typeArguments: [typeArguments[0]],
115
+ arguments: [tx.object(result[0]), tx.pure(user)],
116
+ });
117
+ tx.moveCall({
118
+ target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
119
+ arguments: [tx.object(result[1]), tx.pure(user)],
148
120
  });
121
+ return tx;
149
122
  }
150
123
  exports.getWithdrawTx = getWithdrawTx;
151
124
  /**
152
- public(friend) entry fun unsubscribe<D_TOKEN, B_TOKEN>(
125
+ public fun unsubscribe<D_TOKEN, B_TOKEN>(
153
126
  registry: &mut Registry,
154
127
  index: u64,
155
128
  receipts: vector<TypusDepositReceipt>,
156
129
  share: Option<u64>,
130
+ clock: &Clock,
157
131
  ctx: &mut TxContext,
158
132
  )
159
133
  */
160
- function getUnsubscribeTx(gasBudget, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, share) {
161
- return __awaiter(this, void 0, void 0, function () {
162
- var tx;
163
- return __generator(this, function (_a) {
164
- tx = new transactions_1.TransactionBlock();
165
- tx.moveCall({
166
- target: "".concat(packageId, "::tails_staking::unsubscribe"),
167
- typeArguments: typeArguments,
168
- arguments: [
169
- tx.object(registry),
170
- tx.pure(index),
171
- tx.makeMoveVec({
172
- type: "".concat(typusFrameworkPackageId, "::vault::TypusDepositReceipt"),
173
- objects: receipts.map(function (id) { return tx.object(id); }),
174
- }),
175
- tx.pure(share ? [share] : []),
176
- tx.pure(constants_1.CLOCK),
177
- ],
178
- });
179
- tx.setGasBudget(gasBudget);
180
- return [2 /*return*/, tx];
181
- });
134
+ function getUnsubscribeTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, user, share) {
135
+ var result = tx.moveCall({
136
+ target: "".concat(packageId, "::tails_staking::unsubscribe"),
137
+ typeArguments: typeArguments,
138
+ arguments: [
139
+ tx.object(registry),
140
+ tx.pure(index),
141
+ tx.makeMoveVec({
142
+ type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
143
+ objects: receipts.map(function (id) { return tx.object(id); }),
144
+ }),
145
+ tx.pure(share ? [share] : []),
146
+ tx.pure(constants_1.CLOCK),
147
+ ],
182
148
  });
149
+ tx.moveCall({
150
+ target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
151
+ arguments: [tx.object(result[0]), tx.pure(user)],
152
+ });
153
+ return tx;
183
154
  }
184
155
  exports.getUnsubscribeTx = getUnsubscribeTx;
185
156
  /**
186
- public(friend) entry fun claim<D_TOKEN, B_TOKEN>(
157
+ public fun compound<D_TOKEN, B_TOKEN>(
187
158
  registry: &mut Registry,
188
159
  index: u64,
189
160
  receipts: vector<TypusDepositReceipt>,
161
+ clock: &Clock,
190
162
  ctx: &mut TxContext,
191
163
  )
192
164
  */
193
- function getClaimTx(gasBudget, typusFrameworkPackageId, packageId, registry, requests) {
194
- return __awaiter(this, void 0, void 0, function () {
195
- var tx;
196
- return __generator(this, function (_a) {
197
- tx = new transactions_1.TransactionBlock();
198
- requests.forEach(function (request) {
199
- tx.moveCall({
200
- target: "".concat(packageId, "::tds_user_entry::claim"),
201
- typeArguments: request.typeArguments,
202
- arguments: [
203
- tx.object(registry),
204
- tx.pure(request.index),
205
- tx.makeMoveVec({
206
- type: "".concat(typusFrameworkPackageId, "::vault::TypusDepositReceipt"),
207
- objects: request.receipts.map(function (id) { return tx.object(id); }),
208
- }),
209
- ],
210
- });
211
- });
212
- tx.setGasBudget(gasBudget);
213
- return [2 /*return*/, tx];
214
- });
165
+ function getCompoundTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, user) {
166
+ var result = tx.moveCall({
167
+ target: "".concat(packageId, "::tails_staking::compound"),
168
+ typeArguments: typeArguments,
169
+ arguments: [
170
+ tx.object(registry),
171
+ tx.pure(index),
172
+ tx.makeMoveVec({
173
+ type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
174
+ objects: receipts.map(function (id) { return tx.object(id); }),
175
+ }),
176
+ tx.object(constants_1.CLOCK),
177
+ ],
178
+ });
179
+ tx.moveCall({
180
+ target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
181
+ arguments: [tx.object(result[0]), tx.pure(user)],
215
182
  });
183
+ return tx;
216
184
  }
217
- exports.getClaimTx = getClaimTx;
185
+ exports.getCompoundTx = getCompoundTx;
218
186
  /**
219
- public(friend) entry fun harvest<D_TOKEN, B_TOKEN>(
187
+ public fun claim<D_TOKEN, B_TOKEN>(
220
188
  registry: &mut Registry,
221
189
  index: u64,
222
190
  receipts: vector<TypusDepositReceipt>,
223
191
  ctx: &mut TxContext,
224
192
  )
225
193
  */
226
- function getHarvestTx(gasBudget, typusFrameworkPackageId, packageId, registry, requests) {
227
- return __awaiter(this, void 0, void 0, function () {
228
- var tx;
229
- return __generator(this, function (_a) {
230
- tx = new transactions_1.TransactionBlock();
231
- requests.forEach(function (request) {
232
- tx.moveCall({
233
- target: "".concat(packageId, "::tds_user_entry::harvest"),
234
- typeArguments: request.typeArguments,
235
- arguments: [
236
- tx.object(registry),
237
- tx.pure(request.index),
238
- tx.makeMoveVec({
239
- type: "".concat(typusFrameworkPackageId, "::vault::TypusDepositReceipt"),
240
- objects: request.receipts.map(function (id) { return tx.object(id); }),
241
- }),
242
- ],
243
- });
244
- });
245
- tx.setGasBudget(gasBudget);
246
- return [2 /*return*/, tx];
247
- });
194
+ function getClaimTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, user) {
195
+ var result = tx.moveCall({
196
+ target: "".concat(packageId, "::tds_user_entry::claim"),
197
+ typeArguments: typeArguments,
198
+ arguments: [
199
+ tx.object(registry),
200
+ tx.pure(index),
201
+ tx.makeMoveVec({
202
+ type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
203
+ objects: receipts.map(function (id) { return tx.object(id); }),
204
+ }),
205
+ ],
248
206
  });
207
+ tx.moveCall({
208
+ target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
209
+ typeArguments: [typeArguments[0]],
210
+ arguments: [tx.object(result[0]), tx.pure(user)],
211
+ });
212
+ tx.moveCall({
213
+ target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
214
+ arguments: [tx.object(result[1]), tx.pure(user)],
215
+ });
216
+ return tx;
249
217
  }
250
- exports.getHarvestTx = getHarvestTx;
251
- function getBatchClaimHarvestWithdrawRedeemTx(gasBudget, typusFrameworkPackageId, packageId, registry, claimRequests, harvestRequests, withdrawRequests, redeemRequests) {
252
- return __awaiter(this, void 0, void 0, function () {
253
- var tx;
254
- return __generator(this, function (_a) {
255
- tx = new transactions_1.TransactionBlock();
256
- claimRequests.forEach(function (request) {
257
- tx.moveCall({
258
- target: "".concat(packageId, "::tds_user_entry::claim"),
259
- typeArguments: request.typeArguments,
260
- arguments: [
261
- tx.object(registry),
262
- tx.pure(request.index),
263
- tx.makeMoveVec({
264
- type: "".concat(typusFrameworkPackageId, "::vault::TypusDepositReceipt"),
265
- objects: request.receipts.map(function (id) { return tx.object(id); }),
266
- }),
267
- ],
268
- });
269
- });
270
- harvestRequests.forEach(function (request) {
271
- tx.moveCall({
272
- target: "".concat(packageId, "::tds_user_entry::harvest"),
273
- typeArguments: request.typeArguments,
274
- arguments: [
275
- tx.object(registry),
276
- tx.pure(request.index),
277
- tx.makeMoveVec({
278
- type: "".concat(typusFrameworkPackageId, "::vault::TypusDepositReceipt"),
279
- objects: request.receipts.map(function (id) { return tx.object(id); }),
280
- }),
281
- ],
282
- });
283
- });
284
- withdrawRequests.forEach(function (request) {
285
- tx.moveCall({
286
- target: "".concat(packageId, "::tails_staking::withdraw"),
287
- typeArguments: request.typeArguments,
288
- arguments: [
289
- tx.object(registry),
290
- tx.pure(request.index),
291
- tx.makeMoveVec({
292
- type: "".concat(typusFrameworkPackageId, "::vault::TypusDepositReceipt"),
293
- objects: request.receipts.map(function (id) { return tx.object(id); }),
294
- }),
295
- tx.pure([]),
296
- tx.pure(constants_1.CLOCK),
297
- ],
298
- });
299
- });
300
- redeemRequests.forEach(function (request) {
301
- tx.moveCall({
302
- target: "".concat(packageId, "::tds_user_entry::redeem"),
303
- typeArguments: request.typeArguments,
304
- arguments: [
305
- tx.object(registry),
306
- tx.pure(request.index),
307
- tx.makeMoveVec({
308
- type: "".concat(typusFrameworkPackageId, "::vault::TypusDepositReceipt"),
309
- objects: request.receipts.map(function (id) { return tx.object(id); }),
310
- }),
311
- tx.pure(constants_1.CLOCK),
312
- ],
313
- });
314
- });
315
- tx.setGasBudget(gasBudget);
316
- return [2 /*return*/, tx];
317
- });
218
+ exports.getClaimTx = getClaimTx;
219
+ /**
220
+ public fun harvest<D_TOKEN, B_TOKEN>(
221
+ registry: &mut Registry,
222
+ index: u64,
223
+ receipts: vector<TypusDepositReceipt>,
224
+ ctx: &mut TxContext,
225
+ )
226
+ */
227
+ function getHarvestTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, user) {
228
+ var result = tx.moveCall({
229
+ target: "".concat(packageId, "::tds_user_entry::harvest"),
230
+ typeArguments: typeArguments,
231
+ arguments: [
232
+ tx.object(registry),
233
+ tx.pure(index),
234
+ tx.makeMoveVec({
235
+ type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
236
+ objects: receipts.map(function (id) { return tx.object(id); }),
237
+ }),
238
+ ],
239
+ });
240
+ tx.moveCall({
241
+ target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
242
+ typeArguments: [typeArguments[1]],
243
+ arguments: [tx.object(result[0]), tx.pure(user)],
318
244
  });
245
+ tx.moveCall({
246
+ target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
247
+ arguments: [tx.object(result[1]), tx.pure(user)],
248
+ });
249
+ return tx;
319
250
  }
320
- exports.getBatchClaimHarvestWithdrawRedeemTx = getBatchClaimHarvestWithdrawRedeemTx;
251
+ exports.getHarvestTx = getHarvestTx;
321
252
  /**
322
- public(friend) entry fun compound<D_TOKEN, B_TOKEN>(
253
+ public fun redeem<D_TOKEN, B_TOKEN, I_TOKEN>(
323
254
  registry: &mut Registry,
324
255
  index: u64,
325
256
  receipts: vector<TypusDepositReceipt>,
326
257
  ctx: &mut TxContext,
327
258
  )
328
259
  */
329
- function getCompoundTx(gasBudget, typusFrameworkPackageId, packageId, registry, requests) {
330
- return __awaiter(this, void 0, void 0, function () {
331
- var tx;
332
- return __generator(this, function (_a) {
333
- tx = new transactions_1.TransactionBlock();
334
- requests.forEach(function (request) {
335
- tx.moveCall({
336
- target: "".concat(packageId, "::tails_staking::compound"),
337
- typeArguments: request.typeArguments,
338
- arguments: [
339
- tx.object(registry),
340
- tx.pure(request.index),
341
- tx.makeMoveVec({
342
- type: "".concat(typusFrameworkPackageId, "::vault::TypusDepositReceipt"),
343
- objects: request.receipts.map(function (id) { return tx.object(id); }),
344
- }),
345
- tx.object(constants_1.CLOCK),
346
- ],
347
- });
348
- });
349
- tx.setGasBudget(gasBudget);
350
- return [2 /*return*/, tx];
351
- });
260
+ function getRedeemTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, user) {
261
+ var result = tx.moveCall({
262
+ target: "".concat(packageId, "::tds_user_entry::redeem"),
263
+ typeArguments: typeArguments,
264
+ arguments: [
265
+ tx.object(registry),
266
+ tx.pure(index),
267
+ tx.makeMoveVec({
268
+ type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
269
+ objects: receipts.map(function (id) { return tx.object(id); }),
270
+ }),
271
+ ],
272
+ });
273
+ tx.moveCall({
274
+ target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
275
+ typeArguments: [typeArguments[2]],
276
+ arguments: [tx.object(result[0]), tx.pure(user)],
277
+ });
278
+ tx.moveCall({
279
+ target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
280
+ arguments: [tx.object(result[1]), tx.pure(user)],
352
281
  });
282
+ return tx;
353
283
  }
354
- exports.getCompoundTx = getCompoundTx;
284
+ exports.getRedeemTx = getRedeemTx;
355
285
  /**
356
286
  public(friend) entry fun new_bid<D_TOKEN, B_TOKEN>(
357
287
  registry: &mut Registry,
@@ -362,110 +292,96 @@ exports.getCompoundTx = getCompoundTx;
362
292
  ctx: &mut TxContext,
363
293
  )
364
294
  */
365
- function getNewBidTx(gasBudget, packageId, typeArguments, registry, index, coins, size, premium_required, // fe float * b_token_decimal
366
- usingSponsoredGasCoin) {
295
+ function getNewBidTx(tx, packageId, typeArguments, registry, index, coins, size, premium_required, // fe float * b_token_decimal
296
+ user, usingSponsoredGasCoin) {
367
297
  if (usingSponsoredGasCoin === void 0) { usingSponsoredGasCoin = false; }
368
- return __awaiter(this, void 0, void 0, function () {
369
- var tx, _a, coin;
370
- return __generator(this, function (_b) {
371
- tx = new transactions_1.TransactionBlock();
372
- if (!usingSponsoredGasCoin &&
373
- (typeArguments[1] == "0x2::sui::SUI" ||
374
- typeArguments[1] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
375
- _a = __read(tx.splitCoins(tx.gas, [tx.pure(premium_required)]), 1), coin = _a[0];
376
- tx.moveCall({
377
- target: "".concat(packageId, "::tails_staking::new_bid"),
378
- typeArguments: typeArguments,
379
- arguments: [tx.object(registry), tx.pure(index), tx.makeMoveVec({ objects: [coin] }), tx.pure(size), tx.pure("0x6")],
380
- });
381
- }
382
- else {
383
- tx.moveCall({
384
- target: "".concat(packageId, "::tails_staking::new_bid"),
385
- typeArguments: typeArguments,
386
- arguments: [
387
- tx.object(registry),
388
- tx.pure(index),
389
- tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
390
- tx.pure(size),
391
- tx.pure("0x6"),
392
- ],
393
- });
394
- }
395
- tx.setGasBudget(gasBudget);
396
- return [2 /*return*/, tx];
298
+ if (!usingSponsoredGasCoin &&
299
+ (typeArguments[1] == "0x2::sui::SUI" ||
300
+ typeArguments[1] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
301
+ var _a = __read(tx.splitCoins(tx.gas, [tx.pure(premium_required)]), 1), coin = _a[0];
302
+ var result = tx.moveCall({
303
+ target: "".concat(packageId, "::tails_staking::new_bid"),
304
+ typeArguments: typeArguments,
305
+ arguments: [tx.object(registry), tx.pure(index), tx.makeMoveVec({ objects: [coin] }), tx.pure(size), tx.pure("0x6")],
397
306
  });
398
- });
307
+ tx.transferObjects([tx.object(result[0])], user);
308
+ }
309
+ else {
310
+ var result = tx.moveCall({
311
+ target: "".concat(packageId, "::tails_staking::new_bid"),
312
+ typeArguments: typeArguments,
313
+ arguments: [
314
+ tx.object(registry),
315
+ tx.pure(index),
316
+ tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
317
+ tx.pure(size),
318
+ tx.pure("0x6"),
319
+ ],
320
+ });
321
+ tx.transferObjects([tx.object(result[0])], user);
322
+ }
323
+ return tx;
399
324
  }
400
325
  exports.getNewBidTx = getNewBidTx;
401
326
  /**
402
- public(friend) entry fun transfer_bid_receipt<D_TOKEN, B_TOKEN>(
327
+ public(friend) entry fun exercise<D_TOKEN, B_TOKEN>(
403
328
  registry: &mut Registry,
404
329
  index: u64,
405
330
  receipts: vector<TypusBidReceipt>,
406
- share: Option<u64>,
407
- recipient: address,
408
331
  ctx: &mut TxContext,
409
- ) {
332
+ )
410
333
  */
411
- function getTransferBidReceiptTx(input) {
412
- return __awaiter(this, void 0, void 0, function () {
413
- var tx;
414
- return __generator(this, function (_a) {
415
- tx = new transactions_1.TransactionBlock();
416
- tx.moveCall({
417
- target: "".concat(input.packageId, "::tds_user_entry::transfer_bid_receipt"),
418
- typeArguments: input.typeArguments,
419
- arguments: [
420
- tx.object(input.registry),
421
- tx.pure(input.index),
422
- tx.makeMoveVec({
423
- type: "".concat(input.typusFrameworkPackageId, "::vault::TypusBidReceipt"),
424
- objects: input.receipts.map(function (id) { return tx.object(id); }),
425
- }),
426
- tx.pure(input.share ? [input.share] : []),
427
- tx.pure(input.recipient),
428
- ],
429
- });
430
- tx.setGasBudget(input.gasBudget);
431
- return [2 /*return*/, tx];
432
- });
334
+ function getExerciseTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, user) {
335
+ var result = tx.moveCall({
336
+ target: "".concat(packageId, "::tds_user_entry::exercise"),
337
+ typeArguments: typeArguments,
338
+ arguments: [
339
+ tx.object(registry),
340
+ tx.pure(index),
341
+ tx.makeMoveVec({
342
+ type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusBidReceipt"),
343
+ objects: receipts.map(function (id) { return tx.object(id); }),
344
+ }),
345
+ ],
433
346
  });
347
+ tx.moveCall({
348
+ target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
349
+ typeArguments: [typeArguments[0]],
350
+ arguments: [tx.object(result[0]), tx.pure(user)],
351
+ });
352
+ return tx;
434
353
  }
435
- exports.getTransferBidReceiptTx = getTransferBidReceiptTx;
354
+ exports.getExerciseTx = getExerciseTx;
436
355
  /**
437
- public(friend) entry fun exercise<D_TOKEN, B_TOKEN>(
356
+ public(friend) entry fun transfer_bid_receipt<D_TOKEN, B_TOKEN>(
438
357
  registry: &mut Registry,
439
358
  index: u64,
440
359
  receipts: vector<TypusBidReceipt>,
360
+ share: Option<u64>,
361
+ recipient: address,
441
362
  ctx: &mut TxContext,
442
- )
363
+ ) {
443
364
  */
444
- function getExerciseTx(gasBudget, typusFrameworkPackageId, packageId, registry, requests) {
445
- return __awaiter(this, void 0, void 0, function () {
446
- var tx;
447
- return __generator(this, function (_a) {
448
- tx = new transactions_1.TransactionBlock();
449
- requests.forEach(function (request) {
450
- tx.moveCall({
451
- target: "".concat(packageId, "::tds_user_entry::exercise"),
452
- typeArguments: request.typeArguments,
453
- arguments: [
454
- tx.object(registry),
455
- tx.pure(request.index),
456
- tx.makeMoveVec({
457
- type: "".concat(typusFrameworkPackageId, "::vault::TypusBidReceipt"),
458
- objects: request.receipts.map(function (id) { return tx.object(id); }),
459
- }),
460
- ],
461
- });
462
- });
463
- tx.setGasBudget(gasBudget);
464
- return [2 /*return*/, tx];
465
- });
365
+ function getTransferBidReceiptTx(input) {
366
+ var tx = new transactions_1.TransactionBlock();
367
+ tx.moveCall({
368
+ target: "".concat(input.packageId, "::tds_user_entry::transfer_bid_receipt"),
369
+ typeArguments: input.typeArguments,
370
+ arguments: [
371
+ tx.object(input.registry),
372
+ tx.pure(input.index),
373
+ tx.makeMoveVec({
374
+ type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusBidReceipt"),
375
+ objects: input.receipts.map(function (id) { return tx.object(id); }),
376
+ }),
377
+ tx.pure(input.share ? [input.share] : []),
378
+ tx.pure(input.recipient),
379
+ ],
466
380
  });
381
+ tx.setGasBudget(input.gasBudget);
382
+ return tx;
467
383
  }
468
- exports.getExerciseTx = getExerciseTx;
384
+ exports.getTransferBidReceiptTx = getTransferBidReceiptTx;
469
385
  /**
470
386
  public(friend) entry fun refund<TOKEN>(
471
387
  registry: &mut Registry,
@@ -473,21 +389,16 @@ exports.getExerciseTx = getExerciseTx;
473
389
  )
474
390
  */
475
391
  function getRebateTx(gasBudget, packageId, typeArguments, registry) {
476
- return __awaiter(this, void 0, void 0, function () {
477
- var tx;
478
- return __generator(this, function (_a) {
479
- tx = new transactions_1.TransactionBlock();
480
- typeArguments.forEach(function (typeArgument) {
481
- tx.moveCall({
482
- target: "".concat(packageId, "::tds_user_entry::rebate"),
483
- typeArguments: [typeArgument],
484
- arguments: [tx.object(registry)],
485
- });
486
- });
487
- tx.setGasBudget(gasBudget);
488
- return [2 /*return*/, tx];
392
+ var tx = new transactions_1.TransactionBlock();
393
+ typeArguments.forEach(function (typeArgument) {
394
+ tx.moveCall({
395
+ target: "".concat(packageId, "::tds_user_entry::rebate"),
396
+ typeArguments: [typeArgument],
397
+ arguments: [tx.object(registry)],
489
398
  });
490
399
  });
400
+ tx.setGasBudget(gasBudget);
401
+ return tx;
491
402
  }
492
403
  exports.getRebateTx = getRebateTx;
493
404
  /**
@@ -505,52 +416,47 @@ exports.getRebateTx = getRebateTx;
505
416
  */
506
417
  function getNewStrategyTx(gasBudget, packageId, typeArguments, // B_TOKEN
507
418
  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];
419
+ var tx = new transactions_1.TransactionBlock();
420
+ if (typeArguments[0] == "0x2::sui::SUI" ||
421
+ typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI") {
422
+ var _a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), input_coin = _a[0];
423
+ tx.moveCall({
424
+ target: "".concat(packageId, "::auto_bid::new_strategy"),
425
+ typeArguments: typeArguments,
426
+ arguments: [
427
+ tx.object(strategy_pool),
428
+ tx.pure(vault_index),
429
+ tx.pure(signal_index),
430
+ tx.pure(size),
431
+ tx.pure(price_percentage),
432
+ tx.pure(max_times),
433
+ tx.pure(target_rounds),
434
+ input_coin,
435
+ ],
553
436
  });
554
- });
437
+ }
438
+ else {
439
+ var coin = coins.pop();
440
+ if (coins.length > 0) {
441
+ tx.mergeCoins(tx.object(coin), coins.map(function (id) { return tx.object(id); }));
442
+ }
443
+ var _b = __read(tx.splitCoins(tx.object(coin), [tx.pure(amount)]), 1), input_coin = _b[0];
444
+ tx.moveCall({
445
+ target: "".concat(packageId, "::auto_bid::new_strategy"),
446
+ typeArguments: typeArguments,
447
+ arguments: [
448
+ tx.object(strategy_pool),
449
+ tx.pure(vault_index),
450
+ tx.pure(signal_index),
451
+ tx.pure(size),
452
+ tx.pure(price_percentage),
453
+ tx.pure(max_times),
454
+ tx.pure(target_rounds),
455
+ input_coin,
456
+ ],
457
+ });
458
+ }
459
+ tx.setGasBudget(gasBudget);
460
+ return tx;
555
461
  }
556
462
  exports.getNewStrategyTx = getNewStrategyTx;
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.55",
5
+ "version": "1.1.56",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.7.3",
8
8
  "@mysten/kiosk": "0.7.12",