Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

this.methods.contractConstructor is not a function #2431

Closed
EthanWan opened this issue Feb 28, 2019 · 3 comments · Fixed by #2432
Closed

this.methods.contractConstructor is not a function #2431

EthanWan opened this issue Feb 28, 2019 · 3 comments · Fixed by #2432
Labels
Bug Addressing a bug

Comments

@EthanWan
Copy link

i want to deploy my contract, code is very sample:

    let Web3 = require('web3'); // version v1.0.0-beta46
    const web3 = new Web3("ws://localhost:8545");

    const myContract = new web3.eth.Contract([insert abi]);

    myContract.deploy({
        arguments: [],
        data: "0x12345..."
    })
    // ...

Steps to reproduce the behavior

  1. run command
node deploy.js 

Error Logs

(node:30192) UnhandledPromiseRejectionWarning: TypeError: this.methods.contractConstructor is not a function
    at AbstractContract.deploy (/Users/wansy/Desktop/ethereum-test/node_modules/web3-eth-contract/dist/web3-eth-contract.cjs.js:1036:27)
...

debugger

i use node --inspect to debugger, then print this.method's function:

iModel:AbiModel {abi: Object}
contract:AbstractContract {providersModuleFactory: ProvidersModuleFactory, providerDetector: ProviderDetector, providerResolver: ProviderResolver, …}
methodEncoder:MethodEncoder {abiCoder: AbiCoder}
methodFactory:MethodFactory {accounts: Proxy, utils: Object, formatters: Object, …}
methodOptionsMapper:MethodOptionsMapper {utils: Object, formatters: Object}
methodOptionsValidator:MethodOptionsValidator {utils: Object}
PromiEvent:function PromiEvent() { … }

there have no contractConstructor function

Versions

  • NPM 6.4.1
  • Node v8.11.2
  • Web3.js v1.0.0-beta46
  • OS macOS
@nivida
Copy link
Contributor

nivida commented Feb 28, 2019

Thanks for creating this issue! Could you please add your contract code or the related ABI?

@nivida
Copy link
Contributor

nivida commented Feb 28, 2019

Just checked the code and saw the issue you have. This got fixed in this PR: #2432

@nivida nivida added Bug Addressing a bug and removed more information needed labels Feb 28, 2019
@EthanWan
Copy link
Author

Thanks for creating this issue! Could you please add your contract code or the related ABI?

ABI:

[
	{
		"constant": false,
		"inputs": [
			{
				"name": "a",
				"type": "uint256"
			},
			{
				"name": "b",
				"type": "uint256"
			}
		],
		"name": "add",
		"outputs": [
			{
				"name": "",
				"type": "uint256"
			}
		],
		"payable": false,
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"constant": true,
		"inputs": [],
		"name": "getCount",
		"outputs": [
			{
				"name": "",
				"type": "uint256"
			}
		],
		"payable": false,
		"stateMutability": "view",
		"type": "function"
	}
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Addressing a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants