Closed dorono closed 4 years ago
Hello Doron,
I'm guessing it's related to some babel configuration of your project and/or the factom lib. I quickly checked MyFactomWallet code which is also a React application and uses the factom lib and found that: https://github.com/MyFactomWallet/MyFactomWallet/blob/master/src/addWallet/ImportEcForm.js#L9
On top of that if you only need the utils functions, you can import the 'factom-struct' lib instead that is lighter (contains all the utils but not all the classes to connect to a Factom node). So putting this together I'd recommend trying importing this way:
import {isValidPrivateAddress, isValidPrivateEcAddress, isValidPrivateFctAddress} from 'factom/dist/factom-struct';
I hope that solves your problem, otherwise I'd recommend diving a bit more into MyFactomWallet codebase and configuration.
@PaulBernier Importing as you have above (using 'factom/dist/factom-struct'
) worked(!), at least for my needs in only bringing in those 3 methods.
Thanks for the help as well as your great work on this library!
Awesome, thank you!
Hello Paul,
I am trying to use just the utility functions in your library for the front-end of React application, and the utilities are working great, with me importing them as follows:
import {isValidPrivateAddress, isValidPrivateEcAddress, isValidPrivateFctAddress} from 'factom';
However, when I do the npm build, I get an error (something about the
const
keyword, I can recreate it if you like).I guess my question is - do you have any recommendation for how to import just the utils (or the whole library if it's easier) into a front end project?
Thanks!
Doron