Usage
After you have installed and configured AppKit, you can start using it to interact with the wallet provider and blockchain.
AppKit comes with the Nethereum and Wagmi integration out of the box.
To interact with EVM chains use AppKit.Evm
(see Actions for more details). Internally, AppKit will use Wagmi on WebGL or Nethereum on other platforms.
Nethereum is already preconfigured with RPC URL and interceptor that will route the requests between the wallet provider and RPC node.
Sending Ether
To send ether, you can use the SendTransactionAsync
method of the Web3.Eth
class.
This type of transaction uses the default amount of Gas 21000. Gas price is determined by the wallet provider.
Reading Blockchain State
Get Ether Balance
Smart Contract Interaction
Use ReadContractAsync
and WriteContractAsync
methods of AppKit.Evm
to interact with smart contracts.
To read or write a smart contract function, you need to provide the contract address, ABI, method name, and arguments.
Get ERC20 Token Balance
To get the balance of an ERC20 token, you need to know the contract address, ERC20 standard contract ABI, and the owner address. This operation doesn’t involve state change on the blockchain, so it’s a read-only action that doesn’t require a transaction.
Send ERC20 Token
To send an ERC20 token, you need to know the contract address, ERC20 standard contract ABI, recipient address, and the amount of tokens to send. This operation requires a transaction and gas fees because it changes the state of the blockchain. User will need to confirm the transaction in the wallet.
Nethereum Integration
AppKit offers deep integration with Nethereum on native platforms, with limited support on WebGL.
If you need to use Nethereum directly, you can access a preconfigured Web3
instance from AppKit:
This Web3
instance is preconfigured with Reown’s Blockchain API for the active chain and includes a request interceptor that routes requests between RPC node and the connected wallet (if needs signing).
Avoid caching this Web3
instance, as it may be updated when the active chain is switched.
Was this page helpful?