Skip to content

Added PocketGatewayProvider, updated tests and documentation #1052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ Changelog

This change log is managed by `admin/cmds/update-versions` but may be manually updated.

ethers/v5.0.27 (2021-01-17 21:54)
---------------------------------

- Added Ethereum testnets support and fixed bugs ([fa987a6](https://github.com/ethers-io/ethers.js/commit/fa987a678e29592e87a0354acdcc1ad1870ca6dd))
- Removing PocketProvider file ([6cc3434](https://github.com/ethers-io/ethers.js/commit/6cc3434c1c83936efbc74f4b6a127c4de4ee33d2))
- Updating Pocket provider ([f2b384d](https://github.com/ethers-io/ethers.js/commit/f2b384d3dc6fad628cb29433303b9560fb9412f2))
- Updated provider tests ([3c1c0be](https://github.com/ethers-io/ethers.js/commit/3c1c0be356a99a7d5479b40821a8822cddf9d588))
- Added PocketGatewayProvider, updated tests and docs ([7cf43b9](https://github.com/ethers-io/ethers.js/commit/7cf43b97985572e8cd50e89a4d4aeac50837d18f))
- Updated provider tests ([3949c17](https://github.com/ethers-io/ethers.js/commit/3949c170cf1a3a9aa1ad9ed1fc8c34427db59fde))
- Added PocketGatewayProvider, updated tests and docs ([f77c7d0](https://github.com/ethers-io/ethers.js/commit/f77c7d0081de3ce5d7a9832c438dbdcf4e7693d5))

ethers/v5.0.26 (2021-01-13 14:47)
---------------------------------

Expand Down Expand Up @@ -69,7 +80,7 @@ ethers/v5.0.18 (2020-10-19 01:26)
- Added EIP-712 multi-dimensional array support. ([#687](https://github.com/ethers-io/ethers.js/issues/687); [5a4dd5a](https://github.com/ethers-io/ethers.js/commit/5a4dd5a70377d3e86823d279d6ff466d03767644))
- Consolidated TypedDataEncoder methods. ([#687](https://github.com/ethers-io/ethers.js/issues/687); [345a830](https://github.com/ethers-io/ethers.js/commit/345a830dc4bc869d5f3edfdc27465797e7663055))
- Initial EIP-712 utilities. ([#687](https://github.com/ethers-io/ethers.js/issues/687); [cfa6dec](https://github.com/ethers-io/ethers.js/commit/cfa6dec29314fe485df283974612d40550bc4179))
- Added initial PocketProvider. ([#1052](https://github.com/ethers-io/ethers.js/issues/1052); [a62d20d](https://github.com/ethers-io/ethers.js/commit/a62d20d86f2d545b9a7bcda5418993790b7db91c))
- Added initial PocketGatewayProvider. ([#1052](https://github.com/ethers-io/ethers.js/issues/1052); [a62d20d](https://github.com/ethers-io/ethers.js/commit/a62d20d86f2d545b9a7bcda5418993790b7db91c))

ethers/v5.0.17 (2020-10-07 20:08)
---------------------------------
Expand Down Expand Up @@ -212,4 +223,4 @@ ethers/v5.0.0 (2020-06-12 19:58)
--------------------------------

- Preserve config canary string. ([7157816](https://github.com/ethers-io/ethers.js/commit/7157816fa53f660d750811b293e3b1d5a2f70bd4))
- Updated docs. ([9e4c7e6](https://github.com/ethers-io/ethers.js/commit/9e4c7e609d9eeb5f2a11d6a90bfa9d32ee696431))
- Updated docs. ([9e4c7e6](https://github.com/ethers-io/ethers.js/commit/9e4c7e609d9eeb5f2a11d6a90bfa9d32ee696431))
25 changes: 18 additions & 7 deletions docs.wrm/api-keys.wrm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ operations required to interact with the Ethereum Blockchain.
- higher rate limit (since you are not using the [shared rate limit](link-etherscan-ratelimit))
- customer usage metrics

_subsection: Pocket Gateway@<api-keys--pocket-gateway>

[Pocket Network](link-pocket) is a Decentralized API that connects any app to any blockchain. Stake Pocket Network's
native token POKT to get access to a global set of blockchain infrastructure.

Connect your application to Ethereum via the [Pocket Network Gateway](link-pocket-signup).

**Benefits:**

- Decentralized Access to Blockchain Infrastructure.
- Stake as opposed to paying a monthly fee.
- Highly redundant global set of nodes incentivized by cryptoeconomic incentives.

[Sign up for a free API key on Pocket](link-pocket-signup)

_subsection: INFURA @<api-keys--infura>

The INFURA service has been around for quite some time and is very robust
Expand Down Expand Up @@ -74,11 +89,6 @@ with debugging.
- access to advanced token balance and metadata APIs
- access to advanced debugging trace and revert reason APIs

_subsection: Pocket Gateway@<api-keys--pocket-gateway>


[Sign up for a free API key on Pocket](link-pocket-signup)

**Benefits:**

- customer usage metrics
Expand Down Expand Up @@ -117,10 +127,11 @@ const provider = ethers.getDefaultProvider(network, {
// projectSecret: YOUR_INFURA_PROJECT_SECRET,
// },
alchemy: YOUR_ALCHEMY_API_KEY,
pocket: YOUR_POCKET_APPLICATION_KEY
pocket_gateway: YOUR_POCKET_APPLICATION_KEY
// Or if using an application secret key:
// pocket: {
// pocket_gateway: {
// applicationId: ,
// applicationSecretKey:
// endpointType: <loadbalancer || application>
// }
});
70 changes: 70 additions & 0 deletions docs.wrm/api/providers/api-providers.wrm
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,76 @@ provider = new EtherscanProvider("homestead", apiKey);
_property: provider.getHistory(address) => Array<History> @src<providers>
@TODO... Explain

_subsection: PocketGatewayProvider @<PocketGatewayProvider> @INHERIT<[[UrlJsonRpcProvider]]> @src<providers:class.PocketGatewayProvider>

[Pocket Network](link-pocket) is a Decentralized API that connects any app to any blockchain. The **PocketGatewayProvider** is an interface that
allows your application to connect to Ethereum via the [Pocket Network Gateway](link-pocket-signup)

_property: new ethers.providers.PocketGatewayProvider([ network = "homestead", [ apiKey ] ]) @SRC<providers>
Create a new **PocketGatewayProvider** connected to //network// with
the optional //apiKey//.

The //network// may be specified as **string** for a common
network name, a **number** for a common chain ID or a
[Network Object]provider-(network).

Depending on how you configure your Application in the Pocket Network Gateway
the //apiKey// can be one of:

- **string**: In this case this will be assumed to be the ``applicationID`` property of your application.
- **object**: In this case you will be required one of the following combinations:
- ``applicationID``: If you only specify this property this will have the same effect as passing it as a **string**.
- ``applicationID`` and ``applicationSecretKey``: If you specify the ``applicationSecretKey``,
you also need to specify the ``applicationID`` property.
- ``applicationOrigin``: By specifying this property you are setting the `Origin` header in your request
(remember that browsers will swap this header based on the actual origin of the website loaded).
- ``applicationUserAgent``: By specifying this property you are setting the `User-Agent` header in your request.
- ``endpointType``: By specifying this property you can select to connect via the Pocket Gateway Single Application endpoint or a Load Balancer Endpoint (defaults to Load Balancer)

The //network// and //apiKey// are specified the same as [the constructor](PocketGatewayProvider).

_note: Note: Default API keys
In the event of the //apiKey// not being present in the constructor, a shared ApplicationID will be provided,
which has the capacity of sending up to 10 million requests per day (417,500 per hour) for Ethereum Mainnet,
for Ropsten, Rinkeby and G&ouml;rli there's a shared capacity of 1 million requests per day each (41,750 per hour).

For production applications it is highly recommended to register your application on the
[Pocket Gateway](link-pocket-signup) for your own API key.

_definition: **Supported Networks**

- Homestead (Mainnet Full nodes (non-Archival Nodes))
- Ropsten (proof-of-work testnet)
- Rinkeby (proof-of-authority testnet)
- G&ouml;rli (clique testnet)

_code: Pocket Gateway Examples @lang<javascript>

// <hide>
const PocketGatewayProvider = ethers.providers.PocketGatewayProvider;
const applicationId = "...";
const applicationSecretKey = "...";
const applicationOrigin = "...";
const applicationUserAgent = "...";
// Endpoint Type can be either application or loadbalancer
const endpointType = "...";
// </hide>

// Connect to mainnet (homestead)
provider = new PocketGatewayProvider();

// Connect to mainnet with a Project ID (these are equivalent)
provider = new PocketGatewayProvider(null, applicationId);
provider = new PocketGatewayProvider("homestead", applicationId);

// Connect to mainnet with a Project ID and Project Secret
provider = new PocketGatewayProvider("homestead", {
applicationId: applicationId,
applicationSecretKey: applicationSecretKey,
applicationOrigin: applicationOrigin,
applicationUserAgent: applicationUserAgent,
endpointType: endpointType
});

_subsection: InfuraProvider @<InfuraProvider> @INHERIT<[[UrlJsonRpcProvider]]> @src<providers:class.InfuraProvider>

Expand Down
3 changes: 2 additions & 1 deletion docs/v5/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ Developer Documentation
* [Network Changes](concepts/best-practices)
* [Provider API Keys](api-keys)
* [Etherscan](api-keys)
* [Pocket Gateway](api-keys)
* [INFURA](api-keys)
* [Alchemy](api-keys)
* [Pocket Gateway](api-keys)
* [Creating a Default Provider](api-keys)
* [Application Programming Interface](api)
* [Providers](api/providers)
Expand All @@ -58,6 +58,7 @@ Developer Documentation
* [Node-Specific Methods](api/providers/jsonrpc-provider)
* [API Providers](api/providers/api-providers)
* [EtherscanProvider](api/providers/api-providers)
* [PocketGatewayProvider](api/providers/api-providers)
* [InfuraProvider](api/providers/api-providers)
* [AlchemyProvider](api/providers/api-providers)
* [CloudflareProvider](api/providers/api-providers)
Expand Down
11 changes: 6 additions & 5 deletions docs/v5/api-keys/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ Provider API Keys
Etherscan
---------

Pocket Gateway
--------------

INFURA
------

Alchemy
-------

Pocket Gateway
--------------

Creating a Default Provider
---------------------------

Expand All @@ -38,11 +38,12 @@ const provider = ethers.getDefaultProvider(network, {
// projectSecret: YOUR_INFURA_PROJECT_SECRET,
// },
alchemy: YOUR_ALCHEMY_API_KEY,
pocket: YOUR_POCKET_APPLICATION_KEY
pocket_gateway: YOUR_POCKET_APPLICATION_KEY
// Or if using an application secret key:
// pocket: {
// pocket_gateway: {
// applicationId: ,
// applicationSecretKey:
// endpointType: <loadbalancer || application>
// }
});
```
Expand Down
54 changes: 31 additions & 23 deletions docs/v5/api-keys/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@

<p><ul><li>higher rate limit (since you are not using the <a href="https://info.etherscan.com/api-return-errors/">shared rate limit</a>) </li><li>customer usage metrics </li></ul></p>

<a name="api-keys--pocket-gateway"></a><a name="api-keys--api-keys--pocket-gateway"></a><h2 class="show-anchors"><div>Pocket Gateway<div class="anchors"><a class="self" href="/v5/api-keys/#api-keys--pocket-gateway"></a></div></div></h2><p><a href="https://pokt.network">Pocket Network</a> is a Decentralized API that connects any app to any blockchain. Stake Pocket Network's native token POKT to get access to a global set of blockchain infrastructure.</p>

<p>Connect your application to Ethereum via the <a href="https://pokt.network/pocket-gateway-ethereum-mainnet/">Pocket Network Gateway</a>.</p>

<p><b>Benefits:</b></p>

<p><ul><li>Decentralized Access to Blockchain Infrastructure. </li><li>Stake as opposed to paying a monthly fee. </li><li>Highly redundant global set of nodes incentivized by cryptoeconomic incentives. </li></ul></p>

<p><a href="https://pokt.network/pocket-gateway-ethereum-mainnet/">Sign up for a free API key on Pocket</a></p>

<a name="api-keys--infura"></a><a name="api-keys--api-keys--infura"></a><h2 class="show-anchors"><div>INFURA<div class="anchors"><a class="self" href="/v5/api-keys/#api-keys--infura"></a></div></div></h2><p>The INFURA service has been around for quite some time and is very robust and reliable and highly recommended.</p>

<p>They offer a standard JSON-RPC interface and a WebSocket interface, which makes interaction with standard tools versatile, simple and straight forward.</p>
Expand All @@ -64,8 +74,6 @@

<p><ul><li>higher rate limit </li><li>customer usage metrics </li><li>access to advanced token balance and metadata APIs </li><li>access to advanced debugging trace and revert reason APIs </li></ul></p>

<a name="api-keys--pocket-gateway"></a><a name="api-keys--api-keys--pocket-gateway"></a><h2 class="show-anchors"><div>Pocket Gateway<div class="anchors"><a class="self" href="/v5/api-keys/#api-keys--pocket-gateway"></a></div></div></h2><p><a href="https://pokt.network/pocket-gateway-ethereum-mainnet/">Sign up for a free API key on Pocket</a></p>

<p><b>Benefits:</b></p>

<p><ul><li>customer usage metrics </li><li>decentralized Access to Blockchain Infrastructure </li><li>Stake as opposed to paying a monthly fee </li><li>Highly redundant global set of nodes incentivized by cryptoeconomic incentives </li></ul></p>
Expand All @@ -76,35 +84,35 @@

<p>It is <b>highly recommended</b> that you provide an API for each service, to maximize your applications performance.</p>

<div class="code-title"><div>Passing API Keys into getDefaultProvider</div></div><div class="code"><span class="comment">// Use the mainnet
</span>const network = "homestead";
<div class="code-title"><div>Passing API Keys into getDefaultProvider</div></div><div class="code">// Use the mainnet
const network = "homestead";

<span class="comment">// Specify your own API keys
</span><span class="comment">// Each is optional, and if you omit it the default
</span><span class="comment">// API key for that service will be used.
</span>const provider = ethers.getDefaultProvider(network, {
// Specify your own API keys
// Each is optional, and if you omit it the default
// API key for that service will be used.
const provider = ethers.getDefaultProvider(network, {
etherscan: YOUR_ETHERSCAN_API_KEY,
infura: YOUR_INFURA_PROJECT_ID,
<span class="comment"> // Or if using a project secret:
</span><span class="comment"> // infura: {
</span><span class="comment"> // projectId: YOUR_INFURA_PROJECT_ID,
</span><span class="comment"> // projectSecret: YOUR_INFURA_PROJECT_SECRET,
</span><span class="comment"> // },
</span> alchemy: YOUR_ALCHEMY_API_KEY,
pocket: YOUR_POCKET_APPLICATION_KEY
<span class="comment"> // Or if using an application secret key:
</span><span class="comment"> // pocket: {
</span><span class="comment"> // applicationId: ,
</span><span class="comment"> // applicationSecretKey:
</span><span class="comment"> // }
</span>});
</div>
// Or if using a project secret:
// infura: {
// projectId: YOUR_INFURA_PROJECT_ID,
// projectSecret: YOUR_INFURA_PROJECT_SECRET,
// },
alchemy: YOUR_ALCHEMY_API_KEY,
pocket_gateway: YOUR_POCKET_APPLICATION_KEY
// Or if using an application secret key:
// pocket_gateway: {
// applicationId: ,
// applicationSecretKey:
// endpointType: &lt;loadbalancer || application&gt;
// }
});</div>

<div class="footer">
<div class="nav previous"><a href="/v5/concepts/best-practices/"><span class="arrow">&larr;</span>Best Practices</a></div>
<div class="nav next"><a href="/v5/api/">Application Programming Interface<span class="arrow">&rarr;</span></a></div>
</div>
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on November 22, 2020, 11:5pm.</div>
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on January 17, 2021, 10:26pm.</div>
</div>
<script src="/v5/static/script.js" type="text/javascript"></script>
<!--EXTRASCRIPT-->
Expand Down
1 change: 1 addition & 0 deletions docs/v5/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Application Programming Interface
* [Node-Specific Methods](providers/jsonrpc-provider)
* [API Providers](providers/api-providers)
* [EtherscanProvider](providers/api-providers)
* [PocketGatewayProvider](providers/api-providers)
* [InfuraProvider](providers/api-providers)
* [AlchemyProvider](providers/api-providers)
* [CloudflareProvider](providers/api-providers)
Expand Down
Loading