@gearbox-protocol/sdk 9.4.0 → 9.5.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/constants/address-provider.js +3 -0
- package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +19 -0
- package/dist/esm/sdk/constants/address-provider.js +2 -0
- package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +26 -1
- package/dist/types/sdk/constants/address-provider.d.ts +1 -0
- package/dist/types/sdk/market/pricefeeds/PriceFeedsRegister.d.ts +13 -2
- package/package.json +2 -2
|
@@ -42,6 +42,7 @@ __export(address_provider_exports, {
|
|
|
42
42
|
AP_PARTIAL_LIQUIDATION_BOT: () => AP_PARTIAL_LIQUIDATION_BOT,
|
|
43
43
|
AP_PERIPHERY_COMPRESSOR: () => AP_PERIPHERY_COMPRESSOR,
|
|
44
44
|
AP_PRICE_FEED_COMPRESSOR: () => AP_PRICE_FEED_COMPRESSOR,
|
|
45
|
+
AP_PRICE_FEED_STORE: () => AP_PRICE_FEED_STORE,
|
|
45
46
|
AP_PRICE_ORACLE: () => AP_PRICE_ORACLE,
|
|
46
47
|
AP_REWARDS_COMPRESSOR: () => AP_REWARDS_COMPRESSOR,
|
|
47
48
|
AP_ROUTER: () => AP_ROUTER,
|
|
@@ -78,6 +79,7 @@ const AP_MARKET_CONFIGURATOR = "MARKET_CONFIGURATOR";
|
|
|
78
79
|
const AP_PARTIAL_LIQUIDATION_BOT = "PARTIAL_LIQUIDATION_BOT";
|
|
79
80
|
const AP_PERIPHERY_COMPRESSOR = "GLOBAL::PERIPHERY_COMPRESSOR";
|
|
80
81
|
const AP_PRICE_FEED_COMPRESSOR = "GLOBAL::PRICE_FEED_COMPRESSOR";
|
|
82
|
+
const AP_PRICE_FEED_STORE = "PRICE_FEED_STORE";
|
|
81
83
|
const AP_PRICE_ORACLE = "PRICE_ORACLE";
|
|
82
84
|
const AP_REWARDS_COMPRESSOR = "GLOBAL::REWARDS_COMPRESSOR";
|
|
83
85
|
const AP_ROUTER = "GLOBAL::ROUTER";
|
|
@@ -131,6 +133,7 @@ const ADDRESS_PROVIDER_V310 = "0xF7f0a609BfAb9a0A98786951ef10e5FE26cC1E38";
|
|
|
131
133
|
AP_PARTIAL_LIQUIDATION_BOT,
|
|
132
134
|
AP_PERIPHERY_COMPRESSOR,
|
|
133
135
|
AP_PRICE_FEED_COMPRESSOR,
|
|
136
|
+
AP_PRICE_FEED_STORE,
|
|
134
137
|
AP_PRICE_ORACLE,
|
|
135
138
|
AP_REWARDS_COMPRESSOR,
|
|
136
139
|
AP_ROUTER,
|
|
@@ -21,6 +21,7 @@ __export(PriceFeedsRegister_exports, {
|
|
|
21
21
|
PriceFeedRegister: () => PriceFeedRegister
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(PriceFeedsRegister_exports);
|
|
24
|
+
var import_viem = require("viem");
|
|
24
25
|
var import_compressors = require("../../../abi/compressors.js");
|
|
25
26
|
var import_base = require("../../base/index.js");
|
|
26
27
|
var import_constants = require("../../constants/index.js");
|
|
@@ -127,6 +128,24 @@ class PriceFeedRegister extends import_base.SDKConstruct {
|
|
|
127
128
|
);
|
|
128
129
|
return (0, import_getRawPriceUpdates.getRawPriceUpdates)(updates);
|
|
129
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Similar to {@link generatePriceFeedsUpdates}, but returns raw transaction to PriceFeedStore.updatePrices
|
|
133
|
+
* @param priceFeeds
|
|
134
|
+
* @param logContext
|
|
135
|
+
* @returns
|
|
136
|
+
*/
|
|
137
|
+
async getPriceFeedStoreUpdateTx(priceFeeds, logContext = {}) {
|
|
138
|
+
const pfs = this.sdk.addressProvider.getAddress(import_constants.AP_PRICE_FEED_STORE);
|
|
139
|
+
const updates = await this.generatePriceFeedsUpdates(
|
|
140
|
+
priceFeeds,
|
|
141
|
+
logContext
|
|
142
|
+
);
|
|
143
|
+
return (0, import_utils.createRawTx)(pfs, {
|
|
144
|
+
abi: (0, import_viem.parseAbi)(["function updatePrices((address,bytes)[])"]),
|
|
145
|
+
functionName: "updatePrices",
|
|
146
|
+
args: [updates.map((u) => [u.priceFeed, u.data])]
|
|
147
|
+
});
|
|
148
|
+
}
|
|
130
149
|
/**
|
|
131
150
|
* Similar to {@link generatePriceFeedsUpdateTxs}, but will generate necessary price update transactions for external price feeds
|
|
132
151
|
* This does not add feeds to this register, so they won't be implicitly included in future generatePriceFeedsUpdateTxs calls
|
|
@@ -22,6 +22,7 @@ const AP_MARKET_CONFIGURATOR = "MARKET_CONFIGURATOR";
|
|
|
22
22
|
const AP_PARTIAL_LIQUIDATION_BOT = "PARTIAL_LIQUIDATION_BOT";
|
|
23
23
|
const AP_PERIPHERY_COMPRESSOR = "GLOBAL::PERIPHERY_COMPRESSOR";
|
|
24
24
|
const AP_PRICE_FEED_COMPRESSOR = "GLOBAL::PRICE_FEED_COMPRESSOR";
|
|
25
|
+
const AP_PRICE_FEED_STORE = "PRICE_FEED_STORE";
|
|
25
26
|
const AP_PRICE_ORACLE = "PRICE_ORACLE";
|
|
26
27
|
const AP_REWARDS_COMPRESSOR = "GLOBAL::REWARDS_COMPRESSOR";
|
|
27
28
|
const AP_ROUTER = "GLOBAL::ROUTER";
|
|
@@ -74,6 +75,7 @@ export {
|
|
|
74
75
|
AP_PARTIAL_LIQUIDATION_BOT,
|
|
75
76
|
AP_PERIPHERY_COMPRESSOR,
|
|
76
77
|
AP_PRICE_FEED_COMPRESSOR,
|
|
78
|
+
AP_PRICE_FEED_STORE,
|
|
77
79
|
AP_PRICE_ORACLE,
|
|
78
80
|
AP_REWARDS_COMPRESSOR,
|
|
79
81
|
AP_ROUTER,
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
import { parseAbi } from "viem";
|
|
1
2
|
import { iPriceFeedCompressorAbi } from "../../../abi/compressors.js";
|
|
2
3
|
import { SDKConstruct } from "../../base/index.js";
|
|
3
4
|
import {
|
|
4
5
|
ADDRESS_0X0,
|
|
5
6
|
AP_PRICE_FEED_COMPRESSOR,
|
|
7
|
+
AP_PRICE_FEED_STORE,
|
|
6
8
|
VERSION_RANGE_310
|
|
7
9
|
} from "../../constants/index.js";
|
|
8
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
AddressMap,
|
|
12
|
+
bytes32ToString,
|
|
13
|
+
childLogger,
|
|
14
|
+
createRawTx
|
|
15
|
+
} from "../../utils/index.js";
|
|
9
16
|
import { Hooks } from "../../utils/internal/index.js";
|
|
10
17
|
import {
|
|
11
18
|
PartialPriceFeedInitError
|
|
@@ -110,6 +117,24 @@ class PriceFeedRegister extends SDKConstruct {
|
|
|
110
117
|
);
|
|
111
118
|
return getRawPriceUpdates(updates);
|
|
112
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Similar to {@link generatePriceFeedsUpdates}, but returns raw transaction to PriceFeedStore.updatePrices
|
|
122
|
+
* @param priceFeeds
|
|
123
|
+
* @param logContext
|
|
124
|
+
* @returns
|
|
125
|
+
*/
|
|
126
|
+
async getPriceFeedStoreUpdateTx(priceFeeds, logContext = {}) {
|
|
127
|
+
const pfs = this.sdk.addressProvider.getAddress(AP_PRICE_FEED_STORE);
|
|
128
|
+
const updates = await this.generatePriceFeedsUpdates(
|
|
129
|
+
priceFeeds,
|
|
130
|
+
logContext
|
|
131
|
+
);
|
|
132
|
+
return createRawTx(pfs, {
|
|
133
|
+
abi: parseAbi(["function updatePrices((address,bytes)[])"]),
|
|
134
|
+
functionName: "updatePrices",
|
|
135
|
+
args: [updates.map((u) => [u.priceFeed, u.data])]
|
|
136
|
+
});
|
|
137
|
+
}
|
|
113
138
|
/**
|
|
114
139
|
* Similar to {@link generatePriceFeedsUpdateTxs}, but will generate necessary price update transactions for external price feeds
|
|
115
140
|
* This does not add feeds to this register, so they won't be implicitly included in future generatePriceFeedsUpdateTxs calls
|
|
@@ -23,6 +23,7 @@ export declare const AP_MARKET_CONFIGURATOR = "MARKET_CONFIGURATOR";
|
|
|
23
23
|
export declare const AP_PARTIAL_LIQUIDATION_BOT = "PARTIAL_LIQUIDATION_BOT";
|
|
24
24
|
export declare const AP_PERIPHERY_COMPRESSOR = "GLOBAL::PERIPHERY_COMPRESSOR";
|
|
25
25
|
export declare const AP_PRICE_FEED_COMPRESSOR = "GLOBAL::PRICE_FEED_COMPRESSOR";
|
|
26
|
+
export declare const AP_PRICE_FEED_STORE = "PRICE_FEED_STORE";
|
|
26
27
|
export declare const AP_PRICE_ORACLE = "PRICE_ORACLE";
|
|
27
28
|
export declare const AP_REWARDS_COMPRESSOR = "GLOBAL::REWARDS_COMPRESSOR";
|
|
28
29
|
export declare const AP_ROUTER = "GLOBAL::ROUTER";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Address, type BlockTag } from "viem";
|
|
2
2
|
import type { PriceFeedTreeNode } from "../../base/index.js";
|
|
3
3
|
import { SDKConstruct } from "../../base/index.js";
|
|
4
4
|
import type { GearboxSDK } from "../../GearboxSDK.js";
|
|
5
|
-
import type { ILogger } from "../../types/index.js";
|
|
5
|
+
import type { ILogger, RawTx } from "../../types/index.js";
|
|
6
6
|
import type { IHooks } from "../../utils/internal/index.js";
|
|
7
7
|
import { type PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
|
|
8
8
|
import type { IPriceFeedContract, PriceUpdateV310, UpdatePriceFeedsResult } from "./types.js";
|
|
@@ -57,6 +57,17 @@ export declare class PriceFeedRegister extends SDKConstruct implements IHooks<Pr
|
|
|
57
57
|
} | {
|
|
58
58
|
reserve: true;
|
|
59
59
|
}, logContext?: Record<string, any>): Promise<PriceUpdateV310[]>;
|
|
60
|
+
/**
|
|
61
|
+
* Similar to {@link generatePriceFeedsUpdates}, but returns raw transaction to PriceFeedStore.updatePrices
|
|
62
|
+
* @param priceFeeds
|
|
63
|
+
* @param logContext
|
|
64
|
+
* @returns
|
|
65
|
+
*/
|
|
66
|
+
getPriceFeedStoreUpdateTx(priceFeeds?: IPriceFeedContract[] | {
|
|
67
|
+
main: true;
|
|
68
|
+
} | {
|
|
69
|
+
reserve: true;
|
|
70
|
+
}, logContext?: Record<string, any>): Promise<RawTx>;
|
|
60
71
|
/**
|
|
61
72
|
* Similar to {@link generatePriceFeedsUpdateTxs}, but will generate necessary price update transactions for external price feeds
|
|
62
73
|
* This does not add feeds to this register, so they won't be implicitly included in future generatePriceFeedsUpdateTxs calls
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/sdk",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.5.1",
|
|
4
4
|
"description": "Gearbox SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/cjs/sdk/index.js",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@redstone-finance/protocol": "^0.9.0",
|
|
56
56
|
"@redstone-finance/sdk": "^0.9.0",
|
|
57
57
|
"@types/bn.js": "^5.2.0",
|
|
58
|
-
"abitype": "^1.1.
|
|
58
|
+
"abitype": "^1.1.1",
|
|
59
59
|
"bn.js": "^5.2.2",
|
|
60
60
|
"buffer": "^6.0.3",
|
|
61
61
|
"date-fns": "^4.1.0",
|