@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.
- package/dist/bridge/client.js +45 -6
- package/dist/gen/nord.d.ts +48 -4
- package/dist/gen/nord.js +634 -34
- package/dist/idl/bridge.d.ts +569 -0
- package/dist/idl/bridge.js +8 -0
- package/dist/idl/bridge.json +75 -62
- package/dist/idl/index.d.ts +71 -49
- package/dist/index.d.ts +1 -3
- package/dist/index.js +6 -13
- package/dist/nord/api/actions.d.ts +7 -2
- package/dist/nord/api/actions.js +7 -1
- package/dist/nord/api/core.d.ts +1 -1
- package/dist/nord/api/core.js +3 -3
- package/dist/nord/api/market.js +1 -3
- package/dist/nord/api/queries.js +2 -2
- package/dist/nord/client/Nord.d.ts +9 -14
- package/dist/nord/client/Nord.js +27 -38
- package/dist/nord/client/NordUser.d.ts +7 -23
- package/dist/nord/client/NordUser.js +67 -143
- package/dist/nord/utils/NordError.js +5 -2
- package/dist/types.d.ts +34 -50
- package/dist/utils.d.ts +2 -9
- package/dist/utils.js +13 -18
- package/package.json +17 -18
- package/protoc-generate.sh +0 -0
- package/src/idl/bridge.json +75 -62
- package/src/index.ts +9 -12
- package/src/nord/api/actions.ts +14 -3
- package/src/nord/api/core.ts +4 -2
- package/src/nord/api/market.ts +1 -4
- package/src/nord/api/queries.ts +2 -2
- package/src/nord/client/Nord.ts +45 -50
- package/src/nord/client/NordUser.ts +90 -171
- package/src/nord/utils/NordError.ts +6 -2
- package/src/types.ts +34 -49
- package/src/utils.ts +16 -19
- package/codebase.md +0 -18886
- package/docs/.nojekyll +0 -1
- package/docs/assets/hierarchy.js +0 -1
- package/docs/assets/highlight.css +0 -92
- package/docs/assets/icons.js +0 -18
- package/docs/assets/icons.svg +0 -1
- package/docs/assets/main.js +0 -60
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1611
- package/docs/classes/Nord.html +0 -189
- package/docs/classes/NordError.html +0 -24
- package/docs/classes/NordUser.html +0 -115
- package/docs/classes/NordWebSocketClient.html +0 -330
- package/docs/classes/SolanaBridgeClient.html +0 -91
- package/docs/classes/Subscriber.html +0 -10
- package/docs/enums/FillMode.html +0 -5
- package/docs/enums/KeyType.html +0 -4
- package/docs/enums/MetricPeriod.html +0 -9
- package/docs/enums/PdaSeedType.html +0 -11
- package/docs/enums/PeakTpsPeriodUnit.html +0 -15
- package/docs/enums/Side.html +0 -3
- package/docs/enums/WebSocketMessageType.html +0 -7
- package/docs/functions/actionQueryRollman.html +0 -6
- package/docs/functions/actionsQueryRollman.html +0 -6
- package/docs/functions/aggregateMetrics-1.html +0 -7
- package/docs/functions/assert.html +0 -1
- package/docs/functions/bigIntToProtoU128.html +0 -4
- package/docs/functions/bridgeToBN.html +0 -5
- package/docs/functions/bufferToHex.html +0 -4
- package/docs/functions/cancelOrder.html +0 -1
- package/docs/functions/checkPubKeyLength.html +0 -1
- package/docs/functions/checkedFetch.html +0 -6
- package/docs/functions/createSession.html +0 -1
- package/docs/functions/decodeLengthDelimited.html +0 -11
- package/docs/functions/encodeLengthDelimited.html +0 -6
- package/docs/functions/fillModeToProtoFillMode.html +0 -5
- package/docs/functions/findMarket.html +0 -1
- package/docs/functions/findPda.html +0 -6
- package/docs/functions/findToken.html +0 -1
- package/docs/functions/fromBN.html +0 -5
- package/docs/functions/getAccount.html +0 -6
- package/docs/functions/getActionNonce.html +0 -5
- package/docs/functions/getCurrentTps.html +0 -6
- package/docs/functions/getInfo.html +0 -5
- package/docs/functions/getLastActionId.html +0 -5
- package/docs/functions/getMedianLatency.html +0 -6
- package/docs/functions/getOrderbook.html +0 -6
- package/docs/functions/getPeakTps.html +0 -6
- package/docs/functions/getTimestamp.html +0 -5
- package/docs/functions/getTotalTransactions.html +0 -5
- package/docs/functions/getTrades.html +0 -6
- package/docs/functions/getUserAccountIds.html +0 -6
- package/docs/functions/hexToBuffer.html +0 -4
- package/docs/functions/initWebSocketClient.html +0 -12
- package/docs/functions/keypairFromPrivateKey.html +0 -4
- package/docs/functions/makeSigningFunction.html +0 -4
- package/docs/functions/makeWalletSignFn.html +0 -6
- package/docs/functions/marketsStats.html +0 -5
- package/docs/functions/optExpect.html +0 -5
- package/docs/functions/optMap.html +0 -5
- package/docs/functions/optUnwrap.html +0 -2
- package/docs/functions/panic.html +0 -1
- package/docs/functions/placeOrder.html +0 -1
- package/docs/functions/queryAction.html +0 -6
- package/docs/functions/queryPrometheus.html +0 -6
- package/docs/functions/queryRecentActions.html +0 -7
- package/docs/functions/revokeSession.html +0 -1
- package/docs/functions/shortenPublicKey.html +0 -5
- package/docs/functions/signAction.html +0 -6
- package/docs/functions/toBN.html +0 -5
- package/docs/functions/toScaledU128.html +0 -8
- package/docs/functions/toScaledU64.html +0 -8
- package/docs/functions/transfer.html +0 -1
- package/docs/functions/withdraw.html +0 -1
- package/docs/hierarchy.html +0 -1
- package/docs/index.html +0 -40
- package/docs/interfaces/Account.html +0 -8
- package/docs/interfaces/ActionInfo.html +0 -8
- package/docs/interfaces/ActionNonceResponse.html +0 -3
- package/docs/interfaces/ActionQuery.html +0 -4
- package/docs/interfaces/ActionResponse.html +0 -8
- package/docs/interfaces/ActionsExtendedInfo.html +0 -10
- package/docs/interfaces/ActionsQuery.html +0 -5
- package/docs/interfaces/ActionsResponse.html +0 -6
- package/docs/interfaces/AggregateMetrics.html +0 -12
- package/docs/interfaces/BlockFacts.html +0 -10
- package/docs/interfaces/BlockQuery.html +0 -6
- package/docs/interfaces/BlockResponse.html +0 -6
- package/docs/interfaces/BlockSummary.html +0 -8
- package/docs/interfaces/BlockSummaryResponse.html +0 -6
- package/docs/interfaces/DeltaEvent.html +0 -6
- package/docs/interfaces/DepositSplParams.html +0 -8
- package/docs/interfaces/Info.html +0 -3
- package/docs/interfaces/Market.html +0 -8
- package/docs/interfaces/MarketStats.html +0 -7
- package/docs/interfaces/MarketsStatsResponse.html +0 -2
- package/docs/interfaces/NordConfig.html +0 -24
- package/docs/interfaces/NordWebSocketClientEvents.html +0 -4
- package/docs/interfaces/NordWebSocketEvents.html +0 -8
- package/docs/interfaces/Order.html +0 -6
- package/docs/interfaces/OrderInfo.html +0 -6
- package/docs/interfaces/OrderbookEntry.html +0 -4
- package/docs/interfaces/OrderbookQuery.html +0 -6
- package/docs/interfaces/OrderbookResponse.html +0 -6
- package/docs/interfaces/OrderbookSubscription.html +0 -159
- package/docs/interfaces/PerpMarketStats.html +0 -5
- package/docs/interfaces/RollmanActionExtendedInfo.html +0 -4
- package/docs/interfaces/RollmanActionInfo.html +0 -4
- package/docs/interfaces/RollmanActionResponse.html +0 -4
- package/docs/interfaces/RollmanActionsResponse.html +0 -2
- package/docs/interfaces/RollmanBlockResponse.html +0 -3
- package/docs/interfaces/SPLTokenInfo.html +0 -10
- package/docs/interfaces/SolanaBridgeConfig.html +0 -12
- package/docs/interfaces/StateFacts.html +0 -10
- package/docs/interfaces/SubscriberConfig.html +0 -3
- package/docs/interfaces/TimestampResponse.html +0 -3
- package/docs/interfaces/Token.html +0 -5
- package/docs/interfaces/TokenInfo.html +0 -6
- package/docs/interfaces/Trade.html +0 -5
- package/docs/interfaces/TradeSubscription.html +0 -159
- package/docs/interfaces/Trades.html +0 -5
- package/docs/interfaces/TradesQuery.html +0 -6
- package/docs/interfaces/TradesResponse.html +0 -7
- package/docs/interfaces/TransferParams.html +0 -8
- package/docs/interfaces/UserAccountIdsQuery.html +0 -3
- package/docs/interfaces/UserAccountIdsResponse.html +0 -3
- package/docs/interfaces/WebSocketAccountUpdate.html +0 -6
- package/docs/interfaces/WebSocketDeltaUpdate.html +0 -9
- package/docs/interfaces/WebSocketSubscription.html +0 -4
- package/docs/interfaces/WebSocketTradeUpdate.html +0 -6
- package/docs/interfaces/WithdrawalClaim.html +0 -14
- package/docs/interfaces/WithdrawalParams.html +0 -8
- package/docs/modules.html +0 -1
- package/docs/types/BigIntValue.html +0 -2
- package/docs/types/SubscriptionPattern.html +0 -4
- package/docs/types/SubscriptionType.html +0 -2
- package/docs/types/WebSocketMessage.html +0 -1
- package/docs/variables/DEBUG_KEYS.html +0 -1
- package/docs/variables/DEFAULT_FUNDING_AMOUNTS.html +0 -1
- package/docs/variables/DEV_TOKEN_INFOS.html +0 -1
- package/docs/variables/DEV_URL.html +0 -1
- package/docs/variables/MAX_BUFFER_LEN.html +0 -1
- package/docs/variables/SESSION_TTL.html +0 -1
- package/docs/variables/WEBSERVER_DEV_URL.html +0 -1
- package/docs/variables/ZERO_DECIMAL.html +0 -1
- package/docs/variables/_private.html +0 -2
- package/idl-generate.sh +0 -4
- package/src/bridge/client.ts +0 -498
- package/src/bridge/const.ts +0 -53
- package/src/bridge/index.ts +0 -6
- package/src/bridge/types.ts +0 -129
- package/src/bridge/utils.ts +0 -140
- package/src/gen/common.ts +0 -297
- package/src/gen/nord.ts +0 -6716
- package/src/idl/index.ts +0 -2
package/dist/idl/bridge.json
CHANGED
|
@@ -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": "
|
|
741
|
-
"path": "
|
|
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": "
|
|
846
|
-
"path": "
|
|
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
|
-
"
|
|
1284
|
-
"
|
|
1285
|
-
|
|
1286
|
-
]
|
|
1295
|
+
"defined": {
|
|
1296
|
+
"name": "Commitment"
|
|
1297
|
+
}
|
|
1287
1298
|
}
|
|
1288
1299
|
},
|
|
1289
1300
|
{
|
|
1290
1301
|
"name": "effects_root",
|
|
1291
1302
|
"type": {
|
|
1292
|
-
"
|
|
1293
|
-
"
|
|
1294
|
-
|
|
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
|
-
"
|
|
1354
|
-
"
|
|
1355
|
-
|
|
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
|
-
"
|
|
1408
|
-
"
|
|
1409
|
-
|
|
1410
|
-
]
|
|
1423
|
+
"defined": {
|
|
1424
|
+
"name": "Commitment"
|
|
1425
|
+
}
|
|
1411
1426
|
}
|
|
1412
1427
|
},
|
|
1413
1428
|
{
|
|
1414
1429
|
"name": "deposit_root",
|
|
1415
1430
|
"type": {
|
|
1416
|
-
"
|
|
1417
|
-
"
|
|
1418
|
-
|
|
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
|
-
"
|
|
1475
|
-
"
|
|
1476
|
-
|
|
1477
|
-
]
|
|
1488
|
+
"defined": {
|
|
1489
|
+
"name": "Commitment"
|
|
1490
|
+
}
|
|
1478
1491
|
}
|
|
1479
1492
|
}
|
|
1480
1493
|
},
|
package/dist/idl/index.d.ts
CHANGED
|
@@ -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
|
-
|
|
528
|
-
|
|
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
|
-
|
|
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
|
|
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.
|
|
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
|
-
//
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
Object.defineProperty(exports, "
|
|
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<
|
|
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<
|
|
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;
|
package/dist/nord/api/actions.js
CHANGED
|
@@ -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);
|
package/dist/nord/api/core.d.ts
CHANGED
|
@@ -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
|
|
18
|
+
export declare function getLastEventNonce(webServerUrl: string): Promise<number>;
|
|
19
19
|
/**
|
|
20
20
|
* Get information about the Nord server
|
|
21
21
|
*
|
package/dist/nord/api/core.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getTimestamp = getTimestamp;
|
|
4
|
-
exports.
|
|
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
|
|
34
|
+
async function getLastEventNonce(webServerUrl) {
|
|
35
35
|
try {
|
|
36
|
-
const response = await (0, utils_1.checkedFetch)(`${webServerUrl}/
|
|
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
|
}
|
package/dist/nord/api/market.js
CHANGED
|
@@ -60,9 +60,7 @@ async function getTrades(webServerUrl, query) {
|
|
|
60
60
|
*/
|
|
61
61
|
async function getUserAccountIds(webServerUrl, query) {
|
|
62
62
|
try {
|
|
63
|
-
const
|
|
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) {
|
package/dist/nord/api/queries.js
CHANGED
|
@@ -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}/
|
|
60
|
+
const response = await (0, utils_1.checkedFetch)(`${webServerUrl}/actions/last-id`);
|
|
61
61
|
const data = await response.json();
|
|
62
|
-
return data
|
|
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:
|
|
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(
|
|
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
|
|
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(
|
|
104
|
+
static initNord({ bridgeVk: bridgeVk_, solanaUrl, webServerUrl, }: Readonly<NordConfig>): Promise<Nord>;
|
|
103
105
|
/**
|
|
104
|
-
* Initialize the Nord client
|
|
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
|
*
|