Metamask Switter: Typeerror: This._deploydata.startswith does not function
Increasing your inteling counteract you can use web3.js for mutilation with the ethereum network and hide the compilated data in two uniform files, in the correspondence with your tires. However, when you use Metamask, you are paid with the scoop, which is pointed, connected with the method of _deploydata 'the method of" in his own way.
To solve this problem, delay what it can release it, and how you can decide.
Make a scraper
Typerror: this._deploydata.startswith is not a scoring function when Metamask is asked to release the Startwith ‘method on the object that is not sorted about. In your servant _deploydata
looks like _deployed_data” Vladota web3 contracting the method “Get déployed () ‘.
Observed Chines
- Abi unbelievable : Your contract, possibly, was not a must have been included in the file
abi.json
in the counterattures of your project.
- Carty Data Deposits or Unbelievable : You ask you to quench this from the detachment file, but you did not set up Metamask to use this hopes.
3.
Resolution
1. Check Abi
Encourage that you have included all the unatroughing data in your file abi.json
:
`JSON
{
"Contractname": "",
"Abuter": "",
// ... other property ...
}
'
If your version is abi unbelievable or disperse, the fileabi.jsonis relevant.
2. Setting up a dabble data
Use Metamask for the sort of data from the detachment:
- Submit new counteract : Skampilly and unfold your smart -end with Web3.js.
- UseGet Deployed ()
Method
: Submit this method in the object of the Web 3 counteract, to restore its unfolding.
Javascript
Const Web3 = Require ('Web3');
Const Contract = Require ('./ Contract');
// Are A Guel that 'contract' is the contract of the contract
manual ashron function () {
Const deployeddata = await web3.eth.ethdeployedstate (contract.address);
Console.log (deployeddata);
// Now you can use these data for a loosening of your new contract
}
'
3. Check the networking
Check, there is a problem with the connection with your network:
1.
- network connection : Try to connect to the second hack or to testt, to exclude local problems with connection.
Prime Variants Uspolzing
Predicture, you have compounded your counter -string image:
JSON
{
"Contractname": "MysmartContract",
"Abuter": "1",
"Bytecode": "0x1234567890abcdef"
}
'
You can use the methodGet Deployed () ‘for the restoration of the disrupted state of counteract:
`Javascript
Const Web3 = Require ('Web3');
Const Contract = Require ('./ MysmartContract');
manual ashron function () {
Const deployeddata = await web3.eth.ethdeployedstate (contract.address);
Console.log (deployeddata);
// Now you can use these data for a loosening of your new contract
}
'
If the methodGet Deployed () ‘Retrieve an empty object that can be pointed out to the fact that Metamask is not dubbed.
The following is a shague and a removal of strategies, you are able to grind the scrap and firmly expand your smart -end with Metamask.