Skip to content

Example of a pyth project relying on Pyth data

License

Notifications You must be signed in to change notification settings

hirosystems/clarinet-pyth-example

Clarinet Transaction Simulation Demo

See it in action:

$ npm i -f
$ npm t

Details

This project currently uses clarinet-sdk latest beta ("@hirosystems/clarinet-sdk": "^2.13.0-beta15" or above).

Enable remote data fetching

Remote data fetching is enabled with the following setting. The Simnet will fork mainnet from block 522000.

Important

This is still in beta and could change in the near future.

# clarinet.toml
[repl.remote_data]
enabled = true
api_url = "https://api.hiro.so"
initial_height = 522000

Usage

See usage examples in the test file. Nothing really changes in the way we interact with contract, except that it will use data from mainnet.

const { result } = simnet.callReadOnlyFn(
  "SP3R4F6C1J3JQWWCVZ3S7FRRYPMYG6ZW6RZK31FXY.pyth-storage-v3",
  "get-price",
  [btcFeed],
  address1,
);

About

Example of a pyth project relying on Pyth data

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks