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 theSendTransactionAsync
method of the Web3.Eth
class.
Reading Blockchain State
Get Ether Balance
Smart Contract Interaction
UseReadContractAsync
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.Usage with Solidity Structs
To use Solidity structs when interacting with smart contracts on native platforms, you need to define them as C# classes and mark them with the function encoding attributes from Nethereum. This is not required on WebGL platforms.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 preconfiguredWeb3
instance from AppKit:
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.