Compare commits
119 Commits
v5.0.0-bet
...
v5.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
944600d779 | ||
|
|
b962b59ab7 | ||
|
|
375bd15594 | ||
|
|
f9ab665b52 | ||
|
|
a6b696d8bd | ||
|
|
89615c59d3 | ||
|
|
a33bf0e37f | ||
|
|
e7adc84a97 | ||
|
|
ff9bc2a282 | ||
|
|
b29510e363 | ||
|
|
13dbf1f965 | ||
|
|
5622f703d9 | ||
|
|
edb7c5da91 | ||
|
|
15bb840907 | ||
|
|
f02c7db410 | ||
|
|
bacc440397 | ||
|
|
8eb0190d5e | ||
|
|
acd601e7e7 | ||
|
|
05bfe21caf | ||
|
|
aafa42a32b | ||
|
|
1c85fe95b2 | ||
|
|
1decb13799 | ||
|
|
ba29618896 | ||
|
|
fa317ebc03 | ||
|
|
da8153c877 | ||
|
|
0296594aba | ||
|
|
bee5944567 | ||
|
|
7428776f75 | ||
|
|
edb49da155 | ||
|
|
99329b013c | ||
|
|
c11e7c348e | ||
|
|
e0d1d3866d | ||
|
|
f92d156f17 | ||
|
|
251882ced4 | ||
|
|
1ff5f5233e | ||
|
|
adf56229c6 | ||
|
|
931da2f774 | ||
|
|
5878b54d6e | ||
|
|
a055edb585 | ||
|
|
2d72c856a2 | ||
|
|
f4bcf24a25 | ||
|
|
ea102ef7c4 | ||
|
|
92a383ff0d | ||
|
|
75e1a37bb5 | ||
|
|
c66d81e96f | ||
|
|
10943fc3ef | ||
|
|
bb9aa808a0 | ||
|
|
90ed07c74e | ||
|
|
245cd0e48e | ||
|
|
72b3bc9909 | ||
|
|
4151c0eacd | ||
|
|
c84664953d | ||
|
|
6f7fbf3858 | ||
|
|
41740956df | ||
|
|
602e6a8973 | ||
|
|
2e8f5ca7ed | ||
|
|
381a72ddaa | ||
|
|
074eb4ba69 | ||
|
|
c04f9a7fff | ||
|
|
3c184ace21 | ||
|
|
a7e29d60f7 | ||
|
|
2d5492cd2e | ||
|
|
13f50abd84 | ||
|
|
d0f4642f6d | ||
|
|
1e72fc7d6f | ||
|
|
a21c430c7a | ||
|
|
eb26a6d950 | ||
|
|
a648f2bd1e | ||
|
|
e593aba294 | ||
|
|
5724fa5d9c | ||
|
|
f54f06b5c8 | ||
|
|
e809eadf8d | ||
|
|
184c459fab | ||
|
|
06cafe3437 | ||
|
|
fdf0980663 | ||
|
|
9c78c7fee6 | ||
|
|
fa9f53def7 | ||
|
|
cf036e1ffa | ||
|
|
4470477d7f | ||
|
|
e3752e5986 | ||
|
|
f308ba3540 | ||
|
|
2f0e679f0b | ||
|
|
abab9f6aa2 | ||
|
|
c11c2e2e33 | ||
|
|
3d75c52dac | ||
|
|
29f0e9dd62 | ||
|
|
79ef1e975d | ||
|
|
3ab373334c | ||
|
|
b72ef27b2a | ||
|
|
e518151509 | ||
|
|
19aaade9c6 | ||
|
|
c35ddaf646 | ||
|
|
8316406977 | ||
|
|
01ca35036c | ||
|
|
da8ca2e8bc | ||
|
|
1ec5804bd4 | ||
|
|
75895fa149 | ||
|
|
51e4ef2b45 | ||
|
|
e1509a6326 | ||
|
|
394c36cad4 | ||
|
|
1d4f90a958 | ||
|
|
494381a628 | ||
|
|
d9d438a119 | ||
|
|
3d514c8dbb | ||
|
|
28339a9c85 | ||
|
|
fea867a206 | ||
|
|
5b0c15930f | ||
|
|
12cfc59965 | ||
|
|
3c864de612 | ||
|
|
778eb3b425 | ||
|
|
3d25882d6b | ||
|
|
a12030ad29 | ||
|
|
828c8cfd41 | ||
|
|
238fcba83b | ||
|
|
751793ea25 | ||
|
|
6f4291f65f | ||
|
|
9c63b4a753 | ||
|
|
22a26736cc | ||
|
|
f0b2961f08 |
148
.circleci/config.yml
Normal file
148
.circleci/config.yml
Normal file
@@ -0,0 +1,148 @@
|
||||
version: 2.1
|
||||
|
||||
executors:
|
||||
machine_executor:
|
||||
machine: true
|
||||
working_directory: ~/repo
|
||||
|
||||
commands:
|
||||
build-and-test:
|
||||
parameters:
|
||||
node-version:
|
||||
type: string
|
||||
default: "10.16.3"
|
||||
test-script:
|
||||
type: string
|
||||
default: "test-node"
|
||||
upgrade-chrome:
|
||||
type: string
|
||||
default: ""
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
|
||||
- when:
|
||||
condition: << parameters.upgrade-chrome >>
|
||||
steps:
|
||||
- run:
|
||||
name: Upgrade chrome
|
||||
command: |
|
||||
sudo apt-get purge chromium-browser
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libappindicator1 fonts-liberation
|
||||
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
||||
sudo dpkg -i google-chrome*.deb
|
||||
google-chrome --version
|
||||
|
||||
- run:
|
||||
name: Update gcc version
|
||||
command: |
|
||||
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
|
||||
sudo apt update
|
||||
sudo apt install gcc-6
|
||||
sudo apt install g++-6
|
||||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6
|
||||
|
||||
- run:
|
||||
name: Prepare to run parity
|
||||
command: |
|
||||
mkdir -p /tmp/parity/keys
|
||||
cp -r admin/test-parity/parity-keys /tmp/parity/keys/DevelopmentChain
|
||||
cp admin/test-parity/parity-dev.* /tmp/parity
|
||||
chmod -R 777 /tmp/parity
|
||||
ls -la /tmp/parity
|
||||
|
||||
- run:
|
||||
name: Starting Parity
|
||||
command: |
|
||||
docker run -d \
|
||||
-p 8545:8545 \
|
||||
-p 8546:8546 \
|
||||
-p 30303:30303 \
|
||||
-p 30303:30303/udp \
|
||||
--name parity \
|
||||
-v /tmp/parity:/home/parity/.local/share/io.parity.ethereum parity/parity:v2.4.8-stable \
|
||||
--chain /home/parity/.local/share/io.parity.ethereum/parity-dev.json \
|
||||
--unlock=0x7454a8F5a7c7555d79B172C89D20E1f4e4CC226C \
|
||||
--password /home/parity/.local/share/io.parity.ethereum/parity-dev.pwds \
|
||||
--min-gas-price 1000000000 \
|
||||
--jsonrpc-interface all
|
||||
|
||||
- run:
|
||||
name: Waiting for Parity to be ready
|
||||
command: |
|
||||
for i in `seq 1 20`;
|
||||
do
|
||||
nc -z localhost 8545 && echo Success && exit 0
|
||||
echo -n .
|
||||
sleep 2
|
||||
done
|
||||
docker ps -a
|
||||
docker logs parity
|
||||
echo Failed waiting for Parity && exit 1
|
||||
|
||||
- run:
|
||||
name: Run << parameters.test-script >> with node version << parameters.node-version >>
|
||||
command: |
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
|
||||
nvm install << parameters.node-version >>
|
||||
node -v
|
||||
npm -v
|
||||
gcc --version
|
||||
npm ci
|
||||
npm run bootstrap
|
||||
npm run << parameters.test-script >>
|
||||
|
||||
jobs:
|
||||
node-v8:
|
||||
description: "test with node version 8"
|
||||
executor: machine_executor
|
||||
steps:
|
||||
- build-and-test:
|
||||
node-version: "8.16.1"
|
||||
test-script: "test-node"
|
||||
|
||||
node-v10:
|
||||
description: "test with node version 10"
|
||||
executor: machine_executor
|
||||
steps:
|
||||
- build-and-test:
|
||||
node-version: "10.16.3"
|
||||
test-script: "test-node"
|
||||
|
||||
node-v12:
|
||||
description: "test with node version 12"
|
||||
executor: machine_executor
|
||||
steps:
|
||||
- build-and-test:
|
||||
node-version: "12.13.1"
|
||||
test-script: "test-node"
|
||||
|
||||
browser-esm:
|
||||
description: "test browser with es6 module"
|
||||
executor: machine_executor
|
||||
steps:
|
||||
- build-and-test:
|
||||
node-version: "12.13.1"
|
||||
test-script: "test-browser-esm"
|
||||
upgrade-chrome: "true"
|
||||
|
||||
browser-umd:
|
||||
description: "test browser with es3 module"
|
||||
executor: machine_executor
|
||||
steps:
|
||||
- build-and-test:
|
||||
node-version: "12.13.1"
|
||||
test-script: "test-browser-umd"
|
||||
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
all:
|
||||
jobs:
|
||||
- node-v8
|
||||
- node-v10
|
||||
- node-v12
|
||||
- browser-esm
|
||||
- browser-umd
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -14,3 +14,7 @@ shims/*.d.ts
|
||||
**/*.tmp-browserify-*
|
||||
|
||||
lerna-debug.log
|
||||
|
||||
packages/*/tsconfig.tsbuildinfo
|
||||
|
||||
packages/testcases/input/nameprep/**
|
||||
|
||||
177
CHANGELOG.md
177
CHANGELOG.md
@@ -3,6 +3,183 @@ Changelog
|
||||
|
||||
This change log is managed by `scripts/cmds/update-versions` but may be manually updated.
|
||||
|
||||
ethers/v5.0.0-beta.172 (2020-02-04 00:59)
|
||||
-----------------------------------------
|
||||
|
||||
- Synced GitHub issue cache. ([13dbf1f](https://github.com/ethers-io/ethers.js/commit/13dbf1f965eab344d2a304f7612d19ea96391261))
|
||||
- Better typing for Timers. ([5622f70](https://github.com/ethers-io/ethers.js/commit/5622f703d962993442623ef1450a595825c4efa8))
|
||||
- Safer transaction serialization, matching signature.v with chainId. ([#708](https://github.com/ethers-io/ethers.js/issues/708); [edb7c5d](https://github.com/ethers-io/ethers.js/commit/edb7c5da91ce271688561364d867998b0f0675e3))
|
||||
- Fixed Opcode typo and added check to prevent future typos. ([15bb840](https://github.com/ethers-io/ethers.js/commit/15bb8409077f96b22e8bd60c426cddd015454e6b))
|
||||
- Renamed AST nodes for teh assembler. ([f02c7db](https://github.com/ethers-io/ethers.js/commit/f02c7db4109d1785b4528757aa50f24948e896ae))
|
||||
- Added timeout to waitForTransaction. ([#477](https://github.com/ethers-io/ethers.js/issues/477); [bacc440](https://github.com/ethers-io/ethers.js/commit/bacc4403979fa423890e269e7a5c7d11c6891a9f))
|
||||
- Added CLI for asm package. ([aafa42a](https://github.com/ethers-io/ethers.js/commit/aafa42a32b2a5c7481a409ad048dfc06112c6599))
|
||||
- Prevent Signer.checkTransaction from creating conflicting from properties. ([1decb13](https://github.com/ethers-io/ethers.js/commit/1decb1379902b60a15925b9b1de39633393db825))
|
||||
- Include asm in generated TypeScript dependencies. ([ba29618](https://github.com/ethers-io/ethers.js/commit/ba296188960fb345dfdab12f2bb3ed3dc5eab51a))
|
||||
- Clean up some asm checks and dead code. ([fa317eb](https://github.com/ethers-io/ethers.js/commit/fa317ebc032f8a5f9fb2dd10e23496252ae744e1))
|
||||
- More contained Opcode API. ([da8153c](https://github.com/ethers-io/ethers.js/commit/da8153c87753b79e5e4cd34d484b8e0e717426d9))
|
||||
- Added initial codedrop for the asm package. ([0296594](https://github.com/ethers-io/ethers.js/commit/0296594aba8d1e90e9ef7a18d2324f6cac815953))
|
||||
|
||||
ethers/v5.0.0-beta.171 (2020-02-01 05:05)
|
||||
-----------------------------------------
|
||||
|
||||
- Added CLI for asm package. ([aafa42a](https://github.com/ethers-io/ethers.js/commit/aafa42a32b2a5c7481a409ad048dfc06112c6599))
|
||||
- Added more flatworm documentation. ([1c85fe9](https://github.com/ethers-io/ethers.js/commit/1c85fe95b2b536828e83087676becba85c9a90bb))
|
||||
- Prevent Signer.checkTransaction from creating conflicting from properties. ([1decb13](https://github.com/ethers-io/ethers.js/commit/1decb1379902b60a15925b9b1de39633393db825))
|
||||
- Include asm in generated TypeScript dependencies. ([ba29618](https://github.com/ethers-io/ethers.js/commit/ba296188960fb345dfdab12f2bb3ed3dc5eab51a))
|
||||
- Clean up some asm checks and dead code. ([fa317eb](https://github.com/ethers-io/ethers.js/commit/fa317ebc032f8a5f9fb2dd10e23496252ae744e1))
|
||||
- More contained Opcode API. ([da8153c](https://github.com/ethers-io/ethers.js/commit/da8153c87753b79e5e4cd34d484b8e0e717426d9))
|
||||
- Added initial codedrop for the asm package. ([0296594](https://github.com/ethers-io/ethers.js/commit/0296594aba8d1e90e9ef7a18d2324f6cac815953))
|
||||
|
||||
ethers/v5.0.0-beta.171 (2020-01-29 21:41)
|
||||
-----------------------------------------
|
||||
|
||||
- Better solc support in CLI; it will search the local pacakge for an existing solc version. ([7428776](https://github.com/ethers-io/ethers.js/commit/7428776f75222d5c07282bc29c3dd8ed99f5d2cc))
|
||||
- Update ENS registry address and lower default quorum for testnets. ([edb49da](https://github.com/ethers-io/ethers.js/commit/edb49da15518f25b3d60813ebb84f54171e308f3))
|
||||
- Exposed isBytes and isBytesLike in ethers.utils. ([99329b0](https://github.com/ethers-io/ethers.js/commit/99329b013ce7f3af301d40c41f7eb35bff288910))
|
||||
|
||||
ethers/v5.0.0-beta.170 (2020-01-21 20:37)
|
||||
-----------------------------------------
|
||||
|
||||
- Better, easier and more provider testing. ([e0d1d38](https://github.com/ethers-io/ethers.js/commit/e0d1d3866d2559f39627254873a0a1d4c0fcaf3d))
|
||||
- Fixed out-of-bounds difficulty in getBlock, which can affect PoA networks. ([#711](https://github.com/ethers-io/ethers.js/issues/711); [251882c](https://github.com/ethers-io/ethers.js/commit/251882ced4379931ec82ba28a4db10bc7dbf3580))
|
||||
|
||||
ethers/v5.0.0-beta.169 (2020-01-20 19:42)
|
||||
-----------------------------------------
|
||||
|
||||
- Fixed imports after refactor. ([adf5622](https://github.com/ethers-io/ethers.js/commit/adf56229c6cc83003d319ea9a004677e2555d478))
|
||||
- Refactor some enum names and add UTF-8 error support to the umbrella package. ([931da2f](https://github.com/ethers-io/ethers.js/commit/931da2f77446fc9266cf07f0d7d78d4376625005))
|
||||
- Allow arbitrary apiKey for UrlJsonRpcProvider. ([5878b54](https://github.com/ethers-io/ethers.js/commit/5878b54d6eded1329a6dc3b4023f876a87f72b6e))
|
||||
- Added more general error handling (e.g. error, ignore, replace) for calling toUtf8String. ([a055edb](https://github.com/ethers-io/ethers.js/commit/a055edb5855b96fdf179403458c1694b96fd906c))
|
||||
|
||||
ethers/v5.0.0-beta.168 (2020-01-18 21:46)
|
||||
-----------------------------------------
|
||||
|
||||
- Much more resiliant FallbackProvider which can ignore properties that are only approximate and supports per-provider priorities. ([#635](https://github.com/ethers-io/ethers.js/issues/635), [#588](https://github.com/ethers-io/ethers.js/issues/588); [f4bcf24](https://github.com/ethers-io/ethers.js/commit/f4bcf24a257a17ec9beb98f3d0b3682de543534c))
|
||||
- Fixed some typing for receipts and logs. ([#497](https://github.com/ethers-io/ethers.js/issues/497); [ea102ef](https://github.com/ethers-io/ethers.js/commit/ea102ef7c4fa5df7b9389fbc8a2947bbbd4c471e))
|
||||
- Abstracting mnemonic phrases. ([#685](https://github.com/ethers-io/ethers.js/issues/685); [92a383f](https://github.com/ethers-io/ethers.js/commit/92a383ff0dad4587e44953efca3c6ab795a1b1bd))
|
||||
- Sync GitHub issues. ([75e1a37](https://github.com/ethers-io/ethers.js/commit/75e1a37bb5935d5d538ffcfce5b0073e1334d457))
|
||||
- Fixed 304 status for fetchJson. ([c66d81e](https://github.com/ethers-io/ethers.js/commit/c66d81e96f7c9b0808f181085ffe1c92f6219d46))
|
||||
|
||||
ethers/v5.0.0-beta.167 (2020-01-11 04:16)
|
||||
-----------------------------------------
|
||||
|
||||
- Fixed testcases for provider changes. ([90ed07c](https://github.com/ethers-io/ethers.js/commit/90ed07c74e7230ea0f02288b140d497d8b9779e0))
|
||||
- Add support for legacy flat signatures with recid instead of normalized v. ([245cd0e](https://github.com/ethers-io/ethers.js/commit/245cd0e48e07eef35f5bf45ee7fe5ed5ef31338a))
|
||||
- Fix TransactionResponse to have chainId instead of legacy networkId. ([#700](https://github.com/ethers-io/ethers.js/issues/700); [72b3bc9](https://github.com/ethers-io/ethers.js/commit/72b3bc9909074893038c768f3da1564ed96a6a20))
|
||||
- Fixed splitSignature computing wrong v for BytesLike. ([#700](https://github.com/ethers-io/ethers.js/issues/700); [4151c0e](https://github.com/ethers-io/ethers.js/commit/4151c0eacd22287e2369a8656ffa00359db6f84b))
|
||||
- Added dist files for hardware-wallets. ([c846649](https://github.com/ethers-io/ethers.js/commit/c84664953d2f50ee0d704a8aa18fe6c08668dabb))
|
||||
- Browser support (with dist files) for Ledger. ([6f7fbf3](https://github.com/ethers-io/ethers.js/commit/6f7fbf3858c82417933a5e5595a919c0ec0487c7))
|
||||
|
||||
ethers/v5.0.0-beta.166 (2020-01-10 03:09)
|
||||
-----------------------------------------
|
||||
|
||||
- Relaxed joinSignature API to allow SignauteLike. ([602e6a8](https://github.com/ethers-io/ethers.js/commit/602e6a8973480299843a0158f75451a2c6aac749))
|
||||
- Initial code drop of new hardware wallet package. ([2e8f5ca](https://github.com/ethers-io/ethers.js/commit/2e8f5ca7ed498261079da75713b18f3370dfd236))
|
||||
- Added more docs. ([381a72d](https://github.com/ethers-io/ethers.js/commit/381a72ddaa7fb59ef2ded84d228296d693df05c3))
|
||||
|
||||
ethers/v5.0.0-beta.165 (2020-01-09 03:31)
|
||||
-----------------------------------------
|
||||
|
||||
- Fixed require resolution for CLI scripts. ([c04f9a7](https://github.com/ethers-io/ethers.js/commit/c04f9a7fff727bb04a4aa3a0fa05fd5cd8e795a6))
|
||||
- Added new URLs for default ETC (and ETC testnets) providers. ([#351](https://github.com/ethers-io/ethers.js/issues/351); [3c184ac](https://github.com/ethers-io/ethers.js/commit/3c184ace21aafbb27f4d44cce1bb738af899d59f))
|
||||
|
||||
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)
|
||||
-----------------------------------------
|
||||
|
||||
|
||||
24
README.md
24
README.md
@@ -1,11 +1,17 @@
|
||||
The Ethers Project
|
||||
==================
|
||||
|
||||
**EXPERIMENTAL!!!**
|
||||
**EXPERIMENTAL**
|
||||
|
||||
This is just a development version to experiment with lerna.
|
||||
This branch is the next release of ethers.js, which should
|
||||
be promoted to the official release shortly.
|
||||
|
||||
**Do NOT use**
|
||||
I would recommend it for most new projects and personally use
|
||||
it for my own projects.
|
||||
|
||||
The [new documentation](https://docs-beta.ethers.io) is still a
|
||||
bit sparse, but is coming along as well and will be complete
|
||||
before the promotion to master.
|
||||
|
||||
|
||||
Installing
|
||||
@@ -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>
|
||||
```
|
||||
|
||||
|
||||
@@ -36,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;
|
||||
@@ -69,15 +69,17 @@ function setupConfig(outDir, moduleType, targetType) {
|
||||
|
||||
if (info._ethers_nobuild) { return; }
|
||||
|
||||
if (info.browser) {
|
||||
if (typeof(info.browser) === "string") {
|
||||
info.browser = update(info.browser);
|
||||
} else {
|
||||
for (let key in info.browser) {
|
||||
info.browser[key] = update(info.browser[key]);
|
||||
[ "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");
|
||||
@@ -103,7 +105,7 @@ function runBuild(buildModule) {
|
||||
}
|
||||
|
||||
function runDist() {
|
||||
return run("npm", [ "run", "_dist_ethers" ], true);
|
||||
return run("npm", [ "run", "_dist" ], true);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
10
admin/cmds/cache-github.js
Normal file
10
admin/cmds/cache-github.js
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
const config = require("../config");
|
||||
const { syncIssues } = require("../github");
|
||||
|
||||
(async function() {
|
||||
const user = await config.get("github-user");
|
||||
const password = await config.get("github-readonly");
|
||||
await syncIssues(user, password);
|
||||
})();
|
||||
142
admin/cmds/grep-github.js
Normal file
142
admin/cmds/grep-github.js
Normal file
@@ -0,0 +1,142 @@
|
||||
"use strict";
|
||||
|
||||
const { colorify } = require("../log");
|
||||
const { getIssues } = require("../github");
|
||||
const { repeat } = require("../utils");
|
||||
|
||||
const Options = {
|
||||
"body": 1,
|
||||
"end": 1,
|
||||
"issue": 1,
|
||||
"start": 1,
|
||||
"title": 1,
|
||||
"user": 1,
|
||||
};
|
||||
|
||||
const Flags = {
|
||||
"open": 1,
|
||||
"match-case": 1,
|
||||
};
|
||||
|
||||
(async function() {
|
||||
const options = { };
|
||||
for (let i = 2; i < process.argv.length; i++) {
|
||||
const option = process.argv[i];
|
||||
if (option.substring(0, 2) === "--") {
|
||||
const comps = option.substring(2).split(/=/);
|
||||
if (Flags[comps[0]]) {
|
||||
if (comps[1] != null) { throw new Error("Invalid flag: " + option); }
|
||||
options[comps[0]] = true;
|
||||
} else if (Options[comps[0]]) {
|
||||
if (comps[1] == null) {
|
||||
options[comps[0]] = process.argv[++i];
|
||||
if (options[comps[0]] == null) {
|
||||
throw new Error("Missing option value: " + option);
|
||||
}
|
||||
} else {
|
||||
options[comps[0]] = comps[1];
|
||||
}
|
||||
} else {
|
||||
throw new Error("Unexpected option: " + option);
|
||||
}
|
||||
} else {
|
||||
throw new Error("Unexpected argument: " + option);
|
||||
}
|
||||
}
|
||||
|
||||
if (options["title"]) { options.title = new RegExp(options.title, (options["match-case"] ? "": "i")); }
|
||||
if (options["body"]) { options.body = new RegExp(options.title, (options["match-case"] ? "": "i")); }
|
||||
if (options["start"]) {
|
||||
if (options["start"].match(/^[0-9]{4}-[0-9]{2}-[0-9{2}]$/)) {
|
||||
throw new Error("Expected YYYY-MM-DD");
|
||||
}
|
||||
}
|
||||
if (options["end"]) {
|
||||
if (options["end"].match(/^[0-9]{4}-[0-9]{2}-[0-9{2}]$/)) {
|
||||
throw new Error("Expected YYYY-MM-DD");
|
||||
}
|
||||
}
|
||||
|
||||
const count = { issues: 0, comments: 0, code: 0, responses: 0 };
|
||||
|
||||
const issues = await getIssues();
|
||||
issues.forEach((issue) => {
|
||||
const info = issue.issue;
|
||||
const comments = issue.comments;
|
||||
|
||||
if (options.issue && parseInt(options.issue) != info.number) { return; }
|
||||
if (options.open && info.state !== "open") { return; }
|
||||
if (options.title && !info.title.match(options.title)) { return; }
|
||||
if (options.body) {
|
||||
const body = info.body + "\n" + comments.map((c) => (c.body)).join("\n");
|
||||
if (!body.match(options.body)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (options.user) {
|
||||
const users = comments.map((c) => (c.user.login));
|
||||
users.push(info.user.login);
|
||||
if (users.indexOf(options.user) === -1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const dates = comments.map((c) => (c.created_at.split("T")[0]));
|
||||
dates.push(info.created_at.split("T")[0]);
|
||||
|
||||
if (options.start) {
|
||||
if (dates.filter((d) => (d >= options.start)).length === 0) { return; }
|
||||
}
|
||||
if (options.end) {
|
||||
if (dates.filter((d) => (d <= options.start)).length === 0) { return; }
|
||||
}
|
||||
|
||||
count.issues++;
|
||||
|
||||
console.log(colorify(repeat("=", 70), "bold"))
|
||||
console.log(colorify("Issue:", "bold"), info.title, ` (#${ info.number })`);
|
||||
console.log(colorify("User:","bold"), colorify(info.user.login, "blue"));
|
||||
console.log(colorify("State:", "bold"), info.state);
|
||||
if (info.created_at === info.updated_at) {
|
||||
console.log(colorify("Created:", "bold"), info.created_at);
|
||||
} else {
|
||||
console.log(colorify("Created:", "bold"), info.created_at, ` (updated: ${ info.updated_at })`);
|
||||
}
|
||||
info.body.trim().split("\n").forEach((line) => {
|
||||
console.log(" " + line);
|
||||
});
|
||||
|
||||
if (comments.length) {
|
||||
comments.forEach((info) => {
|
||||
if (options.start && info.created_at < options.start) { return ; }
|
||||
if (options.end && info.created_at > options.end) { return; }
|
||||
count.comments++;
|
||||
if (options.user && info.user.login !== options.user) { return; }
|
||||
count.responses++;
|
||||
if (info.body.indexOf("`") >= 0) { count.code++; }
|
||||
console.log(colorify(repeat("-", 70), "bold"));
|
||||
console.log(colorify("User:", "bold"), colorify(info.user.login, "green"));
|
||||
if (info.created_at === info.updated_at) {
|
||||
console.log(colorify("Created:", "bold"), info.created_at);
|
||||
} else {
|
||||
console.log(colorify("Created:", "bold"), info.created_at, ` (updated: ${ info.updated_at })`);
|
||||
}
|
||||
info.body.trim().split("\n").forEach((line) => {
|
||||
console.log(" " + line);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
console.log(colorify(repeat("=", 70), "bold"))
|
||||
|
||||
// @TODO: Add stats on new/closed issues
|
||||
//if (options.user) {
|
||||
// console.log(`${ count.responses } responses (${ count.code } w/ code) on ${ count.comments } comments across ${ count.issues } issues.`);
|
||||
//} else {
|
||||
console.log(`${ count.comments } comment${ (count.comments !== 1) ? "s": "" } across ${ count.issues } issue${ (count.issues !== 1) ? "s": ""}.`);
|
||||
//}
|
||||
|
||||
})().catch((error) => {
|
||||
console.log("Error: " + error.message);
|
||||
});
|
||||
@@ -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":
|
||||
|
||||
16
admin/cmds/set-config.js
Normal file
16
admin/cmds/set-config.js
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
const { prompt } = require("../../packages/cli");
|
||||
const config = require("../config");
|
||||
|
||||
if (process.argv.length !== 3) {
|
||||
console.log("Usage: set-config KEY");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const key = process.argv[2];
|
||||
|
||||
(async function() {
|
||||
const value = await prompt.getPassword("Value: ");
|
||||
await config.set(key, value);
|
||||
})();
|
||||
44
admin/cmds/set-option.js
Executable file
44
admin/cmds/set-option.js
Executable file
@@ -0,0 +1,44 @@
|
||||
const { setupBuild } = require("../build");
|
||||
const { loadPackage, savePackage } = require("../local");
|
||||
|
||||
const arg = process.argv[2];
|
||||
|
||||
(async function() {
|
||||
switch(arg) {
|
||||
case "esm":
|
||||
setupBuild(true);
|
||||
break;
|
||||
|
||||
case "cjs":
|
||||
setupBuild(false);
|
||||
break;
|
||||
|
||||
case "browser-lang-en": {
|
||||
const info = loadPackage("wordlists");
|
||||
if (info._browser) {
|
||||
info.browser = info._browser;
|
||||
delete info._browser;
|
||||
savePackage("wordlists", info);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case "browser-lang-all": {
|
||||
const info = loadPackage("wordlists");
|
||||
if (info.browser) {
|
||||
info._browser = info.browser;
|
||||
delete info.browser;
|
||||
savePackage("wordlists", info);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
console.log("unknown option");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
})().then((result) => {
|
||||
process.exit(result);
|
||||
});
|
||||
@@ -8,8 +8,18 @@ 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 {
|
||||
|
||||
172
admin/cmds/upload-docs.js
Normal file
172
admin/cmds/upload-docs.js
Normal file
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
|
||||
const crypto = require('crypto');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const AWS = require('aws-sdk');
|
||||
|
||||
const config = require("../config");
|
||||
|
||||
|
||||
const Bucket = "docs-beta.ethers.io";
|
||||
|
||||
|
||||
function _getKeys(s3, result, nextToken, callback) {
|
||||
const params = {
|
||||
Bucket: Bucket,
|
||||
MaxKeys: 1000,
|
||||
ContinuationToken: nextToken,
|
||||
};
|
||||
s3.listObjectsV2(params, function(error, data) {
|
||||
if (error) {
|
||||
console.log(error);
|
||||
callback(error);
|
||||
return;
|
||||
}
|
||||
data.Contents.forEach(function(item) {
|
||||
result[item.Key] = item.ETag.replace(/"/g,'');
|
||||
});
|
||||
callback(null, data.IsTruncated ? data.NextContinuationToken: null);
|
||||
});
|
||||
}
|
||||
|
||||
function getKeys(s3) {
|
||||
const result = {};
|
||||
return new Promise(function(resolve, reject) {
|
||||
function handleBlock(error, nextToken) {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else if (nextToken) {
|
||||
nextBlock(nextToken);
|
||||
} else {
|
||||
resolve(result);
|
||||
}
|
||||
}
|
||||
function nextBlock(nextToken) {
|
||||
_getKeys(s3, result, nextToken, handleBlock);
|
||||
}
|
||||
nextBlock(undefined);
|
||||
});
|
||||
}
|
||||
|
||||
function getMime(filename) {
|
||||
const comps = filename.split('.');
|
||||
const ext = comps[comps.length - 1];
|
||||
switch (ext.toLowerCase()) {
|
||||
case 'css': return 'text/css';
|
||||
case 'doctree': return 'application/x-doctree';
|
||||
case 'eot': return 'application/vnd.ms-fontobject';
|
||||
case 'gif': return 'image/gif';
|
||||
case 'html': return 'text/html';
|
||||
case 'js': return 'application/javascript';
|
||||
case 'jpg': return 'image/jpeg';
|
||||
case 'jpeg': return 'image/jpeg';
|
||||
case 'md': return 'text/markdown';
|
||||
case 'pickle': return 'application/x-pickle';
|
||||
case 'png': return 'image/png';
|
||||
case 'svg': return 'image/svg+xml';
|
||||
case 'ttf': return 'application/x-font-ttf';
|
||||
case 'txt': return 'text/plain';
|
||||
case 'woff': return 'application/font-woff';
|
||||
}
|
||||
console.log('NO MIME', filename);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function putObject(s3, name, content) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
s3.putObject({
|
||||
ACL: 'public-read',
|
||||
Body: content,
|
||||
Bucket: Bucket,
|
||||
ContentType: getMime(name),
|
||||
Key: name
|
||||
}, function(error, data) {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
console.log('Uplodaed:', name)
|
||||
resolve({
|
||||
name: name,
|
||||
hash: data.ETag.replace(/"/g, '')
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function hash(filename) {
|
||||
const hasher = crypto.createHash('md5');
|
||||
hasher.update(fs.readFileSync(filename));
|
||||
return hasher.digest().toString('hex');
|
||||
}
|
||||
|
||||
function _getFiles(result, root) {
|
||||
fs.readdirSync(root).forEach(function(filename) {
|
||||
|
||||
// We don't need to upload junk
|
||||
if (filename === '.DS_Store') { return; }
|
||||
|
||||
const fullFilename = path.join(root, filename)
|
||||
const stat = fs.statSync(fullFilename);
|
||||
if (stat.isDirectory()) {
|
||||
_getFiles(result, fullFilename);
|
||||
} else {
|
||||
result[fullFilename] = hash(fullFilename);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getFiles(dirs) {
|
||||
const result = { } //"index.html": hash("index.html") };
|
||||
dirs.forEach(function(dir) {
|
||||
_getFiles(result, dir);
|
||||
})
|
||||
return result;
|
||||
}
|
||||
|
||||
(async function() {
|
||||
const awsAccessId = await config.get("aws-upload-docs-accesskey");
|
||||
const awsSecretKey = await config.get("aws-upload-docs-secretkey");
|
||||
|
||||
const s3 = new AWS.S3({
|
||||
apiVersion: '2006-03-01',
|
||||
accessKeyId: awsAccessId,
|
||||
secretAccessKey: awsSecretKey
|
||||
});
|
||||
|
||||
const added = [], removed = [], changed = [], upload = [];
|
||||
|
||||
const local = await getFiles([ "docs" ]);
|
||||
const remote = await getKeys(s3);
|
||||
|
||||
Object.keys(local).forEach((filename) => {
|
||||
if (!remote[filename]) {
|
||||
added.push(filename);
|
||||
upload.push(filename);
|
||||
} else if (remote[filename] != local[filename]) {
|
||||
changed.push(filename);
|
||||
upload.push(filename);
|
||||
}
|
||||
});
|
||||
|
||||
Object.keys(remote).forEach((filename) => {
|
||||
if (!local[filename]) {
|
||||
removed.push(filename);
|
||||
} else if (!local[filename] && remote[filename] != local[filename]) {
|
||||
changed.push(filename);
|
||||
upload.push(filename);
|
||||
}
|
||||
});
|
||||
|
||||
console.log('Added: ', added.length);
|
||||
console.log('Removed: ', removed.length);
|
||||
console.log('Changed: ', changed.length);
|
||||
|
||||
for (let i = 0; i < upload.length; i++) {
|
||||
const filename = upload[i];
|
||||
console.log("Uploading:", filename);
|
||||
await putObject(s3, filename, fs.readFileSync(filename));
|
||||
}
|
||||
})();
|
||||
121
admin/config.js
121
admin/config.js
@@ -13,75 +13,96 @@ const computeHmac = require("../packages/sha2").computeHmac;
|
||||
|
||||
const colorify = require("./log").colorify;
|
||||
|
||||
function getConfigFilename() {
|
||||
return resolve(os.homedir(), ".ethers-dist");
|
||||
}
|
||||
|
||||
function getScrypt(message, password, salt) {
|
||||
let progressBar = prompt.getProgressBar(message);
|
||||
return new Promise((resolve, reject) => {
|
||||
scrypt(Buffer.from(password), Buffer.from(salt), (1 << 17), 8, 1, 64, (error, progress, key) => {
|
||||
if (error) { return reject(error); }
|
||||
progressBar(progress);
|
||||
if (key) { resolve(key); }
|
||||
});
|
||||
});
|
||||
return scrypt.scrypt(Buffer.from(password), Buffer.from(salt), (1 << 17), 8, 1, 64, progressBar);
|
||||
}
|
||||
|
||||
async function loadConfig(dkey) {
|
||||
let config = { };
|
||||
function Config(filename) {
|
||||
this.salt = null;
|
||||
this.dkey = null;
|
||||
this.values = { };
|
||||
this.filename = filename;
|
||||
}
|
||||
|
||||
let filename = getConfigFilename();
|
||||
if (fs.existsSync(filename)) {
|
||||
let data = JSON.parse(fs.readFileSync(filename));
|
||||
let ciphertext = Buffer.from(data.ciphertext, "base64");
|
||||
let iv = Buffer.from(data.iv, "base64");
|
||||
let aes = new AES.ModeOfOperation.ctr(dkey.slice(0, 32), new AES.Counter(iv));
|
||||
let plaintext = aes.decrypt(ciphertext);
|
||||
let hmac = computeHmac("sha512", dkey.slice(32, 64), plaintext);
|
||||
Config.prototype.load = async function() {
|
||||
if (this.dkey) { return; }
|
||||
|
||||
let data = null;
|
||||
if (fs.existsSync(this.filename)) {
|
||||
data = JSON.parse(fs.readFileSync(this.filename));
|
||||
} else {
|
||||
data = {
|
||||
salt: Buffer.from(randomBytes(32)).toString("hex")
|
||||
};
|
||||
}
|
||||
|
||||
this.salt = data.salt;
|
||||
|
||||
const password = await prompt.getPassword(colorify("Password (config-store): ", "bold"));
|
||||
|
||||
this.dkey = await getScrypt(colorify("Unlocking config", "bold"), password, this.salt);
|
||||
|
||||
if (data.ciphertext) {
|
||||
const ciphertext = Buffer.from(data.ciphertext, "base64");
|
||||
const iv = Buffer.from(data.iv, "base64");
|
||||
const aes = new AES.ModeOfOperation.ctr(this.dkey.slice(0, 32), new AES.Counter(iv));
|
||||
const plaintext = aes.decrypt(ciphertext);
|
||||
const hmac = computeHmac("sha512", this.dkey.slice(32, 64), plaintext);
|
||||
if (hmac !== data.hmac) {
|
||||
throw new Error("wrong password");
|
||||
}
|
||||
config = JSON.parse(Buffer.from(plaintext).toString());
|
||||
|
||||
this.values = JSON.parse(Buffer.from(plaintext).toString());
|
||||
}
|
||||
};
|
||||
|
||||
return config;
|
||||
}
|
||||
Config.prototype.save = function() {
|
||||
this.values._junk = Buffer.from(randomBytes(16 + parseInt(Math.random() * 48))).toString("base64")
|
||||
|
||||
async function getConfig(key) {
|
||||
let password = await prompt.getPassword(colorify("Password (seesion-store): ", "bold"));
|
||||
let dkey = await getScrypt(colorify("Decrypting", "bold"), password, key);
|
||||
const plaintext = Buffer.from(JSON.stringify(this.values));
|
||||
|
||||
let config = await loadConfig(dkey);
|
||||
return config[key];
|
||||
}
|
||||
const iv = Buffer.from(randomBytes(16));
|
||||
const hmac = computeHmac("sha512", this.dkey.slice(32, 64), plaintext);
|
||||
|
||||
async function setConfig(key, value) {
|
||||
let password = await prompt.getPassword(colorify("Password (seesion-store): ", "bold"));
|
||||
let dkey = await getScrypt("Encrypting", password, key);
|
||||
const aes = new AES.ModeOfOperation.ctr(this.dkey.slice(0, 32), new AES.Counter(iv));
|
||||
const ciphertext = Buffer.from(aes.encrypt(plaintext));
|
||||
|
||||
let config = await loadConfig(dkey);
|
||||
config[key] = value;
|
||||
config._junk = Buffer.from(randomBytes(16 + parseInt(Math.random() * 48))).toString("base64")
|
||||
|
||||
let plaintext = Buffer.from(JSON.stringify(config));
|
||||
|
||||
let iv = Buffer.from(randomBytes(16));
|
||||
let hmac = computeHmac("sha512", dkey.slice(32, 64), plaintext);
|
||||
|
||||
let aes = new AES.ModeOfOperation.ctr(dkey.slice(0, 32), new AES.Counter(iv));
|
||||
let ciphertext = Buffer.from(aes.encrypt(plaintext));
|
||||
|
||||
let data = {
|
||||
const data = {
|
||||
ciphertext: ciphertext.toString("base64"),
|
||||
iv: iv.toString("base64"),
|
||||
salt: this.salt,
|
||||
hmac: hmac
|
||||
};
|
||||
|
||||
fs.writeFileSync(getConfigFilename(), JSON.stringify(data, null, 2));
|
||||
fs.writeFileSync(this.filename, JSON.stringify(data, null, 2));
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
get: getConfig,
|
||||
set: setConfig
|
||||
Config.prototype.get = async function(key) {
|
||||
await this.load();
|
||||
return this.values[key];
|
||||
};
|
||||
|
||||
Config.prototype.set = async function(key, value) {
|
||||
await this.load();
|
||||
this.values[key] = value;
|
||||
this.save();
|
||||
};
|
||||
|
||||
Config.prototype.lock = function() {
|
||||
this.salt = this.dkey = null;
|
||||
}
|
||||
|
||||
const config = new Config(resolve(os.homedir(), ".ethers-dist"));
|
||||
|
||||
module.exports = {
|
||||
get: function(key) {
|
||||
return config.get(key);
|
||||
},
|
||||
set: function(key, value) {
|
||||
config.set(key, value);
|
||||
},
|
||||
lock: function() {
|
||||
config.lock();
|
||||
}
|
||||
}
|
||||
|
||||
134
admin/github.js
Normal file
134
admin/github.js
Normal file
@@ -0,0 +1,134 @@
|
||||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
const { resolve } = require("path");
|
||||
const zlib = require("zlib");
|
||||
|
||||
const { id } = require("../packages/hash");
|
||||
const { fetchJson } = require("../packages/web");
|
||||
|
||||
const CacheDir = resolve(__dirname, "../github-cache/");
|
||||
|
||||
function addResponse(result, response) {
|
||||
return { result, response };
|
||||
}
|
||||
|
||||
function loadFile(filename) {
|
||||
return JSON.parse(zlib.gunzipSync(fs.readFileSync(filename)).toString());
|
||||
//return JSON.parse(fs.readFileSync(filename).toString());
|
||||
}
|
||||
|
||||
// @TODO: atomic
|
||||
function saveFile(filename, content) {
|
||||
fs.writeFileSync(filename, zlib.gzipSync(JSON.stringify(content)));
|
||||
//fs.writeFileSync(filename, JSON.stringify(content));
|
||||
}
|
||||
|
||||
function mockFetchJson(url, body, headers) {
|
||||
return {
|
||||
result: null,
|
||||
response: {
|
||||
statusCode: 304
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function _fetchGitHub(user, password, fetchJson, url) {
|
||||
const result = [ ];
|
||||
while (true) {
|
||||
|
||||
const filename = resolve(CacheDir, id(url).substring(2, 14));
|
||||
|
||||
const headers = {
|
||||
"User-Agent": "ethers-io",
|
||||
};
|
||||
|
||||
let items = null;
|
||||
let link = null;
|
||||
try {
|
||||
const data = loadFile(filename);
|
||||
headers["if-none-match"] = data.etag;
|
||||
items = data.items;
|
||||
link = data.link;
|
||||
} catch (error) {
|
||||
if (error.code !== "ENOENT") { throw error; }
|
||||
}
|
||||
|
||||
const fetch = await fetchJson({
|
||||
url: url,
|
||||
user: user,
|
||||
password: password,
|
||||
headers: headers
|
||||
}, null, addResponse);
|
||||
|
||||
// Cached response is good; use it!
|
||||
if (fetch.response.statusCode !== 304) {
|
||||
items = fetch.result;
|
||||
if (fetch.response.headers) {
|
||||
link = (fetch.response.headers.link || null);
|
||||
}
|
||||
if (fetch.response.headers.etag){
|
||||
saveFile(filename, {
|
||||
timestamp: (new Date()).getTime(),
|
||||
url: url,
|
||||
link: link,
|
||||
etag: fetch.response.headers.etag,
|
||||
items: items,
|
||||
version: 1
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
items.forEach((item) => { result.push(item)});
|
||||
|
||||
url = null;
|
||||
(link || "").split(",").forEach((item) => {
|
||||
if (item.indexOf('rel="next"') >= 0) {
|
||||
const match = item.match(/<([^>]*)>/);
|
||||
if (match) { url = match[1]; }
|
||||
}
|
||||
});
|
||||
|
||||
if (!url) { break; }
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
async function fetchGitHub(user, password, url, cacheOnly) {
|
||||
if (cacheOnly) {
|
||||
return await _fetchGitHub("none", "none", mockFetchJson, url);
|
||||
}
|
||||
|
||||
const results = await _fetchGitHub(user, password, fetchJson, url);
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
async function _getIssues(user, password) {
|
||||
const cacheOnly = (user == null);
|
||||
|
||||
let issues = await fetchGitHub(user, password, "https://api.github.com/repos/ethers-io/ethers.js/issues?state=all&per_page=100", cacheOnly)
|
||||
if (!cacheOnly) { console.log(`Found ${ issues.length } issues`); }
|
||||
const result = [ ];
|
||||
for (let i = 0; i < issues.length; i++) {
|
||||
const issue = issues[i];
|
||||
let comments = await fetchGitHub(user, password, issue.comments_url, cacheOnly);
|
||||
result.push({ issue, comments});
|
||||
if (!cacheOnly) { console.log(` Issue ${ issue.number }: ${ comments.length } comments`); }
|
||||
}
|
||||
result.sort((a, b) => (a.issue.number - b.issue.number));
|
||||
return result;
|
||||
}
|
||||
|
||||
function getIssues() {
|
||||
return _getIssues();
|
||||
}
|
||||
|
||||
function syncIssues(user, password) {
|
||||
return _getIssues(user, password);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getIssues,
|
||||
syncIssues,
|
||||
}
|
||||
@@ -15,8 +15,20 @@ const keccak256 = (function() {
|
||||
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) {
|
||||
|
||||
50
admin/test-parity/parity-dev.json
Normal file
50
admin/test-parity/parity-dev.json
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "DevelopmentChain",
|
||||
"engine": {
|
||||
"instantSeal": null
|
||||
},
|
||||
"params": {
|
||||
"gasLimitBoundDivisor": "0x0400",
|
||||
"accountStartNonce": "0x0",
|
||||
"maximumExtraDataSize": "0x20",
|
||||
"minGasLimit": "0x1388",
|
||||
"networkID" : "0x11",
|
||||
"registrar" : "0x0000000000000000000000000000000000001337",
|
||||
"maxCodeSize": 24576,
|
||||
"maxCodeSizeTransition": "0x0",
|
||||
"eip98Transition": "0x7fffffffffffff",
|
||||
"eip140Transition": "0x0",
|
||||
"eip145Transition": "0x0",
|
||||
"eip150Transition": "0x0",
|
||||
"eip155Transition": "0x0",
|
||||
"eip160Transition": "0x0",
|
||||
"eip161abcTransition": "0x0",
|
||||
"eip161dTransition": "0x0",
|
||||
"eip211Transition": "0x0",
|
||||
"eip214Transition": "0x0",
|
||||
"eip658Transition": "0x0",
|
||||
"wasmActivationTransition": "0x0"
|
||||
},
|
||||
"genesis": {
|
||||
"seal": {
|
||||
"generic": "0x0"
|
||||
},
|
||||
"difficulty": "0x20000",
|
||||
"author": "0x0000000000000000000000000000000000000000",
|
||||
"timestamp": "0x00",
|
||||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"extraData": "0x",
|
||||
"gasLimit": "0x7A1200"
|
||||
},
|
||||
"accounts": {
|
||||
"0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||
"0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
|
||||
"0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
|
||||
"0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
|
||||
"0000000000000000000000000000000000000005": { "balance": "1", "builtin": { "name": "modexp", "activate_at": 0, "pricing": { "modexp": { "divisor": 20 } } } },
|
||||
"0000000000000000000000000000000000000006": { "balance": "1", "builtin": { "name": "alt_bn128_add", "activate_at": 0, "pricing": { "linear": { "base": 500, "word": 0 } } } },
|
||||
"0000000000000000000000000000000000000007": { "balance": "1", "builtin": { "name": "alt_bn128_mul", "activate_at": 0, "pricing": { "linear": { "base": 40000, "word": 0 } } } },
|
||||
"0000000000000000000000000000000000000008": { "balance": "1", "builtin": { "name": "alt_bn128_pairing", "activate_at": 0, "pricing": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 } } } },
|
||||
"0x7454a8f5a7c7555d79b172c89d20e1f4e4cc226c": { "balance": "1606938044258990275541962092341162602522202993782792835301376" }
|
||||
}
|
||||
}
|
||||
1
admin/test-parity/parity-dev.pwds
Normal file
1
admin/test-parity/parity-dev.pwds
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"id":"24d70b97-fff9-d322-e760-4b8cc2e21751","version":3,"crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"45d392cd16dbbd5c0f5b2d145c112da9"},"ciphertext":"b001ccd09fc5431dc055975b58ee61f86e85529245506c04182c902716e750e5","kdf":"pbkdf2","kdfparams":{"c":10240,"dklen":32,"prf":"hmac-sha256","salt":"028594da27a0e864105f33b912e5dc6ce7c75ecd13c81bfc158fe963d30c93bb"},"mac":"374bf2e9144b74b889708abc19e9ebc164f90bc27e83fd9f01da4571a9f81a70"},"address":"7454a8f5a7c7555d79b172c89d20e1f4e4cc226c","name":"","meta":"{}"}
|
||||
@@ -25,7 +25,7 @@ function getDate(date) {
|
||||
|
||||
function getDateTime(date) {
|
||||
return getDate(date) + " " + [
|
||||
date.getHours(),
|
||||
zpad(date.getHours()) ,
|
||||
zpad(date.getMinutes() + 1)
|
||||
].join(":");
|
||||
}
|
||||
|
||||
@@ -9,3 +9,4 @@ _toc:
|
||||
signer
|
||||
providers
|
||||
utils
|
||||
other
|
||||
|
||||
194
docs.wrm/api/other/assembly.wrm
Normal file
194
docs.wrm/api/other/assembly.wrm
Normal file
@@ -0,0 +1,194 @@
|
||||
_title: Assembly
|
||||
|
||||
_section: Assembly @<asm>
|
||||
|
||||
_subsection: Opcode @<asm-opcode>
|
||||
|
||||
_property: asm.Opcode.from(valueOrMnemonic) => [[asm-opcode]]
|
||||
Create a new instnace of an Opcode for a given numeric value
|
||||
(e.g. 0x60 is PUSH1) or mnemonic (e.g. "PUSH1").
|
||||
|
||||
_property: opcode.value => number
|
||||
The value (bytecode as a number) of this opcode.
|
||||
|
||||
_property: opcode.mnemonic => string
|
||||
The mnemonic string of this opcode.
|
||||
|
||||
_property: opcode.delta => number
|
||||
The number of items this opcode will consume from the stack.
|
||||
|
||||
_property: opcode.alpha => number
|
||||
The number of items this opcode will push onto the stack.
|
||||
|
||||
_property: opcode.doc => string
|
||||
A short description of what this opcode does.
|
||||
|
||||
_property: opcode.isMemory() => boolean
|
||||
Returns true if the opcode accesses memory.
|
||||
|
||||
_property: opcode.isStatic() => boolean
|
||||
Returns true if the opcode cannot change state.
|
||||
|
||||
_property: opcode.isJump() => boolean
|
||||
Returns true if the opcode is a jumper operation.
|
||||
|
||||
_property: opcode.isPush() => number
|
||||
Returns 0 if the opcode is not a ``PUSH*``, or the number
|
||||
of bytes this opcode will push if it is.
|
||||
|
||||
_subsection: Assembler
|
||||
|
||||
_heading: Operation @<asm-operation>
|
||||
|
||||
An **Operation** is a single command from a disassembled bytecode
|
||||
stream.
|
||||
|
||||
_property: operation.opcode => [[asm-opcode]]
|
||||
_property: operation.offset => number
|
||||
_property: operation.pushValue => string
|
||||
|
||||
_heading: Functions
|
||||
|
||||
_property: asm.parse(code) => [[asm-node]] @SRC<asm/assembler>
|
||||
Parse an ethers-format assembly file and return the [[asm-ast]].
|
||||
|
||||
_property: asm.assemble(node) => string<[[datahexstring]]> @SRC<asm/assembler:function.assemble>
|
||||
Performs assembly of the [[asm-ast]] //node// and return the
|
||||
resulting bytecode representation.
|
||||
|
||||
_property: asm.disassemble(bytecode) => Array<[[asm-operation]]> @SRC<asm/assembler>
|
||||
Returns an array of Operations given //bytecode//.
|
||||
|
||||
In addition to a standard array, the return also has a
|
||||
``getOperation(offset)`` method, which can be used to get
|
||||
the operation at a given byte offset, which prevents access
|
||||
to internal ``PUSH`` bytes (i.e. safe JUMPDEST).
|
||||
|
||||
_property: asm.formatBytecode(operations) => string @SRC<asm/assembler>
|
||||
Create a formatted output of an array of [[asm-operation]].
|
||||
|
||||
_subsection: Abstract Syntax Tree @<asm-ast>
|
||||
|
||||
Parsing an file using the [Ethers ASM Grammar](link-ethers-asm-grammar)
|
||||
will generate an Abstract Syntax Tree. The root node will always
|
||||
be a [[asm-scopenode]] whose name is ``_``.
|
||||
|
||||
_heading: Location @<asm-location>
|
||||
|
||||
_property: offset => number
|
||||
The offset into the source code to the start of this node.
|
||||
|
||||
_property: length => number
|
||||
The length of characters in the source code to the end of this node.
|
||||
|
||||
_property: source => string
|
||||
The source code of this node.
|
||||
|
||||
|
||||
_heading: Node @<asm-node> @SRC<asm:class.Node>
|
||||
|
||||
_property: node.tag => string
|
||||
A unique tag for this node for the lifetime of the process.
|
||||
|
||||
_property: node.location => [[asm-location]]
|
||||
The source code and location within the source code that this
|
||||
node represents.
|
||||
|
||||
|
||||
_heading: ValueNode @<asm-valuenode> @INHERIT<[[asm-node]]> @SRC<asm:class.ValueNode>
|
||||
|
||||
A **ValueNode** is a node which may manipulate the stack.
|
||||
|
||||
|
||||
_heading: LiteralNode @<asm-literalnode> @INHERIT<[[asm-valuenode]]> @SRC<asm:class.LiteralNode>
|
||||
|
||||
_property: literalNode.value => string
|
||||
The literal value of this node, which may be a [[datahexstring]] or
|
||||
string of a decimal number.
|
||||
|
||||
_property: literalNode.verbatim => boolean
|
||||
This is true in a [[asm-datanode]] context, since in that case the
|
||||
value should be taken verbatim and no ``PUSH`` operation shoud be
|
||||
added, otherwise false.
|
||||
|
||||
|
||||
_heading: LinkNode @<asm-linknode> @INHERIT<[[asm-valuenode]]> @SRC<asm:class.LinkNode>
|
||||
|
||||
A **LinkNode** represents a link to another [[asm-node]]'s data,
|
||||
for example ``$foo`` or ``#bar``.
|
||||
|
||||
_property: linkNode.label => string
|
||||
Te name of the target node.
|
||||
|
||||
_property: linkNode.type => "offset" | "length"
|
||||
Whether this node is for an offset or a length value of the
|
||||
target node.
|
||||
|
||||
|
||||
_heading: OpcodeNode @<asm-opcodenode> @INHERIT<[[asm-valuenode]]> @SRC<asm:class.OpcodeNode>
|
||||
|
||||
_property: opcodeNode.opcode => [[asm-opcode]]
|
||||
The opcode for this Node.
|
||||
|
||||
_property: opcodeNode.operands => Array<[[asm-valuenode]]>
|
||||
A list of all operands passed into this Node.
|
||||
|
||||
|
||||
_heading: EvaluationNode @<asm-evaluationnode> @INHERIT<[[asm-valuenode]]> @SRC<asm:class.EvaluationNode>
|
||||
|
||||
An **EvaluationNode** is used to execute code and insert the results
|
||||
but does not generate
|
||||
any output assembly, using the ``{{! code here }}`` syntax.
|
||||
|
||||
_property: literalNode.verbatim => boolean
|
||||
This is true in a [[asm-datanode]] context, since in that case the
|
||||
value should be taken verbatim and no ``PUSH`` operation shoud be
|
||||
added, otherwise false.
|
||||
|
||||
_property: evaluationNode.script => string
|
||||
The code to evaluate and produce the result to use as a literal.
|
||||
|
||||
|
||||
_heading: ExecutionNode @<asm-executionnode> @INHERIT<[[asm-node]]> @SRC<asm:class.ExecutionNode>
|
||||
|
||||
An **ExecutionNode** is used to execute code but does not generate
|
||||
any output assembly, using the ``{{! code here }}`` syntax.
|
||||
|
||||
_property: evaluationNode.script => string
|
||||
The code to execute. Any result is ignored.
|
||||
|
||||
|
||||
_heading: LabelledNode @<asm-labellednode> @INHERIT<[[asm-node]]> @SRC<asm:class.LabelledNode>
|
||||
|
||||
A **LabelledNode** is used for any Node that has a name, and can therefore
|
||||
be targetted by a [[asm-linknode]].
|
||||
|
||||
_property: labelledNode.name => string
|
||||
The name of this node.
|
||||
|
||||
|
||||
_heading: LabelNode @<asm-labelnode> @INHERIT<[[asm-labellednode]]> @SRC<asm:class.LabelNode>
|
||||
|
||||
A **LabelNode** is used as a place to ``JUMP`` to by referencing it
|
||||
name, using ``@myLabel:``. A ``JUMPDEST`` is automatically inserted
|
||||
at the bytecode offset.
|
||||
|
||||
|
||||
_heading: DataNode @<asm-datanode> @INHERIT<[[asm-labellednode]]> @SRC<asm:class.DataNode>
|
||||
|
||||
A **DataNode** allows for data to be inserted directly into the output
|
||||
assembly, using ``@myData[ ... ]``. The data is padded if needed to ensure
|
||||
values that would otherwise be regarded as a ``PUSH`` value does not impact
|
||||
anything past the data.
|
||||
|
||||
_property: dataNode.data => Array<[[asm-valuenode]]>
|
||||
The child nodes, which each represent a verbatim piece of data in insert.
|
||||
|
||||
_heading: ScopeNode @<asm-scopenode> @INHERIT<[[asm-labellednode]]> @SRC<asm:class.ScopeNode>
|
||||
|
||||
|
||||
A **ScopeNode** allows a new frame of reference that all [[asm-linknode]]'s
|
||||
will use when resolving offset locations, using ``@myScope{ ... }``.
|
||||
|
||||
_property: scopeNode.statements => Array<[[asm-node]]>
|
||||
The list of child nodes for this scope.
|
||||
17
docs.wrm/api/other/hardware/index.wrm
Normal file
17
docs.wrm/api/other/hardware/index.wrm
Normal file
@@ -0,0 +1,17 @@
|
||||
_title: Hardware Wallets
|
||||
|
||||
_section: Hardware Wallets
|
||||
|
||||
_subsection: LedgerSigner @<hw-ledger> @INHERIT<[[signer]]> @SRC<hardware-wallets:class.LedgerSigner>
|
||||
|
||||
The [Ledger Hardware Wallets](link-ledger) are a fairly
|
||||
popular brand.
|
||||
|
||||
TODO: importing
|
||||
|
||||
_heading: API
|
||||
|
||||
_property: new LedgerSigner([provider [, type [ , path ] ] ]) => [[hw-ledger]]
|
||||
Connects to a Ledger Hardware Wallet. The //type// if left unspecified is
|
||||
determined by the environment; in node the default is "hid" and in the browser
|
||||
"u2f" is the default. The default Ethereum path is used if //path// is left unspecified.
|
||||
11
docs.wrm/api/other/index.wrm
Normal file
11
docs.wrm/api/other/index.wrm
Normal file
@@ -0,0 +1,11 @@
|
||||
_title: Other Libraries
|
||||
|
||||
_section: Other Libraries
|
||||
|
||||
Now that ethers is more modular, it is possible to have additional
|
||||
ancillary packages, which are not part of the core but optionally
|
||||
add functionality only needed in certain situations.
|
||||
|
||||
_toc:
|
||||
assembly
|
||||
hardware
|
||||
@@ -13,42 +13,55 @@ To mitigate these issues, it is recommended you use a
|
||||
[Default Provider](get-default-provider).
|
||||
|
||||
|
||||
_subsection: EtherscanProvider
|
||||
_subsection: EtherscanProvider @INHERIT<[[provider]]>
|
||||
|
||||
The **EtherscanProvider** is backed by a combination of the various
|
||||
[Etherscan APIs](https://etherscan.io/apis).
|
||||
[Etherscan APIs](link-etherscan-api).
|
||||
|
||||
_property: provider.getHistory(address) => Array<History>
|
||||
|
||||
@TODO... Explain
|
||||
|
||||
_subsection: InfuraProvider
|
||||
_definition: **Supported Networks**
|
||||
|
||||
The **InfuraProvider** is backed by the popular [INFURA](https://infura.io)
|
||||
- Homestead (Mainnet)
|
||||
- Ropsten (proof-of-work testnet)
|
||||
- Rinkeby (proof-of-Authority testnet)
|
||||
- Görli (clique testnet)
|
||||
- Kovan (proof-of-authority testnet)
|
||||
|
||||
|
||||
_subsection: InfuraProvider @INHERIT<[[provider-urljsonrpc]]>
|
||||
|
||||
The **InfuraProvider** is backed by the popular [INFURA](link-infura)
|
||||
Ethereum service.
|
||||
|
||||
It supports Mainnet (homestead) and all common testnets (Ropsten, Rinkeby,
|
||||
Görli and Kovan).
|
||||
_definition: **Supported Networks**
|
||||
|
||||
- Homestead (Mainnet)
|
||||
- Ropsten (proof-of-work testnet)
|
||||
- Rinkeby (proof-of-Authority testnet)
|
||||
- Görli (clique testnet)
|
||||
- Kovan (proof-of-authority testnet)
|
||||
|
||||
|
||||
_subsection: NodesmithProvider
|
||||
_subsection: AlchemyProvider @INHERIT<[[provider-urljsonrpc]]>
|
||||
|
||||
The **NodesmithProvider** is backed by [Nodesmith](https://nodesmith.io).
|
||||
The **AlchemtProvider** is backed by [Alchemy](link-alchemy).
|
||||
|
||||
It supports Mainnet (homestead) and all common testnets (Ropsten, Rinkeby,
|
||||
Görli and Kovan), as well as the Ethereum-like network [Aion](https://aion.network).
|
||||
_definition: **Supported Networks**
|
||||
|
||||
- Homestead (Mainnet)
|
||||
- Ropsten (proof-of-work testnet)
|
||||
- Rinkeby (proof-of-Authority testnet)
|
||||
- Görli (clique testnet)
|
||||
- Kovan (proof-of-authority testnet)
|
||||
|
||||
|
||||
_subsection: AlchemyProvider
|
||||
_subsection: CloudfrontProvider @INHERIT<[[provider-urljsonrpc]]>
|
||||
|
||||
The **AlchemtProvider** is backed by [Alchemy](https://alchemyapi.io).
|
||||
The CloudfrontProvider is backed by the [Cloudflare Ethereum Gateway](link-cloudflare).
|
||||
|
||||
It supports Mainnet (homestead) and all common testnets (Ropsten, Rinkeby,
|
||||
Görli and Kovan).
|
||||
_definition: **Supported Networks**
|
||||
|
||||
|
||||
_subsection: CloudfrontProvider
|
||||
|
||||
The CloudfrontProvider is backed by the
|
||||
[Cloudflare Ethereum Gateway](https://developers.cloudflare.com/distributed-web/ethereum-gateway/).
|
||||
|
||||
It only supports Mainnet (homestead).
|
||||
- Homestead (Mainnet)
|
||||
|
||||
@@ -1,22 +1,75 @@
|
||||
_title: JSON-RPC Provider
|
||||
|
||||
_section: JSON-RPC Provider
|
||||
_section: JsonRpcProvider @<provider-jsonrpc> @INHERIT<[[provider]]>
|
||||
|
||||
Explain here...
|
||||
The [JSON-RPC API](link-jsonrpc) is a
|
||||
very popular method for interacting with Ethereum and is available in all
|
||||
major Ethereum node implementations (e.g. [Geth](link-geth)
|
||||
and [Parity](link-parity)) as well as many third-party web
|
||||
services (e.g. [INFURA](link-infura))
|
||||
|
||||
_subsection: JsonRpcProvider @<jsonrpc-provider>
|
||||
_property: new ethers.providers.JsonRpcProvider([ url [ , aNetworkish ] ])
|
||||
Connect to a JSON-RPC API located at //url// using the /aNetworkish// network.
|
||||
If //url// is not specified, the default (i.e. ``http://localhost:8545``) is used
|
||||
and if no network is specified, it will be determined automatically by
|
||||
querying the node.
|
||||
|
||||
TODO...
|
||||
_note: Note: Connecting to a Local Node
|
||||
Each node implementation is slightly different and may require specific command-line
|
||||
flags or changes in their Settings UI to enable JSON-RPC, unlock accounrs
|
||||
or expose specific APIs. Please consult theit documentation.
|
||||
|
||||
_property: provider.getSigner([ addressOrIndex ]) => [[jsonrpc-signer]]
|
||||
Returns a [[jsonrpc-signer]] which is managed by this Ethereum node, at
|
||||
_property: jsonRpcProvider.getSigner([ addressOrIndex ]) => [[signer-jsonrpc]] @<provider-jsonrpc-getsigner> @SRC<providers/json-rpc-provider>
|
||||
Returns a [[signer-jsonrpc]] which is managed by this Ethereum node, at
|
||||
//addressOrIndex//. If no //addressOrIndex// is provided, the first
|
||||
account (account #0) is used.
|
||||
|
||||
_property: provider.getUncheckSigner([ addressOrIndex ]) => [[jsonrpc-uncheckedsigner]]
|
||||
_property: jsonRpcProvider.getUncheckedSigner([ addressOrIndex ]) => [[provider-jsonrpc-uncheckedsigner]] @<provider-jsonrpc-getuncheckedsigner> @SRC<providers/json-rpc-provider>
|
||||
|
||||
_subsection: JsonRpcSigner @<jsonrpc-signer>
|
||||
TODO... Explain
|
||||
_property: jsonRpcProvider.listAccounts() => Array<string> @<provider-jsonrpc-listaccounts> @SRC<providers/json-rpc-provider>
|
||||
Returns a list of all account addresses managed by this provider.
|
||||
|
||||
_subsection: JsonRpcUncheckedSigner @<jsonrpc-uncheckedsigner>
|
||||
TODO... Explain
|
||||
_property: jsonRpcProvider.send(method, params) => Promise<any> @<provider-jsonrpc-send> @SRC<providers/json-rpc-provider>
|
||||
Allows sending raw messages to the provider.
|
||||
|
||||
This can be used for backend-specific calls, such as for debugging or
|
||||
specific account management.
|
||||
|
||||
|
||||
_subsection: JsonRpcSigner @<signer-jsonrpc> @INHERIT<[[signer]]>
|
||||
A **JsonRpcSigner** is a simple Signer which is backed by a connected
|
||||
[[provider-jsonrpc]].
|
||||
|
||||
_property: signer.provider => [[provider-jsonrpc]]
|
||||
The provider this signer was established from.
|
||||
|
||||
_property: signer.connectUnchecked() => [[provider-jsonrpc-uncheckedsigner]]
|
||||
Returns a new Signer object which does not perform addtional checks when
|
||||
sending a transaction. See [[provider-jsonrpc-uncheckedsigner]] for more details.
|
||||
|
||||
_property: signer.sendUncheckedTransaction(transaction) => Promise<string<[[datahexstring]]<32>>>
|
||||
Sends the //transaction// and returns a Promise which resolves to the
|
||||
opacque transaction hash.
|
||||
|
||||
_property: signer.unlock(password) => Promise<boolean>
|
||||
Request the node unlock the account (if locked) using //password//.
|
||||
|
||||
|
||||
_subsection: JsonRpcUncheckedSigner @<provider-jsonrpc-uncheckedsigner> @INHERIT<[[signer]]>
|
||||
The JSON-RPC API only provides a transaction hash as the response when a
|
||||
transaction is sent, but the ethers Provider requires populating all details
|
||||
of a transaction before returning it. For example, the gas price and gas limit
|
||||
may be adjusted by the node or the nonce automatically included, in which case
|
||||
the opaque transaction hash has discarded this.
|
||||
|
||||
To remedy this, the [[signer-jsonrpc]] immeidately queries the provider for
|
||||
the details using the returned transaction hash to populate the [[provider-transactionresponse]]
|
||||
object.
|
||||
|
||||
Some backends do not respond immediately and instead defer releasing the
|
||||
details of a transaction it was responsible for signing until it is mined.
|
||||
|
||||
The **UncheckedSigner** does not populate any additional information and will
|
||||
immediately return the result as a mock [[provider-transactionresponse]]-like
|
||||
object, with most of the properties set to null, but allows access to the
|
||||
transaction hash quickly, if that is all that is required.
|
||||
|
||||
@@ -4,24 +4,109 @@ _section: Other Providers
|
||||
|
||||
Others...
|
||||
|
||||
_subsection: FallbackProvider @<provider-fallback>
|
||||
_subsection: FallbackProvider @<provider-fallback> @INHERIT<[[provider]]> @SRC<providers/fallback-provider:class.FallbackProvider>
|
||||
|
||||
Explain...
|
||||
The **FallbackProvider** is the most advanced [[provider]] available in
|
||||
ethers.
|
||||
|
||||
_heading: Properties
|
||||
It uses a quorum and connects to multiple [Providers](provider) as backends,
|
||||
each configured with a //priority// and a //weight// .
|
||||
|
||||
_property: provider.providers => Array<[[provider]]>
|
||||
The list of Providers this is connected to.
|
||||
When a request is made, the request is dispatched to multiple backends, randomly
|
||||
choosen (higher prioirty backends are always selected first) and the results from
|
||||
each are compared against the others. Only once the quorum has been reached will that
|
||||
result be accepted and returned to the caller.
|
||||
|
||||
By default the quorum requires 50% (rounded up) of the backends to agree. The //weight//
|
||||
can be used to give a backend Provider more influence.
|
||||
|
||||
_property: new ethers.providers.FallbackProvider(providers [ , quorum ])
|
||||
Creates a new instance of a FallbackProvider connected to //providers//. If
|
||||
quorum is not specified, half of the total sum of the provider weights is
|
||||
used.
|
||||
|
||||
The //providers// can be either an array of [[provider]] or [[provider-fallback-config]].
|
||||
If a [[provider]] is provided, the defaults are a priority of 1 and a weight of 1.
|
||||
|
||||
_property: provider.providerConfigs => Array<[[provider-fallback-config]]>
|
||||
The list of Provider Configurations that describe the backends.
|
||||
|
||||
_property: provider.quorum => number
|
||||
The quorum the backend responses must agree upon before a result will be
|
||||
resolved. By default this is //half the sum of the weights//.
|
||||
|
||||
_property: provider.weights => Array<number>
|
||||
The weight each of the Providers adds to a results acceptance.
|
||||
|
||||
_heading: FallbackProviderConfig @<provider-fallback-config>
|
||||
|
||||
_property: fallbackProviderConfig.provider => [[provider]]
|
||||
The provider for this configuration.
|
||||
|
||||
_property: fallbackProviderConfig.priority => number
|
||||
The priority used for the provider. Higher priorities are favoured over lower
|
||||
priorities. If multiple providers share the same prioirty, they are choosen
|
||||
at random.
|
||||
|
||||
_property: fallbackProviderConfig.stallTimeout => number
|
||||
The timeout (in ms) after which another [[provider]] will be attempted. This
|
||||
does not affect the current Provider; if it returns a result it is counted
|
||||
as part of the quorum.
|
||||
|
||||
Lower values will result in more network traffic, but may reduce the response
|
||||
time of requests.
|
||||
|
||||
_property: fallbackProviderConfig.weight => number
|
||||
The weight a response from this provider provides. This can be used if a given
|
||||
[[provider]] is more trusted, for example.
|
||||
|
||||
|
||||
_subsection: IpcProvider @<provider-ipc>
|
||||
_subsection: IpcProvider @<provider-ipc> @INHERIT<[[provider-jsonrpc]]> @SRC<providers:class.IpcProvider>
|
||||
|
||||
Explain...
|
||||
The **IpcProvider** allows the JSON-RPC API to be used over a local
|
||||
filename on the file system, exposed by Geth, Parity and other nodes.
|
||||
|
||||
This is only available in //node.js// (as it requires file system access,
|
||||
and may have additional complications due to file permissions. See any
|
||||
related notes on the documentation for the actual node implementation websites.
|
||||
|
||||
_property: ipcProvider.path => string
|
||||
The path this [[provider]] is connected to.
|
||||
|
||||
|
||||
_subsection: UrlJsonRpcProvider @<provider-urljsonrpc> @INHERIT<[[provider-jsonrpc]]> @SRC<providers:class.UrlJsonRpcProvider>
|
||||
|
||||
This class is intended to be sub-classed and not used directly. It
|
||||
simplifies creating a [[provider]] where a normal [[provider-jsonrpc]]
|
||||
would suffice, with a little extra effort needed to generate the JSON-RPC
|
||||
URL.
|
||||
|
||||
_property: new ethers.providers.UrlJsonRpcProvider([ network [ , apiKey ] ])
|
||||
Sub-classes do not need to override this. Instead they should override the
|
||||
static method ``getUrl`` and optionally ``getApiKey``.
|
||||
|
||||
_property: urlJsonRpcProvider.apiKey => any
|
||||
The value of the apiKey that was returned from ``InheritedClass.getApiKey``.
|
||||
|
||||
_property: InheritingClass.getApiKey(apiKey) => any
|
||||
This function should examine the //apiKey// to ensure it is valid and
|
||||
return a (possible modified) value to use in ``getUrl``.
|
||||
|
||||
_property: InheritingClass.getUrl(network, apiKey) => string
|
||||
The URL to use for the JsonRpcProvider instance.
|
||||
|
||||
|
||||
|
||||
_subsection: Web3Provider @<provider-web3> @INHERIT<[[provider-jsonrpc]]>
|
||||
|
||||
The Web3Provider is meant to ease moving from a [web3.js based](link-web3)
|
||||
application to ethers by wraping an existing Web3-compatible (such as a
|
||||
[Web3HttpProvider](link-web3-http)[Web3IpcProvider](link-web3-ipc) or
|
||||
[Web3WsProvider](link-web3-ws)) and exposing it as an ethers.js [[provider]]
|
||||
which can then be used with the rest of the library.
|
||||
|
||||
_property: new ethers.providers.Web3Provider(web3Provider [, network ])
|
||||
Create a new **Web3Provider**, which wraps an [EIP-1193 Provider]() or
|
||||
Web3Provider-compatible Provider.
|
||||
|
||||
_property: web3Provider.provider => Web3CompatibleProvider
|
||||
The provider used to create this instance.
|
||||
|
||||
|
||||
@@ -8,17 +8,17 @@ Explain what a provider is...
|
||||
|
||||
_subsection: Accounts Methods
|
||||
|
||||
_property: provider.getBalance(address [ , blockTag = "latest" ]) => Promise<[[bignumber]]>
|
||||
_property: provider.getBalance(address [ , blockTag = "latest" ]) => Promise<[[bignumber]]> @<provider-getbalance> @SRC<providers/base-provider>
|
||||
Returns the balance of //address// as of the //blockTag// block height.
|
||||
|
||||
_property: provider.getCode(address [ , blockTag = "latest" ]) => Promise<[[hexstring]]>
|
||||
_property: provider.getCode(address [ , blockTag = "latest" ]) => Promise<string<[[datahexstring]]>> @<providers-getcode> @SRC<providers/base-provider>
|
||||
Returns the contract code of //address// as of the //blockTag// block height. If there is
|
||||
no contract currently deployed, the result is ``0x``.
|
||||
|
||||
_property: provider.getStorageAt(address, position [ , blockTag = "latest" ]) => Promise<[[hexstring]]>
|
||||
Returns the ``Bytes32`` value of the //position// at //address//, as of the //blockTag//.
|
||||
_property: provider.getStorageAt(addr, pos [ , blockTag = "latest" ]) => Promise<string<[[datahexstring]]>> @<providers-getstorageat> @SRC<providers/base-provider>
|
||||
Returns the ``Bytes32`` value of the position //pos// at address //addr//, as of the //blockTag//.
|
||||
|
||||
_property: provider.getTransactionCount(address [ , blockTag = "latest" ]) => Promise<number>
|
||||
_property: provider.getTransactionCount(address [ , blockTag = "latest" ]) => Promise<number> @<providers-gettransactioncount> @SRC<providers/base-provider>
|
||||
Returns the number of transactions //address// has ever **sent**, as of //blockTag//.
|
||||
This value is required to be the nonce for the next transaction from //address//
|
||||
sent to the network.
|
||||
@@ -30,11 +30,11 @@ _code: example-account.js
|
||||
|
||||
_subsection: Blocks Methods
|
||||
|
||||
_property: provider.getBlock(block) => Promise<[[provider-block]]>
|
||||
_property: provider.getBlock(block) => Promise<[[provider-block]]> @<providers-getblock> @SRC<providers/base-provider>
|
||||
Get the //block// from the network, where the ``result.transactions`` is a list
|
||||
of transaction hashes.
|
||||
|
||||
_property: provider.getBlockWithTransactions(block) => Promise<[[provider-blocktxs]]>
|
||||
_property: provider.getBlockWithTransactions(block) => Promise<[[provider-blocktxs]]> @<providers-getblockwithtransactions> @SRC<providers/base-provider>
|
||||
Get the //block// from the network, where the ``result.transactions`` is
|
||||
an Array of [[provider-transactionresponse]] objects.
|
||||
|
||||
@@ -43,12 +43,12 @@ _subsection: Ethereum Naming Service (ENS) Methods
|
||||
|
||||
TODO: Explain ENS here...
|
||||
|
||||
_property: provider.lookupAddress(address) => Promise<string>
|
||||
_property: provider.lookupAddress(address) => Promise<string> @<providers-lookupaddress> @SRC<providers/base-provider>
|
||||
Performs a reverse lookup of the //address// in ENS using the
|
||||
//Reverse Registrar//. If the name does not exist, or the
|
||||
forward lookup does not match, ``null`` is returned.
|
||||
|
||||
_property: provider.resovleName(name) => Promise<string>
|
||||
_property: provider.resolveName(name) => Promise<string<[Address](address)>> @<providers-resolvename> @SRC<providers/base-provider>
|
||||
Looks up the address of //name//. If the name is not owned, or
|
||||
does not have a //Resolver// configured, or the //Resolver// does
|
||||
not have an address configured, ``null`` is returned.
|
||||
@@ -59,7 +59,7 @@ _code: example-ens.js
|
||||
|
||||
_subsection: Logs Methods
|
||||
|
||||
_property: provider.getLogs(filter) => Promise<Array<[[provider-log]]>>
|
||||
_property: provider.getLogs(filter) => Promise<Array<[[provider-log]]>> @<providers-getlogs> @SRC<providers/base-provider>
|
||||
Returns the Array of [[provider-log]] matching the //filter//.
|
||||
|
||||
Keep in mind that many backends will discard old events, and that requests
|
||||
@@ -69,24 +69,24 @@ execute the query.
|
||||
|
||||
_subsection: Network Status Methods
|
||||
|
||||
_property: provider.getNetwork() => Promise<[[provider-network]]>
|
||||
_property: provider.getNetwork() => Promise<[[provider-network]]> @<providers-getnetwork> @SRC<providers/base-provider:method.BaseProvider.getNetwork>
|
||||
Returns the [[provider-network]] this Provider is connected to.
|
||||
|
||||
_property: provider.getBlockNumber() => Promise<number>
|
||||
_property: provider.getBlockNumber() => Promise<number> @<providers-getblocknumber> @SRC<providers/base-provider>
|
||||
Returns the block number (or height) of the most recently mined block.
|
||||
|
||||
_property: provider.getGasPrice() => Promise<[[bignumber]]>
|
||||
_property: provider.getGasPrice() => Promise<[[bignumber]]> @<providers-getgasprice> @SRC<providers/base-provider>
|
||||
Returns a //best guess// of the [[gas-price]] to use in a transaction.
|
||||
|
||||
|
||||
_subsection: Transactions Methods
|
||||
|
||||
_property: provider.call(transaction [ , blockTag = "latest" ]) => Promise<[[hexstring]]>
|
||||
Returns the result of executing the //transaction//, using //call//. A call
|
||||
_property: provider.call(transaction [ , blockTag = "latest" ]) => Promise<string<[[hexstring]]>> @<providers-call> @SRC<providers/base-provider>
|
||||
Returns the result of executing the //transaction//, using //call//. A call
|
||||
does not require any ether, but cannot change any state. This is useful
|
||||
for calling gettings on Contracts.
|
||||
|
||||
_property: provider.estimateGas(transaction) => Promise<[[bignumber]]>
|
||||
_property: provider.estimateGas(transaction) => Promise<[[bignumber]]> @<providers-estimategas> @SRC<providers/base-provider>
|
||||
Returns an estimate of the amount of gas that would be required to submit //transaction//
|
||||
to the network.
|
||||
|
||||
@@ -94,12 +94,12 @@ An estimate may not be accurate since there could be another transaction
|
||||
on the network that was not accounted for, but after being mined affected
|
||||
relevant state.
|
||||
|
||||
_property: provider.sendTransaction(transaction) => Promise<[[provider-transactionresponse]]>
|
||||
_property: provider.sendTransaction(transaction) => Promise<[[provider-transactionresponse]]> @<providers-sendtransaction> @SRC<providers/base-provider>
|
||||
Submits //transaction// to the network to be mined. The //transaction// **must** be signed,
|
||||
and be valid (i.e. the nonce is correct and the account has sufficient balance to pay
|
||||
for the transaction).
|
||||
|
||||
_property: provider.waitForTransaction(transactionHash) => Promise<[[provider-transactionreceipt]]>
|
||||
_property: provider.waitForTransaction(transactionHash) => Promise<[[provider-receipt]]> @<providers-waitfortransaction> @SRC<providers/base-provider>
|
||||
Returns a Promise which will not resolve until //transactionHash// is mined.
|
||||
|
||||
|
||||
@@ -107,35 +107,35 @@ _subsection: Event Emitter Methods
|
||||
|
||||
Explain events here...
|
||||
|
||||
_property: provider.on(eventName, listener) => this
|
||||
_property: provider.on(eventName, listener) => this @<providers-on> @SRC<providers/base-provider>
|
||||
Add a //listener// to be triggered for each //eventName//.
|
||||
|
||||
_property: provider.once(eventName, listener) => this
|
||||
_property: provider.once(eventName, listener) => this @<providers-once> @SRC<providers/base-provider>
|
||||
Add a //listener// to be triggered for only the next //eventName//,
|
||||
at which time it be removed.
|
||||
|
||||
_property: provider.emit(eventName, ...args) => boolean
|
||||
_property: provider.emit(eventName, ...args) => boolean @<providers-emit> @SRC<providers/base-provider>
|
||||
Notify all listeners of //eventName//, passing //args// to each listener. This
|
||||
is generally only used internally.
|
||||
|
||||
_property: provider.off(eventName [ , listener ]) => this
|
||||
_property: provider.off(eventName [ , listener ]) => this @<providers-off> @SRC<providers/base-provider>
|
||||
Remove a //listener// for //eventName//. If no //listener// is provided,
|
||||
all listeners for //eventName// are removed.
|
||||
|
||||
_property: provider.removeAllListeners([ eventName ]) => this
|
||||
_property: provider.removeAllListeners([ eventName ]) => this @<providers-removealllisteners> @SRC<providers/base-provider>
|
||||
Remove all the listeners for //eventName//. If no //eventName// is provided,
|
||||
**all** events are removed.
|
||||
|
||||
_property: provider.listenerCount([ eventName ]) => number
|
||||
_property: provider.listenerCount([ eventName ]) => number @<providers-listenercount> @SRC<providers/base-provider>
|
||||
Returns the number of listeners for //eventName//. If no //eventName// is
|
||||
provided, the total number of listeners is returned.
|
||||
|
||||
_property: provider.listeners(eventName) => Array<Listener>
|
||||
_property: provider.listeners(eventName) => Array<Listener> @<providers-listeners> @SRC<providers/base-provider>
|
||||
Returns the list of Listeners for //eventName//.
|
||||
|
||||
|
||||
_subsection: Inspection Methods
|
||||
|
||||
_property: Provider.isProvider(object) => boolean
|
||||
_property: Provider.isProvider(object) => boolean @<providers-isprovider> @SRC<abstract-provider>
|
||||
Returns true if and only if //object// is a Provider.
|
||||
|
||||
|
||||
@@ -8,43 +8,155 @@ A **BlockTag** specifies a specific location in the Blockchain.
|
||||
- **``"latest"``** -- The most recently mined block
|
||||
- **``"earliest"``** -- Block #0
|
||||
- **``"pending"``** -- The block currently being prepared for mining; not all
|
||||
operations support this BlockTag
|
||||
operations and backends support this BlockTag
|
||||
- **//number//** -- The block at this height
|
||||
- **//a negative number//** -- The block this many blocks ago
|
||||
|
||||
_heading: Network @<provider-network>
|
||||
_heading: EventType @<provider-eventtype>
|
||||
|
||||
And **EventType** can be any of the following.
|
||||
|
||||
- **//string//** -- TODO...
|
||||
- **//Array<string<[[datahexstring]]<32>> | Array<string<[[datahexstring]]<32>>>>//** -- TODO...
|
||||
- **//[[provider-eventfilter]]//** -- TODO...
|
||||
|
||||
|
||||
_subsection: Network @<provider-network>
|
||||
A **Network** represents an Etherem network.
|
||||
|
||||
- **name** -- The human-readable name of the network
|
||||
- **chainId** -- The Chain ID of the network
|
||||
- **ensAddress** -- The address at which the ENS registry is deployed
|
||||
_property: network.name => string
|
||||
The human-readable name of the network, such as ``homestead``. If the network
|
||||
name is unknown, this will be ``"unknown"``.
|
||||
|
||||
_property: network.chainId => number
|
||||
The Chain ID of the network.
|
||||
|
||||
_property: network.ensAddress => string<[[address]]>
|
||||
The address at which the ENS registry is deployed on this network.
|
||||
|
||||
|
||||
_subsection: Blocks
|
||||
_subsection: Block @<provider-block>
|
||||
|
||||
_heading: Block @<provider-block>
|
||||
TODO
|
||||
_property: block.hash => string<[[datahexstring]]<32>>
|
||||
The hash of this block.
|
||||
|
||||
_heading: BlockWithTransactions @<provider-blocktxs>
|
||||
TODO
|
||||
_property: block.parentHash => string<[[datahexstring]]<32>>
|
||||
The hash of the previous block.
|
||||
|
||||
_property: block.number => number
|
||||
The height (number) of this block.
|
||||
|
||||
_property: block.timestamp => number
|
||||
The timestamp of this block.
|
||||
|
||||
_property: block.nonce => string<[[datahexstring]]>
|
||||
The nonce used as part of the proof-of-work to mine this block.
|
||||
|
||||
This property is generally of little interest developers.
|
||||
|
||||
_property: block.difficulty => number
|
||||
The difficulty target required to be met by the miner of the block.
|
||||
|
||||
This property is generally of little interest developers.
|
||||
|
||||
_property: block.gasLimit => [[bignumber]]
|
||||
The maximum amount of gas that this block was permitted to use. This
|
||||
is a value that can be voted up or voted down by miners and is used
|
||||
to automatically adjust the bandwidth requirements of the network.
|
||||
|
||||
This property is generally of little interest developers.
|
||||
|
||||
_property: block.gasUsed => [[bignumber]]
|
||||
The total amount of gas used by all transactions in this block.
|
||||
|
||||
_property: block.miner => string
|
||||
The coinbase address of this block, which indicates the address the
|
||||
miner that mined this block would like the subsidy reward to go to.
|
||||
|
||||
_property: block.extraData => string
|
||||
This is extra data a miner may choose to include when mining a block.
|
||||
|
||||
This property is generally of little interest developers.
|
||||
|
||||
_heading: Block (with transaction hashes)
|
||||
|
||||
Often only the hashes of the transactions included in a block are needed,
|
||||
so by default a block only contains this information, as it is
|
||||
substantially less data.
|
||||
|
||||
_property: block.transactions => Array<string<[[datahexstring]]<32>>>
|
||||
A list of the transactions hashes for each transaction this block
|
||||
includes.
|
||||
|
||||
_heading: BlockWithTransactions @<provider-blocktxs> @INHERIT<[Block](provider-block)>
|
||||
|
||||
If all transactions for a block are needed, this object instead includes
|
||||
the full details on each transaction.
|
||||
|
||||
_property: block.transactions => Array<[[provider-transactionresponse]]>
|
||||
A list of the transactions this block includes.
|
||||
|
||||
|
||||
_subsection: Events and Logs
|
||||
|
||||
_heading: EventFilter
|
||||
TODO
|
||||
_heading: EventFilter @<provider-eventfilter>
|
||||
|
||||
_heading: EventType
|
||||
TODO
|
||||
_property: filter.address => string<[[address]]>
|
||||
The address to filter by, or ``null`` to match any address.
|
||||
|
||||
_heading: Filter
|
||||
TODO
|
||||
_property: filter.topics => Array<string<[[datahexstring]]<32>> | Array<string<[[datahexstring]]<32>>>>
|
||||
The topics to filter by, or ``null`` to match any topics. Each entry represents an
|
||||
**AND** condition that must match, or may be ``null`` to match anything. If a given
|
||||
entry is an Array, then that entry is treated as an **OR** for any value in the entry.
|
||||
|
||||
_heading: Filter @<provider-filter> @INHERIT<[[provider-eventfilter]]>
|
||||
|
||||
_property: filter.fromBlock => [[provider-blocktag]]
|
||||
The starting block (inclusive) to search for logs matching the filter criteria.
|
||||
|
||||
_property: filter.toBlock => [[provider-blocktag]]
|
||||
The end block (inclusive) to search for logs matching the filter criteria.
|
||||
|
||||
_heading: FilterByBlockHash @<provider-filterbyblockhash> @INHERIT<[[provider-eventfilter]]>
|
||||
|
||||
_property: filter.blockHash => string<[[datahexstring]]<32>>
|
||||
The specific block (by its block hash) to search for logs matching the filter criteria.
|
||||
|
||||
_heading: FilterByBlockHash
|
||||
TODO
|
||||
|
||||
_heading: Log @<provider-log>
|
||||
A network...
|
||||
|
||||
_property: log.blockNumber => number
|
||||
The block height (number) of the block including the transaction of this log.
|
||||
|
||||
_property: log.blockHash => string<[[datahexstring]]<32>>
|
||||
The block hash of the block including the transaction of this log.
|
||||
|
||||
_property: log.removed => boolean
|
||||
During a re-org, if a transaction is orphaned, this will be set to true
|
||||
to indicate the Log entry has been removed; it will likely be emitted
|
||||
again in the near future when another block is mined with the transaction
|
||||
that triggered this log, but keep in mind the values may change.
|
||||
|
||||
_property: log.transactionLogIndex => number
|
||||
The index of this log in the transaction.
|
||||
|
||||
_property: log.address => string<[[address]]>
|
||||
The address of the contract that generated this log.
|
||||
|
||||
_property: log.data => string<[[datahexstring]]>
|
||||
The data included in this log.
|
||||
|
||||
_property: log.topics => Array<string<[[datahexstring]]<32> > >
|
||||
The list of topics (indexed properties) for this log.
|
||||
|
||||
_property: log.transactionHash => string<[[datahexstring]]<32>>
|
||||
The transaction hash of the transaction of this log.
|
||||
|
||||
_property: log.transactionIndex => number
|
||||
The index of the transaction in the block of the transaction of this log.
|
||||
|
||||
_property: log.logIndex => number
|
||||
The index of this log across all logs in the entire **block**.
|
||||
|
||||
|
||||
_subsection: Transactions
|
||||
@@ -54,22 +166,138 @@ _heading: TransactionRequest @<provider-transactionrequest>
|
||||
A transaction request describes a transaction that is to
|
||||
be sent to the network or otherwise processed.
|
||||
|
||||
It contains the fields:
|
||||
- **to** --- target address
|
||||
- **from** --- target address
|
||||
- **nonce** --- target address
|
||||
- **gasLimit** --- target address
|
||||
- **gasPrice** --- target address
|
||||
- **data** --- target address
|
||||
- **value** --- target address
|
||||
- **chainId** --- target address
|
||||
|
||||
All fields are optional and may be a promise which resolves
|
||||
to the required type.
|
||||
|
||||
_heading: TransactionResponse @<provider-transactionresponse>
|
||||
_property: transactionRequest.to => string | Promise<string>
|
||||
The address (or ENS name) this transaction it to.
|
||||
|
||||
A **TransactionResponse** ..
|
||||
_property: transactionRequest.from => string<[[address]]> | Promise<string<[[address]]>>
|
||||
The address this transaction is from.
|
||||
|
||||
_heading: TransactionReceipt @<provider-transactionreceipt>
|
||||
TODO
|
||||
_property: transactionRequest.nonce => number | Promise<number>
|
||||
The nonce for this transaction. This should be set to the number of
|
||||
transactions ever sent **from** this address.
|
||||
|
||||
_property: transactionRequest.gasLimit => [[bignumber]] | Promise<[[bignumber]]>
|
||||
The maximum amount of gas this transaction is permitted to use.
|
||||
|
||||
_property: transactionRequest.gasPrice => [[bignumber]] | Promise<[[bignumber]]>
|
||||
The price (in wei) per unit of gas this transaction will pay.
|
||||
|
||||
_property: transactionRequest.data => [[datahexstring]] | Promise<[[datahexstring]]>
|
||||
The transaction data.
|
||||
|
||||
_property: transactionRequest.value => [[bignumber]] | Promise<[[bignumber]]>
|
||||
The amount (in wei) this transaction is sending.
|
||||
|
||||
_property: transactionRequest.chainId => number | Promise<number>
|
||||
The chain ID this transaction is authorized on, as specified by
|
||||
[EIP-155](link-eip-155).
|
||||
|
||||
If the chain ID is 0 will disable EIP-155 and the transaction will be valid
|
||||
on any network. This can be **dangerous** and care should be taken, since it
|
||||
allows transactions to be replayed on networks that were possibly not
|
||||
intended.
|
||||
|
||||
_heading: TransactionResponse @INHERIT<[[types-transaction]]> @<provider-transactionresponse>
|
||||
|
||||
A **TransactionResponse** includes all properties of a [[types-transaction]] as well as several
|
||||
properties that are useful once it has been mined.
|
||||
|
||||
_property: transaction.blockNumber => number
|
||||
The number ("height") of the block this transaction was mined in. If the block has not been mined,
|
||||
this is ``null``.
|
||||
|
||||
_property: transaction.blockHash => string<[[datahexstring]]<32>>
|
||||
The hash of the block this transaction was mined in. If the block has not been mined,
|
||||
this is ``null``.
|
||||
|
||||
_property: transaction.timestamp => number
|
||||
The timestamp of the block this transaction was mined in. If the block has not been mined,
|
||||
this is ``null``.
|
||||
|
||||
_property: transaction.confirmations => number
|
||||
The number of blocks that have been mined (including the initial block) since this
|
||||
transaction was mined.
|
||||
|
||||
_property: transaction.raw => string<[[datahexstring]]>
|
||||
The serialized transaction.
|
||||
|
||||
_property: transaction.wait([ confirmations = 1 ]) => Promise<[[provider-receipt]]> @<transaction>
|
||||
Wait for //confirmations//. If 0, and the transaction has not been mined,
|
||||
``null`` is returned.
|
||||
|
||||
_heading: TransactionReceipt @<provider-receipt>
|
||||
|
||||
_property: receipt.to => string<[[address]]>
|
||||
The address this transaction is to. This is ``null`` if the the
|
||||
transaction was an **init transaction**, used to deploy a contract.
|
||||
|
||||
_property: receipt.from => string<[[address]]>
|
||||
The address this transaction is from.
|
||||
|
||||
_property: receipt.contractAddress => string<[[address]]>
|
||||
If this transaction has a ``null` to address, it is an **init transaction**
|
||||
used to deploy a contract, in which case this is the address created by that
|
||||
contract.
|
||||
|
||||
To compute a contract address, the [getContractAddress](utils-getcontractaddress)
|
||||
utility function can also be used with a [[provider-transactionresponse]]
|
||||
object, which requires the transaction nonce and the address of the sender.
|
||||
|
||||
_property: receipt.transactionIndex => number
|
||||
The index of this transaction in the list of transactions included in
|
||||
the block this transaction was mined in.
|
||||
|
||||
_property: receipt.root => string
|
||||
The intermediate state root of a receipt.
|
||||
|
||||
Only transactions included in blocks **before** the [Byzantium Hard Fork](link-eip-609)
|
||||
have this property, as it was replaced by the ``status`` property.
|
||||
|
||||
The property is generally of little use to developers. At the time
|
||||
it could be used to verify a state transition with a fraud-proof
|
||||
only considering the single transaction; without it the full block
|
||||
must be considered.
|
||||
|
||||
_property: receipt.gasUsed => [[bignumber]]
|
||||
The amount of gas actually used by this transaction.
|
||||
|
||||
_property: receipt.logsBloom => string<[[datahexstring]]>
|
||||
A [bloom-filter](link-wiki-bloomfilter), which
|
||||
incldues all the addresses and topics included in any log in this
|
||||
transaction.
|
||||
|
||||
_property: receipt.blockHash => string<[[datahexstring]]<32>>
|
||||
The block hash of the block that this transaction was included in.
|
||||
|
||||
_property: receipt.transactionHash => string<[[datahexstring]]<32>>
|
||||
The transaction hash of this transaction.
|
||||
|
||||
_property: receipt.logs => Array<[[provider-log]]>
|
||||
All the logs emitted by this transaction.
|
||||
|
||||
_property: receipt.blockNumber => number
|
||||
The block height (number) of the block that this transaction was
|
||||
included in.
|
||||
|
||||
_property: receipt.confirmations => number
|
||||
The number of blocks that have been mined since this transaction,
|
||||
including the actual block it was mined in.
|
||||
|
||||
_property: receipt.cumulativeGasUsed => [[bignumber]]
|
||||
For the block this transaction was included in, this is the sum of the
|
||||
gas used used by each transaction in the ordered list of transactions
|
||||
up to (and including) this transaction.
|
||||
|
||||
This is generally of little interest to developers.
|
||||
|
||||
_property: receipt.byzantium => boolean
|
||||
This is true if the block is in a [post-Byzantium Hard Fork](link-eip-609)
|
||||
block.
|
||||
|
||||
_property: receipt.status => boolean
|
||||
The status of a transaction is 1 is successful or 0 if it was
|
||||
reverted. Only transactions included in blocks [post-Byzantium Hard Fork](link-eip-609)
|
||||
have this property.
|
||||
|
||||
@@ -2,32 +2,216 @@ _title: Signer
|
||||
|
||||
_section: Signers
|
||||
|
||||
Tra la la...
|
||||
A Signer represents...
|
||||
|
||||
_subsection: Signer @<signer>
|
||||
_subsection: Signer @<signer> @SRC<abstract-signer:class.Signer>
|
||||
|
||||
_property: signer.connect(provider) => [[signer]]
|
||||
TODO
|
||||
The **Signer** class is abstract and cannot be directly instaniated. Instead
|
||||
use one of the concreate sub-classes, such as the [[wallet]], [[void-signer]]
|
||||
or [[signer-jsonrpc]].
|
||||
|
||||
_heading: Blockchain Methods
|
||||
_property: signer.connect(provider) => [[signer]] @<signer-connect>
|
||||
|
||||
_property: signer.getBalance([ blockTag = "latest" ]) => Promise<[[bignumber]]>
|
||||
TODO
|
||||
Sub-classes **must** implement this, however they may simply throw an error
|
||||
if changing providers is not supported.
|
||||
|
||||
_property: signer.getTransactionCount([ blockTag = "latest" ]) => Promise<number>
|
||||
TODO
|
||||
_property: signer.getAddress() => Promise<string<[Address](address)>> @<signer-getaddress> @SRC<abstract-signer:Signer.connect>
|
||||
Returns a Promise that resolves to the account address.
|
||||
|
||||
This is a Promise so that a **Signer** can be designed around an
|
||||
asynchronous source, such as hardware wallets.
|
||||
|
||||
Sub-classes **must** implement this.
|
||||
|
||||
_property: Signer.isSigner(object) => boolean @<signer-issigner> @SRC<abstract-signer>
|
||||
Returns true if an only if //object// is a **Signer**.
|
||||
|
||||
_heading: Blockchain Methods @<signer-blockchain>
|
||||
|
||||
_property: signer.getBalance([ blockTag = "latest" ]) => Promise<[[bignumber]]> @<signer-getbalance> @SRC<abstract-signer>
|
||||
Returns the balance of this wallet at //blockTag//.
|
||||
|
||||
_property: signer.getChainId() => Promise<number> @<signer-getchainid> @SRC<abstract-signer>
|
||||
Returns ths chain ID this wallet is connected to.
|
||||
|
||||
_property: signer.getGasPrice() => Promise<[[bignumber]]> @<signer-getgasprice> @SRC<abstract-signer>
|
||||
Returns the current gas price.
|
||||
|
||||
_property: signer.getTransactionCount([ blockTag = "latest" ]) => Promise<number> @<signer-gettransactioncount> @SRC<abstract-signer>
|
||||
Returns the number of transactions this account has ever sent. This
|
||||
is the value required to be included in transactions as the ``nonce``.
|
||||
|
||||
_property: signer.call(transactionRequest) => Promise<string<[[datahexstring]]>> @<signer-call> @SRC<abstract-signer>
|
||||
Returns the result of calling using the //transactionRequest//, with this
|
||||
account address being used as the ``from`` field.
|
||||
|
||||
_property: signer.estimateGas(transactionRequest) => Promise<[[bignumber]]> @<signer-estimategas> @SRC<abstract-signer>
|
||||
Returns the result of estimating the cost to send the //transactionRequest//,
|
||||
with this account address being used as the ``from`` field.
|
||||
|
||||
_property: signer.resolveName(ensName) => Promise<string<[Address](address)>> @<signer-resolvename> @SRC<abstract-signer>
|
||||
Returns the address associated with the //ensName//.
|
||||
|
||||
|
||||
_subsection: Wallet inherits Signer
|
||||
_heading: Signing
|
||||
|
||||
_property: signer.signMessage(message) => Promise<string<[FlatSignature](signature-flat)>> @<signer-signmessage>
|
||||
This returns a Promise which resolves to the [[signature-flat]]
|
||||
of //message//.
|
||||
|
||||
Sub-classes **must** implement this, however they may throw if signing a
|
||||
message is not supported.
|
||||
|
||||
_note: Note
|
||||
|
||||
If //message// is a string, it is **treated as a string** and
|
||||
converted to its representation in UTF8 bytes.
|
||||
|
||||
**If and only if** a message is a [[bytes]] will it be treated as
|
||||
binary data.
|
||||
|
||||
For example, the string ``"0x1234"`` is 6 characters long (and in
|
||||
this case 6 bytes long). This is **not** equivalent to the array
|
||||
``[ 0x12, 0x34 ]``, which is 2 bytes long.
|
||||
|
||||
A common case is to sign a hash. In this case, if the hash is a
|
||||
string, it **must** be converted to an array first, using the
|
||||
[arrayify](utils-arrayify) utility function.
|
||||
|
||||
_null:
|
||||
|
||||
_property: signer.signTransaction(transactionRequest) => Promise<string<[[datahexstring]]>> @<signer-signtransaction>
|
||||
Returns a Promise which resolves to the signed transaction of the
|
||||
//transactionRequest//. This method does not populate any missing fields.
|
||||
|
||||
Sub-classes **must** implement this, however they may throw if signing a
|
||||
transaction is not supported.
|
||||
|
||||
_property: signer.sendTransaction(transactionRequest) => Promise<[[provider-transactionresponse]]> @<signer-sendtransaction>
|
||||
This method populates the transactionRequest with missing fields, using
|
||||
[populateTransaction](signer-populatetransaction) and returns a Promise which resolves to the transaction.
|
||||
|
||||
Sub-classes **must** implement this, however they may throw if signing a
|
||||
transaction is not supported.
|
||||
|
||||
_heading: Sub-Classes @<signer-subclassing>
|
||||
|
||||
It is very important that all important properties of a **Signer** are
|
||||
**immutable**. Since Ethereum is very asynchronous and deals with critical
|
||||
data (such as ether and other potentially valuable crypto assets), keeping
|
||||
properties such as the //provider// and //address// static helps prevent
|
||||
serious issues.
|
||||
|
||||
A sub-class **must** call ``super()``.
|
||||
|
||||
_property: signer.checkTransaction(transactionRequest) => [[provider-transactionrequest]] @<signer-checktransaction> @SRC<abstract-signer>
|
||||
This is generally not required to be overridden, but may needed to provide
|
||||
custom behaviour in sub-classes.
|
||||
|
||||
This should return a **copy** of the //transactionRequest//, with any properties
|
||||
needed by ``call``, ``estimateGas`` and ``populateTransaction`` (which is used
|
||||
by sendTransaction). It should also throw an error if any unknown key is specified.
|
||||
|
||||
The default implementation checks only valid [[provider-transactionrequest]] properties
|
||||
exist and adds ``from`` to the transaction if it does not exist, or verifies it is equal
|
||||
to the Signer's address if it does exist.
|
||||
|
||||
_property: signer.populateTransaction(transactionRequest) => Promise<[[provider-transactionrequest]]> @<signer-populatetransaction> @SRC<abstract-signer>
|
||||
This is generally not required to be overridden, but may needed to provide
|
||||
custom behaviour in sub-classes.
|
||||
|
||||
This should return a **copy** of //transactionRequest//, follow the same procedure
|
||||
as ``checkTransaction`` and fill in any properties required for sending a transaction.
|
||||
The result should have all promises resolved; if needed the [resolveProperties](utils-resolveproperties)
|
||||
utility function can be used for this.
|
||||
|
||||
The default implementation calls ``checkTransaction`` and resolves to if it is an
|
||||
ENS name, adds ``gasPrice``, ``nonce``, ``gasLimit`` and ``chainId`` based on the
|
||||
related operations on Signer.
|
||||
|
||||
_subsection: Wallet @<wallet> @INHERIT<[[externally-owned-account]] and [[signer]]> @SRC<wallet:class.Wallet>
|
||||
|
||||
The Wallet class inherits [[signer]] and can sign transactions and messages
|
||||
using a private key as a standard Externally Owned Account (EOA).
|
||||
|
||||
_heading: Creating an Instance
|
||||
_property: new ethers.Wallet(privateKey [ , provider ]) @<wallet-constructor> @SRC<wallet:constructor.Wallet>
|
||||
Create a new Wallet instance for //privateKey// and optionally
|
||||
connected to the //provider//.
|
||||
|
||||
_property: new ethers.Wallet(privateKey [ , provider ])
|
||||
TODO
|
||||
_property: ethers.Wallet.createRandom( [ options = { } ]) => [[wallet]] @<wallet-createrandom> @SRC<wallet>
|
||||
Returns a new Wallet with a random private key, generated from
|
||||
cryptographically secure entropy sources. If the current environment
|
||||
does not have a secure entropy source, an error is thrown.
|
||||
|
||||
_property: Wallet.fromEncryptedJson(json, password)
|
||||
TODO
|
||||
_property: ethers.Wallet.fromEncryptedJson(json, password [ , progress ]) => Promise<[[wallet]]> @<wallet-fromencryptedjson> @SRC<wallet>
|
||||
Create an instance from an encrypted JSON wallet. If //progress//
|
||||
is provided it will be called during decryption with a value between 0 and
|
||||
1 indicating the progress towards completion.
|
||||
|
||||
_property: ethers.Wallet.fromMnemonic(mnemonic [ , path, [ wordlist ] ]) => [[wallet]]
|
||||
Create an instance from a mnemonic phrase.
|
||||
|
||||
If path is not specified, the Ethereum default path is used (i.e. m/44'/60'/0'/0/0).
|
||||
|
||||
If wordlist is not specified, the English Wordlist is used.
|
||||
|
||||
_heading: Properties
|
||||
|
||||
_property: wallet.address => string<[Address](address)>
|
||||
The address for the account this Wallet represents.
|
||||
|
||||
_property: wallet.provider => [[provider]]
|
||||
The provider this wallet is connected to, which will ge used for any [[signer-blockchain]]
|
||||
methods. This can be null.
|
||||
|
||||
_note: Note
|
||||
A **Wallet** instance is immuatable, so if you wish to change the Provider, you
|
||||
may use the [connect](signer-connect) method to create a new instance connected
|
||||
to the desired provider.
|
||||
|
||||
_property: wallet.publicKey => string<[[datahexstring]]<65>>
|
||||
The uncompressed public key for this Wallet represents.
|
||||
|
||||
_heading: Methods
|
||||
|
||||
_property: wallet.encrypt(password, [ options = { }, [ progress ] ]) => Promise<string>
|
||||
|
||||
Encrypt the wallet using //password// returning a Promise which resolves
|
||||
to a JSON wallet.
|
||||
|
||||
|
||||
_subsection: VoidSigner @<void-signer> @INHERIT<[[signer]]> @SRC<abstract-signer:class.VoidSigner>
|
||||
|
||||
A **VoidSigner** is a simple Signer which cannot sign.
|
||||
|
||||
It is useful as a read-only signer, when an API requires a
|
||||
Signer as a parameter, but it is known only read-only operations
|
||||
will be carried.
|
||||
|
||||
For example, the ``call`` operation will automatically have the
|
||||
provided address passed along during the execution.
|
||||
|
||||
_property: new ethers.VoidSigner(address) => [[void-signer]]
|
||||
Create a new instance of a **VoidSigner** for //address//.
|
||||
|
||||
_property: voidSigner.address => string<[Address](address)>
|
||||
The address of this **VoidSigner**.
|
||||
|
||||
|
||||
_subsection: ExternallyOwnedAccount @<externally-owned-account>
|
||||
|
||||
_property: eoa.address => string<[Address](address)>
|
||||
|
||||
The [[address]] of this EOA.
|
||||
|
||||
_property: eoa.privateKey => string<[[datahexstring]]<32>>
|
||||
|
||||
The privateKey of this EOA
|
||||
|
||||
_property: eoa.mnemonic => string
|
||||
|
||||
//Optional//. The account HD mnemonic, if it has one and can be determined.
|
||||
|
||||
_property: eoa.path => string
|
||||
|
||||
//Optional//. The account HD path, if it has one and can be determined.
|
||||
|
||||
242
docs.wrm/api/utils/abi.wrm
Normal file
242
docs.wrm/api/utils/abi.wrm
Normal file
@@ -0,0 +1,242 @@
|
||||
_title: Application Binary Interface
|
||||
|
||||
_section: Application Binary Interface
|
||||
|
||||
Explain an ABI.
|
||||
|
||||
_subsection: Formats
|
||||
|
||||
_heading: JSON String ABI (Solidity Output JSON)
|
||||
|
||||
The **JSON ABI Format** is the format that is
|
||||
[output from the Solidity compiler](link-solc-output).
|
||||
|
||||
A JSON serialized object is always a string, which represents an Array
|
||||
of Objects, where each Object has various properties describing the [[abi-fragment]] of the ABI.
|
||||
|
||||
The deserialied JSON string (which is a normal JavaScript Object) may
|
||||
also be passed into any function which accepts a JSON String ABI.
|
||||
|
||||
_heading: Humanb-Readable ABI
|
||||
|
||||
The Human-Readable ABI was
|
||||
|
||||
[article](link-ricmoo-humanreadableabi)
|
||||
|
||||
_heading: Output Formats @<abi-outputformats> @src<abi/fragments:FormatTypes>
|
||||
|
||||
Each [[abi-fragment]] and [[abi-paramtype]] may be output using its ``format``
|
||||
method.
|
||||
|
||||
_property: utils.FragmentTypes.full => string
|
||||
|
||||
This is a full human-readable string, including all parameter names, any
|
||||
optional modifiers (e.g. ``indexed``, ``public``, etc) and white-space
|
||||
to aid in human readabiliy.
|
||||
|
||||
_property: utils.FragmentTypes.minimal => string
|
||||
|
||||
This is similar to ``full``, except with no unnecessary whitespace or parameter
|
||||
names. This is useful for storing a minimal string which can still fully
|
||||
reconstruct the original Fragment using [Fragment . from](abi-fragment-from).
|
||||
|
||||
_property: utils.FragmentTypes.json => string
|
||||
|
||||
This returns a JavaScript Object which is safe to call ``JSON.stringify``
|
||||
on to create a JSON string.
|
||||
|
||||
_property: utils.FragmentTypes.sighash => string
|
||||
|
||||
This is a minimal output format, which is used by Solidity when computing a
|
||||
signature hash or an event topic hash.
|
||||
|
||||
_warning: Note
|
||||
|
||||
The ``sighash`` format is **insufficient** to re-create the original [[abi-fragment]],
|
||||
since it discards modifiers such as indexed, anonymous, stateMutability, etc.
|
||||
|
||||
|
||||
_subsection: Fragment @<abi-fragment> @SRC<abi/fragments:class.Fragment>
|
||||
|
||||
An ABI is a collection of **Fragments**, where each fragment specifies:
|
||||
|
||||
- An Event
|
||||
- A Function
|
||||
- A Constructor
|
||||
|
||||
_heading: Properties
|
||||
|
||||
_property: fragment.name => string
|
||||
|
||||
This is the name of the Event or Function. This will be null for
|
||||
a [[abi-constructorfragment]].
|
||||
|
||||
_property: fragment.type => string
|
||||
|
||||
This is a string which indicates the type of the [[abi-fragment]]. This
|
||||
will be one of:
|
||||
|
||||
- ``constructor``
|
||||
- ``event``
|
||||
- ``function``
|
||||
|
||||
_property: fragment.inputs => Array<[[abi-paramtype]]>
|
||||
|
||||
This is an array of of each [[abi-paramtype]] for the input parameters to
|
||||
the Constructor, Event of Function.
|
||||
|
||||
_heading: Methods
|
||||
|
||||
_property: utils.Fragment.from(objectOrString) => [[abi-fragment]] @<abi-fragment-from> @SRC<abi/fragments:Fragment.from>
|
||||
|
||||
Returns a
|
||||
|
||||
_property: utils.Fragment.isFragment(object) => boolean @<abi-isfragment> @SRC<abi/fragments:Fragment.isFragment>
|
||||
|
||||
Tra lal al
|
||||
|
||||
|
||||
_subsection: ConstructorFragment @<abi-constructorfragment> @INHERIT<[[abi-fragment]]> @SRC<abi/fragments:class.ConstructorFragment>
|
||||
|
||||
_heading: Properties
|
||||
|
||||
_property: fragment.gas => [[bignumber]]
|
||||
|
||||
This is the gas limit that should be used during deployment. It may be
|
||||
null.
|
||||
|
||||
_property: fragment.payable => boolean
|
||||
|
||||
This is whether the constructor may receive ether during deployment as
|
||||
an endowment (i.e. msg.value != 0).
|
||||
|
||||
_property: fragment.stateMutability => string
|
||||
|
||||
This is the state mutability of the constructor. It can be any of:
|
||||
|
||||
- ``nonpayable``
|
||||
- ``payable``
|
||||
|
||||
_heading: Methods
|
||||
|
||||
_property: utils.ConstructorFragment.from(objectOrString) => [[abi-constructorfragment]] @<abi-constructorfragment-from> @SRC<abi/fragments:ConstructorFragment.from>
|
||||
|
||||
Tra la la...
|
||||
|
||||
_property: utils.ConstructorFragment.isConstructorFragment(object) => boolean @<abi-isconstructorfragment> @SRC<abi/fragments:ConstructorFragment.isConstructorFragment>
|
||||
|
||||
Tra lal al
|
||||
|
||||
|
||||
_subsection: EventFragment @<abi-eventfragment> @INHERIT<[[abi-fragment]]> @SRC<abi/fragments:class.EventFragment>
|
||||
|
||||
_heading: Properties
|
||||
|
||||
_property: fragment.anonymous => boolean
|
||||
|
||||
This is whether the event is anonymous. An anonymous Event does not inject its
|
||||
topic hash as topic0 when creating a log.
|
||||
|
||||
_heading: Methods
|
||||
|
||||
_property: utils.EventFragment.from(objectOrString) => [[abi-eventfragment]] @<abi-eventfragment-from> @SRC<abi/fragments:EventFragment.from>
|
||||
|
||||
Tra la la...
|
||||
|
||||
_property: utils.EventFragment.isEventFragment(object) => boolean @<abi-iseventfragment> @SRC<abi/fragments:EventFragment.isEventFragment>
|
||||
|
||||
Tra lal al
|
||||
|
||||
|
||||
_subsection: FunctionFragment @<abi-functionfragment> @INHERIT<[[abi-constructorfragment]]> @SRC<abi/fragments:class.FunctionFragment>
|
||||
|
||||
_heading: Properties
|
||||
|
||||
_property: fragment.constant => boolean
|
||||
|
||||
This is whether the function is constant (i.e. does not change state). This
|
||||
is true if the state mutability is ``pure`` or ``view``.
|
||||
|
||||
_property: fragment.stateMutability => string
|
||||
|
||||
This is the state mutability of the constructor. It can be any of:
|
||||
|
||||
- ``nonpayable``
|
||||
- ``payable``
|
||||
- ``pure``
|
||||
- ``view``
|
||||
|
||||
_property: fragment.outputs => Array<[[abi-paramtype]]>
|
||||
|
||||
A list of the Function output parameters.
|
||||
|
||||
_heading: Method
|
||||
|
||||
_property: utils.FunctionFragment.from(objectOrString) => [[abi-functionfragment]] @<abi-functionfragment-from> @SRC<abi/fragments:ConstructorFragment.from>
|
||||
|
||||
Tra la la...
|
||||
|
||||
_property: utils.FunctionFragment.isFunctionFragment(object) => boolean @<abi-isfunctionfragment> @SRC<abi/fragments:FunctionFragment.isFunctionFragment>
|
||||
|
||||
Tra lal al
|
||||
|
||||
|
||||
_subsection: ParamType @<abi-paramtype> @SRC<abi/fragments:class.ParamType>
|
||||
|
||||
The following examples will represent the Solidity parameter:
|
||||
|
||||
``string foobar``
|
||||
|
||||
_heading: Properties
|
||||
|
||||
_property: paramType.name => string @<abi-paramtype-name>
|
||||
|
||||
The local parameter name. This may be null for unnamed parameters. For example,
|
||||
the parameter definition ``string foobar`` would be ``foobar``.
|
||||
|
||||
_property: paramType.type => string @<abi-paramtype-type>
|
||||
|
||||
The full type of the parameter, including tuple and array symbols. This may be null
|
||||
for unnamed parameters. For the above example, this would be ``foobar``.
|
||||
|
||||
_property: paramType.basetype => string @<abi-paramtype-basetype>
|
||||
|
||||
The base type of the parameter. For primitive types (e.g. ``address``, ``uint256``, etc)
|
||||
this is equal to [type](abi-paramtype-type). For arrays, it will be the string ``array`` and for
|
||||
a tuple, it will be the string ``tuple``.
|
||||
|
||||
_property: paramType.indexed => boolean @<abi-paramtype-indexed>
|
||||
|
||||
Whether the parameter has been marked as indexed. This **only** applies
|
||||
to parameters which are part of an [[abi-eventfragment]].
|
||||
|
||||
_property: paramType.arrayChildren => [[abi-paramtype]] @<abi-paramtype-arraychildren>
|
||||
|
||||
The type of children of the array. This is null for for any parameter
|
||||
wjhich is not an array.
|
||||
|
||||
_property: paramType.arrayLength => number @<abi-paramtype-arraylength>
|
||||
|
||||
The length of the array, or ``-1`` for dynamic-length arrays. This is
|
||||
null for parameters which is not arrays.
|
||||
|
||||
_property: paramType.components => Array<[[abi-paramtype]]> @<abi-paramtype-components>
|
||||
|
||||
The components of a tuple. This is null for non-tuple parameters.
|
||||
|
||||
|
||||
_heading: Methods
|
||||
|
||||
Tra la la...
|
||||
|
||||
_property: paramType.format([ outputType = "sighash" ])
|
||||
|
||||
Tra la la...
|
||||
|
||||
_property: utils.ParamType.from(objectOrString) => [[abi-paramtype]] @<abi-paramtype-from> @SRC<abi/fragments:ParamType.from>
|
||||
|
||||
Tra la la...
|
||||
|
||||
_property: utils.ParamType.isParamType(object) => boolean @<abi-paramtype-isparamtype> @SRC<abi/fragments:ParamType.isParamType>
|
||||
|
||||
Tra la la...
|
||||
@@ -1,21 +1,68 @@
|
||||
_title: Addresses
|
||||
|
||||
_section: Addresses
|
||||
_section: Addresses @<addresses>
|
||||
|
||||
Explain addresses,formats and checksumming here.
|
||||
|
||||
Also see: [Constants.AddressZero](constants)
|
||||
Also see: [constants.AddressZero](constants)
|
||||
|
||||
_heading: Functions
|
||||
_subsection: Address Formats @<address-formats>
|
||||
|
||||
_property: utils.getAddress(address) => string
|
||||
TODO
|
||||
|
||||
_property: utils.isAddress(address) => boolean
|
||||
TODO
|
||||
_heading: Address @<address>
|
||||
|
||||
_property: utils.getIcapAddress(address) => string
|
||||
TODO
|
||||
An **Address** is a [[datahexstring]] of 20 bytes (40 nibbles), with optional
|
||||
mixed case.
|
||||
|
||||
_property: utils.getContractAddress(transaction) => string
|
||||
TODO
|
||||
If the case is mixed, it is a **Checksum Address**, which uses a specific pattern
|
||||
of uppercase and lowercase letters within a given address to reduce the risk
|
||||
of errors introduced from typing an address or cut and paste issues.
|
||||
|
||||
All functions that return an Address will return a Checksum Address.
|
||||
|
||||
|
||||
_heading: ICAP Address @<address-icap>
|
||||
|
||||
The **ICAP Address Format** was an early attempt to introduce a checksum
|
||||
into Ethereum addresses using the popular banking industry's
|
||||
[IBAN](link-wiki-iban)
|
||||
format with the country code specified as **XE**.
|
||||
|
||||
Due to the way IBAN encodes address, only addresses that fit into 30 base-36
|
||||
characters are actually compatible, so the format was adapted to support 31
|
||||
base-36 characters which is large enough for a full Ethereum address, however
|
||||
the preferred method was to select a private key whose address has a ``0`` as
|
||||
the first byte, which allows the address to be formatted as a fully compatibly
|
||||
standard IBAN address with 30 base-36 characters.
|
||||
|
||||
In general this format is no longer widely supported anymore, however any function that
|
||||
accepts an address can receive an ICAP address, and it will be converted internally.
|
||||
|
||||
To convert an address into the ICAP format, see [getIcapAddress](utils-getIcapAddress).
|
||||
|
||||
|
||||
_subsection: Functions
|
||||
|
||||
_property: utils.getAddress(address) => string<[[address]]> @<utils-getAddress> @SRC<address>
|
||||
Returns //address// as a Checksum Address.
|
||||
|
||||
If //address// is an invalid 40-nibble [[hexstring]] or if it contains mixed case and
|
||||
the checksum is invalid, an InvalidArgument Error is throw.
|
||||
|
||||
The value of //address// may be any supported address format.
|
||||
|
||||
|
||||
_property: utils.isAddress(address) => boolean @<utils-isAddress> @SRC<address>
|
||||
Returns true if //address// is valid (in any supported format).
|
||||
|
||||
_property: utils.getIcapAddress(address) => string<[IcapAddress](address-icap)> @<utils-getIcapAddress> @SRC<address>
|
||||
Returns //address// as an [ICAP address](link-icap).
|
||||
Supports the same restrictions as [utils.getAddress](utils-getAddress).
|
||||
|
||||
_property: utils.getContractAddress(transaction) => string<[[address]]> @<utils-getcontractaddress> @SRC<address>
|
||||
Returns the contract address that would result if //transaction// was
|
||||
used to deploy a contract.
|
||||
|
||||
_property: utils.getCreate2Address(from, salt, initCodeHash) => string<[[address]]> @<utils.getCreate2Address> @SRC<address>
|
||||
Returns the contract address that would result from the given
|
||||
[CREATE2](link-eip-1014) call.
|
||||
|
||||
@@ -31,7 +31,7 @@ _definition: **//number//**
|
||||
A number that is within the safe range for JavaScript numbers.
|
||||
|
||||
_definition: **//BigInt//**
|
||||
A JavaScript [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt)
|
||||
A JavaScript [BigInt](link-js-bigint)
|
||||
object, on environments that support BigInt.
|
||||
|
||||
|
||||
@@ -55,86 +55,86 @@ it represents.
|
||||
|
||||
_heading: Math Operations
|
||||
|
||||
_property: bignumber.add(otherValue) => [[bignumber]]
|
||||
_property: bignumber.add(otherValue) => [[bignumber]] @SRC<bignumber>
|
||||
Returns a BigNumber with the value of //bignumber// **+** //otherValue//.
|
||||
|
||||
_property: bignumber.sub(otherValue) => [[bignumber]]
|
||||
_property: bignumber.sub(otherValue) => [[bignumber]] @SRC<bignumber>
|
||||
Returns a BigNumber with the value of //bignumber// **–** //otherValue//.
|
||||
|
||||
_property: bignumber.mul(otherValue) => [[bignumber]]
|
||||
_property: bignumber.mul(otherValue) => [[bignumber]] @SRC<bignumber>
|
||||
Returns a BigNumber with the value of //bignumber// **×** //otherValue//.
|
||||
|
||||
_property: bignumber.div(divisor) => [[bignumber]]
|
||||
_property: bignumber.div(divisor) => [[bignumber]] @SRC<bignumber>
|
||||
Returns a BigNumber with the value of //bignumber// **÷** //divisor//.
|
||||
|
||||
_property: bignumber.mod(divisor) => [[bignumber]]
|
||||
_property: bignumber.mod(divisor) => [[bignumber]] @SRC<bignumber>
|
||||
Returns a BigNumber with the value of the **remainder** of //bignumber// ÷ //divisor//.
|
||||
|
||||
_property: bignumber.pow(exponent) => [[bignumber]]
|
||||
_property: bignumber.pow(exponent) => [[bignumber]] @SRC<bignumber>
|
||||
Returns a BigNumber with the value of //bignumber// to the power of //exponent//.
|
||||
|
||||
_property: bignumber.abs() => [[bignumber]]
|
||||
_property: bignumber.abs() => [[bignumber]] @SRC<bignumber>
|
||||
Returns a BigNumber with the absolute value of //bignumber//.
|
||||
|
||||
_property: bignumber.maskn(bitcount) => [[bignumber]]
|
||||
_property: bignumber.maskn(bitcount) => [[bignumber]] @SRC<bignumber>
|
||||
Returns a BigNumber with the value of //bignumber// with bits beyond
|
||||
the //bitcount// least significant bits set to zero.
|
||||
|
||||
|
||||
_heading: Two's Compliment
|
||||
|
||||
[Two's Complicment](https://en.wikipedia.org/wiki/Two%27s_complement)
|
||||
[Two's Complicment](link-wiki-twoscomplement)
|
||||
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]]
|
||||
_property: bignumber.fromTwos(bitwidth) => [[bignumber]] @SRC<bignumber>
|
||||
Returns a BigNumber with the value of //bignumber// converted from twos-compliment with //bitwidth//.
|
||||
|
||||
_property: bignumber.toTwos(bitwidth) => [[bignumber]]
|
||||
_property: bignumber.toTwos(bitwidth) => [[bignumber]] @SRC<bignumber>
|
||||
Returns a BigNumber with the value of //bignumber// converted to twos-compliment with //bitwidth//.
|
||||
|
||||
|
||||
_heading: Comparison and Equivalence
|
||||
|
||||
_property: bignumber.eq(otherValue) => boolean
|
||||
_property: bignumber.eq(otherValue) => boolean @SRC<bignumber>
|
||||
Returns true if and only if the value of //bignumber// is equal to //otherValue//.
|
||||
|
||||
_property: bignumber.lt(otherValue) => boolean
|
||||
_property: bignumber.lt(otherValue) => boolean @SRC<bignumber>
|
||||
Returns true if and only if the value of //bignumber// **<** //otherValue//.
|
||||
|
||||
_property: bignumber.lte(otherValue) => boolean
|
||||
_property: bignumber.lte(otherValue) => boolean @SRC<bignumber>
|
||||
Returns true if and only if the value of //bignumber// **≤** //otherValue//.
|
||||
|
||||
_property: bignumber.gt(otherValue) => boolean
|
||||
_property: bignumber.gt(otherValue) => boolean @SRC<bignumber>
|
||||
Returns true if and only if the value of //bignumber// **>** //otherValue//.
|
||||
|
||||
_property: bignumber.gte(otherValue) => boolean
|
||||
_property: bignumber.gte(otherValue) => boolean @SRC<bignumber>
|
||||
Returns true if and only if the value of //bignumber// **≥** //otherValue//.
|
||||
|
||||
_property: bignumber.isZero() => boolean
|
||||
_property: bignumber.isZero() => boolean @SRC<bignumber>
|
||||
Returns true if and only if the value of //bignumber// is zero.
|
||||
|
||||
|
||||
_heading: Conversion
|
||||
|
||||
_property: bignumber.toNumber() => number
|
||||
_property: bignumber.toNumber() => number @SRC<bignumber>
|
||||
Returns the value of //bignumber// as a JavaScript value.
|
||||
|
||||
This will **throw an error**
|
||||
if the value is greater than or equal to //Number.MAX_SAFE_INTEGER// or less than or
|
||||
equal to //Number.MIN_SAFE_INTEGER//.
|
||||
|
||||
_property: bignumber.toString() => string
|
||||
_property: bignumber.toString() => string @SRC<bignumber:BigNumber.toString>
|
||||
Returns the value of //bignumber// as a base-10 string.
|
||||
|
||||
_property: bignumber.toHexString() => string
|
||||
_property: bignumber.toHexString() => string<[[datahexstring]]> @SRC<bignumber:BigNumber.toHexString>
|
||||
Returns the value of //bignumber// as a base-16, `0x`-prefixed [hexstring](hexstring).
|
||||
|
||||
|
||||
_heading: Inspection
|
||||
|
||||
_property: BigNumnber.isBigNumber(object) => boolean
|
||||
_property: BigNumnber.isBigNumber(object) => boolean @SRC<bignumber>
|
||||
Returns true if and only if the //object// is a BigNumber object.
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ with very little granularity. For example, there are only 100
|
||||
cents in a single dollar. However, there are 10^^18^^ **wei** in a
|
||||
single **ether**.
|
||||
|
||||
JavaScript uses [IEEE 754 double-precision binary floating point](https://en.wikipedia.org/wiki/Double-precision_floating-point_format)
|
||||
JavaScript uses [IEEE 754 double-precision binary floating point](link-wiki-ieee754)
|
||||
numbers to represent numeric values. As a result, there are //holes//
|
||||
in the integer set after 9,007,199,254,740,991; which is
|
||||
problematic for //Ethereum// because that is only around 0.009
|
||||
|
||||
@@ -8,64 +8,76 @@ _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](link-js-array) or [TypedArray](link-js-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>
|
||||
|
||||
- **r** and **s** --- The x co-ordinate of **r** and the **s** value of the signature
|
||||
- **v** --- The parity of the y co-ordinate of **r**
|
||||
- **_vs** --- The [compact representation](https://link_here) of the **(r, s)** and **v**
|
||||
- **_vs** --- The [compact representation](link-eip-2098) of the **s** and **v**
|
||||
- **recoveryParam** --- The normalized (i.e. 0 or 1) value of **v**
|
||||
|
||||
_heading: Flat-Format Signature @<signature-flat>
|
||||
|
||||
A **Flat-Format Signature** is a common Signature format where
|
||||
the r, s and v are concanenated into a 65 byte (130 nibble)
|
||||
[[datahexstring]].
|
||||
|
||||
|
||||
_heading: SignatureLike @<signaturelike>
|
||||
|
||||
A **SignatureLike** is similar to a [[signature]], except redundant properties
|
||||
may be omitted.
|
||||
may be omitted or it may be a [[signature-flat]].
|
||||
|
||||
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> @SRC<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> @SRC<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> @SRC<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> @SRC<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<[[datahexstring]]> @<utils-hexlify> @SRC<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<[[hexstring]]> @<utils-hexvalue> @SRC<bytes>
|
||||
Converts //aBigNumberish// to a [[hexstring]], with no __unnecessary__ leading
|
||||
zeros.
|
||||
|
||||
_heading: Examples
|
||||
|
||||
@@ -74,48 +86,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> @SRC<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> @SRC<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> @SRC<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) => string<[[datahexstring]]> @<utils-hexconcat> @SRC<bytes>
|
||||
Concatenates all the [[byteslike]] in //arrayOfBytesLike// into a single [[datahexstring]]
|
||||
|
||||
_property: utils.hexDataLength(aBytesLike) => number
|
||||
_property: utils.hexDataLength(aBytesLike) => string<[[datahexstring]]> @<utils-hexdatalength> @SRC<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 ] ) => string<[[datahexstring]]> @<utils-hexdataslice> @SRC<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) => string<[[hexstring]]> @<utils-hexstripzeros> @SRC<bytes>
|
||||
Returns a [[hexstring]] representation of //aBytesLike// with all
|
||||
leading zeros removed.
|
||||
|
||||
_property: utils.hexStripZeros(aBytesLike) => string
|
||||
@TODO
|
||||
_property: utils.hexZeroPad(aBytesLike, length) => string<[[datahexstring]]> @<utils-hexzeropad> @SRC<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) => string<[FlatSignature](signature-flat)> @<utils-joinsignature> @SRC<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> @SRC<bytes>
|
||||
Return the full expanded-format of //aSignaturelike// or a flat-format [[datahexstring]].
|
||||
Any missing properties will be computed.
|
||||
|
||||
|
||||
@@ -11,38 +11,38 @@ _code: constants-import.js
|
||||
|
||||
_subsection: Bytes
|
||||
|
||||
_property: constants.AddressZero
|
||||
_property: constants.AddressZero => string<[Address](address)> @<constants-addresszero> @SRC<constants>
|
||||
The Address Zero, which is 20 bytes (40 nibbles) of zero.
|
||||
|
||||
_property: constants.HashZero
|
||||
_property: constants.HashZero => string<[[datahexstring]]<32>> @<constants-hashzero> @SRC<constants>
|
||||
The Hash Zero, which is 32 bytes (64 nibbles) of zero.
|
||||
|
||||
|
||||
_subsection: Strings
|
||||
|
||||
_property: constants.EtherSymbol
|
||||
_property: constants.EtherSymbol => string @<constants-ethersymbol> @SRC<constants>
|
||||
The Ether symbol, **Ξ**.
|
||||
|
||||
|
||||
_subsection: BigNumber
|
||||
|
||||
_property: constants.NegativeOne
|
||||
_property: constants.NegativeOne => [[bignumber]] @<constants-negativeone> @SRC<constants>
|
||||
The BigNumber value representing ``"-1"``.
|
||||
|
||||
_property: constants.Zero
|
||||
_property: constants.Zero => [[bignumber]] @<constants-zero> @SRC<constants>
|
||||
The BigNumber value representing ``"0"``.
|
||||
|
||||
_property: constants.One
|
||||
_property: constants.One => [[bignumber]] @<constants-one> @SRC<constants>
|
||||
The BigNumber value representing ``"1"``.
|
||||
|
||||
_property: constants.Two
|
||||
_property: constants.Two => [[bignumber]] @<constants-two> @SRC<constants>
|
||||
The BigNumber value representing ``"2"``.
|
||||
|
||||
_property: constants.WeiPerEther
|
||||
_property: constants.WeiPerEther => [[bignumber]] @<constants-weiperether> @SRC<constants>
|
||||
The BigNumber value representing ``"1000000000000000000"``, which is the
|
||||
number of Wei per Ether.
|
||||
|
||||
_property: constants.MaxUint256
|
||||
_property: constants.MaxUint256 => [[bignumber]] @<constants-maxuint256> @SRC<constants>
|
||||
The BigNumber value representing the maximum ``uint256`` value.
|
||||
|
||||
|
||||
|
||||
@@ -46,23 +46,23 @@ _subsection: Functions
|
||||
|
||||
_heading: Formatting
|
||||
|
||||
_property: utils.commify(value) => string
|
||||
_property: utils.commify(value) => string @<util-commify> @SRC<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> @SRC<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> @SRC<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> @SRC<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> @SRC<units>
|
||||
The equivalent to calling ``parseUnits(value, "ether")``.
|
||||
|
||||
21
docs.wrm/api/utils/encoding.wrm
Normal file
21
docs.wrm/api/utils/encoding.wrm
Normal file
@@ -0,0 +1,21 @@
|
||||
_title: Encoding Utilies
|
||||
|
||||
_section: Encoding Utilities
|
||||
|
||||
_property: utils.base58.decode(textData) => Uin8Array
|
||||
|
||||
Return a typed Uint8Array representation of //textData// decoded using
|
||||
base-58 encoding.
|
||||
|
||||
_property: utils.base58.encode(aBytesLike) => string
|
||||
|
||||
Return //aBytesLike// encoded as a string using the base-58 encoding.
|
||||
|
||||
_property: utils.base64.decode(textData) => Uin8Array
|
||||
|
||||
Return a typed Uint8Array representation of //textData// decoded using
|
||||
base-64 encoding.
|
||||
|
||||
_property: utils.base64.encode(aBytesLike) => string
|
||||
|
||||
Return //aBytesLike// encoded as a string using the base-64 encoding.
|
||||
@@ -2,12 +2,51 @@ _title: Fixed Number
|
||||
|
||||
_section: FixedNumber @<fixednumber>
|
||||
|
||||
_subsection: FixedFormat @<fixedformat>
|
||||
|
||||
_subsection: Types
|
||||
A **FixedFormat** is a simple object which represents a decimal
|
||||
(base-10) Fixed-Point data representation. Usually using this
|
||||
class directly is uneccessary, as passing in a [[fixedformatstring]]
|
||||
directly into the [[fixednumber]] will automatically create this.
|
||||
|
||||
_heading: Format Strings @<fixedformatstring>
|
||||
|
||||
A format string is composed of three components, including signed-ness,
|
||||
bit-width and number of decimals.
|
||||
|
||||
A signed format string begins with ``fixed``, which an unsigned format
|
||||
string begins with ``ufixed``, followed by the width (in bits) and the
|
||||
number of decimals.
|
||||
|
||||
The width must be conguent to 0 mod 8 (i.e. ``(width % 8) == 0``) and no
|
||||
larger than 256 bits and the number of decimals must be no larger than 80.
|
||||
|
||||
For example:
|
||||
|
||||
- **fixed128x18** is signed, 128 bits wide and has 18 decimals; this is useful for most purposes
|
||||
- **fixed32x0** is signed, 32 bits wide and has 0 decimals; this would be the same as a ``int32_t` in C
|
||||
- **ufixed32x0** is unsigned, 32 bits wide and has 0 decimals; this would be the same as a ``uint32_t` in C
|
||||
- **fixed** is shorthand for ``fixed128x18`
|
||||
- **ufixed** is shorthand for ``ufixed128x18`
|
||||
|
||||
_heading: Creating Instances
|
||||
|
||||
_property: FixedFormat.from(value = "fixed128x18") => [[fixedformat]] @<fixednumber-from> @SRC<bignumber/fixednumber:FixedFormat.from>
|
||||
|
||||
Returns a new instance of a **FixedFormat** defined by //value//. Any valid [[fixedformatstring]]
|
||||
may be passed in as well as any object which has any of ``signed``, ``width`` and ``decimals``
|
||||
defined, including a [[fixedformat]] object.
|
||||
|
||||
_heading: Properties
|
||||
|
||||
_property: fixedFormat.signed => boolean
|
||||
|
||||
_property: fixedFormat.width => number
|
||||
|
||||
_property: fixedFormat.decimals => number
|
||||
|
||||
_property: fixedFormat.name => string
|
||||
|
||||
_heading: FixedFormat @<fixedformat>
|
||||
TODO
|
||||
|
||||
_definition: **//"fixed"//**
|
||||
A shorthand for ``fixed128x80``.
|
||||
@@ -17,17 +56,17 @@ _subsection: Creating Instances
|
||||
The FixedNumber constructor cannot be called directly. There are several
|
||||
static methods for creating a FixedNumber.
|
||||
|
||||
_property: BigNumber.from(value [ , format = "fixed" ] ) => [[fixednumber]]
|
||||
_property: FixedNumber.from(value [ , format = "fixed" ] ) => [[fixednumber]] @SRC<bignumber:FixedNumber.from>
|
||||
Returns an instance of a **FixedNumber** for //value// as a //format//.
|
||||
|
||||
_property: BigNumber.fromBytes(aBytesLike [ , format = "fixed" ] ) => [[fixednumber]]
|
||||
_property: FixedNumber.fromBytes(aBytesLike [ , format = "fixed" ] ) => [[fixednumber]] @SRC<bignumber>
|
||||
Returns an instance of a **FixedNumber** for //value// as a //format//.
|
||||
|
||||
_property: BigNumber.fromString(value [ , format = "fixed" ] ) => [[fixednumber]]
|
||||
_property: FixedNumber.fromString(value [ , format = "fixed" ] ) => [[fixednumber]] @SRC<bignumber:FixedNumber.fromString>
|
||||
Returns an instance of a **FixedNumber** for //value// as a //format//. The //value// must
|
||||
not contain more decimals than the //format// permits.
|
||||
|
||||
_property: BigNumber.fromValue(value [ , decimals = 0 [ , format = "fixed" ] ] ) => [[fixednumber]]
|
||||
_property: FixedNumber.fromValue(value [ , decimals = 0 [ , format = "fixed" ] ] ) => [[fixednumber]] @SRC<bignumber:FixedNumber.fromValue>
|
||||
Returns an instance of a **FixedNumber** for //value// with //decimals// as a //format//.
|
||||
|
||||
|
||||
@@ -41,40 +80,40 @@ _subsection: Methods
|
||||
|
||||
_heading: Math Operations
|
||||
|
||||
_property: fixednumber.addUnsafe(otherValue) => [[fixednumber]]
|
||||
_property: fixednumber.addUnsafe(otherValue) => [[fixednumber]] @SRC<bignumber/fixednumber>
|
||||
Returns a new FixedNumber with the value of //fixedvalue// **+** //otherValue//.
|
||||
|
||||
_property: fixednumber.subUnsafe(otherValue) => [[fixednumber]]
|
||||
_property: fixednumber.subUnsafe(otherValue) => [[fixednumber]] @SRC<bignumber/fixednumber>
|
||||
Returns a new FixedNumber with the value of //fixedvalue// **–** //otherValue//.
|
||||
|
||||
_property: fixednumber.mulUnsafe(otherValue) => [[fixednumber]]
|
||||
_property: fixednumber.mulUnsafe(otherValue) => [[fixednumber]] @SRC<bignumber/fixednumber>
|
||||
Returns a new FixedNumber with the value of //fixedvalue// **×** //otherValue//.
|
||||
|
||||
_property: fixednumber.divUnsafe(otherValue) => [[fixednumber]]
|
||||
_property: fixednumber.divUnsafe(otherValue) => [[fixednumber]] @SRC<bignumber/fixednumber>
|
||||
Returns a new FixedNumber with the value of //fixedvalue// **÷** //otherValue//.
|
||||
|
||||
_property: fixednumber.round([ decimals = 0 ]) => [[fixednumber]]
|
||||
_property: fixednumber.round([ decimals = 0 ]) => [[fixednumber]] @SRC<bignumber/fixednumber>
|
||||
Returns a new FixedNumber with the value of //fixedvalue// rounded to //decimals//.
|
||||
|
||||
|
||||
_heading: Conversion
|
||||
|
||||
_property: fixednumber.toFormat(format) => [[fixednumber]]
|
||||
_property: fixednumber.toFormat(format) => [[fixednumber]] @SRC<bignumber/fixednumber>
|
||||
Returns a new FixedNumber with the value of //fixedvalue// with //format//.
|
||||
|
||||
_property: fixednumber.toHexString() => string
|
||||
_property: fixednumber.toHexString() => string @SRC<bignumber/fixednumber>
|
||||
Returns a [Hexstring](hexstring) representation of //fixednumber//.
|
||||
|
||||
_property: fixednumber.toString() => string
|
||||
_property: fixednumber.toString() => string @SRC<bignumber/fixednumber>
|
||||
Returns a string representation of //fixednumber//.
|
||||
|
||||
_property: fixednumber.toUnsafeFloat() => float
|
||||
_property: fixednumber.toUnsafeFloat() => float @SRC<bignumber/fixednumber>
|
||||
Returns a floating-point JavaScript number value of //fixednumber//.
|
||||
Due to rounding in JavaScript numbers, the value is only approximate.
|
||||
|
||||
|
||||
_heading: Inspection
|
||||
|
||||
_property: BigNumber.isFixedNumber(value) => boolean
|
||||
_property: FixedNumber.isFixedNumber(value) => boolean @SRC<bignumber/fixednumber>
|
||||
Returns true if and only if //value// is a **FixedNumber**.
|
||||
|
||||
|
||||
@@ -7,47 +7,47 @@ Explain what hash functions are?
|
||||
|
||||
_subsection: Cryptographic Hashing
|
||||
|
||||
The [Cryptographic Hash Functions](https://en.wikipedia.org/wiki/Cryptographic_hash_function)
|
||||
The [Cryptographic Hash Functions](link-wiki-cryptographichash)
|
||||
are a specific family of hash functions.
|
||||
|
||||
_property: utils.keccak256(aBytesLike) => string
|
||||
Returns the [KECCAK256](https://en.wikipedia.org/wiki/SHA-3) digest //aBytesLike//.
|
||||
_property: ethers.utils.keccak256(aBytesLike) => string<[[datahexstring]]<32>> @<utils-keccak256> @SRC<keccak256>
|
||||
Returns the [KECCAK256](link-wiki-sha3) digest //aBytesLike//.
|
||||
|
||||
_property: utils.ripemd160(aBytesLike) => string
|
||||
Returns the [RIPEMD-160](https://en.m.wikipedia.org/wiki/RIPEMD) digest of //aBytesLike//.
|
||||
_property: ethers.utils.ripemd160(aBytesLike) => string<[[datahexstring]]<20>> @<utils-ripemd160> @SRC<sha2>
|
||||
Returns the [RIPEMD-160](link-wiki-ripemd) digest of //aBytesLike//.
|
||||
|
||||
_property: utils.sha256(aBytesLike) => string
|
||||
Returns the [SHA2-256](https://en.wikipedia.org/wiki/SHA-2) digest of //aBytesLike//.
|
||||
_property: ethers.utils.sha256(aBytesLike) => string<[[datahexstring]]<32>> @<utils-sha256> @SRC<sha2:function.sha256>
|
||||
Returns the [SHA2-256](link-wiki-sha2) digest of //aBytesLike//.
|
||||
|
||||
_property: utils.sha512(aBytesLike) => string
|
||||
Returns the [SHA2-512](https://en.wikipedia.org/wiki/SHA-2) digest of //aBytesLike//.
|
||||
_property: ethers.utils.sha512(aBytesLike) => string<[[datahexstring]]<64>> @<utils-sha512> @SRC<sha2:function.sha512>
|
||||
Returns the [SHA2-512](link-wiki-sha2) digest of //aBytesLike//.
|
||||
|
||||
_property: utils.computeHmac(algorithm, key, data) => string
|
||||
Returns the [HMAC](https://en.wikipedia.org/wiki/HMAC) of //data// with //key//
|
||||
_property: ethers.utils.computeHmac(algorithm, key, data) => string<[[datahexstring]]> @<utils-computehmac> @SRC<sha2>
|
||||
Returns the [HMAC](link-wiki-hmac) of //data// with //key//
|
||||
using the [Algorithm](supported-algorithm) //algorithm//.
|
||||
|
||||
|
||||
_heading: HMAC Supported Algorithms @<supported-algorithm>
|
||||
_heading: HMAC Supported Algorithms @<supported-algorithm> @SRC<sha2:enum.SupportedAlgorithm>
|
||||
|
||||
_property: utils.SupportedAlgorithms.sha256
|
||||
Use the [SHA2-256](https://en.wikipedia.org/wiki/SHA-2) hash algorithm.
|
||||
_property: ethers.utils.SupportedAlgorithm.sha256 => string
|
||||
Use the [SHA2-256](link-wiki-sha2) hash algorithm.
|
||||
|
||||
_property: utils.SupportedAlgorithms.sha512
|
||||
Use the [SHA2-512](https://en.wikipedia.org/wiki/SHA-2) hash algorithm.
|
||||
_property: ethers.utils.SupportedAlgorithm.sha512 => string
|
||||
Use the [SHA2-512](link-wiki-sha2) hash algorithm.
|
||||
|
||||
|
||||
_subsection: Common Hashing Helpers
|
||||
|
||||
_property: utils.hashMessage(message) => string
|
||||
_property: ethers.utils.hashMessage(message) => string<[[datahexstring]]<32>> @<utils-hashmessage> @SRC<hash>
|
||||
Computes the Ethereum message digest of //message//. Ethereum messages are
|
||||
converted to UTF-8 bytes and prefixed with ``\x19Ethereum Signed Message:``
|
||||
converted to UTF-8 bytes and prefixed with ``\\x19Ethereum Signed Message:``
|
||||
and the length of //message//.
|
||||
|
||||
_property: utils.id(text) => string
|
||||
_property: ethers.utils.id(text) => string<[[datahexstring]]<32>> @<utils-id> @SRC<hash>
|
||||
The Ethereum Identity function computs the keccak256 hash of the //text// bytes.
|
||||
|
||||
_property: utils.namehash(name) => string
|
||||
Returns the [ENS Namehash](https://docs.ens.domains/contract-api-reference/name-processing#hashing-names) of //name//.
|
||||
_property: ethers.utils.namehash(name) => string<[[datahexstring]]<32>> @<utils-namehash> @SRC<hash>
|
||||
Returns the [ENS Namehash](link-namehash) of //name//.
|
||||
|
||||
|
||||
_subsection: Solidity Hashing Algorithms
|
||||
@@ -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: ethers.utils.solidityPack(arrayOfTypes, arrayOfValues) => string<[[datahexstring]]> @<utils-soliditypack> @SRC<solidity:pack>
|
||||
Returns the non-standard encoded //arrayOfValues// packed according to
|
||||
their respecive type in //arrayOfTypes//.
|
||||
|
||||
_property: utils.solidityKeccak256(arrayOfTypes, arrayOfValues) => string
|
||||
_property: ethers.utils.solidityKeccak256(arrayOfTypes, arrayOfValues) => string<[[datahexstring]]<32>> @<utils-soliditykeccak256> @SRC<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: ethers.utils.soliditySha256(arrayOfTypes, arrayOfValues) => string<[[datahexstring]]<32>> @<utils-soliditysha256> @SRC<solidity:sha256>
|
||||
Returns the SHA2-256 of the non-standard encoded //arrayOfValues// packed
|
||||
according to their respective type in //arrayOfTypes//.
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ are also quite useful for application developers.
|
||||
|
||||
_toc:
|
||||
address
|
||||
abi
|
||||
bignumber
|
||||
bytes
|
||||
constants
|
||||
@@ -14,3 +15,4 @@ _toc:
|
||||
fixednumber
|
||||
hashing
|
||||
strings
|
||||
transactions
|
||||
|
||||
7
docs.wrm/api/utils/properties.wrm
Normal file
7
docs.wrm/api/utils/properties.wrm
Normal file
@@ -0,0 +1,7 @@
|
||||
_title: Property Utilities
|
||||
|
||||
_section: Property Utilities
|
||||
|
||||
_property: utils.resolveProperties(anObject) => Promise<any> @<utils-resolveproperties> @SRC<properties>
|
||||
|
||||
|
||||
12
docs.wrm/api/utils/signing-key.wrm
Normal file
12
docs.wrm/api/utils/signing-key.wrm
Normal file
@@ -0,0 +1,12 @@
|
||||
_title: Signing Keys
|
||||
|
||||
_section: Signing Key
|
||||
|
||||
|
||||
_property: ethers.utils.verifyMessage(message, signature) => string<[[address]]> @<utils-verifymessage> @SRC<wallet>
|
||||
Returns the address that signed //message// producing //signature//. The
|
||||
signature may have a non-canonical v (i.e. does not need to be 27 or 28),
|
||||
in which case it will be normalized to compute the `recoveryParam` which
|
||||
will then be used to compute the address; this allows systems which use
|
||||
the v to encode additional data (such as [EIP-155](link-eip-155))
|
||||
to be used since the v parameter is still completely non-ambiguous.
|
||||
@@ -17,55 +17,57 @@ 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: ethers.utils.parseBytes32String(aBytesLike) => string @<utils-parsebytes32> @SRC<strings>
|
||||
Returns the decoded string represented by the ``Bytes32`` encoded data.
|
||||
|
||||
_property: utils.formatBytes32String(text) => string
|
||||
_property: ethers.utils.formatBytes32String(text) => string<[[datahexstring]]<32>> @<utils-formatbytes32> @SRC<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: ethers.utils.toUtf8Bytes(text [ , form = current ] ) => Uint8Array @<utils-toutf8bytes> @SRC<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>
|
||||
Returns the Array of codepoints of //aBytesLike//, optionally normalizing it using the
|
||||
_property: ethers.utils.toUtf8CodePoints(text [ , form = current ] ) => Array<number> @<utils-toutf8codepoints> @SRC<strings>
|
||||
Returns the Array of codepoints of //text//, optionally normalized using the
|
||||
[[unicode-normalization-form]] //form//.
|
||||
|
||||
**Note:** This function correctly splits each user-perceived character into
|
||||
_note: Note
|
||||
This function correctly splits each **user-perceived character** into
|
||||
its codepoint, accounting for surrogate pairs. This should not be confused with
|
||||
``string.split("")``, which destroys surrogate pairs, spliting between each UTF-16
|
||||
codeunit instead.
|
||||
|
||||
_property: utils.toUtf8String(aBytesLike [ , ignoreErrors = false ] ) => string
|
||||
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.
|
||||
_property: ethers.utils.toUtf8String(aBytesLike [ , onError = error ] ) => string @<utils-toutf8string> @SRC<strings>
|
||||
Returns the string represented by the UTF-8 bytes of //aBytesLike//.
|
||||
|
||||
The //onError// is a [Custom UTF-8 Error function](utf8error) and if not specified
|
||||
it defaults to the [error](utf8error-error) function, which throws an error
|
||||
on **any** UTF-8 error.
|
||||
|
||||
_heading: UnicodeNormalizationForm @<unicode-normalization-form>
|
||||
_subsection: UnicodeNormalizationForm @<unicode-normalization-form> @SRC<strings/utf8:enum.UnicodeNormalizationForm>
|
||||
|
||||
There are several [commonly used forms](https://en.wikipedia.org/wiki/Unicode_equivalence)
|
||||
There are several [commonly used forms](link-wiki-unicode-equivalence)
|
||||
when normalizing UTF-8 data, which allow strings to be compared or hashed in a stable
|
||||
way.
|
||||
|
||||
_property: utils.UnicodeNormalizationForm.current
|
||||
_property: ethers.utils.UnicodeNormalizationForm.current
|
||||
Maintain the current normalization form.
|
||||
|
||||
_property: utils.UnicodeNormalizationForm.NFC
|
||||
_property: ethers.utils.UnicodeNormalizationForm.NFC
|
||||
The Composed Normalization Form. This form uses single codepoints
|
||||
which represent the fully composed character.
|
||||
|
||||
For example, the **é** is a single codepoint, ``0x00e9``.
|
||||
|
||||
_property: utils.UnicodeNormalizationForm.NFD
|
||||
_property: ethers.utils.UnicodeNormalizationForm.NFD
|
||||
The Decomposed Normalization Form. This form uses multiple codepoints
|
||||
(when necessary) to compose a character.
|
||||
|
||||
@@ -74,7 +76,7 @@ is made up of two codepoints, ``"0x0065"`` (which is the letter ``"e"``)
|
||||
and ``"0x0301"`` which is a special diacritic UTF-8 codepoint which
|
||||
indicates the previous character should have an acute accent.
|
||||
|
||||
_property: utils.UnicodeNormalizationForm.NFKC
|
||||
_property: ethers.utils.UnicodeNormalizationForm.NFKC
|
||||
The Composed Normalization Form with Canonical Equivalence. The Canonical
|
||||
representation folds characters which have the same syntactic representation
|
||||
but different semantic meaning.
|
||||
@@ -82,11 +84,101 @@ but different semantic meaning.
|
||||
For example, the Roman Numeral **I**, which has a UTF-8
|
||||
codepoint ``"0x2160"``, is folded into the capital letter I, ``"0x0049"``.
|
||||
|
||||
_property: utils.UnicodeNormalizationForm.NFKD
|
||||
_property: ethers.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
|
||||
[homoglyph attacks](https://en.wikipedia.org/wiki/IDN_homograph_attack).
|
||||
it should **not** be considered a method to acheive //any// level of security from
|
||||
[homoglyph attacks](link-wiki-homoglyph).
|
||||
|
||||
_subsection: Custom UTF-8 Error Handling @<utf8error>
|
||||
|
||||
When converting a string to its codepoints, there is the possibility
|
||||
of invalid byte sequences. Since certain situations may need specific
|
||||
ways to handle UTF-8 errors, a custom error handling function can be used,
|
||||
which has the signature:
|
||||
|
||||
_property: errorFunction(reason, offset, bytes, output [ , badCodepoint ]) => number
|
||||
The //reason// is one of the [UTF-8 Error Reasons](utf8error-reasons), //offset// is the index
|
||||
into //bytes// where the error was first encountered, output is the list
|
||||
of codepoints already processed (and may be modified) and in certain Error
|
||||
Reasons, the //badCodepoint// indicates the currently computed codepoint,
|
||||
but which would be rejected because its value is invalid.
|
||||
|
||||
This function should return the number of bytes to skip past keeping in
|
||||
mind the value at //offset// will already be consumed.
|
||||
|
||||
_heading: UTF-8 Error Reasons @<utf8error-reasons> @SRC<strings/utf8:Utf8ErrorReason>
|
||||
|
||||
_property: ethers.utils.Utf8ErrorReason.BAD_PREFIX
|
||||
A byte was encountered which is invalid to begin a UTF-8 byte
|
||||
sequence with.
|
||||
|
||||
_property: ethers.utils.Utf8ErrorReason.MISSING_CONTINUE
|
||||
A UTF-8 sequence was begun, but did not have enough continuation
|
||||
bytes for the sequence. For this error the //ofset// is the index
|
||||
at which a continuation byte was expected.
|
||||
|
||||
_property: ethers.utils.Utf8ErrorReason.OUT_OF_RANGE
|
||||
The computed codepoint is outside the range for valid UTF-8
|
||||
codepoints (i.e. the codepoint is greater than 0x10ffff).
|
||||
This reason will pass the computed //badCountpoint// into
|
||||
the custom error function.
|
||||
|
||||
_property: ethers.utils.Utf8ErrorReason.OVERLONG
|
||||
Due to the way UTF-8 allows variable length byte sequences
|
||||
to be used, it is possible to have multiple representations
|
||||
of the same character, which means
|
||||
[overlong sequences](link-wiki-utf8-overlong)
|
||||
allow for a non-distinguished string to be formed, which can
|
||||
impact security as multiple strings that are otherwise
|
||||
equal can have different hashes.
|
||||
|
||||
Generally, overlong sequences are an attempt to circumvent
|
||||
some part of security, but in rare cases may be produced by
|
||||
lazy libraries or used to encode the null terminating
|
||||
character in a way that is safe to include in a ``char*``.
|
||||
|
||||
This reason will pass the computed //badCountpoint// into the
|
||||
custom error function, which is actually a valid codepoint, just
|
||||
one that was arrived at through unsafe methods.
|
||||
|
||||
_property: ethers.utils.Utf8ErrorReason.OVERRUN
|
||||
The string does not have enough characters remaining for the
|
||||
length of this sequence.
|
||||
|
||||
_property: ethers.utils.Utf8ErrorReason.UNEXPECTED_CONTINUE
|
||||
This error is similar to BAD_PREFIX, since a continuation byte
|
||||
cannot begin a valid sequence, but many may wish to process this
|
||||
differently. However, most developers would want to trap this
|
||||
and perform the same operation as a BAD_PREFIX.
|
||||
|
||||
_property: ethers.utils.Utf8ErrorReason.UTF16_SURROGATE
|
||||
The computed codepoint represents a value reserved for
|
||||
UTF-16 surrogate pairs.
|
||||
This reason will pass the computed surrogate half
|
||||
//badCountpoint// into the custom error function.
|
||||
|
||||
|
||||
|
||||
_heading: Provided UTF-8 Error Handling Functions
|
||||
|
||||
There are already several functions available for the most common
|
||||
situations.
|
||||
|
||||
_property: ethers.utils.Utf8ErrorFuncs.error @<utf8error-error> @SRC<strings/utf8:errorFunc>
|
||||
The will throw an error on **any** error with a UTF-8 sequence, including
|
||||
invalid prefix bytes, overlong sequences, UTF-16 surrogate pairs.
|
||||
|
||||
_property: ethers.utils.Utf8ErrorFuncs.ignore @<utf8error-ignore> @SRC<strings/utf8:ignoreFunc>
|
||||
This will drop all invalid sequences (by consuming invalid prefix bytes and
|
||||
any following continuation bytes) from the final string as well as permit
|
||||
overlong sequences to be converted to their equivalent string.
|
||||
|
||||
_property: ethers.utils.Utf8ErrorFuncs.replace @<utf8error-replace> @SRC<strings/utf8:replaceFunc>
|
||||
This will replace all invalid sequences (by consuming invalid prefix bytes and
|
||||
any following continuation bytes) with the
|
||||
[UTF-8 Replacement Character](link-wiki-utf8-replacement),
|
||||
(i.e. U+FFFD).
|
||||
|
||||
72
docs.wrm/api/utils/transactions.wrm
Normal file
72
docs.wrm/api/utils/transactions.wrm
Normal file
@@ -0,0 +1,72 @@
|
||||
_title: Transactions
|
||||
|
||||
_section: Transactions @<utils-transactions>
|
||||
|
||||
_subsection: Types
|
||||
|
||||
_heading: UnsignedTransaction @<types-unsignedtransaction>
|
||||
An unsigned transaction represents a transaction that has not been signed.
|
||||
|
||||
_property: unsignedTransaction.to => string<[Address](address)>
|
||||
|
||||
_property: unsignedTransaction.nonce => number
|
||||
|
||||
_property: unsignedTransaction.gasLimit => [[bignumber]]
|
||||
|
||||
_property: unsignedTransaction.gasPrice => [[bignumber]]
|
||||
|
||||
_property: unsignedTransaction.data => [[byteslike]]
|
||||
|
||||
_property: unsignedTransaction.value => [[bignumber]]
|
||||
|
||||
_property: unsignedTransaction.chainId => number
|
||||
|
||||
|
||||
_heading: Transaction @<types-transaction>
|
||||
A generic object to represent a transaction.
|
||||
|
||||
_property: unsignedTransaction.hash => string<[[datahexstring]]<32>>
|
||||
|
||||
_property: unsignedTransaction.to => string<[Address](address)>
|
||||
|
||||
_property: unsignedTransaction.from => string<[Address](address)>
|
||||
|
||||
_property: unsignedTransaction.nonce => number
|
||||
|
||||
_property: unsignedTransaction.gasLimit => [[bignumber]]
|
||||
|
||||
_property: unsignedTransaction.gasPrice => [[bignumber]]
|
||||
|
||||
_property: unsignedTransaction.data => [[byteslike]]
|
||||
|
||||
_property: unsignedTransaction.value => [[bignumber]]
|
||||
|
||||
_property: unsignedTransaction.chainId => number
|
||||
|
||||
_property: unsignedTransaction.r => [[byteslike]]
|
||||
|
||||
_property: unsignedTransaction.s => [[byteslike]]
|
||||
|
||||
_property: unsignedTransaction.v => number
|
||||
|
||||
|
||||
_subsection: Functions
|
||||
|
||||
_property: ethers.utils.computeAddress(publicOrPrivateKey) => string<[Address](address)> @<utils-computeaddress> @SRC<transactions>
|
||||
Compute the address of //publicOrPrivateKey//. If a public key is
|
||||
provided, it may be either compressed or uncompressed.
|
||||
|
||||
_property: ethers.utils.parse(aBytesLike) => [[types-transaction]] @<utils-parse> @SRC<transactions>
|
||||
Parses the transaction properties from a serialized transactions.
|
||||
|
||||
_property: ethers.utils.recoverAddress(digest, aSignatureLike) => string<[Address](address)> @<utils-recoveraddress> @SRC<transactions>
|
||||
Computes the address that signed //digest// to get //aSignatureLike// using the
|
||||
ecrecover algorithm.
|
||||
|
||||
_property: ethers.utils.serialize(transaction [ , signature ]) => string<[[datahexstring]]> @<utils-serialize> @SRC<transactions>
|
||||
Computes the serialized //transaction/, optionally signed with //signature//. If
|
||||
signature is not presented, the unsigned serialized transaction is returned, which can
|
||||
be used to compute the hash necessary to sign.
|
||||
|
||||
This function uses EIP-155 if a chainId is provided, otherwise legacy serialization is
|
||||
used. It is **highly** recommended to always specify a //chainId//.
|
||||
11
docs.wrm/cli/asm-help.txt
Normal file
11
docs.wrm/cli/asm-help.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
Usage:
|
||||
ethers-asm [ FILENAME ] [ OPTIONS ]
|
||||
|
||||
OPTIONS
|
||||
--disassemble Disassemble input bytecode
|
||||
--define KEY=VALUE provide assembler defines
|
||||
|
||||
OTHER OPTIONS
|
||||
--debug Show stack traces for errors
|
||||
--help Show this usage and exit
|
||||
--version Show this version and exit
|
||||
17
docs.wrm/cli/asm.wrm
Normal file
17
docs.wrm/cli/asm.wrm
Normal file
@@ -0,0 +1,17 @@
|
||||
_title: Assembler
|
||||
|
||||
_section: Assembler
|
||||
|
||||
The assembler Command-Line utility allows you to assemble EVM asm files
|
||||
into deployable bytecode and disassemle EVM bytecode into human-readable
|
||||
mnemonics.
|
||||
|
||||
_subsection: Help
|
||||
|
||||
_code: asm-help.txt
|
||||
|
||||
_subsection: Examples
|
||||
|
||||
TODO examples
|
||||
|
||||
|
||||
69
docs.wrm/cli/ens-help.txt
Normal file
69
docs.wrm/cli/ens-help.txt
Normal file
@@ -0,0 +1,69 @@
|
||||
Usage:
|
||||
ethers-ens COMMAND [ ARGS ] [ OPTIONS ]
|
||||
|
||||
COMMANDS
|
||||
lookup [ NAME | ADDRESS [ ... ] ]
|
||||
Lookup a name or address
|
||||
commit NAME Submit a pre-commitment
|
||||
[ --duration DAYS ] Register duration (default: 365 days)
|
||||
[ --salt SALT ] SALT to blind the commit with
|
||||
[ --secret SECRET ] Use id(SECRET) as the salt
|
||||
[ --owner OWNER ] The target owner (default: current account)
|
||||
reveal NAME Reveal a previous pre-commitment
|
||||
[ --duration DAYS ] Register duration (default: 365 days)
|
||||
[ --salt SALT ] SALT to blind the commit with
|
||||
[ --secret SECRET ] Use id(SECRET) as the salt
|
||||
[ --owner OWNER ] The target owner (default: current account)
|
||||
set-controller NAME Set the controller (default: current account)
|
||||
[ --address ADDRESS ] Specify another address
|
||||
set-subnode NAME Set a subnode owner (default: current account)
|
||||
[ --address ADDRESS ] Specify another address
|
||||
set-resolver NAME Set the resolver (default: resolver.eth)
|
||||
[ --address ADDRESS ] Specify another address
|
||||
set-addr NAME Set the addr record (default: current account)
|
||||
[ --address ADDRESS ] Specify another address
|
||||
set-text NAME KEY VALUE Set a text record
|
||||
set-email NAME EMAIL Set the email text record
|
||||
set-website NAME URL Set the website text record
|
||||
set-content NAME HASH Set the IPFS Content Hash
|
||||
migrate-registrar NAME Migrate from the Legacy to the Permanent Registrar
|
||||
transfer NAME NEW_OWNER Transfer registrant ownership
|
||||
reclaim NAME Reset the controller by the registrant
|
||||
[ --address ADDRESS ] Specify another address
|
||||
|
||||
ACCOUNT OPTIONS
|
||||
--account FILENAME Load from a file (JSON, RAW or mnemonic)
|
||||
--account RAW_KEY Use a private key (insecure *)
|
||||
--account 'MNEMONIC' Use a mnemonic (insecure *)
|
||||
--account - Use secure entry for a raw key or mnemonic
|
||||
--account-void ADDRESS Use an address as a void signer
|
||||
--account-void ENS_NAME Add the resolved address as a void signer
|
||||
--account-rpc ADDRESS Add the address from a JSON-RPC provider
|
||||
--account-rpc INDEX Add the index from a JSON-RPC provider
|
||||
--mnemonic-password Prompt for a password for mnemonics
|
||||
--xxx-mnemonic-password Prompt for a (experimental) hard password
|
||||
|
||||
PROVIDER OPTIONS (default: all + homestead)
|
||||
--alchemy Include Alchemy
|
||||
--etherscan Include Etherscan
|
||||
--infura Include INFURA
|
||||
--nodesmith Include nodesmith
|
||||
--rpc URL Include a custom JSON-RPC
|
||||
--offline Dump signed transactions (no send)
|
||||
--network NETWORK Network to connect to (default: homestead)
|
||||
|
||||
TRANSACTION OPTIONS (default: query network)
|
||||
--gasPrice GWEI Default gas price for transactions(in wei)
|
||||
--gasLimit GAS Default gas limit for transactions
|
||||
--nonce NONCE Initial nonce for the first transaction
|
||||
--yes Always accept Siging and Sending
|
||||
|
||||
OTHER OPTIONS
|
||||
--wait Wait until transactions are mined
|
||||
--debug Show stack traces for errors
|
||||
--help Show this usage and exit
|
||||
--version Show this version and exit
|
||||
|
||||
(*) By including mnemonics or private keys on the command line they are
|
||||
possibly readable by other users on your system and may get stored in
|
||||
your bash history file. This is NOT recommended.
|
||||
13
docs.wrm/cli/ens.wrm
Normal file
13
docs.wrm/cli/ens.wrm
Normal file
@@ -0,0 +1,13 @@
|
||||
_title: ENS
|
||||
|
||||
_section: ENS
|
||||
|
||||
_subsection: Help
|
||||
|
||||
_code: ens-help.txt
|
||||
|
||||
_subsection: Examples
|
||||
|
||||
TODO examples
|
||||
|
||||
|
||||
65
docs.wrm/cli/ethers-help.txt
Normal file
65
docs.wrm/cli/ethers-help.txt
Normal file
@@ -0,0 +1,65 @@
|
||||
Usage:
|
||||
ethers [ COMMAND ] [ ARGS ] [ OPTIONS ]
|
||||
|
||||
COMMANDS (default: sandbox)
|
||||
sandbox Run a REPL VM environment with ethers
|
||||
init FILENAME Create a new JSON wallet
|
||||
[ --force ] Overwrite any existing files
|
||||
fund TARGET Fund TARGET with testnet ether
|
||||
info [ TARGET ... ] Dump info for accounts, addresses and ENS names
|
||||
send TARGET ETHER Send ETHER ether to TARGET form accounts[0]
|
||||
[ --allow-zero ] Allow sending to the address zero
|
||||
[ --data DATA ] Include data in the transaction
|
||||
sweep TARGET Send all ether from accounts[0] to TARGET
|
||||
sign-message MESSAGE Sign a MESSAGE with accounts[0]
|
||||
[ --hex ] The message content is hex encoded
|
||||
eval CODE Run CODE in a VM with ethers
|
||||
run FILENAME Run FILENAME in a VM with ethers
|
||||
wait HASH Wait for a transaction HASH to be mined
|
||||
wrap-ether VALUE Deposit VALUE into Wrapped Ether (WETH)
|
||||
unwrap-ether VALUE Withdraw VALUE from Wrapped Ether (WETH)
|
||||
send-token TOKEN ADDRESS VALUE
|
||||
Send VALUE tokens (at TOKEN) to ADDRESS
|
||||
compile FILENAME Compiles a Solidity contract
|
||||
[ --no-optimize ] Do not optimize the compiled output
|
||||
[ --warnings ] Error on any warning
|
||||
deploy FILENAME Compile and deploy a Solidity contract
|
||||
[ --no-optimize ] Do not optimize the compiled output
|
||||
[ --contract NAME ] Specify the contract to deploy
|
||||
|
||||
ACCOUNT OPTIONS
|
||||
--account FILENAME Load from a file (JSON, RAW or mnemonic)
|
||||
--account RAW_KEY Use a private key (insecure *)
|
||||
--account 'MNEMONIC' Use a mnemonic (insecure *)
|
||||
--account - Use secure entry for a raw key or mnemonic
|
||||
--account-void ADDRESS Use an address as a void signer
|
||||
--account-void ENS_NAME Add the resolved address as a void signer
|
||||
--account-rpc ADDRESS Add the address from a JSON-RPC provider
|
||||
--account-rpc INDEX Add the index from a JSON-RPC provider
|
||||
--mnemonic-password Prompt for a password for mnemonics
|
||||
--xxx-mnemonic-password Prompt for a (experimental) hard password
|
||||
|
||||
PROVIDER OPTIONS (default: all + homestead)
|
||||
--alchemy Include Alchemy
|
||||
--etherscan Include Etherscan
|
||||
--infura Include INFURA
|
||||
--nodesmith Include nodesmith
|
||||
--rpc URL Include a custom JSON-RPC
|
||||
--offline Dump signed transactions (no send)
|
||||
--network NETWORK Network to connect to (default: homestead)
|
||||
|
||||
TRANSACTION OPTIONS (default: query network)
|
||||
--gasPrice GWEI Default gas price for transactions(in wei)
|
||||
--gasLimit GAS Default gas limit for transactions
|
||||
--nonce NONCE Initial nonce for the first transaction
|
||||
--yes Always accept Siging and Sending
|
||||
|
||||
OTHER OPTIONS
|
||||
--wait Wait until transactions are mined
|
||||
--debug Show stack traces for errors
|
||||
--help Show this usage and exit
|
||||
--version Show this version and exit
|
||||
|
||||
(*) By including mnemonics or private keys on the command line they are
|
||||
possibly readable by other users on your system and may get stored in
|
||||
your bash history file. This is NOT recommended.
|
||||
14
docs.wrm/cli/ethers-init.txt
Normal file
14
docs.wrm/cli/ethers-init.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
/home/ethers> ethers init wallet.json
|
||||
Creating a new JSON Wallet - wallet.json
|
||||
Keep this password and file SAFE!! If lost or forgotten
|
||||
it CANNOT be recovered, by ANYone, EVER.
|
||||
Choose a password: ******
|
||||
Confirm password: ******
|
||||
Encrypting... 100%
|
||||
New account address: 0x485bcC23ae2E5038ec7ec9b8DCB2A6A6291cC003
|
||||
Saved: wallet.json
|
||||
|
||||
|
||||
# If you are planning to try out the Ropsten testnet...
|
||||
/home/ethers> ethers --network ropsten fund 0x485bcC23ae2E5038ec7ec9b8DCB2A6A6291cC003
|
||||
Transaction Hash: 0x8dc55b8f8dc8076acded97f9e3ed7d6162460c0221e2769806006b6d7d1156e0
|
||||
8
docs.wrm/cli/ethers-mnemonic-hard.txt
Normal file
8
docs.wrm/cli/ethers-mnemonic-hard.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
/home/ricmoo> ethers --account mnemonic.txt --xxx-mnemonic-password
|
||||
Password (mnemonic; experimental - hard): ******
|
||||
Decrypting... 100%
|
||||
network: homestead (chainId: 1)
|
||||
homestead> accounts[0].getAddress()
|
||||
<Promise id=0 resolved>
|
||||
'0x56FC8792cC17971C19bEC4Ced978beEA44711EeD'
|
||||
homestead>
|
||||
7
docs.wrm/cli/ethers-mnemonic.txt
Normal file
7
docs.wrm/cli/ethers-mnemonic.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
/home/ricmoo> ethers --account public-mnemonic.txt --mnemonic-password
|
||||
Password (mnemonic): ******
|
||||
network: homestead (chainId: 1)
|
||||
homestead> accounts[0].getAddress()
|
||||
<Promise id=0 resolved>
|
||||
'0x6d3F723EC1B73141AA4aC248c3ab34A5a1DAD776'
|
||||
homestead>
|
||||
19
docs.wrm/cli/ethers-script.txt
Normal file
19
docs.wrm/cli/ethers-script.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
# Get the formatted balance of an account
|
||||
/home/ethers> ethers --network ropsten --account wallet.json eval 'accounts[0].getBalance().then(b => formatEther(b))'
|
||||
3.141592653589793238
|
||||
|
||||
# Get the current block number
|
||||
/home/ethers> ethers --network rinkeby eval "provider.getBlockNumber()"
|
||||
5761009
|
||||
|
||||
# Convert a Solidity signature to JSON
|
||||
/home/ethers> ethers eval 'utils.Fragment.from("function balanceOf(address owner) view returns (uint)").format("json")'
|
||||
{"type":"function","name":"balanceOf","constant":true,"stateMutability":"view","payble":false,"inputs":[{"type":"address","name":"owner"}],"ouputs":[{"type":"uint256"}]}
|
||||
|
||||
# Compute a topic hash
|
||||
/home/ricmoo> ethers eval 'id("Transfer(address,address,uint256")'
|
||||
0xd99659a21de82e379975ce8df556f939a4ccb95e92144f38bb0dd35730ffcdd5
|
||||
|
||||
# Create a random mnemonic
|
||||
/home/ricmoo> ethers eval 'Wallet.createRandom().mnemonic'
|
||||
useful pond inch knock ritual matrix giggle attend dilemma convince coach amazing
|
||||
44
docs.wrm/cli/ethers-send.txt
Normal file
44
docs.wrm/cli/ethers-send.txt
Normal file
@@ -0,0 +1,44 @@
|
||||
# Sending ether
|
||||
/home/ricmoo> ethers --account wallet.json send ricmoo.firefly.eth 0.123
|
||||
Password (wallet.json): ******
|
||||
Decrypting... 100%
|
||||
Transaction:
|
||||
To: 0x8ba1f109551bD432803012645Ac136ddd64DBA72
|
||||
From: 0xaB7C8803962c0f2F5BBBe3FA8bf41cd82AA1923C
|
||||
Value: 0.123 ether
|
||||
Nonce: 96
|
||||
Data: 0x
|
||||
Gas Limit: 21000
|
||||
Gas Price: 1.2 gwei
|
||||
Chain ID: 1
|
||||
Network: homestead
|
||||
Send Transaction? (y/N/a) y
|
||||
Response:
|
||||
Hash: 0xc4adf8b379033d7ab679d199aa35e6ceee9a802ca5ab0656af067e911c4a589a
|
||||
|
||||
|
||||
# Sending a token (SAI)
|
||||
# NOTE: the contract address could be used instead but
|
||||
# popular token contract addresses are also managed
|
||||
# by ethers
|
||||
/home/ricmoo> ethers --account wallet.json send-token sai.tokens.ethers.eth ricmoo.firefly.eth 1.0
|
||||
Sending Tokens:
|
||||
To: 0x8ba1f109551bD432803012645Ac136ddd64DBA72
|
||||
Token Contract: 0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359
|
||||
Value: 1.0
|
||||
Password (wallet.json): ******
|
||||
Decrypting... 100%
|
||||
Transaction:
|
||||
To: 0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359
|
||||
From: 0xaB7C8803962c0f2F5BBBe3FA8bf41cd82AA1923C
|
||||
Value: 0.0 ether
|
||||
Nonce: 95
|
||||
Data: 0xa9059cbb0000000000000000000000008ba1f109551bd432803012645ac136ddd64dba720000000000000000000000000000000000000000000000000de0b6b3a7640000
|
||||
Gas Limit: 37538
|
||||
Gas Price: 1.0 gwei
|
||||
Chain ID: 1
|
||||
Network: homestead
|
||||
Send Transaction? (y/N/a) y
|
||||
Response:
|
||||
Hash: 0xd609ecb7e3b5e8d36fd781dffceede3975ece6774b6322ea56cf1e4d0a17e3a1
|
||||
|
||||
14
docs.wrm/cli/ethers-sign.txt
Normal file
14
docs.wrm/cli/ethers-sign.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
/home/ethers> ethers --account wallet.json sign-message 'Hello World'
|
||||
Password (wallet.json): ******
|
||||
Decrypting... 100%
|
||||
Message:
|
||||
Message: "Hello World"
|
||||
Message (hex): 0x48656c6c6f20576f726c64
|
||||
Sign Message? (y/N/a) y
|
||||
Signature
|
||||
Flat: 0xca3f0b32a22a5ab97ca8be7e4a36b1e81d565c6822465d769f4faa4aa24539fb122ee5649c8a37c9f5fc8446593674159e3a7b039997cd6ee697a24b787b1a161b
|
||||
r: 0xca3f0b32a22a5ab97ca8be7e4a36b1e81d565c6822465d769f4faa4aa24539fb
|
||||
s: 0x122ee5649c8a37c9f5fc8446593674159e3a7b039997cd6ee697a24b787b1a16
|
||||
vs: 0x122ee5649c8a37c9f5fc8446593674159e3a7b039997cd6ee697a24b787b1a16
|
||||
v: 27
|
||||
recid: 0
|
||||
59
docs.wrm/cli/ethers.wrm
Normal file
59
docs.wrm/cli/ethers.wrm
Normal file
@@ -0,0 +1,59 @@
|
||||
_title: Sandbox Utility
|
||||
|
||||
_section: Sandbox Utility
|
||||
|
||||
The sandbox utility provides a simple way to use the most common
|
||||
ethers utilities required during learning, debuging and managing
|
||||
interactions with the Ethereum network.
|
||||
|
||||
If no command is given, it will enter a REPL interface with many
|
||||
of the ethers utilities already exposed.
|
||||
|
||||
_subsection: Help
|
||||
|
||||
_code: ethers-help.txt
|
||||
|
||||
_subsection: Examples
|
||||
|
||||
_heading: Creating Wallets @<cliex-init>
|
||||
|
||||
_code: ethers-init.txt
|
||||
|
||||
_heading: Sending Ether and Tokens @<cliex-send>
|
||||
|
||||
_code: ethers-send.txt
|
||||
|
||||
_heading: Signing Messages @<cliex-signing>
|
||||
|
||||
_code: ethers-sign.txt
|
||||
|
||||
_heading: Scripting @<cliex-scripting>
|
||||
|
||||
The ``eval`` command can be used to execute simple one-line scripts from
|
||||
the command line to be passed into other commands or stored in script
|
||||
environment variables.
|
||||
|
||||
_code: ethers-script.txt
|
||||
|
||||
_heading: Using Mnemonics (with a password) @<cliex-mnemonicpassword>
|
||||
|
||||
All mnemonic phrases have a password, but the default is to use the empty
|
||||
string (i.e. ``""``) as the password. If you have a password on your
|
||||
mnemonic, the ``-\-mnemonic-password`` will prompt for the password to
|
||||
use to decrypt the account.
|
||||
|
||||
_code: ethers-mnemonic.txt
|
||||
|
||||
_heading: Using Mnemonics (with experimental memory-hard passwords) @<cliex-mnemonicpassword-xxx>
|
||||
|
||||
The ``-\-xxx-mnemonic-password`` is similar to the ``-\-mnemonic-password`` options,
|
||||
which uses a password to decrypt the account for a mnemonic, however it passes
|
||||
the password through the [scrypt](link-wiki-scrypt)
|
||||
//password-based key derivation function// first, which is intentionally slow and makes
|
||||
a brute-force attack far more difficult.
|
||||
|
||||
_code: ethers-mnemonic-hard.txt
|
||||
|
||||
_warning: Note
|
||||
This is still an experimental feature (hence the ``xxx``).
|
||||
|
||||
10
docs.wrm/cli/index.wrm
Normal file
10
docs.wrm/cli/index.wrm
Normal file
@@ -0,0 +1,10 @@
|
||||
_title: Command Line Interfaces
|
||||
|
||||
_section: Command Line Interfaces
|
||||
|
||||
_toc:
|
||||
ethers
|
||||
asm
|
||||
ens
|
||||
typescript
|
||||
plugin
|
||||
10
docs.wrm/cli/plugin.txt
Normal file
10
docs.wrm/cli/plugin.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
/home/ethers> ethers --account wallet.json --yes send ricmoo.eth 1.0
|
||||
# An Option ----------^ ^ ^
|
||||
# - name = "account" | |
|
||||
# - value = "wallet.json" | |
|
||||
# A Flag -----------------------------------+ |
|
||||
# - name = "yes" |
|
||||
# - value = true |
|
||||
# Arguments ------------------------------------+
|
||||
# - count = 3
|
||||
# - [ "send", "ricmoo.eth", "1.0" ]
|
||||
148
docs.wrm/cli/plugin.wrm
Normal file
148
docs.wrm/cli/plugin.wrm
Normal file
@@ -0,0 +1,148 @@
|
||||
_title: Making Your Own
|
||||
|
||||
_section: Making Your Own
|
||||
|
||||
The //cli// library is meant to make it easy to create command
|
||||
line utilities of your own.
|
||||
|
||||
_subsection: CLI @<cli-cli> @SRC<cli:class.CLI>
|
||||
|
||||
A **CLI** handles parsing all the command-line flags, options and arguments
|
||||
and instantiates a [[cli-plugin]] to process the command.
|
||||
|
||||
A **CLI** may support multiple [[cli-plugin]]'s in which case the first
|
||||
argument is used to determine which to run (or if no arguments, the default
|
||||
plugin will be selected) or may be designed to be standalone, in which case
|
||||
exactly one [[cli-plugin]] will be used and no command argument is allowed.
|
||||
|
||||
|
||||
_property: addPlugin(command, pluginClass) => void @<cli-addplugin> @SRC<cli/cli>
|
||||
Add a //plugin// class for the //command//. After all options and flags
|
||||
have been consumed, the first argument will be consumed and the
|
||||
associated plugin class will be instantiated and run.
|
||||
|
||||
_property: setPlugin(pluginClass) => void @<cli-setplugin> @SRC<cli/cli>
|
||||
Set a dedicated [[cli-plugin]] class which will handle all input. This
|
||||
may not be used in conjuction with addPlugin and will not automatically
|
||||
accept a command from the arguments.
|
||||
|
||||
_property: showUsage([ message = "" [ , status = 0 ] ]) => never @<cli-showusage> @SRC<cli/cli>
|
||||
Shows the usage help screen for the CLI and terminates.
|
||||
|
||||
_property: run(args) => Promise<void> @<cli-run> @SRC<cli/cli:CLI.run>
|
||||
Usually the value of //args// passed in will be ``process.argv.slice(2)``.
|
||||
|
||||
|
||||
_subsection: Plugin @<cli-plugin> @SRC<cli:class.Plugin>
|
||||
|
||||
Each **Plugin** manages each command of a CLI and is executed in phases.
|
||||
|
||||
If the usage (i.e. help) of a CLI is requested, the static methods ``getHelp``
|
||||
and ``getOptionHelp`` are used to geneate the help screen.
|
||||
|
||||
Otherwise, a plugin is instantiated and the ``prepareOptions`` is called. Each
|
||||
plugin **must** call ``super.prepareOptions``, otherwise the basic options are
|
||||
not yet processed. During this time a Plugin should consume all the flags and
|
||||
options it understands, since any left over flags or options will cause the
|
||||
CLI to bail and issue an //unknown option// error. This should throw if a value
|
||||
for a given option is invalid or some combination of options and flags is not
|
||||
allowed.
|
||||
|
||||
Once the prepareOptions is complete (the returned promise is resolved), the ``prepareArguments``
|
||||
is called. This should validate the number of arguments is expected and throw
|
||||
and error if there are too many or too few arguments or if any arguments do not
|
||||
make sense.
|
||||
|
||||
Once the prepareArguments is complete (the returned promise is resolved), the ``run``
|
||||
is called.
|
||||
|
||||
_property: plugin.network => [[provider-network]]
|
||||
The network this plugin is running for.
|
||||
|
||||
_property: plugin.provider => [[provider]]
|
||||
The provider for this plugin is running for.
|
||||
|
||||
_property: plugin.accounts => Array<[[signer]]>
|
||||
The accounts passed into the plugin using ``--account``,
|
||||
``--account-rpc`` and ``--account-void`` which this plugin can use.
|
||||
|
||||
_property: plugin.gasLimit => [[bignumber]]
|
||||
The gas limit this plugin should use. This is null if unspecified.
|
||||
|
||||
_property: plugin.gasPrice => [[bignumber]]
|
||||
The gas price this plugin should use. This is null if unspecified.
|
||||
|
||||
_property: plugin.nonce => number
|
||||
The initial nonce for the account this plugin should use.
|
||||
|
||||
|
||||
_heading: Methods
|
||||
|
||||
_property: plugin.prepareOptions(argParser [ , verifyOnly = false ]) => Promise<void> @<plugin-prepareoptions> @SRC<cli/cli:Plugin.prepareOptions>
|
||||
|
||||
_property: plugin.prepareArgs(args) => Promise<void> @<plugin-prepareargs> @SRC<cli/cli>
|
||||
|
||||
_property: plugin.run() => Promise<void> @<plugin-run> @SRC<cli/cli:Plugin.run>
|
||||
|
||||
_property: plugin.getAddress(addressOrName [ , message = "", [ allowZero = false ] ]) => Promise<string> @<plugin-getaddress> @SRC<cli/cli:Plugin.getAddress>
|
||||
A plugin should use this method to resolve an address. If the resovled address is
|
||||
the zero address and //allowZero// is not true, an error is raised.
|
||||
|
||||
_property: plugin.dump(header, info) => void @<plugin-dump> @SRC<cli/cli:Plugin.dump>
|
||||
Dumps the contents of //info// to the console with a //header// in a nicely
|
||||
formatted style. In the future, plugins may support a JSON output format
|
||||
which will automatically work with this method.
|
||||
|
||||
_property: plugin.throwUsageError([ message = "" ]) => never @<plugin-throwusageerror> @SRC<cli/cli>
|
||||
Stops exectuion of the plugin and shows the help screen of the plugin with
|
||||
the optional //message//.
|
||||
|
||||
_property: plugin.throwError(message) => never @<plugin-throwerror> @SRC<cli/cli>
|
||||
Stops execution of the plugin and shows //message//.
|
||||
|
||||
_heading: Static Methods
|
||||
|
||||
_property: Plugin.getHelp => Help @<plugin-gethelp> @SRC<cli/cli>
|
||||
Each subclass should implement this static method which is used to
|
||||
generate the help screen.
|
||||
|
||||
_property: Plugin.getOptionHelp => Array<Help> @<plugin-getoptionshelp> @SRC<cli/cli>
|
||||
Each subclass should implement this static method if it supports
|
||||
additional options which is used to generate the help screen.
|
||||
|
||||
|
||||
_subsection: ArgParser @<cli-argparser> @SRC<cli:class.ArgParser>
|
||||
|
||||
The **ArgParser** is used to parse a command line into flags, options
|
||||
and arguments.
|
||||
|
||||
_code: plugin.txt
|
||||
|
||||
Flags are simple binary options (such as the ``--yes``), which are true if present
|
||||
otherwise false.
|
||||
|
||||
Options require a single parameter follow them on the command line
|
||||
(such as ``--account wallet.json``, which nhas the name ``account`` and the value
|
||||
``wallet.json``)
|
||||
|
||||
Arguments are all other values on the command line, and are not accessed through
|
||||
the **ArgParser** directly.
|
||||
|
||||
When a CLI is run, an **ArgParser** is used to validate the command line by using
|
||||
prepareOptions, which consumes all flags and options leaving only the arguments
|
||||
behind, which are then passed into prepareArgs.
|
||||
|
||||
_property: argParser.consumeFlag(name) => boolean @<argparser-consumeflag> @SRC<cli/cli>
|
||||
Remove the flag //name// and return true if it is present.
|
||||
|
||||
_property: argParser.consumeMultiOptions(names) => Array<{ name: string, value: string}> @<argparser-consumemultioptions> @SRC<cli/cli>
|
||||
Remove all options which match any name in the Array of //names//
|
||||
with their values returning the list (in order) of values.
|
||||
|
||||
_property: argParser.consumeOption(name) => string @<argparser-consumeoption> @SRC<cli/cli>
|
||||
Remove the option with its value for //name// and return the value. This
|
||||
will throw a UsageError if the option is included multiple times.
|
||||
|
||||
_property: argParser.consumeOptions(name) => Array<string> @<argparser-consumeoptions> @SRC<cli/cli>
|
||||
Remove all options with their values for //name// and return the list
|
||||
(in order) of values.
|
||||
19
docs.wrm/cli/typescript-help.txt
Normal file
19
docs.wrm/cli/typescript-help.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
Usage:
|
||||
ethers-ts FILENAME [ ... ] [ OPTIONS ]
|
||||
|
||||
OPTIONS
|
||||
--output FILENAME Write the output to FILENAME (default: stdout)
|
||||
--force Overwrite files if they already exist
|
||||
--no-optimize Do not run the solc optimizer
|
||||
--no-bytecode Do not include bytecode and Factory methods
|
||||
|
||||
OTHER OPTIONS
|
||||
--debug Show stack traces for errors
|
||||
--help Show this usage and exit
|
||||
--version Show this version and exit
|
||||
|
||||
(*) By including mnemonics or private keys on the command line they are
|
||||
possibly readable by other users on your system and may get stored in
|
||||
your bash history file. This is NOT recommended.
|
||||
|
||||
|
||||
11
docs.wrm/cli/typescript.wrm
Normal file
11
docs.wrm/cli/typescript.wrm
Normal file
@@ -0,0 +1,11 @@
|
||||
_title: TypeScript
|
||||
|
||||
_section: TypeScript
|
||||
|
||||
_subsection: Help
|
||||
|
||||
_code: typescript-help.txt
|
||||
|
||||
_subsection: Examples
|
||||
|
||||
TODO
|
||||
@@ -3,3 +3,7 @@ _title: Events
|
||||
_section: Events
|
||||
|
||||
Explain how topics and such work
|
||||
|
||||
_subsection: Solidity Topics
|
||||
|
||||
How to compute the topic...
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@ _title: Concepts
|
||||
_section: Concepts
|
||||
|
||||
This is a very breif overview of some aspects of //Ethereum//
|
||||
which developers can make use of or should be aware of.
|
||||
and blockchains which developers can make use of or should
|
||||
be aware of.
|
||||
|
||||
_toc:
|
||||
events
|
||||
|
||||
195
docs.wrm/config.js
Normal file
195
docs.wrm/config.js
Normal file
@@ -0,0 +1,195 @@
|
||||
"use strict";
|
||||
|
||||
const { resolve } = require("path");
|
||||
const fs = require("fs");
|
||||
|
||||
const ts = require("typescript");
|
||||
|
||||
function getDefinitions(source) {
|
||||
const sourceFile = ts.createSourceFile("filename.ts", source);
|
||||
|
||||
const defs = [ ];
|
||||
|
||||
function add(type, name, pos) {
|
||||
const lineNo = sourceFile.getLineAndCharacterOfPosition(pos).line + 1;
|
||||
name = type + "." + name
|
||||
defs.push({ type, name, lineNo });
|
||||
}
|
||||
|
||||
let lastClass = null, lastEnum = null;
|
||||
function visit(node, depth) {
|
||||
if (ts.isConstructorDeclaration(node)) {
|
||||
add("constructor", lastClass, node.body.pos);
|
||||
} else if (ts.isFunctionDeclaration(node)) {
|
||||
add("function", node.name.text, node.name.end);
|
||||
} else if (ts.isConstructorDeclaration(node)) {
|
||||
add("constructor", lastClass, node.pos);
|
||||
} else if (ts.isClassDeclaration(node)) {
|
||||
lastClass = node.name.escapedText;
|
||||
add("class", lastClass, node.name.end);
|
||||
} else if (ts.isMethodDeclaration(node)) {
|
||||
if (lastClass == null) { throw new Error("missing class"); }
|
||||
if (ts.hasStaticModifier(node)) {
|
||||
add("staticmethod", (lastClass + "." + node.name.text), node.name.end);
|
||||
} else {
|
||||
add("method", (lastClass + "." + node.name.text), node.name.end);
|
||||
}
|
||||
} else if (ts.isEnumDeclaration(node)) {
|
||||
lastEnum = node.name.escapedText;
|
||||
add("enum", lastEnum, node.name.end);
|
||||
} else if (ts.isEnumMember(node)) {
|
||||
add("enum", (lastEnum + "." + node.name.escapedText), node.name.end);
|
||||
} else if (ts.isVariableDeclaration(node)) {
|
||||
if (depth === 3) {
|
||||
add("var", node.name.escapedText, node.name.end);
|
||||
}
|
||||
}
|
||||
ts.forEachChild(node, (node) => { return visit(node, depth + 1); });
|
||||
}
|
||||
|
||||
visit(sourceFile, 0);
|
||||
|
||||
return defs;
|
||||
}
|
||||
|
||||
const getSourceUrl = (function(path, include, exclude) {
|
||||
console.log("Scanning TypeScript Sources...");
|
||||
const Link = "https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages$FILENAME#L$LINE";
|
||||
const Root = resolve(__dirname, path);
|
||||
|
||||
const readdir = function(path) {
|
||||
if (path.match(exclude)) { return [ ]; }
|
||||
|
||||
const stat = fs.statSync(path);
|
||||
if (stat.isDirectory()) {
|
||||
return fs.readdirSync(path).reduce((result, filename) => {
|
||||
readdir(resolve(path, filename)).forEach((file) => {
|
||||
result.push(file);
|
||||
});
|
||||
return result;
|
||||
}, [ ]);
|
||||
}
|
||||
|
||||
if (path.match(include)) {
|
||||
const source = fs.readFileSync(path).toString();
|
||||
return [ { filename: path.substring(Root.length), defs: getDefinitions(source) } ]
|
||||
}
|
||||
|
||||
return [ ];
|
||||
}
|
||||
|
||||
const defs = readdir(Root);
|
||||
|
||||
return function getSourceUrl(key) {
|
||||
const comps = key.split(":");
|
||||
if (comps.length !== 2) { throw new Error("unsupported key"); }
|
||||
|
||||
const pathCheck = new RegExp("(^|[^a-zA-Z0-9_])" + comps[0].split("/").join("/(.*/)*") + "($|[^a-zA-Z0-9_])");
|
||||
|
||||
let match = comps[1];
|
||||
if (match.indexOf("(" /* fix: )*/)) {
|
||||
match = new RegExp("(^|\\.)" + match.split("(" /* fix: ) */)[0] + "$");
|
||||
} else if (match[0] === "=") {
|
||||
match = new RegExp("^" + match.substring(1) + "$");
|
||||
} else {
|
||||
match = new RegExp("(^|\\.)" + match + "$");
|
||||
}
|
||||
|
||||
const result = [ ];
|
||||
defs.forEach((def) => {
|
||||
if (!def.filename.match(pathCheck)) { return; }
|
||||
def.defs.forEach((d) => {
|
||||
if (!d.name.match(match)) { return; }
|
||||
result.push({ filename: def.filename, lineNo: d.lineNo });
|
||||
});
|
||||
});
|
||||
|
||||
if (result.length > 1) {
|
||||
throw new Error(`Amibguous TypeScript link: ${ key } in [ ${ result.map((r) => JSON.stringify(r.filename + ":" + r.lineNo)).join(", ") }]`);
|
||||
} else if (result.length === 0) {
|
||||
throw new Error(`No matching TypeScript link: ${ key }`);
|
||||
}
|
||||
|
||||
return Link
|
||||
.replace("$LINE", String(result[0].lineNo))
|
||||
.replace("$FILENAME", result[0].filename);
|
||||
}
|
||||
})("../packages/", new RegExp("packages/.*/src.ts/.*\.ts$"), new RegExp("/node_modules/|src.ts/.*browser.*"));
|
||||
|
||||
module.exports = {
|
||||
title: "ethers",
|
||||
subtitle: "v5.0-beta",
|
||||
logo: "logo.svg",
|
||||
|
||||
link: "https://docs-beta.ethers.io",
|
||||
|
||||
markdown: {
|
||||
"banner": "-----\n\nDocumentation: [html](https://docs-beta.ethers.io/)\n\n-----\n\n"
|
||||
},
|
||||
|
||||
getSourceUrl: getSourceUrl,
|
||||
|
||||
externalLinks: {
|
||||
"link-alchemy": "https:/\/alchemyapi.io",
|
||||
"link-cloudflare": "https:/\/developers.cloudflare.com/distributed-web/ethereum-gateway/",
|
||||
"link-ethereum": "https:/\/ethereumorg",
|
||||
"link-etherscan": "https:/\/etherscan.io",
|
||||
"link-etherscan-api": "https:/\/etherscan.io/apis",
|
||||
"link-flatworm": "https:/\/github.com/ricmoo/flatworm",
|
||||
"link-geth": "https:/\/geth.ethereum.org",
|
||||
"link-infura": "https:/\/infura.io",
|
||||
"link-ledger": "https:/\/www.ledger.com",
|
||||
"link-metamask": "https:/\/metamask.io/",
|
||||
"link-parity": "https:/\/www.parity.io",
|
||||
"link-rtd": "https:/\/github.com/readthedocs/sphinx_rtd_theme",
|
||||
"link-sphinx": "https:/\/www.sphinx-doc.org/",
|
||||
|
||||
"link-legacy-docs3": "https:/\/docs.ethers.io/ethers.js/v3.0/html/",
|
||||
"link-legacy-docs4": "https:/\/docs.ethers.io/ethers.js",
|
||||
|
||||
"link-web3": "https:/\/github.com/ethereum/web3.js",
|
||||
"link-web3-http": "https:/\/github.com/ethereum/web3.js/tree/1.x/packages/web3-providers-http",
|
||||
"link-web3-ipc": "https:/\/github.com/ethereum/web3.js/tree/1.x/packages/web3-providers-ipc",
|
||||
"link-web3-ws": "https:/\/github.com/ethereum/web3.js/tree/1.x/packages/web3-providers-ws",
|
||||
|
||||
"link-solc-output": "https:/\/solidity.readthedocs.io/en/v0.6.0/using-the-compiler.html#output-description",
|
||||
|
||||
"link-icap": "https:/\/github.com/ethereum/wiki/wiki/Inter-exchange-Client-Address-Protocol-%28ICAP%29",
|
||||
"link-jsonrpc": "https:/\/github.com/ethereum/wiki/wiki/JSON-RPC",
|
||||
"link-mit": "https:/\/en.m.wikipedia.org/wiki/MIT_License",
|
||||
"link-namehash": "https:/\/docs.ens.domains/contract-api-reference/name-processing#hashing-names",
|
||||
|
||||
"link-ethersio": "https:/\/ethers.io/",
|
||||
"link-ethers-docs": "https:/\/docs.ethers.io/",
|
||||
"link-ethers-js": "https:/\/cdn.ethers.io/lib/ethers-5.0.esm.min.js",
|
||||
"link-ethers-npm": "https:/\/www.npmjs.com/search?q=%40ethersproject%2F",
|
||||
"link-ethers-asm-grammar": "https:/\/github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/asm/grammar.jison",
|
||||
|
||||
"link-eip-155": "https:/\/eips.ethereum.org/EIPS/eip-155",
|
||||
"link-eip-609": "https:/\/eips.ethereum.org/EIPS/eip-609",
|
||||
"link-eip-1014": "https:/\/eips.ethereum.org/EIPS/eip-1014",
|
||||
"link-eip-2098": "https:/\/eips.ethereum.org/EIPS/eip-2098",
|
||||
|
||||
"link-js-array": "https:/\/developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array",
|
||||
"link-js-bigint": "https:/\/developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt",
|
||||
"link-js-typedarray": "https:/\/developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray",
|
||||
|
||||
"link-ricmoo-humanreadableabi": "https:/\/blog.ricmoo.com/human-readable-contract-abis-in-ethers-js-141902f4d917",
|
||||
|
||||
"link-wiki-bloomfilter": "https:/\/en.wikipedia.org/wiki/Bloom_filter",
|
||||
"link-wiki-cryptographichash": "https:/\/en.wikipedia.org/wiki/Cryptographic_hash_function",
|
||||
"link-wiki-homoglyph": "https:/\/en.wikipedia.org/wiki/IDN_homograph_attack",
|
||||
"link-wiki-hmac": "https:/\/en.wikipedia.org/wiki/HMAC",
|
||||
"link-wiki-iban": "https:/\/en.wikipedia.org/wiki/International_Bank_Account_Number",
|
||||
"link-wiki-ieee754": "https:/\/en.wikipedia.org/wiki/Double-precision_floating-point_format",
|
||||
"link-wiki-ripemd": "https:/\/en.m.wikipedia.org/wiki/RIPEMD",
|
||||
"link-wiki-sha2": "https:/\/en.wikipedia.org/wiki/SHA-2",
|
||||
"link-wiki-twoscomplement": "https:/\/en.wikipedia.org/wiki/Two%27s_complement",
|
||||
"link-wiki-unicode-equivalence": "https:/\/en.wikipedia.org/wiki/Unicode_equivalence",
|
||||
"link-wiki-utf8-overlong": "https:/\/en.wikipedia.org/wiki/UTF-8#Overlong_encodings",
|
||||
"link-wiki-utf8-replacement": "https:/\/en.wikipedia.org/wiki/Specials_%28Unicode_block%29#Replacement_character",
|
||||
"link-wiki-scrypt": "https:/\/en.wikipedia.org/wiki/Scrypt",
|
||||
"link-wiki-sha3": "https:/\/en.wikipedia.org/wiki/SHA-3",
|
||||
|
||||
}
|
||||
};
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,13 @@ _toc:
|
||||
some-file
|
||||
some-directory
|
||||
|
||||
_definition and reset the indentation.
|
||||
|
||||
_note: Title
|
||||
This is placed in a blue box.
|
||||
|
||||
_warning: Title
|
||||
This is placed in an orange box.
|
||||
|
||||
_null:
|
||||
This breaks out of a directive. For example, to end a
|
||||
_definition and reset the indentation.
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
_DIRECTIVE: VALUE @<LINK>
|
||||
_DIRECTIVE: VALUE @<LINK> @META<PARAMETER>
|
||||
BODY
|
||||
|
||||
DIRECTIVE: The directive name
|
||||
VALUE: Optional; the value to pass to the directive
|
||||
LINK: Optional; a name for internal linking
|
||||
BODY: Optional; the directive body (certain directives only)
|
||||
DIRECTIVE: The directive name
|
||||
VALUE: Optional; the value to pass to the directive
|
||||
LINK: Optional; a name for internal linking
|
||||
META: Optional; extended directive functionality
|
||||
PARAMETER: Optional; value to pass to extended directive functions
|
||||
BODY: Optional; the directive body (certain directives only)
|
||||
|
||||
@@ -6,11 +6,11 @@ The //Flatworm Docs// rendering script is designed to be **very**
|
||||
simple, but provide enough formatting necessary for documenting
|
||||
JavaScript libraries.
|
||||
|
||||
A lot of its inspiration came from [Read the Docs](https://github.com/readthedocs/sphinx_rtd_theme) and
|
||||
the [Sphinx](https://www.sphinx-doc.org/) project.
|
||||
A lot of its inspiration came from [Read the Docs](link-rtd) and
|
||||
the [Sphinx](link-sphinx) project.
|
||||
|
||||
|
||||
_subsection: Fragments
|
||||
_subsection: Fragments @<flatworm-fragments>
|
||||
|
||||
Flatworm Docs are made up of fragments. A fragment is either a lone
|
||||
body of [markdown](flatworm-markdown) text, or a
|
||||
@@ -49,6 +49,12 @@ _definition: **_property:** //SIGNATURE//
|
||||
A //property// has its JavaScript **SIGNATURE** formatted and the
|
||||
markdown body is indented.
|
||||
|
||||
_definition: **_note:** //TITLE//
|
||||
A //note// is placed in a blue bordered-box to draw attention to it.
|
||||
|
||||
_definition: **_warning:** //TITLE//
|
||||
A //warning// is placed in an orange bordered-box to draw attention to it.
|
||||
|
||||
_definition: **_code:** //FILENAME//
|
||||
A //code// reads the **FILENAME** and depending on the extension
|
||||
adjusts it.
|
||||
@@ -73,7 +79,6 @@ _heading: Examples
|
||||
|
||||
_code: examples.txt
|
||||
|
||||
|
||||
_subsection: Markdown @<flatworm-markdown>
|
||||
|
||||
The markdown is simple and does not have the flexibility of
|
||||
@@ -83,3 +88,39 @@ supporting [links](flatworm-markdown) and lists.
|
||||
|
||||
_code: markdown.txt
|
||||
|
||||
|
||||
_subsection: Configuration @<flatworm-config>
|
||||
|
||||
Configuration is optional (but highly recommended) and may be either
|
||||
a simple JSON file (config.json) or a JS file (config.js) placed in
|
||||
the top of the source folder.
|
||||
|
||||
TODO: example JSON and example JS
|
||||
|
||||
|
||||
_subsection: Extended Directive Functions @<flatworm-extended-directive-functions>
|
||||
|
||||
_heading: @INHERIT\<markdown>
|
||||
|
||||
Adds an inherits description to a directive. The //markdown// may contain links.
|
||||
|
||||
This extended directive function is available for:
|
||||
|
||||
- _section
|
||||
- _subsetion
|
||||
- _heading
|
||||
|
||||
_heading: @SRC\<text>
|
||||
|
||||
Calls the configuration ``getSourceUrl(text, VALUE)`` to get a URL which
|
||||
will be linked to by a link next to the //directive//.
|
||||
|
||||
This extended directive function requires an advanced ``config.js`` [[flatworm-config]]
|
||||
file since it requires a JavaScript function.
|
||||
|
||||
This extended directive function is available for:
|
||||
|
||||
- _section
|
||||
- _subsetion
|
||||
- _heading
|
||||
- _property
|
||||
|
||||
@@ -6,8 +6,7 @@ _section: Getting Started
|
||||
_subsection: Installing
|
||||
|
||||
The various Classes and Functions are available to be imported
|
||||
manually from sub-packages under the
|
||||
[@ethersproject](https://www.npmjs.com/search?q=%40ethersproject%2F)
|
||||
manually from sub-packages under the [@ethersproject](link-ethers-npm)
|
||||
but for most projects, the umbrella package is the easiest way to
|
||||
get started.
|
||||
|
||||
@@ -23,8 +22,8 @@ _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
|
||||
your own webserver and serve it yourself.
|
||||
[ethers library](link-ethers-js) to your own webserver and serve it
|
||||
yourself.
|
||||
|
||||
For quick demos or prototyping though, it can be loaded in your
|
||||
Web Applications from our CDN.
|
||||
|
||||
58
docs.wrm/hacking.wrm
Normal file
58
docs.wrm/hacking.wrm
Normal file
@@ -0,0 +1,58 @@
|
||||
_title: Hacking
|
||||
|
||||
_section: Hacking
|
||||
|
||||
Things to keep in mind:
|
||||
|
||||
|
||||
_heading: Supported Platforms
|
||||
|
||||
...
|
||||
|
||||
_heading: Dependencies
|
||||
|
||||
Adding a dependency is non-trivial and will require fairly convincing
|
||||
arguments.
|
||||
|
||||
Further, **ALL** dependencies for ethers, **must** be MIT licensed or
|
||||
public domain (CC0).
|
||||
|
||||
All contributions to ethers are then included under the MIT license.
|
||||
|
||||
|
||||
_heading: Printable ASCII (7-bit) Characters
|
||||
|
||||
All source and documentation files should ONLY use the printable ASCII
|
||||
set.
|
||||
|
||||
This is for several reasons, bu...
|
||||
|
||||
- Transmission over certain HTTP servers and proxies can mangle
|
||||
UTF-8 data
|
||||
- Certain editors on some platforms, or in certain terminals cannot
|
||||
handle UTF-8 characters elegantly
|
||||
- The ability to enter non-ASCII characters on some platforms require
|
||||
special keyboards, input devices or input methods to be installed,
|
||||
which either not be supported, or may require administrative
|
||||
priviledges.
|
||||
|
||||
|
||||
_heading: License
|
||||
|
||||
MIT...
|
||||
|
||||
|
||||
_heading: Other Considerations
|
||||
|
||||
A common argument to Pull Requests is that they are simple, backwards compatible
|
||||
and
|
||||
|
||||
It is important to remember that a small change is something that
|
||||
we are required to support in perpetuity.
|
||||
|
||||
For example, adding support for an obscure platform, such as adding a dot-file
|
||||
to the root of the package, now carries the implication that we will continue
|
||||
keeping that dot-file up-to-date as new versions of that platform are released.
|
||||
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -4,7 +4,7 @@ _section: What is ethers?
|
||||
|
||||
The ethers.js library aims to be a complete and compact library for
|
||||
interacting with the Ethereum Blockchain and its ecosystem. It was
|
||||
originally designed for use with [ethers.io](https://ethers.io/) and
|
||||
originally designed for use with [ethers.io](link-ethersio) and
|
||||
has since expanded into a much more general-purpose library.
|
||||
|
||||
_subsection: Features
|
||||
@@ -17,17 +17,14 @@ _subsection: Features
|
||||
- Meta-classes create JavaScript objects from any contract ABI,
|
||||
including **ABIv2** and **Human-Readable ABI**
|
||||
- Connect to Ethereum nodes over
|
||||
[JSON-RPC](https://github.com/ethereum/wiki/wiki/JSON-RPC),
|
||||
[INFURA](https://infura.io/),
|
||||
[Etherscan](https://etherscan.io/),
|
||||
[Nodesmith](https://nodesmith.io),
|
||||
[Alchemy](https://alchemyapi.io),
|
||||
or [MetaMask](https://metamask.io/).
|
||||
[JSON-RPC](link-jsonrpc), [INFURA](link-infura),
|
||||
[Etherscan](link-etherscan), [Alchemy](link-alchemy),
|
||||
[Cloudflare](link-cloudflare) or [MetaMask](link-metamask).
|
||||
- **ENS names** are first-class citizens; they can be used
|
||||
anywhere an Ethereum addresses can be used
|
||||
- **Tiny** (~88kb compressed; 284kb uncompressed)
|
||||
- **Complete** functionality for all your Ethereum needs
|
||||
- Extensive [documentation](https://docs.ethers.io/)
|
||||
- Extensive [documentation](link-ethers-docs)
|
||||
- Large collection of **test cases** which are maintained and added to
|
||||
- Fully **TypeScript** ready, with definition files and full
|
||||
TypeScript source
|
||||
@@ -42,6 +39,7 @@ _toc:
|
||||
getting-started
|
||||
concepts
|
||||
api
|
||||
cli
|
||||
cookbook
|
||||
migration
|
||||
testing
|
||||
@@ -55,5 +53,5 @@ _subsection: Legacy Documentation
|
||||
This section will be kept up to date, linking to documentation of
|
||||
older versions of the library.
|
||||
|
||||
- [version 4.0](https://docs.ethers.io/ethers.js)
|
||||
- [version 3.0](https://docs.ethers.io/ethers.js/v3.0/html/)
|
||||
- [version 4.0](link-legacy-docs4)
|
||||
- [version 3.0](link-legacy-docs3)
|
||||
|
||||
@@ -4,8 +4,8 @@ _title: License and Copyright
|
||||
_section: License and Copyright
|
||||
|
||||
The ethers library (including all dependencies) are available
|
||||
under the [MIT License](https://en.m.wikipedia.org/wiki/MIT_License),
|
||||
which permits a wide variety of uses.
|
||||
under the [MIT License](link-mit), which permits a wide variety
|
||||
of uses.
|
||||
|
||||
|
||||
_heading: MIT License
|
||||
|
||||
@@ -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)
|
||||
@@ -53,7 +54,9 @@ Developer Documentation
|
||||
* [Buckets](api/contract)
|
||||
* [Signers](api/signer)
|
||||
* [Signer](api/signer)
|
||||
* [Wallet inherits Signer](api/signer)
|
||||
* [Wallet](api/signer)
|
||||
* [VoidSigner](api/signer)
|
||||
* [ExternallyOwnedAccount](api/signer)
|
||||
* [Providers](api/providers)
|
||||
* [Provider](api/providers/provider)
|
||||
* [Accounts Methods](api/providers/provider)
|
||||
@@ -64,24 +67,35 @@ Developer Documentation
|
||||
* [Transactions Methods](api/providers/provider)
|
||||
* [Event Emitter Methods](api/providers/provider)
|
||||
* [Inspection Methods](api/providers/provider)
|
||||
* [JSON-RPC Provider](api/providers/jsonrpc-provider)
|
||||
* [JsonRpcProvider](api/providers/jsonrpc-provider)
|
||||
* [JsonRpcProvider](api/providers/jsonrpc-provider)
|
||||
* [JsonRpcSigner](api/providers/jsonrpc-provider)
|
||||
* [JsonRpcUncheckedSigner](api/providers/jsonrpc-provider)
|
||||
* [API Providers](api/providers/api-providers)
|
||||
* [EtherscanProvider](api/providers/api-providers)
|
||||
* [InfuraProvider](api/providers/api-providers)
|
||||
* [NodesmithProvider](api/providers/api-providers)
|
||||
* [AlchemyProvider](api/providers/api-providers)
|
||||
* [CloudfrontProvider](api/providers/api-providers)
|
||||
* [Other Providers](api/providers/other)
|
||||
* [FallbackProvider](api/providers/other)
|
||||
* [IpcProvider](api/providers/other)
|
||||
* [UrlJsonRpcProvider](api/providers/other)
|
||||
* [Web3Provider](api/providers/other)
|
||||
* [Types](api/providers/types)
|
||||
* [Blocks](api/providers/types)
|
||||
* [Network](api/providers/types)
|
||||
* [Block](api/providers/types)
|
||||
* [Events and Logs](api/providers/types)
|
||||
* [Transactions](api/providers/types)
|
||||
* [Utilities](api/utils)
|
||||
* [Addresses](api/utils/address)
|
||||
* [Address Formats](api/utils/address)
|
||||
* [Functions](api/utils/address)
|
||||
* [Application Binary Interface](api/utils/abi)
|
||||
* [Formats](api/utils/abi)
|
||||
* [Fragment](api/utils/abi)
|
||||
* [ConstructorFragment](api/utils/abi)
|
||||
* [EventFragment](api/utils/abi)
|
||||
* [FunctionFragment](api/utils/abi)
|
||||
* [ParamType](api/utils/abi)
|
||||
* [BigNumber](api/utils/bignumber)
|
||||
* [Types](api/utils/bignumber)
|
||||
* [Creating Instances](api/utils/bignumber)
|
||||
@@ -102,7 +116,7 @@ Developer Documentation
|
||||
* [Units](api/utils/display-logic)
|
||||
* [Functions](api/utils/display-logic)
|
||||
* [FixedNumber](api/utils/fixednumber)
|
||||
* [Types](api/utils/fixednumber)
|
||||
* [FixedFormat](api/utils/fixednumber)
|
||||
* [Creating Instances](api/utils/fixednumber)
|
||||
* [Properties](api/utils/fixednumber)
|
||||
* [Methods](api/utils/fixednumber)
|
||||
@@ -113,6 +127,31 @@ Developer Documentation
|
||||
* [Strings](api/utils/strings)
|
||||
* [Bytes32String](api/utils/strings)
|
||||
* [UTF-8 Strings](api/utils/strings)
|
||||
* [UnicodeNormalizationForm](api/utils/strings)
|
||||
* [Custom UTF-8 Error Handling](api/utils/strings)
|
||||
* [Transactions](api/utils/transactions)
|
||||
* [Types](api/utils/transactions)
|
||||
* [Functions](api/utils/transactions)
|
||||
* [Other Libraries](api/other)
|
||||
* [Hardware Wallets](api/other/hardware)
|
||||
* [LedgerSigner](api/other/hardware)
|
||||
* [Command Line Interfaces](cli)
|
||||
* [Sandbox Utility](cli/ethers)
|
||||
* [Help](cli/ethers)
|
||||
* [Examples](cli/ethers)
|
||||
* [Assembler](cli/asm)
|
||||
* [Help](cli/asm)
|
||||
* [Examples](cli/asm)
|
||||
* [ENS](cli/ens)
|
||||
* [Help](cli/ens)
|
||||
* [Examples](cli/ens)
|
||||
* [TypeScript](cli/typescript)
|
||||
* [Help](cli/typescript)
|
||||
* [Examples](cli/typescript)
|
||||
* [Making Your Own](cli/plugin)
|
||||
* [CLI](cli/plugin)
|
||||
* [Plugin](cli/plugin)
|
||||
* [ArgParser](cli/plugin)
|
||||
* [Cookbook](cookbook)
|
||||
* [Migration Guide](migration)
|
||||
* [From Web3](migration)
|
||||
@@ -123,6 +162,8 @@ Developer Documentation
|
||||
* [Flatworm Docs](documentation)
|
||||
* [Fragments](documentation)
|
||||
* [Markdown](documentation)
|
||||
* [Configuration](documentation)
|
||||
* [Extended Directive Functions](documentation)
|
||||
* [License and Copyright](license)
|
||||
|
||||
|
||||
@@ -141,4 +182,4 @@ older versions of the library.
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** 6abeb4fa3f15b3443d89a26a6b0320f602a12368bc5ebbfb14a6cce682836167
|
||||
**Content Hash:** bf4f628855f6f4c54ceca8c845e7ec93498135aa2d045f582d7c98e3a05294d7
|
||||
@@ -16,7 +16,9 @@ Here...
|
||||
* [Buckets](contract)
|
||||
* [Signers](signer)
|
||||
* [Signer](signer)
|
||||
* [Wallet inherits Signer](signer)
|
||||
* [Wallet](signer)
|
||||
* [VoidSigner](signer)
|
||||
* [ExternallyOwnedAccount](signer)
|
||||
* [Providers](providers)
|
||||
* [Provider](providers/provider)
|
||||
* [Accounts Methods](providers/provider)
|
||||
@@ -27,24 +29,35 @@ Here...
|
||||
* [Transactions Methods](providers/provider)
|
||||
* [Event Emitter Methods](providers/provider)
|
||||
* [Inspection Methods](providers/provider)
|
||||
* [JSON-RPC Provider](providers/jsonrpc-provider)
|
||||
* [JsonRpcProvider](providers/jsonrpc-provider)
|
||||
* [JsonRpcProvider](providers/jsonrpc-provider)
|
||||
* [JsonRpcSigner](providers/jsonrpc-provider)
|
||||
* [JsonRpcUncheckedSigner](providers/jsonrpc-provider)
|
||||
* [API Providers](providers/api-providers)
|
||||
* [EtherscanProvider](providers/api-providers)
|
||||
* [InfuraProvider](providers/api-providers)
|
||||
* [NodesmithProvider](providers/api-providers)
|
||||
* [AlchemyProvider](providers/api-providers)
|
||||
* [CloudfrontProvider](providers/api-providers)
|
||||
* [Other Providers](providers/other)
|
||||
* [FallbackProvider](providers/other)
|
||||
* [IpcProvider](providers/other)
|
||||
* [UrlJsonRpcProvider](providers/other)
|
||||
* [Web3Provider](providers/other)
|
||||
* [Types](providers/types)
|
||||
* [Blocks](providers/types)
|
||||
* [Network](providers/types)
|
||||
* [Block](providers/types)
|
||||
* [Events and Logs](providers/types)
|
||||
* [Transactions](providers/types)
|
||||
* [Utilities](utils)
|
||||
* [Addresses](utils/address)
|
||||
* [Address Formats](utils/address)
|
||||
* [Functions](utils/address)
|
||||
* [Application Binary Interface](utils/abi)
|
||||
* [Formats](utils/abi)
|
||||
* [Fragment](utils/abi)
|
||||
* [ConstructorFragment](utils/abi)
|
||||
* [EventFragment](utils/abi)
|
||||
* [FunctionFragment](utils/abi)
|
||||
* [ParamType](utils/abi)
|
||||
* [BigNumber](utils/bignumber)
|
||||
* [Types](utils/bignumber)
|
||||
* [Creating Instances](utils/bignumber)
|
||||
@@ -65,7 +78,7 @@ Here...
|
||||
* [Units](utils/display-logic)
|
||||
* [Functions](utils/display-logic)
|
||||
* [FixedNumber](utils/fixednumber)
|
||||
* [Types](utils/fixednumber)
|
||||
* [FixedFormat](utils/fixednumber)
|
||||
* [Creating Instances](utils/fixednumber)
|
||||
* [Properties](utils/fixednumber)
|
||||
* [Methods](utils/fixednumber)
|
||||
@@ -76,8 +89,16 @@ Here...
|
||||
* [Strings](utils/strings)
|
||||
* [Bytes32String](utils/strings)
|
||||
* [UTF-8 Strings](utils/strings)
|
||||
* [UnicodeNormalizationForm](utils/strings)
|
||||
* [Custom UTF-8 Error Handling](utils/strings)
|
||||
* [Transactions](utils/transactions)
|
||||
* [Types](utils/transactions)
|
||||
* [Functions](utils/transactions)
|
||||
* [Other Libraries](other)
|
||||
* [Hardware Wallets](other/hardware)
|
||||
* [LedgerSigner](other/hardware)
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** cbd0b8ac4ada4bfee211c0553ac53e171a6900127d874743a0dedf7fa30618f3
|
||||
**Content Hash:** 9efeac06691d2415dcc248d1567676602f7df029abd5f844480b12bb844588a7
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
23
docs/api/other/README.md
Normal file
23
docs/api/other/README.md
Normal file
@@ -0,0 +1,23 @@
|
||||
-----
|
||||
|
||||
Documentation: [html](https://docs-beta.ethers.io/)
|
||||
|
||||
-----
|
||||
|
||||
|
||||
Other Libraries
|
||||
===============
|
||||
|
||||
|
||||
Now that ethers is more modular, it is possible to have additional
|
||||
ancillary packages, which are not part of the core but optionally
|
||||
add functionality only needed in certain situations.
|
||||
|
||||
|
||||
* [Hardware Wallets](hardware)
|
||||
* [LedgerSigner](hardware)
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** bafa126f115321049791ba83b99acf79f82f222eb246124c601983ad8cb4b73a
|
||||
38
docs/api/other/hardware/README.md
Normal file
38
docs/api/other/hardware/README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
-----
|
||||
|
||||
Documentation: [html](https://docs-beta.ethers.io/)
|
||||
|
||||
-----
|
||||
|
||||
|
||||
Hardware Wallets
|
||||
================
|
||||
|
||||
|
||||
|
||||
LedgerSigner
|
||||
------------
|
||||
|
||||
|
||||
The [Ledger Hardware Wallets](https://www.ledger.com) are a fairly
|
||||
popular brand.
|
||||
|
||||
TODO: importing
|
||||
|
||||
|
||||
### API
|
||||
|
||||
|
||||
|
||||
#### **new** **LedgerSigner** ( [ provider [ , type [ , path ] ] ] ) **=>** *[LedgerSigner](./)*
|
||||
|
||||
Connects to a Ledger Hardware Wallet. The *type* if left unspecified is
|
||||
determined by the environment; in node the default is "hid" and in the browser
|
||||
"u2f" is the default. The default Ethereum path is used if *path* is left unspecified.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** 240366cd9757f396d08ed65ebfceafa51f82bfc44c04695ab68e3560e7a0016b
|
||||
8
docs/api/other/hardware/index.html
Normal file
8
docs/api/other/hardware/index.html
Normal file
File diff suppressed because one or more lines are too long
4
docs/api/other/index.html
Normal file
4
docs/api/other/index.html
Normal file
File diff suppressed because one or more lines are too long
@@ -64,24 +64,26 @@ Provider Documentation
|
||||
* [Transactions Methods](provider)
|
||||
* [Event Emitter Methods](provider)
|
||||
* [Inspection Methods](provider)
|
||||
* [JSON-RPC Provider](jsonrpc-provider)
|
||||
* [JsonRpcProvider](jsonrpc-provider)
|
||||
* [JsonRpcProvider](jsonrpc-provider)
|
||||
* [JsonRpcSigner](jsonrpc-provider)
|
||||
* [JsonRpcUncheckedSigner](jsonrpc-provider)
|
||||
* [API Providers](api-providers)
|
||||
* [EtherscanProvider](api-providers)
|
||||
* [InfuraProvider](api-providers)
|
||||
* [NodesmithProvider](api-providers)
|
||||
* [AlchemyProvider](api-providers)
|
||||
* [CloudfrontProvider](api-providers)
|
||||
* [Other Providers](other)
|
||||
* [FallbackProvider](other)
|
||||
* [IpcProvider](other)
|
||||
* [UrlJsonRpcProvider](other)
|
||||
* [Web3Provider](other)
|
||||
* [Types](types)
|
||||
* [Blocks](types)
|
||||
* [Network](types)
|
||||
* [Block](types)
|
||||
* [Events and Logs](types)
|
||||
* [Transactions](types)
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** b15d8a2febb07abbbd784242c47575fbbb097f24643997ce30625c2e88adb095
|
||||
**Content Hash:** 90fa0754bfed9594694637e2d5167de53e514a4c3527cd10a42083488ad112bf
|
||||
@@ -24,30 +24,88 @@ 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 >*
|
||||
|
||||
@TODO... Explain
|
||||
|
||||
|
||||
|
||||
|
||||
#### **Supported Networks**
|
||||
|
||||
|
||||
|
||||
* Homestead (Mainnet)
|
||||
* Ropsten (proof-of-work testnet)
|
||||
* Rinkeby (proof-of-Authority testnet)
|
||||
* Görli (clique testnet)
|
||||
* Kovan (proof-of-authority testnet)
|
||||
|
||||
|
||||
|
||||
|
||||
InfuraProvider
|
||||
--------------
|
||||
|
||||
|
||||
Tra la la...
|
||||
The **InfuraProvider** is backed by the popular [INFURA](https://infura.io)
|
||||
Ethereum service.
|
||||
|
||||
|
||||
NodesmithProvider
|
||||
-----------------
|
||||
#### **Supported Networks**
|
||||
|
||||
|
||||
|
||||
* Homestead (Mainnet)
|
||||
* Ropsten (proof-of-work testnet)
|
||||
* Rinkeby (proof-of-Authority testnet)
|
||||
* Görli (clique testnet)
|
||||
* Kovan (proof-of-authority testnet)
|
||||
|
||||
|
||||
Tra la la...
|
||||
|
||||
|
||||
AlchemyProvider
|
||||
---------------
|
||||
|
||||
|
||||
Tra la la...
|
||||
The **AlchemtProvider** is backed by [Alchemy](https://alchemyapi.io).
|
||||
|
||||
|
||||
#### **Supported Networks**
|
||||
|
||||
|
||||
|
||||
* Homestead (Mainnet)
|
||||
* Ropsten (proof-of-work testnet)
|
||||
* Rinkeby (proof-of-Authority testnet)
|
||||
* Görli (clique testnet)
|
||||
* Kovan (proof-of-authority testnet)
|
||||
|
||||
|
||||
|
||||
|
||||
CloudfrontProvider
|
||||
------------------
|
||||
|
||||
|
||||
The CloudfrontProvider is backed by the
|
||||
[Cloudflare Ethereum Gateway](https://developers.cloudflare.com/distributed-web/ethereum-gateway/).
|
||||
|
||||
|
||||
#### **Supported Networks**
|
||||
|
||||
|
||||
|
||||
* Homestead (Mainnet)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** 9669eaaa1c2e9a31256fdd49e1b7f79550f064056b1bfd67a8cef6c7b5f8d473
|
||||
**Content Hash:** 516111e087ee3f12588ba555c0719f7170ea532e269590586c95ddc1d7eb7e7b
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -5,21 +5,37 @@ Documentation: [html](https://docs-beta.ethers.io/)
|
||||
-----
|
||||
|
||||
|
||||
JSON-RPC Provider
|
||||
=================
|
||||
|
||||
|
||||
Explain here...
|
||||
|
||||
|
||||
JsonRpcProvider
|
||||
---------------
|
||||
===============
|
||||
|
||||
|
||||
TODO...
|
||||
The [JSON-RPC API](https://github.com/ethereum/wiki/wiki/JSON-RPC) is a
|
||||
very popular method for interacting with Ethereum and is available in all
|
||||
major Ethereum node implementations (e.g. [Geth](https://geth.ethereum.org)
|
||||
and [Parity](https://www.parity.io)) as well as many third-party web
|
||||
services (e.g. [INFURA](https://infura.io))
|
||||
|
||||
|
||||
#### *provider* . **getSigner** ( [ addressOrIndex ] ) **=>** *[JsonRpcSigner](./)*
|
||||
#### **new** *ethers* . *providers* . **JsonRpcProvider** ( [ url [ , aNetworkish ] ] )
|
||||
|
||||
Connect to a JSON-RPC API located at *url* using the /aNetworkish// network.
|
||||
If *url* is not specified, the default (i.e. `http://localhost:8545`) is used
|
||||
and if no network is specified, it will be determined automatically by
|
||||
querying the node.
|
||||
|
||||
|
||||
|
||||
|
||||
#### Note: Connecting to a Local Node
|
||||
|
||||
Each node implementation is slightly different and may require specific command-line
|
||||
flags or changes in their Settings UI to enable JSON-RPC, unlock accounrs
|
||||
or expose specific APIs. Please consult theit documentation.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *jsonRpcProvider* . **getSigner** ( [ addressOrIndex ] ) **=>** *[JsonRpcSigner](./)*
|
||||
|
||||
Returns a [JsonRpcSigner](./) which is managed by this Ethereum node, at
|
||||
*addressOrIndex*. If no *addressOrIndex* is provided, the first
|
||||
@@ -28,27 +44,91 @@ account (account #0) is used.
|
||||
|
||||
|
||||
|
||||
#### *provider* . **getUncheckSigner** ( [ addressOrIndex ] ) **=>** *[JsonRpcUncheckedSigner](./)*
|
||||
#### *jsonRpcProvider* . **getUncheckedSigner** ( [ addressOrIndex ] ) **=>** *[JsonRpcUncheckedSigner](./)*
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#### *jsonRpcProvider* . **listAccounts** ( ) **=>** *Array< string >*
|
||||
|
||||
Returns a list of all account addresses managed by this provider.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *jsonRpcProvider* . **send** ( method , params ) **=>** *Promise< any >*
|
||||
|
||||
Allows sending raw messages to the provider.
|
||||
|
||||
This can be used for backend-specific calls, such as for debugging or
|
||||
specific account management.
|
||||
|
||||
|
||||
|
||||
|
||||
JsonRpcSigner
|
||||
-------------
|
||||
|
||||
|
||||
TODO... Explain
|
||||
A **JsonRpcSigner** is a simple Signer which is backed by a connected
|
||||
[JsonRpcProvider](./).
|
||||
|
||||
|
||||
#### *signer* . **provider** **=>** *[JsonRpcProvider](./)*
|
||||
|
||||
The provider this signer was established from.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *signer* . **connectUnchecked** ( ) **=>** *[JsonRpcUncheckedSigner](./)*
|
||||
|
||||
Returns a new Signer object which does not perform addtional checks when
|
||||
sending a transaction. See [JsonRpcUncheckedSigner](./) for more details.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *signer* . **sendUncheckedTransaction** ( transaction ) **=>** *Promise< string< [DataHexstring](../../utils/bytes)< 32 > > >*
|
||||
|
||||
Sends the *transaction* and returns a Promise which resolves to the
|
||||
opacque transaction hash.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *signer* . **unlock** ( password ) **=>** *Promise< boolean >*
|
||||
|
||||
Request the node unlock the account (if locked) using *password*.
|
||||
|
||||
|
||||
|
||||
|
||||
JsonRpcUncheckedSigner
|
||||
----------------------
|
||||
|
||||
|
||||
TODO... Explain
|
||||
The JSON-RPC API only provides a transaction hash as the response when a
|
||||
transaction is sent, but the ethers Provider requires populating all details
|
||||
of a transaction before returning it. For example, the gas price and gas limit
|
||||
may be adjusted by the node or the nonce automatically included, in which case
|
||||
the opaque transaction hash has discarded this.
|
||||
|
||||
To remedy this, the [JsonRpcSigner](./) immeidately queries the provider for
|
||||
the details using the returned transaction hash to populate the [TransactionResponse](../types)
|
||||
object.
|
||||
|
||||
Some backends do not respond immediately and instead defer releasing the
|
||||
details of a transaction it was responsible for signing until it is mined.
|
||||
|
||||
The **UncheckedSigner** does not populate any additional information and will
|
||||
immediately return the result as a mock [TransactionResponse](../types)-like
|
||||
object, with most of the properties set to null, but allows access to the
|
||||
transaction hash quickly, if that is all that is required.
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** 09091214806fa2270a7425521fd948901355db2ec3406597fb5e29141b40639b
|
||||
**Content Hash:** 4d82738b8e1db6b6421b7234b0d302c35aa25aed707ab2cfb0798e2613e41abd
|
||||
File diff suppressed because one or more lines are too long
@@ -16,16 +16,36 @@ FallbackProvider
|
||||
----------------
|
||||
|
||||
|
||||
Explain...
|
||||
The **FallbackProvider** is the most advanced [Provider](../provider) available in
|
||||
ethers.
|
||||
|
||||
It uses a quorum and connects to multiple [Providers](../provider) as backends,
|
||||
each configured with a *priority* and a *weight* .
|
||||
|
||||
When a request is made, the request is dispatched to multiple backends, randomly
|
||||
choosen (higher prioirty backends are always selected first) and the results from
|
||||
each are compared against the others. Only once the quorum has been reached will that
|
||||
result be accepted and returned to the caller.
|
||||
|
||||
By default the quorum requires 50% (rounded up) of the backends to agree. The *weight*
|
||||
can be used to give a backend Provider more influence.
|
||||
|
||||
|
||||
### Properties
|
||||
#### **new** *ethers* . *providers* . **FallbackProvider** ( providers [ , quorum ] )
|
||||
|
||||
Creates a new instance of a FallbackProvider connected to *providers*. If
|
||||
quorum is not specified, half of the total sum of the provider weights is
|
||||
used.
|
||||
|
||||
The *providers* can be either an array of [Provider](../provider) or [FallbackProviderConfig](./).
|
||||
If a [Provider](../provider) is provided, the defaults are a priority of 1 and a weight of 1.
|
||||
|
||||
|
||||
|
||||
#### *provider* . **providers** **=>** *Array< [Provider](../provider) >*
|
||||
|
||||
The list of Providers this is connected to.
|
||||
#### *provider* . **providerConfigs** **=>** *Array< [FallbackProviderConfig](./) >*
|
||||
|
||||
The list of Provider Configurations that describe the backends.
|
||||
|
||||
|
||||
|
||||
@@ -38,9 +58,42 @@ resolved. By default this is *half the sum of the weights*.
|
||||
|
||||
|
||||
|
||||
#### *provider* . **weights** **=>** *Array< number >*
|
||||
### FallbackProviderConfig
|
||||
|
||||
The weight each of the Providers adds to a results acceptance.
|
||||
|
||||
|
||||
#### *fallbackProviderConfig* . **provider** **=>** *[Provider](../provider)*
|
||||
|
||||
The provider for this configuration.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *fallbackProviderConfig* . **priority** **=>** *number*
|
||||
|
||||
The priority used for the provider. Higher priorities are favoured over lower
|
||||
priorities. If multiple providers share the same prioirty, they are choosen
|
||||
at random.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *fallbackProviderConfig* . **stallTimeout** **=>** *number*
|
||||
|
||||
The timeout (in ms) after which another [Provider](../provider) will be attempted. This
|
||||
does not affect the current Provider; if it returns a result it is counted
|
||||
as part of the quorum.
|
||||
|
||||
Lower values will result in more network traffic, but may reduce the response
|
||||
time of requests.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *fallbackProviderConfig* . **weight** **=>** *number*
|
||||
|
||||
The weight a response from this provider provides. This can be used if a given
|
||||
[Provider](../provider) is more trusted, for example.
|
||||
|
||||
|
||||
|
||||
@@ -49,9 +102,89 @@ IpcProvider
|
||||
-----------
|
||||
|
||||
|
||||
Explain...
|
||||
The **IpcProvider** allows the JSON-RPC API to be used over a local
|
||||
filename on the file system, exposed by Geth, Parity and other nodes.
|
||||
|
||||
This is only available in *node.js* (as it requires file system access,
|
||||
and may have additional complications due to file permissions. See any
|
||||
related notes on the documentation for the actual node implementation websites.
|
||||
|
||||
|
||||
#### *ipcProvider* . **path** **=>** *string*
|
||||
|
||||
The path this [Provider](../provider) is connected to.
|
||||
|
||||
|
||||
|
||||
|
||||
UrlJsonRpcProvider
|
||||
------------------
|
||||
|
||||
|
||||
This class is intended to be sub-classed and not used directly. It
|
||||
simplifies creating a [Provider](../provider) where a normal [JsonRpcProvider](../jsonrpc-provider)
|
||||
would suffice, with a little extra effort needed to generate the JSON-RPC
|
||||
URL.
|
||||
|
||||
|
||||
#### **new** *ethers* . *providers* . **UrlJsonRpcProvider** ( [ network [ , apiKey ] ] )
|
||||
|
||||
Sub-classes do not need to override this. Instead they should override the
|
||||
static method `getUrl` and optionally `getApiKey`.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *urlJsonRpcProvider* . **apiKey** **=>** *any*
|
||||
|
||||
The value of the apiKey that was returned from `InheritedClass.getApiKey`.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *InheritingClass* . **getApiKey** ( apiKey ) **=>** *any*
|
||||
|
||||
This function should examine the *apiKey* to ensure it is valid and
|
||||
return a (possible modified) value to use in `getUrl`.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *InheritingClass* . **getUrl** ( network , apiKey ) **=>** *string*
|
||||
|
||||
The URL to use for the JsonRpcProvider instance.
|
||||
|
||||
|
||||
|
||||
|
||||
Web3Provider
|
||||
------------
|
||||
|
||||
|
||||
The Web3Provider is meant to ease moving from a [web3.js based](https://github.com/ethereum/web3.js)
|
||||
application to ethers by wraping an existing Web3-compatible (such as a
|
||||
[Web3HttpProvider](https://github.com/ethereum/web3.js/tree/1.x/packages/web3-providers-http)
|
||||
[Web3IpcProvider](https://github.com/ethereum/web3.js/tree/1.x/packages/web3-providers-ipc) or
|
||||
[Web3WsProvider](https://github.com/ethereum/web3.js/tree/1.x/packages/web3-providers-ws))
|
||||
and exposing it as an ethers.js [Provider](../provider) which can then be used with the rest of
|
||||
the library.
|
||||
|
||||
|
||||
#### **new** *ethers* . *providers* . **Web3Provider** ( web3Provider [ , network ] )
|
||||
|
||||
Create a new **Web3Provider**, which wraps an [EIP-1193 Provider]() or
|
||||
Web3Provider-compatible Provider.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *web3Provider* . **provider** **=>** *Web3CompatibleProvider*
|
||||
|
||||
The provider used to create this instance.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** c950a8710b679e9061aa834f8b0366614dcb031270627249acb412813bb5ca94
|
||||
**Content Hash:** 95791f5b36e1becb2e1222424eb25b0b14743670c827dea2041b048e686d2118
|
||||
File diff suppressed because one or more lines are too long
@@ -24,7 +24,7 @@ Returns the balance of *address* as of the *blockTag* block height.
|
||||
|
||||
|
||||
|
||||
#### *provider* . **getCode** ( address [ , blockTag="latest" ] ) **=>** *Promise< [Hexstring](../../utils/bytes) >*
|
||||
#### *provider* . **getCode** ( address [ , blockTag="latest" ] ) **=>** *Promise< string< [DataHexstring](../../utils/bytes) > >*
|
||||
|
||||
Returns the contract code of *address* as of the *blockTag* block height. If there is
|
||||
no contract currently deployed, the result is `0x`.
|
||||
@@ -32,9 +32,9 @@ no contract currently deployed, the result is `0x`.
|
||||
|
||||
|
||||
|
||||
#### *provider* . **getStorageAt** ( address , position [ , blockTag="latest" ] ) **=>** *Promise< [Hexstring](../../utils/bytes) >*
|
||||
#### *provider* . **getStorageAt** ( addr , pos [ , blockTag="latest" ] ) **=>** *Promise< string< [DataHexstring](../../utils/bytes) > >*
|
||||
|
||||
Returns the `Bytes32` value of the *position* at *address*, as of the *blockTag*.
|
||||
Returns the `Bytes32` value of the position *pos* at address *addr*, as of the *blockTag*.
|
||||
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ sent to the network.
|
||||
```javascript
|
||||
// Get the balance for an account...
|
||||
provider.getBalance("ricmoo.firefly.eth");
|
||||
// { Promise: { BigNumber: "3446592266910605872" } }
|
||||
// { Promise: { BigNumber: "2049005886712300740" } }
|
||||
|
||||
// Get the code for a contract...
|
||||
provider.getCode("registrar.firefly.eth");
|
||||
@@ -67,7 +67,7 @@ provider.getStorageAt("registrar.firefly.eth", 0)
|
||||
|
||||
// Get transaction count of an account...
|
||||
provider.getTransactionCount("ricmoo.firefly.eth");
|
||||
// { Promise: 531 }
|
||||
// { Promise: 608 }
|
||||
```
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ forward lookup does not match, `null` is returned.
|
||||
|
||||
|
||||
|
||||
#### *provider* . **resovleName** ( name ) **=>** *Promise< string >*
|
||||
#### *provider* . **resolveName** ( name ) **=>** *Promise< string< [Address](../../utils/address) > >*
|
||||
|
||||
Looks up the address of *name*. If the name is not owned, or
|
||||
does not have a *Resolver* configured, or the *Resolver* does
|
||||
@@ -181,7 +181,7 @@ Transactions Methods
|
||||
|
||||
|
||||
|
||||
#### *provider* . **call** ( transaction [ , blockTag="latest" ] ) **=>** *Promise< [Hexstring](../../utils/bytes) >*
|
||||
#### *provider* . **call** ( transaction [ , blockTag="latest" ] ) **=>** *Promise< string< [Hexstring](../../utils/bytes) > >*
|
||||
|
||||
Returns the result of executing the *transaction*, using *call*. A call
|
||||
does not require any ether, but cannot change any state. This is useful
|
||||
@@ -293,4 +293,4 @@ Returns true if and only if *object* is a Provider.
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** 3058ddf4bd47707a1887377afc48a0dffedfbfbebf06929a92274e266c9dc196
|
||||
**Content Hash:** 87f4f33bb310790874b49a3f2295ecc85bf3249bb7908f81a5324483767add72
|
||||
File diff suppressed because one or more lines are too long
@@ -19,38 +19,166 @@ A **BlockTag** specifies a specific location in the Blockchain.
|
||||
|
||||
* **`"latest"`** -- The most recently mined block
|
||||
* **`"earliest"`** -- Block #0
|
||||
* **`"pending"`** -- The block currently being prepared for mining; not all operations support this BlockTag
|
||||
* **`"pending"`** -- The block currently being prepared for mining; not all operations and backends support this BlockTag
|
||||
* ***number*** -- The block at this height
|
||||
* ***a negative number*** -- The block this many blocks ago
|
||||
|
||||
|
||||
### Network
|
||||
### EventType
|
||||
|
||||
|
||||
And **EventType** can be any of the following.
|
||||
|
||||
|
||||
|
||||
* ***string*** -- TODO...
|
||||
* ***Array<string<[DataHexstring](../../utils/bytes)<32>> | Array<string<[DataHexstring](../../utils/bytes)<32>>>>*** -- TODO...
|
||||
* ***[EventFilter](./)*** -- TODO...
|
||||
|
||||
|
||||
Network
|
||||
-------
|
||||
|
||||
|
||||
A **Network** represents an Etherem network.
|
||||
|
||||
|
||||
#### *network* . **name** **=>** *string*
|
||||
|
||||
* **name** -- The human-readable name of the network
|
||||
* **chainId** -- The Chain ID of the network
|
||||
* **ensAddress** -- The address at which the ENS registry is deployed
|
||||
|
||||
|
||||
Blocks
|
||||
------
|
||||
The human-readable name of the network, such as `homestead`. If the network
|
||||
name is unknown, this will be `"unknown"`.
|
||||
|
||||
|
||||
|
||||
### Block
|
||||
|
||||
#### *network* . **chainId** **=>** *number*
|
||||
|
||||
The Chain ID of the network.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *network* . **ensAddress** **=>** *string< [Address](../../utils/address) >*
|
||||
|
||||
The address at which the ENS registry is deployed on this network.
|
||||
|
||||
|
||||
|
||||
|
||||
Block
|
||||
-----
|
||||
|
||||
|
||||
|
||||
#### *block* . **hash** **=>** *string< [DataHexstring](../../utils/bytes)< 32 > >*
|
||||
|
||||
The hash of this block.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *block* . **parentHash** **=>** *string< [DataHexstring](../../utils/bytes)< 32 > >*
|
||||
|
||||
The hash of the previous block.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *block* . **number** **=>** *number*
|
||||
|
||||
The height (number) of this block.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *block* . **timestamp** **=>** *number*
|
||||
|
||||
The timestamp of this block.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *block* . **nonce** **=>** *string< [DataHexstring](../../utils/bytes) >*
|
||||
|
||||
The nonce used as part of the proof-of-work to mine this block.
|
||||
|
||||
This property is generally of little interest developers.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *block* . **difficulty** **=>** *number*
|
||||
|
||||
The difficulty target required to be met by the miner of the block.
|
||||
|
||||
This property is generally of little interest developers.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *block* . **gasLimit** **=>** *[BigNumber](../../utils/bignumber)*
|
||||
|
||||
The maximum amount of gas that this block was permitted to use. This
|
||||
is a value that can be voted up or voted down by miners and is used
|
||||
to automatically adjust the bandwidth requirements of the network.
|
||||
|
||||
This property is generally of little interest developers.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *block* . **gasUsed** **=>** *[BigNumber](../../utils/bignumber)*
|
||||
|
||||
The total amount of gas used by all transactions in this block.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *block* . **miner** **=>** *string*
|
||||
|
||||
The coinbase address of this block, which indicates the address the
|
||||
miner that mined this block would like the subsidy reward to go to.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *block* . **extraData** **=>** *string*
|
||||
|
||||
This is extra data a miner may choose to include when mining a block.
|
||||
|
||||
This property is generally of little interest developers.
|
||||
|
||||
|
||||
|
||||
|
||||
### Block (with transaction hashes)
|
||||
|
||||
|
||||
Often only the hashes of the transactions included in a block are needed,
|
||||
so by default a block only contains this information, as it is
|
||||
substantially less data.
|
||||
|
||||
|
||||
#### *block* . **transactions** **=>** *Array< string< [DataHexstring](../../utils/bytes)< 32 > > >*
|
||||
|
||||
A list of the transactions hashes for each transaction this block
|
||||
includes.
|
||||
|
||||
|
||||
TODO
|
||||
|
||||
|
||||
### BlockWithTransactions
|
||||
|
||||
|
||||
TODO
|
||||
If all transactions for a block are needed, this object instead includes
|
||||
the full details on each transaction.
|
||||
|
||||
|
||||
#### *block* . **transactions** **=>** *Array< [TransactionResponse](./) >*
|
||||
|
||||
A list of the transactions this block includes.
|
||||
|
||||
|
||||
|
||||
|
||||
Events and Logs
|
||||
@@ -61,31 +189,127 @@ Events and Logs
|
||||
### EventFilter
|
||||
|
||||
|
||||
TODO
|
||||
|
||||
#### *filter* . **address** **=>** *string< [Address](../../utils/address) >*
|
||||
|
||||
The address to filter by, or `null` to match any address.
|
||||
|
||||
|
||||
### EventType
|
||||
|
||||
|
||||
TODO
|
||||
#### *filter* . **topics** **=>** *Array< string< [DataHexstring](../../utils/bytes)< 32 > >|Array< string< [DataHexstring](../../utils/bytes)< 32 > > > >*
|
||||
|
||||
The topics to filter by, or `null` to match any topics. Each entry represents an
|
||||
**AND** condition that must match, or may be `null` to match anything. If a given
|
||||
entry is an Array, then that entry is treated as an **OR** for any value in the entry.
|
||||
|
||||
|
||||
|
||||
|
||||
### Filter
|
||||
|
||||
|
||||
TODO
|
||||
|
||||
#### *filter* . **fromBlock** **=>** *[BlockTag](./)*
|
||||
|
||||
The starting block (inclusive) to search for logs matching the filter criteria.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *filter* . **toBlock** **=>** *[BlockTag](./)*
|
||||
|
||||
The end block (inclusive) to search for logs matching the filter criteria.
|
||||
|
||||
|
||||
|
||||
|
||||
### FilterByBlockHash
|
||||
|
||||
|
||||
TODO
|
||||
|
||||
#### *filter* . **blockHash** **=>** *string< [DataHexstring](../../utils/bytes)< 32 > >*
|
||||
|
||||
The specific block (by its block hash) to search for logs matching the filter criteria.
|
||||
|
||||
|
||||
|
||||
|
||||
### Log
|
||||
|
||||
|
||||
A network...
|
||||
|
||||
#### *log* . **blockNumber** **=>** *number*
|
||||
|
||||
The block height (number) of the block including the transaction of this log.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *log* . **blockHash** **=>** *string< [DataHexstring](../../utils/bytes)< 32 > >*
|
||||
|
||||
The block hash of the block including the transaction of this log.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *log* . **removed** **=>** *boolean*
|
||||
|
||||
During a re-org, if a transaction is orphaned, this will be set to true
|
||||
to indicate the Log entry has been removed; it will likely be emitted
|
||||
again in the near future when another block is mined with the transaction
|
||||
that triggered this log, but keep in mind the values may change.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *log* . **transactionLogIndex** **=>** *number*
|
||||
|
||||
The index of this log in the transaction.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *log* . **address** **=>** *string< [Address](../../utils/address) >*
|
||||
|
||||
The address of the contract that generated this log.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *log* . **data** **=>** *string< [DataHexstring](../../utils/bytes) >*
|
||||
|
||||
The data included in this log.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *log* . **topics** **=>** *Array< string< [DataHexstring](../../utils/bytes)< 32 > > >*
|
||||
|
||||
The list of topics (indexed properties) for this log.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *log* . **transactionHash** **=>** *string< [DataHexstring](../../utils/bytes)< 32 > >*
|
||||
|
||||
The transaction hash of the transaction of this log.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *log* . **transactionIndex** **=>** *number*
|
||||
|
||||
The index of the transaction in the block of the transaction of this log.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *log* . **logIndex** **=>** *number*
|
||||
|
||||
The index of this log across all logs in the entire **block**.
|
||||
|
||||
|
||||
|
||||
|
||||
Transactions
|
||||
@@ -99,33 +323,263 @@ Transactions
|
||||
A transaction request describes a transaction that is to
|
||||
be sent to the network or otherwise processed.
|
||||
|
||||
It contains the fields:
|
||||
|
||||
* **to** --- target address
|
||||
* **from** --- target address
|
||||
* **nonce** --- target address
|
||||
* **gasLimit** --- target address
|
||||
* **gasPrice** --- target address
|
||||
* **data** --- target address
|
||||
* **value** --- target address
|
||||
* **chainId** --- target address
|
||||
|
||||
All fields are optional and may be a promise which resolves
|
||||
to the required type.
|
||||
|
||||
|
||||
#### *transactionRequest* . **to** **=>** *string|Promise< string >*
|
||||
|
||||
The address (or ENS name) this transaction it to.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *transactionRequest* . **from** **=>** *string< [Address](../../utils/address) >|Promise< string< [Address](../../utils/address) > >*
|
||||
|
||||
The address this transaction is from.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *transactionRequest* . **nonce** **=>** *number|Promise< number >*
|
||||
|
||||
The nonce for this transaction. This should be set to the number of
|
||||
transactions ever sent **from** this address.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *transactionRequest* . **gasLimit** **=>** *[BigNumber](../../utils/bignumber)|Promise< [BigNumber](../../utils/bignumber) >*
|
||||
|
||||
The maximum amount of gas this transaction is permitted to use.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *transactionRequest* . **gasPrice** **=>** *[BigNumber](../../utils/bignumber)|Promise< [BigNumber](../../utils/bignumber) >*
|
||||
|
||||
The price (in wei) per unit of gas this transaction will pay.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *transactionRequest* . **data** **=>** *[DataHexstring](../../utils/bytes)|Promise< [DataHexstring](../../utils/bytes) >*
|
||||
|
||||
The transaction data.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *transactionRequest* . **value** **=>** *[BigNumber](../../utils/bignumber)|Promise< [BigNumber](../../utils/bignumber) >*
|
||||
|
||||
The amount (in wei) this transaction is sending.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *transactionRequest* . **chainId** **=>** *number|Promise< number >*
|
||||
|
||||
The chain ID this transaction is authorized on, as specified by
|
||||
[EIP-155](https://eips.ethereum.org/EIPS/eip-155).
|
||||
|
||||
If the chain ID is 0 will disable EIP-155 and the transaction will be valid
|
||||
on any network. This can be **dangerous** and care should be taken, since it
|
||||
allows transactions to be replayed on networks that were possibly not
|
||||
intended.
|
||||
|
||||
|
||||
|
||||
|
||||
### TransactionResponse
|
||||
|
||||
|
||||
A **TransactionResponse** ..
|
||||
A **TransactionResponse** includes all properties of a [Transaction](../../utils/transactions) as well as several
|
||||
properties that are useful once it has been mined.
|
||||
|
||||
|
||||
#### *transaction* . **blockNumber** **=>** *number*
|
||||
|
||||
The number ("height") of the block this transaction was mined in. If the block has not been mined,
|
||||
this is `null`.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *transaction* . **blockHash** **=>** *string< [DataHexstring](../../utils/bytes)< 32 > >*
|
||||
|
||||
The hash of the block this transaction was mined in. If the block has not been mined,
|
||||
this is `null`.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *transaction* . **timestamp** **=>** *number*
|
||||
|
||||
The timestamp of the block this transaction was mined in. If the block has not been mined,
|
||||
this is `null`.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *transaction* . **confirmations** **=>** *number*
|
||||
|
||||
The number of blocks that have been mined (including the initial block) since this
|
||||
transaction was mined.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *transaction* . **raw** **=>** *string< [DataHexstring](../../utils/bytes) >*
|
||||
|
||||
The serialized transaction.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *transaction* . **wait** ( [ confirmations=1 ] ) **=>** *Promise< [TransactionReceipt](./) >*
|
||||
|
||||
Wait for *confirmations*. If 0, and the transaction has not been mined,
|
||||
`null` is returned.
|
||||
|
||||
|
||||
|
||||
|
||||
### TransactionReceipt
|
||||
|
||||
|
||||
TODO
|
||||
|
||||
#### *receipt* . **to** **=>** *string< [Address](../../utils/address) >*
|
||||
|
||||
The address this transaction is to. This is `null` if the the
|
||||
transaction was an **init transaction**, used to deploy a contract.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *receipt* . **from** **=>** *string< [Address](../../utils/address) >*
|
||||
|
||||
The address this transaction is from.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *receipt* . **contractAddress** **=>** *string< [Address](../../utils/address) >*
|
||||
|
||||
If this transaction has a ``null` to address, it is an **init transaction**
|
||||
used to deploy a contract, in which case this is the address created by that
|
||||
contract.
|
||||
|
||||
To compute a contract address, the [getContractAddress](../../utils/address)
|
||||
utility function can also be used with a [TransactionResponse](./)
|
||||
object, which requires the transaction nonce and the address of the sender.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *receipt* . **transactionIndex** **=>** *number*
|
||||
|
||||
The index of this transaction in the list of transactions included in
|
||||
the block this transaction was mined in.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *receipt* . **root** **=>** *string*
|
||||
|
||||
The intermediate state root of a receipt.
|
||||
|
||||
Only transactions included in blocks **before** the [Byzantium Hard Fork](https://eips.ethereum.org/EIPS/eip-609)
|
||||
have this property, as it was replaced by the `status` property.
|
||||
|
||||
The property is generally of little use to developers. At the time
|
||||
it could be used to verify a state transition with a fraud-proof
|
||||
only considering the single transaction; without it the full block
|
||||
must be considered.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *receipt* . **gasUsed** **=>** *[BigNumber](../../utils/bignumber)*
|
||||
|
||||
The amount of gas actually used by this transaction.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *receipt* . **logsBloom** **=>** *string< [DataHexstring](../../utils/bytes) >*
|
||||
|
||||
A [bloom-filter](https://en.wikipedia.org/wiki/Bloom_filter), which
|
||||
incldues all the addresses and topics included in any log in this
|
||||
transaction.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *receipt* . **blockHash** **=>** *string< [DataHexstring](../../utils/bytes)< 32 > >*
|
||||
|
||||
The block hash of the block that this transaction was included in.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *receipt* . **transactionHash** **=>** *string< [DataHexstring](../../utils/bytes)< 32 > >*
|
||||
|
||||
The transaction hash of this transaction.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *receipt* . **logs** **=>** *Array< [Log](./) >*
|
||||
|
||||
All the logs emitted by this transaction.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *receipt* . **blockNumber** **=>** *number*
|
||||
|
||||
The block height (number) of the block that this transaction was
|
||||
included in.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *receipt* . **confirmations** **=>** *number*
|
||||
|
||||
The number of blocks that have been mined since this transaction,
|
||||
including the actual block it was mined in.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *receipt* . **cumulativeGasUsed** **=>** *[BigNumber](../../utils/bignumber)*
|
||||
|
||||
For the block this transaction was included in, this is the sum of the
|
||||
gas used used by each transaction in the ordered list of transactions
|
||||
up to (and including) this transaction.
|
||||
|
||||
This is generally of little interest to developers.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *receipt* . **byzantium** **=>** *boolean*
|
||||
|
||||
This is true if the block is in a [post-Byzantium Hard Fork](https://eips.ethereum.org/EIPS/eip-609)
|
||||
block.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *receipt* . **status** **=>** *boolean*
|
||||
|
||||
The status of a transaction is 1 is successful or 0 if it was
|
||||
reverted. Only transactions included in blocks [post-Byzantium Hard Fork](https://eips.ethereum.org/EIPS/eip-609)
|
||||
have this property.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** f6d5ea85b1ddef3a5b5bc0745984620507c001cf7d898c7842e006ddcd2b056b
|
||||
**Content Hash:** ef41b33439a40aa374a5af245d4320705c3a647c86f90d9bb8c127503e2477c9
|
||||
File diff suppressed because one or more lines are too long
@@ -9,17 +9,41 @@ Signers
|
||||
=======
|
||||
|
||||
|
||||
Tra la la...
|
||||
A Signer represents...
|
||||
|
||||
|
||||
Signer
|
||||
------
|
||||
|
||||
|
||||
The **Signer** class is abstract and cannot be directly instaniated. Instead
|
||||
use one of the concreate sub-classes, such as the [Wallet](./), [VoidSigner](./)
|
||||
or [JsonRpcSigner](../providers/jsonrpc-provider).
|
||||
|
||||
#### *signer* . **connect** ( provider ) **=>** *Signer*
|
||||
|
||||
TODO
|
||||
#### *signer* . **connect** ( provider ) **=>** *[Signer](./)*
|
||||
|
||||
Sub-classes **must** implement this, however they may simply throw an error
|
||||
if changing providers is not supported.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *signer* . **getAddress** ( ) **=>** *Promise< string< [Address](../utils/address) > >*
|
||||
|
||||
Returns a Promise that resolves to the account address.
|
||||
|
||||
This is a Promise so that a **Signer** can be designed around an
|
||||
asynchronous source, such as hardware wallets.
|
||||
|
||||
Sub-classes **must** implement this.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *Signer* . **isSigner** ( object ) **=>** *boolean*
|
||||
|
||||
Returns true if an only if *object* is a **Signer**.
|
||||
|
||||
|
||||
|
||||
@@ -28,45 +52,313 @@ TODO
|
||||
|
||||
|
||||
|
||||
#### *signer* . **getBalance** ( [ blockTag="latest" ] ) **=>** *Promise(BigNumber)*
|
||||
#### *signer* . **getBalance** ( [ blockTag="latest" ] ) **=>** *Promise< [BigNumber](../utils/bignumber) >*
|
||||
|
||||
TODO
|
||||
Returns the balance of this wallet at *blockTag*.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *signer* . **getTransactionCount** ( [ blockTag="latest" ] ) **=>** *Promise(number)*
|
||||
#### *signer* . **getChainId** ( ) **=>** *Promise< number >*
|
||||
|
||||
TODO
|
||||
Returns ths chain ID this wallet is connected to.
|
||||
|
||||
|
||||
|
||||
|
||||
Wallet inherits Signer
|
||||
----------------------
|
||||
#### *signer* . **getGasPrice** ( ) **=>** *Promise< [BigNumber](../utils/bignumber) >*
|
||||
|
||||
Returns the current gas price.
|
||||
|
||||
|
||||
Wallet is...
|
||||
|
||||
|
||||
### Creating an Instance
|
||||
#### *signer* . **getTransactionCount** ( [ blockTag="latest" ] ) **=>** *Promise< number >*
|
||||
|
||||
Returns the number of transactions this account has ever sent. This
|
||||
is the value required to be included in transactions as the `nonce`.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *signer* . **call** ( transactionRequest ) **=>** *Promise< string< [DataHexstring](../utils/bytes) > >*
|
||||
|
||||
Returns the result of calling using the *transactionRequest*, with this
|
||||
account address being used as the `from` field.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *signer* . **estimateGas** ( transactionRequest ) **=>** *Promise< [BigNumber](../utils/bignumber) >*
|
||||
|
||||
Returns the result of estimating the cost to send the *transactionRequest*,
|
||||
with this account address being used as the `from` field.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *signer* . **resolveName** ( ensName ) **=>** *Promise< string< [Address](../utils/address) > >*
|
||||
|
||||
Returns the address associated with the *ensName*.
|
||||
|
||||
|
||||
|
||||
|
||||
### Signing
|
||||
|
||||
|
||||
|
||||
#### *signer* . **signMessage** ( message ) **=>** *Promise< string< [FlatSignature](../utils/bytes) > >*
|
||||
|
||||
This returns a Promise which resolves to the [Flat-Format Signature](../utils/bytes)
|
||||
of *message*.
|
||||
|
||||
Sub-classes **must** implement this, however they may throw if signing a
|
||||
message is not supported.
|
||||
|
||||
|
||||
|
||||
|
||||
#### Note
|
||||
|
||||
If *message* is a string, it is **treated as a string** and
|
||||
converted to its representation in UTF8 bytes.
|
||||
|
||||
**If and only if** a message is a [Bytes](../utils/bytes) will it be treated as
|
||||
binary data.
|
||||
|
||||
For example, the string `"0x1234"` is 6 characters long (and in
|
||||
this case 6 bytes long). This is **not** equivalent to the array
|
||||
`[ 0x12, 0x34 ]`, which is 2 bytes long.
|
||||
|
||||
A common case is to sign a hash. In this case, if the hash is a
|
||||
string, it **must** be converted to an array first, using the
|
||||
[arrayify](../utils/bytes) utility function.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#### *signer* . **signTransaction** ( transactionRequest ) **=>** *Promise< string< [DataHexstring](../utils/bytes) > >*
|
||||
|
||||
Returns a Promise which resolves to the signed transaction of the
|
||||
*transactionRequest*. This method does not populate any missing fields.
|
||||
|
||||
Sub-classes **must** implement this, however they may throw if signing a
|
||||
transaction is not supported.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *signer* . **sendTransaction** ( transactionRequest ) **=>** *Promise< [TransactionResponse](../providers/types) >*
|
||||
|
||||
This method populates the transactionRequest with missing fields, using
|
||||
[populateTransaction](./) and returns a Promise which resolves to the transaction.
|
||||
|
||||
Sub-classes **must** implement this, however they may throw if signing a
|
||||
transaction is not supported.
|
||||
|
||||
|
||||
|
||||
|
||||
### Sub-Classes
|
||||
|
||||
|
||||
It is very important that all important properties of a **Signer** are
|
||||
**immutable**. Since Ethereum is very asynchronous and deals with critical
|
||||
data (such as ether and other potentially valuable crypto assets), keeping
|
||||
properties such as the *provider* and *address* static helps prevent
|
||||
serious issues.
|
||||
|
||||
A sub-class **must** call `super()`.
|
||||
|
||||
|
||||
#### *signer* . **checkTransaction** ( transactionRequest ) **=>** *[TransactionRequest](../providers/types)*
|
||||
|
||||
This is generally not required to be overridden, but may needed to provide
|
||||
custom behaviour in sub-classes.
|
||||
|
||||
This should return a **copy** of the *transactionRequest*, with any properties
|
||||
needed by `call`, `estimateGas` and `populateTransaction` (which is used
|
||||
by sendTransaction). It should also throw an error if any unknown key is specified.
|
||||
|
||||
The default implementation checks only valid [TransactionRequest](../providers/types) properties
|
||||
exist and adds `from` to the transaction if it does not exist, or verifies it is equal
|
||||
to the Signer's address if it does exist.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *signer* . **populateTransaction** ( transactionRequest ) **=>** *Promise< [TransactionRequest](../providers/types) >*
|
||||
|
||||
This is generally not required to be overridden, but may needed to provide
|
||||
custom behaviour in sub-classes.
|
||||
|
||||
This should return a **copy** of *transactionRequest*, follow the same procedure
|
||||
as `checkTransaction` and fill in any properties required for sending a transaction.
|
||||
The result should have all promises resolved; if needed the [resolveProperties](../utils/properties)
|
||||
utility function can be used for this.
|
||||
|
||||
The default implementation calls `checkTransaction` and resolves to if it is an
|
||||
ENS name, adds `gasPrice`, `nonce`, `gasLimit` and `chainId` based on the
|
||||
related operations on Signer.
|
||||
|
||||
|
||||
|
||||
|
||||
Wallet
|
||||
------
|
||||
|
||||
|
||||
The Wallet class inherits [Signer](./) and can sign transactions and messages
|
||||
using a private key as a standard Externally Owned Account (EOA).
|
||||
|
||||
|
||||
#### **new** *ethers* . **Wallet** ( privateKey [ , provider ] )
|
||||
|
||||
TODO
|
||||
Create a new Wallet instance for *privateKey* and optionally
|
||||
connected to the *provider*.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *Wallet* . **fromEncryptedJson** ( json , password )
|
||||
#### *ethers* . *Wallet* . **createRandom** ( [ options={} ] ) **=>** *[Wallet](./)*
|
||||
|
||||
TODO
|
||||
Returns a new Wallet with a random private key, generated from
|
||||
cryptographically secure entropy sources. If the current environment
|
||||
does not have a secure entropy source, an error is thrown.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *ethers* . *Wallet* . **fromEncryptedJson** ( json , password [ , progress ] ) **=>** *Promise< [Wallet](./) >*
|
||||
|
||||
Create an instance from an encrypted JSON wallet. If *progress*
|
||||
is provided it will be called during decryption with a value between 0 and
|
||||
1 indicating the progress towards completion.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *ethers* . *Wallet* . **fromMnemonic** ( mnemonic [ , path , [ wordlist ] ] ) **=>** *[Wallet](./)*
|
||||
|
||||
Create an instance from a mnemonic phrase.
|
||||
|
||||
If path is not specified, the Ethereum default path is used (i.e. m/44'/60'/0'/0/0).
|
||||
|
||||
If wordlist is not specified, the English Wordlist is used.
|
||||
|
||||
|
||||
|
||||
|
||||
### Properties
|
||||
|
||||
|
||||
|
||||
#### *wallet* . **address** **=>** *string< [Address](../utils/address) >*
|
||||
|
||||
The address for the account this Wallet represents.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *wallet* . **provider** **=>** *[Provider](../providers/provider)*
|
||||
|
||||
The provider this wallet is connected to, which will ge used for any [Blockchain Methods](./)
|
||||
methods. This can be null.
|
||||
|
||||
|
||||
|
||||
|
||||
#### Note
|
||||
|
||||
A **Wallet** instance is immuatable, so if you wish to change the Provider, you
|
||||
may use the [connect](./) method to create a new instance connected
|
||||
to the desired provider.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *wallet* . **publicKey** **=>** *string< [DataHexstring](../utils/bytes)< 65 > >*
|
||||
|
||||
The uncompressed public key for this Wallet represents.
|
||||
|
||||
|
||||
|
||||
|
||||
### Methods
|
||||
|
||||
|
||||
|
||||
#### *wallet* . **encrypt** ( password , [ options={} , [ progress ] ] ) **=>** *Promise< string >*
|
||||
|
||||
Encrypt the wallet using *password* returning a Promise which resolves
|
||||
to a JSON wallet.
|
||||
|
||||
|
||||
|
||||
|
||||
VoidSigner
|
||||
----------
|
||||
|
||||
|
||||
A **VoidSigner** is a simple Signer which cannot sign.
|
||||
|
||||
It is useful as a read-only signer, when an API requires a
|
||||
Signer as a parameter, but it is known only read-only operations
|
||||
will be carried.
|
||||
|
||||
For example, the `call` operation will automatically have the
|
||||
provided address passed along during the execution.
|
||||
|
||||
|
||||
#### **new** *ethers* . **VoidSigner** ( address ) **=>** *[VoidSigner](./)*
|
||||
|
||||
Create a new instance of a **VoidSigner** for *address*.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *voidSigner* . **address** **=>** *string< [Address](../utils/address) >*
|
||||
|
||||
The address of this **VoidSigner**.
|
||||
|
||||
|
||||
|
||||
|
||||
ExternallyOwnedAccount
|
||||
----------------------
|
||||
|
||||
|
||||
|
||||
#### *eoa* . **address** **=>** *string< [Address](../utils/address) >*
|
||||
|
||||
The [Address](../utils/address) of this EOA.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *eoa* . **privateKey** **=>** *string< [DataHexstring](../utils/bytes)< 32 > >*
|
||||
|
||||
The privateKey of this EOA
|
||||
|
||||
|
||||
|
||||
|
||||
#### *eoa* . **mnemonic** **=>** *string*
|
||||
|
||||
*Optional*. The account HD mnemonic, if it has one and can be determined.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *eoa* . **path** **=>** *string*
|
||||
|
||||
*Optional*. The account HD path, if it has one and can be determined.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** 08ec198fa4ab407a1bed0a705073d7f40a6c3969b8e922961939fd8e009ca1ed
|
||||
**Content Hash:** 0d8eb5d3cf69da2ecac958fba6a88d9f4d1aa6c6545354a2b00ccee770832c96
|
||||
File diff suppressed because one or more lines are too long
@@ -14,6 +14,15 @@ are also quite useful for application developers.
|
||||
|
||||
|
||||
* [Addresses](address)
|
||||
* [Address Formats](address)
|
||||
* [Functions](address)
|
||||
* [Application Binary Interface](abi)
|
||||
* [Formats](abi)
|
||||
* [Fragment](abi)
|
||||
* [ConstructorFragment](abi)
|
||||
* [EventFragment](abi)
|
||||
* [FunctionFragment](abi)
|
||||
* [ParamType](abi)
|
||||
* [BigNumber](bignumber)
|
||||
* [Types](bignumber)
|
||||
* [Creating Instances](bignumber)
|
||||
@@ -34,7 +43,7 @@ are also quite useful for application developers.
|
||||
* [Units](display-logic)
|
||||
* [Functions](display-logic)
|
||||
* [FixedNumber](fixednumber)
|
||||
* [Types](fixednumber)
|
||||
* [FixedFormat](fixednumber)
|
||||
* [Creating Instances](fixednumber)
|
||||
* [Properties](fixednumber)
|
||||
* [Methods](fixednumber)
|
||||
@@ -45,8 +54,13 @@ are also quite useful for application developers.
|
||||
* [Strings](strings)
|
||||
* [Bytes32String](strings)
|
||||
* [UTF-8 Strings](strings)
|
||||
* [UnicodeNormalizationForm](strings)
|
||||
* [Custom UTF-8 Error Handling](strings)
|
||||
* [Transactions](transactions)
|
||||
* [Types](transactions)
|
||||
* [Functions](transactions)
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** ae9deb0419f2da1644ae9588d27ecc475961b741fa9d7b27b2cf13ddf62d50b6
|
||||
**Content Hash:** 87e3535244311d1d85bda676c07cc903e6e0fe7d4c7207943dcf2e72bc33e3d9
|
||||
399
docs/api/utils/abi/README.md
Normal file
399
docs/api/utils/abi/README.md
Normal file
@@ -0,0 +1,399 @@
|
||||
-----
|
||||
|
||||
Documentation: [html](https://docs-beta.ethers.io/)
|
||||
|
||||
-----
|
||||
|
||||
|
||||
Application Binary Interface
|
||||
============================
|
||||
|
||||
|
||||
Explain an ABI.
|
||||
|
||||
|
||||
Formats
|
||||
-------
|
||||
|
||||
|
||||
|
||||
### JSON String ABI (Solidity Output JSON)
|
||||
|
||||
|
||||
The **JSON ABI Format** is the format that is
|
||||
[output from the Solidity compiler](https://solidity.readthedocs.io/en/v0.6.0/using-the-compiler.html#output-description).
|
||||
|
||||
A JSON serialized object is always a string, which represents an Array
|
||||
of Objects, where each Object has various properties describing the [Fragment](./) of the ABI.
|
||||
|
||||
The deserialied JSON string (which is a normal JavaScript Object) may
|
||||
also be passed into any function which accepts a JSON String ABI.
|
||||
|
||||
|
||||
### Humanb-Readable ABI
|
||||
|
||||
|
||||
The Human-Readable ABI was
|
||||
|
||||
[article](https://blog.ricmoo.com/human-readable-contract-abis-in-ethers-js-141902f4d917)
|
||||
|
||||
|
||||
### Output Formats
|
||||
|
||||
|
||||
Each [Fragment](./) and [ParamType](./) may be output using its `format`
|
||||
method.
|
||||
|
||||
|
||||
#### *utils* . *FragmentTypes* . **full** **=>** *string*
|
||||
|
||||
This is a full human-readable string, including all parameter names, any
|
||||
optional modifiers (e.g. `indexed`, `public`, etc) and white-space
|
||||
to aid in human readabiliy.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . *FragmentTypes* . **minimal** **=>** *string*
|
||||
|
||||
This is similar to `full`, except with no unnecessary whitespace or parameter
|
||||
names. This is useful for storing a minimal string which can still fully
|
||||
reconstruct the original Fragment using [Fragment . from](./).
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . *FragmentTypes* . **json** **=>** *string*
|
||||
|
||||
This returns a JavaScript Object which is safe to call `JSON.stringify`
|
||||
on to create a JSON string.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . *FragmentTypes* . **sighash** **=>** *string*
|
||||
|
||||
This is a minimal output format, which is used by Solidity when computing a
|
||||
signature hash or an event topic hash.
|
||||
|
||||
|
||||
|
||||
|
||||
#### Note
|
||||
|
||||
The `sighash` format is **insufficient** to re-create the original [Fragment](./),
|
||||
since it discards modifiers such as indexed, anonymous, stateMutability, etc.
|
||||
|
||||
|
||||
|
||||
|
||||
Fragment
|
||||
--------
|
||||
|
||||
|
||||
An ABI is a collection of **Fragments**, where each fragment specifies:
|
||||
|
||||
|
||||
|
||||
* An Event
|
||||
* A Function
|
||||
* A Constructor
|
||||
|
||||
|
||||
### Properties
|
||||
|
||||
|
||||
|
||||
#### *fragment* . **name** **=>** *string*
|
||||
|
||||
This is the name of the Event or Function. This will be null for
|
||||
a [ConstructorFragment](./).
|
||||
|
||||
|
||||
|
||||
|
||||
#### *fragment* . **type** **=>** *string*
|
||||
|
||||
This is a string which indicates the type of the [Fragment](./). This
|
||||
will be one of:
|
||||
|
||||
|
||||
|
||||
* `constructor`
|
||||
* `event`
|
||||
* `function`
|
||||
|
||||
|
||||
|
||||
|
||||
#### *fragment* . **inputs** **=>** *Array< [ParamType](./) >*
|
||||
|
||||
This is an array of of each [ParamType](./) for the input parameters to
|
||||
the Constructor, Event of Function.
|
||||
|
||||
|
||||
|
||||
|
||||
### Methods
|
||||
|
||||
|
||||
|
||||
#### *utils* . *Fragment* . **from** ( objectOrString ) **=>** *[Fragment](./)*
|
||||
|
||||
Returns a
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . *Fragment* . **isFragment** ( object ) **=>** *boolean*
|
||||
|
||||
Tra lal al
|
||||
|
||||
|
||||
|
||||
|
||||
ConstructorFragment
|
||||
-------------------
|
||||
|
||||
|
||||
|
||||
### Properties
|
||||
|
||||
|
||||
|
||||
#### *fragment* . **gas** **=>** *[BigNumber](../bignumber)*
|
||||
|
||||
This is the gas limit that should be used during deployment. It may be
|
||||
null.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *fragment* . **payable** **=>** *boolean*
|
||||
|
||||
This is whether the constructor may receive ether during deployment as
|
||||
an endowment (i.e. msg.value != 0).
|
||||
|
||||
|
||||
|
||||
|
||||
#### *fragment* . **stateMutability** **=>** *string*
|
||||
|
||||
This is the state mutability of the constructor. It can be any of:
|
||||
|
||||
|
||||
|
||||
* `nonpayable`
|
||||
* `payable`
|
||||
|
||||
|
||||
|
||||
|
||||
### Methods
|
||||
|
||||
|
||||
|
||||
#### *utils* . *ConstructorFragment* . **from** ( objectOrString ) **=>** *[ConstructorFragment](./)*
|
||||
|
||||
Tra la la...
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . *ConstructorFragment* . **isConstructorFragment** ( object ) **=>** *boolean*
|
||||
|
||||
Tra lal al
|
||||
|
||||
|
||||
|
||||
|
||||
EventFragment
|
||||
-------------
|
||||
|
||||
|
||||
|
||||
### Properties
|
||||
|
||||
|
||||
|
||||
#### *fragment* . **anonymous** **=>** *boolean*
|
||||
|
||||
This is whether the event is anonymous. An anonymous Event does not inject its
|
||||
topic hash as topic0 when creating a log.
|
||||
|
||||
|
||||
|
||||
|
||||
### Methods
|
||||
|
||||
|
||||
|
||||
#### *utils* . *EventFragment* . **from** ( objectOrString ) **=>** *[EventFragment](./)*
|
||||
|
||||
Tra la la...
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . *EventFragment* . **isEventFragment** ( object ) **=>** *boolean*
|
||||
|
||||
Tra lal al
|
||||
|
||||
|
||||
|
||||
|
||||
FunctionFragment
|
||||
----------------
|
||||
|
||||
|
||||
|
||||
### Properties
|
||||
|
||||
|
||||
|
||||
#### *fragment* . **constant** **=>** *boolean*
|
||||
|
||||
This is whether the function is constant (i.e. does not change state). This
|
||||
is true if the state mutability is `pure` or `view`.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *fragment* . **stateMutability** **=>** *string*
|
||||
|
||||
This is the state mutability of the constructor. It can be any of:
|
||||
|
||||
|
||||
|
||||
* `nonpayable`
|
||||
* `payable`
|
||||
* `pure`
|
||||
* `view`
|
||||
|
||||
|
||||
|
||||
|
||||
#### *fragment* . **outputs** **=>** *Array< [ParamType](./) >*
|
||||
|
||||
A list of the Function output parameters.
|
||||
|
||||
|
||||
|
||||
|
||||
### Method
|
||||
|
||||
|
||||
|
||||
#### *utils* . *FunctionFragment* . **from** ( objectOrString ) **=>** *[FunctionFragment](./)*
|
||||
|
||||
Tra la la...
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . *FunctionFragment* . **isFunctionFragment** ( object ) **=>** *boolean*
|
||||
|
||||
Tra lal al
|
||||
|
||||
|
||||
|
||||
|
||||
ParamType
|
||||
---------
|
||||
|
||||
|
||||
The following examples will represent the Solidity parameter:
|
||||
|
||||
`string foobar`
|
||||
|
||||
|
||||
### Properties
|
||||
|
||||
|
||||
|
||||
#### *paramType* . **name** **=>** *string*
|
||||
|
||||
The local parameter name. This may be null for unnamed parameters. For example,
|
||||
the parameter definition `string foobar` would be `foobar`.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *paramType* . **type** **=>** *string*
|
||||
|
||||
The full type of the parameter, including tuple and array symbols. This may be null
|
||||
for unnamed parameters. For the above example, this would be `foobar`.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *paramType* . **basetype** **=>** *string*
|
||||
|
||||
The base type of the parameter. For primitive types (e.g. `address`, `uint256`, etc)
|
||||
this is equal to [type](./). For arrays, it will be the string `array` and for
|
||||
a tuple, it will be the string `tuple`.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *paramType* . **indexed** **=>** *boolean*
|
||||
|
||||
Whether the parameter has been marked as indexed. This **only** applies
|
||||
to parameters which are part of an [EventFragment](./).
|
||||
|
||||
|
||||
|
||||
|
||||
#### *paramType* . **arrayChildren** **=>** *[ParamType](./)*
|
||||
|
||||
The type of children of the array. This is null for for any parameter
|
||||
wjhich is not an array.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *paramType* . **arrayLength** **=>** *number*
|
||||
|
||||
The length of the array, or `-1` for dynamic-length arrays. This is
|
||||
null for parameters which is not arrays.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *paramType* . **components** **=>** *Array< [ParamType](./) >*
|
||||
|
||||
The components of a tuple. This is null for non-tuple parameters.
|
||||
|
||||
|
||||
|
||||
|
||||
### Methods
|
||||
|
||||
|
||||
Tra la la...
|
||||
|
||||
|
||||
#### *paramType* . **format** ( [ outputType="sighash" ] )
|
||||
|
||||
Tra la la...
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . *ParamType* . **from** ( objectOrString ) **=>** *[ParamType](./)*
|
||||
|
||||
Tra la la...
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . *ParamType* . **isParamType** ( object ) **=>** *boolean*
|
||||
|
||||
Tra la la...
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** cae7aa26d26d5f02ebe0f227e25759db5d2437b4104d2950b364ced87e7c83f6
|
||||
74
docs/api/utils/abi/index.html
Normal file
74
docs/api/utils/abi/index.html
Normal file
File diff suppressed because one or more lines are too long
@@ -11,41 +11,96 @@ Addresses
|
||||
|
||||
Explain addresses,formats and checksumming here.
|
||||
|
||||
Also see: [Constants.AddressZero](../constants)
|
||||
Also see: [constants.AddressZero](../constants)
|
||||
|
||||
|
||||
### Functions
|
||||
Address Formats
|
||||
---------------
|
||||
|
||||
|
||||
|
||||
#### *utils* . **getAddress** ( address ) **=>** *string*
|
||||
### Address
|
||||
|
||||
TODO
|
||||
|
||||
An **Address** is a [DataHexstring](../bytes) of 20 bytes (40 nibbles), with optional
|
||||
mixed case.
|
||||
|
||||
If the case is mixed, it is a **Checksum Address**, which uses a specific pattern
|
||||
of uppercase and lowercase letters within a given address to reduce the risk
|
||||
of errors introduced from typing an address or cut and paste issues.
|
||||
|
||||
All functions that return an Address will return a Checksum Address.
|
||||
|
||||
|
||||
### ICAP Address
|
||||
|
||||
|
||||
The **ICAP Address Format** was an early attempt to introduce a checksum
|
||||
into Ethereum addresses using the popular banking industry's
|
||||
[IBAN](https://en.wikipedia.org/wiki/International_Bank_Account_Number)
|
||||
format with the country code specified as **XE**.
|
||||
|
||||
Due to the way IBAN encodes address, only addresses that fit into 30 base-36
|
||||
characters are actually compatible, so the format was adapted to support 31
|
||||
base-36 characters which is large enough for a full Ethereum address, however
|
||||
the preferred method was to select a private key whose address has a `0` as
|
||||
the first byte, which allows the address to be formatted as a fully compatibly
|
||||
standard IBAN address with 30 base-36 characters.
|
||||
|
||||
In general this format is no longer widely supported anymore, however any function that
|
||||
accepts an address can receive an ICAP address, and it will be converted internally.
|
||||
|
||||
To convert an address into the ICAP format, see [getIcapAddress](./).
|
||||
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
||||
|
||||
|
||||
#### *utils* . **getAddress** ( address ) **=>** *string< [Address](./) >*
|
||||
|
||||
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*
|
||||
#### *utils* . **getIcapAddress** ( address ) **=>** *string< [IcapAddress](./) >*
|
||||
|
||||
TODO
|
||||
Returns *address* as an [ICAP address](https://github.com/ethereum/wiki/wiki/Inter-exchange-Client-Address-Protocol-%28ICAP%29).
|
||||
Supports the same restrictions as [utils.getAddress](./).
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . **getContractAddress** ( transaction ) **=>** *string*
|
||||
#### *utils* . **getContractAddress** ( transaction ) **=>** *string< [Address](./) >*
|
||||
|
||||
TODO
|
||||
Returns the contract address that would result if *transaction* was
|
||||
used to deploy a contract.
|
||||
|
||||
|
||||
|
||||
|
||||
#### *utils* . **getCreate2Address** ( from , salt , initCodeHash ) **=>** *string< [Address](./) >*
|
||||
|
||||
Returns the contract address that would result from the given
|
||||
[CREATE2](https://eips.ethereum.org/EIPS/eip-1014) call.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-----
|
||||
**Content Hash:** 0e138a3fe39efa87749ebc8290d153f705d26e547a38b7dce5f4d85603264d24
|
||||
**Content Hash:** 7835c97c8afbbdf59c39d32a9d79d86c4e446a2ed6acd6eae1f21c0b190b73c1
|
||||
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user