@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.
- package/dist/cjs/dev/AccountOpener.js +6 -2
- package/dist/cjs/sdk/GearboxSDK.js +1 -1
- package/dist/cjs/sdk/utils/formatter.js +3 -2
- package/dist/esm/dev/AccountOpener.js +6 -2
- package/dist/esm/sdk/GearboxSDK.js +2 -2
- package/dist/esm/sdk/utils/formatter.js +3 -2
- package/dist/types/sdk/types/state-human.d.ts +1 -1
- package/dist/types/sdk/utils/formatter.d.ts +1 -1
- package/package.json +9 -9
|
@@ -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}
|
|
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}
|
|
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
|
-
|
|
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}
|
|
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}
|
|
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
|
-
|
|
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,
|
|
@@ -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.
|
|
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.
|
|
66
|
+
"zod": "^4.3.6"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@biomejs/biome": "^2.3.
|
|
70
|
-
"@commitlint/cli": "^20.3.
|
|
71
|
-
"@commitlint/config-conventional": "^20.3.
|
|
72
|
-
"@gearbox-protocol/biome-config": "^1.0.
|
|
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.
|
|
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.
|
|
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.
|
|
84
|
+
"vitest": "^4.0.18"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"axios": "^1.0.0",
|