docs: updated generated docs.

This commit is contained in:
Richard Moore 2020-11-22 23:07:13 -05:00
parent d122d18cfa
commit 7f775f7ad6
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651
109 changed files with 2151 additions and 797 deletions

View File

@ -33,10 +33,13 @@ Developer Documentation
* [Gas Limit](concepts/gas)
* [Security](concepts/security)
* [Key Derivation Functions](concepts/security)
* [Best Practices](concepts/best-practices)
* [Network Changes](concepts/best-practices)
* [Provider API Keys](api-keys)
* [Etherscan](api-keys)
* [INFURA](api-keys)
* [Alchemy](api-keys)
* [Pocket Gateway](api-keys)
* [Creating a Default Provider](api-keys)
* [Application Programming Interface](api)
* [Providers](api/providers)
@ -193,7 +196,7 @@ Developer Documentation
* [Data Segment](api/other/assembly/dialect)
* [Links](api/other/assembly/dialect)
* [Stack Placeholders](api/other/assembly/dialect)
* [Evaluation and Excution](api/other/assembly/dialect)
* [Evaluation and Execution](api/other/assembly/dialect)
* [Utilities](api/other/assembly/api)
* [Assembler](api/other/assembly/api)
* [Disassembler](api/other/assembly/api)

View File

@ -16,6 +16,9 @@ INFURA
Alchemy
-------
Pocket Gateway
--------------
Creating a Default Provider
---------------------------
@ -29,7 +32,18 @@ const network = "homestead";
const provider = ethers.getDefaultProvider(network, {
etherscan: YOUR_ETHERSCAN_API_KEY,
infura: YOUR_INFURA_PROJECT_ID,
alchemy: YOUR_ALCHEMY_API_KEY
// Or if using a project secret:
// infura: {
// projectId: YOUR_INFURA_PROJECT_ID,
// projectSecret: YOUR_INFURA_PROJECT_SECRET,
// },
alchemy: YOUR_ALCHEMY_API_KEY,
pocket: YOUR_POCKET_APPLICATION_KEY
// Or if using an application secret key:
// pocket: {
// applicationId: ,
// applicationSecretKey:
// }
});
```

File diff suppressed because one or more lines are too long

View File

@ -161,7 +161,7 @@ Application Programming Interface
* [Data Segment](other/assembly/dialect)
* [Links](other/assembly/dialect)
* [Stack Placeholders](other/assembly/dialect)
* [Evaluation and Excution](other/assembly/dialect)
* [Evaluation and Execution](other/assembly/dialect)
* [Utilities](other/assembly/api)
* [Assembler](other/assembly/api)
* [Disassembler](other/assembly/api)

View File

@ -42,7 +42,7 @@ Methods
#### *contractFactory* . **attach**( address ) => *[Contract](/v5/api/contract/contract/)*
Return an instance of a [Contract](/v5/api/contract/contract/) attched to *address*. This is the same as using the [Contract constructor](/v5/api/contract/contract/#Contract--creating) with *address* and this the 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)*
@ -52,7 +52,7 @@ Returns the unsigned transaction which would deploy this Contract with *args* pa
#### *contractFactory* . **deploy**( ...args ) => *Promise< [Contract](/v5/api/contract/contract/) >*
Uses the signer to deploy the Contract with *args* passed into the constructor and retruns 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.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -17,7 +17,7 @@ Generates a brain wallet, with a slightly improved experience, in which the gene
#### *BrainWallet* . **generateLegacy**( username , password [ , progressCallback ] ) => *[BrainWallet](/v5/api/experimental/#experimental-brainwallet)*
Generate a brain wallet which is compatibile with the ethers v3 and earlier.
Generate a brain wallet which is compatible with the ethers v3 and earlier.
EIP1193Bridge
@ -45,13 +45,13 @@ The provider associated with the signer.
Set the current transaction count (nonce) for the signer.
This may be useful it 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*
Bump the current transaction count (nonce) by *count*.
This may be useful it interacting with the signer outside of using this class.
This may be useful in interacting with the signer outside of using this class.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -17,7 +17,7 @@ Other Libraries
* [Data Segment](assembly/dialect)
* [Links](assembly/dialect)
* [Stack Placeholders](assembly/dialect)
* [Evaluation and Excution](assembly/dialect)
* [Evaluation and Execution](assembly/dialect)
* [Utilities](assembly/api)
* [Assembler](assembly/api)
* [Disassembler](assembly/api)

View File

@ -16,7 +16,7 @@ Assembly
* [Data Segment](dialect)
* [Links](dialect)
* [Stack Placeholders](dialect)
* [Evaluation and Excution](dialect)
* [Evaluation and Execution](dialect)
* [Utilities](api)
* [Assembler](api)
* [Disassembler](api)

View File

@ -62,7 +62,7 @@ Opcode
#### *asm* . *Opcode* . **from**( valueOrMnemonic ) => *[Opcode](/v5/api/other/assembly/api/#asm-opcode)*
Create a new instnace of an Opcode for a given numeric value (e.g. 0x60 is PUSH1) or mnemonic string (e.g. "PUSH1").
Create a new instance of an Opcode for a given numeric value (e.g. 0x60 is PUSH1) or mnemonic string (e.g. "PUSH1").
### Properties

File diff suppressed because one or more lines are too long

View File

@ -53,7 +53,7 @@ The literal value of this node, which may be a [DataHexString](/v5/api/utils/byt
#### *literalNode* . **verbatim** => *boolean*
This is true in a [DataNode](/v5/api/other/assembly/ast/#asm-datanode) context, since in that case the value should be taken verbatim and no `PUSH` operation shoud be added, otherwise false.
This is true in a [DataNode](/v5/api/other/assembly/ast/#asm-datanode) context, since in that case the value should be taken verbatim and no `PUSH` operation should be added, otherwise false.
### PopNode
@ -67,7 +67,7 @@ The index this **PopNode** is representing. For an implicit place-holder this is
#### *linkNode* . **label** => *string*
Te name of the target node.
The name of the target node.
#### *linkNode* . **type** => *"offset" | "length"*
@ -91,7 +91,7 @@ A list of all operands passed into this Node.
#### *literalNode* . **verbatim** => *boolean*
This is true in a [DataNode](/v5/api/other/assembly/ast/#asm-datanode) context, since in that case the value should be taken verbatim and no `PUSH` operation shoud be added, otherwise false.
This is true in a [DataNode](/v5/api/other/assembly/ast/#asm-datanode) context, since in that case the value should be taken verbatim and no `PUSH` operation should be added, otherwise false.
#### *evaluationNode* . **script** => *string*

File diff suppressed because one or more lines are too long

View File

@ -31,6 +31,6 @@ Links
Stack Placeholders
------------------
Evaluation and Excution
-----------------------
Evaluation and Execution
------------------------

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -12,7 +12,7 @@ Default Provider
#### *ethers* . **getDefaultProvider**( [ network , [ options ] ] ) => *[Provider](/v5/api/providers/provider/)*
Returns a new Provider, backed by multiple services, connected to *network*. Is no *network* is provided, **homestead** (i.e. mainnet) is used.
Returns a new Provider, backed by multiple services, connected to *network*. If no *network* is provided, **homestead** (i.e. mainnet) is used.
The *network* may also be a URL to connect to, such as `http://localhost:8545` or `wss://example.com`.
@ -25,7 +25,7 @@ Option Properties
#### Note: API Keys
It is highly recommended for production services that to acquire and specify an API Key for each sercice.
It is highly recommended for production services to acquire and specify an API Key for each service.
The default API Keys used by ethers are shared across all users, so services may throttle all services that are using the default API Keys during periods of load without realizing it.

View File

@ -14,7 +14,7 @@ EtherscanProvider
Create a new **EtherscanProvider** connected to *network* with the optional *apiKey*.
The *network* may be specified as **string** for a common network name, a **number** for a common chain ID or a [Network Object]provider-(network).
The *network* may be specified as a **string** for a common network name, a **number** for a common chain ID or a [Network Object]provider-(network).
If no *apiKey* is provided, a shared API key will be used, which may result in reduced performance and throttled requests. It is highly recommended for production, you register with [Etherscan](https://etherscan.io) for your own API key.
@ -71,7 +71,7 @@ InfuraProvider
Create a new **InfuraProvider** connected to *network* with the optional *apiKey*.
The *network* may be specified as **string** for a common network name, a **number** for a common chain ID or a [Network Object]provider-(network).
The *network* may be specified as a **string** for a common network name, a **number** for a common chain ID or a [Network Object]provider-(network).
The *apiKey* can be a **string** Project ID or an **object** with the properties `projectId` and `projectSecret` to specify a [Project Secret](https://infura.io/docs/gettingStarted/authentication) which can be used on non-public sources (like on a server) to further secure your API access and quotas.
@ -130,7 +130,7 @@ AlchemyProvider
Create a new **AlchemyProvider** connected to *network* with the optional *apiKey*.
The *network* may be specified as **string** for a common network name, a **number** for a common chain ID or a [Network Object](/v5/api/providers/types/#providers-Network).
The *network* may be specified as a **string** for a common network name, a **number** for a common chain ID or a [Network Object](/v5/api/providers/types/#providers-Network).
#### Note: Default API keys

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -36,7 +36,7 @@ The provider for this configuration.
#### *fallbackProviderConfig* . **priority** => *number*
The priority used for the provider. Higher priorities are favoured over lower priorities. If multiple providers share the same prioirty, they are choosen at random.
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.
#### *fallbackProviderConfig* . **stallTimeout** => *number*

File diff suppressed because one or more lines are too long

View File

@ -33,7 +33,7 @@ Returns the number of transactions *address* has ever **sent**, as of *blockTag*
```javascript
// Get the balance for an account...
provider.getBalance("ricmoo.firefly.eth");
// { Promise: { BigNumber: "1492974808274631213" } }
// { Promise: { BigNumber: "284831012276355695" } }
// Get the code for a contract...
provider.getCode("registrar.firefly.eth");
@ -45,7 +45,7 @@ provider.getStorageAt("registrar.firefly.eth", 0)
// Get transaction count of an account...
provider.getTransactionCount("ricmoo.firefly.eth");
// { Promise: 679 }
// { Promise: 689 }
```
Blocks Methods
@ -96,7 +96,7 @@ provider.getBlockWithTransactions(100004)
// blockHash: '0xf93283571ae16dcecbe1816adc126954a739350cd1523a1559eabeae155fbb63',
// blockNumber: 100004,
// chainId: 0,
// confirmations: 10719007,
// confirmations: 11212224,
// creates: null,
// data: '0x',
// from: '0xcf00A85f3826941e7A25BFcF9Aac575d40410852',
@ -177,16 +177,16 @@ provider.getNetwork()
// The current block number
provider.getBlockNumber()
// { Promise: 10819010 }
// { Promise: 11312227 }
// Get the current suggested gas price (in wei)...
gasPrice = await provider.getGasPrice()
// { BigNumber: "69000000000" }
// { BigNumber: "46200000000" }
// ...often this gas price is easier to understand or
// display to the user in gwei (giga-wei, or 1e9 wei)
utils.formatUnits(gasPrice, "gwei")
// '69.0'
// '46.2'
```
Transactions Methods
@ -194,7 +194,7 @@ Transactions Methods
#### *provider* . **call**( transaction [ , blockTag = latest ] ) => *Promise< string< [DataHexString](/v5/api/utils/bytes/#DataHexString) > >*
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.
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 getters on Contracts.
#### *provider* . **estimateGas**( transaction ) => *Promise< [BigNumber](/v5/api/utils/bignumber/) >*
@ -224,7 +224,7 @@ 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.
Add a *listener* to be triggered for only the next *eventName*, at which time it will be removed.
#### *provider* . **emit**( eventName , ...args ) => *boolean*

File diff suppressed because one or more lines are too long

View File

@ -60,21 +60,21 @@ The timestamp of this block.
The nonce used as part of the proof-of-work to mine this block.
This property is generally of little interest developers.
This property is generally of little interest to developers.
#### *block* . **difficulty** => *number*
The difficulty target required to be met by the miner of the block.
This property is generally of little interest developers.
This property is generally of little interest to developers.
#### *block* . **gasLimit** => *[BigNumber](/v5/api/utils/bignumber/)*
The maximum amount of gas that this block was permitted to use. This is a value that can be voted up or voted down by miners and is used to automatically adjust the bandwidth requirements of the network.
This property is generally of little interest developers.
This property is generally of little interest to developers.
#### *block* . **gasUsed** => *[BigNumber](/v5/api/utils/bignumber/)*
@ -91,7 +91,7 @@ The coinbase address of this block, which indicates the address the miner that m
This is extra data a miner may choose to include when mining a block.
This property is generally of little interest developers.
This property is generally of little interest to developers.
### Block (with transaction hashes)
@ -277,7 +277,7 @@ Wait for *confirmations*. If 0, and the transaction has not been mined, `null` i
#### *receipt* . **to** => *string< [Address](/v5/api/utils/address/#address) >*
The address this transaction is to. This is `null` if the the transaction was an **init transaction**, used to deploy a contract.
The address this transaction is to. This is `null` if the transaction was an **init transaction**, used to deploy a contract.
#### *receipt* . **from** => *string< [Address](/v5/api/utils/address/#address) >*
@ -313,7 +313,7 @@ The amount of gas actually used by this transaction.
#### *receipt* . **logsBloom** => *string< [DataHexString](/v5/api/utils/bytes/#DataHexString) >*
A [bloom-filter](https://en.wikipedia.org/wiki/Bloom_filter), which incldues all the addresses and topics included in any log in this transaction.
A [bloom-filter](https://en.wikipedia.org/wiki/Bloom_filter), which includes all the addresses and topics included in any log in this transaction.
#### *receipt* . **blockHash** => *string< [DataHexString](/v5/api/utils/bytes/#DataHexString)< 32 > >*
@ -343,7 +343,7 @@ The number of blocks that have been mined since this transaction, including the
#### *receipt* . **cumulativeGasUsed** => *[BigNumber](/v5/api/utils/bignumber/)*
For the block this transaction was included in, this is the sum of the gas used used by each transaction in the ordered list of transactions up to (and including) this transaction.
For the block this transaction was included in, this is the sum of the gas used by each transaction in the ordered list of transactions up to (and including) this transaction.
This is generally of little interest to developers.

File diff suppressed because one or more lines are too long

View File

@ -103,22 +103,72 @@ This method populates the transactionRequest with missing fields, using [populat
Sub-classes **must** implement this, however they may throw if sending a transaction is not supported, such as the [VoidSigner](/v5/api/signer/#VoidSigner) or if the Wallet is offline and not connected to a [Provider](/v5/api/providers/provider/).
#### *signer* . **_signTypedData**( domain , types , value ) => *Promise< string< [RawSignature](/v5/api/utils/bytes/#signature-raw) > >*
Signs the typed data *value* with *types* data structure for *domain* using the [EIP-712](https://eips.ethereum.org/EIPS/eip-712) specification.
#### Experimental feature (this method name will change)
This is still an experimental feature. If using it, please specify the **exact** version of ethers you are using (e.g. spcify `"5.0.18"`, **not** `"^5.0.18"`) as the method name will be renamed from `_signTypedData` to `signTypedData` once it has been used in the field a bit.
```javascript
// All properties on a domain are optional
const domain = {
name: 'Ether Mail',
version: '1',
chainId: 1,
verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC'
};
// The named list of all type definitions
const types = {
Person: [
{ name: 'name', type: 'string' },
{ name: 'wallet', type: 'address' }
],
Mail: [
{ name: 'from', type: 'Person' },
{ name: 'to', type: 'Person' },
{ name: 'contents', type: 'string' }
]
};
// The data to sign
const value = {
from: {
name: 'Cow',
wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826'
},
to: {
name: 'Bob',
wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB'
},
contents: 'Hello, Bob!'
};
const signature = await signer._signTypedData(domain, types, value);
// '0x463b9c9971d1a144507d2e905f4e98becd159139421a4bb8d3c9c2ed04eb401057dd0698d504fd6ca48829a3c8a7a98c1c961eae617096cb54264bbdd082e13d1c'
```
### Sub-Classes
#### *signer* . **checkTransaction**( transactionRequest ) => *[TransactionRequest](/v5/api/providers/types/#providers-TransactionRequest)*
This is generally not required to be overridden, but may needed to provide custom behaviour in sub-classes.
This is generally not required to be overridden, but may be needed to provide custom behaviour in sub-classes.
This should return a **copy** of the *transactionRequest*, with any properties needed by `call`, `estimateGas` and `populateTransaction` (which is used by sendTransaction). It should also throw an error if any unknown key is specified.
The default implementation checks only valid [TransactionRequest](/v5/api/providers/types/#providers-TransactionRequest) properties exist and adds `from` to the transaction if it does not exist.
The default implementation checks only if valid [TransactionRequest](/v5/api/providers/types/#providers-TransactionRequest) properties exist and adds `from` to the transaction if it does not exist.
If there is a `from` field it **must** be verified to be equal to the Signer's address.
#### *signer* . **populateTransaction**( transactionRequest ) => *Promise< [TransactionRequest](/v5/api/providers/types/#providers-TransactionRequest) >*
This is generally not required to be overridden, but may needed to provide custom behaviour in sub-classes.
This is generally not required to be overridden, but may be needed to provide custom behaviour in sub-classes.
This should return a **copy** of *transactionRequest*, follow the same procedure as `checkTransaction` and fill in any properties required for sending a transaction. The result should have all promises resolved; if needed the [resolveProperties](/v5/api/utils/properties/#utils-resolveproperties) utility function can be used for this.
@ -172,7 +222,7 @@ The address for the account this Wallet represents.
#### *wallet* . **provider** => *[Provider](/v5/api/providers/provider/)*
The provider this wallet is connected to, which will ge used for any [Blockchain Methods](/v5/api/signer/#Signer--blockchain-methods) methods. This can be null.
The provider this wallet is connected to, which will be used for any [Blockchain Methods](/v5/api/signer/#Signer--blockchain-methods) methods. This can be null.
#### Note
@ -285,7 +335,7 @@ contract = new ethers.Contract("dai.tokens.ethers.eth", abi, signer)
// Get the number of tokens for this account
tokens = await contract.balanceOf(signer.getAddress())
// { BigNumber: "11386855832278858351495" }
// { BigNumber: "15923148775162018481031" }
//
// Pre-flight (check for revert) on DAI from the signer
@ -302,7 +352,7 @@ contract.callStatic.transfer("donations.ethers.eth", tokens)
// This will fail since it is greater than the token balance
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.4)
// 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)
```
ExternallyOwnedAccount
@ -320,6 +370,6 @@ The privateKey of this EOA
#### *eoa* . **mnemonic** => *[Mnemonic](/v5/api/utils/hdnode/#Mnemonic)*
*Optional*. The account HD mnemonic, if it has one and can be determined. Some sources do not encode the mnemonic, such as an HD extended keys.
*Optional*. The account HD mnemonic, if it has one and can be determined. Some sources do not encode the mnemonic, such as HD extended keys.

File diff suppressed because one or more lines are too long

View File

@ -29,7 +29,7 @@ Coding Methods
#### *abiCoder* . **encode**( types , values ) => *string< [DataHexString](/v5/api/utils/bytes/#DataHexString) >*
Encode the array *values* according the array of *types*, each of which may be a string or a [ParamType](/v5/api/utils/abi/fragments/#ParamType).
Encode the array *values* according to the array of *types*, each of which may be a string or a [ParamType](/v5/api/utils/abi/fragments/#ParamType).
#### *abiCoder* . **decode**( types , data ) => *[Result](/v5/api/utils/abi/interface/#Result)*

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -18,7 +18,7 @@ Formats
#### *ethers* . *utils* . *FragmentTypes* . **full** => *string*
This is a full human-readable string, including all parameter names, any optional modifiers (e.g. `indexed`, `public`, etc) and white-space to aid in human readabiliy.
This is a full human-readable string, including all parameter names, any optional modifiers (e.g. `indexed`, `public`, etc) and white-space to aid in human readability.
#### *ethers* . *utils* . *FragmentTypes* . **minimal** => *string*
@ -64,7 +64,7 @@ This is a string which indicates the type of the [Fragment](/v5/api/utils/abi/fr
#### *fragment* . **inputs** => *Array< [ParamType](/v5/api/utils/abi/fragments/#ParamType) >*
This is an array of of each [ParamType](/v5/api/utils/abi/fragments/#ParamType) for the input parameters to the Constructor, Event of Function.
This is an array of each [ParamType](/v5/api/utils/abi/fragments/#ParamType) for the input parameters to the Constructor, Event of Function.
### Methods
@ -204,12 +204,12 @@ Whether the parameter has been marked as indexed. This **only** applies to param
#### *paramType* . **arrayChildren** => *[ParamType](/v5/api/utils/abi/fragments/#ParamType)*
The type of children of the array. This is null for for any parameter wjhich is not an array.
The type of children of the array. This is null for any parameter which is not an array.
#### *paramType* . **arrayLength** => *number*
The length of the array, or `-1` for dynamic-length arrays. This is null for parameters which is not arrays.
The length of the array, or `-1` for dynamic-length arrays. This is null for parameters which are not arrays.
#### *paramType* . **components** => *Array< [ParamType](/v5/api/utils/abi/fragments/#ParamType) >*

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -85,7 +85,7 @@ BigNumber.from(42n)
// Numbers outside the safe range fail:
BigNumber.from(Number.MAX_SAFE_INTEGER);
// Error: overflow (fault="overflow", operation="BigNumber.from", value=9007199254740991, code=NUMERIC_FAULT, version=bignumber/5.0.6)
// Error: overflow (fault="overflow", operation="BigNumber.from", value=9007199254740991, code=NUMERIC_FAULT, version=bignumber/5.0.11)
```
Methods
@ -133,16 +133,16 @@ Returns a BigNumber with the absolute value of *BigNumber*.
Returns a BigNumber with the value of *BigNumber* with bits beyond the *bitcount* least significant bits set to zero.
### Two's Compliment
### Two's Complement
#### *BigNumber* . **fromTwos**( bitwidth ) => *[BigNumber](/v5/api/utils/bignumber/)*
Returns a BigNumber with the value of *BigNumber* converted from twos-compliment with *bitwidth*.
Returns a BigNumber with the value of *BigNumber* converted from twos-complement with *bitwidth*.
#### *BigNumber* . **toTwos**( bitwidth ) => *[BigNumber](/v5/api/utils/bignumber/)*
Returns a BigNumber with the value of *BigNumber* converted to twos-compliment with *bitwidth*.
Returns a BigNumber with the value of *BigNumber* converted to twos-complement with *bitwidth*.
### Comparison and Equivalence
@ -198,7 +198,7 @@ Returns the value of *BigNumber* as a base-16, `0x`-prefixed [DataHexString](/v5
### Inspection
#### *ethers* . *BigNumnber* . **isBigNumber**( object ) => *boolean*
#### *ethers* . *BigNumber* . **isBigNumber**( object ) => *boolean*
Returns true if and only if the *object* is a BigNumber object.

File diff suppressed because one or more lines are too long

View File

@ -101,7 +101,7 @@ Returns a Uint8Array with all leading `0` bytes of *aBtyesLike* removed.
#### *ethers* . *utils* . **zeroPad**( aBytesLike , length ) => *Uint8Array*
Retutns a Uint8Array of the data in *aBytesLike* with `0` bytes prepended to *length* bytes long.
Returns a Uint8Array of the data in *aBytesLike* with `0` bytes prepended to *length* bytes long.
If *aBytesLike* is already longer than *length* bytes long, an InvalidArgument error will be thrown.
@ -164,20 +164,20 @@ Return a copy of *array* shuffled using [Fisher-Yates Shuffle](https://en.wikipe
```javascript
utils.randomBytes(8)
// Uint8Array [ 98, 93, 74, 126, 111, 146, 146, 3 ]
// Uint8Array [ 82, 221, 254, 37, 192, 138, 147, 109 ]
const data = [ 1, 2, 3, 4, 5, 6, 7 ];
// Returns a new Array
utils.shuffled(data);
// [
// 5,
// 2,
// 6,
// 1,
// 4,
// 5,
// 3,
// 2,
// 7,
// 3
// 4,
// 1
// ]
// 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

View File

@ -40,7 +40,7 @@ Recursive-Length Prefix
Encode a structured Data Object into its RLP-encoded representation.
Each Data component may be an valid [BytesLike](/v5/api/utils/bytes/#BytesLike).
Each Data component may be a valid [BytesLike](/v5/api/utils/bytes/#BytesLike).
#### *ethers* . *utils* . *RLP* . **decode**( aBytesLike ) => *[DataObject](/v5/api/utils/encoding/#rlp--dataobject)*

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -12,7 +12,7 @@ Cryptographic Hash Functions
#### *ethers* . *utils* . **id**( text ) => *string< [DataHexString](/v5/api/utils/bytes/#DataHexString)< 32 > >*
The Ethereum Identity function computs the [KECCAK256](https://en.wikipedia.org/wiki/SHA-3) hash of the *text* bytes.
The Ethereum Identity function computes the [KECCAK256](https://en.wikipedia.org/wiki/SHA-3) hash of the *text* bytes.
#### *ethers* . *utils* . **keccak256**( aBytesLike ) => *string< [DataHexString](/v5/api/utils/bytes/#DataHexString)< 32 > >*
@ -52,7 +52,7 @@ utils.keccak256("0x1234")
// Do NOT use UTF-8 strings that are not a DataHexstring
utils.keccak256("hello world")
// Error: invalid arrayify value (argument="value", value="hello world", code=INVALID_ARGUMENT, version=bytes/5.0.4)
// Error: invalid arrayify value (argument="value", value="hello world", code=INVALID_ARGUMENT, version=bytes/5.0.6)
// If needed, convert strings to bytes first:
utils.keccak256(utils.toUtf8Bytes("hello world"))
@ -77,7 +77,7 @@ utils.keccak256("0x1234")
utils.keccak256([ 0x12, 0x34 ])
// '0x56570de287d73cd1cb6092bb8fdee6173974955fdef345ae579ee9f475ea7432'
const bytes = utils.toUtf8Bytes("0x1234");
const bytes = utils.toUtf8Bytes("0x1234")
// Uint8Array [ 48, 120, 49, 50, 51, 52 ]
// Hash of SIX (6) characters (different than above)
@ -132,8 +132,8 @@ Use the [SHA2-512](https://en.wikipedia.org/wiki/SHA-2) hash algorithm.
```javascript
const key = "0x0102";
const data = "0x1234";
const key = "0x0102"
const data = "0x1234"
utils.computeHmac("sha256", key, data)
// '0x7553df81c628815cf569696cad13a37c606c5058df13d9dff4fee2cf5e9b5779'
```
@ -146,15 +146,41 @@ Hashing Helpers
Computes the [EIP-191](https://eips.ethereum.org/EIPS/eip-191) personal message digest of *message*. Personal messages are converted to UTF-8 bytes and prefixed with `\x19Ethereum Signed Message:` and the length of *message*.
```javascript
// Hashing a string message
utils.hashMessage("Hello World")
// '0xa1de988600a42c4b4ab089b619297c17d53cffae5d5120d82d8a92d0bb3b78f2'
// Hashing binary data (also "Hello World", but as bytes)
utils.hashMessage( [ 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100 ])
// '0xa1de988600a42c4b4ab089b619297c17d53cffae5d5120d82d8a92d0bb3b78f2'
// NOTE: It is important to understand how strings and binary
// data is handled differently. A string is ALWAYS processed
// as the bytes of the string, so a hexstring MUST be
// converted to an ArrayLike object first.
// Hashing a hex string is the same as hashing a STRING
// Note: this is the hash of the 4 characters [ '0', 'x', '4', '2' ]
utils.hashMessage("0x42")
// '0xf0d544d6e4a96e1c08adc3efabe2fcb9ec5e28db1ad6c33ace880ba354ab0fce'
// Hashing the binary data
// Note: this is the hash of the 1 byte [ 0x42 ]
utils.hashMessage([ 0x42 ])
// '0xd18c12b87124f9ceb7e1d3a5d06a5ac92ecab15931417e8d1558d9a263f99d63'
// Hashing the binary data
// Note: similarly, this is the hash of the 1 byte [ 0x42 ]
utils.hashMessage(utils.arrayify("0x42"))
// '0xd18c12b87124f9ceb7e1d3a5d06a5ac92ecab15931417e8d1558d9a263f99d63'
```
#### *ethers* . *utils* . **namehash**( name ) => *string< [DataHexString](/v5/api/utils/bytes/#DataHexString)< 32 > >*
Returns the [ENS Namehash](https://docs.ens.domains/contract-api-reference/name-processing#hashing-names) of *name*.
```javascript
// @TODO: include examples of hashMessage; it can be complex. :)
```
```javascript
utils.namehash("")
// '0x0000000000000000000000000000000000000000000000000000000000000000'
@ -169,12 +195,154 @@ utils.namehash("ricmoo.xyz")
// '0x7d56aa46358ba2f8b77d8e05bcabdd2358370dcf34e87810f8cea77ecb3fc57d'
```
### Typed Data Encoder
#### Experimental Feature (this exported class name will change)
This is still an experimental feature. If using it, please specify the **exact** version of ethers you are using (e.g. spcify `"5.0.18"`, **not** `"^5.0.18"`) as the exported class name will be renamed from `_TypedDataEncoder` to `TypedDataEncoder` once it has been used in the field a bit.
#### *ethers* . *utils* . *_TypedDataEncoder* . **from**( types ) => *[TypedDataEncoder]*
Creates a new **TypedDataEncoder** for *types*. This object is a fairly low-level object that most developers should not require using instances directly.
Most developers will find the static class methods below the most useful.
#### *TypedDataEncoder* . **encode**( domain , types , values ) => *string*
Encodes the Returns the hashed [EIP-712](https://eips.ethereum.org/EIPS/eip-712) domain.
#### *TypedDataEncoder* . **getPayload**( domain , types , value ) => *any*
Returns the standard payload used by various JSON-RPC `eth_signTypedData*` calls.
All domain values and entries in value are normalized and the types are verified.
#### *TypedDataEncoder* . **getPrimaryType**( types ) => *string*
Constructs a directed acyclic graph of the types and returns the root type, which can be used as the **primaryType** for [EIP-712](https://eips.ethereum.org/EIPS/eip-712) payloads.
#### *TypedDataEncoder* . **hash**( domain , types , values ) => *string< [DataHexString](/v5/api/utils/bytes/#DataHexString)< 32 > >*
Returns the computed [EIP-712](https://eips.ethereum.org/EIPS/eip-712) hash.
#### *TypedDataEncoder* . **hashDomain**( domain ) => *string< [DataHexString](/v5/api/utils/bytes/#DataHexString)< 32 > >*
Returns the hashed [EIP-712](https://eips.ethereum.org/EIPS/eip-712) domain.
#### *TypedDataEncoder* . **resolveNames**( domain , types , value , resolveName ) => *Promise< any >*
Returns a copy of value, where any leaf value with a type of `address` will have been recursively replacedwith the value of calling *resolveName* with that value.
```javascript
const domain = {
name: 'Ether Mail',
version: '1',
chainId: 1,
verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC'
}
// The named list of all type definitions
const types = {
Person: [
{ name: 'name', type: 'string' },
{ name: 'wallet', type: 'address' }
],
Mail: [
{ name: 'from', type: 'Person' },
{ name: 'to', type: 'Person' },
{ name: 'contents', type: 'string' }
]
}
// The data to sign
const value = {
from: {
name: 'Cow',
wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826'
},
to: {
name: 'Bob',
wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB'
},
contents: 'Hello, Bob!'
}
TypedDataEncoder.encode(domain, types, value)
// '0x1901f2cee375fa42b42143804025fc449deafd50cc031ca257e0b194a650a912090fc52c0ee5d84264471806290a3f2c4cecfc5490626bf912d01f240d7a274b371e'
TypedDataEncoder.getPayload(domain, types, value)
// {
// domain: {
// chainId: '1',
// name: 'Ether Mail',
// verifyingContract: '0xcccccccccccccccccccccccccccccccccccccccc',
// version: '1'
// },
// message: {
// contents: 'Hello, Bob!',
// from: {
// name: 'Cow',
// wallet: '0xcd2a3d9f938e13cd947ec05abc7fe734df8dd826'
// },
// to: {
// name: 'Bob',
// wallet: '0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'
// }
// },
// primaryType: 'Mail',
// types: {
// Mail: [
// {
// name: 'from',
// type: 'Person'
// },
// {
// name: 'to',
// type: 'Person'
// },
// {
// name: 'contents',
// type: 'string'
// }
// ],
// Person: [
// {
// name: 'name',
// type: 'string'
// },
// {
// name: 'wallet',
// type: 'address'
// }
// ]
// }
// }
TypedDataEncoder.getPrimaryType(types)
// 'Mail'
TypedDataEncoder.hash(domain, types, value)
// '0xbe609aee343fb3c4b28e1df9e632fca64fcfaede20f02e86244efddf30957bd2'
TypedDataEncoder.hashDomain(domain)
// '0xf2cee375fa42b42143804025fc449deafd50cc031ca257e0b194a650a912090f'
```
Solidity Hashing Algorithms
---------------------------
#### *ethers* . *utils* . **solidityPack**( types , values ) => *string< [DataHexString](/v5/api/utils/bytes/#DataHexString) >*
Returns the non-standard encoded *values* packed according to their respecive type in *types*.
Returns the non-standard encoded *values* packed according to their respective type in *types*.
#### *ethers* . *utils* . **solidityKeccak256**( types , values ) => *string< [DataHexString](/v5/api/utils/bytes/#DataHexString)< 32 > >*
@ -199,5 +367,23 @@ utils.solidityKeccak256([ "int16", "uint48" ], [ -1, 12 ])
utils.soliditySha256([ "int16", "uint48" ], [ -1, 12 ])
// '0xa5580fb602f6e2ba9c588011dc4e6c2335e0f5d970dc45869db8f217efc6911a'
// As a short example of the non-distinguished nature of
// Solidity tight-packing (which is why it is inappropriate
// for many things from a security point of view), consider
// the following examples are all equal, despite representing
// very different values and layouts.
utils.solidityPack([ "string", "string" ], [ "hello", "world01" ])
// '0x68656c6c6f776f726c643031'
utils.solidityPack([ "string", "string" ], [ "helloworld", "01" ])
// '0x68656c6c6f776f726c643031'
utils.solidityPack([ "string", "string", "uint16" ], [ "hell", "oworld", 0x3031 ])
// '0x68656c6c6f776f726c643031'
utils.solidityPack([ "uint96" ], [ "32309054545061485574011236401" ])
// '0x68656c6c6f776f726c643031'
```

File diff suppressed because one or more lines are too long

View File

@ -125,7 +125,7 @@ A serialized string representation of this HDNode. Not all properties are includ
#### *hdNode* . **neuter**( ) => *[HDNode](/v5/api/utils/hdnode/#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.
Return a new instance of *hdNode* with its private key removed but all other 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](/v5/api/utils/hdnode/#HDNode)*

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -58,10 +58,10 @@ Throw an [INVALID_ARGUMENT](/v5/api/utils/logger/#errors-InvalidArgument) Error
#### *logger* . **checkAbstract**( target , kind ) => *void*
Checks that *target* is not *kind* and performs the same operatons as `checkNew`. This is useful for ensuring abstract classes are not being instantiated.
Checks that *target* is not *kind* and performs the same operations as `checkNew`. This is useful for ensuring abstract classes are not being instantiated.
#### *logger* . **checkArgumentCount**( count , expectedCound [ , 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.
@ -215,7 +215,7 @@ Log all output, including debugging information.
#### *Logger* . *levels* . **INFO**
Only log output for infomational, warnings and errors.
Only log output for informational, warnings and errors.
#### *Logger* . *levels* . **WARNING**

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -19,12 +19,12 @@ The private key for this Signing Key.
#### *signingKey* . **publicKey** => *string< [DataHexString](/v5/api/utils/bytes/#DataHexString)< 65 > >*
The uncompressed public key for this Signing Key. It will always be 65 bytes (130 nibbles) and begine with `0x04`.
The uncompressed public key for this Signing Key. It will always be 65 bytes (130 nibbles) and begins with `0x04`.
#### *signingKey* . **compressedPublicKey** => *string< [DataHexString](/v5/api/utils/bytes/#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`.
The compressed public key for this Signing Key. It will always be 33 bytes (66 nibbles) and begins with either `0x02` or `0x03`.
#### *signingKey* . **signDigest**( digest ) => *[Signature](/v5/api/utils/bytes/#Signature)*
@ -52,8 +52,14 @@ Other Functions
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)) to be used since the v parameter is still completely non-ambiguous.
#### *ethers* . *utils* . **verifyTypedData**( domain , types , value , signature ) => *string< [Address](/v5/api/utils/address/#address) >*
Returns the address that signed the [EIP-712](https://eips.ethereum.org/EIPS/eip-712) *value* for the *domain* and *types* to produce the signature.
#### *ethers* . *utils* . **recoverPublicKey**( digest , signature ) => *string< [DataHexString](/v5/api/utils/bytes/#DataHexString)< 65 > >*
Returns the uncompressed public key (i.e. the first byte will be `0x04`) of the private key that was used to sign *digest* which gave the *signature*.
#### *ethers* . *utils* . **computePublicKey**( key [ , compressed = false ] ) => *string< [DataHexString](/v5/api/utils/bytes/#DataHexString) >*

File diff suppressed because one or more lines are too long

View File

@ -40,7 +40,7 @@ Returns the Array of codepoints of *text*, optionally normalized using the [Unic
#### Note
This function correctly splits each **user-perceived character** into its codepoint, accounting for surrogate pairs. This should not be confused with `string.split("")`, which destroys surrogate pairs, spliting between each UTF-16 codeunit instead.
This function correctly splits each **user-perceived character** into its codepoint, accounting for surrogate pairs. This should not be confused with `string.split("")`, which destroys surrogate pairs, splitting between each UTF-16 codeunit instead.
#### *ethers* . *utils* . **toUtf8String**( aBytesLike [ , onError = error ] ) => *string*
@ -86,7 +86,7 @@ The Decomposed Normalization Form with Canonical Equivalence. See NFKC for more
#### Note
Only certain specified characters are folded in Canonical Equivalence, and thus it should **not** be considered a method to acheive *any* level of security from [homoglyph attacks](https://en.wikipedia.org/wiki/IDN_homograph_attack).
Only certain specified characters are folded in Canonical Equivalence, and thus it should **not** be considered a method to achieve *any* level of security from [homoglyph attacks](https://en.wikipedia.org/wiki/IDN_homograph_attack).
Custom UTF-8 Error Handling

File diff suppressed because one or more lines are too long

View File

@ -14,7 +14,7 @@ Types
#### *unsignedTransaction* . **to** => *string< [Address](/v5/api/utils/address/#address) >*
The addres this transaction is to.
The address this transaction is to.
#### *unsignedTransaction* . **nonce** => *number*
@ -71,7 +71,7 @@ The nonce for *transaction*. Each transaction sent to the network from an accoun
#### *transaction* . **gasLimit** => *[BigNumber](/v5/api/utils/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.
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 transaction are reverted, but the gas is **fully consumed** and an out-of-gas error occurs.
#### *transaction* . **gasPrice** => *[BigNumber](/v5/api/utils/bignumber/)*
@ -118,7 +118,7 @@ Functions
#### *ethers* . *utils* . **parseTransaction**( aBytesLike ) => *[Transaction](/v5/api/utils/transactions/#Transaction)*
Parses the transaction properties from a serialized transactions.
Parses the transaction properties from a serialized transaction.
#### *ethers* . *utils* . **serializeTransaction**( tx [ , signature ] ) => *string< [DataHexString](/v5/api/utils/bytes/#DataHexString) >*

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ 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.
Fetch and parse the JSON content from *urlOrConnectionInfo*, with the optional body *json* and optionally processing the result with *processFun* before returning it.
#### *ethers* . *utils* . **poll**( pollFunc [ , options ] ) => *Promise< any >*
@ -53,7 +53,7 @@ Additional headers to include in the connection.
#### *options* . **timeout** => *number*
The amount of time allowed to ellapse before triggering a timeout error.
The amount of time allowed to elapse before triggering a timeout error.
#### *options* . **floor** => *number*

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -33,7 +33,7 @@ Example Input Files
```
; SimpleStore (uint)
; Set the inital value of 42
; Set the initial value of 42
sstore(0, 42)
; Init code to deploy myContract
@ -132,7 +132,7 @@ When a program is assembled, the labels are usually given as an absolute byte po
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.
This does incur an additional gas cost of 8 gas per offset access though.
#### **--target LABEL**

File diff suppressed because one or more lines are too long

View File

@ -69,7 +69,7 @@ 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
--yes Always accept Signing and Sending
OTHER OPTIONS
--wait Wait until transactions are mined

File diff suppressed because one or more lines are too long

View File

@ -65,7 +65,7 @@ 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
--yes Always accept Signing and Sending
OTHER OPTIONS
--wait Wait until transactions are mined

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -17,7 +17,7 @@ Add a *plugin* class for the *command*. After all options and flags have been co
#### **setPlugin**( pluginClass ) => *void*
Set a dedicated [Plugin](/v5/cli/plugin/#cli-plugin) class which will handle all input. This may not be used in conjuction with addPlugin and will not automatically accept a command from the arguments.
Set a dedicated [Plugin](/v5/cli/plugin/#cli-plugin) class which will handle all input. This may not be used in conjunction with addPlugin and will not automatically accept a command from the arguments.
#### **showUsage**( [ message = "" [ , status = 0 ] ] ) => *never*
@ -79,7 +79,7 @@ The initial nonce for the account this plugin should use.
#### *plugin* . **getAddress**( addressOrName [ , message = "" , [ allowZero = false ] ] ) => *Promise< string >*
A plugin should use this method to resolve an address. If the resovled address is the zero address and *allowZero* is not true, an error is raised.
A plugin should use this method to resolve an address. If the resolved address is the zero address and *allowZero* is not true, an error is raised.
#### *plugin* . **dump**( header , info ) => *void*
@ -89,7 +89,7 @@ Dumps the contents of *info* to the console with a *header* in a nicely formatte
#### *plugin* . **throwUsageError**( [ message = "" ] ) => *never*
Stops exectuion of the plugin and shows the help screen of the plugin with the optional *message*.
Stops execution of the plugin and shows the help screen of the plugin with the optional *message*.
#### *plugin* . **throwError**( message ) => *never*
@ -128,7 +128,7 @@ ArgParser
Flags are simple binary options (such as the `--yes`), which are true if present otherwise false.
Options require a single parameter follow them on the command line (such as `--account wallet.json`, which nhas the name `account` and the value `wallet.json`)
Options require a single parameter follow them on the command line (such as `--account wallet.json`, which has the name `account` and the value `wallet.json`)
Arguments are all other values on the command line, and are not accessed through the **ArgParser** directly.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -15,4 +15,6 @@ Ethereum Basics
* [Gas Limit](gas)
* [Security](security)
* [Key Derivation Functions](security)
* [Best Practices](best-practices)
* [Network Changes](best-practices)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -25,3 +25,14 @@ import { ethers } from "ethers";
Security
--------
```
// Import the crypto getRandomValues shim (**BEFORE** the shims)
import "react-native-get-random-values"
// Import the the ethers shims (**BEFORE** ethers)
import "@ethersproject/shims"
// Import the ethers library
import { ethers } from "ethers";
```

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -38,7 +38,7 @@ import { ethers } from "ethers";
```
<script src="https://cdn.ethers.io/lib/ethers-5.0.umd.min.js"
type="application/javascipt"></script>
type="application/javascript"></script>
```
Common Terminology
@ -81,7 +81,7 @@ const signer = provider.getSigner()
```javascript
// Look up the current block number
provider.getBlockNumber()
// { Promise: 10819010 }
// { Promise: 11312227 }
// Get the balance of an account (by address or ENS name, if supported by network)
balance = await provider.getBalance("ethers.eth")
@ -143,17 +143,17 @@ const daiContract = new ethers.Contract(daiAddress, daiAbi, provider);
daiContract.name()
// { Promise: 'Dai Stablecoin' }
// Get the ERC-20 token synbol (for tickers and UIs)
// Get the ERC-20 token symbol (for tickers and UIs)
daiContract.symbol()
// { Promise: 'DAI' }
// Get the balance of an address
balance = await daiContract.balanceOf("ricmoo.firefly.eth")
// { BigNumber: "11386855832278858351495" }
// { BigNumber: "15923148775162018481031" }
// Format the DAI for displaying to the user
ethers.utils.formatUnits(balance, 18)
// '11386.855832278858351495'
// '15923.148775162018481031'
```
### State Changing Methods
@ -308,7 +308,7 @@ Signing Messages
// logging into a service, such as CryptoKitties,
// pass the string in.
signature = await signer.signMessage("Hello World");
// '0x94fac815fc18f295c4860128d8960dfdb1d88acf891a48e345368f3f4d52c95e59d0f8b35d05d554905a39c63c11b66f61abf0211fcaba36bef5dfaf1ea5f1331c'
// '0xc2c9a0db8e9ae4266d6aa1974b36efabd8e270452587857922c5fd696838a22b6dd8f0536c24a73c0df512eefac68bc118fb91b10640fcc576e44a57bc024ca31b'
//
// 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
signature = await signer.signMessage(messageBytes)
// '0xa77f9018a3ad3078056d529d5ccaca8796cdb5bc84e799d13b63a53646ab73f87f0895df7bbe2ee6016c95eb78a2e77013ab8f8d4855143d3567932cb5331e881c'
// '0x66b35b262989bc88c5c5c1fadcd8bcd5ae410cdae06abf33ce2c3c98a04d4e892fd2f61717a46f81372146019c2e95646a6cfc3a7ae74e78338f40d905fa69fc1b'
```

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

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