- Create
.env
file on the root directory
REACT_APP_VERSION=$npm_package_version
- Access from environment variables on React app
const version = process.env.REACT_APP_VERSION
[ | |
{ | |
"name": "Afar", | |
"type": "living", | |
"scope": "individual", | |
"iso-639-3": "aar", | |
"iso-639-2B": "aar", | |
"iso-639-2T": "aar", | |
"iso-639-1": "aa" | |
}, |
did:muport:QmQ3fkGTPi7wWSFqMBr9fTf4b4BRtLQXDHoiABGNjmf4MV |
create-react-app-ts() { | |
if [ -n "$1" ] | |
then | |
create-react-app "$1" --scripts-version=react-scripts-ts | |
else | |
echo "Error: create-react-app-ts requires at least one argument (project_name)" | |
fi | |
cd "$1" | |
} |
This is a simple guide to get you started with using the Ethereum Javascript API
(web3.js) with the Create React Native App
project. This is not an in-depth guide.
If you are lazy and just want to get started, I have this project ready for you. It should work out-of-the-box.
This tutorial will show you how to polyfill crypto
and other NodeJS modules globally in a React-Native environment.
Please note that these implementations are purely javascript and don't use native modules to generate random numbers
Run the following command
function concatBuffer(b1, b2) { | |
let r = new Uint8Array(b1.byteLength + b2.byteLength); | |
r.set(new Uint8Array(b1), 0); | |
r.set(new Uint8Array(b2), b1.byteLength); | |
return r.buffer; | |
}; |
function b(a){return a?(a^Math.random()*16>>a/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,b)} |
Live Table: https://diafygi.github.io/webcrypto-examples/
I couldn't find anywhere that had clear examples of WebCryptoAPI, so I wrote examples and made a live table with them. Pull requests welcome!