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
Pyth provides a javascript SDK to construct transaction blocks that update price feeds.
55
+
Pyth also provides a javascript SDK to construct transaction blocks that update price feeds:
53
56
54
57
<Tabs items={["npm", "yarn"]}>
55
58
<Tabs.Tab>
@@ -64,7 +67,7 @@ Pyth provides a javascript SDK to construct transaction blocks that update price
64
67
65
68
Your Sui Move module **should NOT** have a hard-coded call to `pyth::update_single_price_feed.` In other words, a contract should **never call** the Sui Pyth `pyth::update_single_price_feed` entry point. Instead, it should be called directly from client code (e.g., Typescript or Rust).
66
69
67
-
This is because the new address differs from the original when a Sui contract is [upgraded](https://docs.sui.io/build/package-upgrades). If your module has a hard-coded call to `pyth::update_single_price_feed` living at a fixed call-site, it may eventually get bricked due to how Pyth upgrades are implemented. (We only allow users to interact with the most recent package version for security reasons).
70
+
When Sui contracts are [upgraded](<(https://docs.sui.io/build/package-upgrades)>), the address changes, which makes the old address no longer valid. If your module has a hard-coded call to `pyth::update_single_price_feed` living at a fixed call-site, it may eventually get bricked due to how Pyth upgrades are implemented. (We only allow users to interact with the most recent package version for security reasons).
68
71
69
72
Therefore, you should build a [Sui programmable transaction](https://docs.sui.io/build/prog-trans-ts-sdk) that first updates the price by calling `pyth::update_single_price_feed` at the latest call-site from the client-side and then call a functionin your contract that invokes `pyth::get_price` on the `PriceInfoObject` to get the recently updated price.
70
73
You can use `SuiPythClient` to build such transactions and handle all the complexity of updating the price feeds.
@@ -187,27 +190,8 @@ You may find these additional resources helpful for developing your Sui applicat
187
190
188
191
### Contract Addresses
189
192
190
-
Developers will need the Pyth package IDs to use Pyth.
191
-
Please consult [Sui Contract Addresses](../contract-addresses/sui) to find the package IDs for your blockchain.
192
-
193
-
## Common Questions on How to Integrate with Pyth on Sui
194
-
195
-
### What is up with the "sui rev"? Why does it point to a specific commit hash instead of "main" or "devnet"?
196
-
197
-
Our Pyth `Move.toml` depends on specific versions of the [Sui Framework](https://github.com/MystenLabs/sui) as well as [Wormhole](https://github.com/wormhole-foundation/wormhole).
198
-
To make your Sui package compatible, you must also specify the following dependencies verbatim in your `Move.toml` file. We are locked in to this specific `rev` because our package depends on Wormhole and it is pinned to this
### How do I find the Sui Object ID of a PriceInfoObject for a Pyth Price Feed?
193
+
Consult [Sui Contract Addresses](../contract-addresses/sui) to find the package IDs.
209
194
210
-
You can use the `getPriceFeedObjectId`functionin the js sdk to fetch the object ids.
211
-
This mapping is also stored on-chain, and can be queried on-chain using the getter function`pyth::state::get_price_info_object_id` defined in the Pyth package.
195
+
### Pyth Price Feed IDs
212
196
213
-
Also recall that the list of Pyth price feed IDs can be found [here](https://pyth.network/developers/price-feed-ids).
197
+
Consult [Pyth Price Feed IDs](https://pyth.network/developers/price-feed-ids) to find Pyth price feed IDs for various assets.
0 commit comments