Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can a transaction be performed without metamask? #42

Closed
dvalevv opened this issue Feb 22, 2022 · 3 comments
Closed

How can a transaction be performed without metamask? #42

dvalevv opened this issue Feb 22, 2022 · 3 comments

Comments

@dvalevv
Copy link

dvalevv commented Feb 22, 2022

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

Simply my question is:

  • How to execute transaction from Contract(address, abi), which is not signed by Metamask provider, but programmatically using a wallet's private key, where the gas parameters can also be set programmatically. The aim is to completely remove the visual interaction with the browser's extension for faster execution.
  • or how can you execute transaction from Contract(address, abi, provider) specifying your own gas parameters?
@dvalevv
Copy link
Author

dvalevv commented Feb 23, 2022

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

@dvalevv dvalevv closed this as completed Feb 23, 2022
@princepspolycap
Copy link

@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 #43

@dvalevv
Copy link
Author

dvalevv commented Feb 25, 2022

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/[email protected]/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:

  • either create Contract(address, abi, provider) and then await contract.call<BigInt>("balanceOf", ["wallet_address"])
  • or create ContractERC20(address, provider) and await contract.balanceOf("wallet_address")

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants