diff --git a/dapps/ModalEthers/src/App.tsx b/dapps/ModalEthers/src/App.tsx index 5d96c110..c988f73d 100644 --- a/dapps/ModalEthers/src/App.tsx +++ b/dapps/ModalEthers/src/App.tsx @@ -136,16 +136,21 @@ function App(): JSX.Element { }; const onWriteContract = async () => { + if (!client) { + return; + } + + const [address] = await client.listAccounts(); + const signer = client.getSigner(address); + const contract = new ethers.Contract( ContractUtils.contractAddress, ContractUtils.goerliABI, - client, + signer, ); - // Write contract - console.log(contract); const receipt = await contract.mint(); - const hash = receipt.transactionHash; + const hash = receipt.hash; console.log('receipt', receipt); return { method: 'write contract', diff --git a/dapps/ModalEthers/src/utils/ContractUtils.ts b/dapps/ModalEthers/src/utils/ContractUtils.ts index 6eec4b87..09bbd0e4 100644 --- a/dapps/ModalEthers/src/utils/ContractUtils.ts +++ b/dapps/ModalEthers/src/utils/ContractUtils.ts @@ -93,13 +93,6 @@ const goerliABI = [ stateMutability: 'nonpayable', type: 'function', }, - { - inputs: [{internalType: 'uint256', name: 'tokenId', type: 'uint256'}], - name: 'mint', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, { inputs: [], name: 'name',