current position:Home>DAPP related language version update

DAPP related language version update

2022-02-03 23:09:34 Q & A of Denglian community

I am learning DAPP Not to mention the course of solidity Version update for 1. About web3.js Address update problem , Just change the address in the tutorial to the new address

<script src="[email protected]/dist/web3.min.js"></script>

Or simply visit this address, download it locally, and then visit it locally .

2. The way to interact with contracts in the course is to enter ABI And contract address , The new version 1.2.11 Is written

var Contract = require('web3-eth-contract');// set provider for all later instances to useContract.setProvider('ws://localhost:8546');var contract = new Contract(jsonInterface, address);contract.methods.somFunc().send({from: ....}).on('receipt', function(){    ...});

If I use metamask, Is it written

var Contract = require('web3-eth-contract');const ganache = require("ganache-core");Contract.setProvider(ganache.provider());var contract = new Contract(jsonInterface, address);contract.methods.somFunc().send({from: ....}).on('receipt', function(){    ...}); (Ganache Reference resources ) So among them jsonInterface Is it built with JSON Just the file path , and address Because in JSON It has been parsed in, so there is no need to write ( Although the document also says optional ). And how to get the returned data. I didn't find it in the document , sorry

Take the answer 1:
  1. Sure , however Web3.js stay 1.0 Version and previous versions API The interface is a little different , The use of the interface requires Reference documents

  2. No , If you use metamask Can be injected window.ethereum As provider. Or your reference This link

copyright notice
author[Q & A of Denglian community],Please bring the original link to reprint, thank you.

Random recommended