Giter Club home page Giter Club logo

swap-demo-tutorial's Introduction

Note ๐Ÿ“ฃ All API requests require a 0x API key. Legacy code examples may contain requests without API keys. Follow this guide for how to get a live API key and use it for any 0x products.

How to Build a Simple Token Swap DApp using the 0x Swap API

Learn how to build a token swapping dapp, similar to a simple Matcha.xyz, using the 0x /swap API endpoint.

This app aggregates liquidity across the greater DEX ecosystem using 0x to surfaces the best price to the user and allow them to easily settle their trades!

Follow Along to Learn

  • ๐Ÿ’ฆ What is liquidity aggregation?
  • ๐ŸชŸ Query + Display an ERC20 token list
  • โ™ป๏ธ Use @0xProject API's /swap endpoint
  • ๐Ÿงฑ Build a Swap Dapp with Metamask and Web3.js

Video and Written Tutorial

  • ๐ŸŽฅ Watch Video Walk-Through: https://www.youtube.com/watch?v=tVvZ1ivp4X0
  • ๐Ÿ“– Full Written Tutorial: https://0x.org/docs/0x-swap-api/guides/how-to-build-a-token-swap-dapp-with-0x-api
  • The repo is broken up by parts which correspond to parts in the written tutorial above โ˜๏ธ Each part builds upon the previous one.
  • Part 1. Walk-through Starter Code
  • Part 2. Connect to MetaMask
  • Part 3. Create a Modal for the Token List
  • Part 4. Fetch and Display Token List from CoinGecko API
  • Part 5. Display Selected Token Image and Symbol in Swap Box
  • Part 6. Get Price
  • Part 7. Get Quote
  • Part 8. Set a Token Allowance
  • Part 9. Perform the Swap

Further Examples

To find more demo apps, check out the official 0x examples repo.

Try out -

swap-demo-tutorial's People

Contributors

jlin27 avatar kidrew avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swap-demo-tutorial's Issues

Receive fees

Thank you very much for your good training
But what should I do if I want to get a commission from my client?
For example, if I add the feeRecipient and buyTokenPercentageFee parameters to the sent parameters, the customer can manipulate the fee by manipulating JavaScript codes... What is the solution?

Error in code tho i copy pasted exactly also made bundle.js file kindly solve this

Uncaught (in promise) Error: invalid address (argument="address", value=undefined, code=INVALID_ARGUMENT, version=address/5.7.0) (argument="spender", value=undefined, code=INVALID_ARGUMENT, version=abi/5.7.0)
at e.value (index.ts:269:28)
at e.value (index.ts:281:20)
at e.value (index.ts:285:21)
at d.value (abstract-coder.ts:68:16)
at d.value (address.ts:22:18)
at array.ts:71:19
at Array.forEach ()
at b (array.ts:54:12)
at c.value (tuple.ts:54:16)
at e.value (abi-coder.ts:111:15)
value @ index.ts:269
value @ index.ts:281
value @ index.ts:285
value @ abstract-coder.ts:68
value @ address.ts:22
(anonymous) @ array.ts:71
b @ array.ts:54
value @ tuple.ts:54
value @ abi-coder.ts:111
f.encodeParameters @ index.js:127
(anonymous) @ index.js:463
y._encodeMethodABI @ index.js:462
y._processExecuteArguments @ index.js:726
y._executeMethod @ index.js:745
trySwap @ bundle.js:166

A persistent Error from Part 6

Error to get Key from 0xapi

How can I solve the error message:

"No API key provided. Please visit https://0x.org/pricing to get a free API key or sign up to a paid plan"

This error has also been persistent from chapter 6.

  • could it be an issue with the Api end point, because even when I try to query it independently in postman based on the docs you provided, I get the same error.
  • Maybe the end point was updated. I am not certain
    I would really appreciate any help rendered.
    NB: For any content required from me. Please contact.
    ##Thank you.

Got Scammed

I executed code from part 9 and 3 hours after, a fraud transaction was conducted in my wallet. Someone transferred all my token amount to this wallet 0x972506269ab19fcd560aff672d37985d5ae56858. This wallet is fraud one

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.