web3modal icon indicating copy to clipboard operation
web3modal copied to clipboard

[docs] Javascript Wagmi Smart Contract Interaction

Open vanyasav opened this issue 1 year ago • 3 comments

Summary

As stated in the docs:

Wagmi actions can help us interact with wallets and smart contracts:

import { readContract } from '@wagmi/core'
import { USDTAbi } from '../abi/USDTAbi'

const USDTAddress = '0x...'

const data = readContract({
  address: USDTAddress,
  abi: USDTAbi,
  functionName: 'symbol'
})

Read more about Wagmi actions for smart contract interaction here.

But if you follow the link:

import { readContract } from '@wagmi/core'
import { abi } from './abi'
import { config } from './config'

const result = await readContract(config, {
  abi,
  address: '0x6b175474e89094c44da98b954eedeac495271d0f',
  functionName: 'totalSupply',
})

Is config missing from the docs?

Link to the related docs page

https://docs.reown.com/appkit/javascript/core/installation?platform=wagmi

vanyasav avatar Oct 14 '24 22:10 vanyasav

image

modal of class AppKit doesnt have disconnect function

vanyasav avatar Oct 15 '24 07:10 vanyasav

modal of class AppKit doesnt have disconnect function We are solving this issue soon. https://linear.app/reown/issue/APKT-1045/[bug]-disconnect-is-not-exposed

rtomas avatar Oct 15 '24 15:10 rtomas

@rtomas what about config?

vanyasav avatar Oct 16 '24 07:10 vanyasav

@vanyasav Where I can find that config import ?

rtomas avatar Oct 23 '24 23:10 rtomas

@vanyasav Where I can find that config import ?

modal.adapter.wagmiConfig

bolom avatar Oct 24 '24 20:10 bolom

You can directly get the wagmi config from the adapter like this.

const wagmiAdapter = new WagmiAdapter({
  ssr: true,
  networks: [], // Add networks here
  projectId: "YOUR_PROJECT_ID"
})

wagmiAdapter.wagmiConfig // Here

I'll close this issue for now, but please let me know if you're still stuck.

0xmkh avatar Jan 23 '25 10:01 0xmkh