@gearbox-protocol/sdk 13.0.0-next.30 → 13.0.0-next.32
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/base/TokensMeta.js +19 -5
- package/dist/cjs/sdk/market/pricefeeds/PythPriceFeed.js +20 -0
- package/dist/esm/sdk/base/TokensMeta.js +19 -5
- package/dist/esm/sdk/market/pricefeeds/PythPriceFeed.js +21 -1
- package/dist/types/sdk/market/pricefeeds/PythPriceFeed.d.ts +21 -1
- package/package.json +1 -1
|
@@ -22,6 +22,7 @@ __export(TokensMeta_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(TokensMeta_exports);
|
|
24
24
|
var import_viem = require("viem");
|
|
25
|
+
var import_iSecuritizeDegenNFT = require("../../abi/310/iSecuritizeDegenNFT.js");
|
|
25
26
|
var import_iSecuritizeKYCFactory = require("../../abi/310/iSecuritizeKYCFactory.js");
|
|
26
27
|
var import_iStateSerializer = require("../../abi/iStateSerializer.js");
|
|
27
28
|
var import_iVersion = require("../../abi/iVersion.js");
|
|
@@ -252,12 +253,25 @@ class TokensMeta extends import_utils.AddressMap {
|
|
|
252
253
|
}
|
|
253
254
|
}
|
|
254
255
|
async #loadDSTokens(kycFactories) {
|
|
256
|
+
const degenNFTs = await this.#client.multicall({
|
|
257
|
+
contracts: kycFactories.map((address) => {
|
|
258
|
+
return {
|
|
259
|
+
address,
|
|
260
|
+
abi: import_iSecuritizeKYCFactory.iSecuritizeKYCFactoryAbi,
|
|
261
|
+
functionName: "getDegenNFT"
|
|
262
|
+
};
|
|
263
|
+
}),
|
|
264
|
+
allowFailure: false,
|
|
265
|
+
batchSize: 0
|
|
266
|
+
});
|
|
255
267
|
const resp = await this.#client.multicall({
|
|
256
|
-
contracts:
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
268
|
+
contracts: degenNFTs.map((address) => {
|
|
269
|
+
return {
|
|
270
|
+
address,
|
|
271
|
+
abi: import_iSecuritizeDegenNFT.iSecuritizeDegenNFTAbi,
|
|
272
|
+
functionName: "getDSTokens"
|
|
273
|
+
};
|
|
274
|
+
}),
|
|
261
275
|
allowFailure: false,
|
|
262
276
|
batchSize: 0
|
|
263
277
|
});
|
|
@@ -25,6 +25,9 @@ var import_viem = require("viem");
|
|
|
25
25
|
var import_oracles = require("../../abi/oracles.js");
|
|
26
26
|
var import_AbstractPriceFeed = require("./AbstractPriceFeed.js");
|
|
27
27
|
const abi = import_oracles.pythPriceFeedAbi;
|
|
28
|
+
const iPythAbi = (0, import_viem.parseAbi)([
|
|
29
|
+
"function getUpdateFee(bytes[] calldata updateData) external view returns (uint256 feeAmount)"
|
|
30
|
+
]);
|
|
28
31
|
class PythPriceFeed extends import_AbstractPriceFeed.AbstractPriceFeedContract {
|
|
29
32
|
token;
|
|
30
33
|
priceFeedId;
|
|
@@ -71,6 +74,23 @@ class PythPriceFeed extends import_AbstractPriceFeed.AbstractPriceFeedContract {
|
|
|
71
74
|
description: `updating pyth price for ${this.priceFeedId} [${this.labelAddress(this.address)}]`
|
|
72
75
|
});
|
|
73
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Returns contract function parameters for the getUpdateFee function on original Pyth contract
|
|
79
|
+
* @param calldata
|
|
80
|
+
* @returns
|
|
81
|
+
*/
|
|
82
|
+
getUpdateFeeParams(calldata) {
|
|
83
|
+
const [, updateData] = (0, import_viem.decodeAbiParameters)(
|
|
84
|
+
[{ type: "uint256" }, { type: "bytes[]" }],
|
|
85
|
+
calldata
|
|
86
|
+
);
|
|
87
|
+
return {
|
|
88
|
+
address: this.pyth,
|
|
89
|
+
abi: iPythAbi,
|
|
90
|
+
functionName: "getUpdateFee",
|
|
91
|
+
args: [updateData]
|
|
92
|
+
};
|
|
93
|
+
}
|
|
74
94
|
}
|
|
75
95
|
// Annotate the CommonJS export names for ESM import in node:
|
|
76
96
|
0 && (module.exports = {
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
decodeAbiParameters,
|
|
3
3
|
erc20Abi
|
|
4
4
|
} from "viem";
|
|
5
|
+
import { iSecuritizeDegenNFTAbi } from "../../abi/310/iSecuritizeDegenNFT.js";
|
|
5
6
|
import { iSecuritizeKYCFactoryAbi } from "../../abi/310/iSecuritizeKYCFactory.js";
|
|
6
7
|
import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
|
|
7
8
|
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
@@ -240,12 +241,25 @@ class TokensMeta extends AddressMap {
|
|
|
240
241
|
}
|
|
241
242
|
}
|
|
242
243
|
async #loadDSTokens(kycFactories) {
|
|
244
|
+
const degenNFTs = await this.#client.multicall({
|
|
245
|
+
contracts: kycFactories.map((address) => {
|
|
246
|
+
return {
|
|
247
|
+
address,
|
|
248
|
+
abi: iSecuritizeKYCFactoryAbi,
|
|
249
|
+
functionName: "getDegenNFT"
|
|
250
|
+
};
|
|
251
|
+
}),
|
|
252
|
+
allowFailure: false,
|
|
253
|
+
batchSize: 0
|
|
254
|
+
});
|
|
243
255
|
const resp = await this.#client.multicall({
|
|
244
|
-
contracts:
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
256
|
+
contracts: degenNFTs.map((address) => {
|
|
257
|
+
return {
|
|
258
|
+
address,
|
|
259
|
+
abi: iSecuritizeDegenNFTAbi,
|
|
260
|
+
functionName: "getDSTokens"
|
|
261
|
+
};
|
|
262
|
+
}),
|
|
249
263
|
allowFailure: false,
|
|
250
264
|
batchSize: 0
|
|
251
265
|
});
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { decodeAbiParameters } from "viem";
|
|
1
|
+
import { decodeAbiParameters, parseAbi } from "viem";
|
|
2
2
|
import { pythPriceFeedAbi } from "../../abi/oracles.js";
|
|
3
3
|
import { AbstractPriceFeedContract } from "./AbstractPriceFeed.js";
|
|
4
4
|
const abi = pythPriceFeedAbi;
|
|
5
|
+
const iPythAbi = parseAbi([
|
|
6
|
+
"function getUpdateFee(bytes[] calldata updateData) external view returns (uint256 feeAmount)"
|
|
7
|
+
]);
|
|
5
8
|
class PythPriceFeed extends AbstractPriceFeedContract {
|
|
6
9
|
token;
|
|
7
10
|
priceFeedId;
|
|
@@ -48,6 +51,23 @@ class PythPriceFeed extends AbstractPriceFeedContract {
|
|
|
48
51
|
description: `updating pyth price for ${this.priceFeedId} [${this.labelAddress(this.address)}]`
|
|
49
52
|
});
|
|
50
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Returns contract function parameters for the getUpdateFee function on original Pyth contract
|
|
56
|
+
* @param calldata
|
|
57
|
+
* @returns
|
|
58
|
+
*/
|
|
59
|
+
getUpdateFeeParams(calldata) {
|
|
60
|
+
const [, updateData] = decodeAbiParameters(
|
|
61
|
+
[{ type: "uint256" }, { type: "bytes[]" }],
|
|
62
|
+
calldata
|
|
63
|
+
);
|
|
64
|
+
return {
|
|
65
|
+
address: this.pyth,
|
|
66
|
+
abi: iPythAbi,
|
|
67
|
+
functionName: "getUpdateFee",
|
|
68
|
+
args: [updateData]
|
|
69
|
+
};
|
|
70
|
+
}
|
|
51
71
|
}
|
|
52
72
|
export {
|
|
53
73
|
PythPriceFeed
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Address, Hex } from "viem";
|
|
1
|
+
import type { Address, ContractFunctionParameters, Hex } from "viem";
|
|
2
2
|
import type { ConstructOptions } from "../../base/Construct.js";
|
|
3
3
|
import type { RawTx } from "../../types/index.js";
|
|
4
4
|
import type { PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
|
|
@@ -217,6 +217,20 @@ declare const abi: readonly [{
|
|
|
217
217
|
readonly inputs: readonly [];
|
|
218
218
|
}];
|
|
219
219
|
type abi = typeof abi;
|
|
220
|
+
declare const iPythAbi: readonly [{
|
|
221
|
+
readonly name: "getUpdateFee";
|
|
222
|
+
readonly type: "function";
|
|
223
|
+
readonly stateMutability: "view";
|
|
224
|
+
readonly inputs: readonly [{
|
|
225
|
+
readonly type: "bytes[]";
|
|
226
|
+
readonly name: "updateData";
|
|
227
|
+
}];
|
|
228
|
+
readonly outputs: readonly [{
|
|
229
|
+
readonly type: "uint256";
|
|
230
|
+
readonly name: "feeAmount";
|
|
231
|
+
}];
|
|
232
|
+
}];
|
|
233
|
+
type iPythAbi = typeof iPythAbi;
|
|
220
234
|
export declare class PythPriceFeed extends AbstractPriceFeedContract<abi> implements IUpdatablePriceFeedContract {
|
|
221
235
|
readonly token: Address;
|
|
222
236
|
readonly priceFeedId: Hex;
|
|
@@ -224,5 +238,11 @@ export declare class PythPriceFeed extends AbstractPriceFeedContract<abi> implem
|
|
|
224
238
|
readonly maxConfToPriceRatio?: bigint;
|
|
225
239
|
constructor(options: ConstructOptions, args: PartialPriceFeedTreeNode);
|
|
226
240
|
createPriceUpdateTx(data: `0x${string}`): RawTx;
|
|
241
|
+
/**
|
|
242
|
+
* Returns contract function parameters for the getUpdateFee function on original Pyth contract
|
|
243
|
+
* @param calldata
|
|
244
|
+
* @returns
|
|
245
|
+
*/
|
|
246
|
+
getUpdateFeeParams(calldata: Hex): ContractFunctionParameters<iPythAbi, "view", "getUpdateFee">;
|
|
227
247
|
}
|
|
228
248
|
export {};
|