Skip to content

Commit 067cd86

Browse files
authored
fix(pricefeed) Update Sui Guide (#495)
1 parent cb030d4 commit 067cd86

File tree

1 file changed

+2
-5
lines changed
  • pages/price-feeds/use-real-time-data

1 file changed

+2
-5
lines changed

pages/price-feeds/use-real-time-data/sui.mdx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,12 @@ Pyth also provides a javascript SDK to construct transaction blocks that update
9595
9696
The code snippet below provides a general template for what your contract code should look like:
9797
98-
```rust {20} copy
98+
```rust {18} copy
9999
module pyth_example::main {
100100
use sui::clock::Clock;
101101
use pyth::price_info;
102102
use pyth::price_identifier;
103103
use pyth::price;
104-
use pyth::state::{State as PythState};
105104
use pyth::pyth;
106105
use pyth::price_info::PriceInfoObject;
107106

@@ -110,12 +109,11 @@ module pyth_example::main {
110109
public fun use_pyth_price(
111110
// Other arguments
112111
clock: &Clock,
113-
pyth_state: &PythState,
114112
price_info_object: &PriceInfoObject,
115113
){
116114
let max_age = 60;
117115
// Make sure the price is not older than max_age seconds
118-
let price_struct = pyth::get_price(pyth_state,price_info_object, clock);
116+
let price_struct = pyth::get_price_no_older_than(price_info_object,clock, max_age);
119117

120118
// Check the price feed ID
121119
let price_info = price_info::get_price_info_from_price_info_object(price_info_object);
@@ -168,7 +166,6 @@ tx.moveCall({
168166
target: `pyth_example::main::use_pyth_price`,
169167
arguments: [
170168
..., // other arguments needed for your contract
171-
tx.object(pythStateId),
172169
tx.object(priceInfoObjectIds[0]),
173170
],
174171
});

0 commit comments

Comments
 (0)