@n1xyz/nord-ts 0.0.14 → 0.0.16-29f6652
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/.prettierignore +1 -0
- package/README.md +9 -6
- package/dist/bridge/client.d.ts +8 -7
- package/dist/bridge/client.js +39 -37
- package/dist/bridge/index.d.ts +1 -2
- package/dist/bridge/index.js +2 -2
- package/dist/bridge/types.d.ts +7 -3
- package/dist/bridge/types.js +3 -1
- package/dist/gen/common.js +1 -1
- package/dist/gen/nord.d.ts +74 -25
- package/dist/gen/nord.js +498 -78
- package/dist/idl/bridge.json +1493 -0
- package/dist/idl/index.d.ts +585 -0
- package/dist/idl/index.js +8 -0
- package/dist/nord/api/core.js +7 -5
- package/dist/nord/api/metrics.js +7 -4
- package/dist/nord/client/Nord.d.ts +19 -5
- package/dist/nord/client/Nord.js +50 -23
- package/dist/nord/client/NordUser.d.ts +1 -1
- package/dist/nord/client/NordUser.js +19 -16
- package/dist/types.d.ts +3 -3
- package/dist/websocket/NordWebSocketClient.js +0 -2
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Nord.html +99 -100
- package/docs/classes/NordError.html +6 -6
- package/docs/classes/NordUser.html +49 -54
- package/docs/classes/NordWebSocketClient.html +6 -11
- package/docs/classes/SolanaBridgeClient.html +32 -27
- package/docs/classes/Subscriber.html +3 -3
- package/docs/enums/FillMode.html +2 -2
- package/docs/enums/KeyType.html +2 -2
- package/docs/enums/MetricPeriod.html +2 -2
- package/docs/enums/PdaSeedType.html +5 -3
- package/docs/enums/PeakTpsPeriodUnit.html +2 -2
- package/docs/enums/Side.html +2 -2
- package/docs/enums/WebSocketMessageType.html +3 -3
- package/docs/functions/actionQueryRollman.html +1 -1
- package/docs/functions/actionsQueryRollman.html +1 -1
- package/docs/functions/aggregateMetrics-1.html +1 -1
- package/docs/functions/assert.html +1 -1
- package/docs/functions/bigIntToProtoU128.html +1 -1
- package/docs/functions/bridgeToBN.html +1 -1
- package/docs/functions/bufferToHex.html +1 -1
- package/docs/functions/cancelOrder.html +1 -1
- package/docs/functions/checkPubKeyLength.html +1 -1
- package/docs/functions/checkedFetch.html +1 -1
- package/docs/functions/createSession.html +1 -1
- package/docs/functions/decodeLengthDelimited.html +1 -1
- package/docs/functions/encodeLengthDelimited.html +1 -1
- package/docs/functions/fillModeToProtoFillMode.html +1 -1
- package/docs/functions/findMarket.html +1 -1
- package/docs/functions/findPda.html +1 -1
- package/docs/functions/findToken.html +1 -1
- package/docs/functions/fromBN.html +1 -1
- package/docs/functions/getAccount.html +1 -1
- package/docs/functions/getActionNonce.html +1 -1
- package/docs/functions/getCurrentTps.html +1 -1
- package/docs/functions/getInfo.html +1 -1
- package/docs/functions/{queryLastNBlocks.html → getLastActionId.html} +3 -3
- package/docs/functions/getMedianLatency.html +1 -1
- package/docs/functions/getOrderbook.html +1 -1
- package/docs/functions/getPeakTps.html +1 -1
- package/docs/functions/getTimestamp.html +1 -1
- package/docs/functions/getTotalTransactions.html +1 -1
- package/docs/functions/getTrades.html +1 -1
- package/docs/functions/getUserAccountIds.html +1 -1
- package/docs/functions/hexToBuffer.html +1 -1
- package/docs/functions/initWebSocketClient.html +9 -9
- package/docs/functions/keypairFromPrivateKey.html +1 -1
- package/docs/functions/makeSigningFunction.html +1 -1
- package/docs/functions/makeWalletSignFn.html +1 -1
- package/docs/functions/marketsStats.html +1 -1
- package/docs/functions/optExpect.html +1 -1
- package/docs/functions/optMap.html +1 -1
- package/docs/functions/optUnwrap.html +1 -1
- package/docs/functions/panic.html +1 -1
- package/docs/functions/placeOrder.html +1 -1
- package/docs/functions/queryAction.html +1 -1
- package/docs/functions/queryPrometheus.html +1 -1
- package/docs/functions/queryRecentActions.html +4 -3
- package/docs/functions/revokeSession.html +1 -1
- package/docs/functions/shortenPublicKey.html +1 -1
- package/docs/functions/signAction.html +1 -1
- package/docs/functions/toBN.html +1 -1
- package/docs/functions/toScaledU128.html +1 -1
- package/docs/functions/toScaledU64.html +1 -1
- package/docs/functions/transfer.html +1 -1
- package/docs/functions/withdraw.html +1 -1
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +2 -2
- package/docs/interfaces/Account.html +2 -2
- package/docs/interfaces/ActionInfo.html +2 -2
- package/docs/interfaces/ActionNonceResponse.html +2 -2
- package/docs/interfaces/ActionQuery.html +2 -2
- package/docs/interfaces/ActionResponse.html +2 -2
- package/docs/interfaces/ActionsExtendedInfo.html +2 -2
- package/docs/interfaces/ActionsQuery.html +2 -2
- package/docs/interfaces/ActionsResponse.html +2 -2
- package/docs/interfaces/AggregateMetrics.html +2 -2
- package/docs/interfaces/BlockFacts.html +5 -5
- package/docs/interfaces/BlockQuery.html +2 -2
- package/docs/interfaces/BlockResponse.html +2 -2
- package/docs/interfaces/BlockSummary.html +2 -2
- package/docs/interfaces/BlockSummaryResponse.html +2 -2
- package/docs/interfaces/DeltaEvent.html +2 -2
- package/docs/interfaces/DepositSplParams.html +6 -6
- package/docs/interfaces/Info.html +2 -2
- package/docs/interfaces/Market.html +2 -2
- package/docs/interfaces/MarketStats.html +2 -2
- package/docs/interfaces/MarketsStatsResponse.html +2 -2
- package/docs/interfaces/NordConfig.html +19 -9
- package/docs/interfaces/NordWebSocketClientEvents.html +2 -2
- package/docs/interfaces/NordWebSocketEvents.html +3 -3
- package/docs/interfaces/Order.html +2 -2
- package/docs/interfaces/OrderInfo.html +2 -2
- package/docs/interfaces/OrderbookEntry.html +2 -2
- package/docs/interfaces/OrderbookQuery.html +2 -2
- package/docs/interfaces/OrderbookResponse.html +2 -2
- package/docs/interfaces/OrderbookSubscription.html +5 -5
- package/docs/interfaces/PerpMarketStats.html +2 -2
- package/docs/interfaces/RollmanActionExtendedInfo.html +2 -2
- package/docs/interfaces/RollmanActionInfo.html +2 -2
- package/docs/interfaces/RollmanActionResponse.html +2 -2
- package/docs/interfaces/RollmanActionsResponse.html +2 -2
- package/docs/interfaces/RollmanBlockResponse.html +2 -2
- package/docs/interfaces/SPLTokenInfo.html +5 -5
- package/docs/interfaces/SolanaBridgeConfig.html +8 -6
- package/docs/interfaces/StateFacts.html +5 -5
- package/docs/interfaces/SubscriberConfig.html +2 -2
- package/docs/interfaces/TimestampResponse.html +2 -2
- package/docs/interfaces/Token.html +2 -2
- package/docs/interfaces/TokenInfo.html +3 -2
- package/docs/interfaces/Trade.html +2 -2
- package/docs/interfaces/TradeSubscription.html +5 -5
- package/docs/interfaces/Trades.html +2 -2
- package/docs/interfaces/TradesQuery.html +2 -2
- package/docs/interfaces/TradesResponse.html +2 -2
- package/docs/interfaces/TransferParams.html +4 -4
- package/docs/interfaces/UserAccountIdsQuery.html +2 -2
- package/docs/interfaces/UserAccountIdsResponse.html +2 -2
- package/docs/interfaces/WebSocketAccountUpdate.html +6 -0
- package/docs/interfaces/WebSocketDeltaUpdate.html +3 -3
- package/docs/interfaces/WebSocketSubscription.html +3 -3
- package/docs/interfaces/WebSocketTradeUpdate.html +3 -3
- package/docs/interfaces/WithdrawalClaim.html +7 -7
- package/docs/interfaces/WithdrawalParams.html +4 -4
- package/docs/modules.html +1 -1
- package/docs/types/BigIntValue.html +1 -1
- package/docs/types/SubscriptionPattern.html +4 -0
- package/docs/types/SubscriptionType.html +2 -0
- package/docs/types/WebSocketMessage.html +1 -1
- package/docs/variables/DEBUG_KEYS.html +1 -1
- package/docs/variables/DEFAULT_FUNDING_AMOUNTS.html +1 -1
- package/docs/variables/DEV_TOKEN_INFOS.html +1 -1
- package/docs/variables/DEV_URL.html +1 -1
- package/docs/variables/MAX_BUFFER_LEN.html +1 -1
- package/docs/variables/SESSION_TTL.html +1 -1
- package/docs/variables/WEBSERVER_DEV_URL.html +1 -1
- package/docs/variables/ZERO_DECIMAL.html +1 -1
- package/docs/variables/_private.html +1 -1
- package/idl-generate.sh +4 -0
- package/package.json +6 -3
- package/src/bridge/client.ts +55 -43
- package/src/bridge/index.ts +1 -2
- package/src/bridge/types.ts +7 -3
- package/src/gen/common.ts +1 -1
- package/src/gen/nord.ts +567 -75
- package/src/idl/bridge.json +1493 -0
- package/src/idl/index.ts +2 -0
- package/src/nord/api/core.ts +1 -3
- package/src/nord/api/metrics.ts +2 -0
- package/src/nord/client/Nord.ts +49 -13
- package/src/nord/client/NordUser.ts +52 -59
- package/src/types.ts +2 -2
- package/src/websocket/NordWebSocketClient.ts +0 -2
- package/tsconfig.json +1 -1
- package/dist/idl/bridge.d.ts +0 -2
- package/dist/idl/bridge.js +0 -930
- package/docs/functions/blockQueryRollman.html +0 -6
- package/docs/functions/blockSummaryQueryRollman.html +0 -6
- package/docs/functions/queryBlock.html +0 -6
- package/docs/functions/queryRecentBlocks.html +0 -6
- package/docs/interfaces/WebSocketUserUpdate.html +0 -6
- package/src/idl/bridge.ts +0 -929
package/src/gen/nord.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
2
|
// versions:
|
|
3
3
|
// protoc-gen-ts_proto v2.7.0
|
|
4
|
-
// protoc
|
|
4
|
+
// protoc v5.28.3
|
|
5
5
|
// source: nord.proto
|
|
6
6
|
|
|
7
7
|
/* eslint-disable */
|
|
@@ -170,10 +170,11 @@ export enum Error {
|
|
|
170
170
|
PYTH_FEED_ALREADY_ADDED = 95,
|
|
171
171
|
PYTH_GUARDIAN_SET_UNINITIALIZED = 96,
|
|
172
172
|
PYTH_GUARDIAN_SET_INVALID = 97,
|
|
173
|
-
|
|
174
|
-
UNINITIALIZED_PRICES = 98,
|
|
173
|
+
PYTH_FEED_DECIMALS_OUT_OF_RANGE = 98,
|
|
175
174
|
PYTH_FEED_PRICE_OUT_OF_RANGE = 99,
|
|
176
|
-
|
|
175
|
+
PYTH_FEED_VARIANCE_OUT_OF_RANGE = 100,
|
|
176
|
+
PYTH_GUARDIAN_SET_AND_PYTH_SIGNATURE_DO_NOT_MATCH = 126,
|
|
177
|
+
INVALID_TOKEN_PARAMETERS = 101,
|
|
177
178
|
INDEX_PRICE_OUT_OF_RANGE = 103,
|
|
178
179
|
INDEX_DECIMALS_OUT_OF_RANGE = 104,
|
|
179
180
|
INVALID_STATE_VERSION = 105,
|
|
@@ -199,10 +200,8 @@ export enum Error {
|
|
|
199
200
|
* before reducing position
|
|
200
201
|
*/
|
|
201
202
|
CAN_REDUCE_POSITION_ONLY_IF_ALL_ORDERS_ARE_CANCELED = 124,
|
|
202
|
-
PYTH_GUARDIAN_SET_AND_PYTH_SIGNATURE_DO_NOT_MATCH = 126,
|
|
203
203
|
/** UNEXPECTED_TOKEN_ID - Token was found, but not expected to be used in action context */
|
|
204
204
|
UNEXPECTED_TOKEN_ID = 127,
|
|
205
|
-
SIGNATURE_VERIFICATION = 128,
|
|
206
205
|
/**
|
|
207
206
|
* TOKEN_NOT_READY - happens in some situation when token misses some relevant information
|
|
208
207
|
* needed for operation, for example index price
|
|
@@ -231,26 +230,6 @@ export enum Error {
|
|
|
231
230
|
* retained on account
|
|
232
231
|
*/
|
|
233
232
|
DUST_ACCOUNT = 145,
|
|
234
|
-
/** ORDER_EXECUTION - 10011_000 - 3 bit suffix */
|
|
235
|
-
ORDER_EXECUTION = 152,
|
|
236
|
-
/** ORDER_EXECUTION_EMPTY - 10011_001; */
|
|
237
|
-
ORDER_EXECUTION_EMPTY = 153,
|
|
238
|
-
/** ORDER_EXECUTION_FILL_OR_KILL - 10011_010; */
|
|
239
|
-
ORDER_EXECUTION_FILL_OR_KILL = 154,
|
|
240
|
-
/**
|
|
241
|
-
* ORDER_EXECUTION_MISSING_LIMITS - Order requires some of its limits specified according to fill mode
|
|
242
|
-
* 10011_011;
|
|
243
|
-
*/
|
|
244
|
-
ORDER_EXECUTION_MISSING_LIMITS = 155,
|
|
245
|
-
/** ORDER_EXECUTION_MISSING_PRICE - 10011_100; */
|
|
246
|
-
ORDER_EXECUTION_MISSING_PRICE = 156,
|
|
247
|
-
/** ORDER_EXECUTION_SIZE_LIMIT - 10011_101; */
|
|
248
|
-
ORDER_EXECUTION_SIZE_LIMIT = 157,
|
|
249
|
-
/**
|
|
250
|
-
* ORDER_REDUCE_IS_POST_ONLY - 10011_110;
|
|
251
|
-
* Reduce orders can only be post only.
|
|
252
|
-
*/
|
|
253
|
-
ORDER_REDUCE_IS_POST_ONLY = 158,
|
|
254
233
|
/** BALANCE - 10100_000 */
|
|
255
234
|
BALANCE = 160,
|
|
256
235
|
/** BALANCE_DEPOSIT_OVERFLOW - 10100_001 */
|
|
@@ -285,6 +264,7 @@ export enum Error {
|
|
|
285
264
|
* Binary pattern: 10101_001
|
|
286
265
|
*/
|
|
287
266
|
TRIGGER_INVALID_PRICE = 169,
|
|
267
|
+
TRIGGER_NOT_FOUND = 170,
|
|
288
268
|
/** TIMESTAMP - 10110_000 */
|
|
289
269
|
TIMESTAMP = 176,
|
|
290
270
|
/** TIMESTAMP_OUT_OF_THRESHOLD - 10110_001 */
|
|
@@ -307,11 +287,31 @@ export enum Error {
|
|
|
307
287
|
MARKET_FROZEN = 193,
|
|
308
288
|
/** POSITION - 11001_000 */
|
|
309
289
|
POSITION = 200,
|
|
290
|
+
/** POSITION_NOT_FOUND - Position not found for specific entity in specific market */
|
|
291
|
+
POSITION_NOT_FOUND = 201,
|
|
310
292
|
POSITION_STATE_ORDER = 202,
|
|
311
293
|
POSITION_STATE_ORDER_PRICE = 203,
|
|
312
294
|
POSITION_STATE_ORDER_SIZE = 204,
|
|
313
295
|
POSITION_STATE_ORDER_SIDE = 205,
|
|
314
296
|
POSITION_SIZE_LIMIT = 206,
|
|
297
|
+
PRICE = 209,
|
|
298
|
+
SIGNATURE_VERIFICATION = 217,
|
|
299
|
+
SIGNATURE_VERIFICATION_MALFORMED_PUBLIC_KEY = 218,
|
|
300
|
+
SIGNATURE_VERIFICATION_INVALID_LENGTH = 219,
|
|
301
|
+
/** ORDER_EXECUTION - 1111_0000 = 240 -- 4 bit suffix */
|
|
302
|
+
ORDER_EXECUTION = 240,
|
|
303
|
+
ORDER_EXECUTION_EMPTY = 241,
|
|
304
|
+
ORDER_EXECUTION_FILL_OR_KILL = 242,
|
|
305
|
+
/** ORDER_EXECUTION_MISSING_LIMITS - Order requires some of its limits specified according to fill mode */
|
|
306
|
+
ORDER_EXECUTION_MISSING_LIMITS = 243,
|
|
307
|
+
ORDER_EXECUTION_MISSING_PRICE = 244,
|
|
308
|
+
ORDER_EXECUTION_SIZE_LIMIT = 245,
|
|
309
|
+
ORDER_EXECUTION_LIMIT_PRICE = 246,
|
|
310
|
+
/** ORDER_REDUCE_IS_POST_ONLY - Reduce orders can only be post only. */
|
|
311
|
+
ORDER_REDUCE_IS_POST_ONLY = 247,
|
|
312
|
+
/** ORDER_EXECUTION_SELL_PRICE - Order was rejected, because it planned under proposed price */
|
|
313
|
+
ORDER_EXECUTION_SELL_PRICE = 248,
|
|
314
|
+
NOT_IMPLEMENTED = 500,
|
|
315
315
|
Dropped = 999,
|
|
316
316
|
}
|
|
317
317
|
|
|
@@ -387,12 +387,18 @@ export function errorFromJSON(object: any): Error {
|
|
|
387
387
|
case "PYTH_GUARDIAN_SET_INVALID":
|
|
388
388
|
return Error.PYTH_GUARDIAN_SET_INVALID;
|
|
389
389
|
case 98:
|
|
390
|
-
case "
|
|
391
|
-
return Error.
|
|
390
|
+
case "PYTH_FEED_DECIMALS_OUT_OF_RANGE":
|
|
391
|
+
return Error.PYTH_FEED_DECIMALS_OUT_OF_RANGE;
|
|
392
392
|
case 99:
|
|
393
393
|
case "PYTH_FEED_PRICE_OUT_OF_RANGE":
|
|
394
394
|
return Error.PYTH_FEED_PRICE_OUT_OF_RANGE;
|
|
395
395
|
case 100:
|
|
396
|
+
case "PYTH_FEED_VARIANCE_OUT_OF_RANGE":
|
|
397
|
+
return Error.PYTH_FEED_VARIANCE_OUT_OF_RANGE;
|
|
398
|
+
case 126:
|
|
399
|
+
case "PYTH_GUARDIAN_SET_AND_PYTH_SIGNATURE_DO_NOT_MATCH":
|
|
400
|
+
return Error.PYTH_GUARDIAN_SET_AND_PYTH_SIGNATURE_DO_NOT_MATCH;
|
|
401
|
+
case 101:
|
|
396
402
|
case "INVALID_TOKEN_PARAMETERS":
|
|
397
403
|
return Error.INVALID_TOKEN_PARAMETERS;
|
|
398
404
|
case 103:
|
|
@@ -422,15 +428,9 @@ export function errorFromJSON(object: any): Error {
|
|
|
422
428
|
case 124:
|
|
423
429
|
case "CAN_REDUCE_POSITION_ONLY_IF_ALL_ORDERS_ARE_CANCELED":
|
|
424
430
|
return Error.CAN_REDUCE_POSITION_ONLY_IF_ALL_ORDERS_ARE_CANCELED;
|
|
425
|
-
case 126:
|
|
426
|
-
case "PYTH_GUARDIAN_SET_AND_PYTH_SIGNATURE_DO_NOT_MATCH":
|
|
427
|
-
return Error.PYTH_GUARDIAN_SET_AND_PYTH_SIGNATURE_DO_NOT_MATCH;
|
|
428
431
|
case 127:
|
|
429
432
|
case "UNEXPECTED_TOKEN_ID":
|
|
430
433
|
return Error.UNEXPECTED_TOKEN_ID;
|
|
431
|
-
case 128:
|
|
432
|
-
case "SIGNATURE_VERIFICATION":
|
|
433
|
-
return Error.SIGNATURE_VERIFICATION;
|
|
434
434
|
case 130:
|
|
435
435
|
case "TOKEN_NOT_READY":
|
|
436
436
|
return Error.TOKEN_NOT_READY;
|
|
@@ -479,27 +479,6 @@ export function errorFromJSON(object: any): Error {
|
|
|
479
479
|
case 145:
|
|
480
480
|
case "DUST_ACCOUNT":
|
|
481
481
|
return Error.DUST_ACCOUNT;
|
|
482
|
-
case 152:
|
|
483
|
-
case "ORDER_EXECUTION":
|
|
484
|
-
return Error.ORDER_EXECUTION;
|
|
485
|
-
case 153:
|
|
486
|
-
case "ORDER_EXECUTION_EMPTY":
|
|
487
|
-
return Error.ORDER_EXECUTION_EMPTY;
|
|
488
|
-
case 154:
|
|
489
|
-
case "ORDER_EXECUTION_FILL_OR_KILL":
|
|
490
|
-
return Error.ORDER_EXECUTION_FILL_OR_KILL;
|
|
491
|
-
case 155:
|
|
492
|
-
case "ORDER_EXECUTION_MISSING_LIMITS":
|
|
493
|
-
return Error.ORDER_EXECUTION_MISSING_LIMITS;
|
|
494
|
-
case 156:
|
|
495
|
-
case "ORDER_EXECUTION_MISSING_PRICE":
|
|
496
|
-
return Error.ORDER_EXECUTION_MISSING_PRICE;
|
|
497
|
-
case 157:
|
|
498
|
-
case "ORDER_EXECUTION_SIZE_LIMIT":
|
|
499
|
-
return Error.ORDER_EXECUTION_SIZE_LIMIT;
|
|
500
|
-
case 158:
|
|
501
|
-
case "ORDER_REDUCE_IS_POST_ONLY":
|
|
502
|
-
return Error.ORDER_REDUCE_IS_POST_ONLY;
|
|
503
482
|
case 160:
|
|
504
483
|
case "BALANCE":
|
|
505
484
|
return Error.BALANCE;
|
|
@@ -527,6 +506,9 @@ export function errorFromJSON(object: any): Error {
|
|
|
527
506
|
case 169:
|
|
528
507
|
case "TRIGGER_INVALID_PRICE":
|
|
529
508
|
return Error.TRIGGER_INVALID_PRICE;
|
|
509
|
+
case 170:
|
|
510
|
+
case "TRIGGER_NOT_FOUND":
|
|
511
|
+
return Error.TRIGGER_NOT_FOUND;
|
|
530
512
|
case 176:
|
|
531
513
|
case "TIMESTAMP":
|
|
532
514
|
return Error.TIMESTAMP;
|
|
@@ -554,6 +536,9 @@ export function errorFromJSON(object: any): Error {
|
|
|
554
536
|
case 200:
|
|
555
537
|
case "POSITION":
|
|
556
538
|
return Error.POSITION;
|
|
539
|
+
case 201:
|
|
540
|
+
case "POSITION_NOT_FOUND":
|
|
541
|
+
return Error.POSITION_NOT_FOUND;
|
|
557
542
|
case 202:
|
|
558
543
|
case "POSITION_STATE_ORDER":
|
|
559
544
|
return Error.POSITION_STATE_ORDER;
|
|
@@ -569,6 +554,48 @@ export function errorFromJSON(object: any): Error {
|
|
|
569
554
|
case 206:
|
|
570
555
|
case "POSITION_SIZE_LIMIT":
|
|
571
556
|
return Error.POSITION_SIZE_LIMIT;
|
|
557
|
+
case 209:
|
|
558
|
+
case "PRICE":
|
|
559
|
+
return Error.PRICE;
|
|
560
|
+
case 217:
|
|
561
|
+
case "SIGNATURE_VERIFICATION":
|
|
562
|
+
return Error.SIGNATURE_VERIFICATION;
|
|
563
|
+
case 218:
|
|
564
|
+
case "SIGNATURE_VERIFICATION_MALFORMED_PUBLIC_KEY":
|
|
565
|
+
return Error.SIGNATURE_VERIFICATION_MALFORMED_PUBLIC_KEY;
|
|
566
|
+
case 219:
|
|
567
|
+
case "SIGNATURE_VERIFICATION_INVALID_LENGTH":
|
|
568
|
+
return Error.SIGNATURE_VERIFICATION_INVALID_LENGTH;
|
|
569
|
+
case 240:
|
|
570
|
+
case "ORDER_EXECUTION":
|
|
571
|
+
return Error.ORDER_EXECUTION;
|
|
572
|
+
case 241:
|
|
573
|
+
case "ORDER_EXECUTION_EMPTY":
|
|
574
|
+
return Error.ORDER_EXECUTION_EMPTY;
|
|
575
|
+
case 242:
|
|
576
|
+
case "ORDER_EXECUTION_FILL_OR_KILL":
|
|
577
|
+
return Error.ORDER_EXECUTION_FILL_OR_KILL;
|
|
578
|
+
case 243:
|
|
579
|
+
case "ORDER_EXECUTION_MISSING_LIMITS":
|
|
580
|
+
return Error.ORDER_EXECUTION_MISSING_LIMITS;
|
|
581
|
+
case 244:
|
|
582
|
+
case "ORDER_EXECUTION_MISSING_PRICE":
|
|
583
|
+
return Error.ORDER_EXECUTION_MISSING_PRICE;
|
|
584
|
+
case 245:
|
|
585
|
+
case "ORDER_EXECUTION_SIZE_LIMIT":
|
|
586
|
+
return Error.ORDER_EXECUTION_SIZE_LIMIT;
|
|
587
|
+
case 246:
|
|
588
|
+
case "ORDER_EXECUTION_LIMIT_PRICE":
|
|
589
|
+
return Error.ORDER_EXECUTION_LIMIT_PRICE;
|
|
590
|
+
case 247:
|
|
591
|
+
case "ORDER_REDUCE_IS_POST_ONLY":
|
|
592
|
+
return Error.ORDER_REDUCE_IS_POST_ONLY;
|
|
593
|
+
case 248:
|
|
594
|
+
case "ORDER_EXECUTION_SELL_PRICE":
|
|
595
|
+
return Error.ORDER_EXECUTION_SELL_PRICE;
|
|
596
|
+
case 500:
|
|
597
|
+
case "NOT_IMPLEMENTED":
|
|
598
|
+
return Error.NOT_IMPLEMENTED;
|
|
572
599
|
case 999:
|
|
573
600
|
case "Dropped":
|
|
574
601
|
return Error.Dropped;
|
|
@@ -625,10 +652,14 @@ export function errorToJSON(object: Error): string {
|
|
|
625
652
|
return "PYTH_GUARDIAN_SET_UNINITIALIZED";
|
|
626
653
|
case Error.PYTH_GUARDIAN_SET_INVALID:
|
|
627
654
|
return "PYTH_GUARDIAN_SET_INVALID";
|
|
628
|
-
case Error.
|
|
629
|
-
return "
|
|
655
|
+
case Error.PYTH_FEED_DECIMALS_OUT_OF_RANGE:
|
|
656
|
+
return "PYTH_FEED_DECIMALS_OUT_OF_RANGE";
|
|
630
657
|
case Error.PYTH_FEED_PRICE_OUT_OF_RANGE:
|
|
631
658
|
return "PYTH_FEED_PRICE_OUT_OF_RANGE";
|
|
659
|
+
case Error.PYTH_FEED_VARIANCE_OUT_OF_RANGE:
|
|
660
|
+
return "PYTH_FEED_VARIANCE_OUT_OF_RANGE";
|
|
661
|
+
case Error.PYTH_GUARDIAN_SET_AND_PYTH_SIGNATURE_DO_NOT_MATCH:
|
|
662
|
+
return "PYTH_GUARDIAN_SET_AND_PYTH_SIGNATURE_DO_NOT_MATCH";
|
|
632
663
|
case Error.INVALID_TOKEN_PARAMETERS:
|
|
633
664
|
return "INVALID_TOKEN_PARAMETERS";
|
|
634
665
|
case Error.INDEX_PRICE_OUT_OF_RANGE:
|
|
@@ -649,12 +680,8 @@ export function errorToJSON(object: Error): string {
|
|
|
649
680
|
return "FUNDING_OVERFLOW";
|
|
650
681
|
case Error.CAN_REDUCE_POSITION_ONLY_IF_ALL_ORDERS_ARE_CANCELED:
|
|
651
682
|
return "CAN_REDUCE_POSITION_ONLY_IF_ALL_ORDERS_ARE_CANCELED";
|
|
652
|
-
case Error.PYTH_GUARDIAN_SET_AND_PYTH_SIGNATURE_DO_NOT_MATCH:
|
|
653
|
-
return "PYTH_GUARDIAN_SET_AND_PYTH_SIGNATURE_DO_NOT_MATCH";
|
|
654
683
|
case Error.UNEXPECTED_TOKEN_ID:
|
|
655
684
|
return "UNEXPECTED_TOKEN_ID";
|
|
656
|
-
case Error.SIGNATURE_VERIFICATION:
|
|
657
|
-
return "SIGNATURE_VERIFICATION";
|
|
658
685
|
case Error.TOKEN_NOT_READY:
|
|
659
686
|
return "TOKEN_NOT_READY";
|
|
660
687
|
case Error.TOKEN_ALREADY_REGISTERED:
|
|
@@ -687,20 +714,6 @@ export function errorToJSON(object: Error): string {
|
|
|
687
714
|
return "ACCOUNT_INVALID_OWNER";
|
|
688
715
|
case Error.DUST_ACCOUNT:
|
|
689
716
|
return "DUST_ACCOUNT";
|
|
690
|
-
case Error.ORDER_EXECUTION:
|
|
691
|
-
return "ORDER_EXECUTION";
|
|
692
|
-
case Error.ORDER_EXECUTION_EMPTY:
|
|
693
|
-
return "ORDER_EXECUTION_EMPTY";
|
|
694
|
-
case Error.ORDER_EXECUTION_FILL_OR_KILL:
|
|
695
|
-
return "ORDER_EXECUTION_FILL_OR_KILL";
|
|
696
|
-
case Error.ORDER_EXECUTION_MISSING_LIMITS:
|
|
697
|
-
return "ORDER_EXECUTION_MISSING_LIMITS";
|
|
698
|
-
case Error.ORDER_EXECUTION_MISSING_PRICE:
|
|
699
|
-
return "ORDER_EXECUTION_MISSING_PRICE";
|
|
700
|
-
case Error.ORDER_EXECUTION_SIZE_LIMIT:
|
|
701
|
-
return "ORDER_EXECUTION_SIZE_LIMIT";
|
|
702
|
-
case Error.ORDER_REDUCE_IS_POST_ONLY:
|
|
703
|
-
return "ORDER_REDUCE_IS_POST_ONLY";
|
|
704
717
|
case Error.BALANCE:
|
|
705
718
|
return "BALANCE";
|
|
706
719
|
case Error.BALANCE_DEPOSIT_OVERFLOW:
|
|
@@ -719,6 +732,8 @@ export function errorToJSON(object: Error): string {
|
|
|
719
732
|
return "TRIGGER";
|
|
720
733
|
case Error.TRIGGER_INVALID_PRICE:
|
|
721
734
|
return "TRIGGER_INVALID_PRICE";
|
|
735
|
+
case Error.TRIGGER_NOT_FOUND:
|
|
736
|
+
return "TRIGGER_NOT_FOUND";
|
|
722
737
|
case Error.TIMESTAMP:
|
|
723
738
|
return "TIMESTAMP";
|
|
724
739
|
case Error.TIMESTAMP_OUT_OF_THRESHOLD:
|
|
@@ -737,6 +752,8 @@ export function errorToJSON(object: Error): string {
|
|
|
737
752
|
return "MARKET_FROZEN";
|
|
738
753
|
case Error.POSITION:
|
|
739
754
|
return "POSITION";
|
|
755
|
+
case Error.POSITION_NOT_FOUND:
|
|
756
|
+
return "POSITION_NOT_FOUND";
|
|
740
757
|
case Error.POSITION_STATE_ORDER:
|
|
741
758
|
return "POSITION_STATE_ORDER";
|
|
742
759
|
case Error.POSITION_STATE_ORDER_PRICE:
|
|
@@ -747,6 +764,34 @@ export function errorToJSON(object: Error): string {
|
|
|
747
764
|
return "POSITION_STATE_ORDER_SIDE";
|
|
748
765
|
case Error.POSITION_SIZE_LIMIT:
|
|
749
766
|
return "POSITION_SIZE_LIMIT";
|
|
767
|
+
case Error.PRICE:
|
|
768
|
+
return "PRICE";
|
|
769
|
+
case Error.SIGNATURE_VERIFICATION:
|
|
770
|
+
return "SIGNATURE_VERIFICATION";
|
|
771
|
+
case Error.SIGNATURE_VERIFICATION_MALFORMED_PUBLIC_KEY:
|
|
772
|
+
return "SIGNATURE_VERIFICATION_MALFORMED_PUBLIC_KEY";
|
|
773
|
+
case Error.SIGNATURE_VERIFICATION_INVALID_LENGTH:
|
|
774
|
+
return "SIGNATURE_VERIFICATION_INVALID_LENGTH";
|
|
775
|
+
case Error.ORDER_EXECUTION:
|
|
776
|
+
return "ORDER_EXECUTION";
|
|
777
|
+
case Error.ORDER_EXECUTION_EMPTY:
|
|
778
|
+
return "ORDER_EXECUTION_EMPTY";
|
|
779
|
+
case Error.ORDER_EXECUTION_FILL_OR_KILL:
|
|
780
|
+
return "ORDER_EXECUTION_FILL_OR_KILL";
|
|
781
|
+
case Error.ORDER_EXECUTION_MISSING_LIMITS:
|
|
782
|
+
return "ORDER_EXECUTION_MISSING_LIMITS";
|
|
783
|
+
case Error.ORDER_EXECUTION_MISSING_PRICE:
|
|
784
|
+
return "ORDER_EXECUTION_MISSING_PRICE";
|
|
785
|
+
case Error.ORDER_EXECUTION_SIZE_LIMIT:
|
|
786
|
+
return "ORDER_EXECUTION_SIZE_LIMIT";
|
|
787
|
+
case Error.ORDER_EXECUTION_LIMIT_PRICE:
|
|
788
|
+
return "ORDER_EXECUTION_LIMIT_PRICE";
|
|
789
|
+
case Error.ORDER_REDUCE_IS_POST_ONLY:
|
|
790
|
+
return "ORDER_REDUCE_IS_POST_ONLY";
|
|
791
|
+
case Error.ORDER_EXECUTION_SELL_PRICE:
|
|
792
|
+
return "ORDER_EXECUTION_SELL_PRICE";
|
|
793
|
+
case Error.NOT_IMPLEMENTED:
|
|
794
|
+
return "NOT_IMPLEMENTED";
|
|
750
795
|
case Error.Dropped:
|
|
751
796
|
return "Dropped";
|
|
752
797
|
default:
|
|
@@ -840,6 +885,7 @@ export interface Action {
|
|
|
840
885
|
| { $case: "message"; value: Message }
|
|
841
886
|
| { $case: "addTrigger"; value: Action_AddTrigger }
|
|
842
887
|
| { $case: "removeTrigger"; value: Action_RemoveTrigger }
|
|
888
|
+
| { $case: "takePosition"; value: Action_TakePosition }
|
|
843
889
|
| undefined;
|
|
844
890
|
}
|
|
845
891
|
|
|
@@ -971,6 +1017,10 @@ export interface Action_PlaceOrder {
|
|
|
971
1017
|
* Optional account on behalf of whom the order should be placed.
|
|
972
1018
|
* Executed only if sender has delegated authority to do so,
|
|
973
1019
|
* like admin user or liquidator bot.
|
|
1020
|
+
* # Delegation allowed if:
|
|
1021
|
+
* - trigger
|
|
1022
|
+
* - reduce bad position
|
|
1023
|
+
* - sell at good price to reduce if cannot cover bad position
|
|
974
1024
|
*/
|
|
975
1025
|
delegatorAccountId?:
|
|
976
1026
|
| number
|
|
@@ -1097,6 +1147,28 @@ export interface Action_RemoveTrigger {
|
|
|
1097
1147
|
accountId?: number | undefined;
|
|
1098
1148
|
}
|
|
1099
1149
|
|
|
1150
|
+
export interface Action_TakePosition {
|
|
1151
|
+
sessionId: bigint;
|
|
1152
|
+
marketId: number;
|
|
1153
|
+
/** Amount to take. */
|
|
1154
|
+
size: bigint;
|
|
1155
|
+
/**
|
|
1156
|
+
* Account id which performs operation;
|
|
1157
|
+
* if not specified, first account of session's owner user is picked
|
|
1158
|
+
*/
|
|
1159
|
+
senderAccountId?:
|
|
1160
|
+
| number
|
|
1161
|
+
| undefined;
|
|
1162
|
+
/**
|
|
1163
|
+
* If set, then it is take action.
|
|
1164
|
+
* If price not so good as in field, take will fail.
|
|
1165
|
+
*
|
|
1166
|
+
* If not set,
|
|
1167
|
+
* will do fill-or-kill order as per liquidation trade rule.
|
|
1168
|
+
*/
|
|
1169
|
+
price?: bigint | undefined;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1100
1172
|
export interface Receipt {
|
|
1101
1173
|
/**
|
|
1102
1174
|
* Action id which was run to produce this receipt.
|
|
@@ -1123,6 +1195,7 @@ export interface Receipt {
|
|
|
1123
1195
|
| { $case: "transferred"; value: Receipt_Transferred }
|
|
1124
1196
|
| { $case: "triggerAdded"; value: Receipt_TriggerAdded }
|
|
1125
1197
|
| { $case: "triggerRemoved"; value: Receipt_TriggerRemoved }
|
|
1198
|
+
| { $case: "positionTakenOrTraded"; value: Receipt_PositionTakenOrTradedResult }
|
|
1126
1199
|
| undefined;
|
|
1127
1200
|
}
|
|
1128
1201
|
|
|
@@ -1153,6 +1226,19 @@ export interface Receipt_PlaceOrderResult {
|
|
|
1153
1226
|
clientOrderId?: bigint | undefined;
|
|
1154
1227
|
}
|
|
1155
1228
|
|
|
1229
|
+
export interface Receipt_TakenResult {
|
|
1230
|
+
pnl: bigint;
|
|
1231
|
+
size: bigint;
|
|
1232
|
+
takerAccountId: number;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
export interface Receipt_PositionTakenOrTradedResult {
|
|
1236
|
+
marketId: number;
|
|
1237
|
+
PositionTakenOrTradedKind?: { $case: "taken"; value: Receipt_TakenResult } | //
|
|
1238
|
+
/** non empty if trade immediately */
|
|
1239
|
+
{ $case: "traded"; value: Receipt_PlaceOrderResult } | undefined;
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1156
1242
|
export interface Receipt_CancelOrderResult {
|
|
1157
1243
|
orderId: bigint;
|
|
1158
1244
|
/** Account from which order was cancelled */
|
|
@@ -1693,6 +1779,9 @@ export const Action: MessageFns<Action> = {
|
|
|
1693
1779
|
case "removeTrigger":
|
|
1694
1780
|
Action_RemoveTrigger.encode(message.kind.value, writer.uint32(266).fork()).join();
|
|
1695
1781
|
break;
|
|
1782
|
+
case "takePosition":
|
|
1783
|
+
Action_TakePosition.encode(message.kind.value, writer.uint32(274).fork()).join();
|
|
1784
|
+
break;
|
|
1696
1785
|
}
|
|
1697
1786
|
return writer;
|
|
1698
1787
|
},
|
|
@@ -1873,6 +1962,14 @@ export const Action: MessageFns<Action> = {
|
|
|
1873
1962
|
message.kind = { $case: "removeTrigger", value: Action_RemoveTrigger.decode(reader, reader.uint32()) };
|
|
1874
1963
|
continue;
|
|
1875
1964
|
}
|
|
1965
|
+
case 34: {
|
|
1966
|
+
if (tag !== 274) {
|
|
1967
|
+
break;
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
message.kind = { $case: "takePosition", value: Action_TakePosition.decode(reader, reader.uint32()) };
|
|
1971
|
+
continue;
|
|
1972
|
+
}
|
|
1876
1973
|
}
|
|
1877
1974
|
if ((tag & 7) === 4 || tag === 0) {
|
|
1878
1975
|
break;
|
|
@@ -1925,6 +2022,8 @@ export const Action: MessageFns<Action> = {
|
|
|
1925
2022
|
? { $case: "addTrigger", value: Action_AddTrigger.fromJSON(object.addTrigger) }
|
|
1926
2023
|
: isSet(object.removeTrigger)
|
|
1927
2024
|
? { $case: "removeTrigger", value: Action_RemoveTrigger.fromJSON(object.removeTrigger) }
|
|
2025
|
+
: isSet(object.takePosition)
|
|
2026
|
+
? { $case: "takePosition", value: Action_TakePosition.fromJSON(object.takePosition) }
|
|
1928
2027
|
: undefined,
|
|
1929
2028
|
};
|
|
1930
2029
|
},
|
|
@@ -1973,6 +2072,8 @@ export const Action: MessageFns<Action> = {
|
|
|
1973
2072
|
obj.addTrigger = Action_AddTrigger.toJSON(message.kind.value);
|
|
1974
2073
|
} else if (message.kind?.$case === "removeTrigger") {
|
|
1975
2074
|
obj.removeTrigger = Action_RemoveTrigger.toJSON(message.kind.value);
|
|
2075
|
+
} else if (message.kind?.$case === "takePosition") {
|
|
2076
|
+
obj.takePosition = Action_TakePosition.toJSON(message.kind.value);
|
|
1976
2077
|
}
|
|
1977
2078
|
return obj;
|
|
1978
2079
|
},
|
|
@@ -2099,6 +2200,12 @@ export const Action: MessageFns<Action> = {
|
|
|
2099
2200
|
}
|
|
2100
2201
|
break;
|
|
2101
2202
|
}
|
|
2203
|
+
case "takePosition": {
|
|
2204
|
+
if (object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
2205
|
+
message.kind = { $case: "takePosition", value: Action_TakePosition.fromPartial(object.kind.value) };
|
|
2206
|
+
}
|
|
2207
|
+
break;
|
|
2208
|
+
}
|
|
2102
2209
|
}
|
|
2103
2210
|
return message;
|
|
2104
2211
|
},
|
|
@@ -3972,6 +4079,139 @@ export const Action_RemoveTrigger: MessageFns<Action_RemoveTrigger> = {
|
|
|
3972
4079
|
},
|
|
3973
4080
|
};
|
|
3974
4081
|
|
|
4082
|
+
function createBaseAction_TakePosition(): Action_TakePosition {
|
|
4083
|
+
return { sessionId: 0n, marketId: 0, size: 0n, senderAccountId: undefined, price: undefined };
|
|
4084
|
+
}
|
|
4085
|
+
|
|
4086
|
+
export const Action_TakePosition: MessageFns<Action_TakePosition> = {
|
|
4087
|
+
encode(message: Action_TakePosition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
4088
|
+
if (message.sessionId !== 0n) {
|
|
4089
|
+
if (BigInt.asUintN(64, message.sessionId) !== message.sessionId) {
|
|
4090
|
+
throw new globalThis.Error("value provided for field message.sessionId of type uint64 too large");
|
|
4091
|
+
}
|
|
4092
|
+
writer.uint32(8).uint64(message.sessionId);
|
|
4093
|
+
}
|
|
4094
|
+
if (message.marketId !== 0) {
|
|
4095
|
+
writer.uint32(16).uint32(message.marketId);
|
|
4096
|
+
}
|
|
4097
|
+
if (message.size !== 0n) {
|
|
4098
|
+
if (BigInt.asIntN(64, message.size) !== message.size) {
|
|
4099
|
+
throw new globalThis.Error("value provided for field message.size of type int64 too large");
|
|
4100
|
+
}
|
|
4101
|
+
writer.uint32(24).int64(message.size);
|
|
4102
|
+
}
|
|
4103
|
+
if (message.senderAccountId !== undefined) {
|
|
4104
|
+
writer.uint32(32).uint32(message.senderAccountId);
|
|
4105
|
+
}
|
|
4106
|
+
if (message.price !== undefined) {
|
|
4107
|
+
if (BigInt.asUintN(64, message.price) !== message.price) {
|
|
4108
|
+
throw new globalThis.Error("value provided for field message.price of type uint64 too large");
|
|
4109
|
+
}
|
|
4110
|
+
writer.uint32(40).uint64(message.price);
|
|
4111
|
+
}
|
|
4112
|
+
return writer;
|
|
4113
|
+
},
|
|
4114
|
+
|
|
4115
|
+
decode(input: BinaryReader | Uint8Array, length?: number): Action_TakePosition {
|
|
4116
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
4117
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4118
|
+
const message = createBaseAction_TakePosition();
|
|
4119
|
+
while (reader.pos < end) {
|
|
4120
|
+
const tag = reader.uint32();
|
|
4121
|
+
switch (tag >>> 3) {
|
|
4122
|
+
case 1: {
|
|
4123
|
+
if (tag !== 8) {
|
|
4124
|
+
break;
|
|
4125
|
+
}
|
|
4126
|
+
|
|
4127
|
+
message.sessionId = reader.uint64() as bigint;
|
|
4128
|
+
continue;
|
|
4129
|
+
}
|
|
4130
|
+
case 2: {
|
|
4131
|
+
if (tag !== 16) {
|
|
4132
|
+
break;
|
|
4133
|
+
}
|
|
4134
|
+
|
|
4135
|
+
message.marketId = reader.uint32();
|
|
4136
|
+
continue;
|
|
4137
|
+
}
|
|
4138
|
+
case 3: {
|
|
4139
|
+
if (tag !== 24) {
|
|
4140
|
+
break;
|
|
4141
|
+
}
|
|
4142
|
+
|
|
4143
|
+
message.size = reader.int64() as bigint;
|
|
4144
|
+
continue;
|
|
4145
|
+
}
|
|
4146
|
+
case 4: {
|
|
4147
|
+
if (tag !== 32) {
|
|
4148
|
+
break;
|
|
4149
|
+
}
|
|
4150
|
+
|
|
4151
|
+
message.senderAccountId = reader.uint32();
|
|
4152
|
+
continue;
|
|
4153
|
+
}
|
|
4154
|
+
case 5: {
|
|
4155
|
+
if (tag !== 40) {
|
|
4156
|
+
break;
|
|
4157
|
+
}
|
|
4158
|
+
|
|
4159
|
+
message.price = reader.uint64() as bigint;
|
|
4160
|
+
continue;
|
|
4161
|
+
}
|
|
4162
|
+
}
|
|
4163
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
4164
|
+
break;
|
|
4165
|
+
}
|
|
4166
|
+
reader.skip(tag & 7);
|
|
4167
|
+
}
|
|
4168
|
+
return message;
|
|
4169
|
+
},
|
|
4170
|
+
|
|
4171
|
+
fromJSON(object: any): Action_TakePosition {
|
|
4172
|
+
return {
|
|
4173
|
+
sessionId: isSet(object.sessionId) ? BigInt(object.sessionId) : 0n,
|
|
4174
|
+
marketId: isSet(object.marketId) ? globalThis.Number(object.marketId) : 0,
|
|
4175
|
+
size: isSet(object.size) ? BigInt(object.size) : 0n,
|
|
4176
|
+
senderAccountId: isSet(object.senderAccountId) ? globalThis.Number(object.senderAccountId) : undefined,
|
|
4177
|
+
price: isSet(object.price) ? BigInt(object.price) : undefined,
|
|
4178
|
+
};
|
|
4179
|
+
},
|
|
4180
|
+
|
|
4181
|
+
toJSON(message: Action_TakePosition): unknown {
|
|
4182
|
+
const obj: any = {};
|
|
4183
|
+
if (message.sessionId !== 0n) {
|
|
4184
|
+
obj.sessionId = message.sessionId.toString();
|
|
4185
|
+
}
|
|
4186
|
+
if (message.marketId !== 0) {
|
|
4187
|
+
obj.marketId = Math.round(message.marketId);
|
|
4188
|
+
}
|
|
4189
|
+
if (message.size !== 0n) {
|
|
4190
|
+
obj.size = message.size.toString();
|
|
4191
|
+
}
|
|
4192
|
+
if (message.senderAccountId !== undefined) {
|
|
4193
|
+
obj.senderAccountId = Math.round(message.senderAccountId);
|
|
4194
|
+
}
|
|
4195
|
+
if (message.price !== undefined) {
|
|
4196
|
+
obj.price = message.price.toString();
|
|
4197
|
+
}
|
|
4198
|
+
return obj;
|
|
4199
|
+
},
|
|
4200
|
+
|
|
4201
|
+
create<I extends Exact<DeepPartial<Action_TakePosition>, I>>(base?: I): Action_TakePosition {
|
|
4202
|
+
return Action_TakePosition.fromPartial(base ?? ({} as any));
|
|
4203
|
+
},
|
|
4204
|
+
fromPartial<I extends Exact<DeepPartial<Action_TakePosition>, I>>(object: I): Action_TakePosition {
|
|
4205
|
+
const message = createBaseAction_TakePosition();
|
|
4206
|
+
message.sessionId = object.sessionId ?? 0n;
|
|
4207
|
+
message.marketId = object.marketId ?? 0;
|
|
4208
|
+
message.size = object.size ?? 0n;
|
|
4209
|
+
message.senderAccountId = object.senderAccountId ?? undefined;
|
|
4210
|
+
message.price = object.price ?? undefined;
|
|
4211
|
+
return message;
|
|
4212
|
+
},
|
|
4213
|
+
};
|
|
4214
|
+
|
|
3975
4215
|
function createBaseReceipt(): Receipt {
|
|
3976
4216
|
return { actionId: 0n, kind: undefined };
|
|
3977
4217
|
}
|
|
@@ -4039,6 +4279,9 @@ export const Receipt: MessageFns<Receipt> = {
|
|
|
4039
4279
|
case "triggerRemoved":
|
|
4040
4280
|
Receipt_TriggerRemoved.encode(message.kind.value, writer.uint32(522).fork()).join();
|
|
4041
4281
|
break;
|
|
4282
|
+
case "positionTakenOrTraded":
|
|
4283
|
+
Receipt_PositionTakenOrTradedResult.encode(message.kind.value, writer.uint32(530).fork()).join();
|
|
4284
|
+
break;
|
|
4042
4285
|
}
|
|
4043
4286
|
return writer;
|
|
4044
4287
|
},
|
|
@@ -4223,6 +4466,17 @@ export const Receipt: MessageFns<Receipt> = {
|
|
|
4223
4466
|
message.kind = { $case: "triggerRemoved", value: Receipt_TriggerRemoved.decode(reader, reader.uint32()) };
|
|
4224
4467
|
continue;
|
|
4225
4468
|
}
|
|
4469
|
+
case 66: {
|
|
4470
|
+
if (tag !== 530) {
|
|
4471
|
+
break;
|
|
4472
|
+
}
|
|
4473
|
+
|
|
4474
|
+
message.kind = {
|
|
4475
|
+
$case: "positionTakenOrTraded",
|
|
4476
|
+
value: Receipt_PositionTakenOrTradedResult.decode(reader, reader.uint32()),
|
|
4477
|
+
};
|
|
4478
|
+
continue;
|
|
4479
|
+
}
|
|
4226
4480
|
}
|
|
4227
4481
|
if ((tag & 7) === 4 || tag === 0) {
|
|
4228
4482
|
break;
|
|
@@ -4277,6 +4531,11 @@ export const Receipt: MessageFns<Receipt> = {
|
|
|
4277
4531
|
? { $case: "triggerAdded", value: Receipt_TriggerAdded.fromJSON(object.triggerAdded) }
|
|
4278
4532
|
: isSet(object.triggerRemoved)
|
|
4279
4533
|
? { $case: "triggerRemoved", value: Receipt_TriggerRemoved.fromJSON(object.triggerRemoved) }
|
|
4534
|
+
: isSet(object.positionTakenOrTraded)
|
|
4535
|
+
? {
|
|
4536
|
+
$case: "positionTakenOrTraded",
|
|
4537
|
+
value: Receipt_PositionTakenOrTradedResult.fromJSON(object.positionTakenOrTraded),
|
|
4538
|
+
}
|
|
4280
4539
|
: undefined,
|
|
4281
4540
|
};
|
|
4282
4541
|
},
|
|
@@ -4322,6 +4581,8 @@ export const Receipt: MessageFns<Receipt> = {
|
|
|
4322
4581
|
obj.triggerAdded = Receipt_TriggerAdded.toJSON(message.kind.value);
|
|
4323
4582
|
} else if (message.kind?.$case === "triggerRemoved") {
|
|
4324
4583
|
obj.triggerRemoved = Receipt_TriggerRemoved.toJSON(message.kind.value);
|
|
4584
|
+
} else if (message.kind?.$case === "positionTakenOrTraded") {
|
|
4585
|
+
obj.positionTakenOrTraded = Receipt_PositionTakenOrTradedResult.toJSON(message.kind.value);
|
|
4325
4586
|
}
|
|
4326
4587
|
return obj;
|
|
4327
4588
|
},
|
|
@@ -4462,6 +4723,15 @@ export const Receipt: MessageFns<Receipt> = {
|
|
|
4462
4723
|
}
|
|
4463
4724
|
break;
|
|
4464
4725
|
}
|
|
4726
|
+
case "positionTakenOrTraded": {
|
|
4727
|
+
if (object.kind?.value !== undefined && object.kind?.value !== null) {
|
|
4728
|
+
message.kind = {
|
|
4729
|
+
$case: "positionTakenOrTraded",
|
|
4730
|
+
value: Receipt_PositionTakenOrTradedResult.fromPartial(object.kind.value),
|
|
4731
|
+
};
|
|
4732
|
+
}
|
|
4733
|
+
break;
|
|
4734
|
+
}
|
|
4465
4735
|
}
|
|
4466
4736
|
return message;
|
|
4467
4737
|
},
|
|
@@ -4891,6 +5161,228 @@ export const Receipt_PlaceOrderResult: MessageFns<Receipt_PlaceOrderResult> = {
|
|
|
4891
5161
|
},
|
|
4892
5162
|
};
|
|
4893
5163
|
|
|
5164
|
+
function createBaseReceipt_TakenResult(): Receipt_TakenResult {
|
|
5165
|
+
return { pnl: 0n, size: 0n, takerAccountId: 0 };
|
|
5166
|
+
}
|
|
5167
|
+
|
|
5168
|
+
export const Receipt_TakenResult: MessageFns<Receipt_TakenResult> = {
|
|
5169
|
+
encode(message: Receipt_TakenResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
5170
|
+
if (message.pnl !== 0n) {
|
|
5171
|
+
if (BigInt.asIntN(64, message.pnl) !== message.pnl) {
|
|
5172
|
+
throw new globalThis.Error("value provided for field message.pnl of type int64 too large");
|
|
5173
|
+
}
|
|
5174
|
+
writer.uint32(8).int64(message.pnl);
|
|
5175
|
+
}
|
|
5176
|
+
if (message.size !== 0n) {
|
|
5177
|
+
if (BigInt.asIntN(64, message.size) !== message.size) {
|
|
5178
|
+
throw new globalThis.Error("value provided for field message.size of type int64 too large");
|
|
5179
|
+
}
|
|
5180
|
+
writer.uint32(16).int64(message.size);
|
|
5181
|
+
}
|
|
5182
|
+
if (message.takerAccountId !== 0) {
|
|
5183
|
+
writer.uint32(24).uint32(message.takerAccountId);
|
|
5184
|
+
}
|
|
5185
|
+
return writer;
|
|
5186
|
+
},
|
|
5187
|
+
|
|
5188
|
+
decode(input: BinaryReader | Uint8Array, length?: number): Receipt_TakenResult {
|
|
5189
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
5190
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
5191
|
+
const message = createBaseReceipt_TakenResult();
|
|
5192
|
+
while (reader.pos < end) {
|
|
5193
|
+
const tag = reader.uint32();
|
|
5194
|
+
switch (tag >>> 3) {
|
|
5195
|
+
case 1: {
|
|
5196
|
+
if (tag !== 8) {
|
|
5197
|
+
break;
|
|
5198
|
+
}
|
|
5199
|
+
|
|
5200
|
+
message.pnl = reader.int64() as bigint;
|
|
5201
|
+
continue;
|
|
5202
|
+
}
|
|
5203
|
+
case 2: {
|
|
5204
|
+
if (tag !== 16) {
|
|
5205
|
+
break;
|
|
5206
|
+
}
|
|
5207
|
+
|
|
5208
|
+
message.size = reader.int64() as bigint;
|
|
5209
|
+
continue;
|
|
5210
|
+
}
|
|
5211
|
+
case 3: {
|
|
5212
|
+
if (tag !== 24) {
|
|
5213
|
+
break;
|
|
5214
|
+
}
|
|
5215
|
+
|
|
5216
|
+
message.takerAccountId = reader.uint32();
|
|
5217
|
+
continue;
|
|
5218
|
+
}
|
|
5219
|
+
}
|
|
5220
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
5221
|
+
break;
|
|
5222
|
+
}
|
|
5223
|
+
reader.skip(tag & 7);
|
|
5224
|
+
}
|
|
5225
|
+
return message;
|
|
5226
|
+
},
|
|
5227
|
+
|
|
5228
|
+
fromJSON(object: any): Receipt_TakenResult {
|
|
5229
|
+
return {
|
|
5230
|
+
pnl: isSet(object.pnl) ? BigInt(object.pnl) : 0n,
|
|
5231
|
+
size: isSet(object.size) ? BigInt(object.size) : 0n,
|
|
5232
|
+
takerAccountId: isSet(object.takerAccountId) ? globalThis.Number(object.takerAccountId) : 0,
|
|
5233
|
+
};
|
|
5234
|
+
},
|
|
5235
|
+
|
|
5236
|
+
toJSON(message: Receipt_TakenResult): unknown {
|
|
5237
|
+
const obj: any = {};
|
|
5238
|
+
if (message.pnl !== 0n) {
|
|
5239
|
+
obj.pnl = message.pnl.toString();
|
|
5240
|
+
}
|
|
5241
|
+
if (message.size !== 0n) {
|
|
5242
|
+
obj.size = message.size.toString();
|
|
5243
|
+
}
|
|
5244
|
+
if (message.takerAccountId !== 0) {
|
|
5245
|
+
obj.takerAccountId = Math.round(message.takerAccountId);
|
|
5246
|
+
}
|
|
5247
|
+
return obj;
|
|
5248
|
+
},
|
|
5249
|
+
|
|
5250
|
+
create<I extends Exact<DeepPartial<Receipt_TakenResult>, I>>(base?: I): Receipt_TakenResult {
|
|
5251
|
+
return Receipt_TakenResult.fromPartial(base ?? ({} as any));
|
|
5252
|
+
},
|
|
5253
|
+
fromPartial<I extends Exact<DeepPartial<Receipt_TakenResult>, I>>(object: I): Receipt_TakenResult {
|
|
5254
|
+
const message = createBaseReceipt_TakenResult();
|
|
5255
|
+
message.pnl = object.pnl ?? 0n;
|
|
5256
|
+
message.size = object.size ?? 0n;
|
|
5257
|
+
message.takerAccountId = object.takerAccountId ?? 0;
|
|
5258
|
+
return message;
|
|
5259
|
+
},
|
|
5260
|
+
};
|
|
5261
|
+
|
|
5262
|
+
function createBaseReceipt_PositionTakenOrTradedResult(): Receipt_PositionTakenOrTradedResult {
|
|
5263
|
+
return { marketId: 0, PositionTakenOrTradedKind: undefined };
|
|
5264
|
+
}
|
|
5265
|
+
|
|
5266
|
+
export const Receipt_PositionTakenOrTradedResult: MessageFns<Receipt_PositionTakenOrTradedResult> = {
|
|
5267
|
+
encode(message: Receipt_PositionTakenOrTradedResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
5268
|
+
if (message.marketId !== 0) {
|
|
5269
|
+
writer.uint32(8).uint32(message.marketId);
|
|
5270
|
+
}
|
|
5271
|
+
switch (message.PositionTakenOrTradedKind?.$case) {
|
|
5272
|
+
case "taken":
|
|
5273
|
+
Receipt_TakenResult.encode(message.PositionTakenOrTradedKind.value, writer.uint32(18).fork()).join();
|
|
5274
|
+
break;
|
|
5275
|
+
case "traded":
|
|
5276
|
+
Receipt_PlaceOrderResult.encode(message.PositionTakenOrTradedKind.value, writer.uint32(26).fork()).join();
|
|
5277
|
+
break;
|
|
5278
|
+
}
|
|
5279
|
+
return writer;
|
|
5280
|
+
},
|
|
5281
|
+
|
|
5282
|
+
decode(input: BinaryReader | Uint8Array, length?: number): Receipt_PositionTakenOrTradedResult {
|
|
5283
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
5284
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
5285
|
+
const message = createBaseReceipt_PositionTakenOrTradedResult();
|
|
5286
|
+
while (reader.pos < end) {
|
|
5287
|
+
const tag = reader.uint32();
|
|
5288
|
+
switch (tag >>> 3) {
|
|
5289
|
+
case 1: {
|
|
5290
|
+
if (tag !== 8) {
|
|
5291
|
+
break;
|
|
5292
|
+
}
|
|
5293
|
+
|
|
5294
|
+
message.marketId = reader.uint32();
|
|
5295
|
+
continue;
|
|
5296
|
+
}
|
|
5297
|
+
case 2: {
|
|
5298
|
+
if (tag !== 18) {
|
|
5299
|
+
break;
|
|
5300
|
+
}
|
|
5301
|
+
|
|
5302
|
+
message.PositionTakenOrTradedKind = {
|
|
5303
|
+
$case: "taken",
|
|
5304
|
+
value: Receipt_TakenResult.decode(reader, reader.uint32()),
|
|
5305
|
+
};
|
|
5306
|
+
continue;
|
|
5307
|
+
}
|
|
5308
|
+
case 3: {
|
|
5309
|
+
if (tag !== 26) {
|
|
5310
|
+
break;
|
|
5311
|
+
}
|
|
5312
|
+
|
|
5313
|
+
message.PositionTakenOrTradedKind = {
|
|
5314
|
+
$case: "traded",
|
|
5315
|
+
value: Receipt_PlaceOrderResult.decode(reader, reader.uint32()),
|
|
5316
|
+
};
|
|
5317
|
+
continue;
|
|
5318
|
+
}
|
|
5319
|
+
}
|
|
5320
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
5321
|
+
break;
|
|
5322
|
+
}
|
|
5323
|
+
reader.skip(tag & 7);
|
|
5324
|
+
}
|
|
5325
|
+
return message;
|
|
5326
|
+
},
|
|
5327
|
+
|
|
5328
|
+
fromJSON(object: any): Receipt_PositionTakenOrTradedResult {
|
|
5329
|
+
return {
|
|
5330
|
+
marketId: isSet(object.marketId) ? globalThis.Number(object.marketId) : 0,
|
|
5331
|
+
PositionTakenOrTradedKind: isSet(object.taken)
|
|
5332
|
+
? { $case: "taken", value: Receipt_TakenResult.fromJSON(object.taken) }
|
|
5333
|
+
: isSet(object.traded)
|
|
5334
|
+
? { $case: "traded", value: Receipt_PlaceOrderResult.fromJSON(object.traded) }
|
|
5335
|
+
: undefined,
|
|
5336
|
+
};
|
|
5337
|
+
},
|
|
5338
|
+
|
|
5339
|
+
toJSON(message: Receipt_PositionTakenOrTradedResult): unknown {
|
|
5340
|
+
const obj: any = {};
|
|
5341
|
+
if (message.marketId !== 0) {
|
|
5342
|
+
obj.marketId = Math.round(message.marketId);
|
|
5343
|
+
}
|
|
5344
|
+
if (message.PositionTakenOrTradedKind?.$case === "taken") {
|
|
5345
|
+
obj.taken = Receipt_TakenResult.toJSON(message.PositionTakenOrTradedKind.value);
|
|
5346
|
+
} else if (message.PositionTakenOrTradedKind?.$case === "traded") {
|
|
5347
|
+
obj.traded = Receipt_PlaceOrderResult.toJSON(message.PositionTakenOrTradedKind.value);
|
|
5348
|
+
}
|
|
5349
|
+
return obj;
|
|
5350
|
+
},
|
|
5351
|
+
|
|
5352
|
+
create<I extends Exact<DeepPartial<Receipt_PositionTakenOrTradedResult>, I>>(
|
|
5353
|
+
base?: I,
|
|
5354
|
+
): Receipt_PositionTakenOrTradedResult {
|
|
5355
|
+
return Receipt_PositionTakenOrTradedResult.fromPartial(base ?? ({} as any));
|
|
5356
|
+
},
|
|
5357
|
+
fromPartial<I extends Exact<DeepPartial<Receipt_PositionTakenOrTradedResult>, I>>(
|
|
5358
|
+
object: I,
|
|
5359
|
+
): Receipt_PositionTakenOrTradedResult {
|
|
5360
|
+
const message = createBaseReceipt_PositionTakenOrTradedResult();
|
|
5361
|
+
message.marketId = object.marketId ?? 0;
|
|
5362
|
+
switch (object.PositionTakenOrTradedKind?.$case) {
|
|
5363
|
+
case "taken": {
|
|
5364
|
+
if (object.PositionTakenOrTradedKind?.value !== undefined && object.PositionTakenOrTradedKind?.value !== null) {
|
|
5365
|
+
message.PositionTakenOrTradedKind = {
|
|
5366
|
+
$case: "taken",
|
|
5367
|
+
value: Receipt_TakenResult.fromPartial(object.PositionTakenOrTradedKind.value),
|
|
5368
|
+
};
|
|
5369
|
+
}
|
|
5370
|
+
break;
|
|
5371
|
+
}
|
|
5372
|
+
case "traded": {
|
|
5373
|
+
if (object.PositionTakenOrTradedKind?.value !== undefined && object.PositionTakenOrTradedKind?.value !== null) {
|
|
5374
|
+
message.PositionTakenOrTradedKind = {
|
|
5375
|
+
$case: "traded",
|
|
5376
|
+
value: Receipt_PlaceOrderResult.fromPartial(object.PositionTakenOrTradedKind.value),
|
|
5377
|
+
};
|
|
5378
|
+
}
|
|
5379
|
+
break;
|
|
5380
|
+
}
|
|
5381
|
+
}
|
|
5382
|
+
return message;
|
|
5383
|
+
},
|
|
5384
|
+
};
|
|
5385
|
+
|
|
4894
5386
|
function createBaseReceipt_CancelOrderResult(): Receipt_CancelOrderResult {
|
|
4895
5387
|
return { orderId: 0n, accountId: 0 };
|
|
4896
5388
|
}
|