@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.
- package/dist/IndexerBaseClient.cjs +57 -56
- package/dist/IndexerBaseClient.cjs.map +1 -1
- package/dist/IndexerBaseClient.d.cts +1 -2
- package/dist/IndexerBaseClient.d.ts +1 -2
- package/dist/IndexerBaseClient.js +7 -7
- package/dist/IndexerBaseClient.js.map +1 -1
- package/dist/IndexerClient.cjs +16 -16
- package/dist/IndexerClient.cjs.map +1 -1
- package/dist/IndexerClient.d.cts +2 -3
- package/dist/IndexerClient.d.ts +2 -3
- package/dist/IndexerClient.js +2 -2
- package/dist/IndexerClient.js.map +1 -1
- package/dist/dataMappers.cjs +105 -108
- package/dist/dataMappers.cjs.map +1 -1
- package/dist/dataMappers.d.cts +1 -2
- package/dist/dataMappers.d.ts +1 -2
- package/dist/dataMappers.js +7 -10
- package/dist/dataMappers.js.map +1 -1
- package/dist/endpoints.cjs +2 -2
- package/dist/endpoints.cjs.map +1 -1
- package/dist/endpoints.d.cts +1 -1
- package/dist/endpoints.d.ts +1 -1
- package/dist/endpoints.js +2 -2
- package/dist/endpoints.js.map +1 -1
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/types/clientTypes.cjs.map +1 -1
- package/dist/types/clientTypes.d.cts +3 -6
- package/dist/types/clientTypes.d.ts +3 -6
- package/dist/types/index.d.cts +1 -2
- package/dist/types/index.d.ts +1 -2
- package/dist/types/paginatedEventsTypes.cjs.map +1 -1
- package/dist/types/paginatedEventsTypes.d.cts +1 -2
- package/dist/types/paginatedEventsTypes.d.ts +1 -2
- package/dist/types/serverModelTypes.cjs.map +1 -1
- package/dist/types/serverModelTypes.d.cts +2 -1
- package/dist/types/serverModelTypes.d.ts +2 -1
- package/dist/types/serverTypes.cjs.map +1 -1
- package/dist/types/serverTypes.d.cts +1 -1
- package/dist/types/serverTypes.d.ts +1 -1
- package/dist/utils/index.d.cts +2 -3
- package/dist/utils/index.d.ts +2 -3
- package/dist/utils/indexerBalanceValue.cjs.map +1 -1
- package/dist/utils/indexerBalanceValue.d.cts +2 -3
- package/dist/utils/indexerBalanceValue.d.ts +2 -3
- package/dist/utils/indexerBalanceValue.js.map +1 -1
- package/package.json +4 -5
- package/src/IndexerBaseClient.ts +13 -13
- package/src/IndexerClient.ts +2 -2
- package/src/dataMappers.ts +8 -11
- package/src/endpoints.ts +2 -2
- package/src/types/clientTypes.ts +6 -8
- package/src/types/paginatedEventsTypes.ts +1 -2
- package/src/types/serverModelTypes.ts +2 -1
- package/src/types/serverTypes.ts +1 -1
- package/src/utils/indexerBalanceValue.ts +1 -1
package/src/IndexerClient.ts
CHANGED
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
QUOTE_PRODUCT_ID,
|
|
4
4
|
subaccountFromHex,
|
|
5
5
|
NLP_PRODUCT_ID,
|
|
6
|
-
} from '@nadohq/
|
|
7
|
-
import { toBigDecimal, toIntegerString } from '@nadohq/
|
|
6
|
+
} from '@nadohq/shared';
|
|
7
|
+
import { toBigDecimal, toIntegerString } from '@nadohq/shared';
|
|
8
8
|
|
|
9
9
|
import { IndexerBaseClient } from './IndexerBaseClient';
|
|
10
10
|
import {
|
package/src/dataMappers.ts
CHANGED
|
@@ -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
|
-
|
|
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/
|
|
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
|
|
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
|
-
|
|
102
|
-
|
|
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/
|
|
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
|
};
|
package/src/types/clientTypes.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EIP712OrderValues,
|
|
3
3
|
Market,
|
|
4
|
-
|
|
4
|
+
OrderAppendix,
|
|
5
5
|
PerpBalance,
|
|
6
6
|
PerpMarket,
|
|
7
7
|
ProductEngineType,
|
|
8
8
|
SpotBalance,
|
|
9
9
|
SpotMarket,
|
|
10
10
|
Subaccount,
|
|
11
|
-
} from '@nadohq/
|
|
12
|
-
import { BigDecimal } from '@nadohq/
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import { EIP712OrderValues } from '@nadohq/
|
|
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
|
package/src/types/serverTypes.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EIP712LeaderboardAuthenticationValues,
|
|
3
3
|
SignedTx,
|
|
4
|
-
} from '@nadohq/
|
|
4
|
+
} from '@nadohq/shared';
|
|
5
5
|
import { IndexerEventType } from './IndexerEventType';
|
|
6
6
|
import { IndexerLeaderboardRankType } from './IndexerLeaderboardType';
|
|
7
7
|
import { NadoWithdrawCollateralTx } from './NadoTx';
|