From f0ed73b8f43270377b8ab1c29d9ac6e6c0d00528 Mon Sep 17 00:00:00 2001 From: Michal Zielenkiewicz Date: Thu, 7 Nov 2024 08:50:38 +0100 Subject: [PATCH 1/6] Prepare api layer for localnet --- .env | 1 + src/oasis-nexus/generated/api.ts | 312 +++++++++---------- src/oasis-nexus/prependNetworkPath.js | 2 +- src/oasis-nexus/replaceNetworkWithBaseURL.ts | 2 + 4 files changed, 160 insertions(+), 157 deletions(-) diff --git a/.env b/.env index ffcfc490d..575eac159 100644 --- a/.env +++ b/.env @@ -8,6 +8,7 @@ REACT_APP_ENABLE_OASIS_MATOMO_ANALYTICS=true # REACT_APP_TESTNET_API=https://testnet.nexus.stg.oasis.io/v1/ REACT_APP_API=https://nexus.oasis.io/v1/ REACT_APP_TESTNET_API=https://testnet.nexus.oasis.io/v1/ +REACT_APP_LOCALNET_API=http://localhost:8547/v1/ REACT_APP_META_TITLE="Oasis Explorer" REACT_APP_META_IMAGE="Oasis Explorer - OpenGraph Banner.png" REACT_APP_META_MANIFEST=app.webmanifest diff --git a/src/oasis-nexus/generated/api.ts b/src/oasis-nexus/generated/api.ts index 3d1bcd678..0edac56e4 100644 --- a/src/oasis-nexus/generated/api.ts +++ b/src/oasis-nexus/generated/api.ts @@ -2228,7 +2228,7 @@ type SecondParameter any> = Parameters[1]; * @summary Returns the status of indexing. */ export const getStatus = ( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', options?: SecondParameter,signal?: AbortSignal ) => { @@ -2240,12 +2240,12 @@ export const getStatus = ( } -export const getGetStatusQueryKey = (network: 'mainnet' | 'testnet',) => { +export const getGetStatusQueryKey = (network: 'mainnet' | 'testnet' | 'localnet',) => { return [`/${network}/`] as const; } -export const getGetStatusQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} +export const getGetStatusQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { const {query: queryOptions, request: requestOptions} = options ?? {}; @@ -2270,7 +2270,7 @@ export type GetStatusQueryError = HumanReadableErrorResponse | NotFoundErrorResp * @summary Returns the status of indexing. */ export const useGetStatus = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} + network: 'mainnet' | 'testnet' | 'localnet', options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ): UseQueryResult & { queryKey: QueryKey } => { @@ -2291,7 +2291,7 @@ export const useGetStatus = >, TErr * @summary Returns a list of consensus blocks, sorted from most to least recent. */ export const GetConsensusBlocks = ( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusBlocksParams, options?: SecondParameter,signal?: AbortSignal ) => { @@ -2305,13 +2305,13 @@ export const GetConsensusBlocks = ( } -export const getGetConsensusBlocksQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusBlocksQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusBlocksParams,) => { return [`/${network}/consensus/blocks`, ...(params ? [params]: [])] as const; } -export const getGetConsensusBlocksQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusBlocksQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusBlocksParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -2338,7 +2338,7 @@ export type GetConsensusBlocksQueryError = HumanReadableErrorResponse | NotFound * @summary Returns a list of consensus blocks, sorted from most to least recent. */ export const useGetConsensusBlocks = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusBlocksParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ): UseQueryResult & { queryKey: QueryKey } => { @@ -2360,7 +2360,7 @@ export const useGetConsensusBlocks = ,signal?: AbortSignal ) => { @@ -2373,13 +2373,13 @@ export const GetConsensusBlocksHeight = ( } -export const getGetConsensusBlocksHeightQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusBlocksHeightQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', height: number,) => { return [`/${network}/consensus/blocks/${height}`] as const; } -export const getGetConsensusBlocksHeightQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusBlocksHeightQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', height: number, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -2406,7 +2406,7 @@ export type GetConsensusBlocksHeightQueryError = HumanReadableErrorResponse | No * @summary Returns a consensus block. */ export const useGetConsensusBlocksHeight = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', height: number, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ): UseQueryResult & { queryKey: QueryKey } => { @@ -2428,7 +2428,7 @@ export const useGetConsensusBlocksHeight = ,signal?: AbortSignal ) => { @@ -2442,13 +2442,13 @@ export const GetConsensusTransactions = ( } -export const getGetConsensusTransactionsQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusTransactionsQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusTransactionsParams,) => { return [`/${network}/consensus/transactions`, ...(params ? [params]: [])] as const; } -export const getGetConsensusTransactionsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusTransactionsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusTransactionsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -2475,7 +2475,7 @@ export type GetConsensusTransactionsQueryError = HumanReadableErrorResponse | No * @summary Returns a list of consensus transactions. */ export const useGetConsensusTransactions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusTransactionsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ): UseQueryResult & { queryKey: QueryKey } => { @@ -2497,7 +2497,7 @@ export const useGetConsensusTransactions = ,signal?: AbortSignal ) => { @@ -2510,13 +2510,13 @@ export const GetConsensusTransactionsTxHash = ( } -export const getGetConsensusTransactionsTxHashQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusTransactionsTxHashQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', txHash: string,) => { return [`/${network}/consensus/transactions/${txHash}`] as const; } -export const getGetConsensusTransactionsTxHashQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusTransactionsTxHashQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', txHash: string, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -2543,7 +2543,7 @@ export type GetConsensusTransactionsTxHashQueryError = HumanReadableErrorRespons * @summary Returns consensus transactions with the given transaction hash. */ export const useGetConsensusTransactionsTxHash = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', txHash: string, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ): UseQueryResult & { queryKey: QueryKey } => { @@ -2565,7 +2565,7 @@ export const useGetConsensusTransactionsTxHash = ,signal?: AbortSignal ) => { @@ -2579,13 +2579,13 @@ export const GetConsensusEvents = ( } -export const getGetConsensusEventsQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusEventsQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusEventsParams,) => { return [`/${network}/consensus/events`, ...(params ? [params]: [])] as const; } -export const getGetConsensusEventsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusEventsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusEventsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -2612,7 +2612,7 @@ export type GetConsensusEventsQueryError = HumanReadableErrorResponse | NotFound * @summary Returns a list of consensus events. */ export const useGetConsensusEvents = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusEventsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ): UseQueryResult & { queryKey: QueryKey } => { @@ -2633,7 +2633,7 @@ export const useGetConsensusEvents = ,signal?: AbortSignal ) => { @@ -2647,13 +2647,13 @@ export const GetConsensusRoothashMessages = ( } -export const getGetConsensusRoothashMessagesQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusRoothashMessagesQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', params: GetConsensusRoothashMessagesParams,) => { return [`/${network}/consensus/roothash_messages`, ...(params ? [params]: [])] as const; } -export const getGetConsensusRoothashMessagesQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusRoothashMessagesQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', params: GetConsensusRoothashMessagesParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -2679,7 +2679,7 @@ export type GetConsensusRoothashMessagesQueryError = HumanReadableErrorResponse * @deprecated */ export const useGetConsensusRoothashMessages = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', params: GetConsensusRoothashMessagesParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ): UseQueryResult & { queryKey: QueryKey } => { @@ -2701,7 +2701,7 @@ export const useGetConsensusRoothashMessages = ,signal?: AbortSignal ) => { @@ -2715,13 +2715,13 @@ export const GetConsensusEntities = ( } -export const getGetConsensusEntitiesQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusEntitiesQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusEntitiesParams,) => { return [`/${network}/consensus/entities`, ...(params ? [params]: [])] as const; } -export const getGetConsensusEntitiesQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusEntitiesQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusEntitiesParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -2748,7 +2748,7 @@ export type GetConsensusEntitiesQueryError = HumanReadableErrorResponse | NotFou * @summary Returns a list of entities registered at the consensus layer. */ export const useGetConsensusEntities = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusEntitiesParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ): UseQueryResult & { queryKey: QueryKey } => { @@ -2770,7 +2770,7 @@ export const useGetConsensusEntities = ,signal?: AbortSignal ) => { @@ -2783,13 +2783,13 @@ export const GetConsensusEntitiesAddress = ( } -export const getGetConsensusEntitiesAddressQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusEntitiesAddressQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress,) => { return [`/${network}/consensus/entities/${address}`] as const; } -export const getGetConsensusEntitiesAddressQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusEntitiesAddressQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -2816,7 +2816,7 @@ export type GetConsensusEntitiesAddressQueryError = HumanReadableErrorResponse | * @summary Returns an entity registered at the consensus layer. */ export const useGetConsensusEntitiesAddress = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ): UseQueryResult & { queryKey: QueryKey } => { @@ -2838,7 +2838,7 @@ export const useGetConsensusEntitiesAddress = ,signal?: AbortSignal @@ -2853,14 +2853,14 @@ export const GetConsensusEntitiesAddressNodes = ( } -export const getGetConsensusEntitiesAddressNodesQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusEntitiesAddressNodesQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, params?: GetConsensusEntitiesAddressNodesParams,) => { return [`/${network}/consensus/entities/${address}/nodes`, ...(params ? [params]: [])] as const; } -export const getGetConsensusEntitiesAddressNodesQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusEntitiesAddressNodesQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, params?: GetConsensusEntitiesAddressNodesParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -2888,7 +2888,7 @@ export type GetConsensusEntitiesAddressNodesQueryError = HumanReadableErrorRespo * @summary Returns a list of nodes registered at the consensus layer. */ export const useGetConsensusEntitiesAddressNodes = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, params?: GetConsensusEntitiesAddressNodesParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -2911,7 +2911,7 @@ export const useGetConsensusEntitiesAddressNodes = ,signal?: AbortSignal @@ -2925,14 +2925,14 @@ export const GetConsensusEntitiesAddressNodesNodeId = ( } -export const getGetConsensusEntitiesAddressNodesNodeIdQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusEntitiesAddressNodesNodeIdQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, nodeId: Ed25519PubKey,) => { return [`/${network}/consensus/entities/${address}/nodes/${nodeId}`] as const; } -export const getGetConsensusEntitiesAddressNodesNodeIdQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusEntitiesAddressNodesNodeIdQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, nodeId: Ed25519PubKey, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -2960,7 +2960,7 @@ export type GetConsensusEntitiesAddressNodesNodeIdQueryError = HumanReadableErro * @summary Returns a node registered at the consensus layer. */ export const useGetConsensusEntitiesAddressNodesNodeId = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, nodeId: Ed25519PubKey, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -2983,7 +2983,7 @@ export const useGetConsensusEntitiesAddressNodesNodeId = ,signal?: AbortSignal ) => { @@ -2997,13 +2997,13 @@ export const GetConsensusValidators = ( } -export const getGetConsensusValidatorsQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusValidatorsQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusValidatorsParams,) => { return [`/${network}/consensus/validators`, ...(params ? [params]: [])] as const; } -export const getGetConsensusValidatorsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusValidatorsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusValidatorsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -3030,7 +3030,7 @@ export type GetConsensusValidatorsQueryError = HumanReadableErrorResponse | NotF * @summary Returns a list of validators registered at the consensus layer (the list includes all registered entities, even those without a currently active validator node). */ export const useGetConsensusValidators = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusValidatorsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ): UseQueryResult & { queryKey: QueryKey } => { @@ -3052,7 +3052,7 @@ export const useGetConsensusValidators = ,signal?: AbortSignal ) => { @@ -3065,13 +3065,13 @@ export const GetConsensusValidatorsAddress = ( } -export const getGetConsensusValidatorsAddressQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusValidatorsAddressQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress,) => { return [`/${network}/consensus/validators/${address}`] as const; } -export const getGetConsensusValidatorsAddressQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusValidatorsAddressQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -3098,7 +3098,7 @@ export type GetConsensusValidatorsAddressQueryError = HumanReadableErrorResponse * @summary Returns a validator registered at the consensus layer. */ export const useGetConsensusValidatorsAddress = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ): UseQueryResult & { queryKey: QueryKey } => { @@ -3120,7 +3120,7 @@ export const useGetConsensusValidatorsAddress = ,signal?: AbortSignal @@ -3135,14 +3135,14 @@ export const GetConsensusValidatorsAddressHistory = ( } -export const getGetConsensusValidatorsAddressHistoryQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusValidatorsAddressHistoryQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, params?: GetConsensusValidatorsAddressHistoryParams,) => { return [`/${network}/consensus/validators/${address}/history`, ...(params ? [params]: [])] as const; } -export const getGetConsensusValidatorsAddressHistoryQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusValidatorsAddressHistoryQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, params?: GetConsensusValidatorsAddressHistoryParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -3170,7 +3170,7 @@ export type GetConsensusValidatorsAddressHistoryQueryError = HumanReadableErrorR * @summary Returns historical information for a single validator. */ export const useGetConsensusValidatorsAddressHistory = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, params?: GetConsensusValidatorsAddressHistoryParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -3197,7 +3197,7 @@ query the single-account endpoint. */ export const GetConsensusAccounts = ( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusAccountsParams, options?: SecondParameter,signal?: AbortSignal ) => { @@ -3211,13 +3211,13 @@ export const GetConsensusAccounts = ( } -export const getGetConsensusAccountsQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusAccountsQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusAccountsParams,) => { return [`/${network}/consensus/accounts`, ...(params ? [params]: [])] as const; } -export const getGetConsensusAccountsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusAccountsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusAccountsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -3248,7 +3248,7 @@ query the single-account endpoint. */ export const useGetConsensusAccounts = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusAccountsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ): UseQueryResult & { queryKey: QueryKey } => { @@ -3270,7 +3270,7 @@ export const useGetConsensusAccounts = ,signal?: AbortSignal ) => { @@ -3283,13 +3283,13 @@ export const GetConsensusAccountsAddress = ( } -export const getGetConsensusAccountsAddressQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusAccountsAddressQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress,) => { return [`/${network}/consensus/accounts/${address}`] as const; } -export const getGetConsensusAccountsAddressQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusAccountsAddressQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -3316,7 +3316,7 @@ export type GetConsensusAccountsAddressQueryError = HumanReadableErrorResponse | * @summary Returns a consensus layer account. */ export const useGetConsensusAccountsAddress = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ): UseQueryResult & { queryKey: QueryKey } => { @@ -3338,7 +3338,7 @@ export const useGetConsensusAccountsAddress = ,signal?: AbortSignal @@ -3353,14 +3353,14 @@ export const GetConsensusAccountsAddressDelegations = ( } -export const getGetConsensusAccountsAddressDelegationsQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusAccountsAddressDelegationsQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, params?: GetConsensusAccountsAddressDelegationsParams,) => { return [`/${network}/consensus/accounts/${address}/delegations`, ...(params ? [params]: [])] as const; } -export const getGetConsensusAccountsAddressDelegationsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusAccountsAddressDelegationsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, params?: GetConsensusAccountsAddressDelegationsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -3388,7 +3388,7 @@ export type GetConsensusAccountsAddressDelegationsQueryError = HumanReadableErro * @summary Returns an account's delegations. */ export const useGetConsensusAccountsAddressDelegations = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, params?: GetConsensusAccountsAddressDelegationsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -3411,7 +3411,7 @@ export const useGetConsensusAccountsAddressDelegations = ,signal?: AbortSignal @@ -3426,14 +3426,14 @@ export const GetConsensusAccountsAddressDelegationsTo = ( } -export const getGetConsensusAccountsAddressDelegationsToQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusAccountsAddressDelegationsToQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, params?: GetConsensusAccountsAddressDelegationsToParams,) => { return [`/${network}/consensus/accounts/${address}/delegations_to`, ...(params ? [params]: [])] as const; } -export const getGetConsensusAccountsAddressDelegationsToQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusAccountsAddressDelegationsToQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, params?: GetConsensusAccountsAddressDelegationsToParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -3461,7 +3461,7 @@ export type GetConsensusAccountsAddressDelegationsToQueryError = HumanReadableEr * @summary Returns a list of delegations to an account. */ export const useGetConsensusAccountsAddressDelegationsTo = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, params?: GetConsensusAccountsAddressDelegationsToParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -3484,7 +3484,7 @@ export const useGetConsensusAccountsAddressDelegationsTo = ,signal?: AbortSignal @@ -3499,14 +3499,14 @@ export const GetConsensusAccountsAddressDebondingDelegations = ( } -export const getGetConsensusAccountsAddressDebondingDelegationsQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusAccountsAddressDebondingDelegationsQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, params?: GetConsensusAccountsAddressDebondingDelegationsParams,) => { return [`/${network}/consensus/accounts/${address}/debonding_delegations`, ...(params ? [params]: [])] as const; } -export const getGetConsensusAccountsAddressDebondingDelegationsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusAccountsAddressDebondingDelegationsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, params?: GetConsensusAccountsAddressDebondingDelegationsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -3534,7 +3534,7 @@ export type GetConsensusAccountsAddressDebondingDelegationsQueryError = HumanRea * @summary Returns an account's debonding delegations. */ export const useGetConsensusAccountsAddressDebondingDelegations = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, params?: GetConsensusAccountsAddressDebondingDelegationsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -3557,7 +3557,7 @@ export const useGetConsensusAccountsAddressDebondingDelegations = ,signal?: AbortSignal @@ -3572,14 +3572,14 @@ export const GetConsensusAccountsAddressDebondingDelegationsTo = ( } -export const getGetConsensusAccountsAddressDebondingDelegationsToQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusAccountsAddressDebondingDelegationsToQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, params?: GetConsensusAccountsAddressDebondingDelegationsToParams,) => { return [`/${network}/consensus/accounts/${address}/debonding_delegations_to`, ...(params ? [params]: [])] as const; } -export const getGetConsensusAccountsAddressDebondingDelegationsToQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusAccountsAddressDebondingDelegationsToQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, params?: GetConsensusAccountsAddressDebondingDelegationsToParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -3607,7 +3607,7 @@ export type GetConsensusAccountsAddressDebondingDelegationsToQueryError = HumanR * @summary Returns a list of debonding delegations to an account. */ export const useGetConsensusAccountsAddressDebondingDelegationsTo = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', address: StakingAddress, params?: GetConsensusAccountsAddressDebondingDelegationsToParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -3630,7 +3630,7 @@ export const useGetConsensusAccountsAddressDebondingDelegationsTo = ,signal?: AbortSignal ) => { @@ -3644,13 +3644,13 @@ export const GetConsensusEpochs = ( } -export const getGetConsensusEpochsQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusEpochsQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusEpochsParams,) => { return [`/${network}/consensus/epochs`, ...(params ? [params]: [])] as const; } -export const getGetConsensusEpochsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusEpochsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusEpochsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -3677,7 +3677,7 @@ export type GetConsensusEpochsQueryError = HumanReadableErrorResponse | NotFound * @summary Returns a list of consensus epochs. */ export const useGetConsensusEpochs = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusEpochsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ): UseQueryResult & { queryKey: QueryKey } => { @@ -3699,7 +3699,7 @@ export const useGetConsensusEpochs = ,signal?: AbortSignal ) => { @@ -3712,13 +3712,13 @@ export const GetConsensusEpochsEpoch = ( } -export const getGetConsensusEpochsEpochQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusEpochsEpochQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', epoch: number,) => { return [`/${network}/consensus/epochs/${epoch}`] as const; } -export const getGetConsensusEpochsEpochQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusEpochsEpochQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', epoch: number, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -3745,7 +3745,7 @@ export type GetConsensusEpochsEpochQueryError = HumanReadableErrorResponse | Not * @summary Returns a consensus epoch. */ export const useGetConsensusEpochsEpoch = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', epoch: number, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ): UseQueryResult & { queryKey: QueryKey } => { @@ -3767,7 +3767,7 @@ export const useGetConsensusEpochsEpoch = ,signal?: AbortSignal ) => { @@ -3781,13 +3781,13 @@ export const GetConsensusProposals = ( } -export const getGetConsensusProposalsQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusProposalsQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusProposalsParams,) => { return [`/${network}/consensus/proposals`, ...(params ? [params]: [])] as const; } -export const getGetConsensusProposalsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusProposalsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusProposalsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -3814,7 +3814,7 @@ export type GetConsensusProposalsQueryError = HumanReadableErrorResponse | NotFo * @summary Returns a list of governance proposals. */ export const useGetConsensusProposals = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', params?: GetConsensusProposalsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ): UseQueryResult & { queryKey: QueryKey } => { @@ -3836,7 +3836,7 @@ export const useGetConsensusProposals = ,signal?: AbortSignal ) => { @@ -3849,13 +3849,13 @@ export const GetConsensusProposalsProposalId = ( } -export const getGetConsensusProposalsProposalIdQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusProposalsProposalIdQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', proposalId: number,) => { return [`/${network}/consensus/proposals/${proposalId}`] as const; } -export const getGetConsensusProposalsProposalIdQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusProposalsProposalIdQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', proposalId: number, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -3882,7 +3882,7 @@ export type GetConsensusProposalsProposalIdQueryError = HumanReadableErrorRespon * @summary Returns a governance proposal. */ export const useGetConsensusProposalsProposalId = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', proposalId: number, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ): UseQueryResult & { queryKey: QueryKey } => { @@ -3904,7 +3904,7 @@ export const useGetConsensusProposalsProposalId = ,signal?: AbortSignal @@ -3919,14 +3919,14 @@ export const GetConsensusProposalsProposalIdVotes = ( } -export const getGetConsensusProposalsProposalIdVotesQueryKey = (network: 'mainnet' | 'testnet', +export const getGetConsensusProposalsProposalIdVotesQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', proposalId: number, params?: GetConsensusProposalsProposalIdVotesParams,) => { return [`/${network}/consensus/proposals/${proposalId}/votes`, ...(params ? [params]: [])] as const; } -export const getGetConsensusProposalsProposalIdVotesQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetConsensusProposalsProposalIdVotesQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', proposalId: number, params?: GetConsensusProposalsProposalIdVotesParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -3954,7 +3954,7 @@ export type GetConsensusProposalsProposalIdVotesQueryError = HumanReadableErrorR * @summary Returns a list of votes for a governance proposal. */ export const useGetConsensusProposalsProposalIdVotes = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', proposalId: number, params?: GetConsensusProposalsProposalIdVotesParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -3976,7 +3976,7 @@ export const useGetConsensusProposalsProposalIdVotes = ,signal?: AbortSignal @@ -3991,14 +3991,14 @@ export const GetRuntimeBlocks = ( } -export const getGetRuntimeBlocksQueryKey = (network: 'mainnet' | 'testnet', +export const getGetRuntimeBlocksQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, params?: GetRuntimeBlocksParams,) => { return [`/${network}/${runtime}/blocks`, ...(params ? [params]: [])] as const; } -export const getGetRuntimeBlocksQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetRuntimeBlocksQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, params?: GetRuntimeBlocksParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -4025,7 +4025,7 @@ export type GetRuntimeBlocksQueryError = HumanReadableErrorResponse | NotFoundEr * @summary Returns a list of Runtime blocks. */ export const useGetRuntimeBlocks = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, params?: GetRuntimeBlocksParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -4047,7 +4047,7 @@ export const useGetRuntimeBlocks = ,signal?: AbortSignal @@ -4062,14 +4062,14 @@ export const GetRuntimeTransactions = ( } -export const getGetRuntimeTransactionsQueryKey = (network: 'mainnet' | 'testnet', +export const getGetRuntimeTransactionsQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, params?: GetRuntimeTransactionsParams,) => { return [`/${network}/${runtime}/transactions`, ...(params ? [params]: [])] as const; } -export const getGetRuntimeTransactionsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetRuntimeTransactionsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, params?: GetRuntimeTransactionsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -4096,7 +4096,7 @@ export type GetRuntimeTransactionsQueryError = HumanReadableErrorResponse | NotF * @summary Returns a list of Runtime transactions. */ export const useGetRuntimeTransactions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, params?: GetRuntimeTransactionsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -4118,7 +4118,7 @@ export const useGetRuntimeTransactions = ,signal?: AbortSignal @@ -4132,14 +4132,14 @@ export const GetRuntimeTransactionsTxHash = ( } -export const getGetRuntimeTransactionsTxHashQueryKey = (network: 'mainnet' | 'testnet', +export const getGetRuntimeTransactionsTxHashQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, txHash: string,) => { return [`/${network}/${runtime}/transactions/${txHash}`] as const; } -export const getGetRuntimeTransactionsTxHashQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetRuntimeTransactionsTxHashQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, txHash: string, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -4166,7 +4166,7 @@ export type GetRuntimeTransactionsTxHashQueryError = HumanReadableErrorResponse * @summary Returns runtime transactions with the given transaction hash. */ export const useGetRuntimeTransactionsTxHash = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, txHash: string, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -4188,7 +4188,7 @@ export const useGetRuntimeTransactionsTxHash = ,signal?: AbortSignal @@ -4203,14 +4203,14 @@ export const GetRuntimeEvents = ( } -export const getGetRuntimeEventsQueryKey = (network: 'mainnet' | 'testnet', +export const getGetRuntimeEventsQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, params?: GetRuntimeEventsParams,) => { return [`/${network}/${runtime}/events`, ...(params ? [params]: [])] as const; } -export const getGetRuntimeEventsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetRuntimeEventsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, params?: GetRuntimeEventsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -4237,7 +4237,7 @@ export type GetRuntimeEventsQueryError = HumanReadableErrorResponse | NotFoundEr * @summary Returns a list of runtime events. */ export const useGetRuntimeEvents = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, params?: GetRuntimeEventsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -4259,7 +4259,7 @@ export const useGetRuntimeEvents = ,signal?: AbortSignal @@ -4274,14 +4274,14 @@ export const GetRuntimeEvmTokens = ( } -export const getGetRuntimeEvmTokensQueryKey = (network: 'mainnet' | 'testnet', +export const getGetRuntimeEvmTokensQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, params?: GetRuntimeEvmTokensParams,) => { return [`/${network}/${runtime}/evm_tokens`, ...(params ? [params]: [])] as const; } -export const getGetRuntimeEvmTokensQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetRuntimeEvmTokensQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, params?: GetRuntimeEvmTokensParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -4308,7 +4308,7 @@ export type GetRuntimeEvmTokensQueryError = HumanReadableErrorResponse | NotFoun * @summary Returns a list of EVM (ERC-20, ...) tokens on the runtime. */ export const useGetRuntimeEvmTokens = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, params?: GetRuntimeEvmTokensParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -4330,7 +4330,7 @@ export const useGetRuntimeEvmTokens = ,signal?: AbortSignal @@ -4344,14 +4344,14 @@ export const GetRuntimeEvmTokensAddress = ( } -export const getGetRuntimeEvmTokensAddressQueryKey = (network: 'mainnet' | 'testnet', +export const getGetRuntimeEvmTokensAddressQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, address: EthOrOasisAddress,) => { return [`/${network}/${runtime}/evm_tokens/${address}`] as const; } -export const getGetRuntimeEvmTokensAddressQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetRuntimeEvmTokensAddressQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, address: EthOrOasisAddress, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -4378,7 +4378,7 @@ export type GetRuntimeEvmTokensAddressQueryError = HumanReadableErrorResponse | * @summary Returns info on an EVM (ERC-20, ...) token on the runtime. */ export const useGetRuntimeEvmTokensAddress = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, address: EthOrOasisAddress, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -4402,7 +4402,7 @@ This endpoint does not verify that `address` is actually an EVM token; if it is */ export const GetRuntimeEvmTokensAddressHolders = ( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, address: EthOrOasisAddress, params?: GetRuntimeEvmTokensAddressHoldersParams, @@ -4418,7 +4418,7 @@ export const GetRuntimeEvmTokensAddressHolders = ( } -export const getGetRuntimeEvmTokensAddressHoldersQueryKey = (network: 'mainnet' | 'testnet', +export const getGetRuntimeEvmTokensAddressHoldersQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, address: EthOrOasisAddress, params?: GetRuntimeEvmTokensAddressHoldersParams,) => { @@ -4426,7 +4426,7 @@ export const getGetRuntimeEvmTokensAddressHoldersQueryKey = (network: 'mainnet' } -export const getGetRuntimeEvmTokensAddressHoldersQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetRuntimeEvmTokensAddressHoldersQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, address: EthOrOasisAddress, params?: GetRuntimeEvmTokensAddressHoldersParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -4456,7 +4456,7 @@ This endpoint does not verify that `address` is actually an EVM token; if it is */ export const useGetRuntimeEvmTokensAddressHolders = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, address: EthOrOasisAddress, params?: GetRuntimeEvmTokensAddressHoldersParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -4481,7 +4481,7 @@ This endpoint does not verify that `address` is actually an EVM token; if it is */ export const GetRuntimeEvmTokensAddressNfts = ( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, address: EthOrOasisAddress, params?: GetRuntimeEvmTokensAddressNftsParams, @@ -4497,7 +4497,7 @@ export const GetRuntimeEvmTokensAddressNfts = ( } -export const getGetRuntimeEvmTokensAddressNftsQueryKey = (network: 'mainnet' | 'testnet', +export const getGetRuntimeEvmTokensAddressNftsQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, address: EthOrOasisAddress, params?: GetRuntimeEvmTokensAddressNftsParams,) => { @@ -4505,7 +4505,7 @@ export const getGetRuntimeEvmTokensAddressNftsQueryKey = (network: 'mainnet' | ' } -export const getGetRuntimeEvmTokensAddressNftsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetRuntimeEvmTokensAddressNftsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, address: EthOrOasisAddress, params?: GetRuntimeEvmTokensAddressNftsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -4535,7 +4535,7 @@ This endpoint does not verify that `address` is actually an EVM token; if it is */ export const useGetRuntimeEvmTokensAddressNfts = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, address: EthOrOasisAddress, params?: GetRuntimeEvmTokensAddressNftsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -4559,7 +4559,7 @@ export const useGetRuntimeEvmTokensAddressNfts = { @@ -4582,7 +4582,7 @@ export const getGetRuntimeEvmTokensAddressNftsIdQueryKey = (network: 'mainnet' | } -export const getGetRuntimeEvmTokensAddressNftsIdQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetRuntimeEvmTokensAddressNftsIdQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, address: EthOrOasisAddress, id: TextBigInt, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -4611,7 +4611,7 @@ export type GetRuntimeEvmTokensAddressNftsIdQueryError = HumanReadableErrorRespo */ export const useGetRuntimeEvmTokensAddressNftsId = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, address: EthOrOasisAddress, id: TextBigInt, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -4634,7 +4634,7 @@ export const useGetRuntimeEvmTokensAddressNftsId = ,signal?: AbortSignal @@ -4648,14 +4648,14 @@ export const GetRuntimeAccountsAddress = ( } -export const getGetRuntimeAccountsAddressQueryKey = (network: 'mainnet' | 'testnet', +export const getGetRuntimeAccountsAddressQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, address: EthOrOasisAddress,) => { return [`/${network}/${runtime}/accounts/${address}`] as const; } -export const getGetRuntimeAccountsAddressQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetRuntimeAccountsAddressQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, address: EthOrOasisAddress, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -4682,7 +4682,7 @@ export type GetRuntimeAccountsAddressQueryError = HumanReadableErrorResponse | N * @summary Returns a runtime account. */ export const useGetRuntimeAccountsAddress = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, address: EthOrOasisAddress, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -4705,7 +4705,7 @@ export const useGetRuntimeAccountsAddress = { @@ -4729,7 +4729,7 @@ export const getGetRuntimeAccountsAddressNftsQueryKey = (network: 'mainnet' | 't } -export const getGetRuntimeAccountsAddressNftsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetRuntimeAccountsAddressNftsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, address: EthOrOasisAddress, params?: GetRuntimeAccountsAddressNftsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -4758,7 +4758,7 @@ export type GetRuntimeAccountsAddressNftsQueryError = HumanReadableErrorResponse */ export const useGetRuntimeAccountsAddressNfts = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, address: EthOrOasisAddress, params?: GetRuntimeAccountsAddressNftsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -4781,7 +4781,7 @@ export const useGetRuntimeAccountsAddressNfts = ,signal?: AbortSignal ) => { @@ -4794,13 +4794,13 @@ export const GetRuntimeStatus = ( } -export const getGetRuntimeStatusQueryKey = (network: 'mainnet' | 'testnet', +export const getGetRuntimeStatusQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime,) => { return [`/${network}/${runtime}/status`] as const; } -export const getGetRuntimeStatusQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetRuntimeStatusQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -4826,7 +4826,7 @@ export type GetRuntimeStatusQueryError = HumanReadableErrorResponse | NotFoundEr * @summary Returns the runtime status. */ export const useGetRuntimeStatus = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', runtime: Runtime, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ): UseQueryResult & { queryKey: QueryKey } => { @@ -4849,7 +4849,7 @@ for either consensus or one of the paratimes. */ export const GetLayerStatsTxVolume = ( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', layer: Layer, params?: GetLayerStatsTxVolumeParams, options?: SecondParameter,signal?: AbortSignal @@ -4864,14 +4864,14 @@ export const GetLayerStatsTxVolume = ( } -export const getGetLayerStatsTxVolumeQueryKey = (network: 'mainnet' | 'testnet', +export const getGetLayerStatsTxVolumeQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', layer: Layer, params?: GetLayerStatsTxVolumeParams,) => { return [`/${network}/${layer}/stats/tx_volume`, ...(params ? [params]: [])] as const; } -export const getGetLayerStatsTxVolumeQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetLayerStatsTxVolumeQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', layer: Layer, params?: GetLayerStatsTxVolumeParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -4900,7 +4900,7 @@ for either consensus or one of the paratimes. */ export const useGetLayerStatsTxVolume = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', layer: Layer, params?: GetLayerStatsTxVolumeParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} @@ -4924,7 +4924,7 @@ either consensus or one of the paratimes. */ export const GetLayerStatsActiveAccounts = ( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', layer: Layer, params?: GetLayerStatsActiveAccountsParams, options?: SecondParameter,signal?: AbortSignal @@ -4939,14 +4939,14 @@ export const GetLayerStatsActiveAccounts = ( } -export const getGetLayerStatsActiveAccountsQueryKey = (network: 'mainnet' | 'testnet', +export const getGetLayerStatsActiveAccountsQueryKey = (network: 'mainnet' | 'testnet' | 'localnet', layer: Layer, params?: GetLayerStatsActiveAccountsParams,) => { return [`/${network}/${layer}/stats/active_accounts`, ...(params ? [params]: [])] as const; } -export const getGetLayerStatsActiveAccountsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet', +export const getGetLayerStatsActiveAccountsQueryOptions = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>(network: 'mainnet' | 'testnet' | 'localnet', layer: Layer, params?: GetLayerStatsActiveAccountsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} ) => { @@ -4975,7 +4975,7 @@ either consensus or one of the paratimes. */ export const useGetLayerStatsActiveAccounts = >, TError = HumanReadableErrorResponse | NotFoundErrorResponse>( - network: 'mainnet' | 'testnet', + network: 'mainnet' | 'testnet' | 'localnet', layer: Layer, params?: GetLayerStatsActiveAccountsParams, options?: { query?:UseQueryOptions>, TError, TData>, request?: SecondParameter} diff --git a/src/oasis-nexus/prependNetworkPath.js b/src/oasis-nexus/prependNetworkPath.js index dbe714074..e1b8436b9 100644 --- a/src/oasis-nexus/prependNetworkPath.js +++ b/src/oasis-nexus/prependNetworkPath.js @@ -23,7 +23,7 @@ module.exports = inputSchema => ({ required: true, schema: { type: 'string', - enum: ['mainnet', 'testnet'], + enum: ['mainnet', 'testnet', 'localnet'], }, }, ], diff --git a/src/oasis-nexus/replaceNetworkWithBaseURL.ts b/src/oasis-nexus/replaceNetworkWithBaseURL.ts index c8504baad..f6fc59637 100644 --- a/src/oasis-nexus/replaceNetworkWithBaseURL.ts +++ b/src/oasis-nexus/replaceNetworkWithBaseURL.ts @@ -8,6 +8,8 @@ export const replaceNetworkWithBaseURL = ( config.url = config.url.replace('/mainnet/', process.env.REACT_APP_API!) } else if (config.url?.startsWith('/testnet/')) { config.url = config.url.replace('/testnet/', process.env.REACT_APP_TESTNET_API!) + } else if (config.url?.startsWith('/localnet/')) { + config.url = config.url.replace('/localnet/', process.env.REACT_APP_LOCALNET_API!) } else { throw new Error(`Expected URL to be prefixed with network: ${config.url}`) } From 395e542d00192504f50cd5e1beaf62be65ce141f Mon Sep 17 00:00:00 2001 From: Michal Zielenkiewicz Date: Thu, 7 Nov 2024 08:53:29 +0100 Subject: [PATCH 2/6] Create localnet theme --- src/app/pages/HomePage/Graph/Graph/index.tsx | 18 ++++++++++++ src/styles/theme/index.ts | 4 +++ src/styles/theme/localnet/colors.ts | 7 +++++ src/styles/theme/localnet/theme.ts | 31 ++++++++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 src/styles/theme/localnet/colors.ts create mode 100644 src/styles/theme/localnet/theme.ts diff --git a/src/app/pages/HomePage/Graph/Graph/index.tsx b/src/app/pages/HomePage/Graph/Graph/index.tsx index e6e8898d3..d7e9ece69 100644 --- a/src/app/pages/HomePage/Graph/Graph/index.tsx +++ b/src/app/pages/HomePage/Graph/Graph/index.tsx @@ -16,6 +16,7 @@ import { useScreenSize } from '../../../../hooks/useScreensize' import { Layer } from '../../../../../oasis-nexus/api' import { Network } from '../../../../../types/network' import { COLORS } from '../../../../../styles/theme/testnet/colors' +import { COLORS as LOCALNET_COLORS } from '../../../../../styles/theme/localnet/colors' import { useTranslation } from 'react-i18next' import { useConsensusFreshness, useRuntimeFreshness } from '../../../../components/OfflineBanner/hook' import { SearchScope } from '../../../../../types/searchScope' @@ -361,6 +362,23 @@ const GraphCmp: ForwardRefRenderFunction = ( hoverBackground: COLORS.brandExtraDark, hoverText: COLORS.white, }, + localnet: { + cipherCircle: LOCALNET_COLORS.localnet, + cipherCircleFilter: 'url(#filter2_di_6093_290291)', + cipherCircleFill: LOCALNET_COLORS.localnet, + emeraldCircle: LOCALNET_COLORS.localnet, + emeraldCircleFilter: 'url(#filter0_di_6093_290291)', + sapphireCircle: LOCALNET_COLORS.localnet, + sapphireCircleFilter: 'url(#filter1_di_6093_290291)', + consensusCircle: LOCALNET_COLORS.localnetLight, + line: LOCALNET_COLORS.localnet, + text: COLORS.brandExtraDark, + textBackground: LOCALNET_COLORS.localnetLight, + textBorder: LOCALNET_COLORS.localnet, + circleBorder: LOCALNET_COLORS.localnet, + hoverBackground: COLORS.brandExtraDark, + hoverText: COLORS.white, + }, } const graphTheme = graphThemes[network] diff --git a/src/styles/theme/index.ts b/src/styles/theme/index.ts index aabd697fd..ad716cfba 100644 --- a/src/styles/theme/index.ts +++ b/src/styles/theme/index.ts @@ -1,12 +1,14 @@ import { Network } from '../../types/network' import { defaultTheme } from './defaultTheme' import { testnetTheme } from './testnet/theme' +import { localnetTheme } from './localnet/theme' import type { Theme } from '@mui/material/styles/createTheme' import { Layer } from '../../oasis-nexus/api' import { specialScopeThemes } from '../../config' export { defaultTheme } from './defaultTheme' export { testnetTheme } from './testnet/theme' +export { localnetTheme } from './localnet/theme' export const tooltipDelay = 500 export const typingDelay = 1000 @@ -20,5 +22,7 @@ export const getThemeForScope = (network: Network, layer?: Layer): Theme => { return defaultTheme case Network.testnet: return testnetTheme + case Network.localnet: + return localnetTheme } } diff --git a/src/styles/theme/localnet/colors.ts b/src/styles/theme/localnet/colors.ts new file mode 100644 index 000000000..e75ca3c9c --- /dev/null +++ b/src/styles/theme/localnet/colors.ts @@ -0,0 +1,7 @@ +import { COLORS as DEFAULT_COLORS } from '../colors' + +export const COLORS = { + ...DEFAULT_COLORS, + localnet: '#cecece', + localnetLight: '#ebebeb', +} satisfies { [colorName: string]: string } diff --git a/src/styles/theme/localnet/theme.ts b/src/styles/theme/localnet/theme.ts new file mode 100644 index 000000000..547317e2d --- /dev/null +++ b/src/styles/theme/localnet/theme.ts @@ -0,0 +1,31 @@ +import { deepmerge } from '@mui/utils' +import { createTheme } from '@mui/material/styles' +import { COLORS } from './colors' +import { defaultTheme } from '../defaultTheme' + +export const localnetTheme = createTheme( + deepmerge(defaultTheme, { + palette: { + background: { + default: COLORS.localnetLight, + empty: COLORS.white, + }, + layout: { + main: COLORS.brandExtraDark, + border: COLORS.localnet, + contrastMain: COLORS.brandExtraDark, + contrastSecondary: COLORS.localnet, + darkBorder: COLORS.localnet, + hoverBorder: COLORS.localnet, + lightBorder: COLORS.localnet, + secondary: COLORS.localnet, + primaryBackground: COLORS.localnetLight, + secondaryBackground: COLORS.white, + networkBubbleBorder: COLORS.localnet, + titleOnBackground: COLORS.grayExtraDark, + graphZoomOutText: COLORS.brandDark, + helpScreenIconColor: COLORS.brandExtraDark, + }, + }, + }), +) From 3184b115fa2d2bceef59212956368ef0a0dac81c Mon Sep 17 00:00:00 2001 From: Michal Zielenkiewicz Date: Thu, 7 Nov 2024 09:13:31 +0100 Subject: [PATCH 3/6] Make app aware of localnet network --- .changelog/1628.feature.md | 1 + .../AbiPlaygroundLink.tsx | 4 ++++ src/app/components/Search/search-utils.ts | 23 +++++++++++++++++++ src/app/config/dapps/index.ts | 3 +++ src/app/data/oasis-account-names.ts | 5 ++++ src/app/hooks/useAccountMetadata.ts | 3 ++- src/app/utils/getRPCAccountBalances.ts | 3 ++- src/app/utils/route-utils.ts | 10 ++++++++ src/config.ts | 18 ++++++++++++++- src/locales/en/translation.json | 1 + src/types/network.ts | 2 ++ 11 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 .changelog/1628.feature.md diff --git a/.changelog/1628.feature.md b/.changelog/1628.feature.md new file mode 100644 index 000000000..fa3b2e3eb --- /dev/null +++ b/.changelog/1628.feature.md @@ -0,0 +1 @@ +Localnet support diff --git a/src/app/components/ContractVerificationIcon/AbiPlaygroundLink.tsx b/src/app/components/ContractVerificationIcon/AbiPlaygroundLink.tsx index 4e9083e9b..0d79eda10 100644 --- a/src/app/components/ContractVerificationIcon/AbiPlaygroundLink.tsx +++ b/src/app/components/ContractVerificationIcon/AbiPlaygroundLink.tsx @@ -21,6 +21,10 @@ export const AbiPlaygroundLink: FC<{ [Layer.emerald]: `${externalLinks.dapps.abiPlayground}?network=42261&contractAddress=${address_eth}`, [Layer.sapphire]: `${externalLinks.dapps.abiPlayground}?network=23295&contractAddress=${address_eth}`, }, + [Network.localnet]: { + [Layer.emerald]: `${externalLinks.dapps.abiPlayground}?network=42260&contractAddress=${address_eth}`, + [Layer.sapphire]: `${externalLinks.dapps.abiPlayground}?network=23293&contractAddress=${address_eth}`, + }, } const abiPlaygroundLinkProps = { href: scopeToPlaygroundURL[scope.network]?.[scope.layer], diff --git a/src/app/components/Search/search-utils.ts b/src/app/components/Search/search-utils.ts index 3fce4ff8b..e2966ad6b 100644 --- a/src/app/components/Search/search-utils.ts +++ b/src/app/components/Search/search-utils.ts @@ -64,6 +64,29 @@ export const searchSuggestionTerms = { }, consensus: undefined, }, + localnet: { + emerald: { + suggestedBlock: '', + suggestedTransaction: '', + suggestedAccount: '', + suggestedTokenFragment: '', + }, + sapphire: { + suggestedBlock: '', + suggestedTransaction: '', + suggestedAccount: '', + suggestedTokenFragment: '', + }, + cipher: undefined, + pontusxdev: undefined, + pontusxtest: undefined, + consensus: { + suggestedBlock: '', + suggestedTransaction: '', + suggestedAccount: '', + suggestedTokenFragment: '', + }, + }, } satisfies SpecifiedPerEnabledLayer export const textSearchMinimumLength = 3 diff --git a/src/app/config/dapps/index.ts b/src/app/config/dapps/index.ts index e2a0ec21b..71b240fb3 100644 --- a/src/app/config/dapps/index.ts +++ b/src/app/config/dapps/index.ts @@ -22,6 +22,9 @@ const dappsForToken: Record>> = { [Layer.sapphire]: 'https://raw.githubusercontent.com/oasisprotocol/nexus/main/account-names/testnet_paratime.json', }, + [Network.localnet]: { + [Layer.consensus]: undefined, + [Layer.emerald]: undefined, + [Layer.sapphire]: undefined, + }, } const getOasisAccountsMetadata = async (network: Network, layer: Layer): Promise => { diff --git a/src/app/hooks/useAccountMetadata.ts b/src/app/hooks/useAccountMetadata.ts index b71e9c439..322d844ce 100644 --- a/src/app/hooks/useAccountMetadata.ts +++ b/src/app/hooks/useAccountMetadata.ts @@ -4,6 +4,7 @@ import { usePontusXAccountMetadata, useSearchForPontusXAccountsByName } from '.. import { AccountMetadataInfo, AccountNameSearchResults } from '../data/named-accounts' import { useOasisAccountMetadata, useSearchForOasisAccountsByName } from '../data/oasis-account-names' import { getOasisAddress } from '../utils/helpers' +import { isLocalnet } from '../utils/route-utils' /** * Find out the metadata for an account @@ -20,7 +21,7 @@ export const useAccountMetadata = (scope: SearchScope, address: string): Account useErrorBoundary: false, }) const oasisData = useOasisAccountMetadata(scope.network, scope.layer, getOasisAddress(address), { - enabled: !isPontusX, + enabled: !isPontusX && !isLocalnet(scope.network), useErrorBoundary: false, }) return isPontusX ? pontusXData : oasisData diff --git a/src/app/utils/getRPCAccountBalances.ts b/src/app/utils/getRPCAccountBalances.ts index 7b1225496..c8090e524 100644 --- a/src/app/utils/getRPCAccountBalances.ts +++ b/src/app/utils/getRPCAccountBalances.ts @@ -8,6 +8,7 @@ import { fromBaseUnits } from './number-utils' const grpcUrls: { [key in Network]: string } = { [Network.mainnet]: 'https://grpc.oasis.io', [Network.testnet]: 'https://testnet.grpc.oasis.io', + [Network.localnet]: 'http://localhost:8544.', } export async function getRPCAccountBalances( @@ -18,7 +19,7 @@ export async function getRPCAccountBalances( }, ): Promise { const paratimeConfig = paraTimesConfig[scope.layer][scope.network] - if (!paratimeConfig.runtimeId) throw new Error('Paratime is not configured') + if (!paratimeConfig?.runtimeId) throw new Error('Paratime is not configured') const nic = new oasis.client.NodeInternal(grpcUrls[scope.network]) const accountsWrapper = new oasisRT.accounts.Wrapper(oasis.misc.fromHex(paratimeConfig.runtimeId)) diff --git a/src/app/utils/route-utils.ts b/src/app/utils/route-utils.ts index 0d3f24f55..dc1d260cf 100644 --- a/src/app/utils/route-utils.ts +++ b/src/app/utils/route-utils.ts @@ -92,6 +92,14 @@ export abstract class RouteUtils { // Disable WIP Consensus on production and staging [Layer.consensus]: !isStableDeploy, }, + [Network.localnet]: { + [Layer.emerald]: false, + [Layer.sapphire]: false, + [Layer.cipher]: false, + [Layer.pontusxdev]: false, + [Layer.pontusxtest]: false, + [Layer.consensus]: true, + }, } satisfies Record> static getScopeRoute = ({ network, layer }: SearchScope) => { @@ -391,3 +399,5 @@ export const isScopeSelectorNeeded = (sourceScope: SearchScope) => { return false } } + +export const isLocalnet = (network: Network) => network === 'localnet' diff --git a/src/config.ts b/src/config.ts index 33a810be2..6147f1a8f 100644 --- a/src/config.ts +++ b/src/config.ts @@ -35,6 +35,7 @@ type LayerNetwork = { type LayerConfig = { mainnet: LayerNetwork testnet: LayerNetwork + localnet?: LayerNetwork decimals: number type: RuntimeTypes } @@ -52,6 +53,9 @@ export const consensusConfig = { testnet: { tokens: [NativeToken.TEST], }, + localnet: { + tokens: [NativeToken.TEST], + }, decimals: consensusDecimals, } @@ -69,6 +73,12 @@ const emeraldConfig: LayerConfig = { runtimeId: '00000000000000000000000000000000000000000000000072c8215e60d5bca7', tokens: [NativeToken.TEST], }, + localnet: { + address: '', + blockGasLimit: 30_000_000, + runtimeId: '', + tokens: [NativeToken.TEST], + }, decimals: 18, type: RuntimeTypes.Evm, } @@ -105,6 +115,12 @@ const sapphireConfig: LayerConfig = { runtimeId: '000000000000000000000000000000000000000000000000a6d1e3ebf60dff6c', tokens: [NativeToken.TEST], }, + localnet: { + address: '', + blockGasLimit: 15_000_000, + runtimeId: '', + tokens: [NativeToken.TEST], + }, decimals: 18, type: RuntimeTypes.Evm, } @@ -180,7 +196,7 @@ export const getAppTitle = () => process.env.REACT_APP_META_TITLE export const getTokensForScope = (scope: SearchScope | undefined): NativeTokenInfo[] => { if (!scope) return [] if (scope.layer === Layer.consensus) return consensusConfig[scope.network].tokens - return paraTimesConfig[scope.layer][scope.network].tokens + return paraTimesConfig?.[scope.layer]?.[scope.network]?.tokens! } export const getFiatCurrencyForScope = (scope: SearchScope | undefined) => diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index 72d19359d..3004b221f 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -96,6 +96,7 @@ "id": "ID", "invalidVotes": "Invalid votes", "layer": "Layer", + "localnet": "Localnet", "loadMore": "Load more", "lessThanAmount": "< {{value, number}} ", "missing": "n/a", diff --git a/src/types/network.ts b/src/types/network.ts index a142d0e99..dfa9fec6e 100644 --- a/src/types/network.ts +++ b/src/types/network.ts @@ -6,11 +6,13 @@ export type Network = (typeof Network)[keyof typeof Network] export const Network = { mainnet: 'mainnet', testnet: 'testnet', + localnet: 'localnet', } as const export const getNetworkNames = (t: TFunction): Record => ({ [Network.mainnet]: t('common.mainnet'), [Network.testnet]: t('common.testnet'), + [Network.localnet]: t('common.localnet'), }) interface HasNetwork { From d56fa0b532b108821e5acdfdf29afc69e1f9cd27 Mon Sep 17 00:00:00 2001 From: Michal Zielenkiewicz Date: Thu, 7 Nov 2024 09:25:29 +0100 Subject: [PATCH 4/6] Adjust app content to localnet requirements --- .../ContractVerificationIcon/index.tsx | 5 +- .../components/LayerPicker/LayerDetails.tsx | 131 ++++++++++-------- src/app/components/LayerPicker/LayerMenu.tsx | 1 + src/app/components/LayerPicker/index.tsx | 1 + .../pages/ConsensusDashboardPage/index.tsx | 40 ++++-- .../LearningMaterials.tsx | 39 ++++++ src/app/pages/ParatimeDashboardPage/index.tsx | 27 ++-- src/app/utils/content.tsx | 2 + src/app/utils/externalLinks.ts | 2 + src/app/utils/route-utils.ts | 2 +- src/locales/en/translation.json | 12 ++ 11 files changed, 182 insertions(+), 80 deletions(-) diff --git a/src/app/components/ContractVerificationIcon/index.tsx b/src/app/components/ContractVerificationIcon/index.tsx index 5497cd903..61e0cc51e 100644 --- a/src/app/components/ContractVerificationIcon/index.tsx +++ b/src/app/components/ContractVerificationIcon/index.tsx @@ -9,6 +9,7 @@ import Link from '@mui/material/Link' import Typography from '@mui/material/Typography' import { SearchScope } from '../../../types/searchScope' import * as externalLinks from '../../utils/externalLinks' +import { isLocalnet } from '../../utils/route-utils' import { AbiPlaygroundLink } from './AbiPlaygroundLink' type VerificationStatus = 'verified' | 'unverified' @@ -60,7 +61,9 @@ export const VerificationIcon: FC<{ }> = ({ address_eth, scope, verified, noLink = false }) => { const { t } = useTranslation() const [explainDelay, setExplainDelay] = useState(false) - + if (isLocalnet(scope.network)) { + return null + } const status: VerificationStatus = verified ? 'verified' : 'unverified' const statusLabel: Record = { verified: t('contract.verification.isVerified'), diff --git a/src/app/components/LayerPicker/LayerDetails.tsx b/src/app/components/LayerPicker/LayerDetails.tsx index fb745e26a..814ee5174 100644 --- a/src/app/components/LayerPicker/LayerDetails.tsx +++ b/src/app/components/LayerPicker/LayerDetails.tsx @@ -23,11 +23,11 @@ import { useScreenSize } from '../../hooks/useScreensize' type LayerDetailsContent = { description: string - rpcHttp: string + rpcHttp?: string rpcWebSockets?: string chainHexId: string chainDecimalId: string - docs: string + docs?: string } type NetworkDetails = Partial> @@ -85,6 +85,18 @@ const getDetails = (t: TFunction): Details => ({ docs: docs.pontusx1, }, }, + [Network.localnet]: { + [Layer.sapphire]: { + chainHexId: '0x5afd', + chainDecimalId: '23293', + description: t('layerPicker.localnet.sapphire'), + }, + [Layer.emerald]: { + chainHexId: '0xa514', + chainDecimalId: '42260', + description: t('layerPicker.localnet.emerald'), + }, + }, }) export const StyledButton = styled(Button)(({ theme }) => ({ @@ -105,6 +117,7 @@ type LayerDetailsProps = { handleConfirm: () => void network: Network selectedLayer: Layer + selectedNetwork: Network isOutOfDate: boolean | undefined } @@ -114,17 +127,19 @@ const contentMinHeight = '270px' export const LayerDetails: FC = (props: LayerDetailsProps) => props.selectedLayer === Layer.consensus ? : -const ConsensusDetails: FC = props => { +const ConsensusDetails: FC = props => { const { t } = useTranslation() - const { handleConfirm, network, selectedLayer } = props + const { handleConfirm, network, selectedLayer, selectedNetwork } = props const isOutOfDate = useConsensusFreshness(network).outOfDate + const isLocal = selectedNetwork === 'localnet' return ( @@ -136,52 +151,56 @@ const ConsensusDetails: FC = props => { const RuntimeDetails: FC = props => { const { t } = useTranslation() - const { handleConfirm, network, selectedLayer } = props + const { handleConfirm, network, selectedLayer, selectedNetwork } = props const isOutOfDate = useRuntimeFreshness({ network, layer: selectedLayer }).outOfDate - const details = getDetails(t)[network][selectedLayer] - if (!details) { - return null - } + const details = getDetails(t)[network]?.[selectedLayer] return ( - - {details.description} - + {details?.description && ( + + {details.description} + + )} - - {t('layerPicker.rpcHttp', { - endpoint: details.rpcHttp, - })} - - {details.rpcWebSockets && ( + {details?.rpcHttp && ( + + {t('layerPicker.rpcHttp', { + endpoint: details.rpcHttp, + })} + + )} + {details?.rpcWebSockets && ( {t('layerPicker.rpcWebSockets', { endpoint: details.rpcWebSockets, })} )} - - {t('layerPicker.chainId')} - - - {t('layerPicker.hex', { - id: details.chainHexId, - })} - - - {t('layerPicker.decimal', { - id: details.chainDecimalId, - })} - - - + {details?.chainHexId && details?.chainDecimalId && ( + + {t('layerPicker.chainId')} + + + {t('layerPicker.hex', { + id: details.chainHexId, + })} + + + {t('layerPicker.decimal', { + id: details.chainDecimalId, + })} + + + + )} ) @@ -189,7 +208,7 @@ const RuntimeDetails: FC = props => { type LayerDetailsSectionProps = LayerDetailsProps & { children: React.ReactNode - docsUrl: string + docsUrl?: string } export const LayerDetailsSection: FC = ({ @@ -236,25 +255,27 @@ export const LayerDetailsSection: FC = ({ {children} - - {t('layerPicker.readMore', { - layer: layerLabels[selectedLayer], - network: labels[network], - })} - - + {docsUrl && ( + + {t('layerPicker.readMore', { + layer: layerLabels[selectedLayer], + network: labels[network], + })} + + + )} ) diff --git a/src/app/components/LayerPicker/LayerMenu.tsx b/src/app/components/LayerPicker/LayerMenu.tsx index 20c7a9a3e..452f9232f 100644 --- a/src/app/components/LayerPicker/LayerMenu.tsx +++ b/src/app/components/LayerPicker/LayerMenu.tsx @@ -124,6 +124,7 @@ export const LayerMenu: FC = ({ {options.map((option, index) => { if (!option.enabled) { + if (selectedNetwork === 'localnet') return null return ( = ({ isOutOfDate, onClose, diff --git a/src/app/pages/ConsensusDashboardPage/index.tsx b/src/app/pages/ConsensusDashboardPage/index.tsx index 74bf15ca5..745932ed5 100644 --- a/src/app/pages/ConsensusDashboardPage/index.tsx +++ b/src/app/pages/ConsensusDashboardPage/index.tsx @@ -1,6 +1,7 @@ import { FC } from 'react' import Grid from '@mui/material/Grid' import Divider from '@mui/material/Divider' +import { isLocalnet } from '../../utils/route-utils' import { PageLayout } from '../../components/PageLayout' import { useScreenSize } from '../../hooks/useScreensize' import { TotalTransactions } from '../../components/TotalTransactions' @@ -15,31 +16,46 @@ import { LatestConsensusBlocks } from './LatestConsensusBlocks' import { AccountsCard } from './AccountsCard' import { LatestConsensusTransactions } from './LatestConsensusTransactions' import { ParaTimesCard } from './ParaTimesCard' +import { SearchScope } from 'types/searchScope' export const ConsensusDashboardPage: FC = () => { const { isMobile } = useScreenSize() const scope = useRequiredScopeParam() + const isLocal = isLocalnet(scope.network) return ( - + {!isLocal && } - - - + {!isLocal && ( + + + + + - - - - + )} + {isLocal && } - + {!isLocal && } - - + {!isLocal && ( + <> + + + + )} - + {!isLocal && } ) } + +const LatestBlocksGrid = ({ scope }: { scope: SearchScope }) => { + return ( + + + + ) +} diff --git a/src/app/pages/ParatimeDashboardPage/LearningMaterials.tsx b/src/app/pages/ParatimeDashboardPage/LearningMaterials.tsx index fc3a0b721..2ce9adfde 100644 --- a/src/app/pages/ParatimeDashboardPage/LearningMaterials.tsx +++ b/src/app/pages/ParatimeDashboardPage/LearningMaterials.tsx @@ -136,6 +136,45 @@ const getContent = (t: TFunction) => { }, }, }, + [Network.localnet]: { + [Layer.emerald]: { + primary: { + description: t('learningMaterials.emerald.description'), + header: t('learningMaterials.emerald.header'), + url: docs.emeraldTestnet, + }, + secondary: { + description: t('learningMaterials.localnet.description'), + header: t('learningMaterials.localnet.header'), + url: docs.emeraldTestnetNode, + }, + tertiary: { + description: t('learningMaterials.emerald.gatewayDescription'), + header: t('learningMaterials.emerald.gateway'), + url: docs.emeraldGateway, + }, + }, + [Layer.sapphire]: { + primary: { + description: t('learningMaterials.sapphire.description'), + header: t('learningMaterials.sapphire.header'), + url: docs.sapphireTestnet, + }, + secondary: { + description: t('learningMaterials.localnet.description'), + header: t('learningMaterials.localnet.header'), + url: docs.localnet, + }, + tertiary: { + description: t('learningMaterials.tools.description'), + header: t('learningMaterials.tools.header', { layer: labels['sapphire'] }), + url: docs.tools, + }, + }, + [Layer.cipher]: undefined, + [Layer.pontusxdev]: undefined, + [Layer.pontusxtest]: undefined, + }, } satisfies SpecifiedPerEnabledRuntime } diff --git a/src/app/pages/ParatimeDashboardPage/index.tsx b/src/app/pages/ParatimeDashboardPage/index.tsx index 4060776ec..fd7b906b7 100644 --- a/src/app/pages/ParatimeDashboardPage/index.tsx +++ b/src/app/pages/ParatimeDashboardPage/index.tsx @@ -2,6 +2,7 @@ import { FC } from 'react' import Divider from '@mui/material/Divider' import Grid from '@mui/material/Grid' import { useScreenSize } from '../../hooks/useScreensize' +import { isLocalnet } from '../../utils/route-utils' import { Social } from '../../components/Social' import { LearningMaterials } from './LearningMaterials' import { LatestRuntimeBlocks } from './LatestRuntimeBlocks' @@ -16,10 +17,11 @@ import { useRequiredScopeParam } from '../../hooks/useScopeParam' export const ParatimeDashboardPage: FC = () => { const { isMobile } = useScreenSize() const scope = useRequiredScopeParam() + const isLocal = isLocalnet(scope.network) return ( - + {!isLocal && } @@ -36,16 +38,19 @@ export const ParatimeDashboardPage: FC = () => { )} {!isMobile && } - - - - - - - - - - + {!isLocal && ( + <> + + + + + + + + + + + )} ) } diff --git a/src/app/utils/content.tsx b/src/app/utils/content.tsx index e8d110363..a63f16e7f 100644 --- a/src/app/utils/content.tsx +++ b/src/app/utils/content.tsx @@ -4,6 +4,7 @@ import { Layer } from '../../oasis-nexus/api' import { Network } from '../../types/network' import { MainnetIcon } from '../components/CustomIcons/Mainnet' import { TestnetIcon } from '../components/CustomIcons/Testnet' +import ConstructionIcon from '@mui/icons-material/Construction' export const getLayerLabels = (t: TFunction): Record => ({ [Layer.emerald]: t('common.emerald'), @@ -17,4 +18,5 @@ export const getLayerLabels = (t: TFunction): Record => ({ export const getNetworkIcons = ({ size }: { size?: number } = {}): Record => ({ [Network.mainnet]: , [Network.testnet]: , + [Network.localnet]: , }) diff --git a/src/app/utils/externalLinks.ts b/src/app/utils/externalLinks.ts index 8247e06f5..9bf6c0393 100644 --- a/src/app/utils/externalLinks.ts +++ b/src/app/utils/externalLinks.ts @@ -26,8 +26,10 @@ export const docs = { emeraldTestnet: `https://docs.oasis.io/dapp/emerald/#testnet`, emeraldTestnetNode: `https://docs.oasis.io/node/testnet/#emerald`, emeraldGateway: `https://docs.oasis.io/dapp/emerald/#web3-gateway`, + localnet: 'https://docs.oasis.io/dapp/tools/localnet', sapphire: `https://docs.oasis.io/dapp/sapphire/`, token: `https://docs.oasis.io/general/oasis-network/token-metrics-and-distribution`, + tools: 'https://docs.oasis.io/dapp/tools/', paraTimeTransfer: `https://docs.oasis.io/general/manage-tokens/how-to-transfer-rose-into-paratime`, sapphireTestnetNode: `https://docs.oasis.io/node/testnet/#sapphire`, sapphireTestnet: `https://docs.oasis.io/dapp/sapphire/#testnet`, diff --git a/src/app/utils/route-utils.ts b/src/app/utils/route-utils.ts index dc1d260cf..adf85d0b3 100644 --- a/src/app/utils/route-utils.ts +++ b/src/app/utils/route-utils.ts @@ -94,7 +94,7 @@ export abstract class RouteUtils { }, [Network.localnet]: { [Layer.emerald]: false, - [Layer.sapphire]: false, + [Layer.sapphire]: true, [Layer.cipher]: false, [Layer.pontusxdev]: false, [Layer.pontusxtest]: false, diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index 3004b221f..2b8f2f866 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -339,6 +339,14 @@ "header": "Testnet parameters", "description": "The Testnet may be subject to frequent version upgrades." }, + "localnet": { + "header": "Localnet", + "description": "Convenient development and testing of your dApps." + }, + "tools": { + "header": "Tools & Services", + "description": "Oasis integrates with a number of services and provides tooling support for developers." + }, "transfer": { "header": "How to Transfer ROSE into a ParaTime?", "description": "Rose is the currency powering the {{layer}} network." @@ -536,6 +544,10 @@ "sapphire": "The Testnet of the official confidential EVM Compatible ParaTime providing a smart contract development environment with EVM compatibility.", "pontusxdev": "The Devnet of Pontus-X, a confidential EVM Compatible ParaTime offering a smart contract development environment that is compatible with the Ethereum Virtual Machine (EVM) focused on building a Federated Data Economy.", "pontusxtest": "The Testnet of Pontus-X, a confidential EVM Compatible ParaTime offering a smart contract development environment that is compatible with the Ethereum Virtual Machine (EVM) focused on building a Federated Data Economy." + }, + "localnet": { + "emerald": "The Localnet of the EVM Compatible ParaTime providing a smart contract development environment.", + "sapphire": "The Localnet of the official confidential EVM Compatible ParaTime providing a smart contract development environment with EVM compatibility." } }, "home": { From 75262ee56fbc87c571919e2fe209b568fb5d8ce6 Mon Sep 17 00:00:00 2001 From: Michal Zielenkiewicz Date: Thu, 7 Nov 2024 10:43:19 +0100 Subject: [PATCH 5/6] Introduce new localnet envs --- .env | 5 +++++ src/app/utils/route-utils.ts | 6 +++--- src/types/global.d.ts | 3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.env b/.env index 575eac159..8f8169bab 100644 --- a/.env +++ b/.env @@ -30,3 +30,8 @@ REACT_APP_SHOW_BUILD_BANNERS=true # REACT_APP_FIXED_LAYER=sapphire # REACT_APP_SKIP_GRAPH=true REACT_APP_SHOW_FIAT_VALUES=true + +# LOCALNET SETTINGS +REACT_APP_LOCALNET_CONSENSUS=false +REACT_APP_LOCALNET_SAPPHIRE=false +REACT_APP_LOCALNET_EMERALD=false diff --git a/src/app/utils/route-utils.ts b/src/app/utils/route-utils.ts index adf85d0b3..90c26523b 100644 --- a/src/app/utils/route-utils.ts +++ b/src/app/utils/route-utils.ts @@ -93,12 +93,12 @@ export abstract class RouteUtils { [Layer.consensus]: !isStableDeploy, }, [Network.localnet]: { - [Layer.emerald]: false, - [Layer.sapphire]: true, + [Layer.emerald]: process.env.REACT_APP_LOCALNET_EMERALD === 'true', + [Layer.sapphire]: process.env.REACT_APP_LOCALNET_SAPPHIRE === 'true', [Layer.cipher]: false, [Layer.pontusxdev]: false, [Layer.pontusxtest]: false, - [Layer.consensus]: true, + [Layer.consensus]: process.env.REACT_APP_LOCALNET_CONSENSUS === 'true', }, } satisfies Record> diff --git a/src/types/global.d.ts b/src/types/global.d.ts index ce3fbc22b..f4892c1fe 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -30,6 +30,9 @@ declare global { REACT_APP_FIXED_LAYER?: string REACT_APP_SKIP_GRAPH?: string REACT_APP_SHOW_FIAT_VALUES: 'true' | 'false' + REACT_APP_LOCALNET_CONSENSUS: 'true' | 'false' + REACT_APP_LOCALNET_SAPPHIRE: 'true' | 'false' + REACT_APP_LOCALNET_EMERALD: 'true' | 'false' } } From 2038749688f9552fb9dc5fc174f35db3529a88de Mon Sep 17 00:00:00 2001 From: Michal Zielenkiewicz Date: Sun, 10 Nov 2024 09:37:37 +0100 Subject: [PATCH 6/6] Update HomePage graph labels for localnet --- src/app/pages/HomePage/Graph/Graph/index.tsx | 46 +++++++++----------- src/locales/en/translation.json | 4 +- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/app/pages/HomePage/Graph/Graph/index.tsx b/src/app/pages/HomePage/Graph/Graph/index.tsx index d7e9ece69..421c31f88 100644 --- a/src/app/pages/HomePage/Graph/Graph/index.tsx +++ b/src/app/pages/HomePage/Graph/Graph/index.tsx @@ -11,7 +11,7 @@ import { useMemo, useState, } from 'react' -import { RouteUtils } from '../../../../utils/route-utils' +import { RouteUtils, isLocalnet } from '../../../../utils/route-utils' import { useScreenSize } from '../../../../hooks/useScreensize' import { Layer } from '../../../../../oasis-nexus/api' import { Network } from '../../../../../types/network' @@ -42,6 +42,22 @@ interface GraphStyledProps extends GraphBaseProps { hoveredLayer: Layer | null } +const LayerNotEnabledLabel = ({ network }: { network: Network }) => { + const { t } = useTranslation() + const isLocal = isLocalnet(network) + + return ( + <> + + {isLocal ? t('home.not') : t('home.coming')} + + + {isLocal ? t('home.enabled') : t('home.soon')} + + + ) +} + const GraphStyled = styled('svg', { shouldForwardProp: prop => !(['disabled', 'transparent', 'selectedArea', 'hoveredLayer'] as (keyof GraphStyledProps)[]).includes( @@ -604,12 +620,7 @@ const GraphCmp: ForwardRefRenderFunction = ( )} {!isMobile && hoveredLayer === Layer.emerald && disabledMap[Layer.emerald] && ( - - {t('home.coming')} - - - {t('home.soon')} - + )} @@ -660,12 +671,7 @@ const GraphCmp: ForwardRefRenderFunction = ( )} {!isMobile && hoveredLayer === Layer.sapphire && disabledMap[Layer.sapphire] && ( - - {t('home.coming')} - - - {t('home.soon')} - + )} @@ -737,12 +743,7 @@ const GraphCmp: ForwardRefRenderFunction = ( )} {!isMobile && hoveredLayer === Layer.consensus && disabledMap[Layer.consensus] && ( - - {t('home.coming')} - - - {t('home.soon')} - + )} @@ -786,12 +787,7 @@ const GraphCmp: ForwardRefRenderFunction = ( )} {!isMobile && hoveredLayer === Layer.cipher && disabledMap[Layer.cipher] && ( - - {t('home.coming')} - - - {t('home.soon')} - + )} diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index 2b8f2f866..0c25d934e 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -582,7 +582,9 @@ }, "selectedNetwork": "Selected network", "coming": "Coming", - "soon": "soon" + "soon": "soon", + "not": "Not", + "enabled": "enabled" }, "paratimes": { "activeNodes": "{{nodes}} active",