Aditya Arora 1 年之前
父节点
当前提交
c6c9744818

+ 33 - 20
apps/api-reference/src/apis/evm/get-ema-price-no-older-than.ts

@@ -6,28 +6,41 @@ export const getEmaPriceNoOlderThan = readApi<"id" | "age">({
   summary:
     "Get the exponentially weighted moving average (EMA) price object with a published timestamp from before than `age` seconds in the past.",
   description: `
-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 method returns the latest price object containing **exponentially-weighted moving average** price for the requested price feed ID, if
+it has been updated sufficiently recently.
 
-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](updatePriceFeeds) to pull a fresh price
-on-chain and solve this problem.
+The caller provides an **\`age\`** argument that specifies how old the price can be.
 
-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](updatePriceFeeds) will solve this problem.
+The \`price\` object contains the following fields:
+1. \`price\`: The latest price of the price feed.
+2. \`conf\`: The confidence level of the price feed.
+3. \`expo\`: The exponent of the price feed.
+4. \`publishtime\`: The time when the price feed was last updated.
+
+Sample \`price\` object:
+\`\`\`json
+{
+    price: 123456789,
+    conf: 180726074,
+    expo: -8,
+    publishTime: 1721765108
+}
+\`\`\`
+
+The price above is in the format of \`price * 10^expo\`. So, the price in above
+mentioned sample represents the number \`123456789 * 10(-8) = 1.23456789\` in
+this case.
+
+### Error Response
+
+The above method can return the following error response:
+- \`StalePrice\`: The on-chain price has not been updated within the last
+  [\`getValidTimePeriod()\`](getValidTimePeriod) seconds. Try calling
+  [\`updatePriceFeeds()\`](updatePriceFeeds) to update the price feed with the
+  latest price.
+- \`PriceFeedNotFound\`: The requested price feed has never received a price
+  update or does not exist. Try calling
+  [\`updatePriceFeeds()\`](updatePriceFeeds) to update the price feed.
   `,
   parameters: [
     {

+ 34 - 18
apps/api-reference/src/apis/evm/get-ema-price-unsafe.ts

@@ -6,26 +6,42 @@ export const getEmaPriceUnsafe = readApi<"id">({
   summary:
     "Get the **last updated** exponentially weighted moving average (EMA) price object for the requested price feed ID. _Caution: This function may return a price arbitrarily in the past_",
   description: `
-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 method returns the price object containing **last updated** exponentially-weighted moving average(EMA) price for the requested price feed ID.
 
-**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 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. If you need the latest price, update the price using [\`updatePriceFeeds()\`](updatePriceFeeds) and then call [\`getEmaPrice()\`](getEmaPrice).
 
-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](updatePriceFeeds) will solve this problem.
+  The \`price\` object contains the following fields:
+  1. \`price\`: The latest price of the price feed.
+  2. \`conf\`: The confidence level of the price feed.
+  3. \`expo\`: The exponent of the price feed.
+  4. \`publishtime\`: The time when the price feed was last updated.
+
+  Sample \`price\` object:
+  \`\`\`json
+  {
+      price: 123456789,
+      conf: 180726074,
+      expo: -8,
+      publishTime: 1721765108
+  }
+  \`\`\`
+
+  The price above is in the format of \`price * 10^expo\`. So, the price in above
+  mentioned sample represents the number \`123456789 * 10(-8) = 1.23456789\` in
+  this case.
+
+  ### Error Response
+
+  The above method can return the following error response:
+  - \`StalePrice\`: The on-chain price has not been updated within the last
+    [\`getValidTimePeriod()\`](getValidTimePeriod) seconds. Try calling
+    [\`updatePriceFeeds()\`](updatePriceFeeds) to update the price feed with the
+    latest price.
+  - \`PriceFeedNotFound\`: The requested price feed has never received a price
+    update or does not exist. Try calling
+    [\`updatePriceFeeds()\`](updatePriceFeeds) to update the price feed.
   `,
   parameters: [
     {

+ 29 - 23
apps/api-reference/src/apis/evm/get-ema-price.ts

@@ -6,31 +6,37 @@ export const getEmaPrice = readApi<"id">({
   summary:
     "Get the **latest** exponentially weighted moving average (EMA) price object for the requested price feed ID.",
   description: `
-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 method returns the latest price object containing **exponentially-weighted moving average** price for the requested price feed ID.
+  The \`price\` object contains the following fields:
+  1. \`price\`: The latest **EMA** price of the price feed.
+  2. \`conf\`: The confidence level of the price feed.
+  3. \`expo\`: The exponent of the price feed.
+  4. \`publishtime\`: The time when the price feed was last updated.
 
-This function reverts with a \`StalePrice\` error if the on-chain price has not
-been updated within the last [getValidTimePeriod()](getValidTimePeriod) seconds.
-The default valid time period is set to a reasonable default on each chain and
-is typically around 1 minute.  Call [updatePriceFeeds](updatePriceFeeds) to pull
-a fresh price on-chain and solve this problem.  If you would like to configure
-the valid time period, see [getEmaPriceNoOlderThan](getEmaPriceNoOlderThan).  If
-you want the latest price regardless of when it was updated, see
-[getEmaPriceUnsafe](getEmaPriceUnsafe).
+  Sample \`price\` object:
+  \`\`\`json
+  {
+      price: 123456789,
+      conf: 180726074,
+      expo: -8,
+      publishTime: 1721765108
+  }
+  \`\`\`
 
-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](updatePriceFeeds) will solve this problem.
+  The price above is in the format of \`price * 10^expo\`. So, the price in above
+  mentioned sample represents the number \`123456789 * 10(-8) = 1.23456789\` in
+  this case.
+
+  ### Error Response
+
+  The above method can return the following error response:
+  - \`StalePrice\`: The on-chain price has not been updated within the last
+    [\`getValidTimePeriod()\`](getValidTimePeriod) seconds. Try calling
+    [\`updatePriceFeeds()\`](updatePriceFeeds) to update the price feed with the
+    latest price.
+  - \`PriceFeedNotFound\`: The requested price feed has never received a price
+    update or does not exist. Try calling
+    [\`updatePriceFeeds()\`](updatePriceFeeds) to update the price feed.
   `,
   parameters: [
     {

+ 33 - 19
apps/api-reference/src/apis/evm/get-price-no-older-than.ts

@@ -6,27 +6,41 @@ export const getPriceNoOlderThan = readApi<"id" | "age">({
   summary:
     "Get the price object with a published timestamp from before than `age` seconds in the past.",
   description: `
-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.
+This method returns the latest price object for the requested price feed ID, if
+it has been updated sufficiently recently.
 
-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](updatePriceFeeds) to pull a fresh price
-on-chain and solve this problem.
+The caller provides an **\`age\`** argument that specifies how old the price can be.
 
-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](updatePriceFeeds) will solve this problem.
+The \`price\` object contains the following fields:
+1. \`price\`: The latest price of the price feed.
+2. \`conf\`: The confidence level of the price feed.
+3. \`expo\`: The exponent of the price feed.
+4. \`publishtime\`: The time when the price feed was last updated.
+
+Sample \`price\` object:
+\`\`\`json
+{
+    price: 123456789,
+    conf: 180726074,
+    expo: -8,
+    publishTime: 1721765108
+}
+\`\`\`
+
+The price above is in the format of \`price * 10^expo\`. So, the price in above
+mentioned sample represents the number \`123456789 * 10(-8) = 1.23456789\` in
+this case.
+
+### Error Response
+
+The above method can return the following error response:
+- \`StalePrice\`: The on-chain price has not been updated within the last
+  [\`getValidTimePeriod()\`](getValidTimePeriod) seconds. Try calling
+  [\`updatePriceFeeds()\`](updatePriceFeeds) to update the price feed with the
+  latest price.
+- \`PriceFeedNotFound\`: The requested price feed has never received a price
+  update or does not exist. Try calling
+  [\`updatePriceFeeds()\`](updatePriceFeeds) to update the price feed.
   `,
   parameters: [
     {

+ 35 - 17
apps/api-reference/src/apis/evm/get-price-unsafe.ts

@@ -6,25 +6,43 @@ export const getPriceUnsafe = readApi<"id">({
   summary:
     "Get the **last updated** price object for the requested price feed ID. _Caution: This function may return a price from arbitrarily in the the past_",
   description: `
-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 method returns the price object containing **last updated** price for the requested price feed ID.
 
-**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 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. If you need the latest price, update the price using [\`updatePriceFeeds()\`](updatePriceFeeds) and then call [\`getPrice()\`](getPrice).
 
-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](updatePriceFeeds) will solve this problem.
-  `,
+  The \`price\` object contains the following fields:
+  1. \`price\`: The latest price of the price feed.
+  2. \`conf\`: The confidence level of the price feed.
+  3. \`expo\`: The exponent of the price feed.
+  4. \`publishtime\`: The time when the price feed was last updated.
+
+  Sample \`price\` object:
+  \`\`\`json
+  {
+      price: 123456789,
+      conf: 180726074,
+      expo: -8,
+      publishTime: 1721765108
+  }
+  \`\`\`
+
+  The price above is in the format of \`price * 10^expo\`. So, the price in above
+  mentioned sample represents the number \`123456789 * 10(-8) = 1.23456789\` in
+  this case.
+
+  ### Error Response
+
+  The above method can return the following error response:
+  - \`StalePrice\`: The on-chain price has not been updated within the last
+    [\`getValidTimePeriod()\`](getValidTimePeriod) seconds. Try calling
+    [\`updatePriceFeeds()\`](updatePriceFeeds) to update the price feed with the
+    latest price.
+  - \`PriceFeedNotFound\`: The requested price feed has never received a price
+    update or does not exist. Try calling
+    [\`updatePriceFeeds()\`](updatePriceFeeds) to update the price feed.
+`,
   parameters: [
     {
       name: "id",

+ 1 - 1
apps/api-reference/src/apis/evm/get-price.ts

@@ -29,7 +29,7 @@ this case.
 
 ### Error Response
 
-The above method returns the following error response:
+The above method can return the following error response:
 - \`StalePrice\`: The on-chain price has not been updated within the last
   [\`getValidTimePeriod()\`](getValidTimePeriod) seconds. Try calling
   [\`updatePriceFeeds()\`](updatePriceFeeds) to update the price feed with the

+ 7 - 5
apps/api-reference/src/apis/evm/get-update-fee.tsx

@@ -16,17 +16,19 @@ export const getUpdateFee = readApi<"updateData">({
   summary:
     "Get the fee required to update the on-chain price feeds with the provided `updateData`.",
   description: `
-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).
+  This method returns the fee required to update the on-chain price feeds for the given \`updateData\`. 
+  
+  The fee returned is in **wei**.
+  
+  The caller should send the returned fee amount as the transaction value when calling [updatePriceFeeds](update-price-feeds).
+  The \`updateData\` can be retrieved from the [Hermes API](https://hermes.pyth.network/docs).
   `,
   parameters: [
     {
       name: "updateData",
       type: ParameterType.HexArray,
       description:
-        "The price updates that you would like to submit to [updatePriceFeeds](updatePriceFeeds).",
+        "The price updates that you would like to submit to [updatePriceFeeds](updatePriceFeeds). Fetch this data from [Hermes API](https://hermes.pyth.network/docs/#/rest/latest_price_updates).",
     },
   ],
   examples: [

+ 2 - 2
apps/api-reference/src/apis/evm/get-valid-time-period.ts

@@ -4,8 +4,8 @@ export const getValidTimePeriod = readApi<never>({
   name: "getValidTimePeriod",
   summary: "Get the default valid time period of price freshness in seconds.",
   description: `
-Get the default valid time period in seconds.  This quantity is the maximum age
-of price updates returned by functions like [getPrice](getPrice) and
+  This method returns the default valid time period of price freshness in **seconds**.
+ This quantity is the maximum age of price updates returned by functions like [getPrice](getPrice) and
 [getEmaPrice](getEmaPrice); 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.

+ 25 - 19
apps/api-reference/src/apis/evm/parse-price-feed-updates-unique.tsx

@@ -18,32 +18,38 @@ export const parsePriceFeedUpdatesUnique = writeApi<
   summary:
     "Parse `updateData` to return the **first updated** prices if the prices are published within the given time range.",
   description: `
-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 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.
 
-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\`.
+  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. 
 
-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.
+  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](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\`.
+
+  The above method can return the following error response:
+  - \`PriceFeedNotFoundWithinRange\`: No price feed was found within the given time range.
+  - \`InvalidUpdateData\`: The provided update data is invalid or incorrectly signed.
+  - \`InsufficientFee\`: The fee provided is less than the required fee. Try calling [getUpdateFee](getUpdateFee) to get the required fee.
   `,
   parameters: [
     {
       name: "updateData",
       type: ParameterType.HexArray,
-      description: "The price update data to parse.",
+      description: "The price update data for the contract to verify. Fetch this data from [Hermes API](https://hermes.pyth.network/docs/#/rest/latest_price_updates).",
     },
     {
       name: "priceId",

+ 19 - 16
apps/api-reference/src/apis/evm/parse-price-feed-updates.tsx

@@ -18,30 +18,33 @@ export const parsePriceFeedUpdates = writeApi<
   summary:
     "Parse `updateData` to return prices if the prices are published within the given time range.",
   description: `
-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 [getPrice](get-price) or one of its variants.  Unlike
-\`updatePriceFeeds\`, calling this function will not update the on-chain price.
+  This method parse \`updateData\` and return the price feeds for the given \`priceIds\`
+  within, if they are all published between \`minPublishTime\` and
+  \`maxPublishTime\` (\`minPublishTime <= publishTime <= maxPublishTime\`). 
 
-If you need to make sure the price update is the earliest update after the
-\`minPublishTime\` consider using
-[parsePriceFeedUpdatesUnique](parse-price-feed-updates-unique).
+  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.
 
-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\`.
+  Unlike [updatePriceFeeds](updatePriceFeeds), calling this function will **not** update the on-chain price.
 
-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.
+  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\`.
+
+  The above method can return the following error response:
+  - \`PriceFeedNotFoundWithinRange\`: No price feed was found within the given time range.
+  - \`InvalidUpdateData\`: The provided update data is invalid or incorrectly signed.
+  - \`InsufficientFee\`: The fee provided is less than the required fee. Try calling [getUpdateFee](getUpdateFee) to get the required fee.
   `,
   parameters: [
     {
       name: "updateData",
       type: ParameterType.HexArray,
-      description: "The price update data to parse.",
+      description: "The price update data for the contract to verify. Fetch this data from [Hermes API](https://hermes.pyth.network/docs/#/rest/latest_price_updates).",
     },
     {
       name: "priceId",

+ 19 - 16
apps/api-reference/src/apis/evm/update-price-feeds-if-necessary.tsx

@@ -18,30 +18,33 @@ export const updatePriceFeedsIfNecessary = writeApi<
   summary:
     "Update the on-chain price feeds using the provided `updateData` only if the on-chain prices are older than the valid time period.",
   description: `
-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 updates the on-chain price feeds using the provided \`updateData\` if the on-chain data is not sufficiently fresh.
 
-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).
+  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\`. 
 
-Reverts if the required fee is not paid, or the \`updateData\` is incorrectly
-signed or formatted.
+
+  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).
+
+  This method returns the transaction hash of the update transaction.
+
+  The above method can return the following error response:
+  - \`NoFreshUpdate\`: The provided update is not fresh enough to apply. It means the provided \`publishTime\` is not equal to corresponding corresponding price id in \`updateData\`.
+  - \`InvalidUpdateData\`: The provided update data is invalid or incorrectly signed.
+  - \`InsufficientFee\`: The fee provided is less than the required fee. Try calling [getUpdateFee](getUpdateFee) to get the required fee.
   `,
   parameters: [
     {
       name: "updateData",
       type: ParameterType.HexArray,
-      description: "The price update data for the contract to verify.",
+      description: "The price update data for the contract to verify. Fetch this data from [Hermes API](https://hermes.pyth.network/docs/#/rest/latest_price_updates).",
     },
     {
       name: "priceId",

+ 17 - 14
apps/api-reference/src/apis/evm/update-price-feeds.tsx

@@ -15,32 +15,35 @@ export const updatePriceFeeds = writeApi<"updateData" | "fee">({
   name: "updatePriceFeeds",
   summary: "Update the on-chain price feeds using the provided `updateData`.",
   description: `
-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 method updates 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 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.
+  This method 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 method 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](getUpdateFee).
+
+  This method returns the transaction hash of the update transaction.
+
+  ### Error Response
+
+  The above method can return the following error response:
+  - \`InvalidUpdateData\`: The provided update data is invalid or incorrectly signed.
+  - \`InsufficientFee\`: The fee provided is less than the required fee. Try calling [getUpdateFee](getUpdateFee) to get the required fee.
   `,
   parameters: [
     {
       name: "updateData",
       type: ParameterType.HexArray,
-      description: "The price update data for the contract to verify.",
+      description: "The price update data for the contract to verify. Fetch this data from [Hermes API](https://hermes.pyth.network/docs/#/rest/latest_price_updates).",
     },
     {
       name: "fee",
       type: ParameterType.Int,
       description:
-        "The update fee in wei. This fee is sent as the value of the transaction.",
+        "The update fee in **wei**. This fee is sent as the value of the transaction.",
     },
   ],
   valueParam: "fee",