Skip to content

Commit 08f2c37

Browse files
authored
chore(api-reference) Fix Input fieulds (#2994)
* chore(api-reference) Fix Input fieulds * update * update
1 parent ab26746 commit 08f2c37

File tree

6 files changed

+24
-3
lines changed

6 files changed

+24
-3
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ export const parsePriceFeedUpdatesUnique = writeApi<
5353
type: ParameterType.HexArray,
5454
description:
5555
"The price update data for the contract to verify. Fetch this data from [Hermes API](https://hermes.pyth.network/docs/#/rest/latest_price_updates).",
56+
defaultValue:
57+
"0x504e41550100000003b801000000040d00cea20e5677f66ed178e9410ddd8280617c06921916e8fd4b71e597d7f6c6d0a14daf3bb3e1a0d8c9e051c8d0................",
5658
},
5759
{
5860
name: "priceId",
@@ -63,17 +65,20 @@ export const parsePriceFeedUpdatesUnique = writeApi<
6365
name: "minPublishTime",
6466
type: ParameterType.Int,
6567
description: "The minimum timestamp for each returned feed.",
68+
defaultValue: "1721765108",
6669
},
6770
{
6871
name: "maxPublishTime",
6972
type: ParameterType.Int,
7073
description: "The maximum timestamp for each returned feed.",
74+
defaultValue: "1721765108",
7175
},
7276
{
7377
name: "fee",
7478
type: ParameterType.Int,
7579
description:
7680
"The update fee in wei. This fee is sent as the value of the transaction.",
81+
defaultValue: "1",
7782
},
7883
],
7984
valueParam: "fee",

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ export const parsePriceFeedUpdates = writeApi<
4848
type: ParameterType.HexArray,
4949
description:
5050
"The price update data for the contract to verify. Fetch this data from [Hermes API](https://hermes.pyth.network/docs/#/rest/latest_price_updates).",
51+
defaultValue:
52+
"0x504e41550100000003b801000000040d00cea20e5677f66ed178e9410ddd8280617c06921916e8fd4b71e597d7f6c6d0a14daf3bb3e1a0d8c9e051c8d0................",
5153
},
5254
{
5355
name: "priceId",
@@ -58,17 +60,20 @@ export const parsePriceFeedUpdates = writeApi<
5860
name: "minPublishTime",
5961
type: ParameterType.Int,
6062
description: "The minimum timestamp for each returned feed.",
63+
defaultValue: "1721765108",
6164
},
6265
{
6366
name: "maxPublishTime",
6467
type: ParameterType.Int,
6568
description: "The maximum timestamp for each returned feed.",
69+
defaultValue: "1721765108",
6670
},
6771
{
6872
name: "fee",
6973
type: ParameterType.Int,
7074
description:
7175
"The update fee in wei. This fee is sent as the value of the transaction.",
76+
defaultValue: "1",
7277
},
7378
],
7479
valueParam: "fee",

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ export const updatePriceFeedsIfNecessary = writeApi<
4848
type: ParameterType.HexArray,
4949
description:
5050
"The price update data for the contract to verify. Fetch this data from [Hermes API](https://hermes.pyth.network/docs/#/rest/latest_price_updates).",
51+
defaultValue:
52+
"0x504e41550100000003b801000000040d00cea20e5677f66ed178e9410ddd8280617c06921916e8fd4b71e597d7f6c6d0a14daf3bb3e1a0d8c9e051c8d0................",
5153
},
5254
{
5355
name: "priceId",
@@ -59,12 +61,14 @@ export const updatePriceFeedsIfNecessary = writeApi<
5961
type: ParameterType.IntArray,
6062
description:
6163
"The timestamp for each price id that determines whether to apply the update.",
64+
defaultValue: "1721765108",
6265
},
6366
{
6467
name: "fee",
6568
type: ParameterType.Int,
6669
description:
6770
"The update fee in wei. This fee is sent as the value of the transaction.",
71+
defaultValue: "1",
6872
},
6973
],
7074
valueParam: "fee",

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,15 @@ export const updatePriceFeeds = writeApi<"updateData" | "fee">({
3939
type: ParameterType.HexArray,
4040
description:
4141
"The price update data for the contract to verify. Fetch this data from [Hermes API](https://hermes.pyth.network/docs/#/rest/latest_price_updates).",
42+
defaultValue:
43+
"0x504e41550100000003b801000000040d00cea20e5677f66ed178e9410ddd8280617c06921916e8fd4b71e597d7f6c6d0a14daf3bb3e1a0d8c9e051c8d0................",
4244
},
4345
{
4446
name: "fee",
4547
type: ParameterType.Int,
4648
description:
4749
"The update fee in **wei**. This fee is sent as the value of the transaction.",
50+
defaultValue: "1",
4851
},
4952
],
5053
valueParam: "fee",

apps/api-reference/src/components/EvmApi/parameter-input.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import { useState, useCallback, useMemo, useEffect } from "react";
1313

1414
import type { Parameter } from "./parameter";
1515
import {
16-
PLACEHOLDERS,
1716
isValid,
1817
getValidationError,
1918
ParameterType,
19+
getPlaceHolder,
2020
} from "./parameter";
2121
import type { PriceFeed } from "../../use-price-feed-list";
2222
import {
@@ -93,7 +93,7 @@ const PriceFeedIdInput = <ParameterName extends string>({
9393
validationError={validationError}
9494
label={spec.name}
9595
description={<Markdown inline>{spec.description}</Markdown>}
96-
placeholder={PLACEHOLDERS[spec.type]}
96+
placeholder={getPlaceHolder(spec)}
9797
required={true}
9898
/>
9999
<div className="absolute right-0 top-0 z-50 mt-20 hidden w-full min-w-[34rem] overflow-hidden rounded-lg border border-neutral-400 bg-neutral-100 text-sm shadow focus-visible:border-pythpurple-600 focus-visible:outline-none group-data-[open]:block dark:border-neutral-600 dark:bg-neutral-800 dark:shadow-white/20 dark:focus-visible:border-pythpurple-400">
@@ -221,7 +221,7 @@ const DefaultParameterInput = <ParameterName extends string>({
221221
validationError={validationError}
222222
label={spec.name}
223223
description={<Markdown inline>{spec.description}</Markdown>}
224-
placeholder={PLACEHOLDERS[spec.type]}
224+
placeholder={getPlaceHolder(spec)}
225225
required={true}
226226
value={internalValue}
227227
onChange={onChangeInput}

apps/api-reference/src/components/EvmApi/parameter.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export type Parameter<Name extends string> = {
22
name: Name;
33
type: ParameterType;
44
description: string;
5+
defaultValue?: string; // Optional default value for the parameter
56
};
67

78
export enum ParameterType {
@@ -21,6 +22,9 @@ export const TRANSFORMS: Partial<
2122
[ParameterType.IntArray]: (value) => [value],
2223
};
2324

25+
export const getPlaceHolder = (parameter: Parameter<string>): string =>
26+
parameter.defaultValue ?? PLACEHOLDERS[parameter.type];
27+
2428
export const PLACEHOLDERS: Record<ParameterType, string> = {
2529
[ParameterType.PriceFeedId]:
2630
"0x1111111111111111111111111111111111111111111111111111111111111111",

0 commit comments

Comments
 (0)