docs: updates and fixes (#1122).
This commit is contained in:
parent
95e2871966
commit
34488cd7d8
@ -10,7 +10,7 @@ permissions.
|
||||
The ethers library offers default API keys for each service, so that each
|
||||
[[Provider]] works out-of-the-box.
|
||||
|
||||
These API keys are a provided as a community resource by the backend services
|
||||
These API keys are provided as a community resource by the backend services
|
||||
for low-traffic projects and for early prototyping.
|
||||
|
||||
Since these API keys are shared by all users (that have not acquired their
|
||||
@ -43,7 +43,7 @@ operations required to interact with the Ethereum Blockchain.
|
||||
_subsection: INFURA @<api-keys--infura>
|
||||
|
||||
The INFURA service has been around for quite some time and is very robust
|
||||
and reliable and highly recommend.
|
||||
and reliable and highly recommended.
|
||||
|
||||
They offer a standard JSON-RPC interface and a WebSocket interface, which makes
|
||||
interaction with standard tools versatile, simple and straight forward.
|
||||
@ -74,6 +74,18 @@ with debugging.
|
||||
- access to advanced token balance and metadata APIs
|
||||
- access to advanced debugging trace and revert reason APIs
|
||||
|
||||
_subsection: Pocket Gateway@<api-keys--pocket-gateway>
|
||||
|
||||
|
||||
[Sign up for a free API key on Pocket](link-pocket-signup)
|
||||
|
||||
**Benefits:**
|
||||
|
||||
- customer usage metrics
|
||||
- decentralized Access to Blockchain Infrastructure
|
||||
- Stake as opposed to paying a monthly fee
|
||||
- Highly redundant global set of nodes incentivized by cryptoeconomic incentives
|
||||
|
||||
|
||||
_subsection: Creating a Default Provider @<api-keys--getDefaultProvider>
|
||||
|
||||
@ -99,5 +111,16 @@ 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:
|
||||
// }
|
||||
});
|
||||
|
@ -26,7 +26,7 @@ _property: contractFactory.attach(address) => [[Contract]] @<ContractFactory-att
|
||||
|
||||
Return an instance of a [[Contract]] attached to //address//. This is the
|
||||
same as using the [Contract constructor](Contract--creating) with
|
||||
//address// and this the the //interface// and //signerOrProvider// passed
|
||||
//address// and this the //interface// and //signerOrProvider// passed
|
||||
in when creating the ContractFactory.
|
||||
|
||||
_property: contractFactory.getDeployTransaction(...args) => [[UnsignedTransaction]]
|
||||
|
@ -55,11 +55,11 @@ The provider associated with the signer.
|
||||
_property: nonceManager.setTransactionCount(count) => void
|
||||
Set the current transaction count (nonce) for the signer.
|
||||
|
||||
This may be useful it interacting with the signer outside of using
|
||||
This may be useful in interacting with the signer outside of using
|
||||
this class.
|
||||
|
||||
_property: 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 may be useful in interacting with the signer outside of using
|
||||
this class.
|
||||
|
@ -57,7 +57,7 @@ _heading: PopNode @<asm-popnode> @INHERIT<[[asm-valuenode]]> @SRC<asm:class.PopN
|
||||
|
||||
A **PopNode** is used to store a place-holder for an implicit pop from the
|
||||
stack. It represents the code for an implicit place-holder (i.e. ``$$``) or an
|
||||
explicit place-holder (e.g. ``$1``), which indicates the expect stack position
|
||||
explicit place-holder (e.g. ``$1``), which indicates the expected stack position
|
||||
to consume.
|
||||
|
||||
_property: literalNode.index => number
|
||||
@ -72,7 +72,7 @@ A **LinkNode** represents a link to another [[asm-node]]'s data,
|
||||
for example ``$foo`` or ``#bar``.
|
||||
|
||||
_property: linkNode.label => string
|
||||
Te name of the target node.
|
||||
The name of the target node.
|
||||
|
||||
_property: linkNode.type => "offset" | "length"
|
||||
Whether this node is for an offset or a length value of the
|
||||
@ -115,7 +115,7 @@ The code to execute. Any result is ignored.
|
||||
_heading: LabelledNode @<asm-labellednode> @INHERIT<[[asm-node]]> @SRC<asm:class.LabelledNode>
|
||||
|
||||
A **LabelledNode** is used for any Node that has a name, and can therefore
|
||||
be targetted by a [[asm-linknode]].
|
||||
be targeted by a [[asm-linknode]].
|
||||
|
||||
_property: labelledNode.name => string
|
||||
The name of this node.
|
||||
|
@ -76,7 +76,7 @@ A scope may access the offset of any child [[asm-dialect-datasegment]] or
|
||||
child [[asm-dialect-scope]] (with respect to itself) and may access the length
|
||||
of any [[asm-dialect-datasegment]] or [[asm-dialect-scope]] anywhere in the program.
|
||||
|
||||
Every program in the **Ethers ASM Dialect** has a top-leve scope named ``_``.
|
||||
Every program in the **Ethers ASM Dialect** has a top-level scope named ``_``.
|
||||
|
||||
|
||||
_subsection: Data Segment @<asm-dialect-datasegment>
|
||||
|
@ -6,7 +6,7 @@ to them, which simplifies development, since you do not need
|
||||
to run your own instance or cluster of Ethereum nodes.
|
||||
|
||||
However, this reliance on third-party services can reduce
|
||||
resiliance, security and increase the amount of required trust.
|
||||
resilience, security and increase the amount of required trust.
|
||||
To mitigate these issues, it is recommended you use a
|
||||
[Default Provider](providers-getDefaultProvider).
|
||||
|
||||
@ -20,7 +20,7 @@ _property: new ethers.providers.EtherscanProvider([ network = "homestead", [ api
|
||||
Create a new **EtherscanProvider** connected to //network// with the
|
||||
optional //apiKey//.
|
||||
|
||||
The //network// may be specified as **string** for a common
|
||||
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).
|
||||
|
||||
@ -86,7 +86,7 @@ _property: new ethers.providers.InfuraProvider([ network = "homestead", [ apiKey
|
||||
Create a new **InfuraProvider** connected to //network// with
|
||||
the optional //apiKey//.
|
||||
|
||||
The //network// may be specified as **string** for a common
|
||||
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).
|
||||
|
||||
@ -157,7 +157,7 @@ _property: new ethers.providers.AlchemyProvider([ network = "homestead", [ apiKe
|
||||
Create a new **AlchemyProvider** connected to //network// with
|
||||
the optional //apiKey//.
|
||||
|
||||
The //network// may be specified as **string** for a common
|
||||
The //network// may be specified as a **string** for a common
|
||||
network name, a **number** for a common chain ID or a
|
||||
[Network Object](providers-Network).
|
||||
|
||||
|
@ -20,7 +20,7 @@ for use in production.
|
||||
|
||||
It creates a [[FallbackProvider]] connected to as many backend
|
||||
services as possible. When a request is made, it is sent to
|
||||
multiple backends simulatenously. As responses from each backend
|
||||
multiple backends simultaneously. As responses from each backend
|
||||
are returned, they are checked that they agree. Once a quorum
|
||||
has been reached (i.e. enough of the backends agree), the response
|
||||
is provided to your application.
|
||||
@ -31,7 +31,7 @@ responses that match the majority.
|
||||
|
||||
_property: ethers.getDefaultProvider([ network, [ options ] ]) => [[Provider]]
|
||||
Returns a new Provider, backed by multiple services, connected
|
||||
to //network//. Is no //network// is provided, **homestead**
|
||||
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``
|
||||
@ -43,20 +43,22 @@ _table: Option Properties
|
||||
|
||||
$Alchemy: [[link-alchemy]] API Token
|
||||
$Etherscan: [[link-etherscan]] API Token
|
||||
$Infura: [[link-infura]] Project ID or ProjectID and Project Secret
|
||||
$Infura: [[link-infura]] Project ID or ``{ projectId, projectSecret }``
|
||||
$Pocket: [[link-pocket]] Application ID or ``{ applicationId, applicationSecretKey }``
|
||||
$Quorum: The number of backends that must agree
|
||||
//(default: 2 for mainnet, 1 for testnets)//
|
||||
|
||||
|
||||
| **Property** | **Description** |
|
||||
| //alchemy// | $Alchemy |
|
||||
| //etherscan// | $Etherscan |
|
||||
| //infura// | $Infura |
|
||||
| //pocket// | $Pocket |
|
||||
| //quorum// | $Quorum |
|
||||
|
||||
_note: 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
|
||||
|
@ -41,7 +41,7 @@ The provider for this configuration.
|
||||
|
||||
_property: fallbackProviderConfig.priority => number
|
||||
The priority used for the provider. Higher priorities are favoured over lower
|
||||
priorities. If multiple providers share the same prioirty, they are chosen
|
||||
priorities. If multiple providers share the same priority, they are chosen
|
||||
at random.
|
||||
|
||||
_property: fallbackProviderConfig.stallTimeout => number
|
||||
@ -152,7 +152,7 @@ which allows for a persistent connection, multiplexing requests and pub-sub
|
||||
events for a more immediate event dispatching.
|
||||
|
||||
The WebSocket API is newer, and if running your own infrastructure, note that
|
||||
WebSockets are much more intensive on your server resourses, as they must manage
|
||||
WebSockets are much more intensive on your server resources, as they must manage
|
||||
and maintain the state for each client. For this reason, many services may also
|
||||
charge additional fees for using their WebSocket endpoints.
|
||||
|
||||
|
@ -146,7 +146,7 @@ _subsection: Transactions Methods @<Provider--transaction-methods>
|
||||
_property: provider.call(transaction [ , blockTag = latest ]) => Promise<string<[[DataHexString]]>> @<Provider-call> @SRC<providers/base-provider>
|
||||
Returns the result of executing the //transaction//, using //call//. A call
|
||||
does not require any ether, but cannot change any state. This is useful
|
||||
for calling gettings on Contracts.
|
||||
for calling getters on Contracts.
|
||||
|
||||
_property: provider.estimateGas(transaction) => Promise<[[BigNumber]]> @<Provider-estimateGas> @SRC<providers/base-provider>
|
||||
Returns an estimate of the amount of gas that would be required to submit //transaction//
|
||||
@ -174,7 +174,7 @@ Add a //listener// to be triggered for each //eventName//.
|
||||
|
||||
_property: provider.once(eventName, listener) => this @<Provider-once> @SRC<providers/base-provider>
|
||||
Add a //listener// to be triggered for only the next //eventName//,
|
||||
at which time it be removed.
|
||||
at which time it will be removed.
|
||||
|
||||
_property: provider.emit(eventName, ...args) => boolean @<Provider-emit> @SRC<providers/base-provider>
|
||||
Notify all listeners of //eventName//, passing //args// to each listener. This
|
||||
|
@ -59,19 +59,19 @@ The timestamp of this block.
|
||||
_property: block.nonce => string<[[DataHexString]]>
|
||||
The nonce used as part of the proof-of-work to mine this block.
|
||||
|
||||
This property is generally of little interest developers.
|
||||
This property is generally of little interest to developers.
|
||||
|
||||
_property: block.difficulty => number
|
||||
The difficulty target required to be met by the miner of the block.
|
||||
|
||||
This property is generally of little interest developers.
|
||||
This property is generally of little interest to developers.
|
||||
|
||||
_property: block.gasLimit => [[BigNumber]]
|
||||
The maximum amount of gas that this block was permitted to use. This
|
||||
is a value that can be voted up or voted down by miners and is used
|
||||
to automatically adjust the bandwidth requirements of the network.
|
||||
|
||||
This property is generally of little interest developers.
|
||||
This property is generally of little interest to developers.
|
||||
|
||||
_property: block.gasUsed => [[BigNumber]]
|
||||
The total amount of gas used by all transactions in this block.
|
||||
@ -83,7 +83,7 @@ miner that mined this block would like the subsidy reward to go to.
|
||||
_property: block.extraData => string
|
||||
This is extra data a miner may choose to include when mining a block.
|
||||
|
||||
This property is generally of little interest developers.
|
||||
This property is generally of little interest to developers.
|
||||
|
||||
_heading: Block (with transaction hashes)
|
||||
|
||||
@ -238,7 +238,7 @@ Wait for //confirmations//. If 0, and the transaction has not been mined,
|
||||
_heading: TransactionReceipt @<providers-TransactionReceipt>
|
||||
|
||||
_property: receipt.to => string<[[address]]>
|
||||
The address this transaction is to. This is ``null`` if the the
|
||||
The address this transaction is to. This is ``null`` if the
|
||||
transaction was an **init transaction**, used to deploy a contract.
|
||||
|
||||
_property: receipt.from => string<[[address]]>
|
||||
@ -295,7 +295,7 @@ including the actual block it was mined in.
|
||||
|
||||
_property: receipt.cumulativeGasUsed => [[BigNumber]]
|
||||
For the block this transaction was included in, this is the sum of the
|
||||
gas used used by each transaction in the ordered list of transactions
|
||||
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.
|
||||
|
@ -6,7 +6,7 @@ which can be used to sign messages and transactions and send
|
||||
signed transactions to the Ethereum Network to execute state
|
||||
changing operations.
|
||||
|
||||
The available operations depends largely on the sub-class used.
|
||||
The available operations depend largely on the sub-class used.
|
||||
|
||||
For example, a Signer from MetaMask can send transactions and sign
|
||||
messages but cannot sign a transaction (without broadcasting it).
|
||||
@ -20,9 +20,9 @@ The most common Signers you will encounter are:
|
||||
|
||||
_subsection: Signer @<Signer> @SRC<abstract-signer:class.Signer>
|
||||
|
||||
The **Signer** class is abstract and cannot be directly instaniated.
|
||||
The **Signer** class is abstract and cannot be directly instantiated.
|
||||
|
||||
Instead use one of the concreate sub-classes, such as the [[Wallet]],
|
||||
Instead use one of the concrete sub-classes, such as the [[Wallet]],
|
||||
[[VoidSigner]] or [[JsonRpcSigner]].
|
||||
|
||||
_property: signer.connect(provider) => [[Signer]] @<Signer-connect>
|
||||
@ -112,6 +112,63 @@ Sub-classes **must** implement this, however they may throw if sending a
|
||||
transaction is not supported, such as the [[VoidSigner]] or if the
|
||||
Wallet is offline and not connected to a [[Provider]].
|
||||
|
||||
_property: signer._signTypedData(domain, types, value) => Promise<string<[RawSignature](signature-raw)>> @<Signer-signTypedData>
|
||||
|
||||
Signs the typed data //value// with //types// data structure for //domain// using
|
||||
the [[link-eip-712]] specification.
|
||||
|
||||
_warning: 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.
|
||||
|
||||
_code: Typed Data Example @lang<javascript>
|
||||
|
||||
// <hide>
|
||||
signer = new Wallet("0x1234567890123456789012345678901234567890123456789012345678901234");
|
||||
// </hide>
|
||||
|
||||
// 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);
|
||||
//! async signature
|
||||
|
||||
|
||||
_heading: Sub-Classes @<Signer--subclassing>
|
||||
|
||||
It is very important that all important properties of a **Signer** are
|
||||
@ -124,20 +181,20 @@ and libraries make this assumption.
|
||||
A sub-class **must** extend Signer and **must** call ``super()``.
|
||||
|
||||
_property: signer.checkTransaction(transactionRequest) => [[providers-TransactionRequest]] @<Signer-checkTransaction> @SRC<abstract-signer>
|
||||
This is generally not required to be overridden, but may needed to provide
|
||||
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 [[providers-TransactionRequest]] properties
|
||||
The default implementation checks only if valid [[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.
|
||||
|
||||
_property: signer.populateTransaction(transactionRequest) => Promise<[[providers-TransactionRequest]]> @<Signer-populateTransaction> @SRC<abstract-signer>
|
||||
This is generally not required to be overridden, but may needed to provide
|
||||
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
|
||||
@ -193,7 +250,7 @@ _property: wallet.address => string<[[address]]>
|
||||
The address for the account this Wallet represents.
|
||||
|
||||
_property: wallet.provider => [[Provider]]
|
||||
The provider this wallet is connected to, which will ge used for any [[Signer--blockchain-methods]]
|
||||
The provider this wallet is connected to, which will be used for any [[Signer--blockchain-methods]]
|
||||
methods. This can be null.
|
||||
|
||||
_note: Note
|
||||
@ -352,5 +409,5 @@ The privateKey of this EOA
|
||||
_property: eoa.mnemonic => [[Mnemonic]]
|
||||
|
||||
//Optional//. The account HD mnemonic, if it has one and can be
|
||||
determined. Some sources do not encode the mnemonic, such as an
|
||||
determined. Some sources do not encode the mnemonic, such as
|
||||
HD extended keys.
|
||||
|
@ -39,7 +39,7 @@ _subsection: Coding Methods @<AbiCoder--methods>
|
||||
|
||||
_property: abiCoder.encode(types, values) => string<[[DataHexString]]> @<AbiCoder-encode> @SRC<abi/abi-coder>
|
||||
|
||||
Encode the array //values// according the array of //types//, each of which may be a
|
||||
Encode the array //values// according to the array of //types//, each of which may be a
|
||||
string or a [[ParamType]].
|
||||
|
||||
_property: abiCoder.decode(types, data) => [[Result]] @<AbiCoder-decode> @SRC<abi/abi-coder>
|
||||
|
@ -31,7 +31,7 @@ _property: 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.
|
||||
to aid in human readability.
|
||||
|
||||
_property: ethers.utils.FragmentTypes.minimal => string
|
||||
|
||||
@ -81,7 +81,7 @@ will be one of:
|
||||
|
||||
_property: fragment.inputs => Array<[[ParamType]]>
|
||||
|
||||
This is an array of of each [[ParamType]] for the input parameters to
|
||||
This is an array of each [[ParamType]] for the input parameters to
|
||||
the Constructor, Event of Function.
|
||||
|
||||
_heading: Methods
|
||||
@ -211,13 +211,13 @@ to parameters which are part of an [[EventFragment]].
|
||||
|
||||
_property: paramType.arrayChildren => [[ParamType]] @<ParamType-arrayChildren>
|
||||
|
||||
The type of children of the array. This is null for for any parameter
|
||||
The type of children of the array. This is null for any parameter
|
||||
which is not an array.
|
||||
|
||||
_property: paramType.arrayLength => number @<ParamType-arrayLength>
|
||||
|
||||
The length of the array, or ``-1`` for dynamic-length arrays. This is
|
||||
null for parameters which is not arrays.
|
||||
null for parameters which are not arrays.
|
||||
|
||||
_property: paramType.components => Array<[[ParamType]]> @<ParamType-components>
|
||||
|
||||
|
@ -4,7 +4,7 @@ Many operations in Ethereum operation on numbers which are
|
||||
[outside the range of safe values](BigNumber--notes-safenumbers) to use
|
||||
in JavaScript.
|
||||
|
||||
A **BigNumber** is an object which safely allows mathematic operations
|
||||
A **BigNumber** is an object which safely allows mathematical operations
|
||||
on numbers of any magnitude.
|
||||
|
||||
Most operations which need to return a value will return a **BigNumber**
|
||||
@ -126,7 +126,7 @@ _heading: Two's Complement
|
||||
|
||||
[Two's Complement](link-wiki-twoscomplement)
|
||||
is an elegant method used to encode and decode fixed-width signed values
|
||||
while efficiently preserving mathematic operations.
|
||||
while efficiently preserving mathematical operations.
|
||||
Most users will not need to interact with these.
|
||||
|
||||
_property: BigNumber.fromTwos(bitwidth) => [[BigNumber]] @SRC<bignumber>
|
||||
@ -270,7 +270,7 @@ various purposes.
|
||||
|
||||
_heading: Allow us to set a global Big Number library?
|
||||
|
||||
Another comment that comes up frequently is tha desire to specify a
|
||||
Another comment that comes up frequently is the desire to specify a
|
||||
global user-defined Big Number library, which all functions would
|
||||
return.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
_section: Display Logic and Input
|
||||
_section: Display Logic and Input @<display-logic>
|
||||
|
||||
When creating an Application, it is useful to convert between
|
||||
user-friendly strings (usually displaying **ether**) and the
|
||||
@ -17,11 +17,11 @@ The [formatUnits](unit-conversion) will format a [BigNumberish](BigNumberish)
|
||||
into a string, which is useful when displaying a balance.
|
||||
|
||||
|
||||
_subsection: Units
|
||||
_subsection: Units @<display-logic--units>
|
||||
|
||||
_heading: Decimal Count
|
||||
|
||||
A **Unit** can be specified as an number, which indicates the
|
||||
A **Unit** can be specified as a number, which indicates the
|
||||
number of decimal places that should be used.
|
||||
|
||||
**Examples:**
|
||||
@ -29,7 +29,7 @@ number of decimal places that should be used.
|
||||
- 1 ether in wei, has **18** decimal places (i.e. 1 ether represents 10^^18^^ wei)
|
||||
- 1 bitcoin in Satoshi, has **8** decimal places (i.e. 1 bitcoin represents 10^^8^^ satoshi)
|
||||
|
||||
_heading: Named Units
|
||||
_heading: Named Units @<display-logic--named-units>
|
||||
|
||||
There are also several common **Named Units**, in which case their name (as
|
||||
a string) may be used.
|
||||
@ -46,9 +46,9 @@ _table: @STYLE<compact>
|
||||
| //ether// | 18 |
|
||||
|
||||
|
||||
_subsection: Functions
|
||||
_subsection: Functions @<display-logic--functions>
|
||||
|
||||
_heading: Formatting
|
||||
_heading: Formatting @<display-logic--formatting>
|
||||
|
||||
_property: ethers.utils.commify(value) => string @<utils-commify> @SRC<units>
|
||||
Returns a string with value grouped by 3 digits, separated by ``,``.
|
||||
|
@ -28,7 +28,7 @@ structures of Arrays and data.
|
||||
_property: ethers.utils.RLP.encode(dataObject) => string<[[DataHexString]]> @<utils-rlpEncode> @SRC<rlp>
|
||||
Encode a structured Data Object into its RLP-encoded representation.
|
||||
|
||||
Each Data component may be an valid [[BytesLike]].
|
||||
Each Data component may be a valid [[BytesLike]].
|
||||
|
||||
_property: ethers.utils.RLP.decode(aBytesLike) => [DataObject](rlp--dataobject) @<utils.rlpDecode> @SRC<rlp>
|
||||
Decode an RLP-encoded //aBytesLike// into its structured Data Object.
|
||||
|
@ -81,7 +81,7 @@ _subsection: FixedFormat @<FixedFormat>
|
||||
|
||||
A **FixedFormat** is a simple object which represents a decimal
|
||||
(base-10) Fixed-Point data representation. Usually using this
|
||||
class directly is uneccessary, as passing in a [[FixedFormat--strings]]
|
||||
class directly is unnecessary, as passing in a [[FixedFormat--strings]]
|
||||
directly into the [[FixedNumber]] will automatically create this.
|
||||
|
||||
_heading: Format Strings @<FixedFormat--strings>
|
||||
|
@ -1,6 +1,8 @@
|
||||
_section: Hashing Algorithms @<hashing-algorithms>
|
||||
|
||||
Explain what hash functions are?
|
||||
There are many hashing algorithms used throughout the blockchain
|
||||
space as well as some more complex usages which require utilities
|
||||
to facilitate these common operations.
|
||||
|
||||
|
||||
_subsection: Cryptographic Hash Functions @<cryptographic-hash-functions>
|
||||
@ -66,7 +68,7 @@ utils.keccak256("0x1234")
|
||||
utils.keccak256([ 0x12, 0x34 ])
|
||||
//!
|
||||
|
||||
const bytes = utils.toUtf8Bytes("0x1234");
|
||||
const bytes = utils.toUtf8Bytes("0x1234")
|
||||
// <hide>
|
||||
bytes
|
||||
// </hide>
|
||||
@ -119,8 +121,8 @@ Use the [SHA2-512](link-wiki-sha2) hash algorithm.
|
||||
|
||||
_code: HMAC @lang<javascript>
|
||||
|
||||
const key = "0x0102";
|
||||
const data = "0x1234";
|
||||
const key = "0x0102"
|
||||
const data = "0x1234"
|
||||
utils.computeHmac("sha256", key, data)
|
||||
//!
|
||||
|
||||
@ -132,13 +134,39 @@ Computes the [[link-eip-191]] personal message digest of //message//. Personal m
|
||||
converted to UTF-8 bytes and prefixed with ``\\x19Ethereum Signed Message:``
|
||||
and the length of //message//.
|
||||
|
||||
_property: ethers.utils.namehash(name) => string<[[DataHexString]]<32>> @<utils-namehash> @SRC<hash>
|
||||
Returns the [ENS Namehash](link-namehash) of //name//.
|
||||
|
||||
_code: Hashing Messages @lang<javascript>
|
||||
|
||||
// @TODO: include examples of hashMessage; it can be complex. :)
|
||||
// Hashing a string message
|
||||
utils.hashMessage("Hello World")
|
||||
//!
|
||||
|
||||
// Hashing binary data (also "Hello World", but as bytes)
|
||||
utils.hashMessage( [ 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100 ])
|
||||
//!
|
||||
|
||||
// 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")
|
||||
//!
|
||||
|
||||
// Hashing the binary data
|
||||
// Note: this is the hash of the 1 byte [ 0x42 ]
|
||||
utils.hashMessage([ 0x42 ])
|
||||
//!
|
||||
|
||||
// Hashing the binary data
|
||||
// Note: similarly, this is the hash of the 1 byte [ 0x42 ]
|
||||
utils.hashMessage(utils.arrayify("0x42"))
|
||||
//!
|
||||
|
||||
|
||||
_property: ethers.utils.namehash(name) => string<[[DataHexString]]<32>> @<utils-namehash> @SRC<hash>
|
||||
Returns the [ENS Namehash](link-namehash) of //name//.
|
||||
|
||||
_code: Namehash @lang<javascript>
|
||||
|
||||
@ -154,6 +182,121 @@ utils.namehash("ricmoo.firefly.eth")
|
||||
utils.namehash("ricmoo.xyz")
|
||||
//!
|
||||
|
||||
_heading: Typed Data Encoder @<TypedDataEncoder> @SRC<hash:class.TypedDataEncoder>
|
||||
|
||||
The **TypedDataEncoder** is used to compute the various encoded data required
|
||||
for [[link-eip-712]] signed data.
|
||||
|
||||
Signed data requires a domain, list of structures and their members and the data
|
||||
itself.
|
||||
|
||||
The **domain** is an object with values for any of the standard domain
|
||||
properties.
|
||||
|
||||
The **types** is an object with each property being the name of a structure, mapping
|
||||
to an array of field descriptions. It should **not** include the ``EIP712Domain``
|
||||
property unless it is required as a child structure of another.
|
||||
|
||||
_note: 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.
|
||||
|
||||
_property: ethers.utils._TypedDataEncoder.from(types) => [TypedDataEncoder] @<TypedDataEncoder-from> @SRC<hash:TypedDataEncoder.from>
|
||||
|
||||
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.
|
||||
|
||||
_property: TypedDataEncoder.encode(domain, types, values) => string @<TypedDataEncoder-encode> @SRC<hash:staticmethod.TypedDataEncoder.encode>
|
||||
|
||||
Encodes the Returns the hashed [[link-eip-712]] domain.
|
||||
|
||||
_property: TypedDataEncoder.getPayload(domain, types, value) => any @<TypedDataEncoder-getPayload> @SRC<hash:TypedDataEncoder.getPayload>
|
||||
|
||||
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.
|
||||
|
||||
_property: TypedDataEncoder.getPrimaryType(types) => string @<TypedDataEncoder-getPrimaryType> @SRC<hash:TypedDataEncoder.getPrimaryType>
|
||||
|
||||
Constructs a directed acyclic graph of the types and returns the
|
||||
root type, which can be used as the **primaryType** for [[link-eip-712]]
|
||||
payloads.
|
||||
|
||||
_property: TypedDataEncoder.hash(domain, types, values) => string<[[DataHexString]]<32>> @<TypedDataEncoder-hash> @SRC<hash:staticmethod.TypedDataEncoder.hash>
|
||||
|
||||
Returns the computed [[link-eip-712]] hash.
|
||||
|
||||
_property: TypedDataEncoder.hashDomain(domain) => string<[[DataHexString]]<32>> @<TypedDataEncoder-hashDomain> @SRC<hash:TypedDataEncoder.hashDomain>
|
||||
|
||||
Returns the hashed [[link-eip-712]] domain.
|
||||
|
||||
_property: TypedDataEncoder.resolveNames(domain, types, value, resolveName) => Promise<any> @<TypedDataEncoder-resolveNames> @SRC<hash:TypedDataEncoder.resolveNames>
|
||||
|
||||
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.
|
||||
|
||||
_code: Typed Data Example @lang<javascript>
|
||||
|
||||
// <hide>
|
||||
TypedDataEncoder = ethers.utils._TypedDataEncoder
|
||||
// </hide>
|
||||
|
||||
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)
|
||||
//!
|
||||
|
||||
TypedDataEncoder.getPayload(domain, types, value)
|
||||
//!
|
||||
|
||||
TypedDataEncoder.getPrimaryType(types)
|
||||
//!
|
||||
|
||||
TypedDataEncoder.hash(domain, types, value)
|
||||
//!
|
||||
|
||||
TypedDataEncoder.hashDomain(domain)
|
||||
//!
|
||||
|
||||
|
||||
_subsection: Solidity Hashing Algorithms @<utils--solidity-hashing>
|
||||
|
||||
@ -187,3 +330,20 @@ utils.solidityKeccak256([ "int16", "uint48" ], [ -1, 12 ])
|
||||
utils.soliditySha256([ "int16", "uint48" ], [ -1, 12 ])
|
||||
//!
|
||||
|
||||
// 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" ])
|
||||
//!
|
||||
|
||||
utils.solidityPack([ "string", "string" ], [ "helloworld", "01" ])
|
||||
//!
|
||||
|
||||
utils.solidityPack([ "string", "string", "uint16" ], [ "hell", "oworld", 0x3031 ])
|
||||
//!
|
||||
|
||||
utils.solidityPack([ "uint96" ], [ "32309054545061485574011236401" ])
|
||||
//!
|
||||
|
@ -196,7 +196,7 @@ _property: Logger.levels.DEBUG
|
||||
Log all output, including debugging information.
|
||||
|
||||
_property: Logger.levels.INFO
|
||||
Only log output for infomational, warnings and errors.
|
||||
Only log output for informational, warnings and errors.
|
||||
|
||||
_property: Logger.levels.WARNING
|
||||
Only log output for warnings and errors.
|
||||
|
@ -39,7 +39,13 @@ will then be used to compute the address; this allows systems which use
|
||||
the v to encode additional data (such as [EIP-155](link-eip-155))
|
||||
to be used since the v parameter is still completely non-ambiguous.
|
||||
|
||||
_property: ethers.utils.verifyTypedData(domain, types, value, signature) => string<[[address]]> @<utils-verifyTypedData> @SRC<wallet>
|
||||
Returns the address that signed the [[link-eip-712]] //value// for the //domain//
|
||||
and //types// to produce the signature.
|
||||
|
||||
_property: ethers.utils.recoverPublicKey(digest, signature) => string<[[DataHexString]]<65>> @<utils-recoverPublicKey>
|
||||
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//.
|
||||
|
||||
_property: ethers.utils.computePublicKey(key [, compressed = false ]) => string<[[DataHexString]]> @<utils-computePublicKey>
|
||||
Computes the public key of //key//, optionally compressing it. The //key//
|
||||
|
@ -7,7 +7,7 @@ An unsigned transaction represents a transaction that has not been
|
||||
signed and its values are flexible as long as they are not ambiguous.
|
||||
|
||||
_property: unsignedTransaction.to => string<[Address](address)>
|
||||
The addres this transaction is to.
|
||||
The address this transaction is to.
|
||||
|
||||
_property: unsignedTransaction.nonce => number
|
||||
The nonce of this transaction.
|
||||
@ -98,7 +98,7 @@ used to encode the chain ID into the serialized transaction.
|
||||
_subsection: Functions @<transactions--functions>
|
||||
|
||||
_property: ethers.utils.parseTransaction(aBytesLike) => [[Transaction]] @<utils-parseTransaction> @SRC<transactions:parse>
|
||||
Parses the transaction properties from a serialized transactions.
|
||||
Parses the transaction properties from a serialized transaction.
|
||||
|
||||
_property: ethers.utils.serializeTransaction(tx [ , signature ]) => string<[[DataHexString]]> @<utils-serializeTransaction> @SRC<transactions:serialize>
|
||||
Computes the serialized //transaction//, optionally serialized with
|
||||
|
@ -3,7 +3,7 @@ _section: Web Utilities @<web>
|
||||
|
||||
_property: ethers.utils.fetchJson(urlOrConnectionInfo [, json [ , processFunc ] ]) => Promise<any> @<utils-fetchJson>
|
||||
Fetch and parse the JSON content from //urlOrConnectionInfo//, with the
|
||||
optiona body //json// and optionally processing the result with //processFun//
|
||||
optional body //json// and optionally processing the result with //processFun//
|
||||
before returning it.
|
||||
|
||||
_property: ethers.utils.poll(pollFunc [, options ]) => Promise<any> @<utils-poll>
|
||||
|
@ -30,7 +30,7 @@ the registered //name//.
|
||||
|
||||
_subsection: Languages @<wordlists--languages>
|
||||
|
||||
The [official wordlists](link-bip39-wordlists) available in at
|
||||
The [official wordlists](link-bip39-wordlists) available at
|
||||
`ethers.wordlists`. In the browser, only the english language is
|
||||
available by default; to include the others (which increases the
|
||||
size of the library), see the dist files in the `ethers` package.
|
||||
|
@ -104,8 +104,8 @@ bytecode by running multiple passes of an assemble stage, each pass
|
||||
more closely approximating the final result.
|
||||
|
||||
This allows small portions of the bytecode to be massaged and tweaked
|
||||
until the bytecode stablizes. This allows for more compact jump
|
||||
destinations and for code to be include more advanced meta-programming
|
||||
until the bytecode stabilizes. This allows for more compact jump
|
||||
destinations and for code to include more advanced meta-programming
|
||||
techniques.
|
||||
|
||||
_code: @lang<shell>
|
||||
|
@ -47,8 +47,8 @@ for a given option is invalid or some combination of options and flags is not
|
||||
allowed.
|
||||
|
||||
Once the prepareOptions is complete (the returned promise is resolved), the ``prepareArguments``
|
||||
is called. This should validate the number of arguments is expected and throw
|
||||
and error if there are too many or too few arguments or if any arguments do not
|
||||
is called. This should validate the number of arguments expected and throw
|
||||
an error if there are too many or too few arguments or if any arguments do not
|
||||
make sense.
|
||||
|
||||
Once the prepareArguments is complete (the returned promise is resolved), the ``run``
|
||||
|
@ -11,3 +11,4 @@ _toc:
|
||||
events
|
||||
gas
|
||||
security
|
||||
best-practices
|
||||
|
@ -127,7 +127,7 @@ function codeContextify(context) {
|
||||
context.hexlify = ethers.utils.hexlify;
|
||||
context.hexValue = ethers.utils.hexValue;
|
||||
context.Wallet = ethers.Wallet;
|
||||
context.provider = new ethers.providers.InfuraProvider();
|
||||
context.provider = new ethers.providers.InfuraProvider("mainnet", "49a0efa3aaee4fd99797bfa94d8ce2f1");
|
||||
|
||||
context.BigNumber.prototype[inspect.custom] = function(depth, options) {
|
||||
return `{ BigNumber: ${JSON.stringify(this.toString()) } }`;
|
||||
@ -142,6 +142,7 @@ function codeContextify(context) {
|
||||
//return JSON.stringify(value);
|
||||
return inspect(value, {
|
||||
compact: false,
|
||||
depth: null,
|
||||
breakLength: Infinity,
|
||||
sorted: true,
|
||||
});
|
||||
@ -185,6 +186,7 @@ module.exports = {
|
||||
"link-metamask": { name: "Metamask", url: "https:/\/metamask.io/" },
|
||||
"link-otto": "https:/\/github.com/robertkrimen/otto",
|
||||
"link-parity": { name: "Parity", url: "https:/\/www.parity.io" },
|
||||
"link-pocket": { name: "Pocket Network", url: "https:/\/pokt.network" },
|
||||
"link-react-native": { name: "React Native", url: "https:/\/reactnative.dev" },
|
||||
"link-rtd": "https:/\/github.com/readthedocs/sphinx_rtd_theme",
|
||||
"link-semver": { name: "semver", url: "https:/\/semver.org" },
|
||||
@ -195,6 +197,7 @@ module.exports = {
|
||||
"link-etherscan-signup": "https:/\/etherscan.io/apis",
|
||||
"link-etherscan-ratelimit": "https:/\/info.etherscan.com/api-return-errors/",
|
||||
"link-infura-signup": "https:/\/infura.io/register",
|
||||
"link-pocket-signup": "https:/\/pokt.network/pocket-gateway-ethereum-mainnet/",
|
||||
|
||||
"link-json-rpc": "https:/\/github.com/ethereum/wiki/wiki/JSON-RPC",
|
||||
"link-web3-send": "https:/\/github.com/ethereum/web3.js/blob/1.x/packages/web3-providers-http/types/index.d.ts#L57",
|
||||
@ -236,6 +239,7 @@ module.exports = {
|
||||
"link-eip-155": { name: "EIP-155", url: "https:/\/eips.ethereum.org/EIPS/eip-155" },
|
||||
"link-eip-191": { name: "EIP-191", url: "https:/\/eips.ethereum.org/EIPS/eip-191" },
|
||||
"link-eip-609": { name: "EIP-609", url: "https:/\/eips.ethereum.org/EIPS/eip-609" },
|
||||
"link-eip-712": { name: "EIP-712", url: "https:/\/eips.ethereum.org/EIPS/eip-712" },
|
||||
"link-eip-1014": { name: "EIP-1014", url: "https:/\/eips.ethereum.org/EIPS/eip-1014" },
|
||||
"link-eip-1193": { name: "EIP-1193", url: "https:/\/eips.ethereum.org/EIPS/eip-1193" },
|
||||
"link-eip-2098": { name: "EIP-2098", url: "https:/\/eips.ethereum.org/EIPS/eip-2098" },
|
||||
@ -247,7 +251,7 @@ module.exports = {
|
||||
"link-npm-events": { name: "EventEmitter", url: "https:/\/nodejs.org/dist/latest-v13.x/docs/api/events.html#events_class_eventemitter" },
|
||||
"link-npm-bnjs": { name: "BN.js", url: "https:/\/www.npmjs.com/package/bn.js" },
|
||||
"link-npm-query-bignumber": "https:/\/www.npmjs.com/search?q=bignumber",
|
||||
"link-npm-react-native-crypto": { name: "React Native Crypto", url: "https:/\/www.npmjs.com/package/react-native-crypto" },
|
||||
"link-npm-react-native-get-random-values": { name: "React Native get-random-values", url: "https:/\/www.npmjs.com/package/react-native-get-random-values" },
|
||||
|
||||
"link-js-array": "https:/\/developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array",
|
||||
"link-js-bigint": "https:/\/developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt",
|
||||
|
@ -21,7 +21,7 @@ So, pull requests are always welcome, but please keep a few points in mind:
|
||||
may not be accepted
|
||||
|
||||
In general, **please start an issue //before// beginning a pull request**, so we can
|
||||
have a public discussion and figure out the best way to address to problem/feature.
|
||||
have a public discussion and figure out the best way to address the problem/feature.
|
||||
**:)**
|
||||
|
||||
|
||||
|
@ -40,8 +40,21 @@ _subsection: Security @<cookbook-reactnative-security>
|
||||
|
||||
The React Native environment does not contain a secure random source, which
|
||||
is used when computing random private keys. This could result in private
|
||||
keys that others could guess, allowing the funds to be stolen.
|
||||
keys that others could possibly guess, allowing funds to be stolen and assets
|
||||
manipulated.
|
||||
|
||||
For this reason, it is **HIGHLY RECOMMENDED** to get either the
|
||||
[[link-npm-react-native-crypto]] module working or some equivalent.
|
||||
For this reason, it is **HIGHLY RECOMMENDED** to also install the
|
||||
[[link-npm-react-native-get-random-values]], which **must** be included
|
||||
before the shims. If it worked correctly you should not receive any
|
||||
warning in the console regarding missing secure random sources.
|
||||
|
||||
_code: Importing with Secure Random Sources @lang<script>
|
||||
|
||||
// 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";
|
||||
|
@ -380,7 +380,7 @@ _heading: Variables @<flatworm--table-variable>
|
||||
Often the layout of a table is easier to express and maintain without
|
||||
uneven or changing content within it. So the content can be defined
|
||||
separately within a table directive using **variables**. A variable
|
||||
name must being with a letter and must only contain letters and numbers.
|
||||
name must begin with a letter and must only contain letters and numbers.
|
||||
|
||||
Variables are also useful when content is repeated throughout a table.
|
||||
|
||||
|
@ -151,7 +151,7 @@ All errors now belong to the [[Logger]] class and the related functions
|
||||
have been moved to [[Logger]] instances, which can include a per-package
|
||||
version string.
|
||||
|
||||
Global error functions have been moved [[Logger]] class methods.
|
||||
Global error functions have been moved to [[Logger]] class methods.
|
||||
|
||||
_code: @lang<script>
|
||||
|
||||
|
@ -61,7 +61,7 @@ _subsection: Test Suites @<testing-suites>
|
||||
|
||||
The test suites are available as gzipped JSON files in the
|
||||
``@ethersproject/testcases``, which makes it easy to install and import
|
||||
(both GZIP and JSON are quite easy to consume from most langauges). Each
|
||||
(both GZIP and JSON are quite easy to consume from most languages). Each
|
||||
test suite also has its schema available in this package.
|
||||
|
||||
_table: Test Suites @style<full>
|
||||
@ -126,7 +126,7 @@ _heading: Deterministic Random Numbers (DRNG)
|
||||
|
||||
When creating test cases, often we want want random data from the perspective
|
||||
we do not case what values are used, however we want the values to be consistent
|
||||
accross runs. Otherwise it becomes difficult to reproduce an issue.
|
||||
across runs. Otherwise it becomes difficult to reproduce an issue.
|
||||
|
||||
In each of the following the seed is used to control the random value returned. Be
|
||||
sure to tweak the seed properly, for example on each iteration change the value and
|
||||
|
Loading…
Reference in New Issue
Block a user