Docs: added React Native and fixed typos.

This commit is contained in:
Richard Moore 2020-09-07 19:40:50 -04:00
parent 4e394fc680
commit 28ee745211
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651
3 changed files with 53 additions and 1 deletions

@ -156,7 +156,7 @@ WebSockets are much more intensive on your server resourses, as they must manage
and maintain the state for each client. For this reason, many services may also
charge additional fees for using their WebSocket endpoints.
_property: new ethers.provider.WebSockerProvider([ url [ , network ] ])
_property: new ethers.provider.WebSocketProvider([ url [ , network ] ])
Returns a new [[WebSocketProvider]] connected to //url// as the //network//.
If //url// is unspecified, the default ``"ws:/\/localhost:8546"`` will be used.

@ -175,14 +175,17 @@ module.exports = {
"link-ens": { name: "ENS", url: "https:/\/ens.domains/" },
"link-ethereum": { name: "Ethereum", url: "https:/\/ethereumorg" },
"link-etherscan": { name: "Etherscan", url: "https:/\/etherscan.io" },
"link-expo": { name: "Expo", url: "https:/\/expo.io" },
"link-etherscan-api": "https:/\/etherscan.io/apis",
"link-flatworm": { name: "Flatworm", url: "https:/\/github.com/ricmoo/flatworm" },
"link-geth": { name: "Geth", url: "https:/\/geth.ethereum.org" },
"link-infura": { name: "INFURA", url: "https:/\/infura.io" },
"link-javascriptcore": { name: "JavaScriptCore", url: "https:/\/developer.apple.com/documentation/javascriptcore?language=objc" },
"link-ledger": "https:/\/www.ledger.com",
"link-metamask": { name: "Metamask", url: "https:/\/metamask.io/" },
"link-otto": "https:/\/github.com/robertkrimen/otto",
"link-parity": { name: "Parity", url: "https:/\/www.parity.io" },
"link-react-native": { name: "React Native", url: "https:/\/reactnative.dev" },
"link-rtd": "https:/\/github.com/readthedocs/sphinx_rtd_theme",
"link-semver": { name: "semver", url: "https:/\/semver.org" },
"link-solidity": { name: "Solidity" , url: "https:/\/solidity.readthedocs.io/en/v0.6.2/" },
@ -240,9 +243,11 @@ module.exports = {
"link-bip-32": { name: "BIP-32", url: "https:/\/github.com/bitcoin/bips/blob/master/bip-0032.mediawiki" },
"link-npm-elliptic": { name: "elliptic", url: "https:/\/www.npmjs.com/package/elliptic" },
"link-npm-ethersproject-shims": { name: "Shims", url: "https:/\/www.npmjs.com/package/@ethersproject/shims" },
"link-npm-events": { name: "EventEmitter", url: "https:/\/nodejs.org/dist/latest-v13.x/docs/api/events.html#events_class_eventemitter" },
"link-npm-bnjs": { name: "BN.js", url: "https:/\/www.npmjs.com/package/bn.js" },
"link-npm-query-bignumber": "https:/\/www.npmjs.com/search?q=bignumber",
"link-npm-react-native-crypto": { name: "React Native Crypto", url: "https:/\/www.npmjs.com/package/react-native-crypto" },
"link-js-array": "https:/\/developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array",
"link-js-bigint": "https:/\/developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt",

@ -0,0 +1,47 @@
_section: React Native (and ilk) @<cookbook-reactnative>
The [[link-react-native]] framework has become quite popular and
has many popular forks, such as [[link-expo]].
React Native is based on [[link-javascriptcore]] (part of WebKit) and
does not use Node.js or the common Web and DOM APIs. As such,
there are many operations missing that a normal web environment
or Node.js instance would provide.
For this reason, there is a [[link-npm-ethersproject-shims]] module
provided to fill in the holes.
_subsection: Installing @<cookbook-reactnative-shims>
To use ethers in React Native, you must either provide shims for the needed
missing functionality, or use the ethers.js shim.
It is **HIGHLY RECOMMENDED** you check out the [security section](cookbook-reactnative-security>
below for instructions on installing pacakges which can affect the security
of your application.
After installing packages, you may need to restart your packager and company.
_code: Installing @lang<shell>
/home/ricmoo/my-react-project> npm install @ethersproject/shims --save
_code: Importing @lang<script>
// Pull in the shims (BEFORE importing ethers)
import "@ethersproject/shims"
// Import the ethers library
import { ethers } from "ethers";
_subsection: Security @<cookbook-reactnative-security>
The React Native environment does not contain a secure random source, which
is used when computing random private keys. This could result in private
keys that others could guess, allowing the funds to be stolen.
For this reason, it is **HIGHLY RECOMMENDED** to get either the
[[link-npm-react-native-crypto]] module working or some equivalent.