diff --git a/dapps/react-dapp-v2/src/contexts/ClientContext.tsx b/dapps/react-dapp-v2/src/contexts/ClientContext.tsx index 4de8a64..81ee2d3 100644 --- a/dapps/react-dapp-v2/src/contexts/ClientContext.tsx +++ b/dapps/react-dapp-v2/src/contexts/ClientContext.tsx @@ -18,7 +18,7 @@ import { DEFAULT_PROJECT_ID, DEFAULT_RELAY_URL, } from "../constants"; -import { AccountBalances, apiGetAccountAssets } from "../helpers"; +import { AccountBalances, apiGetAccountBalance } from "../helpers"; import { ERROR, getAppMetadata } from "@walletconnect/utils"; /** @@ -73,8 +73,8 @@ export function ClientContextProvider({ children }: { children: ReactNode | Reac _accounts.map(async account => { const [namespace, reference, address] = account.split(":"); const chainId = `${namespace}:${reference}`; - const assets = await apiGetAccountAssets(address, chainId); - return { account, assets }; + const assets = await apiGetAccountBalance(address, chainId); + return { account, assets: [assets] }; }), ); diff --git a/dapps/react-dapp-v2/src/helpers/api.ts b/dapps/react-dapp-v2/src/helpers/api.ts index eb9b495..d6ca62e 100644 --- a/dapps/react-dapp-v2/src/helpers/api.ts +++ b/dapps/react-dapp-v2/src/helpers/api.ts @@ -19,6 +19,15 @@ export async function apiGetAccountAssets(address: string, chainId: string): Pro return result; } +export async function apiGetAccountBalance(address: string, chainId: string): Promise { + const ethChainId = chainId.split(":")[1]; + const response = await ethereumApi.get( + `/account-balance?address=${address}&chainId=${ethChainId}`, + ); + const { result } = response.data; + return result; +} + export async function apiGetAccountTransactions( address: string, chainId: string,