Skip to content
Communicate with the Ethereum blockchain using GraphQL and Apollo Client
Branch: master
Clone or download
Latest commit 34806e4 May 24, 2019

README.md

Apollo Link Ethereum Banner

Apollo Link Ethereum Version on NPM   Apollo Link Ethereum Downloads on NPM


Apollo Link Ethereum

apollo-link-ethereum allows you to use GraphQL to speak directly to a smart contract on the Ethereum blockchain. The package integrates with Apollo Client as a link. There are several resolvers so that you can resolve web3 calls using either web3js 1.0 or Ethers.js. A separate mutations package is available to actually execute transactions (currently only supports ethers.js).

Please see the documentation for each package for more information.

Package Description
apollo-link-ethereum The base package
apollo-link-ethereum-resolver-ethersjs Resolve calls using Ethers.js
apollo-link-ethereum-mutations-ethersjs Send transactions with Ethers.js
apollo-link-ethereum-resolver-web3js Resolve calls using Web3js 1.0

Examples

Example DApps

  1. Here's a simple read-only Example DApp:
    apollo-link-ethereum-example.

  2. A more in-depth application supporting both Ethereum reads (calls) and writes (transactions):
    ZeppelinOS Registry

Installation

You'll need to install the base package apollo-link-ethereum and one of the resolver packages. If you'd like to execute transactions you should also install the mutations package for the bindings you've selected. Currently there is only a mutations package for Ethers.js.

Development

We use yarn and lerna. Run yarn to install the lerna dependency:

$ yarn

Then use lerna to set up the child packages:

$ lerna bootstrap

Live compilation

The yarn watch command runs both the typescript transpilation and rollup to build the JS into a distributable:

$ yarn watch
You can’t perform that action at this time.