{`Argument ${index + 1}`}
diff --git a/src/features/transaction-wizard/components/payment-transaction-builder.tsx b/src/features/transaction-wizard/components/payment-transaction-builder.tsx
index fa1732de..b8897a0c 100644
--- a/src/features/transaction-wizard/components/payment-transaction-builder.tsx
+++ b/src/features/transaction-wizard/components/payment-transaction-builder.tsx
@@ -12,9 +12,9 @@ import { Form } from '@/features/forms/components/form'
import { BuildableTransactionType, BuildPaymentTransactionResult } from '../models'
import { randomGuid } from '@/utils/random-guid'
import { TransactionBuilderMode } from '../data'
-import { ZERO_ADDRESS } from '@/features/common/constants'
import SvgAlgorand from '@/features/common/components/icons/algorand'
import { TransactionBuilderNoteField } from './transaction-builder-note-field'
+import { TransactionBuilderAddressField } from './transaction-builder-address-field'
const receiverLabel = 'Receiver'
@@ -87,18 +87,12 @@ export function PaymentTransactionBuilder({ mode, transaction, activeAddress, on
>
{(helper) => (
<>
- {helper.textField({
- field: 'sender',
- label: 'Sender',
- helpText: 'Account to pay from. Sends the transaction and pays the fee',
- placeholder: ZERO_ADDRESS,
- })}
- {helper.textField({
- field: 'receiver',
- label: receiverLabel,
- helpText: 'Account to receive the amount',
- placeholder: ZERO_ADDRESS,
- })}
+
+
{helper.numberField({
field: 'amount',
label: (
diff --git a/src/features/transaction-wizard/components/transaction-builder-address-field.tsx b/src/features/transaction-wizard/components/transaction-builder-address-field.tsx
new file mode 100644
index 00000000..9e4fe748
--- /dev/null
+++ b/src/features/transaction-wizard/components/transaction-builder-address-field.tsx
@@ -0,0 +1,49 @@
+import { FormFieldHelper } from '@/features/forms/components/form-field-helper'
+import { z } from 'zod'
+import { useFormContext } from 'react-hook-form'
+import { useLoadableNfdResult } from '@/features/nfd/data/nfd'
+import { useDebounce } from 'use-debounce'
+import { NfdResult } from '@/features/nfd/data/types'
+import { ZERO_ADDRESS } from '@/features/common/constants'
+import { useEffect, useState } from 'react'
+import { isNfd } from '@/features/nfd/data/is-nfd'
+import { commonAddressFormData } from '../data/common'
+import { ellipseAddress } from '@/utils/ellipse-address'
+
+type TransactionBuilderAddressFieldProps = {
+ fieldName: keyof z.infer
+ helpText: string
+ label: string
+}
+
+export function TransactionBuilderAddressField({ fieldName, helpText, label }: TransactionBuilderAddressFieldProps) {
+ const helper = new FormFieldHelper>()
+ const formCtx = useFormContext>()
+ const fieldValue = formCtx.watch(fieldName)
+ const [debouncedValue] = useDebounce(fieldValue && isNfd(String(fieldValue)) ? String(fieldValue) : '', 500)
+ const [loadableNfd] = useLoadableNfdResult(debouncedValue)
+ const [currentNfd, setCurrentNfd] = useState(undefined)
+
+ useEffect(() => {
+ if (loadableNfd.state === 'hasData' && loadableNfd.data !== null) {
+ setCurrentNfd(loadableNfd.data)
+ } else {
+ setCurrentNfd(undefined)
+ }
+ }, [loadableNfd])
+
+ return (
+
+ {helper.textField({
+ field: fieldName,
+ label: (
+
+ {label} {currentNfd ? ` (${ellipseAddress(currentNfd.depositAccount)})` : ''}
+
+ ),
+ helpText: helpText,
+ placeholder: ZERO_ADDRESS,
+ })}
+
+ )
+}
diff --git a/src/features/transaction-wizard/data/common.ts b/src/features/transaction-wizard/data/common.ts
index bc436448..83977583 100644
--- a/src/features/transaction-wizard/data/common.ts
+++ b/src/features/transaction-wizard/data/common.ts
@@ -4,14 +4,17 @@ import { isAddress } from '@/utils/is-address'
import { bigIntSchema, numberSchema } from '@/features/forms/data/common'
import algosdk from 'algosdk'
import { asOnCompleteLabel } from '../mappers/as-description-list-items'
+import { isNfd } from '@/features/nfd/data/is-nfd'
export const requiredMessage = 'Required'
const invalidAddressMessage = 'Invalid address'
-export const optionalAddressFieldSchema = zfd.text(z.string().optional()).refine((value) => (value ? isAddress(value) : true), {
- message: invalidAddressMessage,
-})
-export const addressFieldSchema = zfd.text().refine((value) => (value ? isAddress(value) : true), {
+export const optionalAddressFieldSchema = zfd
+ .text(z.string().optional())
+ .refine((value) => (value ? isAddress(value) || isNfd(value) : true), {
+ message: invalidAddressMessage,
+ })
+export const addressFieldSchema = zfd.text().refine((value) => (value ? isAddress(value) || isNfd(value) : true), {
message: invalidAddressMessage,
})
@@ -101,3 +104,16 @@ export const commonSchema = {
}
export const commonFormData = zfd.formData(commonSchema)
+
+export const commonAddressSchema = {
+ ...senderFieldSchema,
+ ...receiverFieldSchema,
+ closeRemainderTo: addressFieldSchema,
+ clawbackTarget: addressFieldSchema,
+ manager: optionalAddressFieldSchema,
+ reserve: optionalAddressFieldSchema,
+ freeze: optionalAddressFieldSchema,
+ clawback: optionalAddressFieldSchema,
+}
+
+export const commonAddressFormData = zfd.formData(commonAddressSchema)
diff --git a/src/features/transaction-wizard/transaction-wizard-page.test.tsx b/src/features/transaction-wizard/transaction-wizard-page.test.tsx
index 358aae52..951fd9e9 100644
--- a/src/features/transaction-wizard/transaction-wizard-page.test.tsx
+++ b/src/features/transaction-wizard/transaction-wizard-page.test.tsx
@@ -8,7 +8,7 @@ import { sendButtonLabel, transactionTypeLabel, TransactionWizardPage } from './
import { selectOption } from '@/tests/utils/select-option'
import { setWalletAddressAndSigner } from '@/tests/utils/set-wallet-address-and-signer'
import { addTransactionLabel } from './components/transactions-builder'
-import { useLoadableNfdResult } from '../nfd/data/nfd'
+import { useLoadableNfd, useLoadableNfdResult } from '../nfd/data/nfd'
describe('transaction-wizard-page', () => {
const localnet = algorandFixture()
@@ -48,6 +48,7 @@ describe('transaction-wizard-page', () => {
describe('when a wallet is connected', () => {
beforeEach(async () => {
await setWalletAddressAndSigner(localnet)
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
})
diff --git a/src/features/transactions-graph/components/transactions-graph.test.tsx b/src/features/transactions-graph/components/transactions-graph.test.tsx
index 46458515..73a3251c 100644
--- a/src/features/transactions-graph/components/transactions-graph.test.tsx
+++ b/src/features/transactions-graph/components/transactions-graph.test.tsx
@@ -18,7 +18,7 @@ import { asTransactionsGraphData } from '@/features/transactions-graph/mappers'
import { Atom } from 'jotai/index'
import { AbiMethod } from '@/features/abi-methods/models'
import { setTimeout } from 'timers/promises'
-import { useLoadableNfdResult } from '@/features/nfd/data/nfd'
+import { useLoadableNfd } from '@/features/nfd/data/nfd'
// This file maintain the snapshot test for the TransactionViewVisual component
// To add new test case:
@@ -38,7 +38,7 @@ describe('payment-transaction-graph', () => {
transactionResultMother['mainnet-ILDCD5Z64CYSLEZIHBG5DVME2ITJI2DIVZAPDPEWPCYMTRA5SVGA']().build(),
])('when rendering transaction $id', (transactionResult: TransactionResult) => {
it('should match snapshot', () => {
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const model = asPaymentTransaction(transactionResult)
const graphData = asTransactionsGraphData([model])
return executeComponentTest(
@@ -67,7 +67,7 @@ describe('asset-transfer-transaction-graph', () => {
'when rendering transaction $transactionResult.id',
({ transactionResult, assetResult }: { transactionResult: TransactionResult; assetResult: AssetResult }) => {
it('should match snapshot', () => {
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const assetResolver = createAssetResolver([assetResult])
const transaction = asAssetTransferTransaction(transactionResult, assetResolver)
const graphData = asTransactionsGraphData([transaction])
@@ -122,7 +122,7 @@ describe('application-call-graph', () => {
'when rendering transaction $transactionResult.id',
({ transactionResult, assetResults }: { transactionResult: TransactionResult; assetResults: AssetResult[] }) => {
it('should match snapshot', () => {
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transactionResult.id }))
const model = asAppCallTransaction(transactionResult, createAssetResolver(assetResults), createAbiMethodResolver())
@@ -150,7 +150,7 @@ describe('key-reg-graph', () => {
])('when rendering transaction $transactionResult.id', ({ transactionResult }: { transactionResult: TransactionResult }) => {
it('should match snapshot', () => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transactionResult.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const model = asKeyRegTransaction(transactionResult)
const graphData = asTransactionsGraphData([model])
return executeComponentTest(
@@ -224,7 +224,7 @@ describe('group-graph', () => {
assetResults: AssetResult[]
}) => {
it('should match snapshot', () => {
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const assetResolver = createAssetResolver(assetResults)
const transactions = transactionResults.map((t) => asTransaction(t, assetResolver, createAbiMethodResolver()))
const groupResult = groupResultMother.groupWithTransactions(transactionResults).withId(groupId).build()
diff --git a/src/features/transactions/components/latest-transactions.tsx b/src/features/transactions/components/latest-transactions.tsx
index b18d9d80..b00c5344 100644
--- a/src/features/transactions/components/latest-transactions.tsx
+++ b/src/features/transactions/components/latest-transactions.tsx
@@ -7,7 +7,7 @@ import { DescriptionList } from '@/features/common/components/description-list'
import { ArrowRightLeft, Info } from 'lucide-react'
import { Badge } from '@/features/common/components/badge'
import { TransactionSummary } from '@/features/transactions/models'
-import { useLoadableNfdResult } from '@/features/nfd/data/nfd'
+import { useLoadableNfd } from '@/features/nfd/data/nfd'
import { RenderLoadable } from '@/features/common/components/render-loadable'
import { useMemo } from 'react'
import { Loadable } from 'jotai/vanilla/utils/loadable'
@@ -20,7 +20,7 @@ type Props = {
}
function useConditionalLoadableNfdResult(address: string | number | undefined) {
- const [loadableNfd] = useLoadableNfdResult(typeof address === 'string' ? address : '')
+ const [loadableNfd] = useLoadableNfd(typeof address === 'string' ? address : '')
return useMemo(() => ({ loadableNfd, isString: typeof address === 'string' }), [address, loadableNfd]) as {
loadableNfd: Loadable
isString: boolean
diff --git a/src/features/transactions/pages/transaction-page.test.tsx b/src/features/transactions/pages/transaction-page.test.tsx
index 86ee07d6..2dd3e19a 100644
--- a/src/features/transactions/pages/transaction-page.test.tsx
+++ b/src/features/transactions/pages/transaction-page.test.tsx
@@ -86,7 +86,7 @@ import { AppInterfaceEntity, dbConnectionAtom } from '@/features/common/data/ind
import { genesisHashAtom } from '@/features/blocks/data'
import { writeAppInterface } from '@/features/app-interfaces/data'
import { algod } from '@/features/common/data/algo-client'
-import { useLoadableNfdResult } from '@/features/nfd/data/nfd'
+import { useLoadableNfd } from '@/features/nfd/data/nfd'
vi.mock('@/features/common/data/algo-client', async () => {
const original = await vi.importActual('@/features/common/data/algo-client')
@@ -160,7 +160,7 @@ describe('transaction-page', () => {
it('should be rendered with the correct data', () => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const myStore = createStore()
myStore.set(transactionResultsAtom, new Map([[transaction.id, createReadOnlyAtomAndTimestamp(transaction)]]))
@@ -221,7 +221,7 @@ describe('transaction-page', () => {
beforeEach(() => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
})
it('should show the multisig information', () => {
@@ -263,7 +263,7 @@ describe('transaction-page', () => {
beforeEach(() => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
})
it('should show 2 tabs with the logicsig base64 as default', () => {
@@ -325,7 +325,7 @@ describe('transaction-page', () => {
beforeEach(() => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
})
it('should show 2 tabs with the note base64 as default', () => {
@@ -376,7 +376,7 @@ describe('transaction-page', () => {
beforeEach(() => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
})
it('should show 3 tabs with the note json as default', () => {
@@ -444,7 +444,7 @@ describe('transaction-page', () => {
beforeEach(() => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
})
it('should show 3 tabs with the note arc-2 as default', () => {
@@ -512,7 +512,7 @@ describe('transaction-page', () => {
it('should be rendered with the correct data', () => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const myStore = createStore()
myStore.set(transactionResultsAtom, new Map([[transaction.id, createReadOnlyAtomAndTimestamp(transaction)]]))
myStore.set(assetResultsAtom, new Map([[asset.index, createReadOnlyAtomAndTimestamp(asset)]]))
@@ -574,7 +574,7 @@ describe('transaction-page', () => {
it('should be rendered with the correct data', () => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const myStore = createStore()
myStore.set(transactionResultsAtom, new Map([[transaction.id, createReadOnlyAtomAndTimestamp(transaction)]]))
myStore.set(assetResultsAtom, new Map([[asset.index, createReadOnlyAtomAndTimestamp(asset)]]))
@@ -600,7 +600,7 @@ describe('transaction-page', () => {
it('should be rendered with the correct data', () => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const myStore = createStore()
myStore.set(transactionResultsAtom, new Map([[transaction.id, createReadOnlyAtomAndTimestamp(transaction)]]))
@@ -627,7 +627,7 @@ describe('transaction-page', () => {
it('should be rendered with the correct data', () => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const myStore = createStore()
myStore.set(transactionResultsAtom, new Map([[transaction.id, createReadOnlyAtomAndTimestamp(transaction)]]))
@@ -662,7 +662,7 @@ describe('transaction-page', () => {
it('should be rendered with the correct data', () => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const myStore = createStore()
myStore.set(transactionResultsAtom, new Map([[transaction.id, createReadOnlyAtomAndTimestamp(transaction)]]))
@@ -763,7 +763,7 @@ describe('transaction-page', () => {
it('should be rendered with the correct data', () => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id, '*': '2' }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const myStore = createStore()
myStore.set(transactionResultsAtom, new Map([[transaction.id, createReadOnlyAtomAndTimestamp(transaction)]]))
@@ -895,7 +895,7 @@ describe('transaction-page', () => {
it('should be rendered with the correct data', () => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id, '*': '2/1' }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const myStore = createStore()
myStore.set(transactionResultsAtom, new Map([[transaction.id, createReadOnlyAtomAndTimestamp(transaction)]]))
myStore.set(
@@ -933,7 +933,7 @@ describe('transaction-page', () => {
it('should be rendered without error', () => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const myStore = createStore()
myStore.set(transactionResultsAtom, new Map([[transaction.id, createReadOnlyAtomAndTimestamp(transaction)]]))
myStore.set(
@@ -965,7 +965,7 @@ describe('transaction-page', () => {
it('should be rendered with the correct data', () => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const myStore = createStore()
myStore.set(transactionResultsAtom, new Map([[transaction.id, createReadOnlyAtomAndTimestamp(transaction)]]))
@@ -1000,7 +1000,7 @@ describe('transaction-page', () => {
it('should be rendered with the correct data', () => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const myStore = createStore()
myStore.set(transactionResultsAtom, new Map([[transaction.id, createReadOnlyAtomAndTimestamp(transaction)]]))
@@ -1063,7 +1063,7 @@ describe('transaction-page', () => {
it('should be rendered with the correct data', () => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const myStore = createStore()
myStore.set(transactionResultsAtom, new Map([[transaction.id, createReadOnlyAtomAndTimestamp(transaction)]]))
@@ -1095,7 +1095,7 @@ describe('transaction-page', () => {
it('should be rendered with the correct data', () => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const myStore = createStore()
myStore.set(transactionResultsAtom, new Map([[transaction.id, createReadOnlyAtomAndTimestamp(transaction)]]))
@@ -1160,7 +1160,7 @@ describe('transaction-page', () => {
it('should be rendered correctly', () => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const myStore = createStore()
myStore.set(transactionResultsAtom, new Map([[transaction.id, createReadOnlyAtomAndTimestamp(transaction)]]))
@@ -1191,7 +1191,7 @@ describe('transaction-page', () => {
it('should be rendered with the correct data', () => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const myStore = createStore()
myStore.set(transactionResultsAtom, new Map([[transaction.id, createReadOnlyAtomAndTimestamp(transaction)]]))
@@ -1229,7 +1229,7 @@ describe('transaction-page', () => {
it('should be rendered with the correct data', () => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const myStore = createStore()
myStore.set(transactionResultsAtom, new Map([[transaction.id, createReadOnlyAtomAndTimestamp(transaction)]]))
@@ -1263,7 +1263,7 @@ describe('when rendering a rekey transaction', () => {
it('should be rendered with the correct data', () => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const myStore = createStore()
myStore.set(transactionResultsAtom, new Map([[transaction.id, createReadOnlyAtomAndTimestamp(transaction)]]))
@@ -1293,7 +1293,7 @@ describe('when rendering an app call transaction with ARC-32 app spec loaded', (
it('should be rendered with the correct data', async () => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const myStore = createStore()
myStore.set(genesisHashAtom, 'some-hash')
myStore.set(transactionResultsAtom, new Map([[transaction.id, createReadOnlyAtomAndTimestamp(transaction)]]))
@@ -1338,7 +1338,7 @@ describe('when rendering an app call transaction with ARC-4 app spec loaded', ()
it('should be rendered with the correct data', async () => {
vi.mocked(useParams).mockImplementation(() => ({ transactionId: transaction.id }))
- vi.mocked(useLoadableNfdResult).mockReturnValue([{ state: 'loading' }])
+ vi.mocked(useLoadableNfd).mockReturnValue([{ state: 'loading' }])
const myStore = createStore()
myStore.set(genesisHashAtom, 'some-hash')
diff --git a/src/features/wallet/components/connect-wallet-button.tsx b/src/features/wallet/components/connect-wallet-button.tsx
index 41a25b46..6ff1589b 100644
--- a/src/features/wallet/components/connect-wallet-button.tsx
+++ b/src/features/wallet/components/connect-wallet-button.tsx
@@ -20,7 +20,7 @@ import { walletDialogOpenAtom } from '../data/wallet-dialog'
import { clearAvailableWallets } from '../utils/clear-available-wallets'
import { useDisconnectWallet } from '../hooks/use-disconnect-wallet'
import { CopyButton } from '@/features/common/components/copy-button'
-import { useLoadableNfdResult } from '@/features/nfd/data/nfd'
+import { useLoadableNfd } from '@/features/nfd/data/nfd'
import { RenderLoadable } from '@/features/common/components/render-loadable'
export const connectWalletLabel = 'Connect Wallet'
@@ -70,7 +70,7 @@ function ConnectedWallet({ activeAddress, connectedActiveAccounts, providers }:
},
[activeProvider]
)
- const [loadableNfd] = useLoadableNfdResult(activeAddress)
+ const [loadableNfd] = useLoadableNfd(activeAddress)
return (
diff --git a/src/tests/setup/mocks/index.ts b/src/tests/setup/mocks/index.ts
index 902f7b2d..d87cd928 100644
--- a/src/tests/setup/mocks/index.ts
+++ b/src/tests/setup/mocks/index.ts
@@ -88,6 +88,7 @@ vi.mock('@/features/nfd/data/nfd', async () => {
const original = await vi.importActual('@/features/nfd/data/nfd')
return {
...original,
+ useLoadableNfd: vi.fn(),
useLoadableNfdResult: vi.fn(),
}
})