@gearbox-protocol/sdk 8.0.3 → 8.1.0-next.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.
- package/dist/cjs/sdk/GearboxSDK.js +20 -8
- package/dist/cjs/sdk/abi/oracles.js +141 -0
- package/dist/cjs/sdk/chain/chains.js +2 -2
- package/dist/cjs/sdk/market/pricefeeds/AbstractPriceFeed.js +2 -1
- package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +17 -23
- package/dist/cjs/sdk/market/pricefeeds/PythPriceFeed.js +9 -1
- package/dist/cjs/sdk/market/pricefeeds/RedstonePriceFeed.js +9 -7
- package/dist/cjs/sdk/market/pricefeeds/index.js +2 -0
- package/dist/cjs/sdk/market/pricefeeds/isUpdatablePriceFeed.js +30 -0
- package/dist/cjs/sdk/market/pricefeeds/updates/PriceUpdateTx.js +52 -0
- package/dist/cjs/sdk/market/pricefeeds/{RedstoneCache.js → updates/PriceUpdatesCache.js} +12 -12
- package/dist/cjs/sdk/market/pricefeeds/updates/PythUpdater.js +175 -0
- package/dist/cjs/sdk/market/pricefeeds/{RedstoneUpdater.js → updates/RedstoneUpdater.js} +21 -45
- package/dist/cjs/sdk/market/pricefeeds/updates/index.js +31 -0
- package/dist/cjs/sdk/market/pricefeeds/updates/types.js +16 -0
- package/dist/cjs/sdk/utils/retry.js +4 -2
- package/dist/esm/sdk/GearboxSDK.js +20 -8
- package/dist/esm/sdk/abi/oracles.js +140 -0
- package/dist/esm/sdk/chain/chains.js +2 -2
- package/dist/esm/sdk/market/pricefeeds/AbstractPriceFeed.js +2 -1
- package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +18 -24
- package/dist/esm/sdk/market/pricefeeds/PythPriceFeed.js +9 -1
- package/dist/esm/sdk/market/pricefeeds/RedstonePriceFeed.js +8 -5
- package/dist/esm/sdk/market/pricefeeds/index.js +1 -0
- package/dist/esm/sdk/market/pricefeeds/isUpdatablePriceFeed.js +6 -0
- package/dist/esm/sdk/market/pricefeeds/updates/PriceUpdateTx.js +28 -0
- package/dist/esm/sdk/market/pricefeeds/{RedstoneCache.js → updates/PriceUpdatesCache.js} +8 -8
- package/dist/esm/sdk/market/pricefeeds/updates/PythUpdater.js +151 -0
- package/dist/esm/sdk/market/pricefeeds/{RedstoneUpdater.js → updates/RedstoneUpdater.js} +21 -44
- package/dist/esm/sdk/market/pricefeeds/updates/index.js +6 -0
- package/dist/esm/sdk/market/pricefeeds/updates/types.js +0 -0
- package/dist/esm/sdk/utils/retry.js +4 -2
- package/dist/types/sdk/GearboxSDK.d.ts +5 -1
- package/dist/types/sdk/abi/oracles.d.ts +212 -0
- package/dist/types/sdk/market/pricefeeds/AbstractPriceFeed.d.ts +2 -2
- package/dist/types/sdk/market/pricefeeds/PriceFeedsRegister.d.ts +4 -4
- package/dist/types/sdk/market/pricefeeds/PythPriceFeed.d.ts +218 -4
- package/dist/types/sdk/market/pricefeeds/RedstonePriceFeed.d.ts +4 -4
- package/dist/types/sdk/market/pricefeeds/index.d.ts +1 -0
- package/dist/types/sdk/market/pricefeeds/isUpdatablePriceFeed.d.ts +2 -0
- package/dist/types/sdk/market/pricefeeds/types.d.ts +5 -2
- package/dist/types/sdk/market/pricefeeds/updates/PriceUpdateTx.d.ts +10 -0
- package/dist/types/sdk/market/pricefeeds/updates/PriceUpdatesCache.d.ts +17 -0
- package/dist/types/sdk/market/pricefeeds/updates/PythUpdater.d.ts +40 -0
- package/dist/types/sdk/market/pricefeeds/{RedstoneUpdater.d.ts → updates/RedstoneUpdater.d.ts} +11 -18
- package/dist/types/sdk/market/pricefeeds/updates/RedstoneUpdater.test.d.ts +1 -0
- package/dist/types/sdk/market/pricefeeds/updates/index.d.ts +3 -0
- package/dist/types/sdk/market/pricefeeds/updates/types.d.ts +21 -0
- package/dist/types/sdk/sdk-legacy/core/creditAccount.d.ts +2 -2
- package/dist/types/sdk/utils/retry.d.ts +1 -0
- package/package.json +1 -1
- package/dist/types/sdk/market/pricefeeds/RedstoneCache.d.ts +0 -25
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { IPriceUpdateTx } from "../../../types/index.js";
|
|
3
|
+
import type { IPriceFeedContract } from "../types.js";
|
|
4
|
+
export interface IPriceUpdateTask {
|
|
5
|
+
dataFeedId: string;
|
|
6
|
+
priceFeed: Address;
|
|
7
|
+
timestamp: number;
|
|
8
|
+
cached: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface IPriceUpdater<T extends IPriceUpdateTask = IPriceUpdateTask> {
|
|
11
|
+
getUpdateTxs: (feeds: IPriceFeedContract[], logContext?: Record<string, any>) => Promise<IPriceUpdateTx<T>[]>;
|
|
12
|
+
}
|
|
13
|
+
export interface TimestampedCalldata {
|
|
14
|
+
dataFeedId: string;
|
|
15
|
+
data: `0x${string}`;
|
|
16
|
+
/**
|
|
17
|
+
* This timestamp is in seconds
|
|
18
|
+
*/
|
|
19
|
+
timestamp: number;
|
|
20
|
+
cached: boolean;
|
|
21
|
+
}
|
|
@@ -134,8 +134,8 @@ export declare class CreditAccountData_Legacy {
|
|
|
134
134
|
constructor(payload: CreditAccountDataPayload);
|
|
135
135
|
static sortBalances(balances: Record<Address, bigint>, prices: Record<Address, bigint>, tokens: Record<Address, TokenData>): Array<[Address, bigint]>;
|
|
136
136
|
static sortAssets<T extends Asset>(balances: Array<T>, prices: Record<Address, bigint>, tokens: Record<Address, TokenData>): T[];
|
|
137
|
-
static assetComparator<T extends Asset>(t1: T, t2: T, prices1: Record<Address, bigint> | undefined, prices2: Record<Address, bigint> | undefined, tokens1: Record<Address, TokenData> | undefined, tokens2: Record<Address, TokenData> | undefined): 1 |
|
|
138
|
-
static tokensAbcComparator(t1?: TokenData, t2?: TokenData): 1 |
|
|
137
|
+
static assetComparator<T extends Asset>(t1: T, t2: T, prices1: Record<Address, bigint> | undefined, prices2: Record<Address, bigint> | undefined, tokens1: Record<Address, TokenData> | undefined, tokens2: Record<Address, TokenData> | undefined): 1 | 0 | -1;
|
|
138
|
+
static tokensAbcComparator(t1?: TokenData, t2?: TokenData): 1 | 0 | -1;
|
|
139
139
|
static amountAbcComparator(t1: bigint, t2: bigint): 1 | -1;
|
|
140
140
|
isForbidden(token: Address): boolean;
|
|
141
141
|
isQuoted(token: Address): boolean;
|
package/package.json
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export interface TimestampedCalldata {
|
|
2
|
-
dataFeedId: string;
|
|
3
|
-
data: `0x${string}`;
|
|
4
|
-
/**
|
|
5
|
-
* This timestamp is in seconds
|
|
6
|
-
*/
|
|
7
|
-
timestamp: number;
|
|
8
|
-
cached: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface RedstoneCacheOptions {
|
|
11
|
-
/**
|
|
12
|
-
* Assume that in historical mode we only need to fetch once and then reuse from cache forever
|
|
13
|
-
*/
|
|
14
|
-
historical: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* TTL in milliseconds
|
|
17
|
-
*/
|
|
18
|
-
ttl: number;
|
|
19
|
-
}
|
|
20
|
-
export declare class RedstoneCache {
|
|
21
|
-
#private;
|
|
22
|
-
constructor(opts: RedstoneCacheOptions);
|
|
23
|
-
get(dataServiceId: string, dataFeedId: string, uniqueSignersCount: number): Omit<TimestampedCalldata, "cached"> | undefined;
|
|
24
|
-
set(dataServiceId: string, dataFeedId: string, uniqueSignersCount: number, value: Omit<TimestampedCalldata, "cached">): void;
|
|
25
|
-
}
|