@n1xyz/nord-ts 0.0.16 → 0.0.18-8121ed05.0

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 (192) hide show
  1. package/dist/bridge/client.js +45 -6
  2. package/dist/gen/nord.d.ts +48 -4
  3. package/dist/gen/nord.js +634 -34
  4. package/dist/idl/bridge.d.ts +569 -0
  5. package/dist/idl/bridge.js +8 -0
  6. package/dist/idl/bridge.json +75 -62
  7. package/dist/idl/index.d.ts +71 -49
  8. package/dist/index.d.ts +1 -3
  9. package/dist/index.js +6 -13
  10. package/dist/nord/api/actions.d.ts +7 -2
  11. package/dist/nord/api/actions.js +7 -1
  12. package/dist/nord/api/core.d.ts +1 -1
  13. package/dist/nord/api/core.js +3 -3
  14. package/dist/nord/api/market.js +1 -3
  15. package/dist/nord/api/queries.js +2 -2
  16. package/dist/nord/client/Nord.d.ts +9 -14
  17. package/dist/nord/client/Nord.js +27 -38
  18. package/dist/nord/client/NordUser.d.ts +7 -23
  19. package/dist/nord/client/NordUser.js +67 -143
  20. package/dist/nord/utils/NordError.js +5 -2
  21. package/dist/types.d.ts +34 -50
  22. package/dist/utils.d.ts +2 -9
  23. package/dist/utils.js +13 -18
  24. package/package.json +17 -18
  25. package/protoc-generate.sh +0 -0
  26. package/src/idl/bridge.json +75 -62
  27. package/src/index.ts +9 -12
  28. package/src/nord/api/actions.ts +14 -3
  29. package/src/nord/api/core.ts +4 -2
  30. package/src/nord/api/market.ts +1 -4
  31. package/src/nord/api/queries.ts +2 -2
  32. package/src/nord/client/Nord.ts +45 -50
  33. package/src/nord/client/NordUser.ts +90 -171
  34. package/src/nord/utils/NordError.ts +6 -2
  35. package/src/types.ts +34 -49
  36. package/src/utils.ts +16 -19
  37. package/codebase.md +0 -18886
  38. package/docs/.nojekyll +0 -1
  39. package/docs/assets/hierarchy.js +0 -1
  40. package/docs/assets/highlight.css +0 -92
  41. package/docs/assets/icons.js +0 -18
  42. package/docs/assets/icons.svg +0 -1
  43. package/docs/assets/main.js +0 -60
  44. package/docs/assets/navigation.js +0 -1
  45. package/docs/assets/search.js +0 -1
  46. package/docs/assets/style.css +0 -1611
  47. package/docs/classes/Nord.html +0 -189
  48. package/docs/classes/NordError.html +0 -24
  49. package/docs/classes/NordUser.html +0 -115
  50. package/docs/classes/NordWebSocketClient.html +0 -330
  51. package/docs/classes/SolanaBridgeClient.html +0 -91
  52. package/docs/classes/Subscriber.html +0 -10
  53. package/docs/enums/FillMode.html +0 -5
  54. package/docs/enums/KeyType.html +0 -4
  55. package/docs/enums/MetricPeriod.html +0 -9
  56. package/docs/enums/PdaSeedType.html +0 -11
  57. package/docs/enums/PeakTpsPeriodUnit.html +0 -15
  58. package/docs/enums/Side.html +0 -3
  59. package/docs/enums/WebSocketMessageType.html +0 -7
  60. package/docs/functions/actionQueryRollman.html +0 -6
  61. package/docs/functions/actionsQueryRollman.html +0 -6
  62. package/docs/functions/aggregateMetrics-1.html +0 -7
  63. package/docs/functions/assert.html +0 -1
  64. package/docs/functions/bigIntToProtoU128.html +0 -4
  65. package/docs/functions/bridgeToBN.html +0 -5
  66. package/docs/functions/bufferToHex.html +0 -4
  67. package/docs/functions/cancelOrder.html +0 -1
  68. package/docs/functions/checkPubKeyLength.html +0 -1
  69. package/docs/functions/checkedFetch.html +0 -6
  70. package/docs/functions/createSession.html +0 -1
  71. package/docs/functions/decodeLengthDelimited.html +0 -11
  72. package/docs/functions/encodeLengthDelimited.html +0 -6
  73. package/docs/functions/fillModeToProtoFillMode.html +0 -5
  74. package/docs/functions/findMarket.html +0 -1
  75. package/docs/functions/findPda.html +0 -6
  76. package/docs/functions/findToken.html +0 -1
  77. package/docs/functions/fromBN.html +0 -5
  78. package/docs/functions/getAccount.html +0 -6
  79. package/docs/functions/getActionNonce.html +0 -5
  80. package/docs/functions/getCurrentTps.html +0 -6
  81. package/docs/functions/getInfo.html +0 -5
  82. package/docs/functions/getLastActionId.html +0 -5
  83. package/docs/functions/getMedianLatency.html +0 -6
  84. package/docs/functions/getOrderbook.html +0 -6
  85. package/docs/functions/getPeakTps.html +0 -6
  86. package/docs/functions/getTimestamp.html +0 -5
  87. package/docs/functions/getTotalTransactions.html +0 -5
  88. package/docs/functions/getTrades.html +0 -6
  89. package/docs/functions/getUserAccountIds.html +0 -6
  90. package/docs/functions/hexToBuffer.html +0 -4
  91. package/docs/functions/initWebSocketClient.html +0 -12
  92. package/docs/functions/keypairFromPrivateKey.html +0 -4
  93. package/docs/functions/makeSigningFunction.html +0 -4
  94. package/docs/functions/makeWalletSignFn.html +0 -6
  95. package/docs/functions/marketsStats.html +0 -5
  96. package/docs/functions/optExpect.html +0 -5
  97. package/docs/functions/optMap.html +0 -5
  98. package/docs/functions/optUnwrap.html +0 -2
  99. package/docs/functions/panic.html +0 -1
  100. package/docs/functions/placeOrder.html +0 -1
  101. package/docs/functions/queryAction.html +0 -6
  102. package/docs/functions/queryPrometheus.html +0 -6
  103. package/docs/functions/queryRecentActions.html +0 -7
  104. package/docs/functions/revokeSession.html +0 -1
  105. package/docs/functions/shortenPublicKey.html +0 -5
  106. package/docs/functions/signAction.html +0 -6
  107. package/docs/functions/toBN.html +0 -5
  108. package/docs/functions/toScaledU128.html +0 -8
  109. package/docs/functions/toScaledU64.html +0 -8
  110. package/docs/functions/transfer.html +0 -1
  111. package/docs/functions/withdraw.html +0 -1
  112. package/docs/hierarchy.html +0 -1
  113. package/docs/index.html +0 -40
  114. package/docs/interfaces/Account.html +0 -8
  115. package/docs/interfaces/ActionInfo.html +0 -8
  116. package/docs/interfaces/ActionNonceResponse.html +0 -3
  117. package/docs/interfaces/ActionQuery.html +0 -4
  118. package/docs/interfaces/ActionResponse.html +0 -8
  119. package/docs/interfaces/ActionsExtendedInfo.html +0 -10
  120. package/docs/interfaces/ActionsQuery.html +0 -5
  121. package/docs/interfaces/ActionsResponse.html +0 -6
  122. package/docs/interfaces/AggregateMetrics.html +0 -12
  123. package/docs/interfaces/BlockFacts.html +0 -10
  124. package/docs/interfaces/BlockQuery.html +0 -6
  125. package/docs/interfaces/BlockResponse.html +0 -6
  126. package/docs/interfaces/BlockSummary.html +0 -8
  127. package/docs/interfaces/BlockSummaryResponse.html +0 -6
  128. package/docs/interfaces/DeltaEvent.html +0 -6
  129. package/docs/interfaces/DepositSplParams.html +0 -8
  130. package/docs/interfaces/Info.html +0 -3
  131. package/docs/interfaces/Market.html +0 -8
  132. package/docs/interfaces/MarketStats.html +0 -7
  133. package/docs/interfaces/MarketsStatsResponse.html +0 -2
  134. package/docs/interfaces/NordConfig.html +0 -24
  135. package/docs/interfaces/NordWebSocketClientEvents.html +0 -4
  136. package/docs/interfaces/NordWebSocketEvents.html +0 -8
  137. package/docs/interfaces/Order.html +0 -6
  138. package/docs/interfaces/OrderInfo.html +0 -6
  139. package/docs/interfaces/OrderbookEntry.html +0 -4
  140. package/docs/interfaces/OrderbookQuery.html +0 -6
  141. package/docs/interfaces/OrderbookResponse.html +0 -6
  142. package/docs/interfaces/OrderbookSubscription.html +0 -159
  143. package/docs/interfaces/PerpMarketStats.html +0 -5
  144. package/docs/interfaces/RollmanActionExtendedInfo.html +0 -4
  145. package/docs/interfaces/RollmanActionInfo.html +0 -4
  146. package/docs/interfaces/RollmanActionResponse.html +0 -4
  147. package/docs/interfaces/RollmanActionsResponse.html +0 -2
  148. package/docs/interfaces/RollmanBlockResponse.html +0 -3
  149. package/docs/interfaces/SPLTokenInfo.html +0 -10
  150. package/docs/interfaces/SolanaBridgeConfig.html +0 -12
  151. package/docs/interfaces/StateFacts.html +0 -10
  152. package/docs/interfaces/SubscriberConfig.html +0 -3
  153. package/docs/interfaces/TimestampResponse.html +0 -3
  154. package/docs/interfaces/Token.html +0 -5
  155. package/docs/interfaces/TokenInfo.html +0 -6
  156. package/docs/interfaces/Trade.html +0 -5
  157. package/docs/interfaces/TradeSubscription.html +0 -159
  158. package/docs/interfaces/Trades.html +0 -5
  159. package/docs/interfaces/TradesQuery.html +0 -6
  160. package/docs/interfaces/TradesResponse.html +0 -7
  161. package/docs/interfaces/TransferParams.html +0 -8
  162. package/docs/interfaces/UserAccountIdsQuery.html +0 -3
  163. package/docs/interfaces/UserAccountIdsResponse.html +0 -3
  164. package/docs/interfaces/WebSocketAccountUpdate.html +0 -6
  165. package/docs/interfaces/WebSocketDeltaUpdate.html +0 -9
  166. package/docs/interfaces/WebSocketSubscription.html +0 -4
  167. package/docs/interfaces/WebSocketTradeUpdate.html +0 -6
  168. package/docs/interfaces/WithdrawalClaim.html +0 -14
  169. package/docs/interfaces/WithdrawalParams.html +0 -8
  170. package/docs/modules.html +0 -1
  171. package/docs/types/BigIntValue.html +0 -2
  172. package/docs/types/SubscriptionPattern.html +0 -4
  173. package/docs/types/SubscriptionType.html +0 -2
  174. package/docs/types/WebSocketMessage.html +0 -1
  175. package/docs/variables/DEBUG_KEYS.html +0 -1
  176. package/docs/variables/DEFAULT_FUNDING_AMOUNTS.html +0 -1
  177. package/docs/variables/DEV_TOKEN_INFOS.html +0 -1
  178. package/docs/variables/DEV_URL.html +0 -1
  179. package/docs/variables/MAX_BUFFER_LEN.html +0 -1
  180. package/docs/variables/SESSION_TTL.html +0 -1
  181. package/docs/variables/WEBSERVER_DEV_URL.html +0 -1
  182. package/docs/variables/ZERO_DECIMAL.html +0 -1
  183. package/docs/variables/_private.html +0 -2
  184. package/idl-generate.sh +0 -4
  185. package/src/bridge/client.ts +0 -498
  186. package/src/bridge/const.ts +0 -53
  187. package/src/bridge/index.ts +0 -6
  188. package/src/bridge/types.ts +0 -129
  189. package/src/bridge/utils.ts +0 -140
  190. package/src/gen/common.ts +0 -297
  191. package/src/gen/nord.ts +0 -6716
  192. package/src/idl/index.ts +0 -2
@@ -317,11 +317,6 @@
317
317
  177
318
318
  ],
319
319
  "accounts": [
320
- {
321
- "name": "payer",
322
- "writable": true,
323
- "signer": true
324
- },
325
320
  {
326
321
  "name": "bridge",
327
322
  "writable": true
@@ -633,7 +628,39 @@
633
628
  }
634
629
  },
635
630
  {
636
- "name": "da_fact_state"
631
+ "name": "da_fact_state",
632
+ "pda": {
633
+ "seeds": [
634
+ {
635
+ "kind": "const",
636
+ "value": [
637
+ 100,
638
+ 97,
639
+ 95,
640
+ 102,
641
+ 97,
642
+ 99,
643
+ 116,
644
+ 95,
645
+ 115,
646
+ 116,
647
+ 111,
648
+ 114,
649
+ 97,
650
+ 103,
651
+ 101
652
+ ]
653
+ },
654
+ {
655
+ "kind": "account",
656
+ "path": "bridge"
657
+ },
658
+ {
659
+ "kind": "arg",
660
+ "path": "facts.da_commitment"
661
+ }
662
+ ]
663
+ }
637
664
  },
638
665
  {
639
666
  "name": "crumb_authority",
@@ -737,12 +764,15 @@
737
764
  "path": "bridge"
738
765
  },
739
766
  {
740
- "kind": "arg",
741
- "path": "asset"
767
+ "kind": "account",
768
+ "path": "mint"
742
769
  }
743
770
  ]
744
771
  }
745
772
  },
773
+ {
774
+ "name": "mint"
775
+ },
746
776
  {
747
777
  "name": "crumb_authority",
748
778
  "pda": {
@@ -779,10 +809,6 @@
779
809
  }
780
810
  ],
781
811
  "args": [
782
- {
783
- "name": "asset",
784
- "type": "pubkey"
785
- },
786
812
  {
787
813
  "name": "min_deposit",
788
814
  "type": "u64"
@@ -842,12 +868,15 @@
842
868
  "path": "bridge"
843
869
  },
844
870
  {
845
- "kind": "arg",
846
- "path": "asset"
871
+ "kind": "account",
872
+ "path": "mint"
847
873
  }
848
874
  ]
849
875
  }
850
876
  },
877
+ {
878
+ "name": "mint"
879
+ },
851
880
  {
852
881
  "name": "crumb_authority",
853
882
  "pda": {
@@ -888,10 +917,6 @@
888
917
  }
889
918
  ],
890
919
  "args": [
891
- {
892
- "name": "asset",
893
- "type": "pubkey"
894
- },
895
920
  {
896
921
  "name": "min_deposit",
897
922
  "type": "u64"
@@ -1192,19 +1217,6 @@
1192
1217
  227
1193
1218
  ]
1194
1219
  },
1195
- {
1196
- "name": "EffectNullifier",
1197
- "discriminator": [
1198
- 138,
1199
- 66,
1200
- 66,
1201
- 124,
1202
- 33,
1203
- 209,
1204
- 105,
1205
- 159
1206
- ]
1207
- },
1208
1220
  {
1209
1221
  "name": "FactStateStorage",
1210
1222
  "discriminator": [
@@ -1280,19 +1292,17 @@
1280
1292
  {
1281
1293
  "name": "da_commitment",
1282
1294
  "type": {
1283
- "array": [
1284
- "u8",
1285
- 32
1286
- ]
1295
+ "defined": {
1296
+ "name": "Commitment"
1297
+ }
1287
1298
  }
1288
1299
  },
1289
1300
  {
1290
1301
  "name": "effects_root",
1291
1302
  "type": {
1292
- "array": [
1293
- "u8",
1294
- 32
1295
- ]
1303
+ "defined": {
1304
+ "name": "Commitment"
1305
+ }
1296
1306
  }
1297
1307
  }
1298
1308
  ]
@@ -1334,6 +1344,20 @@
1334
1344
  ]
1335
1345
  }
1336
1346
  },
1347
+ {
1348
+ "name": "Commitment",
1349
+ "type": {
1350
+ "kind": "struct",
1351
+ "fields": [
1352
+ {
1353
+ "array": [
1354
+ "u8",
1355
+ 32
1356
+ ]
1357
+ }
1358
+ ]
1359
+ }
1360
+ },
1337
1361
  {
1338
1362
  "name": "Deposit",
1339
1363
  "type": {
@@ -1350,22 +1374,14 @@
1350
1374
  {
1351
1375
  "name": "prev_deposit_root",
1352
1376
  "type": {
1353
- "array": [
1354
- "u8",
1355
- 32
1356
- ]
1377
+ "defined": {
1378
+ "name": "Commitment"
1379
+ }
1357
1380
  }
1358
1381
  }
1359
1382
  ]
1360
1383
  }
1361
1384
  },
1362
- {
1363
- "name": "EffectNullifier",
1364
- "type": {
1365
- "kind": "struct",
1366
- "fields": []
1367
- }
1368
- },
1369
1385
  {
1370
1386
  "name": "FactState",
1371
1387
  "type": {
@@ -1404,19 +1420,17 @@
1404
1420
  {
1405
1421
  "name": "app_state_commitment",
1406
1422
  "type": {
1407
- "array": [
1408
- "u8",
1409
- 32
1410
- ]
1423
+ "defined": {
1424
+ "name": "Commitment"
1425
+ }
1411
1426
  }
1412
1427
  },
1413
1428
  {
1414
1429
  "name": "deposit_root",
1415
1430
  "type": {
1416
- "array": [
1417
- "u8",
1418
- 32
1419
- ]
1431
+ "defined": {
1432
+ "name": "Commitment"
1433
+ }
1420
1434
  }
1421
1435
  },
1422
1436
  {
@@ -1471,10 +1485,9 @@
1471
1485
  "name": "proof",
1472
1486
  "type": {
1473
1487
  "vec": {
1474
- "array": [
1475
- "u8",
1476
- 32
1477
- ]
1488
+ "defined": {
1489
+ "name": "Commitment"
1490
+ }
1478
1491
  }
1479
1492
  }
1480
1493
  },
@@ -132,13 +132,6 @@ export declare const BRIDGE_IDL: {
132
132
  accounts: ({
133
133
  name: string;
134
134
  writable: boolean;
135
- signer: boolean;
136
- pda?: undefined;
137
- address?: undefined;
138
- } | {
139
- name: string;
140
- writable: boolean;
141
- signer?: undefined;
142
135
  pda?: undefined;
143
136
  address?: undefined;
144
137
  } | {
@@ -155,7 +148,6 @@ export declare const BRIDGE_IDL: {
155
148
  value?: undefined;
156
149
  })[];
157
150
  };
158
- signer?: undefined;
159
151
  address?: undefined;
160
152
  } | {
161
153
  name: string;
@@ -171,19 +163,16 @@ export declare const BRIDGE_IDL: {
171
163
  })[];
172
164
  };
173
165
  writable?: undefined;
174
- signer?: undefined;
175
166
  address?: undefined;
176
167
  } | {
177
168
  name: string;
178
169
  writable?: undefined;
179
- signer?: undefined;
180
170
  pda?: undefined;
181
171
  address?: undefined;
182
172
  } | {
183
173
  name: string;
184
174
  address: string;
185
175
  writable?: undefined;
186
- signer?: undefined;
187
176
  pda?: undefined;
188
177
  })[];
189
178
  args: {
@@ -319,13 +308,6 @@ export declare const BRIDGE_IDL: {
319
308
  writable?: undefined;
320
309
  signer?: undefined;
321
310
  address?: undefined;
322
- } | {
323
- name: string;
324
- writable?: undefined;
325
- signer?: undefined;
326
- optional?: undefined;
327
- pda?: undefined;
328
- address?: undefined;
329
311
  } | {
330
312
  name: string;
331
313
  pda: {
@@ -343,6 +325,13 @@ export declare const BRIDGE_IDL: {
343
325
  signer?: undefined;
344
326
  optional?: undefined;
345
327
  address?: undefined;
328
+ } | {
329
+ name: string;
330
+ writable?: undefined;
331
+ signer?: undefined;
332
+ optional?: undefined;
333
+ pda?: undefined;
334
+ address?: undefined;
346
335
  } | {
347
336
  name: string;
348
337
  address: string;
@@ -412,6 +401,64 @@ export declare const BRIDGE_IDL: {
412
401
  name: string;
413
402
  type: string;
414
403
  }[];
404
+ } | {
405
+ name: string;
406
+ discriminator: number[];
407
+ accounts: ({
408
+ name: string;
409
+ writable: boolean;
410
+ signer: boolean;
411
+ pda?: undefined;
412
+ address?: undefined;
413
+ } | {
414
+ name: string;
415
+ writable?: undefined;
416
+ signer?: undefined;
417
+ pda?: undefined;
418
+ address?: undefined;
419
+ } | {
420
+ name: string;
421
+ writable: boolean;
422
+ pda: {
423
+ seeds: ({
424
+ kind: string;
425
+ value: number[];
426
+ path?: undefined;
427
+ } | {
428
+ kind: string;
429
+ path: string;
430
+ value?: undefined;
431
+ })[];
432
+ };
433
+ signer?: undefined;
434
+ address?: undefined;
435
+ } | {
436
+ name: string;
437
+ pda: {
438
+ seeds: ({
439
+ kind: string;
440
+ value: number[];
441
+ path?: undefined;
442
+ } | {
443
+ kind: string;
444
+ path: string;
445
+ value?: undefined;
446
+ })[];
447
+ };
448
+ writable?: undefined;
449
+ signer?: undefined;
450
+ address?: undefined;
451
+ } | {
452
+ name: string;
453
+ address: string;
454
+ writable?: undefined;
455
+ signer?: undefined;
456
+ pda?: undefined;
457
+ })[];
458
+ args: {
459
+ name: string;
460
+ type: string;
461
+ }[];
415
462
  } | {
416
463
  name: string;
417
464
  discriminator: number[];
@@ -523,21 +570,9 @@ export declare const BRIDGE_IDL: {
523
570
  name: string;
524
571
  type: {
525
572
  kind: string;
526
- fields: ({
527
- name: string;
528
- type: {
529
- defined: {
530
- name: string;
531
- };
532
- array?: undefined;
533
- };
534
- } | {
535
- name: string;
536
- type: {
537
- array: (string | number)[];
538
- defined?: undefined;
539
- };
540
- })[];
573
+ fields: {
574
+ array: (string | number)[];
575
+ }[];
541
576
  variants?: undefined;
542
577
  };
543
578
  } | {
@@ -549,21 +584,6 @@ export declare const BRIDGE_IDL: {
549
584
  }[];
550
585
  fields?: undefined;
551
586
  };
552
- } | {
553
- name: string;
554
- type: {
555
- kind: string;
556
- fields: ({
557
- name: string;
558
- type: {
559
- array: (string | number)[];
560
- };
561
- } | {
562
- name: string;
563
- type: string;
564
- })[];
565
- variants?: undefined;
566
- };
567
587
  } | {
568
588
  name: string;
569
589
  type: {
@@ -575,7 +595,9 @@ export declare const BRIDGE_IDL: {
575
595
  name: string;
576
596
  type: {
577
597
  vec: {
578
- array: (string | number)[];
598
+ defined: {
599
+ name: string;
600
+ };
579
601
  };
580
602
  };
581
603
  })[];
package/dist/index.d.ts CHANGED
@@ -3,6 +3,4 @@ export * from "./utils";
3
3
  export * from "./const";
4
4
  export * from "./nord";
5
5
  export * from "./websocket/index";
6
- export * from "./bridge/client";
7
- export * from "./bridge/types";
8
- export { bridgeToBN, fromBN, keypairFromPrivateKey, makeSigningFunction, findPda, bufferToHex, hexToBuffer, shortenPublicKey, } from "./bridge/utils";
6
+ export { ProtonClient, buildDepositTx, createTokenAccountIfNeeded, type DepositSplParams, type WithdrawalParams, type WithdrawalClaim, type SPLTokenInfo, } from "@n1xyz/proton";
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.shortenPublicKey = exports.hexToBuffer = exports.bufferToHex = exports.findPda = exports.makeSigningFunction = exports.keypairFromPrivateKey = exports.fromBN = exports.bridgeToBN = void 0;
17
+ exports.createTokenAccountIfNeeded = exports.buildDepositTx = exports.ProtonClient = void 0;
18
18
  // Export types
19
19
  __exportStar(require("./types"), exports);
20
20
  __exportStar(require("./utils"), exports);
@@ -23,15 +23,8 @@ __exportStar(require("./const"), exports);
23
23
  __exportStar(require("./nord"), exports);
24
24
  // Export WebSocket modules
25
25
  __exportStar(require("./websocket/index"), exports);
26
- // Export bridge modules
27
- __exportStar(require("./bridge/client"), exports);
28
- __exportStar(require("./bridge/types"), exports);
29
- var utils_1 = require("./bridge/utils");
30
- Object.defineProperty(exports, "bridgeToBN", { enumerable: true, get: function () { return utils_1.bridgeToBN; } });
31
- Object.defineProperty(exports, "fromBN", { enumerable: true, get: function () { return utils_1.fromBN; } });
32
- Object.defineProperty(exports, "keypairFromPrivateKey", { enumerable: true, get: function () { return utils_1.keypairFromPrivateKey; } });
33
- Object.defineProperty(exports, "makeSigningFunction", { enumerable: true, get: function () { return utils_1.makeSigningFunction; } });
34
- Object.defineProperty(exports, "findPda", { enumerable: true, get: function () { return utils_1.findPda; } });
35
- Object.defineProperty(exports, "bufferToHex", { enumerable: true, get: function () { return utils_1.bufferToHex; } });
36
- Object.defineProperty(exports, "hexToBuffer", { enumerable: true, get: function () { return utils_1.hexToBuffer; } });
37
- Object.defineProperty(exports, "shortenPublicKey", { enumerable: true, get: function () { return utils_1.shortenPublicKey; } });
26
+ // Re-export proton bridge functionality for backward compatibility
27
+ var proton_1 = require("@n1xyz/proton");
28
+ Object.defineProperty(exports, "ProtonClient", { enumerable: true, get: function () { return proton_1.ProtonClient; } });
29
+ Object.defineProperty(exports, "buildDepositTx", { enumerable: true, get: function () { return proton_1.buildDepositTx; } });
30
+ Object.defineProperty(exports, "createTokenAccountIfNeeded", { enumerable: true, get: function () { return proton_1.createTokenAccountIfNeeded; } });
@@ -1,4 +1,5 @@
1
1
  import Decimal from "decimal.js";
2
+ import * as proto from "../../gen/nord";
2
3
  import { FillMode, Side } from "../../types";
3
4
  import { BigIntValue } from "../../utils";
4
5
  declare function createSessionImpl(sendFn: (encoded: Uint8Array) => Promise<Uint8Array>, walletSignFn: (message: string | Uint8Array) => Promise<Uint8Array>, currentTimestamp: bigint, nonce: number, params: {
@@ -22,13 +23,17 @@ declare function withdrawImpl(sendFn: (encoded: Uint8Array) => Promise<Uint8Arra
22
23
  sessionId: BigIntValue;
23
24
  tokenId: number;
24
25
  amount: Decimal.Value;
25
- }): Promise<void>;
26
+ }): Promise<{
27
+ actionId: bigint;
28
+ } & proto.Receipt_WithdrawResult>;
26
29
  export declare function withdraw(serverUrl: string, signFn: (message: Uint8Array) => Promise<Uint8Array>, currentTimestamp: bigint, nonce: number, params: {
27
30
  sizeDecimals: number;
28
31
  sessionId: BigIntValue;
29
32
  tokenId: number;
30
33
  amount: number;
31
- }): Promise<void>;
34
+ }): Promise<{
35
+ actionId: bigint;
36
+ } & proto.Receipt_WithdrawResult>;
32
37
  declare function placeOrderImpl(sendFn: (encoded: Uint8Array) => Promise<Uint8Array>, signFn: (message: Uint8Array) => Promise<Uint8Array>, currentTimestamp: bigint, nonce: number, params: {
33
38
  sessionId: BigIntValue;
34
39
  senderId?: number;
@@ -140,7 +140,13 @@ async function withdrawImpl(sendFn, signFn, currentTimestamp, nonce, params) {
140
140
  },
141
141
  },
142
142
  };
143
- await sendAction(sendFn, (m) => sessionSign(signFn, m), action, "withdraw");
143
+ const resp = await sendAction(sendFn, (m) => sessionSign(signFn, m), action, "withdraw");
144
+ if (resp.kind?.$case === "withdrawResult") {
145
+ return { actionId: resp.actionId, ...resp.kind.value };
146
+ }
147
+ else {
148
+ throw new Error(`Unexpected receipt kind ${resp.kind?.$case}`);
149
+ }
144
150
  }
145
151
  async function withdraw(serverUrl, signFn, currentTimestamp, nonce, params) {
146
152
  return withdrawImpl(makeSendHttp(serverUrl), signFn, currentTimestamp, nonce, params);
@@ -15,7 +15,7 @@ export declare function getTimestamp(webServerUrl: string): Promise<bigint>;
15
15
  * @returns Next action nonce
16
16
  * @throws {NordError} If the request fails
17
17
  */
18
- export declare function getActionNonce(webServerUrl: string): Promise<number>;
18
+ export declare function getLastEventNonce(webServerUrl: string): Promise<number>;
19
19
  /**
20
20
  * Get information about the Nord server
21
21
  *
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getTimestamp = getTimestamp;
4
- exports.getActionNonce = getActionNonce;
4
+ exports.getLastEventNonce = getLastEventNonce;
5
5
  exports.getInfo = getInfo;
6
6
  exports.getAccount = getAccount;
7
7
  exports.initWebSocketClient = initWebSocketClient;
@@ -31,9 +31,9 @@ async function getTimestamp(webServerUrl) {
31
31
  * @returns Next action nonce
32
32
  * @throws {NordError} If the request fails
33
33
  */
34
- async function getActionNonce(webServerUrl) {
34
+ async function getLastEventNonce(webServerUrl) {
35
35
  try {
36
- const response = await (0, utils_1.checkedFetch)(`${webServerUrl}/action_nonce`);
36
+ const response = await (0, utils_1.checkedFetch)(`${webServerUrl}/event/last-acked-nonce`);
37
37
  const data = await response.json();
38
38
  return data.nonce;
39
39
  }
@@ -60,9 +60,7 @@ async function getTrades(webServerUrl, query) {
60
60
  */
61
61
  async function getUserAccountIds(webServerUrl, query) {
62
62
  try {
63
- const params = new URLSearchParams();
64
- params.append("pubkey", query.pubkey);
65
- const response = await (0, utils_1.checkedFetch)(`${webServerUrl}/user?${params.toString()}`);
63
+ const response = await (0, utils_1.checkedFetch)(`${webServerUrl}/user/${query.pubkey.toString()}`);
66
64
  return await response.json();
67
65
  }
68
66
  catch (error) {
@@ -57,9 +57,9 @@ async function queryRecentActions(webServerUrl, from, to) {
57
57
  */
58
58
  async function getLastActionId(webServerUrl) {
59
59
  try {
60
- const response = await (0, utils_1.checkedFetch)(`${webServerUrl}/last_actionid`);
60
+ const response = await (0, utils_1.checkedFetch)(`${webServerUrl}/actions/last-id`);
61
61
  const data = await response.json();
62
- return data.last_actionid;
62
+ return data;
63
63
  }
64
64
  catch (error) {
65
65
  throw new NordError_1.NordError("Failed to get last action ID", {
@@ -1,7 +1,9 @@
1
1
  import { EventEmitter } from "events";
2
2
  import { Account, ActionQuery, ActionResponse, ActionsResponse, AggregateMetrics, Info, Market, MarketsStatsResponse, NordConfig, OrderbookQuery, OrderbookResponse, PeakTpsPeriodUnit, RollmanActionResponse, RollmanActionsResponse, Token, TradesQuery, TradesResponse, UserAccountIdsQuery, UserAccountIdsResponse } from "../../types";
3
+ import { ProtonClient } from "@n1xyz/proton";
3
4
  import { NordWebSocketClient } from "../../websocket/index";
4
5
  import { OrderbookSubscription, TradeSubscription } from "../models/Subscriber";
6
+ import { PublicKey } from "@solana/web3.js";
5
7
  /**
6
8
  * User subscription interface
7
9
  */
@@ -26,9 +28,7 @@ export declare class Nord {
26
28
  /** Base URL for the Nord web server */
27
29
  readonly webServerUrl: string;
28
30
  /** Bridge verification key */
29
- readonly bridgeVk: string;
30
- /** Optional Solana program ID (will be derived from bridgeVk) */
31
- private _solanaProgramId;
31
+ readonly bridgeVk: PublicKey;
32
32
  /** Solana RPC URL */
33
33
  readonly solanaUrl: string;
34
34
  /** Available markets */
@@ -37,6 +37,8 @@ export declare class Nord {
37
37
  tokens: Token[];
38
38
  /** Map of symbol to market_id */
39
39
  private symbolToMarketId;
40
+ /** Proton client for bridge and indexd operations */
41
+ protonClient: ProtonClient;
40
42
  /**
41
43
  * Create a new Nord client
42
44
  *
@@ -46,7 +48,7 @@ export declare class Nord {
46
48
  * @param config.solanaUrl - Solana cluster URL
47
49
  * @throws {Error} If required configuration is missing
48
50
  */
49
- constructor(config: NordConfig);
51
+ private constructor();
50
52
  /**
51
53
  * Create a WebSocket client with specific subscriptions
52
54
  *
@@ -77,7 +79,7 @@ export declare class Nord {
77
79
  */
78
80
  getTimestamp(): Promise<bigint>;
79
81
  /**
80
- * Get the next action nonce from the Nord server
82
+ * Get the last event nonce from the Nord server
81
83
  *
82
84
  * @returns Next action nonce
83
85
  * @throws {NordError} If the request fails
@@ -99,19 +101,12 @@ export declare class Nord {
99
101
  * @returns Initialized Nord client
100
102
  * @throws {NordError} If initialization fails
101
103
  */
102
- static initNord(nordConfig: NordConfig): Promise<Nord>;
104
+ static initNord({ bridgeVk: bridgeVk_, solanaUrl, webServerUrl, }: Readonly<NordConfig>): Promise<Nord>;
103
105
  /**
104
- * Initialize the Nord client by deriving program ID and fetching info
106
+ * Initialize the Nord client
105
107
  * @private
106
108
  */
107
109
  private init;
108
- /**
109
- * Get the Solana program ID derived from bridge VK
110
- *
111
- * @returns Program ID string
112
- * @throws {NordError} If program ID hasn't been initialized
113
- */
114
- getSolanaProgramId(): string;
115
110
  /**
116
111
  * Get market statistics
117
112
  *