help with building an ethers plugin in flutter #2050
Replies: 2 comments 8 replies
-
Can you add console.log statements in the source code for the json-wallets stuff, and see where the difference occurs between the two? There shouldn’t be anything platform specific in those packages. Can you not use the existing shims directly? Or are there additional things missing? |
Beta Was this translation helpful? Give feedback.
-
@peteratfame are you attempting to build a in-page provider ? meaning that you will inject this javascript into a flutter webview and it will provide window.ethereum ? Or are you hooking into ethers (from Dart) to access the functions to create a wallet ? if this is what u want, you could probably also look into using https://inappwebview.dev/docs/headless-in-app-webview/basic-usage/ . Probably will give you the most accurate usage. there is also a stackoverflow post that talks about using LiquidCore(android) and JavascriptCore (ios) via Platform Channels - https://stackoverflow.com/questions/52330102/use-js-library-in-flutter Or the approach here using js.dart as interop - https://github.com/y-pakorn/flutter_web3/blob/27174a4e3c67cdfe31d721ce66fb57e3cd573e70/lib/src/ethers/ethers.dart this is very interesting! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi folks, we've begun the journey of building an ethers.js plugin for use in a flutter app, and have hit a few roadblocks, so thought we'd head over here to chart the journey!
For various reasons, we've opted for flutter_js as our library of choice (for now!) - https://pub.dev/packages/flutter_js
We're happy to chat about why we think this is the best option over others... but.....
Despite everything going swimmingly when we try, for example, to formatUtils or somesuch, the largest roadblock is the silent dying of ether.js, perhaps because of the lack of window.crypto.randomBytes (and maybe other issues related)
So here's where we are at; We have reviewed the issues here; #1070 and think that we understand a bit more about the shim required.
We also wish to use the learning from https://www.scottbrady91.com/Dart/Generating-a-Crypto-Random-String-in-Dart to build a properly secure plugin, which we intend to release under an open source licence, if in fact we're able to make it work at all!
We'll update this discussion with our working as we go, one thing that makes us think that the issue may be slightly deeper than just the randomBytes issue is the fact that a decrypt with a valid keystore and password is also just failing silently atm.
We are mildly persistent though, so will keep trying - any ideas or input would be really welcome, and we're happy to share code snippets as we go!
Beta Was this translation helpful? Give feedback.
All reactions