Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Oracles, VRF, and CCIP with Chainlink
import { Chainlink } from './Chainlink.js'; const chainlink = Chainlink({ provider }); // Get latest price const ethUsd = await chainlink.getLatestPrice(ETH_USD_FEED); console.log('ETH/USD:', ethUsd.answer / 10n ** 8n); // Get historical round const round = await chainlink.getRoundData(ETH_USD_FEED, roundId);
// Request randomness const requestId = await chainlink.requestRandomWords({ keyHash: VRF_KEY_HASH, subId: subscriptionId, minimumRequestConfirmations: 3, callbackGasLimit: 100000, numWords: 1, signer, }); // Randomness delivered to your contract's fulfillRandomWords()
// Send cross-chain message await chainlink.sendCcipMessage({ destinationChainSelector: ARBITRUM_SELECTOR, receiver: receiverContract, data: encodedMessage, tokenAmounts: [], // Optional token transfer feeToken: LINK_ADDRESS, signer, }); // Get message status const status = await chainlink.getMessageStatus(messageId);
Was this page helpful?