2
0
mirror of synced 2025-02-23 03:28:22 +00:00

Updated docs.

This commit is contained in:
Richard Moore 2020-02-25 14:57:11 -05:00
parent 1cfab3173c
commit 8f25e6ab5d
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651
174 changed files with 3299 additions and 1360 deletions

View File

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

View File

@ -0,0 +1,162 @@
_section: Contract @<contract> @SRC<contracts:class.Contract>
_subsection: Properties
_property: contract.address => string<[[address]]>
This is the address (or ENS name) the contract was constructed with.
_property: contract.addressPromise => string<[[address]]>
This is a promise that will resolve to the address the **Contract**
object is attached to. If an [[address]] was provided to the constructor,
it will be equal to this; if an ENS name was provided, this will be the
resolved address.
_property: contract.deployTransaction => [[provider-transactionresponse]]
If the **Contract** object is the result of a ContractFactory deployment,
this is the transaction which was used to deploy the contract.
_property: contract.interface => [[abi-interface]]
This is the ABI as an [[abi-interface]].
_property: contract.provider => [[provider]]
If a provider was provided to the constructor, this is that provider. If
a signer was provided that had a [[provider]], this is that provider.
_property: contract.signer => [[signer]]
If a signer was provided to the constructor, this is that signer.
_subsection: Methods
_property: contract.attach(addressOrName) => [[contract]] @<contract-attach> @SRC<contracts:Contract.attach>
Returns a new instance of the **Contract** attached to a new
address. This is useful if there are multiple similar or identical
copies of a Contract on the network and you wish to interact with
each of them.
_property: contract.connect(providerOrSigner) => [[contract]] @<contract-connect> @SRC<contracts:Contract.connect>
Returns a new instance of the Contract, but connected to
//providerOrSigner//.
By passing in a [[provider]], this will return a downgraded
**Contract** which only has read-only access (i.e. constant calls).
By passing in a [[signer]]. the will return a **Contract** which
will act on behalf of that signer.
_property: contract.deployed() => Promise<[[contract]]> @<contract-deployed> @SRC<contracts>
_property: Contract.isIndexed(value) => boolean @<contract-isIndexed> @SRC<contracts>
_subsection: Events
_property: contract.queryFilter(event [ , fromBlockOrBlockHash [ , toBlock ]) => Promise<Array<Event>> @<contract-queryfilter> @SRC<contracts>
Return Events that match the //event//.
_property: contract.listenerCount([ event ]) => number @<contract-listenerCount> @SRC<contracts:Contract.listenerCount>
Return the number of listeners that are subscribed to //event//. If
no event is provided, returns the total count of all events.
_property: contract.listeners(event) => Array<Listener> @<contract-listeners> @SRC<contracts:Contract.listeners>
Return a list of listeners that are subscribed to //event//.
_property: contract.off(event, listener) => this @<contract-off> @SRC<contracts>
Unsubscribe //listener// to //event//.
_property: contract.on(event, listener) => this @<contract-on> @SRC<contracts>
Subscribe to //event// calling //listener// when the event occurs.
_property: contract.once(event, listener) => this @<contract-once> @SRC<contracts>
Subscribe once to //event// calling //listener// when the event
occurs.
_property: contract.removeAllListeners([ event ]) => this @<contract-removeAllListeners> @SRC<contracts:Contract.removeAllListeners>
Unsubscribe all listeners for //event//. If no event is provided,
all events are unsubscribed.
_subsection: Meta-Class @<contract-metaclass>
A Meta-Class is a Class which has any of its properties determined
at run-time. The **Contract** object uses a Contract's ABI to
determine what methods are available, so the following sections
describe the generic ways to interact with the properties added
at run-time during the **Contract** constructor.
_heading: Read-Only Methods (constant) @<contract-readonly>
A constant method is read-only and evaluates a small amount of EVM
code against the current blockchain state and can be computed by
asking a single node, which can return a result. It is therefore
free and does not require any ether, but **cannot make changes** to
the blockchain state..
_property: contract.METHOD_NAME(...args [ overrides ]) => Promise<any> @<contract-call>
The type of the result depends on the ABI.
For values that have a simple meaning in JavaScript, the types are fairly
straight forward; strings and booleans are returned as JavaScript strings
and booleans.
For numbers, if the **type** is in the JavaSsript safe range (i.e. less
than 53 bits, such as an ``int24`` or ``uint48``) a normal JavaScript
number is used. Otherwise a [[bignumber]] is returned.
For bytes (both fixed length and dynamic), a [[datahexstring]] is returned.
_heading: Write Methods (non-constant) @<contract-write>
A non-constant method requires a transaction to be signed and requires
payment in the form of a fee to be paid to a miner. This transaction
will be verified by every node on the entire network as well by the
miner who will compute the new state of the blockchain after executing
it against the current state.
It cannot return a result. If a result is required, it should be logged
using a Solidity event (or EVM log), which can then be queried from the
transaction receipt.
_property: contract.METHOD_NAME(...args [ , overrides ]) => Promise<[[provider-transactionresponse]]> @<contract-send>
Returns a [[provider-transactionresponse]] for the transaction after
it is sent to the network. This requires the **Contract** has a
signer.
_heading: Write Methods Analysis @<contract-write-check>
There are secveral options to analyze properties and results of a
write method without actually executing it.
_property: contract.estimate.METHOD_NAME(...args [ , overrides ]) => Promise<[[bignumber]]> @<contract-estimateGas>
Returns the estimate units of gas that would be required to
execute the //METHOD_NAME// with //args// and //overrides//.
_property: contract.populateTransaction.METHOD_NAME(...args [ , overrides ]) => Promise<[UnsignedTx](types-unsignedtransaction)> @<contract-populateTransaction>
Returns an [[types-unsignedtransaction]] which represents the transaction
that would need to be signed and submitted to the network to execute
//METHOD_NAME// with //args/ and //overrides//.
_property: contract.staticCall.METHOD_NAME(...args [ , overrides ]) => Promise<any> @<contract-staticCall>
Rather than executing the state-change of a transaction, it is possible
to ask a node to //pretend// that a call is not state-changing and
return the result.
This does not actually chagne any state, but is free. This in some cases
can be used to determine if a transaction will fail or succeed.
This otherwise functions the same as a [Read-Only Method](contract-readonly).
_heading: Event Filters @<contract-filter>
An event filter is made up of topics, which are values logged in a
[[link-wiki-bloomfilter]], allowing efficient searching for entries
which match a filter.
_property: contract.filters.EVENT_NAME(...args) => Filter
Return a filter for //EVENT_NAME//, optionally filtering by additional
constraints.
Only ``indexed`` event parameters may be filtered. If a parameter is
null (or not provided) then any value in that field matches.

View File

@ -0,0 +1,150 @@
_section: Example: ERC-20 Contract
_subsection: Connecting to a Contract
_code: token.txt
_heading: ERC20Contract @INHERIT<[[contract]]>
_property: new ethers.Contract(address, abi, providerOrSigner)
See the above code example for creating an Instance which will
(in addition to the Contact methods and properties) automatically
add the additional properties defined in //abi// to a **Contract**
connected to //address// using the //providerOrSigner//.
_subsection: Properties ^^//(inheritted from [[contract]])//^^
_property: erc20.address => string<[[address]]>
This is the address (or ENS name) the contract was constructed with.
_property: erc20.addressPromise => string<[[address]]>
This is a promise that will resolve to the address the **Contract**
object is attached to. If an [[address]] was provided to the constructor,
it will be equal to this; if an ENS name was provided, this will be the
resolved address.
_property: erc20.deployTransaction => [[provider-transactionresponse]]
If the **Contract** object is the result of a ContractFactory deployment,
this is the transaction which was used to deploy the contract.
_property: erc20.interface => [[abi-interface]]
This is the ABI as an [[abi-interface]].
_property: erc20.provider => [[provider]]
If a provider was provided to the constructor, this is that provider. If
a signer was provided that had a [[provider]], this is that provider.
_property: erc20.signer => [[signer]]
If a signer was provided to the constructor, this is that signer.
_subsection: Methods ^^//(inheritted from [[contract]])//^^
_property: erc20.attach(addressOrName) => [[contract]]
Returns a new instance of the **Contract** attached to a new
address. This is useful if there are multiple similar or identical
copies of a Contract on the network and you wish to interact with
each of them.
_property: erc20.connect(providerOrSigner) => [[contract]]
Returns a new instance of the Contract, but connected to
//providerOrSigner//.
By passing in a [[provider]], this will return a downgraded
**Contract** which only has read-only access (i.e. constant calls).
By passing in a [[signer]]. the will return a **Contract** which
will act on behalf of that signer.
_property: erc20.deployed() => Promise<Contract>
_property: Contract.isIndexed(value) => boolean
_subsection: Events ^^//(inheritted from Contract)//^^ @<erc20-events>
_property: erc20.queryFilter(event [ , fromBlockOrBlockHash [ , toBlock ]) => Promise<Array<Event>> @<erc20-queryfilter>
Return Events that match the //event//.
_property: erc20.listenerCount([ event ]) => number
Return the number of listeners that are subscribed to //event//. If
no event is provided, returns the total count of all events.
_property: erc20.listeners(event) => Array<Listener>
Return a list of listeners that are subscribed to //event//.
_property: erc20.off(event, listener) => this
Unsubscribe //listener// to //event//.
_property: erc20.on(event, listener) => this
Subscribe to //event// calling //listener// when the event occurs.
_property: erc20.once(event, listener) => this
Subscribe once to //event// calling //listener// when the event
occurs.
_property: erc20.removeAllListeners([ event ]) => this
Unsubscribe all listeners for //event//. If no event is provided,
all events are unsubscribed.
_subsection: Meta-Class Methods ^^//(added at Runtime)//^^
Since the Contract is a Meta-Class, the methods available here depend
on the ABI which was passed into the **Contract**.
_property: erc20.decimals([ overrides ]) => Promise<number>
Returns the number of decimal places used by this ERC-20 token. This can be
used with [parseUnits](utils-parseunits) when taking input from the user or
[formatUnits](utils-formatunits] when displaying the token amounts in the UI.
_property: erc20.getBalance(owner [, overrides ]) => Promise<[[bignumber]]>
Returns the balance of //owner// for this ERC-20 token.
_property: erc20.symbol([ overrides ]) => Promise<string>
Returns the symbol of the token.
_property: erc20_rw.transfer(target, amount [, overrides ]) => Promise<[[provider-transactionresponse]]>
Transfers //amount// tokens to //target// from the current signer.
The return value (a boolean) is inaccessible during a write operation
using a transaction. Other techniques (such as events) are required
if this value is required. On-chain contracts calling the ``transfer``
function have access to this result, which is why it is possible.
_property: erc20.callStatic.transfer(target, amount [, overrides ]) => Promise<boolean>
Performs a dry-run of transferring //amount// tokens to //target// from
the current signer, without actually signing or sending a transaction.
This can be used to preflight check that a transaction will be successful.
_property: erc20.estimate.transfer(target, amount [, overrides ]) => Promise<[[bignumber]]>
Returns an estimate for how many units of gas would be required
to transfer //amount// tokens to //target//.
_property: erc20.populateTransaction.transfer(target, amount [, overrides ]) => Promise<[UnsignedTx](types-unsignedtransaction)>
Returns an [[types-unsignedtransaction]] which could be signed and submitted
to the network to transaction //amount// tokens to //target//.
_note: Note on Estimating and Static Calling
When you perform a static call, the current state is taken into account as
best as Ethereum can determine. There are many cases where this can provide
false positives and false negatives. The eventually consistent model of the
blockchain also means there are certain consistency modes that cannot be
known until an actual transaction is attempted.
_subsection: Meta-Class Filters ^^//(added at Runtime)//^^
Since the Contract is a Meta-Class, the methods available here depend
on the ABI which was passed into the **Contract**.
_property: erc20.filters.Transafer([ fromAddress [ , toAddress ] ]) => Filter
Returns a new Filter which can be used to [query](erc20-queryfilter) or
to [subscribe/unsubscribe to events](erc20-events).
If //fromAddress// is null or not provided, then any from address matches.
If //toAddress// is null or not provided, then any to address matches.

View File

@ -0,0 +1,8 @@
_section: Contract Interaction @<contracts>
Explain what contracts are...
_toc:
contract
example

View File

@ -0,0 +1,35 @@
// A Human-Readable ABI; any supported ABI format could be used
const abi = [
// Read-Only Functions
"function balanceOf(address owner) view returns (uint256)",
"function decimals() view returns (uint8)",
"function symbol() view returns (string)",
// Authenticated Functions
"function transfer(address to, uint amount) returns (boolean)",
// Events
"event Transfer(address indexed from, address indexed to, uint amount)"
];
// This can be an address or an ENS name
const address = "demotoken.ethers.eth";
// An example Provider (connceted to testnet)
const provider = ethers.getDefaultProvider("ropsten");
// An example Signer
const signer = ethers.Wallet.createRandom(provider);
// Read-Only; By connecting to a Provider, allows:
// - Any constant function
// - Querying Filters
// - Populating Unsigned Transactions for non-constant methods
// - Estimating Gas for non-constant (as an anonymous sender)
// - Static Calling non-constant methods (as anonymous sender)
const erc20 = new ethers.Contract(address, abi, provider);
// Read-Write; By connecting to a Signer, allows:
// - Everything from Read-Only (except as Signer, not anonymous)
// - Sending transactions for non-constant functions
const erc20_rw = new ethers.Contract(address, abi, signer)

View File

@ -1,6 +1,4 @@
_title: Application Programming Interface
_section: Application Programming Interface (API)
_section: Application Programming Interface @NAV<API>
Here...

View File

@ -1,5 +1,3 @@
_title: Utilities
_section: Utilities @<asm-utilities>
_subsection: Assembler

View File

@ -1,5 +1,3 @@
_title: Abstract Syntax Tree
_section: Abstract Syntax Tree @<asm-ast>
Parsing a file using the [Ethers ASM Dialect](asm-dialect) will

View File

@ -1,5 +1,3 @@
_title: Ethers ASM Dialect
_section: Ethers ASM Dialect @<asm-dialect>
This provides a quick, high-level overcview of the **Ethers ASM Dialect**

View File

@ -1,5 +1,3 @@
_title: Assembly
_section: Assembly
_toc:

View File

@ -1,5 +1,3 @@
_title: Hardware Wallets
_section: Hardware Wallets
_subsection: LedgerSigner @<hw-ledger> @INHERIT<[[signer]]> @SRC<hardware-wallets:class.LedgerSigner>

View File

@ -1,5 +1,3 @@
_title: Other Libraries
_section: Other Libraries
Now that ethers is more modular, it is possible to have additional

View File

@ -1,5 +1,3 @@
_title: API Providers
_section: API Providers
There are many services which offer a web API for accessing

View File

@ -1,5 +1,3 @@
_title: Providers
_section: Providers
A **Provider** is an abstraction of a connection to the

View File

@ -1,5 +1,3 @@
_title: JSON-RPC Provider
_section: JsonRpcProvider @<provider-jsonrpc> @INHERIT<[[provider]]>
The [JSON-RPC API](link-jsonrpc) is a

View File

@ -1,5 +1,3 @@
_title: Other Providers
_section: Other Providers
Others...

View File

@ -1,6 +1,3 @@
_title: Abstract Provider
_section: Provider @<provider>
Explain what a provider is...

View File

@ -1,8 +1,6 @@
_title: Types
_section: Types
_heading: BlockTag @<provider-blocktag>
_subsection: BlockTag @<provider-blocktag>
A **BlockTag** specifies a specific location in the Blockchain.
- **``"latest"``** -- The most recently mined block

View File

@ -1,5 +1,3 @@
_title: Signer
_section: Signers
A Signer represents...
@ -200,6 +198,10 @@ The address of this **VoidSigner**.
_subsection: ExternallyOwnedAccount @<externally-owned-account>
This is an interface which contains a minimal set of properties
required for Externally Owned Accounts which can have certain
operations performed, such as encoding as a JSON wallet.
_property: eoa.address => string<[Address](address)>
The [[address]] of this EOA.
@ -208,10 +210,8 @@ _property: eoa.privateKey => string<[[datahexstring]]<32>>
The privateKey of this EOA
_property: eoa.mnemonic => string
_property: eoa.mnemonic => [[hdnode-mnemonic]]
//Optional//. The account HD mnemonic, if it has one and can be determined.
_property: eoa.path => string
//Optional//. The account HD path, if it has one and can be determined.
//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.

View File

@ -1,6 +1,4 @@
_title: Application Binary Interface
_section: Application Binary Interface
_section: Fragments
Explain an ABI.
@ -23,29 +21,30 @@ The Human-Readable ABI was
[article](link-ricmoo-humanreadableabi)
_heading: Output Formats @<abi-outputformats> @src<abi/fragments:FormatTypes>
_heading: Output Formats @<abi-outputformats> @SRC<abi/fragments:FormatTypes>
Each [[abi-fragment]] and [[abi-paramtype]] may be output using its ``format``
method.
_property: utils.FragmentTypes.full => string
_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.
_property: utils.FragmentTypes.minimal => string
_property: ethers.utils.FragmentTypes.minimal => string
This is similar to ``full``, except with no unnecessary whitespace or parameter
names. This is useful for storing a minimal string which can still fully
reconstruct the original Fragment using [Fragment&thinsp;.&thinsp;from](abi-fragment-from).
_property: utils.FragmentTypes.json => string
_property: ethers.utils.FragmentTypes.json => string
This returns a JavaScript Object which is safe to call ``JSON.stringify``
on to create a JSON string.
_property: utils.FragmentTypes.sighash => string
_property: ethers.utils.FragmentTypes.sighash => string
This is a minimal output format, which is used by Solidity when computing a
signature hash or an event topic hash.
@ -56,16 +55,13 @@ The ``sighash`` format is **insufficient** to re-create the original [[abi-fragm
since it discards modifiers such as indexed, anonymous, stateMutability, etc.
_subsection: Interface @<abi-interface> @SRC<abi/interface:class.Interface>
TODO
_subsection: Fragment @<abi-fragment> @SRC<abi/fragments:class.Fragment>
An ABI is a collection of **Fragments**, where each fragment specifies:
- An Event
- A Function
- A Constructor
- An [Event](abi-eventfragment)
- A [Function](abi-functionfragment)
- A [Constructor](abi-constructorfragment)
_heading: Properties
@ -90,11 +86,11 @@ the Constructor, Event of Function.
_heading: Methods
_property: utils.Fragment.from(objectOrString) => [[abi-fragment]] @<abi-fragment-from> @SRC<abi/fragments:Fragment.from>
_property: ethers.utils.Fragment.from(objectOrString) => [[abi-fragment]] @<abi-fragment-from> @SRC<abi/fragments:Fragment.from>
Returns a
_property: utils.Fragment.isFragment(object) => boolean @<abi-isfragment> @SRC<abi/fragments:Fragment.isFragment>
_property: ethers.utils.Fragment.isFragment(object) => boolean @<abi-isfragment> @SRC<abi/fragments:Fragment.isFragment>
Tra lal al
@ -122,11 +118,11 @@ This is the state mutability of the constructor. It can be any of:
_heading: Methods
_property: utils.ConstructorFragment.from(objectOrString) => [[abi-constructorfragment]] @<abi-constructorfragment-from> @SRC<abi/fragments:ConstructorFragment.from>
_property: ethers.utils.ConstructorFragment.from(objectOrString) => [[abi-constructorfragment]] @<abi-constructorfragment-from> @SRC<abi/fragments:ConstructorFragment.from>
Tra la la...
_property: utils.ConstructorFragment.isConstructorFragment(object) => boolean @<abi-isconstructorfragment> @SRC<abi/fragments:ConstructorFragment.isConstructorFragment>
_property: ethers.utils.ConstructorFragment.isConstructorFragment(object) => boolean @<abi-isconstructorfragment> @SRC<abi/fragments:ConstructorFragment.isConstructorFragment>
Tra lal al
@ -142,11 +138,11 @@ topic hash as topic0 when creating a log.
_heading: Methods
_property: utils.EventFragment.from(objectOrString) => [[abi-eventfragment]] @<abi-eventfragment-from> @SRC<abi/fragments:EventFragment.from>
_property: ethers.utils.EventFragment.from(objectOrString) => [[abi-eventfragment]] @<abi-eventfragment-from> @SRC<abi/fragments:EventFragment.from>
Tra la la...
_property: utils.EventFragment.isEventFragment(object) => boolean @<abi-iseventfragment> @SRC<abi/fragments:EventFragment.isEventFragment>
_property: ethers.utils.EventFragment.isEventFragment(object) => boolean @<abi-iseventfragment> @SRC<abi/fragments:EventFragment.isEventFragment>
Tra lal al
@ -175,11 +171,11 @@ A list of the Function output parameters.
_heading: Method
_property: utils.FunctionFragment.from(objectOrString) => [[abi-functionfragment]] @<abi-functionfragment-from> @SRC<abi/fragments:ConstructorFragment.from>
_property: ethers.utils.FunctionFragment.from(objectOrString) => [[abi-functionfragment]] @<abi-functionfragment-from> @SRC<abi/fragments:ConstructorFragment.from>
Tra la la...
_property: utils.FunctionFragment.isFunctionFragment(object) => boolean @<abi-isfunctionfragment> @SRC<abi/fragments:FunctionFragment.isFunctionFragment>
_property: ethers.utils.FunctionFragment.isFunctionFragment(object) => boolean @<abi-isfunctionfragment> @SRC<abi/fragments:FunctionFragment.isFunctionFragment>
Tra lal al
@ -232,14 +228,14 @@ _heading: Methods
Tra la la...
_property: paramType.format([ outputType = "sighash" ])
_property: paramType.format([ outputType = sighash ])
Tra la la...
_property: utils.ParamType.from(objectOrString) => [[abi-paramtype]] @<abi-paramtype-from> @SRC<abi/fragments:ParamType.from>
_property: ethers.utils.ParamType.from(objectOrString) => [[abi-paramtype]] @<abi-paramtype-from> @SRC<abi/fragments:ParamType.from>
Tra la la...
_property: utils.ParamType.isParamType(object) => boolean @<abi-paramtype-isparamtype> @SRC<abi/fragments:ParamType.isParamType>
_property: ethers.utils.ParamType.isParamType(object) => boolean @<abi-paramtype-isparamtype> @SRC<abi/fragments:ParamType.isParamType>
Tra la la...

View File

@ -0,0 +1,5 @@
_section: Application Binary Interface @NAV<ABI>
_toc:
interface
fragments

View File

@ -0,0 +1,196 @@
_section: Interface @<abi-interface> @SRC<abi/interface:class.Interface>
The **Interface** Class abstracts the encoding and decoding required
to interact with contracts on the Ethereum network.
Many of the standards organically evolved along side the [[link-solidity]]
language, which other languages have adopted to remain compatibile with
existing deployed contracts.
The EVM itself does not understand what the ABI is. It is simply an agreed
upon set of formats to encode various types of data which each contract can
expect so they can interoperate with each other.
_subsection: Creating Instances
_property: new ethers.utils.Interface(abi) @SRC<abi/interface:constructor.Interface>
Create a new **Interface** from a JSON string or object representing
//abi//.
The //abi// may be a JSON string or the parsed Object (using JSON.parse)
which is emitted by the [Solidity compiler](link-solc-output) (or compatible languages).
The //abi// may also be a [Human-Readable Abi](link-ricmoo-humanreadableabi),
which is a format the Ethers created to simplify manually typing the ABI
into the source and so that a Contract ABI can also be referenced easily
within the same source file.
_subsection: Properties
_property: interface.fragments => Array<[[abi-fragment]]>
All the [Fragments](abi-fragment) in the interface.
_property: interface.events => Array<[[abi-eventfragment]]>
All the [Event Fragments](abi-eventfragment) in the interface.
_property: interface.functions => Array<[[abi-functionfragment]]>
All the [Function Fragments](abi-functionfragment) in the interface.
_property: interface.deploy => [[abi-constructorfragment]]
The [Constructor Fragments](abi-constructorfragment) for the interface.
_subsection: Formatting
_property: interface.format( [ format ]) => string | Array<string> @SRC<abi/interface>
Return the formatted **Interface**. If the format type is ``json`` a
single string is returned, otherwise an Array of the human-readable
strings is returned.
_subsection: Fragment Access
_property: interface.getFunction(fragment) => [[abi-functionfragment]] @SRC<abi/interface>
Returns the [[abi-functionfragment]] for //fragment// (see [[abi-fragmentid]]).
_property: interface.getEvent(fragment) => [[abi-eventfragment]] @SRC<abi/interface>
Returns the [[abi-eventfragment]] for //fragment// (see [[abi-fragmentid]]).
_subsection: Signature and Topic Hashes
_property: interface.getSighash(fragment) => string<[[datahexstring]]<4>> @SRC<abi/interface:method.Interface.getSighash>
Return the sighash (or Function Selector) for //fragment// (see [[abi-fragmentid]]).
_property: interface.getEventTopic(fragment) => string<[[datahexstring]]<32>> @SRC<abi/interface:method.Interface.getEventTopic>
Return the topic hash for //fragment// (see [[abi-fragmentid]]).
_subsection: Encoding Data
_property: interface.encodeDeploy([ values ]) => string<[[datahexstring]]> @SRC<abi/interface>
Return the encoded deployment data, which can be concatenated to the
deployment bytecode of a contract to pass //values// into the contract
constructor.
_property: interface.encodeFilterTopics(fragment [ , values ]) => Array<topic | Array<topic>> @SRC<abi/interface>
Returns the encoded topic filter, which can be passed to getLogs for //fragment//
(see [[abi-fragmentid]]) for the given //values//.
Each //topic// is a 32 byte (64 nibble) [[datahexstring]].
_property: interface.encodeFunctionData(fragment [ , values ]) => string<[[datahexstring]]> @SRC<abi/interface>
Returns the encoded data, which can be used as the data for a transaction for
//fragment// (see [[abi-fragmentid]]) for the given //values//.
_property: interface.encodeFunctionResult(fragment [ , values ]) => string<[[datahexstring]]> @SRC<abi/interface>
Returns the encoded result, which would normally be the response from a call for
//fragment// (see [[abi-fragmentid]]) for the given //values//.
Most developers will not need this method, but may be useful for authors of a mock blockchain.
_subsection: Decoding Data
_property: interface.decodeEventLog(fragment, data [ , topics ]) => [[abi-result]] @SRC<abi/interface>
Returns the decoded event values from an event log for
//fragment// (see [[abi-fragmentid]]) for the given //data//
with the optional //topics//.
If //topics// is not specified, placeholders will be inserted into the result.
_property: interface.decodeFunctionData(fragment, data) => [[abi-result]] @SRC<abi/interface>
Returns the decoded values from transaction data for
//fragment// (see [[abi-fragmentid]]) for the given //data//.
Most developers will not need this method, but may be useful for debugging
or inspecting transactions.
_property: interface.decodeFunctionResult(fragment, data) => [[abi-result]] @SRC<abi/interface>
Returns the decoded values from the result of a call for
//fragment// (see [[abi-fragmentid]]) for the given //data//.
_subsection: Parsing
The functions are generally the most useful for most developers. They will
automatically search the ABI for a matching Event or Function and decode
the components as a fully specified description.
_property: interface.parseLog(log) => [[abi-log]] @SRC<abi/interface>
Search the event that matches the //log// topic hash and parse the values
the log represents.
_property: interface.parseTransaction(transaction) => [[abi-transaction]] @SRC<abi/interface>
Search for the function that matches the //transaction// data sighash
and parse the transaction properties.
_subsection: Types
_heading: Result @<abi-result> @INHERIT<Array&lt;any&gt;>
A **Result** is an array, so each value can be accessed as a positional
argument.
Additionally, if values are named, the identical object as its positional
value can be accessed by its name.
The name ``length`` is however reserved as it is part of the Array, so
any named value for this key is renamed to ``_length``. If there is a
name collision, only the first is available by its key.
_heading: LogDescription @<abi-log>
_property: logDescription.args => [[abi-result]]
The values of the input parameters of the event.
_property: logDescription.eventFragment => [[abi-eventfragment]]
The [[abi-eventfragment]] which matches the topic in the Log.
_property: logDescription.name => string
The event name. (e.g. ``Transfer``)
_property: logDescription.signature => string
The event signature. (e.g. ``Transfer(address,address,uint256)``)
_property: logDescription.topic => string
The topic hash.
_heading: TransactionDescription @<abi-transaction>
_property: transactionDescription.args => [[abi-result]]
The decoded values from the transaction data which were passed
as the input parameters.
_property: transactionDescription.functionFragment => [[abi-functionfragment]]
The [[abi-functionfragment]] which matches the sighash in the transaction data.
_property: transactionDescription.name => string
The name of the function. (e.g. ``transfer``)
_property: transactionDescription.sighash => string
The sighash (or function selector) that matched the transaction data.
_property: transactionDescription.signature => string
The signature of the function. (e.g. ``transfer(address,uint256)``)
_property: transactionDescription.value => [[bignumber]]
The value from the transaction.
_subsection: Specifying Fragments @<abi-fragmentid>
When specifying a fragment to any of the functions in an **Interface**,
any of the following may be used:
- The name of the event or function, if it is unique and non-ambiguous
within the ABI (e.g. ``transfer``)
- The signature of the event or function. The signature is normalized,
so, for example, ``uint`` and ``uint256`` are equivalent (e.g. ``transfer(address, uint)``)
- The sighash or topichash of the function. The sighash is often referred
to the function selector in Solidity (e.g. ``0xa9059cbb``)
- A [[abi-fragment]]

View File

@ -1,5 +1,3 @@
_title: Addresses
_section: Addresses @<addresses>
Explain addresses,formats and checksumming here.
@ -43,7 +41,7 @@ To convert an address into the ICAP format, see [getIcapAddress](utils-getIcapAd
_subsection: Functions
_property: utils.getAddress(address) => string<[[address]]> @<utils-getAddress> @SRC<address>
_property: ethers.utils.getAddress(address) => string<[[address]]> @<utils-getAddress> @SRC<address>
Returns //address// as a Checksum Address.
If //address// is an invalid 40-nibble [[hexstring]] or if it contains mixed case and
@ -52,17 +50,17 @@ the checksum is invalid, an InvalidArgument Error is throw.
The value of //address// may be any supported address format.
_property: utils.isAddress(address) => boolean @<utils-isAddress> @SRC<address>
_property: ethers.utils.isAddress(address) => boolean @<utils-isAddress> @SRC<address>
Returns true if //address// is valid (in any supported format).
_property: utils.getIcapAddress(address) => string<[IcapAddress](address-icap)> @<utils-getIcapAddress> @SRC<address>
_property: ethers.utils.getIcapAddress(address) => string<[IcapAddress](address-icap)> @<utils-getIcapAddress> @SRC<address>
Returns //address// as an [ICAP address](link-icap).
Supports the same restrictions as [utils.getAddress](utils-getAddress).
_property: utils.getContractAddress(transaction) => string<[[address]]> @<utils-getcontractaddress> @SRC<address>
_property: ethers.utils.getContractAddress(transaction) => string<[[address]]> @<utils-getcontractaddress> @SRC<address>
Returns the contract address that would result if //transaction// was
used to deploy a contract.
_property: utils.getCreate2Address(from, salt, initCodeHash) => string<[[address]]> @<utils.getCreate2Address> @SRC<address>
_property: ethers.utils.getCreate2Address(from, salt, initCodeHash) => string<[[address]]> @<utils-getCreate2Address> @SRC<address>
Returns the contract address that would result from the given
[CREATE2](link-eip-1014) call.

View File

@ -1,6 +1,3 @@
_title: Big Number
_section: BigNumber @<bignumber>
Many operations in Ethereum operation on numbers which are
@ -48,10 +45,10 @@ _subsection: Creating Instances
The constructor of BigNumber cannot be called directly. Instead, Use the static ``BigNumber.from``.
_property: BigNumber.from(aBigNumberish) => [[bignumber]]
_property: ethers.BigNumber.from(aBigNumberish) => [[bignumber]]
Returns an instance of a **BigNumber** for //aBigNumberish//.
_heading: Examples:
_heading: Examples: @<>
_code: bignumber-create.js
@ -143,7 +140,7 @@ Returns the value of //bignumber// as a base-16, ``0x``-prefixed [[datahexstring
_heading: Inspection
_property: BigNumnber.isBigNumber(object) => boolean @SRC<bignumber>
_property: ethers.BigNumnber.isBigNumber(object) => boolean @SRC<bignumber>
Returns true if and only if the //object// is a BigNumber object.

View File

@ -1,5 +1,3 @@
_title: Byte Manipulation
_section: Byte Manipulation
Tra la la...
@ -55,13 +53,13 @@ missing values can be computed).
_subsection: Inspection
_property: utils.isBytes(object) => boolean @<utils-isbytes> @SRC<bytes>
_property: ethers.utils.isBytes(object) => boolean @<utils-isbytes> @SRC<bytes>
Returns true if and only if //object// is a valid [[bytes]].
_property: utils.isBytesLike(object) => boolean @<utils-isbyteslike> @SRC<bytes>
_property: ethers.utils.isBytesLike(object) => boolean @<utils-isbyteslike> @SRC<bytes>
Returns true if and only if //object// is a [[bytes]] or [[datahexstring]].
_property: utils.isHexString(object, [ length ] ) => boolean @<utils-ishexstring> @SRC<bytes>
_property: ethers.utils.isHexString(object, [ length ] ) => boolean @<utils-ishexstring> @SRC<bytes>
Returns true if and only if //object// is a valid hex string.
If //length// is specified and //object// is not a valid [[datahexstring]] of
//length// bytes, an InvalidArgument error is thrown.
@ -69,13 +67,13 @@ If //length// is specified and //object// is not a valid [[datahexstring]] of
_subsection: Converting between Arrays and Hexstrings
_property: utils.arrayify(datahexstringOrArrayish [ , options ]) => Uint8Array @<utils-arrayify> @SRC<bytes>
_property: ethers.utils.arrayify(datahexstringOrArrayish [ , options ]) => Uint8Array @<utils-arrayify> @SRC<bytes>
Converts //datahexstringOrArrayish// to a Uint8Array.
_property: utils.hexlify(hexstringOrArrayish) => string<[[datahexstring]]> @<utils-hexlify> @SRC<bytes>
_property: ethers.utils.hexlify(hexstringOrArrayish) => string<[[datahexstring]]> @<utils-hexlify> @SRC<bytes>
Converts //hexstringOrArrayish// to a [[datahexstring]].
_property: utils.hexValue(aBigNumberish) => string<[[hexstring]]> @<utils-hexvalue> @SRC<bytes>
_property: ethers.utils.hexValue(aBigNumberish) => string<[[hexstring]]> @<utils-hexvalue> @SRC<bytes>
Converts //aBigNumberish// to a [[hexstring]], with no __unnecessary__ leading
zeros.
@ -86,13 +84,13 @@ _code: bytes-conversion.js
_subsection: Array Manipulation
_property: utils.concat(arrayOfBytesLike) => Uint8Array @<utils-concat> @SRC<bytes>
_property: ethers.utils.concat(arrayOfBytesLike) => Uint8Array @<utils-concat> @SRC<bytes>
Concatenates all the [[byteslike]] in //arrayOfBytesLike// into a single Uint8Array.
_property: utils.stripZeros(aBytesLike) => Uint8Array @<utils-stripzeros> @SRC<bytes>
_property: ethers.utils.stripZeros(aBytesLike) => Uint8Array @<utils-stripzeros> @SRC<bytes>
Returns a Uint8Array with all leading ``0`` bytes of //aBtyesLike// removed.
_property: utils.zeroPad(aBytesLike, length) => Uint8Array @<utils-zeropad> @SRC<bytes>
_property: ethers.utils.zeroPad(aBytesLike, length) => Uint8Array @<utils-zeropad> @SRC<bytes>
Retutns a Uint8Array of the data in //aBytesLike// with ``0`` bytes prepended to
//length// bytes long.
@ -102,22 +100,22 @@ error will be thrown.
_subsection: Hexstring Manipulation
_property: utils.hexConcat(arrayOfBytesLike) => string<[[datahexstring]]> @<utils-hexconcat> @SRC<bytes>
_property: ethers.utils.hexConcat(arrayOfBytesLike) => string<[[datahexstring]]> @<utils-hexconcat> @SRC<bytes>
Concatenates all the [[byteslike]] in //arrayOfBytesLike// into a single [[datahexstring]]
_property: utils.hexDataLength(aBytesLike) => string<[[datahexstring]]> @<utils-hexdatalength> @SRC<bytes>
_property: ethers.utils.hexDataLength(aBytesLike) => string<[[datahexstring]]> @<utils-hexdatalength> @SRC<bytes>
Returns the length (in bytes) of //aBytesLike//.
_property: utils.hexDataSlice(aBytesLike, offset [ , endOffset ] ) => string<[[datahexstring]]> @<utils-hexdataslice> @SRC<bytes>
_property: ethers.utils.hexDataSlice(aBytesLike, offset [ , endOffset ] ) => string<[[datahexstring]]> @<utils-hexdataslice> @SRC<bytes>
Returns a [[datahexstring]] representation of a slice of //aBytesLike//, from
//offset// (in bytes) to //endOffset// (in bytes). If //endOffset// is
omitted, the length of //aBytesLike// is used.
_property: utils.hexStripZeros(aBytesLike) => string<[[hexstring]]> @<utils-hexstripzeros> @SRC<bytes>
_property: ethers.utils.hexStripZeros(aBytesLike) => string<[[hexstring]]> @<utils-hexstripzeros> @SRC<bytes>
Returns a [[hexstring]] representation of //aBytesLike// with all
leading zeros removed.
_property: utils.hexZeroPad(aBytesLike, length) => string<[[datahexstring]]> @<utils-hexzeropad> @SRC<bytes>
_property: ethers.utils.hexZeroPad(aBytesLike, length) => string<[[datahexstring]]> @<utils-hexzeropad> @SRC<bytes>
Returns a [[datahexstring]] representation of //aBytesLike// padded to //length// bytes.
If //aBytesLike// is already longer than //length// bytes long, an InvalidArgument
@ -126,15 +124,18 @@ error will be thrown.
_subsection: Signature Conversion
_property: utils.joinSignature(aSignatureLike) => string<[FlatSignature](signature-flat)> @<utils-joinsignature> @SRC<bytes>
_property: ethers.utils.joinSignature(aSignatureLike) => string<[FlatSignature](signature-flat)> @<utils-joinsignature> @SRC<bytes>
Return the flat-format of //aSignaturelike//, which is 65 bytes (130 nibbles)
long, concatenating the **r**, **s** and (normalized) **v** of a Signature.
_property: utils.splitSignature(aSignatureLikeOrBytesLike) => [[signature]] @<utils-splitsignature> @SRC<bytes>
_property: ethers.utils.splitSignature(aSignatureLikeOrBytesLike) => [[signature]] @<utils-splitsignature> @SRC<bytes>
Return the full expanded-format of //aSignaturelike// or a flat-format [[datahexstring]].
Any missing properties will be computed.
_subsection: Random Bytes
_property: ethers.utils.randomBytes(length) => Uint8Array
_property: ethers.utils.randomBytes(length) => Uint8Array @<utils-randombytes> @SRC<random/index>
Return a new Uint8Array of //length// random bytes.
_property: ethers.utils.shuffled(array) => Array<any> @<utils.shuffled> @SRC<random>
Return a copy of //array// shuffled using [[link-wiki-shuffle]].

View File

@ -1,5 +1,3 @@
_title: Constants
_section: Constants @<constants>
The **ethers.contants** Object contains commonly used values.

View File

@ -1,5 +1,3 @@
_title: Display Logic and Input
_section: Display Logic and Input
When creating an Application, it is useful to convert between
@ -46,23 +44,23 @@ _subsection: Functions
_heading: Formatting
_property: utils.commify(value) => string @<util-commify> @SRC<units>
_property: ethers.utils.commify(value) => string @<utils-commify> @SRC<units>
Returns a string with value grouped by 3 digits, separated by ``,``.
_heading: Conversion @<unit-conversion>
_property: utils.formatUnits(value [ , unit = "ether" ] ) => string @<util-formatunits> @SRC<units>
_property: ethers.utils.formatUnits(value [ , unit = "ether" ] ) => string @<utils-formatunits> @SRC<units>
Returns a string representation of //value// formatted with //unit//
digits (if it is a number) or to the unit specified (if a string).
_property: utils.formatEther(value) => string @<util-formatether> @SRC<units>
_property: ethers.utils.formatEther(value) => string @<utils-formatether> @SRC<units>
The equivalent to calling ``formatUnits(value, "ether")``.
_property: utils.parseUnits(value [ , unit = "ether" ] ) => [BigNumber](bignumber) @<util-parseunits> @SRC<units>
_property: ethers.utils.parseUnits(value [ , unit = "ether" ] ) => [BigNumber](bignumber) @<utils-parseunits> @SRC<units>
Returns a [BigNumber](bignumber) representation of //value//, parsed with
//unit// digits (if it is a number) or from the unit specified (if
a string).
_property: utils.parseEther(value) => [BigNumber](bignumber) @<util-parseether> @SRC<units>
_property: ethers.utils.parseEther(value) => [BigNumber](bignumber) @<utils-parseether> @SRC<units>
The equivalent to calling ``parseUnits(value, "ether")``.

View File

@ -1,8 +1,6 @@
_title: Encoding Utilies
_section: Encoding Utilities @<encoding>
_section: Encoding Utilities
_subsection: Base58
_subsection: Base58 @<bse58> @SRC<basex:Base58>
_property: ethers.utils.base58.decode(textData) => Uin8Array
Return a typed Uint8Array representation of //textData// decoded using
@ -12,27 +10,27 @@ _property: ethers.utils.base58.encode(aBytesLike) => string
Return //aBytesLike// encoded as a string using the base-58 encoding.
_subsection: Base64
_subsection: Base64 @<base64>
_property: ethers.utils.base64.decode(textData) => Uin8Array
_property: ethers.utils.base64.decode(textData) => Uin8Array @SRC<base64>
Return a typed Uint8Array representation of //textData// decoded using
base-64 encoding.
_property: ethers.utils.base64.encode(aBytesLike) => string
_property: ethers.utils.base64.encode(aBytesLike) => string @SRC<base64>
Return //aBytesLike// encoded as a string using the base-64 encoding.
_subsection: Recursive-Length Prefix
_subsection: Recursive-Length Prefix @<rlp>
The [[link-rlp]] encoding is used throughout Ethereum to serialize nested
structures of Arrays and data.
_property: ethers.utils.RLP.encode(dataObject) => string<[[datahexstring]]>
_property: ethers.utils.RLP.encode(dataObject) => string<[[datahexstring]]> @<rlp-encode> @SRC<rlp>
Encode a structured Data Object into its RLP-encoded representation.
Each Data component may be an valid [[byteslike]].
_property: ethers.utils.RLP.decode(aBytesLike) => [DataObject](rlp-dataobject)
_property: ethers.utils.RLP.decode(aBytesLike) => [DataObject](rlp-dataobject) @<rlp-decode> @SRC<rlp>
Decode an RLP-encoded //aBytesLike// into its structured Data Object.
All Data components will be returned as a [[datahexstring]].

View File

@ -1,5 +1,3 @@
_title: Fixed Number
_section: FixedNumber @<fixednumber>
A **FixedNumber** is a fixed-width (in bits) number with an internal

View File

@ -1,5 +1,3 @@
_title: Hashing
_section: Hashing Algorithms
Explain what hash functions are?
@ -39,12 +37,12 @@ Use the [SHA2-512](link-wiki-sha2) hash algorithm.
_subsection: Common Hashing Helpers
_property: ethers.utils.hashMessage(message) => string<[[datahexstring]]<32>> @<utils-hashmessage> @SRC<hash>
Computes the Ethereum message digest of //message//. Ethereum messages are
Computes the [[link-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//.
_property: ethers.utils.id(text) => string<[[datahexstring]]<32>> @<utils-id> @SRC<hash>
The Ethereum Identity function computs the keccak256 hash of the //text// bytes.
The Ethereum Identity function computs the [KECCAK256](link-wiki-sha3) hash of the //text// bytes.
_property: ethers.utils.namehash(name) => string<[[datahexstring]]<32>> @<utils-namehash> @SRC<hash>
Returns the [ENS Namehash](link-namehash) of //name//.
@ -61,11 +59,11 @@ Returns the non-standard encoded //arrayOfValues// packed according to
their respecive type in //arrayOfTypes//.
_property: ethers.utils.solidityKeccak256(arrayOfTypes, arrayOfValues) => string<[[datahexstring]]<32>> @<utils-soliditykeccak256> @SRC<solidity:keccak256>
Returns the KECCAK256 of the non-standard encoded //arrayOfValues// packed
Returns the [KECCAK256](link-wiki-sha3) of the non-standard encoded //arrayOfValues// packed
according to their respective type in //arrayOfTypes//.
_property: ethers.utils.soliditySha256(arrayOfTypes, arrayOfValues) => string<[[datahexstring]]<32>> @<utils-soliditysha256> @SRC<solidity:sha256>
Returns the SHA2-256 of the non-standard encoded //arrayOfValues// packed
Returns the [SHA2-256](link-wiki-sha2) of the non-standard encoded //arrayOfValues// packed
according to their respective type in //arrayOfTypes//.

View File

@ -1,5 +1,3 @@
_title: HD Wallet
_section: HD Wallet
TODO: Explain [BIP32](link-bip-32) [BIP-39](link-bip-39) and whatnot here...

View File

@ -1,5 +1,3 @@
_title: Utilities
_section: Utilities
These utilities are used extensively within the library, but

View File

@ -1,52 +1,154 @@
_title: Logger
_section: Logging @<logging>
_section: Logger @<logger>
These are just a few simple logging utilities provided to simplify
and standardize the error facilities across the Ethers library.
_subsection: Errors @<logger-errors>
The [[logger]] library has zero dependencies and is intentionally
very light so it can be easily included in each library.
_property: Logger.errors.UNKNOWN_ERROR
A generic unknown error.
The [Censorship](logger-censorship) functionality relies on one instance
of the Ethers library being included. In large bundled packages or when
``npm link`` is used, this may not be the case. If you require this
functionality, ensure that your bundling is configured properly.
_subsection: Logger @<logger> @SRC<logger:class.Logger>
_property: new ethers.utils.Logger(version) @SRC<logger:constructor.Logger>
Create a new logger which will include //version// in all errors thrown.
_property: Logger.globalLogger() => [[logger]] @SRC<logger>
Returns the singleton global logger.
_heading: Logging Output
_property: logger.debug(...args) => void @SRC<logger>
Log debugging information.
_property: logger.info(...args) => void @SRC<logger>
Log generic information.
_property: logger.warn(...args) => void @SRC<logger>
Log warnings.
_heading: Errors
These functions honor the current [Censorship](logger-censorship) and help create
a standard error model for detecting and processing errors within Ethers.
_property: logger.makeError(message [ , code = UNKNOWN_ERROR [ , params ] ]) => Error @SRC<logger>
Create an Error object with //message// and an optional //code// and
additional //params// set. This is useful when an error is needed to be
rejected instead of thrown.
_property: logger.throwError(message [ , code = UNKNOWN_ERROR [ , params ] ]) => never @SRC<logger>
Throw an Error with //message// and an optional //code// and
additional //params// set.
_property: logger.throwArgumentError(message, name, value) => never @SRC<logger>
Throw an [INVALID_ARGUMENT](error-invalidargument) Error with //name// and //value//.
_heading: Usage Validation
There can be used to ensure various properties and actions are safe.
_property: logger.checkAbstract(target, kind) => void @SRC<logger>
Checks that //target// is not //kind// and performs the same operatons
as ``checkNew``. This is useful for ensuring abstract classes are not
being instantiated.
_property: logger.checkArgumentCount(count, expectedCound [ , message) => void @SRC<logger>
If //count// is not equal to //expectedCount//, throws a [MISSING_ARGUMENT](error-missingargument)
or [UNEXPECTED_ARGUMENT](error-unexpectedargument) error.
_property: logger.checkNew(target, kind) => void @SRC<logger>
If //target// is not a valid ``this`` or ``target`` value, throw a
[MISSING_NEW](error-missingnew) error. This is useful to ensure
callers of a Class are using ``new``.
_property: logger.checkNormalize(message) => void @SRC<logger>
Check that the environment has a correctly functioning [[link-js-normalize]]. If not, a
[UNSUPPORTED_OPERATION](error-unsupported) error is thrown.
_property: logger.checkSafeUint53(value [, message ]) => void @SRC<logger>
If //value// is not safe as a [JavaScript number](link-wiki-ieee754), throws a
[NUMERIC_FAULT](error-numericfault) error.
_heading: Censorship @<logger-censorship>
_property: Logger.setCensorship(censor [ , permanent = false ]) => void @SRC<logger>
Set error censorship, optionally preventing errors from being uncensored.
In production applications, this prevents any error from leaking information
by masking the message and values of errors.
This can impact debugging, making it substantially more difficult.
_property: Logger.setLogLevel(logLevel) => void @SRC<logger>
Set the log level, to suppress logging output below a [particular log level](logger-levels).
_subsection: Errors @<errors>
Every error in Ethers has a ``code`` value, which is a string that will
match one of the following error codes.
_heading: Generic Error Codes
_property: Logger.errors.NOT_IMPLEMENTED
The operation is not implemented.
_property: Logger.errors.UNSUPPORTED_OPERATION
The operation is not supported.
_property: Logger.errors.NETWORK_ERROR
An Ethereum network validation error, such as an invalid chain ID.
_property: Logger.errors.SERVER_ERROR
There was an error communicating with a server.
_property: Logger.errors.TIMEOUT
_property: Logger.errors.TIMEOUT @<error-timeout>
A timeout occurred.
_property: Logger.errors.UNKNOWN_ERROR @<error-unknown>
A generic unknown error.
_property: Logger.errors.UNSUPPORTED_OPERATION @<error-unsupported>
The operation is not supported.
_heading: Safety Error Codes
_property: Logger.errors.BUFFER_OVERRUN
The amount of data needed is more than the amount of data required,
which would cause the data buffer to read past its end.
_property: Logger.errors.NUMERIC_FAULT
_property: Logger.errors.NUMERIC_FAULT @<error-numericfault>
There was an invalid operation done on numeric values.
Common cases of this occur when there is [[link-wiki-overflow]],
[[link-wiki-underflow]] in fixed numeric types or division by zero.
_property: Logger.errors.MISSING_NEW
An object is a Class, but is now being called with ``new``.
_property: Logger.errors.INVALID_ARGUMENT
_heading: Usage Error Codes
_property: Logger.errors.INVALID_ARGUMENT @<error-invalidargument>
The type or value of an argument is invalid. This will generally also
include the ``name`` and ``value`` of the argument. Any function which
accepts sensitive data (such as a private key) will include the string
``[REDACTED]]`` instead of the value passed in.
``[\[REDACTED]\]`` instead of the value passed in.
_property: Logger.errors.MISSING_ARGUMENT
_property: Logger.errors.MISSING_ARGUMENT @<error-missingargument>
An expected parameter was not specified.
_property: Logger.errors.UNEXPECTED_ARGUMENT
_property: Logger.errors.MISSING_NEW @<error-missingnew>
An object is a Class, but is now being called with ``new``.
_property: Logger.errors.UNEXPECTED_ARGUMENT @<error-unexpectedargument>
Too many parameters we passed into a function.
_heading: Ethereum Error Codes
_property: Logger.errors.CALL_EXCEPTION
An attempt to call a blockchain contract (getter) resulted in a
revert or other error.
@ -59,6 +161,9 @@ A sending account must have enough ether to pay for the value, the gas limit
(at the gas price) as well as the intrinsic cost of data. The intrinsic cost
of data is 4 gas for each zero byte and 68 gas for each non-zero byte.
_property: Logger.errors.NETWORK_ERROR
An Ethereum network validation error, such as an invalid chain ID.
_property: Logger.errors.NONCE_EXPIRED
The nonce being specified has already been used in a mined transaction.
@ -85,8 +190,19 @@ This error can also indicate that the transaction is expected to fail regardless
if for example an account with no tokens is attempting to send a token.
_subsection: Creating instances
_subsection: Log Levels @<logger-levels>
_property: new ethers.utils.Logger(version)
Create a new logger which will include //version// in all errors thrown.
_property: Logger.levels.DEBUG
Log all output, including debugging information.
_property: Logger.levels.INFO
Only log output for infomational, warnings and errors.
_property: Logger.levels.WARNING
Only log output for warnings and errors.
_property: Logger.levels.ERROR
Only log output for errors.
_property: Logger.levels.OFF
Do not output any logs.

View File

@ -1,5 +1,3 @@
_title: Property Utilities
_section: Property Utilities
_property: ethers.utils.checkPropertoes() => void

View File

@ -1,5 +1,3 @@
_title: Signing Keys
_section: Signing Key @<utils-signingkey>
_property: new ethers.utils.SigningKey(privateKey)

View File

@ -1,5 +1,3 @@
_title: Strings
_section: Strings
Tra la la

View File

@ -1,5 +1,3 @@
_title: Transactions
_section: Transactions @<utils-transactions>
_subsection: Types

View File

@ -1,5 +1,3 @@
_title: Web Utilities
_section: Web Utilities

View File

@ -1,5 +1,3 @@
_title: Wordlists
_section: Wordlists @<wordlists>
_subsection: Wordlist @<wordlist>
@ -26,7 +24,7 @@ Checks that all words map both directions correctly and return the
hash of the lists. Sub-classes should use this to validate the wordlist
is correct against the official wordlist hash.
_property: Wordlist.register(wordlist [ , name ]) => string<[[datahexstring]]<32>>
_property: Wordlist.register(wordlist [ , name ]) => void
Register a wordlist with the list of wordlists, optionally overriding
the registered //name//.
@ -47,7 +45,7 @@ The French [[wordlist]].
_property: ethers.wordlists.it => Wordlist
The Italian [[wordlist]].
_property: ethers.wordlists.js => Wordlist
_property: ethers.wordlists.ja => Wordlist
The Japanese [[wordlist]].
_property: ethers.wordlists.ko => Wordlist

View File

@ -1,5 +1,3 @@
_title: Assembler
_section: Assembler @<cli-asm>
The assembler Command-Line utility allows you to assemble the

View File

@ -1,6 +1,4 @@
_title: ENS
_section: ENS
_section: Ethereum Naming Service @NAV<ENS>
_subsection: Help

View File

@ -1,5 +1,3 @@
_title: Sandbox Utility
_section: Sandbox Utility
The sandbox utility provides a simple way to use the most common

View File

@ -1,5 +1,3 @@
_title: Command Line Interfaces
_section: Command Line Interfaces
_toc:

View File

@ -1,6 +1,4 @@
_title: Making Your Own
_section: Making Your Own
_section: Making Your Own @<cli-diy>
The //cli// library is meant to make it easy to create command
line utilities of your own.

View File

@ -1,5 +1,3 @@
_title: TypeScript
_section: TypeScript
_subsection: Help

View File

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

View File

@ -1,5 +1,3 @@
_title: Gas
_section: Gas @<gas>
Explain attack vectors

View File

@ -1,5 +1,3 @@
_title: Concepts
_section: Concepts
This is a very breif overview of some aspects of //Ethereum//

View File

@ -100,12 +100,11 @@ const getSourceUrl = (function(path, include, exclude) {
if (!def.filename.match(pathCheck)) { return; }
def.defs.forEach((d) => {
if (!d.name.match(match)) { return; }
result.push({ filename: def.filename, lineNo: d.lineNo });
result.push({ filename: def.filename, lineNo: d.lineNo, name: d.name });
});
});
if (result.length > 1) {
throw new Error(`Amibguous TypeScript link: ${ key } in [ ${ result.map((r) => JSON.stringify(r.filename + ":" + r.lineNo)).join(", ") }]`);
throw new Error(`Ambiguous TypeScript link: ${ key } in [ ${ result.map((r) => JSON.stringify(r.filename + ":" + r.lineNo + "@" + r.name)).join(", ") }]`);
} else if (result.length === 0) {
throw new Error(`No matching TypeScript link: ${ key }`);
}
@ -142,6 +141,7 @@ module.exports = {
"link-metamask": "https:/\/metamask.io/",
"link-parity": "https:/\/www.parity.io",
"link-rtd": "https:/\/github.com/readthedocs/sphinx_rtd_theme",
"link-solidity": { name: "Solidity" , url: "https:/\/solidity.readthedocs.io/en/v0.6.2/" },
"link-sphinx": "https:/\/www.sphinx-doc.org/",
"link-legacy-docs3": "https:/\/docs.ethers.io/ethers.js/v3.0/html/",
@ -167,6 +167,7 @@ module.exports = {
"link-ethers-asm-grammar": "https:/\/github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/asm/grammar.jison",
"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": "https:/\/eips.ethereum.org/EIPS/eip-609",
"link-eip-1014": "https:/\/eips.ethereum.org/EIPS/eip-1014",
"link-eip-2098": "https:/\/eips.ethereum.org/EIPS/eip-2098",
@ -179,6 +180,7 @@ module.exports = {
"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",
"link-js-normalize": { name: "String.normalize", url: "https:/\/developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize" },
"link-js-maxsafe": "https:/\/developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER#Description",
"link-js-typedarray": "https:/\/developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray",
@ -186,7 +188,7 @@ module.exports = {
"link-wiki-basicauth": { name: "Basic Authentication", url: "https:/\/en.wikipedia.org/wiki/Basic_access_authentication" },
"link-wiki-backoff": { name: "Exponential Backoff", url: "https:/\/en.wikipedia.org/wiki/Exponential_backoff" },
"link-wiki-bloomfilter": "https:/\/en.wikipedia.org/wiki/Bloom_filter",
"link-wiki-bloomfilter": { name: "Bloom Filter", url: "https:/\/en.wikipedia.org/wiki/Bloom_filter" },
"link-wiki-cryptographichash": "https:/\/en.wikipedia.org/wiki/Cryptographic_hash_function",
"link-wiki-homoglyph": "https:/\/en.wikipedia.org/wiki/IDN_homograph_attack",
"link-wiki-hmac": "https:/\/en.wikipedia.org/wiki/HMAC",
@ -200,6 +202,7 @@ module.exports = {
"link-wiki-utf8-replacement": "https:/\/en.wikipedia.org/wiki/Specials_%28Unicode_block%29#Replacement_character",
"link-wiki-scrypt": "https:/\/en.wikipedia.org/wiki/Scrypt",
"link-wiki-sha3": "https:/\/en.wikipedia.org/wiki/SHA-3",
"link-wiki-shuffle": { name: "Fisher-Yates Shuffle", url: "https:/\/en.wikipedia.org/wiki/Fisher-Yates_shuffle" },
"link-wiki-overflow": { name: "overflow", url: "https:/\/en.wikipedia.org/wiki/Integer_overflow" },
"link-wiki-underflow": { name: "arithmetic underflow", url: "https:/\/en.wikipedia.org/wiki/Arithmetic_underflow" },
}

View File

@ -1,5 +1,3 @@
_title: Contributing and Hacking
_section: Contributing and Hacking
The ethers.js library is something that I've written out of necessity,

View File

@ -1,5 +1,3 @@
_title: Cookbook
_section: Cookbook
Cooking...

View File

@ -1,5 +1,3 @@
_title: Flatworm Docs
_section: Flatworm Docs
The //Flatworm Docs// rendering script is designed to be **very**
@ -75,7 +73,7 @@ a //definition//, the bodies are indented, so a //null// can be
used to reset the indentation.
_heading: Examples
_heading: Examples @<>
_code: examples.txt
@ -110,6 +108,16 @@ This extended directive function is available for:
- _subsetion
- _heading
_heading: @NAV\<text>
Sets the name in the breadcrumbs when not the current node.
This extended directive function is available for:
- _section
_heading: @SRC\<text>
Calls the configuration ``getSourceUrl(text, VALUE)`` to get a URL which

View File

@ -1,5 +1,3 @@
_title: Getting Started
_section: Getting Started

View File

@ -1,5 +1,3 @@
_title: Hacking
_section: Hacking
Things to keep in mind:

View File

@ -1,6 +1,6 @@
_title: Documentation
_section: Documentation
_section: What is ethers?
_subsection: What is Ethers?
The ethers.js library aims to be a complete and compact library for
interacting with the Ethereum Blockchain and its ecosystem. It was

View File

@ -1,7 +1,4 @@
_title: License and Copyright
_section: License and Copyright
_section: License and Copyright @<license>
The ethers library (including all dependencies) are available
under the [MIT License](link-mit), which permits a wide variety

View File

@ -1,6 +1,4 @@
_title: ethers v4 to v5
_section: Migration: From Ethers v4
_section: Migration: From Ethers v4 @<migration-v4>
_subsection: BigNumber

View File

@ -1,6 +1,4 @@
_title: Migration Guide
_section: Migration Guide
_section: Migration Guide @<migration>
Here are some migration guides when upgrading from older versions
of Ethers or other libraries.

View File

@ -1,5 +1,3 @@
_title: Migration: From Web3.js
_section: Migration: From Web3.js
TODO

View File

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

View File

@ -4,9 +4,13 @@ Documentation: [html](https://docs-beta.ethers.io/)
-----
Documentation
=============
What is ethers?
===============
What is Ethers?
---------------
The ethers.js library aims to be a complete and compact library for
@ -50,8 +54,19 @@ Developer Documentation
* [Gas Price](concepts/gas)
* [Gas Limit](concepts/gas)
* [Application Programming Interface](api)
* [Contracts](api/contract)
* [Buckets](api/contract)
* [Contract Interaction](api/contract)
* [Contract](api/contract/contract)
* [Properties](api/contract/contract)
* [Methods](api/contract/contract)
* [Events](api/contract/contract)
* [Meta-Class](api/contract/contract)
* [Example: ERC-20 Contract](api/contract/example)
* [Connecting to a Contract](api/contract/example)
* [Properties ^^//(inheritted from [[contract]])//^^](api/contract/example)
* [Methods ^^//(inheritted from [[contract]])//^^](api/contract/example)
* [Events ^^//(inheritted from Contract)//^^](api/contract/example)
* [Meta-Class Methods ^^//(added at Runtime)//^^](api/contract/example)
* [Meta-Class Filters ^^//(added at Runtime)//^^](api/contract/example)
* [Signers](api/signer)
* [Signer](api/signer)
* [Wallet](api/signer)
@ -81,19 +96,31 @@ Developer Documentation
* [UrlJsonRpcProvider](api/providers/other)
* [Web3Provider](api/providers/other)
* [Types](api/providers/types)
* [BlockTag](api/providers/types)
* [Network](api/providers/types)
* [Block](api/providers/types)
* [Events and Logs](api/providers/types)
* [Transactions](api/providers/types)
* [Utilities](api/utils)
* [Application Binary Interface](api/utils/abi)
* [Formats](api/utils/abi)
* [Interface](api/utils/abi)
* [Fragment](api/utils/abi)
* [ConstructorFragment](api/utils/abi)
* [EventFragment](api/utils/abi)
* [FunctionFragment](api/utils/abi)
* [ParamType](api/utils/abi)
* [Interface](api/utils/abi/interface)
* [Creating Instances](api/utils/abi/interface)
* [Properties](api/utils/abi/interface)
* [Formatting](api/utils/abi/interface)
* [Fragment Access](api/utils/abi/interface)
* [Signature and Topic Hashes](api/utils/abi/interface)
* [Encoding Data](api/utils/abi/interface)
* [Decoding Data](api/utils/abi/interface)
* [Parsing](api/utils/abi/interface)
* [Types](api/utils/abi/interface)
* [Specifying Fragments](api/utils/abi/interface)
* [Fragments](api/utils/abi/fragments)
* [Formats](api/utils/abi/fragments)
* [Fragment](api/utils/abi/fragments)
* [ConstructorFragment](api/utils/abi/fragments)
* [EventFragment](api/utils/abi/fragments)
* [FunctionFragment](api/utils/abi/fragments)
* [ParamType](api/utils/abi/fragments)
* [Addresses](api/utils/address)
* [Address Formats](api/utils/address)
* [Functions](api/utils/address)
@ -134,9 +161,10 @@ Developer Documentation
* [Types](api/utils/hdnode)
* [HDNode](api/utils/hdnode)
* [Other Functions](api/utils/hdnode)
* [Logger](api/utils/logger)
* [Logging](api/utils/logger)
* [Logger](api/utils/logger)
* [Errors](api/utils/logger)
* [Creating instances](api/utils/logger)
* [Log Levels](api/utils/logger)
* [Property Utilities](api/utils/properties)
* [Signing Key](api/utils/signing-key)
* [Other Functions](api/utils/signing-key)
@ -182,7 +210,7 @@ Developer Documentation
* [Example Input Files](cli/asm)
* [Assembler Examples](cli/asm)
* [Disassembler Examples](cli/asm)
* [ENS](cli/ens)
* [Ethereum Naming Service](cli/ens)
* [Help](cli/ens)
* [Examples](cli/ens)
* [TypeScript](cli/typescript)
@ -232,4 +260,4 @@ older versions of the library.
-----
**Content Hash:** e47c57b222edf98628be3e6d682eba93201d2163e7e059d2a963004f8ee81059
**Content Hash:** 1ccc27c4ba6e59efa2be69cc0fb345ea9c397f1f4444d08ec13780d0d1a46b60

View File

@ -4,16 +4,26 @@ Documentation: [html](https://docs-beta.ethers.io/)
-----
Application Programming Interface (API)
=======================================
Application Programming Interface
=================================
Here...
* [Contracts](contract)
* [Buckets](contract)
* [Contract Interaction](contract)
* [Contract](contract/contract)
* [Properties](contract/contract)
* [Methods](contract/contract)
* [Events](contract/contract)
* [Meta-Class](contract/contract)
* [Example: ERC-20 Contract](contract/example)
* [Connecting to a Contract](contract/example)
* [Properties ^^//(inheritted from [[contract]])//^^](contract/example)
* [Methods ^^//(inheritted from [[contract]])//^^](contract/example)
* [Events ^^//(inheritted from Contract)//^^](contract/example)
* [Meta-Class Methods ^^//(added at Runtime)//^^](contract/example)
* [Meta-Class Filters ^^//(added at Runtime)//^^](contract/example)
* [Signers](signer)
* [Signer](signer)
* [Wallet](signer)
@ -43,19 +53,31 @@ Here...
* [UrlJsonRpcProvider](providers/other)
* [Web3Provider](providers/other)
* [Types](providers/types)
* [BlockTag](providers/types)
* [Network](providers/types)
* [Block](providers/types)
* [Events and Logs](providers/types)
* [Transactions](providers/types)
* [Utilities](utils)
* [Application Binary Interface](utils/abi)
* [Formats](utils/abi)
* [Interface](utils/abi)
* [Fragment](utils/abi)
* [ConstructorFragment](utils/abi)
* [EventFragment](utils/abi)
* [FunctionFragment](utils/abi)
* [ParamType](utils/abi)
* [Interface](utils/abi/interface)
* [Creating Instances](utils/abi/interface)
* [Properties](utils/abi/interface)
* [Formatting](utils/abi/interface)
* [Fragment Access](utils/abi/interface)
* [Signature and Topic Hashes](utils/abi/interface)
* [Encoding Data](utils/abi/interface)
* [Decoding Data](utils/abi/interface)
* [Parsing](utils/abi/interface)
* [Types](utils/abi/interface)
* [Specifying Fragments](utils/abi/interface)
* [Fragments](utils/abi/fragments)
* [Formats](utils/abi/fragments)
* [Fragment](utils/abi/fragments)
* [ConstructorFragment](utils/abi/fragments)
* [EventFragment](utils/abi/fragments)
* [FunctionFragment](utils/abi/fragments)
* [ParamType](utils/abi/fragments)
* [Addresses](utils/address)
* [Address Formats](utils/address)
* [Functions](utils/address)
@ -96,9 +118,10 @@ Here...
* [Types](utils/hdnode)
* [HDNode](utils/hdnode)
* [Other Functions](utils/hdnode)
* [Logger](utils/logger)
* [Logging](utils/logger)
* [Logger](utils/logger)
* [Errors](utils/logger)
* [Creating instances](utils/logger)
* [Log Levels](utils/logger)
* [Property Utilities](utils/properties)
* [Signing Key](utils/signing-key)
* [Other Functions](utils/signing-key)
@ -139,4 +162,4 @@ Here...
-----
**Content Hash:** be5b26283f92ba2629be4efa3939fb71d8b7d3531bd335a1bd7b5b8386eaf876
**Content Hash:** 792936ddc8c609e435d356c2bfde1adacf9f0b5b708481720f22081f1a61f73d

View File

@ -4,20 +4,27 @@ Documentation: [html](https://docs-beta.ethers.io/)
-----
Contracts
=========
Contract Interaction
====================
Explain what contracts are...
Buckets
-------
* [Contract](contract)
* [Properties](contract)
* [Methods](contract)
* [Events](contract)
* [Meta-Class](contract)
* [Example: ERC-20 Contract](example)
* [Connecting to a Contract](example)
* [Properties ^^//(inheritted from [[contract]])//^^](example)
* [Methods ^^//(inheritted from [[contract]])//^^](example)
* [Events ^^//(inheritted from Contract)//^^](example)
* [Meta-Class Methods ^^//(added at Runtime)//^^](example)
* [Meta-Class Filters ^^//(added at Runtime)//^^](example)
-----
**Content Hash:** 190c93691014eae64ffcb66549f127aa73f4645fc7a4b3a2be9ae00216c79cf6
**Content Hash:** f1a5079be018a7b2e6ce8b86a5a191f7a1352b976434766ea16cec21d0ce3b80

View File

@ -0,0 +1,284 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Contract
========
Properties
----------
#### *contract* . **address** **=>** *string< [Address](../../utils/address) >*
This is the address (or ENS name) the contract was constructed with.
#### *contract* . **addressPromise** **=>** *string< [Address](../../utils/address) >*
This is a promise that will resolve to the address the **Contract**
object is attached to. If an [Address](../../utils/address) was provided to the constructor,
it will be equal to this; if an ENS name was provided, this will be the
resolved address.
#### *contract* . **deployTransaction** **=>** *[TransactionResponse](../../providers/types)*
If the **Contract** object is the result of a ContractFactory deployment,
this is the transaction which was used to deploy the contract.
#### *contract* . **interface** **=>** *[Interface](../../utils/abi/interface)*
This is the ABI as an [Interface](../../utils/abi/interface).
#### *contract* . **provider** **=>** *[Provider](../../providers/provider)*
If a provider was provided to the constructor, this is that provider. If
a signer was provided that had a [Provider](../../providers/provider), this is that provider.
#### *contract* . **signer** **=>** *[Signer](../../signer)*
If a signer was provided to the constructor, this is that signer.
Methods
-------
#### *contract* . **attach** ( addressOrName ) **=>** *[Contract](./)*
Returns a new instance of the **Contract** attached to a new
address. This is useful if there are multiple similar or identical
copies of a Contract on the network and you wish to interact with
each of them.
#### *contract* . **connect** ( providerOrSigner ) **=>** *[Contract](./)*
Returns a new instance of the Contract, but connected to
*providerOrSigner*.
By passing in a [Provider](../../providers/provider), this will return a downgraded
**Contract** which only has read-only access (i.e. constant calls).
By passing in a [Signer](../../signer). the will return a **Contract** which
will act on behalf of that signer.
#### *contract* . **deployed** ( ) **=>** *Promise< [Contract](./) >*
#### *Contract* . **isIndexed** ( value ) **=>** *boolean*
Events
------
#### *contract* . **queryFilter** ( event [ , fromBlockOrBlockHash [ , toBlock ] ) **=>** *Promise< Array< Event > >*
Return Events that match the *event*.
#### *contract* . **listenerCount** ( [ event ] ) **=>** *number*
Return the number of listeners that are subscribed to *event*. If
no event is provided, returns the total count of all events.
#### *contract* . **listeners** ( event ) **=>** *Array< Listener >*
Return a list of listeners that are subscribed to *event*.
#### *contract* . **off** ( event , listener ) **=>** *this*
Unsubscribe *listener* to *event*.
#### *contract* . **on** ( event , listener ) **=>** *this*
Subscribe to *event* calling *listener* when the event occurs.
#### *contract* . **once** ( event , listener ) **=>** *this*
Subscribe once to *event* calling *listener* when the event
occurs.
#### *contract* . **removeAllListeners** ( [ event ] ) **=>** *this*
Unsubscribe all listeners for *event*. If no event is provided,
all events are unsubscribed.
Meta-Class
----------
A Meta-Class is a Class which has any of its properties determined
at run-time. The **Contract** object uses a Contract's ABI to
determine what methods are available, so the following sections
describe the generic ways to interact with the properties added
at run-time during the **Contract** constructor.
### Read-Only Methods (constant)
A constant method is read-only and evaluates a small amount of EVM
code against the current blockchain state and can be computed by
asking a single node, which can return a result. It is therefore
free and does not require any ether, but **cannot make changes** to
the blockchain state..
#### *contract* . **METHOD_NAME** ( ...args [ overrides ] ) **=>** *Promise< any >*
The type of the result depends on the ABI.
For values that have a simple meaning in JavaScript, the types are fairly
straight forward; strings and booleans are returned as JavaScript strings
and booleans.
For numbers, if the **type** is in the JavaSsript safe range (i.e. less
than 53 bits, such as an `int24` or `uint48`) a normal JavaScript
number is used. Otherwise a [BigNumber](../../utils/bignumber) is returned.
For bytes (both fixed length and dynamic), a [DataHexstring](../../utils/bytes) is returned.
### Write Methods (non-constant)
A non-constant method requires a transaction to be signed and requires
payment in the form of a fee to be paid to a miner. This transaction
will be verified by every node on the entire network as well by the
miner who will compute the new state of the blockchain after executing
it against the current state.
It cannot return a result. If a result is required, it should be logged
using a Solidity event (or EVM log), which can then be queried from the
transaction receipt.
#### *contract* . **METHOD_NAME** ( ...args [ , overrides ] ) **=>** *Promise< [TransactionResponse](../../providers/types) >*
Returns a [TransactionResponse](../../providers/types) for the transaction after
it is sent to the network. This requires the **Contract** has a
signer.
### Write Methods Analysis
There are secveral options to analyze properties and results of a
write method without actually executing it.
#### *contract* . *estimate* . **METHOD_NAME** ( ...args [ , overrides ] ) **=>** *Promise< [BigNumber](../../utils/bignumber) >*
Returns the estimate units of gas that would be required to
execute the *METHOD_NAME* with *args* and *overrides*.
#### *contract* . *populateTransaction* . **METHOD_NAME** ( ...args [ , overrides ] ) **=>** *Promise< [UnsignedTx](../../utils/transactions) >*
Returns an [UnsignedTransaction](../../utils/transactions) which represents the transaction
that would need to be signed and submitted to the network to execute
*METHOD_NAME* with *args/ and *overrides//.
#### *contract* . *staticCall* . **METHOD_NAME** ( ...args [ , overrides ] ) **=>** *Promise< any >*
Rather than executing the state-change of a transaction, it is possible
to ask a node to *pretend* that a call is not state-changing and
return the result.
This does not actually chagne any state, but is free. This in some cases
can be used to determine if a transaction will fail or succeed.
This otherwise functions the same as a [Read-Only Method](./).
### Event Filters
An event filter is made up of topics, which are values logged in a
[Bloom Filter](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/en.wikipedia.org/wiki/Bloom_filter), allowing efficient searching for entries
which match a filter.
#### *contract* . *filters* . **EVENT_NAME** ( ...args ) **=>** *Filter*
Return a filter for *EVENT_NAME*, optionally filtering by additional
constraints.
Only `indexed` event parameters may be filtered. If a parameter is
null (or not provided) then any value in that field matches.
-----
**Content Hash:** 8f1f64a28b2501d01dcf4b55c405c43096f3a9daca7169a96022000a315b2ef2

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,323 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Example: ERC-20 Contract
========================
Connecting to a Contract
------------------------
```
// A Human-Readable ABI; any supported ABI format could be used
const abi = [
// Read-Only Functions
"function balanceOf(address owner) view returns (uint256)",
"function decimals() view returns (uint8)",
"function symbol() view returns (string)",
// Authenticated Functions
"function transfer(address to, uint amount) returns (boolean)",
// Events
"event Transfer(address indexed from, address indexed to, uint amount)"
];
// This can be an address or an ENS name
const address = "demotoken.ethers.eth";
// An example Provider (connceted to testnet)
const provider = ethers.getDefaultProvider("ropsten");
// An example Signer
const signer = ethers.Wallet.createRandom(provider);
// Read-Only; By connecting to a Provider, allows:
// - Any constant function
// - Querying Filters
// - Populating Unsigned Transactions for non-constant methods
// - Estimating Gas for non-constant (as an anonymous sender)
// - Static Calling non-constant methods (as anonymous sender)
const erc20 = new ethers.Contract(address, abi, provider);
// Read-Write; By connecting to a Signer, allows:
// - Everything from Read-Only (except as Signer, not anonymous)
// - Sending transactions for non-constant functions
const erc20_rw = new ethers.Contract(address, abi, signer)
```
### ERC20Contract
#### **new** *ethers* . **Contract** ( address , abi , providerOrSigner )
See the above code example for creating an Instance which will
(in addition to the Contact methods and properties) automatically
add the additional properties defined in *abi* to a **Contract**
connected to *address* using the *providerOrSigner*.
Properties ^(*(inheritted from [Contract](../contract))*)
---------------------------------------------------------
#### *erc20* . **address** **=>** *string< [Address](../../utils/address) >*
This is the address (or ENS name) the contract was constructed with.
#### *erc20* . **addressPromise** **=>** *string< [Address](../../utils/address) >*
This is a promise that will resolve to the address the **Contract**
object is attached to. If an [Address](../../utils/address) was provided to the constructor,
it will be equal to this; if an ENS name was provided, this will be the
resolved address.
#### *erc20* . **deployTransaction** **=>** *[TransactionResponse](../../providers/types)*
If the **Contract** object is the result of a ContractFactory deployment,
this is the transaction which was used to deploy the contract.
#### *erc20* . **interface** **=>** *[Interface](../../utils/abi/interface)*
This is the ABI as an [Interface](../../utils/abi/interface).
#### *erc20* . **provider** **=>** *[Provider](../../providers/provider)*
If a provider was provided to the constructor, this is that provider. If
a signer was provided that had a [Provider](../../providers/provider), this is that provider.
#### *erc20* . **signer** **=>** *[Signer](../../signer)*
If a signer was provided to the constructor, this is that signer.
Methods ^(*(inheritted from [Contract](../contract))*)
------------------------------------------------------
#### *erc20* . **attach** ( addressOrName ) **=>** *[Contract](../contract)*
Returns a new instance of the **Contract** attached to a new
address. This is useful if there are multiple similar or identical
copies of a Contract on the network and you wish to interact with
each of them.
#### *erc20* . **connect** ( providerOrSigner ) **=>** *[Contract](../contract)*
Returns a new instance of the Contract, but connected to
*providerOrSigner*.
By passing in a [Provider](../../providers/provider), this will return a downgraded
**Contract** which only has read-only access (i.e. constant calls).
By passing in a [Signer](../../signer). the will return a **Contract** which
will act on behalf of that signer.
#### *erc20* . **deployed** ( ) **=>** *Promise< Contract >*
#### *Contract* . **isIndexed** ( value ) **=>** *boolean*
Events ^(*(inheritted from Contract)*)
--------------------------------------
#### *erc20* . **queryFilter** ( event [ , fromBlockOrBlockHash [ , toBlock ] ) **=>** *Promise< Array< Event > >*
Return Events that match the *event*.
#### *erc20* . **listenerCount** ( [ event ] ) **=>** *number*
Return the number of listeners that are subscribed to *event*. If
no event is provided, returns the total count of all events.
#### *erc20* . **listeners** ( event ) **=>** *Array< Listener >*
Return a list of listeners that are subscribed to *event*.
#### *erc20* . **off** ( event , listener ) **=>** *this*
Unsubscribe *listener* to *event*.
#### *erc20* . **on** ( event , listener ) **=>** *this*
Subscribe to *event* calling *listener* when the event occurs.
#### *erc20* . **once** ( event , listener ) **=>** *this*
Subscribe once to *event* calling *listener* when the event
occurs.
#### *erc20* . **removeAllListeners** ( [ event ] ) **=>** *this*
Unsubscribe all listeners for *event*. If no event is provided,
all events are unsubscribed.
Meta-Class Methods ^(*(added at Runtime)*)
------------------------------------------
Since the Contract is a Meta-Class, the methods available here depend
on the ABI which was passed into the **Contract**.
#### *erc20* . **decimals** ( [ overrides ] ) **=>** *Promise< number >*
Returns the number of decimal places used by this ERC-20 token. This can be
used with [parseUnits](../../utils/display-logic) when taking input from the user or
[formatUnits](utils-formatunits] when displaying the token amounts in the UI.
#### *erc20* . **getBalance** ( owner [ , overrides ] ) **=>** *Promise< [BigNumber](../../utils/bignumber) >*
Returns the balance of *owner* for this ERC-20 token.
#### *erc20* . **symbol** ( [ overrides ] ) **=>** *Promise< string >*
Returns the symbol of the token.
#### *erc20_rw* . **transfer** ( target , amount [ , overrides ] ) **=>** *Promise< [TransactionResponse](../../providers/types) >*
Transfers *amount* tokens to *target* from the current signer.
The return value (a boolean) is inaccessible during a write operation
using a transaction. Other techniques (such as events) are required
if this value is required. On-chain contracts calling the `transfer`
function have access to this result, which is why it is possible.
#### *erc20* . *callStatic* . **transfer** ( target , amount [ , overrides ] ) **=>** *Promise< boolean >*
Performs a dry-run of transferring *amount* tokens to *target* from
the current signer, without actually signing or sending a transaction.
This can be used to preflight check that a transaction will be successful.
#### *erc20* . *estimate* . **transfer** ( target , amount [ , overrides ] ) **=>** *Promise< [BigNumber](../../utils/bignumber) >*
Returns an estimate for how many units of gas would be required
to transfer *amount* tokens to *target*.
#### *erc20* . *populateTransaction* . **transfer** ( target , amount [ , overrides ] ) **=>** *Promise< [UnsignedTx](../../utils/transactions) >*
Returns an [UnsignedTransaction](../../utils/transactions) which could be signed and submitted
to the network to transaction *amount* tokens to *target*.
#### Note on Estimating and Static Calling
When you perform a static call, the current state is taken into account as
best as Ethereum can determine. There are many cases where this can provide
false positives and false negatives. The eventually consistent model of the
blockchain also means there are certain consistency modes that cannot be
known until an actual transaction is attempted.
Meta-Class Filters ^(*(added at Runtime)*)
------------------------------------------
Since the Contract is a Meta-Class, the methods available here depend
on the ABI which was passed into the **Contract**.
#### *erc20* . *filters* . **Transafer** ( [ fromAddress [ , toAddress ] ] ) **=>** *Filter*
Returns a new Filter which can be used to [query](./) or
to [subscribe/unsubscribe to events](./).
If *fromAddress* is null or not provided, then any from address matches.
If *toAddress* is null or not provided, then any to address matches.
-----
**Content Hash:** a3d2ad294a2b4b4500d3f80c7a1cdc76420fee234ad271d90f5c609b040e93fa

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

@ -4,7 +4,6 @@ Documentation: [html](https://docs-beta.ethers.io/)
-----
Other Libraries
===============
@ -38,4 +37,4 @@ add functionality only needed in certain situations.
-----
**Content Hash:** d29ef5cbebb1685588a99b27e7fd65a813eed036f47e893be17b8e02b70bd798
**Content Hash:** 90507a9035452f2463c81dc6ce204622750f4781dd52673cf666afae6e607577

View File

@ -4,7 +4,6 @@ Documentation: [html](https://docs-beta.ethers.io/)
-----
Assembly
========
@ -31,4 +30,4 @@ Assembly
-----
**Content Hash:** 788fa8cbceed019d051941c427df5e77f74cc536d125f33b680f16d2e4aa508a
**Content Hash:** c29497e2f7fe90669ffd6c67b0231649074fcb869470caa58750ddbc39905727

View File

@ -4,7 +4,6 @@ Documentation: [html](https://docs-beta.ethers.io/)
-----
Utilities
=========
@ -182,4 +181,4 @@ of bytes this opcode will push if it is.
-----
**Content Hash:** 1c170b94b22fa807a3906f95d76719a78fba6627996b108356643ef72b21f940
**Content Hash:** d71fdeafad470effc353664c161dec6982a9c29b1015a5726fd2a3f576f8e377

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,6 @@ Documentation: [html](https://docs-beta.ethers.io/)
-----
Abstract Syntax Tree
====================
@ -249,4 +248,4 @@ The list of child nodes for this scope.
-----
**Content Hash:** ee220fb350a143a9868feecd1513ad6a66dbb033b8c108852cfe86fe8dcd871a
**Content Hash:** 27350094145eafe8e3b166698c29705f2edee81f6126de4e45d957a7c35a7109

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,6 @@ Documentation: [html](https://docs-beta.ethers.io/)
-----
Ethers ASM Dialect
==================
@ -143,4 +142,4 @@ Evaluation and Excution
-----
**Content Hash:** 71e165b7b78bd1080c3c1cabf9e19ddc21f1fdd440f945e8225d263f00cc4789
**Content Hash:** b8f100efb0bd6c794cc6d4ae97c0243e10e6c2fe471cf16ba4e751ed43722bba

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,6 @@ Documentation: [html](https://docs-beta.ethers.io/)
-----
Hardware Wallets
================
@ -35,4 +34,4 @@ determined by the environment; in node the default is "hid" and in the browser
-----
**Content Hash:** c6b6d4f14f0e973a30c3cff935960a15715712830e38cece0edfb864ba921a6c
**Content Hash:** 04412211499f34796f91e7112977e6f84607638be72dc600e488df07c4465805

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,6 @@ Documentation: [html](https://docs-beta.ethers.io/)
-----
Providers
=========
@ -78,6 +77,7 @@ Provider Documentation
* [UrlJsonRpcProvider](other)
* [Web3Provider](other)
* [Types](types)
* [BlockTag](types)
* [Network](types)
* [Block](types)
* [Events and Logs](types)
@ -86,4 +86,4 @@ Provider Documentation
-----
**Content Hash:** 90fa0754bfed9594694637e2d5167de53e514a4c3527cd10a42083488ad112bf
**Content Hash:** 29575fb7fa8a7a126446a463e402b3d444aaf8a36c9226d0644466e3ff899b07

View File

@ -4,7 +4,6 @@ Documentation: [html](https://docs-beta.ethers.io/)
-----
API Providers
=============
@ -107,4 +106,4 @@ The CloudfrontProvider is backed by the [Cloudflare Ethereum Gateway](../../../U
-----
**Content Hash:** 8a464bf5a272f32a697857e4e5813b1569ee9293156f77dcfa8f4bd71a8e5c9f
**Content Hash:** 79ad5dae92f00fc2ef2aceff6620ed9ae5f12d92d9e29ebc6be1c5752e65322f

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,6 @@ Documentation: [html](https://docs-beta.ethers.io/)
-----
JsonRpcProvider
===============
@ -131,4 +130,4 @@ transaction hash quickly, if that is all that is required.
-----
**Content Hash:** d05797dcbeabc9dbd764aad98f3c9346b4350e955a4a6210d6d0a6ea17d3a50b
**Content Hash:** d60a1c5ef2f317ae59bc4b22a1e9d079f1762f60f6321b5da1efbe07d8284284

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,6 @@ Documentation: [html](https://docs-beta.ethers.io/)
-----
Other Providers
===============
@ -185,4 +184,4 @@ The provider used to create this instance.
-----
**Content Hash:** 38479cce7fbf5192e1085bce407362ec5169b3a56f42f27e515a623ffeab670b
**Content Hash:** e85f8ef6e4b1924ef63365dd6f761aa0ef5db23ebdd124686763d5061551a8bf

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,6 @@ Documentation: [html](https://docs-beta.ethers.io/)
-----
Provider
========
@ -273,4 +272,4 @@ Returns true if and only if *object* is a Provider.
-----
**Content Hash:** 84bebb527966dbb498f230579a26f0a01f8013a69a490b77726126165262f661
**Content Hash:** 22872aec1236c5cf8fb457e93f36ca9bcd260acddc08c1ededc642931fd1625f

File diff suppressed because one or more lines are too long

View File

@ -4,13 +4,13 @@ Documentation: [html](https://docs-beta.ethers.io/)
-----
Types
=====
### BlockTag
BlockTag
--------
A **BlockTag** specifies a specific location in the Blockchain.
@ -582,4 +582,4 @@ have this property.
-----
**Content Hash:** 8e36229154dd0afe40cd45ca1043bde05c78a54779aa56728d8ba585ba288978
**Content Hash:** 911f42520657ebece6d9fe0456cae0540134758a7253057c42acffac94fb0895

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,6 @@ Documentation: [html](https://docs-beta.ethers.io/)
-----
Signers
=======
@ -330,6 +329,10 @@ ExternallyOwnedAccount
----------------------
This is an interface which contains a minimal set of properties
required for Externally Owned Accounts which can have certain
operations performed, such as encoding as a JSON wallet.
#### *eoa* . **address** **=>** *string< [Address](../utils/address) >*
@ -345,20 +348,15 @@ The privateKey of this EOA
#### *eoa* . **mnemonic** **=>** *string*
#### *eoa* . **mnemonic** **=>** *[Mnemonic](../utils/hdnode)*
*Optional*. The account HD mnemonic, if it has one and can be determined.
#### *eoa* . **path** **=>** *string*
*Optional*. The account HD path, if it has one and can be determined.
*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.
-----
**Content Hash:** 0d8eb5d3cf69da2ecac958fba6a88d9f4d1aa6c6545354a2b00ccee770832c96
**Content Hash:** 142e4d9da1f8b8a900a2e97de899649447054c6addb8cba0fb3342ff02d29fd8

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,6 @@ Documentation: [html](https://docs-beta.ethers.io/)
-----
Utilities
=========
@ -14,13 +13,24 @@ are also quite useful for application developers.
* [Application Binary Interface](abi)
* [Formats](abi)
* [Interface](abi)
* [Fragment](abi)
* [ConstructorFragment](abi)
* [EventFragment](abi)
* [FunctionFragment](abi)
* [ParamType](abi)
* [Interface](abi/interface)
* [Creating Instances](abi/interface)
* [Properties](abi/interface)
* [Formatting](abi/interface)
* [Fragment Access](abi/interface)
* [Signature and Topic Hashes](abi/interface)
* [Encoding Data](abi/interface)
* [Decoding Data](abi/interface)
* [Parsing](abi/interface)
* [Types](abi/interface)
* [Specifying Fragments](abi/interface)
* [Fragments](abi/fragments)
* [Formats](abi/fragments)
* [Fragment](abi/fragments)
* [ConstructorFragment](abi/fragments)
* [EventFragment](abi/fragments)
* [FunctionFragment](abi/fragments)
* [ParamType](abi/fragments)
* [Addresses](address)
* [Address Formats](address)
* [Functions](address)
@ -61,9 +71,10 @@ are also quite useful for application developers.
* [Types](hdnode)
* [HDNode](hdnode)
* [Other Functions](hdnode)
* [Logger](logger)
* [Logging](logger)
* [Logger](logger)
* [Errors](logger)
* [Creating instances](logger)
* [Log Levels](logger)
* [Property Utilities](properties)
* [Signing Key](signing-key)
* [Other Functions](signing-key)
@ -83,4 +94,4 @@ are also quite useful for application developers.
-----
**Content Hash:** 96bd0d92678b30c766203c98bbadbee19c546aa9d34a50ee6bab3b869b704e6e
**Content Hash:** 5be9157e89f865d007e6b7e1fb3bb47369a474882824264c5241e5bb05c80865

View File

@ -4,403 +4,31 @@ Documentation: [html](https://docs-beta.ethers.io/)
-----
Application Binary Interface
============================
Explain an ABI.
Formats
-------
### JSON String ABI (Solidity Output JSON)
The **JSON ABI Format** is the format that is
[output from the Solidity compiler](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/solidity.readthedocs.io/en/v0.6.0/using-the-compiler.html).
A JSON serialized object is always a string, which represents an Array
of Objects, where each Object has various properties describing the [Fragment](./) of the ABI.
The deserialied JSON string (which is a normal JavaScript Object) may
also be passed into any function which accepts a JSON String ABI.
### Humanb-Readable ABI
The Human-Readable ABI was
[article](../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/blog.ricmoo.com/human-readable-contract-abis-in-ethers-js-141902f4d917)
### Output Formats
Each [Fragment](./) and [ParamType](./) may be output using its `format`
method.
#### *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.
#### *utils* . *FragmentTypes* . **minimal** **=>** *string*
This is similar to `full`, except with no unnecessary whitespace or parameter
names. This is useful for storing a minimal string which can still fully
reconstruct the original Fragment using [Fragment&thinsp;.&thinsp;from](./).
#### *utils* . *FragmentTypes* . **json** **=>** *string*
This returns a JavaScript Object which is safe to call `JSON.stringify`
on to create a JSON string.
#### *utils* . *FragmentTypes* . **sighash** **=>** *string*
This is a minimal output format, which is used by Solidity when computing a
signature hash or an event topic hash.
#### Note
The `sighash` format is **insufficient** to re-create the original [Fragment](./),
since it discards modifiers such as indexed, anonymous, stateMutability, etc.
Interface
---------
TODO
Fragment
--------
An ABI is a collection of **Fragments**, where each fragment specifies:
* An Event
* A Function
* A Constructor
### Properties
#### *fragment* . **name** **=>** *string*
This is the name of the Event or Function. This will be null for
a [ConstructorFragment](./).
#### *fragment* . **type** **=>** *string*
This is a string which indicates the type of the [Fragment](./). This
will be one of:
* `constructor`
* `event`
* `function`
#### *fragment* . **inputs** **=>** *Array< [ParamType](./) >*
This is an array of of each [ParamType](./) for the input parameters to
the Constructor, Event of Function.
### Methods
#### *utils* . *Fragment* . **from** ( objectOrString ) **=>** *[Fragment](./)*
Returns a
#### *utils* . *Fragment* . **isFragment** ( object ) **=>** *boolean*
Tra lal al
ConstructorFragment
-------------------
### Properties
#### *fragment* . **gas** **=>** *[BigNumber](../bignumber)*
This is the gas limit that should be used during deployment. It may be
null.
#### *fragment* . **payable** **=>** *boolean*
This is whether the constructor may receive ether during deployment as
an endowment (i.e. msg.value != 0).
#### *fragment* . **stateMutability** **=>** *string*
This is the state mutability of the constructor. It can be any of:
* `nonpayable`
* `payable`
### Methods
#### *utils* . *ConstructorFragment* . **from** ( objectOrString ) **=>** *[ConstructorFragment](./)*
Tra la la...
#### *utils* . *ConstructorFragment* . **isConstructorFragment** ( object ) **=>** *boolean*
Tra lal al
EventFragment
-------------
### Properties
#### *fragment* . **anonymous** **=>** *boolean*
This is whether the event is anonymous. An anonymous Event does not inject its
topic hash as topic0 when creating a log.
### Methods
#### *utils* . *EventFragment* . **from** ( objectOrString ) **=>** *[EventFragment](./)*
Tra la la...
#### *utils* . *EventFragment* . **isEventFragment** ( object ) **=>** *boolean*
Tra lal al
FunctionFragment
----------------
### Properties
#### *fragment* . **constant** **=>** *boolean*
This is whether the function is constant (i.e. does not change state). This
is true if the state mutability is `pure` or `view`.
#### *fragment* . **stateMutability** **=>** *string*
This is the state mutability of the constructor. It can be any of:
* `nonpayable`
* `payable`
* `pure`
* `view`
#### *fragment* . **outputs** **=>** *Array< [ParamType](./) >*
A list of the Function output parameters.
### Method
#### *utils* . *FunctionFragment* . **from** ( objectOrString ) **=>** *[FunctionFragment](./)*
Tra la la...
#### *utils* . *FunctionFragment* . **isFunctionFragment** ( object ) **=>** *boolean*
Tra lal al
ParamType
---------
The following examples will represent the Solidity parameter:
`string foobar`
### Properties
#### *paramType* . **name** **=>** *string*
The local parameter name. This may be null for unnamed parameters. For example,
the parameter definition `string foobar` would be `foobar`.
#### *paramType* . **type** **=>** *string*
The full type of the parameter, including tuple and array symbols. This may be null
for unnamed parameters. For the above example, this would be `foobar`.
#### *paramType* . **basetype** **=>** *string*
The base type of the parameter. For primitive types (e.g. `address`, `uint256`, etc)
this is equal to [type](./). For arrays, it will be the string `array` and for
a tuple, it will be the string `tuple`.
#### *paramType* . **indexed** **=>** *boolean*
Whether the parameter has been marked as indexed. This **only** applies
to parameters which are part of an [EventFragment](./).
#### *paramType* . **arrayChildren** **=>** *[ParamType](./)*
The type of children of the array. This is null for for any parameter
wjhich 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.
#### *paramType* . **components** **=>** *Array< [ParamType](./) >*
The components of a tuple. This is null for non-tuple parameters.
### Methods
Tra la la...
#### *paramType* . **format** ( [ outputType="sighash" ] )
Tra la la...
#### *utils* . *ParamType* . **from** ( objectOrString ) **=>** *[ParamType](./)*
Tra la la...
#### *utils* . *ParamType* . **isParamType** ( object ) **=>** *boolean*
Tra la la...
* [Interface](interface)
* [Creating Instances](interface)
* [Properties](interface)
* [Formatting](interface)
* [Fragment Access](interface)
* [Signature and Topic Hashes](interface)
* [Encoding Data](interface)
* [Decoding Data](interface)
* [Parsing](interface)
* [Types](interface)
* [Specifying Fragments](interface)
* [Fragments](fragments)
* [Formats](fragments)
* [Fragment](fragments)
* [ConstructorFragment](fragments)
* [EventFragment](fragments)
* [FunctionFragment](fragments)
* [ParamType](fragments)
-----
**Content Hash:** 139ec4826ff24c5f5ca9c964bc0432e3b3065f90a5b012744b2ff43be0eb7121
**Content Hash:** 8705c8efbee955960d66f6e6a387af64ad3392dc48f0db81645c1b900ff315e8

View File

@ -0,0 +1,398 @@
-----
Documentation: [html](https://docs-beta.ethers.io/)
-----
Fragments
=========
Explain an ABI.
Formats
-------
### JSON String ABI (Solidity Output JSON)
The **JSON ABI Format** is the format that is
[output from the Solidity compiler](../../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/solidity.readthedocs.io/en/v0.6.0/using-the-compiler.html).
A JSON serialized object is always a string, which represents an Array
of Objects, where each Object has various properties describing the [Fragment](./) of the ABI.
The deserialied JSON string (which is a normal JavaScript Object) may
also be passed into any function which accepts a JSON String ABI.
### Humanb-Readable ABI
The Human-Readable ABI was
[article](../../../../Users/ricmoo/Development/ethers/ethers.js-v5/https:/blog.ricmoo.com/human-readable-contract-abis-in-ethers-js-141902f4d917)
### Output Formats
Each [Fragment](./) and [ParamType](./) may be output using its `format`
method.
#### *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.
#### *ethers* . *utils* . *FragmentTypes* . **minimal** **=>** *string*
This is similar to `full`, except with no unnecessary whitespace or parameter
names. This is useful for storing a minimal string which can still fully
reconstruct the original Fragment using [Fragment&thinsp;.&thinsp;from](./).
#### *ethers* . *utils* . *FragmentTypes* . **json** **=>** *string*
This returns a JavaScript Object which is safe to call `JSON.stringify`
on to create a JSON string.
#### *ethers* . *utils* . *FragmentTypes* . **sighash** **=>** *string*
This is a minimal output format, which is used by Solidity when computing a
signature hash or an event topic hash.
#### Note
The `sighash` format is **insufficient** to re-create the original [Fragment](./),
since it discards modifiers such as indexed, anonymous, stateMutability, etc.
Fragment
--------
An ABI is a collection of **Fragments**, where each fragment specifies:
* An [Event](./)
* A [Function](./)
* A [Constructor](./)
### Properties
#### *fragment* . **name** **=>** *string*
This is the name of the Event or Function. This will be null for
a [ConstructorFragment](./).
#### *fragment* . **type** **=>** *string*
This is a string which indicates the type of the [Fragment](./). This
will be one of:
* `constructor`
* `event`
* `function`
#### *fragment* . **inputs** **=>** *Array< [ParamType](./) >*
This is an array of of each [ParamType](./) for the input parameters to
the Constructor, Event of Function.
### Methods
#### *ethers* . *utils* . *Fragment* . **from** ( objectOrString ) **=>** *[Fragment](./)*
Returns a
#### *ethers* . *utils* . *Fragment* . **isFragment** ( object ) **=>** *boolean*
Tra lal al
ConstructorFragment
-------------------
### Properties
#### *fragment* . **gas** **=>** *[BigNumber](../../bignumber)*
This is the gas limit that should be used during deployment. It may be
null.
#### *fragment* . **payable** **=>** *boolean*
This is whether the constructor may receive ether during deployment as
an endowment (i.e. msg.value != 0).
#### *fragment* . **stateMutability** **=>** *string*
This is the state mutability of the constructor. It can be any of:
* `nonpayable`
* `payable`
### Methods
#### *ethers* . *utils* . *ConstructorFragment* . **from** ( objectOrString ) **=>** *[ConstructorFragment](./)*
Tra la la...
#### *ethers* . *utils* . *ConstructorFragment* . **isConstructorFragment** ( object ) **=>** *boolean*
Tra lal al
EventFragment
-------------
### Properties
#### *fragment* . **anonymous** **=>** *boolean*
This is whether the event is anonymous. An anonymous Event does not inject its
topic hash as topic0 when creating a log.
### Methods
#### *ethers* . *utils* . *EventFragment* . **from** ( objectOrString ) **=>** *[EventFragment](./)*
Tra la la...
#### *ethers* . *utils* . *EventFragment* . **isEventFragment** ( object ) **=>** *boolean*
Tra lal al
FunctionFragment
----------------
### Properties
#### *fragment* . **constant** **=>** *boolean*
This is whether the function is constant (i.e. does not change state). This
is true if the state mutability is `pure` or `view`.
#### *fragment* . **stateMutability** **=>** *string*
This is the state mutability of the constructor. It can be any of:
* `nonpayable`
* `payable`
* `pure`
* `view`
#### *fragment* . **outputs** **=>** *Array< [ParamType](./) >*
A list of the Function output parameters.
### Method
#### *ethers* . *utils* . *FunctionFragment* . **from** ( objectOrString ) **=>** *[FunctionFragment](./)*
Tra la la...
#### *ethers* . *utils* . *FunctionFragment* . **isFunctionFragment** ( object ) **=>** *boolean*
Tra lal al
ParamType
---------
The following examples will represent the Solidity parameter:
`string foobar`
### Properties
#### *paramType* . **name** **=>** *string*
The local parameter name. This may be null for unnamed parameters. For example,
the parameter definition `string foobar` would be `foobar`.
#### *paramType* . **type** **=>** *string*
The full type of the parameter, including tuple and array symbols. This may be null
for unnamed parameters. For the above example, this would be `foobar`.
#### *paramType* . **basetype** **=>** *string*
The base type of the parameter. For primitive types (e.g. `address`, `uint256`, etc)
this is equal to [type](./). For arrays, it will be the string `array` and for
a tuple, it will be the string `tuple`.
#### *paramType* . **indexed** **=>** *boolean*
Whether the parameter has been marked as indexed. This **only** applies
to parameters which are part of an [EventFragment](./).
#### *paramType* . **arrayChildren** **=>** *[ParamType](./)*
The type of children of the array. This is null for for any parameter
wjhich 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.
#### *paramType* . **components** **=>** *Array< [ParamType](./) >*
The components of a tuple. This is null for non-tuple parameters.
### Methods
Tra la la...
#### *paramType* . **format** ( [ outputType=sighash ] )
Tra la la...
#### *ethers* . *utils* . *ParamType* . **from** ( objectOrString ) **=>** *[ParamType](./)*
Tra la la...
#### *ethers* . *utils* . *ParamType* . **isParamType** ( object ) **=>** *boolean*
Tra la la...
-----
**Content Hash:** b3b5bca0e0fe90226032a0727af0e449044a395b8bceb808b47a022024ee560b

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