From 57d5193cc9f5256eebe90e02e3a8f5a257387e55 Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Wed, 27 Aug 2025 15:00:29 -0400 Subject: [PATCH 1/3] chore(api-reference) Fix Input fieulds --- .../src/apis/evm/parse-price-feed-updates-unique.tsx | 5 +++++ .../src/apis/evm/parse-price-feed-updates.tsx | 5 +++++ .../src/apis/evm/update-price-feeds-if-necessary.tsx | 4 ++++ apps/api-reference/src/apis/evm/update-price-feeds.tsx | 3 +++ .../src/components/EvmApi/parameter-input.tsx | 6 +++--- apps/api-reference/src/components/EvmApi/parameter.ts | 7 +++++++ 6 files changed, 27 insertions(+), 3 deletions(-) diff --git a/apps/api-reference/src/apis/evm/parse-price-feed-updates-unique.tsx b/apps/api-reference/src/apis/evm/parse-price-feed-updates-unique.tsx index 877af85f51..ca7cb7647a 100644 --- a/apps/api-reference/src/apis/evm/parse-price-feed-updates-unique.tsx +++ b/apps/api-reference/src/apis/evm/parse-price-feed-updates-unique.tsx @@ -53,6 +53,8 @@ export const parsePriceFeedUpdatesUnique = writeApi< type: ParameterType.HexArray, 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).", + defaultValue: + "0x504e41550100000003b801000000040d00cea20e5677f66ed178e9410ddd8280617c06921916e8fd4b71e597d7f6c6d0a14daf3bb3e1a0d8c9e051c8d0................", }, { name: "priceId", @@ -63,17 +65,20 @@ export const parsePriceFeedUpdatesUnique = writeApi< name: "minPublishTime", type: ParameterType.Int, description: "The minimum timestamp for each returned feed.", + defaultValue: "1721765108", }, { name: "maxPublishTime", type: ParameterType.Int, description: "The maximum timestamp for each returned feed.", + defaultValue: "1721765108", }, { name: "fee", type: ParameterType.Int, description: "The update fee in wei. This fee is sent as the value of the transaction.", + defaultValue: "1", }, ], valueParam: "fee", diff --git a/apps/api-reference/src/apis/evm/parse-price-feed-updates.tsx b/apps/api-reference/src/apis/evm/parse-price-feed-updates.tsx index 22676bc94b..69b00f7b70 100644 --- a/apps/api-reference/src/apis/evm/parse-price-feed-updates.tsx +++ b/apps/api-reference/src/apis/evm/parse-price-feed-updates.tsx @@ -48,6 +48,8 @@ export const parsePriceFeedUpdates = writeApi< type: ParameterType.HexArray, 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).", + defaultValue: + "0x504e41550100000003b801000000040d00cea20e5677f66ed178e9410ddd8280617c06921916e8fd4b71e597d7f6c6d0a14daf3bb3e1a0d8c9e051c8d0................", }, { name: "priceId", @@ -58,17 +60,20 @@ export const parsePriceFeedUpdates = writeApi< name: "minPublishTime", type: ParameterType.Int, description: "The minimum timestamp for each returned feed.", + defaultValue: "1721765108", }, { name: "maxPublishTime", type: ParameterType.Int, description: "The maximum timestamp for each returned feed.", + defaultValue: "1721765108", }, { name: "fee", type: ParameterType.Int, description: "The update fee in wei. This fee is sent as the value of the transaction.", + defaultValue: "1", }, ], valueParam: "fee", diff --git a/apps/api-reference/src/apis/evm/update-price-feeds-if-necessary.tsx b/apps/api-reference/src/apis/evm/update-price-feeds-if-necessary.tsx index e144f37ccc..d6ba551e42 100644 --- a/apps/api-reference/src/apis/evm/update-price-feeds-if-necessary.tsx +++ b/apps/api-reference/src/apis/evm/update-price-feeds-if-necessary.tsx @@ -48,6 +48,8 @@ export const updatePriceFeedsIfNecessary = writeApi< type: ParameterType.HexArray, 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).", + defaultValue: + "0x504e41550100000003b801000000040d00cea20e5677f66ed178e9410ddd8280617c06921916e8fd4b71e597d7f6c6d0a14daf3bb3e1a0d8c9e051c8d0................", }, { name: "priceId", @@ -59,12 +61,14 @@ export const updatePriceFeedsIfNecessary = writeApi< type: ParameterType.IntArray, description: "The timestamp for each price id that determines whether to apply the update.", + defaultValue: "1721765108", }, { name: "fee", type: ParameterType.Int, description: "The update fee in wei. This fee is sent as the value of the transaction.", + defaultValue: "1", }, ], valueParam: "fee", diff --git a/apps/api-reference/src/apis/evm/update-price-feeds.tsx b/apps/api-reference/src/apis/evm/update-price-feeds.tsx index a3dcf9bb35..e1ffc20978 100644 --- a/apps/api-reference/src/apis/evm/update-price-feeds.tsx +++ b/apps/api-reference/src/apis/evm/update-price-feeds.tsx @@ -39,12 +39,15 @@ export const updatePriceFeeds = writeApi<"updateData" | "fee">({ type: ParameterType.HexArray, 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).", + defaultValue: + "0x504e41550100000003b801000000040d00cea20e5677f66ed178e9410ddd8280617c06921916e8fd4b71e597d7f6c6d0a14daf3bb3e1a0d8c9e051c8d0................", }, { name: "fee", type: ParameterType.Int, description: "The update fee in **wei**. This fee is sent as the value of the transaction.", + defaultValue: "1", }, ], valueParam: "fee", diff --git a/apps/api-reference/src/components/EvmApi/parameter-input.tsx b/apps/api-reference/src/components/EvmApi/parameter-input.tsx index c7d461164c..568720a96c 100644 --- a/apps/api-reference/src/components/EvmApi/parameter-input.tsx +++ b/apps/api-reference/src/components/EvmApi/parameter-input.tsx @@ -13,10 +13,10 @@ import { useState, useCallback, useMemo, useEffect } from "react"; import type { Parameter } from "./parameter"; import { - PLACEHOLDERS, isValid, getValidationError, ParameterType, + getPlaceHolder, } from "./parameter"; import type { PriceFeed } from "../../use-price-feed-list"; import { @@ -93,7 +93,7 @@ const PriceFeedIdInput = ({ validationError={validationError} label={spec.name} description={{spec.description}} - placeholder={PLACEHOLDERS[spec.type]} + placeholder={getPlaceHolder(spec)} required={true} />
@@ -221,7 +221,7 @@ const DefaultParameterInput = ({ validationError={validationError} label={spec.name} description={{spec.description}} - placeholder={PLACEHOLDERS[spec.type]} + placeholder={getPlaceHolder(spec)} required={true} value={internalValue} onChange={onChangeInput} diff --git a/apps/api-reference/src/components/EvmApi/parameter.ts b/apps/api-reference/src/components/EvmApi/parameter.ts index 02a1e609e1..35a5b90b21 100644 --- a/apps/api-reference/src/components/EvmApi/parameter.ts +++ b/apps/api-reference/src/components/EvmApi/parameter.ts @@ -2,6 +2,7 @@ export type Parameter = { name: Name; type: ParameterType; description: string; + defaultValue?: string; // Optional default value for the parameter }; export enum ParameterType { @@ -21,6 +22,12 @@ export const TRANSFORMS: Partial< [ParameterType.IntArray]: (value) => [value], }; +export const getPlaceHolder = ( + parameter: Parameter, +) => { + return parameter.defaultValue ?? PLACEHOLDERS[parameter.type]; +}; + export const PLACEHOLDERS: Record = { [ParameterType.PriceFeedId]: "0x1111111111111111111111111111111111111111111111111111111111111111", From ec7a2d2fc0ceb7f29a1be2e3dd83a917a0c6a843 Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Thu, 28 Aug 2025 13:59:29 -0400 Subject: [PATCH 2/3] update --- apps/api-reference/next-env.d.ts | 1 + apps/api-reference/src/components/EvmApi/parameter.ts | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/api-reference/next-env.d.ts b/apps/api-reference/next-env.d.ts index 1b3be0840f..830fb594ca 100644 --- a/apps/api-reference/next-env.d.ts +++ b/apps/api-reference/next-env.d.ts @@ -1,5 +1,6 @@ /// /// +/// // NOTE: This file should not be edited // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. diff --git a/apps/api-reference/src/components/EvmApi/parameter.ts b/apps/api-reference/src/components/EvmApi/parameter.ts index 35a5b90b21..a14f73184c 100644 --- a/apps/api-reference/src/components/EvmApi/parameter.ts +++ b/apps/api-reference/src/components/EvmApi/parameter.ts @@ -22,11 +22,8 @@ export const TRANSFORMS: Partial< [ParameterType.IntArray]: (value) => [value], }; -export const getPlaceHolder = ( - parameter: Parameter, -) => { - return parameter.defaultValue ?? PLACEHOLDERS[parameter.type]; -}; +export const getPlaceHolder = (parameter: Parameter): string => + parameter.defaultValue ?? PLACEHOLDERS[parameter.type]; export const PLACEHOLDERS: Record = { [ParameterType.PriceFeedId]: From e458dcce276e236e106dbc4ad81e8b546d0f0e9b Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Thu, 28 Aug 2025 14:00:26 -0400 Subject: [PATCH 3/3] update --- apps/api-reference/next-env.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/api-reference/next-env.d.ts b/apps/api-reference/next-env.d.ts index 830fb594ca..1b3be0840f 100644 --- a/apps/api-reference/next-env.d.ts +++ b/apps/api-reference/next-env.d.ts @@ -1,6 +1,5 @@ /// /// -/// // NOTE: This file should not be edited // see https://nextjs.org/docs/app/api-reference/config/typescript for more information.