@typus/typus-sdk 1.4.19 → 1.4.21
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/dist/src/auto-bid/index.d.ts +1 -0
- package/dist/src/auto-bid/index.js +1 -0
- package/dist/src/auto-bid/token-user-entry.d.ts +46 -8
- package/dist/src/auto-bid/token-user-entry.js +117 -74
- package/dist/src/auto-bid/user-entry.d.ts +42 -8
- package/dist/src/auto-bid/user-entry.js +92 -93
- package/dist/src/auto-bid/view-function.d.ts +8 -5
- package/dist/src/auto-bid/view-function.js +26 -15
- package/dist/src/constants/constant.d.ts +1 -0
- package/dist/src/constants/constant.js +2 -1
- package/dist/src/dice/api.d.ts +13 -1
- package/dist/src/dice/api.js +25 -14
- package/dist/src/dice/fetch.d.ts +8 -12
- package/dist/src/dice/fetch.js +77 -30
- package/dist/src/dice/user-entry.d.ts +29 -17
- package/dist/src/dice/user-entry.js +114 -79
- package/dist/src/dice/view-function.d.ts +14 -1
- package/dist/src/dice/view-function.js +34 -25
- package/dist/src/typus/airdrop/view-function.d.ts +1 -2
- package/dist/src/typus/airdrop/view-function.js +6 -3
- package/dist/src/typus/leaderboard/view-function.d.ts +1 -2
- package/dist/src/typus/leaderboard/view-function.js +6 -3
- package/dist/src/typus/tails-staking/authority-entry.js +2 -2
- package/dist/src/typus/tails-staking/view-function.d.ts +2 -3
- package/dist/src/typus/tails-staking/view-function.js +10 -6
- package/dist/src/typus/user/view-function.d.ts +1 -2
- package/dist/src/typus/user/view-function.js +6 -4
- package/dist/src/typus-dov-single-v2/authority-entry.d.ts +0 -25
- package/dist/src/typus-dov-single-v2/authority-entry.js +26 -0
- package/dist/src/typus-dov-single-v2/function/bidding.d.ts +5 -3
- package/dist/src/typus-dov-single-v2/function/bidding.js +17 -14
- package/dist/src/typus-dov-single-v2/history/vault-history.d.ts +3 -2
- package/dist/src/typus-dov-single-v2/history/vault-history.js +6 -4
- package/dist/src/typus-dov-single-v2/token-user-entry.js +10 -10
- package/dist/src/typus-dov-single-v2/view-function.d.ts +6 -7
- package/dist/src/typus-dov-single-v2/view-function.js +26 -19
- package/dist/src/typus-nft/user-entry.d.ts +25 -6
- package/dist/src/typus-nft/user-entry.js +24 -36
- package/dist/src/typus-perp/fetch.d.ts +7 -8
- package/dist/src/typus-perp/fetch.js +35 -24
- package/dist/src/typus-perp/user/order.d.ts +4 -11
- package/dist/src/typus-perp/user/order.js +23 -23
- package/dist/src/typus-perp/user/orderWithBidReceipt.d.ts +9 -9
- package/dist/src/typus-perp/user/orderWithBidReceipt.js +50 -49
- package/dist/src/typus-perp/user/tlp.d.ts +5 -13
- package/dist/src/typus-perp/user/tlp.js +30 -30
- package/dist/src/typus-safu/user-entry.d.ts +4 -8
- package/dist/src/typus-safu/user-entry.js +56 -56
- package/dist/src/typus-safu/view-function.d.ts +0 -3
- package/dist/src/typus-safu/view-function.js +10 -7
- package/package.json +1 -1
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./user-entry"), exports);
|
|
18
18
|
__exportStar(require("./view-function"), exports);
|
|
19
|
+
__exportStar(require("./token-user-entry"), exports);
|
|
@@ -1,9 +1,47 @@
|
|
|
1
1
|
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { TypusConfig } from "src/utils";
|
|
3
|
+
export declare function getTokenNewStrategyTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
4
|
+
typeArguments: string[];
|
|
5
|
+
typusTokenType: string;
|
|
6
|
+
strategy_pool: string;
|
|
7
|
+
vault_index: string;
|
|
8
|
+
signal_index: string;
|
|
9
|
+
coins: string[];
|
|
10
|
+
amount: string;
|
|
11
|
+
size: string;
|
|
12
|
+
price_percentage: string;
|
|
13
|
+
max_times: string;
|
|
14
|
+
target_rounds: string[];
|
|
15
|
+
}): TransactionBlock;
|
|
16
|
+
export declare function getTokenUpdateStrategyTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
17
|
+
typeArguments: string[];
|
|
18
|
+
typusTokenType: string;
|
|
19
|
+
strategy_pool: string;
|
|
20
|
+
vault_index: string;
|
|
21
|
+
signal_index: string;
|
|
22
|
+
strategy_index: string;
|
|
23
|
+
coins: string[];
|
|
24
|
+
amount: string;
|
|
25
|
+
size: string | null;
|
|
26
|
+
price_percentage: string | null;
|
|
27
|
+
max_times: string | null;
|
|
28
|
+
target_rounds: string[];
|
|
29
|
+
}): TransactionBlock;
|
|
30
|
+
export declare function getTokenCloseStrategyTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
31
|
+
typeArguments: string[];
|
|
32
|
+
typusTokenType: string;
|
|
33
|
+
strategy_pool: string;
|
|
34
|
+
vault_index: string;
|
|
35
|
+
signal_index: string;
|
|
36
|
+
strategy_index: string;
|
|
37
|
+
user: string;
|
|
38
|
+
}): TransactionBlock;
|
|
39
|
+
export declare function getTokenWithdrawProfitStrategyTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
40
|
+
typeArguments: string[];
|
|
41
|
+
typusTokenType: string;
|
|
42
|
+
strategy_pool: string;
|
|
43
|
+
vault_index: string;
|
|
44
|
+
signal_index: string;
|
|
45
|
+
strategy_index: string;
|
|
46
|
+
user: string;
|
|
47
|
+
}): TransactionBlock;
|
|
@@ -16,111 +16,154 @@ 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
|
-
exports.
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
exports.getTokenNewStrategyTx = getTokenNewStrategyTx;
|
|
20
|
+
exports.getTokenUpdateStrategyTx = getTokenUpdateStrategyTx;
|
|
21
|
+
exports.getTokenCloseStrategyTx = getTokenCloseStrategyTx;
|
|
22
|
+
exports.getTokenWithdrawProfitStrategyTx = getTokenWithdrawProfitStrategyTx;
|
|
23
|
+
function getTokenNewStrategyTx(config, tx, input) {
|
|
24
|
+
var typusTokenRegistry = "";
|
|
25
|
+
switch (input.typusTokenType.split("::")[1]) {
|
|
26
|
+
case "mfud":
|
|
27
|
+
typusTokenRegistry = config.registry.token.mfud;
|
|
28
|
+
break;
|
|
29
|
+
default:
|
|
30
|
+
console.log("No such token exists!");
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
var tToken = tx.moveCall({
|
|
34
|
+
target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::mint"),
|
|
35
|
+
arguments: [
|
|
36
|
+
tx.object(typusTokenRegistry),
|
|
37
|
+
tx.makeMoveVec({ objects: input.coins.map(function (id) { return tx.object(id); }) }),
|
|
38
|
+
tx.pure(input.amount),
|
|
39
|
+
],
|
|
30
40
|
});
|
|
31
41
|
tx.moveCall({
|
|
32
|
-
target: "".concat(
|
|
33
|
-
typeArguments: typeArguments,
|
|
42
|
+
target: "".concat(config.package.dovSingle, "::auto_bid::new_strategy"),
|
|
43
|
+
typeArguments: input.typeArguments,
|
|
34
44
|
arguments: [
|
|
35
|
-
tx.object(registry),
|
|
36
|
-
tx.object(strategy_pool),
|
|
37
|
-
tx.pure(vault_index),
|
|
38
|
-
tx.pure(signal_index),
|
|
39
|
-
tx.pure(size),
|
|
40
|
-
tx.pure(price_percentage),
|
|
41
|
-
tx.pure(max_times),
|
|
42
|
-
tx.pure(target_rounds),
|
|
43
|
-
|
|
45
|
+
tx.object(config.registry.dov.dovSingle),
|
|
46
|
+
tx.object(input.strategy_pool),
|
|
47
|
+
tx.pure(input.vault_index),
|
|
48
|
+
tx.pure(input.signal_index),
|
|
49
|
+
tx.pure(input.size),
|
|
50
|
+
tx.pure(input.price_percentage),
|
|
51
|
+
tx.pure(input.max_times),
|
|
52
|
+
tx.pure(input.target_rounds),
|
|
53
|
+
tToken,
|
|
44
54
|
],
|
|
45
55
|
});
|
|
46
|
-
tx.setGasBudget(gasBudget);
|
|
47
56
|
return tx;
|
|
48
57
|
}
|
|
49
|
-
function
|
|
50
|
-
|
|
51
|
-
|
|
58
|
+
function getTokenUpdateStrategyTx(config, tx, input) {
|
|
59
|
+
var typusTokenRegistry = "";
|
|
60
|
+
switch (input.typusTokenType.split("::")[1]) {
|
|
61
|
+
case "mfud":
|
|
62
|
+
typusTokenRegistry = config.registry.token.mfud;
|
|
63
|
+
break;
|
|
64
|
+
default:
|
|
65
|
+
console.log("No such token exists!");
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
52
68
|
var _a = __read(tx.moveCall({
|
|
53
|
-
target: "".concat(
|
|
54
|
-
arguments: [
|
|
55
|
-
|
|
69
|
+
target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::mint"),
|
|
70
|
+
arguments: [
|
|
71
|
+
tx.object(typusTokenRegistry),
|
|
72
|
+
tx.makeMoveVec({ objects: input.coins.map(function (id) { return tx.object(id); }) }),
|
|
73
|
+
tx.pure(input.amount),
|
|
74
|
+
],
|
|
75
|
+
}), 1), tToken = _a[0];
|
|
56
76
|
tx.moveCall({
|
|
57
|
-
target: "".concat(
|
|
58
|
-
typeArguments: typeArguments,
|
|
77
|
+
target: "".concat(config.package.dovSingle, "::auto_bid::update_strategy"),
|
|
78
|
+
typeArguments: input.typeArguments,
|
|
59
79
|
arguments: [
|
|
60
|
-
tx.object(registry),
|
|
61
|
-
tx.object(strategy_pool),
|
|
62
|
-
tx.pure(vault_index),
|
|
63
|
-
tx.pure(signal_index),
|
|
64
|
-
tx.pure(strategy_index),
|
|
65
|
-
tx.pure(size ? [size] : []),
|
|
66
|
-
tx.pure(price_percentage ? [price_percentage] : []),
|
|
67
|
-
tx.pure(max_times ? [max_times] : []),
|
|
68
|
-
tx.pure(target_rounds),
|
|
69
|
-
tx.makeMoveVec({ objects: [
|
|
80
|
+
tx.object(config.registry.dov.dovSingle),
|
|
81
|
+
tx.object(input.strategy_pool),
|
|
82
|
+
tx.pure(input.vault_index),
|
|
83
|
+
tx.pure(input.signal_index),
|
|
84
|
+
tx.pure(input.strategy_index),
|
|
85
|
+
tx.pure(input.size ? [input.size] : []),
|
|
86
|
+
tx.pure(input.price_percentage ? [input.price_percentage] : []),
|
|
87
|
+
tx.pure(input.max_times ? [input.max_times] : []),
|
|
88
|
+
tx.pure(input.target_rounds),
|
|
89
|
+
tx.makeMoveVec({ objects: [tToken] }),
|
|
70
90
|
],
|
|
71
91
|
});
|
|
72
|
-
tx.setGasBudget(gasBudget);
|
|
73
92
|
return tx;
|
|
74
93
|
}
|
|
75
|
-
function
|
|
76
|
-
|
|
77
|
-
|
|
94
|
+
function getTokenCloseStrategyTx(config, tx, input) {
|
|
95
|
+
var typusTokenRegistry = "";
|
|
96
|
+
switch (input.typusTokenType.split("::")[1]) {
|
|
97
|
+
case "mfud":
|
|
98
|
+
typusTokenRegistry = config.registry.token.mfud;
|
|
99
|
+
break;
|
|
100
|
+
default:
|
|
101
|
+
console.log("No such token exists!");
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
78
104
|
var _a = __read(tx.moveCall({
|
|
79
|
-
target: "".concat(
|
|
80
|
-
typeArguments: typeArguments,
|
|
81
|
-
arguments: [
|
|
105
|
+
target: "".concat(config.package.dovSingle, "::auto_bid::close_strategy"),
|
|
106
|
+
typeArguments: input.typeArguments,
|
|
107
|
+
arguments: [
|
|
108
|
+
tx.object(config.registry.dov.dovSingle),
|
|
109
|
+
tx.object(input.strategy_pool),
|
|
110
|
+
tx.pure(input.vault_index),
|
|
111
|
+
tx.pure(input.signal_index),
|
|
112
|
+
tx.pure(input.strategy_index),
|
|
113
|
+
],
|
|
82
114
|
}), 2), d_token = _a[0], b_token = _a[1];
|
|
83
|
-
if (typeArguments[0].
|
|
84
|
-
var
|
|
85
|
-
target: "".concat(
|
|
86
|
-
arguments: [tx.object(
|
|
115
|
+
if (input.typeArguments[0] == input.typusTokenType) {
|
|
116
|
+
var token = tx.moveCall({
|
|
117
|
+
target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::burn"),
|
|
118
|
+
arguments: [tx.object(typusTokenRegistry), d_token],
|
|
87
119
|
});
|
|
88
|
-
tx.transferObjects([tx.object(
|
|
120
|
+
tx.transferObjects([tx.object(token)], input.user);
|
|
89
121
|
}
|
|
90
122
|
else {
|
|
91
|
-
tx.transferObjects([d_token],
|
|
123
|
+
tx.transferObjects([d_token], input.user);
|
|
92
124
|
}
|
|
93
|
-
if (typeArguments[1].
|
|
94
|
-
var
|
|
95
|
-
target: "".concat(
|
|
96
|
-
arguments: [tx.object(
|
|
125
|
+
if (input.typeArguments[1] == input.typusTokenType) {
|
|
126
|
+
var token = tx.moveCall({
|
|
127
|
+
target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::burn"),
|
|
128
|
+
arguments: [tx.object(typusTokenRegistry), b_token],
|
|
97
129
|
});
|
|
98
|
-
tx.transferObjects([tx.object(
|
|
130
|
+
tx.transferObjects([tx.object(token)], input.user);
|
|
99
131
|
}
|
|
100
132
|
else {
|
|
101
|
-
tx.transferObjects([b_token],
|
|
133
|
+
tx.transferObjects([b_token], input.user);
|
|
102
134
|
}
|
|
103
|
-
tx.setGasBudget(gasBudget);
|
|
104
135
|
return tx;
|
|
105
136
|
}
|
|
106
|
-
function
|
|
107
|
-
|
|
108
|
-
|
|
137
|
+
function getTokenWithdrawProfitStrategyTx(config, tx, input) {
|
|
138
|
+
var typusTokenRegistry = "";
|
|
139
|
+
switch (input.typusTokenType.split("::")[1]) {
|
|
140
|
+
case "mfud":
|
|
141
|
+
typusTokenRegistry = config.registry.token.mfud;
|
|
142
|
+
break;
|
|
143
|
+
default:
|
|
144
|
+
console.log("No such token exists!");
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
109
147
|
var d_token = tx.moveCall({
|
|
110
|
-
target: "".concat(
|
|
111
|
-
typeArguments: typeArguments,
|
|
112
|
-
arguments: [
|
|
148
|
+
target: "".concat(config.package.dovSingle, "::auto_bid::withdraw_profit"),
|
|
149
|
+
typeArguments: input.typeArguments,
|
|
150
|
+
arguments: [
|
|
151
|
+
tx.object(config.registry.dov.dovSingle),
|
|
152
|
+
tx.object(input.strategy_pool),
|
|
153
|
+
tx.pure(input.vault_index),
|
|
154
|
+
tx.pure(input.signal_index),
|
|
155
|
+
tx.pure(input.strategy_index),
|
|
156
|
+
],
|
|
113
157
|
});
|
|
114
|
-
if (typeArguments[0].
|
|
115
|
-
var
|
|
116
|
-
target: "".concat(
|
|
117
|
-
arguments: [tx.object(
|
|
158
|
+
if (input.typeArguments[0] == input.typusTokenType) {
|
|
159
|
+
var token = tx.moveCall({
|
|
160
|
+
target: "".concat(config.package.token, "::").concat(input.typusTokenType.split("::")[1], "::burn"),
|
|
161
|
+
arguments: [tx.object(typusTokenRegistry), d_token],
|
|
118
162
|
});
|
|
119
|
-
tx.transferObjects([tx.object(
|
|
163
|
+
tx.transferObjects([tx.object(token)], input.user);
|
|
120
164
|
}
|
|
121
165
|
else {
|
|
122
|
-
tx.transferObjects([d_token],
|
|
166
|
+
tx.transferObjects([d_token], input.user);
|
|
123
167
|
}
|
|
124
|
-
tx.setGasBudget(gasBudget);
|
|
125
168
|
return tx;
|
|
126
169
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
+
import { TypusConfig } from "src/utils";
|
|
2
3
|
/**
|
|
3
4
|
entry fun new_strategy<B_TOKEN>(
|
|
4
5
|
strategy_pool: &mut StrategyPool,
|
|
@@ -12,8 +13,18 @@ import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
|
12
13
|
ctx: &mut TxContext
|
|
13
14
|
)
|
|
14
15
|
*/
|
|
15
|
-
export declare function getNewStrategyTx(
|
|
16
|
-
|
|
16
|
+
export declare function getNewStrategyTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
17
|
+
typeArguments: string[];
|
|
18
|
+
strategy_pool: string;
|
|
19
|
+
vault_index: string;
|
|
20
|
+
signal_index: string;
|
|
21
|
+
coins: string[];
|
|
22
|
+
amount: string;
|
|
23
|
+
size: string;
|
|
24
|
+
price_percentage: string;
|
|
25
|
+
max_times: string;
|
|
26
|
+
target_rounds: string[];
|
|
27
|
+
}): TransactionBlock;
|
|
17
28
|
/**
|
|
18
29
|
entry fun close_strategy<D_TOKEN, B_TOKEN>(
|
|
19
30
|
strategy_pool: &mut StrategyPoolV2,
|
|
@@ -23,10 +34,22 @@ registry: string, strategy_pool: string, vault_index: string, signal_index: stri
|
|
|
23
34
|
ctx: &mut TxContext
|
|
24
35
|
)
|
|
25
36
|
*/
|
|
26
|
-
export declare function getCloseStrategyTx(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
37
|
+
export declare function getCloseStrategyTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
38
|
+
typeArguments: string[];
|
|
39
|
+
strategy_pool: string;
|
|
40
|
+
vault_index: string;
|
|
41
|
+
signal_index: string;
|
|
42
|
+
strategy_index: string;
|
|
43
|
+
user: string;
|
|
44
|
+
}): TransactionBlock;
|
|
45
|
+
export declare function getWithdrawProfitStrategyTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
46
|
+
typeArguments: string[];
|
|
47
|
+
strategy_pool: string;
|
|
48
|
+
vault_index: string;
|
|
49
|
+
signal_index: string;
|
|
50
|
+
strategy_index: string;
|
|
51
|
+
user: string;
|
|
52
|
+
}): TransactionBlock;
|
|
30
53
|
/**
|
|
31
54
|
entry fun update_strategy<D_TOKEN, B_TOKEN>(
|
|
32
55
|
strategy_pool: &mut StrategyPoolV2,
|
|
@@ -41,5 +64,16 @@ registry: string, strategy_pool: string, vault_index: string, signal_index: stri
|
|
|
41
64
|
ctx: & TxContext
|
|
42
65
|
)
|
|
43
66
|
*/
|
|
44
|
-
export declare function getUpdateStrategyTx(
|
|
45
|
-
|
|
67
|
+
export declare function getUpdateStrategyTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
68
|
+
typeArguments: string[];
|
|
69
|
+
strategy_pool: string;
|
|
70
|
+
vault_index: string;
|
|
71
|
+
signal_index: string;
|
|
72
|
+
strategy_index: string;
|
|
73
|
+
coins: string[];
|
|
74
|
+
amount: string;
|
|
75
|
+
size: string | null;
|
|
76
|
+
price_percentage: string | null;
|
|
77
|
+
max_times: string | null;
|
|
78
|
+
target_rounds: string[];
|
|
79
|
+
}): TransactionBlock;
|
|
@@ -20,7 +20,6 @@ exports.getNewStrategyTx = getNewStrategyTx;
|
|
|
20
20
|
exports.getCloseStrategyTx = getCloseStrategyTx;
|
|
21
21
|
exports.getWithdrawProfitStrategyTx = getWithdrawProfitStrategyTx;
|
|
22
22
|
exports.getUpdateStrategyTx = getUpdateStrategyTx;
|
|
23
|
-
var transactions_1 = require("@mysten/sui.js/transactions");
|
|
24
23
|
/**
|
|
25
24
|
entry fun new_strategy<B_TOKEN>(
|
|
26
25
|
strategy_pool: &mut StrategyPool,
|
|
@@ -34,53 +33,50 @@ var transactions_1 = require("@mysten/sui.js/transactions");
|
|
|
34
33
|
ctx: &mut TxContext
|
|
35
34
|
)
|
|
36
35
|
*/
|
|
37
|
-
function getNewStrategyTx(
|
|
38
|
-
registry, strategy_pool, vault_index, signal_index, coins, amount, size, price_percentage, max_times, target_rounds) {
|
|
39
|
-
var tx = new transactions_1.TransactionBlock();
|
|
36
|
+
function getNewStrategyTx(config, tx, input) {
|
|
40
37
|
if (
|
|
41
38
|
// B_TOKEN
|
|
42
|
-
typeArguments[1] == "0x2::sui::SUI" ||
|
|
43
|
-
typeArguments[1] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI") {
|
|
44
|
-
var _a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), input_coin = _a[0];
|
|
39
|
+
input.typeArguments[1] == "0x2::sui::SUI" ||
|
|
40
|
+
input.typeArguments[1] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI") {
|
|
41
|
+
var _a = __read(tx.splitCoins(tx.gas, [tx.pure(input.amount)]), 1), input_coin = _a[0];
|
|
45
42
|
tx.moveCall({
|
|
46
|
-
target: "".concat(
|
|
47
|
-
typeArguments: typeArguments,
|
|
43
|
+
target: "".concat(config.package.dovSingle, "::auto_bid::new_strategy"),
|
|
44
|
+
typeArguments: input.typeArguments,
|
|
48
45
|
arguments: [
|
|
49
|
-
tx.object(registry),
|
|
50
|
-
tx.object(strategy_pool),
|
|
51
|
-
tx.pure(vault_index),
|
|
52
|
-
tx.pure(signal_index),
|
|
53
|
-
tx.pure(size),
|
|
54
|
-
tx.pure(price_percentage),
|
|
55
|
-
tx.pure(max_times),
|
|
56
|
-
tx.pure(target_rounds),
|
|
46
|
+
tx.object(config.registry.dov.dovSingle),
|
|
47
|
+
tx.object(input.strategy_pool),
|
|
48
|
+
tx.pure(input.vault_index),
|
|
49
|
+
tx.pure(input.signal_index),
|
|
50
|
+
tx.pure(input.size),
|
|
51
|
+
tx.pure(input.price_percentage),
|
|
52
|
+
tx.pure(input.max_times),
|
|
53
|
+
tx.pure(input.target_rounds),
|
|
57
54
|
input_coin,
|
|
58
55
|
],
|
|
59
56
|
});
|
|
60
57
|
}
|
|
61
58
|
else {
|
|
62
|
-
var coin = coins.pop();
|
|
63
|
-
if (coins.length > 0) {
|
|
64
|
-
tx.mergeCoins(tx.object(coin), coins.map(function (coin) { return tx.object(coin); }));
|
|
59
|
+
var coin = input.coins.pop();
|
|
60
|
+
if (input.coins.length > 0) {
|
|
61
|
+
tx.mergeCoins(tx.object(coin), input.coins.map(function (coin) { return tx.object(coin); }));
|
|
65
62
|
}
|
|
66
|
-
var _b = __read(tx.splitCoins(tx.object(coin), [tx.pure(amount)]), 1), input_coin = _b[0];
|
|
63
|
+
var _b = __read(tx.splitCoins(tx.object(coin), [tx.pure(input.amount)]), 1), input_coin = _b[0];
|
|
67
64
|
tx.moveCall({
|
|
68
|
-
target: "".concat(
|
|
69
|
-
typeArguments: typeArguments,
|
|
65
|
+
target: "".concat(config.package.dovSingle, "::auto_bid::new_strategy"),
|
|
66
|
+
typeArguments: input.typeArguments,
|
|
70
67
|
arguments: [
|
|
71
|
-
tx.object(registry),
|
|
72
|
-
tx.object(strategy_pool),
|
|
73
|
-
tx.pure(vault_index),
|
|
74
|
-
tx.pure(signal_index),
|
|
75
|
-
tx.pure(size),
|
|
76
|
-
tx.pure(price_percentage),
|
|
77
|
-
tx.pure(max_times),
|
|
78
|
-
tx.pure(target_rounds),
|
|
68
|
+
tx.object(config.registry.dov.dovSingle),
|
|
69
|
+
tx.object(input.strategy_pool),
|
|
70
|
+
tx.pure(input.vault_index),
|
|
71
|
+
tx.pure(input.signal_index),
|
|
72
|
+
tx.pure(input.size),
|
|
73
|
+
tx.pure(input.price_percentage),
|
|
74
|
+
tx.pure(input.max_times),
|
|
75
|
+
tx.pure(input.target_rounds),
|
|
79
76
|
input_coin,
|
|
80
77
|
],
|
|
81
78
|
});
|
|
82
79
|
}
|
|
83
|
-
tx.setGasBudget(gasBudget);
|
|
84
80
|
return tx;
|
|
85
81
|
}
|
|
86
82
|
/**
|
|
@@ -92,28 +88,34 @@ registry, strategy_pool, vault_index, signal_index, coins, amount, size, price_p
|
|
|
92
88
|
ctx: &mut TxContext
|
|
93
89
|
)
|
|
94
90
|
*/
|
|
95
|
-
function getCloseStrategyTx(
|
|
96
|
-
registry, strategy_pool, vault_index, signal_index, strategy_index, sender, txBlock) {
|
|
97
|
-
var tx = txBlock ? txBlock : new transactions_1.TransactionBlock();
|
|
91
|
+
function getCloseStrategyTx(config, tx, input) {
|
|
98
92
|
var _a = __read(tx.moveCall({
|
|
99
|
-
target: "".concat(
|
|
100
|
-
typeArguments: typeArguments,
|
|
101
|
-
arguments: [
|
|
93
|
+
target: "".concat(config.package.dovSingle, "::auto_bid::close_strategy"),
|
|
94
|
+
typeArguments: input.typeArguments,
|
|
95
|
+
arguments: [
|
|
96
|
+
tx.object(config.registry.dov.dovSingle),
|
|
97
|
+
tx.object(input.strategy_pool),
|
|
98
|
+
tx.pure(input.vault_index),
|
|
99
|
+
tx.pure(input.signal_index),
|
|
100
|
+
tx.pure(input.strategy_index),
|
|
101
|
+
],
|
|
102
102
|
}), 2), d_token = _a[0], b_token = _a[1];
|
|
103
|
-
tx.transferObjects([d_token, b_token],
|
|
104
|
-
tx.setGasBudget(gasBudget);
|
|
103
|
+
tx.transferObjects([d_token, b_token], input.user);
|
|
105
104
|
return tx;
|
|
106
105
|
}
|
|
107
|
-
function getWithdrawProfitStrategyTx(
|
|
108
|
-
registry, strategy_pool, vault_index, signal_index, strategy_index, sender, txBlock) {
|
|
109
|
-
var tx = txBlock ? txBlock : new transactions_1.TransactionBlock();
|
|
106
|
+
function getWithdrawProfitStrategyTx(config, tx, input) {
|
|
110
107
|
var d_token = tx.moveCall({
|
|
111
|
-
target: "".concat(
|
|
112
|
-
typeArguments: typeArguments,
|
|
113
|
-
arguments: [
|
|
108
|
+
target: "".concat(config.package.dovSingle, "::auto_bid::withdraw_profit"),
|
|
109
|
+
typeArguments: input.typeArguments,
|
|
110
|
+
arguments: [
|
|
111
|
+
tx.object(config.registry.dov.dovSingle),
|
|
112
|
+
tx.object(input.strategy_pool),
|
|
113
|
+
tx.pure(input.vault_index),
|
|
114
|
+
tx.pure(input.signal_index),
|
|
115
|
+
tx.pure(input.strategy_index),
|
|
116
|
+
],
|
|
114
117
|
});
|
|
115
|
-
tx.transferObjects([d_token],
|
|
116
|
-
tx.setGasBudget(gasBudget);
|
|
118
|
+
tx.transferObjects([d_token], input.user);
|
|
117
119
|
return tx;
|
|
118
120
|
}
|
|
119
121
|
/**
|
|
@@ -130,74 +132,71 @@ registry, strategy_pool, vault_index, signal_index, strategy_index, sender, txBl
|
|
|
130
132
|
ctx: & TxContext
|
|
131
133
|
)
|
|
132
134
|
*/
|
|
133
|
-
function getUpdateStrategyTx(
|
|
134
|
-
registry, strategy_pool, vault_index, signal_index, strategy_index, coins, amount, size, price_percentage, max_times, target_rounds) {
|
|
135
|
-
var tx = new transactions_1.TransactionBlock();
|
|
135
|
+
function getUpdateStrategyTx(config, tx, input) {
|
|
136
136
|
if (
|
|
137
137
|
// B_TOKEN
|
|
138
|
-
typeArguments[1] == "0x2::sui::SUI" ||
|
|
139
|
-
typeArguments[1] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI") {
|
|
140
|
-
if (amount) {
|
|
141
|
-
var _a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), input_coin = _a[0];
|
|
138
|
+
input.typeArguments[1] == "0x2::sui::SUI" ||
|
|
139
|
+
input.typeArguments[1] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI") {
|
|
140
|
+
if (input.amount) {
|
|
141
|
+
var _a = __read(tx.splitCoins(tx.gas, [tx.pure(input.amount)]), 1), input_coin = _a[0];
|
|
142
142
|
tx.moveCall({
|
|
143
|
-
target: "".concat(
|
|
144
|
-
typeArguments: typeArguments,
|
|
143
|
+
target: "".concat(config.package.dovSingle, "::auto_bid::update_strategy"),
|
|
144
|
+
typeArguments: input.typeArguments,
|
|
145
145
|
arguments: [
|
|
146
|
-
tx.object(registry),
|
|
147
|
-
tx.object(strategy_pool),
|
|
148
|
-
tx.pure(vault_index),
|
|
149
|
-
tx.pure(signal_index),
|
|
150
|
-
tx.pure(strategy_index),
|
|
151
|
-
tx.pure(size ? [size] : []),
|
|
152
|
-
tx.pure(price_percentage ? [price_percentage] : []),
|
|
153
|
-
tx.pure(max_times ? [max_times] : []),
|
|
154
|
-
tx.pure(target_rounds),
|
|
146
|
+
tx.object(config.registry.dov.dovSingle),
|
|
147
|
+
tx.object(input.strategy_pool),
|
|
148
|
+
tx.pure(input.vault_index),
|
|
149
|
+
tx.pure(input.signal_index),
|
|
150
|
+
tx.pure(input.strategy_index),
|
|
151
|
+
tx.pure(input.size ? [input.size] : []),
|
|
152
|
+
tx.pure(input.price_percentage ? [input.price_percentage] : []),
|
|
153
|
+
tx.pure(input.max_times ? [input.max_times] : []),
|
|
154
|
+
tx.pure(input.target_rounds),
|
|
155
155
|
tx.makeMoveVec({ objects: [input_coin] }),
|
|
156
156
|
],
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
159
|
else {
|
|
160
160
|
tx.moveCall({
|
|
161
|
-
target: "".concat(
|
|
162
|
-
typeArguments: typeArguments,
|
|
161
|
+
target: "".concat(config.package.dovSingle, "::auto_bid::update_strategy"),
|
|
162
|
+
typeArguments: input.typeArguments,
|
|
163
163
|
arguments: [
|
|
164
|
-
tx.object(registry),
|
|
165
|
-
tx.object(strategy_pool),
|
|
166
|
-
tx.pure(vault_index),
|
|
167
|
-
tx.pure(signal_index),
|
|
168
|
-
tx.pure(strategy_index),
|
|
169
|
-
tx.pure(size ? [size] : []),
|
|
170
|
-
tx.pure(price_percentage ? [price_percentage] : []),
|
|
171
|
-
tx.pure(max_times ? [max_times] : []),
|
|
172
|
-
tx.pure(target_rounds),
|
|
164
|
+
tx.object(config.registry.dov.dovSingle),
|
|
165
|
+
tx.object(input.strategy_pool),
|
|
166
|
+
tx.pure(input.vault_index),
|
|
167
|
+
tx.pure(input.signal_index),
|
|
168
|
+
tx.pure(input.strategy_index),
|
|
169
|
+
tx.pure(input.size ? [input.size] : []),
|
|
170
|
+
tx.pure(input.price_percentage ? [input.price_percentage] : []),
|
|
171
|
+
tx.pure(input.max_times ? [input.max_times] : []),
|
|
172
|
+
tx.pure(input.target_rounds),
|
|
173
173
|
tx.makeMoveVec({ objects: [] }),
|
|
174
174
|
],
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
else {
|
|
179
|
-
var coin = coins.pop();
|
|
180
|
-
if (coins.length > 0) {
|
|
181
|
-
tx.mergeCoins(tx.object(coin), coins.map(function (coin) { return tx.object(coin); }));
|
|
179
|
+
var coin = input.coins.pop();
|
|
180
|
+
if (input.coins.length > 0) {
|
|
181
|
+
tx.mergeCoins(tx.object(coin), input.coins.map(function (coin) { return tx.object(coin); }));
|
|
182
182
|
}
|
|
183
|
-
var _b = __read(tx.splitCoins(tx.object(coin), [tx.pure(amount)]), 1), input_coin = _b[0];
|
|
183
|
+
var _b = __read(tx.splitCoins(tx.object(coin), [tx.pure(input.amount)]), 1), input_coin = _b[0];
|
|
184
184
|
tx.moveCall({
|
|
185
|
-
target: "".concat(
|
|
186
|
-
typeArguments: typeArguments,
|
|
185
|
+
target: "".concat(config.package.dovSingle, "::auto_bid::update_strategy"),
|
|
186
|
+
typeArguments: input.typeArguments,
|
|
187
187
|
arguments: [
|
|
188
|
-
tx.object(registry),
|
|
189
|
-
tx.object(strategy_pool),
|
|
190
|
-
tx.pure(vault_index),
|
|
191
|
-
tx.pure(signal_index),
|
|
192
|
-
tx.pure(strategy_index),
|
|
193
|
-
tx.pure(size ? [size] : []),
|
|
194
|
-
tx.pure(price_percentage ? [price_percentage] : []),
|
|
195
|
-
tx.pure(max_times ? [max_times] : []),
|
|
196
|
-
tx.pure(target_rounds),
|
|
188
|
+
tx.object(config.registry.dov.dovSingle),
|
|
189
|
+
tx.object(input.strategy_pool),
|
|
190
|
+
tx.pure(input.vault_index),
|
|
191
|
+
tx.pure(input.signal_index),
|
|
192
|
+
tx.pure(input.strategy_index),
|
|
193
|
+
tx.pure(input.size ? [input.size] : []),
|
|
194
|
+
tx.pure(input.price_percentage ? [input.price_percentage] : []),
|
|
195
|
+
tx.pure(input.max_times ? [input.max_times] : []),
|
|
196
|
+
tx.pure(input.target_rounds),
|
|
197
197
|
tx.makeMoveVec({ objects: [input_coin] }),
|
|
198
198
|
],
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
|
-
tx.setGasBudget(gasBudget);
|
|
202
201
|
return tx;
|
|
203
202
|
}
|