Skip to content

Commit d5ab3e7

Browse files
committed
Merge branch 'release/1.7.0'
2 parents 18c0ed3 + ffb4537 commit d5ab3e7

File tree

10 files changed

+143
-4
lines changed

10 files changed

+143
-4
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
<a name="1.7.0"></a>
2+
# [1.7.0](https://github.com/benmarten/CryptoETF/compare/1.6.2...1.7.0) (2018-01-22)
3+
4+
5+
### Bug Fixes
6+
7+
* **ui:** fix rebalance indicator ([1348441](https://github.com/benmarten/CryptoETF/commit/1348441))
8+
9+
10+
### Features
11+
12+
* **integrations:** add blockchain/etherscan address checkers ([#36](https://github.com/benmarten/CryptoETF/issues/36)) ([e7d7857](https://github.com/benmarten/CryptoETF/commit/e7d7857))
13+
* **ui:** colorize output; allow to hide exchanges below certain holding treshold ([93069f7](https://github.com/benmarten/CryptoETF/commit/93069f7))
14+
15+
16+
117
<a name="1.6.2"></a>
218
## [1.6.2](https://github.com/benmarten/CryptoETF/compare/1.6.1...1.6.2) (2018-01-13)
319

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,24 @@ The tool expects your settings in settings.json. Take a look at settings.example
5252
- `npm testLocal` To run all the unit tests, with the integrations, which require you to set all api keys in settings.json.
5353

5454
## Contributing
55+
Please send PR's to the develop branch!
5556
1. Fork it!
5657
2. Create your feature branch: `git checkout -b my-new-feature`
5758
3. Commit your changes: `git commit -am 'Add some feature'`
5859
4. Push to the branch: `git push origin my-new-feature`
59-
5. Submit a pull request :D
60+
5. Submit a pull request to the develop branch :D
61+
62+
## Releasing
63+
```
64+
git checkout develop
65+
git flow release start "1.6.2"
66+
git rebase master
67+
npm run test
68+
npm --no-git-tag-version version 1.6.2
69+
git flow release finish "1.6.2"
70+
git push
71+
git checkout master && git push && git push --tags
72+
```
6073

6174
## License
6275
See LICENSE.md

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
"testLocal": "./node_modules/.bin/nyc mocha --require babel-core/register test/**/*.js test/**/**/*.js",
3333
"test": "NODE_ENV=test npm run testLocal"
3434
},
35-
"version": "1.6.2"
35+
"version": "1.7.0"
3636
}

settings.example.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"accounts": {
3+
"blockchain": [{
4+
"addresses": [
5+
""
6+
]
7+
}],
8+
"etherscan": [{
9+
"addresses": [
10+
""
11+
]
12+
}],
313
"poloniex": [{
414
"apiKey": "",
515
"apiSecret": ""

src/model/Terminal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,4 @@ export default class Terminal {
124124
}
125125
console.log(table(data, config))
126126
}
127-
}
127+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import AbstractWallet from "./AbstractWallet";
2+
import Coin from '../Coin'
3+
import request from 'request-promise'
4+
5+
export default class BlockchainWallet extends AbstractWallet {
6+
/**
7+
* Returns the Bitcoin balance for addresses
8+
* @param addresses The Bitcoin wallet addressses.
9+
* @return {Promise} The address balances.
10+
*/
11+
static _getBalanceForCredential(credentials) {
12+
return new Promise((resolve, reject) => {
13+
let addresses = credentials.addresses.join('|')
14+
let options = {
15+
uri: 'https://blockchain.info/nl/multiaddr?limit=0&active=' + encodeURIComponent(addresses),
16+
json: true
17+
}
18+
return request(options)
19+
.then(data => {
20+
let result = []
21+
for (let address of data.addresses) {
22+
let amount = address.final_balance / Math.pow(10,8)
23+
result.push(new Coin('BTC', amount, 'Blockchain'))
24+
}
25+
resolve(result)
26+
})
27+
.catch(err => {
28+
reject(err)
29+
})
30+
}
31+
)
32+
}
33+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import AbstractWallet from "./AbstractWallet";
2+
import Coin from '../Coin'
3+
import request from 'request-promise'
4+
5+
export default class EtherscanWallet extends AbstractWallet {
6+
/**
7+
* Returns the Ether balance for addresses
8+
* @param addresses The Bitcoin wallet addresss.
9+
* @return {Promise} The address balances.
10+
*/
11+
static _getBalanceForCredential(credentials) {
12+
return new Promise((resolve, reject) => {
13+
let addresses = credentials.addresses.join(',')
14+
let options = {
15+
uri: 'https://api.etherscan.io/api?module=account&action=balancemulti&address=' + encodeURIComponent(addresses),
16+
json: true
17+
}
18+
return request(options)
19+
.then(data => {
20+
let result = []
21+
for (let address of data.result) {
22+
let amount = address.balance / Math.pow(10,18)
23+
result.push(new Coin('ETH', amount, 'Etherscan'))
24+
}
25+
resolve(result)
26+
})
27+
.catch(err => {
28+
reject(err)
29+
})
30+
}
31+
)
32+
}
33+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import assert from 'assert'
2+
import BlockchainWallet from "../../../src/model/integrations/BlockchainWallet";
3+
4+
import * as Settings from './../../../src/Settings'
5+
6+
describe('Testing Blockchain integration', () => {
7+
before(function() {
8+
if (!Settings.accounts.blockchain) {
9+
this.skip()
10+
}
11+
})
12+
it('Testing initial connection and balances', async () => {
13+
let wallet = new BlockchainWallet(Settings.accounts.blockchain[0])
14+
let balance = await wallet.getBalance()
15+
assert(balance.length > 0)
16+
})
17+
})
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import assert from 'assert'
2+
import EtherscanWallet from "../../../src/model/integrations/EtherscanWallet";
3+
4+
import * as Settings from './../../../src/Settings'
5+
6+
describe('Testing Etherscan integration', () => {
7+
before(function() {
8+
if (!Settings.accounts.etherscan) {
9+
this.skip()
10+
}
11+
})
12+
it('Testing initial connection and balances', async () => {
13+
let wallet = new EtherscanWallet(Settings.accounts.etherscan[0])
14+
let balance = await wallet.getBalance()
15+
assert(balance.length > 0)
16+
})
17+
})

0 commit comments

Comments
 (0)