Socket
Socket
Sign inDemoInstall

joyso

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

joyso - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

4

CHANGELOG.md
# Change Log
## v0.4.1 / 2018-11-07
### Added
- support advanceable toggle.
## v0.4.0 / 2018-10-30

@@ -4,0 +8,0 @@ ### Fixed

2

package.json
{
"name": "joyso",
"version": "0.4.0",
"version": "0.4.1",
"description": "JOYSO API client library for trading.",

@@ -5,0 +5,0 @@ "main": "src/joyso.js",

@@ -333,3 +333,3 @@ # JOYSO

|before||Only return Trade ID before this. (excluded)|
|limit||Specify size of records to return|
|limit||Specify size of records to return. Default 100, max 1000|

@@ -336,0 +336,0 @@ Results are same with subscribeMyTrades.

@@ -26,2 +26,19 @@ const EventEmitter = require('events');

});
this.watchMyAdvance();
return promise;
}
destroy() {
clearTimeout(this.retryTimer);
this.cable.unsubscribe();
delete this.cable;
}
watchMyAdvance() {
if (!this.client.system.advanceable) {
this.advanceReal = 0;
this.advanceInOrder = 0;
this.emit('update', { advance_real: 0, advance_in_order: 0});
return;
}
this.cable = this.client.cable.subscriptions.create({

@@ -41,11 +58,4 @@ channel: 'AccountAdvanceChannel',

});
return promise;
}
destroy() {
clearTimeout(this.retryTimer);
this.cable.unsubscribe();
delete this.cable;
}
async update() {

@@ -52,0 +62,0 @@ try {

@@ -122,3 +122,3 @@ const rp = require('request-promise');

repayWithdrawFee(token) {
if (this.account.advanceReal !== 0 && this.account.advanceInOrder === 0) {
if (this.system.advanceable && this.account.advanceReal !== 0 && this.account.advanceInOrder === 0) {
const ratio = this.tokenManager.eth.withdrawFee.div(token.withdrawFee);

@@ -299,4 +299,3 @@ return new BigNumber(this.account.advanceReal).div(ratio).truncated().add(token.withdrawFee);

baseBalance = this.tokenManager.toRawAmount(quote, baseBalance && baseBalance.available || 0);
if (
side !== 'buy' && !feeByJoy && gasFee.gt(baseBalance)
if (this.system.advanceable && side !== 'buy' && !feeByJoy && gasFee.gt(baseBalance)
&& this.account.advanceReal === 0 && this.account.advanceInOrder === 0

@@ -303,0 +302,0 @@ ) {

@@ -8,2 +8,3 @@ const EventEmitter = require('events');

this.client = client;
this.advanceable = true;
}

@@ -53,2 +54,3 @@

this.contract = `0x${json.contracts[0]}`;
this.advanceable = json.advanceable;
this.updateConfig(json);

@@ -55,0 +57,0 @@ return json;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc