New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

steem-rpc

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

steem-rpc - npm Package Compare versions

Comparing version 0.6.3 to 0.6.4

2

build/steem-rpc.min.js

@@ -1,1 +0,1 @@

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.steemWS=e()}}(function(){var e;return function n(e,t,o){function i(c,s){if(!t[c]){if(!e[c]){var a="function"==typeof require&&require;if(!s&&a)return a(c,!0);if(r)return r(c,!0);var u=new Error("Cannot find module '"+c+"'");throw u.code="MODULE_NOT_FOUND",u}var l=t[c]={exports:{}};e[c][0].call(l.exports,function(n){var t=e[c][1][n];return i(t?t:n)},l,l.exports,n,e,t,o)}return t[c].exports}for(var r="function"==typeof require&&require,c=0;c<o.length;c++)i(o[c]);return i}({1:[function(e,n,t){"use strict";function o(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}var i,r=function(){function e(e,n){for(var t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(n,t,o){return t&&e(n.prototype,t),o&&e(n,o),n}}(),c=e("./WebSocketRpc"),s=e("./SteemApi"),a={url:"wss://node.steem.ws",user:"",pass:"",debug:!1,apis:["database_api","network_broadcast_api"]};n.exports={reset:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return i&&this.close(),i=new u(e),i.connect(),i},get:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=arguments[1];return i||(i=new u(e)),n&&(i.setOptions(e),i.connect()),i},close:function(){i.close(),i=null}};var u=function(){function e(n){o(this,e),this.setOptions(n)}return r(e,[{key:"setOptions",value:function(e){this.options=Object.assign({},a,e),-1===this.options.apis.indexOf("database_api")&&this.options.apis.unshift("database_api")}},{key:"connect",value:function(){var e=this;if(!this.wsRpc){try{this.wsRpc=new c(this.options)}catch(n){console.error("wsRpc open error:",n)}this.initPromise=this.wsRpc.login(this.options.user,this.options.pass).then(function(){var n=[];return e.options.apis.forEach(function(t){e["_"+t]=new s(e.wsRpc,t),e[t]=function(){return this["_"+t]},n.push(e["_"+t].init().then(function(){return"database_api"===t?e[t]().exec("get_config",[]).then(function(n){return e.chainId=n.STEEMIT_CHAIN_ID,"connected to "+t}):"connected to "+t}))}),Promise.all(n)})["catch"](function(n){throw new Error("Unable to connect to "+e.options.url)})}}},{key:"close",value:function(){this.wsRpc&&(this.wsRpc.close(),this.wsRpc=null),this.options=null}}]),e}()},{"./SteemApi":2,"./WebSocketRpc":3}],2:[function(e,n,t){"use strict";function o(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,n){for(var t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(n,t,o){return t&&e(n.prototype,t),o&&e(n,o),n}}(),r=function(){function e(n,t){o(this,e),this.wsRpc=n,this.apiName=t}return i(e,[{key:"init",value:function(){var e=this;return this.wsRpc.getApiByName(this.apiName).then(function(n){return e.apiId=n,e})}},{key:"exec",value:function(e,n){return this.wsRpc.call([this.apiId,e,n])["catch"](function(t){throw console.error("SteemApi error:",e,n,JSON.stringify(t)),new Error("SteemApi error:"+e+n+JSON.stringify(t))})}}]),e}();n.exports=r},{}],3:[function(e,n,t){"use strict";function o(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,n){for(var t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(n,t,o){return t&&e(n.prototype,t),o&&e(n,o),n}}(),r=e("./reconnecting-websocket"),c=function(){function n(t){var i=this,c=arguments.length<=1||void 0===arguments[1]?null:arguments[1];o(this,n),"undefined"!=typeof WebSocket?(t.WebSocket=WebSocket,t.idleTreshold="idleTreshold"in t?t.idleTreshold:6e4):(t.WebSocket=e("ws"),t.idleTreshold=0),t.reconnectInterval=1e3,t.reconnectDecay=1.2,this.ws=new r(t),this.ws.timeoutInterval=15e3;var s=!0;this.rcCallback=c,this.connectPromise=new Promise(function(e,n){i.ws.onopen=function(){s?(s=!1,e()):i.rcCallback&&i.rcCallback()},i.ws.onerror=function(e){n(e)},i.ws.onmessage=function(e){var n={};try{n=JSON.parse(e.data)}catch(t){console.log("Unable to parse API response:",t),n.error="Unable to parse response "+JSON.stringify(e)}i.listener(n)}}),this.cbId=0,this.cbs=new Map,this.methodCbs=new Map,"undefined"!=typeof window&&(window.onbeforeunload=function(){i.close()})}return i(n,[{key:"listener",value:function(e){var n=this.cbs.get(e.id),t=this.methodCbs.get(e.id);t&&(this.methodCbs["delete"](e.id),"error"in e&&"reject"in t?t.reject(e.error):"resolve"in t&&t.resolve()),n&&(this.cbs["delete"](e.id),"error"in e?n.reject(e.error):n.resolve(e.result))}},{key:"call",value:function(e){var n=this,t={method:"call",params:e,id:this.cbId++};return new Promise(function(e,o){n.cbs.set(t.id,{time:new Date,resolve:e,reject:o}),"broadcast_transaction_with_callback"===t.params[1]&&t.params[2][0]&&(n.methodCbs.set(t.id,t.params[2][0]),t.params[2][0]=t.params[2][0].resolve),n.ws.onerror=function(e){o(e)},n.ws.send(JSON.stringify(t))})}},{key:"getApiByName",value:function(e){return this.call([1,"get_api_by_name",[e]])}},{key:"login",value:function(e,n){var t=this;return this.connectPromise.then(function(){return t.call([1,"login",[e,n]])})}},{key:"close",value:function(){this.ws&&(this.ws.close(),this.ws=null)}}]),n}();n.exports=c},{"./reconnecting-websocket":5,ws:6}],4:[function(e,n,t){"use strict";var o=e("./ApiInstance");n.exports={Client:o}},{"./ApiInstance":1}],5:[function(n,t,o){"use strict";!function(n,o){"function"==typeof e&&e.amd?e([],o):"undefined"!=typeof t&&t.exports?t.exports=o():n.ReconnectingWebSocket=o()}(void 0,function(){function e(t){function o(e,n){return{name:e}}var i={debug:!1,automaticOpen:!0,reconnectInterval:2e3,maxReconnectInterval:3e5,reconnectDecay:1.5,timeoutInterval:2e3,maxReconnectAttempts:100,binaryType:"arraybuffer",idleTreshold:0};t||(t={}),n=t.WebSocket,e.CONNECTING=n.CONNECTING,e.OPEN=n.OPEN,e.CLOSING=n.CLOSING,e.CLOSED=n.CLOSED,console.debug||(console.debug=console.log);for(var r in i)"undefined"!=typeof t[r]?this[r]=t[r]:this[r]=i[r];this.url=t.url,this.reconnectAttempts=0,this.readyState=n.CONNECTING,this.protocol=null;var c,s=this,a=!1,u=!1,l={},d={addEventListener:function(e,n){l[e]=n},removeEventListener:function(e){delete l[e]},dispatchEvent:function(e){var n=l[e.name];n&&n(e)}};d.addEventListener("open",function(e){s.onopen(e)}),d.addEventListener("close",function(e){s.onclose(e)}),d.addEventListener("connecting",function(e){s.onconnecting(e)}),d.addEventListener("message",function(e){s.onmessage(e)}),d.addEventListener("error",function(e){s.onerror(e)}),this.addEventListener=d.addEventListener.bind(d),this.removeEventListener=d.removeEventListener.bind(d),this.dispatchEvent=d.dispatchEvent.bind(d),s.pendingReconnect=!1,s.idleSince=new Date,this.idleTreshold&&"undefined"!=typeof document&&(document.onkeypress=document.onmousemove=document.onclick=document.onscroll=document.touchstart=function(){s.idleSince=new Date,s.pendingReconnect&&(s.pendingReconnect=!1,s.reconnect())}),this.reconnect=function(){var e=s.reconnectInterval*Math.pow(s.reconnectDecay,s.reconnectAttempts);e=e>s.maxReconnectInterval?s.maxReconnectInterval:e,console.log("WebSocket: will try to reconnect in "+parseInt(e/1e3)+" sec, attempt #"+(s.reconnectAttempts+1)),setTimeout(function(){s.reconnectAttempts++,s.open(!0)},e)},this.open=function(t){if(t){if(this.maxReconnectAttempts&&this.reconnectAttempts>this.maxReconnectAttempts)return}else d.dispatchEvent(o("connecting")),this.reconnectAttempts=0;var i=s.url;Array.isArray(s.url)&&(i=s.url[this.reconnectAttempts%s.url.length]),console.log("connecting to",i),c=new n(i),c.binaryType=this.binaryType,(s.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","attempt-connect",s.url);var r=c,l=setTimeout(function(){(s.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","connection-timeout",s.url),u=!0,r.close(),u=!1},s.timeoutInterval);c.onopen=function(i){clearTimeout(l),(s.debug||e.debugAll)&&console.debug("ReconnectingWebSocket**","onopen",s.url),s.protocol=c.protocol,s.readyState=n.OPEN,s.reconnectAttempts=0;var r=o("open");r.isReconnect=t,t=!1,d.dispatchEvent(r)},c.onclose=function(r){if(1e3!==r.code&&console.log("WARNING! ws connection",i,"closed: ",r&&r.reason?r.reason:r),clearTimeout(l),c=null,a)s.readyState=n.CLOSED,d.dispatchEvent(o("close"));else{s.readyState=n.CONNECTING;var f=o("connecting");f.code=r.code,f.reason=r.reason,f.wasClean=r.wasClean,d.dispatchEvent(f),t||u||((s.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","onclose",s.url),d.dispatchEvent(o("close"))),!s.idleTreshold||new Date-s.idleSince<s.idleTreshold?s.reconnect():(console.debug("idle - will reconnect later"),s.pendingReconnect=!0)}},c.onmessage=function(n){(s.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","onmessage",s.url,n.data);var t=o("message");t.data=n.data,d.dispatchEvent(t)},c.onerror=function(n){(s.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","onerror",s.url,n),d.dispatchEvent(o(n))}},1==this.automaticOpen&&this.open(!1),this.send=function(n){if(c)return(s.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","send",s.url,n),c.send(n);throw"INVALID_STATE_ERR : Pausing to reconnect websocket"},this.close=function(e,n){"undefined"==typeof e&&(e=1e3),a=!0,c&&c.close(e,n)},this.refresh=function(){c&&c.close()}}var n;return e.prototype.onopen=function(e){},e.prototype.onclose=function(e){},e.prototype.onconnecting=function(e){},e.prototype.onmessage=function(e){},e.prototype.onerror=function(e){},e.debugAll=!1,e})},{}],6:[function(e,n,t){},{}]},{},[4])(4)});
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.steemWS=e()}}(function(){var e;return function e(n,t,o){function i(r,s){if(!t[r]){if(!n[r]){var a="function"==typeof require&&require;if(!s&&a)return a(r,!0);if(c)return c(r,!0);var u=new Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}var l=t[r]={exports:{}};n[r][0].call(l.exports,function(e){var t=n[r][1][e];return i(t?t:e)},l,l.exports,e,n,t,o)}return t[r].exports}for(var c="function"==typeof require&&require,r=0;r<o.length;r++)i(o[r]);return i}({1:[function(e,n,t){"use strict";function o(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}var i,c=function(){function e(e,n){for(var t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(n,t,o){return t&&e(n.prototype,t),o&&e(n,o),n}}(),r=e("./WebSocketRpc"),s=e("./SteemApi"),a={url:"wss://node.steem.ws",user:"",pass:"",debug:!1,apis:["database_api","network_broadcast_api"]};n.exports={reset:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return i&&this.close(),i=new u(e),i.connect(),i},get:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=arguments[1];return i||(i=new u(e)),n&&(i.setOptions(e),i.connect()),i},close:function(){i.close(),i=null}};var u=function(){function e(n){o(this,e),this.setOptions(n)}return c(e,[{key:"setOptions",value:function(e){this.options=Object.assign({},a,e),this.options.apis.indexOf("database_api")===-1&&this.options.apis.unshift("database_api")}},{key:"connect",value:function(){if(!this.wsRpc)try{this.wsRpc=new r(this.options,this.onReconnect.bind(this)),this.login()}catch(e){console.error("wsRpc open error:",e)}}},{key:"login",value:function(){var e=this;this.initPromise=this.wsRpc.login(this.options.user,this.options.pass).then(function(){var n=[];return e.options.apis.forEach(function(t){e["_"+t]=new s(e.wsRpc,t),e[t]=function(){return this["_"+t]},n.push(e["_"+t].init().then(function(){return"database_api"===t?e[t]().exec("get_config",[]).then(function(n){return e.chainId=n.STEEMIT_CHAIN_ID,"connected to "+t}):"connected to "+t}))}),Promise.all(n)}).catch(function(n){throw new Error("Unable to connect to "+e.options.url)})}},{key:"onReconnect",value:function(){this.login()}},{key:"close",value:function(){this.wsRpc&&(this.wsRpc.close(),this.wsRpc=null),this.options=null}}]),e}()},{"./SteemApi":2,"./WebSocketRpc":3}],2:[function(e,n,t){"use strict";function o(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,n){for(var t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(n,t,o){return t&&e(n.prototype,t),o&&e(n,o),n}}(),c=function(){function e(n,t){o(this,e),this.wsRpc=n,this.apiName=t}return i(e,[{key:"init",value:function(){var e=this;return this.wsRpc.getApiByName(this.apiName).then(function(n){return e.apiId=n,e})}},{key:"exec",value:function(e,n){return this.wsRpc.call([this.apiId,e,n]).catch(function(t){throw console.error("SteemApi error:",e,n,JSON.stringify(t)),new Error("SteemApi error:"+e+n+JSON.stringify(t))})}}]),e}();n.exports=c},{}],3:[function(e,n,t){"use strict";function o(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,n){for(var t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(n,t,o){return t&&e(n.prototype,t),o&&e(n,o),n}}(),c=e("./reconnecting-websocket"),r=function(){function n(t){var i=this,r=arguments.length<=1||void 0===arguments[1]?null:arguments[1];o(this,n),"undefined"!=typeof WebSocket?(t.WebSocket=WebSocket,t.idleTreshold="idleTreshold"in t?t.idleTreshold:6e4):(t.WebSocket=e("ws"),t.idleTreshold=0),t.reconnectInterval=1e3,t.reconnectDecay=1.2,this.ws=new c(t),this.ws.timeoutInterval=15e3;var s=!0;this.rcCallback=r,this.connectPromise=new Promise(function(e,n){i.ws.onopen=function(){s?(s=!1,e()):i.rcCallback&&i.rcCallback()},i.ws.onerror=function(e){n(e)},i.ws.onmessage=function(e){var n={};try{n=JSON.parse(e.data)}catch(t){console.log("Unable to parse API response:",t),n.error="Unable to parse response "+JSON.stringify(e)}i.listener(n)}}),this.cbId=0,this.cbs=new Map,this.methodCbs=new Map,"undefined"!=typeof window&&(window.onbeforeunload=function(){i.close()})}return i(n,[{key:"listener",value:function(e){var n=this.cbs.get(e.id),t=this.methodCbs.get(e.id);t&&(this.methodCbs.delete(e.id),"error"in e&&"reject"in t?t.reject(e.error):"resolve"in t&&t.resolve()),n&&(this.cbs.delete(e.id),"error"in e?n.reject(e.error):n.resolve(e.result))}},{key:"call",value:function(e){var n=this,t={method:"call",params:e,id:this.cbId++};return new Promise(function(e,o){n.cbs.set(t.id,{time:new Date,resolve:e,reject:o}),"broadcast_transaction_with_callback"===t.params[1]&&t.params[2][0]&&(n.methodCbs.set(t.id,t.params[2][0]),t.params[2][0]=t.params[2][0].resolve),n.ws.onerror=function(e){o(e)},n.ws.send(JSON.stringify(t))})}},{key:"getApiByName",value:function(e){return this.call([1,"get_api_by_name",[e]])}},{key:"login",value:function(e,n){var t=this;return this.connectPromise.then(function(){return t.call([1,"login",[e,n]])})}},{key:"close",value:function(){this.ws&&(this.ws.close(),this.ws=null)}}]),n}();n.exports=r},{"./reconnecting-websocket":5,ws:6}],4:[function(e,n,t){"use strict";var o=e("./ApiInstance");n.exports={Client:o}},{"./ApiInstance":1}],5:[function(n,t,o){"use strict";!function(n,o){"function"==typeof e&&e.amd?e([],o):"undefined"!=typeof t&&t.exports?t.exports=o():n.ReconnectingWebSocket=o()}(void 0,function(){function e(t){function o(e,n){return{name:e}}var i={debug:!1,automaticOpen:!0,reconnectInterval:2e3,maxReconnectInterval:3e5,reconnectDecay:1.5,timeoutInterval:2e3,maxReconnectAttempts:100,binaryType:"arraybuffer",idleTreshold:0};t||(t={}),n=t.WebSocket,e.CONNECTING=n.CONNECTING,e.OPEN=n.OPEN,e.CLOSING=n.CLOSING,e.CLOSED=n.CLOSED,console.debug||(console.debug=console.log);for(var c in i)"undefined"!=typeof t[c]?this[c]=t[c]:this[c]=i[c];this.url=t.url,this.reconnectAttempts=0,this.readyState=n.CONNECTING,this.protocol=null;var r,s=this,a=!1,u=!1,l={},d={addEventListener:function(e,n){l[e]=n},removeEventListener:function(e){delete l[e]},dispatchEvent:function(e){var n=l[e.name];n&&n(e)}};d.addEventListener("open",function(e){s.onopen(e)}),d.addEventListener("close",function(e){s.onclose(e)}),d.addEventListener("connecting",function(e){s.onconnecting(e)}),d.addEventListener("message",function(e){s.onmessage(e)}),d.addEventListener("error",function(e){s.onerror(e)}),this.addEventListener=d.addEventListener.bind(d),this.removeEventListener=d.removeEventListener.bind(d),this.dispatchEvent=d.dispatchEvent.bind(d),s.pendingReconnect=!1,s.idleSince=new Date,this.idleTreshold&&"undefined"!=typeof document&&(document.onkeypress=document.onmousemove=document.onclick=document.onscroll=document.touchstart=function(){s.idleSince=new Date,s.pendingReconnect&&(s.pendingReconnect=!1,s.reconnect())}),this.reconnect=function(){var e=s.reconnectInterval*Math.pow(s.reconnectDecay,s.reconnectAttempts);e=e>s.maxReconnectInterval?s.maxReconnectInterval:e,console.log("WebSocket: will try to reconnect in "+parseInt(e/1e3)+" sec, attempt #"+(s.reconnectAttempts+1)),setTimeout(function(){s.reconnectAttempts++,s.open(!0)},e)},this.open=function(t){if(t){if(this.maxReconnectAttempts&&this.reconnectAttempts>this.maxReconnectAttempts)return}else d.dispatchEvent(o("connecting")),this.reconnectAttempts=0;var i=s.url;Array.isArray(s.url)&&(i=s.url[this.reconnectAttempts%s.url.length]),console.log("connecting to",i),r=new n(i),r.binaryType=this.binaryType,(s.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","attempt-connect",s.url);var c=r,l=setTimeout(function(){(s.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","connection-timeout",s.url),u=!0,c.close(),u=!1},s.timeoutInterval);r.onopen=function(i){clearTimeout(l),(s.debug||e.debugAll)&&console.debug("ReconnectingWebSocket**","onopen",s.url),s.protocol=r.protocol,s.readyState=n.OPEN,s.reconnectAttempts=0;var c=o("open");c.isReconnect=t,t=!1,d.dispatchEvent(c)},r.onclose=function(c){if(1e3!==c.code&&console.log("WARNING! ws connection",i,"closed"),clearTimeout(l),r=null,a)s.readyState=n.CLOSED,d.dispatchEvent(o("close"));else{s.readyState=n.CONNECTING;var f=o("connecting");f.code=c.code,f.reason=c.reason,f.wasClean=c.wasClean,d.dispatchEvent(f),t||u||((s.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","onclose",s.url),d.dispatchEvent(o("close"))),!s.idleTreshold||new Date-s.idleSince<s.idleTreshold?s.reconnect():(console.debug("idle - will reconnect later"),s.pendingReconnect=!0)}},r.onmessage=function(n){(s.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","onmessage",s.url,n.data);var t=o("message");t.data=n.data,d.dispatchEvent(t)},r.onerror=function(n){(s.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","onerror",s.url,n),d.dispatchEvent(o(n))}},1==this.automaticOpen&&this.open(!1),this.send=function(n){if(r)return(s.debug||e.debugAll)&&console.debug("ReconnectingWebSocket","send",s.url,n),r.send(n);throw"INVALID_STATE_ERR : Pausing to reconnect websocket"},this.close=function(e,n){"undefined"==typeof e&&(e=1e3),a=!0,r&&r.close(e,n)},this.refresh=function(){r&&r.close()}}var n;return e.prototype.onopen=function(e){},e.prototype.onclose=function(e){},e.prototype.onconnecting=function(e){},e.prototype.onmessage=function(e){},e.prototype.onerror=function(e){},e.debugAll=!1,e})},{}],6:[function(e,n,t){},{}]},{},[4])(4)});

@@ -74,4 +74,2 @@ "use strict";

value: function connect() {
var _this = this;
if (this.wsRpc) {

@@ -82,6 +80,12 @@ return;

try {
this.wsRpc = new WsRpc(this.options);
this.wsRpc = new WsRpc(this.options, this.onReconnect.bind(this));
this.login();
} catch (err) {
console.error("wsRpc open error:", err);
}
}
}, {
key: "login",
value: function login() {
var _this = this;

@@ -114,2 +118,7 @@ this.initPromise = this.wsRpc.login(this.options.user, this.options.pass).then(function () {

}, {
key: "onReconnect",
value: function onReconnect() {
this.login();
}
}, {
key: "close",

@@ -116,0 +125,0 @@ value: function close() {

@@ -320,3 +320,3 @@ 'use strict';

ws.onclose = function (event) {
if (event.code !== 1000) console.log('WARNING! ws connection', surl, 'closed: ', event && event.reason ? event.reason : event);
if (event.code !== 1000) console.log('WARNING! ws connection', surl, 'closed');
clearTimeout(timeout);

@@ -323,0 +323,0 @@ ws = null;

@@ -21,5 +21,5 @@ "use strict";

} else {
options.WebSocket = require("ws");
options.idleTreshold = 0; // Always reconnect in node.js
}
options.WebSocket = require("ws");
options.idleTreshold = 0; // Always reconnect in node.js
}
options.reconnectInterval = 1000;

@@ -26,0 +26,0 @@ options.reconnectDecay = 1.2;

{
"name": "steem-rpc",
"version": "0.6.3",
"version": "0.6.4",
"description": "Websocket RPC library for the Steem blockchain",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -6,3 +6,3 @@ var expect = require("expect.js");

// pass: "password",
apis: ["database_api", "market_history_api"],
apis: ["database_api", "market_history_api", "network_broadcast_api"],
debug: false

@@ -62,2 +62,11 @@ };

// it("Test timeout and reconnect", function(done) {
// console.log("api", Api.network_broadcast_api().apiId);
// this.timeout(70000);
// setTimeout(function() {
// console.log("api", Api.network_broadcast_api().apiId);
// done();
// }, 65000)
// })
// it("Get potential signatures", function(done) {

@@ -64,0 +73,0 @@ //

@@ -6,3 +6,3 @@ var expect = require("expect.js");

// pass: "password",
apis: ["database_api", "market_history_api"],
apis: ["database_api", "market_history_api", "network_broadcast_api"],
debug: false

@@ -9,0 +9,0 @@ };

Sorry, the diff of this file is too big to display

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