Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.
/ bitwire Public archive

Bitwire command line client written in Go

Notifications You must be signed in to change notification settings

dworznik/bitwire

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bitwire

Bitwire command line client written in Go.

Bitwire API documentation

Installation

Installation from source

To install bitwire, run:

go get github.com/dworznik/bitwire
cd $GOPATH/github.com/dworznik/bitwire
make

OS X binaries via Homebrew

Add the tap with bitwire formula before installing.

brew tap dworznik/tap
brew install bitwire

CLI client usage

Bitwire client produces two kinds of output: text and JSON. The default is text. To enable JSON output, add -j switch.

Add -s switch, if want to use bitwire sandbox API.

For usage instruction, run:

bitwire

To set up API access credentials, run:

bitwire config

Listing transfers:

bitwire transfers

Listing recipients:

bitwire recipients

Displaying current exchange rates:

bitwire rates

Getting a list of available banks:

bitwire banks

Displaying account's limits

bitwire limits

Working with JSON output in the shell

Add -j switch, to get the JSON API response object.

bitwire -j  transfers

Use jq command-line JSON processor to manipulate the output JSON.

For example, to get a total amount of your completed transfers, run:

bitwire -j  transfers | jq  'map(select(.status == "PAID_COMPLETED") .amount|tonumber ) | add'

Client library usage

Initialization

Import the package:

import "github.com/dworznik/bitwire"

It is possible to create a client object with no API credentials.

mode := bitwire.PRODUCTION
client, err := bitwire.New(mode)
if err != nil {
  panic(err)
}

Until the client has been authenticated, only API methods that are not account specific re available.

Authentication

To authenticate using username and password, use LoginCredentials.

creds := bitwire.Credentials{clientId, clientSecret, "password"}
login := bitwire.LoginCredentials{creds, username, password}
token, err := client.Authenticate(login)

To authenticate using an existing token, create a new client with NewWithToken() and the Token struct returned by Authenticate().

mode := bitwire.PRODUCTION
client, err := bitwire.NewWithToken(token)
if err != nil {
  panic(err)
}

To be able to refresh the token, you need to use NewWithConfig() and provide client_id and client_secret along with the token.

mode := bitwire.PRODUCTION
client, err := bitwire.NewWithConfig(conf)
if err != nil {
  panic(err)
}

TODO

  • Clean up the code
  • More docs
  • Getting account name
  • Getting recipient by id
  • Creating a recipient
  • Creating a transfer
  • Localization
  • Displaying a transaction QR code in the terminal

About

Bitwire command line client written in Go

Resources

Stars

Watchers

Forks

Packages

No packages published