@gearbox-protocol/sdk 8.6.0 → 8.6.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/chain/chains.js +2 -2
- package/dist/cjs/sdk/core/BotListV3Contract.js +1 -1
- package/dist/cjs/sdk/core/address-provider/AddressProviderV300Contract.js +1 -2
- package/dist/cjs/sdk/plugins/V300StalenessPeriodPlugin.js +1 -1
- package/dist/esm/sdk/chain/chains.js +1 -1
- package/dist/esm/sdk/core/BotListV3Contract.js +2 -5
- package/dist/esm/sdk/core/address-provider/AddressProviderV300Contract.js +1 -2
- package/dist/esm/sdk/plugins/V300StalenessPeriodPlugin.js +2 -2
- package/dist/types/sdk/chain/Provider.d.ts +3 -3
- package/dist/types/sdk/chain/chains.d.ts +17 -2
- package/package.json +3 -3
|
@@ -29,7 +29,7 @@ __export(chains_exports, {
|
|
|
29
29
|
module.exports = __toCommonJS(chains_exports);
|
|
30
30
|
var import_viem = require("viem");
|
|
31
31
|
var import_chains = require("viem/chains");
|
|
32
|
-
var
|
|
32
|
+
var import_v4 = require("zod/v4");
|
|
33
33
|
const SUPPORTED_NETWORKS = [
|
|
34
34
|
"Mainnet",
|
|
35
35
|
"Arbitrum",
|
|
@@ -46,7 +46,7 @@ const SUPPORTED_NETWORKS = [
|
|
|
46
46
|
"Hemi",
|
|
47
47
|
"Lisk"
|
|
48
48
|
];
|
|
49
|
-
const NetworkType =
|
|
49
|
+
const NetworkType = import_v4.z.enum(SUPPORTED_NETWORKS);
|
|
50
50
|
function withPublicNode(chain, subdomain) {
|
|
51
51
|
return (0, import_viem.defineChain)({
|
|
52
52
|
...chain,
|
|
@@ -30,7 +30,7 @@ class BotListContract extends import_base.BaseContract {
|
|
|
30
30
|
#currentBlock;
|
|
31
31
|
constructor(sdk, address) {
|
|
32
32
|
super(sdk, { addr: address, name: "BotListV3", abi });
|
|
33
|
-
this.#currentBlock =
|
|
33
|
+
this.#currentBlock = sdk.provider.chain.firstBlock ?? 0n;
|
|
34
34
|
}
|
|
35
35
|
parseFunctionParams(params) {
|
|
36
36
|
switch (params.functionName) {
|
|
@@ -33,7 +33,6 @@ __export(AddressProviderV300Contract_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(AddressProviderV300Contract_exports);
|
|
34
34
|
var import_viem = require("viem");
|
|
35
35
|
var import_v300 = require("../../../abi/v300.js");
|
|
36
|
-
var import_constants = require("../../constants/index.js");
|
|
37
36
|
var import_viem2 = require("../../utils/viem/index.js");
|
|
38
37
|
var import_AbstractAddressProviderContract = __toESM(require("./AbstractAddressProviderContract.js"));
|
|
39
38
|
const abi = import_v300.iAddressProviderV300Abi;
|
|
@@ -86,7 +85,7 @@ class AddressProviderV300Contract extends import_AbstractAddressProviderContract
|
|
|
86
85
|
}
|
|
87
86
|
}
|
|
88
87
|
async syncState(blockNumber) {
|
|
89
|
-
const fromBlock =
|
|
88
|
+
const fromBlock = this.sdk.provider.chain.firstBlock;
|
|
90
89
|
this.logger?.debug(
|
|
91
90
|
`loading events from block ${fromBlock} to ${blockNumber}`
|
|
92
91
|
);
|
|
@@ -34,7 +34,7 @@ class V300StalenessPeriodPlugin extends import_BasePlugin.BasePlugin {
|
|
|
34
34
|
#events = [];
|
|
35
35
|
set sdk(sdk) {
|
|
36
36
|
super.sdk = sdk;
|
|
37
|
-
this.#syncedTo =
|
|
37
|
+
this.#syncedTo = (sdk.provider.chain.firstBlock ?? 1n) - 1n;
|
|
38
38
|
}
|
|
39
39
|
get sdk() {
|
|
40
40
|
return super.sdk;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { iBotListV300Abi } from "../../abi/v300.js";
|
|
2
2
|
import { BaseContract } from "../base/index.js";
|
|
3
|
-
import {
|
|
4
|
-
ADDRESS_PROVIDER_BLOCK,
|
|
5
|
-
botPermissionsToString
|
|
6
|
-
} from "../constants/index.js";
|
|
3
|
+
import { botPermissionsToString } from "../constants/index.js";
|
|
7
4
|
const abi = iBotListV300Abi;
|
|
8
5
|
class BotListContract extends BaseContract {
|
|
9
6
|
#approvedCreditManagers;
|
|
10
7
|
#currentBlock;
|
|
11
8
|
constructor(sdk, address) {
|
|
12
9
|
super(sdk, { addr: address, name: "BotListV3", abi });
|
|
13
|
-
this.#currentBlock =
|
|
10
|
+
this.#currentBlock = sdk.provider.chain.firstBlock ?? 0n;
|
|
14
11
|
}
|
|
15
12
|
parseFunctionParams(params) {
|
|
16
13
|
switch (params.functionName) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { bytesToString, getAbiItem, parseEventLogs, toBytes } from "viem";
|
|
2
2
|
import { iAddressProviderV300Abi } from "../../../abi/v300.js";
|
|
3
|
-
import { ADDRESS_PROVIDER_BLOCK } from "../../constants/index.js";
|
|
4
3
|
import { getLogsSafe } from "../../utils/viem/index.js";
|
|
5
4
|
import AbstractAddressProviderContract from "./AbstractAddressProviderContract.js";
|
|
6
5
|
const abi = iAddressProviderV300Abi;
|
|
@@ -53,7 +52,7 @@ class AddressProviderV300Contract extends AbstractAddressProviderContract {
|
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
async syncState(blockNumber) {
|
|
56
|
-
const fromBlock =
|
|
55
|
+
const fromBlock = this.sdk.provider.chain.firstBlock;
|
|
57
56
|
this.logger?.debug(
|
|
58
57
|
`loading events from block ${fromBlock} to ${blockNumber}`
|
|
59
58
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getAbiItem, getAddress } from "viem";
|
|
2
2
|
import { iPriceOracleV300Abi } from "../../abi/v300.js";
|
|
3
|
-
import {
|
|
3
|
+
import { isV300 } from "../constants/index.js";
|
|
4
4
|
import { PriceFeedRef } from "../market/index.js";
|
|
5
5
|
import { AddressMap, formatDuration, hexEq } from "../utils/index.js";
|
|
6
6
|
import { getLogsSafe } from "../utils/viem/index.js";
|
|
@@ -11,7 +11,7 @@ class V300StalenessPeriodPlugin extends BasePlugin {
|
|
|
11
11
|
#events = [];
|
|
12
12
|
set sdk(sdk) {
|
|
13
13
|
super.sdk = sdk;
|
|
14
|
-
this.#syncedTo =
|
|
14
|
+
this.#syncedTo = (sdk.provider.chain.firstBlock ?? 1n) - 1n;
|
|
15
15
|
}
|
|
16
16
|
get sdk() {
|
|
17
17
|
return super.sdk;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PublicClient, Transport } from "viem";
|
|
2
2
|
import type { IAddressLabeller } from "../base/IAddressLabeller.js";
|
|
3
|
-
import type { NetworkType } from "./chains.js";
|
|
3
|
+
import type { GearboxChain, NetworkType } from "./chains.js";
|
|
4
4
|
export interface NetworkOptions {
|
|
5
5
|
/**
|
|
6
6
|
* Chain Id needs to be set, because we sometimemes use forked testnets with different chain ids
|
|
@@ -36,7 +36,7 @@ export declare function createTransport(opts: TransportOptions & ConnectionOptio
|
|
|
36
36
|
export declare class Provider {
|
|
37
37
|
#private;
|
|
38
38
|
readonly chainId: number;
|
|
39
|
-
readonly chain:
|
|
39
|
+
readonly chain: GearboxChain;
|
|
40
40
|
readonly networkType: NetworkType;
|
|
41
41
|
readonly addressLabels: IAddressLabeller;
|
|
42
42
|
constructor(opts: NetworkOptions & TransportOptions & ConnectionOptions);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Address, Chain } from "viem";
|
|
2
|
-
import { z } from "zod";
|
|
2
|
+
import { z } from "zod/v4";
|
|
3
3
|
export type Curator = "Chaos Labs" | "K3" | "cp0x" | "Re7";
|
|
4
4
|
export interface GearboxChain extends Chain {
|
|
5
5
|
network: NetworkType;
|
|
@@ -28,7 +28,22 @@ export interface GearboxChain extends Chain {
|
|
|
28
28
|
firstBlock?: bigint;
|
|
29
29
|
}
|
|
30
30
|
export declare const SUPPORTED_NETWORKS: readonly ["Mainnet", "Arbitrum", "Optimism", "Base", "Sonic", "MegaETH", "Monad", "Berachain", "Avalanche", "BNB", "WorldChain", "Etherlink", "Hemi", "Lisk"];
|
|
31
|
-
export declare const NetworkType: z.ZodEnum<
|
|
31
|
+
export declare const NetworkType: z.ZodEnum<{
|
|
32
|
+
Mainnet: "Mainnet";
|
|
33
|
+
Arbitrum: "Arbitrum";
|
|
34
|
+
Optimism: "Optimism";
|
|
35
|
+
Base: "Base";
|
|
36
|
+
Sonic: "Sonic";
|
|
37
|
+
MegaETH: "MegaETH";
|
|
38
|
+
Monad: "Monad";
|
|
39
|
+
Berachain: "Berachain";
|
|
40
|
+
Avalanche: "Avalanche";
|
|
41
|
+
BNB: "BNB";
|
|
42
|
+
WorldChain: "WorldChain";
|
|
43
|
+
Etherlink: "Etherlink";
|
|
44
|
+
Hemi: "Hemi";
|
|
45
|
+
Lisk: "Lisk";
|
|
46
|
+
}>;
|
|
32
47
|
export type NetworkType = z.infer<typeof NetworkType>;
|
|
33
48
|
export declare const chains: Record<NetworkType, GearboxChain>;
|
|
34
49
|
export declare function getChain(chainIdOrNetworkType: number | bigint | NetworkType): GearboxChain;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/sdk",
|
|
3
|
-
"version": "8.6.
|
|
3
|
+
"version": "8.6.1",
|
|
4
4
|
"description": "Gearbox SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/cjs/sdk/index.js",
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
"date-fns": "^4.1.0",
|
|
61
61
|
"decimal.js-light": "^2.5.1",
|
|
62
62
|
"viem": ">=2.23.15 <3.0.0",
|
|
63
|
-
"zod": "^
|
|
63
|
+
"zod": "^4.0.5"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@biomejs/biome": "^2.
|
|
66
|
+
"@biomejs/biome": "^2.1.1",
|
|
67
67
|
"@commitlint/cli": "^19.8.1",
|
|
68
68
|
"@commitlint/config-conventional": "^19.8.1",
|
|
69
69
|
"@gearbox-protocol/biome-config": "^1.0.0",
|