Closed quetool closed 8 months ago
Based on @bobwith2bees implementation we added support for a better interaction with smart contracts.
Resolves https://github.com/WalletConnect/WalletConnectFlutterV2/issues/255
transfer
final deployedContract = DeployedContract( ContractAbi.fromJson( jsonEncode({contract-abi}), 'SmartContract_Name', ), EthereumAddress.fromHex('smart_contract_address'), ); return web3App.requestWriteContract( topic: topic, chainId: 'eip155:11155111', rpcUrl: 'https://ethereum-sepolia.publicnode.com', deployedContract: deployedContract, functionName: 'transfer', transaction: Transaction( from: EthereumAddress.fromHex(address), to: EthereumAddress.fromHex('0x59e2f66C0E96803206B6486cDb39029abAE834c0'), value: EtherAmount.fromInt(EtherUnit.finney, 10), // == 0.010 ), );
balanceOf
final deployedContract = DeployedContract( ContractAbi.fromJson( jsonEncode({contract-abi}), 'SmartContract_Name', ), EthereumAddress.fromHex('smart_contract_address'), ); return web3App.requestReadContract( deployedContract: deployedContract, functionName: 'balanceOf', rpcUrl: 'https://ethereum-sepolia.publicnode.com', parameters: [ EthereumAddress.fromHex('0xaddress'), ], );
Description
Based on @bobwith2bees implementation we added support for a better interaction with smart contracts.
Resolves https://github.com/WalletConnect/WalletConnectFlutterV2/issues/255
How Has This Been Tested?
Due Dilligence
and WalletConnect's Flutter Wallet
(both included in this repository)
and Zerion wallet
Example
transfer
function from a Smart Contract to send 0.010 value of it's token.balanceOf
function of a Smart Contract to check wallet balance of it's token.