@nadohq/indexer-client 0.1.0-alpha.3 → 0.1.0-alpha.30
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 +73 -62
- package/dist/IndexerBaseClient.cjs.map +1 -1
- package/dist/IndexerBaseClient.d.cts +8 -4
- package/dist/IndexerBaseClient.d.ts +8 -4
- package/dist/IndexerBaseClient.js +26 -14
- package/dist/IndexerBaseClient.js.map +1 -1
- package/dist/IndexerClient.cjs +17 -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 +6 -3
- package/dist/IndexerClient.js.map +1 -1
- package/dist/dataMappers.cjs +119 -109
- package/dist/dataMappers.cjs.map +1 -1
- package/dist/dataMappers.d.cts +5 -5
- package/dist/dataMappers.d.ts +5 -5
- package/dist/dataMappers.js +26 -18
- 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.cjs +6 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -11
- package/dist/index.d.ts +10 -11
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/types/clientTypes.cjs.map +1 -1
- package/dist/types/clientTypes.d.cts +62 -13
- package/dist/types/clientTypes.d.ts +62 -13
- package/dist/types/index.cjs +11 -11
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +6 -7
- package/dist/types/index.d.ts +6 -7
- package/dist/types/index.js +5 -5
- package/dist/types/index.js.map +1 -1
- package/dist/types/paginatedEventsTypes.cjs.map +1 -1
- package/dist/types/paginatedEventsTypes.d.cts +6 -7
- package/dist/types/paginatedEventsTypes.d.ts +6 -7
- package/dist/types/serverModelTypes.cjs.map +1 -1
- package/dist/types/serverModelTypes.d.cts +8 -4
- package/dist/types/serverModelTypes.d.ts +8 -4
- package/dist/types/serverTypes.cjs.map +1 -1
- package/dist/types/serverTypes.d.cts +28 -5
- package/dist/types/serverTypes.d.ts +28 -5
- 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 +41 -20
- package/src/IndexerClient.ts +9 -6
- package/src/dataMappers.ts +33 -21
- package/src/endpoints.ts +2 -2
- package/src/index.ts +3 -2
- package/src/types/clientTypes.ts +73 -14
- package/src/types/index.ts +5 -5
- package/src/types/paginatedEventsTypes.ts +2 -3
- package/src/types/serverModelTypes.ts +8 -4
- package/src/types/serverTypes.ts +38 -5
- package/src/utils/indexerBalanceValue.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/serverTypes.ts"],"sourcesContent":["import {\n EIP712LeaderboardAuthenticationValues,\n SignedTx,\n} from '@nadohq/contracts';\nimport { IndexerEventType } from './IndexerEventType';\nimport { IndexerLeaderboardRankType } from './IndexerLeaderboardType';\nimport { NadoWithdrawCollateralTx } from './NadoTx';\nimport {\n IndexerServerCandlestick,\n IndexerServerEvent,\n IndexerServerLeaderboardContest,\n IndexerServerLeaderboardPosition,\n IndexerServerLeaderboardRegistration,\n IndexerServerMaker,\n IndexerServerMarketSnapshot,\n IndexerServerMarketSnapshotInterval,\n IndexerServerMatchEvent,\n IndexerServerOraclePrice,\n IndexerServerOrder,\n IndexerServerProductPayment,\n IndexerServerProductSnapshot,\n IndexerServerSnapshotsInterval,\n IndexerServerTx,\n IndexerServerNlpSnapshot,\n} from './serverModelTypes';\n\n/**\n * Params\n */\n\nexport interface IndexerServerListSubaccountsParams {\n // Inclusive, defaults to 0\n start?: number;\n // Defaults to 100\n limit?: number;\n address?: string;\n}\n\nexport interface IndexerServerMultiSubaccountSnapshotsParams {\n // Subaccount hex identifiers\n subaccounts: string[];\n timestamps: number[];\n // If not given, will return both isolated & non-iso balances\n isolated?: boolean;\n}\n\nexport interface IndexerServerReferralCodeParams {\n subaccount: string;\n}\n\nexport interface IndexerServerFundingRateParams {\n product_id: number;\n}\n\nexport interface IndexerServerFundingRatesParams {\n product_ids: number[];\n}\n\nexport interface IndexerServerPriceParams {\n product_id: number;\n}\n\nexport interface IndexerServerPerpPricesParams {\n product_ids: number[];\n}\n\nexport interface IndexerServerOraclePricesParams {\n product_ids: number[];\n}\n\nexport interface IndexerServerCandlesticksParams {\n product_id: number;\n granularity: number;\n // Seconds\n max_time?: number;\n limit: number;\n}\n\nexport type IndexerEdgeServerCandlesticksParams =\n IndexerServerCandlesticksParams;\n\nexport interface IndexerServerProductsParams {\n product_id: number;\n max_time?: number;\n limit: number;\n // submission_idx for pagination, inclusive\n idx?: string;\n}\n\nexport interface IndexerServerMultiProductsParams {\n product_ids: number[];\n max_time: number[];\n}\n\nexport interface IndexerServerEventsParams {\n subaccount?: string;\n product_ids?: number[];\n // If not given, will return both isolated & non-iso events\n isolated?: boolean;\n event_types?: IndexerEventType[];\n // Descending order for idx (time), defaults to true\n desc?: boolean;\n // submission_idx for pagination, inclusive\n idx?: string;\n max_time?: number;\n limit?:\n | {\n raw: number;\n }\n | {\n txs: number;\n };\n}\n\nexport interface IndexerServerOrdersParams {\n subaccount?: string;\n product_ids?: number[];\n digests?: string[];\n max_time?: number;\n limit?: number;\n // If not given, will return both isolated & non-iso orders\n isolated?: boolean;\n // submission_idx for pagination, inclusive\n idx?: string;\n}\n\nexport interface IndexerServerMatchEventsParams {\n subaccount?: string;\n product_ids?: number[];\n // If not given, will return both isolated & non-iso events\n isolated?: boolean;\n max_time?: number;\n limit: number;\n // submission_idx for pagination, inclusive\n idx?: string;\n}\n\nexport interface IndexerServerLinkedSignerParams {\n subaccount: string;\n}\n\nexport interface IndexerServerMarketSnapshotsParams {\n interval: IndexerServerMarketSnapshotInterval;\n // Defaults to all\n product_ids?: number[];\n}\n\nexport interface IndexerEdgeServerMarketSnapshotsParams {\n interval: IndexerServerMarketSnapshotInterval;\n}\n\nexport interface IndexerServerInterestFundingParams {\n subaccount: string;\n product_ids: number[];\n // If not given, defaults to latest\n max_idx?: string;\n max_time?: number;\n limit: number;\n}\n\nexport interface IndexerServerMakerStatisticsParams {\n product_id: number;\n epoch: number;\n interval: number;\n}\n\nexport interface IndexerServerLeaderboardParams {\n contest_id: number;\n rank_type: IndexerLeaderboardRankType;\n start?: number | string;\n limit?: number | string;\n}\n\nexport interface IndexerServerLeaderboardRankParams {\n subaccount: string;\n contest_ids: number[];\n}\n\nexport interface IndexerServerLeaderboardContestsParams {\n contest_ids: number[];\n}\n\nexport interface IndexerServerLeaderboardRegistrationParams {\n subaccount: string;\n contest_id: number;\n update_registration: SignedTx<EIP712LeaderboardAuthenticationValues> | null;\n}\n\nexport interface IndexerServerFastWithdrawalSignatureParams {\n /**\n * The submission index of the WithdrawCollateral tx to be used for fast withdraw.\n */\n idx: number | string;\n}\n\nexport interface IndexerServerNlpSnapshotsParams {\n interval: IndexerServerSnapshotsInterval;\n}\n\nexport interface IndexerServerDDAQueryParams {\n subaccount: string;\n}\n\n// Request\nexport interface IndexerServerQueryRequestByType {\n account_snapshots: IndexerServerMultiSubaccountSnapshotsParams;\n backlog: Record<string, never>;\n candlesticks: IndexerServerCandlesticksParams;\n direct_deposit_address: IndexerServerDDAQueryParams;\n edge_candlesticks: IndexerEdgeServerCandlesticksParams;\n edge_market_snapshots: IndexerEdgeServerMarketSnapshotsParams;\n events: IndexerServerEventsParams;\n fast_withdrawal_signature: IndexerServerFastWithdrawalSignatureParams;\n funding_rate: IndexerServerFundingRateParams;\n funding_rates: IndexerServerFundingRatesParams;\n interest_and_funding: IndexerServerInterestFundingParams;\n leaderboard: IndexerServerLeaderboardParams;\n leaderboard_contests: IndexerServerLeaderboardContestsParams;\n leaderboard_rank: IndexerServerLeaderboardRankParams;\n leaderboard_registration: IndexerServerLeaderboardRegistrationParams;\n linked_signer_rate_limit: IndexerServerLinkedSignerParams;\n maker_statistics: IndexerServerMakerStatisticsParams;\n market_snapshots: IndexerServerMarketSnapshotsParams;\n matches: IndexerServerMatchEventsParams;\n oracle_price: IndexerServerOraclePricesParams;\n orders: IndexerServerOrdersParams;\n perp_prices: IndexerServerPerpPricesParams;\n price: IndexerServerPriceParams;\n product_snapshots: IndexerServerMultiProductsParams;\n products: IndexerServerProductsParams;\n referral_code: IndexerServerReferralCodeParams;\n subaccounts: IndexerServerListSubaccountsParams;\n usdc_price: Record<string, never>;\n nlp_snapshots: IndexerServerNlpSnapshotsParams;\n}\n\nexport type IndexerServerQueryRequestType =\n keyof IndexerServerQueryRequestByType;\n\n/**\n * Responses\n */\n\nexport interface IndexerServerListSubaccountsResponse {\n subaccounts: {\n id: string;\n // Hex of subaccount bytes\n subaccount: string;\n }[];\n}\n\nexport interface IndexerServerMultiSubaccountSnapshotsResponse {\n // Map of subaccount hex -> timestamp requested -> latest events corresponding to each product\n snapshots: Record<string, Record<string, IndexerServerEvent[]>>;\n}\n\nexport interface IndexerServerReferralCodeResponse {\n referral_code: string | null;\n}\n\nexport interface IndexerServerFundingRate {\n product_id: number;\n funding_rate_x18: string;\n update_time: number;\n}\n\nexport type IndexerServerFundingRateResponse = IndexerServerFundingRate;\n\n// Map of productId -> IndexerServerFundingRate\nexport type IndexerServerFundingRatesResponse = Record<\n string,\n IndexerServerFundingRate\n>;\n\nexport interface IndexerServerPerpPrices {\n product_id: number;\n index_price_x18: string;\n mark_price_x18: string;\n update_time: number;\n}\n\nexport type IndexerServerPriceResponse = IndexerServerPerpPrices;\n\n// Map of productId -> IndexerServerPerpPrices\nexport type IndexerServerPerpPricesResponse = Record<\n string,\n IndexerServerPerpPrices\n>;\n\nexport interface IndexerServerOraclePricesResponse {\n prices: IndexerServerOraclePrice[];\n}\n\nexport interface IndexerServerCandlesticksResponse {\n candlesticks: IndexerServerCandlestick[];\n}\n\nexport type IndexerEdgeServerCandlesticksResponse =\n IndexerServerCandlesticksResponse;\n\nexport interface IndexerServerProductsResponse {\n products: IndexerServerProductSnapshot[];\n txs: IndexerServerTx[];\n}\n\n// Map of timestamp -> (productID -> IndexerServerProductSnapshot)\nexport type IndexerServerMultiProductsResponse = Record<\n string,\n Record<string, IndexerServerProductSnapshot>\n>;\n\nexport interface IndexerServerEventsResponse {\n events: IndexerServerEvent[];\n txs: IndexerServerTx[];\n}\n\nexport interface IndexerServerOrdersResponse {\n orders: IndexerServerOrder[];\n}\n\nexport interface IndexerServerMatchEventsResponse {\n matches: IndexerServerMatchEvent[];\n txs: IndexerServerTx[];\n}\n\nexport interface IndexerServerUsdcPriceResponse {\n price_x18: string;\n}\n\nexport interface IndexerServerLinkedSignerResponse {\n total_tx_limit: string;\n remaining_tx: string;\n wait_time: string;\n signer: string;\n}\n\nexport interface IndexerServerMarketSnapshotsResponse {\n snapshots: IndexerServerMarketSnapshot[];\n}\n\nexport interface IndexerEdgeServerMarketSnapshotsResponse {\n snapshots: Record<number, IndexerServerMarketSnapshot[]>;\n}\n\nexport interface IndexerServerInterestFundingResponse {\n interest_payments: IndexerServerProductPayment[];\n funding_payments: IndexerServerProductPayment[];\n next_idx: string;\n}\n\nexport interface IndexerServerMakerStatisticsResponse {\n reward_coefficient: string;\n makers: IndexerServerMaker[];\n}\n\nexport interface IndexerServerLeaderboardResponse {\n positions: IndexerServerLeaderboardPosition[];\n}\n\nexport interface IndexerServerLeaderboardRegistrationResponse {\n // For non-tiered contests, null if the user is not registered for the provided contestId.\n // For tiered contests (i.e., related contests), null if the user is not registered for any of the contests in the tier group.\n registration: IndexerServerLeaderboardRegistration | null;\n}\n\nexport interface IndexerServerLeaderboardRankResponse {\n // If the subaccount is not eligible for a given contest, it would not be included in the response.\n // contestId -> IndexerServerLeaderboardPosition\n positions: Record<string, IndexerServerLeaderboardPosition>;\n}\n\nexport interface IndexerServerLeaderboardContestsResponse {\n contests: IndexerServerLeaderboardContest[];\n}\n\nexport interface IndexerServerFastWithdrawalSignatureResponse {\n idx: string;\n tx: NadoWithdrawCollateralTx['withdraw_collateral'];\n tx_bytes: string;\n signatures: string[];\n}\n\nexport interface IndexerServerNlpSnapshotsResponse {\n snapshots: IndexerServerNlpSnapshot[];\n}\n\nexport interface IndexerServerDDAResponse {\n v1_address: string;\n}\n\nexport interface IndexerServerBacklogResponse {\n // Total number of transactions stored in the indexer DB\n total_txs: string;\n // Current nSubmissions value from the chain (i.e., number of processed txs)\n total_submissions: string;\n // Number of unprocessed transactions (total_txs - total_submissions)\n backlog_size: string;\n // UNIX timestamp (in seconds) of when the data was last updated\n updated_at: string;\n // Estimated time in seconds (float) to clear the entire backlog (null if unavailable)\n backlog_eta_in_seconds: string | null;\n // Current submission rate in transactions per second (float) (null if unavailable)\n txs_per_second: string | null;\n}\n\n// Response\nexport interface IndexerServerQueryResponseByType {\n account_snapshots: IndexerServerMultiSubaccountSnapshotsResponse;\n backlog: IndexerServerBacklogResponse;\n candlesticks: IndexerServerCandlesticksResponse;\n direct_deposit_address: IndexerServerDDAResponse;\n edge_candlesticks: IndexerEdgeServerCandlesticksResponse;\n edge_market_snapshots: IndexerEdgeServerMarketSnapshotsResponse;\n events: IndexerServerEventsResponse;\n fast_withdrawal_signature: IndexerServerFastWithdrawalSignatureResponse;\n funding_rate: IndexerServerFundingRateResponse;\n funding_rates: IndexerServerFundingRatesResponse;\n interest_and_funding: IndexerServerInterestFundingResponse;\n leaderboard: IndexerServerLeaderboardResponse;\n leaderboard_contests: IndexerServerLeaderboardContestsResponse;\n leaderboard_rank: IndexerServerLeaderboardRankResponse;\n leaderboard_registration: IndexerServerLeaderboardRegistrationResponse;\n linked_signer_rate_limit: IndexerServerLinkedSignerResponse;\n maker_statistics: IndexerServerMakerStatisticsResponse;\n market_snapshots: IndexerServerMarketSnapshotsResponse;\n matches: IndexerServerMatchEventsResponse;\n oracle_price: IndexerServerOraclePricesResponse;\n orders: IndexerServerOrdersResponse;\n perp_prices: IndexerServerPerpPricesResponse;\n price: IndexerServerPriceResponse;\n product_snapshots: IndexerServerMultiProductsResponse;\n products: IndexerServerProductsResponse;\n referral_code: IndexerServerReferralCodeResponse;\n subaccounts: IndexerServerListSubaccountsResponse;\n usdc_price: IndexerServerUsdcPriceResponse;\n nlp_snapshots: IndexerServerNlpSnapshotsResponse;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/types/serverTypes.ts"],"sourcesContent":["import {\n EIP712LeaderboardAuthenticationValues,\n SignedTx,\n} from '@nadohq/shared';\nimport { IndexerEventType } from './IndexerEventType';\nimport { IndexerLeaderboardRankType } from './IndexerLeaderboardType';\nimport { NadoWithdrawCollateralTx } from './NadoTx';\nimport {\n IndexerServerCandlestick,\n IndexerServerEvent,\n IndexerServerLeaderboardContest,\n IndexerServerLeaderboardPosition,\n IndexerServerLeaderboardRegistration,\n IndexerServerMaker,\n IndexerServerMarketSnapshot,\n IndexerServerMarketSnapshotInterval,\n IndexerServerMatchEvent,\n IndexerServerNlpSnapshot,\n IndexerServerOraclePrice,\n IndexerServerOrder,\n IndexerServerProductPayment,\n IndexerServerProductSnapshot,\n IndexerServerSnapshotsInterval,\n IndexerServerTx,\n} from './serverModelTypes';\n\n/**\n * Params\n */\n\nexport interface IndexerServerListSubaccountsParams {\n // Inclusive, defaults to 0\n start?: number;\n // Defaults to 100\n limit?: number;\n address?: string;\n}\n\nexport interface IndexerServerMultiSubaccountSnapshotsParams {\n // Subaccount hex identifiers\n subaccounts: string[];\n timestamps: number[];\n // If not given, will return both isolated & non-iso balances\n isolated?: boolean;\n}\n\nexport interface IndexerServerReferralCodeParams {\n subaccount: string;\n}\n\nexport interface IndexerServerFundingRateParams {\n product_id: number;\n}\n\nexport interface IndexerServerFundingRatesParams {\n product_ids: number[];\n}\n\nexport interface IndexerServerPriceParams {\n product_id: number;\n}\n\nexport interface IndexerServerPerpPricesParams {\n product_ids: number[];\n}\n\nexport interface IndexerServerOraclePricesParams {\n product_ids: number[];\n}\n\nexport interface IndexerServerCandlesticksParams {\n product_id: number;\n granularity: number;\n // Seconds\n max_time?: number;\n limit: number;\n}\n\nexport type IndexerEdgeServerCandlesticksParams =\n IndexerServerCandlesticksParams;\n\nexport interface IndexerServerProductsParams {\n product_id: number;\n max_time?: number;\n limit: number;\n // submission_idx for pagination, inclusive\n idx?: string;\n}\n\nexport interface IndexerServerMultiProductsParams {\n product_ids: number[];\n max_time: number[];\n}\n\nexport interface IndexerServerEventsParams {\n subaccount?: string;\n product_ids?: number[];\n // If not given, will return both isolated & non-iso events\n isolated?: boolean;\n event_types?: IndexerEventType[];\n // Descending order for idx (time), defaults to true\n desc?: boolean;\n // submission_idx for pagination, inclusive\n idx?: string;\n max_time?: number;\n limit?:\n | {\n raw: number;\n }\n | {\n txs: number;\n };\n}\n\nexport type IndexerServerTriggerTypeFilter =\n | 'none'\n | 'price_trigger'\n | 'time_trigger';\n\nexport interface IndexerServerOrdersParams {\n subaccount?: string;\n product_ids?: number[];\n trigger_types?: IndexerServerTriggerTypeFilter[];\n digests?: string[];\n max_time?: number;\n limit?: number;\n // If not given, will return both isolated & non-iso orders\n isolated?: boolean;\n // submission_idx for pagination, inclusive\n idx?: string;\n}\n\nexport interface IndexerServerMatchEventsParams {\n subaccount?: string;\n product_ids?: number[];\n // If not given, will return both isolated & non-iso events\n isolated?: boolean;\n max_time?: number;\n limit: number;\n // submission_idx for pagination, inclusive\n idx?: string;\n}\n\nexport interface IndexerServerLinkedSignerParams {\n subaccount: string;\n}\n\nexport interface IndexerServerMarketSnapshotsParams {\n interval: IndexerServerMarketSnapshotInterval;\n // Defaults to all\n product_ids?: number[];\n}\n\nexport interface IndexerEdgeServerMarketSnapshotsParams {\n interval: IndexerServerMarketSnapshotInterval;\n}\n\nexport interface IndexerServerInterestFundingParams {\n subaccount: string;\n product_ids: number[];\n // If not given, defaults to latest\n max_idx?: string;\n max_time?: number;\n limit: number;\n}\n\nexport interface IndexerServerMakerStatisticsParams {\n product_id: number;\n epoch: number;\n interval: number;\n}\n\nexport interface IndexerServerLeaderboardParams {\n contest_id: number;\n rank_type: IndexerLeaderboardRankType;\n start?: number | string;\n limit?: number | string;\n}\n\nexport interface IndexerServerLeaderboardRankParams {\n subaccount: string;\n contest_ids: number[];\n}\n\nexport interface IndexerServerLeaderboardContestsParams {\n contest_ids: number[];\n}\n\nexport interface IndexerServerLeaderboardRegistrationParams {\n subaccount: string;\n contest_id: number;\n update_registration: SignedTx<EIP712LeaderboardAuthenticationValues> | null;\n}\n\nexport interface IndexerServerFastWithdrawalSignatureParams {\n /**\n * The submission index of the WithdrawCollateral tx to be used for fast withdraw.\n */\n idx: number | string;\n}\n\nexport interface IndexerServerNlpSnapshotsParams {\n interval: IndexerServerSnapshotsInterval;\n}\n\nexport interface IndexerServerDDAQueryParams {\n subaccount: string;\n}\n\n// Request\nexport interface IndexerServerQueryRequestByType {\n account_snapshots: IndexerServerMultiSubaccountSnapshotsParams;\n backlog: Record<string, never>;\n candlesticks: IndexerServerCandlesticksParams;\n direct_deposit_address: IndexerServerDDAQueryParams;\n edge_candlesticks: IndexerEdgeServerCandlesticksParams;\n edge_market_snapshots: IndexerEdgeServerMarketSnapshotsParams;\n events: IndexerServerEventsParams;\n fast_withdrawal_signature: IndexerServerFastWithdrawalSignatureParams;\n funding_rate: IndexerServerFundingRateParams;\n funding_rates: IndexerServerFundingRatesParams;\n interest_and_funding: IndexerServerInterestFundingParams;\n leaderboard: IndexerServerLeaderboardParams;\n leaderboard_contests: IndexerServerLeaderboardContestsParams;\n leaderboard_rank: IndexerServerLeaderboardRankParams;\n leaderboard_registration: IndexerServerLeaderboardRegistrationParams;\n linked_signer_rate_limit: IndexerServerLinkedSignerParams;\n maker_statistics: IndexerServerMakerStatisticsParams;\n market_snapshots: IndexerServerMarketSnapshotsParams;\n matches: IndexerServerMatchEventsParams;\n oracle_price: IndexerServerOraclePricesParams;\n orders: IndexerServerOrdersParams;\n perp_prices: IndexerServerPerpPricesParams;\n price: IndexerServerPriceParams;\n product_snapshots: IndexerServerMultiProductsParams;\n products: IndexerServerProductsParams;\n referral_code: IndexerServerReferralCodeParams;\n subaccounts: IndexerServerListSubaccountsParams;\n quote_price: Record<string, never>;\n nlp_snapshots: IndexerServerNlpSnapshotsParams;\n}\n\nexport type IndexerServerQueryRequestType =\n keyof IndexerServerQueryRequestByType;\n\n/**\n * Responses\n */\n\nexport interface IndexerServerListSubaccountsResponse {\n subaccounts: {\n id: string;\n // Hex of subaccount bytes\n subaccount: string;\n }[];\n}\n\nexport interface IndexerServerMultiSubaccountSnapshotsResponse {\n // Map of subaccount hex -> timestamp requested -> latest events corresponding to each product\n snapshots: Record<string, Record<string, IndexerServerEvent[]>>;\n}\n\nexport interface IndexerServerReferralCodeResponse {\n referral_code: string | null;\n}\n\nexport interface IndexerServerFundingRate {\n product_id: number;\n funding_rate_x18: string;\n update_time: number;\n}\n\nexport type IndexerServerFundingRateResponse = IndexerServerFundingRate;\n\n// Map of productId -> IndexerServerFundingRate\nexport type IndexerServerFundingRatesResponse = Record<\n string,\n IndexerServerFundingRate\n>;\n\nexport interface IndexerServerPerpPrices {\n product_id: number;\n index_price_x18: string;\n mark_price_x18: string;\n update_time: number;\n}\n\nexport type IndexerServerPriceResponse = IndexerServerPerpPrices;\n\n// Map of productId -> IndexerServerPerpPrices\nexport type IndexerServerPerpPricesResponse = Record<\n string,\n IndexerServerPerpPrices\n>;\n\nexport interface IndexerServerOraclePricesResponse {\n prices: IndexerServerOraclePrice[];\n}\n\nexport interface IndexerServerCandlesticksResponse {\n candlesticks: IndexerServerCandlestick[];\n}\n\nexport type IndexerEdgeServerCandlesticksResponse =\n IndexerServerCandlesticksResponse;\n\nexport interface IndexerServerProductsResponse {\n products: IndexerServerProductSnapshot[];\n txs: IndexerServerTx[];\n}\n\n// Map of timestamp -> (productID -> IndexerServerProductSnapshot)\nexport type IndexerServerMultiProductsResponse = Record<\n string,\n Record<string, IndexerServerProductSnapshot>\n>;\n\nexport interface IndexerServerEventsResponse {\n events: IndexerServerEvent[];\n txs: IndexerServerTx[];\n}\n\nexport interface IndexerServerOrdersResponse {\n orders: IndexerServerOrder[];\n}\n\nexport interface IndexerServerMatchEventsResponse {\n matches: IndexerServerMatchEvent[];\n txs: IndexerServerTx[];\n}\n\nexport interface IndexerServerQuotePriceResponse {\n price_x18: string;\n}\n\nexport interface IndexerServerLinkedSignerResponse {\n total_tx_limit: string;\n remaining_tx: string;\n wait_time: string;\n signer: string;\n}\n\nexport interface IndexerServerMarketSnapshotsResponse {\n snapshots: IndexerServerMarketSnapshot[];\n}\n\nexport interface IndexerEdgeServerMarketSnapshotsResponse {\n snapshots: Record<number, IndexerServerMarketSnapshot[]>;\n}\n\nexport interface IndexerServerInterestFundingResponse {\n interest_payments: IndexerServerProductPayment[];\n funding_payments: IndexerServerProductPayment[];\n next_idx: string;\n}\n\nexport interface IndexerServerMakerStatisticsResponse {\n reward_coefficient: string;\n makers: IndexerServerMaker[];\n}\n\nexport interface IndexerServerLeaderboardResponse {\n positions: IndexerServerLeaderboardPosition[];\n}\n\nexport interface IndexerServerLeaderboardRegistrationResponse {\n // For non-tiered contests, null if the user is not registered for the provided contestId.\n // For tiered contests (i.e., related contests), null if the user is not registered for any of the contests in the tier group.\n registration: IndexerServerLeaderboardRegistration | null;\n}\n\nexport interface IndexerServerLeaderboardRankResponse {\n // If the subaccount is not eligible for a given contest, it would not be included in the response.\n // contestId -> IndexerServerLeaderboardPosition\n positions: Record<string, IndexerServerLeaderboardPosition>;\n}\n\nexport interface IndexerServerLeaderboardContestsResponse {\n contests: IndexerServerLeaderboardContest[];\n}\n\nexport interface IndexerServerFastWithdrawalSignatureResponse {\n idx: string;\n tx: NadoWithdrawCollateralTx['withdraw_collateral'];\n tx_bytes: string;\n signatures: string[];\n}\n\nexport interface IndexerServerNlpSnapshotsResponse {\n snapshots: IndexerServerNlpSnapshot[];\n}\n\nexport interface IndexerServerDDAResponse {\n v1_address: string;\n}\n\nexport interface IndexerServerBacklogResponse {\n // Total number of transactions stored in the indexer DB\n total_txs: string;\n // Current nSubmissions value from the chain (i.e., number of processed txs)\n total_submissions: string;\n // Number of unprocessed transactions (total_txs - total_submissions)\n backlog_size: string;\n // UNIX timestamp (in seconds) of when the data was last updated\n updated_at: string;\n // Estimated time in seconds (float) to clear the entire backlog (null if unavailable)\n backlog_eta_in_seconds: string | null;\n // Current submission rate in transactions per second (float) (null if unavailable)\n txs_per_second: string | null;\n}\n\n// Response\nexport interface IndexerServerQueryResponseByType {\n account_snapshots: IndexerServerMultiSubaccountSnapshotsResponse;\n backlog: IndexerServerBacklogResponse;\n candlesticks: IndexerServerCandlesticksResponse;\n direct_deposit_address: IndexerServerDDAResponse;\n edge_candlesticks: IndexerEdgeServerCandlesticksResponse;\n edge_market_snapshots: IndexerEdgeServerMarketSnapshotsResponse;\n events: IndexerServerEventsResponse;\n fast_withdrawal_signature: IndexerServerFastWithdrawalSignatureResponse;\n funding_rate: IndexerServerFundingRateResponse;\n funding_rates: IndexerServerFundingRatesResponse;\n interest_and_funding: IndexerServerInterestFundingResponse;\n leaderboard: IndexerServerLeaderboardResponse;\n leaderboard_contests: IndexerServerLeaderboardContestsResponse;\n leaderboard_rank: IndexerServerLeaderboardRankResponse;\n leaderboard_registration: IndexerServerLeaderboardRegistrationResponse;\n linked_signer_rate_limit: IndexerServerLinkedSignerResponse;\n maker_statistics: IndexerServerMakerStatisticsResponse;\n market_snapshots: IndexerServerMarketSnapshotsResponse;\n matches: IndexerServerMatchEventsResponse;\n oracle_price: IndexerServerOraclePricesResponse;\n orders: IndexerServerOrdersResponse;\n perp_prices: IndexerServerPerpPricesResponse;\n price: IndexerServerPriceResponse;\n product_snapshots: IndexerServerMultiProductsResponse;\n products: IndexerServerProductsResponse;\n referral_code: IndexerServerReferralCodeResponse;\n subaccounts: IndexerServerListSubaccountsResponse;\n quote_price: IndexerServerQuotePriceResponse;\n nlp_snapshots: IndexerServerNlpSnapshotsResponse;\n}\n\n/**\n * V2 API Types\n */\n\n/**\n * Individual ticker data from v2 indexer endpoint (server format)\n */\nexport interface IndexerServerV2TickerResponse {\n product_id: number;\n ticker_id: string;\n base_currency: string;\n quote_currency: string;\n last_price: number;\n base_volume: number;\n quote_volume: number;\n price_change_percent_24h: number;\n}\n\n/**\n * Response from v2 tickers endpoint (server format)\n * Maps ticker IDs to their respective ticker data\n */\nexport type IndexerServerV2TickersResponse = Record<\n string,\n IndexerServerV2TickerResponse\n>;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SignedTx, EIP712LeaderboardAuthenticationValues } from '@nadohq/
|
|
1
|
+
import { SignedTx, EIP712LeaderboardAuthenticationValues } from '@nadohq/shared';
|
|
2
2
|
import { IndexerEventType } from './IndexerEventType.cjs';
|
|
3
3
|
import { IndexerLeaderboardRankType } from './IndexerLeaderboardType.cjs';
|
|
4
4
|
import { NadoWithdrawCollateralTx } from './NadoTx.cjs';
|
|
@@ -67,9 +67,11 @@ interface IndexerServerEventsParams {
|
|
|
67
67
|
txs: number;
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
+
type IndexerServerTriggerTypeFilter = 'none' | 'price_trigger' | 'time_trigger';
|
|
70
71
|
interface IndexerServerOrdersParams {
|
|
71
72
|
subaccount?: string;
|
|
72
73
|
product_ids?: number[];
|
|
74
|
+
trigger_types?: IndexerServerTriggerTypeFilter[];
|
|
73
75
|
digests?: string[];
|
|
74
76
|
max_time?: number;
|
|
75
77
|
limit?: number;
|
|
@@ -164,7 +166,7 @@ interface IndexerServerQueryRequestByType {
|
|
|
164
166
|
products: IndexerServerProductsParams;
|
|
165
167
|
referral_code: IndexerServerReferralCodeParams;
|
|
166
168
|
subaccounts: IndexerServerListSubaccountsParams;
|
|
167
|
-
|
|
169
|
+
quote_price: Record<string, never>;
|
|
168
170
|
nlp_snapshots: IndexerServerNlpSnapshotsParams;
|
|
169
171
|
}
|
|
170
172
|
type IndexerServerQueryRequestType = keyof IndexerServerQueryRequestByType;
|
|
@@ -221,7 +223,7 @@ interface IndexerServerMatchEventsResponse {
|
|
|
221
223
|
matches: IndexerServerMatchEvent[];
|
|
222
224
|
txs: IndexerServerTx[];
|
|
223
225
|
}
|
|
224
|
-
interface
|
|
226
|
+
interface IndexerServerQuotePriceResponse {
|
|
225
227
|
price_x18: string;
|
|
226
228
|
}
|
|
227
229
|
interface IndexerServerLinkedSignerResponse {
|
|
@@ -305,8 +307,29 @@ interface IndexerServerQueryResponseByType {
|
|
|
305
307
|
products: IndexerServerProductsResponse;
|
|
306
308
|
referral_code: IndexerServerReferralCodeResponse;
|
|
307
309
|
subaccounts: IndexerServerListSubaccountsResponse;
|
|
308
|
-
|
|
310
|
+
quote_price: IndexerServerQuotePriceResponse;
|
|
309
311
|
nlp_snapshots: IndexerServerNlpSnapshotsResponse;
|
|
310
312
|
}
|
|
313
|
+
/**
|
|
314
|
+
* V2 API Types
|
|
315
|
+
*/
|
|
316
|
+
/**
|
|
317
|
+
* Individual ticker data from v2 indexer endpoint (server format)
|
|
318
|
+
*/
|
|
319
|
+
interface IndexerServerV2TickerResponse {
|
|
320
|
+
product_id: number;
|
|
321
|
+
ticker_id: string;
|
|
322
|
+
base_currency: string;
|
|
323
|
+
quote_currency: string;
|
|
324
|
+
last_price: number;
|
|
325
|
+
base_volume: number;
|
|
326
|
+
quote_volume: number;
|
|
327
|
+
price_change_percent_24h: number;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Response from v2 tickers endpoint (server format)
|
|
331
|
+
* Maps ticker IDs to their respective ticker data
|
|
332
|
+
*/
|
|
333
|
+
type IndexerServerV2TickersResponse = Record<string, IndexerServerV2TickerResponse>;
|
|
311
334
|
|
|
312
|
-
export type { IndexerEdgeServerCandlesticksParams, IndexerEdgeServerCandlesticksResponse, IndexerEdgeServerMarketSnapshotsParams, IndexerEdgeServerMarketSnapshotsResponse, IndexerServerBacklogResponse, IndexerServerCandlesticksParams, IndexerServerCandlesticksResponse, IndexerServerDDAQueryParams, IndexerServerDDAResponse, IndexerServerEventsParams, IndexerServerEventsResponse, IndexerServerFastWithdrawalSignatureParams, IndexerServerFastWithdrawalSignatureResponse, IndexerServerFundingRate, IndexerServerFundingRateParams, IndexerServerFundingRateResponse, IndexerServerFundingRatesParams, IndexerServerFundingRatesResponse, IndexerServerInterestFundingParams, IndexerServerInterestFundingResponse, IndexerServerLeaderboardContestsParams, IndexerServerLeaderboardContestsResponse, IndexerServerLeaderboardParams, IndexerServerLeaderboardRankParams, IndexerServerLeaderboardRankResponse, IndexerServerLeaderboardRegistrationParams, IndexerServerLeaderboardRegistrationResponse, IndexerServerLeaderboardResponse, IndexerServerLinkedSignerParams, IndexerServerLinkedSignerResponse, IndexerServerListSubaccountsParams, IndexerServerListSubaccountsResponse, IndexerServerMakerStatisticsParams, IndexerServerMakerStatisticsResponse, IndexerServerMarketSnapshotsParams, IndexerServerMarketSnapshotsResponse, IndexerServerMatchEventsParams, IndexerServerMatchEventsResponse, IndexerServerMultiProductsParams, IndexerServerMultiProductsResponse, IndexerServerMultiSubaccountSnapshotsParams, IndexerServerMultiSubaccountSnapshotsResponse, IndexerServerNlpSnapshotsParams, IndexerServerNlpSnapshotsResponse, IndexerServerOraclePricesParams, IndexerServerOraclePricesResponse, IndexerServerOrdersParams, IndexerServerOrdersResponse, IndexerServerPerpPrices, IndexerServerPerpPricesParams, IndexerServerPerpPricesResponse, IndexerServerPriceParams, IndexerServerPriceResponse, IndexerServerProductsParams, IndexerServerProductsResponse, IndexerServerQueryRequestByType, IndexerServerQueryRequestType, IndexerServerQueryResponseByType, IndexerServerReferralCodeParams, IndexerServerReferralCodeResponse,
|
|
335
|
+
export type { IndexerEdgeServerCandlesticksParams, IndexerEdgeServerCandlesticksResponse, IndexerEdgeServerMarketSnapshotsParams, IndexerEdgeServerMarketSnapshotsResponse, IndexerServerBacklogResponse, IndexerServerCandlesticksParams, IndexerServerCandlesticksResponse, IndexerServerDDAQueryParams, IndexerServerDDAResponse, IndexerServerEventsParams, IndexerServerEventsResponse, IndexerServerFastWithdrawalSignatureParams, IndexerServerFastWithdrawalSignatureResponse, IndexerServerFundingRate, IndexerServerFundingRateParams, IndexerServerFundingRateResponse, IndexerServerFundingRatesParams, IndexerServerFundingRatesResponse, IndexerServerInterestFundingParams, IndexerServerInterestFundingResponse, IndexerServerLeaderboardContestsParams, IndexerServerLeaderboardContestsResponse, IndexerServerLeaderboardParams, IndexerServerLeaderboardRankParams, IndexerServerLeaderboardRankResponse, IndexerServerLeaderboardRegistrationParams, IndexerServerLeaderboardRegistrationResponse, IndexerServerLeaderboardResponse, IndexerServerLinkedSignerParams, IndexerServerLinkedSignerResponse, IndexerServerListSubaccountsParams, IndexerServerListSubaccountsResponse, IndexerServerMakerStatisticsParams, IndexerServerMakerStatisticsResponse, IndexerServerMarketSnapshotsParams, IndexerServerMarketSnapshotsResponse, IndexerServerMatchEventsParams, IndexerServerMatchEventsResponse, IndexerServerMultiProductsParams, IndexerServerMultiProductsResponse, IndexerServerMultiSubaccountSnapshotsParams, IndexerServerMultiSubaccountSnapshotsResponse, IndexerServerNlpSnapshotsParams, IndexerServerNlpSnapshotsResponse, IndexerServerOraclePricesParams, IndexerServerOraclePricesResponse, IndexerServerOrdersParams, IndexerServerOrdersResponse, IndexerServerPerpPrices, IndexerServerPerpPricesParams, IndexerServerPerpPricesResponse, IndexerServerPriceParams, IndexerServerPriceResponse, IndexerServerProductsParams, IndexerServerProductsResponse, IndexerServerQueryRequestByType, IndexerServerQueryRequestType, IndexerServerQueryResponseByType, IndexerServerQuotePriceResponse, IndexerServerReferralCodeParams, IndexerServerReferralCodeResponse, IndexerServerTriggerTypeFilter, IndexerServerV2TickerResponse, IndexerServerV2TickersResponse };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SignedTx, EIP712LeaderboardAuthenticationValues } from '@nadohq/
|
|
1
|
+
import { SignedTx, EIP712LeaderboardAuthenticationValues } from '@nadohq/shared';
|
|
2
2
|
import { IndexerEventType } from './IndexerEventType.js';
|
|
3
3
|
import { IndexerLeaderboardRankType } from './IndexerLeaderboardType.js';
|
|
4
4
|
import { NadoWithdrawCollateralTx } from './NadoTx.js';
|
|
@@ -67,9 +67,11 @@ interface IndexerServerEventsParams {
|
|
|
67
67
|
txs: number;
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
+
type IndexerServerTriggerTypeFilter = 'none' | 'price_trigger' | 'time_trigger';
|
|
70
71
|
interface IndexerServerOrdersParams {
|
|
71
72
|
subaccount?: string;
|
|
72
73
|
product_ids?: number[];
|
|
74
|
+
trigger_types?: IndexerServerTriggerTypeFilter[];
|
|
73
75
|
digests?: string[];
|
|
74
76
|
max_time?: number;
|
|
75
77
|
limit?: number;
|
|
@@ -164,7 +166,7 @@ interface IndexerServerQueryRequestByType {
|
|
|
164
166
|
products: IndexerServerProductsParams;
|
|
165
167
|
referral_code: IndexerServerReferralCodeParams;
|
|
166
168
|
subaccounts: IndexerServerListSubaccountsParams;
|
|
167
|
-
|
|
169
|
+
quote_price: Record<string, never>;
|
|
168
170
|
nlp_snapshots: IndexerServerNlpSnapshotsParams;
|
|
169
171
|
}
|
|
170
172
|
type IndexerServerQueryRequestType = keyof IndexerServerQueryRequestByType;
|
|
@@ -221,7 +223,7 @@ interface IndexerServerMatchEventsResponse {
|
|
|
221
223
|
matches: IndexerServerMatchEvent[];
|
|
222
224
|
txs: IndexerServerTx[];
|
|
223
225
|
}
|
|
224
|
-
interface
|
|
226
|
+
interface IndexerServerQuotePriceResponse {
|
|
225
227
|
price_x18: string;
|
|
226
228
|
}
|
|
227
229
|
interface IndexerServerLinkedSignerResponse {
|
|
@@ -305,8 +307,29 @@ interface IndexerServerQueryResponseByType {
|
|
|
305
307
|
products: IndexerServerProductsResponse;
|
|
306
308
|
referral_code: IndexerServerReferralCodeResponse;
|
|
307
309
|
subaccounts: IndexerServerListSubaccountsResponse;
|
|
308
|
-
|
|
310
|
+
quote_price: IndexerServerQuotePriceResponse;
|
|
309
311
|
nlp_snapshots: IndexerServerNlpSnapshotsResponse;
|
|
310
312
|
}
|
|
313
|
+
/**
|
|
314
|
+
* V2 API Types
|
|
315
|
+
*/
|
|
316
|
+
/**
|
|
317
|
+
* Individual ticker data from v2 indexer endpoint (server format)
|
|
318
|
+
*/
|
|
319
|
+
interface IndexerServerV2TickerResponse {
|
|
320
|
+
product_id: number;
|
|
321
|
+
ticker_id: string;
|
|
322
|
+
base_currency: string;
|
|
323
|
+
quote_currency: string;
|
|
324
|
+
last_price: number;
|
|
325
|
+
base_volume: number;
|
|
326
|
+
quote_volume: number;
|
|
327
|
+
price_change_percent_24h: number;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Response from v2 tickers endpoint (server format)
|
|
331
|
+
* Maps ticker IDs to their respective ticker data
|
|
332
|
+
*/
|
|
333
|
+
type IndexerServerV2TickersResponse = Record<string, IndexerServerV2TickerResponse>;
|
|
311
334
|
|
|
312
|
-
export type { IndexerEdgeServerCandlesticksParams, IndexerEdgeServerCandlesticksResponse, IndexerEdgeServerMarketSnapshotsParams, IndexerEdgeServerMarketSnapshotsResponse, IndexerServerBacklogResponse, IndexerServerCandlesticksParams, IndexerServerCandlesticksResponse, IndexerServerDDAQueryParams, IndexerServerDDAResponse, IndexerServerEventsParams, IndexerServerEventsResponse, IndexerServerFastWithdrawalSignatureParams, IndexerServerFastWithdrawalSignatureResponse, IndexerServerFundingRate, IndexerServerFundingRateParams, IndexerServerFundingRateResponse, IndexerServerFundingRatesParams, IndexerServerFundingRatesResponse, IndexerServerInterestFundingParams, IndexerServerInterestFundingResponse, IndexerServerLeaderboardContestsParams, IndexerServerLeaderboardContestsResponse, IndexerServerLeaderboardParams, IndexerServerLeaderboardRankParams, IndexerServerLeaderboardRankResponse, IndexerServerLeaderboardRegistrationParams, IndexerServerLeaderboardRegistrationResponse, IndexerServerLeaderboardResponse, IndexerServerLinkedSignerParams, IndexerServerLinkedSignerResponse, IndexerServerListSubaccountsParams, IndexerServerListSubaccountsResponse, IndexerServerMakerStatisticsParams, IndexerServerMakerStatisticsResponse, IndexerServerMarketSnapshotsParams, IndexerServerMarketSnapshotsResponse, IndexerServerMatchEventsParams, IndexerServerMatchEventsResponse, IndexerServerMultiProductsParams, IndexerServerMultiProductsResponse, IndexerServerMultiSubaccountSnapshotsParams, IndexerServerMultiSubaccountSnapshotsResponse, IndexerServerNlpSnapshotsParams, IndexerServerNlpSnapshotsResponse, IndexerServerOraclePricesParams, IndexerServerOraclePricesResponse, IndexerServerOrdersParams, IndexerServerOrdersResponse, IndexerServerPerpPrices, IndexerServerPerpPricesParams, IndexerServerPerpPricesResponse, IndexerServerPriceParams, IndexerServerPriceResponse, IndexerServerProductsParams, IndexerServerProductsResponse, IndexerServerQueryRequestByType, IndexerServerQueryRequestType, IndexerServerQueryResponseByType, IndexerServerReferralCodeParams, IndexerServerReferralCodeResponse,
|
|
335
|
+
export type { IndexerEdgeServerCandlesticksParams, IndexerEdgeServerCandlesticksResponse, IndexerEdgeServerMarketSnapshotsParams, IndexerEdgeServerMarketSnapshotsResponse, IndexerServerBacklogResponse, IndexerServerCandlesticksParams, IndexerServerCandlesticksResponse, IndexerServerDDAQueryParams, IndexerServerDDAResponse, IndexerServerEventsParams, IndexerServerEventsResponse, IndexerServerFastWithdrawalSignatureParams, IndexerServerFastWithdrawalSignatureResponse, IndexerServerFundingRate, IndexerServerFundingRateParams, IndexerServerFundingRateResponse, IndexerServerFundingRatesParams, IndexerServerFundingRatesResponse, IndexerServerInterestFundingParams, IndexerServerInterestFundingResponse, IndexerServerLeaderboardContestsParams, IndexerServerLeaderboardContestsResponse, IndexerServerLeaderboardParams, IndexerServerLeaderboardRankParams, IndexerServerLeaderboardRankResponse, IndexerServerLeaderboardRegistrationParams, IndexerServerLeaderboardRegistrationResponse, IndexerServerLeaderboardResponse, IndexerServerLinkedSignerParams, IndexerServerLinkedSignerResponse, IndexerServerListSubaccountsParams, IndexerServerListSubaccountsResponse, IndexerServerMakerStatisticsParams, IndexerServerMakerStatisticsResponse, IndexerServerMarketSnapshotsParams, IndexerServerMarketSnapshotsResponse, IndexerServerMatchEventsParams, IndexerServerMatchEventsResponse, IndexerServerMultiProductsParams, IndexerServerMultiProductsResponse, IndexerServerMultiSubaccountSnapshotsParams, IndexerServerMultiSubaccountSnapshotsResponse, IndexerServerNlpSnapshotsParams, IndexerServerNlpSnapshotsResponse, IndexerServerOraclePricesParams, IndexerServerOraclePricesResponse, IndexerServerOrdersParams, IndexerServerOrdersResponse, IndexerServerPerpPrices, IndexerServerPerpPricesParams, IndexerServerPerpPricesResponse, IndexerServerPriceParams, IndexerServerPriceResponse, IndexerServerProductsParams, IndexerServerProductsResponse, IndexerServerQueryRequestByType, IndexerServerQueryRequestType, IndexerServerQueryResponseByType, IndexerServerQuotePriceResponse, IndexerServerReferralCodeParams, IndexerServerReferralCodeResponse, IndexerServerTriggerTypeFilter, IndexerServerV2TickerResponse, IndexerServerV2TickersResponse };
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
export { calcIndexerPerpBalanceNotionalValue, calcIndexerPerpBalanceValue, calcIndexerSpotBalanceValue } from './indexerBalanceValue.cjs';
|
|
2
|
-
import '@nadohq/
|
|
2
|
+
import '@nadohq/shared';
|
|
3
3
|
import '../types/clientTypes.cjs';
|
|
4
|
-
import '@nadohq/contracts';
|
|
5
4
|
import 'viem';
|
|
6
5
|
import '../types/CandlestickPeriod.cjs';
|
|
7
6
|
import '../types/IndexerEventType.cjs';
|
|
8
7
|
import '../types/IndexerLeaderboardType.cjs';
|
|
9
|
-
import '../types/serverTypes.cjs';
|
|
10
8
|
import '../types/NadoTx.cjs';
|
|
9
|
+
import '../types/serverTypes.cjs';
|
|
11
10
|
import '../types/serverModelTypes.cjs';
|
|
12
11
|
import '@nadohq/engine-client';
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
export { calcIndexerPerpBalanceNotionalValue, calcIndexerPerpBalanceValue, calcIndexerSpotBalanceValue } from './indexerBalanceValue.js';
|
|
2
|
-
import '@nadohq/
|
|
2
|
+
import '@nadohq/shared';
|
|
3
3
|
import '../types/clientTypes.js';
|
|
4
|
-
import '@nadohq/contracts';
|
|
5
4
|
import 'viem';
|
|
6
5
|
import '../types/CandlestickPeriod.js';
|
|
7
6
|
import '../types/IndexerEventType.js';
|
|
8
7
|
import '../types/IndexerLeaderboardType.js';
|
|
9
|
-
import '../types/serverTypes.js';
|
|
10
8
|
import '../types/NadoTx.js';
|
|
9
|
+
import '../types/serverTypes.js';
|
|
11
10
|
import '../types/serverModelTypes.js';
|
|
12
11
|
import '@nadohq/engine-client';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/indexerBalanceValue.ts"],"sourcesContent":["import { BigDecimal } from '@nadohq/
|
|
1
|
+
{"version":3,"sources":["../../src/utils/indexerBalanceValue.ts"],"sourcesContent":["import { BigDecimal } from '@nadohq/shared';\nimport { IndexerPerpBalance, IndexerSpotBalance } from '../types';\n\n/**\n * Most of these calculations take oraclePrice as a separate parameter. This allows us to not rely on the Snapshot\n * interfaces to give clients the optionality to pass either the pre or post balance\n */\n\n/**\n * Calculates the quote value of an indexer spot balance\n *\n * @param balance\n * @param oraclePrice\n */\nexport function calcIndexerSpotBalanceValue(\n balance: IndexerSpotBalance,\n oraclePrice: BigDecimal,\n): BigDecimal {\n return balance.amount.multipliedBy(oraclePrice);\n}\n\n/**\n * Calculates the notional value of an indexer perp balance\n *\n * @param balance\n * @param oraclePrice\n */\nexport function calcIndexerPerpBalanceNotionalValue(\n balance: IndexerPerpBalance,\n oraclePrice: BigDecimal,\n): BigDecimal {\n return balance.amount.multipliedBy(oraclePrice).abs();\n}\n\n/**\n * Calculates the true quote value of a indexer perp balance, which is the same as its unrealized pnl / unsettled quote\n *\n * @param balance\n * @param oraclePrice\n */\nexport function calcIndexerPerpBalanceValue(\n balance: IndexerPerpBalance,\n oraclePrice: BigDecimal,\n): BigDecimal {\n return balance.amount.multipliedBy(oraclePrice).plus(balance.vQuoteBalance);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcO,SAAS,4BACd,SACA,aACY;AACZ,SAAO,QAAQ,OAAO,aAAa,WAAW;AAChD;AAQO,SAAS,oCACd,SACA,aACY;AACZ,SAAO,QAAQ,OAAO,aAAa,WAAW,EAAE,IAAI;AACtD;AAQO,SAAS,4BACd,SACA,aACY;AACZ,SAAO,QAAQ,OAAO,aAAa,WAAW,EAAE,KAAK,QAAQ,aAAa;AAC5E;","names":[]}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { BigDecimal } from '@nadohq/
|
|
1
|
+
import { BigDecimal } from '@nadohq/shared';
|
|
2
2
|
import { IndexerSpotBalance, IndexerPerpBalance } from '../types/clientTypes.cjs';
|
|
3
|
-
import '@nadohq/contracts';
|
|
4
3
|
import 'viem';
|
|
5
4
|
import '../types/CandlestickPeriod.cjs';
|
|
6
5
|
import '../types/IndexerEventType.cjs';
|
|
7
6
|
import '../types/IndexerLeaderboardType.cjs';
|
|
8
|
-
import '../types/serverTypes.cjs';
|
|
9
7
|
import '../types/NadoTx.cjs';
|
|
8
|
+
import '../types/serverTypes.cjs';
|
|
10
9
|
import '../types/serverModelTypes.cjs';
|
|
11
10
|
import '@nadohq/engine-client';
|
|
12
11
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { BigDecimal } from '@nadohq/
|
|
1
|
+
import { BigDecimal } from '@nadohq/shared';
|
|
2
2
|
import { IndexerSpotBalance, IndexerPerpBalance } from '../types/clientTypes.js';
|
|
3
|
-
import '@nadohq/contracts';
|
|
4
3
|
import 'viem';
|
|
5
4
|
import '../types/CandlestickPeriod.js';
|
|
6
5
|
import '../types/IndexerEventType.js';
|
|
7
6
|
import '../types/IndexerLeaderboardType.js';
|
|
8
|
-
import '../types/serverTypes.js';
|
|
9
7
|
import '../types/NadoTx.js';
|
|
8
|
+
import '../types/serverTypes.js';
|
|
10
9
|
import '../types/serverModelTypes.js';
|
|
11
10
|
import '@nadohq/engine-client';
|
|
12
11
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/indexerBalanceValue.ts"],"sourcesContent":["import { BigDecimal } from '@nadohq/
|
|
1
|
+
{"version":3,"sources":["../../src/utils/indexerBalanceValue.ts"],"sourcesContent":["import { BigDecimal } from '@nadohq/shared';\nimport { IndexerPerpBalance, IndexerSpotBalance } from '../types';\n\n/**\n * Most of these calculations take oraclePrice as a separate parameter. This allows us to not rely on the Snapshot\n * interfaces to give clients the optionality to pass either the pre or post balance\n */\n\n/**\n * Calculates the quote value of an indexer spot balance\n *\n * @param balance\n * @param oraclePrice\n */\nexport function calcIndexerSpotBalanceValue(\n balance: IndexerSpotBalance,\n oraclePrice: BigDecimal,\n): BigDecimal {\n return balance.amount.multipliedBy(oraclePrice);\n}\n\n/**\n * Calculates the notional value of an indexer perp balance\n *\n * @param balance\n * @param oraclePrice\n */\nexport function calcIndexerPerpBalanceNotionalValue(\n balance: IndexerPerpBalance,\n oraclePrice: BigDecimal,\n): BigDecimal {\n return balance.amount.multipliedBy(oraclePrice).abs();\n}\n\n/**\n * Calculates the true quote value of a indexer perp balance, which is the same as its unrealized pnl / unsettled quote\n *\n * @param balance\n * @param oraclePrice\n */\nexport function calcIndexerPerpBalanceValue(\n balance: IndexerPerpBalance,\n oraclePrice: BigDecimal,\n): BigDecimal {\n return balance.amount.multipliedBy(oraclePrice).plus(balance.vQuoteBalance);\n}\n"],"mappings":";AAcO,SAAS,4BACd,SACA,aACY;AACZ,SAAO,QAAQ,OAAO,aAAa,WAAW;AAChD;AAQO,SAAS,oCACd,SACA,aACY;AACZ,SAAO,QAAQ,OAAO,aAAa,WAAW,EAAE,IAAI;AACtD;AAQO,SAAS,4BACd,SACA,aACY;AACZ,SAAO,QAAQ,OAAO,aAAa,WAAW,EAAE,KAAK,QAAQ,aAAa;AAC5E;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nadohq/indexer-client",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.30",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "> TODO: description",
|
|
@@ -37,9 +37,8 @@
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@nadohq/
|
|
41
|
-
"@nadohq/
|
|
42
|
-
"@nadohq/utils": "^0.1.0-alpha.3",
|
|
40
|
+
"@nadohq/engine-client": "^0.1.0-alpha.30",
|
|
41
|
+
"@nadohq/shared": "^0.1.0-alpha.30",
|
|
43
42
|
"axios": "*",
|
|
44
43
|
"ts-mixer": "*"
|
|
45
44
|
},
|
|
@@ -49,5 +48,5 @@
|
|
|
49
48
|
"devDependencies": {
|
|
50
49
|
"viem": "*"
|
|
51
50
|
},
|
|
52
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "f91906311b3dfc22e8e174d5ed8fa459ec812a08"
|
|
53
52
|
}
|
package/src/IndexerBaseClient.ts
CHANGED
|
@@ -4,23 +4,22 @@ import {
|
|
|
4
4
|
getDefaultRecvTime,
|
|
5
5
|
getNadoEIP712Values,
|
|
6
6
|
getSignedTransactionRequest,
|
|
7
|
+
getValidatedAddress,
|
|
8
|
+
getValidatedHex,
|
|
9
|
+
mapValues,
|
|
10
|
+
nowInSeconds,
|
|
11
|
+
removeDecimals,
|
|
7
12
|
SignableRequestType,
|
|
8
13
|
SignableRequestTypeToParams,
|
|
9
14
|
SignedTx,
|
|
10
15
|
subaccountFromHex,
|
|
11
16
|
subaccountToHex,
|
|
12
|
-
WalletClientWithAccount,
|
|
13
|
-
} from '@nadohq/contracts';
|
|
14
|
-
import {
|
|
15
|
-
getValidatedHex,
|
|
16
|
-
mapValues,
|
|
17
|
-
nowInSeconds,
|
|
18
|
-
removeDecimals,
|
|
19
17
|
toBigDecimal,
|
|
20
18
|
toBigInt,
|
|
21
19
|
toIntegerString,
|
|
20
|
+
WalletClientWithAccount,
|
|
22
21
|
WalletNotProvidedError,
|
|
23
|
-
} from '@nadohq/
|
|
22
|
+
} from '@nadohq/shared';
|
|
24
23
|
import axios, { AxiosInstance, AxiosResponse } from 'axios';
|
|
25
24
|
import {
|
|
26
25
|
mapIndexerCandlesticks,
|
|
@@ -33,11 +32,12 @@ import {
|
|
|
33
32
|
mapIndexerMakerStatistics,
|
|
34
33
|
mapIndexerMarketSnapshot,
|
|
35
34
|
mapIndexerMatchEventBalances,
|
|
35
|
+
mapIndexerNlpSnapshot,
|
|
36
36
|
mapIndexerOrder,
|
|
37
37
|
mapIndexerPerpPrices,
|
|
38
38
|
mapIndexerProductPayment,
|
|
39
39
|
mapIndexerServerProduct,
|
|
40
|
-
|
|
40
|
+
mapIndexerV2Ticker,
|
|
41
41
|
mapSnapshotsIntervalToServerParams,
|
|
42
42
|
} from './dataMappers';
|
|
43
43
|
import {
|
|
@@ -80,6 +80,8 @@ import {
|
|
|
80
80
|
GetIndexerMultiProductSnapshotsResponse,
|
|
81
81
|
GetIndexerMultiSubaccountSnapshotsParams,
|
|
82
82
|
GetIndexerMultiSubaccountSnapshotsResponse,
|
|
83
|
+
GetIndexerNlpSnapshotsParams,
|
|
84
|
+
GetIndexerNlpSnapshotsResponse,
|
|
83
85
|
GetIndexerOraclePricesParams,
|
|
84
86
|
GetIndexerOraclePricesResponse,
|
|
85
87
|
GetIndexerOrdersParams,
|
|
@@ -91,8 +93,10 @@ import {
|
|
|
91
93
|
GetIndexerQuotePriceResponse,
|
|
92
94
|
GetIndexerReferralCodeParams,
|
|
93
95
|
GetIndexerReferralCodeResponse,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
GetIndexerSubaccountDDAParams,
|
|
97
|
+
GetIndexerSubaccountDDAResponse,
|
|
98
|
+
GetIndexerV2TickersParams,
|
|
99
|
+
GetIndexerV2TickersResponse,
|
|
96
100
|
IndexerEventWithTx,
|
|
97
101
|
IndexerMatchEvent,
|
|
98
102
|
IndexerOraclePrice,
|
|
@@ -100,14 +104,13 @@ import {
|
|
|
100
104
|
IndexerServerQueryRequestByType,
|
|
101
105
|
IndexerServerQueryRequestType,
|
|
102
106
|
IndexerServerQueryResponseByType,
|
|
107
|
+
IndexerServerV2TickersResponse,
|
|
103
108
|
IndexerSnapshotBalance,
|
|
104
109
|
IndexerSubaccountSnapshot,
|
|
105
110
|
ListIndexerSubaccountsParams,
|
|
106
111
|
ListIndexerSubaccountsResponse,
|
|
107
|
-
GetIndexerSubaccountDDAParams,
|
|
108
112
|
UpdateIndexerLeaderboardRegistrationParams,
|
|
109
113
|
UpdateIndexerLeaderboardRegistrationResponse,
|
|
110
|
-
GetIndexerSubaccountDDAResponse,
|
|
111
114
|
} from './types';
|
|
112
115
|
|
|
113
116
|
export interface IndexerClientOpts {
|
|
@@ -132,6 +135,8 @@ export class IndexerBaseClient {
|
|
|
132
135
|
this.opts = opts;
|
|
133
136
|
this.axiosInstance = axios.create({
|
|
134
137
|
withCredentials: true,
|
|
138
|
+
// We have custom logic to validate response status and create an appropriate error
|
|
139
|
+
validateStatus: () => true,
|
|
135
140
|
});
|
|
136
141
|
this.v2Url = opts.v2Url ? opts.v2Url : opts.url.replace('v1', 'v2');
|
|
137
142
|
}
|
|
@@ -444,6 +449,7 @@ export class IndexerBaseClient {
|
|
|
444
449
|
})
|
|
445
450
|
: undefined,
|
|
446
451
|
product_ids: params.productIds,
|
|
452
|
+
trigger_types: params.triggerTypes,
|
|
447
453
|
isolated: params.isolated,
|
|
448
454
|
digests: params.digests,
|
|
449
455
|
max_time: params.maxTimestampInclusive,
|
|
@@ -552,10 +558,10 @@ export class IndexerBaseClient {
|
|
|
552
558
|
}
|
|
553
559
|
|
|
554
560
|
/**
|
|
555
|
-
* Gets quote (
|
|
561
|
+
* Gets quote (USDT) price in terms of USD
|
|
556
562
|
*/
|
|
557
563
|
async getQuotePrice(): Promise<GetIndexerQuotePriceResponse> {
|
|
558
|
-
const baseResponse = await this.query('
|
|
564
|
+
const baseResponse = await this.query('quote_price', {});
|
|
559
565
|
return {
|
|
560
566
|
price: removeDecimals(baseResponse.price_x18),
|
|
561
567
|
};
|
|
@@ -797,14 +803,11 @@ export class IndexerBaseClient {
|
|
|
797
803
|
params: GetIndexerSubaccountDDAParams,
|
|
798
804
|
): Promise<GetIndexerSubaccountDDAResponse> {
|
|
799
805
|
const baseResponse = await this.query('direct_deposit_address', {
|
|
800
|
-
subaccount: subaccountToHex(
|
|
801
|
-
subaccountOwner: params.subaccountOwner,
|
|
802
|
-
subaccountName: params.subaccountName,
|
|
803
|
-
}),
|
|
806
|
+
subaccount: subaccountToHex(params.subaccount),
|
|
804
807
|
});
|
|
805
808
|
|
|
806
809
|
return {
|
|
807
|
-
address: baseResponse.v1_address,
|
|
810
|
+
address: getValidatedAddress(baseResponse.v1_address),
|
|
808
811
|
};
|
|
809
812
|
}
|
|
810
813
|
|
|
@@ -825,6 +828,24 @@ export class IndexerBaseClient {
|
|
|
825
828
|
};
|
|
826
829
|
}
|
|
827
830
|
|
|
831
|
+
/**
|
|
832
|
+
* Get tickers from the v2 indexer endpoint
|
|
833
|
+
* @param params
|
|
834
|
+
*/
|
|
835
|
+
async getV2Tickers(
|
|
836
|
+
params: GetIndexerV2TickersParams,
|
|
837
|
+
): Promise<GetIndexerV2TickersResponse> {
|
|
838
|
+
const response =
|
|
839
|
+
await this.axiosInstance.get<IndexerServerV2TickersResponse>(
|
|
840
|
+
`${this.v2Url}/tickers`,
|
|
841
|
+
{ params },
|
|
842
|
+
);
|
|
843
|
+
|
|
844
|
+
this.checkResponseStatus(response);
|
|
845
|
+
|
|
846
|
+
return mapValues(response.data, mapIndexerV2Ticker);
|
|
847
|
+
}
|
|
848
|
+
|
|
828
849
|
protected async query<TRequestType extends IndexerServerQueryRequestType>(
|
|
829
850
|
requestType: TRequestType,
|
|
830
851
|
params: IndexerServerQueryRequestByType[TRequestType],
|
package/src/IndexerClient.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
+
NLP_PRODUCT_ID,
|
|
2
3
|
ProductEngineType,
|
|
3
4
|
QUOTE_PRODUCT_ID,
|
|
4
5
|
subaccountFromHex,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
toBigDecimal,
|
|
7
|
+
toIntegerString,
|
|
8
|
+
} from '@nadohq/shared';
|
|
8
9
|
|
|
9
10
|
import { IndexerBaseClient } from './IndexerBaseClient';
|
|
10
11
|
import {
|
|
@@ -22,17 +23,17 @@ import {
|
|
|
22
23
|
GetIndexerSubaccountLiquidationEventsResponse,
|
|
23
24
|
GetIndexerSubaccountMatchEventParams,
|
|
24
25
|
GetIndexerSubaccountMatchEventsResponse,
|
|
25
|
-
GetIndexerSubaccountSettlementEventsParams,
|
|
26
|
-
GetIndexerSubaccountSettlementEventsResponse,
|
|
27
26
|
GetIndexerSubaccountNlpEventsParams,
|
|
28
27
|
GetIndexerSubaccountNlpEventsResponse,
|
|
28
|
+
GetIndexerSubaccountSettlementEventsParams,
|
|
29
|
+
GetIndexerSubaccountSettlementEventsResponse,
|
|
29
30
|
IndexerCollateralEvent,
|
|
30
31
|
IndexerEventPerpStateSnapshot,
|
|
31
32
|
IndexerEventSpotStateSnapshot,
|
|
32
33
|
IndexerEventWithTx,
|
|
33
34
|
IndexerLiquidationEvent,
|
|
34
|
-
IndexerSettlementEvent,
|
|
35
35
|
IndexerNlpEvent,
|
|
36
|
+
IndexerSettlementEvent,
|
|
36
37
|
PaginatedIndexerEventsResponse,
|
|
37
38
|
} from './types';
|
|
38
39
|
|
|
@@ -195,6 +196,7 @@ export class IndexerClient extends IndexerBaseClient {
|
|
|
195
196
|
subaccountName,
|
|
196
197
|
subaccountOwner,
|
|
197
198
|
productIds,
|
|
199
|
+
triggerTypes,
|
|
198
200
|
isolated,
|
|
199
201
|
} = params;
|
|
200
202
|
|
|
@@ -205,6 +207,7 @@ export class IndexerClient extends IndexerBaseClient {
|
|
|
205
207
|
subaccount: { subaccountName, subaccountOwner },
|
|
206
208
|
limit,
|
|
207
209
|
productIds,
|
|
210
|
+
triggerTypes,
|
|
208
211
|
isolated,
|
|
209
212
|
});
|
|
210
213
|
|
package/src/dataMappers.ts
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getRecvTimeFromOrderNonce,
|
|
3
|
-
Market,
|
|
4
|
-
parseRawExpirationTimestamp,
|
|
5
|
-
PerpMarket,
|
|
6
|
-
ProductEngineType,
|
|
7
|
-
SpotMarket,
|
|
8
|
-
subaccountFromHex,
|
|
9
|
-
} from '@nadohq/contracts';
|
|
10
1
|
import {
|
|
11
2
|
mapEngineServerPerpProduct,
|
|
12
3
|
mapEngineServerSpotProduct,
|
|
13
4
|
} from '@nadohq/engine-client';
|
|
14
5
|
import {
|
|
6
|
+
getRecvTimeFromOrderNonce,
|
|
15
7
|
mapValues,
|
|
8
|
+
Market,
|
|
9
|
+
PerpMarket,
|
|
10
|
+
ProductEngineType,
|
|
16
11
|
removeDecimals,
|
|
12
|
+
SpotMarket,
|
|
13
|
+
subaccountFromHex,
|
|
17
14
|
toBigDecimal,
|
|
18
15
|
toIntegerString,
|
|
19
|
-
|
|
16
|
+
unpackOrderAppendix,
|
|
17
|
+
} from '@nadohq/shared';
|
|
20
18
|
import {
|
|
21
19
|
Candlestick,
|
|
22
20
|
IndexerEvent,
|
|
@@ -28,6 +26,7 @@ import {
|
|
|
28
26
|
IndexerMaker,
|
|
29
27
|
IndexerMarketSnapshot,
|
|
30
28
|
IndexerMatchEventBalances,
|
|
29
|
+
IndexerNlpSnapshot,
|
|
31
30
|
IndexerOrder,
|
|
32
31
|
IndexerPerpBalance,
|
|
33
32
|
IndexerPerpPrices,
|
|
@@ -42,16 +41,17 @@ import {
|
|
|
42
41
|
IndexerServerMaker,
|
|
43
42
|
IndexerServerMarketSnapshot,
|
|
44
43
|
IndexerServerMatchEventBalances,
|
|
44
|
+
IndexerServerNlpSnapshot,
|
|
45
45
|
IndexerServerOrder,
|
|
46
46
|
IndexerServerPerpPrices,
|
|
47
47
|
IndexerServerProduct,
|
|
48
48
|
IndexerServerProductPayment,
|
|
49
49
|
IndexerServerSnapshotsInterval,
|
|
50
50
|
IndexerServerTx,
|
|
51
|
-
|
|
51
|
+
IndexerServerV2TickerResponse,
|
|
52
52
|
IndexerSnapshotsIntervalParams,
|
|
53
53
|
IndexerSpotBalance,
|
|
54
|
-
|
|
54
|
+
IndexerV2TickerResponse,
|
|
55
55
|
} from './types';
|
|
56
56
|
|
|
57
57
|
export function mapSnapshotsIntervalToServerParams(
|
|
@@ -92,16 +92,12 @@ 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
|
-
|
|
101
|
-
|
|
102
|
-
isReduceOnly: expirationEncodedData.reduceOnly,
|
|
103
|
-
expiration: expirationEncodedData.expirationTime,
|
|
104
|
-
orderType: expirationEncodedData.type,
|
|
99
|
+
expiration: Number(order.expiration),
|
|
100
|
+
appendix,
|
|
105
101
|
nonce: toBigDecimal(order.nonce),
|
|
106
102
|
recvTimeSeconds: getRecvTimeFromOrderNonce(order.nonce) / 1000,
|
|
107
103
|
price: removeDecimals(order.price_x18),
|
|
@@ -156,6 +152,7 @@ export function mapIndexerEvent(event: IndexerServerEvent): IndexerEvent {
|
|
|
156
152
|
netFundingUnrealized: toBigDecimal(event.net_funding_unrealized),
|
|
157
153
|
netInterestCumulative: toBigDecimal(event.net_interest_cumulative),
|
|
158
154
|
netInterestUnrealized: toBigDecimal(event.net_interest_unrealized),
|
|
155
|
+
quoteVolumeCumulative: toBigDecimal(event.quote_volume_cumulative),
|
|
159
156
|
},
|
|
160
157
|
};
|
|
161
158
|
}
|
|
@@ -350,8 +347,8 @@ export function mapIndexerNlpSnapshot(
|
|
|
350
347
|
return {
|
|
351
348
|
submissionIndex: snapshot.submission_idx,
|
|
352
349
|
timestamp: toBigDecimal(snapshot.timestamp),
|
|
353
|
-
|
|
354
|
-
|
|
350
|
+
cumulativeBurnAmountQuote: toBigDecimal(snapshot.cumulative_burn_quote),
|
|
351
|
+
cumulativeMintAmountQuote: toBigDecimal(snapshot.cumulative_mint_quote),
|
|
355
352
|
cumulativePnl: toBigDecimal(snapshot.cumulative_pnl),
|
|
356
353
|
cumulativeTrades: toBigDecimal(snapshot.cumulative_trades),
|
|
357
354
|
cumulativeVolume: toBigDecimal(snapshot.cumulative_volume),
|
|
@@ -360,3 +357,18 @@ export function mapIndexerNlpSnapshot(
|
|
|
360
357
|
tvl: toBigDecimal(snapshot.tvl),
|
|
361
358
|
};
|
|
362
359
|
}
|
|
360
|
+
|
|
361
|
+
export function mapIndexerV2Ticker(
|
|
362
|
+
ticker: IndexerServerV2TickerResponse,
|
|
363
|
+
): IndexerV2TickerResponse {
|
|
364
|
+
return {
|
|
365
|
+
productId: ticker.product_id,
|
|
366
|
+
tickerId: ticker.ticker_id,
|
|
367
|
+
baseCurrency: ticker.base_currency,
|
|
368
|
+
quoteCurrency: ticker.quote_currency,
|
|
369
|
+
lastPrice: ticker.last_price,
|
|
370
|
+
baseVolume: ticker.base_volume,
|
|
371
|
+
quoteVolume: ticker.quote_volume,
|
|
372
|
+
priceChangePercent24h: ticker.price_change_percent_24h,
|
|
373
|
+
};
|
|
374
|
+
}
|
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
|
};
|