@typus/typus-sdk 1.4.17 → 1.4.19

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.
Files changed (37) hide show
  1. package/dist/config-mainnet.json +3 -3
  2. package/dist/src/auto-bid/token-user-entry.d.ts +9 -0
  3. package/dist/src/auto-bid/token-user-entry.js +126 -0
  4. package/dist/src/typus/airdrop/authority-entry.d.ts +14 -2
  5. package/dist/src/typus/airdrop/authority-entry.js +27 -32
  6. package/dist/src/typus/airdrop/user-entry.d.ts +2 -5
  7. package/dist/src/typus/airdrop/user-entry.js +8 -8
  8. package/dist/src/typus/airdrop/view-function.d.ts +2 -5
  9. package/dist/src/typus/airdrop/view-function.js +5 -5
  10. package/dist/src/typus/leaderboard/authority-entry.d.ts +10 -2
  11. package/dist/src/typus/leaderboard/authority-entry.js +12 -13
  12. package/dist/src/typus/leaderboard/view-function.d.ts +2 -5
  13. package/dist/src/typus/leaderboard/view-function.js +6 -6
  14. package/dist/src/typus/tails-staking/authority-entry.d.ts +12 -55
  15. package/dist/src/typus/tails-staking/authority-entry.js +73 -97
  16. package/dist/src/typus/tails-staking/user-entry.d.ts +14 -44
  17. package/dist/src/typus/tails-staking/user-entry.js +123 -123
  18. package/dist/src/typus/tails-staking/view-function.d.ts +3 -11
  19. package/dist/src/typus/tails-staking/view-function.js +10 -10
  20. package/dist/src/typus/user/view-function.d.ts +2 -5
  21. package/dist/src/typus/user/view-function.js +5 -5
  22. package/dist/src/typus-dov-single-v2/authority-entry.d.ts +26 -18
  23. package/dist/src/typus-dov-single-v2/authority-entry.js +23 -114
  24. package/dist/src/typus-dov-single-v2/function/bidding.js +4 -5
  25. package/dist/src/typus-dov-single-v2/token-user-entry.d.ts +11 -84
  26. package/dist/src/typus-dov-single-v2/token-user-entry.js +191 -316
  27. package/dist/src/typus-dov-single-v2/user-entry.d.ts +11 -69
  28. package/dist/src/typus-dov-single-v2/user-entry.js +183 -194
  29. package/dist/src/typus-dov-single-v2/view-function.d.ts +20 -6
  30. package/dist/src/typus-dov-single-v2/view-function.js +37 -43
  31. package/dist/src/typus-perp/user/orderWithBidReceipt.js +1 -5
  32. package/dist/src/typus-safu/index.d.ts +2 -1
  33. package/dist/src/typus-safu/index.js +2 -1
  34. package/dist/src/typus-safu/user-history.d.ts +12 -0
  35. package/dist/src/typus-safu/user-history.js +312 -0
  36. package/dist/src/utils/typusConfig.d.ts +1 -0
  37. package/package.json +1 -1
@@ -1,417 +1,292 @@
1
1
  "use strict";
2
- var __read = (this && this.__read) || function (o, n) {
3
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4
- if (!m) return o;
5
- var i = m.call(o), r, ar = [], e;
6
- try {
7
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
- }
9
- catch (error) { e = { error: error }; }
10
- finally {
11
- try {
12
- if (r && !r.done && (m = i["return"])) m.call(i);
13
- }
14
- finally { if (e) throw e.error; }
15
- }
16
- return ar;
17
- };
18
2
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.getMfudRaiseFundTx = getMfudRaiseFundTx;
20
- exports.getMfudReduceFundTx = getMfudReduceFundTx;
21
- exports.getMfudDepositTx = getMfudDepositTx;
22
- exports.getMfudNewBidTx = getMfudNewBidTx;
23
- exports.getMfudExerciseTx = getMfudExerciseTx;
24
- exports.getMfudRebateTx = getMfudRebateTx;
25
- exports.getMfudNewStrategyTx = getMfudNewStrategyTx;
26
- exports.getMfudUpdateStrategyTx = getMfudUpdateStrategyTx;
27
- exports.getMfudCloseStrategyTx = getMfudCloseStrategyTx;
28
- exports.getMfudWithdrawProfitStrategyTx = getMfudWithdrawProfitStrategyTx;
29
- exports.getMfudCompoundWithRedeemTx = getMfudCompoundWithRedeemTx;
30
- var transactions_1 = require("@mysten/sui.js/transactions");
31
- var constants_1 = require("../constants");
32
- function getMfudRaiseFundTx(input) {
3
+ exports.getTokenRaiseFundTx = getTokenRaiseFundTx;
4
+ exports.getTokenReduceFundTx = getTokenReduceFundTx;
5
+ exports.getTokenNewBidTx = getTokenNewBidTx;
6
+ exports.getTokenExerciseTx = getTokenExerciseTx;
7
+ exports.getTokenRebateTx = getTokenRebateTx;
8
+ exports.getTokenCompoundWithRedeemTx = getTokenCompoundWithRedeemTx;
9
+ var constants_1 = require("src/constants");
10
+ function getTokenRaiseFundTx(config, tx, input) {
11
+ var typusTokenRegistry = "";
12
+ switch (input.typusTokenType.split("::")[1]) {
13
+ case "mfud":
14
+ typusTokenRegistry = config.registry.token.mfud;
15
+ break;
16
+ default:
17
+ console.log("No such token exists!");
18
+ break;
19
+ }
33
20
  var typusTokenBalance = input.raiseCoins.length > 0
34
- ? input.tx.moveCall({
21
+ ? tx.moveCall({
35
22
  target: "0x2::coin::into_balance",
36
23
  typeArguments: [input.typusTokenType],
37
24
  arguments: [
38
- input.tx.object(input.tx.moveCall({
39
- target: "".concat(input.typusTokenPackageId, "::").concat(input.typusTokenType.split("::")[1], "::mint"),
25
+ tx.object(tx.moveCall({
26
+ target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::mint"),
40
27
  arguments: [
41
- input.tx.object(input.typusTokenRegistry),
42
- input.tx.makeMoveVec({ objects: input.raiseCoins }),
43
- input.tx.pure(input.raiseAmount),
28
+ tx.object(typusTokenRegistry),
29
+ tx.makeMoveVec({ objects: input.raiseCoins }),
30
+ tx.pure(input.raiseAmount),
44
31
  ],
45
32
  })),
46
33
  ],
47
34
  })
48
- : input.tx.moveCall({
35
+ : tx.moveCall({
49
36
  target: "0x2::balance::zero",
50
37
  typeArguments: [input.typusTokenType],
51
38
  arguments: [],
52
39
  });
53
- var result = input.tx.moveCall({
54
- target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::public_raise_fund"),
40
+ var result = tx.moveCall({
41
+ target: "".concat(config.package.dovSingle, "::tds_user_entry::public_raise_fund"),
55
42
  typeArguments: input.typeArguments,
56
43
  arguments: [
57
- input.tx.object(input.typusEcosystemVersion),
58
- input.tx.object(input.typusUserRegistry),
59
- input.tx.object(input.typusLeaderboardRegistry),
60
- input.tx.object(input.typusDovSingleRegistry),
61
- input.tx.pure(input.index),
62
- input.tx.makeMoveVec({
63
- type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
64
- objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
44
+ tx.object(config.version.typus),
45
+ tx.object(config.registry.typus.user),
46
+ tx.object(config.registry.typus.leaderboard),
47
+ tx.object(config.registry.dov.dovSingle),
48
+ tx.pure(input.index),
49
+ tx.makeMoveVec({
50
+ type: "".concat(config.packageOrigin.framework, "::vault::TypusDepositReceipt"),
51
+ objects: input.receipts.map(function (receipt) { return tx.object(receipt); }),
65
52
  }),
66
- input.tx.object(typusTokenBalance),
67
- input.tx.pure(input.raiseFromPremium),
68
- input.tx.pure(input.raiseFromInactive),
69
- input.tx.object(constants_1.CLOCK),
53
+ tx.object(typusTokenBalance),
54
+ tx.pure(input.raiseFromPremium),
55
+ tx.pure(input.raiseFromInactive),
56
+ tx.object(constants_1.CLOCK),
70
57
  ],
71
58
  });
72
- input.tx.transferObjects([input.tx.object(result[0])], input.user);
73
- return input.tx;
59
+ tx.transferObjects([tx.object(result[0])], input.user);
60
+ return tx;
74
61
  }
75
- function getMfudReduceFundTx(input) {
76
- var result = input.tx.moveCall({
77
- target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::public_reduce_fund"),
62
+ function getTokenReduceFundTx(config, tx, input) {
63
+ var typusTokenRegistry = "";
64
+ switch (input.typusTokenType.split("::")[1]) {
65
+ case "mfud":
66
+ typusTokenRegistry = config.registry.token.mfud;
67
+ break;
68
+ default:
69
+ console.log("No such token exists!");
70
+ break;
71
+ }
72
+ var result = tx.moveCall({
73
+ target: "".concat(config.package.dovSingle, "::tds_user_entry::public_reduce_fund"),
78
74
  typeArguments: input.typeArguments,
79
75
  arguments: [
80
- input.tx.object(input.typusEcosystemVersion),
81
- input.tx.object(input.typusUserRegistry),
82
- input.tx.object(input.typusLeaderboardRegistry),
83
- input.tx.object(input.typusDovSingleRegistry),
84
- input.tx.pure(input.index),
85
- input.tx.makeMoveVec({
86
- type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
87
- objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
76
+ tx.object(config.version.typus),
77
+ tx.object(config.registry.typus.user),
78
+ tx.object(config.registry.typus.leaderboard),
79
+ tx.object(config.registry.dov.dovSingle),
80
+ tx.pure(input.index),
81
+ tx.makeMoveVec({
82
+ type: "".concat(config.packageOrigin.framework, "::vault::TypusDepositReceipt"),
83
+ objects: input.receipts.map(function (receipt) { return tx.object(receipt); }),
88
84
  }),
89
- input.tx.pure(input.reduceFromWarmup),
90
- input.tx.pure(input.reduceFromActive),
91
- input.tx.pure(input.reduceFromPremium),
92
- input.tx.pure(input.reduceFromInactive),
93
- input.tx.pure(input.reduceFromIncentive),
94
- input.tx.object(constants_1.CLOCK),
85
+ tx.pure(input.reduceFromWarmup),
86
+ tx.pure(input.reduceFromActive),
87
+ tx.pure(input.reduceFromPremium),
88
+ tx.pure(input.reduceFromInactive),
89
+ tx.pure(input.reduceFromIncentive),
90
+ tx.object(constants_1.CLOCK),
95
91
  ],
96
92
  });
97
- input.tx.moveCall({
98
- target: "".concat(input.typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
99
- arguments: [input.tx.object(result[0]), input.tx.pure(input.user)],
93
+ tx.moveCall({
94
+ target: "".concat(config.package.framework, "::vault::transfer_deposit_receipt"),
95
+ arguments: [tx.object(result[0]), tx.pure(input.user)],
100
96
  });
101
97
  if (input.typeArguments[0] == input.typusTokenType) {
102
- var typusToken = input.tx.moveCall({
98
+ var typusToken = tx.moveCall({
103
99
  target: "0x2::coin::from_balance",
104
100
  typeArguments: [input.typeArguments[0]],
105
- arguments: [input.tx.object(result[1])],
101
+ arguments: [tx.object(result[1])],
106
102
  });
107
- var token = input.tx.moveCall({
108
- target: "".concat(input.typusTokenPackageId, "::").concat(input.typusTokenType.split("::")[1], "::burn"),
109
- arguments: [input.tx.object(input.typusTokenRegistry), input.tx.object(typusToken)],
103
+ var token = tx.moveCall({
104
+ target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::burn"),
105
+ arguments: [tx.object(typusTokenRegistry), tx.object(typusToken)],
110
106
  });
111
- input.tx.transferObjects([input.tx.object(token)], input.user);
107
+ tx.transferObjects([tx.object(token)], input.user);
112
108
  }
113
109
  else {
114
- input.tx.moveCall({
115
- target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_balance"),
110
+ tx.moveCall({
111
+ target: "".concat(config.package.framework, "::utils::transfer_balance"),
116
112
  typeArguments: [input.typeArguments[0]],
117
- arguments: [input.tx.object(result[1]), input.tx.pure(input.user)],
113
+ arguments: [tx.object(result[1]), tx.pure(input.user)],
118
114
  });
119
115
  }
120
116
  if (input.typeArguments[1] == input.typusTokenType) {
121
- var typusToken = input.tx.moveCall({
117
+ var typusToken = tx.moveCall({
122
118
  target: "0x2::coin::from_balance",
123
119
  typeArguments: [input.typeArguments[1]],
124
- arguments: [input.tx.object(result[2])],
120
+ arguments: [tx.object(result[2])],
125
121
  });
126
- var token = input.tx.moveCall({
127
- target: "".concat(input.typusTokenPackageId, "::").concat(input.typusTokenType.split("::")[1], "::burn"),
128
- arguments: [input.tx.object(input.typusTokenRegistry), input.tx.object(typusToken)],
122
+ var token = tx.moveCall({
123
+ target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::burn"),
124
+ arguments: [tx.object(typusTokenRegistry), tx.object(typusToken)],
129
125
  });
130
- input.tx.transferObjects([input.tx.object(token)], input.user);
126
+ tx.transferObjects([tx.object(token)], input.user);
131
127
  }
132
128
  else {
133
- input.tx.moveCall({
134
- target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_balance"),
129
+ tx.moveCall({
130
+ target: "".concat(config.package.framework, "::utils::transfer_balance"),
135
131
  typeArguments: [input.typeArguments[1]],
136
- arguments: [input.tx.object(result[2]), input.tx.pure(input.user)],
132
+ arguments: [tx.object(result[2]), tx.pure(input.user)],
137
133
  });
138
134
  }
139
135
  if (input.typeArguments[2] == input.typusTokenType) {
140
- var typusToken = input.tx.moveCall({
136
+ var typusToken = tx.moveCall({
141
137
  target: "0x2::coin::from_balance",
142
138
  typeArguments: [input.typeArguments[2]],
143
- arguments: [input.tx.object(result[3])],
139
+ arguments: [tx.object(result[3])],
144
140
  });
145
- var token = input.tx.moveCall({
146
- target: "".concat(input.typusTokenPackageId, "::").concat(input.typusTokenType.split("::")[1], "::burn"),
147
- arguments: [input.tx.object(input.typusTokenRegistry), input.tx.object(typusToken)],
141
+ var token = tx.moveCall({
142
+ target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::burn"),
143
+ arguments: [tx.object(typusTokenRegistry), tx.object(typusToken)],
148
144
  });
149
- input.tx.transferObjects([input.tx.object(token)], input.user);
145
+ tx.transferObjects([tx.object(token)], input.user);
150
146
  }
151
147
  else {
152
- input.tx.moveCall({
153
- target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_balance"),
148
+ tx.moveCall({
149
+ target: "".concat(config.package.framework, "::utils::transfer_balance"),
154
150
  typeArguments: [input.typeArguments[2]],
155
- arguments: [input.tx.object(result[3]), input.tx.pure(input.user)],
151
+ arguments: [tx.object(result[3]), tx.pure(input.user)],
156
152
  });
157
153
  }
158
- return input.tx;
159
- }
160
- function getMfudDepositTx(input) {
161
- var mfud = input.tx.moveCall({
162
- target: "".concat(input.mfudPackageId, "::mfud::mint"),
163
- arguments: [
164
- input.tx.object(input.mfudRegistry),
165
- input.tx.makeMoveVec({ objects: input.coins.map(function (id) { return input.tx.object(id); }) }),
166
- input.tx.pure(input.mfudAmount),
167
- ],
168
- });
169
- var result = input.tx.moveCall({
170
- target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::public_deposit"),
171
- typeArguments: input.typeArguments,
172
- arguments: [
173
- input.tx.object(input.typusEcosystemVersion),
174
- input.tx.object(input.typusUserRegistry),
175
- input.tx.object(input.typusLeaderboardRegistry),
176
- input.tx.object(input.typusDovSingleRegistry),
177
- input.tx.pure(input.index),
178
- input.tx.makeMoveVec({ objects: [mfud] }),
179
- input.tx.pure(input.mfudAmount),
180
- input.tx.makeMoveVec({
181
- type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
182
- objects: input.receipts.map(function (id) { return input.tx.object(id); }),
183
- }),
184
- input.tx.object(constants_1.CLOCK),
185
- ],
186
- });
187
- input.tx.moveCall({
188
- target: "0x1::vector::destroy_empty",
189
- typeArguments: ["0x2::coin::Coin<" + input.typeArguments[0] + ">"],
190
- arguments: [input.tx.object(result[0])],
191
- });
192
- input.tx.transferObjects([input.tx.object(result[1])], input.user);
193
- return input.tx;
154
+ return tx;
194
155
  }
195
- function getMfudNewBidTx(input) {
196
- var mfud = input.tx.moveCall({
197
- target: "".concat(input.mfudPackageId, "::mfud::mint"),
156
+ function getTokenNewBidTx(config, tx, input) {
157
+ var typusTokenRegistry = "";
158
+ switch (input.typusTokenType.split("::")[1]) {
159
+ case "mfud":
160
+ typusTokenRegistry = config.registry.token.mfud;
161
+ break;
162
+ default:
163
+ console.log("No such token exists!");
164
+ break;
165
+ }
166
+ var mfud = tx.moveCall({
167
+ target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::mint"),
198
168
  arguments: [
199
- input.tx.object(input.mfudRegistry),
200
- input.tx.makeMoveVec({ objects: input.coins.map(function (id) { return input.tx.object(id); }) }),
201
- input.tx.pure(input.premium_required),
169
+ tx.object(typusTokenRegistry),
170
+ tx.makeMoveVec({ objects: input.coins.map(function (id) { return tx.object(id); }) }),
171
+ tx.pure(input.premium_required),
202
172
  ],
203
173
  });
204
- var result = input.tx.moveCall({
205
- target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::public_bid"),
174
+ var result = tx.moveCall({
175
+ target: "".concat(config.package.dovSingle, "::tds_user_entry::public_bid"),
206
176
  typeArguments: input.typeArguments,
207
177
  arguments: [
208
- input.tx.object(input.typusEcosystemVersion),
209
- input.tx.object(input.typusUserRegistry),
210
- input.tx.object(input.tgldRegistry),
211
- input.tx.object(input.typusLeaderboardRegistry),
212
- input.tx.object(input.typusDovSingleRegistry),
213
- input.tx.pure(input.index),
214
- input.tx.makeMoveVec({ objects: [mfud] }),
215
- input.tx.pure(input.size),
216
- input.tx.pure("0x6"),
178
+ tx.object(config.version.typus),
179
+ tx.object(config.registry.typus.user),
180
+ tx.object(config.registry.typus.tgld),
181
+ tx.object(config.registry.typus.leaderboard),
182
+ tx.object(config.registry.dov.dovSingle),
183
+ tx.pure(input.index),
184
+ tx.makeMoveVec({ objects: [mfud] }),
185
+ tx.pure(input.size),
186
+ tx.pure("0x6"),
217
187
  ],
218
188
  });
219
- input.tx.transferObjects([input.tx.object(result[0])], input.user);
220
- var fud_coin = input.tx.moveCall({
221
- target: "".concat(input.mfudPackageId, "::mfud::burn"),
222
- arguments: [input.tx.object(input.mfudRegistry), input.tx.object(result[1])],
189
+ tx.transferObjects([tx.object(result[0])], input.user);
190
+ var fud_coin = tx.moveCall({
191
+ target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::burn"),
192
+ arguments: [tx.object(typusTokenRegistry), tx.object(result[1])],
223
193
  });
224
- input.tx.transferObjects([input.tx.object(fud_coin)], input.user);
225
- return input.tx;
194
+ tx.transferObjects([tx.object(fud_coin)], input.user);
195
+ return tx;
226
196
  }
227
- function getMfudExerciseTx(input) {
228
- var result = input.tx.moveCall({
229
- target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::exercise"),
197
+ function getTokenExerciseTx(config, tx, input) {
198
+ var typusTokenRegistry = "";
199
+ switch (input.typusTokenType.split("::")[1]) {
200
+ case "mfud":
201
+ typusTokenRegistry = config.registry.token.mfud;
202
+ break;
203
+ default:
204
+ console.log("No such token exists!");
205
+ break;
206
+ }
207
+ var result = tx.moveCall({
208
+ target: "".concat(config.package.dovSingle, "::tds_user_entry::exercise"),
230
209
  typeArguments: input.typeArguments,
231
210
  arguments: [
232
- input.tx.object(input.typusDovSingleRegistry),
233
- input.tx.pure(input.index),
234
- input.tx.makeMoveVec({
235
- type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusBidReceipt"),
236
- objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
211
+ tx.object(config.registry.dov.dovSingle),
212
+ tx.pure(input.index),
213
+ tx.makeMoveVec({
214
+ type: "".concat(config.packageOrigin.framework, "::vault::TypusBidReceipt"),
215
+ objects: input.receipts.map(function (receipt) { return tx.object(receipt); }),
237
216
  }),
238
217
  ],
239
218
  });
240
- var mfud_coin = input.tx.moveCall({
219
+ var mfud_coin = tx.moveCall({
241
220
  target: "0x2::coin::from_balance",
242
221
  typeArguments: [input.typeArguments[0]],
243
- arguments: [input.tx.object(result[0])],
222
+ arguments: [tx.object(result[0])],
244
223
  });
245
- var fud_coin = input.tx.moveCall({
246
- target: "".concat(input.mfudPackageId, "::mfud::burn"),
247
- arguments: [input.tx.object(input.mfudRegistry), input.tx.object(mfud_coin)],
224
+ var fud_coin = tx.moveCall({
225
+ target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::burn"),
226
+ arguments: [tx.object(typusTokenRegistry), tx.object(mfud_coin)],
248
227
  });
249
- input.tx.transferObjects([input.tx.object(fud_coin)], input.user);
250
- return input.tx;
228
+ tx.transferObjects([tx.object(fud_coin)], input.user);
229
+ return tx;
251
230
  }
252
- function getMfudRebateTx(input) {
253
- var result = input.tx.moveCall({
254
- target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::rebate"),
231
+ function getTokenRebateTx(config, tx, input) {
232
+ var typusTokenRegistry = "";
233
+ switch (input.typusTokenType.split("::")[1]) {
234
+ case "mfud":
235
+ typusTokenRegistry = config.registry.token.mfud;
236
+ break;
237
+ default:
238
+ console.log("No such token exists!");
239
+ break;
240
+ }
241
+ var result = tx.moveCall({
242
+ target: "".concat(config.package.dovSingle, "::tds_user_entry::rebate"),
255
243
  typeArguments: [input.typeArgument],
256
- arguments: [input.tx.object(input.typusDovSingleRegistry)],
244
+ arguments: [tx.object(config.registry.dov.dovSingle)],
257
245
  });
258
- var balance = input.tx.moveCall({
246
+ var balance = tx.moveCall({
259
247
  target: "0x1::option::destroy_some",
260
248
  typeArguments: ["0x2::balance::Balance<".concat(input.typeArgument, ">")],
261
- arguments: [input.tx.object(result[0])],
249
+ arguments: [tx.object(result[0])],
262
250
  });
263
- var mfud_coin = input.tx.moveCall({
251
+ var mfud_coin = tx.moveCall({
264
252
  target: "0x2::coin::from_balance",
265
253
  typeArguments: [input.typeArgument],
266
- arguments: [input.tx.object(balance)],
267
- });
268
- var fud_coin = input.tx.moveCall({
269
- target: "".concat(input.mfudPackageId, "::mfud::burn"),
270
- arguments: [input.tx.object(input.mfudRegistry), input.tx.object(mfud_coin)],
254
+ arguments: [tx.object(balance)],
271
255
  });
272
- input.tx.transferObjects([input.tx.object(fud_coin)], input.user);
273
- return input.tx;
274
- }
275
- function getMfudNewStrategyTx(gasBudget, packageId, typeArguments, // D_TOKEN, B_TOKEN
276
- registry, strategy_pool, vault_index, signal_index, coins, mfudPackageId, mfudRegistry, mfudAmount, size, price_percentage, max_times, target_rounds) {
277
- var tx = new transactions_1.TransactionBlock();
278
- var input_coin = tx.moveCall({
279
- target: "".concat(mfudPackageId, "::mfud::mint"),
280
- arguments: [tx.object(mfudRegistry), tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }), tx.pure(mfudAmount)],
256
+ var fud_coin = tx.moveCall({
257
+ target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::burn"),
258
+ arguments: [tx.object(typusTokenRegistry), tx.object(mfud_coin)],
281
259
  });
282
- tx.moveCall({
283
- target: "".concat(packageId, "::auto_bid::new_strategy"),
284
- typeArguments: typeArguments,
285
- arguments: [
286
- tx.object(registry),
287
- tx.object(strategy_pool),
288
- tx.pure(vault_index),
289
- tx.pure(signal_index),
290
- tx.pure(size),
291
- tx.pure(price_percentage),
292
- tx.pure(max_times),
293
- tx.pure(target_rounds),
294
- input_coin,
295
- ],
296
- });
297
- tx.setGasBudget(gasBudget);
298
- return tx;
299
- }
300
- function getMfudUpdateStrategyTx(gasBudget, packageId, typeArguments, // D_TOKEN, B_TOKEN
301
- registry, strategy_pool, vault_index, signal_index, strategy_index, coins, mfudPackageId, mfudRegistry, mfudAmount, size, price_percentage, max_times, target_rounds) {
302
- var tx = new transactions_1.TransactionBlock();
303
- var _a = __read(tx.moveCall({
304
- target: "".concat(mfudPackageId, "::mfud::mint"),
305
- arguments: [tx.object(mfudRegistry), tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }), tx.pure(mfudAmount)],
306
- }), 1), input_coin = _a[0];
307
- tx.moveCall({
308
- target: "".concat(packageId, "::auto_bid::update_strategy"),
309
- typeArguments: typeArguments,
310
- arguments: [
311
- tx.object(registry),
312
- tx.object(strategy_pool),
313
- tx.pure(vault_index),
314
- tx.pure(signal_index),
315
- tx.pure(strategy_index),
316
- tx.pure(size ? [size] : []),
317
- tx.pure(price_percentage ? [price_percentage] : []),
318
- tx.pure(max_times ? [max_times] : []),
319
- tx.pure(target_rounds),
320
- tx.makeMoveVec({ objects: [input_coin] }),
321
- ],
322
- });
323
- tx.setGasBudget(gasBudget);
324
- return tx;
325
- }
326
- function getMfudCloseStrategyTx(gasBudget, packageId, typeArguments, // D_TOKEN, B_TOKEN
327
- registry, strategy_pool, vault_index, signal_index, strategy_index, mfudPackageId, mfudRegistry, sender) {
328
- var tx = new transactions_1.TransactionBlock();
329
- var _a = __read(tx.moveCall({
330
- target: "".concat(packageId, "::auto_bid::close_strategy"),
331
- typeArguments: typeArguments,
332
- arguments: [tx.object(registry), tx.object(strategy_pool), tx.pure(vault_index), tx.pure(signal_index), tx.pure(strategy_index)],
333
- }), 2), d_token = _a[0], b_token = _a[1];
334
- if (typeArguments[0].endsWith("MFUD")) {
335
- var fud_coin = tx.moveCall({
336
- target: "".concat(mfudPackageId, "::mfud::burn"),
337
- arguments: [tx.object(mfudRegistry), d_token],
338
- });
339
- tx.transferObjects([tx.object(fud_coin)], sender);
340
- }
341
- else {
342
- tx.transferObjects([d_token], sender);
343
- }
344
- if (typeArguments[1].endsWith("MFUD")) {
345
- var fud_coin = tx.moveCall({
346
- target: "".concat(mfudPackageId, "::mfud::burn"),
347
- arguments: [tx.object(mfudRegistry), b_token],
348
- });
349
- tx.transferObjects([tx.object(fud_coin)], sender);
350
- }
351
- else {
352
- tx.transferObjects([b_token], sender);
353
- }
354
- tx.setGasBudget(gasBudget);
355
- return tx;
356
- }
357
- function getMfudWithdrawProfitStrategyTx(gasBudget, packageId, typeArguments, // D_TOKEN, B_TOKEN
358
- registry, strategy_pool, vault_index, signal_index, strategy_index, mfudPackageId, mfudRegistry, sender, txBlock) {
359
- var tx = txBlock ? txBlock : new transactions_1.TransactionBlock();
360
- var d_token = tx.moveCall({
361
- target: "".concat(packageId, "::auto_bid::withdraw_profit"),
362
- typeArguments: typeArguments,
363
- arguments: [tx.object(registry), tx.object(strategy_pool), tx.pure(vault_index), tx.pure(signal_index), tx.pure(strategy_index)],
364
- });
365
- if (typeArguments[0].endsWith("MFUD")) {
366
- var fud_coin = tx.moveCall({
367
- target: "".concat(mfudPackageId, "::mfud::burn"),
368
- arguments: [tx.object(mfudRegistry), d_token],
369
- });
370
- tx.transferObjects([tx.object(fud_coin)], sender);
371
- }
372
- else {
373
- tx.transferObjects([d_token], sender);
374
- }
375
- tx.setGasBudget(gasBudget);
260
+ tx.transferObjects([tx.object(fud_coin)], input.user);
376
261
  return tx;
377
262
  }
378
- function getMfudCompoundWithRedeemTx(input) {
379
- var raiseBalance = input.tx.moveCall({
263
+ function getTokenCompoundWithRedeemTx(config, tx, input) {
264
+ var raiseBalance = tx.moveCall({
380
265
  target: "0x2::balance::zero",
381
266
  typeArguments: [input.typeArguments[0]],
382
267
  arguments: [],
383
268
  });
384
- var result = input.tx.moveCall({
385
- target: "".concat(input.typusDovSinglePackageId, "::tds_user_entry::public_raise_fund"),
269
+ var result = tx.moveCall({
270
+ target: "".concat(config.package.dovSingle, "::tds_user_entry::public_raise_fund"),
386
271
  typeArguments: [input.typeArguments[0], input.typeArguments[1]],
387
272
  arguments: [
388
- input.tx.object(input.typusEcosystemVersion),
389
- input.tx.object(input.typusUserRegistry),
390
- input.tx.object(input.typusLeaderboardRegistry),
391
- input.tx.object(input.typusDovSingleRegistry),
392
- input.tx.pure(input.index),
393
- input.tx.makeMoveVec({
394
- type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
395
- objects: input.receipts.map(function (receipt) { return input.tx.object(receipt); }),
273
+ tx.object(config.version.typus),
274
+ tx.object(config.registry.typus.user),
275
+ tx.object(config.registry.typus.leaderboard),
276
+ tx.object(config.registry.dov.dovSingle),
277
+ tx.pure(input.index),
278
+ tx.makeMoveVec({
279
+ type: "".concat(config.packageOrigin.framework, "::vault::TypusDepositReceipt"),
280
+ objects: input.receipts.map(function (receipt) { return tx.object(receipt); }),
396
281
  }),
397
- input.tx.object(raiseBalance),
398
- input.tx.pure(true),
399
- input.tx.pure(false),
400
- input.tx.object(constants_1.CLOCK),
282
+ tx.object(raiseBalance),
283
+ tx.pure(true),
284
+ tx.pure(false),
285
+ tx.object(constants_1.CLOCK),
401
286
  ],
402
287
  });
403
- return getMfudReduceFundTx({
404
- tx: input.tx,
405
- typusEcosystemVersion: input.typusEcosystemVersion,
406
- typusUserRegistry: input.typusUserRegistry,
407
- typusLeaderboardRegistry: input.typusLeaderboardRegistry,
408
- typusFrameworkOriginPackageId: input.typusFrameworkOriginPackageId,
409
- typusFrameworkPackageId: input.typusFrameworkPackageId,
410
- typusDovSinglePackageId: input.typusDovSinglePackageId,
411
- typusDovSingleRegistry: input.typusDovSingleRegistry,
288
+ return getTokenReduceFundTx(config, tx, {
412
289
  typeArguments: input.typeArguments,
413
- typusTokenPackageId: input.typusTokenPackageId,
414
- typusTokenRegistry: input.typusTokenRegistry,
415
290
  typusTokenType: input.typusTokenType,
416
291
  index: input.index,
417
292
  receipts: [result[0]],