Coder Social home page Coder Social logo

0x-launch-kit-frontend's Introduction

0x-launch-kit-frontend

CircleCI dependencies Status devDependencies Status Coverage Status

This is an example implementation of a dApp that interacts with a 0x relayer. To use it, you need to have the URL of an existing relayer, or you can start one locally for use during development.

This repo ships with both an ERC-20 token trading interface and an ERC-721 marketplace interface.

ERC-20 ERC-721

Usage

Clone this repository and install its dependencies:

git clone [email protected]:0xProject/0x-launch-kit-frontend.git
cd 0x-launch-kit-frontend
yarn

Using an existing relayer

If you have the URL of an existing relayer, you can use this frontend against it. After installing the dependencies, start the application with this command, replacing RELAYER_URL with the proper value:

REACT_APP_RELAYER_URL='https://RELAYER_URL/api/v2' yarn start

A browser tab will open in the http://localhost:3001 address. You'll need to connect MetaMask to the network used by the relayer.

You can optionally pass in any relayer endpoint that complies with the 0x Standard Relayer API. For example, if you want to mirror Kovan liquidity from Radar Relay:

REACT_APP_RELAYER_URL='https://api.kovan.radarrelay.com/0x/v2' yarn start

These commands start the app in development mode. You can run yarn build to build the assets. The results will be in the build directory. Remember to set the environment variable with the relayer URL when running the build command:

REACT_APP_RELAYER_URL='https://RELAYER_URL/api/v2' yarn build
serve ./build

Creating a relayer for development

If you don't have a relayer, you can start one locally for development. First create a docker-compose.yml file like this:

version: '3'
services:
    ganache:
        image: fvictorio/0x-ganache-testing:0.0.1
        ports:
            - '8545:8545'
    launch-kit:
        image: fvictorio/0x-launch-kit-testing
        environment:
            HTTP_PORT: '3000'
            RPC_URL: 'http://ganache:8545'
            NETWORK_ID: '50'
        ports:
            - '3000:3000'
        depends_on:
            - ganache

and then run docker-compose up. This will create two containers: one has a ganache with the 0x contracts deployed and some test tokens, and the other one has an instance of the launch kit implementation of a relayer that connects to that ganache.

After starting those containers, you can run yarn start in another terminal. A browser tab will open in the http://localhost:3001 address. You'll need to connect MetaMask to localhost:8545.

Note: the state of the relayer will be kept between runs. If you want to start from scratch, use docker-compose up --force-recreate

Environment variables

You can create a .env file to set environment variables and configure the behavior of the dApp. Start by copying the example file (cp .env.example .env) and modify the ones you want. Some things you can configure are:

  • REACT_APP_RELAYER_URL: The URL of the relayer used by the dApp. Defaults to http://localhost:3001/api/v2

Check .env.example for the full list.

Using custom themes

If you want to add your own theme for the app, please read the THEMES.md file

0x-launch-kit-frontend's People

Contributors

adekbadek avatar agupane avatar dekz avatar eharris128 avatar fragosti avatar fvictorio avatar gabitoesmiapodo avatar mariano-aguero avatar pablofullana avatar tomhschmidt avatar unjapones avatar zabirauf avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.