From 2fdf995e8a7e2a4b5dedd2de7ad07b7959969b85 Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Mon, 17 Feb 2020 17:56:50 -0500 Subject: [PATCH] Updated generated documentaiton. --- docs/README.md | 76 ++++- docs/api/README.md | 48 +++- docs/api/contract/index.html | 4 +- docs/api/index.html | 4 +- docs/api/other/README.md | 20 +- docs/api/other/assembly/README.md | 34 +++ docs/api/other/assembly/api/README.md | 185 ++++++++++++ docs/api/other/assembly/api/index.html | 33 +++ docs/api/other/assembly/ast/README.md | 252 +++++++++++++++++ docs/api/other/assembly/ast/index.html | 51 ++++ docs/api/other/assembly/dialect/README.md | 146 ++++++++++ docs/api/other/assembly/dialect/index.html | 21 ++ docs/api/other/assembly/index.html | 4 + docs/api/other/hardware/README.md | 4 +- docs/api/other/hardware/index.html | 4 +- docs/api/other/index.html | 4 +- docs/api/providers/api-providers/README.md | 17 +- docs/api/providers/api-providers/index.html | 10 +- docs/api/providers/index.html | 4 +- docs/api/providers/jsonrpc-provider/README.md | 10 +- .../api/providers/jsonrpc-provider/index.html | 4 +- docs/api/providers/other/README.md | 12 +- docs/api/providers/other/index.html | 10 +- docs/api/providers/provider/README.md | 26 +- docs/api/providers/provider/index.html | 50 ++-- docs/api/providers/types/README.md | 12 +- docs/api/providers/types/index.html | 4 +- docs/api/signer/index.html | 12 +- docs/api/utils/README.md | 30 +- docs/api/utils/abi/README.md | 13 +- docs/api/utils/abi/index.html | 6 +- docs/api/utils/address/README.md | 8 +- docs/api/utils/address/index.html | 4 +- docs/api/utils/bignumber/README.md | 135 +++++---- docs/api/utils/bignumber/index.html | 30 +- docs/api/utils/bytes/README.md | 43 ++- docs/api/utils/bytes/index.html | 9 +- docs/api/utils/constants/README.md | 23 +- docs/api/utils/constants/index.html | 22 +- docs/api/utils/display-logic/index.html | 4 +- docs/api/utils/encoding/README.md | 68 ++++- docs/api/utils/encoding/index.html | 21 +- docs/api/utils/fixednumber/README.md | 177 ++++++------ docs/api/utils/fixednumber/index.html | 34 +-- docs/api/utils/hashing/README.md | 20 +- docs/api/utils/hashing/index.html | 14 +- docs/api/utils/hdnode/README.md | 244 ++++++++++++++++ docs/api/utils/hdnode/index.html | 42 +++ docs/api/utils/index.html | 4 +- docs/api/utils/logger/README.md | 180 ++++++++++++ docs/api/utils/logger/index.html | 25 ++ docs/api/utils/properties/README.md | 39 ++- docs/api/utils/properties/index.html | 9 +- docs/api/utils/signing-key/README.md | 81 +++++- docs/api/utils/signing-key/index.html | 17 +- docs/api/utils/strings/README.md | 10 +- docs/api/utils/strings/index.html | 4 +- docs/api/utils/transactions/README.md | 115 +++++--- docs/api/utils/transactions/index.html | 46 +-- docs/api/utils/web/README.md | 135 +++++++++ docs/api/utils/web/index.html | 21 ++ docs/api/utils/wordlists/README.md | 142 ++++++++++ docs/api/utils/wordlists/index.html | 23 ++ docs/cli/README.md | 6 +- docs/cli/asm/README.md | 252 ++++++++++++++++- docs/cli/asm/index.html | 33 ++- docs/cli/ens/index.html | 4 +- docs/cli/ethers/README.md | 4 +- docs/cli/ethers/index.html | 4 +- docs/cli/index.html | 4 +- docs/cli/plugin/index.html | 4 +- docs/cli/typescript/index.html | 4 +- docs/concepts/events/index.html | 4 +- docs/concepts/gas/index.html | 4 +- docs/concepts/index.html | 4 +- docs/contributing/index.html | 4 +- docs/cookbook/index.html | 4 +- docs/documentation/README.md | 6 +- docs/documentation/index.html | 6 +- docs/getting-started/README.md | 9 +- docs/getting-started/index.html | 4 +- docs/hacking/index.html | 4 +- docs/index.html | 8 +- docs/license/README.md | 6 +- docs/license/index.html | 4 +- docs/migration/README.md | 29 +- docs/migration/ethers-v4/README.md | 266 ++++++++++++++++++ docs/migration/ethers-v4/index.html | 45 +++ docs/migration/index.html | 9 +- docs/migration/web3/README.md | 37 +++ docs/migration/web3/index.html | 11 + docs/testing/index.html | 4 +- 92 files changed, 3085 insertions(+), 557 deletions(-) create mode 100644 docs/api/other/assembly/README.md create mode 100644 docs/api/other/assembly/api/README.md create mode 100644 docs/api/other/assembly/api/index.html create mode 100644 docs/api/other/assembly/ast/README.md create mode 100644 docs/api/other/assembly/ast/index.html create mode 100644 docs/api/other/assembly/dialect/README.md create mode 100644 docs/api/other/assembly/dialect/index.html create mode 100644 docs/api/other/assembly/index.html create mode 100644 docs/api/utils/hdnode/README.md create mode 100644 docs/api/utils/hdnode/index.html create mode 100644 docs/api/utils/logger/README.md create mode 100644 docs/api/utils/logger/index.html create mode 100644 docs/api/utils/web/README.md create mode 100644 docs/api/utils/web/index.html create mode 100644 docs/api/utils/wordlists/README.md create mode 100644 docs/api/utils/wordlists/index.html create mode 100644 docs/migration/ethers-v4/README.md create mode 100644 docs/migration/ethers-v4/index.html create mode 100644 docs/migration/web3/README.md create mode 100644 docs/migration/web3/index.html diff --git a/docs/README.md b/docs/README.md index 5a2042d5..5408c300 100644 --- a/docs/README.md +++ b/docs/README.md @@ -11,7 +11,7 @@ What is ethers? The ethers.js library aims to be a complete and compact library for interacting with the Ethereum Blockchain and its ecosystem. It was -originally designed for use with [ethers.io](https://ethers.io/) and +originally designed for use with [ethers.io](Users/ricmoo/Development/ethers/ethers.js-v5/https:/ethers.io) and has since expanded into a much more general-purpose library. @@ -25,11 +25,11 @@ Features * 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/). +* Connect to Ethereum nodes over [JSON-RPC](Users/ricmoo/Development/ethers/ethers.js-v5/https:/github.com/ethereum/wiki/wiki/JSON-RPC), [INFURA](Users/ricmoo/Development/ethers/ethers.js-v5/https:/infura.io), [Etherscan](Users/ricmoo/Development/ethers/ethers.js-v5/https:/etherscan.io), [Alchemy](Users/ricmoo/Development/ethers/ethers.js-v5/https:/alchemyapi.io), [Cloudflare](Users/ricmoo/Development/ethers/ethers.js-v5/https:/developers.cloudflare.com/distributed-web/ethereum-gateway) or [MetaMask](Users/ricmoo/Development/ethers/ethers.js-v5/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/) +* Extensive [documentation](Users/ricmoo/Development/ethers/ethers.js-v5/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 @@ -86,16 +86,17 @@ Developer Documentation * [Events and Logs](api/providers/types) * [Transactions](api/providers/types) * [Utilities](api/utils) - * [Addresses](api/utils/address) - * [Address Formats](api/utils/address) - * [Functions](api/utils/address) * [Application Binary Interface](api/utils/abi) * [Formats](api/utils/abi) + * [Interface](api/utils/abi) * [Fragment](api/utils/abi) * [ConstructorFragment](api/utils/abi) * [EventFragment](api/utils/abi) * [FunctionFragment](api/utils/abi) * [ParamType](api/utils/abi) + * [Addresses](api/utils/address) + * [Address Formats](api/utils/address) + * [Functions](api/utils/address) * [BigNumber](api/utils/bignumber) * [Types](api/utils/bignumber) * [Creating Instances](api/utils/bignumber) @@ -108,6 +109,7 @@ Developer Documentation * [Array Manipulation](api/utils/bytes) * [Hexstring Manipulation](api/utils/bytes) * [Signature Conversion](api/utils/bytes) + * [Random Bytes](api/utils/bytes) * [Constants](api/utils/constants) * [Bytes](api/utils/constants) * [Strings](api/utils/constants) @@ -115,15 +117,29 @@ Developer Documentation * [Display Logic and Input](api/utils/display-logic) * [Units](api/utils/display-logic) * [Functions](api/utils/display-logic) + * [Encoding Utilities](api/utils/encoding) + * [Base58](api/utils/encoding) + * [Base64](api/utils/encoding) + * [Recursive-Length Prefix](api/utils/encoding) * [FixedNumber](api/utils/fixednumber) - * [FixedFormat](api/utils/fixednumber) * [Creating Instances](api/utils/fixednumber) * [Properties](api/utils/fixednumber) * [Methods](api/utils/fixednumber) + * [FixedFormat](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) + * [HD Wallet](api/utils/hdnode) + * [Types](api/utils/hdnode) + * [HDNode](api/utils/hdnode) + * [Other Functions](api/utils/hdnode) + * [Logger](api/utils/logger) + * [Errors](api/utils/logger) + * [Creating instances](api/utils/logger) + * [Property Utilities](api/utils/properties) + * [Signing Key](api/utils/signing-key) + * [Other Functions](api/utils/signing-key) * [Strings](api/utils/strings) * [Bytes32String](api/utils/strings) * [UTF-8 Strings](api/utils/strings) @@ -132,7 +148,29 @@ Developer Documentation * [Transactions](api/utils/transactions) * [Types](api/utils/transactions) * [Functions](api/utils/transactions) + * [Web Utilities](api/utils/web) + * [Wordlists](api/utils/wordlists) + * [Wordlist](api/utils/wordlists) + * [Languages](api/utils/wordlists) * [Other Libraries](api/other) + * [Assembly](api/other/assembly) + * [Ethers ASM Dialect](api/other/assembly/dialect) + * [Opcodes](api/other/assembly/dialect) + * [Labels](api/other/assembly/dialect) + * [Literals](api/other/assembly/dialect) + * [Comments](api/other/assembly/dialect) + * [Scopes](api/other/assembly/dialect) + * [Data Segment](api/other/assembly/dialect) + * [Links](api/other/assembly/dialect) + * [Stack Placeholders](api/other/assembly/dialect) + * [Evaluation and Excution](api/other/assembly/dialect) + * [Utilities](api/other/assembly/api) + * [Assembler](api/other/assembly/api) + * [Disassembler](api/other/assembly/api) + * [Opcode](api/other/assembly/api) + * [Abstract Syntax Tree](api/other/assembly/ast) + * [Types](api/other/assembly/ast) + * [Nodes](api/other/assembly/ast) * [Hardware Wallets](api/other/hardware) * [LedgerSigner](api/other/hardware) * [Command Line Interfaces](cli) @@ -141,7 +179,9 @@ Developer Documentation * [Examples](cli/ethers) * [Assembler](cli/asm) * [Help](cli/asm) - * [Examples](cli/asm) + * [Example Input Files](cli/asm) + * [Assembler Examples](cli/asm) + * [Disassembler Examples](cli/asm) * [ENS](cli/ens) * [Help](cli/ens) * [Examples](cli/ens) @@ -154,8 +194,18 @@ Developer Documentation * [ArgParser](cli/plugin) * [Cookbook](cookbook) * [Migration Guide](migration) - * [From Web3](migration) - * [From ethers v4](migration) + * [Migration: From Web3.js](migration/web3) + * [Contracts](migration/web3) + * [Providers](migration/web3) + * [Numbers](migration/web3) + * [Utilities](migration/web3) + * [Migration: From Ethers v4](migration/ethers-v4) + * [BigNumber](migration/ethers-v4) + * [Contracts](migration/ethers-v4) + * [Errors](migration/ethers-v4) + * [Interface](migration/ethers-v4) + * [Utilities](migration/ethers-v4) + * [Wallet](migration/ethers-v4) * [Testing](testing) * [Contributing and Hacking](contributing) * [Building](contributing) @@ -176,10 +226,10 @@ older versions of the library. -* [version 4.0](https://docs.ethers.io/ethers.js) -* [version 3.0](https://docs.ethers.io/ethers.js/v3.0/html/) +* [version 4.0](Users/ricmoo/Development/ethers/ethers.js-v5/https:/docs.ethers.io/ethers.js) +* [version 3.0](Users/ricmoo/Development/ethers/ethers.js-v5/https:/docs.ethers.io/ethers.js/v3.0/html) ----- -**Content Hash:** bf4f628855f6f4c54ceca8c845e7ec93498135aa2d045f582d7c98e3a05294d7 \ No newline at end of file +**Content Hash:** e47c57b222edf98628be3e6d682eba93201d2163e7e059d2a963004f8ee81059 \ No newline at end of file diff --git a/docs/api/README.md b/docs/api/README.md index 96246bdf..80704b81 100644 --- a/docs/api/README.md +++ b/docs/api/README.md @@ -48,16 +48,17 @@ Here... * [Events and Logs](providers/types) * [Transactions](providers/types) * [Utilities](utils) - * [Addresses](utils/address) - * [Address Formats](utils/address) - * [Functions](utils/address) * [Application Binary Interface](utils/abi) * [Formats](utils/abi) + * [Interface](utils/abi) * [Fragment](utils/abi) * [ConstructorFragment](utils/abi) * [EventFragment](utils/abi) * [FunctionFragment](utils/abi) * [ParamType](utils/abi) + * [Addresses](utils/address) + * [Address Formats](utils/address) + * [Functions](utils/address) * [BigNumber](utils/bignumber) * [Types](utils/bignumber) * [Creating Instances](utils/bignumber) @@ -70,6 +71,7 @@ Here... * [Array Manipulation](utils/bytes) * [Hexstring Manipulation](utils/bytes) * [Signature Conversion](utils/bytes) + * [Random Bytes](utils/bytes) * [Constants](utils/constants) * [Bytes](utils/constants) * [Strings](utils/constants) @@ -77,15 +79,29 @@ Here... * [Display Logic and Input](utils/display-logic) * [Units](utils/display-logic) * [Functions](utils/display-logic) + * [Encoding Utilities](utils/encoding) + * [Base58](utils/encoding) + * [Base64](utils/encoding) + * [Recursive-Length Prefix](utils/encoding) * [FixedNumber](utils/fixednumber) - * [FixedFormat](utils/fixednumber) * [Creating Instances](utils/fixednumber) * [Properties](utils/fixednumber) * [Methods](utils/fixednumber) + * [FixedFormat](utils/fixednumber) * [Hashing Algorithms](utils/hashing) * [Cryptographic Hashing](utils/hashing) * [Common Hashing Helpers](utils/hashing) * [Solidity Hashing Algorithms](utils/hashing) + * [HD Wallet](utils/hdnode) + * [Types](utils/hdnode) + * [HDNode](utils/hdnode) + * [Other Functions](utils/hdnode) + * [Logger](utils/logger) + * [Errors](utils/logger) + * [Creating instances](utils/logger) + * [Property Utilities](utils/properties) + * [Signing Key](utils/signing-key) + * [Other Functions](utils/signing-key) * [Strings](utils/strings) * [Bytes32String](utils/strings) * [UTF-8 Strings](utils/strings) @@ -94,11 +110,33 @@ Here... * [Transactions](utils/transactions) * [Types](utils/transactions) * [Functions](utils/transactions) + * [Web Utilities](utils/web) + * [Wordlists](utils/wordlists) + * [Wordlist](utils/wordlists) + * [Languages](utils/wordlists) * [Other Libraries](other) + * [Assembly](other/assembly) + * [Ethers ASM Dialect](other/assembly/dialect) + * [Opcodes](other/assembly/dialect) + * [Labels](other/assembly/dialect) + * [Literals](other/assembly/dialect) + * [Comments](other/assembly/dialect) + * [Scopes](other/assembly/dialect) + * [Data Segment](other/assembly/dialect) + * [Links](other/assembly/dialect) + * [Stack Placeholders](other/assembly/dialect) + * [Evaluation and Excution](other/assembly/dialect) + * [Utilities](other/assembly/api) + * [Assembler](other/assembly/api) + * [Disassembler](other/assembly/api) + * [Opcode](other/assembly/api) + * [Abstract Syntax Tree](other/assembly/ast) + * [Types](other/assembly/ast) + * [Nodes](other/assembly/ast) * [Hardware Wallets](other/hardware) * [LedgerSigner](other/hardware) ----- -**Content Hash:** 9efeac06691d2415dcc248d1567676602f7df029abd5f844480b12bb844588a7 \ No newline at end of file +**Content Hash:** be5b26283f92ba2629be4efa3939fb71d8b7d3531bd335a1bd7b5b8386eaf876 \ No newline at end of file diff --git a/docs/api/contract/index.html b/docs/api/contract/index.html index e1d95b64..6d641a9f 100644 --- a/docs/api/contract/index.html +++ b/docs/api/contract/index.html @@ -1,6 +1,6 @@ -Contracts
+Contracts

Contracts

Explain what contracts are...

Buckets

-
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/api/index.html b/docs/api/index.html index 07b55515..51f880f5 100644 --- a/docs/api/index.html +++ b/docs/api/index.html @@ -1,4 +1,4 @@ -Application Programming Interface
+Application Programming Interface

Application Programming Interface (API)

Here...

-
\ No newline at end of file +
Contracts
Buckets
Signers
Signer
Wallet
VoidSigner
ExternallyOwnedAccount
Providers
Provider
Accounts Methods
Blocks Methods
Ethereum Naming Service (ENS) Methods
Logs Methods
Network Status Methods
Transactions Methods
Event Emitter Methods
Inspection Methods
JsonRpcProvider
JsonRpcSigner
JsonRpcUncheckedSigner
API Providers
EtherscanProvider
InfuraProvider
AlchemyProvider
CloudfrontProvider
Other Providers
FallbackProvider
IpcProvider
UrlJsonRpcProvider
Web3Provider
Types
Network
Block
Events and Logs
Transactions
Utilities
Application Binary Interface
Formats
Interface
Fragment
ConstructorFragment
EventFragment
FunctionFragment
ParamType
Addresses
Address Formats
Functions
BigNumber
Types
Creating Instances
Methods
Notes
Byte Manipulation
Types
Inspection
Converting between Arrays and Hexstrings
Array Manipulation
Hexstring Manipulation
Signature Conversion
Random Bytes
Constants
Bytes
Strings
BigNumber
Display Logic and Input
Units
Functions
Encoding Utilities
Base58
Base64
Recursive-Length Prefix
FixedNumber
Creating Instances
Properties
Methods
FixedFormat
Hashing Algorithms
Cryptographic Hashing
Common Hashing Helpers
Solidity Hashing Algorithms
HD Wallet
Types
HDNode
Other Functions
Logger
Errors
Creating instances
Property Utilities
Signing Key
Other Functions
Strings
Bytes32String
UTF-8 Strings
UnicodeNormalizationForm
Custom UTF-8 Error Handling
Transactions
Types
Functions
Web Utilities
Wordlists
Wordlist
Languages
Other Libraries
Assembly
Ethers ASM Dialect
Opcodes
Labels
Literals
Comments
Scopes
Data Segment
Links
Stack Placeholders
Evaluation and Excution
Utilities
Assembler
Disassembler
Opcode
Abstract Syntax Tree
Types
Nodes
Hardware Wallets
LedgerSigner
\ No newline at end of file diff --git a/docs/api/other/README.md b/docs/api/other/README.md index 6b0ba5b0..b21ecb5e 100644 --- a/docs/api/other/README.md +++ b/docs/api/other/README.md @@ -14,10 +14,28 @@ ancillary packages, which are not part of the core but optionally add functionality only needed in certain situations. +* [Assembly](assembly) + * [Ethers ASM Dialect](assembly/dialect) + * [Opcodes](assembly/dialect) + * [Labels](assembly/dialect) + * [Literals](assembly/dialect) + * [Comments](assembly/dialect) + * [Scopes](assembly/dialect) + * [Data Segment](assembly/dialect) + * [Links](assembly/dialect) + * [Stack Placeholders](assembly/dialect) + * [Evaluation and Excution](assembly/dialect) + * [Utilities](assembly/api) + * [Assembler](assembly/api) + * [Disassembler](assembly/api) + * [Opcode](assembly/api) + * [Abstract Syntax Tree](assembly/ast) + * [Types](assembly/ast) + * [Nodes](assembly/ast) * [Hardware Wallets](hardware) * [LedgerSigner](hardware) ----- -**Content Hash:** bafa126f115321049791ba83b99acf79f82f222eb246124c601983ad8cb4b73a \ No newline at end of file +**Content Hash:** d29ef5cbebb1685588a99b27e7fd65a813eed036f47e893be17b8e02b70bd798 \ No newline at end of file diff --git a/docs/api/other/assembly/README.md b/docs/api/other/assembly/README.md new file mode 100644 index 00000000..d218832a --- /dev/null +++ b/docs/api/other/assembly/README.md @@ -0,0 +1,34 @@ +----- + +Documentation: [html](https://docs-beta.ethers.io/) + +----- + + +Assembly +======== + + + +* [Ethers ASM Dialect](dialect) + * [Opcodes](dialect) + * [Labels](dialect) + * [Literals](dialect) + * [Comments](dialect) + * [Scopes](dialect) + * [Data Segment](dialect) + * [Links](dialect) + * [Stack Placeholders](dialect) + * [Evaluation and Excution](dialect) +* [Utilities](api) + * [Assembler](api) + * [Disassembler](api) + * [Opcode](api) +* [Abstract Syntax Tree](ast) + * [Types](ast) + * [Nodes](ast) + + + +----- +**Content Hash:** 788fa8cbceed019d051941c427df5e77f74cc536d125f33b680f16d2e4aa508a \ No newline at end of file diff --git a/docs/api/other/assembly/api/README.md b/docs/api/other/assembly/api/README.md new file mode 100644 index 00000000..55bafd4d --- /dev/null +++ b/docs/api/other/assembly/api/README.md @@ -0,0 +1,185 @@ +----- + +Documentation: [html](https://docs-beta.ethers.io/) + +----- + + +Utilities +========= + + + +Assembler +--------- + + +The assembler utilities allow parsing and assembling an +[Ethers ASM Dialect](../dialect) source file. + + +#### *asm* . **parse** ( code ) **=>** *[Node](../ast)* + +Parse an ethers-format assembly file and return the [Abstract Syntax Tree](../ast). + + + + +#### *asm* . **assemble** ( node ) **=>** *string< [DataHexstring](../../../utils/bytes) >* + +Performs assembly of the [Abstract Syntax Tree](../ast) *node* and return the +resulting bytecode representation. + + + + +Disassembler +------------ + + +The **Disassembler** utilities make it easy to convert bytecode +into an object which can easily be examined for program structure. + + +#### *asm* . **disassemble** ( bytecode ) **=>** *[Bytecode](./)* + +Returns an array of Operations given *bytecode*. + + + + +#### *asm* . **formatBytecode** ( operations ) **=>** *string* + +Create a formatted output of an array of [Operation](./). + + + + +### Bytecode + + +Each arary index represents an operation, collapsing multi-byte operations +(i.e. `PUSH`) into a single operation. + + +#### *bytecode* . **getOperation** ( offset ) **=>** *[Operation](./)* + +Get the operation at a given *offset* into the bytecode. This ensures that +the byte at *offset* is an operation and not data contained within a `PUSH`, +in which case null it returned. + + + + +### Operation + + +An **Operation** is a single command from a disassembled bytecode +stream. + + +#### *operation* . **opcode** **=>** *[Opcode](./)* + +The opcode for this Operation. + + + + +#### *operation* . **offset** **=>** *number* + +The offset into the bytecode for this Operation. + + + + +#### *operation* . **pushValue** **=>** *string< [DataHexstring](../../../utils/bytes) >* + +If the opcode is a `PUSH`, this is the value of that push + + + + +Opcode +------ + + + +#### *asm* . *Opcode* . **from** ( valueOrMnemonic ) **=>** *[Opcode](./)* + +Create a new instnace of an Opcode for a given numeric value +(e.g. 0x60 is PUSH1) or mnemonic string (e.g. "PUSH1"). + + + + +### Properties + + + +#### *opcode* . **value** **=>** *number* + +The value (bytecode as a number) of this opcode. + + + + +#### *opcode* . **mnemonic** **=>** *string* + +The mnemonic string of this opcode. + + + + +#### *opcode* . **delta** **=>** *number* + +The number of items this opcode will consume from the stack. + + + + +#### *opcode* . **alpha** **=>** *number* + +The number of items this opcode will push onto the stack. + + + + +#### *opcode* . **doc** **=>** *string* + +A short description of what this opcode does. + + + + +#### *opcode* . **isMemory** ( ) **=>** *"read"|"write"|"full"* + +Returns true if the opcode accesses memory. + + + + +#### *opcode* . **isStatic** ( ) **=>** *boolean* + +Returns true if the opcode cannot change state. + + + + +#### *opcode* . **isJump** ( ) **=>** *boolean* + +Returns true if the opcode is a jumper operation. + + + + +#### *opcode* . **isPush** ( ) **=>** *number* + +Returns 0 if the opcode is not a `PUSH*`, or the number +of bytes this opcode will push if it is. + + + + + +----- +**Content Hash:** 1c170b94b22fa807a3906f95d76719a78fba6627996b108356643ef72b21f940 \ No newline at end of file diff --git a/docs/api/other/assembly/api/index.html b/docs/api/other/assembly/api/index.html new file mode 100644 index 00000000..d4d678d1 --- /dev/null +++ b/docs/api/other/assembly/api/index.html @@ -0,0 +1,33 @@ +Utilities
+

Utilities

+ +

Assembler

+

The assembler utilities allow parsing and assembling an Ethers ASM Dialect source file.

+
asm . parse ( code ) Node

Parse an ethers-format assembly file and return the Abstract Syntax Tree.

+
asm . assemble ( node ) string< DataHexstring >

Performs assembly of the Abstract Syntax Tree node and return the resulting bytecode representation.

+

Disassembler

+

The Disassembler utilities make it easy to convert bytecode into an object which can easily be examined for program structure.

+
asm . disassemble ( bytecode ) Bytecode

Returns an array of Operations given bytecode.

+
asm . formatBytecode ( operations ) string

Create a formatted output of an array of Operation.

+

Bytecode inherits Array<Operation>

+

Each arary index represents an operation, collapsing multi-byte operations (i.e. PUSH) into a single operation.

+
bytecode . getOperation ( offset ) Operation

Get the operation at a given offset into the bytecode. This ensures that the byte at offset is an operation and not data contained within a PUSH, in which case null it returned.

+

Operation

+

An Operation is a single command from a disassembled bytecode stream.

+
operation . opcode Opcode

The opcode for this Operation.

+
operation . offset number

The offset into the bytecode for this Operation.

+
operation . pushValue string< DataHexstring >

If the opcode is a PUSH, this is the value of that push

+

Opcode

+ +
asm . Opcode . from ( valueOrMnemonic ) Opcode

Create a new instnace of an Opcode for a given numeric value (e.g. 0x60 is PUSH1) or mnemonic string (e.g. "PUSH1").

+

Properties

+ +
opcode . value number

The value (bytecode as a number) of this opcode.

+
opcode . mnemonic string

The mnemonic string of this opcode.

+
opcode . delta number

The number of items this opcode will consume from the stack.

+
opcode . alpha number

The number of items this opcode will push onto the stack.

+
opcode . doc string

A short description of what this opcode does.

+
opcode . isMemory ( ) "read"  |  "write"  |  "full"

Returns true if the opcode accesses memory.

+
opcode . isStatic ( ) boolean

Returns true if the opcode cannot change state.

+
opcode . isJump ( ) boolean

Returns true if the opcode is a jumper operation.

+
opcode . isPush ( ) number

Returns 0 if the opcode is not a PUSH*, or the number of bytes this opcode will push if it is.

\ No newline at end of file diff --git a/docs/api/other/assembly/ast/README.md b/docs/api/other/assembly/ast/README.md new file mode 100644 index 00000000..3459d7f7 --- /dev/null +++ b/docs/api/other/assembly/ast/README.md @@ -0,0 +1,252 @@ +----- + +Documentation: [html](https://docs-beta.ethers.io/) + +----- + + +Abstract Syntax Tree +==================== + + +Parsing a file using the [Ethers ASM Dialect](../dialect) will +generate an Abstract Syntax Tree. The root node will always +be a [ScopeNode](./) whose name is `_`. + +To parse a file into an Abstract Syntax tree, use the [parse](../api) +function. + + +Types +----- + + + +### Location + + + +#### **offset** **=>** *number* + +The offset into the source code to the start of this node. + + + + +#### **length** **=>** *number* + +The length of characters in the source code to the end of this node. + + + + +#### **source** **=>** *string* + +The source code of this node. + + + + +Nodes +----- + + +@TODO: Place a diagram here showing the hierarchy + + +### Node + + + +#### *node* . **tag** **=>** *string* + +A unique tag for this node for the lifetime of the process. + + + + +#### *node* . **location** **=>** *[Location](./)* + +The source code and location within the source code that this +node represents. + + + + +### ValueNode + + +A **ValueNode** is a node which may manipulate the stack. + + +### LiteralNode + + + +#### *literalNode* . **value** **=>** *string* + +The literal value of this node, which may be a [DataHexstring](../../../utils/bytes) or +string of a decimal number. + + + + +#### *literalNode* . **verbatim** **=>** *boolean* + +This is true in a [DataNode](./) context, since in that case the +value should be taken verbatim and no `PUSH` operation shoud be +added, otherwise false. + + + + +### PopNode + + +A **PopNode** is used to store a place-holder for an implicit pop from the +stack. It represents the code for an implicit place-holder (i.e. `$$`) or an +explicit place-holder (e.g. `$1`), which indicates the expect stack position +to consume. + + +#### *literalNode* . **index** **=>** *number* + +The index this **PopNode** is representing. For an implicit place-holder +this is `0`. + + + + +### LinkNode + + +A **LinkNode** represents a link to another [Node](./)'s data, +for example `$foo` or `#bar`. + + +#### *linkNode* . **label** **=>** *string* + +Te name of the target node. + + + + +#### *linkNode* . **type** **=>** *"offset"|"length"* + +Whether this node is for an offset or a length value of the +target node. + + + + +### OpcodeNode + + + +#### *opcodeNode* . **opcode** **=>** *[Opcode](../api)* + +The opcode for this Node. + + + + +#### *opcodeNode* . **operands** **=>** *Array< [ValueNode](./) >* + +A list of all operands passed into this Node. + + + + +### EvaluationNode + + +An **EvaluationNode** is used to execute code and insert the results +but does not generate +any output assembly, using the `{{! code here }}` syntax. + + +#### *literalNode* . **verbatim** **=>** *boolean* + +This is true in a [DataNode](./) context, since in that case the +value should be taken verbatim and no `PUSH` operation shoud be +added, otherwise false. + + + + +#### *evaluationNode* . **script** **=>** *string* + +The code to evaluate and produce the result to use as a literal. + + + + +### ExecutionNode + + +An **ExecutionNode** is used to execute code but does not generate +any output assembly, using the `{{! code here }}` syntax. + + +#### *evaluationNode* . **script** **=>** *string* + +The code to execute. Any result is ignored. + + + + +### LabelledNode + + +A **LabelledNode** is used for any Node that has a name, and can therefore +be targetted by a [LinkNode](./). + + +#### *labelledNode* . **name** **=>** *string* + +The name of this node. + + + + +### LabelNode + + +A **LabelNode** is used as a place to `JUMP` to by referencing it +name, using `@myLabel:`. A `JUMPDEST` is automatically inserted +at the bytecode offset. + + +### DataNode + + +A **DataNode** allows for data to be inserted directly into the output +assembly, using `@myData[ ... ]`. The data is padded if needed to ensure +values that would otherwise be regarded as a `PUSH` value does not impact +anything past the data. + + +#### *dataNode* . **data** **=>** *Array< [ValueNode](./) >* + +The child nodes, which each represent a verbatim piece of data in insert. + + + + +### ScopeNode + + +A **ScopeNode** allows a new frame of reference that all [LinkNode](./)'s +will use when resolving offset locations, using `@myScope{ ... }`. + + +#### *scopeNode* . **statements** **=>** *Array< [Node](./) >* + +The list of child nodes for this scope. + + + + + +----- +**Content Hash:** ee220fb350a143a9868feecd1513ad6a66dbb033b8c108852cfe86fe8dcd871a \ No newline at end of file diff --git a/docs/api/other/assembly/ast/index.html b/docs/api/other/assembly/ast/index.html new file mode 100644 index 00000000..7f1582dc --- /dev/null +++ b/docs/api/other/assembly/ast/index.html @@ -0,0 +1,51 @@ +Abstract Syntax Tree
+

Abstract Syntax Tree

+

Parsing a file using the Ethers ASM Dialect will generate an Abstract Syntax Tree. The root node will always be a ScopeNode whose name is _.

To parse a file into an Abstract Syntax tree, use the parse function.

+

Types

+ +

Location

+ +
offset number

The offset into the source code to the start of this node.

+
length number

The length of characters in the source code to the end of this node.

+
source string

The source code of this node.

+

Nodes

+

@TODO: Place a diagram here showing the hierarchy

+

Node

+ +
node . tag string

A unique tag for this node for the lifetime of the process.

+
node . location Location

The source code and location within the source code that this node represents.

+

ValueNode inherits Node

+

A ValueNode is a node which may manipulate the stack.

+

LiteralNode inherits ValueNode

+ +
literalNode . value string

The literal value of this node, which may be a DataHexstring or string of a decimal number.

+
literalNode . verbatim boolean

This is true in a DataNode context, since in that case the value should be taken verbatim and no PUSH operation shoud be added, otherwise false.

+

PopNode inherits ValueNode

+

A PopNode is used to store a place-holder for an implicit pop from the stack. It represents the code for an implicit place-holder (i.e. $$) or an explicit place-holder (e.g. $1), which indicates the expect stack position to consume.

+
literalNode . index number

The index this PopNode is representing. For an implicit place-holder this is 0.

+

LinkNode inherits ValueNode

+

A LinkNode represents a link to another Node's data, for example $foo or #bar.

+
linkNode . label string

Te name of the target node.

+
linkNode . type "offset"  |  "length"

Whether this node is for an offset or a length value of the target node.

+

OpcodeNode inherits ValueNode

+ +
opcodeNode . opcode Opcode

The opcode for this Node.

+
opcodeNode . operands Array< ValueNode >

A list of all operands passed into this Node.

+

EvaluationNode inherits ValueNode

+

An EvaluationNode is used to execute code and insert the results but does not generate any output assembly, using the {{! code here }} syntax.

+
literalNode . verbatim boolean

This is true in a DataNode context, since in that case the value should be taken verbatim and no PUSH operation shoud be added, otherwise false.

+
evaluationNode . script string

The code to evaluate and produce the result to use as a literal.

+

ExecutionNode inherits Node

+

An ExecutionNode is used to execute code but does not generate any output assembly, using the {{! code here }} syntax.

+
evaluationNode . script string

The code to execute. Any result is ignored.

+

LabelledNode inherits Node

+

A LabelledNode is used for any Node that has a name, and can therefore be targetted by a LinkNode.

+
labelledNode . name string

The name of this node.

+

LabelNode inherits LabelledNode

+

A LabelNode is used as a place to JUMP to by referencing it name, using @myLabel:. A JUMPDEST is automatically inserted at the bytecode offset.

+

DataNode inherits LabelledNode

+

A DataNode allows for data to be inserted directly into the output assembly, using @myData[ ... ]. The data is padded if needed to ensure values that would otherwise be regarded as a PUSH value does not impact anything past the data.

+
dataNode . data Array< ValueNode >

The child nodes, which each represent a verbatim piece of data in insert.

+

ScopeNode inherits LabelledNode

+

A ScopeNode allows a new frame of reference that all LinkNode's will use when resolving offset locations, using @myScope{ ... }.

+
scopeNode . statements Array< Node >

The list of child nodes for this scope.

\ No newline at end of file diff --git a/docs/api/other/assembly/dialect/README.md b/docs/api/other/assembly/dialect/README.md new file mode 100644 index 00000000..ab3a776c --- /dev/null +++ b/docs/api/other/assembly/dialect/README.md @@ -0,0 +1,146 @@ +----- + +Documentation: [html](https://docs-beta.ethers.io/) + +----- + + +Ethers ASM Dialect +================== + + +This provides a quick, high-level overcview of the **Ethers ASM Dialect** +for EVM, which is defined by the [Ethers ASM Dialect Grammar](../../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/asm/grammar.jison) + +Once a program is compiled by a higher level langauge into ASM (assembly), +or hand-coded directly in ASM, it needs to be assembled into bytecode. + +The assembly process performs a very small set of operations and is +intentionally simple and closely related to the underlying EVM bytecode. + +Operations include embedding programs within programs (for example the +deployment bootstrap has the runtime embedded in it) and computing the +necessary offsets for jump operations. + +The [Command-Line Assembler](../../../../cli/asm) can be used to assemble an +*Ethers ASM Dialect* file or to disassemble bytecode into its +human-readable (ish) opcodes and literals. + + +Opcodes +------- + + +An **Opcode** may be provided in either a *functional* or +*instructional* syntax. For Opcodes that require parameters, +the *functional* syntax is recommended and the *instructional* +syntax will raise a warning. + +@TODO: Examples + + +Labels +------ + + +A **Label** is a position in the program which can be jumped to. A +`JUMPDEST` is automatically added to this point in the assembled +output. + +@TODO: Exmaples + + +Literals +-------- + + +A **Literal** puts data on the stack when executed using a `PUSH` +operation. + +A **Literal** can be provided using a [DataHexstring](../../../utils/bytes) or a decimal +byte value. + +@TODO: exmples + + +Comments +-------- + + +To enter a comment in the **Ethers ASM Dialect**, any text following +a semi-colon (i.e. `;`) is ignored by the assembler. + + +Scopes +------ + + +A common case in Ethereum is to have one program embedded in another. + +The most common use of this is embedding a Contract **runtime bytecode** +within a **deployment bytecode**, which can be used as **init code**. + +When deploying a program to Ethereum, an **init transaction** is used. An +*init transaction* has a null `to` address and contains bytecode in +the `data`. This `data` bytecode is a program, that when executed +returns some other bytecode as a result, this restul is the bytecode +to be installed. + +Therefore it is important that embedded code uses jumps relative to itself, +not the entire program it is embedded in, which also means that a jump +can **only** target its own scope, no parent or child scopes. This is +enforced by the assembler. + +A scope may access the offset of any child [Data Segment](./) or +child [Scopes](./) (with respect to itself) and may access the length +of any [Data Segment](./) or [Scopes](./) anywhere in the program. + +Every program in the **Ethers ASM Dialect** has a top-leve scope named `_`. + + +Data Segment +------------ + + +A **Data Segment** allows arbitrary data to be embedded into a program, +which can be useful for lookup tables or deploy-time constants. + +An emtpty **Data Segment** can also be used when a labelled location is +required, but without the `JUMPDEST` which a [Labels](./) adds. + +@TODO: Example + + +Links +----- + + +A **Link** allows access to a [Scopes](./), [Data Segment](./) or [Labels](./). + +To access the byte offset of a labelled item, use `$foobar`. + +For a [Labels](./), the target must be directly reachable within this scope. For +a [Data Segment](./) or a [Scopes](./), it can be inside the same scope or any +child scope. + +For a [Data Segment](./) or a [Labels](./), there is an additional type of +**Link**, which provides the length of the data or bytecode respectively. A +**Length Link** is accessed by `#foobar` and is pushed on the stack as a +literal. + + +Stack Placeholders +------------------ + + +@TODO: exampl + + +Evaluation and Excution +----------------------- + + + + +----- +**Content Hash:** 71e165b7b78bd1080c3c1cabf9e19ddc21f1fdd440f945e8225d263f00cc4789 \ No newline at end of file diff --git a/docs/api/other/assembly/dialect/index.html b/docs/api/other/assembly/dialect/index.html new file mode 100644 index 00000000..ebeb2f5c --- /dev/null +++ b/docs/api/other/assembly/dialect/index.html @@ -0,0 +1,21 @@ +Ethers ASM Dialect
+

Ethers ASM Dialect

+

This provides a quick, high-level overcview of the Ethers ASM Dialect for EVM, which is defined by the Ethers ASM Dialect Grammar

Once a program is compiled by a higher level langauge into ASM (assembly), or hand-coded directly in ASM, it needs to be assembled into bytecode.

The assembly process performs a very small set of operations and is intentionally simple and closely related to the underlying EVM bytecode.

Operations include embedding programs within programs (for example the deployment bootstrap has the runtime embedded in it) and computing the necessary offsets for jump operations.

The Command-Line Assembler can be used to assemble an Ethers ASM Dialect file or to disassemble bytecode into its human-readable (ish) opcodes and literals.

+

Opcodes

+

An Opcode may be provided in either a functional or instructional syntax. For Opcodes that require parameters, the functional syntax is recommended and the instructional syntax will raise a warning.

@TODO: Examples

+

Labels

+

A Label is a position in the program which can be jumped to. A JUMPDEST is automatically added to this point in the assembled output.

@TODO: Exmaples

+

Literals

+

A Literal puts data on the stack when executed using a PUSH operation.

A Literal can be provided using a DataHexstring or a decimal byte value.

@TODO: exmples

+

Comments

+

To enter a comment in the Ethers ASM Dialect, any text following a semi-colon (i.e. ;) is ignored by the assembler.

+

Scopes

+

A common case in Ethereum is to have one program embedded in another.

The most common use of this is embedding a Contract runtime bytecode within a deployment bytecode, which can be used as init code.

When deploying a program to Ethereum, an init transaction is used. An init transaction has a null to address and contains bytecode in the data. This data bytecode is a program, that when executed returns some other bytecode as a result, this restul is the bytecode to be installed.

Therefore it is important that embedded code uses jumps relative to itself, not the entire program it is embedded in, which also means that a jump can only target its own scope, no parent or child scopes. This is enforced by the assembler.

A scope may access the offset of any child Data Segment or child Scopes (with respect to itself) and may access the length of any Data Segment or Scopes anywhere in the program.

Every program in the Ethers ASM Dialect has a top-leve scope named _.

+

Data Segment

+

A Data Segment allows arbitrary data to be embedded into a program, which can be useful for lookup tables or deploy-time constants.

An emtpty Data Segment can also be used when a labelled location is required, but without the JUMPDEST which a Labels adds.

@TODO: Example

+

Links

+

A Link allows access to a Scopes, Data Segment or Labels.

To access the byte offset of a labelled item, use $foobar.

For a Labels, the target must be directly reachable within this scope. For a Data Segment or a Scopes, it can be inside the same scope or any child scope.

For a Data Segment or a Labels, there is an additional type of Link, which provides the length of the data or bytecode respectively. A Length Link is accessed by #foobar and is pushed on the stack as a literal.

+

Stack Placeholders

+

@TODO: exampl

+

Evaluation and Excution

+
\ No newline at end of file diff --git a/docs/api/other/assembly/index.html b/docs/api/other/assembly/index.html new file mode 100644 index 00000000..a3ed254f --- /dev/null +++ b/docs/api/other/assembly/index.html @@ -0,0 +1,4 @@ +Assembly
+

Assembly

+ +
\ No newline at end of file diff --git a/docs/api/other/hardware/README.md b/docs/api/other/hardware/README.md index b091b076..8c415e37 100644 --- a/docs/api/other/hardware/README.md +++ b/docs/api/other/hardware/README.md @@ -14,7 +14,7 @@ LedgerSigner ------------ -The [Ledger Hardware Wallets](https://www.ledger.com) are a fairly +The [Ledger Hardware Wallets](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/www.ledger.com) are a fairly popular brand. TODO: importing @@ -35,4 +35,4 @@ determined by the environment; in node the default is "hid" and in the browser ----- -**Content Hash:** 240366cd9757f396d08ed65ebfceafa51f82bfc44c04695ab68e3560e7a0016b \ No newline at end of file +**Content Hash:** c6b6d4f14f0e973a30c3cff935960a15715712830e38cece0edfb864ba921a6c \ No newline at end of file diff --git a/docs/api/other/hardware/index.html b/docs/api/other/hardware/index.html index b5814c69..4a3b18cb 100644 --- a/docs/api/other/hardware/index.html +++ b/docs/api/other/hardware/index.html @@ -1,8 +1,8 @@ -Hardware Wallets
+Hardware Wallets

Hardware Wallets

LedgerSigner inherits Signer

The Ledger Hardware Wallets are a fairly popular brand.

TODO: importing

API

-
new LedgerSigner ( [ provider [ , type [ , path ] ] ] ) LedgerSigner

Connects to a Ledger Hardware Wallet. The type if left unspecified is determined by the environment; in node the default is "hid" and in the browser "u2f" is the default. The default Ethereum path is used if path is left unspecified.

\ No newline at end of file +
new LedgerSigner ( [ provider [ , type [ , path ] ] ] ) LedgerSigner

Connects to a Ledger Hardware Wallet. The type if left unspecified is determined by the environment; in node the default is "hid" and in the browser "u2f" is the default. The default Ethereum path is used if path is left unspecified.

\ No newline at end of file diff --git a/docs/api/other/index.html b/docs/api/other/index.html index b7bc2b9a..33d6ac6e 100644 --- a/docs/api/other/index.html +++ b/docs/api/other/index.html @@ -1,4 +1,4 @@ -Other Libraries
+Other Libraries

Other Libraries

Now that ethers is more modular, it is possible to have additional ancillary packages, which are not part of the core but optionally add functionality only needed in certain situations.

-
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/api/providers/api-providers/README.md b/docs/api/providers/api-providers/README.md index 47e53a00..cf7cdd0c 100644 --- a/docs/api/providers/api-providers/README.md +++ b/docs/api/providers/api-providers/README.md @@ -25,7 +25,7 @@ EtherscanProvider The **EtherscanProvider** is backed by a combination of the various -[Etherscan APIs](https://etherscan.io/apis). +[Etherscan APIs](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/etherscan.io/apis). #### *provider* . **getHistory** ( address ) **=>** *Array< History >* @@ -41,7 +41,7 @@ The **EtherscanProvider** is backed by a combination of the various * Homestead (Mainnet) * Ropsten (proof-of-work testnet) -* Rinkeby (proof-of-Authority testnet) +* Rinkeby (proof-of-authority testnet) * Görli (clique testnet) * Kovan (proof-of-authority testnet) @@ -52,7 +52,7 @@ InfuraProvider -------------- -The **InfuraProvider** is backed by the popular [INFURA](https://infura.io) +The **InfuraProvider** is backed by the popular [INFURA](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/infura.io) Ethereum service. @@ -62,7 +62,7 @@ Ethereum service. * Homestead (Mainnet) * Ropsten (proof-of-work testnet) -* Rinkeby (proof-of-Authority testnet) +* Rinkeby (proof-of-authority testnet) * Görli (clique testnet) * Kovan (proof-of-authority testnet) @@ -73,7 +73,7 @@ AlchemyProvider --------------- -The **AlchemtProvider** is backed by [Alchemy](https://alchemyapi.io). +The **AlchemtProvider** is backed by [Alchemy](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/alchemyapi.io). #### **Supported Networks** @@ -82,7 +82,7 @@ The **AlchemtProvider** is backed by [Alchemy](https://alchemyapi.io). * Homestead (Mainnet) * Ropsten (proof-of-work testnet) -* Rinkeby (proof-of-Authority testnet) +* Rinkeby (proof-of-authority testnet) * Görli (clique testnet) * Kovan (proof-of-authority testnet) @@ -93,8 +93,7 @@ CloudfrontProvider ------------------ -The CloudfrontProvider is backed by the -[Cloudflare Ethereum Gateway](https://developers.cloudflare.com/distributed-web/ethereum-gateway/). +The CloudfrontProvider is backed by the [Cloudflare Ethereum Gateway](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/developers.cloudflare.com/distributed-web/ethereum-gateway). #### **Supported Networks** @@ -108,4 +107,4 @@ The CloudfrontProvider is backed by the ----- -**Content Hash:** 516111e087ee3f12588ba555c0719f7170ea532e269590586c95ddc1d7eb7e7b \ No newline at end of file +**Content Hash:** 8a464bf5a272f32a697857e4e5813b1569ee9293156f77dcfa8f4bd71a8e5c9f \ No newline at end of file diff --git a/docs/api/providers/api-providers/index.html b/docs/api/providers/api-providers/index.html index f3d5d3c3..a24cc28e 100644 --- a/docs/api/providers/api-providers/index.html +++ b/docs/api/providers/api-providers/index.html @@ -1,16 +1,16 @@ -API Providers
+API Providers

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 inherits Provider

The EtherscanProvider is backed by a combination of the various Etherscan APIs.

provider . getHistory ( address ) Array< History >

@TODO... Explain

-
Supported Networks
  • Homestead (Mainnet)
  • Ropsten (proof-of-work testnet)
  • Rinkeby (proof-of-Authority testnet)
  • Görli (clique testnet)
  • Kovan (proof-of-authority testnet)
+
Supported Networks
  • Homestead (Mainnet)
  • Ropsten (proof-of-work testnet)
  • Rinkeby (proof-of-authority testnet)
  • Görli (clique testnet)
  • Kovan (proof-of-authority testnet)

InfuraProvider inherits UrlJsonRpcProvider

The InfuraProvider is backed by the popular INFURA Ethereum service.

-
Supported Networks
  • Homestead (Mainnet)
  • Ropsten (proof-of-work testnet)
  • Rinkeby (proof-of-Authority testnet)
  • Görli (clique testnet)
  • Kovan (proof-of-authority testnet)
+
Supported Networks
  • Homestead (Mainnet)
  • Ropsten (proof-of-work testnet)
  • Rinkeby (proof-of-authority testnet)
  • Görli (clique testnet)
  • Kovan (proof-of-authority testnet)

AlchemyProvider inherits UrlJsonRpcProvider

The AlchemtProvider is backed by Alchemy.

-
Supported Networks
  • Homestead (Mainnet)
  • Ropsten (proof-of-work testnet)
  • Rinkeby (proof-of-Authority testnet)
  • Görli (clique testnet)
  • Kovan (proof-of-authority testnet)
+
Supported Networks
  • Homestead (Mainnet)
  • Ropsten (proof-of-work testnet)
  • Rinkeby (proof-of-authority testnet)
  • Görli (clique testnet)
  • Kovan (proof-of-authority testnet)

CloudfrontProvider inherits UrlJsonRpcProvider

The CloudfrontProvider is backed by the Cloudflare Ethereum Gateway.

-
Supported Networks
  • Homestead (Mainnet)
\ No newline at end of file +
Supported Networks
  • Homestead (Mainnet)
\ No newline at end of file diff --git a/docs/api/providers/index.html b/docs/api/providers/index.html index d7e37f1d..32b52c2c 100644 --- a/docs/api/providers/index.html +++ b/docs/api/providers/index.html @@ -1,4 +1,4 @@ -Providers
+Providers

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

@@ -6,4 +6,4 @@
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.

Provider Documentation

-
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/api/providers/jsonrpc-provider/README.md b/docs/api/providers/jsonrpc-provider/README.md index 11fe7a7e..10caf36c 100644 --- a/docs/api/providers/jsonrpc-provider/README.md +++ b/docs/api/providers/jsonrpc-provider/README.md @@ -9,11 +9,11 @@ JsonRpcProvider =============== -The [JSON-RPC API](https://github.com/ethereum/wiki/wiki/JSON-RPC) is a +The [JSON-RPC API](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/github.com/ethereum/wiki/wiki/JSON-RPC) is a very popular method for interacting with Ethereum and is available in all -major Ethereum node implementations (e.g. [Geth](https://geth.ethereum.org) -and [Parity](https://www.parity.io)) as well as many third-party web -services (e.g. [INFURA](https://infura.io)) +major Ethereum node implementations (e.g. [Geth](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/geth.ethereum.org) +and [Parity](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/www.parity.io)) as well as many third-party web +services (e.g. [INFURA](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/infura.io)) #### **new** *ethers* . *providers* . **JsonRpcProvider** ( [ url [ , aNetworkish ] ] ) @@ -131,4 +131,4 @@ transaction hash quickly, if that is all that is required. ----- -**Content Hash:** 4d82738b8e1db6b6421b7234b0d302c35aa25aed707ab2cfb0798e2613e41abd \ No newline at end of file +**Content Hash:** d05797dcbeabc9dbd764aad98f3c9346b4350e955a4a6210d6d0a6ea17d3a50b \ No newline at end of file diff --git a/docs/api/providers/jsonrpc-provider/index.html b/docs/api/providers/jsonrpc-provider/index.html index ea35b82a..307e66c8 100644 --- a/docs/api/providers/jsonrpc-provider/index.html +++ b/docs/api/providers/jsonrpc-provider/index.html @@ -1,4 +1,4 @@ -JSON-RPC Provider
+JSON-RPC Provider

JsonRpcProvider inherits Provider

The JSON-RPC API is a very popular method for interacting with Ethereum and is available in all major Ethereum node implementations (e.g. Geth and Parity) as well as many third-party web services (e.g. INFURA)

new ethers . providers . JsonRpcProvider ( [ url [ , aNetworkish ] ] )

Connect to a JSON-RPC API located at url using the /aNetworkish network. If url is not specified, the default (i.e. http:localhost:8545) is used and if no network is specified, it will be determined automatically by querying the node.

@@ -14,4 +14,4 @@
signer . sendUncheckedTransaction ( transaction ) Promise< string< DataHexstring< 32 > > >

Sends the transaction and returns a Promise which resolves to the opacque transaction hash.

signer . unlock ( password ) Promise< boolean >

Request the node unlock the account (if locked) using password.

JsonRpcUncheckedSigner inherits Signer

-

The JSON-RPC API only provides a transaction hash as the response when a transaction is sent, but the ethers Provider requires populating all details of a transaction before returning it. For example, the gas price and gas limit may be adjusted by the node or the nonce automatically included, in which case the opaque transaction hash has discarded this.

To remedy this, the JsonRpcSigner immeidately queries the provider for the details using the returned transaction hash to populate the TransactionResponse object.

Some backends do not respond immediately and instead defer releasing the details of a transaction it was responsible for signing until it is mined.

The UncheckedSigner does not populate any additional information and will immediately return the result as a mock TransactionResponse-like object, with most of the properties set to null, but allows access to the transaction hash quickly, if that is all that is required.

\ No newline at end of file +

The JSON-RPC API only provides a transaction hash as the response when a transaction is sent, but the ethers Provider requires populating all details of a transaction before returning it. For example, the gas price and gas limit may be adjusted by the node or the nonce automatically included, in which case the opaque transaction hash has discarded this.

To remedy this, the JsonRpcSigner immeidately queries the provider for the details using the returned transaction hash to populate the TransactionResponse object.

Some backends do not respond immediately and instead defer releasing the details of a transaction it was responsible for signing until it is mined.

The UncheckedSigner does not populate any additional information and will immediately return the result as a mock TransactionResponse-like object, with most of the properties set to null, but allows access to the transaction hash quickly, if that is all that is required.

\ No newline at end of file diff --git a/docs/api/providers/other/README.md b/docs/api/providers/other/README.md index 1bcc1281..a77de988 100644 --- a/docs/api/providers/other/README.md +++ b/docs/api/providers/other/README.md @@ -161,13 +161,11 @@ Web3Provider ------------ -The Web3Provider is meant to ease moving from a [web3.js based](https://github.com/ethereum/web3.js) +The Web3Provider is meant to ease moving from a [web3.js based](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/github.com/ethereum/web3.js) application to ethers by wraping an existing Web3-compatible (such as a -[Web3HttpProvider](https://github.com/ethereum/web3.js/tree/1.x/packages/web3-providers-http) -[Web3IpcProvider](https://github.com/ethereum/web3.js/tree/1.x/packages/web3-providers-ipc) or -[Web3WsProvider](https://github.com/ethereum/web3.js/tree/1.x/packages/web3-providers-ws)) -and exposing it as an ethers.js [Provider](../provider) which can then be used with the rest of -the library. +[Web3HttpProvider](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/github.com/ethereum/web3.js/tree/1.x/packages/web3-providers-http)[Web3IpcProvider](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/github.com/ethereum/web3.js/tree/1.x/packages/web3-providers-ipc) or +[Web3WsProvider](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/github.com/ethereum/web3.js/tree/1.x/packages/web3-providers-ws)) and exposing it as an ethers.js [Provider](../provider) +which can then be used with the rest of the library. #### **new** *ethers* . *providers* . **Web3Provider** ( web3Provider [ , network ] ) @@ -187,4 +185,4 @@ The provider used to create this instance. ----- -**Content Hash:** 95791f5b36e1becb2e1222424eb25b0b14743670c827dea2041b048e686d2118 \ No newline at end of file +**Content Hash:** 38479cce7fbf5192e1085bce407362ec5169b3a56f42f27e515a623ffeab670b \ No newline at end of file diff --git a/docs/api/providers/other/index.html b/docs/api/providers/other/index.html index d7947b4b..c685ed9b 100644 --- a/docs/api/providers/other/index.html +++ b/docs/api/providers/other/index.html @@ -1,7 +1,7 @@ -Other Providers
+Other Providers

Other Providers

Others...

-

FallbackProvider inherits Provider

+

FallbackProvider inherits Provider

The FallbackProvider is the most advanced Provider available in ethers.

It uses a quorum and connects to multiple Providers as backends, each configured with a priority and a weight .

When a request is made, the request is dispatched to multiple backends, randomly choosen (higher prioirty backends are always selected first) and the results from each are compared against the others. Only once the quorum has been reached will that result be accepted and returned to the caller.

By default the quorum requires 50% (rounded up) of the backends to agree. The weight can be used to give a backend Provider more influence.

new ethers . providers . FallbackProvider ( providers [ , quorum ] )

Creates a new instance of a FallbackProvider connected to providers. If quorum is not specified, half of the total sum of the provider weights is used.

The providers can be either an array of Provider or FallbackProviderConfig. If a Provider is provided, the defaults are a priority of 1 and a weight of 1.

provider . providerConfigs Array< FallbackProviderConfig >

The list of Provider Configurations that describe the backends.

@@ -15,13 +15,13 @@

IpcProvider inherits JsonRpcProvider

The IpcProvider allows the JSON-RPC API to be used over a local filename on the file system, exposed by Geth, Parity and other nodes.

This is only available in node.js (as it requires file system access, and may have additional complications due to file permissions. See any related notes on the documentation for the actual node implementation websites.

ipcProvider . path string

The path this Provider is connected to.

-

UrlJsonRpcProvider inherits JsonRpcProvider

+

UrlJsonRpcProvider inherits JsonRpcProvider

This class is intended to be sub-classed and not used directly. It simplifies creating a Provider where a normal JsonRpcProvider would suffice, with a little extra effort needed to generate the JSON-RPC URL.

new ethers . providers . UrlJsonRpcProvider ( [ network [ , apiKey ] ] )

Sub-classes do not need to override this. Instead they should override the static method getUrl and optionally getApiKey.

urlJsonRpcProvider . apiKey any

The value of the apiKey that was returned from InheritedClass.getApiKey.

InheritingClass . getApiKey ( apiKey ) any

This function should examine the apiKey to ensure it is valid and return a (possible modified) value to use in getUrl.

InheritingClass . getUrl ( network , apiKey ) string

The URL to use for the JsonRpcProvider instance.

Web3Provider inherits JsonRpcProvider

-

The Web3Provider is meant to ease moving from a web3.js based application to ethers by wraping an existing Web3-compatible (such as a Web3HttpProvider Web3IpcProvider or Web3WsProvider) and exposing it as an ethers.js Provider which can then be used with the rest of the library.

+

The Web3Provider is meant to ease moving from a web3.js based application to ethers by wraping an existing Web3-compatible (such as a Web3HttpProviderWeb3IpcProvider or Web3WsProvider) and exposing it as an ethers.js Provider which can then be used with the rest of the library.

new ethers . providers . Web3Provider ( web3Provider [ , network ] )

Create a new Web3Provider, which wraps an [EIP-1193 Provider]() or Web3Provider-compatible Provider.

-
web3Provider . provider Web3CompatibleProvider

The provider used to create this instance.

\ No newline at end of file +
web3Provider . provider Web3CompatibleProvider

The provider used to create this instance.

\ No newline at end of file diff --git a/docs/api/providers/provider/README.md b/docs/api/providers/provider/README.md index 430daa23..7bf19071 100644 --- a/docs/api/providers/provider/README.md +++ b/docs/api/providers/provider/README.md @@ -53,21 +53,7 @@ sent to the network. ```javascript -// Get the balance for an account... -provider.getBalance("ricmoo.firefly.eth"); -// { Promise: { BigNumber: "2049005886712300740" } } - -// Get the code for a contract... -provider.getCode("registrar.firefly.eth"); -// { Promise: "0x606060405236156100885763ffffffff60e060020a60003504166369fe0e2d81146100fa578063704b6c021461010f57806379502c551461012d578063bed866f614610179578063c37067fa1461019e578063c66485b2146101ab578063d80528ae146101c9578063ddca3f43146101f7578063f2c298be14610219578063f3fef3a314610269575b6100f85b6000808052600760209081527f6d5257204ebe7d88fd91ae87941cb2dd9d8062b64ae5a2bd2d28ec40b9fbf6df80543490810190915560408051918252517fdb7750418f9fa390aaf85d881770065aa4adbe46343bcff4ae573754c829d9af929181900390910190a25b565b005b341561010257fe5b6100f860043561028a565b005b341561011757fe5b6100f8600160a060020a03600435166102ec565b005b341561013557fe5b61013d610558565b60408051600160a060020a0396871681526020810195909552928516848401526060840191909152909216608082015290519081900360a00190f35b341561018157fe5b61018c600435610580565b60408051918252519081900360200190f35b6100f8600435610595565b005b34156101b357fe5b6100f8600160a060020a03600435166105e6565b005b34156101d157fe5b6101d9610676565b60408051938452602084019290925282820152519081900360600190f35b34156101ff57fe5b61018c61068d565b60408051918252519081900360200190f35b6100f8600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375094965061069495505050505050565b005b341561027157fe5b6100f8600160a060020a0360043516602435610ab2565b005b60025433600160a060020a039081169116146102a65760006000fd5b600454604080519182526020820183905280517f854231545a00e13c316c82155f2b8610d638e9ff6ebc4930676f84a5af08a49a9281900390910190a160048190555b50565b60025433600160a060020a039081169116146103085760006000fd5b60025460408051600160a060020a039283168152918316602083015280517fbadc9a52979e89f78b7c58309537410c5e51d0f63a0a455efe8d61d2b474e6989281900390910190a16002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038381169190911790915560008054604080516020908101849052815160e060020a6302571be30281527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152915192909416936302571be39360248084019492938390030190829087803b15156103e957fe5b60325a03f115156103f657fe5b50505060405180519050600160a060020a0316631e83409a826000604051602001526040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b151561045f57fe5b60325a03f1151561046c57fe5b50506040805160008054600354602093840183905284517f0178b8bf00000000000000000000000000000000000000000000000000000000815260048101919091529351600160a060020a039091169450630178b8bf9360248082019493918390030190829087803b15156104dd57fe5b60325a03f115156104ea57fe5b505060408051805160035460025460e860020a62d5fa2b0284526004840191909152600160a060020a03908116602484015292519216925063d5fa2b0091604480830192600092919082900301818387803b151561054457fe5b60325a03f1151561055157fe5b5050505b50565b600054600354600254600454600154600160a060020a039485169492831692165b9091929394565b6000818152600760205260409020545b919050565b6000818152600760209081526040918290208054349081019091558251908152915183927fdb7750418f9fa390aaf85d881770065aa4adbe46343bcff4ae573754c829d9af92908290030190a25b50565b60025433600160a060020a039081169116146106025760006000fd5b60015460408051600160a060020a039283168152918316602083015280517f279875333405c968e401e3bc4e71d5f8e48728c90f4e8180ce28f74efb5669209281900390910190a16001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b600654600554600160a060020a033016315b909192565b6004545b90565b80516001820190600080808060048510806106af5750601485115b156106ba5760006000fd5b600093505b8484101561072a57855160ff16925060618310806106e05750607a8360ff16115b80156106fc575060308360ff1610806106fc575060398360ff16115b5b801561070d57508260ff16602d14155b156107185760006000fd5b6001909501945b6001909301926106bf565b60045434101561073a5760006000fd5b866040518082805190602001908083835b6020831061076a5780518252601f19909201916020918201910161074b565b51815160209384036101000a60001901801990921691161790526040805192909401829003822060035483528282018190528451928390038501832060008054948401819052865160e060020a6302571be3028152600481018390529651929a509098509650600160a060020a0390921694506302571be393602480820194509192919082900301818787803b15156107ff57fe5b60325a03f1151561080c57fe5b505060405151600160a060020a031691909114905061082b5760006000fd5b60008054600354604080517f06ab5923000000000000000000000000000000000000000000000000000000008152600481019290925260248201869052600160a060020a03308116604484015290519216926306ab59239260648084019382900301818387803b151561089a57fe5b60325a03f115156108a757fe5b505060008054600154604080517f1896f70a00000000000000000000000000000000000000000000000000000000815260048101879052600160a060020a0392831660248201529051919092169350631896f70a9260448084019391929182900301818387803b151561091657fe5b60325a03f1151561092357fe5b50506001546040805160e860020a62d5fa2b02815260048101859052600160a060020a033381166024830152915191909216925063d5fa2b009160448082019260009290919082900301818387803b151561097a57fe5b60325a03f1151561098757fe5b505060008054604080517f5b0fc9c300000000000000000000000000000000000000000000000000000000815260048101869052600160a060020a0333811660248301529151919092169350635b0fc9c39260448084019391929182900301818387803b15156109f357fe5b60325a03f11515610a0057fe5b505060058054349081019091556006805460010190556000838152600760209081526040918290208054840190558151600160a060020a03331681529081019290925280518493507f179ef3319e6587f6efd3157b34c8b357141528074bcb03f9903589876168fa149281900390910190a260408051348152905182917fdb7750418f9fa390aaf85d881770065aa4adbe46343bcff4ae573754c829d9af919081900360200190a25b50505050505050565b60025433600160a060020a03908116911614610ace5760006000fd5b604051600160a060020a0383169082156108fc029083906000818181858888f193505050501515610aff5760006000fd5b60408051600160a060020a03841681526020810183905281517fac375770417e1cb46c89436efcf586a74d0298fee9838f66a38d40c65959ffda929181900390910190a15b50505600a165627a7a723058205c3628c01dc80233f51979d91a76cec2a25d84e86c9838d34672734ca2232b640029" } - -// Get the storage value at position 0... -provider.getStorageAt("registrar.firefly.eth", 0) -// { Promise: "0x000000000000000000000000314159265dd8dbb310642f98f50c066173c1259b" } - -// Get transaction count of an account... -provider.getTransactionCount("ricmoo.firefly.eth"); -// { Promise: 608 } +Skipping JavaScript Evaluation. ``` @@ -123,13 +109,7 @@ not have an address configured, `null` is returned. ```javascript -// Reverse lookup of an ENS by address... -provider.lookupAddress("0x6fC21092DA55B392b045eD78F4732bff3C580e2c"); -// { Promise: "registrar.firefly.eth" } - -// Lookup an address of an ENS name... -provider.resolveName("ricmoo.firefly.eth"); -// { Promise: "0x8ba1f109551bD432803012645Ac136ddd64DBA72" } +Skipping JavaScript Evaluation. ``` @@ -293,4 +273,4 @@ Returns true if and only if *object* is a Provider. ----- -**Content Hash:** 87f4f33bb310790874b49a3f2295ecc85bf3249bb7908f81a5324483767add72 \ No newline at end of file +**Content Hash:** 84bebb527966dbb498f230579a26f0a01f8013a69a490b77726126165262f661 \ No newline at end of file diff --git a/docs/api/providers/provider/index.html b/docs/api/providers/provider/index.html index f82cc09e..e77fc038 100644 --- a/docs/api/providers/provider/index.html +++ b/docs/api/providers/provider/index.html @@ -1,51 +1,51 @@ -Abstract Provider
+Abstract Provider

Provider

Explain what a provider is...

Accounts Methods

-
provider . getBalance ( address [ , blockTag = "latest" ] ) Promise< BigNumber >

Returns the balance of address as of the blockTag block height.

-
provider . getCode ( address [ , blockTag = "latest" ] ) Promise< string< DataHexstring > >

Returns the contract code of address as of the blockTag block height. If there is no contract currently deployed, the result is 0x.

-
provider . getStorageAt ( addr , pos [ , blockTag = "latest" ] ) Promise< string< DataHexstring > >

Returns the Bytes32 value of the position pos at address addr, as of the blockTag.

-
provider . getTransactionCount ( address [ , blockTag = "latest" ] ) Promise< number >

Returns the number of transactions address has ever sent, as of blockTag. This value is required to be the nonce for the next transaction from address sent to the network.

+
provider . getBalance ( address [ , blockTag = "latest" ] ) Promise< BigNumber >

Returns the balance of address as of the blockTag block height.

+
provider . getCode ( address [ , blockTag = "latest" ] ) Promise< string< DataHexstring > >

Returns the contract code of address as of the blockTag block height. If there is no contract currently deployed, the result is 0x.

+
provider . getStorageAt ( addr , pos [ , blockTag = "latest" ] ) Promise< string< DataHexstring > >

Returns the Bytes32 value of the position pos at address addr, as of the blockTag.

+
provider . getTransactionCount ( address [ , blockTag = "latest" ] ) Promise< number >

Returns the number of transactions address has ever sent, as of blockTag. This value is required to be the nonce for the next transaction from address sent to the network.

Examples

-

// Get the balance for an account...
provider.getBalance("ricmoo.firefly.eth");
// { Promise: { BigNumber: "2049005886712300740" } }

// Get the code for a contract...
provider.getCode("registrar.firefly.eth");
// { Promise: "0x606060405236156100885763ffffffff60e060020a60003504166369fe0e2d81146100fa578063704b6c021461010f57806379502c551461012d578063bed866f614610179578063c37067fa1461019e578063c66485b2146101ab578063d80528ae146101c9578063ddca3f43146101f7578063f2c298be14610219578063f3fef3a314610269575b6100f85b6000808052600760209081527f6d5257204ebe7d88fd91ae87941cb2dd9d8062b64ae5a2bd2d28ec40b9fbf6df80543490810190915560408051918252517fdb7750418f9fa390aaf85d881770065aa4adbe46343bcff4ae573754c829d9af929181900390910190a25b565b005b341561010257fe5b6100f860043561028a565b005b341561011757fe5b6100f8600160a060020a03600435166102ec565b005b341561013557fe5b61013d610558565b60408051600160a060020a0396871681526020810195909552928516848401526060840191909152909216608082015290519081900360a00190f35b341561018157fe5b61018c600435610580565b60408051918252519081900360200190f35b6100f8600435610595565b005b34156101b357fe5b6100f8600160a060020a03600435166105e6565b005b34156101d157fe5b6101d9610676565b60408051938452602084019290925282820152519081900360600190f35b34156101ff57fe5b61018c61068d565b60408051918252519081900360200190f35b6100f8600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375094965061069495505050505050565b005b341561027157fe5b6100f8600160a060020a0360043516602435610ab2565b005b60025433600160a060020a039081169116146102a65760006000fd5b600454604080519182526020820183905280517f854231545a00e13c316c82155f2b8610d638e9ff6ebc4930676f84a5af08a49a9281900390910190a160048190555b50565b60025433600160a060020a039081169116146103085760006000fd5b60025460408051600160a060020a039283168152918316602083015280517fbadc9a52979e89f78b7c58309537410c5e51d0f63a0a455efe8d61d2b474e6989281900390910190a16002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038381169190911790915560008054604080516020908101849052815160e060020a6302571be30281527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152915192909416936302571be39360248084019492938390030190829087803b15156103e957fe5b60325a03f115156103f657fe5b50505060405180519050600160a060020a0316631e83409a826000604051602001526040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b151561045f57fe5b60325a03f1151561046c57fe5b50506040805160008054600354602093840183905284517f0178b8bf00000000000000000000000000000000000000000000000000000000815260048101919091529351600160a060020a039091169450630178b8bf9360248082019493918390030190829087803b15156104dd57fe5b60325a03f115156104ea57fe5b505060408051805160035460025460e860020a62d5fa2b0284526004840191909152600160a060020a03908116602484015292519216925063d5fa2b0091604480830192600092919082900301818387803b151561054457fe5b60325a03f1151561055157fe5b5050505b50565b600054600354600254600454600154600160a060020a039485169492831692165b9091929394565b6000818152600760205260409020545b919050565b6000818152600760209081526040918290208054349081019091558251908152915183927fdb7750418f9fa390aaf85d881770065aa4adbe46343bcff4ae573754c829d9af92908290030190a25b50565b60025433600160a060020a039081169116146106025760006000fd5b60015460408051600160a060020a039283168152918316602083015280517f279875333405c968e401e3bc4e71d5f8e48728c90f4e8180ce28f74efb5669209281900390910190a16001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b600654600554600160a060020a033016315b909192565b6004545b90565b80516001820190600080808060048510806106af5750601485115b156106ba5760006000fd5b600093505b8484101561072a57855160ff16925060618310806106e05750607a8360ff16115b80156106fc575060308360ff1610806106fc575060398360ff16115b5b801561070d57508260ff16602d14155b156107185760006000fd5b6001909501945b6001909301926106bf565b60045434101561073a5760006000fd5b866040518082805190602001908083835b6020831061076a5780518252601f19909201916020918201910161074b565b51815160209384036101000a60001901801990921691161790526040805192909401829003822060035483528282018190528451928390038501832060008054948401819052865160e060020a6302571be3028152600481018390529651929a509098509650600160a060020a0390921694506302571be393602480820194509192919082900301818787803b15156107ff57fe5b60325a03f1151561080c57fe5b505060405151600160a060020a031691909114905061082b5760006000fd5b60008054600354604080517f06ab5923000000000000000000000000000000000000000000000000000000008152600481019290925260248201869052600160a060020a03308116604484015290519216926306ab59239260648084019382900301818387803b151561089a57fe5b60325a03f115156108a757fe5b505060008054600154604080517f1896f70a00000000000000000000000000000000000000000000000000000000815260048101879052600160a060020a0392831660248201529051919092169350631896f70a9260448084019391929182900301818387803b151561091657fe5b60325a03f1151561092357fe5b50506001546040805160e860020a62d5fa2b02815260048101859052600160a060020a033381166024830152915191909216925063d5fa2b009160448082019260009290919082900301818387803b151561097a57fe5b60325a03f1151561098757fe5b505060008054604080517f5b0fc9c300000000000000000000000000000000000000000000000000000000815260048101869052600160a060020a0333811660248301529151919092169350635b0fc9c39260448084019391929182900301818387803b15156109f357fe5b60325a03f11515610a0057fe5b505060058054349081019091556006805460010190556000838152600760209081526040918290208054840190558151600160a060020a03331681529081019290925280518493507f179ef3319e6587f6efd3157b34c8b357141528074bcb03f9903589876168fa149281900390910190a260408051348152905182917fdb7750418f9fa390aaf85d881770065aa4adbe46343bcff4ae573754c829d9af919081900360200190a25b50505050505050565b60025433600160a060020a03908116911614610ace5760006000fd5b604051600160a060020a0383169082156108fc029083906000818181858888f193505050501515610aff5760006000fd5b60408051600160a060020a03841681526020810183905281517fac375770417e1cb46c89436efcf586a74d0298fee9838f66a38d40c65959ffda929181900390910190a15b50505600a165627a7a723058205c3628c01dc80233f51979d91a76cec2a25d84e86c9838d34672734ca2232b640029" }

// Get the storage value at position 0...
provider.getStorageAt("registrar.firefly.eth", 0)
// { Promise: "0x000000000000000000000000314159265dd8dbb310642f98f50c066173c1259b" }

// Get transaction count of an account...
provider.getTransactionCount("ricmoo.firefly.eth");
// { Promise: 608 }
+
Skipping JavaScript Evaluation.

Blocks Methods

-
provider . getBlock ( block ) Promise< Block >

Get the block from the network, where the result.transactions is a list of transaction hashes.

-
provider . getBlockWithTransactions ( block ) Promise< BlockWithTransactions >

Get the block from the network, where the result.transactions is an Array of TransactionResponse objects.

+
provider . getBlock ( block ) Promise< Block >

Get the block from the network, where the result.transactions is a list of transaction hashes.

+
provider . getBlockWithTransactions ( block ) Promise< BlockWithTransactions >

Get the block from the network, where the result.transactions is an Array of TransactionResponse objects.

Ethereum Naming Service (ENS) Methods

TODO: Explain ENS here...

-
provider . lookupAddress ( address ) Promise< string >

Performs a reverse lookup of the address in ENS using the Reverse Registrar. If the name does not exist, or the forward lookup does not match, null is returned.

-
provider . resolveName ( name ) Promise< string< Address > >

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.

+
provider . lookupAddress ( address ) Promise< string >

Performs a reverse lookup of the address in ENS using the Reverse Registrar. If the name does not exist, or the forward lookup does not match, null is returned.

+
provider . resolveName ( name ) Promise< string< Address > >

Looks up the address of name. If the name is not owned, or does not have a Resolver configured, or the Resolver does not have an address configured, null is returned.

Examples

-

// Reverse lookup of an ENS by address...
provider.lookupAddress("0x6fC21092DA55B392b045eD78F4732bff3C580e2c");
// { Promise: "registrar.firefly.eth" }

// Lookup an address of an ENS name...
provider.resolveName("ricmoo.firefly.eth");
// { Promise: "0x8ba1f109551bD432803012645Ac136ddd64DBA72" }

+
Skipping JavaScript Evaluation.

Logs Methods

-
provider . getLogs ( filter ) Promise< Array< Log > >

Returns the Array of 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.

+
provider . getLogs ( filter ) Promise< Array< Log > >

Returns the Array of 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.

Network Status Methods

provider . getNetwork ( ) Promise< Network >

Returns the Network this Provider is connected to.

-
provider . getBlockNumber ( ) Promise< number >

Returns the block number (or height) of the most recently mined block.

-
provider . getGasPrice ( ) Promise< BigNumber >

Returns a best guess of the Gas Price to use in a transaction.

+
provider . getBlockNumber ( ) Promise< number >

Returns the block number (or height) of the most recently mined block.

+
provider . getGasPrice ( ) Promise< BigNumber >

Returns a best guess of the Gas Price to use in a transaction.

Transactions Methods

-
provider . call ( transaction [ , blockTag = "latest" ] ) Promise< string< 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.

-
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.

-
provider . sendTransaction ( transaction ) Promise< 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).

+
provider . call ( transaction [ , blockTag = "latest" ] ) Promise< string< 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.

+
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.

+
provider . sendTransaction ( transaction ) Promise< 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).

provider . waitForTransaction ( transactionHash ) Promise< TransactionReceipt >

Returns a Promise which will not resolve until transactionHash is mined.

Event Emitter Methods

Explain events here...

-
provider . on ( eventName , listener ) this

Add a listener to be triggered for each eventName.

-
provider . once ( eventName , listener ) this

Add a listener to be triggered for only the next eventName, at which time it be removed.

-
provider . emit ( eventName , ...args ) boolean

Notify all listeners of eventName, passing args to each listener. This is generally only used internally.

-
provider . off ( eventName [ , listener ] ) this

Remove a listener for eventName. If no listener is provided, all listeners for eventName are removed.

-
provider . removeAllListeners ( [ eventName ] ) this

Remove all the listeners for eventName. If no eventName is provided, all events are removed.

-
provider . listenerCount ( [ eventName ] ) number

Returns the number of listeners for eventName. If no eventName is provided, the total number of listeners is returned.

-
provider . listeners ( eventName ) Array< Listener >

Returns the list of Listeners for eventName.

+
provider . on ( eventName , listener ) this

Add a listener to be triggered for each eventName.

+
provider . once ( eventName , listener ) this

Add a listener to be triggered for only the next eventName, at which time it be removed.

+
provider . emit ( eventName , ...args ) boolean

Notify all listeners of eventName, passing args to each listener. This is generally only used internally.

+
provider . off ( eventName [ , listener ] ) this

Remove a listener for eventName. If no listener is provided, all listeners for eventName are removed.

+
provider . removeAllListeners ( [ eventName ] ) this

Remove all the listeners for eventName. If no eventName is provided, all events are removed.

+
provider . listenerCount ( [ eventName ] ) number

Returns the number of listeners for eventName. If no eventName is provided, the total number of listeners is returned.

+
provider . listeners ( eventName ) Array< Listener >

Returns the list of Listeners for eventName.

Inspection Methods

-
Provider . isProvider ( object ) boolean

Returns true if and only if object is a Provider.

\ No newline at end of file +
Provider . isProvider ( object ) boolean

Returns true if and only if object is a Provider.

\ No newline at end of file diff --git a/docs/api/providers/types/README.md b/docs/api/providers/types/README.md index a582bc3a..de6cf36a 100644 --- a/docs/api/providers/types/README.md +++ b/docs/api/providers/types/README.md @@ -380,7 +380,7 @@ The amount (in wei) this transaction is sending. #### *transactionRequest* . **chainId** **=>** *number|Promise< number >* The chain ID this transaction is authorized on, as specified by -[EIP-155](https://eips.ethereum.org/EIPS/eip-155). +[EIP-155](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/eips.ethereum.org/EIPS/eip-155). If the chain ID is 0 will disable EIP-155 and the transaction will be valid on any network. This can be **dangerous** and care should be taken, since it @@ -488,7 +488,7 @@ the block this transaction was mined in. The intermediate state root of a receipt. -Only transactions included in blocks **before** the [Byzantium Hard Fork](https://eips.ethereum.org/EIPS/eip-609) +Only transactions included in blocks **before** the [Byzantium Hard Fork](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/eips.ethereum.org/EIPS/eip-609) have this property, as it was replaced by the `status` property. The property is generally of little use to developers. At the time @@ -508,7 +508,7 @@ The amount of gas actually used by this transaction. #### *receipt* . **logsBloom** **=>** *string< [DataHexstring](../../utils/bytes) >* -A [bloom-filter](https://en.wikipedia.org/wiki/Bloom_filter), which +A [bloom-filter](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/Bloom_filter), which incldues all the addresses and topics included in any log in this transaction. @@ -565,7 +565,7 @@ This is generally of little interest to developers. #### *receipt* . **byzantium** **=>** *boolean* -This is true if the block is in a [post-Byzantium Hard Fork](https://eips.ethereum.org/EIPS/eip-609) +This is true if the block is in a [post-Byzantium Hard Fork](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/eips.ethereum.org/EIPS/eip-609) block. @@ -574,7 +574,7 @@ block. #### *receipt* . **status** **=>** *boolean* The status of a transaction is 1 is successful or 0 if it was -reverted. Only transactions included in blocks [post-Byzantium Hard Fork](https://eips.ethereum.org/EIPS/eip-609) +reverted. Only transactions included in blocks [post-Byzantium Hard Fork](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/eips.ethereum.org/EIPS/eip-609) have this property. @@ -582,4 +582,4 @@ have this property. ----- -**Content Hash:** ef41b33439a40aa374a5af245d4320705c3a647c86f90d9bb8c127503e2477c9 \ No newline at end of file +**Content Hash:** 8e36229154dd0afe40cd45ca1043bde05c78a54779aa56728d8ba585ba288978 \ No newline at end of file diff --git a/docs/api/providers/types/index.html b/docs/api/providers/types/index.html index 474c4f1a..279d5e39 100644 --- a/docs/api/providers/types/index.html +++ b/docs/api/providers/types/index.html @@ -1,4 +1,4 @@ -Types
+Types

Types

BlockTag

@@ -89,4 +89,4 @@
receipt . confirmations number

The number of blocks that have been mined since this transaction, including the actual block it was mined in.

receipt . cumulativeGasUsed BigNumber

For the block this transaction was included in, this is the sum of the gas used used by each transaction in the ordered list of transactions up to (and including) this transaction.

This is generally of little interest to developers.

receipt . byzantium boolean

This is true if the block is in a post-Byzantium Hard Fork block.

-
receipt . status boolean

The status of a transaction is 1 is successful or 0 if it was reverted. Only transactions included in blocks post-Byzantium Hard Fork have this property.

\ No newline at end of file +
receipt . status boolean

The status of a transaction is 1 is successful or 0 if it was reverted. Only transactions included in blocks post-Byzantium Hard Fork have this property.

\ No newline at end of file diff --git a/docs/api/signer/index.html b/docs/api/signer/index.html index 51889146..e45fc02a 100644 --- a/docs/api/signer/index.html +++ b/docs/api/signer/index.html @@ -1,11 +1,11 @@ -Signer
+Signer

Signers

A Signer represents...

Signer

The Signer class is abstract and cannot be directly instaniated. Instead use one of the concreate sub-classes, such as the Wallet, VoidSigner or JsonRpcSigner.

signer . connect ( provider ) Signer

Sub-classes must implement this, however they may simply throw an error if changing providers is not supported.

signer . getAddress ( ) Promise< string< Address > >

Returns a Promise that resolves to the account address.

This is a Promise so that a Signer can be designed around an asynchronous source, such as hardware wallets.

Sub-classes must implement this.

-
Signer . isSigner ( object ) boolean

Returns true if an only if object is a Signer.

+
Signer . isSigner ( object ) boolean

Returns true if an only if object is a Signer.

Blockchain Methods

signer . getBalance ( [ blockTag = "latest" ] ) Promise< BigNumber >

Returns the balance of this wallet at blockTag.

@@ -29,8 +29,8 @@

Wallet inherits ExternallyOwnedAccount and Signer

The Wallet class inherits Signer and can sign transactions and messages using a private key as a standard Externally Owned Account (EOA).

new ethers . Wallet ( privateKey [ , provider ] )

Create a new Wallet instance for privateKey and optionally connected to the provider.

-
ethers . Wallet . createRandom ( [ options = {} ] ) Wallet

Returns a new Wallet with a random private key, generated from cryptographically secure entropy sources. If the current environment does not have a secure entropy source, an error is thrown.

-
ethers . Wallet . fromEncryptedJson ( json , password [ , progress ] ) Promise< Wallet >

Create an instance from an encrypted JSON wallet. If progress is provided it will be called during decryption with a value between 0 and 1 indicating the progress towards completion.

+
ethers . Wallet . createRandom ( [ options = {} ] ) Wallet

Returns a new Wallet with a random private key, generated from cryptographically secure entropy sources. If the current environment does not have a secure entropy source, an error is thrown.

+
ethers . Wallet . fromEncryptedJson ( json , password [ , progress ] ) Promise< Wallet >

Create an instance from an encrypted JSON wallet. If progress is provided it will be called during decryption with a value between 0 and 1 indicating the progress towards completion.

ethers . Wallet . fromMnemonic ( mnemonic [ , path , [ wordlist ] ] ) Wallet

Create an instance from a mnemonic phrase.

If path is not specified, the Ethereum default path is used (i.e. m/44'/60'/0'/0/0).

If wordlist is not specified, the English Wordlist is used.

Properties

@@ -41,7 +41,7 @@

Methods

wallet . encrypt ( password , [ options = {} , [ progress ] ] ) Promise< string >

Encrypt the wallet using password returning a Promise which resolves to a JSON wallet.

-

VoidSigner inherits Signer

+

VoidSigner inherits Signer

A VoidSigner is a simple Signer which cannot sign.

It is useful as a read-only signer, when an API requires a Signer as a parameter, but it is known only read-only operations will be carried.

For example, the call operation will automatically have the provided address passed along during the execution.

new ethers . VoidSigner ( address ) VoidSigner

Create a new instance of a VoidSigner for address.

voidSigner . address string< Address >

The address of this VoidSigner.

@@ -50,4 +50,4 @@
eoa . address string< Address >

The Address of this EOA.

eoa . privateKey string< DataHexstring< 32 > >

The privateKey of this EOA

eoa . mnemonic string

Optional. The account HD mnemonic, if it has one and can be determined.

-
eoa . path string

Optional. The account HD path, if it has one and can be determined.

\ No newline at end of file +
eoa . path string

Optional. The account HD path, if it has one and can be determined.

\ No newline at end of file diff --git a/docs/api/utils/README.md b/docs/api/utils/README.md index e9f0dcde..344a047f 100644 --- a/docs/api/utils/README.md +++ b/docs/api/utils/README.md @@ -13,16 +13,17 @@ These utilities are used extensively within the library, but are also quite useful for application developers. -* [Addresses](address) - * [Address Formats](address) - * [Functions](address) * [Application Binary Interface](abi) * [Formats](abi) + * [Interface](abi) * [Fragment](abi) * [ConstructorFragment](abi) * [EventFragment](abi) * [FunctionFragment](abi) * [ParamType](abi) +* [Addresses](address) + * [Address Formats](address) + * [Functions](address) * [BigNumber](bignumber) * [Types](bignumber) * [Creating Instances](bignumber) @@ -35,6 +36,7 @@ are also quite useful for application developers. * [Array Manipulation](bytes) * [Hexstring Manipulation](bytes) * [Signature Conversion](bytes) + * [Random Bytes](bytes) * [Constants](constants) * [Bytes](constants) * [Strings](constants) @@ -42,15 +44,29 @@ are also quite useful for application developers. * [Display Logic and Input](display-logic) * [Units](display-logic) * [Functions](display-logic) +* [Encoding Utilities](encoding) + * [Base58](encoding) + * [Base64](encoding) + * [Recursive-Length Prefix](encoding) * [FixedNumber](fixednumber) - * [FixedFormat](fixednumber) * [Creating Instances](fixednumber) * [Properties](fixednumber) * [Methods](fixednumber) + * [FixedFormat](fixednumber) * [Hashing Algorithms](hashing) * [Cryptographic Hashing](hashing) * [Common Hashing Helpers](hashing) * [Solidity Hashing Algorithms](hashing) +* [HD Wallet](hdnode) + * [Types](hdnode) + * [HDNode](hdnode) + * [Other Functions](hdnode) +* [Logger](logger) + * [Errors](logger) + * [Creating instances](logger) +* [Property Utilities](properties) +* [Signing Key](signing-key) + * [Other Functions](signing-key) * [Strings](strings) * [Bytes32String](strings) * [UTF-8 Strings](strings) @@ -59,8 +75,12 @@ are also quite useful for application developers. * [Transactions](transactions) * [Types](transactions) * [Functions](transactions) +* [Web Utilities](web) +* [Wordlists](wordlists) + * [Wordlist](wordlists) + * [Languages](wordlists) ----- -**Content Hash:** 87e3535244311d1d85bda676c07cc903e6e0fe7d4c7207943dcf2e72bc33e3d9 \ No newline at end of file +**Content Hash:** 96bd0d92678b30c766203c98bbadbee19c546aa9d34a50ee6bab3b869b704e6e \ No newline at end of file diff --git a/docs/api/utils/abi/README.md b/docs/api/utils/abi/README.md index e63053c6..326949d5 100644 --- a/docs/api/utils/abi/README.md +++ b/docs/api/utils/abi/README.md @@ -21,7 +21,7 @@ Formats The **JSON ABI Format** is the format that is -[output from the Solidity compiler](https://solidity.readthedocs.io/en/v0.6.0/using-the-compiler.html#output-description). +[output from the Solidity compiler](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/solidity.readthedocs.io/en/v0.6.0/using-the-compiler.html). A JSON serialized object is always a string, which represents an Array of Objects, where each Object has various properties describing the [Fragment](./) of the ABI. @@ -35,7 +35,7 @@ also be passed into any function which accepts a JSON String ABI. The Human-Readable ABI was -[article](https://blog.ricmoo.com/human-readable-contract-abis-in-ethers-js-141902f4d917) +[article](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/blog.ricmoo.com/human-readable-contract-abis-in-ethers-js-141902f4d917) ### Output Formats @@ -87,6 +87,13 @@ since it discards modifiers such as indexed, anonymous, stateMutability, etc. +Interface +--------- + + +TODO + + Fragment -------- @@ -396,4 +403,4 @@ Tra la la... ----- -**Content Hash:** cae7aa26d26d5f02ebe0f227e25759db5d2437b4104d2950b364ced87e7c83f6 \ No newline at end of file +**Content Hash:** 139ec4826ff24c5f5ca9c964bc0432e3b3065f90a5b012744b2ff43be0eb7121 \ No newline at end of file diff --git a/docs/api/utils/abi/index.html b/docs/api/utils/abi/index.html index 770f92b8..831bda8a 100644 --- a/docs/api/utils/abi/index.html +++ b/docs/api/utils/abi/index.html @@ -1,4 +1,4 @@ -Application Binary Interface
+Application Binary Interface

Application Binary Interface

Explain an ABI.

Formats

@@ -14,6 +14,8 @@
utils . FragmentTypes . json string

This returns a JavaScript Object which is safe to call JSON.stringify on to create a JSON string.

utils . FragmentTypes . sighash string

This is a minimal output format, which is used by Solidity when computing a signature hash or an event topic hash.

Note

The sighash format is insufficient to re-create the original Fragment, since it discards modifiers such as indexed, anonymous, stateMutability, etc.

+

Interface

+

TODO

Fragment

An ABI is a collection of Fragments, where each fragment specifies:

  • An Event
  • A Function
  • A Constructor

Properties

@@ -71,4 +73,4 @@

Tra la la...

paramType . format ( [ outputType = "sighash" ] )

Tra la la...

utils . ParamType . from ( objectOrString ) ParamType

Tra la la...

-
utils . ParamType . isParamType ( object ) boolean

Tra la la...

\ No newline at end of file +
utils . ParamType . isParamType ( object ) boolean

Tra la la...

\ No newline at end of file diff --git a/docs/api/utils/address/README.md b/docs/api/utils/address/README.md index ae7714e7..e4aa9b8a 100644 --- a/docs/api/utils/address/README.md +++ b/docs/api/utils/address/README.md @@ -37,7 +37,7 @@ All functions that return an Address will return a Checksum Address. The **ICAP Address Format** was an early attempt to introduce a checksum into Ethereum addresses using the popular banking industry's -[IBAN](https://en.wikipedia.org/wiki/International_Bank_Account_Number) +[IBAN](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/International_Bank_Account_Number) format with the country code specified as **XE**. Due to the way IBAN encodes address, only addresses that fit into 30 base-36 @@ -79,7 +79,7 @@ Returns true if *address* is valid (in any supported format). #### *utils* . **getIcapAddress** ( address ) **=>** *string< [IcapAddress](./) >* -Returns *address* as an [ICAP address](https://github.com/ethereum/wiki/wiki/Inter-exchange-Client-Address-Protocol-%28ICAP%29). +Returns *address* as an [ICAP address](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/github.com/ethereum/wiki/wiki/Inter-exchange-Client-Address-Protocol-%28ICAP%29). Supports the same restrictions as [utils.getAddress](./). @@ -96,11 +96,11 @@ used to deploy a contract. #### *utils* . **getCreate2Address** ( from , salt , initCodeHash ) **=>** *string< [Address](./) >* Returns the contract address that would result from the given -[CREATE2](https://eips.ethereum.org/EIPS/eip-1014) call. +[CREATE2](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/eips.ethereum.org/EIPS/eip-1014) call. ----- -**Content Hash:** 7835c97c8afbbdf59c39d32a9d79d86c4e446a2ed6acd6eae1f21c0b190b73c1 \ No newline at end of file +**Content Hash:** 9c4842c79e4a9f307ba1de2c84f1d996b2dbcb53af5b8dd153508f6c2f7b7f1d \ No newline at end of file diff --git a/docs/api/utils/address/index.html b/docs/api/utils/address/index.html index 48000ee8..363160d1 100644 --- a/docs/api/utils/address/index.html +++ b/docs/api/utils/address/index.html @@ -1,4 +1,4 @@ -Addresses
+Addresses

Addresses

Explain addresses,formats and checksumming here.

Also see: constants.AddressZero

Address Formats

@@ -13,4 +13,4 @@
utils . isAddress ( address ) boolean

Returns true if address is valid (in any supported format).

utils . getIcapAddress ( address ) string< IcapAddress >

Returns address as an ICAP address. Supports the same restrictions as utils.getAddress.

utils . getContractAddress ( transaction ) string< Address >

Returns the contract address that would result if transaction was used to deploy a contract.

-
utils . getCreate2Address ( from , salt , initCodeHash ) string< Address >

Returns the contract address that would result from the given CREATE2 call.

\ No newline at end of file +
utils . getCreate2Address ( from , salt , initCodeHash ) string< Address >

Returns the contract address that would result from the given CREATE2 call.

\ No newline at end of file diff --git a/docs/api/utils/bignumber/README.md b/docs/api/utils/bignumber/README.md index 9d4babc6..daa49d4e 100644 --- a/docs/api/utils/bignumber/README.md +++ b/docs/api/utils/bignumber/README.md @@ -9,7 +9,15 @@ BigNumber ========= -Explain about BigNumber here... +Many operations in Ethereum operation on numbers which are +[outside the range of safe values](./) to use +in JavaScript. + +A **BigNumber** is an object which safely allows mathematic operations +on numbers of any magnitude. + +Most operations which need to return a value will return a **BigNumber** +and parameters which accept values will generally accept them. ### Importing @@ -69,21 +77,21 @@ A [BytesLike](../bytes) Object, such as an Array or Uint8Array. #### ***BigNumber*** -An existing BigNumber instance. +An existing [BigNumber](./) instance. #### ***number*** -A number that is within the safe range for JavaScript numbers. +A number that is within the [safe range](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER) for JavaScript numbers. #### ***BigInt*** -A JavaScript [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) +A JavaScript [BigInt](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) object, on environments that support BigInt. @@ -108,44 +116,7 @@ Returns an instance of a **BigNumber** for *aBigNumberish*. ```javascript -// From a decimal string... -BigNumber.from("42") -// { BigNumber: "42" } - -// From a hexstring... -BigNumber.from("0x2a") -// { BigNumber: "42" } - -// From a negative hexstring... -BigNumber.from("-0x2a") -// { BigNumber: "-42" } - -// From an Array (or Uint8Array)... -BigNumber.from([ 42 ]) -// { BigNumber: "42" } - -// From an existing BigNumber... -let one1 = constants.One; -let one2 = BigNumber.from(one1) - -one2 -// { BigNumber: "1" } - -// ...which returns the same instance -one1 === one2 -// true - -// From a (safe) number... -BigNumber.from(42) -// { BigNumber: "42" } - -// From a ES2015 BigInt... (only on platforms with BigInt support) -BigNumber.from(42n) -// { BigNumber: "42" } - -// Numbers outside the safe range fail: -BigNumber.from(Number.MAX_SAFE_INTEGER); -// Error: overflow (fault="overflow", operation="BigNumber.from", value=9007199254740991, version=bignumber/5.0.0-beta.135) +Skipping JavaScript Evaluation. ``` @@ -222,7 +193,7 @@ the *bitcount* least significant bits set to zero. ### Two's Compliment -[Two's Complicment](https://en.wikipedia.org/wiki/Two%27s_complement) +[Two's Complicment](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/Two%27s_complement) is an elegant method used to encode and decode fixed-width signed values while efficiently preserving mathematic operations. Most users will not need to interact with these. @@ -312,7 +283,7 @@ Returns the value of *bignumber* as a base-10 string. #### *bignumber* . **toHexString** ( ) **=>** *string< [DataHexstring](../bytes) >* -Returns the value of *bignumber* as a base-16, `0x`-prefixed [hexstring](../bytes). +Returns the value of *bignumber* as a base-16, `0x`-prefixed [DataHexstring](../bytes). @@ -333,11 +304,7 @@ Returns true if and only if the *object* is a BigNumber object. ```javascript -let a = BigNumber.from(42); -let b = BigNumber.from("91"); - - a.mul(b); - // { BigNumber: "3822" } +Skipping JavaScript Evaluation. ``` @@ -346,7 +313,7 @@ Notes ----- -A few short notes on numbers... +This section is a for a couple of questions that come up frequently. ### Why can't I just use numbers? @@ -358,7 +325,7 @@ with very little granularity. For example, there are only 100 cents in a single dollar. However, there are 10^18 **wei** in a single **ether**. -JavaScript uses [IEEE 754 double-precision binary floating point](https://en.wikipedia.org/wiki/Double-precision_floating-point_format) +JavaScript uses [IEEE 754 double-precision binary floating point](../../../Users/ricmoo/Development/ethers/ethers.js-v5/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 @@ -369,8 +336,7 @@ To demonstrate how this may be an issue in your code, consider: ```javascript -(Number.MAX_SAFE_INTEGER + 2 - 2) == (Number.MAX_SAFE_INTEGER) -// false +Skipping JavaScript Evaluation. ``` @@ -384,6 +350,67 @@ by the user and Big Number representations which can have mathematical operations handled safely. +### Why not BigNumber.js, BN.js, BigDecimal, etc? + + +Everyone has their own favourite Big Number library, and once someone +has choosen one, it becomes part of their identity, like their editor, +vi vs emacs. There are over 100 Big Number libraries on [npm](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/www.npmjs.com/search?q=bignumber). + +One of the biggest differences between the Ethers [BigNumber](./) object and +other libraries is that it is immutable, which is very important when +dealing with the asynchronous nature of the blockchain. + +Capturing the value is not safe in async functions, so immutability +protects us from easy to make mistakes, which is not possible on the +low-level library's objects which supports myriad in-place operations. + +Second, the Ethers [BigNumber](./) provides all the functionality required +internally and should generally be sufficient for most developers while +not exposing some of the more advanced and rare functionality. So it will +be eaiser to swap out the underlying library without impacting consumers. + +For example, if [BN.js](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/www.npmjs.com/package/bn.js) was exposed, someone may use the +greatest-common-denominator functions, which would then be functionality +the replacing library should also provide to ensure anyone depending on +that functionality is not broken. + + +### Why BN.js?? + + +The reason why [BN.js](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/www.npmjs.com/package/bn.js) is used internally as the big +number is because that is the library used by [elliptic](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/www.npmjs.com/package/elliptic). + +Therefore it **must** be included regardless, so we leverage that +library rather than adding another Big Number library, which would +mean two different libraries offering the same functionality. + +This has saved about 85kb (80% of this library size) of library size +over other libraries which include separate Big Number libraries for +various purposes. + + +### Why not allow us to set a global Big Number library? + + +Another comment that comes up frequently is tha desire to specify a +global user-defined Big Number library, which all functions would +return. + +This becomes problematic since your code may live along side other +libraries or code that use Ethers. In fact, even Ethers uses a lot +of the public functions internally. + +If you, for example, used a library that used `a.plus(b)` instead +of `a.add(b)`, this would break Ethers when it tries to compute +fees internally, and other libraries likely have similar logic. + +But, the [BigNumber](./) prototype is exposed, so you can always add a +`toMyCustomBigNumber()` method to all [BigNumber](./)'s globally +which is safe. + + ----- -**Content Hash:** 8aa8cbe047d299ae822c3d322def66e29bbbd395d1c9bad59c61c97432d83ffa \ No newline at end of file +**Content Hash:** 87481a6a9d99504396f1d013094f713846f9d4d51891778928744cee04bd85bb \ No newline at end of file diff --git a/docs/api/utils/bignumber/index.html b/docs/api/utils/bignumber/index.html index a20e3202..48a1d158 100644 --- a/docs/api/utils/bignumber/index.html +++ b/docs/api/utils/bignumber/index.html @@ -1,6 +1,6 @@ -Big Number
+Big Number

BigNumber

-

Explain about BigNumber here...

+

Many operations in Ethereum operation on numbers which are outside the range of safe values to use in JavaScript.

A BigNumber is an object which safely allows mathematic operations on numbers of any magnitude.

Most operations which need to return a value will return a BigNumber and parameters which accept values will generally accept them.

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";
@@ -11,15 +11,15 @@

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 or a decimal string, either of which may be negative.

BytesLike

A BytesLike Object, such as an Array or Uint8Array.

-
BigNumber

An existing BigNumber instance.

-
number

A number that is within the safe range for JavaScript numbers.

+
BigNumber

An existing BigNumber instance.

+
number

A number that is within the safe range for JavaScript numbers.

BigInt

A JavaScript 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:

-

// 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.135)
+
Skipping JavaScript Evaluation.

Methods

The BigNumber class is immutable, so no operations can change the value it represents.

@@ -49,17 +49,23 @@
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< DataHexstring >

Returns the value of bignumber as a base-16, `0x`-prefixed hexstring.

+
bignumber . toHexString ( ) string< DataHexstring >

Returns the value of bignumber as a base-16, 0x-prefixed DataHexstring.

Inspection

BigNumnber . isBigNumber ( object ) boolean

Returns true if and only if the object is a BigNumber object.

Examples

-

let a = BigNumber.from(42);
let b = BigNumber.from("91");

a.mul(b);
// { BigNumber: "3822" }
+
Skipping JavaScript Evaluation.

Notes

-

A few short notes on numbers...

-

Why can't I just use numbers?

-

The first problem many encounter when dealing with Ethereum is the concept of numbers. Most common currencies are broken down with very little granularity. For example, there are only 100 cents in a single dollar. However, there are 1018 wei in a single ether.

JavaScript uses IEEE 754 double-precision binary floating point 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:

-
(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 ) and formatEther( wei ) 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.

\ No newline at end of file +

This section is a for a couple of questions that come up frequently.

+

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 1018 wei in a single ether.

JavaScript uses IEEE 754 double-precision binary floating point 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:

+
Skipping JavaScript Evaluation.
+

To remedy this, all numbers (which can be large) are stored and manipulated as Big Numbers.

The functions parseEther( etherString ) and formatEther( wei ) 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.

+

Why not BigNumber.js, BN.js, BigDecimal, etc?

+

Everyone has their own favourite Big Number library, and once someone has choosen one, it becomes part of their identity, like their editor, vi vs emacs. There are over 100 Big Number libraries on npm.

One of the biggest differences between the Ethers BigNumber object and other libraries is that it is immutable, which is very important when dealing with the asynchronous nature of the blockchain.

Capturing the value is not safe in async functions, so immutability protects us from easy to make mistakes, which is not possible on the low-level library's objects which supports myriad in-place operations.

Second, the Ethers BigNumber provides all the functionality required internally and should generally be sufficient for most developers while not exposing some of the more advanced and rare functionality. So it will be eaiser to swap out the underlying library without impacting consumers.

For example, if BN.js was exposed, someone may use the greatest-common-denominator functions, which would then be functionality the replacing library should also provide to ensure anyone depending on that functionality is not broken.

+

Why BN.js??

+

The reason why BN.js is used internally as the big number is because that is the library used by elliptic.

Therefore it must be included regardless, so we leverage that library rather than adding another Big Number library, which would mean two different libraries offering the same functionality.

This has saved about 85kb (80% of this library size) of library size over other libraries which include separate Big Number libraries for various purposes.

+

Why not allow us to set a global Big Number library?

+

Another comment that comes up frequently is tha desire to specify a global user-defined Big Number library, which all functions would return.

This becomes problematic since your code may live along side other libraries or code that use Ethers. In fact, even Ethers uses a lot of the public functions internally.

If you, for example, used a library that used a.plus(b) instead of a.add(b), this would break Ethers when it tries to compute fees internally, and other libraries likely have similar logic.

But, the BigNumber prototype is exposed, so you can always add a toMyCustomBigNumber() method to all BigNumber's globally which is safe.

\ No newline at end of file diff --git a/docs/api/utils/bytes/README.md b/docs/api/utils/bytes/README.md index 46f4bda7..a577d12a 100644 --- a/docs/api/utils/bytes/README.md +++ b/docs/api/utils/bytes/README.md @@ -21,8 +21,7 @@ Types A **Bytes** is any object which is an -[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) or -[TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) with +[Array](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) or [TypedArray](../../../Users/ricmoo/Development/ethers/ethers.js-v5/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. @@ -56,7 +55,7 @@ number of nibbles (i.e. case-insensitive hexidecumal characters, `0-9` and `a-f` * **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://eips.ethereum.org/EIPS/eip-2098) of the **s** and **v** +* **_vs** --- The [compact representation](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/eips.ethereum.org/EIPS/eip-2098) of the **s** and **v** * **recoveryParam** --- The normalized (i.e. 0 or 1) value of **v** @@ -139,29 +138,7 @@ zeros. ```javascript -// Convert a hexstring to a Uint8Array -arrayify("0x1234") -// [ 18, 52 ] - -// Convert an Array to a hexstring -hexlify([1, 2, 3, 4]) -// 0x01020304 - -// Convert an Object to a hexstring -hexlify({ length: 2, "0": 1, "1": 2 }) -// 0x0102 - -// Convert an Array to a hexstring -hexlify([ 1 ]) -// 0x01 - -// Convert a number to a stripped hex value -hexValue(1) -// 0x1 - -// Convert an Array to a stripped hex value -hexValue([ 1, 2 ]) -// 0x102 +Skipping JavaScript Evaluation. ``` @@ -263,6 +240,18 @@ Any missing properties will be computed. +Random Bytes +------------ + + + +#### *ethers* . *utils* . **randomBytes** ( length ) **=>** *Uint8Array* + +Return a new Uint8Array of *length* random bytes. + + + + ----- -**Content Hash:** ef5d3728657f7c650f7531071145048e55ee632bd0fe4ee01b6d11a1e9b1c39b \ No newline at end of file +**Content Hash:** 36831e9bb9c02d184b22e8b4b8700572a545c366ced4d9811a92c560dafaf035 \ No newline at end of file diff --git a/docs/api/utils/bytes/index.html b/docs/api/utils/bytes/index.html index e26ea5e2..52b3d0ba 100644 --- a/docs/api/utils/bytes/index.html +++ b/docs/api/utils/bytes/index.html @@ -1,4 +1,4 @@ -Byte Manipulation
+Byte Manipulation

Byte Manipulation

Tra la la...

Types

@@ -29,7 +29,7 @@
utils . hexValue ( aBigNumberish ) string< Hexstring >

Converts aBigNumberish to a Hexstring, with no unnecessary leading zeros.

Examples

-

// Convert a hexstring to a Uint8Array
arrayify("0x1234")
// [ 18, 52 ]

// Convert an Array to a hexstring
hexlify([1, 2, 3, 4])
// 0x01020304

// Convert an Object to a hexstring
hexlify({ length: 2, "0": 1, "1": 2 })
// 0x0102

// Convert an Array to a hexstring
hexlify([ 1 ])
// 0x01

// Convert a number to a stripped hex value
hexValue(1)
// 0x1

// Convert an Array to a stripped hex value
hexValue([ 1, 2 ])
// 0x102
+
Skipping JavaScript Evaluation.

Array Manipulation

@@ -46,4 +46,7 @@

Signature Conversion

utils . joinSignature ( aSignatureLike ) string< FlatSignature >

Return the flat-format of aSignaturelike, which is 65 bytes (130 nibbles) long, concatenating the r, s and (normalized) v of a Signature.

-
utils . splitSignature ( aSignatureLikeOrBytesLike ) Signature

Return the full expanded-format of aSignaturelike or a flat-format DataHexstring. Any missing properties will be computed.

\ No newline at end of file +
utils . splitSignature ( aSignatureLikeOrBytesLike ) Signature

Return the full expanded-format of aSignaturelike or a flat-format DataHexstring. Any missing properties will be computed.

+

Random Bytes

+ +
ethers . utils . randomBytes ( length ) Uint8Array

Return a new Uint8Array of length random bytes.

\ No newline at end of file diff --git a/docs/api/utils/constants/README.md b/docs/api/utils/constants/README.md index c36eb95b..85d25818 100644 --- a/docs/api/utils/constants/README.md +++ b/docs/api/utils/constants/README.md @@ -17,8 +17,7 @@ The **ethers.contants** Object contains commonly used values. ```javascript -//const { constants } = require("ethers"); -// const { constants } = require("@ethersproject/constants"); +Skipping JavaScript Evaluation. ``` @@ -28,14 +27,14 @@ Bytes -#### *constants* . **AddressZero** **=>** *string< [Address](../address) >* +#### *ethers* . *constants* . **AddressZero** **=>** *string< [Address](../address) >* The Address Zero, which is 20 bytes (40 nibbles) of zero. -#### *constants* . **HashZero** **=>** *string< [DataHexstring](../bytes)< 32 > >* +#### *ethers* . *constants* . **HashZero** **=>** *string< [DataHexstring](../bytes)< 32 > >* The Hash Zero, which is 32 bytes (64 nibbles) of zero. @@ -47,7 +46,7 @@ Strings -#### *constants* . **EtherSymbol** **=>** *string* +#### *ethers* . *constants* . **EtherSymbol** **=>** *string* The Ether symbol, **Ξ**. @@ -59,35 +58,35 @@ BigNumber -#### *constants* . **NegativeOne** **=>** *[BigNumber](../bignumber)* +#### *ethers* . *constants* . **NegativeOne** **=>** *[BigNumber](../bignumber)* The BigNumber value representing `"-1"`. -#### *constants* . **Zero** **=>** *[BigNumber](../bignumber)* +#### *ethers* . *constants* . **Zero** **=>** *[BigNumber](../bignumber)* The BigNumber value representing `"0"`. -#### *constants* . **One** **=>** *[BigNumber](../bignumber)* +#### *ethers* . *constants* . **One** **=>** *[BigNumber](../bignumber)* The BigNumber value representing `"1"`. -#### *constants* . **Two** **=>** *[BigNumber](../bignumber)* +#### *ethers* . *constants* . **Two** **=>** *[BigNumber](../bignumber)* The BigNumber value representing `"2"`. -#### *constants* . **WeiPerEther** **=>** *[BigNumber](../bignumber)* +#### *ethers* . *constants* . **WeiPerEther** **=>** *[BigNumber](../bignumber)* The BigNumber value representing `"1000000000000000000"`, which is the number of Wei per Ether. @@ -95,7 +94,7 @@ number of Wei per Ether. -#### *constants* . **MaxUint256** **=>** *[BigNumber](../bignumber)* +#### *ethers* . *constants* . **MaxUint256** **=>** *[BigNumber](../bignumber)* The BigNumber value representing the maximum `uint256` value. @@ -104,4 +103,4 @@ The BigNumber value representing the maximum `uint256` value. ----- -**Content Hash:** 622800454a6a66b0fc5bbd1aa149f58e00727d81f05a8d32f3eb7be9e1abbf8d \ No newline at end of file +**Content Hash:** ec1f26d84f380998ccbfc88ad451d14ba9395d94bfd9b7366af2e0b8ec1b183f \ No newline at end of file diff --git a/docs/api/utils/constants/index.html b/docs/api/utils/constants/index.html index cb122a4a..f37b3a6f 100644 --- a/docs/api/utils/constants/index.html +++ b/docs/api/utils/constants/index.html @@ -1,22 +1,22 @@ -Constants
+Constants

Constants

The ethers.contants Object contains commonly used values.

Importing

-

//const { constants } = require("ethers");
// const { constants } = require("@ethersproject/constants");
+
Skipping JavaScript Evaluation.

Bytes

-
constants . AddressZero string< Address >

The Address Zero, which is 20 bytes (40 nibbles) of zero.

-
constants . HashZero string< DataHexstring< 32 > >

The Hash Zero, which is 32 bytes (64 nibbles) of zero.

+
ethers . constants . AddressZero string< Address >

The Address Zero, which is 20 bytes (40 nibbles) of zero.

+
ethers . constants . HashZero string< DataHexstring< 32 > >

The Hash Zero, which is 32 bytes (64 nibbles) of zero.

Strings

-
constants . EtherSymbol string

The Ether symbol, Ξ.

+
ethers . constants . EtherSymbol string

The Ether symbol, Ξ.

BigNumber

-
constants . NegativeOne BigNumber

The BigNumber value representing "-1".

-
constants . Zero BigNumber

The BigNumber value representing "0".

-
constants . One BigNumber

The BigNumber value representing "1".

-
constants . Two BigNumber

The BigNumber value representing "2".

-
constants . WeiPerEther BigNumber

The BigNumber value representing "1000000000000000000", which is the number of Wei per Ether.

-
constants . MaxUint256 BigNumber

The BigNumber value representing the maximum uint256 value.

\ No newline at end of file +
ethers . constants . NegativeOne BigNumber

The BigNumber value representing "-1".

+
ethers . constants . Zero BigNumber

The BigNumber value representing "0".

+
ethers . constants . One BigNumber

The BigNumber value representing "1".

+
ethers . constants . Two BigNumber

The BigNumber value representing "2".

+
ethers . constants . WeiPerEther BigNumber

The BigNumber value representing "1000000000000000000", which is the number of Wei per Ether.

+
ethers . constants . MaxUint256 BigNumber

The BigNumber value representing the maximum uint256 value.

\ No newline at end of file diff --git a/docs/api/utils/display-logic/index.html b/docs/api/utils/display-logic/index.html index a4c396a2..fe37c8da 100644 --- a/docs/api/utils/display-logic/index.html +++ b/docs/api/utils/display-logic/index.html @@ -1,4 +1,4 @@ -Display Logic and Input
+Display Logic and Input

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 in wei, and is useful when a user types in a value, such as sending 1.1 ether.

The formatUnits will format a BigNumberish into a string, which is useful when displaying a balance.

Units

@@ -17,4 +17,4 @@
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

Returns a 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

The equivalent to calling parseUnits(value, "ether").

\ No newline at end of file +
utils . parseEther ( value ) BigNumber

The equivalent to calling parseUnits(value, "ether").

\ No newline at end of file diff --git a/docs/api/utils/encoding/README.md b/docs/api/utils/encoding/README.md index 16869464..ea05660f 100644 --- a/docs/api/utils/encoding/README.md +++ b/docs/api/utils/encoding/README.md @@ -10,7 +10,12 @@ Encoding Utilities -#### *utils* . *base58* . **decode** ( textData ) **=>** *Uin8Array* +Base58 +------ + + + +#### *ethers* . *utils* . *base58* . **decode** ( textData ) **=>** *Uin8Array* Return a typed Uint8Array representation of *textData* decoded using base-58 encoding. @@ -18,14 +23,19 @@ base-58 encoding. -#### *utils* . *base58* . **encode** ( aBytesLike ) **=>** *string* +#### *ethers* . *utils* . *base58* . **encode** ( aBytesLike ) **=>** *string* Return *aBytesLike* encoded as a string using the base-58 encoding. -#### *utils* . *base64* . **decode** ( textData ) **=>** *Uin8Array* +Base64 +------ + + + +#### *ethers* . *utils* . *base64* . **decode** ( textData ) **=>** *Uin8Array* Return a typed Uint8Array representation of *textData* decoded using base-64 encoding. @@ -33,13 +43,61 @@ base-64 encoding. -#### *utils* . *base64* . **encode** ( aBytesLike ) **=>** *string* +#### *ethers* . *utils* . *base64* . **encode** ( aBytesLike ) **=>** *string* Return *aBytesLike* encoded as a string using the base-64 encoding. +Recursive-Length Prefix +----------------------- + + +The [Recursive Length Prefix](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/github.com/ethereum/wiki/wiki/RLP) encoding is used throughout Ethereum to serialize nested +structures of Arrays and data. + + +#### *ethers* . *utils* . *RLP* . **encode** ( dataObject ) **=>** *string< [DataHexstring](../bytes) >* + +Encode a structured Data Object into its RLP-encoded representation. + +Each Data component may be an valid [BytesLike](../bytes). + + + + +#### *ethers* . *utils* . *RLP* . **decode** ( aBytesLike ) **=>** *[DataObject](./)* + +Decode an RLP-encoded *aBytesLike* into its structured Data Object. + +All Data components will be returned as a [DataHexstring](../bytes). + + + + +### Data Object + + +A **Data Object** is a recursive structure which is used to serialize many +internal structures in Ethereum. Each **Data Object** can either be: + + + +* Binary Data +* An Array of **Data Objects** (i.e. this recursively includes Nesting) + + +#### **Examples** + + + +* `"0x1234"` +* `[ "0x1234", [ "0xdead", "0xbeef" ], [ ] ]` + + + + ----- -**Content Hash:** a4f4ef6d28d4fde749cce30bb537f6ad3d6d0ae6070623757c75091441523f4e \ No newline at end of file +**Content Hash:** e91a94dca2969f6acf544fb285df0faebedf4cf04b09056fe5c6cf8d2d013097 \ No newline at end of file diff --git a/docs/api/utils/encoding/index.html b/docs/api/utils/encoding/index.html index 9ac4ca84..e8dbeff6 100644 --- a/docs/api/utils/encoding/index.html +++ b/docs/api/utils/encoding/index.html @@ -1,7 +1,18 @@ -Encoding Utilies
+Encoding Utilies

Encoding Utilities

-
utils . base58 . decode ( textData ) Uin8Array

Return a typed Uint8Array representation of textData decoded using base-58 encoding.

-
utils . base58 . encode ( aBytesLike ) string

Return aBytesLike encoded as a string using the base-58 encoding.

-
utils . base64 . decode ( textData ) Uin8Array

Return a typed Uint8Array representation of textData decoded using base-64 encoding.

-
utils . base64 . encode ( aBytesLike ) string

Return aBytesLike encoded as a string using the base-64 encoding.

\ No newline at end of file +

Base58

+ +
ethers . utils . base58 . decode ( textData ) Uin8Array

Return a typed Uint8Array representation of textData decoded using base-58 encoding.

+
ethers . utils . base58 . encode ( aBytesLike ) string

Return aBytesLike encoded as a string using the base-58 encoding.

+

Base64

+ +
ethers . utils . base64 . decode ( textData ) Uin8Array

Return a typed Uint8Array representation of textData decoded using base-64 encoding.

+
ethers . utils . base64 . encode ( aBytesLike ) string

Return aBytesLike encoded as a string using the base-64 encoding.

+

Recursive-Length Prefix

+

The Recursive Length Prefix encoding is used throughout Ethereum to serialize nested structures of Arrays and data.

+
ethers . utils . RLP . encode ( dataObject ) string< DataHexstring >

Encode a structured Data Object into its RLP-encoded representation.

Each Data component may be an valid BytesLike.

+
ethers . utils . RLP . decode ( aBytesLike ) DataObject

Decode an RLP-encoded aBytesLike into its structured Data Object.

All Data components will be returned as a DataHexstring.

+

Data Object

+

A Data Object is a recursive structure which is used to serialize many internal structures in Ethereum. Each Data Object can either be:

+
Examples
  • "0x1234"
  • [ "0x1234", [ "0xdead", "0xbeef" ], [ ] ]
\ No newline at end of file diff --git a/docs/api/utils/fixednumber/README.md b/docs/api/utils/fixednumber/README.md index 8d9c47e9..985d30ff 100644 --- a/docs/api/utils/fixednumber/README.md +++ b/docs/api/utils/fixednumber/README.md @@ -9,91 +9,9 @@ FixedNumber =========== - -FixedFormat ------------ - - -A **FixedFormat** is a simple object which represents a decimal -(base-10) Fixed-Point data representation. Usually using this -class directly is uneccessary, as passing in a [Format Strings](./) -directly into the [FixedNumber](./) will automatically create this. - - -### Format Strings - - -A format string is composed of three components, including signed-ness, -bit-width and number of decimals. - -A signed format string begins with `fixed`, which an unsigned format -string begins with `ufixed`, followed by the width (in bits) and the -number of decimals. - -The width must be conguent to 0 mod 8 (i.e. `(width % 8) == 0`) and no -larger than 256 bits and the number of decimals must be no larger than 80. - -For example: - - - -* **fixed128x18** is signed, 128 bits wide and has 18 decimals; this is useful for most purposes -* **fixed32x0** is signed, 32 bits wide and has 0 decimals; this would be the same as a ``int32_t` in C -* **ufixed32x0** is unsigned, 32 bits wide and has 0 decimals; this would be the same as a ``uint32_t` in C -* **fixed** is shorthand for ``fixed128x18` -* **ufixed** is shorthand for ``ufixed128x18` - - -### Creating Instances - - - -#### *FixedFormat* . **from** ( value="fixed128x18" ) **=>** *[FixedFormat](./)* - -Returns a new instance of a **FixedFormat** defined by *value*. Any valid [Format Strings](./) -may be passed in as well as any object which has any of `signed`, `width` and `decimals` -defined, including a [FixedFormat](./) object. - - - - -### Properties - - - -#### *fixedFormat* . **signed** **=>** *boolean* - - - - - - -#### *fixedFormat* . **width** **=>** *number* - - - - - - -#### *fixedFormat* . **decimals** **=>** *number* - - - - - - -#### *fixedFormat* . **name** **=>** *string* - - - - - - -#### ***"fixed"*** - -A shorthand for `fixed128x80`. - - +A **FixedNumber** is a fixed-width (in bits) number with an internal +base-10 divisor, which allows it to represent a decimal fractional +component. Creating Instances @@ -233,6 +151,93 @@ Returns true if and only if *value* is a **FixedNumber**. +FixedFormat +----------- + + +A **FixedFormat** is a simple object which represents a decimal +(base-10) Fixed-Point data representation. Usually using this +class directly is uneccessary, as passing in a [Format Strings](./) +directly into the [FixedNumber](./) will automatically create this. + + +### Format Strings + + +A format string is composed of three components, including signed-ness, +bit-width and number of decimals. + +A signed format string begins with `fixed`, which an unsigned format +string begins with `ufixed`, followed by the width (in bits) and the +number of decimals. + +The width must be conguent to 0 mod 8 (i.e. `(width % 8) == 0`) and no +larger than 256 bits and the number of decimals must be no larger than 80. + +For example: + + + +* **fixed128x18** is signed, 128 bits wide and has 18 decimals; this is useful for most purposes +* **fixed32x0** is signed, 32 bits wide and has 0 decimals; this would be the same as a ``int32_t` in C +* **ufixed32x0** is unsigned, 32 bits wide and has 0 decimals; this would be the same as a ``uint32_t` in C +* **fixed** is shorthand for ``fixed128x18` +* **ufixed** is shorthand for ``ufixed128x18` + + +### Creating Instances + + + +#### *FixedFormat* . **from** ( value="fixed128x18" ) **=>** *[FixedFormat](./)* + +Returns a new instance of a **FixedFormat** defined by *value*. Any valid [Format Strings](./) +may be passed in as well as any object which has any of `signed`, `width` and `decimals` +defined, including a [FixedFormat](./) object. + + + + +### Properties + + + +#### *fixedFormat* . **signed** **=>** *boolean* + +The signed-ness of *fixedFormat*, true if negative values are supported. + + + + +#### *fixedFormat* . **width** **=>** *number* + +The width (in bits) of *fixedFormat*. + + + + +#### *fixedFormat* . **decimals** **=>** *number* + +The number of decimal points of *fixedFormat*. + + + + +#### *fixedFormat* . **name** **=>** *string* + +The name of the *fixedFormat*, which can be used to recreate the format +and is the string that the Solidity language uses to represent this format. + + + + +#### ***"fixed"*** + +A shorthand for `fixed128x80`. + + + + ----- -**Content Hash:** bb1362f52031bfae2d988bdc25d31a560da087c2eba5988d70fa40e659766960 \ No newline at end of file +**Content Hash:** 722ae303e23974bf47d77cc0fede7fd8fe534421d7c8f39189898e0592b7ef8d \ No newline at end of file diff --git a/docs/api/utils/fixednumber/index.html b/docs/api/utils/fixednumber/index.html index 445d5c33..60f528ae 100644 --- a/docs/api/utils/fixednumber/index.html +++ b/docs/api/utils/fixednumber/index.html @@ -1,20 +1,6 @@ -Fixed Number
+Fixed Number

FixedNumber

- -

FixedFormat

-

A FixedFormat is a simple object which represents a decimal (base-10) Fixed-Point data representation. Usually using this class directly is uneccessary, as passing in a Format Strings directly into the FixedNumber will automatically create this.

-

Format Strings

-

A format string is composed of three components, including signed-ness, bit-width and number of decimals.

A signed format string begins with fixed, which an unsigned format string begins with ufixed, followed by the width (in bits) and the number of decimals.

The width must be conguent to 0 mod 8 (i.e. (width % 8) == 0) and no larger than 256 bits and the number of decimals must be no larger than 80.

For example:

  • fixed128x18 is signed, 128 bits wide and has 18 decimals; this is useful for most purposes
  • fixed32x0 is signed, 32 bits wide and has 0 decimals; this would be the same as a ``int32_t` in C
  • ufixed32x0 is unsigned, 32 bits wide and has 0 decimals; this would be the same as a ``uint32_t` in C
  • fixed is shorthand for ``fixed128x18`
  • ufixed is shorthand for ``ufixed128x18`
-

Creating Instances

- -
FixedFormat . from ( value = "fixed128x18" ) FixedFormat

Returns a new instance of a FixedFormat defined by value. Any valid Format Strings may be passed in as well as any object which has any of signed, width and decimals defined, including a FixedFormat object.

-

Properties

- -
fixedFormat . signed boolean

-
fixedFormat . width number

-
fixedFormat . decimals number

-
fixedFormat . name string

-
"fixed"

A shorthand for fixed128x80.

+

A FixedNumber is a fixed-width (in bits) number with an internal base-10 divisor, which allows it to represent a decimal fractional component.

Creating Instances

The FixedNumber constructor cannot be called directly. There are several static methods for creating a FixedNumber.

FixedNumber . from ( value [ , format = "fixed" ] ) FixedNumber

Returns an instance of a FixedNumber for value as a format.

@@ -41,4 +27,18 @@
fixednumber . toUnsafeFloat ( ) float

Returns a floating-point JavaScript number value of fixednumber. Due to rounding in JavaScript numbers, the value is only approximate.

Inspection

-
FixedNumber . isFixedNumber ( value ) boolean

Returns true if and only if value is a FixedNumber.

\ No newline at end of file +
FixedNumber . isFixedNumber ( value ) boolean

Returns true if and only if value is a FixedNumber.

+

FixedFormat

+

A FixedFormat is a simple object which represents a decimal (base-10) Fixed-Point data representation. Usually using this class directly is uneccessary, as passing in a Format Strings directly into the FixedNumber will automatically create this.

+

Format Strings

+

A format string is composed of three components, including signed-ness, bit-width and number of decimals.

A signed format string begins with fixed, which an unsigned format string begins with ufixed, followed by the width (in bits) and the number of decimals.

The width must be conguent to 0 mod 8 (i.e. (width % 8) == 0) and no larger than 256 bits and the number of decimals must be no larger than 80.

For example:

+

Creating Instances

+ +
FixedFormat . from ( value = "fixed128x18" ) FixedFormat

Returns a new instance of a FixedFormat defined by value. Any valid Format Strings may be passed in as well as any object which has any of signed, width and decimals defined, including a FixedFormat object.

+

Properties

+ +
fixedFormat . signed boolean

The signed-ness of fixedFormat, true if negative values are supported.

+
fixedFormat . width number

The width (in bits) of fixedFormat.

+
fixedFormat . decimals number

The number of decimal points of fixedFormat.

+
fixedFormat . name string

The name of the fixedFormat, which can be used to recreate the format and is the string that the Solidity language uses to represent this format.

+
"fixed"

A shorthand for fixed128x80.

\ No newline at end of file diff --git a/docs/api/utils/hashing/README.md b/docs/api/utils/hashing/README.md index bdd7f94e..f9196dde 100644 --- a/docs/api/utils/hashing/README.md +++ b/docs/api/utils/hashing/README.md @@ -16,41 +16,41 @@ Cryptographic Hashing --------------------- -The [Cryptographic Hash Functions](https://en.wikipedia.org/wiki/Cryptographic_hash_function) +The [Cryptographic Hash Functions](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/Cryptographic_hash_function) are a specific family of hash functions. #### *ethers* . *utils* . **keccak256** ( aBytesLike ) **=>** *string< [DataHexstring](../bytes)< 32 > >* -Returns the [KECCAK256](https://en.wikipedia.org/wiki/SHA-3) digest *aBytesLike*. +Returns the [KECCAK256](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/SHA-3) digest *aBytesLike*. #### *ethers* . *utils* . **ripemd160** ( aBytesLike ) **=>** *string< [DataHexstring](../bytes)< 20 > >* -Returns the [RIPEMD-160](https://en.m.wikipedia.org/wiki/RIPEMD) digest of *aBytesLike*. +Returns the [RIPEMD-160](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.m.wikipedia.org/wiki/RIPEMD) digest of *aBytesLike*. #### *ethers* . *utils* . **sha256** ( aBytesLike ) **=>** *string< [DataHexstring](../bytes)< 32 > >* -Returns the [SHA2-256](https://en.wikipedia.org/wiki/SHA-2) digest of *aBytesLike*. +Returns the [SHA2-256](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/SHA-2) digest of *aBytesLike*. #### *ethers* . *utils* . **sha512** ( aBytesLike ) **=>** *string< [DataHexstring](../bytes)< 64 > >* -Returns the [SHA2-512](https://en.wikipedia.org/wiki/SHA-2) digest of *aBytesLike*. +Returns the [SHA2-512](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/SHA-2) digest of *aBytesLike*. #### *ethers* . *utils* . **computeHmac** ( algorithm , key , data ) **=>** *string< [DataHexstring](../bytes) >* -Returns the [HMAC](https://en.wikipedia.org/wiki/HMAC) of *data* with *key* +Returns the [HMAC](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/HMAC) of *data* with *key* using the [Algorithm](./) *algorithm*. @@ -62,14 +62,14 @@ using the [Algorithm](./) *algorithm*. #### *ethers* . *utils* . *SupportedAlgorithm* . **sha256** **=>** *string* -Use the [SHA2-256](https://en.wikipedia.org/wiki/SHA-2) hash algorithm. +Use the [SHA2-256](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/SHA-2) hash algorithm. #### *ethers* . *utils* . *SupportedAlgorithm* . **sha512** **=>** *string* -Use the [SHA2-512](https://en.wikipedia.org/wiki/SHA-2) hash algorithm. +Use the [SHA2-512](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/SHA-2) hash algorithm. @@ -97,7 +97,7 @@ The Ethereum Identity function computs the keccak256 hash of the *text* bytes. #### *ethers* . *utils* . **namehash** ( name ) **=>** *string< [DataHexstring](../bytes)< 32 > >* -Returns the [ENS Namehash](https://docs.ens.domains/contract-api-reference/name-processing#hashing-names) of *name*. +Returns the [ENS Namehash](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/docs.ens.domains/contract-api-reference/name-processing) of *name*. @@ -137,4 +137,4 @@ according to their respective type in *arrayOfTypes*. ----- -**Content Hash:** 2fd8814fdbe671ecc9c4aa5a9e248528f076bc34c0a1c26caef769d704d24b8b \ No newline at end of file +**Content Hash:** 45555de5a99896ceb416df9f1c5da990ab6d1decc0ecbfba38eea5a476772fba \ No newline at end of file diff --git a/docs/api/utils/hashing/index.html b/docs/api/utils/hashing/index.html index 2e7db082..99e01d7f 100644 --- a/docs/api/utils/hashing/index.html +++ b/docs/api/utils/hashing/index.html @@ -1,13 +1,13 @@ -Hashing
+Hashing

Hashing Algorithms

Explain what hash functions are?

Cryptographic Hashing

The Cryptographic Hash Functions are a specific family of hash functions.

-
ethers . utils . keccak256 ( aBytesLike ) string< DataHexstring< 32 > >

Returns the KECCAK256 digest aBytesLike//.

-
ethers . utils . ripemd160 ( aBytesLike ) string< DataHexstring< 20 > >

Returns the RIPEMD-160 digest of aBytesLike//.

-
ethers . utils . sha256 ( aBytesLike ) string< DataHexstring< 32 > >

Returns the SHA2-256 digest of aBytesLike//.

-
ethers . utils . sha512 ( aBytesLike ) string< DataHexstring< 64 > >

Returns the SHA2-512 digest of aBytesLike//.

-
ethers . utils . computeHmac ( algorithm , key , data ) string< DataHexstring >

Returns the HMAC of data with key using the Algorithm algorithm//.

+
ethers . utils . keccak256 ( aBytesLike ) string< DataHexstring< 32 > >

Returns the KECCAK256 digest aBytesLike.

+
ethers . utils . ripemd160 ( aBytesLike ) string< DataHexstring< 20 > >

Returns the RIPEMD-160 digest of aBytesLike.

+
ethers . utils . sha256 ( aBytesLike ) string< DataHexstring< 32 > >

Returns the SHA2-256 digest of aBytesLike.

+
ethers . utils . sha512 ( aBytesLike ) string< DataHexstring< 64 > >

Returns the SHA2-512 digest of aBytesLike.

+
ethers . utils . computeHmac ( algorithm , key , data ) string< DataHexstring >

Returns the HMAC of data with key using the Algorithm algorithm.

HMAC Supported Algorithms

ethers . utils . SupportedAlgorithm . sha256 string

Use the SHA2-256 hash algorithm.

@@ -21,4 +21,4 @@

When using the Solidity abi.packEncoded(...) function, a non-standard tightly packed version of encoding is used. These functions implement the tightly packing algorithm.

ethers . utils . solidityPack ( arrayOfTypes , arrayOfValues ) string< DataHexstring >

Returns the non-standard encoded arrayOfValues packed according to their respecive type in arrayOfTypes.

ethers . utils . solidityKeccak256 ( arrayOfTypes , arrayOfValues ) string< DataHexstring< 32 > >

Returns the KECCAK256 of the non-standard encoded arrayOfValues packed according to their respective type in arrayOfTypes.

-
ethers . utils . soliditySha256 ( arrayOfTypes , arrayOfValues ) string< DataHexstring< 32 > >

Returns the SHA2-256 of the non-standard encoded arrayOfValues packed according to their respective type in arrayOfTypes.

\ No newline at end of file +
ethers . utils . soliditySha256 ( arrayOfTypes , arrayOfValues ) string< DataHexstring< 32 > >

Returns the SHA2-256 of the non-standard encoded arrayOfValues packed according to their respective type in arrayOfTypes.

\ No newline at end of file diff --git a/docs/api/utils/hdnode/README.md b/docs/api/utils/hdnode/README.md new file mode 100644 index 00000000..ef4646d7 --- /dev/null +++ b/docs/api/utils/hdnode/README.md @@ -0,0 +1,244 @@ +----- + +Documentation: [html](https://docs-beta.ethers.io/) + +----- + + +HD Wallet +========= + + +TODO: Explain [BIP32](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/github.com/bitcoin/bips/blob/master/bip-0032.mediawiki) [BIP-39](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.bitcoin.it/wiki/BIP_0039) and whatnot here... + + +Types +----- + + + +### Constants + + + +#### *ethers* . *utils* . **defaultPath** **=>** *"m/44'/60'/0'/0/0"* + +The default path for Ethereum in an HD Wallet + + + + +### Mnemonic + + + +#### *mnemonic* . **phrase** **=>** *string* + +The mnemonic phrase for this mnemonic. It is 12, 15, 18, 21 or 24 words long +and separated by the whitespace specified by the `locale`. + + + + +#### *mnemonic* . **path** **=>** *string* + +The HD path for this mnemonic. + + + + +#### *mnemonic* . **locale** **=>** *string* + +The language of the wordlist this mnemonic is using. + + + + +HDNode +------ + + + +### Creating Instances + + + +#### *ethers* . *HDNode* . **fromMnemonic** ( phrase [ , password [ , wordlist ] ] ) **=>** *[HDNode](./)* + +Return the [HDNode](./) for *phrase* with the optional *password* +and *wordlist*. + + + + +#### *ethers* . *HDNode* . **fromSeed** ( aBytesLike ) **=>** *[HDNode](./)* + +Return the [HDNode](./) for the seed *aBytesLike*. + + + + +#### *ethers* . *HDNode* . **fromExtendedKey** ( extendedKey ) **=>** *[HDNode](./)* + +Return the [HDNode](./) for the *extendedKey*. If *extendedKey* was +neutered, the **HDNode** will only be able to compute addresses and not +private keys. + + + + +### Properties + + + +#### *hdNode* . **privateKey** **=>** *string< [DataHexstring](../bytes)< 32 > >* + +The private key for this HDNode. + + + + +#### *hdNode* . **publicKey** **=>** *string< [DataHexstring](../bytes)< 33 > >* + +The (compresses) public key for this HDNode. + + + + +#### *hdNode* . **fingerprint** **=>** *string< [DataHexstring](../bytes)< 4 > >* + +The fingerprint is meant as an index to quickly match parent and +children nodes together, however collisions may occur and software +should verify matching nodes. + +Most developers will not need to use this. + + + + +#### *hdNode* . **parentFingerprint** **=>** *string< [DataHexstring](../bytes)< 4 > >* + +The fingerprint of the parent node. See *fingerprint* for more +details. + +Most developers will not need to use this. + + + + +#### *hdNode* . **address** **=>** *string< [Address](../address) >* + +The address of this HDNode. + + + + +#### *hdNode* . **mnemonic** **=>** *[Mnemonic](./)* + +The mnemonic of this HDNode, if known. + + + + +#### *hdNode* . **path** **=>** *string* + +The path of this HDNode, if known. If the *mnemonic* is also known, +this will match `mnemonic.path`. + + + + +#### *hdNode* . **chainCode** **=>** *string< [DataHexstring](../bytes)< 32 > >* + +The chain code is used as a non-secret private key which is then used +with EC-multiply to provide the ability to derive addresses without +the private key of child non-hardened nodes. + +Most developers will not need to use this. + + + + +#### *hdNode* . **index** **=>** *number* + +The index of this HDNode. This will match the last component of +the *path*. + +Most developers will not need to use this. + + + + +#### *hdNode* . **depth** **=>** *number* + +The depth of this HDNode. This will match the number of components +(less one, the `m/`) of the *path*. + +Most developers will not need to use this. + + + + +#### *hdNode* . **extendedKey** **=>** *string* + +A serialized string representation of this HDNode. Not all properties +are included in the serialization, such as the mnemonic and path, so +serializing and deserializing (using the `fromExtendedKey` class +method) will result in reduced information. + + + + +### Methods + + + +#### *hdNode* . **neuter** ( ) **=>** *[HDNode](./)* + +Return a new instance of *hdNode* with its private key removed +but all otehr properties preserved. This ensures that the key +can not leak the private key of itself or any derived children, +but may still be used to compute the addresses of itself and +any non-hardened children. + + + + +#### *hdNode* . **derivePath** ( path ) **=>** *[HDNode](./)* + +Return a new [HDNode](./) which is the child of *hdNode* found +by deriving *path*. + + + + +Other Functions +--------------- + + + +#### *ethers* . *utils* . **mnemonicToSeed** ( phrase [ , password ] ) **=>** *string< [DataHexstring](../bytes)< 64 > >* + +Convert a mnemonic phrase to a seed, according to [BIP-39](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.bitcoin.it/wiki/BIP_0039). + + + + +#### *ethers* . *utils* . **mnemonicToEntropy** ( phrase [ , wordlist ] ) **=>** *string< [DataHexstring](../bytes) >* + +Convert a mnemonic phrase to its entropy, according to [BIP-39](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.bitcoin.it/wiki/BIP_0039). + + + + +#### *ethers* . *utils* . **isValidMnemonic** ( phrase [ , wordlist ] ) **=>** *boolean* + +Returns true if *phrase* is a valid mnemonic phrase, by +testing the checksum. + + + + + +----- +**Content Hash:** c33ab4f669006710c2364a857d2d69c24a8676fb3d1dfc7e66a8d07bc12ee1a2 \ No newline at end of file diff --git a/docs/api/utils/hdnode/index.html b/docs/api/utils/hdnode/index.html new file mode 100644 index 00000000..6e40d619 --- /dev/null +++ b/docs/api/utils/hdnode/index.html @@ -0,0 +1,42 @@ +HD Wallet
+

HD Wallet

+

TODO: Explain BIP32 BIP-39 and whatnot here...

+

Types

+ +

Constants

+ +
ethers . utils . defaultPath "m/44'/60'/0'/0/0"

The default path for Ethereum in an HD Wallet

+

Mnemonic

+ +
mnemonic . phrase string

The mnemonic phrase for this mnemonic. It is 12, 15, 18, 21 or 24 words long and separated by the whitespace specified by the locale.

+
mnemonic . path string

The HD path for this mnemonic.

+
mnemonic . locale string

The language of the wordlist this mnemonic is using.

+

HDNode

+ +

Creating Instances

+ +
ethers . HDNode . fromMnemonic ( phrase [ , password [ , wordlist ] ] ) HDNode

Return the HDNode for phrase with the optional password and wordlist.

+
ethers . HDNode . fromSeed ( aBytesLike ) HDNode

Return the HDNode for the seed aBytesLike.

+
ethers . HDNode . fromExtendedKey ( extendedKey ) HDNode

Return the HDNode for the extendedKey. If extendedKey was neutered, the HDNode will only be able to compute addresses and not private keys.

+

Properties

+ +
hdNode . privateKey string< DataHexstring< 32 > >

The private key for this HDNode.

+
hdNode . publicKey string< DataHexstring< 33 > >

The (compresses) public key for this HDNode.

+
hdNode . fingerprint string< DataHexstring< 4 > >

The fingerprint is meant as an index to quickly match parent and children nodes together, however collisions may occur and software should verify matching nodes.

Most developers will not need to use this.

+
hdNode . parentFingerprint string< DataHexstring< 4 > >

The fingerprint of the parent node. See fingerprint for more details.

Most developers will not need to use this.

+
hdNode . address string< Address >

The address of this HDNode.

+
hdNode . mnemonic Mnemonic

The mnemonic of this HDNode, if known.

+
hdNode . path string

The path of this HDNode, if known. If the mnemonic is also known, this will match mnemonic.path.

+
hdNode . chainCode string< DataHexstring< 32 > >

The chain code is used as a non-secret private key which is then used with EC-multiply to provide the ability to derive addresses without the private key of child non-hardened nodes.

Most developers will not need to use this.

+
hdNode . index number

The index of this HDNode. This will match the last component of the path.

Most developers will not need to use this.

+
hdNode . depth number

The depth of this HDNode. This will match the number of components (less one, the m/) of the path.

Most developers will not need to use this.

+
hdNode . extendedKey string

A serialized string representation of this HDNode. Not all properties are included in the serialization, such as the mnemonic and path, so serializing and deserializing (using the fromExtendedKey class method) will result in reduced information.

+

Methods

+ +
hdNode . neuter ( ) HDNode

Return a new instance of hdNode with its private key removed but all otehr properties preserved. This ensures that the key can not leak the private key of itself or any derived children, but may still be used to compute the addresses of itself and any non-hardened children.

+
hdNode . derivePath ( path ) HDNode

Return a new HDNode which is the child of hdNode found by deriving path.

+

Other Functions

+ +
ethers . utils . mnemonicToSeed ( phrase [ , password ] ) string< DataHexstring< 64 > >

Convert a mnemonic phrase to a seed, according to BIP-39.

+
ethers . utils . mnemonicToEntropy ( phrase [ , wordlist ] ) string< DataHexstring >

Convert a mnemonic phrase to its entropy, according to BIP-39.

+
ethers . utils . isValidMnemonic ( phrase [ , wordlist ] ) boolean

Returns true if phrase is a valid mnemonic phrase, by testing the checksum.

\ No newline at end of file diff --git a/docs/api/utils/index.html b/docs/api/utils/index.html index 82ed06c2..d51ebfda 100644 --- a/docs/api/utils/index.html +++ b/docs/api/utils/index.html @@ -1,4 +1,4 @@ -Utilities
+Utilities \ No newline at end of file +
\ No newline at end of file diff --git a/docs/api/utils/logger/README.md b/docs/api/utils/logger/README.md new file mode 100644 index 00000000..45a490b1 --- /dev/null +++ b/docs/api/utils/logger/README.md @@ -0,0 +1,180 @@ +----- + +Documentation: [html](https://docs-beta.ethers.io/) + +----- + + +Logger +====== + + + +Errors +------ + + + +#### *Logger* . *errors* . **UNKNOWN_ERROR** + +A generic unknown error. + + + + +#### *Logger* . *errors* . **NOT_IMPLEMENTED** + +The operation is not implemented. + + + + +#### *Logger* . *errors* . **UNSUPPORTED_OPERATION** + +The operation is not supported. + + + + +#### *Logger* . *errors* . **NETWORK_ERROR** + +An Ethereum network validation error, such as an invalid chain ID. + + + + +#### *Logger* . *errors* . **SERVER_ERROR** + +There was an error communicating with a server. + + + + +#### *Logger* . *errors* . **TIMEOUT** + +A timeout occurred. + + + + +#### *Logger* . *errors* . **BUFFER_OVERRUN** + +The amount of data needed is more than the amount of data required, +which would cause the data buffer to read past its end. + + + + +#### *Logger* . *errors* . **NUMERIC_FAULT** + +There was an invalid operation done on numeric values. + +Common cases of this occur when there is [overflow](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/Integer_overflow), +[arithmetic underflow](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/Arithmetic_underflow) in fixed numeric types or division by zero. + + + + +#### *Logger* . *errors* . **MISSING_NEW** + +An object is a Class, but is now being called with `new`. + + + + +#### *Logger* . *errors* . **INVALID_ARGUMENT** + +The type or value of an argument is invalid. This will generally also +include the `name` and `value` of the argument. Any function which +accepts sensitive data (such as a private key) will include the string +`[REDACTED]]` instead of the value passed in. + + + + +#### *Logger* . *errors* . **MISSING_ARGUMENT** + +An expected parameter was not specified. + + + + +#### *Logger* . *errors* . **UNEXPECTED_ARGUMENT** + +Too many parameters we passed into a function. + + + + +#### *Logger* . *errors* . **CALL_EXCEPTION** + +An attempt to call a blockchain contract (getter) resulted in a +revert or other error. + + + + +#### *Logger* . *errors* . **INSUFFICIENT_FUNDS** + +The account is attempting to make a transaction which costs more than is +available. + +A sending account must have enough ether to pay for the value, the gas limit +(at the gas price) as well as the intrinsic cost of data. The intrinsic cost +of data is 4 gas for each zero byte and 68 gas for each non-zero byte. + + + + +#### *Logger* . *errors* . **NONCE_EXPIRED** + +The nonce being specified has already been used in a mined transaction. + + + + +#### *Logger* . *errors* . **REPLACEMENT_UNDERPRICED** + +When replacing a transaction, by using a nonce which has already been sent to +the network, but which has not been mined yet the new transaction must specify +a higher gas price. + +This error occurs when the gas price is insufficient to *bribe* the transaction +pool to prefer the new transaction over the old one. Generally, the new gas price +should be about 50% + 1 wei more, so if a gas price of 10 gwei was used, the +replacement should be 15.000000001 gwei. + + + + +#### *Logger* . *errors* . **UNPREDICTABLE_GAS_LIMIT** + +When estimating the required amount of gas for a transaction, a node is queried for +its best guess. + +If a node is unable (or unwilling) to predict the cost, this error occurs. + +The best remedy for this situation is to specify a gas limit in the transaction +manually. + +This error can also indicate that the transaction is expected to fail regardless, +if for example an account with no tokens is attempting to send a token. + + + + +Creating instances +------------------ + + + +#### **new** *ethers* . *utils* . **Logger** ( version ) + +Create a new logger which will include *version* in all errors thrown. + + + + + +----- +**Content Hash:** 8e9a442738b535dee543efeb8207f15f887a9ed3fbc984567c751c73c6ad541a \ No newline at end of file diff --git a/docs/api/utils/logger/index.html b/docs/api/utils/logger/index.html new file mode 100644 index 00000000..79ec2309 --- /dev/null +++ b/docs/api/utils/logger/index.html @@ -0,0 +1,25 @@ +Logger
+

Logger

+ +

Errors

+ +
Logger . errors . UNKNOWN_ERROR

A generic unknown error.

+
Logger . errors . NOT_IMPLEMENTED

The operation is not implemented.

+
Logger . errors . UNSUPPORTED_OPERATION

The operation is not supported.

+
Logger . errors . NETWORK_ERROR

An Ethereum network validation error, such as an invalid chain ID.

+
Logger . errors . SERVER_ERROR

There was an error communicating with a server.

+
Logger . errors . TIMEOUT

A timeout occurred.

+
Logger . errors . BUFFER_OVERRUN

The amount of data needed is more than the amount of data required, which would cause the data buffer to read past its end.

+
Logger . errors . NUMERIC_FAULT

There was an invalid operation done on numeric values.

Common cases of this occur when there is overflow, arithmetic underflow in fixed numeric types or division by zero.

+
Logger . errors . MISSING_NEW

An object is a Class, but is now being called with new.

+
Logger . errors . INVALID_ARGUMENT

The type or value of an argument is invalid. This will generally also include the name and value of the argument. Any function which accepts sensitive data (such as a private key) will include the string [REDACTED]] instead of the value passed in.

+
Logger . errors . MISSING_ARGUMENT

An expected parameter was not specified.

+
Logger . errors . UNEXPECTED_ARGUMENT

Too many parameters we passed into a function.

+
Logger . errors . CALL_EXCEPTION

An attempt to call a blockchain contract (getter) resulted in a revert or other error.

+
Logger . errors . INSUFFICIENT_FUNDS

The account is attempting to make a transaction which costs more than is available.

A sending account must have enough ether to pay for the value, the gas limit (at the gas price) as well as the intrinsic cost of data. The intrinsic cost of data is 4 gas for each zero byte and 68 gas for each non-zero byte.

+
Logger . errors . NONCE_EXPIRED

The nonce being specified has already been used in a mined transaction.

+
Logger . errors . REPLACEMENT_UNDERPRICED

When replacing a transaction, by using a nonce which has already been sent to the network, but which has not been mined yet the new transaction must specify a higher gas price.

This error occurs when the gas price is insufficient to bribe the transaction pool to prefer the new transaction over the old one. Generally, the new gas price should be about 50% + 1 wei more, so if a gas price of 10 gwei was used, the replacement should be 15.000000001 gwei.

+
Logger . errors . UNPREDICTABLE_GAS_LIMIT

When estimating the required amount of gas for a transaction, a node is queried for its best guess.

If a node is unable (or unwilling) to predict the cost, this error occurs.

The best remedy for this situation is to specify a gas limit in the transaction manually.

This error can also indicate that the transaction is expected to fail regardless, if for example an account with no tokens is attempting to send a token.

+

Creating instances

+ +
new ethers . utils . Logger ( version )

Create a new logger which will include version in all errors thrown.

\ No newline at end of file diff --git a/docs/api/utils/properties/README.md b/docs/api/utils/properties/README.md index 864c4e28..be48eb49 100644 --- a/docs/api/utils/properties/README.md +++ b/docs/api/utils/properties/README.md @@ -10,7 +10,42 @@ Property Utilities -#### *utils* . **resolveProperties** ( anObject ) **=>** *Promise< any >* +#### *ethers* . *utils* . **checkPropertoes** ( ) **=>** *void* + + + + + + +#### *ethers* . *utils* . **deepCopy** ( anObject ) **=>** *any* + + + + + + +#### *ethers* . *utils* . **defineReadOnly** ( anObject , name , value ) **=>** *void* + + + + + + +#### *ethers* . *utils* . **getStatic** ( aConstructor , key ) **=>** *any* + + + + + + +#### *ethers* . *utils* . **resolveProperties** ( anObject ) **=>** *Promise< any >* + + + + + + +#### *ethers* . *utils* . **shallowCopy** ( anObject ) **=>** *any* @@ -19,4 +54,4 @@ Property Utilities ----- -**Content Hash:** 6966c4808403140c68bb04e1fa15591474d5dd336cc882150ae390b0b80257f9 \ No newline at end of file +**Content Hash:** 99b9fc544118eb4db3df1bea0d761c04e9d051353aa6b21386b6b497d5c0e93d \ No newline at end of file diff --git a/docs/api/utils/properties/index.html b/docs/api/utils/properties/index.html index 63a38cc1..1fa82922 100644 --- a/docs/api/utils/properties/index.html +++ b/docs/api/utils/properties/index.html @@ -1,4 +1,9 @@ -Property Utilities
+Property Utilities

Property Utilities

-
utils . resolveProperties ( anObject ) Promise< any >

\ No newline at end of file +
ethers . utils . checkPropertoes ( ) void

+
ethers . utils . deepCopy ( anObject ) any

+
ethers . utils . defineReadOnly ( anObject , name , value ) void

+
ethers . utils . getStatic ( aConstructor , key ) any

+
ethers . utils . resolveProperties ( anObject ) Promise< any >

+
ethers . utils . shallowCopy ( anObject ) any

\ No newline at end of file diff --git a/docs/api/utils/signing-key/README.md b/docs/api/utils/signing-key/README.md index 48fdc44d..9eb8ea58 100644 --- a/docs/api/utils/signing-key/README.md +++ b/docs/api/utils/signing-key/README.md @@ -10,18 +10,95 @@ Signing Key +#### **new** *ethers* . *utils* . **SigningKey** ( privateKey ) + +Create a new SigningKey for *privateKey*. + + + + +#### *signingKey* . **privateKey** **=>** *string< [DataHexstring](../bytes)< 32 > >* + +The private key for this Signing Key. + + + + +#### *signingKey* . **publicKey** **=>** *string< [DataHexstring](../bytes)< 65 > >* + +The uncompressed public key for this Signing Key. It will always be +65 bytes (130 nibbles) and begine with `0x04`. + + + + +#### *signingKey* . **compressedPublicKey** **=>** *string< [DataHexstring](../bytes)< 33 > >* + +The compressed public key for this Signing Key. It will always be +33 bytes (66 nibbles) and begine with either `0x02` or `0x03`. + + + + +#### *signingKey* . **signDisgest** ( digest ) **=>** *[Signature](../bytes)* + +Sign the *digest* and return the signature. + + + + +#### *signingKey* . **computeSharedSecret** ( otherKey ) **=>** *string< [DataHexstring](../bytes)< 32 > >* + +Compute the ECDH shared secret with *otherKey*. The *otherKey* may be +either a public key or a private key, but generally will be a public key from +another party. + +It is best practice that each party computes the hash of this before using it +as a symmetric key. + + + + +#### *SigningKey* . **isSigningKey** ( anObject ) **=>** *boolean* + +Returns true if *anObject* is a SigningKey. + + + + +Other Functions +--------------- + + + #### *ethers* . *utils* . **verifyMessage** ( message , signature ) **=>** *string< [Address](../address) >* Returns the address that signed *message* producing *signature*. The signature may have a non-canonical v (i.e. does not need to be 27 or 28), in which case it will be normalized to compute the `recoveryParam` which will then be used to compute the address; this allows systems which use -the v to encode additional data (such as [EIP-155](https://eips.ethereum.org/EIPS/eip-155)) +the v to encode additional data (such as [EIP-155](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/eips.ethereum.org/EIPS/eip-155)) to be used since the v parameter is still completely non-ambiguous. +#### *ethers* . *utils* . **recocverPublicKey** ( digest , signature ) **=>** *string< [DataHexstring](../bytes)< 65 > >* + + + + + + +#### *ethers* . *utils* . **computePublicKey** ( key [ , compressed=false ] ) **=>** *string< [DataHexstring](../bytes) >* + +Computes the public key of *key*, optionally compressing it. The *key* +can be any form of public key (compressed or uncompressed) or a private +key. + + + + ----- -**Content Hash:** 91ee024442e5991be731bab1bf05310b3540825acc1c1c7dffa608eff450430b \ No newline at end of file +**Content Hash:** 2e1925ed3fec464657162ec80f6014719080dfcfc56f23fa6a1d02c24ce9a198 \ No newline at end of file diff --git a/docs/api/utils/signing-key/index.html b/docs/api/utils/signing-key/index.html index d8146769..9d75088e 100644 --- a/docs/api/utils/signing-key/index.html +++ b/docs/api/utils/signing-key/index.html @@ -1,4 +1,15 @@ -Signing Keys
-

Signing Key

+Signing Keys
+

Signing Key

-
ethers . utils . verifyMessage ( message , signature ) string< Address >

Returns the address that signed message producing signature. The signature may have a non-canonical v (i.e. does not need to be 27 or 28), in which case it will be normalized to compute the `recoveryParam` which will then be used to compute the address; this allows systems which use the v to encode additional data (such as EIP-155) to be used since the v parameter is still completely non-ambiguous.

\ No newline at end of file +
new ethers . utils . SigningKey ( privateKey )

Create a new SigningKey for privateKey.

+
signingKey . privateKey string< DataHexstring< 32 > >

The private key for this Signing Key.

+
signingKey . publicKey string< DataHexstring< 65 > >

The uncompressed public key for this Signing Key. It will always be 65 bytes (130 nibbles) and begine with 0x04.

+
signingKey . compressedPublicKey string< DataHexstring< 33 > >

The compressed public key for this Signing Key. It will always be 33 bytes (66 nibbles) and begine with either 0x02 or 0x03.

+
signingKey . signDisgest ( digest ) Signature

Sign the digest and return the signature.

+
signingKey . computeSharedSecret ( otherKey ) string< DataHexstring< 32 > >

Compute the ECDH shared secret with otherKey. The otherKey may be either a public key or a private key, but generally will be a public key from another party.

It is best practice that each party computes the hash of this before using it as a symmetric key.

+
SigningKey . isSigningKey ( anObject ) boolean

Returns true if anObject is a SigningKey.

+

Other Functions

+ +
ethers . utils . verifyMessage ( message , signature ) string< Address >

Returns the address that signed message producing signature. The signature may have a non-canonical v (i.e. does not need to be 27 or 28), in which case it will be normalized to compute the `recoveryParam` which will then be used to compute the address; this allows systems which use the v to encode additional data (such as EIP-155) to be used since the v parameter is still completely non-ambiguous.

+
ethers . utils . recocverPublicKey ( digest , signature ) string< DataHexstring< 65 > >

+
ethers . utils . computePublicKey ( key [ , compressed = false ] ) string< DataHexstring >

Computes the public key of key, optionally compressing it. The key can be any form of public key (compressed or uncompressed) or a private key.

\ No newline at end of file diff --git a/docs/api/utils/strings/README.md b/docs/api/utils/strings/README.md index cb20cfb4..bedd6c8d 100644 --- a/docs/api/utils/strings/README.md +++ b/docs/api/utils/strings/README.md @@ -96,7 +96,7 @@ UnicodeNormalizationForm ------------------------ -There are several [commonly used forms](https://en.wikipedia.org/wiki/Unicode_equivalence) +There are several [commonly used forms](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/Unicode_equivalence) when normalizing UTF-8 data, which allow strings to be compared or hashed in a stable way. @@ -155,7 +155,7 @@ See NFKC for more an example. 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). +[homoglyph attacks](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/IDN_homograph_attack). @@ -220,7 +220,7 @@ the custom error function. Due to the way UTF-8 allows variable length byte sequences to be used, it is possible to have multiple representations of the same character, which means -[overlong sequences](https://en.wikipedia.org/wiki/UTF-8#Overlong_encodings) +[overlong sequences](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/UTF-8) allow for a non-distinguished string to be formed, which can impact security as multiple strings that are otherwise equal can have different hashes. @@ -293,7 +293,7 @@ overlong sequences to be converted to their equivalent string. This will replace all invalid sequences (by consuming invalid prefix bytes and any following continuation bytes) with the -[UTF-8 Replacement Character](https://en.wikipedia.org/wiki/Specials_%28Unicode_block%29#Replacement_character), +[UTF-8 Replacement Character](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/Specials_%28Unicode_block%29), (i.e. U+FFFD). @@ -301,4 +301,4 @@ any following continuation bytes) with the ----- -**Content Hash:** c3856e40d58241c0a7f5bc29928731971ede8e8e8c75e6eda97778c9b952e1f0 \ No newline at end of file +**Content Hash:** 8654a53455522a9b4187d77e56c47fb9a908574b594aed3ce1a8a7d445c8fe75 \ No newline at end of file diff --git a/docs/api/utils/strings/index.html b/docs/api/utils/strings/index.html index f8193469..040101bc 100644 --- a/docs/api/utils/strings/index.html +++ b/docs/api/utils/strings/index.html @@ -1,4 +1,4 @@ -Strings
+Strings

Strings

Tra la la

Bytes32String

@@ -36,4 +36,4 @@

There are already several functions available for the most common situations.

ethers . utils . Utf8ErrorFuncs . error

The will throw an error on any error with a UTF-8 sequence, including invalid prefix bytes, overlong sequences, UTF-16 surrogate pairs.

ethers . utils . Utf8ErrorFuncs . ignore

This will drop all invalid sequences (by consuming invalid prefix bytes and any following continuation bytes) from the final string as well as permit overlong sequences to be converted to their equivalent string.

-
ethers . utils . Utf8ErrorFuncs . replace

This will replace all invalid sequences (by consuming invalid prefix bytes and any following continuation bytes) with the UTF-8 Replacement Character, (i.e. U+FFFD).

\ No newline at end of file +
ethers . utils . Utf8ErrorFuncs . replace

This will replace all invalid sequences (by consuming invalid prefix bytes and any following continuation bytes) with the UTF-8 Replacement Character, (i.e. U+FFFD).

\ No newline at end of file diff --git a/docs/api/utils/transactions/README.md b/docs/api/utils/transactions/README.md index bf2a8827..577ecf90 100644 --- a/docs/api/utils/transactions/README.md +++ b/docs/api/utils/transactions/README.md @@ -18,54 +18,57 @@ Types ### UnsignedTransaction -An unsigned transaction represents a transaction that has not been signed. +An unsigned transaction represents a transaction that has not been +signed and its values are flexible as long as they are not ambiguous. #### *unsignedTransaction* . **to** **=>** *string< [Address](../address) >* - +The addres this transaction is to. #### *unsignedTransaction* . **nonce** **=>** *number* +The nonce of this transaction. +#### *unsignedTransaction* . **gasLimit** **=>** *[BigNumberish](../bignumber)* -#### *unsignedTransaction* . **gasLimit** **=>** *[BigNumber](../bignumber)* +The gas limit for this transaction. +#### *unsignedTransaction* . **gasPrice** **=>** *[BigNumberish](../bignumber)* - -#### *unsignedTransaction* . **gasPrice** **=>** *[BigNumber](../bignumber)* - - +The gas price for this transaction. #### *unsignedTransaction* . **data** **=>** *[BytesLike](../bytes)* +The data for this transaction. +#### *unsignedTransaction* . **value** **=>** *[BigNumberish](../bignumber)* -#### *unsignedTransaction* . **value** **=>** *[BigNumber](../bignumber)* - - +The value (in wei) for this transaction. #### *unsignedTransaction* . **chainId** **=>** *number* - +The chain ID for this transaction. If the chain ID is 0 or null, +then [EIP-155](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/eips.ethereum.org/EIPS/eip-155) is disabled and legacy signing is +used, unless overridden in a signature. @@ -76,86 +79,111 @@ An unsigned transaction represents a transaction that has not been signed. A generic object to represent a transaction. -#### *unsignedTransaction* . **hash** **=>** *string< [DataHexstring](../bytes)< 32 > >* - +#### *transaction* . **hash** **=>** *string< [DataHexstring](../bytes)< 32 > >* +The transaction hash, which can be used as an identifier for +*transaction*. This is the keccak256 of the serialized RLP encoded +representation of *transaction*. #### *unsignedTransaction* . **to** **=>** *string< [Address](../address) >* +The address *transaction* is to. +#### *transaction* . **from** **=>** *string< [Address](../address) >* -#### *unsignedTransaction* . **from** **=>** *string< [Address](../address) >* +The address *transaction* is from. +#### *transaction* . **nonce** **=>** *number* - -#### *unsignedTransaction* . **nonce** **=>** *number* +The nonce for *transaction*. Each transaction sent to the network +from an account includes this, which ensures the order and +non-replayability of a transaction. This must be equal to the current +number of transactions ever sent to the network by the **from** address. +#### *transaction* . **gasLimit** **=>** *[BigNumber](../bignumber)* - -#### *unsignedTransaction* . **gasLimit** **=>** *[BigNumber](../bignumber)* +The gas limit for *transaction*. An account must have enough ether to +cover the gas (at the specified **gasPrice**). Any unused gas is +refunded at the end of the transaction, and if there is insufficient gas +to complete execution, the effects of the trasaction are reverted, but +the gas is **fully consumed** and an out-of-gas error occurs. +#### *transaction* . **gasPrice** **=>** *[BigNumber](../bignumber)* - -#### *unsignedTransaction* . **gasPrice** **=>** *[BigNumber](../bignumber)* +The price (in wei) per unit of gas for *transaction*. +#### *transaction* . **data** **=>** *[BytesLike](../bytes)* - -#### *unsignedTransaction* . **data** **=>** *[BytesLike](../bytes)* +The data for *transaction*. In a contract this is the call data. +#### *transaction* . **value** **=>** *[BigNumber](../bignumber)* - -#### *unsignedTransaction* . **value** **=>** *[BigNumber](../bignumber)* +The value (in wei) for *transaction*. +#### *transaction* . **chainId** **=>** *number* +The chain ID for *transaction*. This is used as part of +[EIP-155](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/eips.ethereum.org/EIPS/eip-155) to prevent replay attacks on different +networks. -#### *unsignedTransaction* . **chainId** **=>** *number* +For example, if a transaction was made on ropsten with an account +also used on homestead, it would be possible for a transaction +signed on ropsten to be executed on homestead, which is likely +unintended. + +There are situations where replay may be desired, however these +are very rare and it is almost always recommended to specify the +chain ID. +#### *transaction* . **r** **=>** *string< [DataHexstring](../bytes)< 32 > >* - -#### *unsignedTransaction* . **r** **=>** *[BytesLike](../bytes)* +The r portion of the elliptic curve signatures for *transaction*. +This is more accurately, the x coordinate of the point r (from +which the y can be computed, along with v). +#### *transaction* . **s** **=>** *string< [DataHexstring](../bytes)< 32 > >* - -#### *unsignedTransaction* . **s** **=>** *[BytesLike](../bytes)* +The s portion of the elliptic curve signatures for *transaction*. +#### *transaction* . **v** **=>** *number* - -#### *unsignedTransaction* . **v** **=>** *number* - - +The v portion of the elliptic curve signatures for *transaction*. +This is used to refine which of the two possible points a given +x-coordinate can have, and in [EIP-155](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/eips.ethereum.org/EIPS/eip-155) is additionally +used to encode the chain ID into the serialized transaction. @@ -190,16 +218,25 @@ ecrecover algorithm. #### *ethers* . *utils* . **serialize** ( transaction [ , signature ] ) **=>** *string< [DataHexstring](../bytes) >* -Computes the serialized *transaction/, optionally signed with *signature//. If -signature is not presented, the unsigned serialized transaction is returned, which can -be used to compute the hash necessary to sign. +Computes the serialized *transaction*, optionally serialized with +the a *signature*. If *signature* is not present, the unsigned +serialized transaction is returned, which can be used to compute the +hash necessary to sign. -This function uses EIP-155 if a chainId is provided, otherwise legacy serialization is -used. It is **highly** recommended to always specify a *chainId*. +This function uses [EIP-155](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/eips.ethereum.org/EIPS/eip-155) if a chainId is provided, +otherwise legacy serialization is used. It is **highly** recommended +to always specify a *chainId*. + +If *signature* includes a chain ID (explicitly or implicitly by using an +[EIP-155](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/eips.ethereum.org/EIPS/eip-155) `v` or `_vs`) it will be used to compute the +chain ID. + +If there is a mismatch between the chain ID of *transaction* and *signature* +an error is thrown. ----- -**Content Hash:** 51f4a8594ba122a2c43d7b2cffdb2bf461f3212cea828e715a76c76ef8dd1ae1 \ No newline at end of file +**Content Hash:** dcb483a7138f06449bb0303ac2d04a10f83c9498eaa23b615a3404316870b0ff \ No newline at end of file diff --git a/docs/api/utils/transactions/index.html b/docs/api/utils/transactions/index.html index 06b44f97..0f32c883 100644 --- a/docs/api/utils/transactions/index.html +++ b/docs/api/utils/transactions/index.html @@ -1,34 +1,34 @@ -Transactions
+Transactions

Transactions

Types

UnsignedTransaction

-

An unsigned transaction represents a transaction that has not been signed.

-
unsignedTransaction . to string< Address >

-
unsignedTransaction . nonce number

-
unsignedTransaction . gasLimit BigNumber

-
unsignedTransaction . gasPrice BigNumber

-
unsignedTransaction . data BytesLike

-
unsignedTransaction . value BigNumber

-
unsignedTransaction . chainId number

+

An unsigned transaction represents a transaction that has not been signed and its values are flexible as long as they are not ambiguous.

+
unsignedTransaction . to string< Address >

The addres this transaction is to.

+
unsignedTransaction . nonce number

The nonce of this transaction.

+
unsignedTransaction . gasLimit BigNumberish

The gas limit for this transaction.

+
unsignedTransaction . gasPrice BigNumberish

The gas price for this transaction.

+
unsignedTransaction . data BytesLike

The data for this transaction.

+
unsignedTransaction . value BigNumberish

The value (in wei) for this transaction.

+
unsignedTransaction . chainId number

The chain ID for this transaction. If the chain ID is 0 or null, then EIP-155 is disabled and legacy signing is used, unless overridden in a signature.

Transaction

A generic object to represent a transaction.

-
unsignedTransaction . hash string< DataHexstring< 32 > >

-
unsignedTransaction . to string< Address >

-
unsignedTransaction . from string< Address >

-
unsignedTransaction . nonce number

-
unsignedTransaction . gasLimit BigNumber

-
unsignedTransaction . gasPrice BigNumber

-
unsignedTransaction . data BytesLike

-
unsignedTransaction . value BigNumber

-
unsignedTransaction . chainId number

-
unsignedTransaction . r BytesLike

-
unsignedTransaction . s BytesLike

-
unsignedTransaction . v number

+
transaction . hash string< DataHexstring< 32 > >

The transaction hash, which can be used as an identifier for transaction. This is the keccak256 of the serialized RLP encoded representation of transaction.

+
unsignedTransaction . to string< Address >

The address transaction is to.

+
transaction . from string< Address >

The address transaction is from.

+
transaction . nonce number

The nonce for transaction. Each transaction sent to the network from an account includes this, which ensures the order and non-replayability of a transaction. This must be equal to the current number of transactions ever sent to the network by the from address.

+
transaction . gasLimit BigNumber

The gas limit for transaction. An account must have enough ether to cover the gas (at the specified gasPrice). Any unused gas is refunded at the end of the transaction, and if there is insufficient gas to complete execution, the effects of the trasaction are reverted, but the gas is fully consumed and an out-of-gas error occurs.

+
transaction . gasPrice BigNumber

The price (in wei) per unit of gas for transaction.

+
transaction . data BytesLike

The data for transaction. In a contract this is the call data.

+
transaction . value BigNumber

The value (in wei) for transaction.

+
transaction . chainId number

The chain ID for transaction. This is used as part of EIP-155 to prevent replay attacks on different networks.

For example, if a transaction was made on ropsten with an account also used on homestead, it would be possible for a transaction signed on ropsten to be executed on homestead, which is likely unintended.

There are situations where replay may be desired, however these are very rare and it is almost always recommended to specify the chain ID.

+
transaction . r string< DataHexstring< 32 > >

The r portion of the elliptic curve signatures for transaction. This is more accurately, the x coordinate of the point r (from which the y can be computed, along with v).

+
transaction . s string< DataHexstring< 32 > >

The s portion of the elliptic curve signatures for transaction.

+
transaction . v number

The v portion of the elliptic curve signatures for transaction. This is used to refine which of the two possible points a given x-coordinate can have, and in EIP-155 is additionally used to encode the chain ID into the serialized transaction.

Functions

ethers . utils . computeAddress ( publicOrPrivateKey ) string< Address >

Compute the address of publicOrPrivateKey. If a public key is provided, it may be either compressed or uncompressed.

-
ethers . utils . parse ( aBytesLike ) Transaction

Parses the transaction properties from a serialized transactions.

+
ethers . utils . parse ( aBytesLike ) Transaction

Parses the transaction properties from a serialized transactions.

ethers . utils . recoverAddress ( digest , aSignatureLike ) string< Address >

Computes the address that signed digest to get aSignatureLike using the ecrecover algorithm.

-
ethers . utils . serialize ( transaction [ , signature ] ) string< DataHexstring >

Computes the serialized transaction/, optionally signed with signature//. If signature is not presented, the unsigned serialized transaction is returned, which can be used to compute the hash necessary to sign.

This function uses EIP-155 if a chainId is provided, otherwise legacy serialization is used. It is highly recommended to always specify a chainId.

\ No newline at end of file +
ethers . utils . serialize ( transaction [ , signature ] ) string< DataHexstring >

Computes the serialized transaction, optionally serialized with the a signature. If signature is not present, the unsigned serialized transaction is returned, which can be used to compute the hash necessary to sign.

This function uses EIP-155 if a chainId is provided, otherwise legacy serialization is used. It is highly recommended to always specify a chainId.

If signature includes a chain ID (explicitly or implicitly by using an EIP-155 v or _vs) it will be used to compute the chain ID.

If there is a mismatch between the chain ID of transaction and signature an error is thrown.

\ No newline at end of file diff --git a/docs/api/utils/web/README.md b/docs/api/utils/web/README.md new file mode 100644 index 00000000..ff2dd90d --- /dev/null +++ b/docs/api/utils/web/README.md @@ -0,0 +1,135 @@ +----- + +Documentation: [html](https://docs-beta.ethers.io/) + +----- + + +Web Utilities +============= + + + +#### *ethers* . *utils* . **fetchJson** ( urlOrConnectionInfo [ , json [ , processFunc ] ] ) **=>** *Promise< any >* + +Fetch and parse the JSON content from *urlOrConnectionInfo*, with the +optiona body *json* and optionally processing the result with *processFun* +before returning it. + + + + +#### *ethers* . *utils* . **poll** ( pollFunc [ , options ] ) **=>** *Promise< any >* + +Repeatedly call pollFunc using the [Poll Options](./) until it returns a +value other than undefined. + + + + +### Connection Info + + + +#### *connection* . **url** **=>** *string* + +The URL to connect to. + + + + +#### *connection* . **user** **=>** *string* + +The username to use for [Basic Authentication](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/Basic_access_authentication). +The default is null (i.e. do not use basic authentication) + + + + +#### *connection* . **password** **=>** *string* + +The password to use for [Basic Authentication](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/Basic_access_authentication). +The default is null (i.e. do not use basic authentication) + + + + +#### *connection* . **allowInsecureAuthentication** **=>** *boolean* + +Allow [Basic Authentication](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/Basic_access_authentication) over non-secure HTTP. The default is false. + + + + +#### *connection* . **timeout** **=>** *number* + +How long to wait before rejecting with a *timeout* error. + + + + +#### *connection* . **headers** **=>** *{[key:string]:string}* + +Additional headers to include in the connection. + + + + +### Poll Options + + + +#### *options* . **timeout** **=>** *number* + +The amount of time allowed to ellapse before triggering a timeout +error. + + + + +#### *options* . **floor** **=>** *number* + +The minimum time limit to allow for [Exponential Backoff](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/Exponential_backoff). + +The default is 0s. + + + + +#### *options* . **ceiling** **=>** *number* + +The maximum time limit to allow for [Exponential Backoff](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/Exponential_backoff). + +The default is 10s. + + + + +#### *options* . **interval** **=>** *number* + +The interval used during [Exponential Backoff](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/Exponential_backoff) calculation. + +The default is 250ms. + + + + +#### *options* . **retryLimit** **=>** *number* + +The number of times to retry in the event of an error or *undefined* is +returned. + + + + +#### *options* . **onceBlock** **=>** *[Provider](../../providers/provider)* + +If this is specified, the polling will wait on new blocks from +*provider* before attempting the *pollFunc* again. + + + + + +----- +**Content Hash:** b7c1a3182a84ac1c136e7e90d5e2ba18269f0a9a91ce8523ee4e77d87a83d0b0 \ No newline at end of file diff --git a/docs/api/utils/web/index.html b/docs/api/utils/web/index.html new file mode 100644 index 00000000..33ba4b92 --- /dev/null +++ b/docs/api/utils/web/index.html @@ -0,0 +1,21 @@ +Web Utilities
+

Web Utilities

+ +
ethers . utils . fetchJson ( urlOrConnectionInfo [ , json [ , processFunc ] ] ) Promise< any >

Fetch and parse the JSON content from urlOrConnectionInfo, with the optiona body json and optionally processing the result with processFun before returning it.

+
ethers . utils . poll ( pollFunc [ , options ] ) Promise< any >

Repeatedly call pollFunc using the Poll Options until it returns a value other than undefined.

+

Connection Info

+ +
connection . url string

The URL to connect to.

+
connection . user string

The username to use for Basic Authentication. The default is null (i.e. do not use basic authentication)

+
connection . password string

The password to use for Basic Authentication. The default is null (i.e. do not use basic authentication)

+
connection . allowInsecureAuthentication boolean

Allow Basic Authentication over non-secure HTTP. The default is false.

+
connection . timeout number

How long to wait before rejecting with a timeout error.

+
connection . headers {[key:string]:string}

Additional headers to include in the connection.

+

Poll Options

+ +
options . timeout number

The amount of time allowed to ellapse before triggering a timeout error.

+
options . floor number

The minimum time limit to allow for Exponential Backoff.

The default is 0s.

+
options . ceiling number

The maximum time limit to allow for Exponential Backoff.

The default is 10s.

+
options . interval number

The interval used during Exponential Backoff calculation.

The default is 250ms.

+
options . retryLimit number

The number of times to retry in the event of an error or undefined is returned.

+
options . onceBlock Provider

If this is specified, the polling will wait on new blocks from provider before attempting the pollFunc again.

\ No newline at end of file diff --git a/docs/api/utils/wordlists/README.md b/docs/api/utils/wordlists/README.md new file mode 100644 index 00000000..9fdfcba0 --- /dev/null +++ b/docs/api/utils/wordlists/README.md @@ -0,0 +1,142 @@ +----- + +Documentation: [html](https://docs-beta.ethers.io/) + +----- + + +Wordlists +========= + + + +Wordlist +-------- + + + +#### *wordlist* . **locale** **=>** *string* + +The locale for this wordlist. + + + + +#### *wordlist* . **getWord** ( index ) **=>** *string* + +Returns the word at *index*. + + + + +#### *wordlist* . **getWordIndex** ( word ) **=>** *number* + +Returns the index of *word* within the wordlist. + + + + +#### *wordlist* . **split** ( mnemonic ) **=>** *Array< string >* + +Returns the mnemonic split into each individual word, according to a +locale's valid whitespace character set. + + + + +#### *wordlist* . **join** ( words ) **=>** *string* + +Returns the mnemonic by joining *words* together using the +whitespace that is standard for the locale. + + + + +#### *Wordlist* . **check** ( wordlists ) **=>** *string< [DataHexstring](../bytes)< 32 > >* + +Checks that all words map both directions correctly and return the +hash of the lists. Sub-classes should use this to validate the wordlist +is correct against the official wordlist hash. + + + + +#### *Wordlist* . **register** ( wordlist [ , name ] ) **=>** *string< [DataHexstring](../bytes)< 32 > >* + +Register a wordlist with the list of wordlists, optionally overriding +the registered *name*. + + + + +Languages +--------- + + + +#### *ethers* . *wordlists* . **cz** **=>** *Wordlist* + +The Czech [Wordlist](./). + + + + +#### *ethers* . *wordlists* . **en** **=>** *Wordlist* + +The English [Wordlist](./). + + + + +#### *ethers* . *wordlists* . **es** **=>** *Wordlist* + +The Spanish [Wordlist](./). + + + + +#### *ethers* . *wordlists* . **fr** **=>** *Wordlist* + +The French [Wordlist](./). + + + + +#### *ethers* . *wordlists* . **it** **=>** *Wordlist* + +The Italian [Wordlist](./). + + + + +#### *ethers* . *wordlists* . **js** **=>** *Wordlist* + +The Japanese [Wordlist](./). + + + + +#### *ethers* . *wordlists* . **ko** **=>** *Wordlist* + +The Korean [Wordlist](./). + + + + +#### *ethers* . *wordlists* . **zh_cn** **=>** *Wordlist* + +The Simplified Chinese [Wordlist](./). + + + + +#### *ethers* . *wordlists* . **zh_tw** **=>** *Wordlist* + +The Traditional Chinese [Wordlist](./). + + + + + +----- +**Content Hash:** de4a1b1a39943d23744fb0cdc9b489e08eb83a52f94da8bec0cbc3b91aae5a17 \ No newline at end of file diff --git a/docs/api/utils/wordlists/index.html b/docs/api/utils/wordlists/index.html new file mode 100644 index 00000000..54aa9bc2 --- /dev/null +++ b/docs/api/utils/wordlists/index.html @@ -0,0 +1,23 @@ +Wordlists
+

Wordlists

+ +

Wordlist

+ +
wordlist . locale string

The locale for this wordlist.

+
wordlist . getWord ( index ) string

Returns the word at index.

+
wordlist . getWordIndex ( word ) number

Returns the index of word within the wordlist.

+
wordlist . split ( mnemonic ) Array< string >

Returns the mnemonic split into each individual word, according to a locale's valid whitespace character set.

+
wordlist . join ( words ) string

Returns the mnemonic by joining words together using the whitespace that is standard for the locale.

+
Wordlist . check ( wordlists ) string< DataHexstring< 32 > >

Checks that all words map both directions correctly and return the hash of the lists. Sub-classes should use this to validate the wordlist is correct against the official wordlist hash.

+
Wordlist . register ( wordlist [ , name ] ) string< DataHexstring< 32 > >

Register a wordlist with the list of wordlists, optionally overriding the registered name.

+

Languages

+ +
ethers . wordlists . cz Wordlist

The Czech Wordlist.

+
ethers . wordlists . en Wordlist

The English Wordlist.

+
ethers . wordlists . es Wordlist

The Spanish Wordlist.

+
ethers . wordlists . fr Wordlist

The French Wordlist.

+
ethers . wordlists . it Wordlist

The Italian Wordlist.

+
ethers . wordlists . js Wordlist

The Japanese Wordlist.

+
ethers . wordlists . ko Wordlist

The Korean Wordlist.

+
ethers . wordlists . zh_cn Wordlist

The Simplified Chinese Wordlist.

+
ethers . wordlists . zh_tw Wordlist

The Traditional Chinese Wordlist.

\ No newline at end of file diff --git a/docs/cli/README.md b/docs/cli/README.md index e3d41f2f..b6b94d16 100644 --- a/docs/cli/README.md +++ b/docs/cli/README.md @@ -15,7 +15,9 @@ Command Line Interfaces * [Examples](ethers) * [Assembler](asm) * [Help](asm) - * [Examples](asm) + * [Example Input Files](asm) + * [Assembler Examples](asm) + * [Disassembler Examples](asm) * [ENS](ens) * [Help](ens) * [Examples](ens) @@ -30,4 +32,4 @@ Command Line Interfaces ----- -**Content Hash:** 0ab5c6b4f0873f77215595622f14d5908f56d0215b385c9642af8a0fa4d1a90c \ No newline at end of file +**Content Hash:** b023e99fb51eed2e58e7b39edbec13fa0f6136000680da4b8f7b64eaf6f6dc1e \ No newline at end of file diff --git a/docs/cli/asm/README.md b/docs/cli/asm/README.md index 3be532e7..2bb5bff8 100644 --- a/docs/cli/asm/README.md +++ b/docs/cli/asm/README.md @@ -9,9 +9,9 @@ Assembler ========= -The assembler Command-Line utility allows you to assemble EVM asm files -into deployable bytecode and disassemle EVM bytecode into human-readable -mnemonics. +The assembler Command-Line utility allows you to assemble the +[Ethers ASM Dialect](../../api/other/assembly/dialect) into deployable EVM bytecode +and disassemle EVM bytecode into human-readable mnemonics. Help @@ -24,8 +24,11 @@ Usage: ethers-asm [ FILENAME ] [ OPTIONS ] OPTIONS - --disassemble Disassemble input bytecode --define KEY=VALUE provide assembler defines + --disassemble Disassemble input bytecode + --ignore-warnings Ignore warnings + --pic generate position independent code + --target LABEL output LABEL bytecode (default: _) OTHER OPTIONS --debug Show stack traces for errors @@ -35,13 +38,246 @@ OTHER OPTIONS -Examples --------- +Example Input Files +------------------- -TODO examples + +#### **SimpleStore.asm** + + + + + + +``` +; SimpleStore (uint) + +; Set the inital value of 42 +sstore(0, 42) + +; Init code to deploy myContract +codecopy(0, $myContract, #myContract) +return(0, #myContract) + +@myContract { + ; Non-payable + jumpi($error, callvalue) + + ; Get the Sighash + shr({{= 256 - 32 }}, calldataload(0)) + + ; getValue() + dup1 + {{= sighash("getValue()") }} + jumpi($getValue, eq) + + ; setValue(uint) + dup1 + {{= sighash("setValue(uint)") }} + jumpi($setValue, eq) + + ; No matching signature + @error: + revert(0, 0) + + @getValue: + mstore(0, sload(0)) + return (0, 32) + + @setValue: + ; Make sure we have exactly a uint + jumpi($error, iszero(eq(calldatasize, 36))) + + ; Store the value + sstore(0, calldataload(4)) + return (0, 0) + + ; There is no *need* for the PUSH32, it just makes + ; decompiled code look nicer + @checksum[ + {{= (defines.checksum ? concat([ Opcode.from("PUSH32"), id(myContract.source) ]): "0x") }} + ] +} +``` + + + +#### **SimpleStore.bin** + + + + + + +``` +0x602a6000556044601160003960446000f334601e5760003560e01c8063209652 +0x5514602457806355241077146030575b60006000fd5b60005460005260206000 +0xf35b6024361415601e5760043560005560006000f3 +``` + + + +#### Note: Bytecode File Syntax + +A bin file may be made up of multiple blocks of bytecode, each may +optionally begin with a `0x` prefix, all of which **must** be of +even length (since bytes are required, with 2 nibbles per byte) + +All whitespace is ignored. + + + + +Assembler Examples +------------------ + + +The assembler converts an [Ethers ASM Dialect](../../api/other/assembly/dialect) into +bytecode by running multiple passes of an assemble stage, each pass +more closely approximating the final result. + +This allows small portions of the bytecode to be massaged and tweaked +until the bytecode stablizes. This allows for more compact jump +destinations and for code to be include more advanced meta-programming +techniques. + + +``` +/home/ethers> ethers-asm SimpleStore.asm +0x602a6000556044601160003960446000f334601e5760003560e01c80632096525514602457806355241077146030575b60006000fd5b60005460005260206000f35b6024361415601e5760043560005560006000f3 + +# Piping in ASM source code +/home/ethers> cat SimpleStore.asm | ethers-asm +# Same as above + +# Setting a define which the ASM file checks and adds a checksum +/home/ethers> ethers-asm --define checksum SimpleStore.asm +0x602a6000556065601160003960656000f334601e5760003560e01c80632096525514602457806355241077146030575b60006000fd5b60005460005260206000f35b6024361415601e5760043560005560006000f37f10358310d664c9aeb4bf4ce7a10a6a03176bd23194c8ccbd3160a6dac90774d6 +``` + + + +### Options + + + +#### **--define KEY=VALUE** *or* **--define FLAG** + +This allows key/value pairs (where the value is a string) and +flags (which the value is `true`) to be passed along to the +assembler, which can be accessed in +[Scripting Blocks](../../api/other/assembly/dialect), such as `{{= defined.someKey }}`. + + + + +#### **--ignore-warnings** + +By default any warning will be treated like an error. This enabled +by-passing warnings. + + + + +#### **--pic** + +When a program is assembled, the labels are usually given as an +absolute byte position, which can be jumped to for loops and +control flow. This means that a program must be installed at a specific +location. + +Byt specifying the **Position Independent Code** flag, code +will be generated in a way such that all offsets are relative, allowing +the program to be moved without any impact to its logic. + +This does incur an additional gsas cost of 8 gas per offset access though. + + + + +#### **--target LABEL** + +All programs have a root scope named `_` which is by default +assembled. This option allows another labelled target (either a +[Scopes](../../api/other/assembly/dialect) or a [Data Segment](../../api/other/assembly/dialect) to be +assembled instead. The entire program is still assembled per usual, +so this only impacts which part of the program is output. + + + + +Disassembler Examples +--------------------- + + +A disassembled program shows offsets and mnemonics for the given +bytecode. This format may change in the future to be more +human-readable. + + +``` +/home/ethers> ethers-asm --disassemble SimpleStore.bin +0000 : 0x2a ; #1 +0002 : 0x00 ; #1 +0004 : SSTORE +0005 : 0x44 ; #1 +0007 : 0x11 ; #1 +0009 : 0x00 ; #1 +000b : CODECOPY +000c : 0x44 ; #1 +000e : 0x00 ; #1 +0010 : RETURN +0011 : CALLVALUE +0012 : 0x1e ; #1 +0014 : JUMPI +0015 : 0x00 ; #1 +0017 : CALLDATALOAD +0018 : 0xe0 ; #1 +001a : SHR +001b : DUP1 +001c : 0x20965255 ; #4 +0021 : EQ +0022 : 0x24 ; #1 +0024 : JUMPI +0025 : DUP1 +0026 : 0x55241077 ; #4 +002b : EQ +002c : 0x30 ; #1 +002e : JUMPI +002f*: JUMPDEST +0030 : 0x00 ; #1 +0032 : 0x00 ; #1 +0034 : REVERT +0035*: JUMPDEST +0036 : 0x00 ; #1 +0038 : SLOAD +0039 : 0x00 ; #1 +003b : MSTORE +003c : 0x20 ; #1 +003e : 0x00 ; #1 +0040 : RETURN +0041*: JUMPDEST +0042 : 0x24 ; #1 +0044 : CALLDATASIZE +0045 : EQ +0046 : ISZERO +0047 : 0x1e ; #1 +0049 : JUMPI +004a : 0x04 ; #1 +004c : CALLDATALOAD +004d : 0x00 ; #1 +004f : SSTORE +0050 : 0x00 ; #1 +0052 : 0x00 ; #1 +0054 : RETURN + +/home/ethers> cat SimpleStore.bin | ethers-asm --disassemble +# Same as above +``` + ----- -**Content Hash:** d5cc366b4a6de2f4f257de4e23d31c9d523e7c1c4bc9bdd28cfd256ee257c754 \ No newline at end of file +**Content Hash:** 72c24560588bdf16e1bb96c2a1f3b367692b5e97c81f89d5d55396c1ccff834b \ No newline at end of file diff --git a/docs/cli/asm/index.html b/docs/cli/asm/index.html index 2b95e744..7362eb7c 100644 --- a/docs/cli/asm/index.html +++ b/docs/cli/asm/index.html @@ -1,9 +1,30 @@ -Assembler
-

Assembler

-

The assembler Command-Line utility allows you to assemble EVM asm files into deployable bytecode and disassemle EVM bytecode into human-readable mnemonics.

+Assembler
+

Assembler

+

The assembler Command-Line utility allows you to assemble the Ethers ASM Dialect into deployable EVM bytecode and disassemle EVM bytecode into human-readable mnemonics.

Help

-
Usage:
   ethers-asm [ FILENAME ] [ OPTIONS ]

OPTIONS
  --disassemble               Disassemble input bytecode
  --define KEY=VALUE          provide assembler defines

OTHER OPTIONS
  --debug                     Show stack traces for errors
  --help                      Show this usage and exit
  --version                   Show this version and exit
+
Usage:
   ethers-asm [ FILENAME ] [ OPTIONS ]

OPTIONS
  --define KEY=VALUE          provide assembler defines
  --disassemble               Disassemble input bytecode
  --ignore-warnings           Ignore warnings
  --pic                       generate position independent code
  --target LABEL              output LABEL bytecode (default: _)

OTHER OPTIONS
  --debug                     Show stack traces for errors
  --help                      Show this usage and exit
  --version                   Show this version and exit
-

Examples

-

TODO examples

\ No newline at end of file +

Example Input Files

+ +
SimpleStore.asm

+
; SimpleStore (uint)

; Set the inital value of 42
sstore(0, 42)

; Init code to deploy myContract
codecopy(0, $myContract, #myContract)
return(0, #myContract)

@myContract {
    ; Non-payable
    jumpi($error, callvalue)

    ; Get the Sighash
    shr({{= 256 - 32 }}, calldataload(0))

    ; getValue()
    dup1
    {{= sighash("getValue()") }}
    jumpi($getValue, eq)

    ; setValue(uint)
    dup1
    {{= sighash("setValue(uint)") }}
    jumpi($setValue, eq)

    ; No matching signature
    @error:
        revert(0, 0)

    @getValue:
        mstore(0, sload(0))
        return (0, 32)

    @setValue:
        ; Make sure we have exactly a uint
        jumpi($error, iszero(eq(calldatasize, 36)))

        ; Store the value
        sstore(0, calldataload(4))
        return (0, 0)

    ; There is no *need* for the PUSH32, it just makes
    ; decompiled code look nicer
    @checksum[
        {{= (defines.checksum ? concat([ Opcode.from("PUSH32"), id(myContract.source) ]): "0x") }}
    ]
}
+ +
SimpleStore.bin

+
0x602a6000556044601160003960446000f334601e5760003560e01c8063209652
0x5514602457806355241077146030575b60006000fd5b60005460005260206000
0xf35b6024361415601e5760043560005560006000f3
+ +
Note: Bytecode File Syntax

A bin file may be made up of multiple blocks of bytecode, each may optionally begin with a 0x prefix, all of which must be of even length (since bytes are required, with 2 nibbles per byte)

All whitespace is ignored.

+

Assembler Examples

+

The assembler converts an Ethers ASM Dialect into bytecode by running multiple passes of an assemble stage, each pass more closely approximating the final result.

This allows small portions of the bytecode to be massaged and tweaked until the bytecode stablizes. This allows for more compact jump destinations and for code to be include more advanced meta-programming techniques.

+
/home/ethers> ethers-asm SimpleStore.asm
0x602a6000556044601160003960446000f334601e5760003560e01c80632096525514602457806355241077146030575b60006000fd5b60005460005260206000f35b6024361415601e5760043560005560006000f3

# Piping in ASM source code
/home/ethers> cat SimpleStore.asm | ethers-asm
# Same as above

# Setting a define which the ASM file checks and adds a checksum
/home/ethers> ethers-asm --define checksum SimpleStore.asm
0x602a6000556065601160003960656000f334601e5760003560e01c80632096525514602457806355241077146030575b60006000fd5b60005460005260206000f35b6024361415601e5760043560005560006000f37f10358310d664c9aeb4bf4ce7a10a6a03176bd23194c8ccbd3160a6dac90774d6
+ +

Options

+ +
--define KEY=VALUE or --define FLAG

This allows key/value pairs (where the value is a string) and flags (which the value is true) to be passed along to the assembler, which can be accessed in Scripting Blocks, such as {{= defined.someKey }}.

+
--ignore-warnings

By default any warning will be treated like an error. This enabled by-passing warnings.

+
--pic

When a program is assembled, the labels are usually given as an absolute byte position, which can be jumped to for loops and control flow. This means that a program must be installed at a specific location.

Byt specifying the Position Independent Code flag, code will be generated in a way such that all offsets are relative, allowing the program to be moved without any impact to its logic.

This does incur an additional gsas cost of 8 gas per offset access though.

+
--target LABEL

All programs have a root scope named _ which is by default assembled. This option allows another labelled target (either a Scopes or a Data Segment to be assembled instead. The entire program is still assembled per usual, so this only impacts which part of the program is output.

+

Disassembler Examples

+

A disassembled program shows offsets and mnemonics for the given bytecode. This format may change in the future to be more human-readable.

+
/home/ethers> ethers-asm --disassemble SimpleStore.bin
0000 : 0x2a                                                               ; #1 
0002 : 0x00                                                               ; #1 
0004 : SSTORE
0005 : 0x44                                                               ; #1 
0007 : 0x11                                                               ; #1 
0009 : 0x00                                                               ; #1 
000b : CODECOPY
000c : 0x44                                                               ; #1 
000e : 0x00                                                               ; #1 
0010 : RETURN
0011 : CALLVALUE
0012 : 0x1e                                                               ; #1 
0014 : JUMPI
0015 : 0x00                                                               ; #1 
0017 : CALLDATALOAD
0018 : 0xe0                                                               ; #1 
001a : SHR
001b : DUP1
001c : 0x20965255                                                         ; #4 
0021 : EQ
0022 : 0x24                                                               ; #1 
0024 : JUMPI
0025 : DUP1
0026 : 0x55241077                                                         ; #4 
002b : EQ
002c : 0x30                                                               ; #1 
002e : JUMPI
002f*: JUMPDEST
0030 : 0x00                                                               ; #1 
0032 : 0x00                                                               ; #1 
0034 : REVERT
0035*: JUMPDEST
0036 : 0x00                                                               ; #1 
0038 : SLOAD
0039 : 0x00                                                               ; #1 
003b : MSTORE
003c : 0x20                                                               ; #1 
003e : 0x00                                                               ; #1 
0040 : RETURN
0041*: JUMPDEST
0042 : 0x24                                                               ; #1 
0044 : CALLDATASIZE
0045 : EQ
0046 : ISZERO
0047 : 0x1e                                                               ; #1 
0049 : JUMPI
004a : 0x04                                                               ; #1 
004c : CALLDATALOAD
004d : 0x00                                                               ; #1 
004f : SSTORE
0050 : 0x00                                                               ; #1 
0052 : 0x00                                                               ; #1 
0054 : RETURN

/home/ethers> cat SimpleStore.bin | ethers-asm --disassemble 
# Same as above
+
\ No newline at end of file diff --git a/docs/cli/ens/index.html b/docs/cli/ens/index.html index 0a0e5ede..839428df 100644 --- a/docs/cli/ens/index.html +++ b/docs/cli/ens/index.html @@ -1,4 +1,4 @@ -ENS
+ENS

ENS

Help

@@ -6,4 +6,4 @@
Usage:
   ethers-ens COMMAND [ ARGS ] [ OPTIONS ]

COMMANDS
   lookup [ NAME | ADDRESS [ ... ] ]
                              Lookup a name or address
   commit NAME                Submit a pre-commitment
      [ --duration DAYS ]        Register duration (default: 365 days)
      [ --salt SALT ]            SALT to blind the commit with
      [ --secret SECRET ]        Use id(SECRET) as the salt
      [ --owner OWNER ]          The target owner (default: current account)
   reveal NAME                Reveal a previous pre-commitment
      [ --duration DAYS ]        Register duration (default: 365 days)
      [ --salt SALT ]            SALT to blind the commit with
      [ --secret SECRET ]        Use id(SECRET) as the salt
      [ --owner OWNER ]          The target owner (default: current account)
   set-controller NAME        Set the controller (default: current account)
      [ --address ADDRESS ]      Specify another address
   set-subnode NAME           Set a subnode owner (default: current account)
      [ --address ADDRESS ]      Specify another address
   set-resolver NAME          Set the resolver (default: resolver.eth)
      [ --address ADDRESS ]      Specify another address
   set-addr NAME              Set the addr record (default: current account)
      [ --address ADDRESS ]      Specify another address
   set-text NAME KEY VALUE    Set a text record
   set-email NAME EMAIL       Set the email text record
   set-website NAME URL       Set the website text record
   set-content NAME HASH      Set the IPFS Content Hash
   migrate-registrar NAME     Migrate from the Legacy to the Permanent Registrar
   transfer NAME NEW_OWNER    Transfer registrant ownership
   reclaim NAME               Reset the controller by the registrant
      [ --address ADDRESS ]      Specify another address

ACCOUNT OPTIONS
  --account FILENAME          Load from a file (JSON, RAW or mnemonic)
  --account RAW_KEY           Use a private key (insecure *)
  --account 'MNEMONIC'        Use a mnemonic (insecure *)
  --account -                 Use secure entry for a raw key or mnemonic
  --account-void ADDRESS      Use an address as a void signer
  --account-void ENS_NAME     Add the resolved address as a void signer
  --account-rpc ADDRESS       Add the address from a JSON-RPC provider
  --account-rpc INDEX         Add the index from a JSON-RPC provider
  --mnemonic-password         Prompt for a password for mnemonics
  --xxx-mnemonic-password     Prompt for a (experimental) hard password

PROVIDER OPTIONS (default: all + homestead)
  --alchemy                   Include Alchemy
  --etherscan                 Include Etherscan
  --infura                    Include INFURA
  --nodesmith                 Include nodesmith
  --rpc URL                   Include a custom JSON-RPC
  --offline                   Dump signed transactions (no send)
  --network NETWORK           Network to connect to (default: homestead)

TRANSACTION OPTIONS (default: query network)
  --gasPrice GWEI             Default gas price for transactions(in wei)
  --gasLimit GAS              Default gas limit for transactions
  --nonce NONCE               Initial nonce for the first transaction
  --yes                       Always accept Siging and Sending

OTHER OPTIONS
  --wait                      Wait until transactions are mined
  --debug                     Show stack traces for errors
  --help                      Show this usage and exit
  --version                   Show this version and exit

(*) By including mnemonics or private keys on the command line they are
    possibly readable by other users on your system and may get stored in
    your bash history file. This is NOT recommended.

Examples

-

TODO examples

\ No newline at end of file +

TODO examples

\ No newline at end of file diff --git a/docs/cli/ethers/README.md b/docs/cli/ethers/README.md index 3873e3e4..4b187b9e 100644 --- a/docs/cli/ethers/README.md +++ b/docs/cli/ethers/README.md @@ -253,7 +253,7 @@ homestead> The `--xxx-mnemonic-password` is similar to the `--mnemonic-password` options, which uses a password to decrypt the account for a mnemonic, however it passes -the password through the [scrypt](https://en.wikipedia.org/wiki/Scrypt) +the password through the [scrypt](../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/Scrypt) *password-based key derivation function* first, which is intentionally slow and makes a brute-force attack far more difficult. @@ -280,4 +280,4 @@ This is still an experimental feature (hence the `xxx`). ----- -**Content Hash:** 92cdbc324ec6a29cc4cd55bf1cb14de1ef8a4512dbd2ab03d7304238269caed5 \ No newline at end of file +**Content Hash:** 4d6fa6e3c4141e4890f32fb4c2e080b5218713f231fe21962d60e27dc0ee2542 \ No newline at end of file diff --git a/docs/cli/ethers/index.html b/docs/cli/ethers/index.html index cf666ac6..cde2c782 100644 --- a/docs/cli/ethers/index.html +++ b/docs/cli/ethers/index.html @@ -1,4 +1,4 @@ -Sandbox Utility
+Sandbox Utility

Sandbox Utility

The sandbox utility provides a simple way to use the most common ethers utilities required during learning, debuging and managing interactions with the Ethereum network.

If no command is given, it will enter a REPL interface with many of the ethers utilities already exposed.

Help

@@ -31,4 +31,4 @@

The --xxx-mnemonic-password is similar to the --mnemonic-password options, which uses a password to decrypt the account for a mnemonic, however it passes the password through the scrypt password-based key derivation function first, which is intentionally slow and makes a brute-force attack far more difficult.

/home/ricmoo> ethers --account mnemonic.txt --xxx-mnemonic-password
Password (mnemonic; experimental - hard): ******
Decrypting... 100%
network: homestead (chainId: 1)
homestead> accounts[0].getAddress()
<Promise id=0 resolved>
'0x56FC8792cC17971C19bEC4Ced978beEA44711EeD'
homestead>
-
Note

This is still an experimental feature (hence the xxx).

\ No newline at end of file +
Note

This is still an experimental feature (hence the xxx).

\ No newline at end of file diff --git a/docs/cli/index.html b/docs/cli/index.html index d2bf0b58..14225b58 100644 --- a/docs/cli/index.html +++ b/docs/cli/index.html @@ -1,4 +1,4 @@ -Command Line Interfaces
+Command Line Interfaces

Command Line Interfaces

-
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/cli/plugin/index.html b/docs/cli/plugin/index.html index 681de4f2..d9517bc6 100644 --- a/docs/cli/plugin/index.html +++ b/docs/cli/plugin/index.html @@ -1,4 +1,4 @@ -Making Your Own
+Making Your Own

Making Your Own

The cli library is meant to make it easy to create command line utilities of your own.

CLI

@@ -35,4 +35,4 @@
argParser . consumeFlag ( name ) boolean

Remove the flag name and return true if it is present.

argParser . consumeMultiOptions ( names ) Array< {name:string,value:string} >

Remove all options which match any name in the Array of names with their values returning the list (in order) of values.

argParser . consumeOption ( name ) string

Remove the option with its value for name and return the value. This will throw a UsageError if the option is included multiple times.

-
argParser . consumeOptions ( name ) Array< string >

Remove all options with their values for name and return the list (in order) of values.

\ No newline at end of file +
argParser . consumeOptions ( name ) Array< string >

Remove all options with their values for name and return the list (in order) of values.

\ No newline at end of file diff --git a/docs/cli/typescript/index.html b/docs/cli/typescript/index.html index 288bc15e..6b67cd70 100644 --- a/docs/cli/typescript/index.html +++ b/docs/cli/typescript/index.html @@ -1,4 +1,4 @@ -TypeScript
+TypeScript

TypeScript

Help

@@ -6,4 +6,4 @@
Usage:
   ethers-ts FILENAME [ ... ] [ OPTIONS ]

OPTIONS
  --output FILENAME           Write the output to FILENAME (default: stdout)
  --force                     Overwrite files if they already exist
  --no-optimize               Do not run the solc optimizer
  --no-bytecode               Do not include bytecode and Factory methods

OTHER OPTIONS
  --debug                     Show stack traces for errors
  --help                      Show this usage and exit
  --version                   Show this version and exit

(*) By including mnemonics or private keys on the command line they are
    possibly readable by other users on your system and may get stored in
    your bash history file. This is NOT recommended.

Examples

-

TODO

\ No newline at end of file +

TODO

\ No newline at end of file diff --git a/docs/concepts/events/index.html b/docs/concepts/events/index.html index 969e9472..3c37f6a1 100644 --- a/docs/concepts/events/index.html +++ b/docs/concepts/events/index.html @@ -1,5 +1,5 @@ -Events
+Events

Events

Explain how topics and such work

Solidity Topics

-

How to compute the topic...

\ No newline at end of file +

How to compute the topic...

\ No newline at end of file diff --git a/docs/concepts/gas/index.html b/docs/concepts/gas/index.html index 5bd80445..cdb2604e 100644 --- a/docs/concepts/gas/index.html +++ b/docs/concepts/gas/index.html @@ -1,7 +1,7 @@ -Gas
+Gas

Gas

Explain attack vectors

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

-
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/concepts/index.html b/docs/concepts/index.html index 656dbe64..c13fd4b7 100644 --- a/docs/concepts/index.html +++ b/docs/concepts/index.html @@ -1,4 +1,4 @@ -Concepts
+Concepts

Concepts

This is a very breif overview of some aspects of Ethereum and blockchains which developers can make use of or should be aware of.

-
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/contributing/index.html b/docs/contributing/index.html index ce17e5ed..9d19765f 100644 --- a/docs/contributing/index.html +++ b/docs/contributing/index.html @@ -1,5 +1,5 @@ -Contributing and Hacking
+Contributing and Hacking

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

\ No newline at end of file +

use npm run auto-build

use npm run update-version

\ No newline at end of file diff --git a/docs/cookbook/index.html b/docs/cookbook/index.html index 08336b45..f7305cb5 100644 --- a/docs/cookbook/index.html +++ b/docs/cookbook/index.html @@ -1,3 +1,3 @@ -Cookbook
+Cookbook

Cookbook

-

Cooking...

\ No newline at end of file +

Cooking...

\ No newline at end of file diff --git a/docs/documentation/README.md b/docs/documentation/README.md index afd74977..3cab5eac 100644 --- a/docs/documentation/README.md +++ b/docs/documentation/README.md @@ -13,8 +13,8 @@ The *Flatworm Docs* rendering script is designed to be **very** simple, but provide enough formatting necessary for documenting JavaScript libraries. -A lot of its inspiration came from [Read the Docs](https://github.com/readthedocs/sphinx_rtd_theme) and -the [Sphinx](https://www.sphinx-doc.org/) project. +A lot of its inspiration came from [Read the Docs](../Users/ricmoo/Development/ethers/ethers.js-v5/https:/github.com/readthedocs/sphinx_rtd_theme) and +the [Sphinx](../Users/ricmoo/Development/ethers/ethers.js-v5/https:/www.sphinx-doc.org) project. Fragments @@ -266,4 +266,4 @@ This extended directive function is available for: ----- -**Content Hash:** 25456ca845a1572440a2c7a6658ef736782f92a39815df78455832aa8e13e5f4 \ No newline at end of file +**Content Hash:** 2fbf0adb4f6ef934152ddd2d9b321be74cb28610a04f34a62b6eff9cf3667993 \ No newline at end of file diff --git a/docs/documentation/index.html b/docs/documentation/index.html index aac3333a..a74946cd 100644 --- a/docs/documentation/index.html +++ b/docs/documentation/index.html @@ -1,6 +1,6 @@ -Flatworm Docs
+Flatworm Docs

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 and the Sphinx project.

+

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 and the Sphinx 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

@@ -34,4 +34,4 @@

@INHERIT<markdown>

Adds an inherits description to a directive. The markdown may contain links.

This extended directive function is available for:

  • _section
  • _subsetion
  • _heading

@SRC<text>

-

Calls the configuration getSourceUrl(text, VALUE) to get a URL which will be linked to by a link next to the directive.

This extended directive function requires an advanced config.js Configuration file since it requires a JavaScript function.

This extended directive function is available for:

  • _section
  • _subsetion
  • _heading
  • _property
\ No newline at end of file +

Calls the configuration getSourceUrl(text, VALUE) to get a URL which will be linked to by a link next to the directive.

This extended directive function requires an advanced config.js Configuration file since it requires a JavaScript function.

This extended directive function is available for:

\ No newline at end of file diff --git a/docs/getting-started/README.md b/docs/getting-started/README.md index dcd8be49..b034b407 100644 --- a/docs/getting-started/README.md +++ b/docs/getting-started/README.md @@ -15,8 +15,7 @@ Installing The various Classes and Functions are available to be imported -manually from sub-packages under the -[@ethersproject](https://www.npmjs.com/search?q=%40ethersproject%2F) +manually from sub-packages under the [@ethersproject](../Users/ricmoo/Development/ethers/ethers.js-v5/https:/www.npmjs.com/search?q=%40ethersproject%2F) but for most projects, the umbrella package is the easiest way to get started. @@ -50,8 +49,8 @@ const { ethers } = require("ethers"); It is generally better practice (for security reasons) to copy the -[ethers library](https://cdn.ethers.io/lib/ethers-5.0.esm.min.js) to -your own webserver and serve it yourself. +[ethers library](../Users/ricmoo/Development/ethers/ethers.js-v5/https:/cdn.ethers.io/lib/ethers-5.0.esm.min.js) to your own webserver and serve it +yourself. For quick demos or prototyping though, it can be loaded in your Web Applications from our CDN. @@ -66,4 +65,4 @@ Web Applications from our CDN. ----- -**Content Hash:** a78889cf0b1215b8268f76e5cef5869b2b592e56a5ce062d58dfcc4f5b93159d \ No newline at end of file +**Content Hash:** 56c46ac0fa7f1a71d4de04e0f6615f10073f21fa7a5294f71c29bbb3ee842c31 \ No newline at end of file diff --git a/docs/getting-started/index.html b/docs/getting-started/index.html index d238e4a1..2ff09ffa 100644 --- a/docs/getting-started/index.html +++ b/docs/getting-started/index.html @@ -1,4 +1,4 @@ -Getting Started
+Getting Started

Getting Started

Installing

@@ -14,4 +14,4 @@

Web Browser

It is generally better practice (for security reasons) to copy the ethers library 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.

<script src="https://cdn.ethers.io/lib/ethers-5.0.esm.min.js"
        type="application/javascipt"></script>
-
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/hacking/index.html b/docs/hacking/index.html index a4280fbf..41289e54 100644 --- a/docs/hacking/index.html +++ b/docs/hacking/index.html @@ -1,4 +1,4 @@ -Hacking
+Hacking

Hacking

Things to keep in mind:

Supported Platforms

@@ -10,4 +10,4 @@

License

MIT...

Other Considerations

-

A common argument to Pull Requests is that they are simple, backwards compatible and

It is important to remember that a small change is something that we are required to support in perpetuity.

For example, adding support for an obscure platform, such as adding a dot-file to the root of the package, now carries the implication that we will continue keeping that dot-file up-to-date as new versions of that platform are released.

\ No newline at end of file +

A common argument to Pull Requests is that they are simple, backwards compatible and

It is important to remember that a small change is something that we are required to support in perpetuity.

For example, adding support for an obscure platform, such as adding a dot-file to the root of the package, now carries the implication that we will continue keeping that dot-file up-to-date as new versions of that platform are released.

\ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 8c76243b..225673d7 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,10 +1,10 @@ -Documentation
+Documentation

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 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, INFURA, Etherscan, Nodesmith, Alchemy, or MetaMask.
  • ENS names are first-class citizens; they can be used anywhere an Ethereum addresses can be used
  • Tiny (~88kb compressed; 284kb uncompressed)
  • Complete functionality for all your Ethereum needs
  • Extensive documentation
  • 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
+
  • 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, INFURA, Etherscan, Alchemy, Cloudflare or MetaMask.
  • ENS names are first-class citizens; they can be used anywhere an Ethereum addresses can be used
  • Tiny (~88kb compressed; 284kb uncompressed)
  • Complete functionality for all your Ethereum needs
  • Extensive documentation
  • 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
Installing
Importing
Concepts
Events
Solidity Topics
Gas
Gas Price
Gas Limit
Application Programming Interface
Contracts
Buckets
Signers
Signer
Wallet
VoidSigner
ExternallyOwnedAccount
Providers
Provider
Accounts Methods
Blocks Methods
Ethereum Naming Service (ENS) Methods
Logs Methods
Network Status Methods
Transactions Methods
Event Emitter Methods
Inspection Methods
JsonRpcProvider
JsonRpcSigner
JsonRpcUncheckedSigner
API Providers
EtherscanProvider
InfuraProvider
AlchemyProvider
CloudfrontProvider
Other Providers
FallbackProvider
IpcProvider
UrlJsonRpcProvider
Web3Provider
Types
Network
Block
Events and Logs
Transactions
Utilities
Addresses
Address Formats
Functions
Application Binary Interface
Formats
Fragment
ConstructorFragment
EventFragment
FunctionFragment
ParamType
BigNumber
Types
Creating Instances
Methods
Notes
Byte Manipulation
Types
Inspection
Converting between Arrays and Hexstrings
Array Manipulation
Hexstring Manipulation
Signature Conversion
Constants
Bytes
Strings
BigNumber
Display Logic and Input
Units
Functions
FixedNumber
FixedFormat
Creating Instances
Properties
Methods
Hashing Algorithms
Cryptographic Hashing
Common Hashing Helpers
Solidity Hashing Algorithms
Strings
Bytes32String
UTF-8 Strings
UnicodeNormalizationForm
Custom UTF-8 Error Handling
Transactions
Types
Functions
Other Libraries
Hardware Wallets
LedgerSigner
Command Line Interfaces
Sandbox Utility
Help
Examples
Assembler
Help
Examples
ENS
Help
Examples
TypeScript
Help
Examples
Making Your Own
CLI
Plugin
ArgParser
Cookbook
Migration Guide
From Web3
From ethers v4
Testing
Contributing and Hacking
Building
Flatworm Docs
Fragments
Markdown
Configuration
Extended Directive Functions
License and Copyright
+
Getting Started
Installing
Importing
Concepts
Events
Solidity Topics
Gas
Gas Price
Gas Limit
Application Programming Interface
Contracts
Buckets
Signers
Signer
Wallet
VoidSigner
ExternallyOwnedAccount
Providers
Provider
Accounts Methods
Blocks Methods
Ethereum Naming Service (ENS) Methods
Logs Methods
Network Status Methods
Transactions Methods
Event Emitter Methods
Inspection Methods
JsonRpcProvider
JsonRpcSigner
JsonRpcUncheckedSigner
API Providers
EtherscanProvider
InfuraProvider
AlchemyProvider
CloudfrontProvider
Other Providers
FallbackProvider
IpcProvider
UrlJsonRpcProvider
Web3Provider
Types
Network
Block
Events and Logs
Transactions
Utilities
Application Binary Interface
Formats
Interface
Fragment
ConstructorFragment
EventFragment
FunctionFragment
ParamType
Addresses
Address Formats
Functions
BigNumber
Types
Creating Instances
Methods
Notes
Byte Manipulation
Types
Inspection
Converting between Arrays and Hexstrings
Array Manipulation
Hexstring Manipulation
Signature Conversion
Random Bytes
Constants
Bytes
Strings
BigNumber
Display Logic and Input
Units
Functions
Encoding Utilities
Base58
Base64
Recursive-Length Prefix
FixedNumber
Creating Instances
Properties
Methods
FixedFormat
Hashing Algorithms
Cryptographic Hashing
Common Hashing Helpers
Solidity Hashing Algorithms
HD Wallet
Types
HDNode
Other Functions
Logger
Errors
Creating instances
Property Utilities
Signing Key
Other Functions
Strings
Bytes32String
UTF-8 Strings
UnicodeNormalizationForm
Custom UTF-8 Error Handling
Transactions
Types
Functions
Web Utilities
Wordlists
Wordlist
Languages
Other Libraries
Assembly
Ethers ASM Dialect
Opcodes
Labels
Literals
Comments
Scopes
Data Segment
Links
Stack Placeholders
Evaluation and Excution
Utilities
Assembler
Disassembler
Opcode
Abstract Syntax Tree
Types
Nodes
Hardware Wallets
LedgerSigner
Command Line Interfaces
Sandbox Utility
Help
Examples
Assembler
Help
Example Input Files
Assembler Examples
Disassembler Examples
ENS
Help
Examples
TypeScript
Help
Examples
Making Your Own
CLI
Plugin
ArgParser
Cookbook
Migration Guide
Migration: From Web3.js
Contracts
Providers
Numbers
Utilities
Migration: From Ethers v4
BigNumber
Contracts
Errors
Interface
Utilities
Wallet
Testing
Contributing and Hacking
Building
Flatworm Docs
Fragments
Markdown
Configuration
Extended Directive Functions
License and Copyright

Legacy Documentation

-

This section will be kept up to date, linking to documentation of older versions of the library.

\ No newline at end of file +

This section will be kept up to date, linking to documentation of older versions of the library.

\ No newline at end of file diff --git a/docs/license/README.md b/docs/license/README.md index bd96b076..ca9d81dd 100644 --- a/docs/license/README.md +++ b/docs/license/README.md @@ -10,8 +10,8 @@ License and Copyright The ethers library (including all dependencies) are available -under the [MIT License](https://en.m.wikipedia.org/wiki/MIT_License), -which permits a wide variety of uses. +under the [MIT License](../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.m.wikipedia.org/wiki/MIT_License), which permits a wide variety +of uses. ### MIT License @@ -40,4 +40,4 @@ SOFTWARE. ----- -**Content Hash:** 91addf1f9680c79e0db3ee454bc36cf3ba11b14221c075f21d8faf4d94146c65 \ No newline at end of file +**Content Hash:** db370fbc48a417a5ddf3ab42646642bf6e87afc445b56a6d4b24c3b3a3c407d8 \ No newline at end of file diff --git a/docs/license/index.html b/docs/license/index.html index d620cc40..908505a0 100644 --- a/docs/license/index.html +++ b/docs/license/index.html @@ -1,5 +1,5 @@ -License and Copyright
+License and Copyright

License and Copyright

The ethers library (including all dependencies) are available under the MIT License, which permits a wide variety of uses.

MIT License

-

Copyright © 2019 Richard Moore.

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.

\ No newline at end of file +

Copyright © 2019 Richard Moore.

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.

\ No newline at end of file diff --git a/docs/migration/README.md b/docs/migration/README.md index 4983d746..f832b182 100644 --- a/docs/migration/README.md +++ b/docs/migration/README.md @@ -9,23 +9,24 @@ Migration Guide =============== -Migratimg... +Here are some migration guides when upgrading from older versions +of Ethers or other libraries. -From Web3 ---------- - - -test - - -From ethers v4 --------------- - - -test +* [Migration: From Web3.js](web3) + * [Contracts](web3) + * [Providers](web3) + * [Numbers](web3) + * [Utilities](web3) +* [Migration: From Ethers v4](ethers-v4) + * [BigNumber](ethers-v4) + * [Contracts](ethers-v4) + * [Errors](ethers-v4) + * [Interface](ethers-v4) + * [Utilities](ethers-v4) + * [Wallet](ethers-v4) ----- -**Content Hash:** dc44071344e2a1a26a1638594b7403e8ab4722d4964a8ae5b9b94411eaa36f3c \ No newline at end of file +**Content Hash:** 740fa7ef44cdf2de76bd3b7e6564144cac3e389786cc5f3c19382bbba20dc90b \ No newline at end of file diff --git a/docs/migration/ethers-v4/README.md b/docs/migration/ethers-v4/README.md new file mode 100644 index 00000000..19752c9e --- /dev/null +++ b/docs/migration/ethers-v4/README.md @@ -0,0 +1,266 @@ +----- + +Documentation: [html](https://docs-beta.ethers.io/) + +----- + + +Migration: From Ethers v4 +========================= + + + +BigNumber +--------- + + + +### Namespace + + +Since [BigNumber](../../api/utils/bignumber) is used quite frequently, it has been moved to +the top level of the umbrella package. + + +``` +// v4 +ethers.utils.BigNumber +ethers.utils.BigNumberish + +// v5 +ethers.BigNumber +ethers.BigNumberish +``` + + + +### Creating Instances + + +The `bigNumberify` method was always preferred over the constructor +since it could short-circuit an object instantiation for [[bignumber] +objects (since they are immutable). This has been moved to a static +`from` class method. + + +``` +// v4 +new ethers.utils.BigNumber(someValue) +ethers.utils.bigNumberify(someValue); + +// v5 +// - Constructor is private +// - Removed `bigNumberify` +ethers.BigNumber.from(someValue) +``` + + + +Contracts +--------- + + +``` +TODO +``` + + + +Errors +------ + + + +### Namespace + + +All errors now belong to the [Logger](../../api/utils/logger) class and the related functions +have been moved to [Logger](../../api/utils/logger) instances, which can include a per-package +version string. + +Global error fucntions have been moved [Logger](../../api/utils/logger) class methods. + + +``` +// v4 +ethers.errors.UNKNOWN_ERROR +ethers.errors.* + +errors.setCensorship(censorship, permanent) +errors.setLogLevel(logLevel) + +errors.checkArgumentCount(count, expectedCount, suffix) +errors.checkNew(self, kind) +errors.checkNormalize() +errors.throwError(message, code, params) +errors.warn(...) +errors.info(...) + +// v5 +ethers.utils.Logger.errors.UNKNOWN_ERROR +ethers.utils.Logger.errors.* + +Logger.setCensorship(censorship, permanent) +Logger.setLogLevel(logLevel) + +const logger = new ethers.utils.Logger(version); +logger.checkArgumentCount(count, expectedCount, suffix) +logger.checkNew(self, kind) +logger.checkNormalize() +logger.throwError(message, code, params) +logger.warn(...) +logger.info(...) +``` + + + +Interface +--------- + + +The [Interface](../../api/utils/abi) object has undergone the most dramatic changes. + +It is no longer a meta-class and now has methods that simplify handling +contract interface operations without the need for object inspection and +special edge cases. + + +### Functions + + +``` +// v4 (example: "transfer(address to, uint amount)") +interface.functions.transfer.encode(to, amount) +interface.functions.transfer.decode(callData) + +// v5 +interface.encodeData("transfer", [ to, amount ]) +interface.decodeResult("transfer", data) + +// Or you can use any compatible signature or Fragment objects. +// Notice that signature normalization is performed for you, +// e.g. "uint" and "uint256" will be automatically converted +interface.encodeData("transfer(address,uint)", [ to, amount ]) +interface.decodeResult("transfer(address to, uint256 amount)", data) +``` + + + +### Events + + +``` +// v4 (example: Transfer(address indexed, address indexed, uint256) +interface.events.Transfer.encodeTopics(values) +interface.events.Transfer.decode(data, topics) + +// v5 +interface.encodeFilterTopics("Transfer", values) +interface.encodeEventLog("Transfer", data, topics) +``` + + + +### Inspection + + +Interrogating properties about a function or event can now (mostly) be +done directly on the [Fragment](../../api/utils/abi) object. + + +``` +// v4 +interface.functions.transfer.name +interface.functions.transfer.inputs +interface.functions.transfer.outputs +interface.functions.transfer.payable +interface.functions.transfer.gas + +// v5 +const functionFragment = interface.getFunction("transfer") +functionFragment.name +functionFragment.inputs +functionFragment.outputs +functionFragment.payable +functionFragment.gas + + +// v4; type is "call" or "transaction" +interface.functions.transfer.type + +// v5; constant is true (i.e. "call") or false (i.e. "transaction") +functionFragment.constant + + +// v4 +interface.events.Transfer.anonymous +interface.events.Transfer.inputs +interface.events.Transfer.name + +// v5 +const eventFragment = interface.getEvent("Transfer"); +eventFragment.anonymous +eventFragment.inputs +eventFragment.name + + +// v4 +const functionSig = interface.functions.transfer.signature +const sighash = interface.functions.transfer.sighash + +const eventSig = interface.events.Transfer.signature +const topic = interface.events.Transfer.topic + +// v5 +const functionSig = functionFragment.format() +const sighash = interface.getSighash(functionFragment) + +const eventSig = eventFragment.format() +const topic = interface.getTopic(eventFragment) +``` + + + +Utilities +--------- + + + +### Renaming + + +``` +TODO +``` + + + +Wallet +------ + + + +### Mnemonic Phrases + + +The **mnemonic** phrase and related properties have been merged into +a single `mnemonic` object, which also now includes the `locale`. + + +``` +// v4 +wallet.mnemonic +wallet.path + +// v5 +// - Mnemonic phrase and path are a Mnemonic object +// - Note: wallet.mnemonic is null if there is no mnemonic +wallet.mnemonic.phrase +wallet.mnemonic.path +``` + + + + +----- +**Content Hash:** 575f41bfdadff38c736a0bb8d7cad7f9f605f3d2667264dea0ce40a904acb479 \ No newline at end of file diff --git a/docs/migration/ethers-v4/index.html b/docs/migration/ethers-v4/index.html new file mode 100644 index 00000000..e4f8bc5f --- /dev/null +++ b/docs/migration/ethers-v4/index.html @@ -0,0 +1,45 @@ +ethers v4 to v5
+

Migration: From Ethers v4

+ +

BigNumber

+ +

Namespace

+

Since BigNumber is used quite frequently, it has been moved to the top level of the umbrella package.

+
// v4
ethers.utils.BigNumber
ethers.utils.BigNumberish

// v5
ethers.BigNumber
ethers.BigNumberish
+ +

Creating Instances

+

The bigNumberify method was always preferred over the constructor since it could short-circuit an object instantiation for [[bignumber] objects (since they are immutable). This has been moved to a static from class method.

+
// v4
new ethers.utils.BigNumber(someValue)
ethers.utils.bigNumberify(someValue);

// v5
// - Constructor is private
// - Removed `bigNumberify`
ethers.BigNumber.from(someValue)
+ +

Contracts

+
TODO
+ +

Errors

+ +

Namespace

+

All errors now belong to the Logger class and the related functions have been moved to Logger instances, which can include a per-package version string.

Global error fucntions have been moved Logger class methods.

+
// v4
ethers.errors.UNKNOWN_ERROR
ethers.errors.*

errors.setCensorship(censorship, permanent)
errors.setLogLevel(logLevel)

errors.checkArgumentCount(count, expectedCount, suffix)
errors.checkNew(self, kind)
errors.checkNormalize()
errors.throwError(message, code, params)
errors.warn(...)
errors.info(...)

// v5
ethers.utils.Logger.errors.UNKNOWN_ERROR
ethers.utils.Logger.errors.*

Logger.setCensorship(censorship, permanent)
Logger.setLogLevel(logLevel)

const logger = new ethers.utils.Logger(version);
logger.checkArgumentCount(count, expectedCount, suffix)
logger.checkNew(self, kind)
logger.checkNormalize()
logger.throwError(message, code, params)
logger.warn(...)
logger.info(...)
+ +

Interface

+

The Interface object has undergone the most dramatic changes.

It is no longer a meta-class and now has methods that simplify handling contract interface operations without the need for object inspection and special edge cases.

+

Functions

+
// v4 (example: "transfer(address to, uint amount)")
interface.functions.transfer.encode(to, amount)
interface.functions.transfer.decode(callData)

// v5
interface.encodeData("transfer", [ to, amount ])
interface.decodeResult("transfer", data)

// Or you can use any compatible signature or Fragment objects.
// Notice that signature normalization is performed for you,
// e.g. "uint" and "uint256" will be automatically converted
interface.encodeData("transfer(address,uint)", [ to, amount ])
interface.decodeResult("transfer(address to, uint256 amount)", data)
+ +

Events

+
// v4 (example: Transfer(address indexed, address indexed, uint256)
interface.events.Transfer.encodeTopics(values)
interface.events.Transfer.decode(data, topics)

// v5
interface.encodeFilterTopics("Transfer", values)
interface.encodeEventLog("Transfer", data, topics)
+ +

Inspection

+

Interrogating properties about a function or event can now (mostly) be done directly on the Fragment object.

+
// v4
interface.functions.transfer.name
interface.functions.transfer.inputs
interface.functions.transfer.outputs
interface.functions.transfer.payable
interface.functions.transfer.gas

// v5
const functionFragment = interface.getFunction("transfer")
functionFragment.name
functionFragment.inputs
functionFragment.outputs
functionFragment.payable
functionFragment.gas


// v4; type is "call" or "transaction"
interface.functions.transfer.type

// v5; constant is true (i.e. "call") or false (i.e. "transaction")
functionFragment.constant


// v4
interface.events.Transfer.anonymous
interface.events.Transfer.inputs
interface.events.Transfer.name

// v5
const eventFragment = interface.getEvent("Transfer");
eventFragment.anonymous
eventFragment.inputs
eventFragment.name


// v4
const functionSig = interface.functions.transfer.signature
const sighash = interface.functions.transfer.sighash

const eventSig = interface.events.Transfer.signature
const topic = interface.events.Transfer.topic

// v5
const functionSig = functionFragment.format()
const sighash = interface.getSighash(functionFragment)

const eventSig = eventFragment.format()
const topic = interface.getTopic(eventFragment)
+ +

Utilities

+ +

Renaming

+
TODO
+ +

Wallet

+ +

Mnemonic Phrases

+

The mnemonic phrase and related properties have been merged into a single mnemonic object, which also now includes the locale.

+
// v4
wallet.mnemonic
wallet.path

// v5
// - Mnemonic phrase and path are a Mnemonic object
// - Note: wallet.mnemonic is null if there is no mnemonic
wallet.mnemonic.phrase
wallet.mnemonic.path
+
\ No newline at end of file diff --git a/docs/migration/index.html b/docs/migration/index.html index 59d07f21..43bc25a0 100644 --- a/docs/migration/index.html +++ b/docs/migration/index.html @@ -1,7 +1,4 @@ -Migration Guide
+Migration Guide

Migration Guide

-

Migratimg...

-

From Web3

-

test

-

From ethers v4

-

test

\ No newline at end of file +

Here are some migration guides when upgrading from older versions of Ethers or other libraries.

+
\ No newline at end of file diff --git a/docs/migration/web3/README.md b/docs/migration/web3/README.md new file mode 100644 index 00000000..2b384311 --- /dev/null +++ b/docs/migration/web3/README.md @@ -0,0 +1,37 @@ +----- + +Documentation: [html](https://docs-beta.ethers.io/) + +----- + + +Migration: From Web3.js +======================= + + +TODO + + +Contracts +--------- + + + +Providers +--------- + + + +Numbers +------- + + + +Utilities +--------- + + + + +----- +**Content Hash:** b33d91f3f6d1d4bde7cb12ec26a2fb0adbf37ef5ee5ff2f95894a62f3d108e14 \ No newline at end of file diff --git a/docs/migration/web3/index.html b/docs/migration/web3/index.html new file mode 100644 index 00000000..4c83ba47 --- /dev/null +++ b/docs/migration/web3/index.html @@ -0,0 +1,11 @@ +Migration: From Web3.js
+

Migration: From Web3.js

+

TODO

+

Contracts

+ +

Providers

+ +

Numbers

+ +

Utilities

+
\ No newline at end of file diff --git a/docs/testing/index.html b/docs/testing/index.html index d3743ac4..bd5865f1 100644 --- a/docs/testing/index.html +++ b/docs/testing/index.html @@ -1,3 +1,3 @@ -Testing
+Testing

Testing

-

Here goes info about testing

\ No newline at end of file +

Here goes info about testing

\ No newline at end of file