Last updated
Last updated
After the feed has been initialized from the last step of , we can now request price signatures from oracles!
So now that we have the contract ready to read and use Switchboard update data, we need a way to fetch these encoded values. Using Crossbar, we can get an encoded feed update with just a fetch. For simplicity, we'll demonstrate a fetch using both.
We'll be working from the Typescript portion of :
bun add ethers
We'll be using to write updates to the example contract. Add it to the project and import the Switchboard EVM call.
Here we're getting the results for the aggregatorId
from Switchboard using the default crossbar deployment.
Pass the encoded updates bytes[] calldata
into the getFeedData call. This will send the transaction over the wire.
In order to submit transactions on the target chain, you need to plug in the right RPC and private key. The signerWithProvider
will be what we pass into the contract.
Add the example contract binding with the getFeedData
call in the ABI.
Here we're connecting all of these components. We're compiling all of calls into a system where we can pull the encoded updates, and calling the contract.