Compare commits

...

72 Commits

Author SHA1 Message Date
Richard Moore
c04f9a7fff Fixed require resolution for CLI scripts. 2020-01-09 03:22:19 -05:00
Richard Moore
3c184ace21 Added new URLs for default ETC (and ETC testnets) providers (#351). 2020-01-08 17:59:21 -05:00
Richard Moore
a7e29d60f7 Updated dist files. 2020-01-07 19:58:04 -05:00
Richard Moore
2d5492cd2e Use better Description typing. 2020-01-07 19:47:55 -05:00
Richard Moore
13f50abd84 Better property access on ABI decoded results (#698). 2020-01-07 19:46:51 -05:00
Richard Moore
d0f4642f6d Better typing support for Description. 2020-01-07 19:44:45 -05:00
Richard Moore
1e72fc7d6f Fixed resolveName when name is an address with an invalid checksum (#694). 2020-01-07 19:41:43 -05:00
Richard Moore
a21c430c7a Updated dist files. 2020-01-06 19:00:55 -05:00
Richard Moore
eb26a6d950 Added function to generate CREATE2 addresses (#697). 2020-01-06 18:51:36 -05:00
Richard Moore
a648f2bd1e Force constructor name to be null (instead of undefined). 2020-01-06 18:48:36 -05:00
Richard Moore
e593aba294 Added documentation uploading script. 2020-01-06 18:47:20 -05:00
Richard Moore
5724fa5d9c Added Czech wordlist to default wordlists export (#691). 2020-01-03 19:41:23 -05:00
Richard Moore
f54f06b5c8 Added Czech BIP-39 wordlist (#691). 2020-01-03 19:39:22 -05:00
Richard Moore
e809eadf8d Updated README. 2019-12-15 02:08:02 -05:00
Richard Moore
184c459fab Updating docs. 2019-12-13 22:05:10 -05:00
Richard Moore
06cafe3437 Merge branch 'yuetloo-ethers-v5-beta' into ethers-v5-beta 2019-12-13 14:55:29 -05:00
Yuet Loo
fdf0980663 add circleci and parity test files 2019-12-09 23:01:21 -05:00
Richard Moore
9c78c7fee6 Fixed typo in package test dist scripts. 2019-11-25 14:23:22 +09:00
Richard Moore
fa9f53def7 Updated dist files. 2019-11-25 00:02:22 +09:00
Richard Moore
cf036e1ffa Update elliptic package to protect from Minerva timing attack (#666). 2019-11-24 23:53:18 +09:00
Richard Moore
4470477d7f Browser and node testing works again. 2019-11-24 19:13:37 +09:00
Richard Moore
e3752e5986 Updated CHANGELOG. 2019-11-23 21:48:16 +09:00
Richard Moore
f308ba3540 Updated dist files (sorted package.json to reduce package version change chatter). 2019-11-23 21:38:13 +09:00
Richard Moore
2f0e679f0b Stubs for adding throttle support. 2019-11-23 21:21:27 +09:00
Richard Moore
abab9f6aa2 Refactor wordlists. 2019-11-23 21:20:23 +09:00
Richard Moore
c11c2e2e33 Browser testcases work again. 2019-11-23 21:15:06 +09:00
Richard Moore
3d75c52dac Added dist files for non-English wordlists. 2019-11-22 20:38:57 +09:00
Richard Moore
29f0e9dd62 Sync GitHub issue cache. 2019-11-20 19:13:52 +09:00
Richard Moore
79ef1e975d Updated dist files. 2019-11-20 18:57:38 +09:00
Richard Moore
3ab373334c Updated API in testcases. 2019-11-20 18:31:19 +09:00
Richard Moore
b72ef27b2a Fixed scrypt import in ESM build. 2019-11-20 18:29:42 +09:00
Richard Moore
e518151509 Fixed null apiKey problem for InfuraProvider. 2019-11-20 18:28:13 +09:00
Richard Moore
19aaade9c6 Added support for sighash-style tuple parsing. 2019-11-20 18:26:59 +09:00
Richard Moore
c35ddaf646 Fixed solc imports for cli. 2019-11-19 18:17:31 +09:00
Richard Moore
8316406977 Added nonce manager to experimental index. 2019-11-19 18:15:47 +09:00
Richard Moore
01ca35036c Removing NodesmithProvider from default provider as it is being discontinued. 2019-11-19 18:14:40 +09:00
Richard Moore
da8ca2e8bc Moved bare ABI named functions and events from Interface into Contracts to simplify other consumers of Interface. 2019-11-19 18:13:58 +09:00
Richard Moore
1ec5804bd4 Added support for complex API keys including support for INFURA project secrets (#464, #651, #652). 2019-11-19 18:00:05 +09:00
Richard Moore
75895fa149 Migrated to scrypt-js v3. 2019-11-13 21:47:08 +09:00
Richard Moore
51e4ef2b45 Moved getDefaultProvider to providers package. 2019-11-01 23:54:05 +09:00
Richard Moore
e1509a6326 Migrating providers to modern syntax and scoping (#634). 2019-11-01 23:51:08 +09:00
Richard Moore
394c36cad4 Migrating to modern syntax and scoping (#634). 2019-11-01 23:33:51 +09:00
Richard Moore
1d4f90a958 Added provider property to Web3Provider (#641). 2019-11-01 22:18:17 +09:00
Richard Moore
494381a628 Updated GitHub issue cache. 2019-11-01 22:16:50 +09:00
Richard Moore
d9d438a119 Force deploy receipt to address to be null (#573). 2019-10-19 20:33:57 +09:00
Richard Moore
3d514c8dbb Updated experimental NonceManager. 2019-10-19 20:02:48 +09:00
Richard Moore
28339a9c85 Fixed typo in error message. 2019-10-19 20:01:57 +09:00
Richard Moore
fea867a206 Added GitHub issue caching. 2019-10-19 20:00:39 +09:00
Richard Moore
5b0c15930f Update dist files. 2019-10-17 01:12:03 +09:00
Richard Moore
12cfc59965 Fixed getBlock for blockhashes with a leading 0 (#629). 2019-10-17 00:53:25 +09:00
Richard Moore
3c864de612 Updated dist files. 2019-09-28 02:36:19 -04:00
Richard Moore
778eb3b425 Added less-common, but useful, coding functions to Interface. 2019-09-27 21:56:42 -04:00
Richard Moore
3d25882d6b Add response handling and 304 support to fetchJson. 2019-09-27 21:55:40 -04:00
Richard Moore
a12030ad29 Allow numeric values in a transaction to be odd-lengthed hexstrings (#614). 2019-09-27 21:54:10 -04:00
Richard Moore
828c8cfd41 Simpler crypt for admin tools. 2019-09-20 22:38:03 -04:00
Richard Moore
238fcba83b Updated dist files. 2019-09-08 02:46:53 -04:00
Richard Moore
751793ea25 Fixed getContractAddress for odd-length hex values (#572). 2019-09-08 02:39:00 -04:00
Richard Moore
6f4291f65f Fixed typo in error message (#592). 2019-09-06 18:49:36 -04:00
Richard Moore
9c63b4a753 Fixed typo in error message (#580). 2019-09-06 18:48:14 -04:00
Richard Moore
22a26736cc Fixed typo in error message (#574). 2019-09-06 18:46:34 -04:00
Richard Moore
f0b2961f08 Updated Changelog. 2019-09-06 17:58:37 -04:00
Richard Moore
4c17c4db04 Removed export star to fix UMD dist file. 2019-09-06 17:48:26 -04:00
Richard Moore
e8028d0e73 Updated TypeScript version. 2019-09-06 12:25:17 -04:00
Richard Moore
1e0ed4e99a Fixed test suites and reporter. 2019-09-01 00:13:35 -04:00
Richard Moore
2187604913 Added lock-versions admin tool. 2019-08-31 23:58:54 -04:00
Richard Moore
85b4db7d6d Updated packages with version lock and moved types. 2019-08-31 23:56:02 -04:00
Richard Moore
019c1fc708 Fixed typo in error message (#592). 2019-08-26 16:00:51 -04:00
Richard Moore
3a91e91df5 Fixed build process to re-target browser field to ES version. 2019-08-25 16:20:34 -04:00
Richard Moore
73a0077fd3 Major overhaul in compilation to enable ES6 module generation. 2019-08-25 02:39:20 -04:00
Richard Moore
81fd9428ca Updated some of the flatworm docs. 2019-08-23 15:25:13 -04:00
Richard Moore
ebfca98dc2 Fixed package descriptions (#561). 2019-08-22 18:03:33 -04:00
Richard Moore
6f4ca61208 Updated dist files. 2019-08-22 17:12:51 -04:00
1702 changed files with 79283 additions and 21447 deletions

148
.circleci/config.yml Normal file
View 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
View File

@@ -14,3 +14,7 @@ shims/*.d.ts
**/*.tmp-browserify-*
lerna-debug.log
packages/*/tsconfig.tsbuildinfo
packages/testcases/input/nameprep/**

View File

@@ -3,6 +3,112 @@ Changelog
This change log is managed by `scripts/cmds/update-versions` but may be manually updated.
ethers/v5.0.0-beta.164 (2020-01-07 19:57)
-----------------------------------------
- Use better Description typing. ([2d5492c](https://github.com/ethers-io/ethers.js/commit/2d5492cd2ee722c818c249244af7b5bea05d67b0))
- Better property access on ABI decoded results. ([#698](https://github.com/ethers-io/ethers.js/issues/698); [13f50ab](https://github.com/ethers-io/ethers.js/commit/13f50abd847f7ddcc7e54c102da54e2d23b86fae))
- Better typing support for Description. ([d0f4642](https://github.com/ethers-io/ethers.js/commit/d0f4642f6d2c9f5119f1910a0082894c60e81191))
- Fixed resolveName when name is an address with an invalid checksum. ([#694](https://github.com/ethers-io/ethers.js/issues/694); [1e72fc7](https://github.com/ethers-io/ethers.js/commit/1e72fc7d6f7c3be4410dbdcfbab9a0463ceb52bd))
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)
-----------------------------------------

View File

@@ -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
@@ -17,10 +23,18 @@ Installing
/home/ricmoo/some_project> npm install --save ethers@next
```
**browser**
**browser (UMD)**
```
<script src="https://cdn.ethers.io/lib/ethers-5.0.min.js" 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>
```

View File

@@ -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
};

View 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
View 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);
});

View 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);
});
})();

View File

@@ -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":

View File

@@ -0,0 +1,5 @@
"use strict";
const { setupBuild } = require("../build");
setupBuild(false);

16
admin/cmds/set-config.js Normal file
View 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
View 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);
});

View 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);

View File

@@ -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);
@@ -52,14 +51,6 @@ if (process.argv.length > 2) {
// Get local package.json (update the tarballHash)
let info = await updatePackage(dirname);
/*
let info = await updatePackage(dirname, {
repository: {
type: "git",
url: "git://github.com/ethers-io/ethers.js.git"
}
});
*/
// Get the remote package.json (or sub in a placeholder for new pacakges)
let npmInfo = await getPackageVersion(info.name);
@@ -85,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);
@@ -97,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
View 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));
}
})();

View File

@@ -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
View 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,
}

View File

@@ -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]);

View File

@@ -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) {

View File

@@ -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");

View 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" }
}
}

View File

@@ -0,0 +1 @@

View File

@@ -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":"{}"}

View File

@@ -12,18 +12,43 @@ 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
Tra la la...
The **EtherscanProvider** is backed by a combination of the various
[Etherscan APIs](https://etherscan.io/apis).
_property: provider.getHistory(address) => Array<History>
_subsection: InfuraProvider
Tra la la...
The **InfuraProvider** is backed by the popular [INFURA](https://infura.io)
Ethereum service.
It supports Mainnet (homestead) and all common testnets (Ropsten, Rinkeby,
G&ouml;rli and Kovan).
_subsection: NodesmithProvider
Tra la la...
The **NodesmithProvider** is backed by [Nodesmith](https://nodesmith.io).
It supports Mainnet (homestead) and all common testnets (Ropsten, Rinkeby,
G&ouml;rli and Kovan), as well as the Ethereum-like network [Aion](https://aion.network).
_subsection: AlchemyProvider
Tra la la...
The **AlchemtProvider** is backed by [Alchemy](https://alchemyapi.io).
It supports Mainnet (homestead) and all common testnets (Ropsten, Rinkeby,
G&ouml;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).

View File

@@ -4,23 +4,24 @@ _section: Signers
Tra la la...
_subsection: Signer
_subsection: Signer @<signer>
_property: signer.connect(provider) => Signer
_property: signer.connect(provider) => [[signer]]
TODO
_heading: Blockchain Methods
_property: signer.getBalance([ blockTag = "latest" ]) => Promise(BigNumber)
_property: signer.getBalance([ blockTag = "latest" ]) => Promise<[[bignumber]]>
TODO
_property: signer.getTransactionCount([ blockTag = "latest" ]) => Promise(number)
_property: signer.getTransactionCount([ blockTag = "latest" ]) => Promise<number>
TODO
_subsection: Wallet inherits Signer
Wallet is...
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

View File

@@ -4,18 +4,27 @@ _section: Addresses
Explain addresses,formats and checksumming here.
Also see: [Constants.AddressZero](constants)
Also see: [constants.AddressZero](constants)
_heading: Functions
_property: utils.getAddress(address) => string
TODO
_property: utils.isAddress(address) => boolean
TODO
_property: utils.getAddress(address) => string @<utils-getAddress> @TS<address:>
Returns //address// as a Checksum Address.
_property: utils.getIcapAddress(address) => string
TODO
If //address// is an invalid 40-nibble [[hexstring]] or if it contains mixed case and
the checksum is invalid, an InvalidArgument Error is throw.
_property: utils.getContractAddress(transaction) => string
TODO
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.

View File

@@ -84,9 +84,9 @@ the //bitcount// least significant bits set to zero.
_heading: Two's Compliment
[Two's Complicment](https://en.wikipedia.org/wiki/Two%27s_complement)
is a method used to encode and decode fixed-width values which can be
positive or negative, without requiring a separate sign bit. Most users
will not need to interact with these.
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//.

View File

@@ -8,20 +8,27 @@ _subsection: Types
_heading: Bytes @<bytes>
A Bytes object 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
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 [[hexstring]].
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
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>
@@ -35,37 +42,36 @@ _heading: SignatureLike @<signaturelike>
A **SignatureLike** is similar to a [[signature]], except redundant properties
may be omitted.
For example, if *_vs* is specified, **(r, s)** and **v** can be omitted. Likewise,
if **recoverParam** is provided, **v** can be omitted (as it can be computed).
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
_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
Returns true if and only if //object// is a [[bytes]] or an Array or TypedArray
where each value is a valid byte (i.e. between 0 and 255 inclusive).
_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
Returns true if and only if //object// is a valid hex string;
if //length// is specified the length (in bytes) is also verified.
_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(hexstringOrArrayish [ , options ]) => Uint8Array
Converts //hexstringOrArrayish// to a Uint8Array. If a [[hexstring]]
is passed in, the length must be even.
_property: utils.arrayify(datahexstringOrArrayish [ , options ]) => Uint8Array @<utils-arrayify> @TS<bytes:>
Converts //datahexstringOrArrayish// to a Uint8Array.
_property: utils.hexlify(hexstringOrArrayish) => string
Converts //hexstringOrArrayish// to a [[hexstring]]. The result
will always be zero-padded to even length.
_property: utils.hexlify(hexstringOrArrayish) => string @<utils-hexlify> @TS<bytes:>
Converts //hexstringOrArrayish// to a [[datahexstring]].
_property: utils.hexValue(aBigNumberish) => string
Converts //aBigNumberish// to a [[hexstring]], with no unecessary leading
zeros. The result of this function can be of odd-length.
_property: utils.hexValue(aBigNumberish) => string @<utils-hexvalue> @TS<bytes:>
Converts //aBigNumberish// to a [[hexstring]], with no __unnecessary__ leading
zeros.
_heading: Examples
@@ -74,48 +80,51 @@ _code: bytes-conversion.js
_subsection: Array Manipulation
_property: utils.concat(arrayOfBytesLike) => Uint8Array
Concatenates all the [[byteslike]] in //arrayOfBytesLike//
into a single Uint8Array.
_property: utils.concat(arrayOfBytesLike) => Uint8Array @<utils-concat> @TS<bytes:>
Concatenates all the [[byteslike]] in //arrayOfBytesLike// into a single Uint8Array.
_property: utils.stripZeros(aBytesLike) => Uint8Array
Concatenates all the [[byteslike]] in //arrayOfBytesLike//
_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
Concatenates all the [[byteslike]] in //arrayOfBytesLike//
_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) => string
Concatenates all the [[byteslike]] in //arrayOfBytesLike//
into a single [[hexstring]]
_property: utils.hexConcat(arrayOfBytesLike) => [[datahexstring]] @<utils-hexconcat> @TS<bytes:>
Concatenates all the [[byteslike]] in //arrayOfBytesLike// into a single [[datahexstring]]
_property: utils.hexDataLength(aBytesLike) => number
_property: utils.hexDataLength(aBytesLike) => [[datahexstring]] @<utils-hexdatalength> @TS<bytes:>
Returns the length (in bytes) of //aBytesLike//.
This will **throw and error** if //aBytesLike// is a [[hexstring]]
but is of odd-length.
_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.hexDataSlice(aBytesLike, offset [ , endOffset ] ) => string
Returns the length (in bytes) of //aBytesLike//.
_property: utils.hexStripZeros(aBytesLike) => [[hexstring]] @<utils-hexstripzeros> @TS<bytes:>
Returns a [[hexstring]] representation of //aBytesLike// with all
leading zeros removed.
_property: utils.hexStripZeros(aBytesLike) => string
@TODO
_property: utils.hexZeroPad(aBytesLike, length) => [[datahexstring]] @<utils-hexzeropad> @TS<bytes:>
Returns a [[datahexstring]] representation of //aBytesLike// padded to //length// bytes.
_property: utils.hexZeroPad(aBytesLike, length) => string
@TODO
If //aBytesLike// is already longer than //length// bytes long, an InvalidArgument
error will be thrown.
_subsection: Signature Conversion
_property: utils.joinSignature(aSignatureLike) => string
Return the flat-format of a [[signaturelike]], which is
65 bytes (130 nibbles) long, concatenating the **r**, **s** and **v**
of a Signature.
_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
Return the full expanded-format of a [[signaturelike]] or
a flat-format [[hexstring]]. Any missing properties will be
computed.
_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.

View File

@@ -11,38 +11,38 @@ _code: constants-import.js
_subsection: Bytes
_property: constants.AddressZero
_property: constants.AddressZero => [[datahexstring]] @<constants-addresszero> @TS<constants:>
The Address Zero, which is 20 bytes (40 nibbles) of zero.
_property: constants.HashZero
_property: constants.HashZero => [[datahexstring]] @<constants-hashzero> @TS<constants:>
The Hash Zero, which is 32 bytes (64 nibbles) of zero.
_subsection: Strings
_property: constants.EtherSymbol
_property: constants.EtherSymbol => string @<constants-ethersymbol> @TS<constants:>
The Ether symbol, **&Xi;**.
_subsection: BigNumber
_property: constants.NegativeOne
_property: constants.NegativeOne => [[bignumber]] @<constants-negativeone> @TS<constants:>
The BigNumber value representing ``"-1"``.
_property: constants.Zero
_property: constants.Zero => [[bignumber]] @<constants-zero> @TS<constants:>
The BigNumber value representing ``"0"``.
_property: constants.One
_property: constants.One => [[bignumber]] @<constants-one> @TS<constants:>
The BigNumber value representing ``"1"``.
_property: constants.Two
_property: constants.Two => [[bignumber]] @<constants-two> @TS<constants:>
The BigNumber value representing ``"2"``.
_property: constants.WeiPerEther
_property: constants.WeiPerEther => [[bignumber]] @<constants-weiperether> @TS<constants:>
The BigNumber value representing ``"1000000000000000000"``, which is the
number of Wei per Ether.
_property: constants.MaxUint256
_property: constants.MaxUint256 => [[bignumber]] @<constants-maxuint256> @TS<constants:>
The BigNumber value representing the maximum ``uint256`` value.

View File

@@ -46,23 +46,23 @@ _subsection: Functions
_heading: Formatting
_property: utils.commify(value) => string
_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
_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
_property: utils.formatEther(value) => string @<util-formatether> @TS<units:>
The equivalent to calling ``formatUnits(value, "ether")``.
_property: utils.parseUnits(value [ , unit = "ether" ] ) => [BigNumber](bignumber)
_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)
_property: utils.parseEther(value) => [BigNumber](bignumber) @<util-parseether> @TS<units:>
The equivalent to calling ``parseUnits(value, "ether")``.

View File

@@ -10,43 +10,43 @@ _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) => string
_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) => string
_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) => string
_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) => string
_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) => string
_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
_property: utils.SupportedAlgorithms.sha256 => string
Use the [SHA2-256](https://en.wikipedia.org/wiki/SHA-2) hash algorithm.
_property: utils.SupportedAlgorithms.sha512
_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) => string
_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) => string
_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) => string
_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//.
@@ -56,15 +56,15 @@ 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) => string
_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) => string
_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) => string
_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//.

View File

@@ -17,25 +17,25 @@ 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.
_definition: **Note:**
_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
_property: utils.parseBytes32String(aBytesLike) => string @<utils-parsebytes32> @TS<strings:>
Returns the decoded string represented by the ``Bytes32`` encoded data.
_property: utils.formatBytes32String(text) => string
_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
_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>
_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//.
@@ -44,7 +44,7 @@ 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
_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.
@@ -86,7 +86,7 @@ _property: utils.UnicodeNormalizationForm.NFKD
The Decomposed Normalization Form with Canonical Equivalence.
See NFKC for more an example.
_definition: **Note:**
_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
it should **not** be considered a method to acheive //any// level of security from
[homoglyph attacks](https://en.wikipedia.org/wiki/IDN_homograph_attack).

View File

@@ -3,3 +3,7 @@ _title: Events
_section: Events
Explain how topics and such work
_subsection: Solidity Topics
How to compute the topic...

View File

@@ -1,6 +1,8 @@
_title: Gas
_section: Gas
_section: Gas @<gas>
Explain attack vectors
_subsection: Gas Price @<gas-price>
@@ -10,4 +12,3 @@ processed.
_subsection: Gas Limit @<gas-limit>

View File

@@ -5,5 +5,11 @@
"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"
}
}

View File

@@ -20,4 +20,5 @@ _toc:
_null:
This breaks out of a directive. For example, to end a
_definition and reset the indentation.

View File

@@ -23,7 +23,7 @@ _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.min.js) to
[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

58
docs.wrm/hacking.wrm Normal file
View 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.

View File

@@ -1,2 +1,2 @@
<script src="https://cdn.ethers.io/lib/ethers-5.0.min.js"
<script src="https://cdn.ethers.io/lib/ethers-5.0.esm.min.js"
type="application/javascipt"></script>

1782
docs.wrm/logo.ai Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -45,6 +45,7 @@ Developer Documentation
* [Importing](getting-started)
* [Concepts](concepts)
* [Events](concepts/events)
* [Solidity Topics](concepts/events)
* [Gas](concepts/gas)
* [Gas Price](concepts/gas)
* [Gas Limit](concepts/gas)
@@ -73,6 +74,7 @@ Developer Documentation
* [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)
@@ -141,4 +143,4 @@ older versions of the library.
-----
**Content Hash:** 6abeb4fa3f15b3443d89a26a6b0320f602a12368bc5ebbfb14a6cce682836167
**Content Hash:** f1da4df3feeb06a567657ae41d8498ea3315f68d05dc2f9e86c2858b5d2b2f89

View File

@@ -36,6 +36,7 @@ Here...
* [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)
@@ -80,4 +81,4 @@ Here...
-----
**Content Hash:** cbd0b8ac4ada4bfee211c0553ac53e171a6900127d874743a0dedf7fa30618f3
**Content Hash:** 82f760f38f47d32016d3fca512c5dc75539d885d13138f1faa15f4be82edf8aa

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -73,6 +73,7 @@ Provider Documentation
* [InfuraProvider](api-providers)
* [NodesmithProvider](api-providers)
* [AlchemyProvider](api-providers)
* [CloudfrontProvider](api-providers)
* [Other Providers](other)
* [FallbackProvider](other)
* [IpcProvider](other)
@@ -84,4 +85,4 @@ Provider Documentation
-----
**Content Hash:** b15d8a2febb07abbbd784242c47575fbbb097f24643997ce30625c2e88adb095
**Content Hash:** 4bae65aa1521a7ecf045f950c9a702ad597d83095d079e66a5abbd327373877c

View File

@@ -24,30 +24,58 @@ EtherscanProvider
-----------------
Tra la la...
The **EtherscanProvider** is backed by a combination of the various
[Etherscan APIs](https://etherscan.io/apis).
#### *provider* . **getHistory** ( address ) **=>** *Array< History >*
InfuraProvider
--------------
Tra la la...
The **InfuraProvider** is backed by the popular [INFURA](https://infura.io)
Ethereum service.
It supports Mainnet (homestead) and all common testnets (Ropsten, Rinkeby,
G&ouml;rli and Kovan).
NodesmithProvider
-----------------
Tra la la...
The **NodesmithProvider** is backed by [Nodesmith](https://nodesmith.io).
It supports Mainnet (homestead) and all common testnets (Ropsten, Rinkeby,
G&ouml;rli and Kovan), as well as the Ethereum-like network [Aion](https://aion.network).
AlchemyProvider
---------------
Tra la la...
The **AlchemtProvider** is backed by [Alchemy](https://alchemyapi.io).
It supports Mainnet (homestead) and all common testnets (Ropsten, Rinkeby,
G&ouml;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:** 9669eaaa1c2e9a31256fdd49e1b7f79550f064056b1bfd67a8cef6c7b5f8d473
**Content Hash:** 2e1dfa80bd4ab1ba02610654b00ee4250a89758a496670822e7950d5db449b1c

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -17,7 +17,7 @@ Signer
#### *signer* . **connect** ( provider ) **=>** *Signer*
#### *signer* . **connect** ( provider ) **=>** *[Signer](./)*
TODO
@@ -28,14 +28,14 @@ TODO
#### *signer* . **getBalance** ( [ blockTag="latest" ] ) **=>** *Promise(BigNumber)*
#### *signer* . **getBalance** ( [ blockTag="latest" ] ) **=>** *Promise< [BigNumber](../utils/bignumber) >*
TODO
#### *signer* . **getTransactionCount** ( [ blockTag="latest" ] ) **=>** *Promise(number)*
#### *signer* . **getTransactionCount** ( [ blockTag="latest" ] ) **=>** *Promise< number >*
TODO
@@ -46,7 +46,8 @@ Wallet inherits Signer
----------------------
Wallet is...
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
@@ -69,4 +70,4 @@ TODO
-----
**Content Hash:** 08ec198fa4ab407a1bed0a705073d7f40a6c3969b8e922961939fd8e009ca1ed
**Content Hash:** 62c0d9640e683e41970dc1c779bd3b59ed08c27d99e15f6b51e7bae31ac1975e

File diff suppressed because one or more lines are too long

View File

@@ -11,7 +11,7 @@ Addresses
Explain addresses,formats and checksumming here.
Also see: [Constants.AddressZero](../constants)
Also see: [constants.AddressZero](../constants)
### Functions
@@ -20,32 +20,39 @@ Also see: [Constants.AddressZero](../constants)
#### *utils* . **getAddress** ( address ) **=>** *string*
TODO
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*
TODO
Returns true if *address* is valid (in any supported format).
#### *utils* . **getIcapAddress** ( address ) **=>** *string*
TODO
Returns *address* as an ICAP address. Supports the same restrictions as
[utils.getAddress](./).
#### *utils* . **getContractAddress** ( transaction ) **=>** *string*
TODO
Returns the contract address that would result if *transaction* was
used to deploy a contract.
-----
**Content Hash:** 0e138a3fe39efa87749ebc8290d153f705d26e547a38b7dce5f4d85603264d24
**Content Hash:** 2dd561245955594d7080796077503064181258304572112d320139ae2594f383

File diff suppressed because one or more lines are too long

View File

@@ -108,44 +108,7 @@ Returns an instance of a **BigNumber** for *aBigNumberish*.
```javascript
// From a decimal string...
BigNumber.from("42")
// { BigNumber: "42" }
// From a hexstring...
BigNumber.from("0x2a")
// { BigNumber: "42" }
// From a negative hexstring...
BigNumber.from("-0x2a")
// { BigNumber: "-42" }
// From an Array (or Uint8Array)...
BigNumber.from([ 42 ])
// { BigNumber: "42" }
// From an existing BigNumber...
let one1 = constants.One;
let one2 = BigNumber.from(one1)
one2
// { BigNumber: "1" }
// ...which returns the same instance
one1 === one2
// true
// From a (safe) number...
BigNumber.from(42)
// { BigNumber: "42" }
// From a ES2015 BigInt... (only on platforms with BigInt support)
BigNumber.from(42n)
// { BigNumber: "42" }
// Numbers outside the safe range fail:
BigNumber.from(Number.MAX_SAFE_INTEGER);
// Error: overflow (fault="overflow", operation="BigNumber.from", value=9007199254740991, version=bignumber/5.0.0-beta.129)
Skipping JavaScript Evaluation.
```
@@ -223,9 +186,9 @@ the *bitcount* least significant bits set to zero.
[Two's Complicment](https://en.wikipedia.org/wiki/Two%27s_complement)
is a method used to encode and decode fixed-width values which can be
positive or negative, without requiring a separate sign bit. Most users
will not need to interact with these.
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](./)*
@@ -333,11 +296,7 @@ Returns true if and only if the *object* is a BigNumber object.
```javascript
let a = BigNumber.from(42);
let b = BigNumber.from("91");
a.mul(b);
// { BigNumber: "3822" }
Skipping JavaScript Evaluation.
```
@@ -369,8 +328,7 @@ To demonstrate how this may be an issue in your code, consider:
```javascript
(Number.MAX_SAFE_INTEGER + 2 - 2) == (Number.MAX_SAFE_INTEGER)
// false
Skipping JavaScript Evaluation.
```
@@ -386,4 +344,4 @@ mathematical operations handled safely.
-----
**Content Hash:** 269c8464ff80c77316617cbfa4e9a195d742f829a23911fecf0bba16961f81ae
**Content Hash:** 76be4f72801f0d772c1ebe1acff4c41f6d52ed96f603de4b168f12d099470273

File diff suppressed because one or more lines are too long

View File

@@ -20,7 +20,7 @@ Types
### Bytes
A Bytes object is any object which is an
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),
@@ -31,13 +31,22 @@ is in the valid byte range.
### BytesLike
A **BytesLike** can be either a [Bytes](./) or a [Hexstring](./).
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
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
@@ -57,8 +66,9 @@ A **hexstring** is a string which has a `0x` prefix followed by
A **SignatureLike** is similar to a [Signature](./), except redundant properties
may be omitted.
For example, if *_vs* is specified, **(r, s)** and **v** can be omitted. Likewise,
if **recoverParam** is provided, **v** can be omitted (as it can be computed).
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
@@ -75,16 +85,16 @@ 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 an Array or TypedArray
where each value is a valid byte (i.e. between 0 and 255 inclusive).
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 the length (in bytes) is also verified.
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.
@@ -94,26 +104,24 @@ Converting between Arrays and Hexstrings
#### *utils* . **arrayify** ( hexstringOrArrayish [ , options ] ) **=>** *Uint8Array*
#### *utils* . **arrayify** ( datahexstringOrArrayish [ , options ] ) **=>** *Uint8Array*
Converts *hexstringOrArrayish* to a Uint8Array. If a [Hexstring](./)
is passed in, the length must be even.
Converts *datahexstringOrArrayish* to a Uint8Array.
#### *utils* . **hexlify** ( hexstringOrArrayish ) **=>** *string*
Converts *hexstringOrArrayish* to a [Hexstring](./). The result
will always be zero-padded to even length.
Converts *hexstringOrArrayish* to a [DataHexstring](./).
#### *utils* . **hexValue** ( aBigNumberish ) **=>** *string*
Converts *aBigNumberish* to a [Hexstring](./), with no unecessary leading
zeros. The result of this function can be of odd-length.
Converts *aBigNumberish* to a [Hexstring](./), with no *unnecessary* leading
zeros.
@@ -123,29 +131,7 @@ zeros. The result of this function can be of odd-length.
```javascript
// Convert a hexstring to a Uint8Array
arrayify("0x1234")
// [ 18, 52 ]
// Convert an Array to a hexstring
hexlify([1, 2, 3, 4])
// 0x01020304
// Convert an Object to a hexstring
hexlify({ length: 2, "0": 1, "1": 2 })
// 0x0102
// Convert an Array to a hexstring
hexlify([ 1 ])
// 0x01
// Convert a number to a stripped hex value
hexValue(1)
// 0x1
// Convert an Array to a stripped hex value
hexValue([ 1, 2 ])
// 0x102
Skipping JavaScript Evaluation.
```
@@ -157,22 +143,25 @@ Array Manipulation
#### *utils* . **concat** ( arrayOfBytesLike ) **=>** *Uint8Array*
Concatenates all the [BytesLike](./) in *arrayOfBytesLike*
into a single Uint8Array.
Concatenates all the [BytesLike](./) in *arrayOfBytesLike* into a single Uint8Array.
#### *utils* . **stripZeros** ( aBytesLike ) **=>** *Uint8Array*
Concatenates all the [BytesLike](./) in *arrayOfBytesLike*
Returns a Uint8Array with all leading `0` bytes of *aBtyesLike* removed.
#### *utils* . **zeroPad** ( aBytesLike , length ) **=>** *Uint8Array*
Concatenates all the [BytesLike](./) in *arrayOfBytesLike*
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.
@@ -182,41 +171,43 @@ Hexstring Manipulation
#### *utils* . **hexConcat** ( arrayOfBytesLike ) **=>** *string*
#### *utils* . **hexConcat** ( arrayOfBytesLike ) **=>** *[DataHexstring](./)*
Concatenates all the [BytesLike](./) in *arrayOfBytesLike*
into a single [Hexstring](./)
Concatenates all the [BytesLike](./) in *arrayOfBytesLike* into a single [DataHexstring](./)
#### *utils* . **hexDataLength** ( aBytesLike ) **=>** *number*
Returns the length (in bytes) of *aBytesLike*.
This will **throw and error** if *aBytesLike* is a [Hexstring](./)
but is of odd-length.
#### *utils* . **hexDataSlice** ( aBytesLike , offset [ , endOffset ] ) **=>** *string*
#### *utils* . **hexDataLength** ( aBytesLike ) **=>** *[DataHexstring](./)*
Returns the length (in bytes) of *aBytesLike*.
#### *utils* . **hexStripZeros** ( aBytesLike ) **=>** *string*
#### *utils* . **hexDataSlice** ( aBytesLike , offset [ , endOffset ] ) **=>** *[DataHexstring](./)*
@TODO
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* . **hexZeroPad** ( aBytesLike , length ) **=>** *string*
#### *utils* . **hexStripZeros** ( aBytesLike ) **=>** *[Hexstring](./)*
@TODO
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.
@@ -226,24 +217,22 @@ Signature Conversion
#### *utils* . **joinSignature** ( aSignatureLike ) **=>** *string*
#### *utils* . **joinSignature** ( aSignatureLike ) **=>** *[DataHexstring](./)*
Return the flat-format of a [SignatureLike](./), which is
65 bytes (130 nibbles) long, concatenating the **r**, **s** and **v**
of a Signature.
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*
#### *utils* . **splitSignature** ( aSignatureLikeOrBytesLike ) **=>** *[Signature](./)*
Return the full expanded-format of a [SignatureLike](./) or
a flat-format [Hexstring](./). Any missing properties will be
computed.
Return the full expanded-format of *aSignaturelike* or a flat-format [DataHexstring](./).
Any missing properties will be computed.
-----
**Content Hash:** 1e52066c61f8794d858f02fb8164b146c9379968b0e0ab90efeb2fe16831599f
**Content Hash:** fce7a8c85402ef3d94ffe261157fa3e0644c5c5d0641d9de7820a9a798bcb6c7

File diff suppressed because one or more lines are too long

View File

@@ -17,8 +17,7 @@ The **ethers.contants** Object contains commonly used values.
```javascript
//const { constants } = require("ethers");
// const { constants } = require("@ethersproject/constants");
Skipping JavaScript Evaluation.
```
@@ -28,14 +27,14 @@ Bytes
#### *constants* . **AddressZero**
#### *constants* . **AddressZero** **=>** *[DataHexstring](../bytes)*
The Address Zero, which is 20 bytes (40 nibbles) of zero.
#### *constants* . **HashZero**
#### *constants* . **HashZero** **=>** *[DataHexstring](../bytes)*
The Hash Zero, which is 32 bytes (64 nibbles) of zero.
@@ -47,7 +46,7 @@ Strings
#### *constants* . **EtherSymbol**
#### *constants* . **EtherSymbol** **=>** *string*
The Ether symbol, **&Xi;**.
@@ -59,35 +58,35 @@ BigNumber
#### *constants* . **NegativeOne**
#### *constants* . **NegativeOne** **=>** *[BigNumber](../bignumber)*
The BigNumber value representing `"-1"`.
#### *constants* . **Zero**
#### *constants* . **Zero** **=>** *[BigNumber](../bignumber)*
The BigNumber value representing `"0"`.
#### *constants* . **One**
#### *constants* . **One** **=>** *[BigNumber](../bignumber)*
The BigNumber value representing `"1"`.
#### *constants* . **Two**
#### *constants* . **Two** **=>** *[BigNumber](../bignumber)*
The BigNumber value representing `"2"`.
#### *constants* . **WeiPerEther**
#### *constants* . **WeiPerEther** **=>** *[BigNumber](../bignumber)*
The BigNumber value representing `"1000000000000000000"`, which is the
number of Wei per Ether.
@@ -95,7 +94,7 @@ number of Wei per Ether.
#### *constants* . **MaxUint256**
#### *constants* . **MaxUint256** **=>** *[BigNumber](../bignumber)*
The BigNumber value representing the maximum `uint256` value.
@@ -104,4 +103,4 @@ The BigNumber value representing the maximum `uint256` value.
-----
**Content Hash:** a781a8990aec282632e70ebc003a711adf5bc7773243aed727fc37a0934097f7
**Content Hash:** 11a9a2e37a2a553b79931caf5374bcd894edf343a897c4253ddeaf4d2f8e1213

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -20,35 +20,35 @@ The [Cryptographic Hash Functions](https://en.wikipedia.org/wiki/Cryptographic_h
are a specific family of hash functions.
#### *utils* . **keccak256** ( aBytesLike ) **=>** *string*
#### *utils* . **keccak256** ( aBytesLike ) **=>** *[DataHexstring](../bytes)*
Returns the [KECCAK256](https://en.wikipedia.org/wiki/SHA-3) digest *aBytesLike*.
#### *utils* . **ripemd160** ( aBytesLike ) **=>** *string*
#### *utils* . **ripemd160** ( aBytesLike ) **=>** *[DataHexstring](../bytes)*
Returns the [RIPEMD-160](https://en.m.wikipedia.org/wiki/RIPEMD) digest of *aBytesLike*.
#### *utils* . **sha256** ( aBytesLike ) **=>** *string*
#### *utils* . **sha256** ( aBytesLike ) **=>** *[DataHexstring](../bytes)*
Returns the [SHA2-256](https://en.wikipedia.org/wiki/SHA-2) digest of *aBytesLike*.
#### *utils* . **sha512** ( aBytesLike ) **=>** *string*
#### *utils* . **sha512** ( aBytesLike ) **=>** *[DataHexstring](../bytes)*
Returns the [SHA2-512](https://en.wikipedia.org/wiki/SHA-2) digest of *aBytesLike*.
#### *utils* . **computeHmac** ( algorithm , key , data ) **=>** *string*
#### *utils* . **computeHmac** ( algorithm , key , data ) **=>** *[DataHexstring](../bytes)*
Returns the [HMAC](https://en.wikipedia.org/wiki/HMAC) of *data* with *key*
using the [Algorithm](./) *algorithm*.
@@ -60,14 +60,14 @@ using the [Algorithm](./) *algorithm*.
#### *utils* . *SupportedAlgorithms* . **sha256**
#### *utils* . *SupportedAlgorithms* . **sha256** **=>** *string*
Use the [SHA2-256](https://en.wikipedia.org/wiki/SHA-2) hash algorithm.
#### *utils* . *SupportedAlgorithms* . **sha512**
#### *utils* . *SupportedAlgorithms* . **sha512** **=>** *string*
Use the [SHA2-512](https://en.wikipedia.org/wiki/SHA-2) hash algorithm.
@@ -79,7 +79,7 @@ Common Hashing Helpers
#### *utils* . **hashMessage** ( message ) **=>** *string*
#### *utils* . **hashMessage** ( message ) **=>** *[DataHexstring](../bytes)*
Computes the Ethereum message digest of *message*. Ethereum messages are
converted to UTF-8 bytes and prefixed with `x19Ethereum Signed Message:`
@@ -88,14 +88,14 @@ and the length of *message*.
#### *utils* . **id** ( text ) **=>** *string*
#### *utils* . **id** ( text ) **=>** *[DataHexstring](../bytes)*
The Ethereum Identity function computs the keccak256 hash of the *text* bytes.
#### *utils* . **namehash** ( name ) **=>** *string*
#### *utils* . **namehash** ( name ) **=>** *[DataHexstring](../bytes)*
Returns the [ENS Namehash](https://docs.ens.domains/contract-api-reference/name-processing#hashing-names) of *name*.
@@ -111,7 +111,7 @@ When using the Solidity `abi.packEncoded(...)` function, a non-standard
the tightly packing algorithm.
#### *utils* . **solidityPack** ( arrayOfTypes , arrayOfValues ) **=>** *string*
#### *utils* . **solidityPack** ( arrayOfTypes , arrayOfValues ) **=>** *[DataHexstring](../bytes)*
Returns the non-standard encoded *arrayOfValues* packed according to
their respecive type in *arrayOfTypes*.
@@ -119,7 +119,7 @@ their respecive type in *arrayOfTypes*.
#### *utils* . **solidityKeccak256** ( arrayOfTypes , arrayOfValues ) **=>** *string*
#### *utils* . **solidityKeccak256** ( arrayOfTypes , arrayOfValues ) **=>** *[DataHexstring](../bytes)*
Returns the KECCAK256 of the non-standard encoded *arrayOfValues* packed
according to their respective type in *arrayOfTypes*.
@@ -127,7 +127,7 @@ according to their respective type in *arrayOfTypes*.
#### *utils* . **soliditySha256** ( arrayOfTypes , arrayOfValues ) **=>** *string*
#### *utils* . **soliditySha256** ( arrayOfTypes , arrayOfValues ) **=>** *[DataHexstring](../bytes)*
Returns the SHA2-256 of the non-standard encoded *arrayOfValues* packed
according to their respective type in *arrayOfTypes*.
@@ -137,4 +137,4 @@ according to their respective type in *arrayOfTypes*.
-----
**Content Hash:** 65dd2158ef160da7be3291c8e7aac15df2de683869df9c31b8efdaa39551b3e4
**Content Hash:** 53b7b2b1fe243aebd3d5ff29c578538d0d068b0ff60b3426f7208cbf9f13d312

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -27,7 +27,7 @@ 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.
@@ -143,10 +143,10 @@ 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
it should **not** be considered a method to acheive *any* level of security from
[homoglyph attacks](https://en.wikipedia.org/wiki/IDN_homograph_attack).
@@ -154,4 +154,4 @@ it should not be considered a method to acheive *any* level of security from
-----
**Content Hash:** 74002cd3d9368872b5618f68967deac34a4d1aeafeeac6ddb5c1d06a450180c9
**Content Hash:** e38fe18f76e58587f7ed1c4558a5b3ec177eee1a5e71b4c88fa6d496154fdd8a

File diff suppressed because one or more lines are too long

View File

@@ -14,6 +14,7 @@ which developers can make use of or should be aware of.
* [Events](events)
* [Solidity Topics](events)
* [Gas](gas)
* [Gas Price](gas)
* [Gas Limit](gas)
@@ -21,4 +22,4 @@ which developers can make use of or should be aware of.
-----
**Content Hash:** ad59f45600332d936821db1fa0d0eeabdab5b4f252e1e815de525b4d1b9a9a7b
**Content Hash:** 1846ad5571101be31cf9617167b5cc53338c83c0fc9389da19c8dd9d4153558b

View File

@@ -12,6 +12,13 @@ Events
Explain how topics and such work
Solidity Topics
---------------
How to compute the topic...
-----
**Content Hash:** 4b045e823bf9863272ddb1c5a8460bc461de2ad262503dc27829b64b57344d46
**Content Hash:** 1334c1751891f09ab9349dcc5b7e6705ef823cd7b15a18433c053c764c6b9042

File diff suppressed because one or more lines are too long

View File

@@ -9,6 +9,8 @@ Gas
===
Explain attack vectors
Gas Price
---------
@@ -26,4 +28,4 @@ Gas Limit
-----
**Content Hash:** 4cc3001196d861faac19ebc393e002ce9e6f24702b66bac62ef8f9185625b3dc
**Content Hash:** 2805374ab42eae31d185e96ae9308f0661dc826d460b33005a86f62fc2f17703

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -149,6 +149,7 @@ _toc:
_null:
This breaks out of a directive. For example, to end a
_definition and reset the indentation.
```
@@ -194,4 +195,4 @@ This is a self-titled link [[https://ethereumorg]] and this
-----
**Content Hash:** 6cc55a98e7a50c76c8b27fbc7aae97bebaf9355a40b9c44a568f2f7fd927da57
**Content Hash:** 2d45e62661589ea3cdf50cc4da9faf63c33b7385840b31fddaf9d3cbe35d6015

File diff suppressed because one or more lines are too long

View File

@@ -50,7 +50,7 @@ const { ethers } = require("ethers");
It is generally better practice (for security reasons) to copy the
[ethers library](https://cdn.ethers.io/lib/ethers-5.0.min.js) to
[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
@@ -58,7 +58,7 @@ Web Applications from our CDN.
```
<script src="https://cdn.ethers.io/lib/ethers-5.0.min.js"
<script src="https://cdn.ethers.io/lib/ethers-5.0.esm.min.js"
type="application/javascipt"></script>
```
@@ -66,4 +66,4 @@ Web Applications from our CDN.
-----
**Content Hash:** 01b739e7d4410ec57652b8058ae7a5902107ce0b170ecd3550cbc97f4d287fd8
**Content Hash:** a78889cf0b1215b8268f76e5cef5869b2b592e56a5ce062d58dfcc4f5b93159d

File diff suppressed because one or more lines are too long

70
docs/hacking/README.md Normal file
View File

@@ -0,0 +1,70 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Hacking
=======
Things to keep in mind:
### Supported Platforms
...
### 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.
### 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.
### License
MIT...
### 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.
-----
**Content Hash:** 55f49a4430f6cc2ae9ca51a5932a710217a99e253a57173223b869e4378ab8bd

13
docs/hacking/index.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

15
docs/static/link.svg vendored Normal file
View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.1.1, 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 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
<path d="M92.7,7.5C88,2.7,81.7,0.2,75,0.2c-6.7,0-13,2.6-17.7,7.3L35.2,29.6c-9.7,9.7-9.7,25.6,0,35.4c1.6,1.6,3.4,2.8,5.2,3.9
l9.5-9.5c-2.2-0.5-4.2-1.6-5.9-3.3c-1.6-1.6-2.6-3.4-3.1-5.4v0c-0.2-0.7-0.3-1.4-0.4-2.1c0,0,0,0,0-0.1c-0.1-0.7-0.1-1.4,0-2.1
c0-0.1,0-0.1,0-0.2c0.1-0.7,0.2-1.3,0.3-2c0-0.1,0-0.1,0-0.2c0.5-2.1,1.6-4,3.2-5.6l22.1-22.1c2.4-2.4,5.6-3.7,8.8-3.7
c3.2,0,6.4,1.2,8.8,3.7c4.9,4.9,4.9,12.8,0,17.7l-7.7,7.7c0.2,0.5,0.3,1.1,0.5,1.6l0,0c0,0.1,0.1,0.3,0.1,0.4
c1.1,3.5,1.5,7.1,1.3,10.7v0c0,0.2,0,0.4-0.1,0.5c-0.1,0.9-0.1,1.8-0.2,2.6l14.8-14.8C102.4,33.1,102.4,17.2,92.7,7.5z M59.5,31.2
L50,40.7c2.1,0.5,4.2,1.6,5.9,3.3c1.6,1.6,2.6,3.4,3.1,5.4v0c0.2,0.7,0.3,1.4,0.4,2.1c0,0,0,0.1,0,0.1c0.1,0.7,0.1,1.4,0,2.1
c0,0.1,0,0.1,0,0.2c-0.1,0.7-0.2,1.3-0.3,2c0,0.1,0,0.1-0.1,0.2c-0.6,2.1-1.6,4-3.2,5.6L33.8,83.7c-2.4,2.4-5.6,3.7-8.8,3.7
s-6.4-1.2-8.8-3.7c-4.9-4.9-4.9-12.8,0-17.7l7.7-7.7c-0.2-0.5-0.3-1.1-0.5-1.6v0c0-0.1-0.1-0.3-0.1-0.4c-1.1-3.5-1.5-7.1-1.3-10.7
c0,0,0,0,0,0c0-0.2,0-0.4,0-0.5c0.1-0.9,0.1-1.8,0.2-2.6L7.3,57.2c-9.7,9.7-9.7,25.6,0,35.4c4.7,4.7,11,7.3,17.7,7.3
s13-2.6,17.7-7.3l22.1-22.1c9.7-9.7,9.7-25.6,0-35.4C63.2,33.5,61.4,32.3,59.5,31.2z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

100
docs/static/style.css vendored
View File

@@ -312,6 +312,60 @@ div.breadcrumbs span.current {
width: 800px;
}
.show-anchors > div {
position: relative;
}
.show-anchors > div > .anchors {
display: block;
height: 100%;
position: absolute;
pointer-events: none;
top: 0;
width: 100%;
}
.anchors a {
height: 50px;
position: absolute;
line-height: 50px;
pointer-events: auto;
transition: opacity 0.3s linear;
top: 50%;
}
.anchors a.self {
background: url(./link.svg) center no-repeat;
left: -8px;
opacity: 0;
transform: translate(-100%, -50%);
width: 20px;
}
.show-anchors:hover > div > .anchors a.self {
opacity: 0.3;
}
.show-anchors > div > .anchors a.self:hover {
opacity: 1;
}
.anchors a.source {
right: 0;
opacity: 0.3;
transform: translate(100%, -50%);
}
.show-anchors:hover > div > .anchors a.source {
opacity: 1;
}
.anchors a.source:hover {
opacity: 1;
}
.definition {
margin: 10px 0 0 15px;
padding: 10px 0 0 15px;
@@ -323,13 +377,53 @@ div.breadcrumbs span.current {
.definition .term {
font-size: 110%;
dddfont-weight: bold;
}
.definition.container-box {
border-radius: 5px;
left: 15px;
margin-bottom: 30px;
margin-top: 30px;
padding: 0;
position: relative;
width: 90%;
}
.definition.container-box .term {
color: #fff;
font-size: 16px;
font-weight: bold;
padding: 5px 15px;
}
.definition.container-box p {
font-size: 16px;
padding: 10px 30px;
}
.definition.container-box.note {
border: 2px solid #184e80;
}
.definition.container-box.note .term {
background-color: #65a9e9;
ddd-border: 2px solid #184e80;
}
.definition.container-box.warning {
border: 2px solid #804e18;
}
.definition.container-box.warning .term {
background-color: #cf7a00;
}
code.inline {
background: #eef;
dddpadding-left: 5px;
dddpadding-right: 5px;
padding-left: 5px;
padding-right: 5px;
}
.property {

File diff suppressed because one or more lines are too long

BIN
github-cache/0021245234e1 Normal file

Binary file not shown.

BIN
github-cache/00b424c41eb4 Normal file

Binary file not shown.

BIN
github-cache/0187d6d5fa5a Normal file

Binary file not shown.

BIN
github-cache/01b9c61ed32d Normal file

Binary file not shown.

BIN
github-cache/01fc95de636a Normal file

Binary file not shown.

BIN
github-cache/020b2817f386 Normal file

Binary file not shown.

BIN
github-cache/025023c5f720 Normal file

Binary file not shown.

BIN
github-cache/025f73edd66b Normal file

Binary file not shown.

BIN
github-cache/02cad84efaa5 Normal file

Binary file not shown.

BIN
github-cache/02e68d9902c5 Normal file

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More