web3-eth-contract
Advanced tools
Comparing version 1.2.9 to 1.2.10-rc.0
{ | ||
"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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1162
46439
1
2
49
+ Addedeth-lib@0.2.8(transitive)
+ Addedeventemitter3@4.0.4(transitive)
+ Addedweb3-core@1.2.10-rc.0(transitive)
+ Addedweb3-core-helpers@1.2.10-rc.0(transitive)
+ Addedweb3-core-method@1.2.10-rc.0(transitive)
+ Addedweb3-core-promievent@1.2.10-rc.0(transitive)
+ Addedweb3-core-requestmanager@1.2.10-rc.0(transitive)
+ Addedweb3-core-subscriptions@1.2.10-rc.0(transitive)
+ Addedweb3-eth-abi@1.2.10-rc.0(transitive)
+ Addedweb3-eth-iban@1.2.10-rc.0(transitive)
+ Addedweb3-providers-http@1.2.10-rc.0(transitive)
+ Addedweb3-providers-ipc@1.2.10-rc.0(transitive)
+ Addedweb3-providers-ws@1.2.10-rc.0(transitive)
+ Addedweb3-utils@1.2.10-rc.0(transitive)
- Removedbn.js@4.11.8(transitive)
- Removedeth-lib@0.2.7(transitive)
- Removedeventemitter3@3.1.24.0.7(transitive)
- Removedweb3-core@1.2.9(transitive)
- Removedweb3-core-helpers@1.2.9(transitive)
- Removedweb3-core-method@1.2.9(transitive)
- Removedweb3-core-promievent@1.2.9(transitive)
- Removedweb3-core-requestmanager@1.2.9(transitive)
- Removedweb3-core-subscriptions@1.2.9(transitive)
- Removedweb3-eth-abi@1.2.9(transitive)
- Removedweb3-eth-iban@1.2.9(transitive)
- Removedweb3-providers-http@1.2.9(transitive)
- Removedweb3-providers-ipc@1.2.9(transitive)
- Removedweb3-providers-ws@1.2.9(transitive)
- Removedweb3-utils@1.2.9(transitive)
Updated@types/bn.js@^4.11.5
Updatedweb3-core@1.2.10-rc.0
Updatedweb3-core-method@1.2.10-rc.0
Updatedweb3-eth-abi@1.2.10-rc.0
Updatedweb3-utils@1.2.10-rc.0