docs: commit built docs

This commit is contained in:
Richard Moore 2021-02-08 15:26:10 -05:00
parent 80cde06bcc
commit 5b41675f33
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651
98 changed files with 1773 additions and 648 deletions

@ -0,0 +1 @@
index.html => /v5/api-keys

@ -0,0 +1,9 @@
server-error => /v5/api/utils/logger/#errors--server-error
unsupported-operation => /v5/api/utils/logger/#errors--unsupported-operation
numeric-fault => /v5/api/utils/logger/#errors--numeric-fault
call-exception => /v5/api/utils/logger/#errors--numeric-fault
insufficient-funds => /v5/api/utils/logger/#errors--insufficient-funds
nonce-expired => /v5/api/utils/logger/#errors--nonce-expired
replacement-underpriced => /v5/api/utils/logger/#errors--replacement-underpriced
unpredicatable-gas-limit => /v5/api/utils/logger/#errors--unpredicatable-gas-limit

BIN
docs/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

@ -26,8 +26,8 @@ Developer Documentation
* [Signing Messages](getting-started) * [Signing Messages](getting-started)
* [Ethereum Basics](concepts) * [Ethereum Basics](concepts)
* [Events](concepts/events) * [Events](concepts/events)
* [Solidity Topics](concepts/events)
* [Logs and Filtering](concepts/events) * [Logs and Filtering](concepts/events)
* [Solidity Topics](concepts/events)
* [Gas](concepts/gas) * [Gas](concepts/gas)
* [Gas Price](concepts/gas) * [Gas Price](concepts/gas)
* [Gas Limit](concepts/gas) * [Gas Limit](concepts/gas)
@ -47,6 +47,7 @@ Developer Documentation
* [Accounts Methods](api/providers/provider) * [Accounts Methods](api/providers/provider)
* [Blocks Methods](api/providers/provider) * [Blocks Methods](api/providers/provider)
* [Ethereum Naming Service (ENS) Methods](api/providers/provider) * [Ethereum Naming Service (ENS) Methods](api/providers/provider)
* [EnsResolver](api/providers/provider)
* [Logs Methods](api/providers/provider) * [Logs Methods](api/providers/provider)
* [Network Status Methods](api/providers/provider) * [Network Status Methods](api/providers/provider)
* [Transactions Methods](api/providers/provider) * [Transactions Methods](api/providers/provider)
@ -253,8 +254,10 @@ Developer Documentation
* [Schemas](testing) * [Schemas](testing)
* [Contributing and Hacking](contributing) * [Contributing and Hacking](contributing)
* [Building](contributing) * [Building](contributing)
* [Making your changes](contributing)
* [Documentation](contributing) * [Documentation](contributing)
* [Other Resources](other-resources)
* [Ethereum Overview](other-resources)
* [Tutorials](other-resources)
* [Flatworm Docs](documentation) * [Flatworm Docs](documentation)
* [Fragments](documentation) * [Fragments](documentation)
* [Markdown](documentation) * [Markdown](documentation)

File diff suppressed because one or more lines are too long

@ -12,6 +12,7 @@ Application Programming Interface
* [Accounts Methods](providers/provider) * [Accounts Methods](providers/provider)
* [Blocks Methods](providers/provider) * [Blocks Methods](providers/provider)
* [Ethereum Naming Service (ENS) Methods](providers/provider) * [Ethereum Naming Service (ENS) Methods](providers/provider)
* [EnsResolver](providers/provider)
* [Logs Methods](providers/provider) * [Logs Methods](providers/provider)
* [Network Status Methods](providers/provider) * [Network Status Methods](providers/provider)
* [Transactions Methods](providers/provider) * [Transactions Methods](providers/provider)

@ -12,14 +12,17 @@ Creating Instances
#### **new ***ethers* . **ContractFactory**( interface , bytecode [ , signer ] ) #### **new ***ethers* . **ContractFactory**( interface , bytecode [ , signer ] )
Creates a new instance of a **ContractFactory** for the contract described by the *interface* and *bytecode* initcode.
#### *ContractFactory* . **fromSolidity**( compilerOutput [ , signer ] ) => *[ContractFactory](/v5/api/contract/contract-factory/)* #### *ContractFactory* . **fromSolidity**( compilerOutput [ , signer ] ) => *[ContractFactory](/v5/api/contract/contract-factory/)*
Consumes the output of the Solidity compiler, extracting the ABI and bytecode from it, allowing for the various formats the solc compiler has emitted over its life.
#### *contractFactory* . **connect**( signer ) => *[Contract](/v5/api/contract/contract/)* #### *contractFactory* . **connect**( signer ) => *[Contract](/v5/api/contract/contract/)*
Returns a **new instance** of the ContractFactory with the same *interface* and *bytecode*, but with a different *signer*.
Properties Properties
@ -27,14 +30,17 @@ Properties
#### *contractFactory* . **interface** => *[Interface](/v5/api/utils/abi/interface/)* #### *contractFactory* . **interface** => *[Interface](/v5/api/utils/abi/interface/)*
The [Contract](/v5/api/contract/contract/) interface.
#### *contractFactory* . **bytecode** => *string< [DataHexString](/v5/api/utils/bytes/#DataHexString) >* #### *contractFactory* . **bytecode** => *string< [DataHexString](/v5/api/utils/bytes/#DataHexString) >*
The bytecode (i.e. initcode) that this **ContractFactory** will use to deploy the Contract.
#### *contractFactory* . **signer** => *[Signer](/v5/api/signer/#Signer)* #### *contractFactory* . **signer** => *[Signer](/v5/api/signer/#Signer)*
The [Signer](/v5/api/signer/#Signer) (if any) this ContractFactory will use to deploy instances of the Contract to the Blockchain.
Methods Methods
@ -45,49 +51,87 @@ Methods
Return an instance of a [Contract](/v5/api/contract/contract/) attached to *address*. This is the same as using the [Contract constructor](/v5/api/contract/contract/#Contract--creating) with *address* and this the *interface* and *signerOrProvider* passed in when creating the ContractFactory. Return an instance of a [Contract](/v5/api/contract/contract/) attached to *address*. This is the same as using the [Contract constructor](/v5/api/contract/contract/#Contract--creating) with *address* and this the *interface* and *signerOrProvider* passed in when creating the ContractFactory.
#### *contractFactory* . **getDeployTransaction**( ...args ) => *[UnsignedTransaction](/v5/api/utils/transactions/#UnsignedTransaction)* #### *contractFactory* . **getDeployTransaction**( ...args [ , overrides ] ) => *[UnsignedTransaction](/v5/api/utils/transactions/#UnsignedTransaction)*
Returns the unsigned transaction which would deploy this Contract with *args* passed to the Contract's constructor. Returns the unsigned transaction which would deploy this Contract with *args* passed to the Contract's constructor.
If the optional *overrides* is specified, they can be used to override the endowment `value`, transaction `nonce`, `gasLimit` or `gasPrice`.
#### *contractFactory* . **deploy**( ...args ) => *Promise< [Contract](/v5/api/contract/contract/) >*
#### *contractFactory* . **deploy**( ...args [ , overrides ] ) => *Promise< [Contract](/v5/api/contract/contract/) >*
Uses the signer to deploy the Contract with *args* passed into the constructor and returns a Contract which is attached to the address where this contract **will** be deployed once the transaction is mined. Uses the signer to deploy the Contract with *args* passed into the constructor and returns a Contract which is attached to the address where this contract **will** be deployed once the transaction is mined.
The transaction can be found at `contract.deployTransaction`, and no interactions should be made until the transaction is mined. The transaction can be found at `contract.deployTransaction`, and no interactions should be made until the transaction is mined.
If the optional *overrides* is specified, they can be used to override the endowment `value`, transaction `nonce`, `gasLimit` or `gasPrice`.
```
// <hide>
const signer = ethers.LocalSigner();
const ContractFactory = ethers.ContractFactory;
// </hide>
```javascript
// If your contract constructor requires parameters, the ABI // If your contract constructor requires parameters, the ABI
// must include the constructor // must include the constructor
const abi = [ const abi = [
"constructor(address owner, uint256 initialValue)" "constructor(address owner, uint256 initialValue)",
"function value() view returns (uint)"
]; ];
const factory = new ContractFactory(abi, bytecode, signer) // The factory we use for deploying contracts
factory = new ContractFactory(abi, bytecode, signer)
const contract = await factory.deploy("ricmoo.eth", 42); // Deploy an instance of the contract
contract = await factory.deploy("ricmoo.eth", 42);
// The address is available immediately, but the contract // The address is available immediately, but the contract
// is NOT deployed yet // is NOT deployed yet
contract.address contract.address
//! // '0x26E9685C018Bf3A401DFA632827e7e6C7D96b1C0'
// The transaction that the signer sent to deploy // The transaction that the signer sent to deploy
contract.deployTransaction contract.deployTransaction
//! // {
// blockHash: null,
// blockNumber: null,
// chainId: 1337,
// confirmations: 0,
// creates: '0x26E9685C018Bf3A401DFA632827e7e6C7D96b1C0',
// data: '0x608060405234801561001057600080fd5b5060405161012e38038061012e8339818101604052604081101561003357600080fd5b81019080805190602001909291908051906020019092919050505081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508060008190555050506088806100a66000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80633fa4f24514602d575b600080fd5b60336049565b6040518082815260200191505060405180910390f35b6000805490509056fea2646970667358221220926465385af0e8706644e1ff3db7161af699dc063beaadd55405f2ccd6478d7564736f6c63430007040033000000000000000000000000ab7c8803962c0f2f5bbbe3fa8bf41cd82aa1923c000000000000000000000000000000000000000000000000000000000000002a',
// from: '0xf3e6942b256A60B596B24F633caE8aDB4983fCA6',
// gasLimit: { BigNumber: "126462" },
// gasPrice: { BigNumber: "1" },
// hash: '0x4037630fdadbbe0aac0bf90eba61118e35ee5fc28329e2134bb2bad0bfc12684',
// nonce: 1,
// r: '0xc3bb79ea4600864cd110fe74d31d38bb3702c327fd5aef9feddf66903cc87a4f',
// s: '0x35cc2ffe352c02b5fcfbbcd2e348001af670f64438d7a9b2c34756ec293a0784',
// to: null,
// transactionIndex: null,
// v: 2709,
// value: { BigNumber: "0" },
// wait: [Function]
// }
// Wait until the transaction is mined // Wait until the transaction is mined (i.e. contract is deployed)
// - returns the receipt
// - throws on failure (the reciept is on the error)
contract.deployTransaction.wait() contract.deployTransaction.wait()
//! // { Promise: {
// blockHash: '0x1715de2bdfec15a7f64fb79a8254699274be6776df244d24a04945a3218543e6',
// blockNumber: 2,
// byzantium: true,
// confirmations: 1,
// contractAddress: '0x26E9685C018Bf3A401DFA632827e7e6C7D96b1C0',
// cumulativeGasUsed: { BigNumber: "126462" },
// from: '0xf3e6942b256A60B596B24F633caE8aDB4983fCA6',
// gasUsed: { BigNumber: "126462" },
// logs: [],
// logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
// status: 1,
// to: null,
// transactionHash: '0x4037630fdadbbe0aac0bf90eba61118e35ee5fc28329e2134bb2bad0bfc12684',
// transactionIndex: 0
// } }
// Now the contract is safe to interact with // Now the contract is safe to interact with
contract.value() contract.value()
//! // { Promise: { BigNumber: "42" } }
``` ```

File diff suppressed because one or more lines are too long

@ -117,7 +117,7 @@ Meta-Class
#### *contract* . **METHOD_NAME**( ...args [ , overrides ] ) => *Promise< any >* #### *contract* . **METHOD_NAME**( ...args [ , overrides ] ) => *Promise< any >*
The type of the result depends on the ABI. The type of the result depends on the ABI. If the method returns a single value, it will be returned directly, otherwise a [Result](/v5/api/utils/abi/interface/#Result) object will be returned with each parameter available positionally and if the parameter is named, it will also be available by its name.
For values that have a simple meaning in JavaScript, the types are fairly straight forward; strings and booleans are returned as JavaScript strings and booleans. For values that have a simple meaning in JavaScript, the types are fairly straight forward; strings and booleans are returned as JavaScript strings and booleans.
@ -125,6 +125,16 @@ For numbers, if the **type** is in the JavaScript safe range (i.e. less than 53
For bytes (both fixed length and dynamic), a [DataHexString](/v5/api/utils/bytes/#DataHexString) is returned. For bytes (both fixed length and dynamic), a [DataHexString](/v5/api/utils/bytes/#DataHexString) is returned.
The *overrides* object for a read-only method may include any of:
- `overrides.from` - the `msg.sender` (or `CALLER`) to use during the execution of the code
- `overrides.value` - the `msg.value` (or `CALLVALUE`) to use during the exectuiont of the code
- `overrides.gasPrice` - the price to pay per gas (theoretically); since there is no transaction, there is not going to be any fee charged, but the EVM still requires a value to report to `tx.gasprice` (or `GASPRICE`); *most developers will not require this*
- `overrides.gasLimit` - the amount of gas (theoretically) to allow a node to use during the execution of the code; since there is no transaction, there is not going to be any fee charged, but the EVM still processes gas metering so calls like `gasleft` (or `GAS`) report meaningful values
- `overrides.blockTag` - a block tag to simulate the execution at, which can be used for hypothetical historic analysis; note that many backends do not support this, or may require paid plans to access as the node database storage and processing requirements are much higher
#### *contract* . *functions* . **METHOD_NAME**( ...args [ , overrides ] ) => *Promise< [Result](/v5/api/utils/abi/interface/#Result) >* #### *contract* . *functions* . **METHOD_NAME**( ...args [ , overrides ] ) => *Promise< [Result](/v5/api/utils/abi/interface/#Result) >*
@ -136,6 +146,8 @@ Another use for this method is for error recovery. For example, if a function re
Most developers should not require this. Most developers should not require this.
The *overrides* are identical to the read-only operations above.
### Write Methods (non-constant) ### Write Methods (non-constant)
@ -143,6 +155,29 @@ Most developers should not require this.
Returns a [TransactionResponse](/v5/api/providers/types/#providers-TransactionResponse) for the transaction after it is sent to the network. This requires the **Contract** has a signer. Returns a [TransactionResponse](/v5/api/providers/types/#providers-TransactionResponse) for the transaction after it is sent to the network. This requires the **Contract** has a signer.
The *overrides* object for write methods may include any of:
- `overrides.gasPrice` - the price to pay per gas
- `overrides.gasLimit` - the limit on the amount of gas to allow the transaction to consume; any unused gas is returned at the gasPrice
- `overrides.value` - the amount of ether (in wei) to forward with the call
- `overrides.nonce` - the nonce to use for the [Signer](/v5/api/signer/#Signer)
If the `wait()` method on the returned [TransactionResponse](/v5/api/providers/types/#providers-TransactionResponse) is called, there will be additional properties on the receipt:
- `receipt.events` - an array of the logs, with additional properties (if the ABI included a description for the events)
- `receipt.events[n].args` - the parsed arguments
- `receipt.events[n].decode` - a method that can be used to parse the log topics and data (this was used to compute `args`)
- `receipt.events[n].event` - the name of the event
- `receipt.events[n].eventSignature` - the full signature of the event
- `receipt.removeListener()` - a method to remove the listener that trigger this event
- `receipt.getBlock()` - a method to return the [Block](/v5/api/providers/types/#providers-Block) this event occurred in
- `receipt.getTransaction()` - a method to return the [Transaction](/v5/api/providers/types/#providers-TransactionResponse) this event occurred in
- `receipt.getTransactionReceipt()` - a method to return the [Transaction Receipt](/v5/api/providers/types/#providers-TransactionReceipt) this event occurred in
### Write Methods Analysis ### Write Methods Analysis
@ -150,11 +185,15 @@ Returns a [TransactionResponse](/v5/api/providers/types/#providers-TransactionRe
Returns the estimate units of gas that would be required to execute the *METHOD_NAME* with *args* and *overrides*. Returns the estimate units of gas that would be required to execute the *METHOD_NAME* with *args* and *overrides*.
The *overrides* are identical to the overrides above for read-only or write methods, depending on the type of call of *METHOD_NAME*.
#### *contract* . *populateTransaction* . **METHOD_NAME**( ...args [ , overrides ] ) => *Promise< [UnsignedTx](/v5/api/utils/transactions/#UnsignedTransaction) >* #### *contract* . *populateTransaction* . **METHOD_NAME**( ...args [ , overrides ] ) => *Promise< [UnsignedTx](/v5/api/utils/transactions/#UnsignedTransaction) >*
Returns an [UnsignedTransaction](/v5/api/utils/transactions/#UnsignedTransaction) which represents the transaction that would need to be signed and submitted to the network to execute *METHOD_NAME* with *args* and *overrides*. Returns an [UnsignedTransaction](/v5/api/utils/transactions/#UnsignedTransaction) which represents the transaction that would need to be signed and submitted to the network to execute *METHOD_NAME* with *args* and *overrides*.
The *overrides* are identical to the overrides above for read-only or write methods, depending on the type of call of *METHOD_NAME*.
#### *contract* . *callStatic* . **METHOD_NAME**( ...args [ , overrides ] ) => *Promise< any >* #### *contract* . *callStatic* . **METHOD_NAME**( ...args [ , overrides ] ) => *Promise< any >*
@ -164,6 +203,8 @@ This does not actually change any state, but is free. This in some cases can be
This otherwise functions the same as a [Read-Only Method](/v5/api/contract/contract/#Contract--readonly). This otherwise functions the same as a [Read-Only Method](/v5/api/contract/contract/#Contract--readonly).
The *overrides* are identical to the read-only operations above.
### Event Filters ### Event Filters

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -48,7 +48,7 @@ Set the current transaction count (nonce) for the signer.
This may be useful in interacting with the signer outside of using this class. This may be useful in interacting with the signer outside of using this class.
#### *nonceManager* . **increaseTransactionCount**( [ count = 1 ] ) => *void* #### *nonceManager* . **incrementTransactionCount**( [ count = 1 ] ) => *void*
Bump the current transaction count (nonce) by *count*. Bump the current transaction count (nonce) by *count*.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -54,6 +54,7 @@ Provider Documentation
* [Accounts Methods](provider) * [Accounts Methods](provider)
* [Blocks Methods](provider) * [Blocks Methods](provider)
* [Ethereum Naming Service (ENS) Methods](provider) * [Ethereum Naming Service (ENS) Methods](provider)
* [EnsResolver](provider)
* [Logs Methods](provider) * [Logs Methods](provider)
* [Network Status Methods](provider) * [Network Status Methods](provider)
* [Transactions Methods](provider) * [Transactions Methods](provider)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -7,9 +7,11 @@ Documentation: [html](https://docs.ethers.io/)
JsonRpcProvider JsonRpcProvider
=============== ===============
#### **new ***ethers* . *providers* . **JsonRpcProvider**( [ url [ , aNetworkish ] ] ) #### **new ***ethers* . *providers* . **JsonRpcProvider**( [ urlOrConnectionInfo [ , networkish ] ] )
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. Connect to a JSON-RPC HTTP API using the URL or [ConnectionInfo](/v5/api/utils/web/#ConnectionInfo) *urlOrConnectionInfo* connected to the *networkish* network.
If *urlOrConnectionInfo* 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 using `eth_chaindId` and falling back on `eth_networkId`.
#### Note: Connecting to a Local Node #### Note: Connecting to a Local Node

File diff suppressed because one or more lines are too long

@ -36,7 +36,7 @@ The provider for this configuration.
#### *fallbackProviderConfig* . **priority** => *number* #### *fallbackProviderConfig* . **priority** => *number*
The priority used for the provider. Higher priorities are favoured over lower priorities. If multiple providers share the same priority, they are chosen at random. The priority used for the provider. Lower-value priorities are favoured over higher-value priorities. If multiple providers share the same priority, they are chosen at random.
#### *fallbackProviderConfig* . **stallTimeout** => *number* #### *fallbackProviderConfig* . **stallTimeout** => *number*
@ -123,7 +123,7 @@ This is identical to `sendAsync`. Historically, this used a synchronous web requ
WebSocketProvider WebSocketProvider
----------------- -----------------
#### **new ***ethers* . *provider* . **WebSocketProvider**( [ url [ , network ] ] ) #### **new ***ethers* . *providers* . **WebSocketProvider**( [ url [ , network ] ] )
Returns a new [WebSocketProvider](/v5/api/providers/other/#WebSocketProvider) connected to *url* as the *network*. Returns a new [WebSocketProvider](/v5/api/providers/other/#WebSocketProvider) connected to *url* as the *network*.

File diff suppressed because one or more lines are too long

@ -7,6 +7,15 @@ Documentation: [html](https://docs.ethers.io/)
Provider Provider
======== ========
#### Coming from Web3.js?
If you are coming from Web3.js, this is one of the biggest differences you will encounter using ethers.
The ethers library creates a strong division between the operation a **Provider** can perform and those of a [Signer](/v5/api/signer/#Signer), which Web3.js lumps together.
This separation of concerns and a stricted subset of Provider operations allows for a larger variety of backends, a more consistent API and ensures other libraries to operate without being able to rely on any underlying assumption.
Accounts Methods Accounts Methods
---------------- ----------------
@ -33,7 +42,7 @@ Returns the number of transactions *address* has ever **sent**, as of *blockTag*
```javascript ```javascript
// Get the balance for an account... // Get the balance for an account...
provider.getBalance("ricmoo.firefly.eth"); provider.getBalance("ricmoo.firefly.eth");
// { Promise: { BigNumber: "284831012276355695" } } // { Promise: { BigNumber: "25334210474552466902" } }
// Get the code for a contract... // Get the code for a contract...
provider.getCode("registrar.firefly.eth"); provider.getCode("registrar.firefly.eth");
@ -45,7 +54,7 @@ provider.getStorageAt("registrar.firefly.eth", 0)
// Get transaction count of an account... // Get transaction count of an account...
provider.getTransactionCount("ricmoo.firefly.eth"); provider.getTransactionCount("ricmoo.firefly.eth");
// { Promise: 689 } // { Promise: 712 }
``` ```
Blocks Methods Blocks Methods
@ -96,7 +105,7 @@ provider.getBlockWithTransactions(100004)
// blockHash: '0xf93283571ae16dcecbe1816adc126954a739350cd1523a1559eabeae155fbb63', // blockHash: '0xf93283571ae16dcecbe1816adc126954a739350cd1523a1559eabeae155fbb63',
// blockNumber: 100004, // blockNumber: 100004,
// chainId: 0, // chainId: 0,
// confirmations: 11212224, // confirmations: 11717911,
// creates: null, // creates: null,
// data: '0x', // data: '0x',
// from: '0xcf00A85f3826941e7A25BFcF9Aac575d40410852', // from: '0xcf00A85f3826941e7A25BFcF9Aac575d40410852',
@ -118,6 +127,11 @@ provider.getBlockWithTransactions(100004)
Ethereum Naming Service (ENS) Methods Ethereum Naming Service (ENS) Methods
------------------------------------- -------------------------------------
#### *provider* . **getResolver**( name ) => *Promise< [EnsResolver](/v5/api/providers/provider/#EnsResolver) >*
Returns an EnsResolver instance which can be used to further inquire about specific entries for an ENS name.
#### *provider* . **lookupAddress**( address ) => *Promise< string >* #### *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. 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.
@ -138,6 +152,34 @@ provider.resolveName("ricmoo.firefly.eth");
// { Promise: '0x8ba1f109551bD432803012645Ac136ddd64DBA72' } // { Promise: '0x8ba1f109551bD432803012645Ac136ddd64DBA72' }
``` ```
EnsResolver
-----------
#### *resolver* . **name** => *string*
The name of this resolver.
#### *resolver* . **address** => *string< [Address](/v5/api/utils/address/#address) >*
The address of the Resolver.
#### *resolver* . **getAddress**( [ cointType = 60 ] ) => *Promise< string >*
Returns a Promise which resolves to the [EIP-2304](https://eips.ethereum.org/EIPS/eip-2304) multicoin address stored for the *coinType*. By default an Ethereum [Address](/v5/api/utils/address/#address) (`coinType = 60`) will be returned.
#### *resolver* . **getContentHash**( ) => *Promise< string >*
Returns a Promise which resolves to any stored [EIP-1577](https://eips.ethereum.org/EIPS/eip-1577) content hash.
#### *resolver* . **getText**( key ) => *Promise< string >*
Returns a Promise which resolves to any stored [EIP-634](https://eips.ethereum.org/EIPS/eip-634) text entry for *key*.
Logs Methods Logs Methods
------------ ------------
@ -166,6 +208,13 @@ Returns the block number (or height) of the most recently mined block.
Returns a *best guess* of the [Gas Price](/v5/concepts/gas/#gas-price) to use in a transaction. Returns a *best guess* of the [Gas Price](/v5/concepts/gas/#gas-price) to use in a transaction.
#### *provider* . **ready** => *Promise< [Network](/v5/api/providers/types/#providers-Network) >*
Returns a Promise which will stall until the network has heen established, ignoring errors due to the target node not being active yet.
This can be used for testing or attaching scripts to wait until the node is up and running smoothly.
```javascript ```javascript
// The network information // The network information
provider.getNetwork() provider.getNetwork()
@ -177,16 +226,16 @@ provider.getNetwork()
// The current block number // The current block number
provider.getBlockNumber() provider.getBlockNumber()
// { Promise: 11312227 } // { Promise: 11817914 }
// Get the current suggested gas price (in wei)... // Get the current suggested gas price (in wei)...
gasPrice = await provider.getGasPrice() gasPrice = await provider.getGasPrice()
// { BigNumber: "46200000000" } // { BigNumber: "207000000000" }
// ...often this gas price is easier to understand or // ...often this gas price is easier to understand or
// display to the user in gwei (giga-wei, or 1e9 wei) // display to the user in gwei (giga-wei, or 1e9 wei)
utils.formatUnits(gasPrice, "gwei") utils.formatUnits(gasPrice, "gwei")
// '46.2' // '207.0'
``` ```
Transactions Methods Transactions Methods
@ -204,6 +253,20 @@ Returns an estimate of the amount of gas that would be required to submit *trans
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. 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* . **getTransaction**( hash ) => *Promise< [TransactionResponse](/v5/api/providers/types/#providers-TransactionResponse) >*
Returns the transaction with *hash* or null if the transaction is unknown.
If a transaction has not been mined, this method will search the transaction pool. Various backends may have more restrictive transaction pool access (e.g. if the gas price is too low or the transaction was only recently sent and not yet indexed) in which case this method may also return null.
#### *provider* . **getTransactionReceipt**( hash ) => *Promise< [TransactionReceipt](/v5/api/providers/types/#providers-TransactionReceipt) >*
Returns the transaction receipt for *hash* or null if the transaction has not been mined.
To stall until the transaction has been mined, consider the `waitForTransaction` method below.
#### *provider* . **sendTransaction**( transaction ) => *Promise< [TransactionResponse](/v5/api/providers/types/#providers-TransactionResponse) >* #### *provider* . **sendTransaction**( transaction ) => *Promise< [TransactionResponse](/v5/api/providers/types/#providers-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). 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).
@ -213,43 +276,45 @@ Submits *transaction* to the network to be mined. The *transaction* **must** be
Returns a Promise which will not resolve until *transactionHash* is mined. Returns a Promise which will not resolve until *transactionHash* is mined.
If *confirms* is 0, this method is non-blocking and if the transaction has not been mined returns null. Otherwise, this method will block until the transaction has *confirms* blocks mined on top of the block in which is was mined.
Event Emitter Methods Event Emitter Methods
--------------------- ---------------------
#### *provider* . **on**( eventName , listener ) => *this* #### *provider* . **on**( eventName , listener ) => *this*
Add a *listener* to be triggered for each *eventName*. Add a *listener* to be triggered for each *eventName* [event](/v5/api/providers/provider/#Provider--events).
#### *provider* . **once**( eventName , listener ) => *this* #### *provider* . **once**( eventName , listener ) => *this*
Add a *listener* to be triggered for only the next *eventName*, at which time it will be removed. Add a *listener* to be triggered for only the next *eventName* [event](/v5/api/providers/provider/#Provider--events), at which time it will be removed.
#### *provider* . **emit**( eventName , ...args ) => *boolean* #### *provider* . **emit**( eventName , ...args ) => *boolean*
Notify all listeners of *eventName*, passing *args* to each listener. This is generally only used internally. Notify all listeners of the *eventName* [event](/v5/api/providers/provider/#Provider--events), passing *args* to each listener. This is generally only used internally.
#### *provider* . **off**( eventName [ , listener ] ) => *this* #### *provider* . **off**( eventName [ , listener ] ) => *this*
Remove a *listener* for *eventName*. If no *listener* is provided, all listeners for *eventName* are removed. Remove a *listener* for the *eventName* [event](/v5/api/providers/provider/#Provider--events). If no *listener* is provided, all listeners for *eventName* are removed.
#### *provider* . **removeAllListeners**( [ eventName ] ) => *this* #### *provider* . **removeAllListeners**( [ eventName ] ) => *this*
Remove all the listeners for *eventName*. If no *eventName* is provided, **all** events are removed. Remove all the listeners for the *eventName* [events](/v5/api/providers/provider/#Provider--events). If no *eventName* is provided, **all** events are removed.
#### *provider* . **listenerCount**( [ eventName ] ) => *number* #### *provider* . **listenerCount**( [ eventName ] ) => *number*
Returns the number of listeners for *eventName*. If no *eventName* is provided, the total number of listeners is returned. Returns the number of listeners for the *eventName* [events](/v5/api/providers/provider/#Provider--events). If no *eventName* is provided, the total number of listeners is returned.
#### *provider* . **listeners**( eventName ) => *Array< Listener >* #### *provider* . **listeners**( eventName ) => *Array< Listener >*
Returns the list of Listeners for *eventName*. Returns the list of Listeners for the *eventName* [events](/v5/api/providers/provider/#Provider--events).
### Events ### Events
@ -260,7 +325,7 @@ A filter is an object, representing a contract log Filter, which has the optiona
If `address` is unspecified, the filter matches any contract address. If `address` is unspecified, the filter matches any contract address.
See events for more information on how to specify topic-sets. See [EventFilters](/v5/api/providers/types/#providers-EventFilter) for more information on filtering events.
#### **Topic-Set Filter** #### **Topic-Set Filter**
@ -269,6 +334,8 @@ The value of a **Topic-Set Filter** is a array of Topic-Sets.
This event is identical to a *Log Filter* with the address omitted (i.e. from any contract). This event is identical to a *Log Filter* with the address omitted (i.e. from any contract).
See [EventFilters](/v5/api/providers/types/#providers-EventFilter) for more information on filtering events.
#### **Transaction Filter** #### **Transaction Filter**

File diff suppressed because one or more lines are too long

@ -10,8 +10,6 @@ Types
BlockTag BlockTag
-------- --------
### EventType
Networkish Networkish
---------- ----------
@ -118,9 +116,13 @@ Events and Logs
The address to filter by, or `null` to match any address. The address to filter by, or `null` to match any address.
#### *filter* . **topics** => *Array< string< [DataHexString](/v5/api/utils/bytes/#DataHexString)< 32 > > | Array< string< [DataHexString](/v5/api/utils/bytes/#DataHexString)< 32 > > > >* #### *filter* . **topics** => *Array< string< [Data](/v5/api/utils/bytes/#DataHexString)< 32 > > | Array< string< [Data](/v5/api/utils/bytes/#DataHexString)< 32 > > > >*
The topics to filter by, or `null` to match any topics. Each entry represents an **AND** condition that must match, or may be `null` to match anything. If a given entry is an Array, then that entry is treated as an **OR** for any value in the entry. The topics to filter by or `null` to match any topics.
Each entry represents an **AND** condition that must match, or may be `null` to match anything. If a given entry is an Array, then that entry is treated as an **OR** for any value in the entry.
See [Filters](/v5/concepts/events/#events--filters) for more details and examples on specifying complex filters.
### Filter ### Filter
@ -268,9 +270,17 @@ The number of blocks that have been mined (including the initial block) since th
The serialized transaction. The serialized transaction.
#### *transaction* . **wait**( [ confirmations = 1 ] ) => *Promise< [TransactionReceipt](/v5/api/providers/types/#providers-TransactionReceipt) >* #### *transaction* . **wait**( [ confirms = 1 ] ) => *Promise< [TransactionReceipt](/v5/api/providers/types/#providers-TransactionReceipt) >*
Resolves to the [TransactionReceipt](/v5/api/providers/types/#providers-TransactionReceipt) once the transaction has been included in the chain for *confirms* blocks. If *confirms* is 0, and the transaction has not been mined, `null` is returned.
If the transaction execution failed (i.e. the receipt status is `0`), a [CALL_EXCEPTION](/v5/api/utils/logger/#errors--call-exception) Error will be rejected with the following properties:
- `error.transaction` - the original transaction
- `error.transactionHash` - the hash of the transaction
- `error.receipt` - the actual receipt, with the status of `0`
Wait for *confirmations*. If 0, and the transaction has not been mined, `null` is returned.
### TransactionReceipt ### TransactionReceipt

File diff suppressed because one or more lines are too long

@ -273,7 +273,7 @@ walletMnemonic.publicKey
walletMnemonic.mnemonic walletMnemonic.mnemonic
// { // {
// locale: 'en', // locale: 'en',
// path: 'm/44\'/60\'/0\'/0/0', // path: "m/44'/60'/0'/0/0",
// phrase: 'announce room limb pattern dry unit scale effort smooth jazz weasel alcohol' // phrase: 'announce room limb pattern dry unit scale effort smooth jazz weasel alcohol'
// } // }
@ -335,7 +335,7 @@ contract = new ethers.Contract("dai.tokens.ethers.eth", abi, signer)
// Get the number of tokens for this account // Get the number of tokens for this account
tokens = await contract.balanceOf(signer.getAddress()) tokens = await contract.balanceOf(signer.getAddress())
// { BigNumber: "15923148775162018481031" } // { BigNumber: "198172622063578627973" }
// //
// Pre-flight (check for revert) on DAI from the signer // Pre-flight (check for revert) on DAI from the signer
@ -352,7 +352,7 @@ contract.callStatic.transfer("donations.ethers.eth", tokens)
// This will fail since it is greater than the token balance // This will fail since it is greater than the token balance
contract.callStatic.transfer("donations.ethers.eth", tokens.add(1)) contract.callStatic.transfer("donations.ethers.eth", tokens.add(1))
// Error: call revert exception (method="transfer(address,uint256)", errorSignature="Error(string)", errorArgs=["Dai/insufficient-balance"], reason="Dai/insufficient-balance", code=CALL_EXCEPTION, version=abi/5.0.9) // Error: call revert exception (method="transfer(address,uint256)", errorSignature="Error(string)", errorArgs=["Dai/insufficient-balance"], reason="Dai/insufficient-balance", code=CALL_EXCEPTION, version=abi/5.0.12)
``` ```
ExternallyOwnedAccount ExternallyOwnedAccount

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -21,14 +21,14 @@ Converting and Verifying
Returns *address* as a Checksum Address. Returns *address* as a Checksum Address.
If *address* is an invalid 40-nibble [HexString](/v5/api/utils/bytes/#HexString) or if it contains mixed case and the checksum is invalid, an InvalidArgument Error is thrown. If *address* is an invalid 40-nibble [HexString](/v5/api/utils/bytes/#HexString) or if it contains mixed case and the checksum is invalid, an [INVALID_ARGUMENT](/v5/api/utils/logger/#errors--invalid-argument) Error is thrown.
The value of *address* may be any supported address format. The value of *address* may be any supported address format.
#### *ethers* . *utils* . **getIcapAddress**( address ) => *string< [IcapAddress](/v5/api/utils/address/#address-icap) >* #### *ethers* . *utils* . **getIcapAddress**( address ) => *string< [IcapAddress](/v5/api/utils/address/#address-icap) >*
Returns *address* as an [ICAP address](https://github.com/ethereum/wiki/wiki/Inter-exchange-Client-Address-Protocol-%28ICAP%29). Supports the same restrictions as [utils.getAddress](/v5/api/utils/address/#utils-getAddress). Returns *address* as an [ICAP address](https://github.com/ethereum/wiki/wiki/Inter-exchange-Client-Address-Protocol-%28ICAP%29). Supports the same restrictions as [getAddress](/v5/api/utils/address/#utils-getAddress).
#### *ethers* . *utils* . **isAddress**( address ) => *boolean* #### *ethers* . *utils* . **isAddress**( address ) => *boolean*

File diff suppressed because one or more lines are too long

@ -85,7 +85,7 @@ BigNumber.from(42n)
// Numbers outside the safe range fail: // Numbers outside the safe range fail:
BigNumber.from(Number.MAX_SAFE_INTEGER); BigNumber.from(Number.MAX_SAFE_INTEGER);
// Error: overflow (fault="overflow", operation="BigNumber.from", value=9007199254740991, code=NUMERIC_FAULT, version=bignumber/5.0.11) // Error: overflow (fault="overflow", operation="BigNumber.from", value=9007199254740991, code=NUMERIC_FAULT, version=bignumber/5.0.14)
``` ```
Methods Methods

File diff suppressed because one or more lines are too long

@ -164,20 +164,20 @@ Return a copy of *array* shuffled using [Fisher-Yates Shuffle](https://en.wikipe
```javascript ```javascript
utils.randomBytes(8) utils.randomBytes(8)
// Uint8Array [ 82, 221, 254, 37, 192, 138, 147, 109 ] // Uint8Array [ 97, 223, 223, 186, 224, 0, 90, 28 ]
const data = [ 1, 2, 3, 4, 5, 6, 7 ]; const data = [ 1, 2, 3, 4, 5, 6, 7 ];
// Returns a new Array // Returns a new Array
utils.shuffled(data); utils.shuffled(data);
// [ // [
// 6,
// 5, // 5,
// 3, // 3,
// 2, // 1,
// 7,
// 4, // 4,
// 1 // 6,
// 7,
// 2
// ] // ]
// The Original is unscathed... // The Original is unscathed...

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -52,7 +52,7 @@ utils.keccak256("0x1234")
// Do NOT use UTF-8 strings that are not a DataHexstring // Do NOT use UTF-8 strings that are not a DataHexstring
utils.keccak256("hello world") utils.keccak256("hello world")
// Error: invalid arrayify value (argument="value", value="hello world", code=INVALID_ARGUMENT, version=bytes/5.0.6) // Error: invalid arrayify value (argument="value", value="hello world", code=INVALID_ARGUMENT, version=bytes/5.0.10)
// If needed, convert strings to bytes first: // If needed, convert strings to bytes first:
utils.keccak256(utils.toUtf8Bytes("hello world")) utils.keccak256(utils.toUtf8Bytes("hello world"))
@ -300,6 +300,24 @@ TypedDataEncoder.getPayload(domain, types, value)
// }, // },
// primaryType: 'Mail', // primaryType: 'Mail',
// types: { // types: {
// EIP712Domain: [
// {
// name: 'name',
// type: 'string'
// },
// {
// name: 'version',
// type: 'string'
// },
// {
// name: 'chainId',
// type: 'uint256'
// },
// {
// name: 'verifyingContract',
// type: 'address'
// }
// ],
// Mail: [ // Mail: [
// { // {
// name: 'from', // name: 'from',

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -51,34 +51,36 @@ Throw an Error with *message* and an optional *code* and additional *params* set
#### *logger* . **throwArgumentError**( message , name , value ) => *never* #### *logger* . **throwArgumentError**( message , name , value ) => *never*
Throw an [INVALID_ARGUMENT](/v5/api/utils/logger/#errors-InvalidArgument) Error with *name* and *value*. Throw an [INVALID_ARGUMENT](/v5/api/utils/logger/#errors--invalid-argument) Error with *name* and *value*.
### Usage Validation ### Usage Validation
#### *logger* . **checkAbstract**( target , kind ) => *void* #### *logger* . **checkAbstract**( target , kind ) => *void*
Checks that *target* is not *kind* and performs the same operations as `checkNew`. This is useful for ensuring abstract classes are not being instantiated. If *target* is *kind*, throws a [UNSUPPORTED_OPERATION](/v5/api/utils/logger/#errors--unsupported-operation) error otherwise performs the same operations as [checkNew](/v5/api/utils/logger/#Logger-checkNew).
This is useful for ensuring abstract classes are not being instantiated.
#### *logger* . **checkArgumentCount**( count , expectedCount [ , message ) => *void* #### *logger* . **checkArgumentCount**( count , expectedCount [ , message ) => *void*
If *count* is not equal to *expectedCount*, throws a [MISSING_ARGUMENT](/v5/api/utils/logger/#errors-MissingArgument) or [UNEXPECTED_ARGUMENT](/v5/api/utils/logger/#errors-UnexpectedArgument) error. If *count* is not equal to *expectedCount*, throws a [MISSING_ARGUMENT](/v5/api/utils/logger/#errors--missing-argument) or [UNEXPECTED_ARGUMENT](/v5/api/utils/logger/#errors--unexpected-argument) error.
#### *logger* . **checkNew**( target , kind ) => *void* #### *logger* . **checkNew**( target , kind ) => *void*
If *target* is not a valid `this` or `target` value, throw a [MISSING_NEW](/v5/api/utils/logger/#errors-MissingNew) error. This is useful to ensure callers of a Class are using `new`. If *target* is not a valid `this` or `target` value, throw a [MISSING_NEW](/v5/api/utils/logger/#errors--missing-new) error. This is useful to ensure callers of a Class are using `new`.
#### *logger* . **checkNormalize**( message ) => *void* #### *logger* . **checkNormalize**( message ) => *void*
Check that the environment has a correctly functioning [String.normalize](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize). If not, a [UNSUPPORTED_OPERATION](/v5/api/utils/logger/#errors-UnsupportedOperation) error is thrown. Check that the environment has a correctly functioning [String.normalize](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize). If not, a [UNSUPPORTED_OPERATION](/v5/api/utils/logger/#errors--unsupported-operation) error is thrown.
#### *logger* . **checkSafeUint53**( value [ , message ] ) => *void* #### *logger* . **checkSafeUint53**( value [ , message ] ) => *void*
If *value* is not safe as a [JavaScript number](https://en.wikipedia.org/wiki/Double-precision_floating-point_format), throws a [NUMERIC_FAULT](/v5/api/utils/logger/#errors-NumericFault) error. If *value* is not safe as a [JavaScript number](https://en.wikipedia.org/wiki/Double-precision_floating-point_format), throws a [NUMERIC_FAULT](/v5/api/utils/logger/#errors--numeric-fault) error.
### Censorship ### Censorship
@ -104,13 +106,23 @@ Errors
#### *Logger* . *errors* . **NOT_IMPLEMENTED** #### *Logger* . *errors* . **NOT_IMPLEMENTED**
The operation is not implemented. The operation is not implemented. This may occur when calling a method on a sub-class that has not fully implemented its abstract superclass.
#### *Logger* . *errors* . **SERVER_ERROR** #### *Logger* . *errors* . **SERVER_ERROR**
There was an error communicating with a server. There was an error communicating with a server.
This may occur for a number of reasons, for example:
- a [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issue; this is quite often the problem and also the hardest to diagnose and fix, so it is very beneficial to familiarize yourself with CORS; some backends allow you configure your CORS, such as the geth command-line or conifguration files or the INFURA and Alchemy dashboards by specifing allowed Origins, methods, etc.
- an SSL issue; for example, if you are trying to connect to a local node via HTTP but are serving the content from a secure HTTPS website
- a link issue; a firewall is preventing the traffic from reaching the server
- a server issue; the server is down, or is returning 500 error codes
- a backend DDoS mitigation proxy; for example, Etherscan operates behind a Cloudflare proxy, which will block traffic if the request is sent via specific User Agents or the client fingerprint is detected as a bot in some cases
#### *Logger* . *errors* . **TIMEOUT** #### *Logger* . *errors* . **TIMEOUT**
@ -126,6 +138,14 @@ A generic unknown error.
The operation is not supported. The operation is not supported.
This can happen for a variety reasons, for example:
- Some backends do not support certain operations; such as passing a blockTag to an [EtherscanProvider](/v5/api/providers/api-providers/#EtherscanProvider) for [call](/v5/api/providers/provider/#Provider-call)
- A [Contract](/v5/api/contract/contract/) object connected to [Provider](/v5/api/providers/provider/) (instead of a [Signer](/v5/api/signer/#Signer)) cannot [sign](/v5/api/signer/#Signer-signTransaction) or [send](/v5/api/signer/#Signer-sendTransaction) transactions
- a [Contract](/v5/api/contract/contract/) connected to a [Signer](/v5/api/signer/#Signer) without a [Provider](/v5/api/providers/provider/) is write-only and cannot estimate gas or execute static calls
### Safety Error Codes ### Safety Error Codes
@ -133,6 +153,8 @@ The operation is not supported.
The amount of data needed is more than the amount of data required, which would cause the data buffer to read past its end. The amount of data needed is more than the amount of data required, which would cause the data buffer to read past its end.
This can occur if a contract erroneously returns invalid ABI-encoded data or RLP data is malformed.
#### *Logger* . *errors* . **NUMERIC_FAULT** #### *Logger* . *errors* . **NUMERIC_FAULT**
@ -145,7 +167,7 @@ Common cases of this occur when there is [overflow](https://en.wikipedia.org/wik
#### *Logger* . *errors* . **INVALID_ARGUMENT** #### *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. 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** #### *Logger* . *errors* . **MISSING_ARGUMENT**
@ -155,7 +177,7 @@ An expected parameter was not specified.
#### *Logger* . *errors* . **MISSING_NEW** #### *Logger* . *errors* . **MISSING_NEW**
An object is a Class, but is now being called with `new`. An object is a Class, but is not being called with `new`.
#### *Logger* . *errors* . **UNEXPECTED_ARGUMENT** #### *Logger* . *errors* . **UNEXPECTED_ARGUMENT**
@ -167,14 +189,16 @@ Too many parameters we passed into a function.
#### *Logger* . *errors* . **CALL_EXCEPTION** #### *Logger* . *errors* . **CALL_EXCEPTION**
An attempt to call a blockchain contract (getter) resulted in a revert or other error. An attempt to call a blockchain contract (getter) resulted in a revert or other error, such as insufficient gas (out-of-gas) or an invalid opcode. This can also occur during gas estimation or if waiting for a [TransactionReceipt](/v5/api/providers/types/#providers-TransactionReceipt) which failed during execution.
Consult the contract to determine the cause, such as a failed condition in a `require` statement. The `reason` property may provide more context for the cause of this error.
#### *Logger* . *errors* . **INSUFFICIENT_FUNDS** #### *Logger* . *errors* . **INSUFFICIENT_FUNDS**
The account is attempting to make a transaction which costs more than is available. 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. 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, as well as 35000 gas if a transaction contains no `to` property and is therefore expected to create a new account.
#### *Logger* . *errors* . **NETWORK_ERROR** #### *Logger* . *errors* . **NETWORK_ERROR**
@ -191,7 +215,7 @@ The nonce being specified has already been used in a mined transaction.
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. 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. 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. This is not enforced by the protocol, as it deals with unmined transactions, and can be configured by each node, however to ensure a transaction is propagated to a miner it is best practice to follow the defaults most nodes have enabled.
#### *Logger* . *errors* . **UNPREDICTABLE_GAS_LIMIT** #### *Logger* . *errors* . **UNPREDICTABLE_GAS_LIMIT**

File diff suppressed because one or more lines are too long

@ -7,27 +7,35 @@ Documentation: [html](https://docs.ethers.io/)
Property Utilities Property Utilities
================== ==================
#### *ethers* . *utils* . **checkProperties**( ) => *void* #### *ethers* . *utils* . **checkProperties**( object , check ) => *void*
Checks that *object* only contains properties included in *check*, and throws [INVALID_ARGUMENT](/v5/api/utils/logger/#errors--invalid-argument) if not.
#### *ethers* . *utils* . **deepCopy**( anObject ) => *any* #### *ethers* . *utils* . **deepCopy**( anObject ) => *any*
Creates a recursive copy of *anObject*. Frozen (i.e. and other known immutable) objects are copied by reference.
#### *ethers* . *utils* . **defineReadOnly**( anObject , name , value ) => *void* #### *ethers* . *utils* . **defineReadOnly**( anObject , name , value ) => *void*
Uses the `Object.defineProperty` method to set a read-only property on an object.
#### *ethers* . *utils* . **getStatic**( aConstructor , key ) => *any* #### *ethers* . *utils* . **getStatic**( aConstructor , key ) => *any*
Recursively check for a static method *key* on an inheritance chain from *aConstructor* to all ancestors.
This is used to mimic behaviour in other languages where `this` in a static method will also search ancestors.
#### *ethers* . *utils* . **resolveProperties**( anObject ) => *Promise< any >* #### *ethers* . *utils* . **resolveProperties**( anObject ) => *Promise< any >*
Retruns a Promise which resolves all child values on *anObject*.
#### *ethers* . *utils* . **shallowCopy**( anObject ) => *any* #### *ethers* . *utils* . **shallowCopy**( anObject ) => *any*
Returns a shallow copy of *anObject*. This is the same as using `Object.assign({ }, anObject)`.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -8,8 +8,8 @@ Ethereum Basics
=============== ===============
* [Events](events) * [Events](events)
* [Solidity Topics](events)
* [Logs and Filtering](events) * [Logs and Filtering](events)
* [Solidity Topics](events)
* [Gas](gas) * [Gas](gas)
* [Gas Price](gas) * [Gas Price](gas)
* [Gas Limit](gas) * [Gas Limit](gas)

File diff suppressed because one or more lines are too long

@ -7,9 +7,6 @@ Documentation: [html](https://docs.ethers.io/)
Events Events
====== ======
Solidity Topics
---------------
Logs and Filtering Logs and Filtering
------------------ ------------------
@ -135,5 +132,8 @@ contract.filters.Transfer(null, [ myAddress, otherAddress ])
// } // }
``` ```
Solidity Topics
---------------
### Other Things? TODO ### Other Things? TODO

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -12,46 +12,77 @@ Building
``` ```
# Clone the repository # Clone the repository
/home/ricmoo> git clone git@github.com:ethers-io/ethers.js.git /home/ricmoo> git clone https://github.com/ethers-io/ethers.js.git
/home/ricmoo> cd ethers.js /home/ricmoo> cd ethers.js
# Install the base dependencies # Install all dependencies:
# - Hoists all sub-package dependencies in the package.json (preinstall)
# - Installs all the (hoisted) dependencies and devDependencies (install)
# - Build the rat-nests (in .package_node_modules) (postinstall)
# - Create a dependency graph for the TypeScript (postinstall)
# - Link the rat-nets into each project (postinstall)
/home/ricmoo/ethers.js> npm install /home/ricmoo/ethers.js> npm install
# Install each module's dependencies and link the libraries
# internally, so they reference each other
/home/ricmoo/ethers.js> npm run bootstrap
``` ```
Making your changes ### Making Changes
-------------------
``` ```
# Begin watching the files and re-building whenever they change # Begin watching the files and re-building whenever they change
/home/ricmoo/ethers.js> npm run auto-build /home/ricmoo/ethers.js> npm run auto-build
# Or if you do not want to watch and just build
# Sometimes the issue only affects the ESM modules /home/ricmoo/ethers.js> npm run build
/home/ricmoo/ethers.js> npm run auto-build-esm
# Or if you only need to run a single build
/home/ricmoo/ethers.js> npm run _build-cjs
/home/ricmoo/ethers.js> npm run _build-esm
``` ```
### Creating Browser-Ready Files
``` ```
# Rebuilds all files and bundles testcases up for testing # If you need to rebuild all the libs (esm + cjs) and dist files
# Note: this requires node 10 or newer
/home/ricmoo/ethers.js> npm run build-all
```
### Testing
```
# Rebuilds all files (npm run build-all) and bundles testcases up for testing
/home/ricmoo/ethers.js> npm test /home/ricmoo/ethers.js> npm test
# Often you don't need the full CI experience # Often you don't need the full CI experience
/home/ricmoo/ethers.js> npm run _test-node /home/ricmoo/ethers.js> npm run test-node
``` ```
### Distribution
``` ```
# Prepare all the distribution files
# - Remove all generated files (i.e. npm run clean)
# - Re-install all dependencies, hoisting, etc. (npm install)
# - Spell check all strings in every TypeScript files
# - Build everything from scratch with this clean install
# - Compare local with npm, bumping the version if changed
# - Build everything again (with the updated versions)
# - Update the CHANGELOG.md with the git history since the last change
/home/ricmoo/ethers.js> npm run update-version /home/ricmoo/ethers.js> npm run update-version
``` ```
#### Do NOT check in dist files in a PR
For Pull Requests, please ONLY commit files in the `docs.wrm/` and `packages/*/src.ts/` folders. I will prepare the distribution builds myself and keeping the PR relevant makes it easier to verify the changes.
### Publishing
```
# Publish
# - Update any changed packages to NPM
# - Create a release on GitHub with the latest CHANGELOG.md description
# - Upload the bundled files the the CDN
# - Flush the CDN edge caches
/home/ricmoo/ethers.js> npm run publish-all
```
Documentation Documentation
------------- -------------

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -234,7 +234,7 @@ url.parse("https://www.ricmoo.com/").protocol
// 'https:' // 'https:'
url.parse(45) url.parse(45)
// Error: The "url" argument must be of type string. Received type number // Error: The "url" argument must be of type string. Received type number (45)
// You want to assign (doesn't emit eval) AND display the value // You want to assign (doesn't emit eval) AND display the value
const foo = 4 + 5; const foo = 4 + 5;

File diff suppressed because one or more lines are too long

@ -81,7 +81,7 @@ const signer = provider.getSigner()
```javascript ```javascript
// Look up the current block number // Look up the current block number
provider.getBlockNumber() provider.getBlockNumber()
// { Promise: 11312227 } // { Promise: 11817915 }
// Get the balance of an account (by address or ENS name, if supported by network) // Get the balance of an account (by address or ENS name, if supported by network)
balance = await provider.getBalance("ethers.eth") balance = await provider.getBalance("ethers.eth")
@ -149,11 +149,11 @@ daiContract.symbol()
// Get the balance of an address // Get the balance of an address
balance = await daiContract.balanceOf("ricmoo.firefly.eth") balance = await daiContract.balanceOf("ricmoo.firefly.eth")
// { BigNumber: "15923148775162018481031" } // { BigNumber: "198172622063578627973" }
// Format the DAI for displaying to the user // Format the DAI for displaying to the user
ethers.utils.formatUnits(balance, 18) ethers.utils.formatUnits(balance, 18)
// '15923.148775162018481031' // '198.172622063578627973'
``` ```
### State Changing Methods ### State Changing Methods
@ -208,7 +208,7 @@ daiContract.on(filter, (from, to, amount, event) => {
myAddress = await signer.getAddress() myAddress = await signer.getAddress()
// '0x8ba1f109551bD432803012645Ac136ddd64DBA72' // '0x8ba1f109551bD432803012645Ac136ddd64DBA72'
// Filter for all token transfers to me // Filter for all token transfers from me
filterFrom = daiContract.filters.Transfer(myAddress, null); filterFrom = daiContract.filters.Transfer(myAddress, null);
// { // {
// address: 'dai.tokens.ethers.eth', // address: 'dai.tokens.ethers.eth',
@ -218,7 +218,7 @@ filterFrom = daiContract.filters.Transfer(myAddress, null);
// ] // ]
// } // }
// Filter for all token transfers from me // Filter for all token transfers to me
filterTo = daiContract.filters.Transfer(null, myAddress); filterTo = daiContract.filters.Transfer(null, myAddress);
// { // {
// address: 'dai.tokens.ethers.eth', // address: 'dai.tokens.ethers.eth',
@ -308,7 +308,7 @@ Signing Messages
// logging into a service, such as CryptoKitties, // logging into a service, such as CryptoKitties,
// pass the string in. // pass the string in.
signature = await signer.signMessage("Hello World"); signature = await signer.signMessage("Hello World");
// '0xc2c9a0db8e9ae4266d6aa1974b36efabd8e270452587857922c5fd696838a22b6dd8f0536c24a73c0df512eefac68bc118fb91b10640fcc576e44a57bc024ca31b' // '0x800d1d157d472b0cb567ec0d9e2825203aaa7e84db5a9b19169c0c85575f6e0761e99bd670ed82f71a346020cdec8326644132cdeffd8e327d888f94f21825e01b'
// //
// A common case is also signing a hash, which is 32 // A common case is also signing a hash, which is 32
@ -325,6 +325,6 @@ messageBytes = ethers.utils.arrayify(message);
// To sign a hash, you most often want to sign the bytes // To sign a hash, you most often want to sign the bytes
signature = await signer.signMessage(messageBytes) signature = await signer.signMessage(messageBytes)
// '0x66b35b262989bc88c5c5c1fadcd8bcd5ae410cdae06abf33ce2c3c98a04d4e892fd2f61717a46f81372146019c2e95646a6cfc3a7ae74e78338f40d905fa69fc1b' // '0x3ec3dca35ae2712e7f9bb1e2819f9b40c818c567b1a01586d3b0d0a73bad1c303b7f39d4471ac0c9eb900438bc6b6a4bf5b2c120a5cb31edc2cfab11ede409381b'
``` ```

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,15 @@
-----
Documentation: [html](https://docs.ethers.io/)
-----
Other Resources
===============
Ethereum Overview
-----------------
Tutorials
---------

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -134,4 +134,14 @@ if (document.getElementsByTagName("html")[0].classList.contains("single-page"))
// Set up the initial TOC highlight // Set up the initial TOC highlight
highlightToc(true); highlightToc(true);
} else {
const sidebar = document.getElementsByClassName("sidebar")[0];
// Scroll to TOC to get the selected page visible
setTimeout(function() {
const selected = document.querySelector(".myself");
if (selected) {
sidebar.scrollTop = Math.max(selected.offsetTop - 230, 0);
}
}, 10);
} }

BIN
docs/v5/static/social.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

File diff suppressed because one or more lines are too long