Skip to content
This repository has been archived by the owner on Nov 13, 2020. It is now read-only.

tdex-network/tdex-cli-alpha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

alpha-wallet

Wallet CLI for making swaps on TDEX

Install

  • Install from NPM
$ npm install -g tdex-cli

Custom datadir

  • Configure custom directory for data persistence (Default ~/.tdex)
$ export TDEX_CLI_PATH=/path/to/data/dir 
$ tdex-cli help

Commands

Network

  • Set the network to work against

NOTICE With the --explorer flag you can set a different electrum REST server (eg. Blockstream/electrs) for connecting to the blockchain

# Mainnet
$ tdex-cli netwrok liquid
# Public regtest Nigiri
$ tdex-cli netwrok regtest
# Local Nigiri or Electrum REST server
$ tdex-cli network regtest --explorer localhost:3001

Info

  • Show current persisted state
$ tdex-cli info

Provider

  • Connect to a liquidity provider
$ tdex-cli connect https://tdex.vulpem.com

Market

  • List all available markets for current provider
$ tdex-cli market list
  • Select a market to use for trading
$ tdex-cli market LBTC-USDT
  • Get current exchnage rate for selected market
$ tdex-cli market LBTC-USDT

Wallet

  • Create or Restore Wallet
$ tdex-cli wallet
=========*** Wallet ***==========

✔ Want to restore from WIF (Wallet Import Format)? · Nope / Yep
✔ Type your private key WIF (Wallet Import Format) · 
✔ How do you want to store your private key? 🔑 · encrypted
✔ Type your password · ****
  • Run again to print pubkey and address
$ tdex-cli wallet
  • Get Wallet Balance
$ tdex-cli wallet balance

Swap

  • Start a swap against the selected provider

NOTICE With the --local flag you can export manually the SwapRequest message without the need of a connection with the provider.

$ tdex-cli swap 
=========*** Swap ***==========

✔ Which asset do you want to send? · USDT / LBTC
✔ How much do you want to send? · 0.5
Gotcha! You will send LBTC 0.5 and receive USDT 3000
✔ Are you sure continue? (y/N) · true

Sending SwapRequest to provider...

Swap has been accepted!

Signing with private key...
Sending SwapComplete to provider...

Swap completed!
  • Import manually a SwapRequest and sign a resulting SwapAccept message
$ tdex-cli swap accept <message>
  • Import a SwapAccept message and sign a resulting SwapComplete message

NOTICE With the --push flag you can print the hex encoded extracted transaction and broadcast to the network

$ tdex-cli swap complete <message>

Development

Requirements

  • Node/npm or yarn

Instructions

  • Install deps
yarn install
  • Build .ts files
yarn build
  • Build and Test
yarn test
  • Try it out locally
npm install -g 
tdex-cli --version