diff --git a/api/src/services/nova/novaApi.ts b/api/src/services/nova/novaApi.ts index c99e6212c..53ee46fb9 100644 --- a/api/src/services/nova/novaApi.ts +++ b/api/src/services/nova/novaApi.ts @@ -79,14 +79,14 @@ export class NovaApi { * @returns The account details. */ public static async accountDetails(network: INetwork, accountId: string): Promise { - const aliasOutputId = await this.tryFetchNodeThenPermanode(accountId, "accountOutputId", network); + const accountOutputId = await this.tryFetchNodeThenPermanode(accountId, "accountOutputId", network); - if (aliasOutputId) { - const outputResponse = await this.outputDetails(network, aliasOutputId); + if (accountOutputId) { + const outputResponse = await this.outputDetails(network, accountOutputId); return outputResponse.error ? { error: outputResponse.error } : { accountDetails: outputResponse.output }; } - return { message: "Alias output not found" }; + return { message: "Account output not found" }; } /** diff --git a/client/src/app/AppUtils.tsx b/client/src/app/AppUtils.tsx index e7b82d016..0f240c6a2 100644 --- a/client/src/app/AppUtils.tsx +++ b/client/src/app/AppUtils.tsx @@ -37,7 +37,7 @@ export const populateNetworkInfoNova = (networkName: string) => { }) ?? null; const setNetworkInfoNova = useNetworkInfoNova.getState().setNetworkInfo; setNetworkInfoNova({ - name: nodeInfo?.name ?? "", + name: networkName, tokenInfo: nodeInfo?.baseToken ?? {}, protocolVersion: protocolInfo?.parameters.version ?? -1, bech32Hrp: protocolInfo?.parameters.bech32Hrp ?? "", diff --git a/client/src/app/components/nova/Input.tsx b/client/src/app/components/nova/Input.tsx index 0b5a58600..1861a216c 100644 --- a/client/src/app/components/nova/Input.tsx +++ b/client/src/app/components/nova/Input.tsx @@ -2,14 +2,14 @@ /* eslint-disable jsdoc/require-returns */ import { Utils } from "@iota/sdk-wasm-nova/web"; import classNames from "classnames"; -import React, { useContext, useState } from "react"; +import React, { useState } from "react"; import { useHistory, Link } from "react-router-dom"; import Bech32Address from "../stardust/address/Bech32Address"; +import { useNetworkInfoNova } from "~helpers/nova/networkInfo"; import OutputView from "./OutputView"; import DropdownIcon from "~assets/dropdown-arrow.svg?react"; import { formatAmount } from "~helpers/stardust/valueFormatHelper"; import { IInput } from "~models/api/nova/IInput"; -import NetworkContext from "../../context/NetworkContext"; interface InputProps { /** @@ -27,7 +27,7 @@ interface InputProps { */ const Input: React.FC = ({ input, network }) => { const history = useHistory(); - const { tokenInfo } = useContext(NetworkContext); + const { tokenInfo } = useNetworkInfoNova((s) => s.networkInfo); const [isExpanded, setIsExpanded] = useState(false); const [isFormattedBalance, setIsFormattedBalance] = useState(true); diff --git a/client/src/app/components/nova/OutputView.tsx b/client/src/app/components/nova/OutputView.tsx index 1f24f71c8..d138f6deb 100644 --- a/client/src/app/components/nova/OutputView.tsx +++ b/client/src/app/components/nova/OutputView.tsx @@ -26,7 +26,6 @@ import { Bech32AddressHelper } from "~/helpers/nova/bech32AddressHelper"; import "./OutputView.scss"; interface OutputViewProps { - network: string; outputId: string; output: Output; showCopyAmount: boolean; @@ -34,10 +33,10 @@ interface OutputViewProps { isLinksDisabled?: boolean; } -const OutputView: React.FC = ({ network, outputId, output, showCopyAmount, isPreExpanded, isLinksDisabled }) => { +const OutputView: React.FC = ({ outputId, output, showCopyAmount, isPreExpanded, isLinksDisabled }) => { const [isExpanded, setIsExpanded] = React.useState(isPreExpanded ?? false); const [isFormattedBalance, setIsFormattedBalance] = React.useState(true); - const { bech32Hrp } = useNetworkInfoNova((s) => s.networkInfo); + const { bech32Hrp, name: network } = useNetworkInfoNova((s) => s.networkInfo); const aliasOrNftBech32 = buildAddressForAliasOrNft(outputId, output, bech32Hrp); const outputIdTransactionPart = `${outputId.slice(0, 8)}....${outputId.slice(-8, -4)}`; diff --git a/client/src/app/components/nova/address/section/association/AssociatedOutputs.tsx b/client/src/app/components/nova/address/section/association/AssociatedOutputs.tsx index baf38f446..186b1f1ec 100644 --- a/client/src/app/components/nova/address/section/association/AssociatedOutputs.tsx +++ b/client/src/app/components/nova/address/section/association/AssociatedOutputs.tsx @@ -3,15 +3,12 @@ import React, { useEffect, useState } from "react"; import { AssociatedOutputTab, buildAssociatedOutputsTabs, outputTypeToAssociations } from "./AssociatedOutputsUtils"; import AssociationSection from "./AssociationSection"; import { useAssociatedOutputs } from "~helpers/nova/hooks/useAssociatedOutputs"; +import { useNetworkInfoNova } from "~helpers/nova/networkInfo"; import { IBech32AddressDetails } from "~models/api/IBech32AddressDetails"; import { AssociationType, IAssociation } from "~models/api/nova/IAssociationsResponse"; import "./AssociatedOutputs.scss"; interface AssociatedOutputsProps { - /** - * The network in context. - */ - readonly network: string; /** * Address details */ @@ -26,7 +23,8 @@ interface AssociatedOutputsProps { readonly setIsLoading?: (isLoading: boolean) => void; } -const AssociatedOutputs: React.FC = ({ network, addressDetails, setOutputCount, setIsLoading }) => { +const AssociatedOutputs: React.FC = ({ addressDetails, setOutputCount, setIsLoading }) => { + const { name: network } = useNetworkInfoNova((s) => s.networkInfo); const [currentTab, setCurrentTab] = useState("Basic"); const [associations, isLoading] = useAssociatedOutputs(network, addressDetails, setOutputCount); const [tabsToRender, setTabsToRender] = useState([]); @@ -69,7 +67,6 @@ const AssociatedOutputs: React.FC = ({ network, addressD ); return ( AssociationType[association.type].startsWith("DELEGATION"))) { - tabs.push("Account"); + tabs.push("Delegation"); } if (associations.some((association) => AssociationType[association.type].startsWith("FOUNDRY"))) { tabs.push("Foundry"); diff --git a/client/src/app/components/nova/address/section/association/AssociationSection.tsx b/client/src/app/components/nova/address/section/association/AssociationSection.tsx index 7a3daef51..104a6a7d9 100644 --- a/client/src/app/components/nova/address/section/association/AssociationSection.tsx +++ b/client/src/app/components/nova/address/section/association/AssociationSection.tsx @@ -12,7 +12,6 @@ import { useNetworkInfoNova } from "~/helpers/nova/networkInfo"; import "./AssociationSection.scss"; interface IAssociatedSectionProps { - readonly network: string; readonly association: AssociationType; readonly outputIds: string[] | undefined; } @@ -24,8 +23,8 @@ interface IOutputTableItem { const PAGE_SIZE = 10; -const AssociationSection: React.FC = ({ network, association, outputIds }) => { - const { tokenInfo } = useNetworkInfoNova((s) => s.networkInfo); +const AssociationSection: React.FC = ({ association, outputIds }) => { + const { tokenInfo, name: network } = useNetworkInfoNova((s) => s.networkInfo); const [isExpanded, setIsExpanded] = useState(false); const [isFormatBalance, setIsFormatBalance] = useState(false); const [loadMoreCounter, setLoadMoreCounter] = useState(); diff --git a/client/src/app/components/nova/block/payload/SignedTransactionPayload.tsx b/client/src/app/components/nova/block/payload/SignedTransactionPayload.tsx index 553ada80d..f12f7f80d 100644 --- a/client/src/app/components/nova/block/payload/SignedTransactionPayload.tsx +++ b/client/src/app/components/nova/block/payload/SignedTransactionPayload.tsx @@ -3,6 +3,7 @@ import React from "react"; import Modal from "~/app/components/Modal"; import Unlocks from "~/app/components/nova/Unlocks"; import OutputView from "~/app/components/nova/OutputView"; +import { useNetworkInfoNova } from "~helpers/nova/networkInfo"; import transactionPayloadMessage from "~assets/modals/stardust/block/transaction-payload.json"; import { IInput } from "~/models/api/nova/IInput"; import Input from "~/app/components/nova/Input"; @@ -14,7 +15,8 @@ interface SignedTransactionPayloadProps { } const SignedTransactionPayload: React.FC = ({ payload, inputs, header }) => { - const { networkId, outputs } = payload.transaction; + const { outputs } = payload.transaction; + const { name: network } = useNetworkInfoNova(s => s.networkInfo); const transactionId = Utils.transactionId(payload); return ( @@ -36,7 +38,7 @@ const SignedTransactionPayload: React.FC = ({ pay
{inputs.map((input, idx) => ( - + ))}
diff --git a/client/src/app/routes/nova/AddressPage.tsx b/client/src/app/routes/nova/AddressPage.tsx index 9d1b0e702..fd40a1a12 100644 --- a/client/src/app/routes/nova/AddressPage.tsx +++ b/client/src/app/routes/nova/AddressPage.tsx @@ -12,7 +12,7 @@ import "./AddressPage.scss"; const AddressPage: React.FC> = ({ match: { - params: { network, address }, + params: { address }, }, }) => { const [state] = useAddressPageState(); @@ -51,7 +51,7 @@ const AddressPage: React.FC> = ({

Associated Outputs

- + )} diff --git a/client/src/app/routes/nova/Block.tsx b/client/src/app/routes/nova/Block.tsx index f22b92ad5..c1beac903 100644 --- a/client/src/app/routes/nova/Block.tsx +++ b/client/src/app/routes/nova/Block.tsx @@ -20,6 +20,7 @@ import taggedDataPayloadInfo from "~assets/modals/stardust/block/tagged-data-pay import transactionPayloadInfo from "~assets/modals/stardust/block/transaction-payload.json"; import { useBlockMetadata } from "~/helpers/nova/hooks/useBlockMetadata"; import TransactionMetadataSection from "~/app/components/nova/block/section/TransactionMetadataSection"; + export interface BlockProps { /** * The network to lookup. @@ -33,7 +34,6 @@ export interface BlockProps { } const Block: React.FC> = ({ - history, match: { params: { network, blockId }, }, diff --git a/client/src/helpers/nova/hooks/useAddressPageState.ts b/client/src/helpers/nova/hooks/useAddressPageState.ts index a85d0c643..0f76327c8 100644 --- a/client/src/helpers/nova/hooks/useAddressPageState.ts +++ b/client/src/helpers/nova/hooks/useAddressPageState.ts @@ -37,7 +37,6 @@ export const useAddressPageState = (): [IAddressState, React.Dispatch