@typus/typus-perp-sdk 1.1.49 → 1.1.51-upgrade
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/api/sentio.d.ts +1 -1
- package/dist/src/api/sentio.js +3 -3
- package/dist/src/client.d.ts +11 -12
- package/dist/src/client.js +16 -44
- package/dist/src/fetch.d.ts +15 -45
- package/dist/src/fetch.js +70 -69
- package/dist/src/generated/typus_perp/admin.d.ts +32 -42
- package/dist/src/generated/typus_perp/admin.js +41 -67
- package/dist/src/generated/typus_perp/competition.d.ts +22 -10
- package/dist/src/generated/typus_perp/competition.js +19 -54
- package/dist/src/generated/typus_perp/deps/std/type_name.d.ts +2 -2
- package/dist/src/generated/typus_perp/deps/std/type_name.js +2 -2
- package/dist/src/generated/typus_perp/deps/sui/balance.d.ts +3 -3
- package/dist/src/generated/typus_perp/deps/sui/balance.js +3 -3
- package/dist/src/generated/typus_perp/deps/sui/object_table.d.ts +4 -6
- package/dist/src/generated/typus_perp/deps/sui/object_table.js +4 -38
- package/dist/src/generated/typus_perp/deps/sui/table.d.ts +4 -6
- package/dist/src/generated/typus_perp/deps/sui/table.js +4 -38
- package/dist/src/generated/typus_perp/deps/sui/vec_set.d.ts +2 -2
- package/dist/src/generated/typus_perp/deps/sui/vec_set.js +2 -2
- package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.d.ts +7 -9
- package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.js +6 -6
- package/dist/src/generated/typus_perp/deps/typus/linked_object_table.d.ts +6 -10
- package/dist/src/generated/typus_perp/deps/typus/linked_object_table.js +5 -39
- package/dist/src/generated/typus_perp/deps/typus_framework/vault.d.ts +14 -8
- package/dist/src/generated/typus_perp/deps/typus_framework/vault.js +13 -39
- package/dist/src/generated/typus_perp/error.d.ts +97 -87
- package/dist/src/generated/typus_perp/error.js +18 -0
- package/dist/src/generated/typus_perp/escrow.d.ts +17 -21
- package/dist/src/generated/typus_perp/escrow.js +10 -22
- package/dist/src/generated/typus_perp/lending.d.ts +47 -0
- package/dist/src/generated/typus_perp/lending.js +40 -0
- package/dist/src/generated/typus_perp/lp_pool.d.ts +718 -397
- package/dist/src/generated/typus_perp/lp_pool.js +485 -365
- package/dist/src/generated/typus_perp/math.d.ts +18 -8
- package/dist/src/generated/typus_perp/math.js +24 -6
- package/dist/src/generated/typus_perp/position.d.ts +207 -185
- package/dist/src/generated/typus_perp/position.js +236 -277
- package/dist/src/generated/typus_perp/profit_vault.d.ts +64 -72
- package/dist/src/generated/typus_perp/profit_vault.js +48 -86
- package/dist/src/generated/typus_perp/symbol.d.ts +6 -6
- package/dist/src/generated/typus_perp/symbol.js +11 -13
- package/dist/src/generated/typus_perp/trading.d.ts +451 -558
- package/dist/src/generated/typus_perp/trading.js +429 -681
- package/dist/src/generated/typus_perp/treasury_caps.d.ts +5 -7
- package/dist/src/generated/typus_perp/treasury_caps.js +8 -45
- package/dist/src/generated/typus_stake_pool/admin.d.ts +13 -122
- package/dist/src/generated/typus_stake_pool/admin.js +19 -103
- package/dist/src/generated/typus_stake_pool/deps/std/type_name.d.ts +2 -2
- package/dist/src/generated/typus_stake_pool/deps/std/type_name.js +2 -2
- package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.d.ts +2 -2
- package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.js +2 -2
- package/dist/src/generated/typus_stake_pool/stake_pool.d.ts +249 -240
- package/dist/src/generated/typus_stake_pool/stake_pool.js +159 -246
- package/dist/src/generated/utils/index.d.ts +21 -2
- package/dist/src/generated/utils/index.js +34 -10
- package/dist/src/user/history.d.ts +3 -2
- package/dist/src/user/history.js +60 -18
- package/dist/src/user/order.d.ts +1 -1
- package/dist/src/user/orderWithBidReceipt.d.ts +1 -1
- package/package.json +8 -15
- package/dist/src/generated/typus_perp/deps/sui/object.d.ts +0 -8
- package/dist/src/generated/typus_perp/deps/sui/object.js +0 -16
- package/dist/src/generated/typus_perp/user_account.d.ts +0 -146
- package/dist/src/generated/typus_perp/user_account.js +0 -221
- package/dist/src/generated/typus_stake_pool/deps/sui/object.d.ts +0 -8
- package/dist/src/generated/typus_stake_pool/deps/sui/object.js +0 -16
- package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.d.ts +0 -30
- package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.js +0 -37
- package/dist/src/grpc/graphql.d.ts +0 -26
- package/dist/src/grpc/graphql.js +0 -126
- package/dist/src/grpc/grpc.d.ts +0 -1
- package/dist/src/grpc/grpc.js +0 -38
- package/dist/src/grpc/ledgerService.d.ts +0 -0
- package/dist/src/grpc/ledgerService.js +0 -64
- package/dist/src/grpc/liveDataService.d.ts +0 -0
- package/dist/src/grpc/liveDataService.js +0 -49
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.RealizeOptionPositionEvent = exports.ExpiredPositionInfo = exports.UpdateFundingRateEvent = exports.SettleReceiptCollateralEvent = exports.LiquidateEvent = exports.LiquidationInfo = exports.ManagerCloseOptionPositionEvent = exports.ManagerClearPositionEvent = exports.ManagerReducePositionEvent = exports.
|
|
36
|
+
exports.RealizeOptionPositionEvent = exports.ExpiredPositionInfo = exports.UpdateFundingRateEvent = exports.SettleReceiptCollateralEvent = exports.LiquidateEvent = exports.LiquidationInfo = exports.ManagerCloseOptionPositionEvent = exports.ManagerClearPositionEvent = exports.ManagerReducePositionEvent = exports.MatchTradingOrderEvent = exports.CreateTradingOrderWithBidReceiptsEvent = exports.IncreaseCollateralEvent = exports.ReleaseCollateralEvent = exports.CancelTradingOrderEvent = exports.ManagerCancelOrdersEvent = exports.CreateTradingOrderEvent = exports.ResumeTradingSymbolEvent = exports.SuspendTradingSymbolEvent = exports.ResumeMarketEvent = exports.SuspendMarketEvent = exports.UpdateMarketConfigEvent = exports.UpdateProtocolFeeShareBpEvent = exports.AddTradingSymbolEvent = exports.NewMarketsEvent = exports.USD = exports.SymbolMarket = exports.MarketConfig = exports.MarketInfo = exports.Markets = exports.MarketRegistry = void 0;
|
|
37
37
|
exports.init = init;
|
|
38
38
|
exports.newMarkets = newMarkets;
|
|
39
39
|
exports.addTradingSymbol = addTradingSymbol;
|
|
@@ -52,7 +52,6 @@ exports.collectPositionFundingFee = collectPositionFundingFee;
|
|
|
52
52
|
exports.createTradingOrderWithBidReceipt = createTradingOrderWithBidReceipt;
|
|
53
53
|
exports.reduceOptionCollateralPositionSize = reduceOptionCollateralPositionSize;
|
|
54
54
|
exports.matchTradingOrder = matchTradingOrder;
|
|
55
|
-
exports.managerCancelOrderByOpenInterestLimit = managerCancelOrderByOpenInterestLimit;
|
|
56
55
|
exports.cancelLinkedOrders = cancelLinkedOrders;
|
|
57
56
|
exports.managerReducePosition = managerReducePosition;
|
|
58
57
|
exports.managerClearPosition = managerClearPosition;
|
|
@@ -63,25 +62,23 @@ exports.liquidate = liquidate;
|
|
|
63
62
|
exports.settleReceiptCollateral = settleReceiptCollateral;
|
|
64
63
|
exports.updateFundingRate = updateFundingRate;
|
|
65
64
|
exports.getExpiredPositionInfo = getExpiredPositionInfo;
|
|
66
|
-
exports.
|
|
67
|
-
exports.createUserAccount = createUserAccount;
|
|
68
|
-
exports.addDelegateUser = addDelegateUser;
|
|
69
|
-
exports.removeDelegateUser = removeDelegateUser;
|
|
70
|
-
exports.removeUserAccount = removeUserAccount;
|
|
71
|
-
exports.depositUserAccount = depositUserAccount;
|
|
72
|
-
exports.withdrawUserAccount = withdrawUserAccount;
|
|
65
|
+
exports.prepareOrderExecution = prepareOrderExecution;
|
|
73
66
|
exports.executeOrder_ = executeOrder_;
|
|
74
67
|
exports.executeOptionCollateralOrder_ = executeOptionCollateralOrder_;
|
|
75
68
|
exports.removeLinkedOrders = removeLinkedOrders;
|
|
76
69
|
exports.removeLinkedOrder_ = removeLinkedOrder_;
|
|
77
70
|
exports.getMutOrders = getMutOrders;
|
|
78
71
|
exports.getOrders = getOrders;
|
|
72
|
+
exports.getOrderKey = getOrderKey;
|
|
79
73
|
exports.takeOrderByOrderIdAndPrice = takeOrderByOrderIdAndPrice;
|
|
80
74
|
exports.getLinkedPosition = getLinkedPosition;
|
|
81
75
|
exports.checkCollateralEnoughWhenAddingPosition = checkCollateralEnoughWhenAddingPosition;
|
|
82
76
|
exports.checkCollateralEnoughWhenReducingPosition = checkCollateralEnoughWhenReducingPosition;
|
|
83
77
|
exports.checkOptionCollateralEnough = checkOptionCollateralEnough;
|
|
84
78
|
exports.checkReserveEnough = checkReserveEnough;
|
|
79
|
+
exports.getMaxReleasingCollateralAmount_ = getMaxReleasingCollateralAmount_;
|
|
80
|
+
exports.normalSafetyCheck = normalSafetyCheck;
|
|
81
|
+
exports.validateTradingFeeConfig = validateTradingFeeConfig;
|
|
85
82
|
exports.adjustMarketInfoUserOrderSize = adjustMarketInfoUserOrderSize;
|
|
86
83
|
exports.adjustMarketInfoUserPositionSize = adjustMarketInfoUserPositionSize;
|
|
87
84
|
exports.exerciseBidReceipts = exerciseBidReceipts;
|
|
@@ -91,7 +88,6 @@ exports.getUserOrders = getUserOrders;
|
|
|
91
88
|
exports.getUserPositions = getUserPositions;
|
|
92
89
|
exports.getAllPositions = getAllPositions;
|
|
93
90
|
exports.getActiveOrdersByOrderTag = getActiveOrdersByOrderTag;
|
|
94
|
-
exports.getActiveOrdersByOrderTagAndCtoken = getActiveOrdersByOrderTagAndCtoken;
|
|
95
91
|
exports.getMaxReleasingCollateralAmount = getMaxReleasingCollateralAmount;
|
|
96
92
|
exports.getEstimatedLiquidationPriceAndPnl = getEstimatedLiquidationPriceAndPnl;
|
|
97
93
|
exports.calculateTradingFeeRateMbp = calculateTradingFeeRateMbp;
|
|
@@ -102,20 +98,58 @@ exports.deprecated = deprecated;
|
|
|
102
98
|
/**************************************************************
|
|
103
99
|
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
104
100
|
**************************************************************/
|
|
105
|
-
const
|
|
101
|
+
const index_js_1 = require("../utils/index.js");
|
|
106
102
|
const bcs_1 = require("@mysten/sui/bcs");
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
const
|
|
103
|
+
const linked_object_table = __importStar(require("./deps/typus/linked_object_table.js"));
|
|
104
|
+
const type_name = __importStar(require("./deps/std/type_name.js"));
|
|
105
|
+
const type_name_1 = __importStar(require("./deps/std/type_name.js"));
|
|
106
|
+
const type_name_2 = __importStar(require("./deps/std/type_name.js"));
|
|
107
|
+
const object_table = __importStar(require("./deps/sui/object_table.js"));
|
|
108
|
+
const keyed_big_vector = __importStar(require("./deps/typus/keyed_big_vector.js"));
|
|
109
|
+
const type_name_3 = __importStar(require("./deps/std/type_name.js"));
|
|
110
|
+
const type_name_4 = __importStar(require("./deps/std/type_name.js"));
|
|
111
|
+
const type_name_5 = __importStar(require("./deps/std/type_name.js"));
|
|
112
|
+
const type_name_6 = __importStar(require("./deps/std/type_name.js"));
|
|
113
|
+
const type_name_7 = __importStar(require("./deps/std/type_name.js"));
|
|
114
|
+
const type_name_8 = __importStar(require("./deps/std/type_name.js"));
|
|
115
|
+
const type_name_9 = __importStar(require("./deps/std/type_name.js"));
|
|
116
|
+
const type_name_10 = __importStar(require("./deps/std/type_name.js"));
|
|
117
|
+
const type_name_11 = __importStar(require("./deps/std/type_name.js"));
|
|
118
|
+
const type_name_12 = __importStar(require("./deps/std/type_name.js"));
|
|
119
|
+
const type_name_13 = __importStar(require("./deps/std/type_name.js"));
|
|
120
|
+
const type_name_14 = __importStar(require("./deps/std/type_name.js"));
|
|
121
|
+
const type_name_15 = __importStar(require("./deps/std/type_name.js"));
|
|
122
|
+
const type_name_16 = __importStar(require("./deps/std/type_name.js"));
|
|
123
|
+
const type_name_17 = __importStar(require("./deps/std/type_name.js"));
|
|
124
|
+
const type_name_18 = __importStar(require("./deps/std/type_name.js"));
|
|
125
|
+
const type_name_19 = __importStar(require("./deps/std/type_name.js"));
|
|
126
|
+
const type_name_20 = __importStar(require("./deps/std/type_name.js"));
|
|
127
|
+
const type_name_21 = __importStar(require("./deps/std/type_name.js"));
|
|
128
|
+
const type_name_22 = __importStar(require("./deps/std/type_name.js"));
|
|
129
|
+
const type_name_23 = __importStar(require("./deps/std/type_name.js"));
|
|
130
|
+
const type_name_24 = __importStar(require("./deps/std/type_name.js"));
|
|
131
|
+
const type_name_25 = __importStar(require("./deps/std/type_name.js"));
|
|
132
|
+
const type_name_26 = __importStar(require("./deps/std/type_name.js"));
|
|
133
|
+
const type_name_27 = __importStar(require("./deps/std/type_name.js"));
|
|
134
|
+
const type_name_28 = __importStar(require("./deps/std/type_name.js"));
|
|
135
|
+
const type_name_29 = __importStar(require("./deps/std/type_name.js"));
|
|
136
|
+
const type_name_30 = __importStar(require("./deps/std/type_name.js"));
|
|
137
|
+
const type_name_31 = __importStar(require("./deps/std/type_name.js"));
|
|
138
|
+
const type_name_32 = __importStar(require("./deps/std/type_name.js"));
|
|
139
|
+
const type_name_33 = __importStar(require("./deps/std/type_name.js"));
|
|
140
|
+
const type_name_34 = __importStar(require("./deps/std/type_name.js"));
|
|
141
|
+
const type_name_35 = __importStar(require("./deps/std/type_name.js"));
|
|
142
|
+
const type_name_36 = __importStar(require("./deps/std/type_name.js"));
|
|
143
|
+
const type_name_37 = __importStar(require("./deps/std/type_name.js"));
|
|
144
|
+
const type_name_38 = __importStar(require("./deps/std/type_name.js"));
|
|
145
|
+
const type_name_39 = __importStar(require("./deps/std/type_name.js"));
|
|
112
146
|
const $moduleName = "@typus/perp::trading";
|
|
113
|
-
exports.MarketRegistry = new
|
|
147
|
+
exports.MarketRegistry = new index_js_1.MoveStruct({
|
|
114
148
|
name: `${$moduleName}::MarketRegistry`,
|
|
115
149
|
fields: {
|
|
116
|
-
id:
|
|
150
|
+
id: bcs_1.bcs.Address,
|
|
117
151
|
/** The UID of the referral registry. */
|
|
118
|
-
referral_registry:
|
|
152
|
+
referral_registry: bcs_1.bcs.Address,
|
|
119
153
|
/** A linked object table of markets. */
|
|
120
154
|
markets: linked_object_table.LinkedObjectTable(bcs_1.bcs.u64()),
|
|
121
155
|
/** The number of markets. */
|
|
@@ -124,29 +158,29 @@ exports.MarketRegistry = new index_1.MoveStruct({
|
|
|
124
158
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
125
159
|
},
|
|
126
160
|
});
|
|
127
|
-
exports.Markets = new
|
|
161
|
+
exports.Markets = new index_js_1.MoveStruct({
|
|
128
162
|
name: `${$moduleName}::Markets`,
|
|
129
163
|
fields: {
|
|
130
|
-
id:
|
|
164
|
+
id: bcs_1.bcs.Address,
|
|
131
165
|
/** The index of the market. */
|
|
132
166
|
index: bcs_1.bcs.u64(),
|
|
133
167
|
/** The type name of the LP token. */
|
|
134
168
|
lp_token_type: type_name.TypeName,
|
|
135
169
|
/** The type name of the quote token. */
|
|
136
|
-
quote_token_type:
|
|
170
|
+
quote_token_type: type_name_1.TypeName,
|
|
137
171
|
/** Whether the market is active. */
|
|
138
172
|
is_active: bcs_1.bcs.bool(),
|
|
139
173
|
/** The protocol's share of the trading fee in basis points. */
|
|
140
174
|
protocol_fee_share_bp: bcs_1.bcs.u64(),
|
|
141
175
|
/** A vector of the symbols in the market. */
|
|
142
|
-
symbols: bcs_1.bcs.vector(
|
|
176
|
+
symbols: bcs_1.bcs.vector(type_name_2.TypeName),
|
|
143
177
|
/** An object table of the symbol markets. */
|
|
144
178
|
symbol_markets: object_table.ObjectTable,
|
|
145
179
|
/** Padding for future use. */
|
|
146
180
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
147
181
|
},
|
|
148
182
|
});
|
|
149
|
-
exports.MarketInfo = new
|
|
183
|
+
exports.MarketInfo = new index_js_1.MoveStruct({
|
|
150
184
|
name: `${$moduleName}::MarketInfo`,
|
|
151
185
|
fields: {
|
|
152
186
|
/** Whether the market is active. */
|
|
@@ -181,7 +215,7 @@ exports.MarketInfo = new index_1.MoveStruct({
|
|
|
181
215
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
182
216
|
},
|
|
183
217
|
});
|
|
184
|
-
exports.MarketConfig = new
|
|
218
|
+
exports.MarketConfig = new index_js_1.MoveStruct({
|
|
185
219
|
name: `${$moduleName}::MarketConfig`,
|
|
186
220
|
fields: {
|
|
187
221
|
/** The address of the oracle. */
|
|
@@ -202,55 +236,55 @@ exports.MarketConfig = new index_1.MoveStruct({
|
|
|
202
236
|
funding_interval_ts_ms: bcs_1.bcs.u64(),
|
|
203
237
|
/** The experience multiplier. */
|
|
204
238
|
exp_multiplier: bcs_1.bcs.u64(),
|
|
205
|
-
/** The cool
|
|
239
|
+
/** The position cool-down threshold in milliseconds. */
|
|
206
240
|
cool_down_threshold_ts_ms: bcs_1.bcs.u64(),
|
|
207
241
|
/** Padding for future use. */
|
|
208
242
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
209
243
|
},
|
|
210
244
|
});
|
|
211
|
-
exports.SymbolMarket = new
|
|
245
|
+
exports.SymbolMarket = new index_js_1.MoveStruct({
|
|
212
246
|
name: `${$moduleName}::SymbolMarket`,
|
|
213
247
|
fields: {
|
|
214
|
-
id:
|
|
248
|
+
id: bcs_1.bcs.Address,
|
|
215
249
|
/** A keyed big vector of user positions. */
|
|
216
250
|
user_positions: keyed_big_vector.KeyedBigVector,
|
|
217
251
|
/** The UID of the token collateral orders. */
|
|
218
|
-
token_collateral_orders:
|
|
252
|
+
token_collateral_orders: bcs_1.bcs.Address,
|
|
219
253
|
/** The UID of the option collateral orders. */
|
|
220
|
-
option_collateral_orders:
|
|
254
|
+
option_collateral_orders: bcs_1.bcs.Address,
|
|
221
255
|
/** Information about the market. */
|
|
222
256
|
market_info: exports.MarketInfo,
|
|
223
257
|
/** Configuration for the market. */
|
|
224
258
|
market_config: exports.MarketConfig,
|
|
225
259
|
},
|
|
226
260
|
});
|
|
227
|
-
exports.USD = new
|
|
261
|
+
exports.USD = new index_js_1.MoveStruct({
|
|
228
262
|
name: `${$moduleName}::USD`,
|
|
229
263
|
fields: {
|
|
230
264
|
dummy_field: bcs_1.bcs.bool(),
|
|
231
265
|
},
|
|
232
266
|
});
|
|
233
|
-
exports.NewMarketsEvent = new
|
|
267
|
+
exports.NewMarketsEvent = new index_js_1.MoveStruct({
|
|
234
268
|
name: `${$moduleName}::NewMarketsEvent`,
|
|
235
269
|
fields: {
|
|
236
270
|
index: bcs_1.bcs.u64(),
|
|
237
|
-
lp_token_type:
|
|
238
|
-
quote_token_type:
|
|
271
|
+
lp_token_type: type_name_3.TypeName,
|
|
272
|
+
quote_token_type: type_name_4.TypeName,
|
|
239
273
|
protocol_fee_share_bp: bcs_1.bcs.u64(),
|
|
240
274
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
241
275
|
},
|
|
242
276
|
});
|
|
243
|
-
exports.AddTradingSymbolEvent = new
|
|
277
|
+
exports.AddTradingSymbolEvent = new index_js_1.MoveStruct({
|
|
244
278
|
name: `${$moduleName}::AddTradingSymbolEvent`,
|
|
245
279
|
fields: {
|
|
246
280
|
index: bcs_1.bcs.u64(),
|
|
247
|
-
base_token_type:
|
|
281
|
+
base_token_type: type_name_5.TypeName,
|
|
248
282
|
market_info: exports.MarketInfo,
|
|
249
283
|
market_config: exports.MarketConfig,
|
|
250
284
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
251
285
|
},
|
|
252
286
|
});
|
|
253
|
-
exports.UpdateProtocolFeeShareBpEvent = new
|
|
287
|
+
exports.UpdateProtocolFeeShareBpEvent = new index_js_1.MoveStruct({
|
|
254
288
|
name: `${$moduleName}::UpdateProtocolFeeShareBpEvent`,
|
|
255
289
|
fields: {
|
|
256
290
|
index: bcs_1.bcs.u64(),
|
|
@@ -259,54 +293,54 @@ exports.UpdateProtocolFeeShareBpEvent = new index_1.MoveStruct({
|
|
|
259
293
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
260
294
|
},
|
|
261
295
|
});
|
|
262
|
-
exports.UpdateMarketConfigEvent = new
|
|
296
|
+
exports.UpdateMarketConfigEvent = new index_js_1.MoveStruct({
|
|
263
297
|
name: `${$moduleName}::UpdateMarketConfigEvent`,
|
|
264
298
|
fields: {
|
|
265
299
|
index: bcs_1.bcs.u64(),
|
|
266
|
-
base_token_type:
|
|
300
|
+
base_token_type: type_name_6.TypeName,
|
|
267
301
|
previous_market_config: exports.MarketConfig,
|
|
268
302
|
new_market_config: exports.MarketConfig,
|
|
269
303
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
270
304
|
},
|
|
271
305
|
});
|
|
272
|
-
exports.SuspendMarketEvent = new
|
|
306
|
+
exports.SuspendMarketEvent = new index_js_1.MoveStruct({
|
|
273
307
|
name: `${$moduleName}::SuspendMarketEvent`,
|
|
274
308
|
fields: {
|
|
275
309
|
index: bcs_1.bcs.u64(),
|
|
276
310
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
277
311
|
},
|
|
278
312
|
});
|
|
279
|
-
exports.ResumeMarketEvent = new
|
|
313
|
+
exports.ResumeMarketEvent = new index_js_1.MoveStruct({
|
|
280
314
|
name: `${$moduleName}::ResumeMarketEvent`,
|
|
281
315
|
fields: {
|
|
282
316
|
index: bcs_1.bcs.u64(),
|
|
283
317
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
284
318
|
},
|
|
285
319
|
});
|
|
286
|
-
exports.SuspendTradingSymbolEvent = new
|
|
320
|
+
exports.SuspendTradingSymbolEvent = new index_js_1.MoveStruct({
|
|
287
321
|
name: `${$moduleName}::SuspendTradingSymbolEvent`,
|
|
288
322
|
fields: {
|
|
289
323
|
index: bcs_1.bcs.u64(),
|
|
290
|
-
suspended_base_token:
|
|
324
|
+
suspended_base_token: type_name_7.TypeName,
|
|
291
325
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
292
326
|
},
|
|
293
327
|
});
|
|
294
|
-
exports.ResumeTradingSymbolEvent = new
|
|
328
|
+
exports.ResumeTradingSymbolEvent = new index_js_1.MoveStruct({
|
|
295
329
|
name: `${$moduleName}::ResumeTradingSymbolEvent`,
|
|
296
330
|
fields: {
|
|
297
331
|
index: bcs_1.bcs.u64(),
|
|
298
|
-
resumed_base_token:
|
|
332
|
+
resumed_base_token: type_name_8.TypeName,
|
|
299
333
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
300
334
|
},
|
|
301
335
|
});
|
|
302
|
-
exports.CreateTradingOrderEvent = new
|
|
336
|
+
exports.CreateTradingOrderEvent = new index_js_1.MoveStruct({
|
|
303
337
|
name: `${$moduleName}::CreateTradingOrderEvent`,
|
|
304
338
|
fields: {
|
|
305
339
|
user: bcs_1.bcs.Address,
|
|
306
340
|
market_index: bcs_1.bcs.u64(),
|
|
307
341
|
pool_index: bcs_1.bcs.u64(),
|
|
308
|
-
collateral_token:
|
|
309
|
-
base_token:
|
|
342
|
+
collateral_token: type_name_9.TypeName,
|
|
343
|
+
base_token: type_name_10.TypeName,
|
|
310
344
|
order_id: bcs_1.bcs.u64(),
|
|
311
345
|
linked_position_id: bcs_1.bcs.option(bcs_1.bcs.u64()),
|
|
312
346
|
collateral_amount: bcs_1.bcs.u64(),
|
|
@@ -316,61 +350,75 @@ exports.CreateTradingOrderEvent = new index_1.MoveStruct({
|
|
|
316
350
|
is_stop_order: bcs_1.bcs.bool(),
|
|
317
351
|
size: bcs_1.bcs.u64(),
|
|
318
352
|
trigger_price: bcs_1.bcs.u64(),
|
|
353
|
+
trading_pair_oracle_price: bcs_1.bcs.u64(),
|
|
319
354
|
filled: bcs_1.bcs.bool(),
|
|
320
355
|
filled_price: bcs_1.bcs.option(bcs_1.bcs.u64()),
|
|
321
356
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
322
357
|
},
|
|
323
358
|
});
|
|
324
|
-
exports.
|
|
359
|
+
exports.ManagerCancelOrdersEvent = new index_js_1.MoveStruct({
|
|
360
|
+
name: `${$moduleName}::ManagerCancelOrdersEvent`,
|
|
361
|
+
fields: {
|
|
362
|
+
reason: bcs_1.bcs.string(),
|
|
363
|
+
collateral_token: type_name_11.TypeName,
|
|
364
|
+
base_token: type_name_12.TypeName,
|
|
365
|
+
order_type_tag: bcs_1.bcs.u8(),
|
|
366
|
+
order_id: bcs_1.bcs.u64(),
|
|
367
|
+
order_size: bcs_1.bcs.u64(),
|
|
368
|
+
order_price: bcs_1.bcs.u64(),
|
|
369
|
+
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
370
|
+
},
|
|
371
|
+
});
|
|
372
|
+
exports.CancelTradingOrderEvent = new index_js_1.MoveStruct({
|
|
325
373
|
name: `${$moduleName}::CancelTradingOrderEvent`,
|
|
326
374
|
fields: {
|
|
327
375
|
user: bcs_1.bcs.Address,
|
|
328
376
|
market_index: bcs_1.bcs.u64(),
|
|
329
377
|
order_id: bcs_1.bcs.u64(),
|
|
330
378
|
trigger_price: bcs_1.bcs.u64(),
|
|
331
|
-
collateral_token:
|
|
332
|
-
base_token:
|
|
379
|
+
collateral_token: type_name_13.TypeName,
|
|
380
|
+
base_token: type_name_14.TypeName,
|
|
333
381
|
released_collateral_amount: bcs_1.bcs.u64(),
|
|
334
382
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
335
383
|
},
|
|
336
384
|
});
|
|
337
|
-
exports.ReleaseCollateralEvent = new
|
|
385
|
+
exports.ReleaseCollateralEvent = new index_js_1.MoveStruct({
|
|
338
386
|
name: `${$moduleName}::ReleaseCollateralEvent`,
|
|
339
387
|
fields: {
|
|
340
388
|
user: bcs_1.bcs.Address,
|
|
341
389
|
market_index: bcs_1.bcs.u64(),
|
|
342
390
|
pool_index: bcs_1.bcs.u64(),
|
|
343
391
|
position_id: bcs_1.bcs.u64(),
|
|
344
|
-
collateral_token:
|
|
345
|
-
base_token:
|
|
392
|
+
collateral_token: type_name_15.TypeName,
|
|
393
|
+
base_token: type_name_16.TypeName,
|
|
346
394
|
released_collateral_amount: bcs_1.bcs.u64(),
|
|
347
395
|
remaining_collateral_amount: bcs_1.bcs.u64(),
|
|
348
396
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
349
397
|
},
|
|
350
398
|
});
|
|
351
|
-
exports.IncreaseCollateralEvent = new
|
|
399
|
+
exports.IncreaseCollateralEvent = new index_js_1.MoveStruct({
|
|
352
400
|
name: `${$moduleName}::IncreaseCollateralEvent`,
|
|
353
401
|
fields: {
|
|
354
402
|
user: bcs_1.bcs.Address,
|
|
355
403
|
market_index: bcs_1.bcs.u64(),
|
|
356
404
|
pool_index: bcs_1.bcs.u64(),
|
|
357
405
|
position_id: bcs_1.bcs.u64(),
|
|
358
|
-
collateral_token:
|
|
359
|
-
base_token:
|
|
406
|
+
collateral_token: type_name_17.TypeName,
|
|
407
|
+
base_token: type_name_18.TypeName,
|
|
360
408
|
increased_collateral_amount: bcs_1.bcs.u64(),
|
|
361
409
|
remaining_collateral_amount: bcs_1.bcs.u64(),
|
|
362
410
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
363
411
|
},
|
|
364
412
|
});
|
|
365
|
-
exports.CreateTradingOrderWithBidReceiptsEvent = new
|
|
413
|
+
exports.CreateTradingOrderWithBidReceiptsEvent = new index_js_1.MoveStruct({
|
|
366
414
|
name: `${$moduleName}::CreateTradingOrderWithBidReceiptsEvent`,
|
|
367
415
|
fields: {
|
|
368
416
|
user: bcs_1.bcs.Address,
|
|
369
417
|
market_index: bcs_1.bcs.u64(),
|
|
370
418
|
pool_index: bcs_1.bcs.u64(),
|
|
371
419
|
dov_index: bcs_1.bcs.u64(),
|
|
372
|
-
collateral_token:
|
|
373
|
-
base_token:
|
|
420
|
+
collateral_token: type_name_19.TypeName,
|
|
421
|
+
base_token: type_name_20.TypeName,
|
|
374
422
|
order_id: bcs_1.bcs.u64(),
|
|
375
423
|
collateral_in_deposit_token: bcs_1.bcs.u64(),
|
|
376
424
|
is_long: bcs_1.bcs.bool(),
|
|
@@ -381,34 +429,21 @@ exports.CreateTradingOrderWithBidReceiptsEvent = new index_1.MoveStruct({
|
|
|
381
429
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
382
430
|
},
|
|
383
431
|
});
|
|
384
|
-
exports.MatchTradingOrderEvent = new
|
|
432
|
+
exports.MatchTradingOrderEvent = new index_js_1.MoveStruct({
|
|
385
433
|
name: `${$moduleName}::MatchTradingOrderEvent`,
|
|
386
434
|
fields: {
|
|
387
|
-
collateral_token:
|
|
388
|
-
base_token:
|
|
435
|
+
collateral_token: type_name_21.TypeName,
|
|
436
|
+
base_token: type_name_22.TypeName,
|
|
389
437
|
matched_order_ids: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
390
438
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
391
439
|
},
|
|
392
440
|
});
|
|
393
|
-
exports.
|
|
394
|
-
name: `${$moduleName}::ManagerCancelOrdersEvent`,
|
|
395
|
-
fields: {
|
|
396
|
-
reason: bcs_1.bcs.string(),
|
|
397
|
-
collateral_token: type_name.TypeName,
|
|
398
|
-
base_token: type_name.TypeName,
|
|
399
|
-
order_type_tag: bcs_1.bcs.u8(),
|
|
400
|
-
order_ids: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
401
|
-
order_sizes: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
402
|
-
order_prices: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
403
|
-
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
404
|
-
},
|
|
405
|
-
});
|
|
406
|
-
exports.ManagerReducePositionEvent = new index_1.MoveStruct({
|
|
441
|
+
exports.ManagerReducePositionEvent = new index_js_1.MoveStruct({
|
|
407
442
|
name: `${$moduleName}::ManagerReducePositionEvent`,
|
|
408
443
|
fields: {
|
|
409
444
|
user: bcs_1.bcs.Address,
|
|
410
|
-
collateral_token:
|
|
411
|
-
base_token:
|
|
445
|
+
collateral_token: type_name_23.TypeName,
|
|
446
|
+
base_token: type_name_24.TypeName,
|
|
412
447
|
position_id: bcs_1.bcs.u64(),
|
|
413
448
|
reduced_size: bcs_1.bcs.u64(),
|
|
414
449
|
collateral_price: bcs_1.bcs.u64(),
|
|
@@ -417,24 +452,24 @@ exports.ManagerReducePositionEvent = new index_1.MoveStruct({
|
|
|
417
452
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
418
453
|
},
|
|
419
454
|
});
|
|
420
|
-
exports.ManagerClearPositionEvent = new
|
|
455
|
+
exports.ManagerClearPositionEvent = new index_js_1.MoveStruct({
|
|
421
456
|
name: `${$moduleName}::ManagerClearPositionEvent`,
|
|
422
457
|
fields: {
|
|
423
458
|
user: bcs_1.bcs.Address,
|
|
424
|
-
collateral_token:
|
|
425
|
-
base_token:
|
|
459
|
+
collateral_token: type_name_25.TypeName,
|
|
460
|
+
base_token: type_name_26.TypeName,
|
|
426
461
|
position_id: bcs_1.bcs.u64(),
|
|
427
462
|
removed_size: bcs_1.bcs.u64(),
|
|
428
463
|
cancelled_order_ids: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
429
464
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
430
465
|
},
|
|
431
466
|
});
|
|
432
|
-
exports.ManagerCloseOptionPositionEvent = new
|
|
467
|
+
exports.ManagerCloseOptionPositionEvent = new index_js_1.MoveStruct({
|
|
433
468
|
name: `${$moduleName}::ManagerCloseOptionPositionEvent`,
|
|
434
469
|
fields: {
|
|
435
470
|
user: bcs_1.bcs.Address,
|
|
436
|
-
collateral_token:
|
|
437
|
-
base_token:
|
|
471
|
+
collateral_token: type_name_27.TypeName,
|
|
472
|
+
base_token: type_name_28.TypeName,
|
|
438
473
|
position_id: bcs_1.bcs.u64(),
|
|
439
474
|
order_size: bcs_1.bcs.u64(),
|
|
440
475
|
collateral_price: bcs_1.bcs.u64(),
|
|
@@ -443,20 +478,20 @@ exports.ManagerCloseOptionPositionEvent = new index_1.MoveStruct({
|
|
|
443
478
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
444
479
|
},
|
|
445
480
|
});
|
|
446
|
-
exports.LiquidationInfo = new
|
|
481
|
+
exports.LiquidationInfo = new index_js_1.MoveStruct({
|
|
447
482
|
name: `${$moduleName}::LiquidationInfo`,
|
|
448
483
|
fields: {
|
|
449
484
|
position_id: bcs_1.bcs.u64(),
|
|
450
485
|
dov_index: bcs_1.bcs.option(bcs_1.bcs.u64()),
|
|
451
|
-
bid_token: bcs_1.bcs.option(
|
|
486
|
+
bid_token: bcs_1.bcs.option(type_name_29.TypeName),
|
|
452
487
|
},
|
|
453
488
|
});
|
|
454
|
-
exports.LiquidateEvent = new
|
|
489
|
+
exports.LiquidateEvent = new index_js_1.MoveStruct({
|
|
455
490
|
name: `${$moduleName}::LiquidateEvent`,
|
|
456
491
|
fields: {
|
|
457
492
|
user: bcs_1.bcs.Address,
|
|
458
|
-
collateral_token:
|
|
459
|
-
base_token:
|
|
493
|
+
collateral_token: type_name_30.TypeName,
|
|
494
|
+
base_token: type_name_31.TypeName,
|
|
460
495
|
position_id: bcs_1.bcs.u64(),
|
|
461
496
|
collateral_price: bcs_1.bcs.u64(),
|
|
462
497
|
trading_price: bcs_1.bcs.u64(),
|
|
@@ -465,12 +500,12 @@ exports.LiquidateEvent = new index_1.MoveStruct({
|
|
|
465
500
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
466
501
|
},
|
|
467
502
|
});
|
|
468
|
-
exports.SettleReceiptCollateralEvent = new
|
|
503
|
+
exports.SettleReceiptCollateralEvent = new index_js_1.MoveStruct({
|
|
469
504
|
name: `${$moduleName}::SettleReceiptCollateralEvent`,
|
|
470
505
|
fields: {
|
|
471
506
|
user: bcs_1.bcs.Address,
|
|
472
|
-
collateral_token:
|
|
473
|
-
bid_token:
|
|
507
|
+
collateral_token: type_name_32.TypeName,
|
|
508
|
+
bid_token: type_name_33.TypeName,
|
|
474
509
|
position_id: bcs_1.bcs.u64(),
|
|
475
510
|
realized_liquidator_fee: bcs_1.bcs.u64(),
|
|
476
511
|
remaining_unrealized_sign: bcs_1.bcs.bool(),
|
|
@@ -479,10 +514,10 @@ exports.SettleReceiptCollateralEvent = new index_1.MoveStruct({
|
|
|
479
514
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
480
515
|
},
|
|
481
516
|
});
|
|
482
|
-
exports.UpdateFundingRateEvent = new
|
|
517
|
+
exports.UpdateFundingRateEvent = new index_js_1.MoveStruct({
|
|
483
518
|
name: `${$moduleName}::UpdateFundingRateEvent`,
|
|
484
519
|
fields: {
|
|
485
|
-
base_token:
|
|
520
|
+
base_token: type_name_34.TypeName,
|
|
486
521
|
new_funding_ts_ms: bcs_1.bcs.u64(),
|
|
487
522
|
intervals_count: bcs_1.bcs.u64(),
|
|
488
523
|
previous_cumulative_funding_rate_index_sign: bcs_1.bcs.bool(),
|
|
@@ -492,23 +527,23 @@ exports.UpdateFundingRateEvent = new index_1.MoveStruct({
|
|
|
492
527
|
u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
493
528
|
},
|
|
494
529
|
});
|
|
495
|
-
exports.ExpiredPositionInfo = new
|
|
530
|
+
exports.ExpiredPositionInfo = new index_js_1.MoveStruct({
|
|
496
531
|
name: `${$moduleName}::ExpiredPositionInfo`,
|
|
497
532
|
fields: {
|
|
498
533
|
position_id: bcs_1.bcs.u64(),
|
|
499
534
|
dov_index: bcs_1.bcs.u64(),
|
|
500
|
-
collateral_token:
|
|
501
|
-
bid_token:
|
|
502
|
-
base_token:
|
|
535
|
+
collateral_token: type_name_35.TypeName,
|
|
536
|
+
bid_token: type_name_36.TypeName,
|
|
537
|
+
base_token: type_name_37.TypeName,
|
|
503
538
|
},
|
|
504
539
|
});
|
|
505
|
-
exports.RealizeOptionPositionEvent = new
|
|
540
|
+
exports.RealizeOptionPositionEvent = new index_js_1.MoveStruct({
|
|
506
541
|
name: `${$moduleName}::RealizeOptionPositionEvent`,
|
|
507
542
|
fields: {
|
|
508
543
|
position_user: bcs_1.bcs.Address,
|
|
509
544
|
position_id: bcs_1.bcs.u64(),
|
|
510
|
-
trading_symbol:
|
|
511
|
-
realize_balance_token_type:
|
|
545
|
+
trading_symbol: type_name_38.TypeName,
|
|
546
|
+
realize_balance_token_type: type_name_39.TypeName,
|
|
512
547
|
exercise_balance_value: bcs_1.bcs.u64(),
|
|
513
548
|
user_remaining_value: bcs_1.bcs.u64(),
|
|
514
549
|
user_remaining_in_usd: bcs_1.bcs.u64(),
|
|
@@ -530,13 +565,13 @@ function init(options = {}) {
|
|
|
530
565
|
/** [Authorized Function] Creates a new market. */
|
|
531
566
|
function newMarkets(options) {
|
|
532
567
|
const packageAddress = options.package ?? "@typus/perp";
|
|
533
|
-
const argumentsTypes = [
|
|
568
|
+
const argumentsTypes = [null, null, "u64"];
|
|
534
569
|
const parameterNames = ["version", "registry", "protocolFeeShareBp"];
|
|
535
570
|
return (tx) => tx.moveCall({
|
|
536
571
|
package: packageAddress,
|
|
537
572
|
module: "trading",
|
|
538
573
|
function: "new_markets",
|
|
539
|
-
arguments: (0,
|
|
574
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
540
575
|
typeArguments: options.typeArguments,
|
|
541
576
|
});
|
|
542
577
|
}
|
|
@@ -544,11 +579,11 @@ function newMarkets(options) {
|
|
|
544
579
|
function addTradingSymbol(options) {
|
|
545
580
|
const packageAddress = options.package ?? "@typus/perp";
|
|
546
581
|
const argumentsTypes = [
|
|
547
|
-
|
|
548
|
-
|
|
582
|
+
null,
|
|
583
|
+
null,
|
|
549
584
|
"u64",
|
|
550
585
|
"u64",
|
|
551
|
-
|
|
586
|
+
null,
|
|
552
587
|
"u64",
|
|
553
588
|
"u64",
|
|
554
589
|
"u64",
|
|
@@ -561,10 +596,11 @@ function addTradingSymbol(options) {
|
|
|
561
596
|
"u64",
|
|
562
597
|
"u64",
|
|
563
598
|
"u64",
|
|
599
|
+
"u64",
|
|
564
600
|
"vector<u64>",
|
|
565
601
|
"u64",
|
|
566
602
|
"u64",
|
|
567
|
-
"
|
|
603
|
+
"0x2::clock::Clock",
|
|
568
604
|
];
|
|
569
605
|
const parameterNames = [
|
|
570
606
|
"version",
|
|
@@ -580,6 +616,7 @@ function addTradingSymbol(options) {
|
|
|
580
616
|
"basicFundingRate",
|
|
581
617
|
"fundingIntervalTsMs",
|
|
582
618
|
"expMultiplier",
|
|
619
|
+
"coolDownThresholdTsMs",
|
|
583
620
|
"maxBuyOpenInterest",
|
|
584
621
|
"maxSellOpenInterest",
|
|
585
622
|
"maintenanceMarginRateBp",
|
|
@@ -592,50 +629,46 @@ function addTradingSymbol(options) {
|
|
|
592
629
|
package: packageAddress,
|
|
593
630
|
module: "trading",
|
|
594
631
|
function: "add_trading_symbol",
|
|
595
|
-
arguments: (0,
|
|
632
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
596
633
|
typeArguments: options.typeArguments,
|
|
597
634
|
});
|
|
598
635
|
}
|
|
599
636
|
/** [Authorized Function] Updates the protocol fee share. */
|
|
600
637
|
function updateProtocolFeeShareBp(options) {
|
|
601
638
|
const packageAddress = options.package ?? "@typus/perp";
|
|
602
|
-
const argumentsTypes = [
|
|
603
|
-
`${packageAddress}::admin::Version`,
|
|
604
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
605
|
-
"u64",
|
|
606
|
-
"u64",
|
|
607
|
-
];
|
|
639
|
+
const argumentsTypes = [null, null, "u64", "u64"];
|
|
608
640
|
const parameterNames = ["version", "registry", "marketIndex", "protocolFeeShareBp"];
|
|
609
641
|
return (tx) => tx.moveCall({
|
|
610
642
|
package: packageAddress,
|
|
611
643
|
module: "trading",
|
|
612
644
|
function: "update_protocol_fee_share_bp",
|
|
613
|
-
arguments: (0,
|
|
645
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
614
646
|
});
|
|
615
647
|
}
|
|
616
648
|
/** [Authorized Function] Updates the market configuration. */
|
|
617
649
|
function updateMarketConfig(options) {
|
|
618
650
|
const packageAddress = options.package ?? "@typus/perp";
|
|
619
651
|
const argumentsTypes = [
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
"u64",
|
|
623
|
-
"
|
|
624
|
-
"
|
|
625
|
-
"
|
|
626
|
-
"
|
|
627
|
-
"
|
|
628
|
-
"
|
|
629
|
-
"
|
|
630
|
-
"
|
|
631
|
-
"
|
|
632
|
-
"
|
|
633
|
-
"
|
|
634
|
-
"
|
|
635
|
-
"
|
|
636
|
-
"
|
|
637
|
-
"
|
|
638
|
-
"
|
|
652
|
+
null,
|
|
653
|
+
null,
|
|
654
|
+
"u64",
|
|
655
|
+
"0x1::option::Option<address>",
|
|
656
|
+
"0x1::option::Option<u64>",
|
|
657
|
+
"0x1::option::Option<u64>",
|
|
658
|
+
"0x1::option::Option<u64>",
|
|
659
|
+
"0x1::option::Option<u64>",
|
|
660
|
+
"0x1::option::Option<vector<u64>>",
|
|
661
|
+
"0x1::option::Option<u64>",
|
|
662
|
+
"0x1::option::Option<u64>",
|
|
663
|
+
"0x1::option::Option<u64>",
|
|
664
|
+
"0x1::option::Option<u64>",
|
|
665
|
+
"0x1::option::Option<u64>",
|
|
666
|
+
"0x1::option::Option<u64>",
|
|
667
|
+
"0x1::option::Option<u64>",
|
|
668
|
+
"0x1::option::Option<u64>",
|
|
669
|
+
"0x1::option::Option<vector<u64>>",
|
|
670
|
+
"0x1::option::Option<u64>",
|
|
671
|
+
"0x1::option::Option<u64>",
|
|
639
672
|
];
|
|
640
673
|
const parameterNames = [
|
|
641
674
|
"version",
|
|
@@ -650,6 +683,7 @@ function updateMarketConfig(options) {
|
|
|
650
683
|
"basicFundingRate",
|
|
651
684
|
"fundingIntervalTsMs",
|
|
652
685
|
"expMultiplier",
|
|
686
|
+
"coolDownThresholdTsMs",
|
|
653
687
|
"maxBuyOpenInterest",
|
|
654
688
|
"maxSellOpenInterest",
|
|
655
689
|
"maintenanceMarginRateBp",
|
|
@@ -662,70 +696,70 @@ function updateMarketConfig(options) {
|
|
|
662
696
|
package: packageAddress,
|
|
663
697
|
module: "trading",
|
|
664
698
|
function: "update_market_config",
|
|
665
|
-
arguments: (0,
|
|
699
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
666
700
|
typeArguments: options.typeArguments,
|
|
667
701
|
});
|
|
668
702
|
}
|
|
669
703
|
/** [Authorized Function] Suspends a market. */
|
|
670
704
|
function suspendMarket(options) {
|
|
671
705
|
const packageAddress = options.package ?? "@typus/perp";
|
|
672
|
-
const argumentsTypes = [
|
|
706
|
+
const argumentsTypes = [null, null, "u64"];
|
|
673
707
|
const parameterNames = ["version", "registry", "marketIndex"];
|
|
674
708
|
return (tx) => tx.moveCall({
|
|
675
709
|
package: packageAddress,
|
|
676
710
|
module: "trading",
|
|
677
711
|
function: "suspend_market",
|
|
678
|
-
arguments: (0,
|
|
712
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
679
713
|
});
|
|
680
714
|
}
|
|
681
715
|
/** [Authorized Function] Resumes a market. */
|
|
682
716
|
function resumeMarket(options) {
|
|
683
717
|
const packageAddress = options.package ?? "@typus/perp";
|
|
684
|
-
const argumentsTypes = [
|
|
718
|
+
const argumentsTypes = [null, null, "u64"];
|
|
685
719
|
const parameterNames = ["version", "registry", "marketIndex"];
|
|
686
720
|
return (tx) => tx.moveCall({
|
|
687
721
|
package: packageAddress,
|
|
688
722
|
module: "trading",
|
|
689
723
|
function: "resume_market",
|
|
690
|
-
arguments: (0,
|
|
724
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
691
725
|
});
|
|
692
726
|
}
|
|
693
727
|
/** [Authorized Function] Suspends a trading symbol. */
|
|
694
728
|
function suspendTradingSymbol(options) {
|
|
695
729
|
const packageAddress = options.package ?? "@typus/perp";
|
|
696
|
-
const argumentsTypes = [
|
|
730
|
+
const argumentsTypes = [null, null, "u64"];
|
|
697
731
|
const parameterNames = ["version", "registry", "marketIndex"];
|
|
698
732
|
return (tx) => tx.moveCall({
|
|
699
733
|
package: packageAddress,
|
|
700
734
|
module: "trading",
|
|
701
735
|
function: "suspend_trading_symbol",
|
|
702
|
-
arguments: (0,
|
|
736
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
703
737
|
typeArguments: options.typeArguments,
|
|
704
738
|
});
|
|
705
739
|
}
|
|
706
740
|
/** [Authorized Function] Resumes a trading symbol. */
|
|
707
741
|
function resumeTradingSymbol(options) {
|
|
708
742
|
const packageAddress = options.package ?? "@typus/perp";
|
|
709
|
-
const argumentsTypes = [
|
|
743
|
+
const argumentsTypes = [null, null, "u64"];
|
|
710
744
|
const parameterNames = ["version", "registry", "marketIndex"];
|
|
711
745
|
return (tx) => tx.moveCall({
|
|
712
746
|
package: packageAddress,
|
|
713
747
|
module: "trading",
|
|
714
748
|
function: "resume_trading_symbol",
|
|
715
|
-
arguments: (0,
|
|
749
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
716
750
|
typeArguments: options.typeArguments,
|
|
717
751
|
});
|
|
718
752
|
}
|
|
719
753
|
/** [Authorized Function] Removes a trading symbol from a market. */
|
|
720
754
|
function removeTradingSymbol(options) {
|
|
721
755
|
const packageAddress = options.package ?? "@typus/perp";
|
|
722
|
-
const argumentsTypes = [
|
|
756
|
+
const argumentsTypes = [null, null, "u64"];
|
|
723
757
|
const parameterNames = ["version", "registry", "marketIndex"];
|
|
724
758
|
return (tx) => tx.moveCall({
|
|
725
759
|
package: packageAddress,
|
|
726
760
|
module: "trading",
|
|
727
761
|
function: "remove_trading_symbol",
|
|
728
|
-
arguments: (0,
|
|
762
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
729
763
|
typeArguments: options.typeArguments,
|
|
730
764
|
});
|
|
731
765
|
}
|
|
@@ -733,16 +767,16 @@ function removeTradingSymbol(options) {
|
|
|
733
767
|
function createTradingOrder(options) {
|
|
734
768
|
const packageAddress = options.package ?? "@typus/perp";
|
|
735
769
|
const argumentsTypes = [
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
"
|
|
770
|
+
null,
|
|
771
|
+
null,
|
|
772
|
+
null,
|
|
773
|
+
null,
|
|
774
|
+
null,
|
|
775
|
+
"0x2::clock::Clock",
|
|
742
776
|
"u64",
|
|
743
777
|
"u64",
|
|
744
|
-
"
|
|
745
|
-
|
|
778
|
+
"0x1::option::Option<u64>",
|
|
779
|
+
null,
|
|
746
780
|
"bool",
|
|
747
781
|
"bool",
|
|
748
782
|
"bool",
|
|
@@ -769,27 +803,20 @@ function createTradingOrder(options) {
|
|
|
769
803
|
package: packageAddress,
|
|
770
804
|
module: "trading",
|
|
771
805
|
function: "create_trading_order",
|
|
772
|
-
arguments: (0,
|
|
806
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
773
807
|
typeArguments: options.typeArguments,
|
|
774
808
|
});
|
|
775
809
|
}
|
|
776
810
|
/** [User Function] Cancels a trading order. */
|
|
777
811
|
function cancelTradingOrder(options) {
|
|
778
812
|
const packageAddress = options.package ?? "@typus/perp";
|
|
779
|
-
const argumentsTypes = [
|
|
780
|
-
`${packageAddress}::admin::Version`,
|
|
781
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
782
|
-
"u64",
|
|
783
|
-
"u64",
|
|
784
|
-
"u64",
|
|
785
|
-
"0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<address>",
|
|
786
|
-
];
|
|
813
|
+
const argumentsTypes = [null, null, "u64", "u64", "u64", "0x1::option::Option<address>"];
|
|
787
814
|
const parameterNames = ["version", "registry", "marketIndex", "orderId", "triggerPrice", "orderUser"];
|
|
788
815
|
return (tx) => tx.moveCall({
|
|
789
816
|
package: packageAddress,
|
|
790
817
|
module: "trading",
|
|
791
818
|
function: "cancel_trading_order",
|
|
792
|
-
arguments: (0,
|
|
819
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
793
820
|
typeArguments: options.typeArguments,
|
|
794
821
|
});
|
|
795
822
|
}
|
|
@@ -799,18 +826,7 @@ function cancelTradingOrder(options) {
|
|
|
799
826
|
*/
|
|
800
827
|
function releaseCollateral(options) {
|
|
801
828
|
const packageAddress = options.package ?? "@typus/perp";
|
|
802
|
-
const argumentsTypes = [
|
|
803
|
-
`${packageAddress}::admin::Version`,
|
|
804
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
805
|
-
`${packageAddress}::lp_pool::Registry`,
|
|
806
|
-
"0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73::oracle::Oracle",
|
|
807
|
-
"0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73::oracle::Oracle",
|
|
808
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
809
|
-
"u64",
|
|
810
|
-
"u64",
|
|
811
|
-
"u64",
|
|
812
|
-
"u64",
|
|
813
|
-
];
|
|
829
|
+
const argumentsTypes = [null, null, null, null, null, "0x2::clock::Clock", "u64", "u64", "u64", "u64"];
|
|
814
830
|
const parameterNames = [
|
|
815
831
|
"version",
|
|
816
832
|
"registry",
|
|
@@ -826,7 +842,7 @@ function releaseCollateral(options) {
|
|
|
826
842
|
package: packageAddress,
|
|
827
843
|
module: "trading",
|
|
828
844
|
function: "release_collateral",
|
|
829
|
-
arguments: (0,
|
|
845
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
830
846
|
typeArguments: options.typeArguments,
|
|
831
847
|
});
|
|
832
848
|
}
|
|
@@ -836,18 +852,7 @@ function releaseCollateral(options) {
|
|
|
836
852
|
*/
|
|
837
853
|
function increaseCollateral(options) {
|
|
838
854
|
const packageAddress = options.package ?? "@typus/perp";
|
|
839
|
-
const argumentsTypes = [
|
|
840
|
-
`${packageAddress}::admin::Version`,
|
|
841
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
842
|
-
`${packageAddress}::lp_pool::Registry`,
|
|
843
|
-
"0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73::oracle::Oracle",
|
|
844
|
-
"0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73::oracle::Oracle",
|
|
845
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
846
|
-
"u64",
|
|
847
|
-
"u64",
|
|
848
|
-
"u64",
|
|
849
|
-
`0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<${options.typeArguments[0]}>`,
|
|
850
|
-
];
|
|
855
|
+
const argumentsTypes = [null, null, null, null, null, "0x2::clock::Clock", "u64", "u64", "u64", null];
|
|
851
856
|
const parameterNames = [
|
|
852
857
|
"version",
|
|
853
858
|
"registry",
|
|
@@ -863,24 +868,14 @@ function increaseCollateral(options) {
|
|
|
863
868
|
package: packageAddress,
|
|
864
869
|
module: "trading",
|
|
865
870
|
function: "increase_collateral",
|
|
866
|
-
arguments: (0,
|
|
871
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
867
872
|
typeArguments: options.typeArguments,
|
|
868
873
|
});
|
|
869
874
|
}
|
|
870
875
|
/** Collects the funding fee for a position. Safe with `check_position_user_matched` */
|
|
871
876
|
function collectPositionFundingFee(options) {
|
|
872
877
|
const packageAddress = options.package ?? "@typus/perp";
|
|
873
|
-
const argumentsTypes = [
|
|
874
|
-
`${packageAddress}::admin::Version`,
|
|
875
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
876
|
-
`${packageAddress}::lp_pool::Registry`,
|
|
877
|
-
"0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73::oracle::Oracle",
|
|
878
|
-
"0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73::oracle::Oracle",
|
|
879
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
880
|
-
"u64",
|
|
881
|
-
"u64",
|
|
882
|
-
"u64",
|
|
883
|
-
];
|
|
878
|
+
const argumentsTypes = [null, null, null, null, null, "0x2::clock::Clock", "u64", "u64", "u64"];
|
|
884
879
|
const parameterNames = [
|
|
885
880
|
"version",
|
|
886
881
|
"registry",
|
|
@@ -895,7 +890,7 @@ function collectPositionFundingFee(options) {
|
|
|
895
890
|
package: packageAddress,
|
|
896
891
|
module: "trading",
|
|
897
892
|
function: "collect_position_funding_fee",
|
|
898
|
-
arguments: (0,
|
|
893
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
899
894
|
typeArguments: options.typeArguments,
|
|
900
895
|
});
|
|
901
896
|
}
|
|
@@ -903,21 +898,21 @@ function collectPositionFundingFee(options) {
|
|
|
903
898
|
function createTradingOrderWithBidReceipt(options) {
|
|
904
899
|
const packageAddress = options.package ?? "@typus/perp";
|
|
905
900
|
const argumentsTypes = [
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
"
|
|
913
|
-
"u64",
|
|
914
|
-
"u64",
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
901
|
+
null,
|
|
902
|
+
null,
|
|
903
|
+
null,
|
|
904
|
+
null,
|
|
905
|
+
null,
|
|
906
|
+
null,
|
|
907
|
+
"0x2::clock::Clock",
|
|
908
|
+
"u64",
|
|
909
|
+
"u64",
|
|
910
|
+
null,
|
|
911
|
+
null,
|
|
912
|
+
null,
|
|
913
|
+
null,
|
|
914
|
+
null,
|
|
915
|
+
null,
|
|
921
916
|
"bool",
|
|
922
917
|
];
|
|
923
918
|
const parameterNames = [
|
|
@@ -941,7 +936,7 @@ function createTradingOrderWithBidReceipt(options) {
|
|
|
941
936
|
package: packageAddress,
|
|
942
937
|
module: "trading",
|
|
943
938
|
function: "create_trading_order_with_bid_receipt",
|
|
944
|
-
arguments: (0,
|
|
939
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
945
940
|
typeArguments: options.typeArguments,
|
|
946
941
|
});
|
|
947
942
|
}
|
|
@@ -949,22 +944,22 @@ function createTradingOrderWithBidReceipt(options) {
|
|
|
949
944
|
function reduceOptionCollateralPositionSize(options) {
|
|
950
945
|
const packageAddress = options.package ?? "@typus/perp";
|
|
951
946
|
const argumentsTypes = [
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
"
|
|
947
|
+
null,
|
|
948
|
+
null,
|
|
949
|
+
null,
|
|
950
|
+
null,
|
|
951
|
+
null,
|
|
952
|
+
null,
|
|
953
|
+
"0x2::clock::Clock",
|
|
959
954
|
"u64",
|
|
960
955
|
"u64",
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
956
|
+
null,
|
|
957
|
+
null,
|
|
958
|
+
null,
|
|
959
|
+
null,
|
|
960
|
+
null,
|
|
966
961
|
"u64",
|
|
967
|
-
"
|
|
962
|
+
"0x1::option::Option<u64>",
|
|
968
963
|
];
|
|
969
964
|
const parameterNames = [
|
|
970
965
|
"version",
|
|
@@ -987,7 +982,7 @@ function reduceOptionCollateralPositionSize(options) {
|
|
|
987
982
|
package: packageAddress,
|
|
988
983
|
module: "trading",
|
|
989
984
|
function: "reduce_option_collateral_position_size",
|
|
990
|
-
arguments: (0,
|
|
985
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
991
986
|
typeArguments: options.typeArguments,
|
|
992
987
|
});
|
|
993
988
|
}
|
|
@@ -995,20 +990,20 @@ function reduceOptionCollateralPositionSize(options) {
|
|
|
995
990
|
function matchTradingOrder(options) {
|
|
996
991
|
const packageAddress = options.package ?? "@typus/perp";
|
|
997
992
|
const argumentsTypes = [
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
"
|
|
1005
|
-
"u64",
|
|
1006
|
-
"u64",
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
993
|
+
null,
|
|
994
|
+
null,
|
|
995
|
+
null,
|
|
996
|
+
null,
|
|
997
|
+
null,
|
|
998
|
+
null,
|
|
999
|
+
"0x2::clock::Clock",
|
|
1000
|
+
"u64",
|
|
1001
|
+
"u64",
|
|
1002
|
+
null,
|
|
1003
|
+
null,
|
|
1004
|
+
null,
|
|
1005
|
+
null,
|
|
1006
|
+
null,
|
|
1012
1007
|
"u8",
|
|
1013
1008
|
"u64",
|
|
1014
1009
|
"u64",
|
|
@@ -1035,59 +1030,20 @@ function matchTradingOrder(options) {
|
|
|
1035
1030
|
package: packageAddress,
|
|
1036
1031
|
module: "trading",
|
|
1037
1032
|
function: "match_trading_order",
|
|
1038
|
-
arguments: (0,
|
|
1039
|
-
typeArguments: options.typeArguments,
|
|
1040
|
-
});
|
|
1041
|
-
}
|
|
1042
|
-
/** [Authorized Function] Cancels orders by the manager due to open interest limit. */
|
|
1043
|
-
function managerCancelOrderByOpenInterestLimit(options) {
|
|
1044
|
-
const packageAddress = options.package ?? "@typus/perp";
|
|
1045
|
-
const argumentsTypes = [
|
|
1046
|
-
`${packageAddress}::admin::Version`,
|
|
1047
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
1048
|
-
`${packageAddress}::lp_pool::Registry`,
|
|
1049
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
1050
|
-
"u64",
|
|
1051
|
-
"u64",
|
|
1052
|
-
"u8",
|
|
1053
|
-
"u64",
|
|
1054
|
-
"u64",
|
|
1055
|
-
];
|
|
1056
|
-
const parameterNames = [
|
|
1057
|
-
"version",
|
|
1058
|
-
"registry",
|
|
1059
|
-
"poolRegistry",
|
|
1060
|
-
"marketIndex",
|
|
1061
|
-
"poolIndex",
|
|
1062
|
-
"orderTypeTag",
|
|
1063
|
-
"triggerPrice",
|
|
1064
|
-
"maxOperationCount",
|
|
1065
|
-
];
|
|
1066
|
-
return (tx) => tx.moveCall({
|
|
1067
|
-
package: packageAddress,
|
|
1068
|
-
module: "trading",
|
|
1069
|
-
function: "manager_cancel_order_by_open_interest_limit",
|
|
1070
|
-
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1033
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1071
1034
|
typeArguments: options.typeArguments,
|
|
1072
1035
|
});
|
|
1073
1036
|
}
|
|
1074
1037
|
/** [Authorized Function] Cancels linked orders. */
|
|
1075
1038
|
function cancelLinkedOrders(options) {
|
|
1076
1039
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1077
|
-
const argumentsTypes = [
|
|
1078
|
-
`${packageAddress}::admin::Version`,
|
|
1079
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
1080
|
-
"u64",
|
|
1081
|
-
"vector<u64>",
|
|
1082
|
-
"vector<u64>",
|
|
1083
|
-
"address",
|
|
1084
|
-
];
|
|
1040
|
+
const argumentsTypes = [null, null, "u64", "vector<u64>", "vector<u64>", "address"];
|
|
1085
1041
|
const parameterNames = ["version", "registry", "marketIndex", "linkedOrderIds", "linkedOrderPrices", "user"];
|
|
1086
1042
|
return (tx) => tx.moveCall({
|
|
1087
1043
|
package: packageAddress,
|
|
1088
1044
|
module: "trading",
|
|
1089
1045
|
function: "cancel_linked_orders",
|
|
1090
|
-
arguments: (0,
|
|
1046
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1091
1047
|
typeArguments: options.typeArguments,
|
|
1092
1048
|
});
|
|
1093
1049
|
}
|
|
@@ -1095,20 +1051,20 @@ function cancelLinkedOrders(options) {
|
|
|
1095
1051
|
function managerReducePosition(options) {
|
|
1096
1052
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1097
1053
|
const argumentsTypes = [
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
"
|
|
1054
|
+
null,
|
|
1055
|
+
null,
|
|
1056
|
+
null,
|
|
1057
|
+
null,
|
|
1058
|
+
null,
|
|
1059
|
+
null,
|
|
1060
|
+
"0x2::clock::Clock",
|
|
1105
1061
|
"u64",
|
|
1106
1062
|
"u64",
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1063
|
+
null,
|
|
1064
|
+
null,
|
|
1065
|
+
null,
|
|
1066
|
+
null,
|
|
1067
|
+
null,
|
|
1112
1068
|
"u64",
|
|
1113
1069
|
"u64",
|
|
1114
1070
|
];
|
|
@@ -1133,26 +1089,19 @@ function managerReducePosition(options) {
|
|
|
1133
1089
|
package: packageAddress,
|
|
1134
1090
|
module: "trading",
|
|
1135
1091
|
function: "manager_reduce_position",
|
|
1136
|
-
arguments: (0,
|
|
1092
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1137
1093
|
typeArguments: options.typeArguments,
|
|
1138
1094
|
});
|
|
1139
1095
|
}
|
|
1140
1096
|
function managerClearPosition(options) {
|
|
1141
1097
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1142
|
-
const argumentsTypes = [
|
|
1143
|
-
`${packageAddress}::admin::Version`,
|
|
1144
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
1145
|
-
`${packageAddress}::lp_pool::Registry`,
|
|
1146
|
-
"u64",
|
|
1147
|
-
"u64",
|
|
1148
|
-
"u64",
|
|
1149
|
-
];
|
|
1098
|
+
const argumentsTypes = [null, null, null, "u64", "u64", "u64"];
|
|
1150
1099
|
const parameterNames = ["version", "registry", "poolRegistry", "marketIndex", "poolIndex", "positionId"];
|
|
1151
1100
|
return (tx) => tx.moveCall({
|
|
1152
1101
|
package: packageAddress,
|
|
1153
1102
|
module: "trading",
|
|
1154
1103
|
function: "manager_clear_position",
|
|
1155
|
-
arguments: (0,
|
|
1104
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1156
1105
|
typeArguments: options.typeArguments,
|
|
1157
1106
|
});
|
|
1158
1107
|
}
|
|
@@ -1160,20 +1109,20 @@ function managerClearPosition(options) {
|
|
|
1160
1109
|
function managerCloseOptionPosition(options) {
|
|
1161
1110
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1162
1111
|
const argumentsTypes = [
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
"
|
|
1112
|
+
null,
|
|
1113
|
+
null,
|
|
1114
|
+
null,
|
|
1115
|
+
null,
|
|
1116
|
+
null,
|
|
1117
|
+
null,
|
|
1118
|
+
"0x2::clock::Clock",
|
|
1170
1119
|
"u64",
|
|
1171
1120
|
"u64",
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1121
|
+
null,
|
|
1122
|
+
null,
|
|
1123
|
+
null,
|
|
1124
|
+
null,
|
|
1125
|
+
null,
|
|
1177
1126
|
"u64",
|
|
1178
1127
|
];
|
|
1179
1128
|
const parameterNames = [
|
|
@@ -1196,36 +1145,25 @@ function managerCloseOptionPosition(options) {
|
|
|
1196
1145
|
package: packageAddress,
|
|
1197
1146
|
module: "trading",
|
|
1198
1147
|
function: "manager_close_option_position",
|
|
1199
|
-
arguments: (0,
|
|
1148
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1200
1149
|
typeArguments: options.typeArguments,
|
|
1201
1150
|
});
|
|
1202
1151
|
}
|
|
1203
1152
|
function getTradingFeeConfig(options) {
|
|
1204
1153
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1205
|
-
const argumentsTypes = [
|
|
1154
|
+
const argumentsTypes = [null, "bool"];
|
|
1206
1155
|
const parameterNames = ["marketConfig", "isOptionPosition"];
|
|
1207
1156
|
return (tx) => tx.moveCall({
|
|
1208
1157
|
package: packageAddress,
|
|
1209
1158
|
module: "trading",
|
|
1210
1159
|
function: "get_trading_fee_config",
|
|
1211
|
-
arguments: (0,
|
|
1160
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1212
1161
|
});
|
|
1213
1162
|
}
|
|
1214
1163
|
/** [View Function] Gets the liquidation information for a position. */
|
|
1215
1164
|
function getLiquidationInfo(options) {
|
|
1216
1165
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1217
|
-
const argumentsTypes = [
|
|
1218
|
-
`${packageAddress}::admin::Version`,
|
|
1219
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
1220
|
-
`${packageAddress}::lp_pool::Registry`,
|
|
1221
|
-
"0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f::typus_dov_single::Registry",
|
|
1222
|
-
"0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73::oracle::Oracle",
|
|
1223
|
-
"0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73::oracle::Oracle",
|
|
1224
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
1225
|
-
"u64",
|
|
1226
|
-
"u64",
|
|
1227
|
-
"bool",
|
|
1228
|
-
];
|
|
1166
|
+
const argumentsTypes = [null, null, null, null, null, null, "0x2::clock::Clock", "u64", "u64", "bool"];
|
|
1229
1167
|
const parameterNames = [
|
|
1230
1168
|
"version",
|
|
1231
1169
|
"registry",
|
|
@@ -1241,25 +1179,14 @@ function getLiquidationInfo(options) {
|
|
|
1241
1179
|
package: packageAddress,
|
|
1242
1180
|
module: "trading",
|
|
1243
1181
|
function: "get_liquidation_info",
|
|
1244
|
-
arguments: (0,
|
|
1182
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1245
1183
|
typeArguments: options.typeArguments,
|
|
1246
1184
|
});
|
|
1247
1185
|
}
|
|
1248
1186
|
/** [Authorized Function] Liquidates a position. */
|
|
1249
1187
|
function liquidate(options) {
|
|
1250
1188
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1251
|
-
const argumentsTypes = [
|
|
1252
|
-
`${packageAddress}::admin::Version`,
|
|
1253
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
1254
|
-
`${packageAddress}::lp_pool::Registry`,
|
|
1255
|
-
"0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f::typus_dov_single::Registry",
|
|
1256
|
-
"0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73::oracle::Oracle",
|
|
1257
|
-
"0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73::oracle::Oracle",
|
|
1258
|
-
"u64",
|
|
1259
|
-
"u64",
|
|
1260
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
1261
|
-
"u64",
|
|
1262
|
-
];
|
|
1189
|
+
const argumentsTypes = [null, null, null, null, null, null, "u64", "u64", "0x2::clock::Clock", "u64"];
|
|
1263
1190
|
const parameterNames = [
|
|
1264
1191
|
"version",
|
|
1265
1192
|
"registry",
|
|
@@ -1275,209 +1202,79 @@ function liquidate(options) {
|
|
|
1275
1202
|
package: packageAddress,
|
|
1276
1203
|
module: "trading",
|
|
1277
1204
|
function: "liquidate",
|
|
1278
|
-
arguments: (0,
|
|
1205
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1279
1206
|
typeArguments: options.typeArguments,
|
|
1280
1207
|
});
|
|
1281
1208
|
}
|
|
1282
1209
|
/** [Authorized Function] Settles receipt collateral. */
|
|
1283
1210
|
function settleReceiptCollateral(options) {
|
|
1284
1211
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1285
|
-
const argumentsTypes = [
|
|
1286
|
-
`${packageAddress}::admin::Version`,
|
|
1287
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
1288
|
-
`${packageAddress}::lp_pool::Registry`,
|
|
1289
|
-
"0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f::typus_dov_single::Registry",
|
|
1290
|
-
"0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73::oracle::Oracle",
|
|
1291
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
1292
|
-
"u64",
|
|
1293
|
-
"u64",
|
|
1294
|
-
];
|
|
1212
|
+
const argumentsTypes = [null, null, null, null, null, "0x2::clock::Clock", "u64", "u64"];
|
|
1295
1213
|
const parameterNames = ["version", "registry", "poolRegistry", "dovRegistry", "typusOracleCToken", "marketIndex", "poolIndex"];
|
|
1296
1214
|
return (tx) => tx.moveCall({
|
|
1297
1215
|
package: packageAddress,
|
|
1298
1216
|
module: "trading",
|
|
1299
1217
|
function: "settle_receipt_collateral",
|
|
1300
|
-
arguments: (0,
|
|
1218
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1301
1219
|
typeArguments: options.typeArguments,
|
|
1302
1220
|
});
|
|
1303
1221
|
}
|
|
1304
1222
|
/** [Authorized Function] Updates the funding rate. */
|
|
1305
1223
|
function updateFundingRate(options) {
|
|
1306
1224
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1307
|
-
const argumentsTypes = [
|
|
1308
|
-
`${packageAddress}::admin::Version`,
|
|
1309
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
1310
|
-
`${packageAddress}::lp_pool::Registry`,
|
|
1311
|
-
"0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73::oracle::Oracle",
|
|
1312
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
1313
|
-
"u64",
|
|
1314
|
-
"u64",
|
|
1315
|
-
];
|
|
1225
|
+
const argumentsTypes = [null, null, null, null, "0x2::clock::Clock", "u64", "u64"];
|
|
1316
1226
|
const parameterNames = ["version", "registry", "poolRegistry", "typusOracleTradingSymbol", "marketIndex", "poolIndex"];
|
|
1317
1227
|
return (tx) => tx.moveCall({
|
|
1318
1228
|
package: packageAddress,
|
|
1319
1229
|
module: "trading",
|
|
1320
1230
|
function: "update_funding_rate",
|
|
1321
|
-
arguments: (0,
|
|
1231
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1322
1232
|
typeArguments: options.typeArguments,
|
|
1323
1233
|
});
|
|
1324
1234
|
}
|
|
1325
1235
|
function getExpiredPositionInfo(options) {
|
|
1326
1236
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1327
|
-
const argumentsTypes = [
|
|
1328
|
-
`${packageAddress}::admin::Version`,
|
|
1329
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
1330
|
-
`${packageAddress}::lp_pool::Registry`,
|
|
1331
|
-
"0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f::typus_dov_single::Registry",
|
|
1332
|
-
"u64",
|
|
1333
|
-
"u64",
|
|
1334
|
-
];
|
|
1237
|
+
const argumentsTypes = [null, null, null, null, "u64", "u64"];
|
|
1335
1238
|
const parameterNames = ["version", "registry", "poolRegistry", "dovRegistry", "marketIndex", "poolIndex"];
|
|
1336
1239
|
return (tx) => tx.moveCall({
|
|
1337
1240
|
package: packageAddress,
|
|
1338
1241
|
module: "trading",
|
|
1339
1242
|
function: "get_expired_position_info",
|
|
1340
|
-
arguments: (0,
|
|
1243
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1341
1244
|
});
|
|
1342
1245
|
}
|
|
1343
|
-
|
|
1344
|
-
* [Authorized Function] Initializes the user account table. TODO: can be removed,
|
|
1345
|
-
* only use once.
|
|
1346
|
-
*/
|
|
1347
|
-
function initUserAccountTable(options) {
|
|
1246
|
+
function prepareOrderExecution(options) {
|
|
1348
1247
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1349
|
-
const argumentsTypes = [
|
|
1350
|
-
const parameterNames = ["
|
|
1248
|
+
const argumentsTypes = [null, null, null];
|
|
1249
|
+
const parameterNames = ["symbolMarket", "liquidityPool", "order"];
|
|
1351
1250
|
return (tx) => tx.moveCall({
|
|
1352
1251
|
package: packageAddress,
|
|
1353
1252
|
module: "trading",
|
|
1354
|
-
function: "
|
|
1355
|
-
arguments: (0,
|
|
1356
|
-
});
|
|
1357
|
-
}
|
|
1358
|
-
/** [User Function] Creates a new user account. */
|
|
1359
|
-
function createUserAccount(options) {
|
|
1360
|
-
const packageAddress = options.package ?? "@typus/perp";
|
|
1361
|
-
const argumentsTypes = [`${packageAddress}::admin::Version`, `${packageAddress}::trading::MarketRegistry`, "u64"];
|
|
1362
|
-
const parameterNames = ["version", "registry", "marketIndex"];
|
|
1363
|
-
return (tx) => tx.moveCall({
|
|
1364
|
-
package: packageAddress,
|
|
1365
|
-
module: "trading",
|
|
1366
|
-
function: "create_user_account",
|
|
1367
|
-
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1368
|
-
});
|
|
1369
|
-
}
|
|
1370
|
-
/** [User Function] Adds a delegate user to a user account. Safe with `check_owner` */
|
|
1371
|
-
function addDelegateUser(options) {
|
|
1372
|
-
const packageAddress = options.package ?? "@typus/perp";
|
|
1373
|
-
const argumentsTypes = [
|
|
1374
|
-
`${packageAddress}::admin::Version`,
|
|
1375
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
1376
|
-
"u64",
|
|
1377
|
-
"address",
|
|
1378
|
-
];
|
|
1379
|
-
const parameterNames = ["version", "registry", "marketIndex", "user"];
|
|
1380
|
-
return (tx) => tx.moveCall({
|
|
1381
|
-
package: packageAddress,
|
|
1382
|
-
module: "trading",
|
|
1383
|
-
function: "add_delegate_user",
|
|
1384
|
-
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1385
|
-
});
|
|
1386
|
-
}
|
|
1387
|
-
/**
|
|
1388
|
-
* [User Function] Remove a delegate user to a user account. Safe with
|
|
1389
|
-
* `check_owner`
|
|
1390
|
-
*/
|
|
1391
|
-
function removeDelegateUser(options) {
|
|
1392
|
-
const packageAddress = options.package ?? "@typus/perp";
|
|
1393
|
-
const argumentsTypes = [
|
|
1394
|
-
`${packageAddress}::admin::Version`,
|
|
1395
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
1396
|
-
"u64",
|
|
1397
|
-
"address",
|
|
1398
|
-
];
|
|
1399
|
-
const parameterNames = ["version", "registry", "marketIndex", "user"];
|
|
1400
|
-
return (tx) => tx.moveCall({
|
|
1401
|
-
package: packageAddress,
|
|
1402
|
-
module: "trading",
|
|
1403
|
-
function: "remove_delegate_user",
|
|
1404
|
-
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1405
|
-
});
|
|
1406
|
-
}
|
|
1407
|
-
/** [User Function] Removes a user account. Safe with `UserAccountCap` */
|
|
1408
|
-
function removeUserAccount(options) {
|
|
1409
|
-
const packageAddress = options.package ?? "@typus/perp";
|
|
1410
|
-
const argumentsTypes = [
|
|
1411
|
-
`${packageAddress}::admin::Version`,
|
|
1412
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
1413
|
-
"u64",
|
|
1414
|
-
`${packageAddress}::user_account::UserAccountCap`,
|
|
1415
|
-
];
|
|
1416
|
-
const parameterNames = ["version", "registry", "marketIndex", "userAccountCap"];
|
|
1417
|
-
return (tx) => tx.moveCall({
|
|
1418
|
-
package: packageAddress,
|
|
1419
|
-
module: "trading",
|
|
1420
|
-
function: "remove_user_account",
|
|
1421
|
-
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1422
|
-
});
|
|
1423
|
-
}
|
|
1424
|
-
/** Deposits collateral into a user account. Safe with `check_owner` */
|
|
1425
|
-
function depositUserAccount(options) {
|
|
1426
|
-
const packageAddress = options.package ?? "@typus/perp";
|
|
1427
|
-
const argumentsTypes = [
|
|
1428
|
-
`${packageAddress}::admin::Version`,
|
|
1429
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
1430
|
-
"u64",
|
|
1431
|
-
`0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<${options.typeArguments[0]}>`,
|
|
1432
|
-
];
|
|
1433
|
-
const parameterNames = ["version", "registry", "marketIndex", "collateral"];
|
|
1434
|
-
return (tx) => tx.moveCall({
|
|
1435
|
-
package: packageAddress,
|
|
1436
|
-
module: "trading",
|
|
1437
|
-
function: "deposit_user_account",
|
|
1438
|
-
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1439
|
-
typeArguments: options.typeArguments,
|
|
1440
|
-
});
|
|
1441
|
-
}
|
|
1442
|
-
/** Withdraws collateral from a user account. Safe with `UserAccountCap` */
|
|
1443
|
-
function withdrawUserAccount(options) {
|
|
1444
|
-
const packageAddress = options.package ?? "@typus/perp";
|
|
1445
|
-
const argumentsTypes = [
|
|
1446
|
-
`${packageAddress}::admin::Version`,
|
|
1447
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
1448
|
-
"u64",
|
|
1449
|
-
"0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>",
|
|
1450
|
-
`${packageAddress}::user_account::UserAccountCap`,
|
|
1451
|
-
];
|
|
1452
|
-
const parameterNames = ["version", "registry", "marketIndex", "amount", "userAccountCap"];
|
|
1453
|
-
return (tx) => tx.moveCall({
|
|
1454
|
-
package: packageAddress,
|
|
1455
|
-
module: "trading",
|
|
1456
|
-
function: "withdraw_user_account",
|
|
1457
|
-
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1253
|
+
function: "prepare_order_execution",
|
|
1254
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1458
1255
|
typeArguments: options.typeArguments,
|
|
1459
1256
|
});
|
|
1460
1257
|
}
|
|
1461
1258
|
function executeOrder_(options) {
|
|
1462
1259
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1463
1260
|
const argumentsTypes = [
|
|
1464
|
-
|
|
1261
|
+
null,
|
|
1465
1262
|
"u64",
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1263
|
+
null,
|
|
1264
|
+
null,
|
|
1265
|
+
null,
|
|
1266
|
+
null,
|
|
1470
1267
|
"u64",
|
|
1471
1268
|
"u64",
|
|
1472
1269
|
"u64",
|
|
1473
1270
|
"u64",
|
|
1474
1271
|
"u64",
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
"
|
|
1272
|
+
null,
|
|
1273
|
+
null,
|
|
1274
|
+
null,
|
|
1275
|
+
null,
|
|
1276
|
+
null,
|
|
1277
|
+
"0x2::clock::Clock",
|
|
1481
1278
|
];
|
|
1482
1279
|
const parameterNames = [
|
|
1483
1280
|
"version",
|
|
@@ -1501,32 +1298,32 @@ function executeOrder_(options) {
|
|
|
1501
1298
|
package: packageAddress,
|
|
1502
1299
|
module: "trading",
|
|
1503
1300
|
function: "execute_order_",
|
|
1504
|
-
arguments: (0,
|
|
1301
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1505
1302
|
typeArguments: options.typeArguments,
|
|
1506
1303
|
});
|
|
1507
1304
|
}
|
|
1508
1305
|
function executeOptionCollateralOrder_(options) {
|
|
1509
1306
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1510
1307
|
const argumentsTypes = [
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1308
|
+
null,
|
|
1309
|
+
null,
|
|
1310
|
+
null,
|
|
1311
|
+
null,
|
|
1312
|
+
null,
|
|
1313
|
+
null,
|
|
1314
|
+
null,
|
|
1518
1315
|
"u64",
|
|
1519
1316
|
"u64",
|
|
1520
1317
|
"u64",
|
|
1521
1318
|
"u64",
|
|
1522
1319
|
"u64",
|
|
1523
1320
|
"u64",
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
"
|
|
1321
|
+
null,
|
|
1322
|
+
null,
|
|
1323
|
+
null,
|
|
1324
|
+
null,
|
|
1325
|
+
null,
|
|
1326
|
+
"0x2::clock::Clock",
|
|
1530
1327
|
];
|
|
1531
1328
|
const parameterNames = [
|
|
1532
1329
|
"version",
|
|
@@ -1552,106 +1349,92 @@ function executeOptionCollateralOrder_(options) {
|
|
|
1552
1349
|
package: packageAddress,
|
|
1553
1350
|
module: "trading",
|
|
1554
1351
|
function: "execute_option_collateral_order_",
|
|
1555
|
-
arguments: (0,
|
|
1352
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1556
1353
|
typeArguments: options.typeArguments,
|
|
1557
1354
|
});
|
|
1558
1355
|
}
|
|
1559
1356
|
function removeLinkedOrders(options) {
|
|
1560
1357
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1561
|
-
const argumentsTypes = [
|
|
1562
|
-
`${packageAddress}::admin::Version`,
|
|
1563
|
-
"u64",
|
|
1564
|
-
`${packageAddress}::trading::SymbolMarket`,
|
|
1565
|
-
"vector<u64>",
|
|
1566
|
-
"vector<u64>",
|
|
1567
|
-
"address",
|
|
1568
|
-
];
|
|
1358
|
+
const argumentsTypes = [null, "u64", null, "vector<u64>", "vector<u64>", "address"];
|
|
1569
1359
|
const parameterNames = ["version", "marketIndex", "symbolMarket", "linkedOrderIds", "linkedOrderPrices", "user"];
|
|
1570
1360
|
return (tx) => tx.moveCall({
|
|
1571
1361
|
package: packageAddress,
|
|
1572
1362
|
module: "trading",
|
|
1573
1363
|
function: "remove_linked_orders",
|
|
1574
|
-
arguments: (0,
|
|
1364
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1575
1365
|
typeArguments: options.typeArguments,
|
|
1576
1366
|
});
|
|
1577
1367
|
}
|
|
1578
1368
|
function removeLinkedOrder_(options) {
|
|
1579
1369
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1580
|
-
const argumentsTypes = [
|
|
1581
|
-
`${packageAddress}::admin::Version`,
|
|
1582
|
-
"u64",
|
|
1583
|
-
`${packageAddress}::trading::SymbolMarket`,
|
|
1584
|
-
`${packageAddress}::position::TradingOrder`,
|
|
1585
|
-
"address",
|
|
1586
|
-
];
|
|
1370
|
+
const argumentsTypes = [null, "u64", null, null, "address"];
|
|
1587
1371
|
const parameterNames = ["version", "marketIndex", "symbolMarket", "order", "user"];
|
|
1588
1372
|
return (tx) => tx.moveCall({
|
|
1589
1373
|
package: packageAddress,
|
|
1590
1374
|
module: "trading",
|
|
1591
1375
|
function: "remove_linked_order_",
|
|
1592
|
-
arguments: (0,
|
|
1376
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1593
1377
|
typeArguments: options.typeArguments,
|
|
1594
1378
|
});
|
|
1595
1379
|
}
|
|
1596
1380
|
function getMutOrders(options) {
|
|
1597
1381
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1598
|
-
const argumentsTypes = [
|
|
1382
|
+
const argumentsTypes = [null, "bool", "u8"];
|
|
1599
1383
|
const parameterNames = ["symbolMarket", "isTokenCollateral", "orderTypeTag"];
|
|
1600
1384
|
return (tx) => tx.moveCall({
|
|
1601
1385
|
package: packageAddress,
|
|
1602
1386
|
module: "trading",
|
|
1603
1387
|
function: "get_mut_orders",
|
|
1604
|
-
arguments: (0,
|
|
1388
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1605
1389
|
});
|
|
1606
1390
|
}
|
|
1607
1391
|
function getOrders(options) {
|
|
1608
1392
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1609
|
-
const argumentsTypes = [
|
|
1393
|
+
const argumentsTypes = [null, "bool", "u8"];
|
|
1610
1394
|
const parameterNames = ["symbolMarket", "isTokenCollateral", "orderTypeTag"];
|
|
1611
1395
|
return (tx) => tx.moveCall({
|
|
1612
1396
|
package: packageAddress,
|
|
1613
1397
|
module: "trading",
|
|
1614
1398
|
function: "get_orders",
|
|
1615
|
-
arguments: (0,
|
|
1399
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
function getOrderKey(options) {
|
|
1403
|
+
const packageAddress = options.package ?? "@typus/perp";
|
|
1404
|
+
const argumentsTypes = ["u8"];
|
|
1405
|
+
const parameterNames = ["orderTypeTag"];
|
|
1406
|
+
return (tx) => tx.moveCall({
|
|
1407
|
+
package: packageAddress,
|
|
1408
|
+
module: "trading",
|
|
1409
|
+
function: "get_order_key",
|
|
1410
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1616
1411
|
});
|
|
1617
1412
|
}
|
|
1618
1413
|
function takeOrderByOrderIdAndPrice(options) {
|
|
1619
1414
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1620
|
-
const argumentsTypes = [
|
|
1415
|
+
const argumentsTypes = [null, "u64", "u64", "bool", "address"];
|
|
1621
1416
|
const parameterNames = ["symbolMarket", "triggerPrice", "orderId", "isTokenCollateral", "user"];
|
|
1622
1417
|
return (tx) => tx.moveCall({
|
|
1623
1418
|
package: packageAddress,
|
|
1624
1419
|
module: "trading",
|
|
1625
1420
|
function: "take_order_by_order_id_and_price",
|
|
1626
|
-
arguments: (0,
|
|
1421
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1627
1422
|
});
|
|
1628
1423
|
}
|
|
1629
1424
|
function getLinkedPosition(options) {
|
|
1630
1425
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1631
|
-
const argumentsTypes = [
|
|
1632
|
-
`${packageAddress}::trading::SymbolMarket`,
|
|
1633
|
-
"0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u64>",
|
|
1634
|
-
"address",
|
|
1635
|
-
];
|
|
1426
|
+
const argumentsTypes = [null, "0x1::option::Option<u64>", "address"];
|
|
1636
1427
|
const parameterNames = ["symbolMarket", "linkedPositionId", "user"];
|
|
1637
1428
|
return (tx) => tx.moveCall({
|
|
1638
1429
|
package: packageAddress,
|
|
1639
1430
|
module: "trading",
|
|
1640
1431
|
function: "get_linked_position",
|
|
1641
|
-
arguments: (0,
|
|
1432
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1642
1433
|
});
|
|
1643
1434
|
}
|
|
1644
1435
|
function checkCollateralEnoughWhenAddingPosition(options) {
|
|
1645
1436
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1646
|
-
const argumentsTypes = [
|
|
1647
|
-
`${packageAddress}::trading::SymbolMarket`,
|
|
1648
|
-
`${packageAddress}::position::TradingOrder`,
|
|
1649
|
-
"u64",
|
|
1650
|
-
"u64",
|
|
1651
|
-
"u64",
|
|
1652
|
-
"u64",
|
|
1653
|
-
"u64",
|
|
1654
|
-
];
|
|
1437
|
+
const argumentsTypes = [null, null, "u64", "u64", "u64", "u64", "u64"];
|
|
1655
1438
|
const parameterNames = [
|
|
1656
1439
|
"symbolMarket",
|
|
1657
1440
|
"order",
|
|
@@ -1665,21 +1448,13 @@ function checkCollateralEnoughWhenAddingPosition(options) {
|
|
|
1665
1448
|
package: packageAddress,
|
|
1666
1449
|
module: "trading",
|
|
1667
1450
|
function: "check_collateral_enough_when_adding_position",
|
|
1668
|
-
arguments: (0,
|
|
1451
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1669
1452
|
typeArguments: options.typeArguments,
|
|
1670
1453
|
});
|
|
1671
1454
|
}
|
|
1672
1455
|
function checkCollateralEnoughWhenReducingPosition(options) {
|
|
1673
1456
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1674
|
-
const argumentsTypes = [
|
|
1675
|
-
`${packageAddress}::trading::SymbolMarket`,
|
|
1676
|
-
`${packageAddress}::position::TradingOrder`,
|
|
1677
|
-
"u64",
|
|
1678
|
-
"u64",
|
|
1679
|
-
"u64",
|
|
1680
|
-
"u64",
|
|
1681
|
-
"u64",
|
|
1682
|
-
];
|
|
1457
|
+
const argumentsTypes = [null, null, "u64", "u64", "u64", "u64", "u64"];
|
|
1683
1458
|
const parameterNames = [
|
|
1684
1459
|
"symbolMarket",
|
|
1685
1460
|
"order",
|
|
@@ -1693,25 +1468,13 @@ function checkCollateralEnoughWhenReducingPosition(options) {
|
|
|
1693
1468
|
package: packageAddress,
|
|
1694
1469
|
module: "trading",
|
|
1695
1470
|
function: "check_collateral_enough_when_reducing_position",
|
|
1696
|
-
arguments: (0,
|
|
1471
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1697
1472
|
typeArguments: options.typeArguments,
|
|
1698
1473
|
});
|
|
1699
1474
|
}
|
|
1700
1475
|
function checkOptionCollateralEnough(options) {
|
|
1701
1476
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1702
|
-
const argumentsTypes = [
|
|
1703
|
-
"0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f::typus_dov_single::Registry",
|
|
1704
|
-
"0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73::oracle::Oracle",
|
|
1705
|
-
"0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73::oracle::Oracle",
|
|
1706
|
-
`${packageAddress}::trading::SymbolMarket`,
|
|
1707
|
-
`${packageAddress}::position::TradingOrder`,
|
|
1708
|
-
"u64",
|
|
1709
|
-
"u64",
|
|
1710
|
-
"u64",
|
|
1711
|
-
"u64",
|
|
1712
|
-
"u64",
|
|
1713
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
1714
|
-
];
|
|
1477
|
+
const argumentsTypes = [null, null, null, null, null, "u64", "u64", "u64", "u64", "u64", "0x2::clock::Clock"];
|
|
1715
1478
|
const parameterNames = [
|
|
1716
1479
|
"dovRegistry",
|
|
1717
1480
|
"typusOracleTradingSymbol",
|
|
@@ -1728,21 +1491,13 @@ function checkOptionCollateralEnough(options) {
|
|
|
1728
1491
|
package: packageAddress,
|
|
1729
1492
|
module: "trading",
|
|
1730
1493
|
function: "check_option_collateral_enough",
|
|
1731
|
-
arguments: (0,
|
|
1494
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1732
1495
|
typeArguments: options.typeArguments,
|
|
1733
1496
|
});
|
|
1734
1497
|
}
|
|
1735
1498
|
function checkReserveEnough(options) {
|
|
1736
1499
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1737
|
-
const argumentsTypes = [
|
|
1738
|
-
`${packageAddress}::trading::SymbolMarket`,
|
|
1739
|
-
`${packageAddress}::lp_pool::LiquidityPool`,
|
|
1740
|
-
`${packageAddress}::position::TradingOrder`,
|
|
1741
|
-
"u64",
|
|
1742
|
-
"u64",
|
|
1743
|
-
"u64",
|
|
1744
|
-
"u64",
|
|
1745
|
-
];
|
|
1500
|
+
const argumentsTypes = [null, null, null, "u64", "u64", "u64", "u64"];
|
|
1746
1501
|
const parameterNames = [
|
|
1747
1502
|
"symbolMarket",
|
|
1748
1503
|
"liquidityPool",
|
|
@@ -1756,106 +1511,143 @@ function checkReserveEnough(options) {
|
|
|
1756
1511
|
package: packageAddress,
|
|
1757
1512
|
module: "trading",
|
|
1758
1513
|
function: "check_reserve_enough",
|
|
1759
|
-
arguments: (0,
|
|
1514
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1760
1515
|
typeArguments: options.typeArguments,
|
|
1761
1516
|
});
|
|
1762
1517
|
}
|
|
1518
|
+
function getMaxReleasingCollateralAmount_(options) {
|
|
1519
|
+
const packageAddress = options.package ?? "@typus/perp";
|
|
1520
|
+
const argumentsTypes = [null, null, null, null, null, "u64", "u64", "u64", "u64", "u64"];
|
|
1521
|
+
const parameterNames = [
|
|
1522
|
+
"liquidityPool",
|
|
1523
|
+
"position",
|
|
1524
|
+
"marketInfo",
|
|
1525
|
+
"marketConfig",
|
|
1526
|
+
"collateralToken",
|
|
1527
|
+
"collateralOraclePrice",
|
|
1528
|
+
"collateralOraclePriceDecimal",
|
|
1529
|
+
"tradingPairOraclePrice",
|
|
1530
|
+
"tradingPairOraclePriceDecimal",
|
|
1531
|
+
"cumulativeBorrowRate",
|
|
1532
|
+
];
|
|
1533
|
+
return (tx) => tx.moveCall({
|
|
1534
|
+
package: packageAddress,
|
|
1535
|
+
module: "trading",
|
|
1536
|
+
function: "get_max_releasing_collateral_amount_",
|
|
1537
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1538
|
+
});
|
|
1539
|
+
}
|
|
1540
|
+
function normalSafetyCheck(options) {
|
|
1541
|
+
const packageAddress = options.package ?? "@typus/perp";
|
|
1542
|
+
const argumentsTypes = [null, null, null, null, null, "u64", "u64", "0x1::option::Option<u64>"];
|
|
1543
|
+
const parameterNames = [
|
|
1544
|
+
"version",
|
|
1545
|
+
"registry",
|
|
1546
|
+
"poolRegistry",
|
|
1547
|
+
"typusOracleCToken",
|
|
1548
|
+
"typusOracleTradingSymbol",
|
|
1549
|
+
"marketIndex",
|
|
1550
|
+
"poolIndex",
|
|
1551
|
+
"positionId",
|
|
1552
|
+
];
|
|
1553
|
+
return (tx) => tx.moveCall({
|
|
1554
|
+
package: packageAddress,
|
|
1555
|
+
module: "trading",
|
|
1556
|
+
function: "normal_safety_check",
|
|
1557
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1558
|
+
typeArguments: options.typeArguments,
|
|
1559
|
+
});
|
|
1560
|
+
}
|
|
1561
|
+
function validateTradingFeeConfig(options) {
|
|
1562
|
+
const packageAddress = options.package ?? "@typus/perp";
|
|
1563
|
+
const argumentsTypes = ["vector<u64>"];
|
|
1564
|
+
const parameterNames = ["config"];
|
|
1565
|
+
return (tx) => tx.moveCall({
|
|
1566
|
+
package: packageAddress,
|
|
1567
|
+
module: "trading",
|
|
1568
|
+
function: "validate_trading_fee_config",
|
|
1569
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1570
|
+
});
|
|
1571
|
+
}
|
|
1763
1572
|
function adjustMarketInfoUserOrderSize(options) {
|
|
1764
1573
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1765
|
-
const argumentsTypes = [
|
|
1574
|
+
const argumentsTypes = [null, "bool", "bool", "u64"];
|
|
1766
1575
|
const parameterNames = ["symbolMarket", "long", "filledOrCancelled", "size"];
|
|
1767
1576
|
return (tx) => tx.moveCall({
|
|
1768
1577
|
package: packageAddress,
|
|
1769
1578
|
module: "trading",
|
|
1770
1579
|
function: "adjust_market_info_user_order_size",
|
|
1771
|
-
arguments: (0,
|
|
1580
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1772
1581
|
});
|
|
1773
1582
|
}
|
|
1774
1583
|
function adjustMarketInfoUserPositionSize(options) {
|
|
1775
1584
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1776
|
-
const argumentsTypes = [
|
|
1585
|
+
const argumentsTypes = [null, "bool", "bool", "u64"];
|
|
1777
1586
|
const parameterNames = ["symbolMarket", "filledOrderIsLong", "reducingPosition", "size"];
|
|
1778
1587
|
return (tx) => tx.moveCall({
|
|
1779
1588
|
package: packageAddress,
|
|
1780
1589
|
module: "trading",
|
|
1781
1590
|
function: "adjust_market_info_user_position_size",
|
|
1782
|
-
arguments: (0,
|
|
1591
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1783
1592
|
});
|
|
1784
1593
|
}
|
|
1785
1594
|
function exerciseBidReceipts(options) {
|
|
1786
1595
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1787
|
-
const argumentsTypes = [
|
|
1788
|
-
"0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f::typus_dov_single::Registry",
|
|
1789
|
-
"vector<0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded::vault::TypusBidReceipt>",
|
|
1790
|
-
];
|
|
1596
|
+
const argumentsTypes = [null, "vector<null>"];
|
|
1791
1597
|
const parameterNames = ["dovRegistry", "bidReceipts"];
|
|
1792
1598
|
return (tx) => tx.moveCall({
|
|
1793
1599
|
package: packageAddress,
|
|
1794
1600
|
module: "trading",
|
|
1795
1601
|
function: "exercise_bid_receipts",
|
|
1796
|
-
arguments: (0,
|
|
1602
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1797
1603
|
typeArguments: options.typeArguments,
|
|
1798
1604
|
});
|
|
1799
1605
|
}
|
|
1800
1606
|
function returnToUser(options) {
|
|
1801
1607
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1802
|
-
const argumentsTypes = [
|
|
1803
|
-
|
|
1804
|
-
`0x0000000000000000000000000000000000000000000000000000000000000002::balance::Balance<${options.typeArguments[0]}>`,
|
|
1805
|
-
"address",
|
|
1806
|
-
];
|
|
1807
|
-
const parameterNames = ["marketId", "balance", "user"];
|
|
1608
|
+
const argumentsTypes = [null, "address"];
|
|
1609
|
+
const parameterNames = ["balance", "user"];
|
|
1808
1610
|
return (tx) => tx.moveCall({
|
|
1809
1611
|
package: packageAddress,
|
|
1810
1612
|
module: "trading",
|
|
1811
1613
|
function: "return_to_user",
|
|
1812
|
-
arguments: (0,
|
|
1614
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1813
1615
|
typeArguments: options.typeArguments,
|
|
1814
1616
|
});
|
|
1815
1617
|
}
|
|
1816
1618
|
function checkPositionUserMatched(options) {
|
|
1817
1619
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1818
|
-
const argumentsTypes = [
|
|
1620
|
+
const argumentsTypes = [null, "address"];
|
|
1819
1621
|
const parameterNames = ["position", "user"];
|
|
1820
1622
|
return (tx) => tx.moveCall({
|
|
1821
1623
|
package: packageAddress,
|
|
1822
1624
|
module: "trading",
|
|
1823
1625
|
function: "check_position_user_matched",
|
|
1824
|
-
arguments: (0,
|
|
1626
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1825
1627
|
});
|
|
1826
1628
|
}
|
|
1827
1629
|
/** [View Function] Gets the user's orders. */
|
|
1828
1630
|
function getUserOrders(options) {
|
|
1829
1631
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1830
|
-
const argumentsTypes = [
|
|
1831
|
-
`${packageAddress}::admin::Version`,
|
|
1832
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
1833
|
-
"u64",
|
|
1834
|
-
"address",
|
|
1835
|
-
];
|
|
1632
|
+
const argumentsTypes = [null, null, "u64", "address"];
|
|
1836
1633
|
const parameterNames = ["version", "registry", "marketIndex", "user"];
|
|
1837
1634
|
return (tx) => tx.moveCall({
|
|
1838
1635
|
package: packageAddress,
|
|
1839
1636
|
module: "trading",
|
|
1840
1637
|
function: "get_user_orders",
|
|
1841
|
-
arguments: (0,
|
|
1638
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1842
1639
|
});
|
|
1843
1640
|
}
|
|
1844
1641
|
/** [View Function] Gets the user's positions. */
|
|
1845
1642
|
function getUserPositions(options) {
|
|
1846
1643
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1847
|
-
const argumentsTypes = [
|
|
1848
|
-
`${packageAddress}::admin::Version`,
|
|
1849
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
1850
|
-
"u64",
|
|
1851
|
-
"address",
|
|
1852
|
-
];
|
|
1644
|
+
const argumentsTypes = [null, null, "u64", "address"];
|
|
1853
1645
|
const parameterNames = ["version", "registry", "marketIndex", "user"];
|
|
1854
1646
|
return (tx) => tx.moveCall({
|
|
1855
1647
|
package: packageAddress,
|
|
1856
1648
|
module: "trading",
|
|
1857
1649
|
function: "get_user_positions",
|
|
1858
|
-
arguments: (0,
|
|
1650
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1859
1651
|
});
|
|
1860
1652
|
}
|
|
1861
1653
|
/** [View Function] Gets all positions. */
|
|
@@ -1873,43 +1665,20 @@ function getAllPositions(options) {
|
|
|
1873
1665
|
package: packageAddress,
|
|
1874
1666
|
module: "trading",
|
|
1875
1667
|
function: "get_all_positions",
|
|
1876
|
-
arguments: (0,
|
|
1668
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1877
1669
|
typeArguments: options.typeArguments,
|
|
1878
1670
|
});
|
|
1879
1671
|
}
|
|
1880
1672
|
/** [View Function] Gets active orders by order type tag. */
|
|
1881
1673
|
function getActiveOrdersByOrderTag(options) {
|
|
1882
1674
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1883
|
-
const argumentsTypes = [
|
|
1884
|
-
`${packageAddress}::admin::Version`,
|
|
1885
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
1886
|
-
"u64",
|
|
1887
|
-
"u8",
|
|
1888
|
-
];
|
|
1675
|
+
const argumentsTypes = [null, null, "u64", "u8"];
|
|
1889
1676
|
const parameterNames = ["version", "registry", "marketIndex", "orderTypeTag"];
|
|
1890
1677
|
return (tx) => tx.moveCall({
|
|
1891
1678
|
package: packageAddress,
|
|
1892
1679
|
module: "trading",
|
|
1893
1680
|
function: "get_active_orders_by_order_tag",
|
|
1894
|
-
arguments: (0,
|
|
1895
|
-
typeArguments: options.typeArguments,
|
|
1896
|
-
});
|
|
1897
|
-
}
|
|
1898
|
-
/** [View Function] Gets active orders by order type tag and collateral token. */
|
|
1899
|
-
function getActiveOrdersByOrderTagAndCtoken(options) {
|
|
1900
|
-
const packageAddress = options.package ?? "@typus/perp";
|
|
1901
|
-
const argumentsTypes = [
|
|
1902
|
-
`${packageAddress}::admin::Version`,
|
|
1903
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
1904
|
-
"u64",
|
|
1905
|
-
"u8",
|
|
1906
|
-
];
|
|
1907
|
-
const parameterNames = ["version", "registry", "marketIndex", "orderTypeTag"];
|
|
1908
|
-
return (tx) => tx.moveCall({
|
|
1909
|
-
package: packageAddress,
|
|
1910
|
-
module: "trading",
|
|
1911
|
-
function: "get_active_orders_by_order_tag_and_ctoken",
|
|
1912
|
-
arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1681
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1913
1682
|
typeArguments: options.typeArguments,
|
|
1914
1683
|
});
|
|
1915
1684
|
}
|
|
@@ -1919,17 +1688,7 @@ function getActiveOrdersByOrderTagAndCtoken(options) {
|
|
|
1919
1688
|
*/
|
|
1920
1689
|
function getMaxReleasingCollateralAmount(options) {
|
|
1921
1690
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1922
|
-
const argumentsTypes = [
|
|
1923
|
-
`${packageAddress}::admin::Version`,
|
|
1924
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
1925
|
-
`${packageAddress}::lp_pool::Registry`,
|
|
1926
|
-
"0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73::oracle::Oracle",
|
|
1927
|
-
"0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73::oracle::Oracle",
|
|
1928
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
1929
|
-
"u64",
|
|
1930
|
-
"u64",
|
|
1931
|
-
"u64",
|
|
1932
|
-
];
|
|
1691
|
+
const argumentsTypes = [null, null, null, null, null, "0x2::clock::Clock", "u64", "u64", "u64"];
|
|
1933
1692
|
const parameterNames = [
|
|
1934
1693
|
"version",
|
|
1935
1694
|
"registry",
|
|
@@ -1944,25 +1703,14 @@ function getMaxReleasingCollateralAmount(options) {
|
|
|
1944
1703
|
package: packageAddress,
|
|
1945
1704
|
module: "trading",
|
|
1946
1705
|
function: "get_max_releasing_collateral_amount",
|
|
1947
|
-
arguments: (0,
|
|
1706
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1948
1707
|
typeArguments: options.typeArguments,
|
|
1949
1708
|
});
|
|
1950
1709
|
}
|
|
1951
1710
|
/** [View Functio Only] Gets the estimated liquidation price and PnL for a position. */
|
|
1952
1711
|
function getEstimatedLiquidationPriceAndPnl(options) {
|
|
1953
1712
|
const packageAddress = options.package ?? "@typus/perp";
|
|
1954
|
-
const argumentsTypes = [
|
|
1955
|
-
`${packageAddress}::admin::Version`,
|
|
1956
|
-
`${packageAddress}::trading::MarketRegistry`,
|
|
1957
|
-
`${packageAddress}::lp_pool::Registry`,
|
|
1958
|
-
"0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f::typus_dov_single::Registry",
|
|
1959
|
-
"0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73::oracle::Oracle",
|
|
1960
|
-
"0x1d17058789bd1e1e79f1a92424519a88146f191f58a06cc4d9ab23d17d46ab73::oracle::Oracle",
|
|
1961
|
-
"u64",
|
|
1962
|
-
"u64",
|
|
1963
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
1964
|
-
"u64",
|
|
1965
|
-
];
|
|
1713
|
+
const argumentsTypes = [null, null, null, null, null, null, "u64", "u64", "0x2::clock::Clock", "u64"];
|
|
1966
1714
|
const parameterNames = [
|
|
1967
1715
|
"version",
|
|
1968
1716
|
"registry",
|
|
@@ -1978,7 +1726,7 @@ function getEstimatedLiquidationPriceAndPnl(options) {
|
|
|
1978
1726
|
package: packageAddress,
|
|
1979
1727
|
module: "trading",
|
|
1980
1728
|
function: "get_estimated_liquidation_price_and_pnl",
|
|
1981
|
-
arguments: (0,
|
|
1729
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
1982
1730
|
typeArguments: options.typeArguments,
|
|
1983
1731
|
});
|
|
1984
1732
|
}
|
|
@@ -2001,42 +1749,42 @@ function calculateTradingFeeRateMbp(options) {
|
|
|
2001
1749
|
package: packageAddress,
|
|
2002
1750
|
module: "trading",
|
|
2003
1751
|
function: "calculate_trading_fee_rate_mbp",
|
|
2004
|
-
arguments: (0,
|
|
1752
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
2005
1753
|
});
|
|
2006
1754
|
}
|
|
2007
1755
|
/** [View Function] Gets the BCS-serialized markets. */
|
|
2008
1756
|
function getMarketsBcs(options) {
|
|
2009
1757
|
const packageAddress = options.package ?? "@typus/perp";
|
|
2010
|
-
const argumentsTypes = [
|
|
1758
|
+
const argumentsTypes = [null, "vector<u64>"];
|
|
2011
1759
|
const parameterNames = ["registry", "indexes"];
|
|
2012
1760
|
return (tx) => tx.moveCall({
|
|
2013
1761
|
package: packageAddress,
|
|
2014
1762
|
module: "trading",
|
|
2015
1763
|
function: "get_markets_bcs",
|
|
2016
|
-
arguments: (0,
|
|
1764
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
2017
1765
|
});
|
|
2018
1766
|
}
|
|
2019
1767
|
/** Gets a mutable reference to the market ID. WARNING: no authority check inside */
|
|
2020
1768
|
function getMutMarketId(options) {
|
|
2021
1769
|
const packageAddress = options.package ?? "@typus/perp";
|
|
2022
|
-
const argumentsTypes = [
|
|
1770
|
+
const argumentsTypes = [null, "u64"];
|
|
2023
1771
|
const parameterNames = ["registry", "marketIndex"];
|
|
2024
1772
|
return (tx) => tx.moveCall({
|
|
2025
1773
|
package: packageAddress,
|
|
2026
1774
|
module: "trading",
|
|
2027
1775
|
function: "get_mut_market_id",
|
|
2028
|
-
arguments: (0,
|
|
1776
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
2029
1777
|
});
|
|
2030
1778
|
}
|
|
2031
1779
|
function tradingSymbolExists(options) {
|
|
2032
1780
|
const packageAddress = options.package ?? "@typus/perp";
|
|
2033
|
-
const argumentsTypes = [
|
|
1781
|
+
const argumentsTypes = [null];
|
|
2034
1782
|
const parameterNames = ["market"];
|
|
2035
1783
|
return (tx) => tx.moveCall({
|
|
2036
1784
|
package: packageAddress,
|
|
2037
1785
|
module: "trading",
|
|
2038
1786
|
function: "trading_symbol_exists",
|
|
2039
|
-
arguments: (0,
|
|
1787
|
+
arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
2040
1788
|
typeArguments: options.typeArguments,
|
|
2041
1789
|
});
|
|
2042
1790
|
}
|