Skip to content

Commit

Permalink
Added initial flatworm documentation stubs.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Aug 21, 2019
1 parent 57bf997 commit 0333a76
Show file tree
Hide file tree
Showing 107 changed files with 5,314 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs.wrm/api/contract.wrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
_title: Contracts

_null: Contract @<contract>
_section: Contracts

Explain what contracts are...

_subsection: Buckets
11 changes: 11 additions & 0 deletions docs.wrm/api/index.wrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
_title: Application Programming Interface

_section: Application Programming Interface (API)

Here...

_toc:
contract
signer
providers
utils
29 changes: 29 additions & 0 deletions docs.wrm/api/providers/api-providers.wrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
_title: API Providers

_section: API Providers

There are many services which offer a web API for accessing
the Ethereum Blockchain. These Providers allow connecting
to them, which simplifies development, since you do not need
to run your own instance or cluster of Ethereum nodes.

However, this reliance on third-party services can reduce
resiliance, security and increase the amount of required trust.
To mitigate these issues, it is recommended you use a
[Default Provider](get-default-provider).

_subsection: EtherscanProvider

Tra la la...

_subsection: InfuraProvider

Tra la la...

_subsection: NodesmithProvider

Tra la la...

_subsection: AlchemyProvider

Tra la la...
29 changes: 29 additions & 0 deletions docs.wrm/api/providers/example-account.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// <hide>

const { ethers } = require("./packages/ethers");
const provider = ethers.getDefaultProvider()

function _inspect(result) {
if (ethers.BigNumber.isBigNumber(result)) {
return `{ BigNumber: ${ JSON.stringify(result.toString()) } }`;
}
return JSON.stringify(result);
}

// </hide>

// Get the balance for an account...
provider.getBalance("ricmoo.firefly.eth");
//!

// Get the code for a contract...
provider.getCode("registrar.firefly.eth");
//!

// Get the storage value at position 0...
provider.getStorageAt("registrar.firefly.eth", 0)
//!

// Get transaction count of an account...
provider.getTransactionCount("ricmoo.firefly.eth");
//!
15 changes: 15 additions & 0 deletions docs.wrm/api/providers/example-ens.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// <hide>

const { ethers } = require("./packages/ethers");
const provider = ethers.getDefaultProvider()

// </hide>

// Reverse lookup of an ENS by address...
provider.lookupAddress("0x6fC21092DA55B392b045eD78F4732bff3C580e2c");
//!

// Lookup an address of an ENS name...
provider.resolveName("ricmoo.firefly.eth");
//!

46 changes: 46 additions & 0 deletions docs.wrm/api/providers/index.wrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
_title: Providers

_section: Providers

A **Provider** is an abstraction of a connection to the
Ethereum network, providing a concise, consistent interface
to standard Ethereum node functionality.

The ethers.js library provides several options which should
cover the vast majority of use-cases, but also includes the
necessary functions and classes for sub-classing if a more
custom configuration is necessary.

Most users should be able to simply use the [[get-default-provider]].


_subsection: Default Provider @<get-default-provider>

The default provider is the safest, easiest way to begin
developing on //Ethereum//, and it is also robust enough
for use in production.

It creates a [[provider-fallback]] connected to as many backend
services as possible. When a request is made, it is sent to
multiple backends simulatenously. As responses from each backend
are returned, they are checked that they agree. Once a quorum
has been reached (i.e. enough of the backends agree), the response
is provided to your application.

This ensures that if a backend has become out-of-sync, or if it
has been compromised that its responses are dropped in favor of
responses that match the majority.

_property: ethers.getDefaultProvider([ network ]) => [[provider]]
Returns a new Provider, backed by multiple services, connected
to //network//. Is no //network// is provided, **homestead**
(i.e. mainnet) is used.

_subsection: Provider Documentation

_toc:
provider
jsonrpc-provider
api-providers
other
types
22 changes: 22 additions & 0 deletions docs.wrm/api/providers/jsonrpc-provider.wrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
_title: JSON-RPC Provider

_section: JSON-RPC Provider

Explain here...

_subsection: JsonRpcProvider @<jsonrpc-provider>

TODO...

_property: provider.getSigner([ addressOrIndex ]) => [[jsonrpc-signer]]
Returns a [[jsonrpc-signer]] which is managed by this Ethereum node, at
//addressOrIndex//. If no //addressOrIndex// is provided, the first
account (account #0) is used.

_property: provider.getUncheckSigner([ addressOrIndex ]) => [[jsonrpc-uncheckedsigner]]

_subsection: JsonRpcSigner @<jsonrpc-signer>
TODO... Explain

_subsection: JsonRpcUncheckedSigner @<jsonrpc-uncheckedsigner>
TODO... Explain
27 changes: 27 additions & 0 deletions docs.wrm/api/providers/other.wrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
_title: Other Providers

_section: Other Providers

Others...

_subsection: FallbackProvider @<provider-fallback>

Explain...

_heading: Properties

_property: provider.providers => Array<[[provider]]>
The list of Providers this is connected to.

_property: provider.quorum => number
The quorum the backend responses must agree upon before a result will be
resolved. By default this is //half the sum of the weights//.

_property: provider.weights => Array<number>
The weight each of the Providers adds to a results acceptance.


_subsection: IpcProvider @<provider-ipc>

Explain...

141 changes: 141 additions & 0 deletions docs.wrm/api/providers/provider.wrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
_title: Abstract Provider


_section: Provider @<provider>

Explain what a provider is...


_subsection: Accounts Methods

_property: provider.getBalance(address [ , blockTag = "latest" ]) => Promise<[[bignumber]]>
Returns the balance of //address// as of the //blockTag// block height.

_property: provider.getCode(address [ , blockTag = "latest" ]) => Promise<[[hexstring]]>
Returns the contract code of //address// as of the //blockTag// block height. If there is
no contract currently deployed, the result is ``0x``.

_property: provider.getStorageAt(address, position [ , blockTag = "latest" ]) => Promise<[[hexstring]]>
Returns the ``Bytes32`` value of the //position// at //address//, as of the //blockTag//.

_property: provider.getTransactionCount(address [ , blockTag = "latest" ]) => Promise<number>
Returns the number of transactions //address// has ever **sent**, as of //blockTag//.
This value is required to be the nonce for the next transaction from //address//
sent to the network.

_heading: Examples

_code: example-account.js


_subsection: Blocks Methods

_property: provider.getBlock(block) => Promise<[[provider-block]]>
Get the //block// from the network, where the ``result.transactions`` is a list
of transaction hashes.

_property: provider.getBlockWithTransactions(block) => Promise<[[provider-blocktxs]]>
Get the //block// from the network, where the ``result.transactions`` is
an Array of [[provider-transactionresponse]] objects.


_subsection: Ethereum Naming Service (ENS) Methods

TODO: Explain ENS here...

_property: provider.lookupAddress(address) => Promise<string>
Performs a reverse lookup of the //address// in ENS using the
//Reverse Registrar//. If the name does not exist, or the
forward lookup does not match, ``null`` is returned.

_property: provider.resovleName(name) => Promise<string>
Looks up the address of //name//. If the name is not owned, or
does not have a //Resolver// configured, or the //Resolver// does
not have an address configured, ``null`` is returned.

_heading: Examples

_code: example-ens.js

_subsection: Logs Methods

_property: provider.getLogs(filter) => Promise<Array<[[provider-log]]>>
Returns the Array of [[provider-log]] matching the //filter//.

Keep in mind that many backends will discard old events, and that requests
which are too broad may get dropped as they require too many resources to
execute the query.


_subsection: Network Status Methods

_property: provider.getNetwork() => Promise<[[provider-network]]>
Returns the [[provider-network]] this Provider is connected to.

_property: provider.getBlockNumber() => Promise<number>
Returns the block number (or height) of the most recently mined block.

_property: provider.getGasPrice() => Promise<[[bignumber]]>
Returns a //best guess// of the [[gas-price]] to use in a transaction.


_subsection: Transactions Methods

_property: provider.call(transaction [ , blockTag = "latest" ]) => Promise<[[hexstring]]>
Returns the result of executing the //transaction//, using //call//. A call
does not require any ether, but cannot change any state. This is useful
for calling gettings on Contracts.

_property: provider.estimateGas(transaction) => Promise<[[bignumber]]>
Returns an estimate of the amount of gas that would be required to submit //transaction//
to the network.

An estimate may not be accurate since there could be another transaction
on the network that was not accounted for, but after being mined affected
relevant state.

_property: provider.sendTransaction(transaction) => Promise<[[provider-transactionresponse]]>
Submits //transaction// to the network to be mined. The //transaction// **must** be signed,
and be valid (i.e. the nonce is correct and the account has sufficient balance to pay
for the transaction).

_property: provider.waitForTransaction(transactionHash) => Promise<[[provider-transactionreceipt]]>
Returns a Promise which will not resolve until //transactionHash// is mined.


_subsection: Event Emitter Methods

Explain events here...

_property: provider.on(eventName, listener) => this
Add a //listener// to be triggered for each //eventName//.

_property: provider.once(eventName, listener) => this
Add a //listener// to be triggered for only the next //eventName//,
at which time it be removed.

_property: provider.emit(eventName, ...args) => boolean
Notify all listeners of //eventName//, passing //args// to each listener. This
is generally only used internally.

_property: provider.off(eventName [ , listener ]) => this
Remove a //listener// for //eventName//. If no //listener// is provided,
all listeners for //eventName// are removed.

_property: provider.removeAllListeners([ eventName ]) => this
Remove all the listeners for //eventName//. If no //eventName// is provided,
**all** events are removed.

_property: provider.listenerCount([ eventName ]) => number
Returns the number of listeners for //eventName//. If no //eventName// is
provided, the total number of listeners is returned.

_property: provider.listeners(eventName) => Array<Listener>
Returns the list of Listeners for //eventName//.


_subsection: Inspection Methods

_property: Provider.isProvider(object) => boolean
Returns true if and only if object is a Provider.

Loading

0 comments on commit 0333a76

Please sign in to comment.