Closed afdaldev closed 1 month ago
this issue coming from WalletConnectFlutterV2 ,, just return result.first
Hello, @afdaldev ! Could you post a reproducible pice of code so I can check?
final deployedContract = DeployedContract(
ContractAbi.fromJson(
abiCode,
'ISOMAStaking',
),
EthereumAddress.fromHex(
'0x89E0633eA38CD3539A69A9f88F410A3133f61cF1',
),
);
final result = await walletConnect.w3mService.requestReadContract(
deployedContract: deployedContract,
functionName: 'pools',
rpcUrl: 'https://data-seed-prebsc-1-s1.binance.org:8545',
parameters: [
BigInt.from(0),
],
);
log.d('$result');
here @quetool ..
and now i using web3dart to ReadContract. because, the return data is List<dynamic>
may you can change return of requestReadContract
and requestWriteContract
to List<dynamic>
like from web3dart
@afdaldev what should be the expected result? Could you provide a working example? using web3dart maybe?
@quetool here : Web3Example
i think you just need to change return of requestReadContract
to List<dynamic>
and return value from Web3dart
Because, i see Here you return result.first
Hello @afdaldev I'll check this ASAP or you can also open a PR for this and I'll review it
Hello @afdaldev! I just pushed a fix, could you check by using
dependencies:
walletconnect_flutter_v2: ^2.2.2-beta02
If you instead need this fix on web3modal_flutter
then for now you can just add this new dependency overrides options as follows:
dependencies:
web3modal_flutter: ^3.1.2
dependency_overrides:
walletconnect_flutter_v2: ^2.2.2-beta02
i have try in : https://github.com/afdaldev/Web3Dart_Example/tree/testing_read_contract_with_web3modal
thanks @quetool
it's working like my expectation.
i will wait for next release version in web3modal_flutter
Hello @afdaldev! Are you ok with the current solution? if you don't get the proper response type you can try w3mService.web3App!.requestWriteContract()
sure, this is good solution for me. because, i can get all information from my smart contract
for w3mService.web3App!.requestWriteContract()
. i don't get any problem.. i still use this function to write
Sounds good! I'll close this issue for now and I'll let you know then the fix is on web3modal as well. Thanks!
Describe the bug I try to read smart contract with requestReadContract,, for single value response is good.. but, for multiple value i just get response 1 value
Expected behavior my expectation return list of value => [maxCap,lockedPeriod,apy ,rewardPercent,totalStaked] My ABI: "name": "pools", "outputs": [ {"internalType": "uint256", "name": "maxCap", "type": "uint256"}, {"internalType": "uint256", "name": "lockedPeriod", "type": "uint256"}, {"internalType": "uint256", "name": "apy", "type": "uint256"}, {"internalType": "uint256", "name": "rewardPercent", "type": "uint256"}, {"internalType": "uint256", "name": "totalStaked", "type": "uint256"} ],
Actual behavior I just get single response => result: 10000000000000000000000000 (value of maxCap)