{address &&
{ensName ? `${ensName} (${address})` : address}
}
-
Your balance is {balance !== null ? balance.toString() : 'Loading...'}
+
Your balance is {balance?.toFloat() ?? 'Loading...'}
)
diff --git a/sdk-consumer/src/config/wagmiConfig.ts b/sdk-consumer/src/config/wagmiConfig.ts
index 5209c4d57f..4e80e0321e 100644
--- a/sdk-consumer/src/config/wagmiConfig.ts
+++ b/sdk-consumer/src/config/wagmiConfig.ts
@@ -1,12 +1,11 @@
import { createConfig, http } from 'wagmi'
-import { base, mainnet } from 'wagmi/chains'
+import { sepolia } from 'wagmi/chains'
import { injected } from 'wagmi/connectors'
export const wagmiConfig = createConfig({
- chains: [mainnet, base],
+ chains: [sepolia],
connectors: [injected()],
transports: {
- [mainnet.id]: http(),
- [base.id]: http(),
+ [sepolia.id]: http(),
},
})
diff --git a/sdk-consumer/src/hooks/useAccount.ts b/sdk-consumer/src/hooks/useAccount.ts
new file mode 100644
index 0000000000..c9a88de891
--- /dev/null
+++ b/sdk-consumer/src/hooks/useAccount.ts
@@ -0,0 +1,13 @@
+import { useMemo } from 'react'
+import { useAccount } from 'wagmi'
+import { centrifuge } from '../centrifuge'
+import { useCentrifugeQuery } from './useCentrifugeQuery'
+
+const tUSD = '0x8503b4452Bf6238cC76CdbEE223b46d7196b1c93'
+
+export function useAccountBalance() {
+ const { address } = useAccount()
+ const balance$ = useMemo(() => (address ? centrifuge.balance(tUSD, address) : undefined), [address])
+ console.log('balance$', balance$)
+ return useCentrifugeQuery(balance$)
+}
diff --git a/sdk-consumer/src/hooks/useAccountbalance.ts b/sdk-consumer/src/hooks/useAccountbalance.ts
deleted file mode 100644
index 0bc7789fb1..0000000000
--- a/sdk-consumer/src/hooks/useAccountbalance.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-import Centrifuge from '@centrifuge/centrifuge-sdk'
-import { useEffect, useState } from 'react'
-import { useAccount } from 'wagmi'
-
-type Balance = bigint | null
-
-export function useAccountBalance(): Balance {
- const { address, chain } = useAccount()
- const [balance, setBalance] = useState