@typus/typus-sdk 1.1.57 → 1.1.59
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.
- package/lib/mainnet.json +67 -0
- package/lib/utils/auto-bid/user-entry.d.ts +27 -0
- package/lib/utils/auto-bid/user-entry.js +102 -0
- package/lib/utils/auto-bid/view-function.d.ts +33 -0
- package/lib/utils/auto-bid/view-function.js +215 -0
- package/lib/utils/nft-staking/authorized-entry.d.ts +2 -2
- package/lib/utils/nft-staking/authorized-entry.js +29 -9
- package/lib/utils/nft-staking/user-entry.d.ts +3 -3
- package/lib/utils/nft-staking/user-entry.js +6 -6
- package/lib/utils/price.d.ts +2 -0
- package/lib/utils/price.js +101 -1
- package/lib/utils/recap2023.d.ts +1 -0
- package/lib/utils/recap2023.js +176 -0
- package/lib/utils/tails-exp-dice/fetch.d.ts +1 -0
- package/lib/utils/tails-exp-dice/fetch.js +9 -6
- package/lib/utils/token.js +4 -0
- package/lib/utils/typus-dov-single-v2/authorized-entry.d.ts +1 -0
- package/lib/utils/typus-dov-single-v2/authorized-entry.js +1 -0
- package/lib/utils/typus-dov-single-v2/mfud-user-entry.d.ts +125 -0
- package/lib/utils/typus-dov-single-v2/mfud-user-entry.js +270 -0
- package/lib/utils/typus-dov-single-v2/user-entry.d.ts +133 -30
- package/lib/utils/typus-dov-single-v2/user-entry.js +334 -253
- package/lib/utils/typus-dov-single-v2/user-history.js +8 -1
- package/package.json +1 -1
|
@@ -16,8 +16,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
16
16
|
return ar;
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
20
|
-
var transactions_1 = require("@mysten/sui.js/transactions");
|
|
19
|
+
exports.getRebateTx = exports.getTransferBidReceiptTx = exports.getExerciseTx = exports.getNewBidTx = exports.getWithdrawHarvestClaimTx = exports.getRedeemTx = exports.getHarvestTx = exports.getClaimTx = exports.getCompoundTx = exports.getUnsubscribeTx = exports.getWithdrawTx = exports.getDepositTx = void 0;
|
|
21
20
|
var constants_1 = require("../../constants");
|
|
22
21
|
/**
|
|
23
22
|
public fun deposit<D_TOKEN, B_TOKEN>(
|
|
@@ -30,58 +29,57 @@ var constants_1 = require("../../constants");
|
|
|
30
29
|
ctx: &mut TxContext,
|
|
31
30
|
)
|
|
32
31
|
*/
|
|
33
|
-
function getDepositTx(
|
|
34
|
-
if (usingSponsoredGasCoin
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
typeArguments: typeArguments,
|
|
32
|
+
function getDepositTx(input) {
|
|
33
|
+
if (!input.usingSponsoredGasCoin &&
|
|
34
|
+
(input.typeArguments[0] == "0x2::sui::SUI" ||
|
|
35
|
+
input.typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
|
|
36
|
+
var _a = __read(input.tx.splitCoins(input.tx.gas, [input.tx.pure(input.amount)]), 1), coin = _a[0];
|
|
37
|
+
var result = input.tx.moveCall({
|
|
38
|
+
target: "".concat(input.typusDovSinglePackageId, "::tails_staking::deposit"),
|
|
39
|
+
typeArguments: input.typeArguments,
|
|
42
40
|
arguments: [
|
|
43
|
-
tx.object(
|
|
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 (
|
|
41
|
+
input.tx.object(input.typusDovSingleRegistry),
|
|
42
|
+
input.tx.pure(input.index),
|
|
43
|
+
input.tx.makeMoveVec({ objects: [coin] }),
|
|
44
|
+
input.tx.pure(input.amount),
|
|
45
|
+
input.tx.makeMoveVec({
|
|
46
|
+
type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
47
|
+
objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
|
|
50
48
|
}),
|
|
51
|
-
tx.pure(constants_1.CLOCK),
|
|
49
|
+
input.tx.pure(constants_1.CLOCK),
|
|
52
50
|
],
|
|
53
51
|
});
|
|
54
|
-
tx.moveCall({
|
|
55
|
-
target: "".concat(typusFrameworkPackageId, "::utils::transfer_coins"),
|
|
56
|
-
typeArguments: [typeArguments[0]],
|
|
57
|
-
arguments: [tx.object(result[0]), tx.pure(user)],
|
|
52
|
+
input.tx.moveCall({
|
|
53
|
+
target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_coins"),
|
|
54
|
+
typeArguments: [input.typeArguments[0]],
|
|
55
|
+
arguments: [input.tx.object(result[0]), input.tx.pure(input.user)],
|
|
58
56
|
});
|
|
59
|
-
tx.transferObjects([tx.object(result[1])], user);
|
|
57
|
+
input.tx.transferObjects([input.tx.object(result[1])], input.user);
|
|
60
58
|
}
|
|
61
59
|
else {
|
|
62
|
-
var result = tx.moveCall({
|
|
63
|
-
target: "".concat(
|
|
64
|
-
typeArguments: typeArguments,
|
|
60
|
+
var result = input.tx.moveCall({
|
|
61
|
+
target: "".concat(input.typusDovSinglePackageId, "::tails_staking::deposit"),
|
|
62
|
+
typeArguments: input.typeArguments,
|
|
65
63
|
arguments: [
|
|
66
|
-
tx.object(
|
|
67
|
-
tx.pure(index),
|
|
68
|
-
tx.makeMoveVec({ objects: coins.map(function (
|
|
69
|
-
tx.pure(amount),
|
|
70
|
-
tx.makeMoveVec({
|
|
71
|
-
type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
72
|
-
objects: receipts.map(function (
|
|
64
|
+
input.tx.object(input.typusDovSingleRegistry),
|
|
65
|
+
input.tx.pure(input.index),
|
|
66
|
+
input.tx.makeMoveVec({ objects: input.coins.map(function (coin) { return input.tx.object(coin); }) }),
|
|
67
|
+
input.tx.pure(input.amount),
|
|
68
|
+
input.tx.makeMoveVec({
|
|
69
|
+
type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
70
|
+
objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
|
|
73
71
|
}),
|
|
74
|
-
tx.pure(constants_1.CLOCK),
|
|
72
|
+
input.tx.pure(constants_1.CLOCK),
|
|
75
73
|
],
|
|
76
74
|
});
|
|
77
|
-
tx.moveCall({
|
|
78
|
-
target: "".concat(typusFrameworkPackageId, "::utils::transfer_coins"),
|
|
79
|
-
typeArguments: [typeArguments[0]],
|
|
80
|
-
arguments: [tx.object(result[0]), tx.pure(user)],
|
|
75
|
+
input.tx.moveCall({
|
|
76
|
+
target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_coins"),
|
|
77
|
+
typeArguments: [input.typeArguments[0]],
|
|
78
|
+
arguments: [input.tx.object(result[0]), input.tx.pure(input.user)],
|
|
81
79
|
});
|
|
82
|
-
tx.transferObjects([tx.object(result[1])], user);
|
|
80
|
+
input.tx.transferObjects([input.tx.object(result[1])], input.user);
|
|
83
81
|
}
|
|
84
|
-
return tx;
|
|
82
|
+
return input.tx;
|
|
85
83
|
}
|
|
86
84
|
exports.getDepositTx = getDepositTx;
|
|
87
85
|
/**
|
|
@@ -94,31 +92,31 @@ exports.getDepositTx = getDepositTx;
|
|
|
94
92
|
ctx: &mut TxContext,
|
|
95
93
|
)
|
|
96
94
|
*/
|
|
97
|
-
function getWithdrawTx(
|
|
98
|
-
var result = tx.moveCall({
|
|
99
|
-
target: "".concat(
|
|
100
|
-
typeArguments: typeArguments,
|
|
95
|
+
function getWithdrawTx(input) {
|
|
96
|
+
var result = input.tx.moveCall({
|
|
97
|
+
target: "".concat(input.typusDovSinglePackageId, "::tails_staking::withdraw"),
|
|
98
|
+
typeArguments: input.typeArguments,
|
|
101
99
|
arguments: [
|
|
102
|
-
tx.object(
|
|
103
|
-
tx.pure(index),
|
|
104
|
-
tx.makeMoveVec({
|
|
105
|
-
type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
106
|
-
objects: receipts.map(function (
|
|
100
|
+
input.tx.object(input.typusDovSingleRegistry),
|
|
101
|
+
input.tx.pure(input.index),
|
|
102
|
+
input.tx.makeMoveVec({
|
|
103
|
+
type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
104
|
+
objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
|
|
107
105
|
}),
|
|
108
|
-
tx.pure(share ? [share] : []),
|
|
109
|
-
tx.pure(constants_1.CLOCK),
|
|
106
|
+
input.tx.pure(input.share ? [input.share] : []),
|
|
107
|
+
input.tx.pure(constants_1.CLOCK),
|
|
110
108
|
],
|
|
111
109
|
});
|
|
112
|
-
tx.moveCall({
|
|
113
|
-
target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
114
|
-
typeArguments: [typeArguments[0]],
|
|
115
|
-
arguments: [tx.object(result[0]), tx.pure(user)],
|
|
110
|
+
input.tx.moveCall({
|
|
111
|
+
target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
112
|
+
typeArguments: [input.typeArguments[0]],
|
|
113
|
+
arguments: [input.tx.object(result[0]), input.tx.pure(input.user)],
|
|
116
114
|
});
|
|
117
|
-
tx.moveCall({
|
|
118
|
-
target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
|
|
119
|
-
arguments: [tx.object(result[1]), tx.pure(user)],
|
|
115
|
+
input.tx.moveCall({
|
|
116
|
+
target: "".concat(input.typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
|
|
117
|
+
arguments: [input.tx.object(result[1]), input.tx.pure(input.user)],
|
|
120
118
|
});
|
|
121
|
-
return tx;
|
|
119
|
+
return input.tx;
|
|
122
120
|
}
|
|
123
121
|
exports.getWithdrawTx = getWithdrawTx;
|
|
124
122
|
/**
|
|
@@ -131,23 +129,23 @@ exports.getWithdrawTx = getWithdrawTx;
|
|
|
131
129
|
ctx: &mut TxContext,
|
|
132
130
|
)
|
|
133
131
|
*/
|
|
134
|
-
function getUnsubscribeTx(
|
|
135
|
-
var result = tx.moveCall({
|
|
136
|
-
target: "".concat(
|
|
137
|
-
typeArguments: typeArguments,
|
|
132
|
+
function getUnsubscribeTx(input) {
|
|
133
|
+
var result = input.tx.moveCall({
|
|
134
|
+
target: "".concat(input.typusDovSinglePackageId, "::tails_staking::unsubscribe"),
|
|
135
|
+
typeArguments: input.typeArguments,
|
|
138
136
|
arguments: [
|
|
139
|
-
tx.object(
|
|
140
|
-
tx.pure(index),
|
|
141
|
-
tx.makeMoveVec({
|
|
142
|
-
type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
143
|
-
objects: receipts.map(function (
|
|
137
|
+
input.tx.object(input.typusDovSingleRegistry),
|
|
138
|
+
input.tx.pure(input.index),
|
|
139
|
+
input.tx.makeMoveVec({
|
|
140
|
+
type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
141
|
+
objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
|
|
144
142
|
}),
|
|
145
|
-
tx.pure(share ? [share] : []),
|
|
146
|
-
tx.pure(constants_1.CLOCK),
|
|
143
|
+
input.tx.pure(input.share ? [input.share] : []),
|
|
144
|
+
input.tx.pure(constants_1.CLOCK),
|
|
147
145
|
],
|
|
148
146
|
});
|
|
149
|
-
tx.transferObjects([tx.object(result[0])], user);
|
|
150
|
-
return tx;
|
|
147
|
+
input.tx.transferObjects([input.tx.object(result[0])], input.user);
|
|
148
|
+
return input.tx;
|
|
151
149
|
}
|
|
152
150
|
exports.getUnsubscribeTx = getUnsubscribeTx;
|
|
153
151
|
/**
|
|
@@ -159,22 +157,38 @@ exports.getUnsubscribeTx = getUnsubscribeTx;
|
|
|
159
157
|
ctx: &mut TxContext,
|
|
160
158
|
)
|
|
161
159
|
*/
|
|
162
|
-
function getCompoundTx(
|
|
163
|
-
var result = tx.moveCall({
|
|
164
|
-
target: "".concat(
|
|
165
|
-
typeArguments: typeArguments,
|
|
160
|
+
function getCompoundTx(input) {
|
|
161
|
+
var result = input.tx.moveCall({
|
|
162
|
+
target: "".concat(input.typusDovSinglePackageId, "::tails_staking::compound"),
|
|
163
|
+
typeArguments: input.typeArguments,
|
|
166
164
|
arguments: [
|
|
167
|
-
tx.object(
|
|
168
|
-
tx.pure(index),
|
|
169
|
-
tx.makeMoveVec({
|
|
170
|
-
type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
171
|
-
objects: receipts.map(function (
|
|
165
|
+
input.tx.object(input.typusDovSingleRegistry),
|
|
166
|
+
input.tx.pure(input.index),
|
|
167
|
+
input.tx.makeMoveVec({
|
|
168
|
+
type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
169
|
+
objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
|
|
172
170
|
}),
|
|
173
|
-
tx.object(constants_1.CLOCK),
|
|
171
|
+
input.tx.object(constants_1.CLOCK),
|
|
174
172
|
],
|
|
175
173
|
});
|
|
176
|
-
|
|
177
|
-
|
|
174
|
+
if (input.incentiveToken) {
|
|
175
|
+
input.typeArguments.push(input.incentiveToken);
|
|
176
|
+
input.tx = getRedeemTx({
|
|
177
|
+
tx: input.tx,
|
|
178
|
+
typusFrameworkOriginPackageId: input.typusFrameworkOriginPackageId,
|
|
179
|
+
typusFrameworkPackageId: input.typusFrameworkPackageId,
|
|
180
|
+
typusDovSinglePackageId: input.typusDovSinglePackageId,
|
|
181
|
+
typusDovSingleRegistry: input.typusDovSingleRegistry,
|
|
182
|
+
typeArguments: input.typeArguments,
|
|
183
|
+
index: input.index,
|
|
184
|
+
receipts: [input.tx.object(result[0])],
|
|
185
|
+
user: input.user,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
input.tx.transferObjects([input.tx.object(result[0])], input.user);
|
|
190
|
+
}
|
|
191
|
+
return input.tx;
|
|
178
192
|
}
|
|
179
193
|
exports.getCompoundTx = getCompoundTx;
|
|
180
194
|
/**
|
|
@@ -185,29 +199,29 @@ exports.getCompoundTx = getCompoundTx;
|
|
|
185
199
|
ctx: &mut TxContext,
|
|
186
200
|
)
|
|
187
201
|
*/
|
|
188
|
-
function getClaimTx(
|
|
189
|
-
var result = tx.moveCall({
|
|
190
|
-
target: "".concat(
|
|
191
|
-
typeArguments: typeArguments,
|
|
202
|
+
function getClaimTx(input) {
|
|
203
|
+
var result = input.tx.moveCall({
|
|
204
|
+
target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::claim"),
|
|
205
|
+
typeArguments: input.typeArguments,
|
|
192
206
|
arguments: [
|
|
193
|
-
tx.object(
|
|
194
|
-
tx.pure(index),
|
|
195
|
-
tx.makeMoveVec({
|
|
196
|
-
type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
197
|
-
objects: receipts.map(function (
|
|
207
|
+
input.tx.object(input.typusDovSingleRegistry),
|
|
208
|
+
input.tx.pure(input.index),
|
|
209
|
+
input.tx.makeMoveVec({
|
|
210
|
+
type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
211
|
+
objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
|
|
198
212
|
}),
|
|
199
213
|
],
|
|
200
214
|
});
|
|
201
|
-
tx.moveCall({
|
|
202
|
-
target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
203
|
-
typeArguments: [typeArguments[0]],
|
|
204
|
-
arguments: [tx.object(result[0]), tx.pure(user)],
|
|
215
|
+
input.tx.moveCall({
|
|
216
|
+
target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
217
|
+
typeArguments: [input.typeArguments[0]],
|
|
218
|
+
arguments: [input.tx.object(result[0]), input.tx.pure(input.user)],
|
|
205
219
|
});
|
|
206
|
-
tx.moveCall({
|
|
207
|
-
target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
|
|
208
|
-
arguments: [tx.object(result[1]), tx.pure(user)],
|
|
220
|
+
input.tx.moveCall({
|
|
221
|
+
target: "".concat(input.typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
|
|
222
|
+
arguments: [input.tx.object(result[1]), input.tx.pure(input.user)],
|
|
209
223
|
});
|
|
210
|
-
return tx;
|
|
224
|
+
return input.tx;
|
|
211
225
|
}
|
|
212
226
|
exports.getClaimTx = getClaimTx;
|
|
213
227
|
/**
|
|
@@ -218,29 +232,50 @@ exports.getClaimTx = getClaimTx;
|
|
|
218
232
|
ctx: &mut TxContext,
|
|
219
233
|
)
|
|
220
234
|
*/
|
|
221
|
-
function getHarvestTx(
|
|
222
|
-
var result = tx.moveCall({
|
|
223
|
-
target: "".concat(
|
|
224
|
-
typeArguments: typeArguments,
|
|
235
|
+
function getHarvestTx(input) {
|
|
236
|
+
var result = input.tx.moveCall({
|
|
237
|
+
target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::harvest"),
|
|
238
|
+
typeArguments: input.typeArguments,
|
|
225
239
|
arguments: [
|
|
226
|
-
tx.object(
|
|
227
|
-
tx.pure(index),
|
|
228
|
-
tx.makeMoveVec({
|
|
229
|
-
type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
230
|
-
objects: receipts.map(function (
|
|
240
|
+
input.tx.object(input.typusDovSingleRegistry),
|
|
241
|
+
input.tx.pure(input.index),
|
|
242
|
+
input.tx.makeMoveVec({
|
|
243
|
+
type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
244
|
+
objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
|
|
231
245
|
}),
|
|
232
246
|
],
|
|
233
247
|
});
|
|
234
|
-
tx.moveCall({
|
|
235
|
-
target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
236
|
-
typeArguments: [typeArguments[1]],
|
|
237
|
-
arguments: [tx.object(result[0]), tx.pure(user)],
|
|
238
|
-
});
|
|
239
|
-
tx.moveCall({
|
|
240
|
-
target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
|
|
241
|
-
arguments: [tx.object(result[1]), tx.pure(user)],
|
|
248
|
+
input.tx.moveCall({
|
|
249
|
+
target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
250
|
+
typeArguments: [input.typeArguments[1]],
|
|
251
|
+
arguments: [input.tx.object(result[0]), input.tx.pure(input.user)],
|
|
242
252
|
});
|
|
243
|
-
|
|
253
|
+
if (input.incentiveToken) {
|
|
254
|
+
input.typeArguments.push(input.incentiveToken);
|
|
255
|
+
var receipt = input.tx.moveCall({
|
|
256
|
+
target: "0x1::option::destroy_some",
|
|
257
|
+
typeArguments: ["".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt")],
|
|
258
|
+
arguments: [input.tx.object(result[1])],
|
|
259
|
+
});
|
|
260
|
+
input.tx = getRedeemTx({
|
|
261
|
+
tx: input.tx,
|
|
262
|
+
typusFrameworkOriginPackageId: input.typusFrameworkOriginPackageId,
|
|
263
|
+
typusFrameworkPackageId: input.typusFrameworkPackageId,
|
|
264
|
+
typusDovSinglePackageId: input.typusDovSinglePackageId,
|
|
265
|
+
typusDovSingleRegistry: input.typusDovSingleRegistry,
|
|
266
|
+
typeArguments: input.typeArguments,
|
|
267
|
+
index: input.index,
|
|
268
|
+
receipts: [input.tx.object(receipt)],
|
|
269
|
+
user: input.user,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
input.tx.moveCall({
|
|
274
|
+
target: "".concat(input.typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
|
|
275
|
+
arguments: [input.tx.object(result[1]), input.tx.pure(input.user)],
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
return input.tx;
|
|
244
279
|
}
|
|
245
280
|
exports.getHarvestTx = getHarvestTx;
|
|
246
281
|
/**
|
|
@@ -251,31 +286,128 @@ exports.getHarvestTx = getHarvestTx;
|
|
|
251
286
|
ctx: &mut TxContext,
|
|
252
287
|
)
|
|
253
288
|
*/
|
|
254
|
-
function getRedeemTx(
|
|
255
|
-
var result = tx.moveCall({
|
|
256
|
-
target: "".concat(
|
|
257
|
-
typeArguments: typeArguments,
|
|
289
|
+
function getRedeemTx(input) {
|
|
290
|
+
var result = input.tx.moveCall({
|
|
291
|
+
target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::redeem"),
|
|
292
|
+
typeArguments: input.typeArguments,
|
|
258
293
|
arguments: [
|
|
259
|
-
tx.object(
|
|
260
|
-
tx.pure(index),
|
|
261
|
-
tx.makeMoveVec({
|
|
262
|
-
type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
263
|
-
objects: receipts.map(function (
|
|
294
|
+
input.tx.object(input.typusDovSingleRegistry),
|
|
295
|
+
input.tx.pure(input.index),
|
|
296
|
+
input.tx.makeMoveVec({
|
|
297
|
+
type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
298
|
+
objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
|
|
264
299
|
}),
|
|
265
300
|
],
|
|
266
301
|
});
|
|
267
|
-
tx.moveCall({
|
|
268
|
-
target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
269
|
-
typeArguments: [typeArguments[2]],
|
|
270
|
-
arguments: [tx.object(result[0]), tx.pure(user)],
|
|
302
|
+
input.tx.moveCall({
|
|
303
|
+
target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
304
|
+
typeArguments: [input.typeArguments[2]],
|
|
305
|
+
arguments: [input.tx.object(result[0]), input.tx.pure(input.user)],
|
|
271
306
|
});
|
|
272
|
-
tx.moveCall({
|
|
273
|
-
target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
|
|
274
|
-
arguments: [tx.object(result[1]), tx.pure(user)],
|
|
307
|
+
input.tx.moveCall({
|
|
308
|
+
target: "".concat(input.typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
|
|
309
|
+
arguments: [input.tx.object(result[1]), input.tx.pure(input.user)],
|
|
275
310
|
});
|
|
276
|
-
return tx;
|
|
311
|
+
return input.tx;
|
|
277
312
|
}
|
|
278
313
|
exports.getRedeemTx = getRedeemTx;
|
|
314
|
+
function getWithdrawHarvestClaimTx(input) {
|
|
315
|
+
var result = input.withdraw
|
|
316
|
+
? input.tx.moveCall({
|
|
317
|
+
target: "".concat(input.typusDovSinglePackageId, "::tails_staking::withdraw"),
|
|
318
|
+
typeArguments: input.typeArguments,
|
|
319
|
+
arguments: [
|
|
320
|
+
input.tx.object(input.typusDovSingleRegistry),
|
|
321
|
+
input.tx.pure(input.index),
|
|
322
|
+
input.tx.makeMoveVec({
|
|
323
|
+
type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
324
|
+
objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
|
|
325
|
+
}),
|
|
326
|
+
input.tx.pure([]),
|
|
327
|
+
input.tx.pure(constants_1.CLOCK),
|
|
328
|
+
],
|
|
329
|
+
})
|
|
330
|
+
: undefined;
|
|
331
|
+
if (input.withdraw) {
|
|
332
|
+
input.tx.moveCall({
|
|
333
|
+
target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
334
|
+
typeArguments: [input.typeArguments[0]],
|
|
335
|
+
arguments: [input.tx.object(result[0]), input.tx.pure(input.user)],
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
result = input.harvest
|
|
339
|
+
? input.tx.moveCall({
|
|
340
|
+
target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::harvest"),
|
|
341
|
+
typeArguments: input.typeArguments,
|
|
342
|
+
arguments: [
|
|
343
|
+
input.tx.object(input.typusDovSingleRegistry),
|
|
344
|
+
input.tx.pure(input.index),
|
|
345
|
+
input.tx.makeMoveVec({
|
|
346
|
+
type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
347
|
+
objects: result ? [result[1]] : input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
|
|
348
|
+
}),
|
|
349
|
+
],
|
|
350
|
+
})
|
|
351
|
+
: result;
|
|
352
|
+
if (input.harvest) {
|
|
353
|
+
input.tx.moveCall({
|
|
354
|
+
target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
355
|
+
typeArguments: [input.typeArguments[1]],
|
|
356
|
+
arguments: [input.tx.object(result[0]), input.tx.pure(input.user)],
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
result = input.claim
|
|
360
|
+
? input.tx.moveCall({
|
|
361
|
+
target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::claim"),
|
|
362
|
+
typeArguments: input.typeArguments,
|
|
363
|
+
arguments: [
|
|
364
|
+
input.tx.object(input.typusDovSingleRegistry),
|
|
365
|
+
input.tx.pure(input.index),
|
|
366
|
+
input.tx.makeMoveVec({
|
|
367
|
+
type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
368
|
+
objects: result ? [result[1]] : input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
|
|
369
|
+
}),
|
|
370
|
+
],
|
|
371
|
+
})
|
|
372
|
+
: result;
|
|
373
|
+
if (input.claim) {
|
|
374
|
+
input.tx.moveCall({
|
|
375
|
+
target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
376
|
+
typeArguments: [input.typeArguments[0]],
|
|
377
|
+
arguments: [input.tx.object(result[0]), input.tx.pure(input.user)],
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
if (input.incentiveToken) {
|
|
381
|
+
input.typeArguments.push(input.incentiveToken);
|
|
382
|
+
var receipts = result
|
|
383
|
+
? [
|
|
384
|
+
input.tx.object(input.tx.moveCall({
|
|
385
|
+
target: "0x1::option::destroy_some",
|
|
386
|
+
arguments: [input.tx.object(result[1])],
|
|
387
|
+
})),
|
|
388
|
+
]
|
|
389
|
+
: input.receipts.map(function (receipt) { return input.tx.object(receipt); });
|
|
390
|
+
input.tx = getRedeemTx({
|
|
391
|
+
tx: input.tx,
|
|
392
|
+
typusFrameworkOriginPackageId: input.typusFrameworkOriginPackageId,
|
|
393
|
+
typusFrameworkPackageId: input.typusFrameworkPackageId,
|
|
394
|
+
typusDovSinglePackageId: input.typusDovSinglePackageId,
|
|
395
|
+
typusDovSingleRegistry: input.typusDovSingleRegistry,
|
|
396
|
+
typeArguments: input.typeArguments,
|
|
397
|
+
index: input.index,
|
|
398
|
+
receipts: receipts,
|
|
399
|
+
user: input.user,
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
else {
|
|
403
|
+
input.tx.moveCall({
|
|
404
|
+
target: "".concat(input.typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
|
|
405
|
+
arguments: [input.tx.object(result[1]), input.tx.pure(input.user)],
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
return input.tx;
|
|
409
|
+
}
|
|
410
|
+
exports.getWithdrawHarvestClaimTx = getWithdrawHarvestClaimTx;
|
|
279
411
|
/**
|
|
280
412
|
public(friend) entry fun new_bid<D_TOKEN, B_TOKEN>(
|
|
281
413
|
registry: &mut Registry,
|
|
@@ -286,35 +418,39 @@ exports.getRedeemTx = getRedeemTx;
|
|
|
286
418
|
ctx: &mut TxContext,
|
|
287
419
|
)
|
|
288
420
|
*/
|
|
289
|
-
function getNewBidTx(
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
(
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
421
|
+
function getNewBidTx(input) {
|
|
422
|
+
if (!input.usingSponsoredGasCoin &&
|
|
423
|
+
(input.typeArguments[1] == "0x2::sui::SUI" ||
|
|
424
|
+
input.typeArguments[1] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
|
|
425
|
+
var _a = __read(input.tx.splitCoins(input.tx.gas, [input.tx.pure(input.premium_required)]), 1), coin = _a[0];
|
|
426
|
+
var result = input.tx.moveCall({
|
|
427
|
+
target: "".concat(input.typusDovSinglePackageId, "::tails_staking::new_bid"),
|
|
428
|
+
typeArguments: input.typeArguments,
|
|
429
|
+
arguments: [
|
|
430
|
+
input.tx.object(input.typusDovSingleRegistry),
|
|
431
|
+
input.tx.pure(input.index),
|
|
432
|
+
input.tx.makeMoveVec({ objects: [coin] }),
|
|
433
|
+
input.tx.pure(input.size),
|
|
434
|
+
input.tx.pure("0x6"),
|
|
435
|
+
],
|
|
300
436
|
});
|
|
301
|
-
tx.transferObjects([tx.object(result[0])], user);
|
|
437
|
+
input.tx.transferObjects([input.tx.object(result[0])], input.user);
|
|
302
438
|
}
|
|
303
439
|
else {
|
|
304
|
-
var result = tx.moveCall({
|
|
305
|
-
target: "".concat(
|
|
306
|
-
typeArguments: typeArguments,
|
|
440
|
+
var result = input.tx.moveCall({
|
|
441
|
+
target: "".concat(input.typusDovSinglePackageId, "::tails_staking::new_bid"),
|
|
442
|
+
typeArguments: input.typeArguments,
|
|
307
443
|
arguments: [
|
|
308
|
-
tx.object(
|
|
309
|
-
tx.pure(index),
|
|
310
|
-
tx.makeMoveVec({ objects: coins.map(function (
|
|
311
|
-
tx.pure(size),
|
|
312
|
-
tx.pure("0x6"),
|
|
444
|
+
input.tx.object(input.typusDovSingleRegistry),
|
|
445
|
+
input.tx.pure(input.index),
|
|
446
|
+
input.tx.makeMoveVec({ objects: input.coins.map(function (coin) { return input.tx.object(coin); }) }),
|
|
447
|
+
input.tx.pure(input.size),
|
|
448
|
+
input.tx.pure("0x6"),
|
|
313
449
|
],
|
|
314
450
|
});
|
|
315
|
-
tx.transferObjects([tx.object(result[0])], user);
|
|
451
|
+
input.tx.transferObjects([input.tx.object(result[0])], input.user);
|
|
316
452
|
}
|
|
317
|
-
return tx;
|
|
453
|
+
return input.tx;
|
|
318
454
|
}
|
|
319
455
|
exports.getNewBidTx = getNewBidTx;
|
|
320
456
|
/**
|
|
@@ -325,25 +461,25 @@ exports.getNewBidTx = getNewBidTx;
|
|
|
325
461
|
ctx: &mut TxContext,
|
|
326
462
|
)
|
|
327
463
|
*/
|
|
328
|
-
function getExerciseTx(
|
|
329
|
-
var result = tx.moveCall({
|
|
330
|
-
target: "".concat(
|
|
331
|
-
typeArguments: typeArguments,
|
|
464
|
+
function getExerciseTx(input) {
|
|
465
|
+
var result = input.tx.moveCall({
|
|
466
|
+
target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::exercise"),
|
|
467
|
+
typeArguments: input.typeArguments,
|
|
332
468
|
arguments: [
|
|
333
|
-
tx.object(
|
|
334
|
-
tx.pure(index),
|
|
335
|
-
tx.makeMoveVec({
|
|
336
|
-
type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusBidReceipt"),
|
|
337
|
-
objects: receipts.map(function (
|
|
469
|
+
input.tx.object(input.typusDovSingleRegistry),
|
|
470
|
+
input.tx.pure(input.index),
|
|
471
|
+
input.tx.makeMoveVec({
|
|
472
|
+
type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusBidReceipt"),
|
|
473
|
+
objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
|
|
338
474
|
}),
|
|
339
475
|
],
|
|
340
476
|
});
|
|
341
|
-
tx.moveCall({
|
|
342
|
-
target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
343
|
-
typeArguments: [typeArguments[0]],
|
|
344
|
-
arguments: [tx.object(result[0]), tx.pure(user)],
|
|
477
|
+
input.tx.moveCall({
|
|
478
|
+
target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
479
|
+
typeArguments: [input.typeArguments[0]],
|
|
480
|
+
arguments: [input.tx.object(result[0]), input.tx.pure(input.user)],
|
|
345
481
|
});
|
|
346
|
-
return tx;
|
|
482
|
+
return input.tx;
|
|
347
483
|
}
|
|
348
484
|
exports.getExerciseTx = getExerciseTx;
|
|
349
485
|
/**
|
|
@@ -357,23 +493,21 @@ exports.getExerciseTx = getExerciseTx;
|
|
|
357
493
|
) {
|
|
358
494
|
*/
|
|
359
495
|
function getTransferBidReceiptTx(input) {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
target: "".concat(input.packageId, "::tds_user_entry::transfer_bid_receipt"),
|
|
496
|
+
input.tx.moveCall({
|
|
497
|
+
target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::transfer_bid_receipt"),
|
|
363
498
|
typeArguments: input.typeArguments,
|
|
364
499
|
arguments: [
|
|
365
|
-
tx.object(input.
|
|
366
|
-
tx.pure(input.index),
|
|
367
|
-
tx.makeMoveVec({
|
|
500
|
+
input.tx.object(input.typusDovSingleRegistry),
|
|
501
|
+
input.tx.pure(input.index),
|
|
502
|
+
input.tx.makeMoveVec({
|
|
368
503
|
type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusBidReceipt"),
|
|
369
|
-
objects: input.receipts.map(function (
|
|
504
|
+
objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
|
|
370
505
|
}),
|
|
371
|
-
tx.pure(input.share ? [input.share] : []),
|
|
372
|
-
tx.pure(input.recipient),
|
|
506
|
+
input.tx.pure(input.share ? [input.share] : []),
|
|
507
|
+
input.tx.pure(input.recipient),
|
|
373
508
|
],
|
|
374
509
|
});
|
|
375
|
-
|
|
376
|
-
return tx;
|
|
510
|
+
return input.tx;
|
|
377
511
|
}
|
|
378
512
|
exports.getTransferBidReceiptTx = getTransferBidReceiptTx;
|
|
379
513
|
/**
|
|
@@ -382,75 +516,22 @@ exports.getTransferBidReceiptTx = getTransferBidReceiptTx;
|
|
|
382
516
|
ctx: &mut TxContext,
|
|
383
517
|
)
|
|
384
518
|
*/
|
|
385
|
-
function getRebateTx(
|
|
386
|
-
var
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
519
|
+
function getRebateTx(input) {
|
|
520
|
+
var result = input.tx.moveCall({
|
|
521
|
+
target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::rebate"),
|
|
522
|
+
typeArguments: [input.typeArgument],
|
|
523
|
+
arguments: [input.tx.object(input.typusDovSingleRegistry)],
|
|
524
|
+
});
|
|
525
|
+
var balance = input.tx.moveCall({
|
|
526
|
+
target: "0x1::option::destroy_some",
|
|
527
|
+
typeArguments: ["0x2::balance::Balance<".concat(input.typeArgument, ">")],
|
|
528
|
+
arguments: [input.tx.object(result[0])],
|
|
529
|
+
});
|
|
530
|
+
input.tx.moveCall({
|
|
531
|
+
target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
532
|
+
typeArguments: [input.typeArgument],
|
|
533
|
+
arguments: [input.tx.object(balance), input.tx.pure(input.user)],
|
|
393
534
|
});
|
|
394
|
-
tx
|
|
395
|
-
return tx;
|
|
535
|
+
return input.tx;
|
|
396
536
|
}
|
|
397
537
|
exports.getRebateTx = getRebateTx;
|
|
398
|
-
/**
|
|
399
|
-
entry fun new_strategy<B_TOKEN>(
|
|
400
|
-
strategy_pool: &mut StrategyPool,
|
|
401
|
-
vault_index: u64,
|
|
402
|
-
signal_index: u64,
|
|
403
|
-
size: u64,
|
|
404
|
-
price_percentage: u64,
|
|
405
|
-
max_times: u64,
|
|
406
|
-
target_rounds: vector<u64>,
|
|
407
|
-
coin: Coin<B_TOKEN>,
|
|
408
|
-
ctx: &mut TxContext
|
|
409
|
-
)
|
|
410
|
-
*/
|
|
411
|
-
function getNewStrategyTx(gasBudget, packageId, typeArguments, // B_TOKEN
|
|
412
|
-
strategy_pool, vault_index, signal_index, coins, amount, size, price_percentage, max_times, target_rounds) {
|
|
413
|
-
var tx = new transactions_1.TransactionBlock();
|
|
414
|
-
if (typeArguments[0] == "0x2::sui::SUI" ||
|
|
415
|
-
typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI") {
|
|
416
|
-
var _a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), input_coin = _a[0];
|
|
417
|
-
tx.moveCall({
|
|
418
|
-
target: "".concat(packageId, "::auto_bid::new_strategy"),
|
|
419
|
-
typeArguments: typeArguments,
|
|
420
|
-
arguments: [
|
|
421
|
-
tx.object(strategy_pool),
|
|
422
|
-
tx.pure(vault_index),
|
|
423
|
-
tx.pure(signal_index),
|
|
424
|
-
tx.pure(size),
|
|
425
|
-
tx.pure(price_percentage),
|
|
426
|
-
tx.pure(max_times),
|
|
427
|
-
tx.pure(target_rounds),
|
|
428
|
-
input_coin,
|
|
429
|
-
],
|
|
430
|
-
});
|
|
431
|
-
}
|
|
432
|
-
else {
|
|
433
|
-
var coin = coins.pop();
|
|
434
|
-
if (coins.length > 0) {
|
|
435
|
-
tx.mergeCoins(tx.object(coin), coins.map(function (id) { return tx.object(id); }));
|
|
436
|
-
}
|
|
437
|
-
var _b = __read(tx.splitCoins(tx.object(coin), [tx.pure(amount)]), 1), input_coin = _b[0];
|
|
438
|
-
tx.moveCall({
|
|
439
|
-
target: "".concat(packageId, "::auto_bid::new_strategy"),
|
|
440
|
-
typeArguments: typeArguments,
|
|
441
|
-
arguments: [
|
|
442
|
-
tx.object(strategy_pool),
|
|
443
|
-
tx.pure(vault_index),
|
|
444
|
-
tx.pure(signal_index),
|
|
445
|
-
tx.pure(size),
|
|
446
|
-
tx.pure(price_percentage),
|
|
447
|
-
tx.pure(max_times),
|
|
448
|
-
tx.pure(target_rounds),
|
|
449
|
-
input_coin,
|
|
450
|
-
],
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
tx.setGasBudget(gasBudget);
|
|
454
|
-
return tx;
|
|
455
|
-
}
|
|
456
|
-
exports.getNewStrategyTx = getNewStrategyTx;
|