Interacting With Fiefdom Smart Contracts
const Web3 = require('web3'); const web3 = new Web3('https://fiefdom-playground.calderachain.xyz/http');const { ethers } = require('ethers'); const provider = new ethers.providers.JsonRpcProvider('https://fiefdom-playground.calderachain.xyz/http');
const contract = new web3.eth.Contract(abi, contractAddress);const contract = new ethers.Contract(contractAddress, abi, provider);
contract.methods.yourMethodName().call().then(console.log);contract.methods.yourMethodName().send({ from: senderAddress }).then(console.log);// For view methods contract.yourMethodName().then(console.log); // For state-changing methods const signer = provider.getSigner(); const contractWithSigner = contract.connect(signer); contractWithSigner.yourMethodName().then(console.log);
Last updated