|
@@ -5,11 +5,14 @@ import { camelToSnakeCaseObject } from "./utils";
|
|
|
|
|
|
|
|
// Accessing schema objects
|
|
// Accessing schema objects
|
|
|
export type AssetType = z.infer<typeof schemas.AssetType>;
|
|
export type AssetType = z.infer<typeof schemas.AssetType>;
|
|
|
-export type BinaryPriceUpdate = z.infer<typeof schemas.BinaryPriceUpdate>;
|
|
|
|
|
|
|
+export type BinaryPriceUpdate = z.infer<typeof schemas.BinaryUpdate>;
|
|
|
export type EncodingType = z.infer<typeof schemas.EncodingType>;
|
|
export type EncodingType = z.infer<typeof schemas.EncodingType>;
|
|
|
export type PriceFeedMetadata = z.infer<typeof schemas.PriceFeedMetadata>;
|
|
export type PriceFeedMetadata = z.infer<typeof schemas.PriceFeedMetadata>;
|
|
|
export type PriceIdInput = z.infer<typeof schemas.PriceIdInput>;
|
|
export type PriceIdInput = z.infer<typeof schemas.PriceIdInput>;
|
|
|
export type PriceUpdate = z.infer<typeof schemas.PriceUpdate>;
|
|
export type PriceUpdate = z.infer<typeof schemas.PriceUpdate>;
|
|
|
|
|
+export type PublisherCaps = z.infer<
|
|
|
|
|
+ typeof schemas.LatestPublisherStakeCapsUpdateDataResponse
|
|
|
|
|
+>;
|
|
|
|
|
|
|
|
const DEFAULT_TIMEOUT: DurationInMs = 5000;
|
|
const DEFAULT_TIMEOUT: DurationInMs = 5000;
|
|
|
const DEFAULT_HTTP_RETRIES = 3;
|
|
const DEFAULT_HTTP_RETRIES = 3;
|
|
@@ -120,6 +123,31 @@ export class HermesClient {
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Fetch the latest publisher stake caps.
|
|
|
|
|
+ * This endpoint can be customized by specifying the encoding type and whether the results should also return the parsed publisher caps.
|
|
|
|
|
+ * This will throw an error if there is a network problem or the price service returns a non-ok response.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param options Optional parameters:
|
|
|
|
|
+ * - encoding: Encoding type. If specified, return the publisher caps in the encoding specified by the encoding parameter. Default is hex.
|
|
|
|
|
+ * - parsed: Boolean to specify if the parsed publisher caps should be included in the response. Default is false.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @returns PublisherCaps object containing the latest publisher stake caps.
|
|
|
|
|
+ */
|
|
|
|
|
+ async getLatestPublisherCaps(options?: {
|
|
|
|
|
+ encoding?: EncodingType;
|
|
|
|
|
+ parsed?: boolean;
|
|
|
|
|
+ }): Promise<PublisherCaps> {
|
|
|
|
|
+ const url = new URL("v2/updates/publisher_stake_caps/latest", this.baseURL);
|
|
|
|
|
+ if (options) {
|
|
|
|
|
+ this.appendUrlSearchParams(url, options);
|
|
|
|
|
+ }
|
|
|
|
|
+ return await this.httpRequest(
|
|
|
|
|
+ url.toString(),
|
|
|
|
|
+ schemas.LatestPublisherStakeCapsUpdateDataResponse
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Fetch the latest price updates for a set of price feed IDs.
|
|
* Fetch the latest price updates for a set of price feed IDs.
|
|
|
* This endpoint can be customized by specifying the encoding type and whether the results should also return the parsed price update using the options object.
|
|
* This endpoint can be customized by specifying the encoding type and whether the results should also return the parsed price update using the options object.
|