Ich möchte auf die Daten zugreifen, die ich im vorigen Vertragsfall über eine Funktion gesendet habe. Ist es möglich, die Daten über die Vertragsinstanz oder den Transaktionshash abzurufen?
Sie müssen einen Vertrag nicht erneut bereitstellen. Wenn er bereits bereitgestellt ist, müssen Sie eine Instanz erstellen, die auf die Vertragsadresse verweist
async function queryContract() {
const ContractABI = [...]; // <-- Contract ABI
const ContractAddress = "0x1234...."; // <-- Deployed contract address
// Assign deployed address of a contract
const myContract = new web3.eth.Contract(ContractABI, ContractAddress);
// Send a transaction
await myContract.methods.sendHash("0x12341234")
.send({
from: MyAccount,
gas: 2000000,
gasPrice: '30000000000'
});
// Query modified data
const hash = await myContract.methods.getHash().call();
console.log(hash)
}
queryContract();
Santosh Kaluva
Ismael