@n1xyz/nord-ts 0.0.1 → 0.0.5

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 (260) hide show
  1. package/README.md +148 -65
  2. package/dist/bridge/client.d.ts +150 -0
  3. package/dist/bridge/client.js +394 -0
  4. package/dist/bridge/const.d.ts +23 -0
  5. package/dist/bridge/const.js +47 -0
  6. package/dist/bridge/index.d.ts +5 -0
  7. package/dist/bridge/index.js +23 -0
  8. package/dist/bridge/types.d.ts +118 -0
  9. package/dist/bridge/types.js +16 -0
  10. package/dist/bridge/utils.d.ts +64 -0
  11. package/dist/bridge/utils.js +131 -0
  12. package/dist/const.d.ts +2 -5
  13. package/dist/const.js +2 -6
  14. package/dist/gen/common.d.ts +6 -1
  15. package/dist/gen/common.js +19 -9
  16. package/dist/gen/nord.d.ts +76 -21
  17. package/dist/gen/nord.js +987 -423
  18. package/dist/idl/bridge.d.ts +2 -0
  19. package/dist/idl/bridge.js +703 -0
  20. package/dist/index.d.ts +5 -2
  21. package/dist/index.js +18 -2
  22. package/dist/nord/{actions.d.ts → api/actions.d.ts} +6 -6
  23. package/dist/nord/{actions.js → api/actions.js} +6 -10
  24. package/dist/nord/api/core.d.ts +49 -0
  25. package/dist/nord/api/core.js +121 -0
  26. package/dist/nord/api/market.d.ts +36 -0
  27. package/dist/nord/api/market.js +98 -0
  28. package/dist/nord/api/metrics.d.ts +67 -0
  29. package/dist/nord/api/metrics.js +132 -0
  30. package/dist/nord/api/queries.d.ts +81 -0
  31. package/dist/nord/api/queries.js +187 -0
  32. package/dist/nord/client/Nord.d.ts +335 -0
  33. package/dist/nord/client/Nord.js +532 -0
  34. package/dist/nord/client/NordUser.d.ts +320 -0
  35. package/dist/nord/client/NordUser.js +697 -0
  36. package/dist/nord/index.d.ts +9 -2
  37. package/dist/nord/index.js +30 -6
  38. package/dist/nord/models/Subscriber.d.ts +37 -0
  39. package/dist/nord/models/Subscriber.js +25 -0
  40. package/dist/nord/utils/NordError.d.ts +35 -0
  41. package/dist/nord/utils/NordError.js +46 -0
  42. package/dist/types.d.ts +143 -86
  43. package/dist/types.js +12 -1
  44. package/dist/utils.d.ts +9 -0
  45. package/dist/utils.js +20 -1
  46. package/dist/websocket/NordWebSocketClient.d.ts +71 -0
  47. package/dist/websocket/NordWebSocketClient.js +343 -0
  48. package/dist/websocket/events.d.ts +19 -0
  49. package/dist/websocket/events.js +2 -0
  50. package/dist/websocket/index.d.ts +2 -0
  51. package/dist/websocket/index.js +5 -0
  52. package/docs/assets/hierarchy.js +1 -0
  53. package/docs/assets/highlight.css +16 -16
  54. package/docs/assets/icons.js +17 -14
  55. package/docs/assets/icons.svg +1 -1
  56. package/docs/assets/main.js +5 -4
  57. package/docs/assets/navigation.js +1 -1
  58. package/docs/assets/search.js +1 -1
  59. package/docs/assets/style.css +1423 -1227
  60. package/docs/classes/Nord.html +189 -43
  61. package/docs/classes/NordError.html +24 -0
  62. package/docs/classes/NordUser.html +120 -35
  63. package/docs/classes/NordWebSocketClient.html +335 -0
  64. package/docs/classes/SolanaBridgeClient.html +86 -0
  65. package/docs/classes/Subscriber.html +10 -6
  66. package/docs/enums/FillMode.html +5 -5
  67. package/docs/enums/KeyType.html +4 -4
  68. package/docs/enums/MetricPeriod.html +9 -0
  69. package/docs/enums/PdaSeedType.html +9 -0
  70. package/docs/enums/PeakTpsPeriodUnit.html +7 -7
  71. package/docs/enums/Side.html +3 -3
  72. package/docs/enums/WebSocketMessageType.html +7 -0
  73. package/docs/functions/actionQueryRollman.html +6 -0
  74. package/docs/functions/actionsQueryRollman.html +6 -0
  75. package/docs/functions/aggregateMetrics-1.html +7 -0
  76. package/docs/functions/assert.html +1 -1
  77. package/docs/functions/bigIntToProtoU128.html +3 -3
  78. package/docs/functions/blockQueryRollman.html +6 -0
  79. package/docs/functions/blockSummaryQueryRollman.html +6 -0
  80. package/docs/functions/bridgeToBN.html +5 -0
  81. package/docs/functions/bufferToHex.html +4 -0
  82. package/docs/functions/cancelOrder.html +1 -0
  83. package/docs/functions/checkPubKeyLength.html +1 -1
  84. package/docs/functions/checkedFetch.html +4 -4
  85. package/docs/functions/createSession.html +1 -0
  86. package/docs/functions/decodeLengthDelimited.html +7 -6
  87. package/docs/functions/encodeLengthDelimited.html +4 -4
  88. package/docs/functions/fillModeToProtoFillMode.html +4 -4
  89. package/docs/functions/findMarket.html +1 -1
  90. package/docs/functions/findPda.html +6 -0
  91. package/docs/functions/findToken.html +1 -1
  92. package/docs/functions/fromBN.html +5 -0
  93. package/docs/functions/getAccount.html +6 -0
  94. package/docs/functions/getActionNonce.html +5 -0
  95. package/docs/functions/getCurrentTps.html +6 -0
  96. package/docs/functions/getInfo.html +5 -0
  97. package/docs/functions/getMedianLatency.html +6 -0
  98. package/docs/functions/getOrderbook.html +6 -0
  99. package/docs/functions/getPeakTps.html +6 -0
  100. package/docs/functions/getTimestamp.html +5 -0
  101. package/docs/functions/getTotalTransactions.html +5 -0
  102. package/docs/functions/getTrades.html +6 -0
  103. package/docs/functions/getUserAccountIds.html +6 -0
  104. package/docs/functions/hexToBuffer.html +4 -0
  105. package/docs/functions/initWebSocketClient.html +12 -0
  106. package/docs/functions/keypairFromPrivateKey.html +4 -0
  107. package/docs/functions/makeSigningFunction.html +4 -0
  108. package/docs/functions/makeWalletSignFn.html +5 -5
  109. package/docs/functions/marketsStats.html +5 -0
  110. package/docs/functions/optExpect.html +4 -4
  111. package/docs/functions/optMap.html +5 -5
  112. package/docs/functions/optUnwrap.html +2 -2
  113. package/docs/functions/panic.html +1 -1
  114. package/docs/functions/placeOrder.html +1 -0
  115. package/docs/functions/queryAction.html +6 -0
  116. package/docs/functions/queryBlock.html +6 -0
  117. package/docs/functions/queryLastNBlocks.html +5 -0
  118. package/docs/functions/queryPrometheus.html +6 -0
  119. package/docs/functions/queryRecentActions.html +6 -0
  120. package/docs/functions/queryRecentBlocks.html +6 -0
  121. package/docs/functions/revokeSession.html +1 -0
  122. package/docs/functions/shortenPublicKey.html +5 -0
  123. package/docs/functions/signAction.html +2 -2
  124. package/docs/functions/toBN.html +5 -0
  125. package/docs/functions/toScaledU128.html +5 -5
  126. package/docs/functions/toScaledU64.html +5 -5
  127. package/docs/functions/transfer.html +1 -0
  128. package/docs/functions/withdraw.html +1 -0
  129. package/docs/hierarchy.html +1 -0
  130. package/docs/index.html +39 -20
  131. package/docs/interfaces/Account.html +8 -8
  132. package/docs/interfaces/ActionInfo.html +8 -8
  133. package/docs/interfaces/ActionNonceResponse.html +3 -0
  134. package/docs/interfaces/ActionQuery.html +4 -4
  135. package/docs/interfaces/ActionResponse.html +8 -8
  136. package/docs/interfaces/ActionsExtendedInfo.html +10 -10
  137. package/docs/interfaces/ActionsQuery.html +5 -5
  138. package/docs/interfaces/ActionsResponse.html +6 -6
  139. package/docs/interfaces/AggregateMetrics.html +12 -12
  140. package/docs/interfaces/BlockFacts.html +10 -0
  141. package/docs/interfaces/BlockQuery.html +6 -6
  142. package/docs/interfaces/BlockResponse.html +6 -6
  143. package/docs/interfaces/BlockSummary.html +8 -8
  144. package/docs/interfaces/BlockSummaryResponse.html +6 -6
  145. package/docs/interfaces/DeltaEvent.html +6 -6
  146. package/docs/interfaces/DepositSplParams.html +10 -0
  147. package/docs/interfaces/Info.html +3 -3
  148. package/docs/interfaces/Market.html +8 -6
  149. package/docs/interfaces/MarketStats.html +7 -7
  150. package/docs/interfaces/MarketsStatsResponse.html +2 -2
  151. package/docs/interfaces/NordConfig.html +14 -5
  152. package/docs/interfaces/NordWebSocketClientEvents.html +4 -0
  153. package/docs/interfaces/NordWebSocketEvents.html +8 -0
  154. package/docs/interfaces/Order.html +6 -6
  155. package/docs/interfaces/OrderInfo.html +6 -6
  156. package/docs/interfaces/OrderbookEntry.html +4 -0
  157. package/docs/interfaces/OrderbookQuery.html +6 -0
  158. package/docs/interfaces/OrderbookResponse.html +6 -10
  159. package/docs/interfaces/OrderbookSubscription.html +159 -0
  160. package/docs/interfaces/PerpMarketStats.html +5 -5
  161. package/docs/interfaces/RollmanActionExtendedInfo.html +4 -4
  162. package/docs/interfaces/RollmanActionInfo.html +4 -4
  163. package/docs/interfaces/RollmanActionResponse.html +4 -4
  164. package/docs/interfaces/RollmanActionsResponse.html +2 -2
  165. package/docs/interfaces/RollmanBlockResponse.html +3 -3
  166. package/docs/interfaces/SPLTokenInfo.html +10 -0
  167. package/docs/interfaces/SolanaBridgeConfig.html +10 -0
  168. package/docs/interfaces/StateFacts.html +10 -0
  169. package/docs/interfaces/SubscriberConfig.html +3 -3
  170. package/docs/interfaces/TimestampResponse.html +3 -0
  171. package/docs/interfaces/Token.html +5 -5
  172. package/docs/interfaces/TokenInfo.html +5 -0
  173. package/docs/interfaces/Trade.html +5 -5
  174. package/docs/interfaces/TradeSubscription.html +159 -0
  175. package/docs/interfaces/Trades.html +5 -5
  176. package/docs/interfaces/TradesQuery.html +6 -0
  177. package/docs/interfaces/TradesResponse.html +7 -12
  178. package/docs/interfaces/TransferParams.html +8 -0
  179. package/docs/interfaces/UserAccountIdsQuery.html +3 -0
  180. package/docs/interfaces/UserAccountIdsResponse.html +3 -0
  181. package/docs/interfaces/WebSocketDeltaUpdate.html +9 -0
  182. package/docs/interfaces/WebSocketSubscription.html +4 -0
  183. package/docs/interfaces/WebSocketTradeUpdate.html +6 -0
  184. package/docs/interfaces/WebSocketUserUpdate.html +6 -0
  185. package/docs/interfaces/WithdrawalClaim.html +14 -0
  186. package/docs/interfaces/WithdrawalParams.html +8 -0
  187. package/docs/modules.html +1 -77
  188. package/docs/types/BigIntValue.html +2 -2
  189. package/docs/types/WebSocketMessage.html +1 -0
  190. package/docs/variables/DEBUG_KEYS.html +1 -1
  191. package/docs/variables/DEFAULT_FUNDING_AMOUNTS.html +1 -1
  192. package/docs/variables/DEV_TOKEN_INFOS.html +1 -1
  193. package/docs/variables/DEV_URL.html +1 -1
  194. package/docs/variables/MAX_BUFFER_LEN.html +1 -1
  195. package/docs/variables/SESSION_TTL.html +1 -1
  196. package/docs/variables/WEBSERVER_DEV_URL.html +1 -1
  197. package/docs/variables/ZERO_DECIMAL.html +1 -1
  198. package/docs/variables/_private.html +2 -0
  199. package/eslint.config.mjs +66 -0
  200. package/package.json +20 -23
  201. package/src/bridge/client.ts +487 -0
  202. package/src/bridge/const.ts +53 -0
  203. package/src/bridge/index.ts +7 -0
  204. package/src/bridge/types.ts +127 -0
  205. package/src/bridge/utils.ts +140 -0
  206. package/src/const.ts +4 -9
  207. package/src/gen/common.ts +27 -10
  208. package/src/gen/nord.ts +1045 -487
  209. package/src/idl/bridge.ts +702 -0
  210. package/src/index.ts +21 -2
  211. package/src/nord/{actions.ts → api/actions.ts} +12 -16
  212. package/src/nord/api/core.ts +130 -0
  213. package/src/nord/api/market.ts +125 -0
  214. package/src/nord/api/metrics.ts +154 -0
  215. package/src/nord/api/queries.ts +236 -0
  216. package/src/nord/client/Nord.ts +652 -0
  217. package/src/nord/client/NordUser.ts +1101 -0
  218. package/src/nord/index.ts +16 -2
  219. package/src/nord/models/Subscriber.ts +56 -0
  220. package/src/nord/utils/NordError.ts +72 -0
  221. package/src/types.ts +163 -92
  222. package/src/utils.ts +22 -1
  223. package/src/websocket/NordWebSocketClient.ts +432 -0
  224. package/src/websocket/events.ts +31 -0
  225. package/src/websocket/index.ts +2 -0
  226. package/tsconfig.eslint.json +12 -0
  227. package/.eslintignore +0 -1
  228. package/.eslintrc.js +0 -20
  229. package/dist/abis/ERC20_ABI.d.ts +0 -39
  230. package/dist/abis/ERC20_ABI.js +0 -313
  231. package/dist/abis/NORD_GETTERS_FACET_ABI.d.ts +0 -34
  232. package/dist/abis/NORD_GETTERS_FACET_ABI.js +0 -195
  233. package/dist/abis/NORD_RAMP_FACET_ABI.d.ts +0 -35
  234. package/dist/abis/NORD_RAMP_FACET_ABI.js +0 -144
  235. package/dist/abis/index.d.ts +0 -3
  236. package/dist/abis/index.js +0 -9
  237. package/dist/nord/Nord.d.ts +0 -76
  238. package/dist/nord/Nord.js +0 -376
  239. package/dist/nord/NordImpl.d.ts +0 -7
  240. package/dist/nord/NordImpl.js +0 -6
  241. package/dist/nord/NordUser.d.ts +0 -77
  242. package/dist/nord/NordUser.js +0 -249
  243. package/docs/functions/createWebSocketSubscription.html +0 -12
  244. package/docs/interfaces/ERC20TokenInfo.html +0 -5
  245. package/docs/interfaces/OrderbookOrder.html +0 -6
  246. package/docs/interfaces/TradeInfo.html +0 -20
  247. package/docs/interfaces/TradesQueryParams.html +0 -10
  248. package/docs/variables/DEV_CONTRACT_ADDRESS.html +0 -1
  249. package/docs/variables/ERC20_ABI.html +0 -1
  250. package/docs/variables/EVM_DEV_URL.html +0 -1
  251. package/docs/variables/FAUCET_PRIVATE_ADDRESS.html +0 -1
  252. package/docs/variables/NORD_GETTERS_FACET_ABI.html +0 -1
  253. package/docs/variables/NORD_RAMP_FACET_ABI.html +0 -1
  254. package/src/abis/ERC20_ABI.ts +0 -310
  255. package/src/abis/NORD_GETTERS_FACET_ABI.ts +0 -192
  256. package/src/abis/NORD_RAMP_FACET_ABI.ts +0 -141
  257. package/src/abis/index.ts +0 -3
  258. package/src/nord/Nord.ts +0 -504
  259. package/src/nord/NordImpl.ts +0 -8
  260. package/src/nord/NordUser.ts +0 -469
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.keypairFromPrivateKey = keypairFromPrivateKey;
7
+ exports.makeSigningFunction = makeSigningFunction;
8
+ exports.bridgeToBN = bridgeToBN;
9
+ exports.fromBN = fromBN;
10
+ exports.findPda = findPda;
11
+ exports.bufferToHex = bufferToHex;
12
+ exports.hexToBuffer = hexToBuffer;
13
+ exports.shortenPublicKey = shortenPublicKey;
14
+ const web3_js_1 = require("@solana/web3.js");
15
+ const anchor_1 = require("@coral-xyz/anchor");
16
+ const bs58_1 = __importDefault(require("bs58"));
17
+ /**
18
+ * Convert a private key string to a Solana Keypair
19
+ *
20
+ * @param privateKey Private key as base58 string, hex string, or Uint8Array
21
+ * @returns Solana Keypair
22
+ */
23
+ function keypairFromPrivateKey(privateKey) {
24
+ if (typeof privateKey === "string") {
25
+ // Check if it's a base58 encoded string
26
+ if (!privateKey.startsWith("0x")) {
27
+ return web3_js_1.Keypair.fromSecretKey(bs58_1.default.decode(privateKey));
28
+ }
29
+ // It's a hex string
30
+ const hex = privateKey.startsWith("0x") ? privateKey.slice(2) : privateKey;
31
+ const bytes = new Uint8Array(hex.match(/.{1,2}/g).map((byte) => parseInt(byte, 16)));
32
+ return web3_js_1.Keypair.fromSecretKey(bytes);
33
+ }
34
+ // It's already a Uint8Array
35
+ return web3_js_1.Keypair.fromSecretKey(privateKey);
36
+ }
37
+ /**
38
+ * Create a signing function for Solana transactions
39
+ *
40
+ * @param keypair Solana keypair
41
+ * @returns Signing function
42
+ */
43
+ function makeSigningFunction(keypair) {
44
+ return async (_message) => {
45
+ // Use the correct API for signing with a Keypair
46
+ const signature = keypair.secretKey.slice(0, 32);
47
+ const publicKey = keypair.publicKey.toBytes();
48
+ // This is a simplified version - in a real implementation, you would use proper signing
49
+ // For now, we're just returning a placeholder signature
50
+ return new Uint8Array([...signature, ...publicKey].slice(0, 64));
51
+ };
52
+ }
53
+ /**
54
+ * Convert a number to a BN with the specified number of decimals
55
+ *
56
+ * @param amount Amount as a number
57
+ * @param decimals Number of decimals
58
+ * @returns BN representation of the amount
59
+ */
60
+ function bridgeToBN(amount, decimals) {
61
+ const factor = Math.pow(10, decimals);
62
+ const amountBN = new anchor_1.BN(Math.floor(amount * factor));
63
+ return amountBN;
64
+ }
65
+ /**
66
+ * Format a BN as a human-readable number with the specified number of decimals
67
+ *
68
+ * @param amount Amount as a BN
69
+ * @param decimals Number of decimals
70
+ * @returns Formatted number
71
+ */
72
+ function fromBN(amount, decimals) {
73
+ const factor = Math.pow(10, decimals);
74
+ return amount.toNumber() / factor;
75
+ }
76
+ /**
77
+ * Derive a PDA (Program Derived Address) for the given seeds
78
+ *
79
+ * @param programId Program ID
80
+ * @param type PDA seed type
81
+ * @param seeds Additional seeds
82
+ * @returns [PDA, bump]
83
+ */
84
+ function findPda(programId, type, ...seeds) {
85
+ const seedBuffers = [
86
+ Buffer.from(type),
87
+ ...seeds.map((seed) => {
88
+ if (seed instanceof web3_js_1.PublicKey) {
89
+ return seed.toBuffer();
90
+ }
91
+ else if (typeof seed === "string") {
92
+ return Buffer.from(seed);
93
+ }
94
+ else if (typeof seed === "number") {
95
+ return Buffer.from([seed]);
96
+ }
97
+ return seed;
98
+ }),
99
+ ];
100
+ return web3_js_1.PublicKey.findProgramAddressSync(seedBuffers, programId);
101
+ }
102
+ /**
103
+ * Convert a buffer to a hex string
104
+ *
105
+ * @param buffer Buffer to convert
106
+ * @returns Hex string
107
+ */
108
+ function bufferToHex(buffer) {
109
+ return "0x" + Buffer.from(buffer).toString("hex");
110
+ }
111
+ /**
112
+ * Convert a hex string to a buffer
113
+ *
114
+ * @param hex Hex string
115
+ * @returns Buffer
116
+ */
117
+ function hexToBuffer(hex) {
118
+ const hexString = hex.startsWith("0x") ? hex.slice(2) : hex;
119
+ return Buffer.from(hexString, "hex");
120
+ }
121
+ /**
122
+ * Shorten a public key for display
123
+ *
124
+ * @param publicKey Public key to shorten
125
+ * @param chars Number of characters to show at the beginning and end
126
+ * @returns Shortened public key
127
+ */
128
+ function shortenPublicKey(publicKey, chars = 4) {
129
+ const key = typeof publicKey === "string" ? publicKey : publicKey.toBase58();
130
+ return `${key.slice(0, chars)}...${key.slice(-chars)}`;
131
+ }
package/dist/const.d.ts CHANGED
@@ -1,11 +1,8 @@
1
- import { ERC20TokenInfo } from "./types";
1
+ import { TokenInfo } from "./types";
2
2
  export declare const DEBUG_KEYS: string[];
3
3
  export declare const DEV_URL = "http://localhost";
4
- export declare const EVM_DEV_URL: string;
5
4
  export declare const WEBSERVER_DEV_URL: string;
6
- export declare const DEV_CONTRACT_ADDRESS = "0x8a791620dd6260079bf849dc5567adc3f2fdc318";
7
- export declare const DEV_TOKEN_INFOS: ERC20TokenInfo[];
8
- export declare const FAUCET_PRIVATE_ADDRESS = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80";
5
+ export declare const DEV_TOKEN_INFOS: TokenInfo[];
9
6
  export declare const DEFAULT_FUNDING_AMOUNTS: {
10
7
  [key: string]: [string, number];
11
8
  };
package/dist/const.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_FUNDING_AMOUNTS = exports.FAUCET_PRIVATE_ADDRESS = exports.DEV_TOKEN_INFOS = exports.DEV_CONTRACT_ADDRESS = exports.WEBSERVER_DEV_URL = exports.EVM_DEV_URL = exports.DEV_URL = exports.DEBUG_KEYS = void 0;
4
- const EVM_PORT = "8545";
3
+ exports.DEFAULT_FUNDING_AMOUNTS = exports.DEV_TOKEN_INFOS = exports.WEBSERVER_DEV_URL = exports.DEV_URL = exports.DEBUG_KEYS = void 0;
5
4
  const WEBSERVER_PORT = "80";
6
5
  exports.DEBUG_KEYS = [
7
6
  "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
@@ -16,9 +15,7 @@ exports.DEBUG_KEYS = [
16
15
  "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6",
17
16
  ];
18
17
  exports.DEV_URL = "http://localhost";
19
- exports.EVM_DEV_URL = exports.DEV_URL + ":" + EVM_PORT;
20
18
  exports.WEBSERVER_DEV_URL = exports.DEV_URL + ":" + WEBSERVER_PORT;
21
- exports.DEV_CONTRACT_ADDRESS = "0x8a791620dd6260079bf849dc5567adc3f2fdc318";
22
19
  exports.DEV_TOKEN_INFOS = [
23
20
  {
24
21
  address: "0x9a9f2ccfde556a7e9ff0848998aa4a0cfd8863ae",
@@ -27,8 +24,7 @@ exports.DEV_TOKEN_INFOS = [
27
24
  name: "usdc",
28
25
  },
29
26
  ];
30
- exports.FAUCET_PRIVATE_ADDRESS = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80";
31
27
  exports.DEFAULT_FUNDING_AMOUNTS = {
32
- ETH: ["0.2", 0],
28
+ SOL: ["0.2", 0],
33
29
  "0x9a9f2ccfde556a7e9ff0848998aa4a0cfd8863ae": ["10000", 6],
34
30
  };
@@ -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
@@ -416,10 +450,7 @@ export interface Action_CancelOrderById {
416
450
  senderAccountId?: number | undefined;
417
451
  }
418
452
  export interface Action_Deposit {
419
- /**
420
- * used for integration of rollup with nord app
421
- * todo(n1): remove when integrated with gate
422
- */
453
+ /** used for integration of rollup with nord app */
423
454
  actionNonce: bigint;
424
455
  tokenAddr: Uint8Array;
425
456
  /** Shifted by the token's decimals. */
@@ -456,6 +487,12 @@ export interface Action_PythPriceFeedUpdate {
456
487
  /** See https://hermes.pyth.network/docs/#/rest/latest_price_updates */
457
488
  rawPythnetData: Uint8Array;
458
489
  }
490
+ /**
491
+ * Perform final account liquidation procedure.
492
+ * Can be executed only accounts with AV < 0 (bankrupt).
493
+ * After execution, `liquidatee_account_id` is removed from state.
494
+ * See MARKETS.md `Bankruptcy` for details.
495
+ */
459
496
  export interface Action_Liquidate {
460
497
  liquidatorSessionId: bigint;
461
498
  liquidateeAccountId: number;
@@ -469,13 +506,19 @@ export interface Action_Pause {
469
506
  }
470
507
  export interface Action_Unpause {
471
508
  }
509
+ /** Transfers tokens to specified account. */
472
510
  export interface Action_Transfer {
473
511
  sessionId: bigint;
474
512
  fromAccountId: number;
475
513
  tokenId: number;
476
514
  amount: bigint;
477
- /** If target account id isn't specified, new account is created */
515
+ /** If target account id isn't specified, new account is created. */
478
516
  toAccountId?: number | undefined;
517
+ /**
518
+ * If specified, than `to_account_id` must be none.
519
+ * Transfer funds to accounts, for example to cover bankruptcies.
520
+ */
521
+ specialAccount?: SpecialAccount | undefined;
479
522
  }
480
523
  export interface Action_AddTrigger {
481
524
  sessionId: bigint;
@@ -535,7 +578,7 @@ export interface Receipt {
535
578
  value: Receipt_UpdateGuardianSetResult;
536
579
  } | {
537
580
  $case: "liquidated";
538
- value: Receipt_Liquidated;
581
+ value: Receipt_AccountLiquidated;
539
582
  } | {
540
583
  $case: "sessionRevoked";
541
584
  value: Receipt_SessionRevoked;
@@ -563,7 +606,6 @@ export interface Receipt_Posted {
563
606
  size: bigint;
564
607
  orderId: bigint;
565
608
  accountId: number;
566
- clientOrderId?: bigint | undefined;
567
609
  }
568
610
  export interface Receipt_Trade {
569
611
  orderId: bigint;
@@ -578,6 +620,7 @@ export interface Receipt_CreateSessionResult {
578
620
  export interface Receipt_PlaceOrderResult {
579
621
  posted?: Receipt_Posted | undefined;
580
622
  fills: Receipt_Trade[];
623
+ clientOrderId?: bigint | undefined;
581
624
  }
582
625
  export interface Receipt_CancelOrderResult {
583
626
  orderId: bigint;
@@ -618,7 +661,17 @@ export interface Receipt_UpdateGuardianSetResult {
618
661
  guardianSetIndex: number;
619
662
  addresses: Uint8Array[];
620
663
  }
621
- export interface Receipt_Liquidated {
664
+ export interface Receipt_PerpPosition {
665
+ marketId: number;
666
+ baseSize: bigint;
667
+ price: bigint;
668
+ }
669
+ /** / Result of bankruptcy liquidation. */
670
+ export interface Receipt_AccountLiquidated {
671
+ liquidatorAccountId: number;
672
+ liquidateeAccountId: number;
673
+ cancelledOrders: bigint[];
674
+ removedPerps: Receipt_PerpPosition[];
622
675
  }
623
676
  export interface Receipt_SessionRevoked {
624
677
  }
@@ -628,10 +681,11 @@ export interface Receipt_Unpaused {
628
681
  }
629
682
  export interface Receipt_Transferred {
630
683
  fromAccountId: number;
631
- toAccountId: number;
684
+ toUserAccount?: number | undefined;
632
685
  tokenId: number;
633
686
  amount: bigint;
634
687
  accountCreated: boolean;
688
+ toSpecialAccount?: SpecialAccount | undefined;
635
689
  }
636
690
  export interface Receipt_TriggerAdded {
637
691
  }
@@ -671,7 +725,8 @@ export declare const Receipt_WithdrawResult: MessageFns<Receipt_WithdrawResult>;
671
725
  export declare const Receipt_OracleSymbolFeedResult: MessageFns<Receipt_OracleSymbolFeedResult>;
672
726
  export declare const Receipt_OracleUpdateResult: MessageFns<Receipt_OracleUpdateResult>;
673
727
  export declare const Receipt_UpdateGuardianSetResult: MessageFns<Receipt_UpdateGuardianSetResult>;
674
- export declare const Receipt_Liquidated: MessageFns<Receipt_Liquidated>;
728
+ export declare const Receipt_PerpPosition: MessageFns<Receipt_PerpPosition>;
729
+ export declare const Receipt_AccountLiquidated: MessageFns<Receipt_AccountLiquidated>;
675
730
  export declare const Receipt_SessionRevoked: MessageFns<Receipt_SessionRevoked>;
676
731
  export declare const Receipt_Paused: MessageFns<Receipt_Paused>;
677
732
  export declare const Receipt_Unpaused: MessageFns<Receipt_Unpaused>;