• Stars
    star
    173
  • Rank 220,124 (Top 5 %)
  • Language
    TypeScript
  • License
    Other
  • Created about 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Launch a 0x relayer in under a minute [DEPRECATED]

โš ๏ธ Deprecation Warning ๏ธ๏ธโš ๏ธ

This project is no longer being actively maintained. To fork or run a Standard Relayer API instance, you can use the 0x API instead.

Table of contents

Introduction

Launch a 0x relayer in under a minute with Launch Kit. This repository contains an open-source, free-to-use 0x relayer template that you can use as a starting point for your own project.

  • Quickly launch a market for your community token
  • Seemlessly create an in-game marketplace for digital items and collectibles
  • Enable trading of any ERC-20 or ERC-721 asset

Fork this repository to get started!

See website

Language choice

0x-launch-kit-backend ships with 2 codebases, one in Typescript and another in Javascript. Although the Javascript is auto-generated from the Typescript, we made sure the Javascript generated is readable.

Before you start using 0x-launch-kit-backend, choose whether you want your codebase to be in Typescript or Javascript.

If you want to work in Javascript:

  • delete the ts directory
  • delete all scripts from package.json that end with :ts

Note: If you also wish to build and use the Docker image, please update the command in the Dockerfile to CMD [ "forever", "js/index.js" ]

If you want to work in Typescript:

  • delete the js directory
  • delete all scripts from package.json that end with :js

Getting started

Pre-requirements

  • Node.js > v8.x
  • Yarn > v1.x
  • 0x Mesh > v5.0.1 for v3. Docker image 0xorg/mesh:5.0.1-beta-0xv3 or greater

To develop ontop of 0x-launch-kit, follow the following instructions:

  1. Fork this repository

  2. Clone your fork of this repository

  3. Open the config.ts/config.js file (depending on the language you've chosen above) and edit the whitelisted tokens:

    • WHITELISTED_TOKENS -- Which tokens you would like to host orderbooks for.
  4. Open the .env file and edit the following fields. Defaults are defined in config.ts/config.js. The bash environment takes precedence over the .env file. If you run source .env, changes to the .env file will have no effect until you unset the colliding variables.

    • CHAIN_ID -- the chain you'd like your relayer to run on (e.g: 1 -> mainnet, 42 -> Kovan, 3 -> Ropsten, etc...). Defaults to 42
    • MESH_ENDPOINT -- the url pointing to the 0x Mesh node. Defaults to ws://localhost:60557
    • FEE_RECIPIENT -- The Ethereum address which should be specified as the fee recipient in orders your relayer accepts. Defaults to a fake address that helps the 0x core team use anonymous, already public data to understand Launch Kit developer usage. Defaults to an auto-generated address
    • MAKER_FEE_ASSET_DATA -- The maker fee token asset data. Defaults to 0x, i.e no fee
    • MAKER_FEE_UNIT_AMOUNT -- The flat maker fee amount you'd like to receive for filled orders hosted by you. Defaults to 0
    • MAKER_FEE_ASSET_DATA -- The taker fee token asset data. Defaults to 0x, i.e no fee
    • TAKER_FEE_UNIT_AMOUNT -- The flat taker fee you'd like to receive for filled orders hosted by you. Defaults to 0

Instructions for using Launch Kit with Ganache

  1. Make sure you have Yarn installed.

  2. Install the dependencies:

    yarn
  3. Build the project [This step is for Typescript users only]

    yarn build:ts

    or build & watch:

    yarn watch:ts

    Note: There isn't currently a build step when working on the Javascript codebase because we assume 0x-launch-kit will be running on Node.js > v8.0. If you want this project to work in an environment that doesn't support many of the latest Javascript features, you will need to add a transpiler (e.g Babel) to this project.

  4. Start the relayer

    yarn start:ts

    OR

    yarn start:js

Client for your relayer's API

Since the 0x-launch-kit-backend relayer adheres to V3 of the Standard Relayer API Specification, you can use 0x Connect (an HTTP/Websocket client) to make calls to your relayer (e.g submit an order, get all orders, etc...)

Learn how to use 0x Connect to interact with your 0x-launch-kit relayer in this tutorial.

To quickly check if your relayer is up-and-running, send it this CURL request from the command-line:

curl http://localhost:3000/v3/orders

If everything is working as expected, you should see this response:

{
    "total": 0,
    "page": 0,
    "perPage": 20,
    "records": []
}

Since no orders have been added to your relayer yet, the records array is empty.

Commands

Typescript project commands:

  • yarn build:ts - Build the code
  • yarn lint:ts - Lint the code
  • yarn start:ts - Starts the relayer
  • yarn watch:ts - Watch the source code and rebuild on change
  • yarn prettier:ts - Auto-format the code

Javascript project commands:

  • yarn start:js - Start the relayer
  • yarn prettier:js - Auto-format the code

Database

This project uses TypeORM. It makes it easier for anyone to switch out the backing database used by this project. By default, this project uses an SQLite database.

Because we want to support both Javascript and Typescript codebases, we don't use TypeORM's decorators (since they don't transpile nicely into readable Javascript). TypeORM shines with decorators however, so you might want to use them if you're going to be working in Typescript.

Deployment

0x-launch-kit ships as a docker container. First, install Docker (mac, windows). To build the image run:

docker build -t 0x-launch-kit-backend .

You can check that the image was built by running:

docker images

And launch it with

docker run -p 3000:3000 -d 0x-launch-kit-backend

Check that it's working by running

curl http://localhost:3000/v3/asset_pairs

The laws and regulations applicable to the use and exchange of digital assets and blockchain-native tokens, including through any software developed using the licensed work created by ZeroEx Intl. as described here (the โ€œWorkโ€), vary by jurisdiction. As set forth in the Apache License, Version 2.0 applicable to the Work, developers are โ€œsolely responsible for determining the appropriateness of using or redistributing the Work,โ€ which includes responsibility for ensuring compliance with any such applicable laws and regulations. See the Apache License, Version 2.0 for the specific language governing all applicable permissions and limitations: http://www.apache.org/licenses/LICENSE-2.0

More Repositories

1

0x-monorepo

0x protocol monorepo - includes our smart contracts and many developer tools
TypeScript
1,412
star
2

OpenZKP

OpenZKP - pure Rust implementations of Zero-Knowledge Proof systems.
Rust
646
star
3

0x-launch-kit

Start an exchange in under a minute
JavaScript
380
star
4

protocol

TypeScript
362
star
5

0x-api

An HTTP Interface to 0x liquidity and tooling
TypeScript
362
star
6

0x-mesh

A peer-to-peer network for sharing 0x orders
Go
258
star
7

0x-starter-project

A project showcasing how to get started with 0x.js
TypeScript
200
star
8

standard-relayer-api

Standard specifications for 0x relayer public APIs
164
star
9

0x-protocol-specification

Specification for 0x protocol
148
star
10

0x-launch-kit-frontend

TypeScript
112
star
11

tools

TypeScript
96
star
12

ZEIPs

0x Improvement Proposals
91
star
13

swap-demo-tutorial

JavaScript
67
star
14

website

0x.org website
TypeScript
54
star
15

0x-nextjs-demo-app

Example ERC20 swapping app made with 0x Swap API, Next.js, and ConnectKit
TypeScript
52
star
16

rpc-gateway

A failover proxy for node providers
Go
47
star
17

0x-relayer-registry

A collection of relayers using 0x
TypeScript
43
star
18

whitepaper

Technical document that specifies 0x protocol.
TeX
33
star
19

0x-parser

๐Ÿงพ A library that parses 0x transactions from EVM blockchains into a format that is user-friendly and easy to understand.
TypeScript
30
star
20

web3-typescript-typings

[DEPRECATED] A preliminary Web3 v0.x typescript type definition
30
star
21

dev-tools-truffle-example

An example Truffle project showing how to use the 0x Dev Tools with the Truffle framework
JavaScript
28
star
22

fast-abi

ABI encoding, fast
Rust
27
star
23

0x-event-pipeline

A node.js app for pulling 0x event info to inform things like staking.
TypeScript
26
star
24

0x-examples

A collection of 0x API code examples
TypeScript
19
star
25

VDF

A Solidity implementation of a VDF verifier contract
Solidity
16
star
26

0x-sdk

TypeScript SDK for building exchange functionality on Ethereum and EVM-compatible chains ๐Ÿ› .
TypeScript
15
star
27

0x-codesandbox

0x Codesandbox
TypeScript
14
star
28

0x-debug

TypeScript
14
star
29

quote-server

An RFQ quote server that can be used to provide quotes via 0x API
TypeScript
14
star
30

0x-settler

0x settlement contracts using Permit2
Solidity
11
star
31

0x-instant

JavaScript
10
star
32

0x-staking-pool-registry

A collection of metadata about staking pools on 0x - https://0x.org/
TypeScript
10
star
33

connect-starter-project

A tutorial for interacting with a relayer that conforms to the standard relayer API
TypeScript
10
star
34

0x-coordinator-server

A reference implementation of a 0x coordinator server (soft-cancel variant)
TypeScript
9
star
35

sutro

Eye of Sutro: Ethereum State Watcher
Rust
7
star
36

pm

6
star
37

branding

Logos and other media
5
star
38

p2p_incentives

Python
5
star
39

node-anvil

Nodejs bindings to Foundry Anvil
Rust
5
star
40

zrx-buyer

A demonstration of using asset-buyer to buy ZRX
TypeScript
4
star
41

0x-subgraph

TypeScript
4
star
42

mesh-viz

https://mesh-viz.0x.org/
TypeScript
4
star
43

matcha-flagged-tokens

4
star
44

0x-exchange-proxy-subgraph

TypeScript
4
star
45

0x-api-forked-testnet-example

A basic example for how you can test 0x API using a private for of Ethereum mainnet
TypeScript
4
star
46

proxy

Simple Go Proxy
Go
3
star
47

mesh-mock-graphql-api

Demo of the new Mesh GraphQL API using mock data
TypeScript
3
star
48

setup-helm

Github Action for Helm installation
TypeScript
3
star
49

mesh-workshop-demo

TypeScript
3
star
50

exchange-v3

TypeScript
2
star
51

0x-mesh-demo-client-javascript

[DEPRECATED] A demo 0x Mesh WebSocket client written in Javascript
TypeScript
2
star
52

ts-doc-gen

A CLI for generating a single MD reference doc file for a TS project
TypeScript
2
star
53

setup-govulncheck

Setup govulncheck: https://go.dev/security/vuln/
TypeScript
2
star
54

setup-foundry

Install foundry-rs/foundry in your Github Action workflow
TypeScript
2
star
55

mesh-rs

Rust implementation of the 0x Mesh protocol
Rust
1
star
56

matcha-unsupported-tokens

1
star
57

permit2-matcha

A headless prototype of how the Matcha API works with permit2 smart contracts.
TypeScript
1
star