Use Cosmos Kit with Keplr Extension support.

This commit is contained in:
Noah Saso
2023-10-11 16:48:20 -07:00
parent 8b1c9e669d
commit dfe0a27f77
85 changed files with 1776 additions and 1004 deletions
+14 -4
View File
@@ -1,5 +1,5 @@
import { useWallet } from 'contexts/wallet'
import { useCallback, useEffect, useState } from 'react'
import { useWallet } from 'utils/wallet'
import type { BaseFactoryContract, BaseFactoryInstance, BaseFactoryMessages } from './contract'
import { baseFactory as initContract } from './contract'
@@ -22,9 +22,19 @@ export function useBaseFactoryContract(): UseBaseFactoryContractProps {
}, [])
useEffect(() => {
const BaseFactoryBaseContract = initContract(wallet.getClient(), wallet.address)
setBaseFactory(BaseFactoryBaseContract)
}, [wallet])
if (!wallet.isWalletConnected) {
return
}
const load = async () => {
const client = await wallet.getSigningCosmWasmClient()
const BaseFactoryBaseContract = initContract(client, wallet.address || '')
setBaseFactory(BaseFactoryBaseContract)
}
load().catch(console.error)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [wallet.isWalletConnected, wallet.address])
const updateContractAddress = (contractAddress: string) => {
setAddress(contractAddress)