Returns an ethers.js provider for the Selendra Network.
network
(optional): 'mainnet' (default) or 'testnet'
const { getSelendraProvider } = require('./utils/selendraConfig');
const provider = getSelendraProvider('testnet');
Returns an ethers.js wallet instance for the Selendra Network.
privateKey
: Your account's private keynetwork
(optional): 'mainnet' (default) or 'testnet'
const { getSelendraWallet } = require('./utils/selendraConfig');
const wallet = getSelendraWallet('your-private-key', 'mainnet');
Deploys a contract to the Selendra Network.
contractJson
: Object containing contract ABI and bytecodeconstructorArgs
: Array of constructor argumentsprivateKey
: Deployer's private keynetwork
(optional): 'mainnet' (default) or 'testnet'
const { deployContract } = require('./utils/contractInteraction');
const contract = await deployContract(MyContract, [], 'your-private-key');
Returns a contract instance.
contractAddress
: Address of the deployed contractcontractAbi
: ABI of the contractsignerOrProvider
: Ethers.js signer or provider
const { getContract } = require('./utils/contractInteraction');
const contract = await getContract('0x...', MyContract.abi, provider);
Estimates gas for a contract method call.
contract
: Contract instancemethod
: Name of the method to callargs
: Array of method arguments
const { estimateGas } = require('./utils/contractInteraction');
const gasEstimate = await estimateGas(contract, 'myMethod', [arg1, arg2]);
Sends a transaction to a contract method.
contract
: Contract instancemethod
: Name of the method to callargs
: Array of method argumentsoptions
(optional): Transaction options
const { sendTransaction } = require('./utils/contractInteraction');
const tx = await sendTransaction(contract, 'myMethod', [arg1, arg2]);
For more detailed examples and use cases, refer to the Examples dapp documentation.