0.3.8 • Published 5 years ago

@oax/client v0.3.8

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

Version License: MIT

Layer 2 Trustless Exchange (L2X)

This is an implementation of the OAX L2X protocol as a full-stack high-performance, scalable, trustless exchange.

Documentation

Getting Started with the OAX Testnet

This section will walk you through using the client library and CLI to interact with the OAX testnet. If you'd like to learn how to run the server, modify it and deploy it, see the Server related sections in the documentation.

Requirements

  • node.js v10.x or later

Installation

  1. Create a new folder
  2. Create a package.json
npm init
  1. Install the OAX client package
npm install @oax/client --save
  1. Initialize the CLI. This will create a new config.json file with the OAX Testnet config.
npx oax init

Once this is created, please open the config.json file and update the providerUrl by adding in your geth node url or infura url for the rinkeby testnet.

  1. Create a new encrypted wallet.
npx oax createWallet
  1. Fund the wallet with Rinkeby test ether. You can use one of the public Rinkeby faucets to request Ether for the wallet address you just created.

Interacting with the Testnet Exchange

After funding your wallet, you need to purchase OAX tokens. OAX tokens are needed to pay fees. They can be purchased using the buy method. WETH can also be purchased in this way. Once you purchase these tokens you can send them to the exchange using the deposit method. Finally once your tokens show up on the exchange balances, you can start trading.

Launch the CLI in console mode

> npx oax buy OAX 1
Buying 1 OAX...
Bought 1 OAX.

> npx oax fetchWalletBalance OAX
Balance: 1.0

> npx oax deposit OAX 1.0
Depositing 1 OAX...

> fetchBalances
{
    "OAX": {
        "free": "1",
        "locked": "0"
    },
    "WETH": {
        "free": "0",
        "locked": "0"
    }
}

> npx oax createOrder BUY OAX/WETH 5 0.1
Placing order to BUY 5 OAX/WETH @ 0.1...
Order placed successfully.
"0xfd91b90308ccfcaff77ae9cfc7e455b6383320aa981f1cbd273f1ead2732081b"

You can see the full list of commands available in the CLI by typing:

npx oax --help

Building the Client from source

Currently the build script will build everything, client , server , smart-contracts, so you can simply run pnpm run clean-build after modifying some source code.


© 2019 OAX Foundation