diff --git a/.changeset/cold-items-notice.md b/.changeset/cold-items-notice.md new file mode 100644 index 000000000..5e5d5aa8e --- /dev/null +++ b/.changeset/cold-items-notice.md @@ -0,0 +1,7 @@ +--- +'@siafoundation/explored-js': minor +'@siafoundation/explored-react': minor +'@siafoundation/explored-types': minor +--- + +Added the TransactionChainIndices route types, sdk method, and react hook. diff --git a/libs/explored-js/src/api.ts b/libs/explored-js/src/api.ts index 626d22e6d..1ba7db484 100644 --- a/libs/explored-js/src/api.ts +++ b/libs/explored-js/src/api.ts @@ -56,6 +56,14 @@ import { MetricsByIDParams, MetricsByIDPayload, MetricsByIDResponse, + OutputSiacoineParams, + OutputSiacoinePayload, + OutputSiacoineResponse, + outputSiacoineRoute, + OutputSiafundeParams, + OutputSiafundePayload, + OutputSiafundeResponse, + outputSiafundeRoute, searchResultTypeRoute, SearchResultTypeParams, SearchResultTypePayload, @@ -92,14 +100,10 @@ import { TxpoolTransactionsParams, TxpoolTransactionsPayload, TxpoolTransactionsResponse, - OutputSiacoineParams, - OutputSiacoinePayload, - OutputSiacoineResponse, - outputSiacoineRoute, - OutputSiafundeParams, - OutputSiafundePayload, - OutputSiafundeResponse, - outputSiafundeRoute, + transactionChainIndicesRoute, + TransactionChainIndicesParams, + TransactionChainIndicesPayload, + TransactionChainIndicesResponse, } from '@siafoundation/explored-types' export function Explored({ @@ -182,6 +186,11 @@ export function Explored({ TransactionsByIDsPayload, TransactionsByIDsResponse >(axios, 'post', transactionsByIDsRoute), + transactionChainIndices: buildRequestHandler< + TransactionChainIndicesParams, + TransactionChainIndicesPayload, + TransactionChainIndicesResponse + >(axios, 'post', transactionChainIndicesRoute), // Address addressSiacoinUTXOs: buildRequestHandler< AddressSiacoinUTXOsParams, diff --git a/libs/explored-react/src/hooks.ts b/libs/explored-react/src/hooks.ts index fecdbce6a..ab0b8e8c9 100644 --- a/libs/explored-react/src/hooks.ts +++ b/libs/explored-react/src/hooks.ts @@ -56,6 +56,9 @@ import { TransactionByIDParams, TransactionByIDResponse, transactionByIDRoute, + TransactionChainIndicesParams, + TransactionChainIndicesResponse, + transactionChainIndicesRoute, TransactionsByIDsParams, TransactionsByIDsPayload, TransactionsByIDsResponse, @@ -213,6 +216,18 @@ export function useTransactionsByIDs( }) } +export function useTransactionChainIndices( + args: HookArgsSwr< + TransactionChainIndicesParams, + TransactionChainIndicesResponse + > +) { + return useGetSwr({ + ...args, + route: transactionChainIndicesRoute, + }) +} + // Address export function useAddressSiacoinUTXOs( diff --git a/libs/explored-types/src/api.ts b/libs/explored-types/src/api.ts index 35e4eb37e..46312a33b 100644 --- a/libs/explored-types/src/api.ts +++ b/libs/explored-types/src/api.ts @@ -114,6 +114,15 @@ export type TransactionsByIDsParams = void export type TransactionsByIDsPayload = { ids: TransactionID[] } export type TransactionsByIDsResponse = ExplorerTransaction[] +export const transactionChainIndicesRoute = '/transactions/:id/indices' +export type TransactionChainIndicesParams = { + id: TransactionID + offset?: number + limit?: number +} +export type TransactionChainIndicesPayload = void +export type TransactionChainIndicesResponse = ChainIndex[] + // Address // Returns the specified address' unspent siacoin outputs.