@gearbox-protocol/sdk 12.9.9 → 12.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/cjs/history/errors.js +2 -0
  2. package/dist/cjs/permissionless/utils/price-update/get-prices.js +0 -3
  3. package/dist/cjs/permissionless/utils/price-update/get-updatable-feeds.js +2 -23
  4. package/dist/cjs/sdk/GearboxSDK.js +5 -25
  5. package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +8 -6
  6. package/dist/cjs/sdk/market/pricefeeds/PythPriceFeed.js +3 -27
  7. package/dist/cjs/sdk/market/pricefeeds/RedstonePriceFeed.js +2 -0
  8. package/dist/cjs/sdk/market/pricefeeds/index.js +0 -2
  9. package/dist/cjs/sdk/market/pricefeeds/updates/RedstoneUpdater.js +3 -202
  10. package/dist/cjs/sdk/market/pricefeeds/updates/fetchRedstonePayloads.js +4 -126
  11. package/dist/cjs/sdk/market/pricefeeds/updates/index.js +0 -7
  12. package/dist/cjs/sdk/options.js +1 -5
  13. package/dist/esm/history/errors.js +2 -0
  14. package/dist/esm/permissionless/utils/price-update/get-prices.js +0 -3
  15. package/dist/esm/permissionless/utils/price-update/get-updatable-feeds.js +2 -27
  16. package/dist/esm/sdk/GearboxSDK.js +5 -25
  17. package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +8 -6
  18. package/dist/esm/sdk/market/pricefeeds/PythPriceFeed.js +4 -28
  19. package/dist/esm/sdk/market/pricefeeds/RedstonePriceFeed.js +2 -0
  20. package/dist/esm/sdk/market/pricefeeds/index.js +0 -2
  21. package/dist/esm/sdk/market/pricefeeds/updates/RedstoneUpdater.js +3 -202
  22. package/dist/esm/sdk/market/pricefeeds/updates/fetchRedstonePayloads.js +4 -130
  23. package/dist/esm/sdk/market/pricefeeds/updates/index.js +0 -4
  24. package/dist/esm/sdk/options.js +2 -9
  25. package/dist/types/permissionless/utils/price-update/get-updatable-feeds.d.ts +4 -3
  26. package/dist/types/sdk/market/pricefeeds/PriceFeedsRegister.d.ts +2 -3
  27. package/dist/types/sdk/market/pricefeeds/PythPriceFeed.d.ts +2 -25
  28. package/dist/types/sdk/market/pricefeeds/index.d.ts +1 -1
  29. package/dist/types/sdk/market/pricefeeds/updates/RedstoneUpdater.d.ts +5 -10
  30. package/dist/types/sdk/market/pricefeeds/updates/fetchRedstonePayloads.d.ts +2 -6
  31. package/dist/types/sdk/market/pricefeeds/updates/index.d.ts +0 -2
  32. package/dist/types/sdk/options.d.ts +0 -6
  33. package/package.json +6 -7
  34. package/dist/cjs/sdk/market/pricefeeds/updates/PriceUpdateTx.js +0 -55
  35. package/dist/cjs/sdk/market/pricefeeds/updates/PriceUpdatesCache.js +0 -78
  36. package/dist/cjs/sdk/market/pricefeeds/updates/PythAccumulatorUpdateData.js +0 -195
  37. package/dist/cjs/sdk/market/pricefeeds/updates/PythUpdater.js +0 -183
  38. package/dist/cjs/sdk/market/pricefeeds/updates/fetchPythPayloads.js +0 -135
  39. package/dist/esm/sdk/market/pricefeeds/updates/PriceUpdateTx.js +0 -31
  40. package/dist/esm/sdk/market/pricefeeds/updates/PriceUpdatesCache.js +0 -54
  41. package/dist/esm/sdk/market/pricefeeds/updates/PythAccumulatorUpdateData.js +0 -157
  42. package/dist/esm/sdk/market/pricefeeds/updates/PythUpdater.js +0 -158
  43. package/dist/esm/sdk/market/pricefeeds/updates/fetchPythPayloads.js +0 -115
  44. package/dist/types/sdk/market/pricefeeds/updates/PriceUpdateTx.d.ts +0 -13
  45. package/dist/types/sdk/market/pricefeeds/updates/PriceUpdatesCache.d.ts +0 -24
  46. package/dist/types/sdk/market/pricefeeds/updates/PythAccumulatorUpdateData.d.ts +0 -41
  47. package/dist/types/sdk/market/pricefeeds/updates/PythUpdater.d.ts +0 -26
  48. package/dist/types/sdk/market/pricefeeds/updates/fetchPythPayloads.d.ts +0 -45
@@ -1,41 +0,0 @@
1
- /**
2
- * This is https://github.com/pyth-network/pyth-crosschain/blob/main/price_service/sdk/js/src/AccumulatorUpdateData.ts
3
- * modified to use buffer from npm package
4
- */
5
- import BN from "bn.js";
6
- import { Buffer } from "buffer";
7
- export type AccumulatorUpdateData = {
8
- vaa: Buffer;
9
- updates: {
10
- message: Buffer;
11
- proof: number[][];
12
- }[];
13
- };
14
- export type PriceFeedMessage = {
15
- feedId: Buffer;
16
- price: BN;
17
- confidence: BN;
18
- exponent: number;
19
- publishTime: BN;
20
- prevPublishTime: BN;
21
- emaPrice: BN;
22
- emaConf: BN;
23
- };
24
- export type TwapMessage = {
25
- feedId: Buffer;
26
- cumulativePrice: BN;
27
- cumulativeConf: BN;
28
- numDownSlots: BN;
29
- exponent: number;
30
- publishTime: BN;
31
- prevPublishTime: BN;
32
- publishSlot: BN;
33
- };
34
- export declare function isAccumulatorUpdateData(updateBytes: Buffer): boolean;
35
- export declare function parsePriceFeedMessage(message: Buffer): PriceFeedMessage;
36
- export declare function parseTwapMessage(message: Buffer): TwapMessage;
37
- /**
38
- * An AccumulatorUpdateData contains a VAA and a list of updates. This function returns a new serialized AccumulatorUpdateData with only the updates in the range [start, end).
39
- */
40
- export declare function sliceAccumulatorUpdateData(data: Buffer, start?: number, end?: number): Buffer;
41
- export declare function parseAccumulatorUpdateData(data: Buffer): AccumulatorUpdateData;
@@ -1,26 +0,0 @@
1
- import { z } from "zod/v4";
2
- import { SDKConstruct } from "../../../base/index.js";
3
- import type { GearboxSDK } from "../../../GearboxSDK.js";
4
- import type { IPriceFeedContract } from "../types.js";
5
- import { PriceUpdateTx } from "./PriceUpdateTx.js";
6
- import type { IPriceUpdater, IPriceUpdateTask } from "./types.js";
7
- export type PythUpdateTask = IPriceUpdateTask;
8
- declare class PythUpdateTx extends PriceUpdateTx<PythUpdateTask> {
9
- readonly name = "pyth";
10
- }
11
- export declare const PythOptions: z.ZodObject<{
12
- historicTimestamp: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<true>]>>;
13
- apiProxy: z.ZodOptional<z.ZodURL>;
14
- cacheTTL: z.ZodOptional<z.ZodNumber>;
15
- ignoreMissingFeeds: z.ZodOptional<z.ZodBoolean>;
16
- }, z.core.$strip>;
17
- export type PythOptions = z.infer<typeof PythOptions>;
18
- /**
19
- * Class to update multiple pyth price feeds at once
20
- */
21
- export declare class PythUpdater extends SDKConstruct implements IPriceUpdater<PythUpdateTask> {
22
- #private;
23
- constructor(sdk: GearboxSDK, opts?: PythOptions);
24
- getUpdateTxs(feeds: IPriceFeedContract[]): Promise<PythUpdateTx[]>;
25
- }
26
- export {};
@@ -1,45 +0,0 @@
1
- import type { ILogger } from "../../../types/logger.js";
2
- import type { TimestampedCalldata, TimestampedCalldataWithPrice } from "./types.js";
3
- export interface FetchPythPayloadsOptions {
4
- /**
5
- * Feeds to fetch
6
- */
7
- dataFeedsIds: Iterable<string>;
8
- /**
9
- * When true, will not throw an error if pyth is unable to fetch data for some feeds
10
- */
11
- ignoreMissingFeeds?: boolean;
12
- /**
13
- * Historical timestamp in seconds
14
- */
15
- historicalTimestampSeconds?: number;
16
- /**
17
- * Override Hermes API with this proxy. Can be used to set caching proxies, to avoid rate limiting
18
- */
19
- apiProxy?: string;
20
- /**
21
- * Logger to use
22
- */
23
- logger?: ILogger;
24
- /**
25
- * Custom fetch function to use instead of global fetch.
26
- * Can be used to add custom headers, authentication, or use a different HTTP client.
27
- */
28
- customFetch?: typeof fetch;
29
- /**
30
- * When true, returns the price data for each feed.
31
- */
32
- returnPrices?: boolean;
33
- }
34
- /**
35
- * Fetches pyth payloads from Hermes API with price data
36
- */
37
- export declare function fetchPythPayloads(options: FetchPythPayloadsOptions & {
38
- returnPrices: true;
39
- }): Promise<TimestampedCalldataWithPrice[]>;
40
- /**
41
- * Fetches pyth payloads from Hermes API
42
- */
43
- export declare function fetchPythPayloads(options: FetchPythPayloadsOptions & {
44
- returnPrices?: false;
45
- }): Promise<TimestampedCalldata[]>;