SDKs

SDKs available in languages such as JavaScript

Using the JavaScript SDK (ChangeJS)

Example: Interacting with a Smart Contract

// const { ChangeChainProvider, Contract, Wallet } = require('changejs');
const provider = new ChangeChainProvider('https://node.changechain.org');

// ABI and Contract Address
const abi = [
  // ABI array of the contract
];
const contractAddress = '0xCONTRACT_ADDRESS';

// Initialize wallet and contract
const privateKey = '0xYOUR_PRIVATE_KEY';
const wallet = new Wallet(privateKey, provider);
const contract = new Contract(contractAddress, abi, wallet);

// Call a contract function
async function getValue() {
  const value = await contract.functions.getValue();
  console.log('Contract Value:', value);
}

// Send a transaction to the contract
async function setValue(newValue) {
  const tx = await contract.functions.setValue(newValue);
  await tx.wait(); // Wait for transaction confirmation
  console.log('Value Set Successfully');
}

getValue();
setValue(42);

Last updated