Compare commits

...

57 Commits

Author SHA1 Message Date
Richard Moore
c031a13368 Added Wrapped Ether and Token transfers to CLI. 2019-08-22 17:06:50 -04:00
Richard Moore
07e15993ba Fixed sendTransaction and use median gas price in FallbackProvider. 2019-08-22 16:51:35 -04:00
Richard Moore
a12d60d722 Port optional Secret Storage wallet address to v5 (#582). 2019-08-22 16:00:53 -04:00
Richard Moore
8745a81b11 Updated flatworm docs output. 2019-08-22 01:52:17 -04:00
Richard Moore
0333a76f4f Added initial flatworm documentation stubs. 2019-08-21 01:53:47 -04:00
Richard Moore
57bf997d33 Updates dist files. 2019-08-21 01:52:13 -04:00
Richard Moore
b7494d8618 Use safe transfer for ENS in CLI. 2019-08-21 01:47:08 -04:00
Richard Moore
b304ec1f00 Fixed quorum-matching logic for FallbackProvider. 2019-08-21 01:45:51 -04:00
Richard Moore
621313d2a6 Added CloudflareProvider (#587). 2019-08-21 01:45:06 -04:00
Richard Moore
724c32e8c0 Added receipt to CALL_EXCEPTION errors. 2019-08-20 14:01:16 -04:00
Richard Moore
db8c46299b Updated dist files. 2019-08-06 19:15:30 -04:00
Richard Moore
edb26b1635 Updated gas estimate failure messaging to include that the tx may simple be causing a revert. 2019-08-06 19:11:56 -04:00
Richard Moore
de4b2a449c Additional sanity checks in ethers-ens. 2019-08-06 19:11:09 -04:00
Richard Moore
9977c9f66a Fix bug in --wait for CLI. 2019-08-06 18:05:44 -04:00
Richard Moore
7dfef463f8 Added content-hash support to ENS CLI. 2019-08-06 02:22:11 -04:00
Richard Moore
2cc51542be Updted dist files. 2019-08-05 14:38:04 -04:00
Richard Moore
226bb63184 Updated dist files. 2019-08-05 14:31:04 -04:00
Richard Moore
19ee2b5160 Using CLI --wait instead of custom Plugin flag. 2019-08-04 19:55:46 -04:00
Richard Moore
7640292ac8 Added --wait as a general flag to CLI. 2019-08-04 19:54:38 -04:00
Richard Moore
31e8e1b052 Added migrate-registrar and transfer to ENS CLI. 2019-08-04 19:22:04 -04:00
Richard Moore
53bd96a9f6 Include data in the CLI dump. 2019-08-04 19:20:38 -04:00
Richard Moore
0e6b810def Better errors on gas estimation failure. 2019-08-04 19:20:03 -04:00
Richard Moore
e6bab2e94f Updated changelog. 2019-08-03 01:30:21 -04:00
Richard Moore
692589db54 Added package name prefix to all _version for Logger. 2019-08-03 01:27:20 -04:00
Richard Moore
3ba45ff064 Updated dist files. 2019-08-03 01:07:19 -04:00
Richard Moore
1cabce7e1c Fixed old references to errors package. 2019-08-03 01:05:39 -04:00
Richard Moore
b21681a7f4 Added generation scripts for Table A.1 for stringprep (#42). 2019-08-03 00:54:39 -04:00
Richard Moore
8a45687a5b Updated dist files. 2019-08-03 00:46:00 -04:00
Richard Moore
f955dca417 Fixed some case-folding and added Table A.1 for IDNA (#42). 2019-08-03 00:43:22 -04:00
Richard Moore
c09de16347 Removed references to legacy errors pacakge and updated umbrella pacakge. 2019-08-02 02:32:32 -04:00
Richard Moore
226c100c72 Updated admin module to use new fetchJson. 2019-08-02 02:11:22 -04:00
Richard Moore
8354c3f9fe Updated dist files. 2019-08-02 02:10:58 -04:00
Richard Moore
0af95f4a65 Full case-folding for IDNA in namehash. 2019-08-02 01:58:42 -04:00
Richard Moore
0b224e8fb5 Deprecating errors for logger. 2019-08-01 18:04:06 -04:00
Richard Moore
e8f28b55d7 More consistent debug events for Providers. 2019-08-01 16:13:35 -04:00
Richard Moore
638d1fe62e Updated dist files. 2019-07-27 19:02:24 -03:00
Richard Moore
c3c65b2fa1 Initial drop of new ENS CLI tool. 2019-07-27 18:53:19 -03:00
Richard Moore
6de4a5d8a9 Added TypeScript tool support for functions with multiple outputs. 2019-07-27 18:51:39 -03:00
Richard Moore
b67b121239 Added CLI support for stand-alone (no sub-command) tools. 2019-07-27 18:51:05 -03:00
Richard Moore
74dbc281ed Make utils.resolveProperties preserve object parameter order. 2019-07-27 18:45:51 -03:00
Richard Moore
28eb38ee70 Added initial IDNA support for full UTF-8 support in namehash (#42). 2019-07-27 18:44:53 -03:00
Richard Moore
47663ca26b Updated dist files. 2019-07-23 01:04:32 -03:00
Richard Moore
99c7b1ca94 Use the CLI solc instead of solc directly for ABI testcase generation. 2019-07-23 01:01:00 -03:00
Richard Moore
b132e32172 Added experimental UTF-8 functions for escaping non-ascii strings. 2019-07-23 00:58:07 -03:00
Richard Moore
600524842e Bump Solidity version in CLI to 0.5.10. 2019-07-23 00:49:01 -03:00
Richard Moore
a62af37b23 Updated dist files. 2019-07-20 21:06:45 -03:00
Richard Moore
efaafb203f Keep extra filter topics when using Frgment filters in Contracts. 2019-07-20 21:03:53 -03:00
Richard Moore
d88ee45937 Updated package.json description for Contract package (#561). 2019-07-20 20:16:57 -03:00
Richard Moore
46149cfe16 Updated dist files. 2019-07-20 20:13:00 -03:00
Richard Moore
083fd76a3a Export provider.Formatter (#562). 2019-07-20 20:09:49 -03:00
Richard Moore
9a4119910b Update CLI to use new Fragment.format style. 2019-07-20 20:03:50 -03:00
Richard Moore
a05027c744 Added FormatTypes to utils. 2019-07-20 19:57:21 -03:00
Richard Moore
5877418de9 Added experimental memory-hard password scheme for password-protected mnemonics to the CLI. 2019-07-20 19:56:43 -03:00
Richard Moore
e9558c8d4f Added more flexible output options to fragment.format (JSON and minimal) and better JSON object parsing. 2019-07-20 19:53:07 -03:00
Richard Moore
0a24a86d89 Updated dist files. 2019-07-09 17:30:10 -04:00
Richard Moore
e4423b7a27 Make mnemonic phrases case agnostic (#557). 2019-07-09 17:25:10 -04:00
Richard Moore
ab5f9e2f82 Updated dist filels. 2019-07-02 16:13:03 -04:00
441 changed files with 27129 additions and 3326 deletions

1
.gitignore vendored
View File

@@ -5,6 +5,7 @@ obsolete/
dist/types/shims/
shims/*.d.ts
**/*.swp
*~
# Weird intermediate files tsc generates for references
**/src.ts/*.js

View File

@@ -3,6 +3,96 @@ Changelog
This change log is managed by `scripts/cmds/update-versions` but may be manually updated.
ethers/v5.0.0-beta.154 (2019-08-21 01:51)
-----------------------------------------
- Use safe transfer for ENS in CLI. ([b7494d8](https://github.com/ethers-io/ethers.js/commit/b7494d8618001797a4e856f3d1886273897e6ba4))
- Fixed quorum-matching logic for FallbackProvider. ([b304ec1](https://github.com/ethers-io/ethers.js/commit/b304ec1f008ec5301c0dbd1a493d790fe3528512))
- Added CloudflareProvider. ([#587](https://github.com/ethers-io/ethers.js/issues/587); [621313d](https://github.com/ethers-io/ethers.js/commit/621313d2a697bc6e1dd25eb5b08d67e832a28d05))
- Added receipt to CALL_EXCEPTION errors. ([724c32e](https://github.com/ethers-io/ethers.js/commit/724c32e8c08b55404594f263e52babb0550a15b8))
ethers/v5.0.0-beta.153 (2019-08-06 19:15)
-----------------------------------------
- Updated gas estimate failure messaging to include that the tx may simple be causing a revert. ([edb26b1](https://github.com/ethers-io/ethers.js/commit/edb26b16354afd707e5d03e174c4cc809b951c4f))
- Additional sanity checks in ethers-ens. ([de4b2a4](https://github.com/ethers-io/ethers.js/commit/de4b2a449ca3a49807c8bedb3e21e8e8d71e63fc))
- Fix bug in --wait for CLI. ([9977c9f](https://github.com/ethers-io/ethers.js/commit/9977c9f66a7007dcc1963128c88c584b6b6c064b))
- Added content-hash support to ENS CLI. ([7dfef46](https://github.com/ethers-io/ethers.js/commit/7dfef463f83a9190d1b89cf81e0fb692da3dd813))
ethers/v5.0.0-beta.152 (2019-08-05 14:37)
-----------------------------------------
- Using CLI --wait instead of custom Plugin flag for ethers-ens. ([19ee2b5](https://github.com/ethers-io/ethers.js/commit/19ee2b516005b2c35b846f19457ec9bbfa0c283b))
- Added --wait as a general flag to CLI. ([7640292](https://github.com/ethers-io/ethers.js/commit/7640292ac8b7b9e6de3ad6699d23e2debf26cc1b))
- Added migrate-registrar and transfer to ENS CLI. ([31e8e1b](https://github.com/ethers-io/ethers.js/commit/31e8e1b0520bc8be390fbf7e2b473c36a8649eb3))
- Include data in the CLI transaction dump. ([53bd96a](https://github.com/ethers-io/ethers.js/commit/53bd96a9f675233906033290f1e0c71ca4e9d389))
- Better errors on gas estimation failure. ([0e6b810](https://github.com/ethers-io/ethers.js/commit/0e6b810def390309240508a99b2cf0736848dedd))
ethers/v5.0.0-beta.151 (2019-08-05 14:29)
-----------------------------------------
- Added package name prefix to all _version for Logger. ([692589d](https://github.com/ethers-io/ethers.js/commit/692589db54cbca10a2a453e9a1801a8612056559))
ethers/v5.0.0-beta.150 (2019-08-03 01:07)
-----------------------------------------
- Fixed old references to errors package. ([1cabce7](https://github.com/ethers-io/ethers.js/commit/1cabce7e1c23b15cc2b630c0b403dd72d815a5ba))
- Added generation scripts for Table A.1 for stringprep. ([#42](https://github.com/ethers-io/ethers.js/issues/42); [b21681a](https://github.com/ethers-io/ethers.js/commit/b21681a7f4292b0e77315caad3a59fe814e9292b))
ethers/v5.0.0-beta.149 (2019-08-03 00:45)
-----------------------------------------
- Fixed some case-folding and added Table A.1 for IDNA. ([#42](https://github.com/ethers-io/ethers.js/issues/42); [f955dca](https://github.com/ethers-io/ethers.js/commit/f955dca417a6f86690cf33a81b08baa99e1b1a5c))
- Removed references to legacy errors pacakge and updated umbrella pacakge. ([c09de16](https://github.com/ethers-io/ethers.js/commit/c09de163473c361cac11ddef9ec852f4cbb7d8e3))
- Updated admin module to use new fetchJson. ([226c100](https://github.com/ethers-io/ethers.js/commit/226c100c72c3fcb0c0e3b62be5f579fd9cc4c904))
- Updated dist files. ([8354c3f](https://github.com/ethers-io/ethers.js/commit/8354c3f9fe5487f21acaaeccd4450d9a5d495bc1))
- Full case-folding for IDNA in namehash. ([0af95f4](https://github.com/ethers-io/ethers.js/commit/0af95f4a655106e67c2ba8f445af88c9e9e24339))
- Deprecating errors for logger. ([0b224e8](https://github.com/ethers-io/ethers.js/commit/0b224e8fb5811cd06727063c909ca1e1e5cde57e))
- More consistent debug events for Providers. ([e8f28b5](https://github.com/ethers-io/ethers.js/commit/e8f28b55d7dd62e29f03628232ffe7c75dc811b5))
ethers/v5.0.0-beta.148 (2019-07-27 18:56)
-----------------------------------------
- Initial drop of new ENS CLI tool. ([c3c65b2](https://github.com/ethers-io/ethers.js/commit/c3c65b2fa19e117d6433c2e0b3d20decfe506c74))
- Added TypeScript tool support for functions with multiple outputs. ([6de4a5d](https://github.com/ethers-io/ethers.js/commit/6de4a5d8a9d114c4c33c58f8a304b60e7370eeff))
- Added CLI support for stand-alone (no sub-command) tools. ([b67b121](https://github.com/ethers-io/ethers.js/commit/b67b12123996f1aaf7cbe3c8648fd85a22d6674e))
- Make utils.resolveProperties preserve object parameter order. ([74dbc28](https://github.com/ethers-io/ethers.js/commit/74dbc281ede042c5eeaa7b45150b215dea860a88))
- Added initial IDNA support for full UTF-8 support in namehash. ([#42](https://github.com/ethers-io/ethers.js/issues/42); [28eb38e](https://github.com/ethers-io/ethers.js/commit/28eb38ee703288aaad9f730b2d93fe3aeea7ada6))
ethers/v5.0.0-beta.147 (2019-07-23 01:04)
-----------------------------------------
- Use the CLI solc instead of solc directly for ABI testcase generation. ([99c7b1c](https://github.com/ethers-io/ethers.js/commit/99c7b1ca94382490b9757fd51375a7ad4259b831))
- Added experimental UTF-8 functions for escaping non-ascii strings. ([b132e32](https://github.com/ethers-io/ethers.js/commit/b132e32172c9d63e59209628dadd5796dd6291c8))
- Bump Solidity version in CLI to 0.5.10. ([6005248](https://github.com/ethers-io/ethers.js/commit/600524842e1a4b857e8428a45c0c7d1baa0624ee))
ethers/v5.0.0-beta.146 (2019-07-20 21:06)
-----------------------------------------
- Keep extra filter topics when using Frgment filters in Contracts. ([efaafb2](https://github.com/ethers-io/ethers.js/commit/efaafb203feaf703de803df7e346652372e9fb75))
- Updated package.json description for Contract package. ([#561](https://github.com/ethers-io/ethers.js/issues/561); [d88ee45](https://github.com/ethers-io/ethers.js/commit/d88ee45937b3484b68f72e3f72ad6c29556c984b))
ethers/v5.0.0-beta.145 (2019-07-20 20:12)
-----------------------------------------
- Export provider.Formatter. ([#562](https://github.com/ethers-io/ethers.js/issues/562); [083fd76](https://github.com/ethers-io/ethers.js/commit/083fd76a3a638ec16d5f9bf652101e5a150c7347))
- Update CLI to use new Fragment.format style. ([9a41199](https://github.com/ethers-io/ethers.js/commit/9a4119910b07d1ad61bafafb38ac18a9dae1d9ed))
- Added FormatTypes to utils. ([a05027c](https://github.com/ethers-io/ethers.js/commit/a05027c744102bbe1be5e13dd89b9c1e64b3b526))
- Added experimental memory-hard password scheme for password-protected mnemonics to the CLI. ([5877418](https://github.com/ethers-io/ethers.js/commit/5877418de94256a69fdf2ad466ba579309b9dee8))
- Added more flexible output options to fragment.format (JSON and minimal) and better JSON object parsing. ([e9558c8](https://github.com/ethers-io/ethers.js/commit/e9558c8d4fe6df889f4d7ba6ac6448aa543ef99d))
ethers/v5.0.0-beta.144 (2019-07-09 17:28)
-----------------------------------------
- Make mnemonic phrases case agnostic. ([#557](https://github.com/ethers-io/ethers.js/issues/557); [e4423b7](https://github.com/ethers-io/ethers.js/commit/e4423b7a277e7e1be1c02d345d4ab1eab484c9b8))
ethers/v5.0.0-beta.143 (2019-07-02 16:12)
-----------------------------------------
- Adding more support for offline signing in the CLI. ([9cc269c](https://github.com/ethers-io/ethers.js/commit/9cc269ceb5d33b2d88542d4bc6771279f729e733))
- Allow providers to prepare their Network object. ([6484908](https://github.com/ethers-io/ethers.js/commit/6484908cb25dd35e5d98b2672dca72ed3f30cbe1))
- Export BIP-44 default path in ethers.utils. ([04bdf45](https://github.com/ethers-io/ethers.js/commit/04bdf456eb07aa72872265e0ee01e3231d2b6cf1))
ethers/v5.0.0-beta.142 (2019-06-28 16:13)
-----------------------------------------

View File

@@ -14,13 +14,13 @@ Installing
**node.js**
```
/home/ricmoo/some_project> npm install --save ethers
/home/ricmoo/some_project> npm install --save ethers@next
```
**browser**
```
<script src="@TODO" type="text/javasctipt">
<script src="https://cdn.ethers.io/lib/ethers-5.0.min.js" type="text/javasctipt">
</script>
```
@@ -72,7 +72,7 @@ apps). To do this, run:
```
/home/ethers> npm run update-version
/home/ethers> npm run update-versions
```
Which will also list all packages that have changed along with the specifc files.

View File

@@ -52,6 +52,14 @@ if (process.argv.length > 2) {
// Get local package.json (update the tarballHash)
let info = await updatePackage(dirname);
/*
let info = await updatePackage(dirname, {
repository: {
type: "git",
url: "git://github.com/ethers-io/ethers.js.git"
}
});
*/
// Get the remote package.json (or sub in a placeholder for new pacakges)
let npmInfo = await getPackageVersion(info.name);
@@ -65,7 +73,7 @@ if (process.argv.length > 2) {
// Write out the _version.ts
if (!info._ethers_nobuild) {
let code = "export const version = " + JSON.stringify(newVersion) + ";\n";
let code = "export const version = " + JSON.stringify(dirname + "/" + newVersion) + ";\n";
fs.writeFileSync(resolve(path, "src.ts/_version.ts"), code);
}

View File

@@ -24,7 +24,7 @@ async function getPackage(name) {
cache[name] = result;
return result;
}, (error) => {
if (error.statusCode === 404) {
if (error.status === 404) {
return null;
}
throw error;

16
docs.wrm/README.md Normal file
View File

@@ -0,0 +1,16 @@
Documentation
=============
These docs are built using [Flatworm Docs](https://github.com/ricmoo/flatworm).
The output is placed in [docs](../docs) and generates both HTML and Markdown
files.
Building
--------
```
/home/ricmoo/ethers.js> npm run build-docs
```

View File

@@ -0,0 +1,8 @@
_title: Contracts
_null: Contract @<contract>
_section: Contracts
Explain what contracts are...
_subsection: Buckets

11
docs.wrm/api/index.wrm Normal file
View File

@@ -0,0 +1,11 @@
_title: Application Programming Interface
_section: Application Programming Interface (API)
Here...
_toc:
contract
signer
providers
utils

View File

@@ -0,0 +1,29 @@
_title: API Providers
_section: API Providers
There are many services which offer a web API for accessing
the Ethereum Blockchain. These Providers allow connecting
to them, which simplifies development, since you do not need
to run your own instance or cluster of Ethereum nodes.
However, this reliance on third-party services can reduce
resiliance, security and increase the amount of required trust.
To mitigate these issues, it is recommended you use a
[Default Provider](get-default-provider).
_subsection: EtherscanProvider
Tra la la...
_subsection: InfuraProvider
Tra la la...
_subsection: NodesmithProvider
Tra la la...
_subsection: AlchemyProvider
Tra la la...

View File

@@ -0,0 +1,29 @@
// <hide>
const { ethers } = require("./packages/ethers");
const provider = ethers.getDefaultProvider()
function _inspect(result) {
if (ethers.BigNumber.isBigNumber(result)) {
return `{ BigNumber: ${ JSON.stringify(result.toString()) } }`;
}
return JSON.stringify(result);
}
// </hide>
// Get the balance for an account...
provider.getBalance("ricmoo.firefly.eth");
//!
// Get the code for a contract...
provider.getCode("registrar.firefly.eth");
//!
// Get the storage value at position 0...
provider.getStorageAt("registrar.firefly.eth", 0)
//!
// Get transaction count of an account...
provider.getTransactionCount("ricmoo.firefly.eth");
//!

View File

@@ -0,0 +1,15 @@
// <hide>
const { ethers } = require("./packages/ethers");
const provider = ethers.getDefaultProvider()
// </hide>
// Reverse lookup of an ENS by address...
provider.lookupAddress("0x6fC21092DA55B392b045eD78F4732bff3C580e2c");
//!
// Lookup an address of an ENS name...
provider.resolveName("ricmoo.firefly.eth");
//!

View File

@@ -0,0 +1,46 @@
_title: Providers
_section: Providers
A **Provider** is an abstraction of a connection to the
Ethereum network, providing a concise, consistent interface
to standard Ethereum node functionality.
The ethers.js library provides several options which should
cover the vast majority of use-cases, but also includes the
necessary functions and classes for sub-classing if a more
custom configuration is necessary.
Most users should be able to simply use the [[get-default-provider]].
_subsection: Default Provider @<get-default-provider>
The default provider is the safest, easiest way to begin
developing on //Ethereum//, and it is also robust enough
for use in production.
It creates a [[provider-fallback]] connected to as many backend
services as possible. When a request is made, it is sent to
multiple backends simulatenously. As responses from each backend
are returned, they are checked that they agree. Once a quorum
has been reached (i.e. enough of the backends agree), the response
is provided to your application.
This ensures that if a backend has become out-of-sync, or if it
has been compromised that its responses are dropped in favor of
responses that match the majority.
_property: ethers.getDefaultProvider([ network ]) => [[provider]]
Returns a new Provider, backed by multiple services, connected
to //network//. Is no //network// is provided, **homestead**
(i.e. mainnet) is used.
_subsection: Provider Documentation
_toc:
provider
jsonrpc-provider
api-providers
other
types

View File

@@ -0,0 +1,22 @@
_title: JSON-RPC Provider
_section: JSON-RPC Provider
Explain here...
_subsection: JsonRpcProvider @<jsonrpc-provider>
TODO...
_property: provider.getSigner([ addressOrIndex ]) => [[jsonrpc-signer]]
Returns a [[jsonrpc-signer]] which is managed by this Ethereum node, at
//addressOrIndex//. If no //addressOrIndex// is provided, the first
account (account #0) is used.
_property: provider.getUncheckSigner([ addressOrIndex ]) => [[jsonrpc-uncheckedsigner]]
_subsection: JsonRpcSigner @<jsonrpc-signer>
TODO... Explain
_subsection: JsonRpcUncheckedSigner @<jsonrpc-uncheckedsigner>
TODO... Explain

View File

@@ -0,0 +1,27 @@
_title: Other Providers
_section: Other Providers
Others...
_subsection: FallbackProvider @<provider-fallback>
Explain...
_heading: Properties
_property: provider.providers => Array<[[provider]]>
The list of Providers this is connected to.
_property: provider.quorum => number
The quorum the backend responses must agree upon before a result will be
resolved. By default this is //half the sum of the weights//.
_property: provider.weights => Array<number>
The weight each of the Providers adds to a results acceptance.
_subsection: IpcProvider @<provider-ipc>
Explain...

View File

@@ -0,0 +1,141 @@
_title: Abstract Provider
_section: Provider @<provider>
Explain what a provider is...
_subsection: Accounts Methods
_property: provider.getBalance(address [ , blockTag = "latest" ]) => Promise<[[bignumber]]>
Returns the balance of //address// as of the //blockTag// block height.
_property: provider.getCode(address [ , blockTag = "latest" ]) => Promise<[[hexstring]]>
Returns the contract code of //address// as of the //blockTag// block height. If there is
no contract currently deployed, the result is ``0x``.
_property: provider.getStorageAt(address, position [ , blockTag = "latest" ]) => Promise<[[hexstring]]>
Returns the ``Bytes32`` value of the //position// at //address//, as of the //blockTag//.
_property: provider.getTransactionCount(address [ , blockTag = "latest" ]) => Promise<number>
Returns the number of transactions //address// has ever **sent**, as of //blockTag//.
This value is required to be the nonce for the next transaction from //address//
sent to the network.
_heading: Examples
_code: example-account.js
_subsection: Blocks Methods
_property: provider.getBlock(block) => Promise<[[provider-block]]>
Get the //block// from the network, where the ``result.transactions`` is a list
of transaction hashes.
_property: provider.getBlockWithTransactions(block) => Promise<[[provider-blocktxs]]>
Get the //block// from the network, where the ``result.transactions`` is
an Array of [[provider-transactionresponse]] objects.
_subsection: Ethereum Naming Service (ENS) Methods
TODO: Explain ENS here...
_property: provider.lookupAddress(address) => Promise<string>
Performs a reverse lookup of the //address// in ENS using the
//Reverse Registrar//. If the name does not exist, or the
forward lookup does not match, ``null`` is returned.
_property: provider.resovleName(name) => Promise<string>
Looks up the address of //name//. If the name is not owned, or
does not have a //Resolver// configured, or the //Resolver// does
not have an address configured, ``null`` is returned.
_heading: Examples
_code: example-ens.js
_subsection: Logs Methods
_property: provider.getLogs(filter) => Promise<Array<[[provider-log]]>>
Returns the Array of [[provider-log]] matching the //filter//.
Keep in mind that many backends will discard old events, and that requests
which are too broad may get dropped as they require too many resources to
execute the query.
_subsection: Network Status Methods
_property: provider.getNetwork() => Promise<[[provider-network]]>
Returns the [[provider-network]] this Provider is connected to.
_property: provider.getBlockNumber() => Promise<number>
Returns the block number (or height) of the most recently mined block.
_property: provider.getGasPrice() => Promise<[[bignumber]]>
Returns a //best guess// of the [[gas-price]] to use in a transaction.
_subsection: Transactions Methods
_property: provider.call(transaction [ , blockTag = "latest" ]) => Promise<[[hexstring]]>
Returns the result of executing the //transaction//, using //call//. A call
does not require any ether, but cannot change any state. This is useful
for calling gettings on Contracts.
_property: provider.estimateGas(transaction) => Promise<[[bignumber]]>
Returns an estimate of the amount of gas that would be required to submit //transaction//
to the network.
An estimate may not be accurate since there could be another transaction
on the network that was not accounted for, but after being mined affected
relevant state.
_property: provider.sendTransaction(transaction) => Promise<[[provider-transactionresponse]]>
Submits //transaction// to the network to be mined. The //transaction// **must** be signed,
and be valid (i.e. the nonce is correct and the account has sufficient balance to pay
for the transaction).
_property: provider.waitForTransaction(transactionHash) => Promise<[[provider-transactionreceipt]]>
Returns a Promise which will not resolve until //transactionHash// is mined.
_subsection: Event Emitter Methods
Explain events here...
_property: provider.on(eventName, listener) => this
Add a //listener// to be triggered for each //eventName//.
_property: provider.once(eventName, listener) => this
Add a //listener// to be triggered for only the next //eventName//,
at which time it be removed.
_property: provider.emit(eventName, ...args) => boolean
Notify all listeners of //eventName//, passing //args// to each listener. This
is generally only used internally.
_property: provider.off(eventName [ , listener ]) => this
Remove a //listener// for //eventName//. If no //listener// is provided,
all listeners for //eventName// are removed.
_property: provider.removeAllListeners([ eventName ]) => this
Remove all the listeners for //eventName//. If no //eventName// is provided,
**all** events are removed.
_property: provider.listenerCount([ eventName ]) => number
Returns the number of listeners for //eventName//. If no //eventName// is
provided, the total number of listeners is returned.
_property: provider.listeners(eventName) => Array<Listener>
Returns the list of Listeners for //eventName//.
_subsection: Inspection Methods
_property: Provider.isProvider(object) => boolean
Returns true if and only if //object// is a Provider.

View File

@@ -0,0 +1,75 @@
_title: Types
_section: Types
_heading: BlockTag @<provider-blocktag>
A **BlockTag** specifies a specific location in the Blockchain.
- **``"latest"``** -- The most recently mined block
- **``"earliest"``** -- Block #0
- **``"pending"``** -- The block currently being prepared for mining; not all
operations support this BlockTag
- **//number//** -- The block at this height
- **//a negative number//** -- The block this many blocks ago
_heading: Network @<provider-network>
A **Network** represents an Etherem network.
- **name** -- The human-readable name of the network
- **chainId** -- The Chain ID of the network
- **ensAddress** -- The address at which the ENS registry is deployed
_subsection: Blocks
_heading: Block @<provider-block>
TODO
_heading: BlockWithTransactions @<provider-blocktxs>
TODO
_subsection: Events and Logs
_heading: EventFilter
TODO
_heading: EventType
TODO
_heading: Filter
TODO
_heading: FilterByBlockHash
TODO
_heading: Log @<provider-log>
A network...
_subsection: Transactions
_heading: TransactionRequest @<provider-transactionrequest>
A transaction request describes a transaction that is to
be sent to the network or otherwise processed.
It contains the fields:
- **to** --- target address
- **from** --- target address
- **nonce** --- target address
- **gasLimit** --- target address
- **gasPrice** --- target address
- **data** --- target address
- **value** --- target address
- **chainId** --- target address
All fields are optional and may be a promise which resolves
to the required type.
_heading: TransactionResponse @<provider-transactionresponse>
A **TransactionResponse** ..
_heading: TransactionReceipt @<provider-transactionreceipt>
TODO

32
docs.wrm/api/signer.wrm Normal file
View File

@@ -0,0 +1,32 @@
_title: Signer
_section: Signers
Tra la la...
_subsection: Signer
_property: signer.connect(provider) => Signer
TODO
_heading: Blockchain Methods
_property: signer.getBalance([ blockTag = "latest" ]) => Promise(BigNumber)
TODO
_property: signer.getTransactionCount([ blockTag = "latest" ]) => Promise(number)
TODO
_subsection: Wallet inherits Signer
Wallet is...
_heading: Creating an Instance
_property: new ethers.Wallet(privateKey [ , provider ])
TODO
_property: Wallet.fromEncryptedJson(json, password)
TODO

View File

@@ -0,0 +1,21 @@
_title: Addresses
_section: Addresses
Explain addresses,formats and checksumming here.
Also see: [Constants.AddressZero](constants)
_heading: Functions
_property: utils.getAddress(address) => string
TODO
_property: utils.isAddress(address) => boolean
TODO
_property: utils.getIcapAddress(address) => string
TODO
_property: utils.getContractAddress(transaction) => string
TODO

View File

@@ -0,0 +1,50 @@
// <hide>
const { BigNumber } = require("./packages/ethers");
const { constants } = require("./packages/ethers");
function _inspect(result) {
if (BigNumber.isBigNumber(result)) {
return `{ BigNumber: ${ JSON.stringify(result.toString()) } }`;
}
return result;
}
// </hide>
// From a decimal string...
BigNumber.from("42")
//!
// From a hexstring...
BigNumber.from("0x2a")
//!
// From a negative hexstring...
BigNumber.from("-0x2a")
//!
// From an Array (or Uint8Array)...
BigNumber.from([ 42 ])
//!
// From an existing BigNumber...
let one1 = constants.One;
let one2 = BigNumber.from(one1)
one2
//!
// ...which returns the same instance
one1 === one2
//!
// From a (safe) number...
BigNumber.from(42)
//!
// From a ES2015 BigInt... (only on platforms with BigInt support)
BigNumber.from(42n)
//!
// Numbers outside the safe range fail:
BigNumber.from(Number.MAX_SAFE_INTEGER);
//! error

View File

@@ -0,0 +1,16 @@
// <hide>
const { BigNumber } = require("./packages/ethers");
function _inspect(result) {
if (BigNumber.isBigNumber(result)) {
return `{ BigNumber: ${ JSON.stringify(result.toString()) } }`;
}
return result;
}
// </hide>
let a = BigNumber.from(42);
let b = BigNumber.from("91");
a.mul(b);
//!

View File

@@ -0,0 +1,2 @@
(Number.MAX_SAFE_INTEGER + 2 - 2) == (Number.MAX_SAFE_INTEGER)
//!

View File

@@ -0,0 +1,18 @@
/////
// CommonJS:
// From the Umbrella ethers package...
const { BigNumber } = require("ethers");
// From the bignumber pacakge...
const { BigNumber } = require("@ethersproject/bignumber");
/////
// ES6 and TypeScript:
// From the Umbrella ethers package...
import { BigNumber } from "ethers";
// From the bignumber pacakge...
import { BigNumber } from "@ethersproject/bignumber";

View File

@@ -0,0 +1,175 @@
_title: Big Number
_section: BigNumber @<bignumber>
Explain about BigNumber here...
_heading: Importing
_code: bignumber-import.source
_subsection: Types
_heading: BigNumberish @<bignumberish>
Many functions and methods in this library take in values which
can be non-ambiguously and safely converted to a BigNumber. These
values can be sepcified as:
_definition: **//string//**
A [hexstring](hexstring) or a decimal string, either of which may
be negative.
_definition: **//BytesLike//**
A [BytesLike](byteslike) Object, such as an Array or Uint8Array.
_definition: **//BigNumber//**
An existing BigNumber instance.
_definition: **//number//**
A number that is within the safe range for JavaScript numbers.
_definition: **//BigInt//**
A JavaScript [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt)
object, on environments that support BigInt.
_subsection: Creating Instances
The constructor of BigNumber cannot be called directly. Instead, Use the static ``BigNumber.from``.
_property: BigNumber.from(aBigNumberish) => [[bignumber]]
Returns an instance of a **BigNumber** for //aBigNumberish//.
_heading: Examples:
_code: bignumber-create.js
_subsection: Methods
The BigNumber class is immutable, so no operations can change the value
it represents.
_heading: Math Operations
_property: bignumber.add(otherValue) => [[bignumber]]
Returns a BigNumber with the value of //bignumber// **+** //otherValue//.
_property: bignumber.sub(otherValue) => [[bignumber]]
Returns a BigNumber with the value of //bignumber// **&ndash;** //otherValue//.
_property: bignumber.mul(otherValue) => [[bignumber]]
Returns a BigNumber with the value of //bignumber// **&times;** //otherValue//.
_property: bignumber.div(divisor) => [[bignumber]]
Returns a BigNumber with the value of //bignumber// **&#247;** //divisor//.
_property: bignumber.mod(divisor) => [[bignumber]]
Returns a BigNumber with the value of the **remainder** of //bignumber// &#247; //divisor//.
_property: bignumber.pow(exponent) => [[bignumber]]
Returns a BigNumber with the value of //bignumber// to the power of //exponent//.
_property: bignumber.abs() => [[bignumber]]
Returns a BigNumber with the absolute value of //bignumber//.
_property: bignumber.maskn(bitcount) => [[bignumber]]
Returns a BigNumber with the value of //bignumber// with bits beyond
the //bitcount// least significant bits set to zero.
_heading: Two's Compliment
[Two's Complicment](https://en.wikipedia.org/wiki/Two%27s_complement)
is a method used to encode and decode fixed-width values which can be
positive or negative, without requiring a separate sign bit. Most users
will not need to interact with these.
_property: bignumber.fromTwos(bitwidth) => [[bignumber]]
Returns a BigNumber with the value of //bignumber// converted from twos-compliment with //bitwidth//.
_property: bignumber.toTwos(bitwidth) => [[bignumber]]
Returns a BigNumber with the value of //bignumber// converted to twos-compliment with //bitwidth//.
_heading: Comparison and Equivalence
_property: bignumber.eq(otherValue) => boolean
Returns true if and only if the value of //bignumber// is equal to //otherValue//.
_property: bignumber.lt(otherValue) => boolean
Returns true if and only if the value of //bignumber// **<** //otherValue//.
_property: bignumber.lte(otherValue) => boolean
Returns true if and only if the value of //bignumber// **&le;** //otherValue//.
_property: bignumber.gt(otherValue) => boolean
Returns true if and only if the value of //bignumber// **>** //otherValue//.
_property: bignumber.gte(otherValue) => boolean
Returns true if and only if the value of //bignumber// **&ge;** //otherValue//.
_property: bignumber.isZero() => boolean
Returns true if and only if the value of //bignumber// is zero.
_heading: Conversion
_property: bignumber.toNumber() => number
Returns the value of //bignumber// as a JavaScript value.
This will **throw an error**
if the value is greater than or equal to //Number.MAX_SAFE_INTEGER// or less than or
equal to //Number.MIN_SAFE_INTEGER//.
_property: bignumber.toString() => string
Returns the value of //bignumber// as a base-10 string.
_property: bignumber.toHexString() => string
Returns the value of //bignumber// as a base-16, `0x`-prefixed [hexstring](hexstring).
_heading: Inspection
_property: BigNumnber.isBigNumber(object) => boolean
Returns true if and only if the //object// is a BigNumber object.
_heading: Examples
_code: bignumber-examples.js
_subsection: Notes
A few short notes on numbers...
_heading: Why can't I just use numbers?
The first problem many encounter when dealing with Ethereum is
the concept of numbers. Most common currencies are broken down
with very little granularity. For example, there are only 100
cents in a single dollar. However, there are 10^^18^^ **wei** in a
single **ether**.
JavaScript uses [IEEE 754 double-precision binary floating point](https://en.wikipedia.org/wiki/Double-precision_floating-point_format)
numbers to represent numeric values. As a result, there are //holes//
in the integer set after 9,007,199,254,740,991; which is
problematic for //Ethereum// because that is only around 0.009
ether (in wei), which means any value over that will begin to
experience rounding errors.
To demonstrate how this may be an issue in your code, consider:
_code: bignumber-ieee754.js
To remedy this, all numbers (which can be large) are stored
and manipulated as [Big Numbers](bignumber).
The functions [parseEther( etherString )](http://linkto) and
[formatEther( wei )](http://linkto) can be used to convert
between string representations, which are displayed to or entered
by the user and Big Number representations which can have
mathematical operations handled safely.

View File

@@ -0,0 +1,37 @@
// <hide>
const { ethers } = require("./packages/ethers");
const { arrayify, hexlify, hexValue } = ethers.utils;
function _inspect(result) {
if (result && typeof(result.length) === "number" && typeof(result) !== "string") {
return "[ " + Array.prototype.map.call(result, (i) => _inspect(i)).join(", ") + " ]";
}
return result;
}
// </hide>
// Convert a hexstring to a Uint8Array
arrayify("0x1234")
//!
// Convert an Array to a hexstring
hexlify([1, 2, 3, 4])
//!
// Convert an Object to a hexstring
hexlify({ length: 2, "0": 1, "1": 2 })
//!
// Convert an Array to a hexstring
hexlify([ 1 ])
//!
// Convert a number to a stripped hex value
hexValue(1)
//!
// Convert an Array to a stripped hex value
hexValue([ 1, 2 ])
//!

View File

@@ -0,0 +1,121 @@
_title: Byte Manipulation
_section: Byte Manipulation
Tra la la...
_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
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]].
_heading: Hexstring @<hexstring>
A **hexstring** is a string which has a ``0x`` prefix followed by
_heading: Signature @<signature>
- **r** and **s** --- The x co-ordinate of **r** and the **s** value of the signature
- **v** --- The parity of the y co-ordinate of **r**
- **_vs** --- The [compact representation](https://link_here) of the **(r, s)** and **v**
- **recoveryParam** --- The normalized (i.e. 0 or 1) value of **v**
_heading: SignatureLike @<signaturelike>
A **SignatureLike** is similar to a [[signature]], except redundant properties
may be omitted.
For example, if *_vs* is specified, **(r, s)** and **v** can be omitted. Likewise,
if **recoverParam** is provided, **v** can be omitted (as it can be computed).
_subsection: Inspection
_property: utils.isBytes(object) => boolean
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.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.
_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.hexlify(hexstringOrArrayish) => string
Converts //hexstringOrArrayish// to a [[hexstring]]. The result
will always be zero-padded to even length.
_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.
_heading: Examples
_code: bytes-conversion.js
_subsection: Array Manipulation
_property: utils.concat(arrayOfBytesLike) => Uint8Array
Concatenates all the [[byteslike]] in //arrayOfBytesLike//
into a single Uint8Array.
_property: utils.stripZeros(aBytesLike) => Uint8Array
Concatenates all the [[byteslike]] in //arrayOfBytesLike//
_property: utils.zeroPad(aBytesLike, length) => Uint8Array
Concatenates all the [[byteslike]] in //arrayOfBytesLike//
_subsection: Hexstring Manipulation
_property: utils.hexConcat(arrayOfBytesLike) => string
Concatenates all the [[byteslike]] in //arrayOfBytesLike//
into a single [[hexstring]]
_property: utils.hexDataLength(aBytesLike) => number
Returns the length (in bytes) of //aBytesLike//.
This will **throw and error** if //aBytesLike// is a [[hexstring]]
but is of odd-length.
_property: utils.hexDataSlice(aBytesLike, offset [ , endOffset ] ) => string
Returns the length (in bytes) of //aBytesLike//.
_property: utils.hexStripZeros(aBytesLike) => string
@TODO
_property: utils.hexZeroPad(aBytesLike, length) => string
@TODO
_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.splitSignature(aSignatureLikeOrBytesLike) => Signature
Return the full expanded-format of a [[signaturelike]] or
a flat-format [[hexstring]]. Any missing properties will be
computed.

View File

@@ -0,0 +1,3 @@
//const { constants } = require("ethers");
// const { constants } = require("@ethersproject/constants");

View File

@@ -0,0 +1,49 @@
_title: Constants
_section: Constants @<constants>
The **ethers.contants** Object contains commonly used values.
_heading: Importing
_code: constants-import.js
_subsection: Bytes
_property: constants.AddressZero
The Address Zero, which is 20 bytes (40 nibbles) of zero.
_property: constants.HashZero
The Hash Zero, which is 32 bytes (64 nibbles) of zero.
_subsection: Strings
_property: constants.EtherSymbol
The Ether symbol, **&Xi;**.
_subsection: BigNumber
_property: constants.NegativeOne
The BigNumber value representing ``"-1"``.
_property: constants.Zero
The BigNumber value representing ``"0"``.
_property: constants.One
The BigNumber value representing ``"1"``.
_property: constants.Two
The BigNumber value representing ``"2"``.
_property: constants.WeiPerEther
The BigNumber value representing ``"1000000000000000000"``, which is the
number of Wei per Ether.
_property: constants.MaxUint256
The BigNumber value representing the maximum ``uint256`` value.

View File

@@ -0,0 +1,68 @@
_title: Display Logic and Input
_section: Display Logic and Input
When creating an Application, it is useful to convert between
user-friendly strings (usually displaying **ether**) and the
machine-readable values that contracts and maths depend on
(usually in **wei**).
For example, a Wallet may specify the balance in ether, and
gas prices in gwei for the User Interface, but when sending
a transaction, both must be specified in wei.
The [parseUnits](unit-conversion) will parse a string representing
ether, such as ``1.1`` into a [BigNumber](bignumber) in wei, and is
useful when a user types in a value, such as sending 1.1 ether.
The [formatUnits](unit-conversion) will format a [BigNumberish](bignumberish)
into a string, which is useful when displaying a balance.
_subsection: Units
_heading: Decimal Count
The //unit// specified may be an integer, which indicates how
many decimal place the unit has. For example, 1 ether has 18 decimal
places for wei, and if this library were used with Bitcoin, 1 BTC
has 8 decimal places for satoshis.
_heading: Named Units
In addition to specifying //unit// as a number of decimals, there
are several common units, which can be passed in as a string:
- **wei** --- 0
- **kwei** --- 3
- **mwei** --- 6
- **gwei** --- 9
- **szabo** --- 12
- **finney** --- 15
- **ether** --- 18
_subsection: Functions
_heading: Formatting
_property: utils.commify(value) => string
Returns a string with value grouped by 3 digits, separated by ``,``.
_heading: Conversion @<unit-conversion>
_property: utils.formatUnits(value [ , unit = "ether" ] ) => string
Returns a string representation of //value// formatted with //unit//
digits (if it is a number) or to the unit specified (if a string).
_property: utils.formatEther(value) => string
The equivalent to calling ``formatUnits(value, "ether")``.
_property: utils.parseUnits(value [ , unit = "ether" ] ) => [BigNumber](bignumber)
Returns a [BigNumber](bignumber) representation of //value//, parsed with
//unit// digits (if it is a number) or from the unit specified (if
a string).
_property: utils.parseEther(value) => [BigNumber](bignumber)
The equivalent to calling ``parseUnits(value, "ether")``.

View File

@@ -0,0 +1,80 @@
_title: Fixed Number
_section: FixedNumber @<fixednumber>
_subsection: Types
_heading: FixedFormat @<fixedformat>
TODO
_definition: **//"fixed"//**
A shorthand for ``fixed128x80``.
_subsection: Creating Instances
The FixedNumber constructor cannot be called directly. There are several
static methods for creating a FixedNumber.
_property: BigNumber.from(value [ , format = "fixed" ] ) => [[fixednumber]]
Returns an instance of a **FixedNumber** for //value// as a //format//.
_property: BigNumber.fromBytes(aBytesLike [ , format = "fixed" ] ) => [[fixednumber]]
Returns an instance of a **FixedNumber** for //value// as a //format//.
_property: BigNumber.fromString(value [ , format = "fixed" ] ) => [[fixednumber]]
Returns an instance of a **FixedNumber** for //value// as a //format//. The //value// must
not contain more decimals than the //format// permits.
_property: BigNumber.fromValue(value [ , decimals = 0 [ , format = "fixed" ] ] ) => [[fixednumber]]
Returns an instance of a **FixedNumber** for //value// with //decimals// as a //format//.
_subsection: Properties
_property: fixednumber.format
The [FixedFormat](fixedformat) of //fixednumber//.
_subsection: Methods
_heading: Math Operations
_property: fixednumber.addUnsafe(otherValue) => [[fixednumber]]
Returns a new FixedNumber with the value of //fixedvalue// **+** //otherValue//.
_property: fixednumber.subUnsafe(otherValue) => [[fixednumber]]
Returns a new FixedNumber with the value of //fixedvalue// **&ndash;** //otherValue//.
_property: fixednumber.mulUnsafe(otherValue) => [[fixednumber]]
Returns a new FixedNumber with the value of //fixedvalue// **&times;** //otherValue//.
_property: fixednumber.divUnsafe(otherValue) => [[fixednumber]]
Returns a new FixedNumber with the value of //fixedvalue// **&#247;** //otherValue//.
_property: fixednumber.round([ decimals = 0 ]) => [[fixednumber]]
Returns a new FixedNumber with the value of //fixedvalue// rounded to //decimals//.
_heading: Conversion
_property: fixednumber.toFormat(format) => [[fixednumber]]
Returns a new FixedNumber with the value of //fixedvalue// with //format//.
_property: fixednumber.toHexString() => string
Returns a [Hexstring](hexstring) representation of //fixednumber//.
_property: fixednumber.toString() => string
Returns a string representation of //fixednumber//.
_property: fixednumber.toUnsafeFloat() => float
Returns a floating-point JavaScript number value of //fixednumber//.
Due to rounding in JavaScript numbers, the value is only approximate.
_heading: Inspection
_property: BigNumber.isFixedNumber(value) => boolean
Returns true if and only if //value// is a **FixedNumber**.

View File

@@ -0,0 +1,71 @@
_title: Hashing
_section: Hashing Algorithms
Explain what hash functions are?
_subsection: Cryptographic Hashing
The [Cryptographic Hash Functions](https://en.wikipedia.org/wiki/Cryptographic_hash_function)
are a specific family of hash functions.
_property: utils.keccak256(aBytesLike) => string
Returns the [KECCAK256](https://en.wikipedia.org/wiki/SHA-3) digest //aBytesLike//.
_property: utils.ripemd160(aBytesLike) => string
Returns the [RIPEMD-160](https://en.m.wikipedia.org/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: utils.sha512(aBytesLike) => string
Returns the [SHA2-512](https://en.wikipedia.org/wiki/SHA-2) digest of //aBytesLike//.
_property: utils.computeHmac(algorithm, key, data) => string
Returns the [HMAC](https://en.wikipedia.org/wiki/HMAC) of //data// with //key//
using the [Algorithm](supported-algorithm) //algorithm//.
_heading: HMAC Supported Algorithms @<supported-algorithm>
_property: utils.SupportedAlgorithms.sha256
Use the [SHA2-256](https://en.wikipedia.org/wiki/SHA-2) hash algorithm.
_property: utils.SupportedAlgorithms.sha512
Use the [SHA2-512](https://en.wikipedia.org/wiki/SHA-2) hash algorithm.
_subsection: Common Hashing Helpers
_property: utils.hashMessage(message) => string
Computes the Ethereum message digest of //message//. Ethereum messages are
converted to UTF-8 bytes and prefixed with ``\x19Ethereum Signed Message:``
and the length of //message//.
_property: utils.id(text) => string
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//.
_subsection: Solidity Hashing Algorithms
When using the Solidity ``abi.packEncoded(...)`` function, a non-standard
//tightly packed// version of encoding is used. These functions implement
the tightly packing algorithm.
_property: utils.solidityPack(arrayOfTypes, arrayOfValues) => string
Returns the non-standard encoded //arrayOfValues// packed according to
their respecive type in //arrayOfTypes//.
_property: utils.solidityKeccak256(arrayOfTypes, arrayOfValues) => string
Returns the KECCAK256 of the non-standard encoded //arrayOfValues// packed
according to their respective type in //arrayOfTypes//.
_property: utils.soliditySha256(arrayOfTypes, arrayOfValues) => string
Returns the SHA2-256 of the non-standard encoded //arrayOfValues// packed
according to their respective type in //arrayOfTypes//.

View File

@@ -0,0 +1,16 @@
_title: Utilities
_section: Utilities
These utilities are used extensively within the library, but
are also quite useful for application developers.
_toc:
address
bignumber
bytes
constants
display-logic
fixednumber
hashing
strings

View File

@@ -0,0 +1,92 @@
_title: Strings
_section: Strings
Tra la la
_subsection: Bytes32String @<bytes32-string>
A string in Solidity is length prefixed with its 256-bit (32 byte)
length, which means that even short strings require 2 words (64 bytes)
of storage.
In many cases, we deal with short strings, so instead of prefixing
the string with its length, we can null-terminate it and fit it in a
single word (32 bytes). Since we need only a single byte for the
null termination, we can store strings up to 31 bytes long in a
word.
_definition: **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
Returns the decoded string represented by the ``Bytes32`` encoded data.
_property: utils.formatBytes32String(text) => string
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
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
[[unicode-normalization-form]] //form//.
**Note:** This function correctly splits each user-perceived character into
its codepoint, accounting for surrogate pairs. This should not be confused with
``string.split("")``, which destroys surrogate pairs, spliting between each UTF-16
codeunit instead.
_property: utils.toUtf8String(aBytesLike [ , ignoreErrors = false ] ) => string
Returns the string represented by the UTF-8 bytes of //aBytesLike//. This will
throw an error for invalid surrogates, overlong sequences or other UTF-8 issues,
unless //ignoreErrors// is specified.
_heading: UnicodeNormalizationForm @<unicode-normalization-form>
There are several [commonly used forms](https://en.wikipedia.org/wiki/Unicode_equivalence)
when normalizing UTF-8 data, which allow strings to be compared or hashed in a stable
way.
_property: utils.UnicodeNormalizationForm.current
Maintain the current normalization form.
_property: utils.UnicodeNormalizationForm.NFC
The Composed Normalization Form. This form uses single codepoints
which represent the fully composed character.
For example, the **&eacute;** is a single codepoint, ``0x00e9``.
_property: utils.UnicodeNormalizationForm.NFD
The Decomposed Normalization Form. This form uses multiple codepoints
(when necessary) to compose a character.
For example, the **&eacute;**
is made up of two codepoints, ``"0x0065"`` (which is the letter ``"e"``)
and ``"0x0301"`` which is a special diacritic UTF-8 codepoint which
indicates the previous character should have an acute accent.
_property: utils.UnicodeNormalizationForm.NFKC
The Composed Normalization Form with Canonical Equivalence. The Canonical
representation folds characters which have the same syntactic representation
but different semantic meaning.
For example, the Roman Numeral **I**, which has a UTF-8
codepoint ``"0x2160"``, is folded into the capital letter I, ``"0x0049"``.
_property: utils.UnicodeNormalizationForm.NFKD
The Decomposed Normalization Form with Canonical Equivalence.
See NFKC for more an example.
_definition: **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).

View File

@@ -0,0 +1,5 @@
_title: Events
_section: Events
Explain how topics and such work

13
docs.wrm/concepts/gas.wrm Normal file
View File

@@ -0,0 +1,13 @@
_title: Gas
_section: Gas
_subsection: Gas Price @<gas-price>
The gas price is used somewhat like a bid, indicating an amount
you are willing to pay (per unit of execution) to have your transaction
processed.
_subsection: Gas Limit @<gas-limit>

View File

@@ -0,0 +1,10 @@
_title: Concepts
_section: Concepts
This is a very breif overview of some aspects of //Ethereum//
which developers can make use of or should be aware of.
_toc:
events
gas

9
docs.wrm/config.json Normal file
View File

@@ -0,0 +1,9 @@
{
"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"
}
}

35
docs.wrm/contributing.wrm Normal file
View File

@@ -0,0 +1,35 @@
_title: Contributing and Hacking
_section: Contributing and Hacking
The ethers.js library is something that I've written out of necessity,
and has grown somewhat organically over time.
Many things are the way they are for good (at the time, at least) reasons,
but I always welcome criticism, and am completely willing to have my mind
changed on things.
So, pull requests are always welcome, but please keep a few points in mind:
- Backwards-compatibility-breaking changes will not be accepted; they may be
considered for the next major version
- Security is important; adding dependencies require fairly convincing
arguments as to why
- The library aims to be lean, so keep an eye on the dist/ethers.min.js
file size before and after your changes
- Add test cases for both expected and unexpected input
- Any new features need to be supported by me (future issues, documentation,
testing, migration), so anything that is overly complicated or specific
may not be accepted
In general, **please start an issue //before// beginning a pull request**, so we can
have a public discussion and figure out the best way to address to problem/feature.
**:)**
_subsection: Building
use npm run auto-build
use npm run update-version

View File

@@ -0,0 +1,7 @@
_title: Cookbook
_section: Cookbook
Cooking...

View File

@@ -0,0 +1,23 @@
_section: Hello World @<link-to-this-section>
_subsection: Some Example @<link-to-this-subsection>
_heading: Large Bold Text @<link-to-this-heading>
_definition: Flatworm
A phylum of relatively **simple** bilaterian, unsegmented,
soft-bodied invertebrates.
_property: String.fromCharCode(code) => string
Returns a string created from //code//, a sequence of
UTF-16 code units.
_code: filename.js
_toc:
some-file
some-directory
_null:
This breaks out of a directive. For example, to end a
_definition and reset the indentation.

View File

@@ -0,0 +1,7 @@
_DIRECTIVE: VALUE @<LINK>
BODY
DIRECTIVE: The directive name
VALUE: Optional; the value to pass to the directive
LINK: Optional; a name for internal linking
BODY: Optional; the directive body (certain directives only)

View File

@@ -0,0 +1,85 @@
_title: Flatworm Docs
_section: Flatworm Docs
The //Flatworm Docs// rendering script is designed to be **very**
simple, but provide enough formatting necessary for documenting
JavaScript libraries.
A lot of its inspiration came from [Read the Docs](https://github.com/readthedocs/sphinx_rtd_theme) and
the [Sphinx](https://www.sphinx-doc.org/) project.
_subsection: Fragments
Flatworm Docs are made up of fragments. A fragment is either a lone
body of [markdown](flatworm-markdown) text, or a
[directive](flatworm-directive) for specialized formatting, which may
itself have body.
_heading: Directive Format
_code: fragment.txt
_heading: Flatworm Directives @<flatworm-directive>
_definition: **_section:** //TITLE//
A //section// has its **TITLE** in an H1 font. Sections are linked
to in //Table of Contents// and have a dividing line drawn above
them. If an option is specified, it is avaialble as a name for
intern linking. There should only be one ``_section:`` per page.
_definition: **_subsection:** //TITLE//
A //subsection// has its **TITLE** in an H2 font. Subsections are linked
to in //Table of Contents// and have a dividing line drawn above
them. If an option is specified, it is avaialble as a name for
internal linking.
_definition: **_heading:** //TITLE//
A //heading// has its **TITLE** in an H3 font. If an option is specified,
it is available as a name for internal linking.
_definition: **_definition:** //TERM//
A //definition// has its **TERM** bolded and the markdown body is
indented.
_definition: **_property:** //SIGNATURE//
A //property// has its JavaScript **SIGNATURE** formatted and the
markdown body is indented.
_definition: **_code:** //FILENAME//
A //code// reads the **FILENAME** and depending on the extension
adjusts it.
For JavaScript files, the file is executed, with ``\/\/!`` replaced
with the result of the last statement and ``\/\/!error`` is replaced
with the throw error. If the error state does not agree, rendering
fails.
_definition: **_toc:**
A //toc// injects a Table of Contents, loading each line of the
body as a filename and recursively loads the //toc// if present,
otherwise all the //sections// and //subsections//.
_definition: **_null:**
A //null// is used to terminated a directive. For example, after
a //definition//, the bodies are indented, so a //null// can be
used to reset the indentation.
_heading: Examples
_code: examples.txt
_subsection: Markdown @<flatworm-markdown>
The markdown is simple and does not have the flexibility of
other dialects, but allows for **bold**, //italic//,
__underlined__, ``monospaced``, ^^super-scripted^^ text,
supporting [links](flatworm-markdown) and lists.
_code: markdown.txt

View File

@@ -0,0 +1,23 @@
**bold text**
//italic text//
__underlined text__
``monospace code``
^^superscript text^^
- This is a list
- With bullet points
- With a total of three items
This is separated by -- an en-dash.
This is separated by --- an em-dash.
This is a [Link to Ethereum](https://ethereum.org) and this
is an [Internal Link](some-link).
This is a self-titled link [[https://ethereumorg]] and this
[[some-link]] will use the title from its directives value.

View File

@@ -0,0 +1,32 @@
_title: Getting Started
_section: Getting Started
_subsection: Installing
The various Classes and Functions are available to be imported
manually from sub-packages under the
[@ethersproject](https://www.npmjs.com/search?q=%40ethersproject%2F)
but for most projects, the umbrella package is the easiest way to
get started.
_code: installing.txt
_subsection: Importing
_heading: Node.js
_code: importing-node.source
_heading: Web Browser
It is generally better practice (for security reasons) to copy the
[ethers library](https://cdn.ethers.io/lib/ethers-5.0.min.js) to
your own webserver and serve it yourself.
For quick demos or prototyping though, it can be loaded in your
Web Applications from our CDN.
_code: importing-browser.txt

View File

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

View File

@@ -0,0 +1,5 @@
// CommonJS
const { ethers } = require("ethers");
// ES6 or TypeScript
const { ethers } = require("ethers");

59
docs.wrm/index.wrm Normal file
View File

@@ -0,0 +1,59 @@
_title: Documentation
_section: What is ethers?
The ethers.js library aims to be a complete and compact library for
interacting with the Ethereum Blockchain and its ecosystem. It was
originally designed for use with [ethers.io](https://ethers.io/) and
has since expanded into a much more general-purpose library.
_subsection: Features
- Keep your private keys in your client, **safe** and sound
- Import and export **JSON wallets** (Geth, Parity and crowdsale)
- Import and export BIP 39 **mnemonic phrases** (12 word backup
phrases) and HD Wallets (English, Italian, Japanese, Korean,
Simplified Chinese, Traditional Chinese; more coming soon)
- Meta-classes create JavaScript objects from any contract ABI,
including **ABIv2** and **Human-Readable ABI**
- Connect to Ethereum nodes over
[JSON-RPC](https://github.com/ethereum/wiki/wiki/JSON-RPC),
[INFURA](https://infura.io/),
[Etherscan](https://etherscan.io/),
[Nodesmith](https://nodesmith.io),
[Alchemy](https://alchemyapi.io),
or [MetaMask](https://metamask.io/).
- **ENS names** are first-class citizens; they can be used
anywhere an Ethereum addresses can be used
- **Tiny** (~88kb compressed; 284kb uncompressed)
- **Complete** functionality for all your Ethereum needs
- Extensive [documentation](https://docs.ethers.io/)
- Large collection of **test cases** which are maintained and added to
- Fully **TypeScript** ready, with definition files and full
TypeScript source
- **MIT License** (including //ALL// dependencies); completely open
source to do with as you please
_subsection: Developer Documentation
_toc:
getting-started
concepts
api
cookbook
migration
testing
contributing
documentation
license
_subsection: Legacy Documentation
This section will be kept up to date, linking to documentation of
older versions of the library.
- [version 4.0](https://docs.ethers.io/ethers.js)
- [version 3.0](https://docs.ethers.io/ethers.js/v3.0/html/)

1
docs.wrm/installing.txt Normal file
View File

@@ -0,0 +1 @@
/home/ricmoo> npm install --save ethers@next

32
docs.wrm/license.wrm Normal file
View File

@@ -0,0 +1,32 @@
_title: License and Copyright
_section: License and Copyright
The ethers library (including all dependencies) are available
under the [MIT License](https://en.m.wikipedia.org/wiki/MIT_License),
which permits a wide variety of uses.
_heading: MIT License
//Copyright &copy; 2019 [Richard Moore](mailto:me@ricmoo.com).//
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

12
docs.wrm/logo.svg Normal file
View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 58" style="enable-background:new 0 0 100 58;" xml:space="preserve">
<style type="text/css">
.st0{fill-rule:evenodd;clip-rule:evenodd;fill:#FFFFFF;}
</style>
<path class="st0" d="M94.45,47.18c-42.62,5.57-73.04,12.26-73.49-15.2c0,0,0.93-10.64,13.98-11.31c0,0,0.44-9.45,10.41-10.52
c5.36-0.58,11.45,4.94,12.11,10.75c0,0,13.19-2.44,13.76,10.42c0.2,4.48-0.81,12.1-13.53,11.77c0,0-7.36-1-8.36-12.38
c-2.07,22.03,29.78,20.75,30.24,0.74c0.2-8.65-5.34-17.55-17.82-15.88C54.91-1.64,36.7-0.65,29.92,15.31
c-9.69,0-17.1,7.46-16.99,17.2C13.3,63.86,56.93,54.41,94.45,47.18z"/>
</svg>

After

Width:  |  Height:  |  Size: 853 B

View File

@@ -0,0 +1,13 @@
_title: Migration Guide
_section: Migration Guide
Migratimg...
_subsection: From Web3
test
_subsection: From ethers v4
test

View File

@@ -0,0 +1,5 @@
_title: Testing
_section: Testing
Here goes info about testing

144
docs/README.md Normal file
View File

@@ -0,0 +1,144 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
What is ethers?
===============
The ethers.js library aims to be a complete and compact library for
interacting with the Ethereum Blockchain and its ecosystem. It was
originally designed for use with [ethers.io](https://ethers.io/) and
has since expanded into a much more general-purpose library.
Features
--------
* Keep your private keys in your client, **safe** and sound
* Import and export **JSON wallets** (Geth, Parity and crowdsale)
* Import and export BIP 39 **mnemonic phrases** (12 word backup phrases) and HD Wallets (English, Italian, Japanese, Korean, Simplified Chinese, Traditional Chinese; more coming soon)
* Meta-classes create JavaScript objects from any contract ABI, including **ABIv2** and **Human-Readable ABI**
* Connect to Ethereum nodes over [JSON-RPC](https://github.com/ethereum/wiki/wiki/JSON-RPC), [INFURA](https://infura.io/), [Etherscan](https://etherscan.io/), [Nodesmith](https://nodesmith.io), [Alchemy](https://alchemyapi.io), or [MetaMask](https://metamask.io/).
* **ENS names** are first-class citizens; they can be used anywhere an Ethereum addresses can be used
* **Tiny** (~88kb compressed; 284kb uncompressed)
* **Complete** functionality for all your Ethereum needs
* Extensive [documentation](https://docs.ethers.io/)
* Large collection of **test cases** which are maintained and added to
* Fully **TypeScript** ready, with definition files and full TypeScript source
* **MIT License** (including *ALL* dependencies); completely open source to do with as you please
Developer Documentation
-----------------------
* [Getting Started](getting-started)
* [Installing](getting-started)
* [Importing](getting-started)
* [Concepts](concepts)
* [Events](concepts/events)
* [Gas](concepts/gas)
* [Gas Price](concepts/gas)
* [Gas Limit](concepts/gas)
* [Application Programming Interface](api)
* [Contracts](api/contract)
* [Buckets](api/contract)
* [Signers](api/signer)
* [Signer](api/signer)
* [Wallet inherits Signer](api/signer)
* [Providers](api/providers)
* [Provider](api/providers/provider)
* [Accounts Methods](api/providers/provider)
* [Blocks Methods](api/providers/provider)
* [Ethereum Naming Service (ENS) Methods](api/providers/provider)
* [Logs Methods](api/providers/provider)
* [Network Status Methods](api/providers/provider)
* [Transactions Methods](api/providers/provider)
* [Event Emitter Methods](api/providers/provider)
* [Inspection Methods](api/providers/provider)
* [JSON-RPC Provider](api/providers/jsonrpc-provider)
* [JsonRpcProvider](api/providers/jsonrpc-provider)
* [JsonRpcSigner](api/providers/jsonrpc-provider)
* [JsonRpcUncheckedSigner](api/providers/jsonrpc-provider)
* [API Providers](api/providers/api-providers)
* [EtherscanProvider](api/providers/api-providers)
* [InfuraProvider](api/providers/api-providers)
* [NodesmithProvider](api/providers/api-providers)
* [AlchemyProvider](api/providers/api-providers)
* [Other Providers](api/providers/other)
* [FallbackProvider](api/providers/other)
* [IpcProvider](api/providers/other)
* [Types](api/providers/types)
* [Blocks](api/providers/types)
* [Events and Logs](api/providers/types)
* [Transactions](api/providers/types)
* [Utilities](api/utils)
* [Addresses](api/utils/address)
* [BigNumber](api/utils/bignumber)
* [Types](api/utils/bignumber)
* [Creating Instances](api/utils/bignumber)
* [Methods](api/utils/bignumber)
* [Notes](api/utils/bignumber)
* [Byte Manipulation](api/utils/bytes)
* [Types](api/utils/bytes)
* [Inspection](api/utils/bytes)
* [Converting between Arrays and Hexstrings](api/utils/bytes)
* [Array Manipulation](api/utils/bytes)
* [Hexstring Manipulation](api/utils/bytes)
* [Signature Conversion](api/utils/bytes)
* [Constants](api/utils/constants)
* [Bytes](api/utils/constants)
* [Strings](api/utils/constants)
* [BigNumber](api/utils/constants)
* [Display Logic and Input](api/utils/display-logic)
* [Units](api/utils/display-logic)
* [Functions](api/utils/display-logic)
* [FixedNumber](api/utils/fixednumber)
* [Types](api/utils/fixednumber)
* [Creating Instances](api/utils/fixednumber)
* [Properties](api/utils/fixednumber)
* [Methods](api/utils/fixednumber)
* [Hashing Algorithms](api/utils/hashing)
* [Cryptographic Hashing](api/utils/hashing)
* [Common Hashing Helpers](api/utils/hashing)
* [Solidity Hashing Algorithms](api/utils/hashing)
* [Strings](api/utils/strings)
* [Bytes32String](api/utils/strings)
* [UTF-8 Strings](api/utils/strings)
* [Cookbook](cookbook)
* [Migration Guide](migration)
* [From Web3](migration)
* [From ethers v4](migration)
* [Testing](testing)
* [Contributing and Hacking](contributing)
* [Building](contributing)
* [Flatworm Docs](documentation)
* [Fragments](documentation)
* [Markdown](documentation)
* [License and Copyright](license)
Legacy Documentation
--------------------
This section will be kept up to date, linking to documentation of
older versions of the library.
* [version 4.0](https://docs.ethers.io/ethers.js)
* [version 3.0](https://docs.ethers.io/ethers.js/v3.0/html/)
-----
**Content Hash:** 6abeb4fa3f15b3443d89a26a6b0320f602a12368bc5ebbfb14a6cce682836167

83
docs/api/README.md Normal file
View File

@@ -0,0 +1,83 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Application Programming Interface (API)
=======================================
Here...
* [Contracts](contract)
* [Buckets](contract)
* [Signers](signer)
* [Signer](signer)
* [Wallet inherits Signer](signer)
* [Providers](providers)
* [Provider](providers/provider)
* [Accounts Methods](providers/provider)
* [Blocks Methods](providers/provider)
* [Ethereum Naming Service (ENS) Methods](providers/provider)
* [Logs Methods](providers/provider)
* [Network Status Methods](providers/provider)
* [Transactions Methods](providers/provider)
* [Event Emitter Methods](providers/provider)
* [Inspection Methods](providers/provider)
* [JSON-RPC Provider](providers/jsonrpc-provider)
* [JsonRpcProvider](providers/jsonrpc-provider)
* [JsonRpcSigner](providers/jsonrpc-provider)
* [JsonRpcUncheckedSigner](providers/jsonrpc-provider)
* [API Providers](providers/api-providers)
* [EtherscanProvider](providers/api-providers)
* [InfuraProvider](providers/api-providers)
* [NodesmithProvider](providers/api-providers)
* [AlchemyProvider](providers/api-providers)
* [Other Providers](providers/other)
* [FallbackProvider](providers/other)
* [IpcProvider](providers/other)
* [Types](providers/types)
* [Blocks](providers/types)
* [Events and Logs](providers/types)
* [Transactions](providers/types)
* [Utilities](utils)
* [Addresses](utils/address)
* [BigNumber](utils/bignumber)
* [Types](utils/bignumber)
* [Creating Instances](utils/bignumber)
* [Methods](utils/bignumber)
* [Notes](utils/bignumber)
* [Byte Manipulation](utils/bytes)
* [Types](utils/bytes)
* [Inspection](utils/bytes)
* [Converting between Arrays and Hexstrings](utils/bytes)
* [Array Manipulation](utils/bytes)
* [Hexstring Manipulation](utils/bytes)
* [Signature Conversion](utils/bytes)
* [Constants](utils/constants)
* [Bytes](utils/constants)
* [Strings](utils/constants)
* [BigNumber](utils/constants)
* [Display Logic and Input](utils/display-logic)
* [Units](utils/display-logic)
* [Functions](utils/display-logic)
* [FixedNumber](utils/fixednumber)
* [Types](utils/fixednumber)
* [Creating Instances](utils/fixednumber)
* [Properties](utils/fixednumber)
* [Methods](utils/fixednumber)
* [Hashing Algorithms](utils/hashing)
* [Cryptographic Hashing](utils/hashing)
* [Common Hashing Helpers](utils/hashing)
* [Solidity Hashing Algorithms](utils/hashing)
* [Strings](utils/strings)
* [Bytes32String](utils/strings)
* [UTF-8 Strings](utils/strings)
-----
**Content Hash:** cbd0b8ac4ada4bfee211c0553ac53e171a6900127d874743a0dedf7fa30618f3

View File

@@ -0,0 +1,23 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Contracts
=========
Explain what contracts are...
Buckets
-------
-----
**Content Hash:** 190c93691014eae64ffcb66549f127aa73f4645fc7a4b3a2be9ae00216c79cf6

File diff suppressed because one or more lines are too long

4
docs/api/index.html Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,87 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Providers
=========
A **Provider** is an abstraction of a connection to the
Ethereum network, providing a concise, consistent interface
to standard Ethereum node functionality.
The ethers.js library provides several options which should
cover the vast majority of use-cases, but also includes the
necessary functions and classes for sub-classing if a more
custom configuration is necessary.
Most users should be able to simply use the [Default Provider](./).
Default Provider
----------------
The default provider is the safest, easiest way to begin
developing on *Ethereum*, and it is also robust enough
for use in production.
It creates a [FallbackProvider](other) connected to as many backend
services as possible. When a request is made, it is sent to
multiple backends simulatenously. As responses from each backend
are returned, they are checked that they agree. Once a quorum
has been reached (i.e. enough of the backends agree), the response
is provided to your application.
This ensures that if a backend has become out-of-sync, or if it
has been compromised that its responses are dropped in favor of
responses that match the majority.
#### *ethers* . **getDefaultProvider** ( [ network ] ) **=>** *[Provider](provider)*
Returns a new Provider, backed by multiple services, connected
to *network*. Is no *network* is provided, **homestead**
(i.e. mainnet) is used.
Provider Documentation
----------------------
* [Provider](provider)
* [Accounts Methods](provider)
* [Blocks Methods](provider)
* [Ethereum Naming Service (ENS) Methods](provider)
* [Logs Methods](provider)
* [Network Status Methods](provider)
* [Transactions Methods](provider)
* [Event Emitter Methods](provider)
* [Inspection Methods](provider)
* [JSON-RPC Provider](jsonrpc-provider)
* [JsonRpcProvider](jsonrpc-provider)
* [JsonRpcSigner](jsonrpc-provider)
* [JsonRpcUncheckedSigner](jsonrpc-provider)
* [API Providers](api-providers)
* [EtherscanProvider](api-providers)
* [InfuraProvider](api-providers)
* [NodesmithProvider](api-providers)
* [AlchemyProvider](api-providers)
* [Other Providers](other)
* [FallbackProvider](other)
* [IpcProvider](other)
* [Types](types)
* [Blocks](types)
* [Events and Logs](types)
* [Transactions](types)
-----
**Content Hash:** b15d8a2febb07abbbd784242c47575fbbb097f24643997ce30625c2e88adb095

View File

@@ -0,0 +1,53 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
API Providers
=============
There are many services which offer a web API for accessing
the Ethereum Blockchain. These Providers allow connecting
to them, which simplifies development, since you do not need
to run your own instance or cluster of Ethereum nodes.
However, this reliance on third-party services can reduce
resiliance, security and increase the amount of required trust.
To mitigate these issues, it is recommended you use a
[Default Provider](..).
EtherscanProvider
-----------------
Tra la la...
InfuraProvider
--------------
Tra la la...
NodesmithProvider
-----------------
Tra la la...
AlchemyProvider
---------------
Tra la la...
-----
**Content Hash:** 9669eaaa1c2e9a31256fdd49e1b7f79550f064056b1bfd67a8cef6c7b5f8d473

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,54 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
JSON-RPC Provider
=================
Explain here...
JsonRpcProvider
---------------
TODO...
#### *provider* . **getSigner** ( [ addressOrIndex ] ) **=>** *[JsonRpcSigner](./)*
Returns a [JsonRpcSigner](./) which is managed by this Ethereum node, at
*addressOrIndex*. If no *addressOrIndex* is provided, the first
account (account #0) is used.
#### *provider* . **getUncheckSigner** ( [ addressOrIndex ] ) **=>** *[JsonRpcUncheckedSigner](./)*
JsonRpcSigner
-------------
TODO... Explain
JsonRpcUncheckedSigner
----------------------
TODO... Explain
-----
**Content Hash:** 09091214806fa2270a7425521fd948901355db2ec3406597fb5e29141b40639b

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,57 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Other Providers
===============
Others...
FallbackProvider
----------------
Explain...
### Properties
#### *provider* . **providers** **=>** *Array< [Provider](../provider) >*
The list of Providers this is connected to.
#### *provider* . **quorum** **=>** *number*
The quorum the backend responses must agree upon before a result will be
resolved. By default this is *half the sum of the weights*.
#### *provider* . **weights** **=>** *Array< number >*
The weight each of the Providers adds to a results acceptance.
IpcProvider
-----------
Explain...
-----
**Content Hash:** c950a8710b679e9061aa834f8b0366614dcb031270627249acb412813bb5ca94

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,131 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Types
=====
### BlockTag
A **BlockTag** specifies a specific location in the Blockchain.
* **`"latest"`** -- The most recently mined block
* **`"earliest"`** -- Block #0
* **`"pending"`** -- The block currently being prepared for mining; not all operations support this BlockTag
* ***number*** -- The block at this height
* ***a negative number*** -- The block this many blocks ago
### Network
A **Network** represents an Etherem network.
* **name** -- The human-readable name of the network
* **chainId** -- The Chain ID of the network
* **ensAddress** -- The address at which the ENS registry is deployed
Blocks
------
### Block
TODO
### BlockWithTransactions
TODO
Events and Logs
---------------
### EventFilter
TODO
### EventType
TODO
### Filter
TODO
### FilterByBlockHash
TODO
### Log
A network...
Transactions
------------
### TransactionRequest
A transaction request describes a transaction that is to
be sent to the network or otherwise processed.
It contains the fields:
* **to** --- target address
* **from** --- target address
* **nonce** --- target address
* **gasLimit** --- target address
* **gasPrice** --- target address
* **data** --- target address
* **value** --- target address
* **chainId** --- target address
All fields are optional and may be a promise which resolves
to the required type.
### TransactionResponse
A **TransactionResponse** ..
### TransactionReceipt
TODO
-----
**Content Hash:** f6d5ea85b1ddef3a5b5bc0745984620507c001cf7d898c7842e006ddcd2b056b

File diff suppressed because one or more lines are too long

72
docs/api/signer/README.md Normal file
View File

@@ -0,0 +1,72 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Signers
=======
Tra la la...
Signer
------
#### *signer* . **connect** ( provider ) **=>** *Signer*
TODO
### Blockchain Methods
#### *signer* . **getBalance** ( [ blockTag="latest" ] ) **=>** *Promise(BigNumber)*
TODO
#### *signer* . **getTransactionCount** ( [ blockTag="latest" ] ) **=>** *Promise(number)*
TODO
Wallet inherits Signer
----------------------
Wallet is...
### Creating an Instance
#### **new** *ethers* . **Wallet** ( privateKey [ , provider ] )
TODO
#### *Wallet* . **fromEncryptedJson** ( json , password )
TODO
-----
**Content Hash:** 08ec198fa4ab407a1bed0a705073d7f40a6c3969b8e922961939fd8e009ca1ed

File diff suppressed because one or more lines are too long

52
docs/api/utils/README.md Normal file
View File

@@ -0,0 +1,52 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Utilities
=========
These utilities are used extensively within the library, but
are also quite useful for application developers.
* [Addresses](address)
* [BigNumber](bignumber)
* [Types](bignumber)
* [Creating Instances](bignumber)
* [Methods](bignumber)
* [Notes](bignumber)
* [Byte Manipulation](bytes)
* [Types](bytes)
* [Inspection](bytes)
* [Converting between Arrays and Hexstrings](bytes)
* [Array Manipulation](bytes)
* [Hexstring Manipulation](bytes)
* [Signature Conversion](bytes)
* [Constants](constants)
* [Bytes](constants)
* [Strings](constants)
* [BigNumber](constants)
* [Display Logic and Input](display-logic)
* [Units](display-logic)
* [Functions](display-logic)
* [FixedNumber](fixednumber)
* [Types](fixednumber)
* [Creating Instances](fixednumber)
* [Properties](fixednumber)
* [Methods](fixednumber)
* [Hashing Algorithms](hashing)
* [Cryptographic Hashing](hashing)
* [Common Hashing Helpers](hashing)
* [Solidity Hashing Algorithms](hashing)
* [Strings](strings)
* [Bytes32String](strings)
* [UTF-8 Strings](strings)
-----
**Content Hash:** ae9deb0419f2da1644ae9588d27ecc475961b741fa9d7b27b2cf13ddf62d50b6

View File

@@ -0,0 +1,51 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Addresses
=========
Explain addresses,formats and checksumming here.
Also see: [Constants.AddressZero](../constants)
### Functions
#### *utils* . **getAddress** ( address ) **=>** *string*
TODO
#### *utils* . **isAddress** ( address ) **=>** *boolean*
TODO
#### *utils* . **getIcapAddress** ( address ) **=>** *string*
TODO
#### *utils* . **getContractAddress** ( transaction ) **=>** *string*
TODO
-----
**Content Hash:** 0e138a3fe39efa87749ebc8290d153f705d26e547a38b7dce5f4d85603264d24

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,389 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
BigNumber
=========
Explain about BigNumber here...
### Importing
```
/////
// CommonJS:
// From the Umbrella ethers package...
const { BigNumber } = require("ethers");
// From the bignumber pacakge...
const { BigNumber } = require("@ethersproject/bignumber");
/////
// ES6 and TypeScript:
// From the Umbrella ethers package...
import { BigNumber } from "ethers";
// From the bignumber pacakge...
import { BigNumber } from "@ethersproject/bignumber";
```
Types
-----
### BigNumberish
Many functions and methods in this library take in values which
can be non-ambiguously and safely converted to a BigNumber. These
values can be sepcified as:
#### ***string***
A [hexstring](../bytes) or a decimal string, either of which may
be negative.
#### ***BytesLike***
A [BytesLike](../bytes) Object, such as an Array or Uint8Array.
#### ***BigNumber***
An existing BigNumber instance.
#### ***number***
A number that is within the safe range for JavaScript numbers.
#### ***BigInt***
A JavaScript [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt)
object, on environments that support BigInt.
Creating Instances
------------------
The constructor of BigNumber cannot be called directly. Instead, Use the static `BigNumber.from`.
#### *BigNumber* . **from** ( aBigNumberish ) **=>** *[BigNumber](./)*
Returns an instance of a **BigNumber** for *aBigNumberish*.
### Examples:
```javascript
// From a decimal string...
BigNumber.from("42")
// { BigNumber: "42" }
// From a hexstring...
BigNumber.from("0x2a")
// { BigNumber: "42" }
// From a negative hexstring...
BigNumber.from("-0x2a")
// { BigNumber: "-42" }
// From an Array (or Uint8Array)...
BigNumber.from([ 42 ])
// { BigNumber: "42" }
// From an existing BigNumber...
let one1 = constants.One;
let one2 = BigNumber.from(one1)
one2
// { BigNumber: "1" }
// ...which returns the same instance
one1 === one2
// true
// From a (safe) number...
BigNumber.from(42)
// { BigNumber: "42" }
// From a ES2015 BigInt... (only on platforms with BigInt support)
BigNumber.from(42n)
// { BigNumber: "42" }
// Numbers outside the safe range fail:
BigNumber.from(Number.MAX_SAFE_INTEGER);
// Error: overflow (fault="overflow", operation="BigNumber.from", value=9007199254740991, version=bignumber/5.0.0-beta.129)
```
Methods
-------
The BigNumber class is immutable, so no operations can change the value
it represents.
### Math Operations
#### *bignumber* . **add** ( otherValue ) **=>** *[BigNumber](./)*
Returns a BigNumber with the value of *bignumber* **+** *otherValue*.
#### *bignumber* . **sub** ( otherValue ) **=>** *[BigNumber](./)*
Returns a BigNumber with the value of *bignumber* **&ndash;** *otherValue*.
#### *bignumber* . **mul** ( otherValue ) **=>** *[BigNumber](./)*
Returns a BigNumber with the value of *bignumber* **&times;** *otherValue*.
#### *bignumber* . **div** ( divisor ) **=>** *[BigNumber](./)*
Returns a BigNumber with the value of *bignumber* **&#247;** *divisor*.
#### *bignumber* . **mod** ( divisor ) **=>** *[BigNumber](./)*
Returns a BigNumber with the value of the **remainder** of *bignumber* &#247; *divisor*.
#### *bignumber* . **pow** ( exponent ) **=>** *[BigNumber](./)*
Returns a BigNumber with the value of *bignumber* to the power of *exponent*.
#### *bignumber* . **abs** ( ) **=>** *[BigNumber](./)*
Returns a BigNumber with the absolute value of *bignumber*.
#### *bignumber* . **maskn** ( bitcount ) **=>** *[BigNumber](./)*
Returns a BigNumber with the value of *bignumber* with bits beyond
the *bitcount* least significant bits set to zero.
### Two's Compliment
[Two's Complicment](https://en.wikipedia.org/wiki/Two%27s_complement)
is a method used to encode and decode fixed-width values which can be
positive or negative, without requiring a separate sign bit. Most users
will not need to interact with these.
#### *bignumber* . **fromTwos** ( bitwidth ) **=>** *[BigNumber](./)*
Returns a BigNumber with the value of *bignumber* converted from twos-compliment with *bitwidth*.
#### *bignumber* . **toTwos** ( bitwidth ) **=>** *[BigNumber](./)*
Returns a BigNumber with the value of *bignumber* converted to twos-compliment with *bitwidth*.
### Comparison and Equivalence
#### *bignumber* . **eq** ( otherValue ) **=>** *boolean*
Returns true if and only if the value of *bignumber* is equal to *otherValue*.
#### *bignumber* . **lt** ( otherValue ) **=>** *boolean*
Returns true if and only if the value of *bignumber* **<** *otherValue*.
#### *bignumber* . **lte** ( otherValue ) **=>** *boolean*
Returns true if and only if the value of *bignumber* **&le;** *otherValue*.
#### *bignumber* . **gt** ( otherValue ) **=>** *boolean*
Returns true if and only if the value of *bignumber* **>** *otherValue*.
#### *bignumber* . **gte** ( otherValue ) **=>** *boolean*
Returns true if and only if the value of *bignumber* **&ge;** *otherValue*.
#### *bignumber* . **isZero** ( ) **=>** *boolean*
Returns true if and only if the value of *bignumber* is zero.
### Conversion
#### *bignumber* . **toNumber** ( ) **=>** *number*
Returns the value of *bignumber* as a JavaScript value.
This will **throw an error**
if the value is greater than or equal to *Number.MAX_SAFE_INTEGER* or less than or
equal to *Number.MIN_SAFE_INTEGER*.
#### *bignumber* . **toString** ( ) **=>** *string*
Returns the value of *bignumber* as a base-10 string.
#### *bignumber* . **toHexString** ( ) **=>** *string*
Returns the value of *bignumber* as a base-16, `0x`-prefixed [hexstring](../bytes).
### Inspection
#### *BigNumnber* . **isBigNumber** ( object ) **=>** *boolean*
Returns true if and only if the *object* is a BigNumber object.
### Examples
```javascript
let a = BigNumber.from(42);
let b = BigNumber.from("91");
a.mul(b);
// { BigNumber: "3822" }
```
Notes
-----
A few short notes on numbers...
### Why can't I just use numbers?
The first problem many encounter when dealing with Ethereum is
the concept of numbers. Most common currencies are broken down
with very little granularity. For example, there are only 100
cents in a single dollar. However, there are 10^18 **wei** in a
single **ether**.
JavaScript uses [IEEE 754 double-precision binary floating point](https://en.wikipedia.org/wiki/Double-precision_floating-point_format)
numbers to represent numeric values. As a result, there are *holes*
in the integer set after 9,007,199,254,740,991; which is
problematic for *Ethereum* because that is only around 0.009
ether (in wei), which means any value over that will begin to
experience rounding errors.
To demonstrate how this may be an issue in your code, consider:
```javascript
(Number.MAX_SAFE_INTEGER + 2 - 2) == (Number.MAX_SAFE_INTEGER)
// false
```
To remedy this, all numbers (which can be large) are stored
and manipulated as [Big Numbers](./).
The functions [parseEther( etherString )](http://linkto) and
[formatEther( wei )](http://linkto) can be used to convert
between string representations, which are displayed to or entered
by the user and Big Number representations which can have
mathematical operations handled safely.
-----
**Content Hash:** 269c8464ff80c77316617cbfa4e9a195d742f829a23911fecf0bba16961f81ae

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,249 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Byte Manipulation
=================
Tra la la...
Types
-----
### 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
each value in the valid byte range (i.e. between 0 and 255 inclusive),
or is an Object with a `length` property where each indexed property
is in the valid byte range.
### BytesLike
A **BytesLike** can be either a [Bytes](./) or a [Hexstring](./).
### Hexstring
A **hexstring** is a string which has a `0x` prefix followed by
### Signature
* **r** and **s** --- The x co-ordinate of **r** and the **s** value of the signature
* **v** --- The parity of the y co-ordinate of **r**
* **_vs** --- The [compact representation](https://link_here) of the **(r, s)** and **v**
* **recoveryParam** --- The normalized (i.e. 0 or 1) value of **v**
### SignatureLike
A **SignatureLike** is similar to a [Signature](./), except redundant properties
may be omitted.
For example, if *_vs* is specified, **(r, s)** and **v** can be omitted. Likewise,
if **recoverParam** is provided, **v** can be omitted (as it can be computed).
Inspection
----------
#### *utils* . **isBytes** ( object ) **=>** *boolean*
Returns true if and only if *object* is a valid [Bytes](./).
#### *utils* . **isBytesLike** ( object ) **=>** *boolean*
Returns true if and only if *object* is a [Bytes](./) or an Array or TypedArray
where each value is a valid byte (i.e. between 0 and 255 inclusive).
#### *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.
Converting between Arrays and Hexstrings
----------------------------------------
#### *utils* . **arrayify** ( hexstringOrArrayish [ , options ] ) **=>** *Uint8Array*
Converts *hexstringOrArrayish* to a Uint8Array. If a [Hexstring](./)
is passed in, the length must be even.
#### *utils* . **hexlify** ( hexstringOrArrayish ) **=>** *string*
Converts *hexstringOrArrayish* to a [Hexstring](./). The result
will always be zero-padded to even length.
#### *utils* . **hexValue** ( aBigNumberish ) **=>** *string*
Converts *aBigNumberish* to a [Hexstring](./), with no unecessary leading
zeros. The result of this function can be of odd-length.
### Examples
```javascript
// Convert a hexstring to a Uint8Array
arrayify("0x1234")
// [ 18, 52 ]
// Convert an Array to a hexstring
hexlify([1, 2, 3, 4])
// 0x01020304
// Convert an Object to a hexstring
hexlify({ length: 2, "0": 1, "1": 2 })
// 0x0102
// Convert an Array to a hexstring
hexlify([ 1 ])
// 0x01
// Convert a number to a stripped hex value
hexValue(1)
// 0x1
// Convert an Array to a stripped hex value
hexValue([ 1, 2 ])
// 0x102
```
Array Manipulation
------------------
#### *utils* . **concat** ( arrayOfBytesLike ) **=>** *Uint8Array*
Concatenates all the [BytesLike](./) in *arrayOfBytesLike*
into a single Uint8Array.
#### *utils* . **stripZeros** ( aBytesLike ) **=>** *Uint8Array*
Concatenates all the [BytesLike](./) in *arrayOfBytesLike*
#### *utils* . **zeroPad** ( aBytesLike , length ) **=>** *Uint8Array*
Concatenates all the [BytesLike](./) in *arrayOfBytesLike*
Hexstring Manipulation
----------------------
#### *utils* . **hexConcat** ( arrayOfBytesLike ) **=>** *string*
Concatenates all the [BytesLike](./) in *arrayOfBytesLike*
into a single [Hexstring](./)
#### *utils* . **hexDataLength** ( aBytesLike ) **=>** *number*
Returns the length (in bytes) of *aBytesLike*.
This will **throw and error** if *aBytesLike* is a [Hexstring](./)
but is of odd-length.
#### *utils* . **hexDataSlice** ( aBytesLike , offset [ , endOffset ] ) **=>** *string*
Returns the length (in bytes) of *aBytesLike*.
#### *utils* . **hexStripZeros** ( aBytesLike ) **=>** *string*
@TODO
#### *utils* . **hexZeroPad** ( aBytesLike , length ) **=>** *string*
@TODO
Signature Conversion
--------------------
#### *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.
#### *utils* . **splitSignature** ( aSignatureLikeOrBytesLike ) **=>** *Signature*
Return the full expanded-format of a [SignatureLike](./) or
a flat-format [Hexstring](./). Any missing properties will be
computed.
-----
**Content Hash:** 1e52066c61f8794d858f02fb8164b146c9379968b0e0ab90efeb2fe16831599f

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,107 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Constants
=========
The **ethers.contants** Object contains commonly used values.
### Importing
```javascript
//const { constants } = require("ethers");
// const { constants } = require("@ethersproject/constants");
```
Bytes
-----
#### *constants* . **AddressZero**
The Address Zero, which is 20 bytes (40 nibbles) of zero.
#### *constants* . **HashZero**
The Hash Zero, which is 32 bytes (64 nibbles) of zero.
Strings
-------
#### *constants* . **EtherSymbol**
The Ether symbol, **&Xi;**.
BigNumber
---------
#### *constants* . **NegativeOne**
The BigNumber value representing `"-1"`.
#### *constants* . **Zero**
The BigNumber value representing `"0"`.
#### *constants* . **One**
The BigNumber value representing `"1"`.
#### *constants* . **Two**
The BigNumber value representing `"2"`.
#### *constants* . **WeiPerEther**
The BigNumber value representing `"1000000000000000000"`, which is the
number of Wei per Ether.
#### *constants* . **MaxUint256**
The BigNumber value representing the maximum `uint256` value.
-----
**Content Hash:** a781a8990aec282632e70ebc003a711adf5bc7773243aed727fc37a0934097f7

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,113 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Display Logic and Input
=======================
When creating an Application, it is useful to convert between
user-friendly strings (usually displaying **ether**) and the
machine-readable values that contracts and maths depend on
(usually in **wei**).
For example, a Wallet may specify the balance in ether, and
gas prices in gwei for the User Interface, but when sending
a transaction, both must be specified in wei.
The [parseUnits](./) will parse a string representing
ether, such as `1.1` into a [BigNumber](../bignumber) in wei, and is
useful when a user types in a value, such as sending 1.1 ether.
The [formatUnits](./) will format a [BigNumberish](../bignumber)
into a string, which is useful when displaying a balance.
Units
-----
### Decimal Count
The *unit* specified may be an integer, which indicates how
many decimal place the unit has. For example, 1 ether has 18 decimal
places for wei, and if this library were used with Bitcoin, 1 BTC
has 8 decimal places for satoshis.
### Named Units
In addition to specifying *unit* as a number of decimals, there
are several common units, which can be passed in as a string:
* **wei** --- 0
* **kwei** --- 3
* **mwei** --- 6
* **gwei** --- 9
* **szabo** --- 12
* **finney** --- 15
* **ether** --- 18
Functions
---------
### Formatting
#### *utils* . **commify** ( value ) **=>** *string*
Returns a string with value grouped by 3 digits, separated by `,`.
### Conversion
#### *utils* . **formatUnits** ( value [ , unit="ether" ] ) **=>** *string*
Returns a string representation of *value* formatted with *unit*
digits (if it is a number) or to the unit specified (if a string).
#### *utils* . **formatEther** ( value ) **=>** *string*
The equivalent to calling `formatUnits(value, "ether")`.
#### *utils* . **parseUnits** ( value [ , unit="ether" ] ) **=>** *[BigNumber](../bignumber)*
Returns a [BigNumber](../bignumber) representation of *value*, parsed with
*unit* digits (if it is a number) or from the unit specified (if
a string).
#### *utils* . **parseEther** ( value ) **=>** *[BigNumber](../bignumber)*
The equivalent to calling `parseUnits(value, "ether")`.
-----
**Content Hash:** 172c3345092afd2abb6a47dc225ae54c13c3ee3ce87868dd87e19656f4e6078d

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,170 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
FixedNumber
===========
Types
-----
### FixedFormat
TODO
#### ***"fixed"***
A shorthand for `fixed128x80`.
Creating Instances
------------------
The FixedNumber constructor cannot be called directly. There are several
static methods for creating a FixedNumber.
#### *BigNumber* . **from** ( value [ , format="fixed" ] ) **=>** *[FixedNumber](./)*
Returns an instance of a **FixedNumber** for *value* as a *format*.
#### *BigNumber* . **fromBytes** ( aBytesLike [ , format="fixed" ] ) **=>** *[FixedNumber](./)*
Returns an instance of a **FixedNumber** for *value* as a *format*.
#### *BigNumber* . **fromString** ( value [ , format="fixed" ] ) **=>** *[FixedNumber](./)*
Returns an instance of a **FixedNumber** for *value* as a *format*. The *value* must
not contain more decimals than the *format* permits.
#### *BigNumber* . **fromValue** ( value [ , decimals=0 [ , format="fixed" ] ] ) **=>** *[FixedNumber](./)*
Returns an instance of a **FixedNumber** for *value* with *decimals* as a *format*.
Properties
----------
#### *fixednumber* . **format**
The [FixedFormat](./) of *fixednumber*.
Methods
-------
### Math Operations
#### *fixednumber* . **addUnsafe** ( otherValue ) **=>** *[FixedNumber](./)*
Returns a new FixedNumber with the value of *fixedvalue* **+** *otherValue*.
#### *fixednumber* . **subUnsafe** ( otherValue ) **=>** *[FixedNumber](./)*
Returns a new FixedNumber with the value of *fixedvalue* **&ndash;** *otherValue*.
#### *fixednumber* . **mulUnsafe** ( otherValue ) **=>** *[FixedNumber](./)*
Returns a new FixedNumber with the value of *fixedvalue* **&times;** *otherValue*.
#### *fixednumber* . **divUnsafe** ( otherValue ) **=>** *[FixedNumber](./)*
Returns a new FixedNumber with the value of *fixedvalue* **&#247;** *otherValue*.
#### *fixednumber* . **round** ( [ decimals=0 ] ) **=>** *[FixedNumber](./)*
Returns a new FixedNumber with the value of *fixedvalue* rounded to *decimals*.
### Conversion
#### *fixednumber* . **toFormat** ( format ) **=>** *[FixedNumber](./)*
Returns a new FixedNumber with the value of *fixedvalue* with *format*.
#### *fixednumber* . **toHexString** ( ) **=>** *string*
Returns a [Hexstring](../bytes) representation of *fixednumber*.
#### *fixednumber* . **toString** ( ) **=>** *string*
Returns a string representation of *fixednumber*.
#### *fixednumber* . **toUnsafeFloat** ( ) **=>** *float*
Returns a floating-point JavaScript number value of *fixednumber*.
Due to rounding in JavaScript numbers, the value is only approximate.
### Inspection
#### *BigNumber* . **isFixedNumber** ( value ) **=>** *boolean*
Returns true if and only if *value* is a **FixedNumber**.
-----
**Content Hash:** e58731f51c5fe088aa89a78c7649ec914dce2d65dac9c1de3c4b3a89c911b46b

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,140 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Hashing Algorithms
==================
Explain what hash functions are?
Cryptographic Hashing
---------------------
The [Cryptographic Hash Functions](https://en.wikipedia.org/wiki/Cryptographic_hash_function)
are a specific family of hash functions.
#### *utils* . **keccak256** ( aBytesLike ) **=>** *string*
Returns the [KECCAK256](https://en.wikipedia.org/wiki/SHA-3) digest *aBytesLike*.
#### *utils* . **ripemd160** ( aBytesLike ) **=>** *string*
Returns the [RIPEMD-160](https://en.m.wikipedia.org/wiki/RIPEMD) digest of *aBytesLike*.
#### *utils* . **sha256** ( aBytesLike ) **=>** *string*
Returns the [SHA2-256](https://en.wikipedia.org/wiki/SHA-2) digest of *aBytesLike*.
#### *utils* . **sha512** ( aBytesLike ) **=>** *string*
Returns the [SHA2-512](https://en.wikipedia.org/wiki/SHA-2) digest of *aBytesLike*.
#### *utils* . **computeHmac** ( algorithm , key , data ) **=>** *string*
Returns the [HMAC](https://en.wikipedia.org/wiki/HMAC) of *data* with *key*
using the [Algorithm](./) *algorithm*.
### HMAC Supported Algorithms
#### *utils* . *SupportedAlgorithms* . **sha256**
Use the [SHA2-256](https://en.wikipedia.org/wiki/SHA-2) hash algorithm.
#### *utils* . *SupportedAlgorithms* . **sha512**
Use the [SHA2-512](https://en.wikipedia.org/wiki/SHA-2) hash algorithm.
Common Hashing Helpers
----------------------
#### *utils* . **hashMessage** ( message ) **=>** *string*
Computes the Ethereum message digest of *message*. Ethereum messages are
converted to UTF-8 bytes and prefixed with `x19Ethereum Signed Message:`
and the length of *message*.
#### *utils* . **id** ( text ) **=>** *string*
The Ethereum Identity function computs the keccak256 hash of the *text* bytes.
#### *utils* . **namehash** ( name ) **=>** *string*
Returns the [ENS Namehash](https://docs.ens.domains/contract-api-reference/name-processing#hashing-names) of *name*.
Solidity Hashing Algorithms
---------------------------
When using the Solidity `abi.packEncoded(...)` function, a non-standard
*tightly packed* version of encoding is used. These functions implement
the tightly packing algorithm.
#### *utils* . **solidityPack** ( arrayOfTypes , arrayOfValues ) **=>** *string*
Returns the non-standard encoded *arrayOfValues* packed according to
their respecive type in *arrayOfTypes*.
#### *utils* . **solidityKeccak256** ( arrayOfTypes , arrayOfValues ) **=>** *string*
Returns the KECCAK256 of the non-standard encoded *arrayOfValues* packed
according to their respective type in *arrayOfTypes*.
#### *utils* . **soliditySha256** ( arrayOfTypes , arrayOfValues ) **=>** *string*
Returns the SHA2-256 of the non-standard encoded *arrayOfValues* packed
according to their respective type in *arrayOfTypes*.
-----
**Content Hash:** 65dd2158ef160da7be3291c8e7aac15df2de683869df9c31b8efdaa39551b3e4

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,157 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Strings
=======
Tra la la
Bytes32String
-------------
A string in Solidity is length prefixed with its 256-bit (32 byte)
length, which means that even short strings require 2 words (64 bytes)
of storage.
In many cases, we deal with short strings, so instead of prefixing
the string with its length, we can null-terminate it and fit it in a
single word (32 bytes). Since we need only a single byte for the
null termination, we can store strings up to 31 bytes long in a
word.
#### **Note:**
Strings that are 31 **bytes** long may contain fewer than 31 **characters**,
since UTF-8 requires multiple bytes to encode international characters.
#### *utils* . **parseBytes32String** ( aBytesLike ) **=>** *string*
Returns the decoded string represented by the `Bytes32` encoded data.
#### *utils* . **formatBytes32String** ( text ) **=>** *string*
Returns a `bytes32` string representation of *text*. If the
length of *text* exceeds 31 bytes, it will throw an error.
UTF-8 Strings
-------------
#### *utils* . **toUtf8Bytes** ( text [ , form=current ] ) **=>** *Uint8Array*
Returns the UTF-8 bytes of *text*, optionally normalizing it using the
[UnicodeNormalizationForm](./) *form*.
#### *utils* . **toUtf8CodePoints** ( aBytesLike [ , form=current ] ) **=>** *Array< number >*
Returns the Array of codepoints of *aBytesLike*, optionally normalizing it using the
[UnicodeNormalizationForm](./) *form*.
**Note:** This function correctly splits each user-perceived character into
its codepoint, accounting for surrogate pairs. This should not be confused with
`string.split("")`, which destroys surrogate pairs, spliting between each UTF-16
codeunit instead.
#### *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.
### UnicodeNormalizationForm
There are several [commonly used forms](https://en.wikipedia.org/wiki/Unicode_equivalence)
when normalizing UTF-8 data, which allow strings to be compared or hashed in a stable
way.
#### *utils* . *UnicodeNormalizationForm* . **current**
Maintain the current normalization form.
#### *utils* . *UnicodeNormalizationForm* . **NFC**
The Composed Normalization Form. This form uses single codepoints
which represent the fully composed character.
For example, the **&eacute;** is a single codepoint, `0x00e9`.
#### *utils* . *UnicodeNormalizationForm* . **NFD**
The Decomposed Normalization Form. This form uses multiple codepoints
(when necessary) to compose a character.
For example, the **&eacute;**
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.
#### *utils* . *UnicodeNormalizationForm* . **NFKC**
The Composed Normalization Form with Canonical Equivalence. The Canonical
representation folds characters which have the same syntactic representation
but different semantic meaning.
For example, the Roman Numeral **I**, which has a UTF-8
codepoint `"0x2160"`, is folded into the capital letter I, `"0x0049"`.
#### *utils* . *UnicodeNormalizationForm* . **NFKD**
The Decomposed Normalization Form with Canonical Equivalence.
See NFKC for more an example.
#### **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).
-----
**Content Hash:** 74002cd3d9368872b5618f68967deac34a4d1aeafeeac6ddb5c1d06a450180c9

File diff suppressed because one or more lines are too long

24
docs/concepts/README.md Normal file
View File

@@ -0,0 +1,24 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Concepts
========
This is a very breif overview of some aspects of *Ethereum*
which developers can make use of or should be aware of.
* [Events](events)
* [Gas](gas)
* [Gas Price](gas)
* [Gas Limit](gas)
-----
**Content Hash:** ad59f45600332d936821db1fa0d0eeabdab5b4f252e1e815de525b4d1b9a9a7b

View File

@@ -0,0 +1,17 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Events
======
Explain how topics and such work
-----
**Content Hash:** 4b045e823bf9863272ddb1c5a8460bc461de2ad262503dc27829b64b57344d46

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,29 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Gas
===
Gas Price
---------
The gas price is used somewhat like a bid, indicating an amount
you are willing to pay (per unit of execution) to have your transaction
processed.
Gas Limit
---------
-----
**Content Hash:** 4cc3001196d861faac19ebc393e002ce9e6f24702b66bac62ef8f9185625b3dc

File diff suppressed because one or more lines are too long

4
docs/concepts/index.html Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,45 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Contributing and Hacking
========================
The ethers.js library is something that I've written out of necessity,
and has grown somewhat organically over time.
Many things are the way they are for good (at the time, at least) reasons,
but I always welcome criticism, and am completely willing to have my mind
changed on things.
So, pull requests are always welcome, but please keep a few points in mind:
* Backwards-compatibility-breaking changes will not be accepted; they may be considered for the next major version
* Security is important; adding dependencies require fairly convincing arguments as to why
* The library aims to be lean, so keep an eye on the dist/ethers.min.js file size before and after your changes
* Add test cases for both expected and unexpected input
* Any new features need to be supported by me (future issues, documentation, testing, migration), so anything that is overly complicated or specific may not be accepted
In general, **please start an issue *before* beginning a pull request**, so we can
have a public discussion and figure out the best way to address to problem/feature.
**:)**
Building
--------
use npm run auto-build
use npm run update-version
-----
**Content Hash:** f817d13fd530f58e6a03c9b5cb7190a3b7a084e8bf6eb05b130665c36d421950

File diff suppressed because one or more lines are too long

17
docs/cookbook/README.md Normal file
View File

@@ -0,0 +1,17 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Cookbook
========
Cooking...
-----
**Content Hash:** e3e2d42077858c887af142ae8f1c49a1882ea80d98cf4b75e272d97a65a0e713

3
docs/cookbook/index.html Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,197 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Flatworm Docs
=============
The *Flatworm Docs* rendering script is designed to be **very**
simple, but provide enough formatting necessary for documenting
JavaScript libraries.
A lot of its inspiration came from [Read the Docs](https://github.com/readthedocs/sphinx_rtd_theme) and
the [Sphinx](https://www.sphinx-doc.org/) project.
Fragments
---------
Flatworm Docs are made up of fragments. A fragment is either a lone
body of [markdown](./) text, or a
[directive](./) for specialized formatting, which may
itself have body.
### Directive Format
```
_DIRECTIVE: VALUE @<LINK>
BODY
DIRECTIVE: The directive name
VALUE: Optional; the value to pass to the directive
LINK: Optional; a name for internal linking
BODY: Optional; the directive body (certain directives only)
```
### Flatworm Directives
#### **_section:** *TITLE*
A *section* has its **TITLE** in an H1 font. Sections are linked
to in *Table of Contents* and have a dividing line drawn above
them. If an option is specified, it is avaialble as a name for
intern linking. There should only be one `_section:` per page.
#### **_subsection:** *TITLE*
A *subsection* has its **TITLE** in an H2 font. Subsections are linked
to in *Table of Contents* and have a dividing line drawn above
them. If an option is specified, it is avaialble as a name for
internal linking.
#### **_heading:** *TITLE*
A *heading* has its **TITLE** in an H3 font. If an option is specified,
it is available as a name for internal linking.
#### **_definition:** *TERM*
A *definition* has its **TERM** bolded and the markdown body is
indented.
#### **_property:** *SIGNATURE*
A *property* has its JavaScript **SIGNATURE** formatted and the
markdown body is indented.
#### **_code:** *FILENAME*
A *code* reads the **FILENAME** and depending on the extension
adjusts it.
For JavaScript files, the file is executed, with `//!` replaced
with the result of the last statement and `//!error` is replaced
with the throw error. If the error state does not agree, rendering
fails.
#### **_toc:**
A *toc* injects a Table of Contents, loading each line of the
body as a filename and recursively loads the *toc* if present,
otherwise all the *sections* and *subsections*.
#### **_null:**
A *null* is used to terminated a directive. For example, after
a *definition*, the bodies are indented, so a *null* can be
used to reset the indentation.
### Examples
```
_section: Hello World @<link-to-this-section>
_subsection: Some Example @<link-to-this-subsection>
_heading: Large Bold Text @<link-to-this-heading>
_definition: Flatworm
A phylum of relatively **simple** bilaterian, unsegmented,
soft-bodied invertebrates.
_property: String.fromCharCode(code) => string
Returns a string created from //code//, a sequence of
UTF-16 code units.
_code: filename.js
_toc:
some-file
some-directory
_null:
This breaks out of a directive. For example, to end a
_definition and reset the indentation.
```
Markdown
--------
The markdown is simple and does not have the flexibility of
other dialects, but allows for **bold**, *italic*,
*underlined*, `monospaced`, ^super-scripted text,
supporting [links](./) and lists.
```
**bold text**
//italic text//
__underlined text__
``monospace code``
^^superscript text^^
- This is a list
- With bullet points
- With a total of three items
This is separated by -- an en-dash.
This is separated by --- an em-dash.
This is a [Link to Ethereum](https://ethereum.org) and this
is an [Internal Link](some-link).
This is a self-titled link [[https://ethereumorg]] and this
[[some-link]] will use the title from its directives value.
```
-----
**Content Hash:** 6cc55a98e7a50c76c8b27fbc7aae97bebaf9355a40b9c44a568f2f7fd927da57

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