y-pakorn / flutter_web3

Web3 Ethereum, Etherjs and Wallet Connect wrapper for Flutter Web.
Other
134 stars 47 forks source link

How can a transaction be performed without metamask? #42

Closed dvalevv closed 2 years ago

dvalevv commented 2 years ago

Hello, I am trying to execute transaction using the private wallet key instead of Metamask.

Simply my question is:

dvalevv commented 2 years ago

I am closing the issue as after long search in the documentation I found that it can be done using TransactionOverride.

princepspolycap commented 2 years ago

@dvalevv Do you know how to get the balance of an account on something like the Gnosis Chain ? I keep getting the error that my provider is undefined or null, I created an issue here explaining more information https://github.com/y-pakorn/flutter_web3/issues/43

dvalevv commented 2 years ago

Usually it must work like this:

1. First: don't forget to add these into your flutter_app/web/index.html inside the head tag

<script src="https://cdn.ethers.io/lib/ethers-5.4.umd.min.js" type="application/javascript"></script>
<script src="https://cdn.jsdelivr.net/npm/@walletconnect/web3-provider@1.6.5/dist/umd/index.min.js" type="application/javascript"></script>

2. Then:

For native token:

final rpcProvider = JsonRpcProvider('https://rpc.gnosischain.com/');
var balance = await rpcProvider.getBalance("your_wallet_address");

For ERC20 token you can:


If you give me more info I can try it and send you the working code.