From 05707ddea8b0bb35e1e54dbd60cdf99a0ec5dae2 Mon Sep 17 00:00:00 2001 From: Alfreedom <00tango.bromine@icloud.com> Date: Mon, 11 Dec 2023 19:12:26 +0100 Subject: [PATCH] minor changes --- .github/ISSUE_TEMPLATE/bug_report.md | 3 + .../lib/dependencies/chains/evm_service.dart | 66 +++++++++++++++++++ lib/apis/utils/constants.dart | 4 +- lib/walletconnect_flutter_v2.dart | 2 + 4 files changed, 74 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index dd84ea78..d6e688ab 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -20,6 +20,9 @@ Steps to reproduce the behavior: **Expected behavior** A clear and concise description of what you expected to happen. +**Reproducible code** +If applicable, add a minimum reproducible code snippet. + **Screenshots** If applicable, add screenshots to help explain your problem. diff --git a/example/wallet/lib/dependencies/chains/evm_service.dart b/example/wallet/lib/dependencies/chains/evm_service.dart index d42c4ad2..6db29e2c 100644 --- a/example/wallet/lib/dependencies/chains/evm_service.dart +++ b/example/wallet/lib/dependencies/chains/evm_service.dart @@ -289,4 +289,70 @@ class EVMService { version: TypedDataVersion.V4, ); } + + // Future interactWithContract(String topic, dynamic parameters) async { + // final contractAddr = + // EthereumAddress.fromHex('0xf451659CF5688e31a31fC3316efbcC2339A490Fb'); + // final receiver = + // EthereumAddress.fromHex('0x6c87E1a114C3379BEc929f6356c5263d62542C13'); + + // final File abiFile = File(join(dirname(Platform.script.path), 'abi.json')); + // final List keys = GetIt.I().getKeysForChain( + // chainSupported.chain(), + // ); + + // final credentials = EthPrivateKey.fromHex('0x${keys[0].privateKey}'); + // final ownAddress = credentials.address; + + // // read the contract abi and tell web3dart where it's deployed (contractAddr) + // final abiCode = await abiFile.readAsString(); + // final contract = DeployedContract( + // ContractAbi.fromJson(abiCode, 'MetaCoin'), + // contractAddr, + // ); + + // // extracting some functions and events that we'll need later + // final transferEvent = contract.event('Transfer'); + // final balanceFunction = contract.function('getBalance'); + // final sendFunction = contract.function('sendCoin'); + + // // listen for the Transfer event when it's emitted by the contract above + // final subscription = ethClient + // .events(FilterOptions.events(contract: contract, event: transferEvent)) + // .take(1) + // .listen((event) { + // final decoded = transferEvent.decodeResults( + // event.topics ?? [], + // event.data ?? '', + // ); + + // final from = decoded[0] as EthereumAddress; + // final to = decoded[1] as EthereumAddress; + // final value = decoded[2] as BigInt; + + // print('$from sent $value MetaCoins to $to'); + // }); + + // // check our balance in MetaCoins by calling the appropriate function + // final balance = await ethClient.call( + // contract: contract, + // function: balanceFunction, + // params: [ownAddress], + // ); + // print('We have ${balance.first} MetaCoins'); + + // // send all our MetaCoins to the other address by calling the sendCoin + // // function + // await ethClient.sendTransaction( + // credentials, + // Transaction.callContract( + // contract: contract, + // function: sendFunction, + // parameters: [receiver, balance.first], + // ), + // ); + + // await subscription.asFuture(); + // await subscription.cancel(); + // } } diff --git a/lib/apis/utils/constants.dart b/lib/apis/utils/constants.dart index 4ddb5b53..3259edb8 100644 --- a/lib/apis/utils/constants.dart +++ b/lib/apis/utils/constants.dart @@ -1,5 +1,7 @@ +import 'package:walletconnect_flutter_v2/src/version.dart'; + class WalletConnectConstants { - static const SDK_VERSION = '2.1.11'; + static const SDK_VERSION = packageVersion; static const CORE_PROTOCOL = 'wc'; static const CORE_VERSION = 2; diff --git a/lib/walletconnect_flutter_v2.dart b/lib/walletconnect_flutter_v2.dart index ce587f65..c45a7d4d 100644 --- a/lib/walletconnect_flutter_v2.dart +++ b/lib/walletconnect_flutter_v2.dart @@ -48,3 +48,5 @@ export 'apis/web3wallet/web3wallet.dart'; // Web3App export 'apis/web3app/i_web3app.dart'; export 'apis/web3app/web3app.dart'; + +export 'src/version.dart';