You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once the SDK is installed, one can import the sdk into your smart contracts:
29
+
Once the SDK is installed, one can import the sdk into smart contracts:
30
30
31
31
```solidity copy
32
32
import { PythLazer } from "pyth-lazer/PythLazer.sol";
@@ -65,4 +65,81 @@ function updatePrice(bytes calldata priceUpdate) public payable {
65
65
66
66
The `verifyUpdate` function will verify the price update and return the payload and the verification fee. This call takes a fee which can be queried from `verification_fee()` function and passed to the `verifyUpdate` call. This fee is used to cover the cost of verifying the price update.
67
67
68
+
This SDK provides `parsePayloadHeader` method to retrieve the values from the payload header.
### Subscribe to Pyth Lazer to receive Price Updates
114
+
115
+
Pyth Lazer provides a websocket endpoint to receive price updates. Moreover, Pyth Lazer provides a typescript SDK to subscribe to the websocket endpoint.
116
+
117
+
Consult [How to fetch price updates from Pyth Lazer](../fetch-price-updates.mdx) for a complete step-by-step guide.
118
+
119
+
### Include the price updates into smart contract transactions
120
+
121
+
Now that one have the price updates, and the smart contract is able to parse the price updates, one can include the price updates into the smart contract transactions by passing the price updates received from the websocket to the `updatePrice` method.
122
+
68
123
</Steps>
124
+
125
+
## Additional Resources
126
+
127
+
You may find these additional resources helpful for integrating Pyth Lazer into your EVM smart contracts.
128
+
129
+
### Price Feed IDs
130
+
131
+
Pyth Lazer supports a wide range of price feeds. Consult the [Price Feed IDs](../price-feeds.mdx) page for a complete list of supported price feeds.
132
+
133
+
### Examples
134
+
135
+
[Pyth-lazer-example-evm](https://github.com/pyth-network/pyth-examples/tree/main/lazer/evm) is a simple example contract that parses and consumes price updates from Pyth Lazer.
136
+
137
+
[pyth-lazer-example-js](https://github.com/pyth-network/pyth-examples/tree/main/lazer/js) is a simple example for subscribing to the Pyth Lazer websocket.
0 commit comments