From 22c2acfe615c8046ec9b1192759dadde7adf4904 Mon Sep 17 00:00:00 2001 From: Josh Harvey Date: Mon, 4 Apr 2016 16:19:41 +0100 Subject: [PATCH] WIP --- lib/plugins/kraken.js | 5 ----- lib/plugins/web3.js | 25 +++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 lib/plugins/web3.js diff --git a/lib/plugins/kraken.js b/lib/plugins/kraken.js index 29376ca4..a843af62 100644 --- a/lib/plugins/kraken.js +++ b/lib/plugins/kraken.js @@ -8,12 +8,7 @@ BigNumber.config({DECIMAL_PLACES: 40}) exports.NAME = 'Kraken' exports.SUPPORTED_MODULES = ['ticker'] -// var pluginConfig = {} - -// https://bitpay.com/api/rates - exports.config = function config (localConfig) { -// pluginConfig = localConfig } function findCurrency (fxRates, currency) { diff --git a/lib/plugins/web3.js b/lib/plugins/web3.js new file mode 100644 index 00000000..b4a970f2 --- /dev/null +++ b/lib/plugins/web3.js @@ -0,0 +1,25 @@ +var Web3 = require('web3') + +var web3 = new Web3() + +if (!web3.isConnected()) { + web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545')) +} + +// Note: it's still called sendBitcoins for backwards compatibility, but this +// is for any currency +exports.sendBitcoins = function sendBitcoins (address, satoshis, fee, callback) { + web3.eth.sendTransaction({ + to: address, + value: satoshis + }, callback) +} + +exports.balance = function balance (cb) { + var coinbase = web3.eth.coinbase + web3.eth.getBalance(coinbase, 'pending', cb) +} + +exports.newAddress = function newAddress (info, callback) { + throw new Error('Not implemented') +} diff --git a/package.json b/package.json index 79659a18..fc919553 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,8 @@ "axios": "^0.9.1", "bignumber.js": "^2.3.0", "bluebird": "^3.3.4", - "bunyan": "~0.22.3", "es6-promise": "^3.1.2", + "ethereumjs-wallet": "^0.5.1", "express": "~3.4.7", "inquirer": "^0.8.0", "joi": "^5.1.0",