Compare commits
111 Commits
v5.0.0-bet
...
v5.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d5492cd2e | ||
|
|
13f50abd84 | ||
|
|
d0f4642f6d | ||
|
|
1e72fc7d6f | ||
|
|
a21c430c7a | ||
|
|
eb26a6d950 | ||
|
|
a648f2bd1e | ||
|
|
e593aba294 | ||
|
|
5724fa5d9c | ||
|
|
f54f06b5c8 | ||
|
|
e809eadf8d | ||
|
|
184c459fab | ||
|
|
06cafe3437 | ||
|
|
fdf0980663 | ||
|
|
9c78c7fee6 | ||
|
|
fa9f53def7 | ||
|
|
cf036e1ffa | ||
|
|
4470477d7f | ||
|
|
e3752e5986 | ||
|
|
f308ba3540 | ||
|
|
2f0e679f0b | ||
|
|
abab9f6aa2 | ||
|
|
c11c2e2e33 | ||
|
|
3d75c52dac | ||
|
|
29f0e9dd62 | ||
|
|
79ef1e975d | ||
|
|
3ab373334c | ||
|
|
b72ef27b2a | ||
|
|
e518151509 | ||
|
|
19aaade9c6 | ||
|
|
c35ddaf646 | ||
|
|
8316406977 | ||
|
|
01ca35036c | ||
|
|
da8ca2e8bc | ||
|
|
1ec5804bd4 | ||
|
|
75895fa149 | ||
|
|
51e4ef2b45 | ||
|
|
e1509a6326 | ||
|
|
394c36cad4 | ||
|
|
1d4f90a958 | ||
|
|
494381a628 | ||
|
|
d9d438a119 | ||
|
|
3d514c8dbb | ||
|
|
28339a9c85 | ||
|
|
fea867a206 | ||
|
|
5b0c15930f | ||
|
|
12cfc59965 | ||
|
|
3c864de612 | ||
|
|
778eb3b425 | ||
|
|
3d25882d6b | ||
|
|
a12030ad29 | ||
|
|
828c8cfd41 | ||
|
|
238fcba83b | ||
|
|
751793ea25 | ||
|
|
6f4291f65f | ||
|
|
9c63b4a753 | ||
|
|
22a26736cc | ||
|
|
f0b2961f08 | ||
|
|
4c17c4db04 | ||
|
|
e8028d0e73 | ||
|
|
1e0ed4e99a | ||
|
|
2187604913 | ||
|
|
85b4db7d6d | ||
|
|
019c1fc708 | ||
|
|
3a91e91df5 | ||
|
|
73a0077fd3 | ||
|
|
81fd9428ca | ||
|
|
ebfca98dc2 | ||
|
|
6f4ca61208 | ||
|
|
c031a13368 | ||
|
|
07e15993ba | ||
|
|
a12d60d722 | ||
|
|
8745a81b11 | ||
|
|
0333a76f4f | ||
|
|
57bf997d33 | ||
|
|
b7494d8618 | ||
|
|
b304ec1f00 | ||
|
|
621313d2a6 | ||
|
|
724c32e8c0 | ||
|
|
db8c46299b | ||
|
|
edb26b1635 | ||
|
|
de4b2a449c | ||
|
|
9977c9f66a | ||
|
|
7dfef463f8 | ||
|
|
2cc51542be | ||
|
|
226bb63184 | ||
|
|
19ee2b5160 | ||
|
|
7640292ac8 | ||
|
|
31e8e1b052 | ||
|
|
53bd96a9f6 | ||
|
|
0e6b810def | ||
|
|
e6bab2e94f | ||
|
|
692589db54 | ||
|
|
3ba45ff064 | ||
|
|
1cabce7e1c | ||
|
|
b21681a7f4 | ||
|
|
8a45687a5b | ||
|
|
f955dca417 | ||
|
|
c09de16347 | ||
|
|
226c100c72 | ||
|
|
8354c3f9fe | ||
|
|
0af95f4a65 | ||
|
|
0b224e8fb5 | ||
|
|
e8f28b55d7 | ||
|
|
638d1fe62e | ||
|
|
c3c65b2fa1 | ||
|
|
6de4a5d8a9 | ||
|
|
b67b121239 | ||
|
|
74dbc281ed | ||
|
|
28eb38ee70 | ||
|
|
47663ca26b |
148
.circleci/config.yml
Normal file
148
.circleci/config.yml
Normal file
@@ -0,0 +1,148 @@
|
||||
version: 2.1
|
||||
|
||||
executors:
|
||||
machine_executor:
|
||||
machine: true
|
||||
working_directory: ~/repo
|
||||
|
||||
commands:
|
||||
build-and-test:
|
||||
parameters:
|
||||
node-version:
|
||||
type: string
|
||||
default: "10.16.3"
|
||||
test-script:
|
||||
type: string
|
||||
default: "test-node"
|
||||
upgrade-chrome:
|
||||
type: string
|
||||
default: ""
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
|
||||
- when:
|
||||
condition: << parameters.upgrade-chrome >>
|
||||
steps:
|
||||
- run:
|
||||
name: Upgrade chrome
|
||||
command: |
|
||||
sudo apt-get purge chromium-browser
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libappindicator1 fonts-liberation
|
||||
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
||||
sudo dpkg -i google-chrome*.deb
|
||||
google-chrome --version
|
||||
|
||||
- run:
|
||||
name: Update gcc version
|
||||
command: |
|
||||
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
|
||||
sudo apt update
|
||||
sudo apt install gcc-6
|
||||
sudo apt install g++-6
|
||||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6
|
||||
|
||||
- run:
|
||||
name: Prepare to run parity
|
||||
command: |
|
||||
mkdir -p /tmp/parity/keys
|
||||
cp -r admin/test-parity/parity-keys /tmp/parity/keys/DevelopmentChain
|
||||
cp admin/test-parity/parity-dev.* /tmp/parity
|
||||
chmod -R 777 /tmp/parity
|
||||
ls -la /tmp/parity
|
||||
|
||||
- run:
|
||||
name: Starting Parity
|
||||
command: |
|
||||
docker run -d \
|
||||
-p 8545:8545 \
|
||||
-p 8546:8546 \
|
||||
-p 30303:30303 \
|
||||
-p 30303:30303/udp \
|
||||
--name parity \
|
||||
-v /tmp/parity:/home/parity/.local/share/io.parity.ethereum parity/parity:v2.4.8-stable \
|
||||
--chain /home/parity/.local/share/io.parity.ethereum/parity-dev.json \
|
||||
--unlock=0x7454a8F5a7c7555d79B172C89D20E1f4e4CC226C \
|
||||
--password /home/parity/.local/share/io.parity.ethereum/parity-dev.pwds \
|
||||
--min-gas-price 1000000000 \
|
||||
--jsonrpc-interface all
|
||||
|
||||
- run:
|
||||
name: Waiting for Parity to be ready
|
||||
command: |
|
||||
for i in `seq 1 20`;
|
||||
do
|
||||
nc -z localhost 8545 && echo Success && exit 0
|
||||
echo -n .
|
||||
sleep 2
|
||||
done
|
||||
docker ps -a
|
||||
docker logs parity
|
||||
echo Failed waiting for Parity && exit 1
|
||||
|
||||
- run:
|
||||
name: Run << parameters.test-script >> with node version << parameters.node-version >>
|
||||
command: |
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
|
||||
nvm install << parameters.node-version >>
|
||||
node -v
|
||||
npm -v
|
||||
gcc --version
|
||||
npm ci
|
||||
npm run bootstrap
|
||||
npm run << parameters.test-script >>
|
||||
|
||||
jobs:
|
||||
node-v8:
|
||||
description: "test with node version 8"
|
||||
executor: machine_executor
|
||||
steps:
|
||||
- build-and-test:
|
||||
node-version: "8.16.1"
|
||||
test-script: "test-node"
|
||||
|
||||
node-v10:
|
||||
description: "test with node version 10"
|
||||
executor: machine_executor
|
||||
steps:
|
||||
- build-and-test:
|
||||
node-version: "10.16.3"
|
||||
test-script: "test-node"
|
||||
|
||||
node-v12:
|
||||
description: "test with node version 12"
|
||||
executor: machine_executor
|
||||
steps:
|
||||
- build-and-test:
|
||||
node-version: "12.13.1"
|
||||
test-script: "test-node"
|
||||
|
||||
browser-esm:
|
||||
description: "test browser with es6 module"
|
||||
executor: machine_executor
|
||||
steps:
|
||||
- build-and-test:
|
||||
node-version: "12.13.1"
|
||||
test-script: "test-browser-esm"
|
||||
upgrade-chrome: "true"
|
||||
|
||||
browser-umd:
|
||||
description: "test browser with es3 module"
|
||||
executor: machine_executor
|
||||
steps:
|
||||
- build-and-test:
|
||||
node-version: "12.13.1"
|
||||
test-script: "test-browser-umd"
|
||||
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
all:
|
||||
jobs:
|
||||
- node-v8
|
||||
- node-v10
|
||||
- node-v12
|
||||
- browser-esm
|
||||
- browser-umd
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -14,3 +14,7 @@ shims/*.d.ts
|
||||
**/*.tmp-browserify-*
|
||||
|
||||
lerna-debug.log
|
||||
|
||||
packages/*/tsconfig.tsbuildinfo
|
||||
|
||||
packages/testcases/input/nameprep/**
|
||||
|
||||
161
CHANGELOG.md
161
CHANGELOG.md
@@ -3,6 +3,167 @@ Changelog
|
||||
|
||||
This change log is managed by `scripts/cmds/update-versions` but may be manually updated.
|
||||
|
||||
ethers/v5.0.0-beta.163 (2020-01-06 18:57)
|
||||
-----------------------------------------
|
||||
|
||||
- Added function to generate CREATE2 addresses. ([#697](https://github.com/ethers-io/ethers.js/issues/697); [eb26a6d](https://github.com/ethers-io/ethers.js/commit/eb26a6d95022a241c44f859e7b2f29646afb4914))
|
||||
- Force constructor name to be null (instead of undefined). ([a648f2b](https://github.com/ethers-io/ethers.js/commit/a648f2bd1e5e52a3662896f04fe7025884866972))
|
||||
- Added documentation uploading script. ([e593aba](https://github.com/ethers-io/ethers.js/commit/e593aba2946c98820b0c2edf9c5dab6cb30c7402))
|
||||
- Added Czech wordlist to default wordlists export. ([#691](https://github.com/ethers-io/ethers.js/issues/691); [5724fa5](https://github.com/ethers-io/ethers.js/commit/5724fa5d9c6fe73f14ec8bdea1f7226a222537ef))
|
||||
- Added Czech BIP-39 wordlist. ([#691](https://github.com/ethers-io/ethers.js/issues/691); [f54f06b](https://github.com/ethers-io/ethers.js/commit/f54f06b5c8092997fd3c9055d69a3e0796ce44f3))
|
||||
- Updated README. ([e809ead](https://github.com/ethers-io/ethers.js/commit/e809eadf8d608cd8c8a78c08a2e3547dd09156cf))
|
||||
- Updating docs. ([184c459](https://github.com/ethers-io/ethers.js/commit/184c459fab0d089a8a879584b72e5eb3560b33ce))
|
||||
- Merge branch 'yuetloo-ethers-v5-beta' into ethers-v5-beta ([06cafe3](https://github.com/ethers-io/ethers.js/commit/06cafe3437ef129b47f5f9c02f4759f2c4854d3c))
|
||||
- Add circleci and parity test files ([fdf0980](https://github.com/ethers-io/ethers.js/commit/fdf0980663ffead0faf3e9b7b233b22ca1574e21))
|
||||
- Fixed typo in package test dist scripts. ([9c78c7f](https://github.com/ethers-io/ethers.js/commit/9c78c7fee69d07733048d898d58205ae7f5c82d7))
|
||||
|
||||
ethers/v5.0.0-beta.162 (2019-11-25 0:02)
|
||||
----------------------------------------
|
||||
|
||||
- Update elliptic package to protect from Minerva timing attack. ([#666](https://github.com/ethers-io/ethers.js/issues/666); [cf036e1](https://github.com/ethers-io/ethers.js/commit/cf036e1ffad3340fcf1c7559d0032493ccc08e6e))
|
||||
- Browser and node testing works again. ([4470477](https://github.com/ethers-io/ethers.js/commit/4470477d7fd3031f2f3a1fbd9c538468c33c7350))
|
||||
|
||||
ethers/v5.0.0-beta.161 (2019-11-23 21:43)
|
||||
-----------------------------------------
|
||||
|
||||
- Updated dist files (sorted package.json to reduce package version change chatter). ([f308ba3](https://github.com/ethers-io/ethers.js/commit/f308ba3540ed0d282d099456d0369873ad9596b0))
|
||||
- Stubs for adding throttle support. ([2f0e679](https://github.com/ethers-io/ethers.js/commit/2f0e679f0bc81bf901cf60a79e50f9715cddec5a))
|
||||
- Refactor wordlists. ([abab9f6](https://github.com/ethers-io/ethers.js/commit/abab9f6aa27d1870d1053e7caa951408b86c454d))
|
||||
- Browser testcases work again. ([c11c2e2](https://github.com/ethers-io/ethers.js/commit/c11c2e2e3376a6764f07ed443245823f2792b8cc))
|
||||
- Added dist files for non-English wordlists. ([3d75c52](https://github.com/ethers-io/ethers.js/commit/3d75c52dac668af5eeede3e7764dadd3055a0707))
|
||||
- Sync GitHub issue cache. ([29f0e9d](https://github.com/ethers-io/ethers.js/commit/29f0e9dd627a7b4b7f772300497f27718c9ecc7b))
|
||||
|
||||
ethers/v5.0.0-beta.160 (2019-11-20 18:36)
|
||||
-----------------------------------------
|
||||
|
||||
- Updated API in testcases. ([3ab3733](https://github.com/ethers-io/ethers.js/commit/3ab373334c75800f2b20b6639ed8eb1b11e453ef))
|
||||
- Fixed scrypt import in ESM build. ([b72ef27](https://github.com/ethers-io/ethers.js/commit/b72ef27b2a8f9941fb9d79122ec449fed9d2464d))
|
||||
- Fixed null apiKey problem for InfuraProvider. ([e518151](https://github.com/ethers-io/ethers.js/commit/e51815150912d10e2734707986b10b37c87d6d12))
|
||||
- Added support for sighash-style tuple parsing. ([19aaade](https://github.com/ethers-io/ethers.js/commit/19aaade9c62510012cfd50ae487ebd1705a28678))
|
||||
- Fixed solc imports for cli. ([c35ddaf](https://github.com/ethers-io/ethers.js/commit/c35ddaf646efa25e738fee604585a0a7af45b206))
|
||||
- Added nonce manager to experimental index. ([8316406](https://github.com/ethers-io/ethers.js/commit/8316406977ea26ca2044d16f7b3bb6ba21ef5b43))
|
||||
- Removing NodesmithProvider from default provider as it is being discontinued. ([01ca350](https://github.com/ethers-io/ethers.js/commit/01ca35036ca11a47f60890e5cae62e46a00f3da8))
|
||||
- Moved bare ABI named functions and events from Interface into Contracts to simplify other consumers of Interface. ([da8ca2e](https://github.com/ethers-io/ethers.js/commit/da8ca2e8bc982fc3ea0343bb3c593a485ca1fef0))
|
||||
- Added support for complex API keys including support for INFURA project secrets. ([#464](https://github.com/ethers-io/ethers.js/issues/464), [#651](https://github.com/ethers-io/ethers.js/issues/651), [#652](https://github.com/ethers-io/ethers.js/issues/652); [1ec5804](https://github.com/ethers-io/ethers.js/commit/1ec5804bd460f6948d4813469fdc7bf739baa6a6))
|
||||
- Migrated to scrypt-js v3. ([75895fa](https://github.com/ethers-io/ethers.js/commit/75895fa1491e7542c755a102f4e4c190685fd2b6))
|
||||
- Moved getDefaultProvider to providers package. ([51e4ef2](https://github.com/ethers-io/ethers.js/commit/51e4ef2b45b83a8d82923600a2fac544d70b0807))
|
||||
- Migrating providers to modern syntax and scoping. ([#634](https://github.com/ethers-io/ethers.js/issues/634); [e1509a6](https://github.com/ethers-io/ethers.js/commit/e1509a6326dd2cb8bf7ed64b82dd3947b768a314))
|
||||
- Migrating to modern syntax and scoping. ([#634](https://github.com/ethers-io/ethers.js/issues/634); [394c36c](https://github.com/ethers-io/ethers.js/commit/394c36cad43f229a94c72d21f94d1c7982a887a1))
|
||||
- Added provider property to Web3Provider. ([#641](https://github.com/ethers-io/ethers.js/issues/641); [1d4f90a](https://github.com/ethers-io/ethers.js/commit/1d4f90a958da6364117353850d62535c9702abd2))
|
||||
- Updated GitHub issue cache. ([494381a](https://github.com/ethers-io/ethers.js/commit/494381a6284cc8ed90bd8002d42a6b6d94dc1200))
|
||||
- Force deploy receipt to address to be null. ([#573](https://github.com/ethers-io/ethers.js/issues/573); [d9d438a](https://github.com/ethers-io/ethers.js/commit/d9d438a119bb11f8516fc9cf02c534ab3816fcb3))
|
||||
- Updated experimental NonceManager. ([3d514c8](https://github.com/ethers-io/ethers.js/commit/3d514c8dbb94e1c4ce5754463e683dd9dbe7c0aa))
|
||||
- Fixed typo in error message. ([28339a9](https://github.com/ethers-io/ethers.js/commit/28339a9c8585392086da159a46df4afb8958915c))
|
||||
- Added GitHub issue caching. ([fea867a](https://github.com/ethers-io/ethers.js/commit/fea867a206f007a17718396e486883a5e718aa29))
|
||||
|
||||
ethers/v5.0.0-beta.159 (2019-10-17 01:08)
|
||||
-----------------------------------------
|
||||
|
||||
- Removing TypeScript build files from npm to fix excessive package diffs.
|
||||
- Fixed getBlock for blockhashes with a leading 0. ([#629](https://github.com/ethers-io/ethers.js/issues/629); [12cfc59](https://github.com/ethers-io/ethers.js/commit/12cfc599656d7e3a6d3d9aa4e468592865a711cc))
|
||||
|
||||
ethers/v5.0.0-beta.158 (2019-09-28 01:56)
|
||||
-----------------------------------------
|
||||
|
||||
- Added less-common, but useful, coding functions to Interface. ([778eb3b](https://github.com/ethers-io/ethers.js/commit/778eb3b425b5ab5b23d28e75be92feccd0fc56bc))
|
||||
- Add response handling and 304 support to fetchJson. ([3d25882](https://github.com/ethers-io/ethers.js/commit/3d25882d6bf689740506b9c569f6e0d30da6f6a5))
|
||||
- Allow numeric values in a transaction to be odd-lengthed hexstrings. ([#614](https://github.com/ethers-io/ethers.js/issues/614); [a12030a](https://github.com/ethers-io/ethers.js/commit/a12030ad29aa13c02aa75d9e0860f4986a0043b4))
|
||||
- Simpler crypt for admin tools. ([828c8cf](https://github.com/ethers-io/ethers.js/commit/828c8cfd419ac4f8d11d978c2e2ff83eba5ae909))
|
||||
|
||||
ethers/v5.0.0-beta.157 (2019-09-08 02:43)
|
||||
-----------------------------------------
|
||||
|
||||
- Fixed getContractAddress for odd-length hex values. ([#572](https://github.com/ethers-io/ethers.js/issues/572); [751793e](https://github.com/ethers-io/ethers.js/commit/751793ea25183d54d7fc4c610a789608f91c062e))
|
||||
- Fixed typo in error message. ([#592](https://github.com/ethers-io/ethers.js/issues/592); [6f4291f](https://github.com/ethers-io/ethers.js/commit/6f4291f65f0ea20c65fef7fd7b09b4d5bf5f0dcd))
|
||||
- Fixed typo in error message. ([#580](https://github.com/ethers-io/ethers.js/issues/580); [9c63b4a](https://github.com/ethers-io/ethers.js/commit/9c63b4a7535f423a802bb1c17c325ce968987349))
|
||||
- Fixed typo in error message. ([#574](https://github.com/ethers-io/ethers.js/issues/574); [22a2673](https://github.com/ethers-io/ethers.js/commit/22a26736cc332fe6e896c9d2707cc99ceee2fb10))
|
||||
|
||||
ethers/v5.0.0-beta.156 (2019-09-06 17:56)
|
||||
-----------------------------------------
|
||||
|
||||
- Removed export star to fix UMD dist file. ([4c17c4d](https://github.com/ethers-io/ethers.js/commit/4c17c4db0455e1b89fd597c4c929cdc36aa3d90d))
|
||||
- Updated TypeScript version. ([e8028d0](https://github.com/ethers-io/ethers.js/commit/e8028d0e73368257b76b394bb8e2bf63f8aecd71))
|
||||
- Fixed test suites and reporter. ([1e0ed4e](https://github.com/ethers-io/ethers.js/commit/1e0ed4e99a22a27fe5057336f8cb320809768f3e))
|
||||
- Added lock-versions admin tool. ([2187604](https://github.com/ethers-io/ethers.js/commit/21876049137644af2b3afa31120ee95d032843a8))
|
||||
- Updated packages with version lock and moved types. ([85b4db7](https://github.com/ethers-io/ethers.js/commit/85b4db7d6db37b853f11a90cf4648c34404edcf9))
|
||||
- Fixed typo in error message. ([#592](https://github.com/ethers-io/ethers.js/issues/592); [019c1fc](https://github.com/ethers-io/ethers.js/commit/019c1fc7089b3da2d7bd41c933b6c6bc35c8dade))
|
||||
- Fixed build process to re-target browser field to ES version. ([3a91e91](https://github.com/ethers-io/ethers.js/commit/3a91e91df56c1ef6cf096c0322f74fd5060891e0))
|
||||
- Major overhaul in compilation to enable ES6 module generation. ([73a0077](https://github.com/ethers-io/ethers.js/commit/73a0077fd38c6ae79f33a9d4d3cc128a904b4a6c))
|
||||
- Updated some of the flatworm docs. ([81fd942](https://github.com/ethers-io/ethers.js/commit/81fd9428cab4be7eee7ddeb564bf91f282cae475))
|
||||
- Fixed package descriptions. ([#561](https://github.com/ethers-io/ethers.js/issues/561); [ebfca98](https://github.com/ethers-io/ethers.js/commit/ebfca98dc276d6f6ca6961632635e8203bb17645))
|
||||
|
||||
ethers/v5.0.0-beta.155 (2019-08-22 17:11)
|
||||
-----------------------------------------
|
||||
|
||||
- Added Wrapped Ether and Token transfers to CLI. ([c031a13](https://github.com/ethers-io/ethers.js/commit/c031a1336815923bae85d9982dba0985a79cfaed))
|
||||
- Fixed sendTransaction and use median gas price in FallbackProvider. ([07e1599](https://github.com/ethers-io/ethers.js/commit/07e15993ba181cfbff987778d158dbde6bb84de2))
|
||||
- Port optional Secret Storage wallet address to v5. ([#582](https://github.com/ethers-io/ethers.js/issues/582); [a12d60d](https://github.com/ethers-io/ethers.js/commit/a12d60d722dfcf998a2e06eba5e46390d7d442e5))
|
||||
- Updated flatworm docs output. ([8745a81](https://github.com/ethers-io/ethers.js/commit/8745a81b11b710036ddb546308c13958be1affb9))
|
||||
- Added initial flatworm documentation stubs. ([0333a76](https://github.com/ethers-io/ethers.js/commit/0333a76f4ff382b5b59b24c672b702721e7a386a))
|
||||
|
||||
ethers/v5.0.0-beta.154 (2019-08-21 01:51)
|
||||
-----------------------------------------
|
||||
|
||||
- Use safe transfer for ENS in CLI. ([b7494d8](https://github.com/ethers-io/ethers.js/commit/b7494d8618001797a4e856f3d1886273897e6ba4))
|
||||
- Fixed quorum-matching logic for FallbackProvider. ([b304ec1](https://github.com/ethers-io/ethers.js/commit/b304ec1f008ec5301c0dbd1a493d790fe3528512))
|
||||
- Added CloudflareProvider. ([#587](https://github.com/ethers-io/ethers.js/issues/587); [621313d](https://github.com/ethers-io/ethers.js/commit/621313d2a697bc6e1dd25eb5b08d67e832a28d05))
|
||||
- Added receipt to CALL_EXCEPTION errors. ([724c32e](https://github.com/ethers-io/ethers.js/commit/724c32e8c08b55404594f263e52babb0550a15b8))
|
||||
|
||||
ethers/v5.0.0-beta.153 (2019-08-06 19:15)
|
||||
-----------------------------------------
|
||||
|
||||
- Updated gas estimate failure messaging to include that the tx may simple be causing a revert. ([edb26b1](https://github.com/ethers-io/ethers.js/commit/edb26b16354afd707e5d03e174c4cc809b951c4f))
|
||||
- Additional sanity checks in ethers-ens. ([de4b2a4](https://github.com/ethers-io/ethers.js/commit/de4b2a449ca3a49807c8bedb3e21e8e8d71e63fc))
|
||||
- Fix bug in --wait for CLI. ([9977c9f](https://github.com/ethers-io/ethers.js/commit/9977c9f66a7007dcc1963128c88c584b6b6c064b))
|
||||
- Added content-hash support to ENS CLI. ([7dfef46](https://github.com/ethers-io/ethers.js/commit/7dfef463f83a9190d1b89cf81e0fb692da3dd813))
|
||||
|
||||
ethers/v5.0.0-beta.152 (2019-08-05 14:37)
|
||||
-----------------------------------------
|
||||
|
||||
- Using CLI --wait instead of custom Plugin flag for ethers-ens. ([19ee2b5](https://github.com/ethers-io/ethers.js/commit/19ee2b516005b2c35b846f19457ec9bbfa0c283b))
|
||||
- Added --wait as a general flag to CLI. ([7640292](https://github.com/ethers-io/ethers.js/commit/7640292ac8b7b9e6de3ad6699d23e2debf26cc1b))
|
||||
- Added migrate-registrar and transfer to ENS CLI. ([31e8e1b](https://github.com/ethers-io/ethers.js/commit/31e8e1b0520bc8be390fbf7e2b473c36a8649eb3))
|
||||
- Include data in the CLI transaction dump. ([53bd96a](https://github.com/ethers-io/ethers.js/commit/53bd96a9f675233906033290f1e0c71ca4e9d389))
|
||||
- Better errors on gas estimation failure. ([0e6b810](https://github.com/ethers-io/ethers.js/commit/0e6b810def390309240508a99b2cf0736848dedd))
|
||||
|
||||
ethers/v5.0.0-beta.151 (2019-08-05 14:29)
|
||||
-----------------------------------------
|
||||
|
||||
- Added package name prefix to all _version for Logger. ([692589d](https://github.com/ethers-io/ethers.js/commit/692589db54cbca10a2a453e9a1801a8612056559))
|
||||
|
||||
ethers/v5.0.0-beta.150 (2019-08-03 01:07)
|
||||
-----------------------------------------
|
||||
|
||||
- Fixed old references to errors package. ([1cabce7](https://github.com/ethers-io/ethers.js/commit/1cabce7e1c23b15cc2b630c0b403dd72d815a5ba))
|
||||
- Added generation scripts for Table A.1 for stringprep. ([#42](https://github.com/ethers-io/ethers.js/issues/42); [b21681a](https://github.com/ethers-io/ethers.js/commit/b21681a7f4292b0e77315caad3a59fe814e9292b))
|
||||
|
||||
ethers/v5.0.0-beta.149 (2019-08-03 00:45)
|
||||
-----------------------------------------
|
||||
|
||||
- Fixed some case-folding and added Table A.1 for IDNA. ([#42](https://github.com/ethers-io/ethers.js/issues/42); [f955dca](https://github.com/ethers-io/ethers.js/commit/f955dca417a6f86690cf33a81b08baa99e1b1a5c))
|
||||
- Removed references to legacy errors pacakge and updated umbrella pacakge. ([c09de16](https://github.com/ethers-io/ethers.js/commit/c09de163473c361cac11ddef9ec852f4cbb7d8e3))
|
||||
- Updated admin module to use new fetchJson. ([226c100](https://github.com/ethers-io/ethers.js/commit/226c100c72c3fcb0c0e3b62be5f579fd9cc4c904))
|
||||
- Updated dist files. ([8354c3f](https://github.com/ethers-io/ethers.js/commit/8354c3f9fe5487f21acaaeccd4450d9a5d495bc1))
|
||||
- Full case-folding for IDNA in namehash. ([0af95f4](https://github.com/ethers-io/ethers.js/commit/0af95f4a655106e67c2ba8f445af88c9e9e24339))
|
||||
- Deprecating errors for logger. ([0b224e8](https://github.com/ethers-io/ethers.js/commit/0b224e8fb5811cd06727063c909ca1e1e5cde57e))
|
||||
- More consistent debug events for Providers. ([e8f28b5](https://github.com/ethers-io/ethers.js/commit/e8f28b55d7dd62e29f03628232ffe7c75dc811b5))
|
||||
|
||||
ethers/v5.0.0-beta.148 (2019-07-27 18:56)
|
||||
-----------------------------------------
|
||||
|
||||
- Initial drop of new ENS CLI tool. ([c3c65b2](https://github.com/ethers-io/ethers.js/commit/c3c65b2fa19e117d6433c2e0b3d20decfe506c74))
|
||||
- Added TypeScript tool support for functions with multiple outputs. ([6de4a5d](https://github.com/ethers-io/ethers.js/commit/6de4a5d8a9d114c4c33c58f8a304b60e7370eeff))
|
||||
- Added CLI support for stand-alone (no sub-command) tools. ([b67b121](https://github.com/ethers-io/ethers.js/commit/b67b12123996f1aaf7cbe3c8648fd85a22d6674e))
|
||||
- Make utils.resolveProperties preserve object parameter order. ([74dbc28](https://github.com/ethers-io/ethers.js/commit/74dbc281ede042c5eeaa7b45150b215dea860a88))
|
||||
- Added initial IDNA support for full UTF-8 support in namehash. ([#42](https://github.com/ethers-io/ethers.js/issues/42); [28eb38e](https://github.com/ethers-io/ethers.js/commit/28eb38ee703288aaad9f730b2d93fe3aeea7ada6))
|
||||
|
||||
ethers/v5.0.0-beta.147 (2019-07-23 01:04)
|
||||
-----------------------------------------
|
||||
|
||||
- Use the CLI solc instead of solc directly for ABI testcase generation. ([99c7b1c](https://github.com/ethers-io/ethers.js/commit/99c7b1ca94382490b9757fd51375a7ad4259b831))
|
||||
- Added experimental UTF-8 functions for escaping non-ascii strings. ([b132e32](https://github.com/ethers-io/ethers.js/commit/b132e32172c9d63e59209628dadd5796dd6291c8))
|
||||
- Bump Solidity version in CLI to 0.5.10. ([6005248](https://github.com/ethers-io/ethers.js/commit/600524842e1a4b857e8428a45c0c7d1baa0624ee))
|
||||
|
||||
ethers/v5.0.0-beta.146 (2019-07-20 21:06)
|
||||
-----------------------------------------
|
||||
|
||||
|
||||
28
README.md
28
README.md
@@ -1,11 +1,17 @@
|
||||
The Ethers Project
|
||||
==================
|
||||
|
||||
**EXPERIMENTAL!!!**
|
||||
**EXPERIMENTAL**
|
||||
|
||||
This is just a development version to experiment with lerna.
|
||||
This branch is the next release of ethers.js, which should
|
||||
be promoted to the official release shortly.
|
||||
|
||||
**Do NOT use**
|
||||
I would recommend it for most new projects and personally use
|
||||
it for my own projects.
|
||||
|
||||
The [new documentation](https://docs-beta.ethers.io) is still a
|
||||
bit sparse, but is coming along as well and will be complete
|
||||
before the promotion to master.
|
||||
|
||||
|
||||
Installing
|
||||
@@ -14,13 +20,21 @@ Installing
|
||||
**node.js**
|
||||
|
||||
```
|
||||
/home/ricmoo/some_project> npm install --save ethers
|
||||
/home/ricmoo/some_project> npm install --save ethers@next
|
||||
```
|
||||
|
||||
**browser**
|
||||
**browser (UMD)**
|
||||
|
||||
```
|
||||
<script src="@TODO" type="text/javasctipt">
|
||||
<script src="https://cdn.ethers.io/lib/ethers-5.0.umd.min.js" type="text/javasctipt">
|
||||
</script>
|
||||
```
|
||||
|
||||
**browser (ESM)**
|
||||
|
||||
```
|
||||
<script type="module">
|
||||
import { ethers } from "https://cdn.ethers.io/lib/ethers-5.0.umd.min.js";
|
||||
</script>
|
||||
```
|
||||
|
||||
@@ -72,7 +86,7 @@ apps). To do this, run:
|
||||
|
||||
|
||||
```
|
||||
/home/ethers> npm run update-version
|
||||
/home/ethers> npm run update-versions
|
||||
```
|
||||
|
||||
Which will also list all packages that have changed along with the specifc files.
|
||||
|
||||
@@ -4,7 +4,9 @@ const fs = require("fs");
|
||||
const resolve = require("path").resolve;
|
||||
const spawn = require("child_process").spawn;
|
||||
|
||||
const local = require("./local");
|
||||
const { dirnames } = require("./local");
|
||||
const { loadPackage, savePackage } = require("./local");
|
||||
const { loadJson, saveJson } = require("./utils");
|
||||
|
||||
function run(progname, args, ignoreErrorStream) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -34,7 +36,7 @@ function run(progname, args, ignoreErrorStream) {
|
||||
console.log("ERROR");
|
||||
console.log(stderr.toString());
|
||||
|
||||
let error = new Error("stderr not empty");
|
||||
let error = new Error(`stderr not empty: ${ progname } ${ JSON.stringify(args) }`);
|
||||
error.stderr = stderr.toString();
|
||||
error.stdout = stdout.toString();
|
||||
error.statusCode = code;
|
||||
@@ -46,16 +48,69 @@ function run(progname, args, ignoreErrorStream) {
|
||||
});
|
||||
}
|
||||
|
||||
function runBuild() {
|
||||
return run("npx", [ "tsc", "--build", resolve(__dirname, "../tsconfig.project.json") ]);
|
||||
function setupConfig(outDir, moduleType, targetType) {
|
||||
function update(value) {
|
||||
let comps = value.split("/");
|
||||
if (comps.length >= 3 && comps[0] === "." && comps[1].match(/^lib(\.esm)?$/)) {
|
||||
return outDir + comps.slice(2).join("/");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
// Configure the tsconfit.package.json...
|
||||
const path = resolve(__dirname, "../tsconfig.package.json");
|
||||
const content = loadJson(path);
|
||||
content.compilerOptions.module = moduleType;
|
||||
content.compilerOptions.target = targetType;
|
||||
saveJson(path, content);
|
||||
|
||||
dirnames.forEach((dirname) => {
|
||||
let info = loadPackage(dirname);
|
||||
|
||||
if (info._ethers_nobuild) { return; }
|
||||
|
||||
[ "browser", "_browser" ].forEach((key) => {
|
||||
if (info[key]) {
|
||||
if (typeof(info[key]) === "string") {
|
||||
info[key] = update(info[key]);
|
||||
} else {
|
||||
for (let k in info[key]) {
|
||||
info[key][k] = update(info[key][k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
savePackage(dirname, info);
|
||||
|
||||
let path = resolve(__dirname, "../packages", dirname, "tsconfig.json");
|
||||
let content = loadJson(path);
|
||||
content.compilerOptions.outDir = outDir;
|
||||
saveJson(path, content);
|
||||
});
|
||||
}
|
||||
|
||||
function setupBuild(buildModule) {
|
||||
if (buildModule) {
|
||||
setupConfig("./lib.esm/", "es2015", "es2015");
|
||||
} else {
|
||||
setupConfig("./lib/", "commonjs", "es5");
|
||||
}
|
||||
}
|
||||
|
||||
function runBuild(buildModule) {
|
||||
setupBuild(buildModule);
|
||||
|
||||
// Compile
|
||||
return run("npx", [ "tsc", "--build", resolve(__dirname, "../tsconfig.project.json"), "--force" ]);
|
||||
}
|
||||
|
||||
function runDist() {
|
||||
return run("npx", [ "lerna", "run", "dist" ], true);
|
||||
return run("npm", [ "run", "_dist" ], true);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
run: run,
|
||||
runDist: runDist,
|
||||
runBuild: runBuild
|
||||
runBuild: runBuild,
|
||||
setupBuild: setupBuild
|
||||
};
|
||||
|
||||
10
admin/cmds/cache-github.js
Normal file
10
admin/cmds/cache-github.js
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
const config = require("../config");
|
||||
const { syncIssues } = require("../github");
|
||||
|
||||
(async function() {
|
||||
const user = await config.get("github-user");
|
||||
const password = await config.get("github-readonly");
|
||||
await syncIssues(user, password);
|
||||
})();
|
||||
142
admin/cmds/grep-github.js
Normal file
142
admin/cmds/grep-github.js
Normal file
@@ -0,0 +1,142 @@
|
||||
"use strict";
|
||||
|
||||
const { colorify } = require("../log");
|
||||
const { getIssues } = require("../github");
|
||||
const { repeat } = require("../utils");
|
||||
|
||||
const Options = {
|
||||
"body": 1,
|
||||
"end": 1,
|
||||
"issue": 1,
|
||||
"start": 1,
|
||||
"title": 1,
|
||||
"user": 1,
|
||||
};
|
||||
|
||||
const Flags = {
|
||||
"open": 1,
|
||||
"match-case": 1,
|
||||
};
|
||||
|
||||
(async function() {
|
||||
const options = { };
|
||||
for (let i = 2; i < process.argv.length; i++) {
|
||||
const option = process.argv[i];
|
||||
if (option.substring(0, 2) === "--") {
|
||||
const comps = option.substring(2).split(/=/);
|
||||
if (Flags[comps[0]]) {
|
||||
if (comps[1] != null) { throw new Error("Invalid flag: " + option); }
|
||||
options[comps[0]] = true;
|
||||
} else if (Options[comps[0]]) {
|
||||
if (comps[1] == null) {
|
||||
options[comps[0]] = process.argv[++i];
|
||||
if (options[comps[0]] == null) {
|
||||
throw new Error("Missing option value: " + option);
|
||||
}
|
||||
} else {
|
||||
options[comps[0]] = comps[1];
|
||||
}
|
||||
} else {
|
||||
throw new Error("Unexpected option: " + option);
|
||||
}
|
||||
} else {
|
||||
throw new Error("Unexpected argument: " + option);
|
||||
}
|
||||
}
|
||||
|
||||
if (options["title"]) { options.title = new RegExp(options.title, (options["match-case"] ? "": "i")); }
|
||||
if (options["body"]) { options.body = new RegExp(options.title, (options["match-case"] ? "": "i")); }
|
||||
if (options["start"]) {
|
||||
if (options["start"].match(/^[0-9]{4}-[0-9]{2}-[0-9{2}]$/)) {
|
||||
throw new Error("Expected YYYY-MM-DD");
|
||||
}
|
||||
}
|
||||
if (options["end"]) {
|
||||
if (options["end"].match(/^[0-9]{4}-[0-9]{2}-[0-9{2}]$/)) {
|
||||
throw new Error("Expected YYYY-MM-DD");
|
||||
}
|
||||
}
|
||||
|
||||
const count = { issues: 0, comments: 0, code: 0, responses: 0 };
|
||||
|
||||
const issues = await getIssues();
|
||||
issues.forEach((issue) => {
|
||||
const info = issue.issue;
|
||||
const comments = issue.comments;
|
||||
|
||||
if (options.issue && parseInt(options.issue) != info.number) { return; }
|
||||
if (options.open && info.state !== "open") { return; }
|
||||
if (options.title && !info.title.match(options.title)) { return; }
|
||||
if (options.body) {
|
||||
const body = info.body + "\n" + comments.map((c) => (c.body)).join("\n");
|
||||
if (!body.match(options.body)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (options.user) {
|
||||
const users = comments.map((c) => (c.user.login));
|
||||
users.push(info.user.login);
|
||||
if (users.indexOf(options.user) === -1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const dates = comments.map((c) => (c.created_at.split("T")[0]));
|
||||
dates.push(info.created_at.split("T")[0]);
|
||||
|
||||
if (options.start) {
|
||||
if (dates.filter((d) => (d >= options.start)).length === 0) { return; }
|
||||
}
|
||||
if (options.end) {
|
||||
if (dates.filter((d) => (d <= options.start)).length === 0) { return; }
|
||||
}
|
||||
|
||||
count.issues++;
|
||||
|
||||
console.log(colorify(repeat("=", 70), "bold"))
|
||||
console.log(colorify("Issue:", "bold"), info.title, ` (#${ info.number })`);
|
||||
console.log(colorify("User:","bold"), colorify(info.user.login, "blue"));
|
||||
console.log(colorify("State:", "bold"), info.state);
|
||||
if (info.created_at === info.updated_at) {
|
||||
console.log(colorify("Created:", "bold"), info.created_at);
|
||||
} else {
|
||||
console.log(colorify("Created:", "bold"), info.created_at, ` (updated: ${ info.updated_at })`);
|
||||
}
|
||||
info.body.trim().split("\n").forEach((line) => {
|
||||
console.log(" " + line);
|
||||
});
|
||||
|
||||
if (comments.length) {
|
||||
comments.forEach((info) => {
|
||||
if (options.start && info.created_at < options.start) { return ; }
|
||||
if (options.end && info.created_at > options.end) { return; }
|
||||
count.comments++;
|
||||
if (options.user && info.user.login !== options.user) { return; }
|
||||
count.responses++;
|
||||
if (info.body.indexOf("`") >= 0) { count.code++; }
|
||||
console.log(colorify(repeat("-", 70), "bold"));
|
||||
console.log(colorify("User:", "bold"), colorify(info.user.login, "green"));
|
||||
if (info.created_at === info.updated_at) {
|
||||
console.log(colorify("Created:", "bold"), info.created_at);
|
||||
} else {
|
||||
console.log(colorify("Created:", "bold"), info.created_at, ` (updated: ${ info.updated_at })`);
|
||||
}
|
||||
info.body.trim().split("\n").forEach((line) => {
|
||||
console.log(" " + line);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
console.log(colorify(repeat("=", 70), "bold"))
|
||||
|
||||
// @TODO: Add stats on new/closed issues
|
||||
//if (options.user) {
|
||||
// console.log(`${ count.responses } responses (${ count.code } w/ code) on ${ count.comments } comments across ${ count.issues } issues.`);
|
||||
//} else {
|
||||
console.log(`${ count.comments } comment${ (count.comments !== 1) ? "s": "" } across ${ count.issues } issue${ (count.issues !== 1) ? "s": ""}.`);
|
||||
//}
|
||||
|
||||
})().catch((error) => {
|
||||
console.log("Error: " + error.message);
|
||||
});
|
||||
41
admin/cmds/lock-versions.js
Normal file
41
admin/cmds/lock-versions.js
Normal file
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
|
||||
const { getOrdered, loadPackage } = require("../depgraph");
|
||||
const { savePackage } = require("../local");
|
||||
const { log } = require("../log");
|
||||
|
||||
(async function() {
|
||||
let versions = { };
|
||||
|
||||
const dirnames = getOrdered();
|
||||
|
||||
dirnames.forEach((dirname) => {
|
||||
let info = loadPackage(dirname);
|
||||
if (info.name.split("/")[0] === "@ethersproject" || info.name === "ethers") {
|
||||
versions[info.name] = info.version;
|
||||
}
|
||||
});
|
||||
|
||||
dirnames.forEach((dirname) => {
|
||||
const info = loadPackage(dirname);
|
||||
let shown = false;
|
||||
["dependencies", "devDependencies"].forEach((key) => {
|
||||
const deps = info[key];
|
||||
if (!deps) { return; }
|
||||
Object.keys(deps).forEach((name) => {
|
||||
if (versions[name] == null) { return; }
|
||||
const value = ">=" + versions[name];
|
||||
if (value !== deps[name])
|
||||
if (!deps[name]) { return; }
|
||||
if (!shown) {
|
||||
log(`<bold:Locking ${ info.name }:>`);
|
||||
shown = true;
|
||||
}
|
||||
log(` <green:${ name }>: ${ deps[name] } => <bold:${ value.substring(2) }>`);
|
||||
deps[name] = value;
|
||||
});
|
||||
});
|
||||
savePackage(dirname, info);
|
||||
});
|
||||
|
||||
})();
|
||||
@@ -36,7 +36,7 @@ if (process.argv.length > 2) {
|
||||
|
||||
// Load the token from the encrypted store
|
||||
try {
|
||||
token = await config.get("token");
|
||||
token = await config.get("npm-token");
|
||||
} catch (error) {
|
||||
switch (error.message) {
|
||||
case "wrong password":
|
||||
|
||||
5
admin/cmds/reset-build.js
Normal file
5
admin/cmds/reset-build.js
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
const { setupBuild } = require("../build");
|
||||
|
||||
setupBuild(false);
|
||||
16
admin/cmds/set-config.js
Normal file
16
admin/cmds/set-config.js
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
const { prompt } = require("../../packages/cli");
|
||||
const config = require("../config");
|
||||
|
||||
if (process.argv.length !== 3) {
|
||||
console.log("Usage: set-config KEY");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const key = process.argv[2];
|
||||
|
||||
(async function() {
|
||||
const value = await prompt.getPassword("Value: ");
|
||||
await config.set(key, value);
|
||||
})();
|
||||
44
admin/cmds/set-option.js
Executable file
44
admin/cmds/set-option.js
Executable file
@@ -0,0 +1,44 @@
|
||||
const { setupBuild } = require("../build");
|
||||
const { loadPackage, savePackage } = require("../local");
|
||||
|
||||
const arg = process.argv[2];
|
||||
|
||||
(async function() {
|
||||
switch(arg) {
|
||||
case "esm":
|
||||
setupBuild(true);
|
||||
break;
|
||||
|
||||
case "cjs":
|
||||
setupBuild(false);
|
||||
break;
|
||||
|
||||
case "browser-lang-en": {
|
||||
const info = loadPackage("wordlists");
|
||||
if (info._browser) {
|
||||
info.browser = info._browser;
|
||||
delete info._browser;
|
||||
savePackage("wordlists", info);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case "browser-lang-all": {
|
||||
const info = loadPackage("wordlists");
|
||||
if (info.browser) {
|
||||
info._browser = info.browser;
|
||||
delete info.browser;
|
||||
savePackage("wordlists", info);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
console.log("unknown option");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
})().then((result) => {
|
||||
process.exit(result);
|
||||
});
|
||||
30
admin/cmds/update-exports.js
Normal file
30
admin/cmds/update-exports.js
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
const { resolve } = require("path");
|
||||
|
||||
const sourceEthers = fs.readFileSync(resolve(__dirname, "../../packages/ethers/src.ts/ethers.ts")).toString();
|
||||
const targets = sourceEthers.match(/export\s*{\s*((.|\s)*)}/)[1].trim();
|
||||
|
||||
const output = `"use strict";
|
||||
|
||||
// To modify this file, you must update ./admin/cmds/update-exports.js
|
||||
|
||||
import * as ethers from "./ethers";
|
||||
|
||||
try {
|
||||
const anyGlobal = (window as any);
|
||||
|
||||
if (anyGlobal._ethers == null) {
|
||||
anyGlobal._ethers = ethers;
|
||||
}
|
||||
} catch (error) { }
|
||||
|
||||
export { ethers };
|
||||
|
||||
export {
|
||||
${ targets }
|
||||
} from "./ethers";
|
||||
`;
|
||||
|
||||
fs.writeFileSync(resolve(__dirname, "../../packages/ethers/src.ts/index.ts"), output);
|
||||
@@ -18,7 +18,7 @@ const { getPackageVersion } = require("../npm");
|
||||
const { resolve } = require("../utils");
|
||||
const { colorify, log } = require("../log");
|
||||
|
||||
const { getProgressBar } = require("../../packages/cli/prompt");
|
||||
const { prompt } = require("../../packages/cli");
|
||||
|
||||
let dirnames = getOrdered();
|
||||
|
||||
@@ -41,8 +41,7 @@ if (process.argv.length > 2) {
|
||||
}
|
||||
|
||||
(async function() {
|
||||
|
||||
let progress = getProgressBar(colorify("Updating versions", "bold"));
|
||||
let progress = prompt.getProgressBar(colorify("Updating versions", "bold"));
|
||||
|
||||
for (let i = 0; i < dirnames.length; i++) {
|
||||
progress(i / dirnames.length);
|
||||
@@ -65,7 +64,7 @@ if (process.argv.length > 2) {
|
||||
|
||||
// Write out the _version.ts
|
||||
if (!info._ethers_nobuild) {
|
||||
let code = "export const version = " + JSON.stringify(newVersion) + ";\n";
|
||||
let code = "export const version = " + JSON.stringify(dirname + "/" + newVersion) + ";\n";
|
||||
fs.writeFileSync(resolve(path, "src.ts/_version.ts"), code);
|
||||
}
|
||||
|
||||
@@ -77,8 +76,10 @@ if (process.argv.length > 2) {
|
||||
progress(1);
|
||||
|
||||
try {
|
||||
log("<bold:Building TypeScript source...>");
|
||||
await runBuild();
|
||||
log("<bold:Building TypeScript source (es6)...>");
|
||||
await runBuild(true);
|
||||
log("<bold:Building TypeScript source (commonjs)...>");
|
||||
await runBuild(false);
|
||||
log("<bold:Building distribution files...>");
|
||||
let content = await runDist();
|
||||
console.log(content);
|
||||
@@ -89,7 +90,7 @@ if (process.argv.length > 2) {
|
||||
}
|
||||
|
||||
// Update the tarball hash now that _version and package.json may have changed.
|
||||
progress = getProgressBar(colorify("Updating tarballHash", "bold"));
|
||||
progress = prompt.getProgressBar(colorify("Updating tarballHash", "bold"));
|
||||
for (let i = 0; i < dirnames.length; i++) {
|
||||
progress(i / dirnames.length);
|
||||
await updatePackage(dirnames[i]);
|
||||
|
||||
172
admin/cmds/upload-docs.js
Normal file
172
admin/cmds/upload-docs.js
Normal file
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
|
||||
const crypto = require('crypto');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const AWS = require('aws-sdk');
|
||||
|
||||
const config = require("../config");
|
||||
|
||||
|
||||
const Bucket = "docs-beta.ethers.io";
|
||||
|
||||
|
||||
function _getKeys(s3, result, nextToken, callback) {
|
||||
const params = {
|
||||
Bucket: Bucket,
|
||||
MaxKeys: 1000,
|
||||
ContinuationToken: nextToken,
|
||||
};
|
||||
s3.listObjectsV2(params, function(error, data) {
|
||||
if (error) {
|
||||
console.log(error);
|
||||
callback(error);
|
||||
return;
|
||||
}
|
||||
data.Contents.forEach(function(item) {
|
||||
result[item.Key] = item.ETag.replace(/"/g,'');
|
||||
});
|
||||
callback(null, data.IsTruncated ? data.NextContinuationToken: null);
|
||||
});
|
||||
}
|
||||
|
||||
function getKeys(s3) {
|
||||
const result = {};
|
||||
return new Promise(function(resolve, reject) {
|
||||
function handleBlock(error, nextToken) {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else if (nextToken) {
|
||||
nextBlock(nextToken);
|
||||
} else {
|
||||
resolve(result);
|
||||
}
|
||||
}
|
||||
function nextBlock(nextToken) {
|
||||
_getKeys(s3, result, nextToken, handleBlock);
|
||||
}
|
||||
nextBlock(undefined);
|
||||
});
|
||||
}
|
||||
|
||||
function getMime(filename) {
|
||||
const comps = filename.split('.');
|
||||
const ext = comps[comps.length - 1];
|
||||
switch (ext.toLowerCase()) {
|
||||
case 'css': return 'text/css';
|
||||
case 'doctree': return 'application/x-doctree';
|
||||
case 'eot': return 'application/vnd.ms-fontobject';
|
||||
case 'gif': return 'image/gif';
|
||||
case 'html': return 'text/html';
|
||||
case 'js': return 'application/javascript';
|
||||
case 'jpg': return 'image/jpeg';
|
||||
case 'jpeg': return 'image/jpeg';
|
||||
case 'md': return 'text/markdown';
|
||||
case 'pickle': return 'application/x-pickle';
|
||||
case 'png': return 'image/png';
|
||||
case 'svg': return 'image/svg+xml';
|
||||
case 'ttf': return 'application/x-font-ttf';
|
||||
case 'txt': return 'text/plain';
|
||||
case 'woff': return 'application/font-woff';
|
||||
}
|
||||
console.log('NO MIME', filename);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function putObject(s3, name, content) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
s3.putObject({
|
||||
ACL: 'public-read',
|
||||
Body: content,
|
||||
Bucket: Bucket,
|
||||
ContentType: getMime(name),
|
||||
Key: name
|
||||
}, function(error, data) {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
console.log('Uplodaed:', name)
|
||||
resolve({
|
||||
name: name,
|
||||
hash: data.ETag.replace(/"/g, '')
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function hash(filename) {
|
||||
const hasher = crypto.createHash('md5');
|
||||
hasher.update(fs.readFileSync(filename));
|
||||
return hasher.digest().toString('hex');
|
||||
}
|
||||
|
||||
function _getFiles(result, root) {
|
||||
fs.readdirSync(root).forEach(function(filename) {
|
||||
|
||||
// We don't need to upload junk
|
||||
if (filename === '.DS_Store') { return; }
|
||||
|
||||
const fullFilename = path.join(root, filename)
|
||||
const stat = fs.statSync(fullFilename);
|
||||
if (stat.isDirectory()) {
|
||||
_getFiles(result, fullFilename);
|
||||
} else {
|
||||
result[fullFilename] = hash(fullFilename);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getFiles(dirs) {
|
||||
const result = { } //"index.html": hash("index.html") };
|
||||
dirs.forEach(function(dir) {
|
||||
_getFiles(result, dir);
|
||||
})
|
||||
return result;
|
||||
}
|
||||
|
||||
(async function() {
|
||||
const awsAccessId = await config.get("aws-upload-docs-accesskey");
|
||||
const awsSecretKey = await config.get("aws-upload-docs-secretkey");
|
||||
|
||||
const s3 = new AWS.S3({
|
||||
apiVersion: '2006-03-01',
|
||||
accessKeyId: awsAccessId,
|
||||
secretAccessKey: awsSecretKey
|
||||
});
|
||||
|
||||
const added = [], removed = [], changed = [], upload = [];
|
||||
|
||||
const local = await getFiles([ "docs" ]);
|
||||
const remote = await getKeys(s3);
|
||||
|
||||
Object.keys(local).forEach((filename) => {
|
||||
if (!remote[filename]) {
|
||||
added.push(filename);
|
||||
upload.push(filename);
|
||||
} else if (remote[filename] != local[filename]) {
|
||||
changed.push(filename);
|
||||
upload.push(filename);
|
||||
}
|
||||
});
|
||||
|
||||
Object.keys(remote).forEach((filename) => {
|
||||
if (!local[filename]) {
|
||||
removed.push(filename);
|
||||
} else if (!local[filename] && remote[filename] != local[filename]) {
|
||||
changed.push(filename);
|
||||
upload.push(filename);
|
||||
}
|
||||
});
|
||||
|
||||
console.log('Added: ', added.length);
|
||||
console.log('Removed: ', removed.length);
|
||||
console.log('Changed: ', changed.length);
|
||||
|
||||
for (let i = 0; i < upload.length; i++) {
|
||||
const filename = upload[i];
|
||||
console.log("Uploading:", filename);
|
||||
await putObject(s3, filename, fs.readFileSync(filename));
|
||||
}
|
||||
})();
|
||||
123
admin/config.js
123
admin/config.js
@@ -7,81 +7,102 @@ const resolve = require("path").resolve;
|
||||
const AES = require("aes-js");
|
||||
const scrypt = require("scrypt-js");
|
||||
|
||||
const prompt = require("../packages/cli/prompt");
|
||||
const { prompt } = require("../packages/cli");
|
||||
const randomBytes = require("../packages/random").randomBytes;
|
||||
const computeHmac = require("../packages/sha2").computeHmac;
|
||||
|
||||
const colorify = require("./log").colorify;
|
||||
|
||||
function getConfigFilename() {
|
||||
return resolve(os.homedir(), ".ethers-dist");
|
||||
}
|
||||
|
||||
function getScrypt(message, password, salt) {
|
||||
let progressBar = prompt.getProgressBar(message);
|
||||
return new Promise((resolve, reject) => {
|
||||
scrypt(Buffer.from(password), Buffer.from(salt), (1 << 17), 8, 1, 64, (error, progress, key) => {
|
||||
if (error) { return reject(error); }
|
||||
progressBar(progress);
|
||||
if (key) { resolve(key); }
|
||||
});
|
||||
});
|
||||
return scrypt.scrypt(Buffer.from(password), Buffer.from(salt), (1 << 17), 8, 1, 64, progressBar);
|
||||
}
|
||||
|
||||
async function loadConfig(dkey) {
|
||||
let config = { };
|
||||
function Config(filename) {
|
||||
this.salt = null;
|
||||
this.dkey = null;
|
||||
this.values = { };
|
||||
this.filename = filename;
|
||||
}
|
||||
|
||||
let filename = getConfigFilename();
|
||||
if (fs.existsSync(filename)) {
|
||||
let data = JSON.parse(fs.readFileSync(filename));
|
||||
let ciphertext = Buffer.from(data.ciphertext, "base64");
|
||||
let iv = Buffer.from(data.iv, "base64");
|
||||
let aes = new AES.ModeOfOperation.ctr(dkey.slice(0, 32), new AES.Counter(iv));
|
||||
let plaintext = aes.decrypt(ciphertext);
|
||||
let hmac = computeHmac("sha512", dkey.slice(32, 64), plaintext);
|
||||
Config.prototype.load = async function() {
|
||||
if (this.dkey) { return; }
|
||||
|
||||
let data = null;
|
||||
if (fs.existsSync(this.filename)) {
|
||||
data = JSON.parse(fs.readFileSync(this.filename));
|
||||
} else {
|
||||
data = {
|
||||
salt: Buffer.from(randomBytes(32)).toString("hex")
|
||||
};
|
||||
}
|
||||
|
||||
this.salt = data.salt;
|
||||
|
||||
const password = await prompt.getPassword(colorify("Password (config-store): ", "bold"));
|
||||
|
||||
this.dkey = await getScrypt(colorify("Unlocking config", "bold"), password, this.salt);
|
||||
|
||||
if (data.ciphertext) {
|
||||
const ciphertext = Buffer.from(data.ciphertext, "base64");
|
||||
const iv = Buffer.from(data.iv, "base64");
|
||||
const aes = new AES.ModeOfOperation.ctr(this.dkey.slice(0, 32), new AES.Counter(iv));
|
||||
const plaintext = aes.decrypt(ciphertext);
|
||||
const hmac = computeHmac("sha512", this.dkey.slice(32, 64), plaintext);
|
||||
if (hmac !== data.hmac) {
|
||||
throw new Error("wrong password");
|
||||
}
|
||||
config = JSON.parse(Buffer.from(plaintext).toString());
|
||||
|
||||
this.values = JSON.parse(Buffer.from(plaintext).toString());
|
||||
}
|
||||
};
|
||||
|
||||
return config;
|
||||
}
|
||||
Config.prototype.save = function() {
|
||||
this.values._junk = Buffer.from(randomBytes(16 + parseInt(Math.random() * 48))).toString("base64")
|
||||
|
||||
async function getConfig(key) {
|
||||
let password = await prompt.getPassword(colorify("Password (seesion-store): ", "bold"));
|
||||
let dkey = await getScrypt(colorify("Decrypting", "bold"), password, key);
|
||||
const plaintext = Buffer.from(JSON.stringify(this.values));
|
||||
|
||||
let config = await loadConfig(dkey);
|
||||
return config[key];
|
||||
}
|
||||
const iv = Buffer.from(randomBytes(16));
|
||||
const hmac = computeHmac("sha512", this.dkey.slice(32, 64), plaintext);
|
||||
|
||||
async function setConfig(key, value) {
|
||||
let password = await prompt.getPassword(colorify("Password (seesion-store): ", "bold"));
|
||||
let dkey = await getScrypt("Encrypting", password, key);
|
||||
const aes = new AES.ModeOfOperation.ctr(this.dkey.slice(0, 32), new AES.Counter(iv));
|
||||
const ciphertext = Buffer.from(aes.encrypt(plaintext));
|
||||
|
||||
let config = await loadConfig(dkey);
|
||||
config[key] = value;
|
||||
config._junk = Buffer.from(randomBytes(16 + parseInt(Math.random() * 48))).toString("base64")
|
||||
|
||||
let plaintext = Buffer.from(JSON.stringify(config));
|
||||
|
||||
let iv = Buffer.from(randomBytes(16));
|
||||
let hmac = computeHmac("sha512", dkey.slice(32, 64), plaintext);
|
||||
|
||||
let aes = new AES.ModeOfOperation.ctr(dkey.slice(0, 32), new AES.Counter(iv));
|
||||
let ciphertext = Buffer.from(aes.encrypt(plaintext));
|
||||
|
||||
let data = {
|
||||
const data = {
|
||||
ciphertext: ciphertext.toString("base64"),
|
||||
iv: iv.toString("base64"),
|
||||
salt: this.salt,
|
||||
hmac: hmac
|
||||
};
|
||||
|
||||
fs.writeFileSync(getConfigFilename(), JSON.stringify(data, null, 2));
|
||||
fs.writeFileSync(this.filename, JSON.stringify(data, null, 2));
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
get: getConfig,
|
||||
set: setConfig
|
||||
Config.prototype.get = async function(key) {
|
||||
await this.load();
|
||||
return this.values[key];
|
||||
};
|
||||
|
||||
Config.prototype.set = async function(key, value) {
|
||||
await this.load();
|
||||
this.values[key] = value;
|
||||
this.save();
|
||||
};
|
||||
|
||||
Config.prototype.lock = function() {
|
||||
this.salt = this.dkey = null;
|
||||
}
|
||||
|
||||
const config = new Config(resolve(os.homedir(), ".ethers-dist"));
|
||||
|
||||
module.exports = {
|
||||
get: function(key) {
|
||||
return config.get(key);
|
||||
},
|
||||
set: function(key, value) {
|
||||
config.set(key, value);
|
||||
},
|
||||
lock: function() {
|
||||
config.lock();
|
||||
}
|
||||
}
|
||||
|
||||
134
admin/github.js
Normal file
134
admin/github.js
Normal file
@@ -0,0 +1,134 @@
|
||||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
const { resolve } = require("path");
|
||||
const zlib = require("zlib");
|
||||
|
||||
const { id } = require("../packages/hash");
|
||||
const { fetchJson } = require("../packages/web");
|
||||
|
||||
const CacheDir = resolve(__dirname, "../github-cache/");
|
||||
|
||||
function addResponse(result, response) {
|
||||
return { result, response };
|
||||
}
|
||||
|
||||
function loadFile(filename) {
|
||||
return JSON.parse(zlib.gunzipSync(fs.readFileSync(filename)).toString());
|
||||
//return JSON.parse(fs.readFileSync(filename).toString());
|
||||
}
|
||||
|
||||
// @TODO: atomic
|
||||
function saveFile(filename, content) {
|
||||
fs.writeFileSync(filename, zlib.gzipSync(JSON.stringify(content)));
|
||||
//fs.writeFileSync(filename, JSON.stringify(content));
|
||||
}
|
||||
|
||||
function mockFetchJson(url, body, headers) {
|
||||
return {
|
||||
result: null,
|
||||
response: {
|
||||
statusCode: 304
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function _fetchGitHub(user, password, fetchJson, url) {
|
||||
const result = [ ];
|
||||
while (true) {
|
||||
|
||||
const filename = resolve(CacheDir, id(url).substring(2, 14));
|
||||
|
||||
const headers = {
|
||||
"User-Agent": "ethers-io",
|
||||
};
|
||||
|
||||
let items = null;
|
||||
let link = null;
|
||||
try {
|
||||
const data = loadFile(filename);
|
||||
headers["if-none-match"] = data.etag;
|
||||
items = data.items;
|
||||
link = data.link;
|
||||
} catch (error) {
|
||||
if (error.code !== "ENOENT") { throw error; }
|
||||
}
|
||||
|
||||
const fetch = await fetchJson({
|
||||
url: url,
|
||||
user: user,
|
||||
password: password,
|
||||
headers: headers
|
||||
}, null, addResponse);
|
||||
|
||||
// Cached response is good; use it!
|
||||
if (fetch.response.statusCode !== 304) {
|
||||
items = fetch.result;
|
||||
if (fetch.response.headers) {
|
||||
link = (fetch.response.headers.link || null);
|
||||
}
|
||||
if (fetch.response.headers.etag){
|
||||
saveFile(filename, {
|
||||
timestamp: (new Date()).getTime(),
|
||||
url: url,
|
||||
link: link,
|
||||
etag: fetch.response.headers.etag,
|
||||
items: items,
|
||||
version: 1
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
items.forEach((item) => { result.push(item)});
|
||||
|
||||
url = null;
|
||||
(link || "").split(",").forEach((item) => {
|
||||
if (item.indexOf('rel="next"') >= 0) {
|
||||
const match = item.match(/<([^>]*)>/);
|
||||
if (match) { url = match[1]; }
|
||||
}
|
||||
});
|
||||
|
||||
if (!url) { break; }
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
async function fetchGitHub(user, password, url, cacheOnly) {
|
||||
if (cacheOnly) {
|
||||
return await _fetchGitHub("none", "none", mockFetchJson, url);
|
||||
}
|
||||
|
||||
const results = await _fetchGitHub(user, password, fetchJson, url);
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
async function _getIssues(user, password) {
|
||||
const cacheOnly = (user == null);
|
||||
|
||||
let issues = await fetchGitHub(user, password, "https://api.github.com/repos/ethers-io/ethers.js/issues?state=all&per_page=100", cacheOnly)
|
||||
if (!cacheOnly) { console.log(`Found ${ issues.length } issues`); }
|
||||
const result = [ ];
|
||||
for (let i = 0; i < issues.length; i++) {
|
||||
const issue = issues[i];
|
||||
let comments = await fetchGitHub(user, password, issue.comments_url, cacheOnly);
|
||||
result.push({ issue, comments});
|
||||
if (!cacheOnly) { console.log(` Issue ${ issue.number }: ${ comments.length } comments`); }
|
||||
}
|
||||
result.sort((a, b) => (a.issue.number - b.issue.number));
|
||||
return result;
|
||||
}
|
||||
|
||||
function getIssues() {
|
||||
return _getIssues();
|
||||
}
|
||||
|
||||
function syncIssues(user, password) {
|
||||
return _getIssues(user, password);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getIssues,
|
||||
syncIssues,
|
||||
}
|
||||
@@ -6,7 +6,7 @@ const resolve = require("path").resolve;
|
||||
const diff = require("diff");
|
||||
const semver = require("semver");
|
||||
|
||||
const { getProgressBar, prompt } = require("../packages/cli/prompt");
|
||||
const { prompt } = require("../packages/cli");
|
||||
|
||||
const build = require("./build");
|
||||
const changelog = require("./changelog");
|
||||
@@ -158,7 +158,7 @@ async function runUpdate(dirnames) {
|
||||
// @TODO: Root
|
||||
|
||||
// Update all the package.json and _version.ts
|
||||
let progress = getProgressBar(colorify("Updating versions", "bold"));
|
||||
let progress = prompt.getProgressBar(colorify("Updating versions", "bold"));
|
||||
for (let i = 0; i < dirnames.length; i++) {
|
||||
progress(i / dirnames.length);
|
||||
|
||||
@@ -205,7 +205,7 @@ async function runUpdate(dirnames) {
|
||||
// @TODO:
|
||||
|
||||
// Update the tarball hash now that _version and package.json may have changed.
|
||||
progress = getProgressBar(colorify("Updating tarballHash", "bold"));
|
||||
progress = prompt.getProgressBar(colorify("Updating tarballHash", "bold"));
|
||||
for (let i = 0; i < dirnames.length; i++) {
|
||||
progress(i / dirnames.length);
|
||||
await local.updatePackage(dirnames[i]);
|
||||
|
||||
@@ -2,12 +2,33 @@
|
||||
|
||||
const packlist = require("npm-packlist");
|
||||
const tar = require("tar");
|
||||
const keccak256 = require("../packages/keccak256").keccak256;
|
||||
|
||||
const keccak256 = (function() {
|
||||
try {
|
||||
return require("../packages/keccak256").keccak256;
|
||||
} catch (error) {
|
||||
console.log("Cannot load Keccak256 (maybe not built yet? Not really a problem for most things)");
|
||||
return null;
|
||||
}
|
||||
})();
|
||||
|
||||
const { dirnames, loadPackage, ROOT } = require("./depgraph");
|
||||
const { resolve, saveJson } = require("./utils");
|
||||
|
||||
function sorted(obj) {
|
||||
if (Array.isArray(obj)) { return obj.map(sorted); }
|
||||
if (obj == null || typeof(obj) !== "object") { return obj; }
|
||||
|
||||
const keys = Object.keys(obj);
|
||||
keys.sort();
|
||||
|
||||
const result = { };
|
||||
keys.forEach((key) => { result[key] = sorted(obj[key]); });
|
||||
return result;
|
||||
}
|
||||
|
||||
function savePackage(dirname, info) {
|
||||
return saveJson(resolve(ROOT, dirname, "package.json"), info);
|
||||
return saveJson(resolve(ROOT, dirname, "package.json"), sorted(info));
|
||||
}
|
||||
|
||||
async function createTarball(dirname) {
|
||||
|
||||
@@ -9,7 +9,7 @@ const local = require("./local");
|
||||
|
||||
const keccak256 = require("../packages/keccak256").keccak256;
|
||||
const fetchJson = require("../packages/web").fetchJson;
|
||||
const prompt = require("../packages/cli/prompt");
|
||||
const { prompt } = require("../packages/cli");
|
||||
|
||||
const colorify = require("./log").colorify;
|
||||
const git = require("./git");
|
||||
@@ -24,7 +24,7 @@ async function getPackage(name) {
|
||||
cache[name] = result;
|
||||
return result;
|
||||
}, (error) => {
|
||||
if (error.statusCode === 404) {
|
||||
if (error.status === 404) {
|
||||
return null;
|
||||
}
|
||||
throw error;
|
||||
|
||||
50
admin/test-parity/parity-dev.json
Normal file
50
admin/test-parity/parity-dev.json
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "DevelopmentChain",
|
||||
"engine": {
|
||||
"instantSeal": null
|
||||
},
|
||||
"params": {
|
||||
"gasLimitBoundDivisor": "0x0400",
|
||||
"accountStartNonce": "0x0",
|
||||
"maximumExtraDataSize": "0x20",
|
||||
"minGasLimit": "0x1388",
|
||||
"networkID" : "0x11",
|
||||
"registrar" : "0x0000000000000000000000000000000000001337",
|
||||
"maxCodeSize": 24576,
|
||||
"maxCodeSizeTransition": "0x0",
|
||||
"eip98Transition": "0x7fffffffffffff",
|
||||
"eip140Transition": "0x0",
|
||||
"eip145Transition": "0x0",
|
||||
"eip150Transition": "0x0",
|
||||
"eip155Transition": "0x0",
|
||||
"eip160Transition": "0x0",
|
||||
"eip161abcTransition": "0x0",
|
||||
"eip161dTransition": "0x0",
|
||||
"eip211Transition": "0x0",
|
||||
"eip214Transition": "0x0",
|
||||
"eip658Transition": "0x0",
|
||||
"wasmActivationTransition": "0x0"
|
||||
},
|
||||
"genesis": {
|
||||
"seal": {
|
||||
"generic": "0x0"
|
||||
},
|
||||
"difficulty": "0x20000",
|
||||
"author": "0x0000000000000000000000000000000000000000",
|
||||
"timestamp": "0x00",
|
||||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"extraData": "0x",
|
||||
"gasLimit": "0x7A1200"
|
||||
},
|
||||
"accounts": {
|
||||
"0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||
"0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
|
||||
"0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
|
||||
"0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
|
||||
"0000000000000000000000000000000000000005": { "balance": "1", "builtin": { "name": "modexp", "activate_at": 0, "pricing": { "modexp": { "divisor": 20 } } } },
|
||||
"0000000000000000000000000000000000000006": { "balance": "1", "builtin": { "name": "alt_bn128_add", "activate_at": 0, "pricing": { "linear": { "base": 500, "word": 0 } } } },
|
||||
"0000000000000000000000000000000000000007": { "balance": "1", "builtin": { "name": "alt_bn128_mul", "activate_at": 0, "pricing": { "linear": { "base": 40000, "word": 0 } } } },
|
||||
"0000000000000000000000000000000000000008": { "balance": "1", "builtin": { "name": "alt_bn128_pairing", "activate_at": 0, "pricing": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 } } } },
|
||||
"0x7454a8f5a7c7555d79b172c89d20e1f4e4cc226c": { "balance": "1606938044258990275541962092341162602522202993782792835301376" }
|
||||
}
|
||||
}
|
||||
1
admin/test-parity/parity-dev.pwds
Normal file
1
admin/test-parity/parity-dev.pwds
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"id":"24d70b97-fff9-d322-e760-4b8cc2e21751","version":3,"crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"45d392cd16dbbd5c0f5b2d145c112da9"},"ciphertext":"b001ccd09fc5431dc055975b58ee61f86e85529245506c04182c902716e750e5","kdf":"pbkdf2","kdfparams":{"c":10240,"dklen":32,"prf":"hmac-sha256","salt":"028594da27a0e864105f33b912e5dc6ce7c75ecd13c81bfc158fe963d30c93bb"},"mac":"374bf2e9144b74b889708abc19e9ebc164f90bc27e83fd9f01da4571a9f81a70"},"address":"7454a8f5a7c7555d79b172c89d20e1f4e4cc226c","name":"","meta":"{}"}
|
||||
16
docs.wrm/README.md
Normal file
16
docs.wrm/README.md
Normal file
@@ -0,0 +1,16 @@
|
||||
Documentation
|
||||
=============
|
||||
|
||||
These docs are built using [Flatworm Docs](https://github.com/ricmoo/flatworm).
|
||||
|
||||
The output is placed in [docs](../docs) and generates both HTML and Markdown
|
||||
files.
|
||||
|
||||
|
||||
Building
|
||||
--------
|
||||
|
||||
```
|
||||
/home/ricmoo/ethers.js> npm run build-docs
|
||||
```
|
||||
|
||||
8
docs.wrm/api/contract.wrm
Normal file
8
docs.wrm/api/contract.wrm
Normal file
@@ -0,0 +1,8 @@
|
||||
_title: Contracts
|
||||
|
||||
_null: Contract @<contract>
|
||||
_section: Contracts
|
||||
|
||||
Explain what contracts are...
|
||||
|
||||
_subsection: Buckets
|
||||
11
docs.wrm/api/index.wrm
Normal file
11
docs.wrm/api/index.wrm
Normal file
@@ -0,0 +1,11 @@
|
||||
_title: Application Programming Interface
|
||||
|
||||
_section: Application Programming Interface (API)
|
||||
|
||||
Here...
|
||||
|
||||
_toc:
|
||||
contract
|
||||
signer
|
||||
providers
|
||||
utils
|
||||
54
docs.wrm/api/providers/api-providers.wrm
Normal file
54
docs.wrm/api/providers/api-providers.wrm
Normal file
@@ -0,0 +1,54 @@
|
||||
_title: API Providers
|
||||
|
||||
_section: API Providers
|
||||
|
||||
There are many services which offer a web API for accessing
|
||||
the Ethereum Blockchain. These Providers allow connecting
|
||||
to them, which simplifies development, since you do not need
|
||||
to run your own instance or cluster of Ethereum nodes.
|
||||
|
||||
However, this reliance on third-party services can reduce
|
||||
resiliance, security and increase the amount of required trust.
|
||||
To mitigate these issues, it is recommended you use a
|
||||
[Default Provider](get-default-provider).
|
||||
|
||||
|
||||
_subsection: EtherscanProvider
|
||||
|
||||
The **EtherscanProvider** is backed by a combination of the various
|
||||
[Etherscan APIs](https://etherscan.io/apis).
|
||||
|
||||
_property: provider.getHistory(address) => Array<History>
|
||||
|
||||
|
||||
_subsection: InfuraProvider
|
||||
|
||||
The **InfuraProvider** is backed by the popular [INFURA](https://infura.io)
|
||||
Ethereum service.
|
||||
|
||||
It supports Mainnet (homestead) and all common testnets (Ropsten, Rinkeby,
|
||||
Görli and Kovan).
|
||||
|
||||
|
||||
_subsection: NodesmithProvider
|
||||
|
||||
The **NodesmithProvider** is backed by [Nodesmith](https://nodesmith.io).
|
||||
|
||||
It supports Mainnet (homestead) and all common testnets (Ropsten, Rinkeby,
|
||||
Görli and Kovan), as well as the Ethereum-like network [Aion](https://aion.network).
|
||||
|
||||
|
||||
_subsection: AlchemyProvider
|
||||
|
||||
The **AlchemtProvider** is backed by [Alchemy](https://alchemyapi.io).
|
||||
|
||||
It supports Mainnet (homestead) and all common testnets (Ropsten, Rinkeby,
|
||||
Görli and Kovan).
|
||||
|
||||
|
||||
_subsection: CloudfrontProvider
|
||||
|
||||
The CloudfrontProvider is backed by the
|
||||
[Cloudflare Ethereum Gateway](https://developers.cloudflare.com/distributed-web/ethereum-gateway/).
|
||||
|
||||
It only supports Mainnet (homestead).
|
||||
29
docs.wrm/api/providers/example-account.js
Normal file
29
docs.wrm/api/providers/example-account.js
Normal file
@@ -0,0 +1,29 @@
|
||||
// <hide>
|
||||
|
||||
const { ethers } = require("./packages/ethers");
|
||||
const provider = ethers.getDefaultProvider()
|
||||
|
||||
function _inspect(result) {
|
||||
if (ethers.BigNumber.isBigNumber(result)) {
|
||||
return `{ BigNumber: ${ JSON.stringify(result.toString()) } }`;
|
||||
}
|
||||
return JSON.stringify(result);
|
||||
}
|
||||
|
||||
// </hide>
|
||||
|
||||
// Get the balance for an account...
|
||||
provider.getBalance("ricmoo.firefly.eth");
|
||||
//!
|
||||
|
||||
// Get the code for a contract...
|
||||
provider.getCode("registrar.firefly.eth");
|
||||
//!
|
||||
|
||||
// Get the storage value at position 0...
|
||||
provider.getStorageAt("registrar.firefly.eth", 0)
|
||||
//!
|
||||
|
||||
// Get transaction count of an account...
|
||||
provider.getTransactionCount("ricmoo.firefly.eth");
|
||||
//!
|
||||
15
docs.wrm/api/providers/example-ens.js
Normal file
15
docs.wrm/api/providers/example-ens.js
Normal file
@@ -0,0 +1,15 @@
|
||||
// <hide>
|
||||
|
||||
const { ethers } = require("./packages/ethers");
|
||||
const provider = ethers.getDefaultProvider()
|
||||
|
||||
// </hide>
|
||||
|
||||
// Reverse lookup of an ENS by address...
|
||||
provider.lookupAddress("0x6fC21092DA55B392b045eD78F4732bff3C580e2c");
|
||||
//!
|
||||
|
||||
// Lookup an address of an ENS name...
|
||||
provider.resolveName("ricmoo.firefly.eth");
|
||||
//!
|
||||
|
||||
46
docs.wrm/api/providers/index.wrm
Normal file
46
docs.wrm/api/providers/index.wrm
Normal file
@@ -0,0 +1,46 @@
|
||||
_title: Providers
|
||||
|
||||
_section: Providers
|
||||
|
||||
A **Provider** is an abstraction of a connection to the
|
||||
Ethereum network, providing a concise, consistent interface
|
||||
to standard Ethereum node functionality.
|
||||
|
||||
The ethers.js library provides several options which should
|
||||
cover the vast majority of use-cases, but also includes the
|
||||
necessary functions and classes for sub-classing if a more
|
||||
custom configuration is necessary.
|
||||
|
||||
Most users should be able to simply use the [[get-default-provider]].
|
||||
|
||||
|
||||
_subsection: Default Provider @<get-default-provider>
|
||||
|
||||
The default provider is the safest, easiest way to begin
|
||||
developing on //Ethereum//, and it is also robust enough
|
||||
for use in production.
|
||||
|
||||
It creates a [[provider-fallback]] connected to as many backend
|
||||
services as possible. When a request is made, it is sent to
|
||||
multiple backends simulatenously. As responses from each backend
|
||||
are returned, they are checked that they agree. Once a quorum
|
||||
has been reached (i.e. enough of the backends agree), the response
|
||||
is provided to your application.
|
||||
|
||||
This ensures that if a backend has become out-of-sync, or if it
|
||||
has been compromised that its responses are dropped in favor of
|
||||
responses that match the majority.
|
||||
|
||||
_property: ethers.getDefaultProvider([ network ]) => [[provider]]
|
||||
Returns a new Provider, backed by multiple services, connected
|
||||
to //network//. Is no //network// is provided, **homestead**
|
||||
(i.e. mainnet) is used.
|
||||
|
||||
_subsection: Provider Documentation
|
||||
|
||||
_toc:
|
||||
provider
|
||||
jsonrpc-provider
|
||||
api-providers
|
||||
other
|
||||
types
|
||||
22
docs.wrm/api/providers/jsonrpc-provider.wrm
Normal file
22
docs.wrm/api/providers/jsonrpc-provider.wrm
Normal file
@@ -0,0 +1,22 @@
|
||||
_title: JSON-RPC Provider
|
||||
|
||||
_section: JSON-RPC Provider
|
||||
|
||||
Explain here...
|
||||
|
||||
_subsection: JsonRpcProvider @<jsonrpc-provider>
|
||||
|
||||
TODO...
|
||||
|
||||
_property: provider.getSigner([ addressOrIndex ]) => [[jsonrpc-signer]]
|
||||
Returns a [[jsonrpc-signer]] which is managed by this Ethereum node, at
|
||||
//addressOrIndex//. If no //addressOrIndex// is provided, the first
|
||||
account (account #0) is used.
|
||||
|
||||
_property: provider.getUncheckSigner([ addressOrIndex ]) => [[jsonrpc-uncheckedsigner]]
|
||||
|
||||
_subsection: JsonRpcSigner @<jsonrpc-signer>
|
||||
TODO... Explain
|
||||
|
||||
_subsection: JsonRpcUncheckedSigner @<jsonrpc-uncheckedsigner>
|
||||
TODO... Explain
|
||||
27
docs.wrm/api/providers/other.wrm
Normal file
27
docs.wrm/api/providers/other.wrm
Normal file
@@ -0,0 +1,27 @@
|
||||
_title: Other Providers
|
||||
|
||||
_section: Other Providers
|
||||
|
||||
Others...
|
||||
|
||||
_subsection: FallbackProvider @<provider-fallback>
|
||||
|
||||
Explain...
|
||||
|
||||
_heading: Properties
|
||||
|
||||
_property: provider.providers => Array<[[provider]]>
|
||||
The list of Providers this is connected to.
|
||||
|
||||
_property: provider.quorum => number
|
||||
The quorum the backend responses must agree upon before a result will be
|
||||
resolved. By default this is //half the sum of the weights//.
|
||||
|
||||
_property: provider.weights => Array<number>
|
||||
The weight each of the Providers adds to a results acceptance.
|
||||
|
||||
|
||||
_subsection: IpcProvider @<provider-ipc>
|
||||
|
||||
Explain...
|
||||
|
||||
141
docs.wrm/api/providers/provider.wrm
Normal file
141
docs.wrm/api/providers/provider.wrm
Normal file
@@ -0,0 +1,141 @@
|
||||
_title: Abstract Provider
|
||||
|
||||
|
||||
_section: Provider @<provider>
|
||||
|
||||
Explain what a provider is...
|
||||
|
||||
|
||||
_subsection: Accounts Methods
|
||||
|
||||
_property: provider.getBalance(address [ , blockTag = "latest" ]) => Promise<[[bignumber]]>
|
||||
Returns the balance of //address// as of the //blockTag// block height.
|
||||
|
||||
_property: provider.getCode(address [ , blockTag = "latest" ]) => Promise<[[hexstring]]>
|
||||
Returns the contract code of //address// as of the //blockTag// block height. If there is
|
||||
no contract currently deployed, the result is ``0x``.
|
||||
|
||||
_property: provider.getStorageAt(address, position [ , blockTag = "latest" ]) => Promise<[[hexstring]]>
|
||||
Returns the ``Bytes32`` value of the //position// at //address//, as of the //blockTag//.
|
||||
|
||||
_property: provider.getTransactionCount(address [ , blockTag = "latest" ]) => Promise<number>
|
||||
Returns the number of transactions //address// has ever **sent**, as of //blockTag//.
|
||||
This value is required to be the nonce for the next transaction from //address//
|
||||
sent to the network.
|
||||
|
||||
_heading: Examples
|
||||
|
||||
_code: example-account.js
|
||||
|
||||
|
||||
_subsection: Blocks Methods
|
||||
|
||||
_property: provider.getBlock(block) => Promise<[[provider-block]]>
|
||||
Get the //block// from the network, where the ``result.transactions`` is a list
|
||||
of transaction hashes.
|
||||
|
||||
_property: provider.getBlockWithTransactions(block) => Promise<[[provider-blocktxs]]>
|
||||
Get the //block// from the network, where the ``result.transactions`` is
|
||||
an Array of [[provider-transactionresponse]] objects.
|
||||
|
||||
|
||||
_subsection: Ethereum Naming Service (ENS) Methods
|
||||
|
||||
TODO: Explain ENS here...
|
||||
|
||||
_property: provider.lookupAddress(address) => Promise<string>
|
||||
Performs a reverse lookup of the //address// in ENS using the
|
||||
//Reverse Registrar//. If the name does not exist, or the
|
||||
forward lookup does not match, ``null`` is returned.
|
||||
|
||||
_property: provider.resovleName(name) => Promise<string>
|
||||
Looks up the address of //name//. If the name is not owned, or
|
||||
does not have a //Resolver// configured, or the //Resolver// does
|
||||
not have an address configured, ``null`` is returned.
|
||||
|
||||
_heading: Examples
|
||||
|
||||
_code: example-ens.js
|
||||
|
||||
_subsection: Logs Methods
|
||||
|
||||
_property: provider.getLogs(filter) => Promise<Array<[[provider-log]]>>
|
||||
Returns the Array of [[provider-log]] matching the //filter//.
|
||||
|
||||
Keep in mind that many backends will discard old events, and that requests
|
||||
which are too broad may get dropped as they require too many resources to
|
||||
execute the query.
|
||||
|
||||
|
||||
_subsection: Network Status Methods
|
||||
|
||||
_property: provider.getNetwork() => Promise<[[provider-network]]>
|
||||
Returns the [[provider-network]] this Provider is connected to.
|
||||
|
||||
_property: provider.getBlockNumber() => Promise<number>
|
||||
Returns the block number (or height) of the most recently mined block.
|
||||
|
||||
_property: provider.getGasPrice() => Promise<[[bignumber]]>
|
||||
Returns a //best guess// of the [[gas-price]] to use in a transaction.
|
||||
|
||||
|
||||
_subsection: Transactions Methods
|
||||
|
||||
_property: provider.call(transaction [ , blockTag = "latest" ]) => Promise<[[hexstring]]>
|
||||
Returns the result of executing the //transaction//, using //call//. A call
|
||||
does not require any ether, but cannot change any state. This is useful
|
||||
for calling gettings on Contracts.
|
||||
|
||||
_property: provider.estimateGas(transaction) => Promise<[[bignumber]]>
|
||||
Returns an estimate of the amount of gas that would be required to submit //transaction//
|
||||
to the network.
|
||||
|
||||
An estimate may not be accurate since there could be another transaction
|
||||
on the network that was not accounted for, but after being mined affected
|
||||
relevant state.
|
||||
|
||||
_property: provider.sendTransaction(transaction) => Promise<[[provider-transactionresponse]]>
|
||||
Submits //transaction// to the network to be mined. The //transaction// **must** be signed,
|
||||
and be valid (i.e. the nonce is correct and the account has sufficient balance to pay
|
||||
for the transaction).
|
||||
|
||||
_property: provider.waitForTransaction(transactionHash) => Promise<[[provider-transactionreceipt]]>
|
||||
Returns a Promise which will not resolve until //transactionHash// is mined.
|
||||
|
||||
|
||||
_subsection: Event Emitter Methods
|
||||
|
||||
Explain events here...
|
||||
|
||||
_property: provider.on(eventName, listener) => this
|
||||
Add a //listener// to be triggered for each //eventName//.
|
||||
|
||||
_property: provider.once(eventName, listener) => this
|
||||
Add a //listener// to be triggered for only the next //eventName//,
|
||||
at which time it be removed.
|
||||
|
||||
_property: provider.emit(eventName, ...args) => boolean
|
||||
Notify all listeners of //eventName//, passing //args// to each listener. This
|
||||
is generally only used internally.
|
||||
|
||||
_property: provider.off(eventName [ , listener ]) => this
|
||||
Remove a //listener// for //eventName//. If no //listener// is provided,
|
||||
all listeners for //eventName// are removed.
|
||||
|
||||
_property: provider.removeAllListeners([ eventName ]) => this
|
||||
Remove all the listeners for //eventName//. If no //eventName// is provided,
|
||||
**all** events are removed.
|
||||
|
||||
_property: provider.listenerCount([ eventName ]) => number
|
||||
Returns the number of listeners for //eventName//. If no //eventName// is
|
||||
provided, the total number of listeners is returned.
|
||||
|
||||
_property: provider.listeners(eventName) => Array<Listener>
|
||||
Returns the list of Listeners for //eventName//.
|
||||
|
||||
|
||||
_subsection: Inspection Methods
|
||||
|
||||
_property: Provider.isProvider(object) => boolean
|
||||
Returns true if and only if //object// is a Provider.
|
||||
|
||||
75
docs.wrm/api/providers/types.wrm
Normal file
75
docs.wrm/api/providers/types.wrm
Normal file
@@ -0,0 +1,75 @@
|
||||
_title: Types
|
||||
|
||||
_section: Types
|
||||
|
||||
_heading: BlockTag @<provider-blocktag>
|
||||
A **BlockTag** specifies a specific location in the Blockchain.
|
||||
|
||||
- **``"latest"``** -- The most recently mined block
|
||||
- **``"earliest"``** -- Block #0
|
||||
- **``"pending"``** -- The block currently being prepared for mining; not all
|
||||
operations support this BlockTag
|
||||
- **//number//** -- The block at this height
|
||||
- **//a negative number//** -- The block this many blocks ago
|
||||
|
||||
_heading: Network @<provider-network>
|
||||
A **Network** represents an Etherem network.
|
||||
|
||||
- **name** -- The human-readable name of the network
|
||||
- **chainId** -- The Chain ID of the network
|
||||
- **ensAddress** -- The address at which the ENS registry is deployed
|
||||
|
||||
|
||||
_subsection: Blocks
|
||||
|
||||
_heading: Block @<provider-block>
|
||||
TODO
|
||||
|
||||
_heading: BlockWithTransactions @<provider-blocktxs>
|
||||
TODO
|
||||
|
||||
|
||||
_subsection: Events and Logs
|
||||
|
||||
_heading: EventFilter
|
||||
TODO
|
||||
|
||||
_heading: EventType
|
||||
TODO
|
||||
|
||||
_heading: Filter
|
||||
TODO
|
||||
|
||||
_heading: FilterByBlockHash
|
||||
TODO
|
||||
|
||||
_heading: Log @<provider-log>
|
||||
A network...
|
||||
|
||||
|
||||
_subsection: Transactions
|
||||
|
||||
_heading: TransactionRequest @<provider-transactionrequest>
|
||||
|
||||
A transaction request describes a transaction that is to
|
||||
be sent to the network or otherwise processed.
|
||||
|
||||
It contains the fields:
|
||||
- **to** --- target address
|
||||
- **from** --- target address
|
||||
- **nonce** --- target address
|
||||
- **gasLimit** --- target address
|
||||
- **gasPrice** --- target address
|
||||
- **data** --- target address
|
||||
- **value** --- target address
|
||||
- **chainId** --- target address
|
||||
|
||||
All fields are optional and may be a promise which resolves
|
||||
to the required type.
|
||||
|
||||
_heading: TransactionResponse @<provider-transactionresponse>
|
||||
|
||||
A **TransactionResponse** ..
|
||||
|
||||
_heading: TransactionReceipt @<provider-transactionreceipt>
|
||||
TODO
|
||||
33
docs.wrm/api/signer.wrm
Normal file
33
docs.wrm/api/signer.wrm
Normal file
@@ -0,0 +1,33 @@
|
||||
_title: Signer
|
||||
|
||||
_section: Signers
|
||||
|
||||
Tra la la...
|
||||
|
||||
_subsection: Signer @<signer>
|
||||
|
||||
_property: signer.connect(provider) => [[signer]]
|
||||
TODO
|
||||
|
||||
_heading: Blockchain Methods
|
||||
|
||||
_property: signer.getBalance([ blockTag = "latest" ]) => Promise<[[bignumber]]>
|
||||
TODO
|
||||
|
||||
_property: signer.getTransactionCount([ blockTag = "latest" ]) => Promise<number>
|
||||
TODO
|
||||
|
||||
|
||||
_subsection: Wallet inherits Signer
|
||||
|
||||
The Wallet class inherits [[signer]] and can sign transactions and messages
|
||||
using a private key as a standard Externally Owned Account (EOA).
|
||||
|
||||
_heading: Creating an Instance
|
||||
|
||||
_property: new ethers.Wallet(privateKey [ , provider ])
|
||||
TODO
|
||||
|
||||
_property: Wallet.fromEncryptedJson(json, password)
|
||||
TODO
|
||||
|
||||
30
docs.wrm/api/utils/address.wrm
Normal file
30
docs.wrm/api/utils/address.wrm
Normal file
@@ -0,0 +1,30 @@
|
||||
_title: Addresses
|
||||
|
||||
_section: Addresses
|
||||
|
||||
Explain addresses,formats and checksumming here.
|
||||
|
||||
Also see: [constants.AddressZero](constants)
|
||||
|
||||
_heading: Functions
|
||||
|
||||
|
||||
_property: utils.getAddress(address) => string @<utils-getAddress> @TS<address:>
|
||||
Returns //address// as a Checksum Address.
|
||||
|
||||
If //address// is an invalid 40-nibble [[hexstring]] or if it contains mixed case and
|
||||
the checksum is invalid, an InvalidArgument Error is throw.
|
||||
|
||||
The value of //address// may be any supported address format.
|
||||
|
||||
|
||||
_property: utils.isAddress(address) => boolean @<utils-isAddress> @TS<address:>
|
||||
Returns true if //address// is valid (in any supported format).
|
||||
|
||||
_property: utils.getIcapAddress(address) => string @<utils-getIcapAddress> @TS<address:>
|
||||
Returns //address// as an ICAP address. Supports the same restrictions as
|
||||
[utils.getAddress](utils-getAddress).
|
||||
|
||||
_property: utils.getContractAddress(transaction) => string @<utils-getContractAddress> @TS<address:>
|
||||
Returns the contract address that would result if //transaction// was
|
||||
used to deploy a contract.
|
||||
50
docs.wrm/api/utils/bignumber-create.js
Normal file
50
docs.wrm/api/utils/bignumber-create.js
Normal file
@@ -0,0 +1,50 @@
|
||||
// <hide>
|
||||
const { BigNumber } = require("./packages/ethers");
|
||||
const { constants } = require("./packages/ethers");
|
||||
|
||||
function _inspect(result) {
|
||||
if (BigNumber.isBigNumber(result)) {
|
||||
return `{ BigNumber: ${ JSON.stringify(result.toString()) } }`;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// </hide>
|
||||
|
||||
// From a decimal string...
|
||||
BigNumber.from("42")
|
||||
//!
|
||||
|
||||
// From a hexstring...
|
||||
BigNumber.from("0x2a")
|
||||
//!
|
||||
|
||||
// From a negative hexstring...
|
||||
BigNumber.from("-0x2a")
|
||||
//!
|
||||
|
||||
// From an Array (or Uint8Array)...
|
||||
BigNumber.from([ 42 ])
|
||||
//!
|
||||
|
||||
// From an existing BigNumber...
|
||||
let one1 = constants.One;
|
||||
let one2 = BigNumber.from(one1)
|
||||
|
||||
one2
|
||||
//!
|
||||
|
||||
// ...which returns the same instance
|
||||
one1 === one2
|
||||
//!
|
||||
|
||||
// From a (safe) number...
|
||||
BigNumber.from(42)
|
||||
//!
|
||||
|
||||
// From a ES2015 BigInt... (only on platforms with BigInt support)
|
||||
BigNumber.from(42n)
|
||||
//!
|
||||
|
||||
// Numbers outside the safe range fail:
|
||||
BigNumber.from(Number.MAX_SAFE_INTEGER);
|
||||
//! error
|
||||
16
docs.wrm/api/utils/bignumber-examples.js
Normal file
16
docs.wrm/api/utils/bignumber-examples.js
Normal file
@@ -0,0 +1,16 @@
|
||||
// <hide>
|
||||
const { BigNumber } = require("./packages/ethers");
|
||||
|
||||
function _inspect(result) {
|
||||
if (BigNumber.isBigNumber(result)) {
|
||||
return `{ BigNumber: ${ JSON.stringify(result.toString()) } }`;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// </hide>
|
||||
|
||||
let a = BigNumber.from(42);
|
||||
let b = BigNumber.from("91");
|
||||
|
||||
a.mul(b);
|
||||
//!
|
||||
2
docs.wrm/api/utils/bignumber-ieee754.js
Normal file
2
docs.wrm/api/utils/bignumber-ieee754.js
Normal file
@@ -0,0 +1,2 @@
|
||||
(Number.MAX_SAFE_INTEGER + 2 - 2) == (Number.MAX_SAFE_INTEGER)
|
||||
//!
|
||||
18
docs.wrm/api/utils/bignumber-import.source
Normal file
18
docs.wrm/api/utils/bignumber-import.source
Normal file
@@ -0,0 +1,18 @@
|
||||
/////
|
||||
// CommonJS:
|
||||
|
||||
// From the Umbrella ethers package...
|
||||
const { BigNumber } = require("ethers");
|
||||
|
||||
// From the bignumber pacakge...
|
||||
const { BigNumber } = require("@ethersproject/bignumber");
|
||||
|
||||
|
||||
/////
|
||||
// ES6 and TypeScript:
|
||||
|
||||
// From the Umbrella ethers package...
|
||||
import { BigNumber } from "ethers";
|
||||
|
||||
// From the bignumber pacakge...
|
||||
import { BigNumber } from "@ethersproject/bignumber";
|
||||
175
docs.wrm/api/utils/bignumber.wrm
Normal file
175
docs.wrm/api/utils/bignumber.wrm
Normal file
@@ -0,0 +1,175 @@
|
||||
_title: Big Number
|
||||
|
||||
|
||||
_section: BigNumber @<bignumber>
|
||||
|
||||
Explain about BigNumber here...
|
||||
|
||||
_heading: Importing
|
||||
|
||||
_code: bignumber-import.source
|
||||
|
||||
_subsection: Types
|
||||
|
||||
_heading: BigNumberish @<bignumberish>
|
||||
|
||||
Many functions and methods in this library take in values which
|
||||
can be non-ambiguously and safely converted to a BigNumber. These
|
||||
values can be sepcified as:
|
||||
|
||||
_definition: **//string//**
|
||||
A [hexstring](hexstring) or a decimal string, either of which may
|
||||
be negative.
|
||||
|
||||
_definition: **//BytesLike//**
|
||||
A [BytesLike](byteslike) Object, such as an Array or Uint8Array.
|
||||
|
||||
_definition: **//BigNumber//**
|
||||
An existing BigNumber instance.
|
||||
|
||||
_definition: **//number//**
|
||||
A number that is within the safe range for JavaScript numbers.
|
||||
|
||||
_definition: **//BigInt//**
|
||||
A JavaScript [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt)
|
||||
object, on environments that support BigInt.
|
||||
|
||||
|
||||
_subsection: Creating Instances
|
||||
|
||||
The constructor of BigNumber cannot be called directly. Instead, Use the static ``BigNumber.from``.
|
||||
|
||||
_property: BigNumber.from(aBigNumberish) => [[bignumber]]
|
||||
Returns an instance of a **BigNumber** for //aBigNumberish//.
|
||||
|
||||
_heading: Examples:
|
||||
|
||||
_code: bignumber-create.js
|
||||
|
||||
|
||||
_subsection: Methods
|
||||
|
||||
The BigNumber class is immutable, so no operations can change the value
|
||||
it represents.
|
||||
|
||||
|
||||
_heading: Math Operations
|
||||
|
||||
_property: bignumber.add(otherValue) => [[bignumber]]
|
||||
Returns a BigNumber with the value of //bignumber// **+** //otherValue//.
|
||||
|
||||
_property: bignumber.sub(otherValue) => [[bignumber]]
|
||||
Returns a BigNumber with the value of //bignumber// **–** //otherValue//.
|
||||
|
||||
_property: bignumber.mul(otherValue) => [[bignumber]]
|
||||
Returns a BigNumber with the value of //bignumber// **×** //otherValue//.
|
||||
|
||||
_property: bignumber.div(divisor) => [[bignumber]]
|
||||
Returns a BigNumber with the value of //bignumber// **÷** //divisor//.
|
||||
|
||||
_property: bignumber.mod(divisor) => [[bignumber]]
|
||||
Returns a BigNumber with the value of the **remainder** of //bignumber// ÷ //divisor//.
|
||||
|
||||
_property: bignumber.pow(exponent) => [[bignumber]]
|
||||
Returns a BigNumber with the value of //bignumber// to the power of //exponent//.
|
||||
|
||||
_property: bignumber.abs() => [[bignumber]]
|
||||
Returns a BigNumber with the absolute value of //bignumber//.
|
||||
|
||||
_property: bignumber.maskn(bitcount) => [[bignumber]]
|
||||
Returns a BigNumber with the value of //bignumber// with bits beyond
|
||||
the //bitcount// least significant bits set to zero.
|
||||
|
||||
|
||||
_heading: Two's Compliment
|
||||
|
||||
[Two's Complicment](https://en.wikipedia.org/wiki/Two%27s_complement)
|
||||
is an elegant method used to encode and decode fixed-width signed values
|
||||
while efficiently preserving mathematic operations.
|
||||
Most users will not need to interact with these.
|
||||
|
||||
_property: bignumber.fromTwos(bitwidth) => [[bignumber]]
|
||||
Returns a BigNumber with the value of //bignumber// converted from twos-compliment with //bitwidth//.
|
||||
|
||||
_property: bignumber.toTwos(bitwidth) => [[bignumber]]
|
||||
Returns a BigNumber with the value of //bignumber// converted to twos-compliment with //bitwidth//.
|
||||
|
||||
|
||||
_heading: Comparison and Equivalence
|
||||
|
||||
_property: bignumber.eq(otherValue) => boolean
|
||||
Returns true if and only if the value of //bignumber// is equal to //otherValue//.
|
||||
|
||||
_property: bignumber.lt(otherValue) => boolean
|
||||
Returns true if and only if the value of //bignumber// **<** //otherValue//.
|
||||
|
||||
_property: bignumber.lte(otherValue) => boolean
|
||||
Returns true if and only if the value of //bignumber// **≤** //otherValue//.
|
||||
|
||||
_property: bignumber.gt(otherValue) => boolean
|
||||
Returns true if and only if the value of //bignumber// **>** //otherValue//.
|
||||
|
||||
_property: bignumber.gte(otherValue) => boolean
|
||||
Returns true if and only if the value of //bignumber// **≥** //otherValue//.
|
||||
|
||||
_property: bignumber.isZero() => boolean
|
||||
Returns true if and only if the value of //bignumber// is zero.
|
||||
|
||||
|
||||
_heading: Conversion
|
||||
|
||||
_property: bignumber.toNumber() => number
|
||||
Returns the value of //bignumber// as a JavaScript value.
|
||||
|
||||
This will **throw an error**
|
||||
if the value is greater than or equal to //Number.MAX_SAFE_INTEGER// or less than or
|
||||
equal to //Number.MIN_SAFE_INTEGER//.
|
||||
|
||||
_property: bignumber.toString() => string
|
||||
Returns the value of //bignumber// as a base-10 string.
|
||||
|
||||
_property: bignumber.toHexString() => string
|
||||
Returns the value of //bignumber// as a base-16, `0x`-prefixed [hexstring](hexstring).
|
||||
|
||||
|
||||
_heading: Inspection
|
||||
|
||||
_property: BigNumnber.isBigNumber(object) => boolean
|
||||
Returns true if and only if the //object// is a BigNumber object.
|
||||
|
||||
|
||||
_heading: Examples
|
||||
|
||||
_code: bignumber-examples.js
|
||||
|
||||
_subsection: Notes
|
||||
|
||||
A few short notes on numbers...
|
||||
|
||||
_heading: Why can't I just use numbers?
|
||||
|
||||
The first problem many encounter when dealing with Ethereum is
|
||||
the concept of numbers. Most common currencies are broken down
|
||||
with very little granularity. For example, there are only 100
|
||||
cents in a single dollar. However, there are 10^^18^^ **wei** in a
|
||||
single **ether**.
|
||||
|
||||
JavaScript uses [IEEE 754 double-precision binary floating point](https://en.wikipedia.org/wiki/Double-precision_floating-point_format)
|
||||
numbers to represent numeric values. As a result, there are //holes//
|
||||
in the integer set after 9,007,199,254,740,991; which is
|
||||
problematic for //Ethereum// because that is only around 0.009
|
||||
ether (in wei), which means any value over that will begin to
|
||||
experience rounding errors.
|
||||
|
||||
To demonstrate how this may be an issue in your code, consider:
|
||||
|
||||
_code: bignumber-ieee754.js
|
||||
|
||||
To remedy this, all numbers (which can be large) are stored
|
||||
and manipulated as [Big Numbers](bignumber).
|
||||
|
||||
The functions [parseEther( etherString )](http://linkto) and
|
||||
[formatEther( wei )](http://linkto) can be used to convert
|
||||
between string representations, which are displayed to or entered
|
||||
by the user and Big Number representations which can have
|
||||
mathematical operations handled safely.
|
||||
37
docs.wrm/api/utils/bytes-conversion.js
Normal file
37
docs.wrm/api/utils/bytes-conversion.js
Normal file
@@ -0,0 +1,37 @@
|
||||
// <hide>
|
||||
|
||||
const { ethers } = require("./packages/ethers");
|
||||
const { arrayify, hexlify, hexValue } = ethers.utils;
|
||||
|
||||
function _inspect(result) {
|
||||
if (result && typeof(result.length) === "number" && typeof(result) !== "string") {
|
||||
return "[ " + Array.prototype.map.call(result, (i) => _inspect(i)).join(", ") + " ]";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// </hide>
|
||||
|
||||
// Convert a hexstring to a Uint8Array
|
||||
arrayify("0x1234")
|
||||
//!
|
||||
|
||||
// Convert an Array to a hexstring
|
||||
hexlify([1, 2, 3, 4])
|
||||
//!
|
||||
|
||||
// Convert an Object to a hexstring
|
||||
hexlify({ length: 2, "0": 1, "1": 2 })
|
||||
//!
|
||||
|
||||
// Convert an Array to a hexstring
|
||||
hexlify([ 1 ])
|
||||
//!
|
||||
|
||||
// Convert a number to a stripped hex value
|
||||
hexValue(1)
|
||||
//!
|
||||
|
||||
// Convert an Array to a stripped hex value
|
||||
hexValue([ 1, 2 ])
|
||||
//!
|
||||
130
docs.wrm/api/utils/bytes.wrm
Normal file
130
docs.wrm/api/utils/bytes.wrm
Normal file
@@ -0,0 +1,130 @@
|
||||
_title: Byte Manipulation
|
||||
|
||||
_section: Byte Manipulation
|
||||
|
||||
Tra la la...
|
||||
|
||||
_subsection: Types
|
||||
|
||||
_heading: Bytes @<bytes>
|
||||
|
||||
A **Bytes** is any object which is an
|
||||
[Array](https:/\/developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) or
|
||||
[TypedArray](https:/\/developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) with
|
||||
each value in the valid byte range (i.e. between 0 and 255 inclusive),
|
||||
or is an Object with a ``length`` property where each indexed property
|
||||
is in the valid byte range.
|
||||
|
||||
_heading: BytesLike @<byteslike>
|
||||
|
||||
A **BytesLike** can be either a [[bytes]] or a [[datahexstring]].
|
||||
|
||||
_heading: DataHexstring @<datahexstring>
|
||||
|
||||
A **DataHexstring** is identical to a [[hexstring]] except that it has
|
||||
an even number of nibbles, and therefore is a valid representation of
|
||||
binary data as a string.
|
||||
|
||||
_heading: Hexstring @<hexstring>
|
||||
|
||||
A **hexstring** is a string which has a ``0x`` prefix followed by any
|
||||
number of nibbles (i.e. case-insensitive hexidecumal characters, ``0-9`` and ``a-f``).
|
||||
|
||||
_heading: Signature @<signature>
|
||||
|
||||
- **r** and **s** --- The x co-ordinate of **r** and the **s** value of the signature
|
||||
- **v** --- The parity of the y co-ordinate of **r**
|
||||
- **_vs** --- The [compact representation](https://link_here) of the **(r, s)** and **v**
|
||||
- **recoveryParam** --- The normalized (i.e. 0 or 1) value of **v**
|
||||
|
||||
_heading: SignatureLike @<signaturelike>
|
||||
|
||||
A **SignatureLike** is similar to a [[signature]], except redundant properties
|
||||
may be omitted.
|
||||
|
||||
For example, if **_vs** is specified, **s** and **v** may be omitted. Likewise,
|
||||
if **recoveryParam** is provided, **v** may be omitted (as in these cases the
|
||||
missing values can be computed).
|
||||
|
||||
|
||||
_subsection: Inspection
|
||||
|
||||
_property: utils.isBytes(object) => boolean @<utils-isbytes> @TS<bytes:>
|
||||
Returns true if and only if //object// is a valid [[bytes]].
|
||||
|
||||
_property: utils.isBytesLike(object) => boolean @<utils-isbyteslike> @TS<bytes:>
|
||||
Returns true if and only if //object// is a [[bytes]] or [[datahexstring]].
|
||||
|
||||
_property: utils.isHexString(object, [ length ] ) => boolean @<utils-ishexstring> @TS<bytes:>
|
||||
Returns true if and only if //object// is a valid hex string.
|
||||
If //length// is specified and //object// is not a valid [[datahexstring]] of
|
||||
//length// bytes, an InvalidArgument error is thrown.
|
||||
|
||||
|
||||
_subsection: Converting between Arrays and Hexstrings
|
||||
|
||||
_property: utils.arrayify(datahexstringOrArrayish [ , options ]) => Uint8Array @<utils-arrayify> @TS<bytes:>
|
||||
Converts //datahexstringOrArrayish// to a Uint8Array.
|
||||
|
||||
_property: utils.hexlify(hexstringOrArrayish) => string @<utils-hexlify> @TS<bytes:>
|
||||
Converts //hexstringOrArrayish// to a [[datahexstring]].
|
||||
|
||||
_property: utils.hexValue(aBigNumberish) => string @<utils-hexvalue> @TS<bytes:>
|
||||
Converts //aBigNumberish// to a [[hexstring]], with no __unnecessary__ leading
|
||||
zeros.
|
||||
|
||||
_heading: Examples
|
||||
|
||||
_code: bytes-conversion.js
|
||||
|
||||
|
||||
_subsection: Array Manipulation
|
||||
|
||||
_property: utils.concat(arrayOfBytesLike) => Uint8Array @<utils-concat> @TS<bytes:>
|
||||
Concatenates all the [[byteslike]] in //arrayOfBytesLike// into a single Uint8Array.
|
||||
|
||||
_property: utils.stripZeros(aBytesLike) => Uint8Array @<utils-stripzeros> @TS<bytes:>
|
||||
Returns a Uint8Array with all leading ``0`` bytes of //aBtyesLike// removed.
|
||||
|
||||
_property: utils.zeroPad(aBytesLike, length) => Uint8Array @<utils-zeropad> @TS<bytes:>
|
||||
Retutns a Uint8Array of the data in //aBytesLike// with ``0`` bytes prepended to
|
||||
//length// bytes long.
|
||||
|
||||
If //aBytesLike// is already longer than //length// bytes long, an InvalidArgument
|
||||
error will be thrown.
|
||||
|
||||
|
||||
_subsection: Hexstring Manipulation
|
||||
|
||||
_property: utils.hexConcat(arrayOfBytesLike) => [[datahexstring]] @<utils-hexconcat> @TS<bytes:>
|
||||
Concatenates all the [[byteslike]] in //arrayOfBytesLike// into a single [[datahexstring]]
|
||||
|
||||
_property: utils.hexDataLength(aBytesLike) => [[datahexstring]] @<utils-hexdatalength> @TS<bytes:>
|
||||
Returns the length (in bytes) of //aBytesLike//.
|
||||
|
||||
_property: utils.hexDataSlice(aBytesLike, offset [ , endOffset ] ) => [[datahexstring]] @<utils-hexdataslice> @TS<bytes:>
|
||||
Returns a [[datahexstring]] representation of a slice of //aBytesLike//, from
|
||||
//offset// (in bytes) to //endOffset// (in bytes). If //endOffset// is
|
||||
omitted, the length of //aBytesLike// is used.
|
||||
|
||||
_property: utils.hexStripZeros(aBytesLike) => [[hexstring]] @<utils-hexstripzeros> @TS<bytes:>
|
||||
Returns a [[hexstring]] representation of //aBytesLike// with all
|
||||
leading zeros removed.
|
||||
|
||||
_property: utils.hexZeroPad(aBytesLike, length) => [[datahexstring]] @<utils-hexzeropad> @TS<bytes:>
|
||||
Returns a [[datahexstring]] representation of //aBytesLike// padded to //length// bytes.
|
||||
|
||||
If //aBytesLike// is already longer than //length// bytes long, an InvalidArgument
|
||||
error will be thrown.
|
||||
|
||||
|
||||
_subsection: Signature Conversion
|
||||
|
||||
_property: utils.joinSignature(aSignatureLike) => [[datahexstring]] @<utils-joinsignature> @TS<bytes:>
|
||||
Return the flat-format of //aSignaturelike//, which is 65 bytes (130 nibbles)
|
||||
long, concatenating the **r**, **s** and (normalized) **v** of a Signature.
|
||||
|
||||
_property: utils.splitSignature(aSignatureLikeOrBytesLike) => [[signature]] @<utils-splitsignature> @TS<bytes:>
|
||||
Return the full expanded-format of //aSignaturelike// or a flat-format [[datahexstring]].
|
||||
Any missing properties will be computed.
|
||||
|
||||
3
docs.wrm/api/utils/constants-import.js
Normal file
3
docs.wrm/api/utils/constants-import.js
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
//const { constants } = require("ethers");
|
||||
// const { constants } = require("@ethersproject/constants");
|
||||
49
docs.wrm/api/utils/constants.wrm
Normal file
49
docs.wrm/api/utils/constants.wrm
Normal file
@@ -0,0 +1,49 @@
|
||||
_title: Constants
|
||||
|
||||
_section: Constants @<constants>
|
||||
|
||||
The **ethers.contants** Object contains commonly used values.
|
||||
|
||||
_heading: Importing
|
||||
|
||||
_code: constants-import.js
|
||||
|
||||
|
||||
_subsection: Bytes
|
||||
|
||||
_property: constants.AddressZero => [[datahexstring]] @<constants-addresszero> @TS<constants:>
|
||||
The Address Zero, which is 20 bytes (40 nibbles) of zero.
|
||||
|
||||
_property: constants.HashZero => [[datahexstring]] @<constants-hashzero> @TS<constants:>
|
||||
The Hash Zero, which is 32 bytes (64 nibbles) of zero.
|
||||
|
||||
|
||||
_subsection: Strings
|
||||
|
||||
_property: constants.EtherSymbol => string @<constants-ethersymbol> @TS<constants:>
|
||||
The Ether symbol, **Ξ**.
|
||||
|
||||
|
||||
_subsection: BigNumber
|
||||
|
||||
_property: constants.NegativeOne => [[bignumber]] @<constants-negativeone> @TS<constants:>
|
||||
The BigNumber value representing ``"-1"``.
|
||||
|
||||
_property: constants.Zero => [[bignumber]] @<constants-zero> @TS<constants:>
|
||||
The BigNumber value representing ``"0"``.
|
||||
|
||||
_property: constants.One => [[bignumber]] @<constants-one> @TS<constants:>
|
||||
The BigNumber value representing ``"1"``.
|
||||
|
||||
_property: constants.Two => [[bignumber]] @<constants-two> @TS<constants:>
|
||||
The BigNumber value representing ``"2"``.
|
||||
|
||||
_property: constants.WeiPerEther => [[bignumber]] @<constants-weiperether> @TS<constants:>
|
||||
The BigNumber value representing ``"1000000000000000000"``, which is the
|
||||
number of Wei per Ether.
|
||||
|
||||
_property: constants.MaxUint256 => [[bignumber]] @<constants-maxuint256> @TS<constants:>
|
||||
The BigNumber value representing the maximum ``uint256`` value.
|
||||
|
||||
|
||||
|
||||
68
docs.wrm/api/utils/display-logic.wrm
Normal file
68
docs.wrm/api/utils/display-logic.wrm
Normal file
@@ -0,0 +1,68 @@
|
||||
_title: Display Logic and Input
|
||||
|
||||
_section: Display Logic and Input
|
||||
|
||||
When creating an Application, it is useful to convert between
|
||||
user-friendly strings (usually displaying **ether**) and the
|
||||
machine-readable values that contracts and maths depend on
|
||||
(usually in **wei**).
|
||||
|
||||
For example, a Wallet may specify the balance in ether, and
|
||||
gas prices in gwei for the User Interface, but when sending
|
||||
a transaction, both must be specified in wei.
|
||||
|
||||
The [parseUnits](unit-conversion) will parse a string representing
|
||||
ether, such as ``1.1`` into a [BigNumber](bignumber) in wei, and is
|
||||
useful when a user types in a value, such as sending 1.1 ether.
|
||||
|
||||
The [formatUnits](unit-conversion) will format a [BigNumberish](bignumberish)
|
||||
into a string, which is useful when displaying a balance.
|
||||
|
||||
|
||||
_subsection: Units
|
||||
|
||||
_heading: Decimal Count
|
||||
|
||||
The //unit// specified may be an integer, which indicates how
|
||||
many decimal place the unit has. For example, 1 ether has 18 decimal
|
||||
places for wei, and if this library were used with Bitcoin, 1 BTC
|
||||
has 8 decimal places for satoshis.
|
||||
|
||||
_heading: Named Units
|
||||
|
||||
In addition to specifying //unit// as a number of decimals, there
|
||||
are several common units, which can be passed in as a string:
|
||||
|
||||
- **wei** --- 0
|
||||
- **kwei** --- 3
|
||||
- **mwei** --- 6
|
||||
- **gwei** --- 9
|
||||
- **szabo** --- 12
|
||||
- **finney** --- 15
|
||||
- **ether** --- 18
|
||||
|
||||
|
||||
_subsection: Functions
|
||||
|
||||
_heading: Formatting
|
||||
|
||||
_property: utils.commify(value) => string @<util-commify> @TS<units:>
|
||||
Returns a string with value grouped by 3 digits, separated by ``,``.
|
||||
|
||||
|
||||
_heading: Conversion @<unit-conversion>
|
||||
|
||||
_property: utils.formatUnits(value [ , unit = "ether" ] ) => string @<util-formatunits> @TS<units:>
|
||||
Returns a string representation of //value// formatted with //unit//
|
||||
digits (if it is a number) or to the unit specified (if a string).
|
||||
|
||||
_property: utils.formatEther(value) => string @<util-formatether> @TS<units:>
|
||||
The equivalent to calling ``formatUnits(value, "ether")``.
|
||||
|
||||
_property: utils.parseUnits(value [ , unit = "ether" ] ) => [BigNumber](bignumber) @<util-parseunits> @TS<units:>
|
||||
Returns a [BigNumber](bignumber) representation of //value//, parsed with
|
||||
//unit// digits (if it is a number) or from the unit specified (if
|
||||
a string).
|
||||
|
||||
_property: utils.parseEther(value) => [BigNumber](bignumber) @<util-parseether> @TS<units:>
|
||||
The equivalent to calling ``parseUnits(value, "ether")``.
|
||||
80
docs.wrm/api/utils/fixednumber.wrm
Normal file
80
docs.wrm/api/utils/fixednumber.wrm
Normal file
@@ -0,0 +1,80 @@
|
||||
_title: Fixed Number
|
||||
|
||||
_section: FixedNumber @<fixednumber>
|
||||
|
||||
|
||||
_subsection: Types
|
||||
|
||||
|
||||
_heading: FixedFormat @<fixedformat>
|
||||
TODO
|
||||
|
||||
_definition: **//"fixed"//**
|
||||
A shorthand for ``fixed128x80``.
|
||||
|
||||
_subsection: Creating Instances
|
||||
|
||||
The FixedNumber constructor cannot be called directly. There are several
|
||||
static methods for creating a FixedNumber.
|
||||
|
||||
_property: BigNumber.from(value [ , format = "fixed" ] ) => [[fixednumber]]
|
||||
Returns an instance of a **FixedNumber** for //value// as a //format//.
|
||||
|
||||
_property: BigNumber.fromBytes(aBytesLike [ , format = "fixed" ] ) => [[fixednumber]]
|
||||
Returns an instance of a **FixedNumber** for //value// as a //format//.
|
||||
|
||||
_property: BigNumber.fromString(value [ , format = "fixed" ] ) => [[fixednumber]]
|
||||
Returns an instance of a **FixedNumber** for //value// as a //format//. The //value// must
|
||||
not contain more decimals than the //format// permits.
|
||||
|
||||
_property: BigNumber.fromValue(value [ , decimals = 0 [ , format = "fixed" ] ] ) => [[fixednumber]]
|
||||
Returns an instance of a **FixedNumber** for //value// with //decimals// as a //format//.
|
||||
|
||||
|
||||
_subsection: Properties
|
||||
|
||||
_property: fixednumber.format
|
||||
The [FixedFormat](fixedformat) of //fixednumber//.
|
||||
|
||||
|
||||
_subsection: Methods
|
||||
|
||||
_heading: Math Operations
|
||||
|
||||
_property: fixednumber.addUnsafe(otherValue) => [[fixednumber]]
|
||||
Returns a new FixedNumber with the value of //fixedvalue// **+** //otherValue//.
|
||||
|
||||
_property: fixednumber.subUnsafe(otherValue) => [[fixednumber]]
|
||||
Returns a new FixedNumber with the value of //fixedvalue// **–** //otherValue//.
|
||||
|
||||
_property: fixednumber.mulUnsafe(otherValue) => [[fixednumber]]
|
||||
Returns a new FixedNumber with the value of //fixedvalue// **×** //otherValue//.
|
||||
|
||||
_property: fixednumber.divUnsafe(otherValue) => [[fixednumber]]
|
||||
Returns a new FixedNumber with the value of //fixedvalue// **÷** //otherValue//.
|
||||
|
||||
_property: fixednumber.round([ decimals = 0 ]) => [[fixednumber]]
|
||||
Returns a new FixedNumber with the value of //fixedvalue// rounded to //decimals//.
|
||||
|
||||
|
||||
_heading: Conversion
|
||||
|
||||
_property: fixednumber.toFormat(format) => [[fixednumber]]
|
||||
Returns a new FixedNumber with the value of //fixedvalue// with //format//.
|
||||
|
||||
_property: fixednumber.toHexString() => string
|
||||
Returns a [Hexstring](hexstring) representation of //fixednumber//.
|
||||
|
||||
_property: fixednumber.toString() => string
|
||||
Returns a string representation of //fixednumber//.
|
||||
|
||||
_property: fixednumber.toUnsafeFloat() => float
|
||||
Returns a floating-point JavaScript number value of //fixednumber//.
|
||||
Due to rounding in JavaScript numbers, the value is only approximate.
|
||||
|
||||
|
||||
_heading: Inspection
|
||||
|
||||
_property: BigNumber.isFixedNumber(value) => boolean
|
||||
Returns true if and only if //value// is a **FixedNumber**.
|
||||
|
||||
71
docs.wrm/api/utils/hashing.wrm
Normal file
71
docs.wrm/api/utils/hashing.wrm
Normal file
@@ -0,0 +1,71 @@
|
||||
_title: Hashing
|
||||
|
||||
_section: Hashing Algorithms
|
||||
|
||||
Explain what hash functions are?
|
||||
|
||||
|
||||
_subsection: Cryptographic Hashing
|
||||
|
||||
The [Cryptographic Hash Functions](https://en.wikipedia.org/wiki/Cryptographic_hash_function)
|
||||
are a specific family of hash functions.
|
||||
|
||||
_property: utils.keccak256(aBytesLike) => [[datahexstring]] @<utils-keccak256> @TS<keccak256:>
|
||||
Returns the [KECCAK256](https://en.wikipedia.org/wiki/SHA-3) digest //aBytesLike//.
|
||||
|
||||
_property: utils.ripemd160(aBytesLike) => [[datahexstring]] @<utils-ripemd160> @TS<sha2:>
|
||||
Returns the [RIPEMD-160](https://en.m.wikipedia.org/wiki/RIPEMD) digest of //aBytesLike//.
|
||||
|
||||
_property: utils.sha256(aBytesLike) => [[datahexstring]] @<utils-sha256> @TS<sha2:>
|
||||
Returns the [SHA2-256](https://en.wikipedia.org/wiki/SHA-2) digest of //aBytesLike//.
|
||||
|
||||
_property: utils.sha512(aBytesLike) => [[datahexstring]] @<utils-sha512> @TS<sha2:>
|
||||
Returns the [SHA2-512](https://en.wikipedia.org/wiki/SHA-2) digest of //aBytesLike//.
|
||||
|
||||
_property: utils.computeHmac(algorithm, key, data) => [[datahexstring]] @<utils-computehmac> @TS<sha2:>
|
||||
Returns the [HMAC](https://en.wikipedia.org/wiki/HMAC) of //data// with //key//
|
||||
using the [Algorithm](supported-algorithm) //algorithm//.
|
||||
|
||||
|
||||
_heading: HMAC Supported Algorithms @<supported-algorithm>
|
||||
|
||||
_property: utils.SupportedAlgorithms.sha256 => string
|
||||
Use the [SHA2-256](https://en.wikipedia.org/wiki/SHA-2) hash algorithm.
|
||||
|
||||
_property: utils.SupportedAlgorithms.sha512 => string
|
||||
Use the [SHA2-512](https://en.wikipedia.org/wiki/SHA-2) hash algorithm.
|
||||
|
||||
|
||||
_subsection: Common Hashing Helpers
|
||||
|
||||
_property: utils.hashMessage(message) => [[datahexstring]] @<utils-hashmessage> @TS<hash:>
|
||||
Computes the Ethereum message digest of //message//. Ethereum messages are
|
||||
converted to UTF-8 bytes and prefixed with ``\x19Ethereum Signed Message:``
|
||||
and the length of //message//.
|
||||
|
||||
_property: utils.id(text) => [[datahexstring]] @<utils-id> @TS<hash:>
|
||||
The Ethereum Identity function computs the keccak256 hash of the //text// bytes.
|
||||
|
||||
_property: utils.namehash(name) => [[datahexstring]] @<utils-namehash> @TS<hash:>
|
||||
Returns the [ENS Namehash](https://docs.ens.domains/contract-api-reference/name-processing#hashing-names) of //name//.
|
||||
|
||||
|
||||
_subsection: Solidity Hashing Algorithms
|
||||
|
||||
When using the Solidity ``abi.packEncoded(...)`` function, a non-standard
|
||||
//tightly packed// version of encoding is used. These functions implement
|
||||
the tightly packing algorithm.
|
||||
|
||||
_property: utils.solidityPack(arrayOfTypes, arrayOfValues) => [[datahexstring]] @<utils-soliditypack> @TS<solidity:pack()>
|
||||
Returns the non-standard encoded //arrayOfValues// packed according to
|
||||
their respecive type in //arrayOfTypes//.
|
||||
|
||||
_property: utils.solidityKeccak256(arrayOfTypes, arrayOfValues) => [[datahexstring]] @<utils-soliditykeccak256> @TS<solidity:keccak256()>
|
||||
Returns the KECCAK256 of the non-standard encoded //arrayOfValues// packed
|
||||
according to their respective type in //arrayOfTypes//.
|
||||
|
||||
_property: utils.soliditySha256(arrayOfTypes, arrayOfValues) => [[datahexstring]] @<utils-soliditysha256> @TS<solidity:sha256()>
|
||||
Returns the SHA2-256 of the non-standard encoded //arrayOfValues// packed
|
||||
according to their respective type in //arrayOfTypes//.
|
||||
|
||||
|
||||
16
docs.wrm/api/utils/index.wrm
Normal file
16
docs.wrm/api/utils/index.wrm
Normal file
@@ -0,0 +1,16 @@
|
||||
_title: Utilities
|
||||
|
||||
_section: Utilities
|
||||
|
||||
These utilities are used extensively within the library, but
|
||||
are also quite useful for application developers.
|
||||
|
||||
_toc:
|
||||
address
|
||||
bignumber
|
||||
bytes
|
||||
constants
|
||||
display-logic
|
||||
fixednumber
|
||||
hashing
|
||||
strings
|
||||
92
docs.wrm/api/utils/strings.wrm
Normal file
92
docs.wrm/api/utils/strings.wrm
Normal file
@@ -0,0 +1,92 @@
|
||||
_title: Strings
|
||||
|
||||
_section: Strings
|
||||
|
||||
Tra la la
|
||||
|
||||
|
||||
_subsection: Bytes32String @<bytes32-string>
|
||||
|
||||
A string in Solidity is length prefixed with its 256-bit (32 byte)
|
||||
length, which means that even short strings require 2 words (64 bytes)
|
||||
of storage.
|
||||
|
||||
In many cases, we deal with short strings, so instead of prefixing
|
||||
the string with its length, we can null-terminate it and fit it in a
|
||||
single word (32 bytes). Since we need only a single byte for the
|
||||
null termination, we can store strings up to 31 bytes long in a
|
||||
word.
|
||||
|
||||
_note: Note
|
||||
Strings that are 31 __//bytes//__ long may contain fewer than 31 __//characters//__,
|
||||
since UTF-8 requires multiple bytes to encode international characters.
|
||||
|
||||
_property: utils.parseBytes32String(aBytesLike) => string @<utils-parsebytes32> @TS<strings:>
|
||||
Returns the decoded string represented by the ``Bytes32`` encoded data.
|
||||
|
||||
_property: utils.formatBytes32String(text) => string @<utils-formatbytes32> @TS<strings:>
|
||||
Returns a ``bytes32`` string representation of //text//. If the
|
||||
length of //text// exceeds 31 bytes, it will throw an error.
|
||||
|
||||
|
||||
_subsection: UTF-8 Strings @<utf8-string>
|
||||
|
||||
_property: utils.toUtf8Bytes(text [ , form = current ] ) => Uint8Array @<utils-toutf8bytes> @TS<strings:>
|
||||
Returns the UTF-8 bytes of //text//, optionally normalizing it using the
|
||||
[[unicode-normalization-form]] //form//.
|
||||
|
||||
_property: utils.toUtf8CodePoints(aBytesLike [ , form = current ] ) => Array<number> @<utils-toutf8codepoints> @TS<strings:>
|
||||
Returns the Array of codepoints of //aBytesLike//, optionally normalizing it using the
|
||||
[[unicode-normalization-form]] //form//.
|
||||
|
||||
**Note:** This function correctly splits each user-perceived character into
|
||||
its codepoint, accounting for surrogate pairs. This should not be confused with
|
||||
``string.split("")``, which destroys surrogate pairs, spliting between each UTF-16
|
||||
codeunit instead.
|
||||
|
||||
_property: utils.toUtf8String(aBytesLike [ , ignoreErrors = false ] ) => string @<utils-toutf8string> @TS<strings:>
|
||||
Returns the string represented by the UTF-8 bytes of //aBytesLike//. This will
|
||||
throw an error for invalid surrogates, overlong sequences or other UTF-8 issues,
|
||||
unless //ignoreErrors// is specified.
|
||||
|
||||
|
||||
_heading: UnicodeNormalizationForm @<unicode-normalization-form>
|
||||
|
||||
There are several [commonly used forms](https://en.wikipedia.org/wiki/Unicode_equivalence)
|
||||
when normalizing UTF-8 data, which allow strings to be compared or hashed in a stable
|
||||
way.
|
||||
|
||||
_property: utils.UnicodeNormalizationForm.current
|
||||
Maintain the current normalization form.
|
||||
|
||||
_property: utils.UnicodeNormalizationForm.NFC
|
||||
The Composed Normalization Form. This form uses single codepoints
|
||||
which represent the fully composed character.
|
||||
|
||||
For example, the **é** is a single codepoint, ``0x00e9``.
|
||||
|
||||
_property: utils.UnicodeNormalizationForm.NFD
|
||||
The Decomposed Normalization Form. This form uses multiple codepoints
|
||||
(when necessary) to compose a character.
|
||||
|
||||
For example, the **é**
|
||||
is made up of two codepoints, ``"0x0065"`` (which is the letter ``"e"``)
|
||||
and ``"0x0301"`` which is a special diacritic UTF-8 codepoint which
|
||||
indicates the previous character should have an acute accent.
|
||||
|
||||
_property: utils.UnicodeNormalizationForm.NFKC
|
||||
The Composed Normalization Form with Canonical Equivalence. The Canonical
|
||||
representation folds characters which have the same syntactic representation
|
||||
but different semantic meaning.
|
||||
|
||||
For example, the Roman Numeral **I**, which has a UTF-8
|
||||
codepoint ``"0x2160"``, is folded into the capital letter I, ``"0x0049"``.
|
||||
|
||||
_property: utils.UnicodeNormalizationForm.NFKD
|
||||
The Decomposed Normalization Form with Canonical Equivalence.
|
||||
See NFKC for more an example.
|
||||
|
||||
_note: Note
|
||||
Only certain specified characters are folded in Canonical Equivalence, and thus
|
||||
it should **not** be considered a method to acheive //any// level of security from
|
||||
[homoglyph attacks](https://en.wikipedia.org/wiki/IDN_homograph_attack).
|
||||
9
docs.wrm/concepts/events.wrm
Normal file
9
docs.wrm/concepts/events.wrm
Normal file
@@ -0,0 +1,9 @@
|
||||
_title: Events
|
||||
|
||||
_section: Events
|
||||
|
||||
Explain how topics and such work
|
||||
|
||||
_subsection: Solidity Topics
|
||||
|
||||
How to compute the topic...
|
||||
14
docs.wrm/concepts/gas.wrm
Normal file
14
docs.wrm/concepts/gas.wrm
Normal file
@@ -0,0 +1,14 @@
|
||||
_title: Gas
|
||||
|
||||
_section: Gas @<gas>
|
||||
|
||||
Explain attack vectors
|
||||
|
||||
_subsection: Gas Price @<gas-price>
|
||||
|
||||
The gas price is used somewhat like a bid, indicating an amount
|
||||
you are willing to pay (per unit of execution) to have your transaction
|
||||
processed.
|
||||
|
||||
_subsection: Gas Limit @<gas-limit>
|
||||
|
||||
10
docs.wrm/concepts/index.wrm
Normal file
10
docs.wrm/concepts/index.wrm
Normal file
@@ -0,0 +1,10 @@
|
||||
_title: Concepts
|
||||
|
||||
_section: Concepts
|
||||
|
||||
This is a very breif overview of some aspects of //Ethereum//
|
||||
which developers can make use of or should be aware of.
|
||||
|
||||
_toc:
|
||||
events
|
||||
gas
|
||||
15
docs.wrm/config.json
Normal file
15
docs.wrm/config.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"title": "ethers",
|
||||
"subtitle": "v5.0-beta",
|
||||
"logo": "logo.svg",
|
||||
"link": "https://docs-beta.ethers.io",
|
||||
"markdown": {
|
||||
"banner": "-----\n\nDocumentation: [html](https://docs-beta.ethers.io/)\n\n-----\n\n"
|
||||
},
|
||||
"source": {
|
||||
"path": "../packages/",
|
||||
"include": "packages/.*/src.ts/",
|
||||
"exclude": "/node_modules/|src.ts/.*browser.*",
|
||||
"link": "https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages$FILENAME#L$LINE"
|
||||
}
|
||||
}
|
||||
35
docs.wrm/contributing.wrm
Normal file
35
docs.wrm/contributing.wrm
Normal file
@@ -0,0 +1,35 @@
|
||||
_title: Contributing and Hacking
|
||||
|
||||
_section: Contributing and Hacking
|
||||
|
||||
The ethers.js library is something that I've written out of necessity,
|
||||
and has grown somewhat organically over time.
|
||||
|
||||
Many things are the way they are for good (at the time, at least) reasons,
|
||||
but I always welcome criticism, and am completely willing to have my mind
|
||||
changed on things.
|
||||
|
||||
So, pull requests are always welcome, but please keep a few points in mind:
|
||||
|
||||
- Backwards-compatibility-breaking changes will not be accepted; they may be
|
||||
considered for the next major version
|
||||
- Security is important; adding dependencies require fairly convincing
|
||||
arguments as to why
|
||||
- The library aims to be lean, so keep an eye on the dist/ethers.min.js
|
||||
file size before and after your changes
|
||||
- Add test cases for both expected and unexpected input
|
||||
- Any new features need to be supported by me (future issues, documentation,
|
||||
testing, migration), so anything that is overly complicated or specific
|
||||
may not be accepted
|
||||
|
||||
In general, **please start an issue //before// beginning a pull request**, so we can
|
||||
have a public discussion and figure out the best way to address to problem/feature.
|
||||
**:)**
|
||||
|
||||
|
||||
_subsection: Building
|
||||
|
||||
use npm run auto-build
|
||||
|
||||
use npm run update-version
|
||||
|
||||
7
docs.wrm/cookbook/index.wrm
Normal file
7
docs.wrm/cookbook/index.wrm
Normal file
@@ -0,0 +1,7 @@
|
||||
_title: Cookbook
|
||||
|
||||
_section: Cookbook
|
||||
|
||||
Cooking...
|
||||
|
||||
|
||||
24
docs.wrm/documentation/examples.txt
Normal file
24
docs.wrm/documentation/examples.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
_section: Hello World @<link-to-this-section>
|
||||
|
||||
_subsection: Some Example @<link-to-this-subsection>
|
||||
|
||||
_heading: Large Bold Text @<link-to-this-heading>
|
||||
|
||||
_definition: Flatworm
|
||||
A phylum of relatively **simple** bilaterian, unsegmented,
|
||||
soft-bodied invertebrates.
|
||||
|
||||
_property: String.fromCharCode(code) => string
|
||||
Returns a string created from //code//, a sequence of
|
||||
UTF-16 code units.
|
||||
|
||||
_code: filename.js
|
||||
|
||||
_toc:
|
||||
some-file
|
||||
some-directory
|
||||
|
||||
_null:
|
||||
This breaks out of a directive. For example, to end a
|
||||
|
||||
_definition and reset the indentation.
|
||||
7
docs.wrm/documentation/fragment.txt
Normal file
7
docs.wrm/documentation/fragment.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
_DIRECTIVE: VALUE @<LINK>
|
||||
BODY
|
||||
|
||||
DIRECTIVE: The directive name
|
||||
VALUE: Optional; the value to pass to the directive
|
||||
LINK: Optional; a name for internal linking
|
||||
BODY: Optional; the directive body (certain directives only)
|
||||
85
docs.wrm/documentation/index.wrm
Normal file
85
docs.wrm/documentation/index.wrm
Normal file
@@ -0,0 +1,85 @@
|
||||
_title: Flatworm Docs
|
||||
|
||||
_section: Flatworm Docs
|
||||
|
||||
The //Flatworm Docs// rendering script is designed to be **very**
|
||||
simple, but provide enough formatting necessary for documenting
|
||||
JavaScript libraries.
|
||||
|
||||
A lot of its inspiration came from [Read the Docs](https://github.com/readthedocs/sphinx_rtd_theme) and
|
||||
the [Sphinx](https://www.sphinx-doc.org/) project.
|
||||
|
||||
|
||||
_subsection: Fragments
|
||||
|
||||
Flatworm Docs are made up of fragments. A fragment is either a lone
|
||||
body of [markdown](flatworm-markdown) text, or a
|
||||
[directive](flatworm-directive) for specialized formatting, which may
|
||||
itself have body.
|
||||
|
||||
|
||||
_heading: Directive Format
|
||||
|
||||
_code: fragment.txt
|
||||
|
||||
|
||||
_heading: Flatworm Directives @<flatworm-directive>
|
||||
|
||||
_definition: **_section:** //TITLE//
|
||||
A //section// has its **TITLE** in an H1 font. Sections are linked
|
||||
to in //Table of Contents// and have a dividing line drawn above
|
||||
them. If an option is specified, it is avaialble as a name for
|
||||
intern linking. There should only be one ``_section:`` per page.
|
||||
|
||||
_definition: **_subsection:** //TITLE//
|
||||
A //subsection// has its **TITLE** in an H2 font. Subsections are linked
|
||||
to in //Table of Contents// and have a dividing line drawn above
|
||||
them. If an option is specified, it is avaialble as a name for
|
||||
internal linking.
|
||||
|
||||
_definition: **_heading:** //TITLE//
|
||||
A //heading// has its **TITLE** in an H3 font. If an option is specified,
|
||||
it is available as a name for internal linking.
|
||||
|
||||
_definition: **_definition:** //TERM//
|
||||
A //definition// has its **TERM** bolded and the markdown body is
|
||||
indented.
|
||||
|
||||
_definition: **_property:** //SIGNATURE//
|
||||
A //property// has its JavaScript **SIGNATURE** formatted and the
|
||||
markdown body is indented.
|
||||
|
||||
_definition: **_code:** //FILENAME//
|
||||
A //code// reads the **FILENAME** and depending on the extension
|
||||
adjusts it.
|
||||
|
||||
For JavaScript files, the file is executed, with ``\/\/!`` replaced
|
||||
with the result of the last statement and ``\/\/!error`` is replaced
|
||||
with the throw error. If the error state does not agree, rendering
|
||||
fails.
|
||||
|
||||
_definition: **_toc:**
|
||||
A //toc// injects a Table of Contents, loading each line of the
|
||||
body as a filename and recursively loads the //toc// if present,
|
||||
otherwise all the //sections// and //subsections//.
|
||||
|
||||
_definition: **_null:**
|
||||
A //null// is used to terminated a directive. For example, after
|
||||
a //definition//, the bodies are indented, so a //null// can be
|
||||
used to reset the indentation.
|
||||
|
||||
|
||||
_heading: Examples
|
||||
|
||||
_code: examples.txt
|
||||
|
||||
|
||||
_subsection: Markdown @<flatworm-markdown>
|
||||
|
||||
The markdown is simple and does not have the flexibility of
|
||||
other dialects, but allows for **bold**, //italic//,
|
||||
__underlined__, ``monospaced``, ^^super-scripted^^ text,
|
||||
supporting [links](flatworm-markdown) and lists.
|
||||
|
||||
_code: markdown.txt
|
||||
|
||||
23
docs.wrm/documentation/markdown.txt
Normal file
23
docs.wrm/documentation/markdown.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
**bold text**
|
||||
|
||||
//italic text//
|
||||
|
||||
__underlined text__
|
||||
|
||||
``monospace code``
|
||||
|
||||
^^superscript text^^
|
||||
|
||||
- This is a list
|
||||
- With bullet points
|
||||
- With a total of three items
|
||||
|
||||
This is separated by -- an en-dash.
|
||||
|
||||
This is separated by --- an em-dash.
|
||||
|
||||
This is a [Link to Ethereum](https://ethereum.org) and this
|
||||
is an [Internal Link](some-link).
|
||||
|
||||
This is a self-titled link [[https://ethereumorg]] and this
|
||||
[[some-link]] will use the title from its directives value.
|
||||
32
docs.wrm/getting-started.wrm
Normal file
32
docs.wrm/getting-started.wrm
Normal file
@@ -0,0 +1,32 @@
|
||||
_title: Getting Started
|
||||
|
||||
_section: Getting Started
|
||||
|
||||
|
||||
_subsection: Installing
|
||||
|
||||
The various Classes and Functions are available to be imported
|
||||
manually from sub-packages under the
|
||||
[@ethersproject](https://www.npmjs.com/search?q=%40ethersproject%2F)
|
||||
but for most projects, the umbrella package is the easiest way to
|
||||
get started.
|
||||
|
||||
_code: installing.txt
|
||||
|
||||
|
||||
_subsection: Importing
|
||||
|
||||
_heading: Node.js
|
||||
|
||||
_code: importing-node.source
|
||||
|
||||
_heading: Web Browser
|
||||
|
||||
It is generally better practice (for security reasons) to copy the
|
||||
[ethers library](https://cdn.ethers.io/lib/ethers-5.0.esm.min.js) to
|
||||
your own webserver and serve it yourself.
|
||||
|
||||
For quick demos or prototyping though, it can be loaded in your
|
||||
Web Applications from our CDN.
|
||||
|
||||
_code: importing-browser.txt
|
||||
58
docs.wrm/hacking.wrm
Normal file
58
docs.wrm/hacking.wrm
Normal file
@@ -0,0 +1,58 @@
|
||||
_title: Hacking
|
||||
|
||||
_section: Hacking
|
||||
|
||||
Things to keep in mind:
|
||||
|
||||
|
||||
_heading: Supported Platforms
|
||||
|
||||
...
|
||||
|
||||
_heading: Dependencies
|
||||
|
||||
Adding a dependency is non-trivial and will require fairly convincing
|
||||
arguments.
|
||||
|
||||
Further, **ALL** dependencies for ethers, **must** be MIT licensed or
|
||||
public domain (CC0).
|
||||
|
||||
All contributions to ethers are then included under the MIT license.
|
||||
|
||||
|
||||
_heading: Printable ASCII (7-bit) Characters
|
||||
|
||||
All source and documentation files should ONLY use the printable ASCII
|
||||
set.
|
||||
|
||||
This is for several reasons, bu...
|
||||
|
||||
- Transmission over certain HTTP servers and proxies can mangle
|
||||
UTF-8 data
|
||||
- Certain editors on some platforms, or in certain terminals cannot
|
||||
handle UTF-8 characters elegantly
|
||||
- The ability to enter non-ASCII characters on some platforms require
|
||||
special keyboards, input devices or input methods to be installed,
|
||||
which either not be supported, or may require administrative
|
||||
priviledges.
|
||||
|
||||
|
||||
_heading: License
|
||||
|
||||
MIT...
|
||||
|
||||
|
||||
_heading: Other Considerations
|
||||
|
||||
A common argument to Pull Requests is that they are simple, backwards compatible
|
||||
and
|
||||
|
||||
It is important to remember that a small change is something that
|
||||
we are required to support in perpetuity.
|
||||
|
||||
For example, adding support for an obscure platform, such as adding a dot-file
|
||||
to the root of the package, now carries the implication that we will continue
|
||||
keeping that dot-file up-to-date as new versions of that platform are released.
|
||||
|
||||
|
||||
|
||||
2
docs.wrm/importing-browser.txt
Normal file
2
docs.wrm/importing-browser.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
<script src="https://cdn.ethers.io/lib/ethers-5.0.esm.min.js"
|
||||
type="application/javascipt"></script>
|
||||
5
docs.wrm/importing-node.source
Normal file
5
docs.wrm/importing-node.source
Normal file
@@ -0,0 +1,5 @@
|
||||
// CommonJS
|
||||
const { ethers } = require("ethers");
|
||||
|
||||
// ES6 or TypeScript
|
||||
const { ethers } = require("ethers");
|
||||
59
docs.wrm/index.wrm
Normal file
59
docs.wrm/index.wrm
Normal file
@@ -0,0 +1,59 @@
|
||||
_title: Documentation
|
||||
|
||||
_section: What is ethers?
|
||||
|
||||
The ethers.js library aims to be a complete and compact library for
|
||||
interacting with the Ethereum Blockchain and its ecosystem. It was
|
||||
originally designed for use with [ethers.io](https://ethers.io/) and
|
||||
has since expanded into a much more general-purpose library.
|
||||
|
||||
_subsection: Features
|
||||
|
||||
- Keep your private keys in your client, **safe** and sound
|
||||
- Import and export **JSON wallets** (Geth, Parity and crowdsale)
|
||||
- Import and export BIP 39 **mnemonic phrases** (12 word backup
|
||||
phrases) and HD Wallets (English, Italian, Japanese, Korean,
|
||||
Simplified Chinese, Traditional Chinese; more coming soon)
|
||||
- Meta-classes create JavaScript objects from any contract ABI,
|
||||
including **ABIv2** and **Human-Readable ABI**
|
||||
- Connect to Ethereum nodes over
|
||||
[JSON-RPC](https://github.com/ethereum/wiki/wiki/JSON-RPC),
|
||||
[INFURA](https://infura.io/),
|
||||
[Etherscan](https://etherscan.io/),
|
||||
[Nodesmith](https://nodesmith.io),
|
||||
[Alchemy](https://alchemyapi.io),
|
||||
or [MetaMask](https://metamask.io/).
|
||||
- **ENS names** are first-class citizens; they can be used
|
||||
anywhere an Ethereum addresses can be used
|
||||
- **Tiny** (~88kb compressed; 284kb uncompressed)
|
||||
- **Complete** functionality for all your Ethereum needs
|
||||
- Extensive [documentation](https://docs.ethers.io/)
|
||||
- Large collection of **test cases** which are maintained and added to
|
||||
- Fully **TypeScript** ready, with definition files and full
|
||||
TypeScript source
|
||||
- **MIT License** (including //ALL// dependencies); completely open
|
||||
source to do with as you please
|
||||
|
||||
|
||||
_subsection: Developer Documentation
|
||||
|
||||
_toc:
|
||||
|
||||
getting-started
|
||||
concepts
|
||||
api
|
||||
cookbook
|
||||
migration
|
||||
testing
|
||||
contributing
|
||||
documentation
|
||||
license
|
||||
|
||||
|
||||
_subsection: Legacy Documentation
|
||||
|
||||
This section will be kept up to date, linking to documentation of
|
||||
older versions of the library.
|
||||
|
||||
- [version 4.0](https://docs.ethers.io/ethers.js)
|
||||
- [version 3.0](https://docs.ethers.io/ethers.js/v3.0/html/)
|
||||
1
docs.wrm/installing.txt
Normal file
1
docs.wrm/installing.txt
Normal file
@@ -0,0 +1 @@
|
||||
/home/ricmoo> npm install --save ethers@next
|
||||
32
docs.wrm/license.wrm
Normal file
32
docs.wrm/license.wrm
Normal file
@@ -0,0 +1,32 @@
|
||||
_title: License and Copyright
|
||||
|
||||
|
||||
_section: License and Copyright
|
||||
|
||||
The ethers library (including all dependencies) are available
|
||||
under the [MIT License](https://en.m.wikipedia.org/wiki/MIT_License),
|
||||
which permits a wide variety of uses.
|
||||
|
||||
|
||||
_heading: MIT License
|
||||
|
||||
//Copyright © 2019 [Richard Moore](mailto:me@ricmoo.com).//
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
1782
docs.wrm/logo.ai
Normal file
1782
docs.wrm/logo.ai
Normal file
File diff suppressed because it is too large
Load Diff
12
docs.wrm/logo.svg
Normal file
12
docs.wrm/logo.svg
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 23.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 100 58" style="enable-background:new 0 0 100 58;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill-rule:evenodd;clip-rule:evenodd;fill:#FFFFFF;}
|
||||
</style>
|
||||
<path class="st0" d="M94.45,47.18c-42.62,5.57-73.04,12.26-73.49-15.2c0,0,0.93-10.64,13.98-11.31c0,0,0.44-9.45,10.41-10.52
|
||||
c5.36-0.58,11.45,4.94,12.11,10.75c0,0,13.19-2.44,13.76,10.42c0.2,4.48-0.81,12.1-13.53,11.77c0,0-7.36-1-8.36-12.38
|
||||
c-2.07,22.03,29.78,20.75,30.24,0.74c0.2-8.65-5.34-17.55-17.82-15.88C54.91-1.64,36.7-0.65,29.92,15.31
|
||||
c-9.69,0-17.1,7.46-16.99,17.2C13.3,63.86,56.93,54.41,94.45,47.18z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 853 B |
13
docs.wrm/migration/index.wrm
Normal file
13
docs.wrm/migration/index.wrm
Normal file
@@ -0,0 +1,13 @@
|
||||
_title: Migration Guide
|
||||
|
||||
_section: Migration Guide
|
||||
|
||||
Migratimg...
|
||||
|
||||
_subsection: From Web3
|
||||
|
||||
test
|
||||
|
||||
_subsection: From ethers v4
|
||||
|
||||
test
|
||||
5
docs.wrm/testing/index.wrm
Normal file
5
docs.wrm/testing/index.wrm
Normal file
@@ -0,0 +1,5 @@
|
||||
_title: Testing
|
||||
|
||||
_section: Testing
|
||||
|
||||
Here goes info about testing
|
||||
146
docs/README.md
Normal file
146
docs/README.md
Normal file
@@ -0,0 +1,146 @@
|
||||
-----
|
||||
|
||||
Documentation: [html](https://docs-beta.ethers.io/)
|
||||
|
||||
-----
|
||||
|
||||
|
||||
What is ethers?
|
||||
===============
|
||||
|
||||
|
||||
The ethers.js library aims to be a complete and compact library for
|
||||
interacting with the Ethereum Blockchain and its ecosystem. It was
|
||||
originally designed for use with [ethers.io](https://ethers.io/) and
|
||||
has since expanded into a much more general-purpose library.
|
||||
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
|
||||
|
||||
|
||||
* Keep your private keys in your client, **safe** and sound
|
||||
* Import and export **JSON wallets** (Geth, Parity and crowdsale)
|
||||
* Import and export BIP 39 **mnemonic phrases** (12 word backup phrases) and HD Wallets (English, Italian, Japanese, Korean, Simplified Chinese, Traditional Chinese; more coming soon)
|
||||
* Meta-classes create JavaScript objects from any contract ABI, including **ABIv2** and **Human-Readable ABI**
|
||||
* Connect to Ethereum nodes over [JSON-RPC](https://github.com/ethereum/wiki/wiki/JSON-RPC), [INFURA](https://infura.io/), [Etherscan](https://etherscan.io/), [Nodesmith](https://nodesmith.io), [Alchemy](https://alchemyapi.io), or [MetaMask](https://metamask.io/).
|
||||
* **ENS names** are first-class citizens; they can be used anywhere an Ethereum addresses can be used
|
||||
* **Tiny** (~88kb compressed; 284kb uncompressed)
|
||||
* **Complete** functionality for all your Ethereum needs
|
||||
* Extensive [documentation](https://docs.ethers.io/)
|
||||
* Large collection of **test cases** which are maintained and added to
|
||||
* Fully **TypeScript** ready, with definition files and full TypeScript source
|
||||
* **MIT License** (including *ALL* dependencies); completely open source to do with as you please
|
||||
|
||||
|
||||
Developer Documentation
|
||||
-----------------------
|
||||
|
||||
|
||||
|
||||
* [Getting Started](getting-started)
|
||||
* [Installing](getting-started)
|
||||
* [Importing](getting-started)
|
||||
* [Concepts](concepts)
|
||||
* [Events](concepts/events)
|
||||
* [Solidity Topics](concepts/events)
|
||||
* [Gas](concepts/gas)
|
||||
* [Gas Price](concepts/gas)
|
||||
* [Gas Limit](concepts/gas)
|
||||
* [Application Programming Interface](api)
|
||||
* [Contracts](api/contract)
|
||||
* [Buckets](api/contract)
|
||||
* [Signers](api/signer)
|
||||
* [Signer](api/signer)
|
||||
* [Wallet inherits Signer](api/signer)
|
||||
* [Providers](api/providers)
|
||||
* [Provider](api/providers/provider)
|
||||
* [Accounts Methods](api/providers/provider)
|
||||
* [Blocks Methods](api/providers/provider)
|
||||
* [Ethereum Naming Service (ENS) Methods](api/providers/provider)
|
||||
* [Logs Methods](api/providers/provider)
|
||||
* [Network Status Methods](api/providers/provider)
|
||||
* [Transactions Methods](api/providers/provider)
|
||||
* [Event Emitter Methods](api/providers/provider)
|
||||
* [Inspection Methods](api/providers/provider)
|
||||
* [JSON-RPC Provider](api/providers/jsonrpc-provider)
|
||||
* [JsonRpcProvider](api/providers/jsonrpc-provider)
|
||||
* [JsonRpcSigner](api/providers/jsonrpc-provider)
|
||||
* [JsonRpcUncheckedSigner](api/providers/jsonrpc-provider)
|
||||
* [API Providers](api/providers/api-providers)
|
||||
* [EtherscanProvider](api/providers/api-providers)
|
||||
* [InfuraProvider](api/providers/api-providers)
|
||||
* [NodesmithProvider](api/providers/api-providers)
|
||||
* [AlchemyProvider](api/providers/api-providers)
|
||||
* [CloudfrontProvider](api/providers/api-providers)
|
||||
* [Other Providers](api/providers/other)
|
||||
* [FallbackProvider](api/providers/other)
|
||||
* [IpcProvider](api/providers/other)
|
||||
* [Types](api/providers/types)
|
||||
* [Blocks](api/providers/types)
|
||||
* [Events and Logs](api/providers/types)
|
||||
* [Transactions](api/providers/types)
|
||||
* [Utilities](api/utils)
|
||||
* [Addresses](api/utils/address)
|
||||
* [BigNumber](api/utils/bignumber)
|
||||
* [Types](api/utils/bignumber)
|
||||
* [Creating Instances](api/utils/bignumber)
|
||||
* [Methods](api/utils/bignumber)
|
||||
* [Notes](api/utils/bignumber)
|
||||
* [Byte Manipulation](api/utils/bytes)
|
||||
* [Types](api/utils/bytes)
|
||||
* [Inspection](api/utils/bytes)
|
||||
* [Converting between Arrays and Hexstrings](api/utils/bytes)
|
||||
* [Array Manipulation](api/utils/bytes)
|
||||
* [Hexstring Manipulation](api/utils/bytes)
|
||||
* [Signature Conversion](api/utils/bytes)
|
||||
* [Constants](api/utils/constants)
|
||||
* [Bytes](api/utils/constants)
|
||||
* [Strings](api/utils/constants)
|
||||
* [BigNumber](api/utils/constants)
|
||||
* [Display Logic and Input](api/utils/display-logic)
|
||||
* [Units](api/utils/display-logic)
|
||||
* [Functions](api/utils/display-logic)
|
||||
* [FixedNumber](api/utils/fixednumber)
|
||||
* [Types](api/utils/fixednumber)
|
||||
* [Creating Instances](api/utils/fixednumber)
|
||||
* [Properties](api/utils/fixednumber)
|
||||
* [Methods](api/utils/fixednumber)
|
||||
* [Hashing Algorithms](api/utils/hashing)
|
||||
* [Cryptographic Hashing](api/utils/hashing)
|
||||
* [Common Hashing Helpers](api/utils/hashing)
|
||||
* [Solidity Hashing Algorithms](api/utils/hashing)
|
||||
* [Strings](api/utils/strings)
|
||||
* [Bytes32String](api/utils/strings)
|
||||
* [UTF-8 Strings](api/utils/strings)
|
||||
* [Cookbook](cookbook)
|
||||
* [Migration Guide](migration)
|
||||
* [From Web3](migration)
|
||||
* [From ethers v4](migration)
|
||||
* [Testing](testing)
|
||||
* [Contributing and Hacking](contributing)
|
||||
* [Building](contributing)
|
||||
* [Flatworm Docs](documentation)
|
||||
* [Fragments](documentation)
|
||||
* [Markdown](documentation)
|
||||
* [License and Copyright](license)
|
||||
|
||||
|
||||
Legacy Documentation
|
||||
--------------------
|
||||
|
||||
|
||||
This section will be kept up to date, linking to documentation of
|
||||
older versions of the library.
|
||||
|
||||
|
||||
|
||||
* [version 4.0](https://docs.ethers.io/ethers.js)
|
||||
* [version 3.0](https://docs.ethers.io/ethers.js/v3.0/html/)
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** f1da4df3feeb06a567657ae41d8498ea3315f68d05dc2f9e86c2858b5d2b2f89
|
||||
84
docs/api/README.md
Normal file
84
docs/api/README.md
Normal file
@@ -0,0 +1,84 @@
|
||||
-----
|
||||
|
||||
Documentation: [html](https://docs-beta.ethers.io/)
|
||||
|
||||
-----
|
||||
|
||||
|
||||
Application Programming Interface (API)
|
||||
=======================================
|
||||
|
||||
|
||||
Here...
|
||||
|
||||
|
||||
* [Contracts](contract)
|
||||
* [Buckets](contract)
|
||||
* [Signers](signer)
|
||||
* [Signer](signer)
|
||||
* [Wallet inherits Signer](signer)
|
||||
* [Providers](providers)
|
||||
* [Provider](providers/provider)
|
||||
* [Accounts Methods](providers/provider)
|
||||
* [Blocks Methods](providers/provider)
|
||||
* [Ethereum Naming Service (ENS) Methods](providers/provider)
|
||||
* [Logs Methods](providers/provider)
|
||||
* [Network Status Methods](providers/provider)
|
||||
* [Transactions Methods](providers/provider)
|
||||
* [Event Emitter Methods](providers/provider)
|
||||
* [Inspection Methods](providers/provider)
|
||||
* [JSON-RPC Provider](providers/jsonrpc-provider)
|
||||
* [JsonRpcProvider](providers/jsonrpc-provider)
|
||||
* [JsonRpcSigner](providers/jsonrpc-provider)
|
||||
* [JsonRpcUncheckedSigner](providers/jsonrpc-provider)
|
||||
* [API Providers](providers/api-providers)
|
||||
* [EtherscanProvider](providers/api-providers)
|
||||
* [InfuraProvider](providers/api-providers)
|
||||
* [NodesmithProvider](providers/api-providers)
|
||||
* [AlchemyProvider](providers/api-providers)
|
||||
* [CloudfrontProvider](providers/api-providers)
|
||||
* [Other Providers](providers/other)
|
||||
* [FallbackProvider](providers/other)
|
||||
* [IpcProvider](providers/other)
|
||||
* [Types](providers/types)
|
||||
* [Blocks](providers/types)
|
||||
* [Events and Logs](providers/types)
|
||||
* [Transactions](providers/types)
|
||||
* [Utilities](utils)
|
||||
* [Addresses](utils/address)
|
||||
* [BigNumber](utils/bignumber)
|
||||
* [Types](utils/bignumber)
|
||||
* [Creating Instances](utils/bignumber)
|
||||
* [Methods](utils/bignumber)
|
||||
* [Notes](utils/bignumber)
|
||||
* [Byte Manipulation](utils/bytes)
|
||||
* [Types](utils/bytes)
|
||||
* [Inspection](utils/bytes)
|
||||
* [Converting between Arrays and Hexstrings](utils/bytes)
|
||||
* [Array Manipulation](utils/bytes)
|
||||
* [Hexstring Manipulation](utils/bytes)
|
||||
* [Signature Conversion](utils/bytes)
|
||||
* [Constants](utils/constants)
|
||||
* [Bytes](utils/constants)
|
||||
* [Strings](utils/constants)
|
||||
* [BigNumber](utils/constants)
|
||||
* [Display Logic and Input](utils/display-logic)
|
||||
* [Units](utils/display-logic)
|
||||
* [Functions](utils/display-logic)
|
||||
* [FixedNumber](utils/fixednumber)
|
||||
* [Types](utils/fixednumber)
|
||||
* [Creating Instances](utils/fixednumber)
|
||||
* [Properties](utils/fixednumber)
|
||||
* [Methods](utils/fixednumber)
|
||||
* [Hashing Algorithms](utils/hashing)
|
||||
* [Cryptographic Hashing](utils/hashing)
|
||||
* [Common Hashing Helpers](utils/hashing)
|
||||
* [Solidity Hashing Algorithms](utils/hashing)
|
||||
* [Strings](utils/strings)
|
||||
* [Bytes32String](utils/strings)
|
||||
* [UTF-8 Strings](utils/strings)
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** 82f760f38f47d32016d3fca512c5dc75539d885d13138f1faa15f4be82edf8aa
|
||||
23
docs/api/contract/README.md
Normal file
23
docs/api/contract/README.md
Normal file
@@ -0,0 +1,23 @@
|
||||
-----
|
||||
|
||||
Documentation: [html](https://docs-beta.ethers.io/)
|
||||
|
||||
-----
|
||||
|
||||
|
||||
|
||||
Contracts
|
||||
=========
|
||||
|
||||
|
||||
Explain what contracts are...
|
||||
|
||||
|
||||
Buckets
|
||||
-------
|
||||
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** 190c93691014eae64ffcb66549f127aa73f4645fc7a4b3a2be9ae00216c79cf6
|
||||
6
docs/api/contract/index.html
Normal file
6
docs/api/contract/index.html
Normal file
File diff suppressed because one or more lines are too long
4
docs/api/index.html
Normal file
4
docs/api/index.html
Normal file
File diff suppressed because one or more lines are too long
88
docs/api/providers/README.md
Normal file
88
docs/api/providers/README.md
Normal file
@@ -0,0 +1,88 @@
|
||||
-----
|
||||
|
||||
Documentation: [html](https://docs-beta.ethers.io/)
|
||||
|
||||
-----
|
||||
|
||||
|
||||
Providers
|
||||
=========
|
||||
|
||||
|
||||
A **Provider** is an abstraction of a connection to the
|
||||
Ethereum network, providing a concise, consistent interface
|
||||
to standard Ethereum node functionality.
|
||||
|
||||
The ethers.js library provides several options which should
|
||||
cover the vast majority of use-cases, but also includes the
|
||||
necessary functions and classes for sub-classing if a more
|
||||
custom configuration is necessary.
|
||||
|
||||
Most users should be able to simply use the [Default Provider](./).
|
||||
|
||||
|
||||
Default Provider
|
||||
----------------
|
||||
|
||||
|
||||
The default provider is the safest, easiest way to begin
|
||||
developing on *Ethereum*, and it is also robust enough
|
||||
for use in production.
|
||||
|
||||
It creates a [FallbackProvider](other) connected to as many backend
|
||||
services as possible. When a request is made, it is sent to
|
||||
multiple backends simulatenously. As responses from each backend
|
||||
are returned, they are checked that they agree. Once a quorum
|
||||
has been reached (i.e. enough of the backends agree), the response
|
||||
is provided to your application.
|
||||
|
||||
This ensures that if a backend has become out-of-sync, or if it
|
||||
has been compromised that its responses are dropped in favor of
|
||||
responses that match the majority.
|
||||
|
||||
|
||||
#### *ethers* . **getDefaultProvider** ( [ network ] ) **=>** *[Provider](provider)*
|
||||
|
||||
Returns a new Provider, backed by multiple services, connected
|
||||
to *network*. Is no *network* is provided, **homestead**
|
||||
(i.e. mainnet) is used.
|
||||
|
||||
|
||||
|
||||
|
||||
Provider Documentation
|
||||
----------------------
|
||||
|
||||
|
||||
|
||||
* [Provider](provider)
|
||||
* [Accounts Methods](provider)
|
||||
* [Blocks Methods](provider)
|
||||
* [Ethereum Naming Service (ENS) Methods](provider)
|
||||
* [Logs Methods](provider)
|
||||
* [Network Status Methods](provider)
|
||||
* [Transactions Methods](provider)
|
||||
* [Event Emitter Methods](provider)
|
||||
* [Inspection Methods](provider)
|
||||
* [JSON-RPC Provider](jsonrpc-provider)
|
||||
* [JsonRpcProvider](jsonrpc-provider)
|
||||
* [JsonRpcSigner](jsonrpc-provider)
|
||||
* [JsonRpcUncheckedSigner](jsonrpc-provider)
|
||||
* [API Providers](api-providers)
|
||||
* [EtherscanProvider](api-providers)
|
||||
* [InfuraProvider](api-providers)
|
||||
* [NodesmithProvider](api-providers)
|
||||
* [AlchemyProvider](api-providers)
|
||||
* [CloudfrontProvider](api-providers)
|
||||
* [Other Providers](other)
|
||||
* [FallbackProvider](other)
|
||||
* [IpcProvider](other)
|
||||
* [Types](types)
|
||||
* [Blocks](types)
|
||||
* [Events and Logs](types)
|
||||
* [Transactions](types)
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** 4bae65aa1521a7ecf045f950c9a702ad597d83095d079e66a5abbd327373877c
|
||||
81
docs/api/providers/api-providers/README.md
Normal file
81
docs/api/providers/api-providers/README.md
Normal file
@@ -0,0 +1,81 @@
|
||||
-----
|
||||
|
||||
Documentation: [html](https://docs-beta.ethers.io/)
|
||||
|
||||
-----
|
||||
|
||||
|
||||
API Providers
|
||||
=============
|
||||
|
||||
|
||||
There are many services which offer a web API for accessing
|
||||
the Ethereum Blockchain. These Providers allow connecting
|
||||
to them, which simplifies development, since you do not need
|
||||
to run your own instance or cluster of Ethereum nodes.
|
||||
|
||||
However, this reliance on third-party services can reduce
|
||||
resiliance, security and increase the amount of required trust.
|
||||
To mitigate these issues, it is recommended you use a
|
||||
[Default Provider](..).
|
||||
|
||||
|
||||
EtherscanProvider
|
||||
-----------------
|
||||
|
||||
|
||||
The **EtherscanProvider** is backed by a combination of the various
|
||||
[Etherscan APIs](https://etherscan.io/apis).
|
||||
|
||||
|
||||
#### *provider* . **getHistory** ( address ) **=>** *Array< History >*
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
InfuraProvider
|
||||
--------------
|
||||
|
||||
|
||||
The **InfuraProvider** is backed by the popular [INFURA](https://infura.io)
|
||||
Ethereum service.
|
||||
|
||||
It supports Mainnet (homestead) and all common testnets (Ropsten, Rinkeby,
|
||||
Görli and Kovan).
|
||||
|
||||
|
||||
NodesmithProvider
|
||||
-----------------
|
||||
|
||||
|
||||
The **NodesmithProvider** is backed by [Nodesmith](https://nodesmith.io).
|
||||
|
||||
It supports Mainnet (homestead) and all common testnets (Ropsten, Rinkeby,
|
||||
Görli and Kovan), as well as the Ethereum-like network [Aion](https://aion.network).
|
||||
|
||||
|
||||
AlchemyProvider
|
||||
---------------
|
||||
|
||||
|
||||
The **AlchemtProvider** is backed by [Alchemy](https://alchemyapi.io).
|
||||
|
||||
It supports Mainnet (homestead) and all common testnets (Ropsten, Rinkeby,
|
||||
Görli and Kovan).
|
||||
|
||||
|
||||
CloudfrontProvider
|
||||
------------------
|
||||
|
||||
|
||||
The CloudfrontProvider is backed by the
|
||||
[Cloudflare Ethereum Gateway](https://developers.cloudflare.com/distributed-web/ethereum-gateway/).
|
||||
|
||||
It only supports Mainnet (homestead).
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** 2e1dfa80bd4ab1ba02610654b00ee4250a89758a496670822e7950d5db449b1c
|
||||
14
docs/api/providers/api-providers/index.html
Normal file
14
docs/api/providers/api-providers/index.html
Normal file
File diff suppressed because one or more lines are too long
9
docs/api/providers/index.html
Normal file
9
docs/api/providers/index.html
Normal file
File diff suppressed because one or more lines are too long
54
docs/api/providers/jsonrpc-provider/README.md
Normal file
54
docs/api/providers/jsonrpc-provider/README.md
Normal file
@@ -0,0 +1,54 @@
|
||||
-----
|
||||
|
||||
Documentation: [html](https://docs-beta.ethers.io/)
|
||||
|
||||
-----
|
||||
|
||||
|
||||
JSON-RPC Provider
|
||||
=================
|
||||
|
||||
|
||||
Explain here...
|
||||
|
||||
|
||||
JsonRpcProvider
|
||||
---------------
|
||||
|
||||
|
||||
TODO...
|
||||
|
||||
|
||||
#### *provider* . **getSigner** ( [ addressOrIndex ] ) **=>** *[JsonRpcSigner](./)*
|
||||
|
||||
Returns a [JsonRpcSigner](./) which is managed by this Ethereum node, at
|
||||
*addressOrIndex*. If no *addressOrIndex* is provided, the first
|
||||
account (account #0) is used.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *provider* . **getUncheckSigner** ( [ addressOrIndex ] ) **=>** *[JsonRpcUncheckedSigner](./)*
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
JsonRpcSigner
|
||||
-------------
|
||||
|
||||
|
||||
TODO... Explain
|
||||
|
||||
|
||||
JsonRpcUncheckedSigner
|
||||
----------------------
|
||||
|
||||
|
||||
TODO... Explain
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** 09091214806fa2270a7425521fd948901355db2ec3406597fb5e29141b40639b
|
||||
11
docs/api/providers/jsonrpc-provider/index.html
Normal file
11
docs/api/providers/jsonrpc-provider/index.html
Normal file
File diff suppressed because one or more lines are too long
57
docs/api/providers/other/README.md
Normal file
57
docs/api/providers/other/README.md
Normal file
@@ -0,0 +1,57 @@
|
||||
-----
|
||||
|
||||
Documentation: [html](https://docs-beta.ethers.io/)
|
||||
|
||||
-----
|
||||
|
||||
|
||||
Other Providers
|
||||
===============
|
||||
|
||||
|
||||
Others...
|
||||
|
||||
|
||||
FallbackProvider
|
||||
----------------
|
||||
|
||||
|
||||
Explain...
|
||||
|
||||
|
||||
### Properties
|
||||
|
||||
|
||||
|
||||
#### *provider* . **providers** **=>** *Array< [Provider](../provider) >*
|
||||
|
||||
The list of Providers this is connected to.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *provider* . **quorum** **=>** *number*
|
||||
|
||||
The quorum the backend responses must agree upon before a result will be
|
||||
resolved. By default this is *half the sum of the weights*.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *provider* . **weights** **=>** *Array< number >*
|
||||
|
||||
The weight each of the Providers adds to a results acceptance.
|
||||
|
||||
|
||||
|
||||
|
||||
IpcProvider
|
||||
-----------
|
||||
|
||||
|
||||
Explain...
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** c950a8710b679e9061aa834f8b0366614dcb031270627249acb412813bb5ca94
|
||||
12
docs/api/providers/other/index.html
Normal file
12
docs/api/providers/other/index.html
Normal file
File diff suppressed because one or more lines are too long
276
docs/api/providers/provider/README.md
Normal file
276
docs/api/providers/provider/README.md
Normal file
@@ -0,0 +1,276 @@
|
||||
-----
|
||||
|
||||
Documentation: [html](https://docs-beta.ethers.io/)
|
||||
|
||||
-----
|
||||
|
||||
|
||||
Provider
|
||||
========
|
||||
|
||||
|
||||
Explain what a provider is...
|
||||
|
||||
|
||||
Accounts Methods
|
||||
----------------
|
||||
|
||||
|
||||
|
||||
#### *provider* . **getBalance** ( address [ , blockTag="latest" ] ) **=>** *Promise< [BigNumber](../../utils/bignumber) >*
|
||||
|
||||
Returns the balance of *address* as of the *blockTag* block height.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *provider* . **getCode** ( address [ , blockTag="latest" ] ) **=>** *Promise< [Hexstring](../../utils/bytes) >*
|
||||
|
||||
Returns the contract code of *address* as of the *blockTag* block height. If there is
|
||||
no contract currently deployed, the result is `0x`.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *provider* . **getStorageAt** ( address , position [ , blockTag="latest" ] ) **=>** *Promise< [Hexstring](../../utils/bytes) >*
|
||||
|
||||
Returns the `Bytes32` value of the *position* at *address*, as of the *blockTag*.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *provider* . **getTransactionCount** ( address [ , blockTag="latest" ] ) **=>** *Promise< number >*
|
||||
|
||||
Returns the number of transactions *address* has ever **sent**, as of *blockTag*.
|
||||
This value is required to be the nonce for the next transaction from *address*
|
||||
sent to the network.
|
||||
|
||||
|
||||
|
||||
|
||||
### Examples
|
||||
|
||||
|
||||
|
||||
```javascript
|
||||
Skipping JavaScript Evaluation.
|
||||
```
|
||||
|
||||
|
||||
|
||||
Blocks Methods
|
||||
--------------
|
||||
|
||||
|
||||
|
||||
#### *provider* . **getBlock** ( block ) **=>** *Promise< [Block](../types) >*
|
||||
|
||||
Get the *block* from the network, where the `result.transactions` is a list
|
||||
of transaction hashes.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *provider* . **getBlockWithTransactions** ( block ) **=>** *Promise< [BlockWithTransactions](../types) >*
|
||||
|
||||
Get the *block* from the network, where the `result.transactions` is
|
||||
an Array of [TransactionResponse](../types) objects.
|
||||
|
||||
|
||||
|
||||
|
||||
Ethereum Naming Service (ENS) Methods
|
||||
-------------------------------------
|
||||
|
||||
|
||||
TODO: Explain ENS here...
|
||||
|
||||
|
||||
#### *provider* . **lookupAddress** ( address ) **=>** *Promise< string >*
|
||||
|
||||
Performs a reverse lookup of the *address* in ENS using the
|
||||
*Reverse Registrar*. If the name does not exist, or the
|
||||
forward lookup does not match, `null` is returned.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *provider* . **resovleName** ( name ) **=>** *Promise< string >*
|
||||
|
||||
Looks up the address of *name*. If the name is not owned, or
|
||||
does not have a *Resolver* configured, or the *Resolver* does
|
||||
not have an address configured, `null` is returned.
|
||||
|
||||
|
||||
|
||||
|
||||
### Examples
|
||||
|
||||
|
||||
|
||||
```javascript
|
||||
Skipping JavaScript Evaluation.
|
||||
```
|
||||
|
||||
|
||||
|
||||
Logs Methods
|
||||
------------
|
||||
|
||||
|
||||
|
||||
#### *provider* . **getLogs** ( filter ) **=>** *Promise< Array< [Log](../types) > >*
|
||||
|
||||
Returns the Array of [Log](../types) matching the *filter*.
|
||||
|
||||
Keep in mind that many backends will discard old events, and that requests
|
||||
which are too broad may get dropped as they require too many resources to
|
||||
execute the query.
|
||||
|
||||
|
||||
|
||||
|
||||
Network Status Methods
|
||||
----------------------
|
||||
|
||||
|
||||
|
||||
#### *provider* . **getNetwork** ( ) **=>** *Promise< [Network](../types) >*
|
||||
|
||||
Returns the [Network](../types) this Provider is connected to.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *provider* . **getBlockNumber** ( ) **=>** *Promise< number >*
|
||||
|
||||
Returns the block number (or height) of the most recently mined block.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *provider* . **getGasPrice** ( ) **=>** *Promise< [BigNumber](../../utils/bignumber) >*
|
||||
|
||||
Returns a *best guess* of the [Gas Price](../../../concepts/gas) to use in a transaction.
|
||||
|
||||
|
||||
|
||||
|
||||
Transactions Methods
|
||||
--------------------
|
||||
|
||||
|
||||
|
||||
#### *provider* . **call** ( transaction [ , blockTag="latest" ] ) **=>** *Promise< [Hexstring](../../utils/bytes) >*
|
||||
|
||||
Returns the result of executing the *transaction*, using *call*. A call
|
||||
does not require any ether, but cannot change any state. This is useful
|
||||
for calling gettings on Contracts.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *provider* . **estimateGas** ( transaction ) **=>** *Promise< [BigNumber](../../utils/bignumber) >*
|
||||
|
||||
Returns an estimate of the amount of gas that would be required to submit *transaction*
|
||||
to the network.
|
||||
|
||||
An estimate may not be accurate since there could be another transaction
|
||||
on the network that was not accounted for, but after being mined affected
|
||||
relevant state.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *provider* . **sendTransaction** ( transaction ) **=>** *Promise< [TransactionResponse](../types) >*
|
||||
|
||||
Submits *transaction* to the network to be mined. The *transaction* **must** be signed,
|
||||
and be valid (i.e. the nonce is correct and the account has sufficient balance to pay
|
||||
for the transaction).
|
||||
|
||||
|
||||
|
||||
|
||||
#### *provider* . **waitForTransaction** ( transactionHash ) **=>** *Promise< [TransactionReceipt](../types) >*
|
||||
|
||||
Returns a Promise which will not resolve until *transactionHash* is mined.
|
||||
|
||||
|
||||
|
||||
|
||||
Event Emitter Methods
|
||||
---------------------
|
||||
|
||||
|
||||
Explain events here...
|
||||
|
||||
|
||||
#### *provider* . **on** ( eventName , listener ) **=>** *this*
|
||||
|
||||
Add a *listener* to be triggered for each *eventName*.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *provider* . **once** ( eventName , listener ) **=>** *this*
|
||||
|
||||
Add a *listener* to be triggered for only the next *eventName*,
|
||||
at which time it be removed.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *provider* . **emit** ( eventName , ...args ) **=>** *boolean*
|
||||
|
||||
Notify all listeners of *eventName*, passing *args* to each listener. This
|
||||
is generally only used internally.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *provider* . **off** ( eventName [ , listener ] ) **=>** *this*
|
||||
|
||||
Remove a *listener* for *eventName*. If no *listener* is provided,
|
||||
all listeners for *eventName* are removed.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *provider* . **removeAllListeners** ( [ eventName ] ) **=>** *this*
|
||||
|
||||
Remove all the listeners for *eventName*. If no *eventName* is provided,
|
||||
**all** events are removed.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *provider* . **listenerCount** ( [ eventName ] ) **=>** *number*
|
||||
|
||||
Returns the number of listeners for *eventName*. If no *eventName* is
|
||||
provided, the total number of listeners is returned.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *provider* . **listeners** ( eventName ) **=>** *Array< Listener >*
|
||||
|
||||
Returns the list of Listeners for *eventName*.
|
||||
|
||||
|
||||
|
||||
|
||||
Inspection Methods
|
||||
------------------
|
||||
|
||||
|
||||
|
||||
#### *Provider* . **isProvider** ( object ) **=>** *boolean*
|
||||
|
||||
Returns true if and only if *object* is a Provider.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** 95fe0eed62718e6b1f1836b94380b8dd580d48931b261723c8100531c1f570c2
|
||||
51
docs/api/providers/provider/index.html
Normal file
51
docs/api/providers/provider/index.html
Normal file
File diff suppressed because one or more lines are too long
131
docs/api/providers/types/README.md
Normal file
131
docs/api/providers/types/README.md
Normal file
@@ -0,0 +1,131 @@
|
||||
-----
|
||||
|
||||
Documentation: [html](https://docs-beta.ethers.io/)
|
||||
|
||||
-----
|
||||
|
||||
|
||||
Types
|
||||
=====
|
||||
|
||||
|
||||
|
||||
### BlockTag
|
||||
|
||||
|
||||
A **BlockTag** specifies a specific location in the Blockchain.
|
||||
|
||||
|
||||
|
||||
* **`"latest"`** -- The most recently mined block
|
||||
* **`"earliest"`** -- Block #0
|
||||
* **`"pending"`** -- The block currently being prepared for mining; not all operations support this BlockTag
|
||||
* ***number*** -- The block at this height
|
||||
* ***a negative number*** -- The block this many blocks ago
|
||||
|
||||
|
||||
### Network
|
||||
|
||||
|
||||
A **Network** represents an Etherem network.
|
||||
|
||||
|
||||
|
||||
* **name** -- The human-readable name of the network
|
||||
* **chainId** -- The Chain ID of the network
|
||||
* **ensAddress** -- The address at which the ENS registry is deployed
|
||||
|
||||
|
||||
Blocks
|
||||
------
|
||||
|
||||
|
||||
|
||||
### Block
|
||||
|
||||
|
||||
TODO
|
||||
|
||||
|
||||
### BlockWithTransactions
|
||||
|
||||
|
||||
TODO
|
||||
|
||||
|
||||
Events and Logs
|
||||
---------------
|
||||
|
||||
|
||||
|
||||
### EventFilter
|
||||
|
||||
|
||||
TODO
|
||||
|
||||
|
||||
### EventType
|
||||
|
||||
|
||||
TODO
|
||||
|
||||
|
||||
### Filter
|
||||
|
||||
|
||||
TODO
|
||||
|
||||
|
||||
### FilterByBlockHash
|
||||
|
||||
|
||||
TODO
|
||||
|
||||
|
||||
### Log
|
||||
|
||||
|
||||
A network...
|
||||
|
||||
|
||||
Transactions
|
||||
------------
|
||||
|
||||
|
||||
|
||||
### TransactionRequest
|
||||
|
||||
|
||||
A transaction request describes a transaction that is to
|
||||
be sent to the network or otherwise processed.
|
||||
|
||||
It contains the fields:
|
||||
|
||||
* **to** --- target address
|
||||
* **from** --- target address
|
||||
* **nonce** --- target address
|
||||
* **gasLimit** --- target address
|
||||
* **gasPrice** --- target address
|
||||
* **data** --- target address
|
||||
* **value** --- target address
|
||||
* **chainId** --- target address
|
||||
|
||||
All fields are optional and may be a promise which resolves
|
||||
to the required type.
|
||||
|
||||
|
||||
### TransactionResponse
|
||||
|
||||
|
||||
A **TransactionResponse** ..
|
||||
|
||||
|
||||
### TransactionReceipt
|
||||
|
||||
|
||||
TODO
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** f6d5ea85b1ddef3a5b5bc0745984620507c001cf7d898c7842e006ddcd2b056b
|
||||
33
docs/api/providers/types/index.html
Normal file
33
docs/api/providers/types/index.html
Normal file
File diff suppressed because one or more lines are too long
73
docs/api/signer/README.md
Normal file
73
docs/api/signer/README.md
Normal file
@@ -0,0 +1,73 @@
|
||||
-----
|
||||
|
||||
Documentation: [html](https://docs-beta.ethers.io/)
|
||||
|
||||
-----
|
||||
|
||||
|
||||
Signers
|
||||
=======
|
||||
|
||||
|
||||
Tra la la...
|
||||
|
||||
|
||||
Signer
|
||||
------
|
||||
|
||||
|
||||
|
||||
#### *signer* . **connect** ( provider ) **=>** *[Signer](./)*
|
||||
|
||||
TODO
|
||||
|
||||
|
||||
|
||||
|
||||
### Blockchain Methods
|
||||
|
||||
|
||||
|
||||
#### *signer* . **getBalance** ( [ blockTag="latest" ] ) **=>** *Promise< [BigNumber](../utils/bignumber) >*
|
||||
|
||||
TODO
|
||||
|
||||
|
||||
|
||||
|
||||
#### *signer* . **getTransactionCount** ( [ blockTag="latest" ] ) **=>** *Promise< number >*
|
||||
|
||||
TODO
|
||||
|
||||
|
||||
|
||||
|
||||
Wallet inherits Signer
|
||||
----------------------
|
||||
|
||||
|
||||
The Wallet class inherits [Signer](./) and can sign transactions and messages
|
||||
using a private key as a standard Externally Owned Account (EOA).
|
||||
|
||||
|
||||
### Creating an Instance
|
||||
|
||||
|
||||
|
||||
#### **new** *ethers* . **Wallet** ( privateKey [ , provider ] )
|
||||
|
||||
TODO
|
||||
|
||||
|
||||
|
||||
|
||||
#### *Wallet* . **fromEncryptedJson** ( json , password )
|
||||
|
||||
TODO
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** 62c0d9640e683e41970dc1c779bd3b59ed08c27d99e15f6b51e7bae31ac1975e
|
||||
16
docs/api/signer/index.html
Normal file
16
docs/api/signer/index.html
Normal file
File diff suppressed because one or more lines are too long
52
docs/api/utils/README.md
Normal file
52
docs/api/utils/README.md
Normal file
@@ -0,0 +1,52 @@
|
||||
-----
|
||||
|
||||
Documentation: [html](https://docs-beta.ethers.io/)
|
||||
|
||||
-----
|
||||
|
||||
|
||||
Utilities
|
||||
=========
|
||||
|
||||
|
||||
These utilities are used extensively within the library, but
|
||||
are also quite useful for application developers.
|
||||
|
||||
|
||||
* [Addresses](address)
|
||||
* [BigNumber](bignumber)
|
||||
* [Types](bignumber)
|
||||
* [Creating Instances](bignumber)
|
||||
* [Methods](bignumber)
|
||||
* [Notes](bignumber)
|
||||
* [Byte Manipulation](bytes)
|
||||
* [Types](bytes)
|
||||
* [Inspection](bytes)
|
||||
* [Converting between Arrays and Hexstrings](bytes)
|
||||
* [Array Manipulation](bytes)
|
||||
* [Hexstring Manipulation](bytes)
|
||||
* [Signature Conversion](bytes)
|
||||
* [Constants](constants)
|
||||
* [Bytes](constants)
|
||||
* [Strings](constants)
|
||||
* [BigNumber](constants)
|
||||
* [Display Logic and Input](display-logic)
|
||||
* [Units](display-logic)
|
||||
* [Functions](display-logic)
|
||||
* [FixedNumber](fixednumber)
|
||||
* [Types](fixednumber)
|
||||
* [Creating Instances](fixednumber)
|
||||
* [Properties](fixednumber)
|
||||
* [Methods](fixednumber)
|
||||
* [Hashing Algorithms](hashing)
|
||||
* [Cryptographic Hashing](hashing)
|
||||
* [Common Hashing Helpers](hashing)
|
||||
* [Solidity Hashing Algorithms](hashing)
|
||||
* [Strings](strings)
|
||||
* [Bytes32String](strings)
|
||||
* [UTF-8 Strings](strings)
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** ae9deb0419f2da1644ae9588d27ecc475961b741fa9d7b27b2cf13ddf62d50b6
|
||||
58
docs/api/utils/address/README.md
Normal file
58
docs/api/utils/address/README.md
Normal file
@@ -0,0 +1,58 @@
|
||||
-----
|
||||
|
||||
Documentation: [html](https://docs-beta.ethers.io/)
|
||||
|
||||
-----
|
||||
|
||||
|
||||
Addresses
|
||||
=========
|
||||
|
||||
|
||||
Explain addresses,formats and checksumming here.
|
||||
|
||||
Also see: [constants.AddressZero](../constants)
|
||||
|
||||
|
||||
### Functions
|
||||
|
||||
|
||||
|
||||
#### *utils* . **getAddress** ( address ) **=>** *string*
|
||||
|
||||
Returns *address* as a Checksum Address.
|
||||
|
||||
If *address* is an invalid 40-nibble [Hexstring](../bytes) or if it contains mixed case and
|
||||
the checksum is invalid, an InvalidArgument Error is throw.
|
||||
|
||||
The value of *address* may be any supported address format.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . **isAddress** ( address ) **=>** *boolean*
|
||||
|
||||
Returns true if *address* is valid (in any supported format).
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . **getIcapAddress** ( address ) **=>** *string*
|
||||
|
||||
Returns *address* as an ICAP address. Supports the same restrictions as
|
||||
[utils.getAddress](./).
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . **getContractAddress** ( transaction ) **=>** *string*
|
||||
|
||||
Returns the contract address that would result if *transaction* was
|
||||
used to deploy a contract.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** 2dd561245955594d7080796077503064181258304572112d320139ae2594f383
|
||||
9
docs/api/utils/address/index.html
Normal file
9
docs/api/utils/address/index.html
Normal file
File diff suppressed because one or more lines are too long
347
docs/api/utils/bignumber/README.md
Normal file
347
docs/api/utils/bignumber/README.md
Normal file
@@ -0,0 +1,347 @@
|
||||
-----
|
||||
|
||||
Documentation: [html](https://docs-beta.ethers.io/)
|
||||
|
||||
-----
|
||||
|
||||
|
||||
BigNumber
|
||||
=========
|
||||
|
||||
|
||||
Explain about BigNumber here...
|
||||
|
||||
|
||||
### Importing
|
||||
|
||||
|
||||
|
||||
```
|
||||
/////
|
||||
// CommonJS:
|
||||
|
||||
// From the Umbrella ethers package...
|
||||
const { BigNumber } = require("ethers");
|
||||
|
||||
// From the bignumber pacakge...
|
||||
const { BigNumber } = require("@ethersproject/bignumber");
|
||||
|
||||
|
||||
/////
|
||||
// ES6 and TypeScript:
|
||||
|
||||
// From the Umbrella ethers package...
|
||||
import { BigNumber } from "ethers";
|
||||
|
||||
// From the bignumber pacakge...
|
||||
import { BigNumber } from "@ethersproject/bignumber";
|
||||
```
|
||||
|
||||
|
||||
|
||||
Types
|
||||
-----
|
||||
|
||||
|
||||
|
||||
### BigNumberish
|
||||
|
||||
|
||||
Many functions and methods in this library take in values which
|
||||
can be non-ambiguously and safely converted to a BigNumber. These
|
||||
values can be sepcified as:
|
||||
|
||||
|
||||
#### ***string***
|
||||
|
||||
A [hexstring](../bytes) or a decimal string, either of which may
|
||||
be negative.
|
||||
|
||||
|
||||
|
||||
|
||||
#### ***BytesLike***
|
||||
|
||||
A [BytesLike](../bytes) Object, such as an Array or Uint8Array.
|
||||
|
||||
|
||||
|
||||
|
||||
#### ***BigNumber***
|
||||
|
||||
An existing BigNumber instance.
|
||||
|
||||
|
||||
|
||||
|
||||
#### ***number***
|
||||
|
||||
A number that is within the safe range for JavaScript numbers.
|
||||
|
||||
|
||||
|
||||
|
||||
#### ***BigInt***
|
||||
|
||||
A JavaScript [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt)
|
||||
object, on environments that support BigInt.
|
||||
|
||||
|
||||
|
||||
|
||||
Creating Instances
|
||||
------------------
|
||||
|
||||
|
||||
The constructor of BigNumber cannot be called directly. Instead, Use the static `BigNumber.from`.
|
||||
|
||||
|
||||
#### *BigNumber* . **from** ( aBigNumberish ) **=>** *[BigNumber](./)*
|
||||
|
||||
Returns an instance of a **BigNumber** for *aBigNumberish*.
|
||||
|
||||
|
||||
|
||||
|
||||
### Examples:
|
||||
|
||||
|
||||
|
||||
```javascript
|
||||
Skipping JavaScript Evaluation.
|
||||
```
|
||||
|
||||
|
||||
|
||||
Methods
|
||||
-------
|
||||
|
||||
|
||||
The BigNumber class is immutable, so no operations can change the value
|
||||
it represents.
|
||||
|
||||
|
||||
### Math Operations
|
||||
|
||||
|
||||
|
||||
#### *bignumber* . **add** ( otherValue ) **=>** *[BigNumber](./)*
|
||||
|
||||
Returns a BigNumber with the value of *bignumber* **+** *otherValue*.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *bignumber* . **sub** ( otherValue ) **=>** *[BigNumber](./)*
|
||||
|
||||
Returns a BigNumber with the value of *bignumber* **–** *otherValue*.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *bignumber* . **mul** ( otherValue ) **=>** *[BigNumber](./)*
|
||||
|
||||
Returns a BigNumber with the value of *bignumber* **×** *otherValue*.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *bignumber* . **div** ( divisor ) **=>** *[BigNumber](./)*
|
||||
|
||||
Returns a BigNumber with the value of *bignumber* **÷** *divisor*.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *bignumber* . **mod** ( divisor ) **=>** *[BigNumber](./)*
|
||||
|
||||
Returns a BigNumber with the value of the **remainder** of *bignumber* ÷ *divisor*.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *bignumber* . **pow** ( exponent ) **=>** *[BigNumber](./)*
|
||||
|
||||
Returns a BigNumber with the value of *bignumber* to the power of *exponent*.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *bignumber* . **abs** ( ) **=>** *[BigNumber](./)*
|
||||
|
||||
Returns a BigNumber with the absolute value of *bignumber*.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *bignumber* . **maskn** ( bitcount ) **=>** *[BigNumber](./)*
|
||||
|
||||
Returns a BigNumber with the value of *bignumber* with bits beyond
|
||||
the *bitcount* least significant bits set to zero.
|
||||
|
||||
|
||||
|
||||
|
||||
### Two's Compliment
|
||||
|
||||
|
||||
[Two's Complicment](https://en.wikipedia.org/wiki/Two%27s_complement)
|
||||
is an elegant method used to encode and decode fixed-width signed values
|
||||
while efficiently preserving mathematic operations.
|
||||
Most users will not need to interact with these.
|
||||
|
||||
|
||||
#### *bignumber* . **fromTwos** ( bitwidth ) **=>** *[BigNumber](./)*
|
||||
|
||||
Returns a BigNumber with the value of *bignumber* converted from twos-compliment with *bitwidth*.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *bignumber* . **toTwos** ( bitwidth ) **=>** *[BigNumber](./)*
|
||||
|
||||
Returns a BigNumber with the value of *bignumber* converted to twos-compliment with *bitwidth*.
|
||||
|
||||
|
||||
|
||||
|
||||
### Comparison and Equivalence
|
||||
|
||||
|
||||
|
||||
#### *bignumber* . **eq** ( otherValue ) **=>** *boolean*
|
||||
|
||||
Returns true if and only if the value of *bignumber* is equal to *otherValue*.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *bignumber* . **lt** ( otherValue ) **=>** *boolean*
|
||||
|
||||
Returns true if and only if the value of *bignumber* **<** *otherValue*.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *bignumber* . **lte** ( otherValue ) **=>** *boolean*
|
||||
|
||||
Returns true if and only if the value of *bignumber* **≤** *otherValue*.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *bignumber* . **gt** ( otherValue ) **=>** *boolean*
|
||||
|
||||
Returns true if and only if the value of *bignumber* **>** *otherValue*.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *bignumber* . **gte** ( otherValue ) **=>** *boolean*
|
||||
|
||||
Returns true if and only if the value of *bignumber* **≥** *otherValue*.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *bignumber* . **isZero** ( ) **=>** *boolean*
|
||||
|
||||
Returns true if and only if the value of *bignumber* is zero.
|
||||
|
||||
|
||||
|
||||
|
||||
### Conversion
|
||||
|
||||
|
||||
|
||||
#### *bignumber* . **toNumber** ( ) **=>** *number*
|
||||
|
||||
Returns the value of *bignumber* as a JavaScript value.
|
||||
|
||||
This will **throw an error**
|
||||
if the value is greater than or equal to *Number.MAX_SAFE_INTEGER* or less than or
|
||||
equal to *Number.MIN_SAFE_INTEGER*.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *bignumber* . **toString** ( ) **=>** *string*
|
||||
|
||||
Returns the value of *bignumber* as a base-10 string.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *bignumber* . **toHexString** ( ) **=>** *string*
|
||||
|
||||
Returns the value of *bignumber* as a base-16, `0x`-prefixed [hexstring](../bytes).
|
||||
|
||||
|
||||
|
||||
|
||||
### Inspection
|
||||
|
||||
|
||||
|
||||
#### *BigNumnber* . **isBigNumber** ( object ) **=>** *boolean*
|
||||
|
||||
Returns true if and only if the *object* is a BigNumber object.
|
||||
|
||||
|
||||
|
||||
|
||||
### Examples
|
||||
|
||||
|
||||
|
||||
```javascript
|
||||
Skipping JavaScript Evaluation.
|
||||
```
|
||||
|
||||
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
||||
|
||||
A few short notes on numbers...
|
||||
|
||||
|
||||
### Why can't I just use numbers?
|
||||
|
||||
|
||||
The first problem many encounter when dealing with Ethereum is
|
||||
the concept of numbers. Most common currencies are broken down
|
||||
with very little granularity. For example, there are only 100
|
||||
cents in a single dollar. However, there are 10^18 **wei** in a
|
||||
single **ether**.
|
||||
|
||||
JavaScript uses [IEEE 754 double-precision binary floating point](https://en.wikipedia.org/wiki/Double-precision_floating-point_format)
|
||||
numbers to represent numeric values. As a result, there are *holes*
|
||||
in the integer set after 9,007,199,254,740,991; which is
|
||||
problematic for *Ethereum* because that is only around 0.009
|
||||
ether (in wei), which means any value over that will begin to
|
||||
experience rounding errors.
|
||||
|
||||
To demonstrate how this may be an issue in your code, consider:
|
||||
|
||||
|
||||
```javascript
|
||||
Skipping JavaScript Evaluation.
|
||||
```
|
||||
|
||||
|
||||
To remedy this, all numbers (which can be large) are stored
|
||||
and manipulated as [Big Numbers](./).
|
||||
|
||||
The functions [parseEther( etherString )](http://linkto) and
|
||||
[formatEther( wei )](http://linkto) can be used to convert
|
||||
between string representations, which are displayed to or entered
|
||||
by the user and Big Number representations which can have
|
||||
mathematical operations handled safely.
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** 76be4f72801f0d772c1ebe1acff4c41f6d52ed96f603de4b168f12d099470273
|
||||
65
docs/api/utils/bignumber/index.html
Normal file
65
docs/api/utils/bignumber/index.html
Normal file
File diff suppressed because one or more lines are too long
238
docs/api/utils/bytes/README.md
Normal file
238
docs/api/utils/bytes/README.md
Normal file
@@ -0,0 +1,238 @@
|
||||
-----
|
||||
|
||||
Documentation: [html](https://docs-beta.ethers.io/)
|
||||
|
||||
-----
|
||||
|
||||
|
||||
Byte Manipulation
|
||||
=================
|
||||
|
||||
|
||||
Tra la la...
|
||||
|
||||
|
||||
Types
|
||||
-----
|
||||
|
||||
|
||||
|
||||
### Bytes
|
||||
|
||||
|
||||
A **Bytes** is any object which is an
|
||||
[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) or
|
||||
[TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) with
|
||||
each value in the valid byte range (i.e. between 0 and 255 inclusive),
|
||||
or is an Object with a `length` property where each indexed property
|
||||
is in the valid byte range.
|
||||
|
||||
|
||||
### BytesLike
|
||||
|
||||
|
||||
A **BytesLike** can be either a [Bytes](./) or a [DataHexstring](./).
|
||||
|
||||
|
||||
### DataHexstring
|
||||
|
||||
|
||||
A **DataHexstring** is identical to a [Hexstring](./) except that it has
|
||||
an even number of nibbles, and therefore is a valid representation of
|
||||
binary data as a string.
|
||||
|
||||
|
||||
### Hexstring
|
||||
|
||||
|
||||
A **hexstring** is a string which has a `0x` prefix followed by any
|
||||
number of nibbles (i.e. case-insensitive hexidecumal characters, `0-9` and `a-f`).
|
||||
|
||||
|
||||
### Signature
|
||||
|
||||
|
||||
|
||||
|
||||
* **r** and **s** --- The x co-ordinate of **r** and the **s** value of the signature
|
||||
* **v** --- The parity of the y co-ordinate of **r**
|
||||
* **_vs** --- The [compact representation](https://link_here) of the **(r, s)** and **v**
|
||||
* **recoveryParam** --- The normalized (i.e. 0 or 1) value of **v**
|
||||
|
||||
|
||||
### SignatureLike
|
||||
|
||||
|
||||
A **SignatureLike** is similar to a [Signature](./), except redundant properties
|
||||
may be omitted.
|
||||
|
||||
For example, if **_vs** is specified, **s** and **v** may be omitted. Likewise,
|
||||
if **recoveryParam** is provided, **v** may be omitted (as in these cases the
|
||||
missing values can be computed).
|
||||
|
||||
|
||||
Inspection
|
||||
----------
|
||||
|
||||
|
||||
|
||||
#### *utils* . **isBytes** ( object ) **=>** *boolean*
|
||||
|
||||
Returns true if and only if *object* is a valid [Bytes](./).
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . **isBytesLike** ( object ) **=>** *boolean*
|
||||
|
||||
Returns true if and only if *object* is a [Bytes](./) or [DataHexstring](./).
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . **isHexString** ( object , [ length ] ) **=>** *boolean*
|
||||
|
||||
Returns true if and only if *object* is a valid hex string.
|
||||
If *length* is specified and *object* is not a valid [DataHexstring](./) of
|
||||
*length* bytes, an InvalidArgument error is thrown.
|
||||
|
||||
|
||||
|
||||
|
||||
Converting between Arrays and Hexstrings
|
||||
----------------------------------------
|
||||
|
||||
|
||||
|
||||
#### *utils* . **arrayify** ( datahexstringOrArrayish [ , options ] ) **=>** *Uint8Array*
|
||||
|
||||
Converts *datahexstringOrArrayish* to a Uint8Array.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . **hexlify** ( hexstringOrArrayish ) **=>** *string*
|
||||
|
||||
Converts *hexstringOrArrayish* to a [DataHexstring](./).
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . **hexValue** ( aBigNumberish ) **=>** *string*
|
||||
|
||||
Converts *aBigNumberish* to a [Hexstring](./), with no *unnecessary* leading
|
||||
zeros.
|
||||
|
||||
|
||||
|
||||
|
||||
### Examples
|
||||
|
||||
|
||||
|
||||
```javascript
|
||||
Skipping JavaScript Evaluation.
|
||||
```
|
||||
|
||||
|
||||
|
||||
Array Manipulation
|
||||
------------------
|
||||
|
||||
|
||||
|
||||
#### *utils* . **concat** ( arrayOfBytesLike ) **=>** *Uint8Array*
|
||||
|
||||
Concatenates all the [BytesLike](./) in *arrayOfBytesLike* into a single Uint8Array.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . **stripZeros** ( aBytesLike ) **=>** *Uint8Array*
|
||||
|
||||
Returns a Uint8Array with all leading `0` bytes of *aBtyesLike* removed.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . **zeroPad** ( aBytesLike , length ) **=>** *Uint8Array*
|
||||
|
||||
Retutns a Uint8Array of the data in *aBytesLike* with `0` bytes prepended to
|
||||
*length* bytes long.
|
||||
|
||||
If *aBytesLike* is already longer than *length* bytes long, an InvalidArgument
|
||||
error will be thrown.
|
||||
|
||||
|
||||
|
||||
|
||||
Hexstring Manipulation
|
||||
----------------------
|
||||
|
||||
|
||||
|
||||
#### *utils* . **hexConcat** ( arrayOfBytesLike ) **=>** *[DataHexstring](./)*
|
||||
|
||||
Concatenates all the [BytesLike](./) in *arrayOfBytesLike* into a single [DataHexstring](./)
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . **hexDataLength** ( aBytesLike ) **=>** *[DataHexstring](./)*
|
||||
|
||||
Returns the length (in bytes) of *aBytesLike*.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . **hexDataSlice** ( aBytesLike , offset [ , endOffset ] ) **=>** *[DataHexstring](./)*
|
||||
|
||||
Returns a [DataHexstring](./) representation of a slice of *aBytesLike*, from
|
||||
*offset* (in bytes) to *endOffset* (in bytes). If *endOffset* is
|
||||
omitted, the length of *aBytesLike* is used.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . **hexStripZeros** ( aBytesLike ) **=>** *[Hexstring](./)*
|
||||
|
||||
Returns a [Hexstring](./) representation of *aBytesLike* with all
|
||||
leading zeros removed.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . **hexZeroPad** ( aBytesLike , length ) **=>** *[DataHexstring](./)*
|
||||
|
||||
Returns a [DataHexstring](./) representation of *aBytesLike* padded to *length* bytes.
|
||||
|
||||
If *aBytesLike* is already longer than *length* bytes long, an InvalidArgument
|
||||
error will be thrown.
|
||||
|
||||
|
||||
|
||||
|
||||
Signature Conversion
|
||||
--------------------
|
||||
|
||||
|
||||
|
||||
#### *utils* . **joinSignature** ( aSignatureLike ) **=>** *[DataHexstring](./)*
|
||||
|
||||
Return the flat-format of *aSignaturelike*, which is 65 bytes (130 nibbles)
|
||||
long, concatenating the **r**, **s** and (normalized) **v** of a Signature.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . **splitSignature** ( aSignatureLikeOrBytesLike ) **=>** *[Signature](./)*
|
||||
|
||||
Return the full expanded-format of *aSignaturelike* or a flat-format [DataHexstring](./).
|
||||
Any missing properties will be computed.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** fce7a8c85402ef3d94ffe261157fa3e0644c5c5d0641d9de7820a9a798bcb6c7
|
||||
47
docs/api/utils/bytes/index.html
Normal file
47
docs/api/utils/bytes/index.html
Normal file
File diff suppressed because one or more lines are too long
106
docs/api/utils/constants/README.md
Normal file
106
docs/api/utils/constants/README.md
Normal file
@@ -0,0 +1,106 @@
|
||||
-----
|
||||
|
||||
Documentation: [html](https://docs-beta.ethers.io/)
|
||||
|
||||
-----
|
||||
|
||||
|
||||
Constants
|
||||
=========
|
||||
|
||||
|
||||
The **ethers.contants** Object contains commonly used values.
|
||||
|
||||
|
||||
### Importing
|
||||
|
||||
|
||||
|
||||
```javascript
|
||||
Skipping JavaScript Evaluation.
|
||||
```
|
||||
|
||||
|
||||
|
||||
Bytes
|
||||
-----
|
||||
|
||||
|
||||
|
||||
#### *constants* . **AddressZero** **=>** *[DataHexstring](../bytes)*
|
||||
|
||||
The Address Zero, which is 20 bytes (40 nibbles) of zero.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *constants* . **HashZero** **=>** *[DataHexstring](../bytes)*
|
||||
|
||||
The Hash Zero, which is 32 bytes (64 nibbles) of zero.
|
||||
|
||||
|
||||
|
||||
|
||||
Strings
|
||||
-------
|
||||
|
||||
|
||||
|
||||
#### *constants* . **EtherSymbol** **=>** *string*
|
||||
|
||||
The Ether symbol, **Ξ**.
|
||||
|
||||
|
||||
|
||||
|
||||
BigNumber
|
||||
---------
|
||||
|
||||
|
||||
|
||||
#### *constants* . **NegativeOne** **=>** *[BigNumber](../bignumber)*
|
||||
|
||||
The BigNumber value representing `"-1"`.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *constants* . **Zero** **=>** *[BigNumber](../bignumber)*
|
||||
|
||||
The BigNumber value representing `"0"`.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *constants* . **One** **=>** *[BigNumber](../bignumber)*
|
||||
|
||||
The BigNumber value representing `"1"`.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *constants* . **Two** **=>** *[BigNumber](../bignumber)*
|
||||
|
||||
The BigNumber value representing `"2"`.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *constants* . **WeiPerEther** **=>** *[BigNumber](../bignumber)*
|
||||
|
||||
The BigNumber value representing `"1000000000000000000"`, which is the
|
||||
number of Wei per Ether.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *constants* . **MaxUint256** **=>** *[BigNumber](../bignumber)*
|
||||
|
||||
The BigNumber value representing the maximum `uint256` value.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** 11a9a2e37a2a553b79931caf5374bcd894edf343a897c4253ddeaf4d2f8e1213
|
||||
22
docs/api/utils/constants/index.html
Normal file
22
docs/api/utils/constants/index.html
Normal file
File diff suppressed because one or more lines are too long
113
docs/api/utils/display-logic/README.md
Normal file
113
docs/api/utils/display-logic/README.md
Normal file
@@ -0,0 +1,113 @@
|
||||
-----
|
||||
|
||||
Documentation: [html](https://docs-beta.ethers.io/)
|
||||
|
||||
-----
|
||||
|
||||
|
||||
Display Logic and Input
|
||||
=======================
|
||||
|
||||
|
||||
When creating an Application, it is useful to convert between
|
||||
user-friendly strings (usually displaying **ether**) and the
|
||||
machine-readable values that contracts and maths depend on
|
||||
(usually in **wei**).
|
||||
|
||||
For example, a Wallet may specify the balance in ether, and
|
||||
gas prices in gwei for the User Interface, but when sending
|
||||
a transaction, both must be specified in wei.
|
||||
|
||||
The [parseUnits](./) will parse a string representing
|
||||
ether, such as `1.1` into a [BigNumber](../bignumber) in wei, and is
|
||||
useful when a user types in a value, such as sending 1.1 ether.
|
||||
|
||||
The [formatUnits](./) will format a [BigNumberish](../bignumber)
|
||||
into a string, which is useful when displaying a balance.
|
||||
|
||||
|
||||
Units
|
||||
-----
|
||||
|
||||
|
||||
|
||||
### Decimal Count
|
||||
|
||||
|
||||
The *unit* specified may be an integer, which indicates how
|
||||
many decimal place the unit has. For example, 1 ether has 18 decimal
|
||||
places for wei, and if this library were used with Bitcoin, 1 BTC
|
||||
has 8 decimal places for satoshis.
|
||||
|
||||
|
||||
### Named Units
|
||||
|
||||
|
||||
In addition to specifying *unit* as a number of decimals, there
|
||||
are several common units, which can be passed in as a string:
|
||||
|
||||
|
||||
|
||||
* **wei** --- 0
|
||||
* **kwei** --- 3
|
||||
* **mwei** --- 6
|
||||
* **gwei** --- 9
|
||||
* **szabo** --- 12
|
||||
* **finney** --- 15
|
||||
* **ether** --- 18
|
||||
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
||||
|
||||
|
||||
### Formatting
|
||||
|
||||
|
||||
|
||||
#### *utils* . **commify** ( value ) **=>** *string*
|
||||
|
||||
Returns a string with value grouped by 3 digits, separated by `,`.
|
||||
|
||||
|
||||
|
||||
|
||||
### Conversion
|
||||
|
||||
|
||||
|
||||
#### *utils* . **formatUnits** ( value [ , unit="ether" ] ) **=>** *string*
|
||||
|
||||
Returns a string representation of *value* formatted with *unit*
|
||||
digits (if it is a number) or to the unit specified (if a string).
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . **formatEther** ( value ) **=>** *string*
|
||||
|
||||
The equivalent to calling `formatUnits(value, "ether")`.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . **parseUnits** ( value [ , unit="ether" ] ) **=>** *[BigNumber](../bignumber)*
|
||||
|
||||
Returns a [BigNumber](../bignumber) representation of *value*, parsed with
|
||||
*unit* digits (if it is a number) or from the unit specified (if
|
||||
a string).
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . **parseEther** ( value ) **=>** *[BigNumber](../bignumber)*
|
||||
|
||||
The equivalent to calling `parseUnits(value, "ether")`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** 172c3345092afd2abb6a47dc225ae54c13c3ee3ce87868dd87e19656f4e6078d
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user