Arbitrum
Read prices in your browser
Read a price update on-chain
import { ethers } from 'ethers';
// Set up your Arbitrum provider
const provider = new ethers.JsonRpcProvider("<YOUR_PROVIDER_URL>");
// Initialize wallet using private key and connect it to the provider
const wallet = new ethers.Wallet("<YOUR_PRIVATE_KEY>", provider);
// PriceFeedsUpdateTrigger contract address
const triggerAddress = "0xff2743c44f820C64c94eCCfc1B497a1019541097";
// ABI definition of the contract's refreshPriceFeeds method
const abi = [
"function refreshPriceFeeds() payable external"
];
const trigger = new ethers.Contract(triggerAddress, abi, wallet);
async function refreshPriceFeeds() {
try {
// No ETH value: the contract requires msg.value to be exactly 0
const tx = await trigger.refreshPriceFeeds();
console.log("Transaction sent. Waiting for confirmation...");
const receipt = await tx.wait();
console.log("Transaction confirmed:", receipt.hash);
} catch (error) {
console.error("Error while calling refreshPriceFeeds:", error);
}
}
refreshPriceFeeds();Read the price on-chain
Last updated
Was this helpful?
