diff --git a/projects/TokenizeRWATemplate-frontend/src/components/AppCalls.tsx b/projects/TokenizeRWATemplate-frontend/src/components/AppCalls.tsx index 8dc1589..987c30d 100644 --- a/projects/TokenizeRWATemplate-frontend/src/components/AppCalls.tsx +++ b/projects/TokenizeRWATemplate-frontend/src/components/AppCalls.tsx @@ -3,7 +3,7 @@ import { OnSchemaBreak, OnUpdate } from '@algorandfoundation/algokit-utils/types import { useWallet } from '@txnlab/use-wallet-react' import { useSnackbar } from 'notistack' import { useState } from 'react' -import { HelloWorldFactory } from '../contracts/HelloWorldClient' +import { HelloWorldFactory } from '../contracts/HelloWorld' import { getAlgodConfigFromViteEnvironment, getIndexerConfigFromViteEnvironment } from '../utils/network/getAlgoClientConfigs' interface AppCallsInterface { @@ -24,8 +24,8 @@ const AppCalls = ({ openModal, setModalState }: AppCallsInterface) => { indexerConfig, }) if (transactionSigner) { - // @ts-expect-error - optional API depending on algokit-utils version - algorand.setDefaultSigner?.(transactionSigner) + // setDefaultSigner exists in algokit-utils v9 + algorand.setDefaultSigner(transactionSigner) } const sendAppCall = async () => { diff --git a/projects/TokenizeRWATemplate-frontend/src/components/TokenizeAsset.tsx b/projects/TokenizeRWATemplate-frontend/src/components/TokenizeAsset.tsx index 0a39822..8e9815b 100644 --- a/projects/TokenizeRWATemplate-frontend/src/components/TokenizeAsset.tsx +++ b/projects/TokenizeRWATemplate-frontend/src/components/TokenizeAsset.tsx @@ -1,4 +1,4 @@ -import { AlgorandClient } from '@algorandfoundation/algokit-utils' +import { AlgorandClient, microAlgos } from '@algorandfoundation/algokit-utils' import { useWallet } from '@txnlab/use-wallet-react' import { sha512_256 } from 'js-sha512' import { useSnackbar } from 'notistack' @@ -12,7 +12,7 @@ import { getAlgodConfigFromViteEnvironment } from '../utils/network/getAlgoClien * Captures ASA configuration including compliance fields */ type CreatedAsset = { - assetId: number + assetId: bigint assetName: string unitName: string total: string @@ -267,9 +267,9 @@ export default function TokenizeAsset() { // Method 2: Fallback to account information API // Used when method 1 has non-404 errors or for verification const info = await algorand.client.algod.accountInformation(activeAddress).do() - const assets: Array<{ ['asset-id']: number; amount?: number }> = info?.assets ?? [] + const assets: Array<{ assetId: bigint; amount?: number | bigint }> = info?.assets ?? [] - const usdcHolding = assets.find((a) => a['asset-id'] === TESTNET_USDC_ASSET_ID) + const usdcHolding = assets.find((a) => a.assetId === BigInt(TESTNET_USDC_ASSET_ID)) if (usdcHolding) { const balance = BigInt(usdcHolding.amount ?? 0) @@ -406,7 +406,7 @@ export default function TokenizeAsset() { const result = await algorand.send.assetTransfer({ sender: activeAddress, signer, - assetId: TESTNET_USDC_ASSET_ID, + assetId: BigInt(TESTNET_USDC_ASSET_ID), receiver: activeAddress, amount: 0n, }) @@ -570,7 +570,7 @@ export default function TokenizeAsset() { const assetId = createResult.assetId const newEntry: CreatedAsset = { - assetId: Number(assetId), + assetId: BigInt(assetId), assetName: String(assetName), unitName: String(unitName), total: String(total), @@ -667,13 +667,11 @@ export default function TokenizeAsset() { if (transferMode === 'algo') { enqueueSnackbar('Sending ALGO...', { variant: 'info' }) - const microAlgos = decimalToBaseUnits(transferAmount, ALGO_DECIMALS) - const result = await algorand.send.payment({ sender: activeAddress, signer, receiver: receiverAddress, - amount: algorand.microAlgos(microAlgos), + amount: microAlgos(decimalToBaseUnits(transferAmount, ALGO_DECIMALS)), }) const txId = (result as { txId?: string }).txId @@ -715,7 +713,7 @@ export default function TokenizeAsset() { const result = await algorand.send.assetTransfer({ sender: activeAddress, signer, - assetId: TESTNET_USDC_ASSET_ID, + assetId: BigInt(TESTNET_USDC_ASSET_ID), receiver: receiverAddress, amount: usdcAmount, }) @@ -748,7 +746,7 @@ export default function TokenizeAsset() { const result = await algorand.send.assetTransfer({ sender: activeAddress, signer, - assetId: Number(transferAssetId), + assetId: BigInt(transferAssetId), receiver: receiverAddress, amount: BigInt(transferAmount), }) @@ -893,7 +891,7 @@ export default function TokenizeAsset() { // ✅ Persist minted NFT into SAME history list (NFTs are ASAs) const nftEntry: CreatedAsset = { - assetId: Number(assetId), + assetId: BigInt(assetId), assetName: String(nftName), unitName: String(nftUnit), total: String(nftSupply), @@ -1472,7 +1470,7 @@ export default function TokenizeAsset() { >