Socket
Socket
Sign inDemoInstall

web3-eth-contract

Package Overview
Dependencies
Maintainers
2
Versions
452
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web3-eth-contract - npm Package Compare versions

Comparing version 1.2.9 to 1.2.10-rc.0

24

package.json
{
"name": "web3-eth-contract",
"version": "1.2.9",
"version": "1.2.10-rc.0",
"description": "Web3 module to interact with Ethereum smart contracts.",

@@ -12,21 +12,21 @@ "repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-eth-contract",

"scripts": {
"dtslint": "dtslint --localTs node_modules/typescript/lib types"
"dtslint": "dtslint --localTs ../../node_modules/typescript/lib types"
},
"main": "src/index.js",
"dependencies": {
"@types/bn.js": "^4.11.4",
"@types/bn.js": "^4.11.5",
"underscore": "1.9.1",
"web3-core": "1.2.9",
"web3-core-helpers": "1.2.9",
"web3-core-method": "1.2.9",
"web3-core-promievent": "1.2.9",
"web3-core-subscriptions": "1.2.9",
"web3-eth-abi": "1.2.9",
"web3-utils": "1.2.9"
"web3-core": "1.2.10-rc.0",
"web3-core-helpers": "1.2.10-rc.0",
"web3-core-method": "1.2.10-rc.0",
"web3-core-promievent": "1.2.10-rc.0",
"web3-core-subscriptions": "1.2.10-rc.0",
"web3-eth-abi": "1.2.10-rc.0",
"web3-utils": "1.2.10-rc.0"
},
"devDependencies": {
"dtslint": "^3.4.1",
"typescript": "latest"
"typescript": "^3.9.5"
},
"gitHead": "0e7ee3325437f73f4bace6c2df06aefafd72c716"
"gitHead": "ef81e78b2eed69dd386e0d2cb9bd22d8af998c34"
}

@@ -19,23 +19,11 @@ # web3-eth-contract

### In the Browser
Build running the following in the [web3.js][repo] repository:
```bash
npm run-script build-all
```
Then include `dist/web3-eth-contract.js` in your html file.
This will expose the `Web3EthContract` object on the window object.
## Usage
```js
// in node.js
var Web3EthContract = require('web3-eth-contract');
const Web3EthContract = require('web3-eth-contract');
// set provider for all later instances to use
// Set provider for all later instances to use
Web3EthContract.setProvider('ws://localhost:8546');
var contract = new Web3EthContract(jsonInterface, address);
const contract = new Web3EthContract(jsonInterface, address);
contract.methods.somFunc().send({from: ....})

@@ -42,0 +30,0 @@ .on('receipt', function(){

@@ -74,3 +74,3 @@ /*

if(!jsonInterface || !(Array.isArray(jsonInterface))) {
throw new Error('You must provide the json interface of the contract when instantiating a contract object.');
throw errors.ContractMissingABIError();
}

@@ -346,3 +346,3 @@

if(event === type) {
throw new Error('The event "'+ type +'" is a reserved event name, you can\'t use it.');
throw errors.ContractReservedEventError(type);
}

@@ -603,5 +603,8 @@ };

// return error, if no "data" is specified
// throw error, if no "data" is specified
if(!options.data) {
return utils._fireError(new Error('No "data" specified in neither the given options, nor the default options.'), null, null, callback);
if (typeof callback === 'function'){
return callback(errors.ContractMissingDeployDataError());
}
throw errors.ContractMissingDeployDataError();
}

@@ -650,7 +653,7 @@

if (!event) {
throw new Error('Event "' + eventName + '" doesn\'t exist in this contract.');
throw errors.ContractEventDoesNotExistError(eventName);
}
if (!utils.isAddress(this.options.address)) {
throw new Error('This contract object doesn\'t have address set yet, please set an address first.');
throw errors.ContractNoAddressDefinedError();
}

@@ -692,3 +695,3 @@

if (!callback) {
throw new Error('Once requires a callback as the second parameter.');
throw errors.ContractOnceRequiresCallbackError();
}

@@ -864,3 +867,3 @@

if(!this._deployData && !utils.isAddress(this._parent.options.address))
throw new Error('This contract object doesn\'t have address set yet, please set an address first.');
throw errors.ContractNoAddressDefinedError();

@@ -954,3 +957,3 @@ if(!this._deployData)

if(!utils.isAddress(args.options.from)) {
return utils._fireError(new Error('No "from" address specified in neither the given options, nor the default options.'), defer.eventEmitter, defer.reject, args.callback);
return utils._fireError(errors.ContractNoFromAddressDefinedError(), defer.eventEmitter, defer.reject, args.callback);
}

@@ -957,0 +960,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