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

@geekcash/smart-rpc

Package Overview
Dependencies
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@geekcash/smart-rpc - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

2

dist/index.js

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

module.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t){e.exports=require("util")},function(e,t){e.exports=require("events")},function(e,t,n){"use strict";var o=function(e){return e&&e.__esModule?e:{default:e}}(n(3));var r=n(4),s=n(0),i=n(1).EventEmitter;function c(){i.call(this)}c.prototype={create:function(e){return new r(e)},listen:function(e){var t=this;Array.isArray(e)||(e=[e]);var n=this;this.clients=[];for(var r=0;r<e.length;r++){var s=e[r];if(!s.id)throw new Error("option.id is required");var i=this.create((0,o.default)(s,{listen:1}));this.clients.push(i)}for(var c=function(e){var o=t.clients[e];o.on("error",function(e){n.emit("error",o,e)}),o.on("hashblock",function(e){n.emit("hashblock",o,e)}),o.on("block",function(e){n.emit("block",o,e)}),o.on("rawtx",function(e){n.emit("rawtx",o,e)}),o.on("tx",function(e){n.emit("tx",o,e)})},a=0;a<this.clients.length;a++)c(a)}},s.inherits(c,i),e.exports=new c},function(e,t){e.exports=require("babel-runtime/core-js/object/assign")},function(e,t,n){"use strict";var o=function(e){return e&&e.__esModule?e:{default:e}}(n(5));var r=n(6),s=n(0),i=n(7),c=n(8),a=n(9),l=n(10),u=n(1).EventEmitter;function d(e){u.call(this),this.opts=e,this.id=e.id,this.apis=["abandonTransaction","addMultiSigAddress","addNode","backupWallet","clearBanned","createMultiSig","createRawTransaction","debug","decodeRawTransaction","decodeScript","disconnectNode","dumpPrivKey","dumpWallet","encryptWallet","estimateFee","estimatePriority","estimateSmartFee","estimateSmartPriority","fundRawTransaction","generate","getAccount","getAccountAddress","getAddressMempool","getAddressUtxos","getAddressBalance","getAddressDeltas","getAddressTxids","getAddressesByAccount","getAddedNodeInfo","getBalance","getBestBlockHash","getBlock","getBlockchainInfo","getBlockCount","getBlockHashes","getBlockHash","getBlockHeader","getBlockHeaders","getBlockTemplate","getConnectionCount","getChainTips","getDifficulty","getGenerate","getGovernanceInfo","getGovernanceInfo","getInfo","getMemPoolInfo","getMiningInfo","getNewAddress","getNetTotals","getNetworkInfo","getNetworkHashps","getPeerInfo","getPoolInfo","getRawMemPool","getRawChangeAddress","getRawTransaction","getReceivedByAccount","getReceivedByAddress","getSpentInfo","getSuperBlockBudget","getTransaction","getTxOut","getTxOutProof","getTxOutSetInfo","getWalletInfo","help","importAddress","instantSendToAddress","gobject","invalidateBlock","importPrivKey","importPubKey","importElectrumWallet","importWallet","keyPoolRefill","listAccounts","listAddressGroupings","listBanned","listReceivedByAccount","listReceivedByAddress","listSinceBlock","listTransactions","listUnspent","listLockUnspent","lockUnspent","masternode","masternodeBroadcast","masternodeList","mnsync","move","ping","prioritiseTransaction","privateSend","reconsiderBlock","resendWalletTransactions","sendFrom","sendMany","sendRawTransaction","sendToAddress","sentinelPing","setAccount","setBan","setGenerate","setTxFee","setMockTime","spork","signMessage","signRawTransaction","stop","submitBlock","validateAddress","verifyMessage","verifyChain","verifyTxOutProof","voteRaw","walletLock","walletPassPhrase","walletPassphraseChange"],this.transactions=a(5e3),this.transactionLocks=a(5e3),this.blocks=a(50),this.axios=r.create(e.rpc),this.axios.interceptors.response.use(function(e){return e&&e.data?e.data.result:null},function(e){return o.default.reject(e)}),this.init(),e.listen&&e.socket&&this.listen()}d.prototype={init:function(){for(var e=this,t=function(t){var n=e.apis[t];e[n]=function(){var e=[].slice.call(arguments);return this.axios.request({data:{jsonrpc:"2.0",method:n.toLowerCase(),params:e,id:(new Date).getTime()},maxContentLength:5e7,timeout:6e4})}},n=0;n<this.apis.length;n++)t(n)},listen:function(){var e=this;this.socket=c.socket("sub"),this.socket.on("connect",function(e,t){i.info("ZMQ connected to:",t)}),this.socket.on("connect_delay",function(e,t){i.warn("ZMQ connection delay:",t)}),this.socket.on("disconnect",function(e,t){i.warn("ZMQ disconnect:",t)}),this.socket.on("monitor_error",function(t){i.error("Error in monitoring: %s, will restart monitoring in 5 seconds",t),setTimeout(function(){e.socket.monitor(500,0)},5e3)}),this.socket.subscribe("hashblock"),this.socket.subscribe("rawtx"),this.socket.subscribe("rawtxlock"),this.socket.on("message",function(t,n){switch(t.toString("utf8")){case"rawtxlock":var o=n.toString("hex"),r=l.md5(o);e.transactionLocks.get(r)||(e.transactionLocks.set(r,!0),e.decodeRawTransaction(o).then(function(t){e.emit("txlock",t)}));break;case"rawtx":o=n.toString("hex"),r=l.md5(o);e.transactions.get(r)||(e.transactions.set(r,!0),e.emit("rawtx",n),e.decodeRawTransaction(o).then(function(t){e.emit("tx",t)}));break;case"hashblock":o=n.toString("hex");e.blocks.get(o)||(e.blocks.set(o,!0),e.emit("hashblock",o),e.getBlock(o).then(function(t){e.emit("block",t)}))}}),i.info("Start monitoring..."),this.socket.monitor(500,0),this.socket.connect(this.opts.socket)}},s.inherits(d,u),e.exports=d},function(e,t){e.exports=require("babel-runtime/core-js/promise")},function(e,t){e.exports=require("axios")},function(e,t){e.exports=require("loglevel")},function(e,t){e.exports=require("zmq")},function(e,t){e.exports=require("lru-cache")},function(e,t){e.exports=require("mix-hash")}]);
module.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t){e.exports=require("util")},function(e,t){e.exports=require("events")},function(e,t,n){"use strict";var o=function(e){return e&&e.__esModule?e:{default:e}}(n(3));var i=n(4),s=n(0),r=n(1).EventEmitter;function c(){r.call(this)}c.prototype={create:function(e){return new i(e)},listen:function(e){var t=this;Array.isArray(e)||(e=[e]);var n=this;this.clients=[];for(var i=0;i<e.length;i++){var s=e[i];if(!s.id)throw new Error("option.id is required");var r=this.create((0,o.default)(s,{listen:1}));this.clients.push(r)}for(var c=function(e){var o=t.clients[e];o.on("error",function(e){n.emit("error",o,e)}),o.on("hashblock",function(e){n.emit("hashblock",o,e)}),o.on("block",function(e){n.emit("block",o,e)}),o.on("rawtx",function(e){n.emit("rawtx",o,e)}),o.on("tx",function(e){n.emit("tx",o,e)})},a=0;a<this.clients.length;a++)c(a)}},s.inherits(c,r),e.exports=new c},function(e,t){e.exports=require("babel-runtime/core-js/object/assign")},function(e,t,n){"use strict";var o=function(e){return e&&e.__esModule?e:{default:e}}(n(5));var i=n(6),s=n(0),r=n(7),c=n(8),a=n(9),u=n(10),l=n(1).EventEmitter;function d(e){l.call(this),r.setLevel("info"),this.opts=e,this.id=e.id,this.apis=["abandonTransaction","addMultiSigAddress","addNode","backupWallet","clearBanned","createMultiSig","createRawTransaction","debug","decodeRawTransaction","decodeScript","disconnectNode","dumpPrivKey","dumpWallet","encryptWallet","estimateFee","estimatePriority","estimateSmartFee","estimateSmartPriority","fundRawTransaction","generate","getAccount","getAccountAddress","getAddressMempool","getAddressUtxos","getAddressBalance","getAddressDeltas","getAddressTxids","getAddressesByAccount","getAddedNodeInfo","getBalance","getBestBlockHash","getBlock","getBlockchainInfo","getBlockCount","getBlockHashes","getBlockHash","getBlockHeader","getBlockHeaders","getBlockTemplate","getConnectionCount","getChainTips","getDifficulty","getGenerate","getGovernanceInfo","getGovernanceInfo","getInfo","getMemPoolInfo","getMiningInfo","getNewAddress","getNetTotals","getNetworkInfo","getNetworkHashps","getPeerInfo","getPoolInfo","getRawMemPool","getRawChangeAddress","getRawTransaction","getReceivedByAccount","getReceivedByAddress","getSpentInfo","getSuperBlockBudget","getTransaction","getTxOut","getTxOutProof","getTxOutSetInfo","getWalletInfo","help","importAddress","instantSendToAddress","gobject","invalidateBlock","importPrivKey","importPubKey","importElectrumWallet","importWallet","keyPoolRefill","listAccounts","listAddressGroupings","listBanned","listReceivedByAccount","listReceivedByAddress","listSinceBlock","listTransactions","listUnspent","listLockUnspent","lockUnspent","masternode","masternodeBroadcast","masternodeList","mnsync","move","ping","prioritiseTransaction","privateSend","reconsiderBlock","resendWalletTransactions","sendFrom","sendMany","sendRawTransaction","sendToAddress","sentinelPing","setAccount","setBan","setGenerate","setTxFee","setMockTime","spork","signMessage","signRawTransaction","stop","submitBlock","validateAddress","verifyMessage","verifyChain","verifyTxOutProof","voteRaw","walletLock","walletPassPhrase","walletPassphraseChange"],this.transactions=a(5e3),this.transactionLocks=a(5e3),this.blocks=a(50),this.axios=i.create(e.rpc),this.axios.interceptors.response.use(function(e){return e&&e.data?e.data.result:null},function(e){return o.default.reject(e.response.data)}),this.init(),e.listen&&e.socket&&this.listen()}d.prototype={init:function(){for(var e=this,t=function(t){var n=e.apis[t];e[n]=function(){var e=[].slice.call(arguments);return this.axios.request({data:{jsonrpc:"2.0",method:n.toLowerCase(),params:e,id:(new Date).getTime()},maxContentLength:5e7,timeout:6e4})}},n=0;n<this.apis.length;n++)t(n);this._ready()},_ready:function(){var e=this;r.info("Check %s Daemon Ready",e.id,new Date),this.getBestBlockHash().then(function(t){e.getBlock(t).then(function(t){e.emit("ready"),r.info("%s Daemon Ready",e.id)}).catch(function(t){setTimeout(function(){e._ready()},5e3)})}).catch(function(t){setTimeout(function(){e._ready()},5e3)})},listen:function(){var e=this;this.socket=c.socket("sub"),this.socket.on("connect",function(e,t){r.info("ZMQ connected to:",t)}),this.socket.on("connect_delay",function(e,t){r.warn("ZMQ connection delay:",t)}),this.socket.on("disconnect",function(e,t){r.warn("ZMQ disconnect:",t)}),this.socket.on("monitor_error",function(t){r.error("Error in monitoring: %s, will restart monitoring in 5 seconds",t),setTimeout(function(){e.socket.monitor(500,0)},5e3)}),this.socket.subscribe("hashblock"),this.socket.subscribe("rawtx"),this.socket.subscribe("rawtxlock"),this.socket.on("message",function(t,n){switch(t.toString("utf8")){case"rawtxlock":var o=n.toString("hex"),i=u.md5(o);e.transactionLocks.get(i)||(e.transactionLocks.set(i,!0),e.decodeRawTransaction(o).then(function(t){e.emit("txlock",t)}));break;case"rawtx":o=n.toString("hex"),i=u.md5(o);e.transactions.get(i)||(e.transactions.set(i,!0),e.emit("rawtx",n),e.decodeRawTransaction(o).then(function(t){e.emit("tx",t)}));break;case"hashblock":o=n.toString("hex");e.blocks.get(o)||(e.blocks.set(o,!0),e.emit("hashblock",o),e.getBlock(o).then(function(t){e.emit("block",t)}))}}),r.info("Start monitoring..."),this.socket.monitor(500,0),this.socket.connect(this.opts.socket)}},s.inherits(d,l),e.exports=d},function(e,t){e.exports=require("babel-runtime/core-js/promise")},function(e,t){e.exports=require("axios")},function(e,t){e.exports=require("loglevel")},function(e,t){e.exports=require("zmq")},function(e,t){e.exports=require("lru-cache")},function(e,t){e.exports=require("mix-hash")}]);
{
"name": "@geekcash/smart-rpc",
"version": "1.0.6",
"version": "1.0.7",
"description": "Block and Transaction Real-Time Broadcasting in JavaScript.",

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

@@ -120,2 +120,6 @@ Block and Transaction Real-Time Broadcasting

client.on('ready' function(){
console.log('Daemon is Ready!');
});
// Returns the hash of the best (tip) block in the longest block chain.

@@ -122,0 +126,0 @@ // Result

@@ -15,2 +15,3 @@ 'use strict';

EventEmitter.call(this);
log.setLevel("info");
this.opts = option;

@@ -31,3 +32,3 @@ this.id = option.id;

// Do something with response error
return Promise.reject(error);
return Promise.reject(error.response.data);
});

@@ -65,7 +66,32 @@

};
}
this._ready();
},
_ready: function () {
var self = this;
log.info('Check %s Daemon Ready', self.id, new Date());
this.getBestBlockHash().then((hash) => {
self.getBlock(hash).then((data) => {
self.emit('ready');
log.info('%s Daemon Ready', self.id);
}).catch(err => {
setTimeout(function () {
self._ready();
}, 5000);
return;
});
}).catch(err => {
setTimeout(function () {
self._ready();
}, 5000);
return;
});
},
listen: function () {

@@ -72,0 +98,0 @@

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