-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1211 from bitholla/testnet
Testnet
- Loading branch information
Showing
27 changed files
with
160 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"version": "2.2.8", | ||
"version": "2.2.9", | ||
"private": false, | ||
"description": "HollaEx Kit", | ||
"keywords": [ | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,29 @@ | ||
const HollaEx = require('../index'); | ||
require('dotenv').load(); | ||
|
||
const API_KEY = process.env.API_KEY || ''; | ||
const API_SECRET = process.env.API_SECRET || ''; | ||
const client = new HollaEx({ apiKey: API_KEY, apiSecret: API_SECRET }); | ||
|
||
client | ||
.getTicker('xht-usdt') | ||
.then((res) => { | ||
let data = JSON.parse(res); | ||
console.log('The volume is', data.volume); | ||
}) | ||
.catch((err) => { | ||
console.log(err); | ||
}); | ||
|
||
// connect to websocket | ||
/* | ||
events (emitted) : trades (trades), orderbook (orderbook), user (userInfo, userWallet, userOrder, userTrades, userUpdate), all | ||
symbols : xht-usdt | ||
*/ | ||
|
||
const socket1 = client.connect('trades:xht-usdt'); | ||
|
||
socket1.on('trades', (data) => { | ||
console.log(data); | ||
const Network = require('./index'); | ||
|
||
const network = new Network({ | ||
apiUrl: 'https://api.hollaex.network', | ||
apiKey: '', | ||
apiSecret: '', | ||
activation_code: '', | ||
exchange_id: 1 | ||
}); | ||
|
||
const socket2 = client.connect('all'); | ||
|
||
socket2.on('orderbook', (data) => { | ||
console.log(data); | ||
}); | ||
|
||
// You have to use a token to use these otherwise the socket disconnects | ||
socket2.on('userInfo', (data) => { | ||
console.log(data); | ||
}); | ||
|
||
|
||
setTimeout(() => { | ||
socket2.disconnect(); | ||
}, 5000); | ||
(async () => { | ||
try { | ||
const init = await network.init(); | ||
console.log(init); | ||
console.log(network.exchange_id) | ||
|
||
console.log('connecting to websocket') | ||
network.connect(['orderbook:xht-usdt']); | ||
network.ws.on('message', (data) => { | ||
console.log(data) | ||
}) | ||
|
||
} catch (err) { | ||
console.log(err) | ||
} | ||
|
||
|
||
|
||
}) (); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
{ | ||
"name": "hollaex-tools-lib", | ||
"version": "2.15.0", | ||
"version": "2.2.8", | ||
"description": "HollaEx tools library for developers", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "bitHolla Inc", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/bitholla/hollaex-tools-lib" | ||
"url": "https://github.com/bitholla/hollaex-kit/tree/master/server/utils/hollaex-tools-lib" | ||
}, | ||
"dependencies": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.2.8 | ||
2.2.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,46 @@ | ||
import React from 'react'; | ||
import moment from 'moment'; | ||
import 'moment-timezone'; | ||
|
||
class Timer extends React.Component { | ||
constructor(prop) { | ||
super(prop); | ||
let date = this.getTimeString(); | ||
this.state = { | ||
time: date | ||
}; | ||
} | ||
constructor(prop) { | ||
super(prop); | ||
let date = this.getTimeString(); | ||
this.state = { | ||
time: date, | ||
}; | ||
} | ||
|
||
componentDidMount () { | ||
componentDidMount() { | ||
this.timer = setInterval(() => { | ||
const date = this.getTimeString(); | ||
this.setState({ | ||
time: date | ||
}) | ||
time: date, | ||
}); | ||
}, 1000); | ||
} | ||
} | ||
|
||
getTimeString() { | ||
let date = moment().format('hh:mm:ssA'); | ||
if (this.props.isHover) { | ||
date = moment().format('DD/MMM/YYYY, hh:mm:ssA ').toUpperCase() + new Date().toTimeString().slice(9); | ||
} | ||
if (this.props.isHover) { | ||
date = | ||
moment().format('DD/MMM/YYYY, hh:mm:ssA ').toUpperCase() + | ||
moment.tz.guess(true) + | ||
' ' + | ||
new Date().toTimeString().slice(9); | ||
} | ||
return date; | ||
} | ||
|
||
componentWillUnmount() { | ||
if (this.timer) { | ||
clearInterval(this.timer); | ||
} | ||
} | ||
componentWillUnmount() { | ||
if (this.timer) { | ||
clearInterval(this.timer); | ||
} | ||
} | ||
|
||
render () { | ||
return ( | ||
<div>{this.state.time}</div> | ||
) | ||
} | ||
}; | ||
render() { | ||
return <div>{this.state.time}</div>; | ||
} | ||
} | ||
|
||
export default Timer; | ||
export default Timer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.