@gearbox-protocol/sdk 12.6.0 → 12.6.2

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.
@@ -148,12 +148,16 @@ class AccountOpener extends import_sdk.SDKConstruct {
148
148
  success += result.account ? 1 : 0;
149
149
  if (result.error) {
150
150
  this.#logger?.error(
151
- `failed to open account #${i + 1}/${targets.length}: ${result.error}`
151
+ new Error(`failed to open account #${i + 1}/${targets.length}`, {
152
+ cause: result.error
153
+ })
152
154
  );
153
155
  }
154
156
  } catch (e) {
155
157
  this.#logger?.error(
156
- `failed to open account #${i + 1}/${targets.length}: ${e}`
158
+ new Error(`failed to open account #${i + 1}/${targets.length}`, {
159
+ cause: e
160
+ })
157
161
  );
158
162
  accounts.push({
159
163
  input: target,
@@ -315,7 +315,7 @@ class GearboxSDK extends import_base.ChainContractsRegister {
315
315
  stateHuman(raw = true) {
316
316
  return {
317
317
  block: Number(this.currentBlock),
318
- timestamp: Number(this.timestamp),
318
+ timestamp: (0, import_utils.formatTimestamp)(Number(this.timestamp), raw),
319
319
  core: {
320
320
  addressProviderV3: this.addressProvider.stateHuman(raw),
321
321
  botList: this.botListContract?.stateHuman(raw),
@@ -122,11 +122,12 @@ function formatDuration(seconds, raw = true) {
122
122
  function formatNumberToString_(value) {
123
123
  return value.toLocaleString("en-US", { minimumIntegerDigits: 1, useGrouping: true }).replaceAll(",", "_");
124
124
  }
125
- function formatTimestamp(timestamp) {
126
- return new Date(timestamp * 1e3).toLocaleString("en-GB", {
125
+ function formatTimestamp(timestamp, raw = true) {
126
+ const result = new Date(timestamp * 1e3).toLocaleString("en-GB", {
127
127
  dateStyle: "short",
128
128
  timeStyle: "short"
129
129
  });
130
+ return raw ? `${result} [${timestamp}]` : result;
130
131
  }
131
132
  // Annotate the CommonJS export names for ESM import in node:
132
133
  0 && (module.exports = {
@@ -139,12 +139,16 @@ class AccountOpener extends SDKConstruct {
139
139
  success += result.account ? 1 : 0;
140
140
  if (result.error) {
141
141
  this.#logger?.error(
142
- `failed to open account #${i + 1}/${targets.length}: ${result.error}`
142
+ new Error(`failed to open account #${i + 1}/${targets.length}`, {
143
+ cause: result.error
144
+ })
143
145
  );
144
146
  }
145
147
  } catch (e) {
146
148
  this.#logger?.error(
147
- `failed to open account #${i + 1}/${targets.length}: ${e}`
149
+ new Error(`failed to open account #${i + 1}/${targets.length}`, {
150
+ cause: e
151
+ })
148
152
  );
149
153
  accounts.push({
150
154
  input: target,
@@ -30,7 +30,7 @@ import {
30
30
  PluginStateVersionError
31
31
  } from "./plugins/index.js";
32
32
  import { createRouter } from "./router/index.js";
33
- import { TypedObjectUtils, toAddress } from "./utils/index.js";
33
+ import { formatTimestamp, TypedObjectUtils, toAddress } from "./utils/index.js";
34
34
  import { Hooks } from "./utils/internal/index.js";
35
35
  import { getLogsSafe } from "./utils/viem/index.js";
36
36
  const ERR_NOT_ATTACHED = new Error("Gearbox SDK not attached");
@@ -314,7 +314,7 @@ class GearboxSDK extends ChainContractsRegister {
314
314
  stateHuman(raw = true) {
315
315
  return {
316
316
  block: Number(this.currentBlock),
317
- timestamp: Number(this.timestamp),
317
+ timestamp: formatTimestamp(Number(this.timestamp), raw),
318
318
  core: {
319
319
  addressProviderV3: this.addressProvider.stateHuman(raw),
320
320
  botList: this.botListContract?.stateHuman(raw),
@@ -91,11 +91,12 @@ function formatDuration(seconds, raw = true) {
91
91
  function formatNumberToString_(value) {
92
92
  return value.toLocaleString("en-US", { minimumIntegerDigits: 1, useGrouping: true }).replaceAll(",", "_");
93
93
  }
94
- function formatTimestamp(timestamp) {
95
- return new Date(timestamp * 1e3).toLocaleString("en-GB", {
94
+ function formatTimestamp(timestamp, raw = true) {
95
+ const result = new Date(timestamp * 1e3).toLocaleString("en-GB", {
96
96
  dateStyle: "short",
97
97
  timeStyle: "short"
98
98
  });
99
+ return raw ? `${result} [${timestamp}]` : result;
99
100
  }
100
101
  export {
101
102
  fmtBinaryMask,
@@ -196,7 +196,7 @@ export interface MarketStateHuman {
196
196
  }
197
197
  export interface GearboxStateHuman {
198
198
  block: number;
199
- timestamp: number;
199
+ timestamp: string;
200
200
  core: CoreStateHuman;
201
201
  markets: MarketStateHuman[];
202
202
  plugins: Record<string, unknown>;
@@ -9,4 +9,4 @@ export declare function fmtBinaryMask(mask: bigint): string;
9
9
  export declare function numberWithCommas(x: number | bigint): string;
10
10
  export declare function formatDuration(seconds: number, raw?: boolean): string;
11
11
  export declare function formatNumberToString_(value: bigint | number): string;
12
- export declare function formatTimestamp(timestamp: number): string;
12
+ export declare function formatTimestamp(timestamp: number, raw?: boolean): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "12.6.0",
3
+ "version": "12.6.2",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",
@@ -63,25 +63,25 @@
63
63
  "date-fns": "^4.1.0",
64
64
  "decimal.js-light": "^2.5.1",
65
65
  "viem": ">=2.23.15 <3.0.0",
66
- "zod": "^4.3.5"
66
+ "zod": "^4.3.6"
67
67
  },
68
68
  "devDependencies": {
69
- "@biomejs/biome": "^2.3.11",
70
- "@commitlint/cli": "^20.3.0",
71
- "@commitlint/config-conventional": "^20.3.0",
72
- "@gearbox-protocol/biome-config": "^1.0.17",
69
+ "@biomejs/biome": "^2.3.13",
70
+ "@commitlint/cli": "^20.3.1",
71
+ "@commitlint/config-conventional": "^20.3.1",
72
+ "@gearbox-protocol/biome-config": "^1.0.19",
73
73
  "@types/cross-spawn": "^6.0.6",
74
- "axios": "^1.13.2",
74
+ "axios": "^1.13.3",
75
75
  "cross-spawn": "^7.0.6",
76
76
  "husky": "^9.1.7",
77
77
  "lint-staged": "^16.2.7",
78
- "pino": "^10.1.0",
78
+ "pino": "^10.3.0",
79
79
  "pino-pretty": "^13.1.3",
80
80
  "tsup": "^8.5.1",
81
81
  "tsx": "^4.21.0",
82
82
  "typescript": "^5.9.3",
83
83
  "viem-deal": "^2.0.4",
84
- "vitest": "^4.0.16"
84
+ "vitest": "^4.0.18"
85
85
  },
86
86
  "peerDependencies": {
87
87
  "axios": "^1.0.0",