diff --git a/__tests__/validateCodeSnippets.ts b/__tests__/validateCodeSnippets.ts
index 203c10eb..ee991005 100644
--- a/__tests__/validateCodeSnippets.ts
+++ b/__tests__/validateCodeSnippets.ts
@@ -199,6 +199,5 @@ function validateCodeSnippets(directoryPath: string): void {
describe("Validate code snippets", () => {
// We only validate code snippets in the API reference.
// However, we exclude Aptos for now because it's annoying (and doesn't seem worth it).
- validateCodeSnippets("./pages/price-feeds/api-reference/evm");
validateCodeSnippets("./pages/price-feeds/api-reference/cosmwasm");
});
diff --git a/next.config.js b/next.config.js
index ec9f5c4c..41734aeb 100644
--- a/next.config.js
+++ b/next.config.js
@@ -140,14 +140,29 @@ const nextConfig = {
config.resolve.fallback = { fs: false, net: false, tls: false };
return config;
},
+
async redirects() {
- return permanentRedirectArray.map((value) => {
+ const permanentRedirects = permanentRedirectArray.map((value) => {
return {
source: value[0],
destination: value[1],
permanent: true,
};
});
+
+ return [
+ ...permanentRedirects,
+ {
+ source: "/price-feeds/api-reference/evm/:slug",
+ destination: "https://api-reference.pyth.network/price-feeds/evm/:slug",
+ permanent: false,
+ },
+ {
+ source: "/price-feeds/api-reference/evm/",
+ destination: "https://api-reference.pyth.network/price-feeds/evm/",
+ permanent: false,
+ },
+ ];
},
};
diff --git a/package-lock.json b/package-lock.json
index ef0dff3d..1bcd8734 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -741,6 +741,7 @@
},
"node_modules/@clack/prompts/node_modules/is-unicode-supported": {
"version": "1.3.0",
+ "extraneous": true,
"inBundle": true,
"license": "MIT",
"engines": {
@@ -28338,7 +28339,8 @@
"dependencies": {
"is-unicode-supported": {
"version": "1.3.0",
- "bundled": true
+ "bundled": true,
+ "extraneous": true
}
}
},
diff --git a/pages/price-feeds/api-reference/_meta.json b/pages/price-feeds/api-reference/_meta.json
index c055add0..81cfa2a0 100644
--- a/pages/price-feeds/api-reference/_meta.json
+++ b/pages/price-feeds/api-reference/_meta.json
@@ -1,5 +1,9 @@
{
- "evm": "EVM",
+ "evm": {
+ "title": "EVM ↗",
+ "href": "https://api-reference.pyth.network/price-feeds/evm/getPriceNoOlderThan",
+ "newWindow": true
+ },
"aptos": "Aptos",
"cosmwasm": "CosmWasm",
"hermes": {
diff --git a/pages/price-feeds/api-reference/evm.mdx b/pages/price-feeds/api-reference/evm.mdx
deleted file mode 100644
index 97feeab9..00000000
--- a/pages/price-feeds/api-reference/evm.mdx
+++ /dev/null
@@ -1,15 +0,0 @@
-# Pyth Price Feeds EVM Contract Reference
-
-The Pyth Network EVM contract allows users to submit price updates for verification and can store them for later use.
-Please see the documentation section on [Pull Updates](../pythnet-price-feeds/pull-updates) if you haven't already;
-this section will explain the differences between Pyth Network and other oracles, and help you understand the expected usage patterns.
-
-Users of the Pyth contract will typically need to perform two operations:
-
-- Update the on-chain price -- In off-chain code, retrieve a price update from
- [Hermes](../pythnet-price-feeds/hermes) and submit it to the contract
- for verification. This operation makes the price available for on-chain use.
- You will typically call [updatePriceFeeds](evm/update-price-feeds) to do this.
-- Read the on-chain price -- After updating the price, your on-chain contract can call one of the
- many getter functions on the contract to get the price. See [getPriceNoOlderThan](evm/get-price-no-older-than) and its variants
- for more information.
diff --git a/pages/price-feeds/api-reference/evm/_meta.json b/pages/price-feeds/api-reference/evm/_meta.json
deleted file mode 100644
index 35aaba09..00000000
--- a/pages/price-feeds/api-reference/evm/_meta.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "--- EVM Contract": {
- "title": "EVM Contract",
- "type": "separator"
- },
- "sdks": "SDKs",
- "configuration": "Contract Configuration",
- "--- Methods": {
- "title": "Methods",
- "type": "separator"
- },
-
- "get-price": "getPrice (deprecated)",
- "get-price-unsafe": "getPriceUnsafe",
- "get-price-no-older-than": "getPriceNoOlderThan",
- "get-ema-price": "getEmaPrice",
- "get-ema-price-unsafe": "getEmaPriceUnsafe",
- "get-ema-price-no-older-than": "getEmaPriceNoOlderThan",
- "get-update-fee": "getUpdateFee",
- "get-valid-time-period": "getValidTimePeriod (deprecated)",
- "parse-price-feed-updates": "parsePriceFeedUpdates",
- "parse-price-feed-updates-unique": "parsePriceFeedUpdatesUnique",
- "update-price-feeds": "updatePriceFeeds",
- "update-price-feeds-if-necessary": "updatePriceFeedsIfNecessary"
-}
diff --git a/pages/price-feeds/api-reference/evm/configuration.mdx b/pages/price-feeds/api-reference/evm/configuration.mdx
deleted file mode 100644
index f5ec39ec..00000000
--- a/pages/price-feeds/api-reference/evm/configuration.mdx
+++ /dev/null
@@ -1,5 +0,0 @@
-import ContractInfo from "../../../../components/ContractInfo";
-
-# Contract Configuration
-
-
diff --git a/pages/price-feeds/api-reference/evm/get-ema-price-no-older-than.mdx b/pages/price-feeds/api-reference/evm/get-ema-price-no-older-than.mdx
deleted file mode 100644
index 1af8e86d..00000000
--- a/pages/price-feeds/api-reference/evm/get-ema-price-no-older-than.mdx
+++ /dev/null
@@ -1,109 +0,0 @@
-import Input from "../../../../components/Input";
-import Arg from "../../../../components/Arg";
-import Example from "../../../../components/Example";
-import DynamicCode from "../../../../components/DynamicCode";
-import { InputFormats } from "../../../../utils/InputFormat";
-import EvmCall from "../../../../components/EvmCall";
-import { Tab, Tabs } from "nextra-theme-docs";
-import Examples from "../../../../components/Examples";
-
-# Get EMA Price No Older Than
-
-Get the latest exponentially-weighted moving average (EMA) price and confidence interval for the requested price feed id.
-The price feed id is a 32-byte id written as a hexadecimal string; see the [price feed ids](https://pyth.network/developers/price-feed-ids) page to look up the id for a given symbol.
-The returned price and confidence are decimal numbers written in the form `a * 10^e`, where `e` is an exponent included in the result.
-For example, a price of 1234 with an exponent of -2 represents the number 12.34.
-The result also includes a `publishTime` which is the unix timestamp for the price update.
-The EMA methodology is described in more detail in this [blog post](https://pythnetwork.medium.com/whats-in-a-name-302a03e6c3e1).
-
-The caller provides an `age` argument that specifies how old the price can be.
-The call reverts with a `StalePriceError` if the on-chain price is from more than `age` seconds in the past (with respect to the current on-chain timestamp).
-Call [updatePriceFeeds](update-price-feeds) to pull a fresh price on-chain and solve this problem.
-
-This function reverts with a `PriceFeedNotFound` error if the requested feed id has never received a price update.
-This error could either mean that the provided price feed id is incorrect, or (more typically) that this is the first
-attempted use of that feed on-chain. In the second case, calling [updatePriceFeeds](update-price-feeds) will solve
-this problem.
-
-
-
-| Argument | Input | Description |
-| ----------------------------------------- | --------------------------------------------- | --------------------------------------------- |
-| id | | The ID of the price feed you want to read |
-| age | | Maximum age of the on-chain price in seconds. |
-
-
-
-
- ctx.getFeedId0x("Crypto.BTC/USD"),
- age: () => 60,
- }}
- value="BTC/USD"
- />
- ctx.getFeedId0x("Crypto.ETH/USD"),
- age: () => 60,
- }}
- value="ETH/USD"
- />
-
-
- [kvs["id"], kvs["age"]]}
-/>
-
-## Example Code
-
-
-
- ctx.pythAddressConfig.pythAddress,
- "0x1111111111111111111111111111111111111111111111111111111111111111": (ctx) => ctx.get("id", ""),
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- "0x2": (ctx) => ctx.get("age", ""),
- }}>
- ```solidity copy
- import "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
- import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";
-
- // NETWORK_NAME
- address contractAddress = 0x0000000000000000000000000000000000000000;
- IPyth pyth = IPyth(contractAddress);
-
- bytes32 priceId = 0x1111111111111111111111111111111111111111111111111111111111111111;
- uint256 age = 0x2;
- PythStructs.Price memory currentBasePrice = pyth.getEmaPriceNoOlderThan(priceId, age);
- ```
-
-
-
-
-
- `'${ctx.pythAddressConfig.pythAddress}'`,
- "'0x1111'": (ctx) => `'${ctx.get("id", "")}'`,
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- "'RPC_URL'": (ctx) => ctx.currentChainConfig.rpcUrls.default.http.length > 0 ? `'${ctx.currentChainConfig.rpcUrls.default.http[0]}'` : 'RPC_URL',
- "'0x2222'": (ctx) => `'${ctx.get("age", "")}'`,
- }}>
- ```typescript copy
- import { ethers } from "ethers";
- import PythAbi from "@pythnetwork/pyth-sdk-solidity/abis/IPyth.json" assert { type: "json" };
-
- // NETWORK_NAME
- const contractAddress = '0x0000';
- const provider = ethers.getDefaultProvider('RPC_URL');
- const contract = new ethers.Contract(contractAddress, PythAbi, provider);
-
- const priceId = '0x1111';
- const age = '0x2222'
- const [price, conf, expo, timestamp] = await contract.getEmaPriceNoOlderThan(priceId, age);
- ```
-
-
-
-
diff --git a/pages/price-feeds/api-reference/evm/get-ema-price-unsafe.mdx b/pages/price-feeds/api-reference/evm/get-ema-price-unsafe.mdx
deleted file mode 100644
index dc4391f4..00000000
--- a/pages/price-feeds/api-reference/evm/get-ema-price-unsafe.mdx
+++ /dev/null
@@ -1,102 +0,0 @@
-import Input from "../../../../components/Input";
-import Arg from "../../../../components/Arg";
-import Example from "../../../../components/Example";
-import DynamicCode from "../../../../components/DynamicCode";
-import { InputFormats } from "../../../../utils/InputFormat";
-import EvmCall from "../../../../components/EvmCall";
-import { Tab, Tabs } from "nextra-theme-docs";
-import Examples from "../../../../components/Examples";
-
-# Get EMA Price Unsafe
-
-Get the latest exponentially-weighted moving average (EMA) price and confidence interval for the requested price feed id.
-The price feed id is a 32-byte id written as a hexadecimal string; see the [price feed ids](https://pyth.network/developers/price-feed-ids) page to look up the id for a given symbol.
-The returned price and confidence are decimal numbers written in the form `a * 10^e`, where `e` is an exponent included in the result.
-For example, a price of 1234 with an exponent of -2 represents the number 12.34.
-The result also includes a `publishTime` which is the unix timestamp for the price update.
-The EMA methodology is described in more detail in this [blog post](https://pythnetwork.medium.com/whats-in-a-name-302a03e6c3e1).
-
-**This function may return a price from arbitrarily far in the past.**
-It is the caller's responsibility to check the returned `publishTime` to ensure that the update is recent enough for their use case.
-
-This function reverts with a `PriceFeedNotFound` error if the requested feed id has never received a price update.
-This error could either mean that the provided price feed id is incorrect, or (more typically) that this is the first
-attempted use of that feed on-chain. In the second case, calling [updatePriceFeeds](update-price-feeds) will solve
-this problem.
-
-
-
-| Argument | Input | Description |
-| ---------------------------------------- | --------------------------------------------- | ----------------------------------------- |
-| id | | The ID of the price feed you want to read |
-
-
-
-
- ctx.getFeedId0x("Crypto.BTC/USD"),
- }}
- value="BTC/USD"
- />
- ctx.getFeedId0x("Crypto.ETH/USD"),
- }}
- value="ETH/USD"
- />
-
-
- [kvs["id"]]}
-/>
-
-## Example Code
-
-
-
- ctx.pythAddressConfig.pythAddress,
- "0x1111111111111111111111111111111111111111111111111111111111111111": (ctx) => ctx.get("id", ""),
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- }}>
- ```solidity copy
- import "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
- import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";
-
- // NETWORK_NAME
- address contractAddress = 0x0000000000000000000000000000000000000000;
- IPyth pyth = IPyth(contractAddress);
-
- bytes32 priceId = 0x1111111111111111111111111111111111111111111111111111111111111111;
- PythStructs.Price memory currentBasePrice = pyth.getEmaPriceUnsafe(priceId);
- ```
-
-
-
-
-
- `'${ctx.pythAddressConfig.pythAddress}'`,
- "'0x1111'": (ctx) => `'${ctx.get("id", "")}'`,
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- "'RPC_URL'": (ctx) => ctx.currentChainConfig.rpcUrls.default.http.length > 0 ? `'${ctx.currentChainConfig.rpcUrls.default.http[0]}'` : 'RPC_URL',
- }}>
- ```typescript copy
- import { ethers } from "ethers";
- import PythAbi from "@pythnetwork/pyth-sdk-solidity/abis/IPyth.json" assert { type: "json" };
-
- // NETWORK_NAME
- const contractAddress = '0x0000';
- const provider = ethers.getDefaultProvider('RPC_URL');
- const contract = new ethers.Contract(contractAddress, PythAbi, provider);
-
- const priceId = '0x1111';
- const [price, conf, expo, timestamp] = await contract.getEmaPriceUnsafe(priceId);
- ```
-
-
-
-
-
diff --git a/pages/price-feeds/api-reference/evm/get-ema-price.mdx b/pages/price-feeds/api-reference/evm/get-ema-price.mdx
deleted file mode 100644
index 0db20d79..00000000
--- a/pages/price-feeds/api-reference/evm/get-ema-price.mdx
+++ /dev/null
@@ -1,102 +0,0 @@
-import Input from "../../../../components/Input";
-import Arg from "../../../../components/Arg";
-import { InputFormats } from "../../../../utils/InputFormat";
-import Example from "../../../../components/Example";
-import DynamicCode from "../../../../components/DynamicCode";
-import EvmCall from "../../../../components/EvmCall";
-import { Tab, Tabs } from "nextra-theme-docs";
-import Examples from "../../../../components/Examples";
-
-# Get EMA Price
-
-Get the latest exponentially-weighted moving average (EMA) price and confidence interval for the requested price feed id.
-The price feed id is a 32-byte id written as a hexadecimal string; see the [price feed ids](https://pyth.network/developers/price-feed-ids) page to look up the id for a given symbol.
-The returned price and confidence are decimal numbers written in the form `a * 10^e`, where `e` is an exponent included in the result.
-For example, a price of 1234 with an exponent of -2 represents the number 12.34.
-The result also includes a `publishTime` which is the unix timestamp for the price update.
-The EMA methodology is described in more detail in this [blog post](https://pythnetwork.medium.com/whats-in-a-name-302a03e6c3e1).
-
-This function reverts with a `StalePrice` error if the on-chain price has not been updated within the last [getValidTimePeriod()](get-valid-time-period) seconds.
-The default valid time period is set to a reasonable default on each chain and is typically around 1 minute.
-Call [updatePriceFeeds](update-price-feeds) to pull a fresh price on-chain and solve this problem.
-If you would like to configure the valid time period, see [getEmaPriceNoOlderThan](get-ema-price-no-older-than).
-If you want the latest price regardless of when it was updated, see [getEmaPriceUnsafe](get-ema-price-unsafe).
-
-This function reverts with a `PriceFeedNotFound` error if the requested feed id has never received a price update.
-This error could either mean that the provided price feed id is incorrect, or (more typically) that this is the first
-attempted use of that feed on-chain. In the second case, calling [updatePriceFeeds](update-price-feeds) will solve
-this problem.
-
-
-
-| Argument | Input | Description |
-| ---------------------------------------- | --------------------------------------------- | ----------------------------------------- |
-| id | | The ID of the price feed you want to read |
-
-
-
-
- ctx.getFeedId0x("Crypto.BTC/USD"),
- }}
- value="BTC/USD"
- />
- ctx.getFeedId0x("Crypto.ETH/USD"),
- }}
- value="ETH/USD"
- />
-
-
- [kvs["id"]]} />
-
-## Example Code
-
-
-
- ctx.pythAddressConfig.pythAddress,
- "0x1111111111111111111111111111111111111111111111111111111111111111": (ctx) => ctx.get("id", ""),
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- }}>
- ```solidity copy
- import "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
- import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";
-
- // NETWORK_NAME
- address contractAddress = 0x0000000000000000000000000000000000000000;
- IPyth pyth = IPyth(contractAddress);
-
- bytes32 priceId = 0x1111111111111111111111111111111111111111111111111111111111111111;
- PythStructs.Price memory currentBasePrice = pyth.getEmaPrice(priceId);
- ```
-
-
-
-
-
- `'${ctx.pythAddressConfig.pythAddress}'`,
- "'0x1111'": (ctx) => `'${ctx.get("id", "")}'`,
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- "'RPC_URL'": (ctx) => ctx.currentChainConfig.rpcUrls.default.http.length > 0 ? `'${ctx.currentChainConfig.rpcUrls.default.http[0]}'` : 'RPC_URL',
- }}>
- ```typescript copy
- import { ethers } from "ethers";
- import PythAbi from "@pythnetwork/pyth-sdk-solidity/abis/IPyth.json" assert { type: "json" };
-
- // NETWORK_NAME
- const contractAddress = '0x0000';
- const provider = ethers.getDefaultProvider('RPC_URL');
- const contract = new ethers.Contract(contractAddress, PythAbi, provider);
-
- const priceId = '0x1111';
- const [price, conf, expo, timestamp] = await contract.getEmaPrice(priceId);
- ```
-
-
-
-
-
diff --git a/pages/price-feeds/api-reference/evm/get-price-no-older-than.mdx b/pages/price-feeds/api-reference/evm/get-price-no-older-than.mdx
deleted file mode 100644
index f35c628a..00000000
--- a/pages/price-feeds/api-reference/evm/get-price-no-older-than.mdx
+++ /dev/null
@@ -1,108 +0,0 @@
-import Input from "../../../../components/Input";
-import Arg from "../../../../components/Arg";
-import Example from "../../../../components/Example";
-import DynamicCode from "../../../../components/DynamicCode";
-import { InputFormats } from "../../../../utils/InputFormat";
-import EvmCall from "../../../../components/EvmCall";
-import { Tab, Tabs } from "nextra-theme-docs";
-import Examples from "../../../../components/Examples";
-
-# Get Price No Older Than
-
-Get the latest price and confidence interval for the requested price feed id, if it has been updated sufficiently recently.
-The price feed id is a 32-byte id written as a hexadecimal string; see the [price feed ids](https://pyth.network/developers/price-feed-ids) page to look up the id for a given symbol.
-The returned price and confidence are decimal numbers written in the form `a * 10^e`, where `e` is an exponent included in the result.
-For example, a price of 1234 with an exponent of -2 represents the number 12.34.
-The result also includes a `publishTime` which is the unix timestamp for the price update.
-
-The caller provides an `age` argument that specifies how old the price can be.
-The call reverts with a `StalePriceError` if the on-chain price is from more than `age` seconds in the past (with respect to the current on-chain timestamp).
-Call [updatePriceFeeds](update-price-feeds) to pull a fresh price on-chain and solve this problem.
-
-This function reverts with a `PriceFeedNotFound` error if the requested feed id has never received a price update.
-This error could either mean that the provided price feed id is incorrect, or (more typically) that this is the first
-attempted use of that feed on-chain. In the second case, calling [updatePriceFeeds](update-price-feeds) will solve
-this problem.
-
-
-
-| Argument | Input | Description |
-| ----------------------------------------- | --------------------------------------------- | --------------------------------------------- |
-| id | | The ID of the price feed you want to read |
-| age | | Maximum age of the on-chain price in seconds. |
-
-
-
-
- ctx.getFeedId0x("Crypto.BTC/USD"),
- age: () => 60,
- }}
- value="BTC/USD"
- />
- ctx.getFeedId0x("Crypto.ETH/USD"),
- age: () => 60,
- }}
- value="ETH/USD"
- />
-
-
- [kvs["id"], kvs["age"]]}
-/>
-
-## Example Code
-
-
-
- ctx.pythAddressConfig.pythAddress,
- "0x1111111111111111111111111111111111111111111111111111111111111111": (ctx) => ctx.get("id", ""),
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- "0x2": (ctx) => ctx.get("age", ""),
- }}>
- ```solidity copy
- import "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
- import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";
-
- // NETWORK_NAME
- address contractAddress = 0x0000000000000000000000000000000000000000;
- IPyth pyth = IPyth(contractAddress);
-
- bytes32 priceId = 0x1111111111111111111111111111111111111111111111111111111111111111;
- uint256 age = 0x2;
- PythStructs.Price memory currentBasePrice = pyth.getPriceNoOlderThan(priceId, age);
- ```
-
-
-
-
-
- `'${ctx.pythAddressConfig.pythAddress}'`,
- "'0x1111'": (ctx) => `'${ctx.get("id", "")}'`,
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- "'RPC_URL'": (ctx) => ctx.currentChainConfig.rpcUrls.default.http.length > 0 ? `'${ctx.currentChainConfig.rpcUrls.default.http[0]}'` : 'RPC_URL',
- "'0x2222'": (ctx) => `'${ctx.get("age", "")}'`,
- }}>
- ```typescript copy
- import { ethers } from "ethers";
- import PythAbi from "@pythnetwork/pyth-sdk-solidity/abis/IPyth.json" assert { type: "json" };
-
- // NETWORK_NAME
- const contractAddress = '0x0000';
- const provider = ethers.getDefaultProvider('RPC_URL');
- const contract = new ethers.Contract(contractAddress, PythAbi, provider);
-
- const priceId = '0x1111';
- const age = '0x2222'
- const [price, conf, expo, timestamp] = await contract.getPriceNoOlderThan(priceId, age);
- ```
-
-
-
-
diff --git a/pages/price-feeds/api-reference/evm/get-price-unsafe.mdx b/pages/price-feeds/api-reference/evm/get-price-unsafe.mdx
deleted file mode 100644
index a009aca5..00000000
--- a/pages/price-feeds/api-reference/evm/get-price-unsafe.mdx
+++ /dev/null
@@ -1,98 +0,0 @@
-import Input from "../../../../components/Input";
-import Arg from "../../../../components/Arg";
-import Example from "../../../../components/Example";
-import Examples from "../../../../components/Examples";
-import DynamicCode from "../../../../components/DynamicCode";
-import { InputFormats } from "../../../../utils/InputFormat";
-import EvmCall from "../../../../components/EvmCall";
-import { Tab, Tabs } from "nextra-theme-docs";
-
-# Get Price Unsafe
-
-Get the latest price and confidence interval for the requested price feed id.
-The price feed id is a 32-byte id written as a hexadecimal string; see the [price feed ids](https://pyth.network/developers/price-feed-ids) page to look up the id for a given symbol.
-The returned price and confidence are decimal numbers written in the form `a * 10^e`, where `e` is an exponent included in the result.
-For example, a price of 1234 with an exponent of -2 represents the number 12.34.
-The result also includes a `publishTime` which is the unix timestamp for the price update.
-
-**This function may return a price from arbitrarily far in the past.**
-It is the caller's responsibility to check the returned `publishTime` to ensure that the update is recent enough for their use case.
-
-This function reverts with a `PriceFeedNotFound` error if the requested feed id has never received a price update.
-This error could either mean that the provided price feed id is incorrect, or (more typically) that this is the first
-attempted use of that feed on-chain. In the second case, calling [updatePriceFeeds](update-price-feeds) will solve
-this problem.
-
-
-
-| Argument | Input | Description |
-| ---------------------------------------- | --------------------------------------------- | ----------------------------------------- |
-| id | | The ID of the price feed you want to read |
-
-
-
-
- ctx.getFeedId0x("Crypto.BTC/USD"),
- }}
- value="BTC/USD"
- />
- ctx.getFeedId0x("Crypto.ETH/USD"),
- }}
- value="ETH/USD"
- />
-
-
- [kvs["id"]]} />
-
-## Example Code
-
-
-
- ctx.pythAddressConfig.pythAddress,
- "0x1111111111111111111111111111111111111111111111111111111111111111": (ctx) => ctx.get("id", ""),
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- }}>
- ```solidity copy
- import "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
- import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";
-
- // NETWORK_NAME
- address contractAddress = 0x0000000000000000000000000000000000000000;
- IPyth pyth = IPyth(contractAddress);
-
- bytes32 priceId = 0x1111111111111111111111111111111111111111111111111111111111111111;
- PythStructs.Price memory currentBasePrice = pyth.getPriceUnsafe(priceId);
- ```
-
-
-
-
-
- `'${ctx.pythAddressConfig.pythAddress}'`,
- "'0x1111'": (ctx) => `'${ctx.get("id", "")}'`,
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- "'RPC_URL'": (ctx) => ctx.currentChainConfig.rpcUrls.default.http.length > 0 ? `'${ctx.currentChainConfig.rpcUrls.default.http[0]}'` : 'RPC_URL',
- }}>
- ```typescript copy
- import { ethers } from "ethers";
- import PythAbi from "@pythnetwork/pyth-sdk-solidity/abis/IPyth.json" assert { type: "json" };
-
- // NETWORK_NAME
- const contractAddress = '0x0000';
- const provider = ethers.getDefaultProvider('RPC_URL');
- const contract = new ethers.Contract(contractAddress, PythAbi, provider);
-
- const priceId = '0x1111';
- const [price, conf, expo, timestamp] = await contract.getPriceUnsafe(priceId);
- ```
-
-
-
-
-
diff --git a/pages/price-feeds/api-reference/evm/get-price.mdx b/pages/price-feeds/api-reference/evm/get-price.mdx
deleted file mode 100644
index 4b1a9dc0..00000000
--- a/pages/price-feeds/api-reference/evm/get-price.mdx
+++ /dev/null
@@ -1,102 +0,0 @@
-import Input from "../../../../components/Input";
-import Arg from "../../../../components/Arg";
-import { InputFormats } from "../../../../utils/InputFormat";
-import Example from "../../../../components/Example";
-import Examples from "../../../../components/Examples";
-import DynamicCode from "../../../../components/DynamicCode";
-import EvmCall from "../../../../components/EvmCall";
-import { Tab, Tabs } from "nextra-theme-docs";
-
-# Get Price (Deprecated)
-
-**This function is deprecated, please consider using `getPriceNoOlderThan` or `getPriceUnsafe` instead.**
-
-Get the latest price and confidence interval for the requested price feed id.
-The price feed id is a 32-byte id written as a hexadecimal string; see the [price feed ids](https://pyth.network/developers/price-feed-ids) page to look up the id for a given symbol.
-The returned price and confidence are decimal numbers written in the form `a * 10^e`, where `e` is an exponent included in the result.
-For example, a price of 1234 with an exponent of -2 represents the number 12.34.
-The result also includes a `publishTime` which is the unix timestamp for the price update.
-
-This function reverts with a `StalePrice` error if the on-chain price has not been updated within the last [getValidTimePeriod()](get-valid-time-period) seconds.
-The default valid time period is set to a reasonable default on each chain and is typically around 1 minute.
-Call [updatePriceFeeds](update-price-feeds) to pull a fresh price on-chain and solve this problem.
-If you would like to configure the valid time period, see [getPriceNoOlderThan](get-price-no-older-than).
-If you want the latest price regardless of when it was updated, see [getPriceUnsafe](get-price-unsafe).
-
-This function reverts with a `PriceFeedNotFound` error if the requested feed id has never received a price update.
-This error could either mean that the provided price feed id is incorrect, or (more typically) that this is the first
-attempted use of that feed on-chain. In the second case, calling [updatePriceFeeds](update-price-feeds) will solve
-this problem.
-
-
-
-| Argument | Input | Description |
-| ---------------------------------------- | --------------------------------------------- | ----------------------------------------- |
-| id | | The ID of the price feed you want to read |
-
-
-
-
- ctx.getFeedId0x("Crypto.BTC/USD"),
- }}
- value="BTC/USD"
- />
- ctx.getFeedId0x("Crypto.ETH/USD"),
- }}
- value="ETH/USD"
- />
-
-
- [kvs["id"]]} />
-
-## Example Code
-
-
-
- ctx.pythAddressConfig.pythAddress,
- "0x1111111111111111111111111111111111111111111111111111111111111111": (ctx) => ctx.get("id", ""),
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- }}>
- ```solidity copy
- import "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
- import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";
-
- // NETWORK_NAME
- address contractAddress = 0x0000000000000000000000000000000000000000;
- IPyth pyth = IPyth(contractAddress);
-
- bytes32 priceId = 0x1111111111111111111111111111111111111111111111111111111111111111;
- PythStructs.Price memory currentBasePrice = pyth.getPrice(priceId);
- ```
-
-
-
-
-
- `'${ctx.pythAddressConfig.pythAddress}'`,
- "'0x1111'": (ctx) => `'${ctx.get("id", "")}'`,
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- "'RPC_URL'": (ctx) => ctx.currentChainConfig.rpcUrls.default.http.length > 0 ? `'${ctx.currentChainConfig.rpcUrls.default.http[0]}'` : 'RPC_URL',
- }}>
- ```typescript copy
- import { ethers } from "ethers";
- import PythAbi from "@pythnetwork/pyth-sdk-solidity/abis/IPyth.json" assert { type: "json" };
-
- // NETWORK_NAME
- const contractAddress = '0x0000';
- const provider = ethers.getDefaultProvider('RPC_URL');
- const contract = new ethers.Contract(contractAddress, PythAbi, provider);
-
- const priceId = '0x1111';
- const [price, conf, expo, timestamp] = await contract.getPrice(priceId);
- ```
-
-
-
-
diff --git a/pages/price-feeds/api-reference/evm/get-update-fee.mdx b/pages/price-feeds/api-reference/evm/get-update-fee.mdx
deleted file mode 100644
index 06312076..00000000
--- a/pages/price-feeds/api-reference/evm/get-update-fee.mdx
+++ /dev/null
@@ -1,86 +0,0 @@
-import Input from "../../../../components/Input";
-import Arg from "../../../../components/Arg";
-import { InputFormats } from "../../../../utils/InputFormat";
-import Example from "../../../../components/Example";
-import Examples from "../../../../components/Examples";
-import DynamicCode from "../../../../components/DynamicCode";
-import EvmCall from "../../../../components/EvmCall";
-import { Tab, Tabs } from "nextra-theme-docs";
-
-# Get Update Fee
-
-Get the fee required to update the on-chain price feeds with the provided `updateData`.
-The returned number of wei should be sent as the transaction value when calling [updatePriceFeeds](update-price-feeds).
-The `updateData` can be retrieved from the [Hermes API](https://hermes.pyth.network/docs).
-
-
-
-| Argument | Input | Description |
-| -------------------------------------------------- | ---------------------------------------------------- | ----------------------------------------------------------------------------------------- |
-| updateData | | The price updates that you would like to submit to [updatePriceFeeds](update-price-feeds) |
-
-
-
-
-
- (await ctx.getLatestPriceFeed("Crypto.BTC/USD", "evm")).vaa,
- }}
- value="Latest BTC/USD update data"
- />
-
-
- [[kvs["updateData"]]]}
-/>
-
-## Example Code
-
-
-
- ctx.pythAddressConfig.pythAddress,
- "0x1111111111111111111111111111111111111111111111111111111111111111": (ctx) => ctx.get("id", ""),
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- "\"11\"": (ctx) => `"${ctx.get("updateData", "").replace("0x", "")}"`,
- }}>
- ```solidity copy
- import "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
- import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";
-
- // NETWORK_NAME
- address contractAddress = 0x0000000000000000000000000000000000000000;
- IPyth pyth = IPyth(contractAddress);
-
- bytes[] memory updateData = new bytes[](1);
- updateData[0] = hex"11";
- uint feeAmount = pyth.getUpdateFee(updateData);
- ```
-
-
-
-
- `'${ctx.pythAddressConfig.pythAddress}'`,
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- "'RPC_URL'": (ctx) => ctx.currentChainConfig.rpcUrls.default.http.length > 0 ? `'${ctx.currentChainConfig.rpcUrls.default.http[0]}'` : 'RPC_URL',
- "'0x1111'": (ctx) => `'${ctx.get("updateData", "")}'`,
- }}>
- ```typescript copy
- import { ethers } from "ethers";
- import PythAbi from "@pythnetwork/pyth-sdk-solidity/abis/IPyth.json" assert { type: "json" };
-
- // NETWORK_NAME
- const contractAddress = '0x0000';
- const provider = ethers.getDefaultProvider('RPC_URL');
- const contract = new ethers.Contract(contractAddress, PythAbi, provider);
-
- const updateData = ['0x1111'];
- const [feeAmount] = await contract.getUpdateFee(updateData);
- ```
-
-
-
-
diff --git a/pages/price-feeds/api-reference/evm/get-valid-time-period.mdx b/pages/price-feeds/api-reference/evm/get-valid-time-period.mdx
deleted file mode 100644
index 2dc06f20..00000000
--- a/pages/price-feeds/api-reference/evm/get-valid-time-period.mdx
+++ /dev/null
@@ -1,57 +0,0 @@
-import DynamicCode from "../../../../components/DynamicCode";
-import EvmCall from "../../../../components/EvmCall";
-import { Tab, Tabs } from "nextra-theme-docs";
-
-# Get Valid Time Period (deprecated)
-
-**This function is deprecated. Please consider using `getPriceNoOlderThan` with your own acceptable staleness time period.**
-
-Get the default valid time period in seconds.
-This quantity is the maximum age of price updates returned by functions like [getPrice](get-price) and [getEmaPrice](get-ema-price);
-these functions revert if the current on-chain price is older than this period.
-The valid time period is configured to be a sane default for each blockchain.
-
- []} />
-
-## Example Code
-
-
-
- ctx.pythAddressConfig.pythAddress,
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- }}>
- ```solidity copy
- import "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
- import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";
-
- // NETWORK_NAME
- address contractAddress = 0x0000000000000000000000000000000000000000;
- IPyth pyth = IPyth(contractAddress);
-
- uint validTimePeriod = pyth.getValidTimePeriod();
- ```
-
-
-
-
- `'${ctx.pythAddressConfig.pythAddress}'`,
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- "'RPC_URL'": (ctx) => ctx.currentChainConfig.rpcUrls.default.http.length > 0 ? `'${ctx.currentChainConfig.rpcUrls.default.http[0]}'` : 'RPC_URL',
- }}>
- ```typescript copy
- import { ethers } from "ethers";
- import PythAbi from "@pythnetwork/pyth-sdk-solidity/abis/IPyth.json" assert { type: "json" };
-
- // NETWORK_NAME
- const contractAddress = '0x0000';
- const provider = ethers.getDefaultProvider('RPC_URL');
- const contract = new ethers.Contract(contractAddress, PythAbi, provider);
-
- const [validTimePeriod] = await contract.getValidTimePeriod();
- ```
-
-
-
-
diff --git a/pages/price-feeds/api-reference/evm/parse-price-feed-updates-unique.mdx b/pages/price-feeds/api-reference/evm/parse-price-feed-updates-unique.mdx
deleted file mode 100644
index 24b5e948..00000000
--- a/pages/price-feeds/api-reference/evm/parse-price-feed-updates-unique.mdx
+++ /dev/null
@@ -1,136 +0,0 @@
-import Input from "../../../../components/Input";
-import Arg from "../../../../components/Arg";
-import { InputFormats } from "../../../../utils/InputFormat";
-import Example from "../../../../components/Example";
-import Examples from "../../../../components/Examples";
-import DynamicCode from "../../../../components/DynamicCode";
-import EvmSend from "../../../../components/EvmSend";
-import { Tab, Tabs } from "nextra-theme-docs";
-
-# Parse Price Feed Updates Unique
-
-Parse `updateData` and return the price feeds for the given `priceIds` within, if they are all **the first updates** published between `minPublishTime` and `maxPublishTime`.
-That is to say, if `prevPublishTime < minPublishTime <= publishTime <= maxPublishTime` where `prevPublishTime` is the publish time of the previous update for the given price feed.
-These updates are unique per `priceId` and `minPublishTime`.
-This will guarantee no updates exist for the given `priceIds` earlier than the returned updates and still in the given time range.
-If you do not need the uniqueness guarantee, consider using [parsePriceFeedUpdates](parse-price-feed-updates) instead.
-Use this function if you want to use a Pyth price for a fixed time and not the most recent price;
-otherwise, consider using [updatePriceFeeds](update-price-feeds) followed by [getPrice](get-price) or one of its variants.
-Unlike `updatePriceFeeds`, calling this function will not update the on-chain price.
-
-This method requires the caller to pay a fee in wei; the required fee can be computed by calling [getUpdateFee](get-update-fee) with `updateData`.
-
-Reverts if the transferred fee is not sufficient, or `updateData` is invalid, or `updateData` does not
-contain an update for any of the given `priceIds` within the given time range.
-
-
-
-| Argument | Input | Description |
-| ------------------------------------------------------- | ---------------------------------------------------------- | ------------------------------------------------------------------------ |
-| updateData | | The price update data to parse. |
-| priceIds | | The price ids whose feeds will be returned. |
-| minPublishTime | | The minimum timestamp for each returned feed. |
-| maxPublishTime | | The maximum timestamp for each returned feed. |
-| fee | | The update fee in wei. This fee is sent as the value of the transaction. |
-
-
-
-
-
- (await ctx.getLatestPriceFeed("Crypto.BTC/USD", "evm")).vaa,
- priceId: (ctx) => ctx.getFeedId0x("Crypto.BTC/USD"),
- minPublishTime: async (ctx) =>
- (await ctx.getLatestPriceFeed("Crypto.BTC/USD", "evm")).price
- .publish_time - 5,
- maxPublishTime: async (ctx) =>
- (await ctx.getLatestPriceFeed("Crypto.BTC/USD", "evm")).price
- .publish_time + 5,
- fee: async (ctx) => {
- let vaa = (await ctx.getLatestPriceFeed("Crypto.BTC/USD", "evm")).vaa;
- return await ctx.getEthUpdateFee([vaa]);
- },
- }}
- value="Latest BTC/USD update data"
- />
-
-
- [
- [kvs["updateData"]],
- [kvs["priceId"]],
- kvs["minPublishTime"],
- kvs["maxPublishTime"],
- ]}
- feeKey="fee"
-/>
-
-## Example Code
-
-
-
- ctx.pythAddressConfig.pythAddress,
- "0x1111111111111111111111111111111111111111111111111111111111111111": (ctx) => ctx.get("priceId", ""),
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- "\"11\"": (ctx) => `"${ctx.get("updateData", "").replace("0x", "")}"`,
- "2": (ctx) => ctx.get("fee", ""),
- "3": (ctx) => ctx.get("minPublishTime", ""),
- "4": (ctx) => ctx.get("maxPublishTime", ""),
- }}>
- ```solidity copy
- import "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
- import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";
-
- // NETWORK_NAME
- address contractAddress = 0x0000000000000000000000000000000000000000;
- IPyth pyth = IPyth(contractAddress);
-
- bytes[] memory updateData = new bytes[](1);
- updateData[0] = hex"11";
- bytes32[] memory priceIds = new bytes32[](1);
- priceIds[0] = 0x1111111111111111111111111111111111111111111111111111111111111111;
- uint64 minPublishTime = 3;
- uint64 maxPublishTime = 4;
-
- uint fee = 2;
- pyth.parsePriceFeedUpdatesUnique{value: fee}(updateData, priceIds, minPublishTime, maxPublishTime);
- ```
-
-
-
-
- `'${ctx.pythAddressConfig.pythAddress}'`,
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- "'RPC_URL'": (ctx) => ctx.currentChainConfig.rpcUrls.default.http.length > 0 ? `'${ctx.currentChainConfig.rpcUrls.default.http[0]}'` : 'RPC_URL',
- "'0x1111'": (ctx) => `'${ctx.get("updateData", "")}'`,
- "'0x2222'": (ctx) => `'${ctx.get("priceId", "")}'`,
- "3": (ctx) => ctx.get("minPublishTime", ""),
- "4": (ctx) => ctx.get("maxPublishTime", ""),
- "2": (ctx) => ctx.get("fee", ""),
- }}>
- ```typescript copy
- import { ethers } from "ethers";
- import PythAbi from "@pythnetwork/pyth-sdk-solidity/abis/IPyth.json" assert { type: "json" };
-
- // NETWORK_NAME
- const contractAddress = '0x0000';
- const provider = ethers.getDefaultProvider('RPC_URL');
- const contract = new ethers.Contract(contractAddress, PythAbi, provider);
-
- const fee = ethers.toBigInt(2)
-
- const updateData = ['0x1111'];
- const priceIds = ['0x2222'];
- const minPublishTime = ethers.toBigInt(3);
- const maxPublishTime = ethers.toBigInt(4);
- const tx = await contract.parsePriceFeedUpdatesUnique(updateData, priceIds, minPublishTime, maxPublishTime, {value: fee});
- const receipt = await tx.wait();
- ```
-
-
-
-
diff --git a/pages/price-feeds/api-reference/evm/parse-price-feed-updates.mdx b/pages/price-feeds/api-reference/evm/parse-price-feed-updates.mdx
deleted file mode 100644
index 2fc87195..00000000
--- a/pages/price-feeds/api-reference/evm/parse-price-feed-updates.mdx
+++ /dev/null
@@ -1,134 +0,0 @@
-import Input from "../../../../components/Input";
-import Arg from "../../../../components/Arg";
-import { InputFormats } from "../../../../utils/InputFormat";
-import Example from "../../../../components/Example";
-import Examples from "../../../../components/Examples";
-import DynamicCode from "../../../../components/DynamicCode";
-import EvmSend from "../../../../components/EvmSend";
-import { Tab, Tabs } from "nextra-theme-docs";
-
-# Parse Price Feed Updates
-
-Parse `updateData` and return the price feeds for the given `priceIds` within, if they are all published between `minPublishTime` and `maxPublishTime` (`minPublishTime <= publishTime <= maxPublishTime`).
-Use this function if you want to use a Pyth price for a fixed time and not the most recent price;
-otherwise, consider using [updatePriceFeeds](update-price-feeds) followed by [getPriceNoOlderThan](get-price-no-older-than) or one of its variants.
-Unlike `updatePriceFeeds`, calling this function will not update the on-chain price.
-
-If you need to make sure the price update is the earliest update after the `minPublishTime` consider using [parsePriceFeedUpdatesUnique](parse-price-feed-updates-unique).
-
-This method requires the caller to pay a fee in wei; the required fee can be computed by calling [getUpdateFee](get-update-fee) with `updateData`.
-
-Reverts if the transferred fee is not sufficient, or `updateData` is invalid, or `updateData` does not
-contain an update for any of the given `priceIds` within the given time range.
-
-
-
-| Argument | Input | Description |
-| ------------------------------------------------------- | ---------------------------------------------------------- | ------------------------------------------------------------------------ |
-| updateData | | The price update data to parse. |
-| priceIds | | The price ids whose feeds will be returned. |
-| minPublishTime | | The minimum timestamp for each returned feed. |
-| maxPublishTime | | The maximum timestamp for each returned feed. |
-| fee | | The update fee in wei. This fee is sent as the value of the transaction. |
-
-
-
-
-
- (await ctx.getLatestPriceFeed("Crypto.BTC/USD", "evm")).vaa,
- priceId: (ctx) => ctx.getFeedId0x("Crypto.BTC/USD"),
- minPublishTime: async (ctx) =>
- (await ctx.getLatestPriceFeed("Crypto.BTC/USD", "evm")).price
- .publish_time - 5,
- maxPublishTime: async (ctx) =>
- (await ctx.getLatestPriceFeed("Crypto.BTC/USD", "evm")).price
- .publish_time + 5,
- fee: async (ctx) => {
- let vaa = (await ctx.getLatestPriceFeed("Crypto.BTC/USD", "evm")).vaa;
- return await ctx.getEthUpdateFee([vaa]);
- },
- }}
- value="Latest BTC/USD update data"
- />
-
-
- [
- [kvs["updateData"]],
- [kvs["priceId"]],
- kvs["minPublishTime"],
- kvs["maxPublishTime"],
- ]}
- feeKey="fee"
-/>
-
-## Example Code
-
-
-
- ctx.pythAddressConfig.pythAddress,
- "0x1111111111111111111111111111111111111111111111111111111111111111": (ctx) => ctx.get("priceId", ""),
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- "\"11\"": (ctx) => `"${ctx.get("updateData", "").replace("0x", "")}"`,
- "2": (ctx) => ctx.get("fee", ""),
- "3": (ctx) => ctx.get("minPublishTime", ""),
- "4": (ctx) => ctx.get("maxPublishTime", ""),
- }}>
- ```solidity copy
- import "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
- import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";
-
- // NETWORK_NAME
- address contractAddress = 0x0000000000000000000000000000000000000000;
- IPyth pyth = IPyth(contractAddress);
-
- bytes[] memory updateData = new bytes[](1);
- updateData[0] = hex"11";
- bytes32[] memory priceIds = new bytes32[](1);
- priceIds[0] = 0x1111111111111111111111111111111111111111111111111111111111111111;
- uint64 minPublishTime = 3;
- uint64 maxPublishTime = 4;
-
- uint fee = 2;
- pyth.parsePriceFeedUpdates{value: fee}(updateData, priceIds, minPublishTime, maxPublishTime);
- ```
-
-
-
-
- `'${ctx.pythAddressConfig.pythAddress}'`,
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- "'RPC_URL'": (ctx) => ctx.currentChainConfig.rpcUrls.default.http.length > 0 ? `'${ctx.currentChainConfig.rpcUrls.default.http[0]}'` : 'RPC_URL',
- "'0x1111'": (ctx) => `'${ctx.get("updateData", "")}'`,
- "'0x2222'": (ctx) => `'${ctx.get("priceId", "")}'`,
- "3": (ctx) => ctx.get("minPublishTime", ""),
- "4": (ctx) => ctx.get("maxPublishTime", ""),
- "2": (ctx) => ctx.get("fee", ""),
- }}>
- ```typescript copy
- import { ethers } from "ethers";
- import PythAbi from "@pythnetwork/pyth-sdk-solidity/abis/IPyth.json" assert { type: "json" };
-
- // NETWORK_NAME
- const contractAddress = '0x0000';
- const provider = ethers.getDefaultProvider('RPC_URL');
- const contract = new ethers.Contract(contractAddress, PythAbi, provider);
-
- const fee = ethers.toBigInt(2)
-
- const updateData = ['0x1111'];
- const priceIds = ['0x2222'];
- const minPublishTime = ethers.toBigInt(3);
- const maxPublishTime = ethers.toBigInt(4);
- const tx = await contract.parsePriceFeedUpdates(updateData, priceIds, minPublishTime, maxPublishTime, {value: fee});
- const receipt = await tx.wait();
- ```
-
-
-
-
diff --git a/pages/price-feeds/api-reference/evm/sdks.mdx b/pages/price-feeds/api-reference/evm/sdks.mdx
deleted file mode 100644
index aa538353..00000000
--- a/pages/price-feeds/api-reference/evm/sdks.mdx
+++ /dev/null
@@ -1,62 +0,0 @@
-import { Tab, Tabs } from "nextra-theme-docs";
-
-# SDKs
-
-The [@pythnetwork/pyth-sdk-solidity](https://www.npmjs.com/package/@pythnetwork/pyth-sdk-solidity)
-([github](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/ethereum/sdk/solidity))
-package provides solidity interfaces for the EVM contract as well as contract ABIs for off-chain applications.
-
-## Installation Instructions
-
-
-
- If you are using Foundry, you will need to create an NPM project if you don't already have one.
- From the root directory of your project, run:
-
- ```bash copy
- npm init -y
- npm install @pythnetwork/pyth-sdk-solidity
- ```
-
- Then add the following line to your `remappings.txt` file:
-
- ```text copy
- @pythnetwork/pyth-sdk-solidity/=node_modules/@pythnetwork/pyth-sdk-solidity
- ```
-
- You can now import interfaces from the SDK in Solidity code as follows:
-
- ```solidity copy
- import "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
- ```
-
-
- First, install the NPM package:
-
- ```bash
- npm install @pythnetwork/pyth-sdk-solidity
- ```
-
- You can now import interfaces from the SDK in Solidity code as follows:
-
- ```solidity copy
- import "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
- ```
-
-
- First, install the SDK in your project by running:
- ```
- npm install @pythnetwork/pyth-sdk-solidity
- ```
-
- Then you can import the contract ABI in your typescript code as follows:
-
- ```typescript copy
- import PythAbi from "@pythnetwork/pyth-sdk-solidity/abis/IPyth.json" assert { type: "json" };
- ```
-
- The same directory also contains ABI files for errors (`PythErrors.json`) and events (`IPythEvents.json`),
- which you may also find useful for decoding contract responses.
-
-
-
diff --git a/pages/price-feeds/api-reference/evm/update-price-feeds-if-necessary.mdx b/pages/price-feeds/api-reference/evm/update-price-feeds-if-necessary.mdx
deleted file mode 100644
index ea38b836..00000000
--- a/pages/price-feeds/api-reference/evm/update-price-feeds-if-necessary.mdx
+++ /dev/null
@@ -1,127 +0,0 @@
-import Input from "../../../../components/Input";
-import Arg from "../../../../components/Arg";
-import { InputFormats } from "../../../../utils/InputFormat";
-import Example from "../../../../components/Example";
-import Examples from "../../../../components/Examples";
-import DynamicCode from "../../../../components/DynamicCode";
-import EvmSend from "../../../../components/EvmSend";
-import { Tab, Tabs } from "nextra-theme-docs";
-
-# Update Price Feeds If Necessary
-
-Update the on-chain price feeds using the provided `updateData` if the on-chain data is not sufficiently fresh.
-The caller provides two matched arrays, `priceIds` and `publishTimes`.
-This function applies the update if there exists an index `i` such that `priceIds[i]`'s last `publishTime` is before than `publishTimes[i]`.
-Callers should typically pass `publishTimes[i]` to be equal to the publishTime of the corresponding price id in `updateData`.
-If this condition is not satisfied, the call will revert with a `NoFreshUpdate` error.
-
-This method is a variant of [updatePriceFeeds](update-price-feeds) that reduces gas usage when multiple callers are sending the same price updates.
-
-This function requires the caller to pay a fee to perform the update.
-The required fee for a given set of updates can be computed by passing them to [getUpdateFee](get-update-fee).
-
-Reverts if the required fee is not paid, or the `updateData` is incorrectly signed or formatted.
-
-
-
-| Argument | Input | Description |
-| ------------------------------------------------------- | ------------------------------------------------------- | ---------------------------------------------------------------------------- |
-| updateData | | The price update data for the contract to verify. |
-| priceIds | | The price ids to update |
-| publishTimes | | The timestamp for each price id that determines whether to apply the update. |
-| fee | | The update fee in wei. This fee is sent as the value of the transaction. |
-
-
-
-
-
- (await ctx.getLatestPriceFeed("Crypto.BTC/USD", "evm")).vaa,
- priceId: (ctx) => ctx.getFeedId0x("Crypto.BTC/USD"),
- publishTime: async (ctx) =>
- (await ctx.getLatestPriceFeed("Crypto.BTC/USD", "evm")).price
- .publish_time,
- fee: async (ctx) => {
- let vaa = (await ctx.getLatestPriceFeed("Crypto.BTC/USD", "evm")).vaa;
- return await ctx.getEthUpdateFee([vaa]);
- },
- }}
- value="Latest BTC/USD update data"
- />
-
-
- [
- [kvs["updateData"]],
- [kvs["priceId"]],
- [kvs["publishTime"]],
- ]}
- feeKey="fee"
-/>
-
-## Example Code
-
-
-
- ctx.pythAddressConfig.pythAddress,
- "0x1111111111111111111111111111111111111111111111111111111111111111": (ctx) => ctx.get("priceId", ""),
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- "\"11\"": (ctx) => `"${ctx.get("updateData", "").replace("0x", "")}"`,
- "2": (ctx) => ctx.get("fee", ""),
- "3": (ctx) => ctx.get("publishTime", ""),
- }}>
- ```solidity copy
- import "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
- import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";
-
- // NETWORK_NAME
- address contractAddress = 0x0000000000000000000000000000000000000000;
- IPyth pyth = IPyth(contractAddress);
-
- bytes[] memory updateData = new bytes[](1);
- updateData[0] = hex"11";
-
- bytes32[] memory priceIds = new bytes32[](1);
- priceIds[0] = 0x1111111111111111111111111111111111111111111111111111111111111111;
- uint64[] memory publishTimes = new uint64[](1);
- publishTimes[0] = 3;
- uint fee = 2;
- pyth.updatePriceFeedsIfNecessary{value: fee}(updateData, priceIds, publishTimes);
- ```
-
-
-
-
- `'${ctx.pythAddressConfig.pythAddress}'`,
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- "'RPC_URL'": (ctx) => ctx.currentChainConfig.rpcUrls.default.http.length > 0 ? `'${ctx.currentChainConfig.rpcUrls.default.http[0]}'` : 'RPC_URL',
- "'0x1111'": (ctx) => `'${ctx.get("updateData", "")}'`,
- "'0x2222'": (ctx) => `'${ctx.get("priceId", "")}'`,
- "3": (ctx) => ctx.get("publishTime", ""),
- "2": (ctx) => ctx.get("fee", ""),
- }}>
- ```typescript copy
- import { ethers } from "ethers";
- import PythAbi from "@pythnetwork/pyth-sdk-solidity/abis/IPyth.json" assert { type: "json" };
-
- // NETWORK_NAME
- const contractAddress = '0x0000';
- const provider = ethers.getDefaultProvider('RPC_URL');
- const contract = new ethers.Contract(contractAddress, PythAbi, provider);
-
- const fee = ethers.toBigInt(2)
-
- const updateData = ['0x1111'];
- const priceIds = ['0x2222'];
- const publishTimes = [ethers.toBigInt(3)];
- const tx = await contract.updatePriceFeedsIfNecessary(updateData, priceIds, publishTimes, {value: fee});
- const receipt = await tx.wait();
- ```
-
-
-
-
diff --git a/pages/price-feeds/api-reference/evm/update-price-feeds.mdx b/pages/price-feeds/api-reference/evm/update-price-feeds.mdx
deleted file mode 100644
index f9598374..00000000
--- a/pages/price-feeds/api-reference/evm/update-price-feeds.mdx
+++ /dev/null
@@ -1,107 +0,0 @@
-import Input from "../../../../components/Input";
-import Arg from "../../../../components/Arg";
-import { InputFormats } from "../../../../utils/InputFormat";
-import Example from "../../../../components/Example";
-import Examples from "../../../../components/Examples";
-import DynamicCode from "../../../../components/DynamicCode";
-import EvmSend from "../../../../components/EvmSend";
-import { Tab, Tabs } from "nextra-theme-docs";
-
-# Update Price Feeds
-
-Update the on-chain price feeds using the provided `updateData`, which contains serialized and signed price update data from Pyth Network.
-You can retrieve the latest price `updateData` for a given set of price feeds from the [Hermes API](https://hermes.pyth.network/docs).
-This function updates the on-chain price if the provided update is more recent than the current on-chain price.
-Otherwise, the provided update will be ignored.
-The function call will succeed even if the update is ignored.
-
-This function requires the caller to pay a fee to perform the update.
-The required fee for a given set of updates can be computed by passing them to [getUpdateFee](get-update-fee).
-
-Reverts if the required fee is not paid, or the `updateData` is incorrectly signed or formatted.
-
-
-
-| Argument | Input | Description |
-| -------------------------------------------------- | ----------------------------------------------------- | ------------------------------------------------------------------------ |
-| updateData | | The price update data for the contract to verify. |
-| fee | | The update fee in wei. This fee is sent as the value of the transaction. |
-
-
-
-
-
- (await ctx.getLatestPriceFeed("Crypto.BTC/USD", "evm")).vaa,
- fee: async (ctx) => {
- // NOTE: this technically could get the update fee for a different VAA than the one above.
- // This shouldn't affect the update fee as long as the fee is only dependent on the price feed ids
- // and not the specific content of the price update.
- let vaa = (await ctx.getLatestPriceFeed("Crypto.BTC/USD", "evm")).vaa;
- return await ctx.getEthUpdateFee([vaa]);
- },
- }}
- value="Latest BTC/USD update data"
- />
-
-
- [[kvs["updateData"]]]}
- feeKey="fee"
-/>
-
-## Example Code
-
-
-
- ctx.pythAddressConfig.pythAddress,
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- "\"11\"": (ctx) => `"${ctx.get("updateData", "").replace("0x", "")}"`,
- "2": (ctx) => ctx.get("fee", ""),
- }}>
- ```solidity copy
- import "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
- import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";
-
- // NETWORK_NAME
- address contractAddress = 0x0000000000000000000000000000000000000000;
- IPyth pyth = IPyth(contractAddress);
-
- bytes[] memory updateData = new bytes[](1);
- updateData[0] = hex"11";
- uint fee = 2;
- pyth.updatePriceFeeds{value: fee}(updateData);
- ```
-
-
-
-
- `'${ctx.pythAddressConfig.pythAddress}'`,
- "// NETWORK_NAME": (ctx) => `// ${ctx.currentChainConfig.name}`,
- "'RPC_URL'": (ctx) => ctx.currentChainConfig.rpcUrls.default.http.length > 0 ? `'${ctx.currentChainConfig.rpcUrls.default.http[0]}'` : 'RPC_URL',
- "'0x1111'": (ctx) => `'${ctx.get("updateData", "")}'`,
- "2": (ctx) => ctx.get("fee", "")
- }}>
- ```typescript copy
- import { ethers } from "ethers";
- import PythAbi from "@pythnetwork/pyth-sdk-solidity/abis/IPyth.json" assert { type: "json" };
-
- // NETWORK_NAME
- const contractAddress = '0x0000';
- const provider = ethers.getDefaultProvider('RPC_URL');
- const contract = new ethers.Contract(contractAddress, PythAbi, provider);
-
- const fee = ethers.toBigInt(2)
-
- const updateData = ['0x1111'];
- const tx = await contract.updatePriceFeeds(updateData, {value: fee});
- const receipt = await tx.wait();
- ```
-
-
-
-
diff --git a/pages/price-feeds/create-your-first-pyth-app/evm/part-1.mdx b/pages/price-feeds/create-your-first-pyth-app/evm/part-1.mdx
index c3e3df96..b018228b 100644
--- a/pages/price-feeds/create-your-first-pyth-app/evm/part-1.mdx
+++ b/pages/price-feeds/create-your-first-pyth-app/evm/part-1.mdx
@@ -336,9 +336,9 @@ contract MyFirstPythContract {
```
The end of this function calls the `mint` function we defined before.
-Before that, however, the function calls [`updatePriceFeeds`](https://docs.pyth.network/price-feeds/api-reference/evm/update-price-feeds) on the Pyth contract.
+Before that, however, the function calls [`updatePriceFeeds`](../../api-reference/evm/updatePriceFeeds) on the Pyth contract.
This function takes a payload of `bytes[]` that is passed into the function itself.
-The Pyth contract requires a fee to perform this update; the code snippet above calculates the needed fee using [`getUpdateFee`](https://docs.pyth.network/price-feeds/api-reference/evm/get-update-fee).
+The Pyth contract requires a fee to perform this update; the code snippet above calculates the needed fee using [`getUpdateFee`](https://api-reference.pyth.network/price-feeds/evm/getUpdateFee).
The caller of this function can pass in a recent Pyth price update as this payload, guaranteeing that the `StalePrice` error won't occur.
We can test this function by adding the following snippet to the test file:
diff --git a/pages/price-feeds/create-your-first-pyth-app/evm/part-2.mdx b/pages/price-feeds/create-your-first-pyth-app/evm/part-2.mdx
index e0ec6503..ff89117a 100644
--- a/pages/price-feeds/create-your-first-pyth-app/evm/part-2.mdx
+++ b/pages/price-feeds/create-your-first-pyth-app/evm/part-2.mdx
@@ -291,5 +291,5 @@ then deployed the contract and interacted with it both via the command line and
## Next Steps
-Check out the [EVM Contract References](https://docs.pyth.network/price-feeds/api-reference/evm) for detailed information on the Pyth EVM contract API.
-For an end-to-end example using Pyth price feed, check out the [Pyth Oracle AMM Example](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/ethereum/examples/oracle_swap).
+Check out the [EVM Contract References](https://api-reference.pyth.network/price-feeds/evm/getPriceNoOlderThan) for detailed information on the Pyth EVM contract API.
+For an end-to-end example using Pyth price feed, check out the [Pyth Oracle AMM Example](https://github.com/pyth-network/pyth-examples/tree/main/price_feeds/evm).