@nadohq/indexer-client 0.1.0-alpha.3 → 0.1.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/IndexerBaseClient.cjs +57 -56
  2. package/dist/IndexerBaseClient.cjs.map +1 -1
  3. package/dist/IndexerBaseClient.d.cts +1 -2
  4. package/dist/IndexerBaseClient.d.ts +1 -2
  5. package/dist/IndexerBaseClient.js +7 -7
  6. package/dist/IndexerBaseClient.js.map +1 -1
  7. package/dist/IndexerClient.cjs +16 -16
  8. package/dist/IndexerClient.cjs.map +1 -1
  9. package/dist/IndexerClient.d.cts +2 -3
  10. package/dist/IndexerClient.d.ts +2 -3
  11. package/dist/IndexerClient.js +2 -2
  12. package/dist/IndexerClient.js.map +1 -1
  13. package/dist/dataMappers.cjs +105 -108
  14. package/dist/dataMappers.cjs.map +1 -1
  15. package/dist/dataMappers.d.cts +1 -2
  16. package/dist/dataMappers.d.ts +1 -2
  17. package/dist/dataMappers.js +7 -10
  18. package/dist/dataMappers.js.map +1 -1
  19. package/dist/endpoints.cjs +2 -2
  20. package/dist/endpoints.cjs.map +1 -1
  21. package/dist/endpoints.d.cts +1 -1
  22. package/dist/endpoints.d.ts +1 -1
  23. package/dist/endpoints.js +2 -2
  24. package/dist/endpoints.js.map +1 -1
  25. package/dist/index.d.cts +1 -2
  26. package/dist/index.d.ts +1 -2
  27. package/dist/types/clientTypes.cjs.map +1 -1
  28. package/dist/types/clientTypes.d.cts +3 -6
  29. package/dist/types/clientTypes.d.ts +3 -6
  30. package/dist/types/index.d.cts +1 -2
  31. package/dist/types/index.d.ts +1 -2
  32. package/dist/types/paginatedEventsTypes.cjs.map +1 -1
  33. package/dist/types/paginatedEventsTypes.d.cts +1 -2
  34. package/dist/types/paginatedEventsTypes.d.ts +1 -2
  35. package/dist/types/serverModelTypes.cjs.map +1 -1
  36. package/dist/types/serverModelTypes.d.cts +2 -1
  37. package/dist/types/serverModelTypes.d.ts +2 -1
  38. package/dist/types/serverTypes.cjs.map +1 -1
  39. package/dist/types/serverTypes.d.cts +1 -1
  40. package/dist/types/serverTypes.d.ts +1 -1
  41. package/dist/utils/index.d.cts +2 -3
  42. package/dist/utils/index.d.ts +2 -3
  43. package/dist/utils/indexerBalanceValue.cjs.map +1 -1
  44. package/dist/utils/indexerBalanceValue.d.cts +2 -3
  45. package/dist/utils/indexerBalanceValue.d.ts +2 -3
  46. package/dist/utils/indexerBalanceValue.js.map +1 -1
  47. package/package.json +4 -5
  48. package/src/IndexerBaseClient.ts +13 -13
  49. package/src/IndexerClient.ts +2 -2
  50. package/src/dataMappers.ts +8 -11
  51. package/src/endpoints.ts +2 -2
  52. package/src/types/clientTypes.ts +6 -8
  53. package/src/types/paginatedEventsTypes.ts +1 -2
  54. package/src/types/serverModelTypes.ts +2 -1
  55. package/src/types/serverTypes.ts +1 -1
  56. package/src/utils/indexerBalanceValue.ts +1 -1
@@ -3,8 +3,8 @@ import {
3
3
  QUOTE_PRODUCT_ID,
4
4
  subaccountFromHex,
5
5
  NLP_PRODUCT_ID,
6
- } from '@nadohq/contracts';
7
- import { toBigDecimal, toIntegerString } from '@nadohq/utils';
6
+ } from '@nadohq/shared';
7
+ import { toBigDecimal, toIntegerString } from '@nadohq/shared';
8
8
 
9
9
  import { IndexerBaseClient } from './IndexerBaseClient';
10
10
  import {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  getRecvTimeFromOrderNonce,
3
3
  Market,
4
- parseRawExpirationTimestamp,
5
4
  PerpMarket,
6
5
  ProductEngineType,
7
6
  SpotMarket,
8
7
  subaccountFromHex,
9
- } from '@nadohq/contracts';
8
+ unpackOrderAppendix,
9
+ } from '@nadohq/shared';
10
10
  import {
11
11
  mapEngineServerPerpProduct,
12
12
  mapEngineServerSpotProduct,
@@ -16,7 +16,7 @@ import {
16
16
  removeDecimals,
17
17
  toBigDecimal,
18
18
  toIntegerString,
19
- } from '@nadohq/utils';
19
+ } from '@nadohq/shared';
20
20
  import {
21
21
  Candlestick,
22
22
  IndexerEvent,
@@ -28,6 +28,7 @@ import {
28
28
  IndexerMaker,
29
29
  IndexerMarketSnapshot,
30
30
  IndexerMatchEventBalances,
31
+ IndexerNlpSnapshot,
31
32
  IndexerOrder,
32
33
  IndexerPerpBalance,
33
34
  IndexerPerpPrices,
@@ -42,16 +43,15 @@ import {
42
43
  IndexerServerMaker,
43
44
  IndexerServerMarketSnapshot,
44
45
  IndexerServerMatchEventBalances,
46
+ IndexerServerNlpSnapshot,
45
47
  IndexerServerOrder,
46
48
  IndexerServerPerpPrices,
47
49
  IndexerServerProduct,
48
50
  IndexerServerProductPayment,
49
51
  IndexerServerSnapshotsInterval,
50
52
  IndexerServerTx,
51
- IndexerServerNlpSnapshot,
52
53
  IndexerSnapshotsIntervalParams,
53
54
  IndexerSpotBalance,
54
- IndexerNlpSnapshot,
55
55
  } from './types';
56
56
 
57
57
  export function mapSnapshotsIntervalToServerParams(
@@ -92,16 +92,13 @@ export function mapIndexerServerBalance(
92
92
  }
93
93
 
94
94
  export function mapIndexerOrder(order: IndexerServerOrder): IndexerOrder {
95
- const expiration = toBigDecimal(order.expiration);
96
- const expirationEncodedData = parseRawExpirationTimestamp(order.expiration);
95
+ const appendix = unpackOrderAppendix(order.appendix);
97
96
  return {
98
97
  amount: toBigDecimal(order.amount),
99
98
  digest: order.digest,
100
99
  isolated: order.isolated,
101
- rawExpiration: expiration,
102
- isReduceOnly: expirationEncodedData.reduceOnly,
103
- expiration: expirationEncodedData.expirationTime,
104
- orderType: expirationEncodedData.type,
100
+ expiration: Number(order.expiration),
101
+ appendix,
105
102
  nonce: toBigDecimal(order.nonce),
106
103
  recvTimeSeconds: getRecvTimeFromOrderNonce(order.nonce) / 1000,
107
104
  price: removeDecimals(order.price_x18),
package/src/endpoints.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { ChainEnv } from '@nadohq/contracts';
1
+ import { ChainEnv } from '@nadohq/shared';
2
2
 
3
3
  export const INDEXER_CLIENT_ENDPOINTS: Record<ChainEnv, string> = {
4
4
  local: 'http://localhost:8000/indexer',
5
- arbitrumTestnet: 'https://archive.sepolia-test.vertexprotocol.com/v1',
6
5
  arbitrum: 'https://archive.prod.vertexprotocol.com/v1',
6
+ inkTestnet: 'https://archive.test.nado-backend.xyz/v1',
7
7
  };
@@ -1,24 +1,24 @@
1
1
  import {
2
2
  EIP712OrderValues,
3
3
  Market,
4
- OrderExpirationType,
4
+ OrderAppendix,
5
5
  PerpBalance,
6
6
  PerpMarket,
7
7
  ProductEngineType,
8
8
  SpotBalance,
9
9
  SpotMarket,
10
10
  Subaccount,
11
- } from '@nadohq/contracts';
12
- import { BigDecimal } from '@nadohq/utils';
11
+ } from '@nadohq/shared';
12
+ import { BigDecimal } from '@nadohq/shared';
13
13
  import { Hex } from 'viem';
14
14
  import { CandlestickPeriod } from './CandlestickPeriod';
15
15
  import { IndexerEventType } from './IndexerEventType';
16
16
  import { IndexerLeaderboardRankType } from './IndexerLeaderboardType';
17
+ import { NadoTx, NadoWithdrawCollateralTx } from './NadoTx';
17
18
  import {
18
19
  IndexerServerFastWithdrawalSignatureParams,
19
20
  IndexerServerListSubaccountsParams,
20
21
  } from './serverTypes';
21
- import { NadoTx, NadoWithdrawCollateralTx } from './NadoTx';
22
22
 
23
23
  /**
24
24
  * Base types
@@ -354,11 +354,9 @@ export interface IndexerOrder {
354
354
  submissionIndex: string;
355
355
  amount: BigDecimal;
356
356
  price: BigDecimal;
357
- // This includes the order type
358
- rawExpiration: BigDecimal;
359
- isReduceOnly: boolean;
360
- orderType: OrderExpirationType;
361
357
  expiration: number;
358
+ // Order metadata from appendix
359
+ appendix: OrderAppendix;
362
360
  nonce: BigDecimal;
363
361
  // Derived from the nonce
364
362
  recvTimeSeconds: number;
@@ -1,5 +1,4 @@
1
- import { Subaccount } from '@nadohq/contracts';
2
- import { BigDecimal } from '@nadohq/utils';
1
+ import { BigDecimal, Subaccount } from '@nadohq/shared';
3
2
  import {
4
3
  GetIndexerInterestFundingPaymentsParams,
5
4
  GetIndexerInterestFundingPaymentsResponse,
@@ -1,4 +1,4 @@
1
- import { EIP712OrderValues } from '@nadohq/contracts';
1
+ import { EIP712OrderValues } from '@nadohq/shared';
2
2
  import {
3
3
  EngineServerPerpBalance,
4
4
  EngineServerPerpProduct,
@@ -99,6 +99,7 @@ export interface IndexerServerOrder {
99
99
  amount: string;
100
100
  price_x18: string;
101
101
  expiration: string;
102
+ appendix: string;
102
103
  nonce: string;
103
104
  base_filled: string;
104
105
  // Includes fee
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  EIP712LeaderboardAuthenticationValues,
3
3
  SignedTx,
4
- } from '@nadohq/contracts';
4
+ } from '@nadohq/shared';
5
5
  import { IndexerEventType } from './IndexerEventType';
6
6
  import { IndexerLeaderboardRankType } from './IndexerLeaderboardType';
7
7
  import { NadoWithdrawCollateralTx } from './NadoTx';
@@ -1,4 +1,4 @@
1
- import { BigDecimal } from '@nadohq/utils';
1
+ import { BigDecimal } from '@nadohq/shared';
2
2
  import { IndexerPerpBalance, IndexerSpotBalance } from '../types';
3
3
 
4
4
  /**