@n1xyz/nord-ts 0.0.1 → 0.0.4

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 (237) hide show
  1. package/.eslintrc.js +11 -0
  2. package/README.md +148 -65
  3. package/dist/bridge/NordUser.d.ts +78 -0
  4. package/dist/bridge/NordUser.js +196 -0
  5. package/dist/bridge/client.d.ts +150 -0
  6. package/dist/bridge/client.js +394 -0
  7. package/dist/bridge/const.d.ts +23 -0
  8. package/dist/bridge/const.js +47 -0
  9. package/dist/bridge/index.d.ts +5 -0
  10. package/dist/bridge/index.js +23 -0
  11. package/dist/bridge/types.d.ts +118 -0
  12. package/dist/bridge/types.js +16 -0
  13. package/dist/bridge/utils.d.ts +64 -0
  14. package/dist/bridge/utils.js +131 -0
  15. package/dist/client.d.ts +70 -0
  16. package/dist/client.js +129 -0
  17. package/dist/const.d.ts +2 -5
  18. package/dist/const.js +18 -22
  19. package/dist/constants/endpoints.d.ts +65 -0
  20. package/dist/constants/endpoints.js +68 -0
  21. package/dist/gen/common.d.ts +6 -1
  22. package/dist/gen/common.js +19 -9
  23. package/dist/gen/nord.d.ts +75 -17
  24. package/dist/gen/nord.js +987 -423
  25. package/dist/idl/bridge.d.ts +2 -0
  26. package/dist/idl/bridge.js +703 -0
  27. package/dist/index.d.ts +8 -5
  28. package/dist/index.js +18 -2
  29. package/dist/models/account.d.ts +58 -0
  30. package/dist/models/account.js +6 -0
  31. package/dist/models/index.d.ts +8 -0
  32. package/dist/models/index.js +28 -0
  33. package/dist/models/market.d.ts +137 -0
  34. package/dist/models/market.js +6 -0
  35. package/dist/models/order.d.ts +211 -0
  36. package/dist/models/order.js +6 -0
  37. package/dist/models/token.d.ts +50 -0
  38. package/dist/models/token.js +6 -0
  39. package/dist/nord/Nord.d.ts +222 -49
  40. package/dist/nord/Nord.js +290 -278
  41. package/dist/nord/NordError.d.ts +23 -0
  42. package/dist/nord/NordError.js +48 -0
  43. package/dist/nord/NordImpl.d.ts +6 -2
  44. package/dist/nord/NordImpl.js +21 -1
  45. package/dist/nord/NordUser.d.ts +208 -42
  46. package/dist/nord/NordUser.js +389 -157
  47. package/dist/nord/Subscriber.d.ts +37 -0
  48. package/dist/nord/Subscriber.js +29 -0
  49. package/dist/nord/api/actions.d.ts +101 -0
  50. package/dist/nord/api/actions.js +250 -0
  51. package/dist/nord/api/core.d.ts +49 -0
  52. package/dist/nord/api/core.js +121 -0
  53. package/dist/nord/api/index.d.ts +1 -0
  54. package/dist/nord/api/index.js +17 -0
  55. package/dist/nord/api/market.d.ts +36 -0
  56. package/dist/nord/api/market.js +98 -0
  57. package/dist/nord/api/metrics.d.ts +67 -0
  58. package/dist/nord/api/metrics.js +132 -0
  59. package/dist/nord/api/orderFunctions.d.ts +168 -0
  60. package/dist/nord/api/orderFunctions.js +133 -0
  61. package/dist/nord/api/queries.d.ts +81 -0
  62. package/dist/nord/api/queries.js +187 -0
  63. package/dist/nord/client/Nord.d.ts +335 -0
  64. package/dist/nord/client/Nord.js +532 -0
  65. package/dist/nord/client/NordUser.d.ts +320 -0
  66. package/dist/nord/client/NordUser.js +701 -0
  67. package/dist/nord/core.d.ts +48 -0
  68. package/dist/nord/core.js +97 -0
  69. package/dist/nord/index.d.ts +9 -2
  70. package/dist/nord/index.js +30 -6
  71. package/dist/nord/market.d.ts +36 -0
  72. package/dist/nord/market.js +90 -0
  73. package/dist/nord/metrics.d.ts +67 -0
  74. package/dist/nord/metrics.js +124 -0
  75. package/dist/nord/models/Subscriber.d.ts +37 -0
  76. package/dist/nord/models/Subscriber.js +29 -0
  77. package/dist/nord/queries.d.ts +81 -0
  78. package/dist/nord/queries.js +181 -0
  79. package/dist/nord/types.d.ts +88 -0
  80. package/dist/nord/types.js +2 -0
  81. package/dist/nord/utils/NordError.d.ts +35 -0
  82. package/dist/nord/utils/NordError.js +46 -0
  83. package/dist/nord/websocket.d.ts +49 -0
  84. package/dist/nord/websocket.js +107 -0
  85. package/dist/operations/account.d.ts +58 -0
  86. package/dist/operations/account.js +112 -0
  87. package/dist/operations/market.d.ts +65 -0
  88. package/dist/operations/market.js +131 -0
  89. package/dist/operations/orders.d.ts +57 -0
  90. package/dist/operations/orders.js +129 -0
  91. package/dist/solana/NordUser.d.ts +78 -0
  92. package/dist/solana/NordUser.js +196 -0
  93. package/dist/solana/client.d.ts +139 -0
  94. package/dist/solana/client.js +360 -0
  95. package/dist/solana/const.d.ts +23 -0
  96. package/dist/solana/const.js +47 -0
  97. package/dist/solana/index.d.ts +5 -0
  98. package/dist/solana/index.js +23 -0
  99. package/dist/solana/types.d.ts +118 -0
  100. package/dist/solana/types.js +16 -0
  101. package/dist/solana/utils.d.ts +64 -0
  102. package/dist/solana/utils.js +131 -0
  103. package/dist/types/api.d.ts +152 -0
  104. package/dist/types/api.js +6 -0
  105. package/dist/types/config.d.ts +34 -0
  106. package/dist/types/config.js +6 -0
  107. package/dist/types.d.ts +144 -87
  108. package/dist/types.js +13 -2
  109. package/dist/utils/errors.d.ts +96 -0
  110. package/dist/utils/errors.js +132 -0
  111. package/dist/utils/http.d.ts +35 -0
  112. package/dist/utils/http.js +105 -0
  113. package/dist/utils.d.ts +14 -5
  114. package/dist/utils.js +26 -7
  115. package/dist/websocket/NordWebSocketClient.d.ts +71 -0
  116. package/dist/websocket/NordWebSocketClient.js +343 -0
  117. package/dist/websocket/client.d.ts +93 -0
  118. package/dist/websocket/client.js +222 -0
  119. package/dist/websocket/events.d.ts +19 -0
  120. package/dist/websocket/events.js +2 -0
  121. package/dist/websocket/index.d.ts +2 -0
  122. package/dist/websocket/index.js +5 -0
  123. package/dist/websocket.d.ts +55 -0
  124. package/dist/websocket.js +211 -0
  125. package/docs/assets/navigation.js +1 -1
  126. package/docs/assets/search.js +1 -1
  127. package/docs/classes/Nord.html +2 -15
  128. package/docs/classes/NordUser.html +4 -4
  129. package/docs/enums/FillMode.html +2 -2
  130. package/docs/enums/KeyType.html +2 -2
  131. package/docs/enums/PeakTpsPeriodUnit.html +2 -2
  132. package/docs/enums/Side.html +2 -2
  133. package/docs/functions/assert.html +1 -1
  134. package/docs/functions/bigIntToProtoU128.html +1 -1
  135. package/docs/functions/checkPubKeyLength.html +1 -1
  136. package/docs/functions/checkedFetch.html +1 -1
  137. package/docs/functions/decodeLengthDelimited.html +1 -1
  138. package/docs/functions/encodeLengthDelimited.html +1 -1
  139. package/docs/functions/fillModeToProtoFillMode.html +1 -1
  140. package/docs/functions/findMarket.html +1 -1
  141. package/docs/functions/findToken.html +1 -1
  142. package/docs/functions/makeWalletSignFn.html +1 -1
  143. package/docs/functions/optExpect.html +1 -1
  144. package/docs/functions/optMap.html +1 -1
  145. package/docs/functions/optUnwrap.html +1 -1
  146. package/docs/functions/panic.html +1 -1
  147. package/docs/functions/signAction.html +1 -1
  148. package/docs/functions/toScaledU128.html +1 -1
  149. package/docs/functions/toScaledU64.html +1 -1
  150. package/docs/interfaces/Account.html +2 -2
  151. package/docs/interfaces/ActionInfo.html +2 -2
  152. package/docs/interfaces/ActionQuery.html +2 -2
  153. package/docs/interfaces/ActionResponse.html +2 -2
  154. package/docs/interfaces/ActionsExtendedInfo.html +2 -2
  155. package/docs/interfaces/ActionsQuery.html +2 -2
  156. package/docs/interfaces/ActionsResponse.html +2 -2
  157. package/docs/interfaces/AggregateMetrics.html +2 -2
  158. package/docs/interfaces/BlockQuery.html +2 -2
  159. package/docs/interfaces/BlockResponse.html +2 -2
  160. package/docs/interfaces/BlockSummary.html +2 -2
  161. package/docs/interfaces/BlockSummaryResponse.html +2 -2
  162. package/docs/interfaces/DeltaEvent.html +2 -2
  163. package/docs/interfaces/ERC20TokenInfo.html +2 -2
  164. package/docs/interfaces/Info.html +2 -2
  165. package/docs/interfaces/Market.html +2 -2
  166. package/docs/interfaces/MarketStats.html +2 -2
  167. package/docs/interfaces/MarketsStatsResponse.html +2 -2
  168. package/docs/interfaces/NordConfig.html +2 -2
  169. package/docs/interfaces/Order.html +2 -2
  170. package/docs/interfaces/OrderInfo.html +2 -2
  171. package/docs/interfaces/PerpMarketStats.html +2 -2
  172. package/docs/interfaces/RollmanActionExtendedInfo.html +2 -2
  173. package/docs/interfaces/RollmanActionInfo.html +2 -2
  174. package/docs/interfaces/RollmanActionResponse.html +2 -2
  175. package/docs/interfaces/RollmanActionsResponse.html +2 -2
  176. package/docs/interfaces/RollmanBlockResponse.html +2 -2
  177. package/docs/interfaces/SubscriberConfig.html +2 -2
  178. package/docs/interfaces/Token.html +2 -2
  179. package/docs/interfaces/Trade.html +2 -2
  180. package/docs/interfaces/Trades.html +2 -2
  181. package/docs/modules.html +0 -7
  182. package/docs/types/BigIntValue.html +1 -1
  183. package/docs/variables/DEBUG_KEYS.html +1 -1
  184. package/docs/variables/DEFAULT_FUNDING_AMOUNTS.html +1 -1
  185. package/docs/variables/DEV_CONTRACT_ADDRESS.html +1 -1
  186. package/docs/variables/DEV_TOKEN_INFOS.html +1 -1
  187. package/docs/variables/DEV_URL.html +1 -1
  188. package/docs/variables/ERC20_ABI.html +1 -1
  189. package/docs/variables/EVM_DEV_URL.html +1 -1
  190. package/docs/variables/FAUCET_PRIVATE_ADDRESS.html +1 -1
  191. package/docs/variables/MAX_BUFFER_LEN.html +1 -1
  192. package/docs/variables/NORD_GETTERS_FACET_ABI.html +1 -1
  193. package/docs/variables/NORD_RAMP_FACET_ABI.html +1 -1
  194. package/docs/variables/SESSION_TTL.html +1 -1
  195. package/docs/variables/WEBSERVER_DEV_URL.html +1 -1
  196. package/docs/variables/ZERO_DECIMAL.html +1 -1
  197. package/package.json +10 -12
  198. package/src/bridge/client.ts +487 -0
  199. package/src/bridge/const.ts +53 -0
  200. package/src/bridge/index.ts +7 -0
  201. package/src/bridge/types.ts +127 -0
  202. package/src/bridge/utils.ts +140 -0
  203. package/src/const.ts +20 -25
  204. package/src/gen/common.ts +27 -10
  205. package/src/gen/nord.ts +1044 -483
  206. package/src/idl/bridge.ts +702 -0
  207. package/src/index.ts +24 -5
  208. package/src/nord/{actions.ts → api/actions.ts} +33 -37
  209. package/src/nord/api/core.ts +130 -0
  210. package/src/nord/api/market.ts +125 -0
  211. package/src/nord/api/metrics.ts +154 -0
  212. package/src/nord/api/queries.ts +236 -0
  213. package/src/nord/client/Nord.ts +652 -0
  214. package/src/nord/client/NordUser.ts +1105 -0
  215. package/src/nord/index.ts +16 -2
  216. package/src/nord/models/Subscriber.ts +57 -0
  217. package/src/nord/utils/NordError.ts +72 -0
  218. package/src/types.ts +170 -99
  219. package/src/utils.ts +40 -19
  220. package/src/websocket/NordWebSocketClient.ts +432 -0
  221. package/src/websocket/events.ts +31 -0
  222. package/src/websocket/index.ts +2 -0
  223. package/tests/utils.spec.ts +24 -24
  224. package/docs/classes/Subscriber.html +0 -6
  225. package/docs/functions/createWebSocketSubscription.html +0 -12
  226. package/docs/interfaces/OrderbookOrder.html +0 -6
  227. package/docs/interfaces/OrderbookResponse.html +0 -10
  228. package/docs/interfaces/TradeInfo.html +0 -20
  229. package/docs/interfaces/TradesQueryParams.html +0 -10
  230. package/docs/interfaces/TradesResponse.html +0 -12
  231. package/src/abis/ERC20_ABI.ts +0 -310
  232. package/src/abis/NORD_GETTERS_FACET_ABI.ts +0 -192
  233. package/src/abis/NORD_RAMP_FACET_ABI.ts +0 -141
  234. package/src/abis/index.ts +0 -3
  235. package/src/nord/Nord.ts +0 -504
  236. package/src/nord/NordImpl.ts +0 -8
  237. package/src/nord/NordUser.ts +0 -469
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ /**
3
+ * API endpoint constants
4
+ * @module constants/endpoints
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.ENDPOINTS = void 0;
8
+ /**
9
+ * API endpoints
10
+ */
11
+ exports.ENDPOINTS = {
12
+ /**
13
+ * Markets endpoint
14
+ */
15
+ MARKETS: '/api/markets',
16
+ /**
17
+ * Orderbook endpoint
18
+ */
19
+ ORDERBOOK: '/api/orderbook',
20
+ /**
21
+ * Trades endpoint
22
+ */
23
+ TRADES: '/api/trades',
24
+ /**
25
+ * Candles endpoint
26
+ */
27
+ CANDLES: '/api/candles',
28
+ /**
29
+ * Timestamp endpoint
30
+ */
31
+ TIMESTAMP: '/api/timestamp',
32
+ /**
33
+ * Account endpoint
34
+ */
35
+ ACCOUNT: '/api/account',
36
+ /**
37
+ * Accounts endpoint
38
+ */
39
+ ACCOUNTS: '/api/accounts',
40
+ /**
41
+ * Balance endpoint
42
+ */
43
+ BALANCE: '/api/balance',
44
+ /**
45
+ * Balances endpoint
46
+ */
47
+ BALANCES: '/api/balances',
48
+ /**
49
+ * Order endpoint
50
+ */
51
+ ORDER: '/api/order',
52
+ /**
53
+ * Orders endpoint
54
+ */
55
+ ORDERS: '/api/orders',
56
+ /**
57
+ * Place order endpoint
58
+ */
59
+ PLACE_ORDER: '/api/order/place',
60
+ /**
61
+ * Cancel order endpoint
62
+ */
63
+ CANCEL_ORDER: '/api/order/cancel',
64
+ /**
65
+ * Metrics endpoint
66
+ */
67
+ METRICS: '/api/metrics',
68
+ };
@@ -1,7 +1,12 @@
1
1
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
2
  export declare const protobufPackage = "common";
3
3
  export interface Message {
4
- kind?: {
4
+ kind?: //
5
+ /**
6
+ * there are many things to come here, that why enum,
7
+ * from list abi calls, nfts, multi asset transfer
8
+ */
9
+ {
5
10
  $case: "transfer";
6
11
  value: Message_Transfer;
7
12
  } | undefined;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
3
  // versions:
4
- // protoc-gen-ts_proto v2.2.0
5
- // protoc v5.28.3
4
+ // protoc-gen-ts_proto v2.6.1
5
+ // protoc v3.21.12
6
6
  // source: common.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.Message_Transfer = exports.Message = exports.protobufPackage = void 0;
@@ -28,12 +28,13 @@ exports.Message = {
28
28
  while (reader.pos < end) {
29
29
  const tag = reader.uint32();
30
30
  switch (tag >>> 3) {
31
- case 1:
31
+ case 1: {
32
32
  if (tag !== 10) {
33
33
  break;
34
34
  }
35
35
  message.kind = { $case: "transfer", value: exports.Message_Transfer.decode(reader, reader.uint32()) };
36
36
  continue;
37
+ }
37
38
  }
38
39
  if ((tag & 7) === 4 || tag === 0) {
39
40
  break;
@@ -61,8 +62,13 @@ exports.Message = {
61
62
  },
62
63
  fromPartial(object) {
63
64
  const message = createBaseMessage();
64
- if (object.kind?.$case === "transfer" && object.kind?.value !== undefined && object.kind?.value !== null) {
65
- message.kind = { $case: "transfer", value: exports.Message_Transfer.fromPartial(object.kind.value) };
65
+ switch (object.kind?.$case) {
66
+ case "transfer": {
67
+ if (object.kind?.value !== undefined && object.kind?.value !== null) {
68
+ message.kind = { $case: "transfer", value: exports.Message_Transfer.fromPartial(object.kind.value) };
69
+ }
70
+ break;
71
+ }
66
72
  }
67
73
  return message;
68
74
  },
@@ -98,25 +104,28 @@ exports.Message_Transfer = {
98
104
  while (reader.pos < end) {
99
105
  const tag = reader.uint32();
100
106
  switch (tag >>> 3) {
101
- case 1:
107
+ case 1: {
102
108
  if (tag !== 8) {
103
109
  break;
104
110
  }
105
111
  message.tokenId = reader.uint32();
106
112
  continue;
107
- case 2:
113
+ }
114
+ case 2: {
108
115
  if (tag !== 18) {
109
116
  break;
110
117
  }
111
118
  message.userPubkey = reader.bytes();
112
119
  continue;
113
- case 3:
120
+ }
121
+ case 3: {
114
122
  if (tag !== 24) {
115
123
  break;
116
124
  }
117
125
  message.amount = reader.uint64();
118
126
  continue;
119
- case 7:
127
+ }
128
+ case 7: {
120
129
  if (tag === 56) {
121
130
  message.channelId.push(reader.uint32());
122
131
  continue;
@@ -129,6 +138,7 @@ exports.Message_Transfer = {
129
138
  continue;
130
139
  }
131
140
  break;
141
+ }
132
142
  }
133
143
  if ((tag & 7) === 4 || tag === 0) {
134
144
  break;
@@ -37,7 +37,6 @@ export declare function marketTypeToJSON(object: MarketType): string;
37
37
  */
38
38
  export declare enum Error {
39
39
  DUPLICATE = 0,
40
- TIMESTAMP_STALE = 1,
41
40
  DECODE_FAILURE = 2,
42
41
  INVALID_SIGNATURE = 3,
43
42
  MARKET_NOT_FOUND = 4,
@@ -67,7 +66,6 @@ export declare enum Error {
67
66
  INDEX_PRICE_OUT_OF_RANGE = 103,
68
67
  INDEX_DECIMALS_OUT_OF_RANGE = 104,
69
68
  INVALID_STATE_VERSION = 105,
70
- POSITION_STATE_IS_WRONG_FOR_ORDER = 106,
71
69
  INVALID_MARGINS = 107,
72
70
  /** ACTION_CANNOT_BE_DELEGATED - means that user cannot execute proposed action on behalf of different user */
73
71
  ACTION_CANNOT_BE_DELEGATED = 108,
@@ -84,9 +82,6 @@ export declare enum Error {
84
82
  */
85
83
  MARKET_DECIMALS_EXCEED_LIMITS = 109,
86
84
  TOO_MANY_TOKENS = 110,
87
- BANKRUPTCY = 111,
88
- /** TOKEN_ALREADY_REGISTERED - Token with specified blockchain address already registered */
89
- TOKEN_ALREADY_REGISTERED = 112,
90
85
  FUNDING_OVERFLOW = 123,
91
86
  /**
92
87
  * CAN_REDUCE_POSITION_ONLY_IF_ALL_ORDERS_ARE_CANCELED - If there is order to cancel for position, it should be canceled first
@@ -97,13 +92,13 @@ export declare enum Error {
97
92
  /** UNEXPECTED_TOKEN_ID - Token was found, but not expected to be used in action context */
98
93
  UNEXPECTED_TOKEN_ID = 127,
99
94
  SIGNATURE_VERIFICATION = 128,
100
- /** MARKET_NOT_READY - Happens when market is not read to handle orders */
101
- MARKET_NOT_READY = 129,
102
95
  /**
103
96
  * TOKEN_NOT_READY - happens in some situation when token misses some relevant information
104
- * needed for operation
97
+ * needed for operation, for example index price
105
98
  */
106
99
  TOKEN_NOT_READY = 130,
100
+ /** TOKEN_ALREADY_REGISTERED - Token with specified blockchain address already registered */
101
+ TOKEN_ALREADY_REGISTERED = 112,
107
102
  OMF_LESS_THAN_OR_EQUAL_IMF = 131,
108
103
  ORDER_ON_UNHEALTHY_ACCOUNT_CAN_ONLY_IMPROVE = 132,
109
104
  IMMEDIATE_ORDER_GOT_NO_FILLS = 133,
@@ -140,6 +135,11 @@ export declare enum Error {
140
135
  ORDER_EXECUTION_MISSING_PRICE = 156,
141
136
  /** ORDER_EXECUTION_SIZE_LIMIT - 10011_101; */
142
137
  ORDER_EXECUTION_SIZE_LIMIT = 157,
138
+ /**
139
+ * ORDER_REDUCE_IS_POST_ONLY - 10011_110;
140
+ * Reduce orders can only be post only.
141
+ */
142
+ ORDER_REDUCE_IS_POST_ONLY = 158,
143
143
  /** BALANCE - 10100_000 */
144
144
  BALANCE = 160,
145
145
  /** BALANCE_DEPOSIT_OVERFLOW - 10100_001 */
@@ -174,10 +174,42 @@ export declare enum Error {
174
174
  * Binary pattern: 10101_001
175
175
  */
176
176
  TRIGGER_INVALID_PRICE = 169,
177
+ /** TIMESTAMP - 10110_000 */
178
+ TIMESTAMP = 176,
179
+ /** TIMESTAMP_OUT_OF_THRESHOLD - 10110_001 */
180
+ TIMESTAMP_OUT_OF_THRESHOLD = 177,
181
+ TIMESTAMP_STALE = 178,
182
+ /** BANKRUPTCY - 10111_000 */
183
+ BANKRUPTCY = 184,
184
+ /** BANKRUPTCY_INSUFFICIENT_COVERAGE - 10111_001 */
185
+ BANKRUPTCY_INSUFFICIENT_COVERAGE = 185,
186
+ /**
187
+ * BANKRUPTCY_NOT_FOUND - 10111_010
188
+ * Account is not in bankruptcy state.
189
+ */
190
+ BANKRUPTCY_NOT_FOUND = 186,
191
+ /**
192
+ * MARKET_NOT_READY - 11000_000
193
+ * Happens when market is not read to handle orders
194
+ */
195
+ MARKET_NOT_READY = 192,
196
+ MARKET_FROZEN = 193,
197
+ /** POSITION - 11001_000 */
198
+ POSITION = 200,
199
+ POSITION_STATE_ORDER = 202,
200
+ POSITION_STATE_ORDER_PRICE = 203,
201
+ POSITION_STATE_ORDER_SIZE = 204,
202
+ POSITION_STATE_ORDER_SIDE = 205,
203
+ POSITION_SIZE_LIMIT = 206,
177
204
  Dropped = 999
178
205
  }
179
206
  export declare function errorFromJSON(object: any): Error;
180
207
  export declare function errorToJSON(object: Error): string;
208
+ export declare enum SpecialAccount {
209
+ FeeVault = 0
210
+ }
211
+ export declare function specialAccountFromJSON(object: any): SpecialAccount;
212
+ export declare function specialAccountToJSON(object: SpecialAccount): string;
181
213
  /** Emulation of 128-bit integers since Protobuf doesn't have native support */
182
214
  export interface U128 {
183
215
  /** Low 64-bit word */
@@ -306,9 +338,7 @@ export interface Action_CreateToken {
306
338
  /** / Used to bind to relevant oracle feed */
307
339
  oracleSymbol: string;
308
340
  /** On chain id for the wrapped asset on the rollup */
309
- ethAddr: Uint8Array;
310
- /** Minimum amount to withdraw per action to disincentivize spam. */
311
- minWithdrawAmount: bigint;
341
+ solAddr: Uint8Array;
312
342
  }
313
343
  export interface Action_CreateMarket {
314
344
  sizeDecimals: number;
@@ -345,6 +375,10 @@ export interface Action_CreateMarket {
345
375
  * This behavior exists because order can be limited by quote size,
346
376
  * which converts to order size in a non-linear manner.
347
377
  *
378
+ * Some orders can be executed immediately, in this no order will be added to
379
+ * orderbook, no order id created. Consider using `client_order_id` to track
380
+ * execution of such orders.
381
+ *
348
382
  * Example: User posts order with size 2^48+100_000. Order fills counter
349
383
  * orders and its size is reduced to 2^48-1_000_000 in process. This order
350
384
  * will be added to orderbook successfully despite its initial size is above
@@ -456,6 +490,12 @@ export interface Action_PythPriceFeedUpdate {
456
490
  /** See https://hermes.pyth.network/docs/#/rest/latest_price_updates */
457
491
  rawPythnetData: Uint8Array;
458
492
  }
493
+ /**
494
+ * Perform final account liquidation procedure.
495
+ * Can be executed only accounts with AV < 0 (bankrupt).
496
+ * After execution, `liquidatee_account_id` is removed from state.
497
+ * See MARKETS.md `Bankruptcy` for details.
498
+ */
459
499
  export interface Action_Liquidate {
460
500
  liquidatorSessionId: bigint;
461
501
  liquidateeAccountId: number;
@@ -469,13 +509,19 @@ export interface Action_Pause {
469
509
  }
470
510
  export interface Action_Unpause {
471
511
  }
512
+ /** Transfers tokens to specified account. */
472
513
  export interface Action_Transfer {
473
514
  sessionId: bigint;
474
515
  fromAccountId: number;
475
516
  tokenId: number;
476
517
  amount: bigint;
477
- /** If target account id isn't specified, new account is created */
518
+ /** If target account id isn't specified, new account is created. */
478
519
  toAccountId?: number | undefined;
520
+ /**
521
+ * If specified, than `to_account_id` must be none.
522
+ * Transfer funds to accounts, for example to cover bankruptcies.
523
+ */
524
+ specialAccount?: SpecialAccount | undefined;
479
525
  }
480
526
  export interface Action_AddTrigger {
481
527
  sessionId: bigint;
@@ -535,7 +581,7 @@ export interface Receipt {
535
581
  value: Receipt_UpdateGuardianSetResult;
536
582
  } | {
537
583
  $case: "liquidated";
538
- value: Receipt_Liquidated;
584
+ value: Receipt_AccountLiquidated;
539
585
  } | {
540
586
  $case: "sessionRevoked";
541
587
  value: Receipt_SessionRevoked;
@@ -563,7 +609,6 @@ export interface Receipt_Posted {
563
609
  size: bigint;
564
610
  orderId: bigint;
565
611
  accountId: number;
566
- clientOrderId?: bigint | undefined;
567
612
  }
568
613
  export interface Receipt_Trade {
569
614
  orderId: bigint;
@@ -578,6 +623,7 @@ export interface Receipt_CreateSessionResult {
578
623
  export interface Receipt_PlaceOrderResult {
579
624
  posted?: Receipt_Posted | undefined;
580
625
  fills: Receipt_Trade[];
626
+ clientOrderId?: bigint | undefined;
581
627
  }
582
628
  export interface Receipt_CancelOrderResult {
583
629
  orderId: bigint;
@@ -618,7 +664,17 @@ export interface Receipt_UpdateGuardianSetResult {
618
664
  guardianSetIndex: number;
619
665
  addresses: Uint8Array[];
620
666
  }
621
- export interface Receipt_Liquidated {
667
+ export interface Receipt_PerpPosition {
668
+ marketId: number;
669
+ baseSize: bigint;
670
+ price: bigint;
671
+ }
672
+ /** / Result of bankruptcy liquidation. */
673
+ export interface Receipt_AccountLiquidated {
674
+ liquidatorAccountId: number;
675
+ liquidateeAccountId: number;
676
+ cancelledOrders: bigint[];
677
+ removedPerps: Receipt_PerpPosition[];
622
678
  }
623
679
  export interface Receipt_SessionRevoked {
624
680
  }
@@ -628,10 +684,11 @@ export interface Receipt_Unpaused {
628
684
  }
629
685
  export interface Receipt_Transferred {
630
686
  fromAccountId: number;
631
- toAccountId: number;
687
+ toUserAccount?: number | undefined;
632
688
  tokenId: number;
633
689
  amount: bigint;
634
690
  accountCreated: boolean;
691
+ toSpecialAccount?: SpecialAccount | undefined;
635
692
  }
636
693
  export interface Receipt_TriggerAdded {
637
694
  }
@@ -671,7 +728,8 @@ export declare const Receipt_WithdrawResult: MessageFns<Receipt_WithdrawResult>;
671
728
  export declare const Receipt_OracleSymbolFeedResult: MessageFns<Receipt_OracleSymbolFeedResult>;
672
729
  export declare const Receipt_OracleUpdateResult: MessageFns<Receipt_OracleUpdateResult>;
673
730
  export declare const Receipt_UpdateGuardianSetResult: MessageFns<Receipt_UpdateGuardianSetResult>;
674
- export declare const Receipt_Liquidated: MessageFns<Receipt_Liquidated>;
731
+ export declare const Receipt_PerpPosition: MessageFns<Receipt_PerpPosition>;
732
+ export declare const Receipt_AccountLiquidated: MessageFns<Receipt_AccountLiquidated>;
675
733
  export declare const Receipt_SessionRevoked: MessageFns<Receipt_SessionRevoked>;
676
734
  export declare const Receipt_Paused: MessageFns<Receipt_Paused>;
677
735
  export declare const Receipt_Unpaused: MessageFns<Receipt_Unpaused>;