@n1xyz/nord-ts 0.0.14 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/.prettierignore +1 -0
  2. package/README.md +9 -6
  3. package/dist/bridge/client.d.ts +8 -7
  4. package/dist/bridge/client.js +38 -37
  5. package/dist/bridge/index.d.ts +1 -2
  6. package/dist/bridge/index.js +2 -2
  7. package/dist/bridge/types.d.ts +5 -3
  8. package/dist/bridge/types.js +3 -1
  9. package/dist/gen/nord.d.ts +66 -5
  10. package/dist/gen/nord.js +449 -22
  11. package/dist/idl/bridge.json +1493 -0
  12. package/dist/idl/index.d.ts +585 -0
  13. package/dist/idl/index.js +8 -0
  14. package/dist/nord/api/core.js +7 -5
  15. package/dist/nord/api/metrics.js +7 -4
  16. package/dist/nord/client/Nord.d.ts +19 -5
  17. package/dist/nord/client/Nord.js +50 -23
  18. package/dist/nord/client/NordUser.js +4 -7
  19. package/dist/types.d.ts +3 -3
  20. package/docs/assets/hierarchy.js +1 -1
  21. package/docs/assets/navigation.js +1 -1
  22. package/docs/assets/search.js +1 -1
  23. package/docs/classes/Nord.html +99 -100
  24. package/docs/classes/NordError.html +6 -6
  25. package/docs/classes/NordUser.html +48 -53
  26. package/docs/classes/NordWebSocketClient.html +6 -11
  27. package/docs/classes/SolanaBridgeClient.html +23 -23
  28. package/docs/classes/Subscriber.html +3 -3
  29. package/docs/enums/FillMode.html +2 -2
  30. package/docs/enums/KeyType.html +2 -2
  31. package/docs/enums/MetricPeriod.html +2 -2
  32. package/docs/enums/PdaSeedType.html +2 -2
  33. package/docs/enums/PeakTpsPeriodUnit.html +2 -2
  34. package/docs/enums/Side.html +2 -2
  35. package/docs/enums/WebSocketMessageType.html +3 -3
  36. package/docs/functions/actionQueryRollman.html +1 -1
  37. package/docs/functions/actionsQueryRollman.html +1 -1
  38. package/docs/functions/aggregateMetrics-1.html +1 -1
  39. package/docs/functions/assert.html +1 -1
  40. package/docs/functions/bigIntToProtoU128.html +1 -1
  41. package/docs/functions/bridgeToBN.html +1 -1
  42. package/docs/functions/bufferToHex.html +1 -1
  43. package/docs/functions/cancelOrder.html +1 -1
  44. package/docs/functions/checkPubKeyLength.html +1 -1
  45. package/docs/functions/checkedFetch.html +1 -1
  46. package/docs/functions/createSession.html +1 -1
  47. package/docs/functions/decodeLengthDelimited.html +1 -1
  48. package/docs/functions/encodeLengthDelimited.html +1 -1
  49. package/docs/functions/fillModeToProtoFillMode.html +1 -1
  50. package/docs/functions/findMarket.html +1 -1
  51. package/docs/functions/findPda.html +1 -1
  52. package/docs/functions/findToken.html +1 -1
  53. package/docs/functions/fromBN.html +1 -1
  54. package/docs/functions/getAccount.html +1 -1
  55. package/docs/functions/getActionNonce.html +1 -1
  56. package/docs/functions/getCurrentTps.html +1 -1
  57. package/docs/functions/getInfo.html +1 -1
  58. package/docs/functions/{queryLastNBlocks.html → getLastActionId.html} +3 -3
  59. package/docs/functions/getMedianLatency.html +1 -1
  60. package/docs/functions/getOrderbook.html +1 -1
  61. package/docs/functions/getPeakTps.html +1 -1
  62. package/docs/functions/getTimestamp.html +1 -1
  63. package/docs/functions/getTotalTransactions.html +1 -1
  64. package/docs/functions/getTrades.html +1 -1
  65. package/docs/functions/getUserAccountIds.html +1 -1
  66. package/docs/functions/hexToBuffer.html +1 -1
  67. package/docs/functions/initWebSocketClient.html +9 -9
  68. package/docs/functions/keypairFromPrivateKey.html +1 -1
  69. package/docs/functions/makeSigningFunction.html +1 -1
  70. package/docs/functions/makeWalletSignFn.html +1 -1
  71. package/docs/functions/marketsStats.html +1 -1
  72. package/docs/functions/optExpect.html +1 -1
  73. package/docs/functions/optMap.html +1 -1
  74. package/docs/functions/optUnwrap.html +1 -1
  75. package/docs/functions/panic.html +1 -1
  76. package/docs/functions/placeOrder.html +1 -1
  77. package/docs/functions/queryAction.html +1 -1
  78. package/docs/functions/queryPrometheus.html +1 -1
  79. package/docs/functions/queryRecentActions.html +4 -3
  80. package/docs/functions/revokeSession.html +1 -1
  81. package/docs/functions/shortenPublicKey.html +1 -1
  82. package/docs/functions/signAction.html +1 -1
  83. package/docs/functions/toBN.html +1 -1
  84. package/docs/functions/toScaledU128.html +1 -1
  85. package/docs/functions/toScaledU64.html +1 -1
  86. package/docs/functions/transfer.html +1 -1
  87. package/docs/functions/withdraw.html +1 -1
  88. package/docs/hierarchy.html +1 -1
  89. package/docs/index.html +2 -2
  90. package/docs/interfaces/Account.html +2 -2
  91. package/docs/interfaces/ActionInfo.html +2 -2
  92. package/docs/interfaces/ActionNonceResponse.html +2 -2
  93. package/docs/interfaces/ActionQuery.html +2 -2
  94. package/docs/interfaces/ActionResponse.html +2 -2
  95. package/docs/interfaces/ActionsExtendedInfo.html +2 -2
  96. package/docs/interfaces/ActionsQuery.html +2 -2
  97. package/docs/interfaces/ActionsResponse.html +2 -2
  98. package/docs/interfaces/AggregateMetrics.html +2 -2
  99. package/docs/interfaces/BlockFacts.html +5 -5
  100. package/docs/interfaces/BlockQuery.html +2 -2
  101. package/docs/interfaces/BlockResponse.html +2 -2
  102. package/docs/interfaces/BlockSummary.html +2 -2
  103. package/docs/interfaces/BlockSummaryResponse.html +2 -2
  104. package/docs/interfaces/DeltaEvent.html +2 -2
  105. package/docs/interfaces/DepositSplParams.html +5 -5
  106. package/docs/interfaces/Info.html +2 -2
  107. package/docs/interfaces/Market.html +2 -2
  108. package/docs/interfaces/MarketStats.html +2 -2
  109. package/docs/interfaces/MarketsStatsResponse.html +2 -2
  110. package/docs/interfaces/NordConfig.html +19 -9
  111. package/docs/interfaces/NordWebSocketClientEvents.html +2 -2
  112. package/docs/interfaces/NordWebSocketEvents.html +3 -3
  113. package/docs/interfaces/Order.html +2 -2
  114. package/docs/interfaces/OrderInfo.html +2 -2
  115. package/docs/interfaces/OrderbookEntry.html +2 -2
  116. package/docs/interfaces/OrderbookQuery.html +2 -2
  117. package/docs/interfaces/OrderbookResponse.html +2 -2
  118. package/docs/interfaces/OrderbookSubscription.html +5 -5
  119. package/docs/interfaces/PerpMarketStats.html +2 -2
  120. package/docs/interfaces/RollmanActionExtendedInfo.html +2 -2
  121. package/docs/interfaces/RollmanActionInfo.html +2 -2
  122. package/docs/interfaces/RollmanActionResponse.html +2 -2
  123. package/docs/interfaces/RollmanActionsResponse.html +2 -2
  124. package/docs/interfaces/RollmanBlockResponse.html +2 -2
  125. package/docs/interfaces/SPLTokenInfo.html +5 -5
  126. package/docs/interfaces/SolanaBridgeConfig.html +5 -5
  127. package/docs/interfaces/StateFacts.html +5 -5
  128. package/docs/interfaces/SubscriberConfig.html +2 -2
  129. package/docs/interfaces/TimestampResponse.html +2 -2
  130. package/docs/interfaces/Token.html +2 -2
  131. package/docs/interfaces/TokenInfo.html +3 -2
  132. package/docs/interfaces/Trade.html +2 -2
  133. package/docs/interfaces/TradeSubscription.html +5 -5
  134. package/docs/interfaces/Trades.html +2 -2
  135. package/docs/interfaces/TradesQuery.html +2 -2
  136. package/docs/interfaces/TradesResponse.html +2 -2
  137. package/docs/interfaces/TransferParams.html +4 -4
  138. package/docs/interfaces/UserAccountIdsQuery.html +2 -2
  139. package/docs/interfaces/UserAccountIdsResponse.html +2 -2
  140. package/docs/interfaces/WebSocketAccountUpdate.html +6 -0
  141. package/docs/interfaces/WebSocketDeltaUpdate.html +3 -3
  142. package/docs/interfaces/WebSocketSubscription.html +3 -3
  143. package/docs/interfaces/WebSocketTradeUpdate.html +3 -3
  144. package/docs/interfaces/WithdrawalClaim.html +7 -7
  145. package/docs/interfaces/WithdrawalParams.html +4 -4
  146. package/docs/modules.html +1 -1
  147. package/docs/types/BigIntValue.html +1 -1
  148. package/docs/types/SubscriptionPattern.html +4 -0
  149. package/docs/types/SubscriptionType.html +2 -0
  150. package/docs/types/WebSocketMessage.html +1 -1
  151. package/docs/variables/DEBUG_KEYS.html +1 -1
  152. package/docs/variables/DEFAULT_FUNDING_AMOUNTS.html +1 -1
  153. package/docs/variables/DEV_TOKEN_INFOS.html +1 -1
  154. package/docs/variables/DEV_URL.html +1 -1
  155. package/docs/variables/MAX_BUFFER_LEN.html +1 -1
  156. package/docs/variables/SESSION_TTL.html +1 -1
  157. package/docs/variables/WEBSERVER_DEV_URL.html +1 -1
  158. package/docs/variables/ZERO_DECIMAL.html +1 -1
  159. package/docs/variables/_private.html +1 -1
  160. package/idl-generate.sh +4 -0
  161. package/package.json +4 -3
  162. package/src/bridge/client.ts +54 -43
  163. package/src/bridge/index.ts +1 -2
  164. package/src/bridge/types.ts +5 -3
  165. package/src/gen/nord.ts +518 -19
  166. package/src/idl/bridge.json +1493 -0
  167. package/src/idl/index.ts +2 -0
  168. package/src/nord/api/core.ts +1 -3
  169. package/src/nord/api/metrics.ts +2 -0
  170. package/src/nord/client/Nord.ts +49 -13
  171. package/src/nord/client/NordUser.ts +32 -49
  172. package/src/types.ts +2 -2
  173. package/docs/functions/blockQueryRollman.html +0 -6
  174. package/docs/functions/blockSummaryQueryRollman.html +0 -6
  175. package/docs/functions/queryBlock.html +0 -6
  176. package/docs/functions/queryRecentBlocks.html +0 -6
  177. package/docs/interfaces/WebSocketUserUpdate.html +0 -6
  178. package/src/idl/bridge.ts +0 -929
package/src/gen/nord.ts CHANGED
@@ -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
- /** UNINITIALIZED_PRICES - TODO(deprecate) */
174
- UNINITIALIZED_PRICES = 98,
173
+ PYTH_FEED_DECIMALS_OUT_OF_RANGE = 98,
175
174
  PYTH_FEED_PRICE_OUT_OF_RANGE = 99,
176
- INVALID_TOKEN_PARAMETERS = 100,
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
@@ -251,6 +250,11 @@ export enum Error {
251
250
  * Reduce orders can only be post only.
252
251
  */
253
252
  ORDER_REDUCE_IS_POST_ONLY = 158,
253
+ /**
254
+ * ORDER_EXECUTION_SELL_PRICE - 10011_111;
255
+ * Order was rejected, because it planned under proposed price
256
+ */
257
+ ORDER_EXECUTION_SELL_PRICE = 159,
254
258
  /** BALANCE - 10100_000 */
255
259
  BALANCE = 160,
256
260
  /** BALANCE_DEPOSIT_OVERFLOW - 10100_001 */
@@ -285,6 +289,7 @@ export enum Error {
285
289
  * Binary pattern: 10101_001
286
290
  */
287
291
  TRIGGER_INVALID_PRICE = 169,
292
+ TRIGGER_NOT_FOUND = 170,
288
293
  /** TIMESTAMP - 10110_000 */
289
294
  TIMESTAMP = 176,
290
295
  /** TIMESTAMP_OUT_OF_THRESHOLD - 10110_001 */
@@ -307,11 +312,18 @@ export enum Error {
307
312
  MARKET_FROZEN = 193,
308
313
  /** POSITION - 11001_000 */
309
314
  POSITION = 200,
315
+ /** POSITION_NOT_FOUND - Position not found for specific entity in specific market */
316
+ POSITION_NOT_FOUND = 201,
310
317
  POSITION_STATE_ORDER = 202,
311
318
  POSITION_STATE_ORDER_PRICE = 203,
312
319
  POSITION_STATE_ORDER_SIZE = 204,
313
320
  POSITION_STATE_ORDER_SIDE = 205,
314
321
  POSITION_SIZE_LIMIT = 206,
322
+ PRICE = 209,
323
+ SIGNATURE_VERIFICATION = 217,
324
+ SIGNATURE_VERIFICATION_MALFORMED_PUBLIC_KEY = 218,
325
+ SIGNATURE_VERIFICATION_INVALID_LENGTH = 219,
326
+ NOT_IMPLEMENTED = 500,
315
327
  Dropped = 999,
316
328
  }
317
329
 
@@ -387,12 +399,18 @@ export function errorFromJSON(object: any): Error {
387
399
  case "PYTH_GUARDIAN_SET_INVALID":
388
400
  return Error.PYTH_GUARDIAN_SET_INVALID;
389
401
  case 98:
390
- case "UNINITIALIZED_PRICES":
391
- return Error.UNINITIALIZED_PRICES;
402
+ case "PYTH_FEED_DECIMALS_OUT_OF_RANGE":
403
+ return Error.PYTH_FEED_DECIMALS_OUT_OF_RANGE;
392
404
  case 99:
393
405
  case "PYTH_FEED_PRICE_OUT_OF_RANGE":
394
406
  return Error.PYTH_FEED_PRICE_OUT_OF_RANGE;
395
407
  case 100:
408
+ case "PYTH_FEED_VARIANCE_OUT_OF_RANGE":
409
+ return Error.PYTH_FEED_VARIANCE_OUT_OF_RANGE;
410
+ case 126:
411
+ case "PYTH_GUARDIAN_SET_AND_PYTH_SIGNATURE_DO_NOT_MATCH":
412
+ return Error.PYTH_GUARDIAN_SET_AND_PYTH_SIGNATURE_DO_NOT_MATCH;
413
+ case 101:
396
414
  case "INVALID_TOKEN_PARAMETERS":
397
415
  return Error.INVALID_TOKEN_PARAMETERS;
398
416
  case 103:
@@ -422,15 +440,9 @@ export function errorFromJSON(object: any): Error {
422
440
  case 124:
423
441
  case "CAN_REDUCE_POSITION_ONLY_IF_ALL_ORDERS_ARE_CANCELED":
424
442
  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
443
  case 127:
429
444
  case "UNEXPECTED_TOKEN_ID":
430
445
  return Error.UNEXPECTED_TOKEN_ID;
431
- case 128:
432
- case "SIGNATURE_VERIFICATION":
433
- return Error.SIGNATURE_VERIFICATION;
434
446
  case 130:
435
447
  case "TOKEN_NOT_READY":
436
448
  return Error.TOKEN_NOT_READY;
@@ -500,6 +512,9 @@ export function errorFromJSON(object: any): Error {
500
512
  case 158:
501
513
  case "ORDER_REDUCE_IS_POST_ONLY":
502
514
  return Error.ORDER_REDUCE_IS_POST_ONLY;
515
+ case 159:
516
+ case "ORDER_EXECUTION_SELL_PRICE":
517
+ return Error.ORDER_EXECUTION_SELL_PRICE;
503
518
  case 160:
504
519
  case "BALANCE":
505
520
  return Error.BALANCE;
@@ -527,6 +542,9 @@ export function errorFromJSON(object: any): Error {
527
542
  case 169:
528
543
  case "TRIGGER_INVALID_PRICE":
529
544
  return Error.TRIGGER_INVALID_PRICE;
545
+ case 170:
546
+ case "TRIGGER_NOT_FOUND":
547
+ return Error.TRIGGER_NOT_FOUND;
530
548
  case 176:
531
549
  case "TIMESTAMP":
532
550
  return Error.TIMESTAMP;
@@ -554,6 +572,9 @@ export function errorFromJSON(object: any): Error {
554
572
  case 200:
555
573
  case "POSITION":
556
574
  return Error.POSITION;
575
+ case 201:
576
+ case "POSITION_NOT_FOUND":
577
+ return Error.POSITION_NOT_FOUND;
557
578
  case 202:
558
579
  case "POSITION_STATE_ORDER":
559
580
  return Error.POSITION_STATE_ORDER;
@@ -569,6 +590,21 @@ export function errorFromJSON(object: any): Error {
569
590
  case 206:
570
591
  case "POSITION_SIZE_LIMIT":
571
592
  return Error.POSITION_SIZE_LIMIT;
593
+ case 209:
594
+ case "PRICE":
595
+ return Error.PRICE;
596
+ case 217:
597
+ case "SIGNATURE_VERIFICATION":
598
+ return Error.SIGNATURE_VERIFICATION;
599
+ case 218:
600
+ case "SIGNATURE_VERIFICATION_MALFORMED_PUBLIC_KEY":
601
+ return Error.SIGNATURE_VERIFICATION_MALFORMED_PUBLIC_KEY;
602
+ case 219:
603
+ case "SIGNATURE_VERIFICATION_INVALID_LENGTH":
604
+ return Error.SIGNATURE_VERIFICATION_INVALID_LENGTH;
605
+ case 500:
606
+ case "NOT_IMPLEMENTED":
607
+ return Error.NOT_IMPLEMENTED;
572
608
  case 999:
573
609
  case "Dropped":
574
610
  return Error.Dropped;
@@ -625,10 +661,14 @@ export function errorToJSON(object: Error): string {
625
661
  return "PYTH_GUARDIAN_SET_UNINITIALIZED";
626
662
  case Error.PYTH_GUARDIAN_SET_INVALID:
627
663
  return "PYTH_GUARDIAN_SET_INVALID";
628
- case Error.UNINITIALIZED_PRICES:
629
- return "UNINITIALIZED_PRICES";
664
+ case Error.PYTH_FEED_DECIMALS_OUT_OF_RANGE:
665
+ return "PYTH_FEED_DECIMALS_OUT_OF_RANGE";
630
666
  case Error.PYTH_FEED_PRICE_OUT_OF_RANGE:
631
667
  return "PYTH_FEED_PRICE_OUT_OF_RANGE";
668
+ case Error.PYTH_FEED_VARIANCE_OUT_OF_RANGE:
669
+ return "PYTH_FEED_VARIANCE_OUT_OF_RANGE";
670
+ case Error.PYTH_GUARDIAN_SET_AND_PYTH_SIGNATURE_DO_NOT_MATCH:
671
+ return "PYTH_GUARDIAN_SET_AND_PYTH_SIGNATURE_DO_NOT_MATCH";
632
672
  case Error.INVALID_TOKEN_PARAMETERS:
633
673
  return "INVALID_TOKEN_PARAMETERS";
634
674
  case Error.INDEX_PRICE_OUT_OF_RANGE:
@@ -649,12 +689,8 @@ export function errorToJSON(object: Error): string {
649
689
  return "FUNDING_OVERFLOW";
650
690
  case Error.CAN_REDUCE_POSITION_ONLY_IF_ALL_ORDERS_ARE_CANCELED:
651
691
  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
692
  case Error.UNEXPECTED_TOKEN_ID:
655
693
  return "UNEXPECTED_TOKEN_ID";
656
- case Error.SIGNATURE_VERIFICATION:
657
- return "SIGNATURE_VERIFICATION";
658
694
  case Error.TOKEN_NOT_READY:
659
695
  return "TOKEN_NOT_READY";
660
696
  case Error.TOKEN_ALREADY_REGISTERED:
@@ -701,6 +737,8 @@ export function errorToJSON(object: Error): string {
701
737
  return "ORDER_EXECUTION_SIZE_LIMIT";
702
738
  case Error.ORDER_REDUCE_IS_POST_ONLY:
703
739
  return "ORDER_REDUCE_IS_POST_ONLY";
740
+ case Error.ORDER_EXECUTION_SELL_PRICE:
741
+ return "ORDER_EXECUTION_SELL_PRICE";
704
742
  case Error.BALANCE:
705
743
  return "BALANCE";
706
744
  case Error.BALANCE_DEPOSIT_OVERFLOW:
@@ -719,6 +757,8 @@ export function errorToJSON(object: Error): string {
719
757
  return "TRIGGER";
720
758
  case Error.TRIGGER_INVALID_PRICE:
721
759
  return "TRIGGER_INVALID_PRICE";
760
+ case Error.TRIGGER_NOT_FOUND:
761
+ return "TRIGGER_NOT_FOUND";
722
762
  case Error.TIMESTAMP:
723
763
  return "TIMESTAMP";
724
764
  case Error.TIMESTAMP_OUT_OF_THRESHOLD:
@@ -737,6 +777,8 @@ export function errorToJSON(object: Error): string {
737
777
  return "MARKET_FROZEN";
738
778
  case Error.POSITION:
739
779
  return "POSITION";
780
+ case Error.POSITION_NOT_FOUND:
781
+ return "POSITION_NOT_FOUND";
740
782
  case Error.POSITION_STATE_ORDER:
741
783
  return "POSITION_STATE_ORDER";
742
784
  case Error.POSITION_STATE_ORDER_PRICE:
@@ -747,6 +789,16 @@ export function errorToJSON(object: Error): string {
747
789
  return "POSITION_STATE_ORDER_SIDE";
748
790
  case Error.POSITION_SIZE_LIMIT:
749
791
  return "POSITION_SIZE_LIMIT";
792
+ case Error.PRICE:
793
+ return "PRICE";
794
+ case Error.SIGNATURE_VERIFICATION:
795
+ return "SIGNATURE_VERIFICATION";
796
+ case Error.SIGNATURE_VERIFICATION_MALFORMED_PUBLIC_KEY:
797
+ return "SIGNATURE_VERIFICATION_MALFORMED_PUBLIC_KEY";
798
+ case Error.SIGNATURE_VERIFICATION_INVALID_LENGTH:
799
+ return "SIGNATURE_VERIFICATION_INVALID_LENGTH";
800
+ case Error.NOT_IMPLEMENTED:
801
+ return "NOT_IMPLEMENTED";
750
802
  case Error.Dropped:
751
803
  return "Dropped";
752
804
  default:
@@ -840,6 +892,7 @@ export interface Action {
840
892
  | { $case: "message"; value: Message }
841
893
  | { $case: "addTrigger"; value: Action_AddTrigger }
842
894
  | { $case: "removeTrigger"; value: Action_RemoveTrigger }
895
+ | { $case: "takePosition"; value: Action_TakePosition }
843
896
  | undefined;
844
897
  }
845
898
 
@@ -971,6 +1024,10 @@ export interface Action_PlaceOrder {
971
1024
  * Optional account on behalf of whom the order should be placed.
972
1025
  * Executed only if sender has delegated authority to do so,
973
1026
  * like admin user or liquidator bot.
1027
+ * # Delegation allowed if:
1028
+ * - trigger
1029
+ * - reduce bad position
1030
+ * - sell at good price to reduce if cannot cover bad position
974
1031
  */
975
1032
  delegatorAccountId?:
976
1033
  | number
@@ -1097,6 +1154,28 @@ export interface Action_RemoveTrigger {
1097
1154
  accountId?: number | undefined;
1098
1155
  }
1099
1156
 
1157
+ export interface Action_TakePosition {
1158
+ sessionId: bigint;
1159
+ marketId: number;
1160
+ /** Amount to take. */
1161
+ size: bigint;
1162
+ /**
1163
+ * Account id which performs operation;
1164
+ * if not specified, first account of session's owner user is picked
1165
+ */
1166
+ senderAccountId?:
1167
+ | number
1168
+ | undefined;
1169
+ /**
1170
+ * If set, then it is take action.
1171
+ * If price not so good as in field, take will fail.
1172
+ *
1173
+ * If not set,
1174
+ * will do fill-or-kill order as per liquidation trade rule.
1175
+ */
1176
+ price?: bigint | undefined;
1177
+ }
1178
+
1100
1179
  export interface Receipt {
1101
1180
  /**
1102
1181
  * Action id which was run to produce this receipt.
@@ -1123,6 +1202,7 @@ export interface Receipt {
1123
1202
  | { $case: "transferred"; value: Receipt_Transferred }
1124
1203
  | { $case: "triggerAdded"; value: Receipt_TriggerAdded }
1125
1204
  | { $case: "triggerRemoved"; value: Receipt_TriggerRemoved }
1205
+ | { $case: "positionTakenOrTraded"; value: Receipt_PositionTakenOrTradedResult }
1126
1206
  | undefined;
1127
1207
  }
1128
1208
 
@@ -1153,6 +1233,19 @@ export interface Receipt_PlaceOrderResult {
1153
1233
  clientOrderId?: bigint | undefined;
1154
1234
  }
1155
1235
 
1236
+ export interface Receipt_TakenResult {
1237
+ pnl: bigint;
1238
+ size: bigint;
1239
+ takerAccountId: number;
1240
+ }
1241
+
1242
+ export interface Receipt_PositionTakenOrTradedResult {
1243
+ marketId: number;
1244
+ PositionTakenOrTradedKind?: { $case: "taken"; value: Receipt_TakenResult } | //
1245
+ /** non empty if trade immediately */
1246
+ { $case: "traded"; value: Receipt_PlaceOrderResult } | undefined;
1247
+ }
1248
+
1156
1249
  export interface Receipt_CancelOrderResult {
1157
1250
  orderId: bigint;
1158
1251
  /** Account from which order was cancelled */
@@ -1693,6 +1786,9 @@ export const Action: MessageFns<Action> = {
1693
1786
  case "removeTrigger":
1694
1787
  Action_RemoveTrigger.encode(message.kind.value, writer.uint32(266).fork()).join();
1695
1788
  break;
1789
+ case "takePosition":
1790
+ Action_TakePosition.encode(message.kind.value, writer.uint32(274).fork()).join();
1791
+ break;
1696
1792
  }
1697
1793
  return writer;
1698
1794
  },
@@ -1873,6 +1969,14 @@ export const Action: MessageFns<Action> = {
1873
1969
  message.kind = { $case: "removeTrigger", value: Action_RemoveTrigger.decode(reader, reader.uint32()) };
1874
1970
  continue;
1875
1971
  }
1972
+ case 34: {
1973
+ if (tag !== 274) {
1974
+ break;
1975
+ }
1976
+
1977
+ message.kind = { $case: "takePosition", value: Action_TakePosition.decode(reader, reader.uint32()) };
1978
+ continue;
1979
+ }
1876
1980
  }
1877
1981
  if ((tag & 7) === 4 || tag === 0) {
1878
1982
  break;
@@ -1925,6 +2029,8 @@ export const Action: MessageFns<Action> = {
1925
2029
  ? { $case: "addTrigger", value: Action_AddTrigger.fromJSON(object.addTrigger) }
1926
2030
  : isSet(object.removeTrigger)
1927
2031
  ? { $case: "removeTrigger", value: Action_RemoveTrigger.fromJSON(object.removeTrigger) }
2032
+ : isSet(object.takePosition)
2033
+ ? { $case: "takePosition", value: Action_TakePosition.fromJSON(object.takePosition) }
1928
2034
  : undefined,
1929
2035
  };
1930
2036
  },
@@ -1973,6 +2079,8 @@ export const Action: MessageFns<Action> = {
1973
2079
  obj.addTrigger = Action_AddTrigger.toJSON(message.kind.value);
1974
2080
  } else if (message.kind?.$case === "removeTrigger") {
1975
2081
  obj.removeTrigger = Action_RemoveTrigger.toJSON(message.kind.value);
2082
+ } else if (message.kind?.$case === "takePosition") {
2083
+ obj.takePosition = Action_TakePosition.toJSON(message.kind.value);
1976
2084
  }
1977
2085
  return obj;
1978
2086
  },
@@ -2099,6 +2207,12 @@ export const Action: MessageFns<Action> = {
2099
2207
  }
2100
2208
  break;
2101
2209
  }
2210
+ case "takePosition": {
2211
+ if (object.kind?.value !== undefined && object.kind?.value !== null) {
2212
+ message.kind = { $case: "takePosition", value: Action_TakePosition.fromPartial(object.kind.value) };
2213
+ }
2214
+ break;
2215
+ }
2102
2216
  }
2103
2217
  return message;
2104
2218
  },
@@ -3972,6 +4086,139 @@ export const Action_RemoveTrigger: MessageFns<Action_RemoveTrigger> = {
3972
4086
  },
3973
4087
  };
3974
4088
 
4089
+ function createBaseAction_TakePosition(): Action_TakePosition {
4090
+ return { sessionId: 0n, marketId: 0, size: 0n, senderAccountId: undefined, price: undefined };
4091
+ }
4092
+
4093
+ export const Action_TakePosition: MessageFns<Action_TakePosition> = {
4094
+ encode(message: Action_TakePosition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
4095
+ if (message.sessionId !== 0n) {
4096
+ if (BigInt.asUintN(64, message.sessionId) !== message.sessionId) {
4097
+ throw new globalThis.Error("value provided for field message.sessionId of type uint64 too large");
4098
+ }
4099
+ writer.uint32(8).uint64(message.sessionId);
4100
+ }
4101
+ if (message.marketId !== 0) {
4102
+ writer.uint32(16).uint32(message.marketId);
4103
+ }
4104
+ if (message.size !== 0n) {
4105
+ if (BigInt.asIntN(64, message.size) !== message.size) {
4106
+ throw new globalThis.Error("value provided for field message.size of type int64 too large");
4107
+ }
4108
+ writer.uint32(24).int64(message.size);
4109
+ }
4110
+ if (message.senderAccountId !== undefined) {
4111
+ writer.uint32(32).uint32(message.senderAccountId);
4112
+ }
4113
+ if (message.price !== undefined) {
4114
+ if (BigInt.asUintN(64, message.price) !== message.price) {
4115
+ throw new globalThis.Error("value provided for field message.price of type uint64 too large");
4116
+ }
4117
+ writer.uint32(40).uint64(message.price);
4118
+ }
4119
+ return writer;
4120
+ },
4121
+
4122
+ decode(input: BinaryReader | Uint8Array, length?: number): Action_TakePosition {
4123
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
4124
+ let end = length === undefined ? reader.len : reader.pos + length;
4125
+ const message = createBaseAction_TakePosition();
4126
+ while (reader.pos < end) {
4127
+ const tag = reader.uint32();
4128
+ switch (tag >>> 3) {
4129
+ case 1: {
4130
+ if (tag !== 8) {
4131
+ break;
4132
+ }
4133
+
4134
+ message.sessionId = reader.uint64() as bigint;
4135
+ continue;
4136
+ }
4137
+ case 2: {
4138
+ if (tag !== 16) {
4139
+ break;
4140
+ }
4141
+
4142
+ message.marketId = reader.uint32();
4143
+ continue;
4144
+ }
4145
+ case 3: {
4146
+ if (tag !== 24) {
4147
+ break;
4148
+ }
4149
+
4150
+ message.size = reader.int64() as bigint;
4151
+ continue;
4152
+ }
4153
+ case 4: {
4154
+ if (tag !== 32) {
4155
+ break;
4156
+ }
4157
+
4158
+ message.senderAccountId = reader.uint32();
4159
+ continue;
4160
+ }
4161
+ case 5: {
4162
+ if (tag !== 40) {
4163
+ break;
4164
+ }
4165
+
4166
+ message.price = reader.uint64() as bigint;
4167
+ continue;
4168
+ }
4169
+ }
4170
+ if ((tag & 7) === 4 || tag === 0) {
4171
+ break;
4172
+ }
4173
+ reader.skip(tag & 7);
4174
+ }
4175
+ return message;
4176
+ },
4177
+
4178
+ fromJSON(object: any): Action_TakePosition {
4179
+ return {
4180
+ sessionId: isSet(object.sessionId) ? BigInt(object.sessionId) : 0n,
4181
+ marketId: isSet(object.marketId) ? globalThis.Number(object.marketId) : 0,
4182
+ size: isSet(object.size) ? BigInt(object.size) : 0n,
4183
+ senderAccountId: isSet(object.senderAccountId) ? globalThis.Number(object.senderAccountId) : undefined,
4184
+ price: isSet(object.price) ? BigInt(object.price) : undefined,
4185
+ };
4186
+ },
4187
+
4188
+ toJSON(message: Action_TakePosition): unknown {
4189
+ const obj: any = {};
4190
+ if (message.sessionId !== 0n) {
4191
+ obj.sessionId = message.sessionId.toString();
4192
+ }
4193
+ if (message.marketId !== 0) {
4194
+ obj.marketId = Math.round(message.marketId);
4195
+ }
4196
+ if (message.size !== 0n) {
4197
+ obj.size = message.size.toString();
4198
+ }
4199
+ if (message.senderAccountId !== undefined) {
4200
+ obj.senderAccountId = Math.round(message.senderAccountId);
4201
+ }
4202
+ if (message.price !== undefined) {
4203
+ obj.price = message.price.toString();
4204
+ }
4205
+ return obj;
4206
+ },
4207
+
4208
+ create<I extends Exact<DeepPartial<Action_TakePosition>, I>>(base?: I): Action_TakePosition {
4209
+ return Action_TakePosition.fromPartial(base ?? ({} as any));
4210
+ },
4211
+ fromPartial<I extends Exact<DeepPartial<Action_TakePosition>, I>>(object: I): Action_TakePosition {
4212
+ const message = createBaseAction_TakePosition();
4213
+ message.sessionId = object.sessionId ?? 0n;
4214
+ message.marketId = object.marketId ?? 0;
4215
+ message.size = object.size ?? 0n;
4216
+ message.senderAccountId = object.senderAccountId ?? undefined;
4217
+ message.price = object.price ?? undefined;
4218
+ return message;
4219
+ },
4220
+ };
4221
+
3975
4222
  function createBaseReceipt(): Receipt {
3976
4223
  return { actionId: 0n, kind: undefined };
3977
4224
  }
@@ -4039,6 +4286,9 @@ export const Receipt: MessageFns<Receipt> = {
4039
4286
  case "triggerRemoved":
4040
4287
  Receipt_TriggerRemoved.encode(message.kind.value, writer.uint32(522).fork()).join();
4041
4288
  break;
4289
+ case "positionTakenOrTraded":
4290
+ Receipt_PositionTakenOrTradedResult.encode(message.kind.value, writer.uint32(530).fork()).join();
4291
+ break;
4042
4292
  }
4043
4293
  return writer;
4044
4294
  },
@@ -4223,6 +4473,17 @@ export const Receipt: MessageFns<Receipt> = {
4223
4473
  message.kind = { $case: "triggerRemoved", value: Receipt_TriggerRemoved.decode(reader, reader.uint32()) };
4224
4474
  continue;
4225
4475
  }
4476
+ case 66: {
4477
+ if (tag !== 530) {
4478
+ break;
4479
+ }
4480
+
4481
+ message.kind = {
4482
+ $case: "positionTakenOrTraded",
4483
+ value: Receipt_PositionTakenOrTradedResult.decode(reader, reader.uint32()),
4484
+ };
4485
+ continue;
4486
+ }
4226
4487
  }
4227
4488
  if ((tag & 7) === 4 || tag === 0) {
4228
4489
  break;
@@ -4277,6 +4538,11 @@ export const Receipt: MessageFns<Receipt> = {
4277
4538
  ? { $case: "triggerAdded", value: Receipt_TriggerAdded.fromJSON(object.triggerAdded) }
4278
4539
  : isSet(object.triggerRemoved)
4279
4540
  ? { $case: "triggerRemoved", value: Receipt_TriggerRemoved.fromJSON(object.triggerRemoved) }
4541
+ : isSet(object.positionTakenOrTraded)
4542
+ ? {
4543
+ $case: "positionTakenOrTraded",
4544
+ value: Receipt_PositionTakenOrTradedResult.fromJSON(object.positionTakenOrTraded),
4545
+ }
4280
4546
  : undefined,
4281
4547
  };
4282
4548
  },
@@ -4322,6 +4588,8 @@ export const Receipt: MessageFns<Receipt> = {
4322
4588
  obj.triggerAdded = Receipt_TriggerAdded.toJSON(message.kind.value);
4323
4589
  } else if (message.kind?.$case === "triggerRemoved") {
4324
4590
  obj.triggerRemoved = Receipt_TriggerRemoved.toJSON(message.kind.value);
4591
+ } else if (message.kind?.$case === "positionTakenOrTraded") {
4592
+ obj.positionTakenOrTraded = Receipt_PositionTakenOrTradedResult.toJSON(message.kind.value);
4325
4593
  }
4326
4594
  return obj;
4327
4595
  },
@@ -4462,6 +4730,15 @@ export const Receipt: MessageFns<Receipt> = {
4462
4730
  }
4463
4731
  break;
4464
4732
  }
4733
+ case "positionTakenOrTraded": {
4734
+ if (object.kind?.value !== undefined && object.kind?.value !== null) {
4735
+ message.kind = {
4736
+ $case: "positionTakenOrTraded",
4737
+ value: Receipt_PositionTakenOrTradedResult.fromPartial(object.kind.value),
4738
+ };
4739
+ }
4740
+ break;
4741
+ }
4465
4742
  }
4466
4743
  return message;
4467
4744
  },
@@ -4891,6 +5168,228 @@ export const Receipt_PlaceOrderResult: MessageFns<Receipt_PlaceOrderResult> = {
4891
5168
  },
4892
5169
  };
4893
5170
 
5171
+ function createBaseReceipt_TakenResult(): Receipt_TakenResult {
5172
+ return { pnl: 0n, size: 0n, takerAccountId: 0 };
5173
+ }
5174
+
5175
+ export const Receipt_TakenResult: MessageFns<Receipt_TakenResult> = {
5176
+ encode(message: Receipt_TakenResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
5177
+ if (message.pnl !== 0n) {
5178
+ if (BigInt.asIntN(64, message.pnl) !== message.pnl) {
5179
+ throw new globalThis.Error("value provided for field message.pnl of type int64 too large");
5180
+ }
5181
+ writer.uint32(8).int64(message.pnl);
5182
+ }
5183
+ if (message.size !== 0n) {
5184
+ if (BigInt.asIntN(64, message.size) !== message.size) {
5185
+ throw new globalThis.Error("value provided for field message.size of type int64 too large");
5186
+ }
5187
+ writer.uint32(16).int64(message.size);
5188
+ }
5189
+ if (message.takerAccountId !== 0) {
5190
+ writer.uint32(24).uint32(message.takerAccountId);
5191
+ }
5192
+ return writer;
5193
+ },
5194
+
5195
+ decode(input: BinaryReader | Uint8Array, length?: number): Receipt_TakenResult {
5196
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
5197
+ let end = length === undefined ? reader.len : reader.pos + length;
5198
+ const message = createBaseReceipt_TakenResult();
5199
+ while (reader.pos < end) {
5200
+ const tag = reader.uint32();
5201
+ switch (tag >>> 3) {
5202
+ case 1: {
5203
+ if (tag !== 8) {
5204
+ break;
5205
+ }
5206
+
5207
+ message.pnl = reader.int64() as bigint;
5208
+ continue;
5209
+ }
5210
+ case 2: {
5211
+ if (tag !== 16) {
5212
+ break;
5213
+ }
5214
+
5215
+ message.size = reader.int64() as bigint;
5216
+ continue;
5217
+ }
5218
+ case 3: {
5219
+ if (tag !== 24) {
5220
+ break;
5221
+ }
5222
+
5223
+ message.takerAccountId = reader.uint32();
5224
+ continue;
5225
+ }
5226
+ }
5227
+ if ((tag & 7) === 4 || tag === 0) {
5228
+ break;
5229
+ }
5230
+ reader.skip(tag & 7);
5231
+ }
5232
+ return message;
5233
+ },
5234
+
5235
+ fromJSON(object: any): Receipt_TakenResult {
5236
+ return {
5237
+ pnl: isSet(object.pnl) ? BigInt(object.pnl) : 0n,
5238
+ size: isSet(object.size) ? BigInt(object.size) : 0n,
5239
+ takerAccountId: isSet(object.takerAccountId) ? globalThis.Number(object.takerAccountId) : 0,
5240
+ };
5241
+ },
5242
+
5243
+ toJSON(message: Receipt_TakenResult): unknown {
5244
+ const obj: any = {};
5245
+ if (message.pnl !== 0n) {
5246
+ obj.pnl = message.pnl.toString();
5247
+ }
5248
+ if (message.size !== 0n) {
5249
+ obj.size = message.size.toString();
5250
+ }
5251
+ if (message.takerAccountId !== 0) {
5252
+ obj.takerAccountId = Math.round(message.takerAccountId);
5253
+ }
5254
+ return obj;
5255
+ },
5256
+
5257
+ create<I extends Exact<DeepPartial<Receipt_TakenResult>, I>>(base?: I): Receipt_TakenResult {
5258
+ return Receipt_TakenResult.fromPartial(base ?? ({} as any));
5259
+ },
5260
+ fromPartial<I extends Exact<DeepPartial<Receipt_TakenResult>, I>>(object: I): Receipt_TakenResult {
5261
+ const message = createBaseReceipt_TakenResult();
5262
+ message.pnl = object.pnl ?? 0n;
5263
+ message.size = object.size ?? 0n;
5264
+ message.takerAccountId = object.takerAccountId ?? 0;
5265
+ return message;
5266
+ },
5267
+ };
5268
+
5269
+ function createBaseReceipt_PositionTakenOrTradedResult(): Receipt_PositionTakenOrTradedResult {
5270
+ return { marketId: 0, PositionTakenOrTradedKind: undefined };
5271
+ }
5272
+
5273
+ export const Receipt_PositionTakenOrTradedResult: MessageFns<Receipt_PositionTakenOrTradedResult> = {
5274
+ encode(message: Receipt_PositionTakenOrTradedResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
5275
+ if (message.marketId !== 0) {
5276
+ writer.uint32(8).uint32(message.marketId);
5277
+ }
5278
+ switch (message.PositionTakenOrTradedKind?.$case) {
5279
+ case "taken":
5280
+ Receipt_TakenResult.encode(message.PositionTakenOrTradedKind.value, writer.uint32(18).fork()).join();
5281
+ break;
5282
+ case "traded":
5283
+ Receipt_PlaceOrderResult.encode(message.PositionTakenOrTradedKind.value, writer.uint32(26).fork()).join();
5284
+ break;
5285
+ }
5286
+ return writer;
5287
+ },
5288
+
5289
+ decode(input: BinaryReader | Uint8Array, length?: number): Receipt_PositionTakenOrTradedResult {
5290
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
5291
+ let end = length === undefined ? reader.len : reader.pos + length;
5292
+ const message = createBaseReceipt_PositionTakenOrTradedResult();
5293
+ while (reader.pos < end) {
5294
+ const tag = reader.uint32();
5295
+ switch (tag >>> 3) {
5296
+ case 1: {
5297
+ if (tag !== 8) {
5298
+ break;
5299
+ }
5300
+
5301
+ message.marketId = reader.uint32();
5302
+ continue;
5303
+ }
5304
+ case 2: {
5305
+ if (tag !== 18) {
5306
+ break;
5307
+ }
5308
+
5309
+ message.PositionTakenOrTradedKind = {
5310
+ $case: "taken",
5311
+ value: Receipt_TakenResult.decode(reader, reader.uint32()),
5312
+ };
5313
+ continue;
5314
+ }
5315
+ case 3: {
5316
+ if (tag !== 26) {
5317
+ break;
5318
+ }
5319
+
5320
+ message.PositionTakenOrTradedKind = {
5321
+ $case: "traded",
5322
+ value: Receipt_PlaceOrderResult.decode(reader, reader.uint32()),
5323
+ };
5324
+ continue;
5325
+ }
5326
+ }
5327
+ if ((tag & 7) === 4 || tag === 0) {
5328
+ break;
5329
+ }
5330
+ reader.skip(tag & 7);
5331
+ }
5332
+ return message;
5333
+ },
5334
+
5335
+ fromJSON(object: any): Receipt_PositionTakenOrTradedResult {
5336
+ return {
5337
+ marketId: isSet(object.marketId) ? globalThis.Number(object.marketId) : 0,
5338
+ PositionTakenOrTradedKind: isSet(object.taken)
5339
+ ? { $case: "taken", value: Receipt_TakenResult.fromJSON(object.taken) }
5340
+ : isSet(object.traded)
5341
+ ? { $case: "traded", value: Receipt_PlaceOrderResult.fromJSON(object.traded) }
5342
+ : undefined,
5343
+ };
5344
+ },
5345
+
5346
+ toJSON(message: Receipt_PositionTakenOrTradedResult): unknown {
5347
+ const obj: any = {};
5348
+ if (message.marketId !== 0) {
5349
+ obj.marketId = Math.round(message.marketId);
5350
+ }
5351
+ if (message.PositionTakenOrTradedKind?.$case === "taken") {
5352
+ obj.taken = Receipt_TakenResult.toJSON(message.PositionTakenOrTradedKind.value);
5353
+ } else if (message.PositionTakenOrTradedKind?.$case === "traded") {
5354
+ obj.traded = Receipt_PlaceOrderResult.toJSON(message.PositionTakenOrTradedKind.value);
5355
+ }
5356
+ return obj;
5357
+ },
5358
+
5359
+ create<I extends Exact<DeepPartial<Receipt_PositionTakenOrTradedResult>, I>>(
5360
+ base?: I,
5361
+ ): Receipt_PositionTakenOrTradedResult {
5362
+ return Receipt_PositionTakenOrTradedResult.fromPartial(base ?? ({} as any));
5363
+ },
5364
+ fromPartial<I extends Exact<DeepPartial<Receipt_PositionTakenOrTradedResult>, I>>(
5365
+ object: I,
5366
+ ): Receipt_PositionTakenOrTradedResult {
5367
+ const message = createBaseReceipt_PositionTakenOrTradedResult();
5368
+ message.marketId = object.marketId ?? 0;
5369
+ switch (object.PositionTakenOrTradedKind?.$case) {
5370
+ case "taken": {
5371
+ if (object.PositionTakenOrTradedKind?.value !== undefined && object.PositionTakenOrTradedKind?.value !== null) {
5372
+ message.PositionTakenOrTradedKind = {
5373
+ $case: "taken",
5374
+ value: Receipt_TakenResult.fromPartial(object.PositionTakenOrTradedKind.value),
5375
+ };
5376
+ }
5377
+ break;
5378
+ }
5379
+ case "traded": {
5380
+ if (object.PositionTakenOrTradedKind?.value !== undefined && object.PositionTakenOrTradedKind?.value !== null) {
5381
+ message.PositionTakenOrTradedKind = {
5382
+ $case: "traded",
5383
+ value: Receipt_PlaceOrderResult.fromPartial(object.PositionTakenOrTradedKind.value),
5384
+ };
5385
+ }
5386
+ break;
5387
+ }
5388
+ }
5389
+ return message;
5390
+ },
5391
+ };
5392
+
4894
5393
  function createBaseReceipt_CancelOrderResult(): Receipt_CancelOrderResult {
4895
5394
  return { orderId: 0n, accountId: 0 };
4896
5395
  }