Wallet CLI for making swaps on TDEX
- Install from NPM
$ npm install -g tdex-cli
- Download standalone binary (nodejs/npm not needed)
- Configure custom directory for data persistence (Default ~/.tdex)
$ export TDEX_CLI_PATH=/path/to/data/dir
$ tdex-cli help
- 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
- Show current persisted state
$ tdex-cli info
- Connect to a liquidity provider
$ tdex-cli connect https://tdex.vulpem.com
- 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
- 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
- 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>
- Node/npm or yarn
- Install deps
yarn install
- Build .ts files
yarn build
- Build and Test
yarn test
- Try it out locally
npm install -g
tdex-cli --version