Giter Site home page Giter Site logo

osasere1m / 0x-nextjs-demo-app Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 0xproject/0x-nextjs-demo-app

0.0 0.0 0.0 83.33 MB

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

Home Page: https://0x.org/docs/

JavaScript 3.09% TypeScript 94.78% CSS 2.13%

0x-nextjs-demo-app's Introduction

0x Next.js Demo App

Overview

An example ERC-20 swap application built on Next.js 13 with 0x Swap API and ConnectKit.

Covers best practices for how to use the 0x Swap API's /price endpoint for indicative pricing and the /quote endpoint for firm quotes.

Live Demo

Checkout with live demo ๐Ÿ‘‰ here

Getting Started

  1. Setup the required API keys
API Keys Description Code
alchemyId Alchemy API key (create one here) Add here
walletConnectProjectId WalletConnect's SDK to help with connecting wallets (create one here) Add here
0x 0x API key (create one here) Add for /price here and for /quote here
  1. Install project dependencies
npm install
  1. Start the Next.js development server
npm run dev
  1. Navigate to http://localhost:3000
open http://localhost:3000

Resources

Video

๐ŸŽฅ Watch this video for a walk-through of this app.

Documentation

Swap API Basics

RFQ Integration on Swap API

The 0x Swap API makes it simple to easily integrate RFQ liquidity for the best pricing. This demo app is setup to enable RFQ liquidity by default because it requires a non-null takerAddress. For more implement details and the difference between indicative pricing and requesting a firm quote, check out How to Integrate RFQ Liquidity.

Monetizing Your Swap Integration

You have full flexibility to collect affiliate fees on trades going through your swap integration. This can be done by setting the feeRecipient and buyTokenPercentageFee parameters in a Swap API request.

If you would like to display the fee to your end users separately, just display the amount returned by grossBuyAmount * buyTokenPercentageFee.

Learn more about setting up monetization here.

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.