@gearbox-protocol/sdk 12.3.0 → 12.3.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/permissionless/bindings/governance/governor.js +3 -4
- package/dist/cjs/permissionless/utils/format.js +0 -8
- package/dist/cjs/sdk/market/credit/CreditFacadeV300Contract.js +1 -1
- package/dist/cjs/sdk/market/credit/CreditFacadeV310Contract.js +1 -1
- package/dist/cjs/sdk/utils/formatter.js +8 -0
- package/dist/esm/permissionless/bindings/governance/governor.js +5 -2
- package/dist/esm/permissionless/utils/format.js +0 -7
- package/dist/esm/sdk/market/credit/CreditFacadeV300Contract.js +6 -2
- package/dist/esm/sdk/market/credit/CreditFacadeV310Contract.js +6 -2
- package/dist/esm/sdk/utils/formatter.js +7 -0
- package/dist/types/permissionless/utils/format.d.ts +0 -1
- package/dist/types/sdk/types/state-human.d.ts +1 -1
- package/dist/types/sdk/utils/formatter.d.ts +1 -0
- package/package.json +1 -1
|
@@ -25,7 +25,6 @@ var import_viem = require("viem");
|
|
|
25
25
|
var import_utils = require("viem/utils");
|
|
26
26
|
var import_governor = require("../../../abi/governance/governor.js");
|
|
27
27
|
var import_sdk = require("../../../sdk/index.js");
|
|
28
|
-
var import_utils2 = require("../../utils/index.js");
|
|
29
28
|
var import_market_configurator = require("../market-configurator.js");
|
|
30
29
|
var import_treasury_splitter = require("../treasury-splitter.js");
|
|
31
30
|
var import_batches_chain = require("./batches-chain.js");
|
|
@@ -177,7 +176,7 @@ class GovernorContract extends import_sdk.BaseContract {
|
|
|
177
176
|
case "startBatch": {
|
|
178
177
|
const [eta] = args;
|
|
179
178
|
return {
|
|
180
|
-
eta: (0,
|
|
179
|
+
eta: (0, import_sdk.formatTimestamp)(Number(eta))
|
|
181
180
|
};
|
|
182
181
|
}
|
|
183
182
|
case "queueTransaction": {
|
|
@@ -190,7 +189,7 @@ class GovernorContract extends import_sdk.BaseContract {
|
|
|
190
189
|
data: (0, import_sdk.json_stringify)(
|
|
191
190
|
this.#decodeFunctionData(target, calldata)?.args ?? calldata
|
|
192
191
|
),
|
|
193
|
-
eta: (0,
|
|
192
|
+
eta: (0, import_sdk.formatTimestamp)(Number(eta))
|
|
194
193
|
};
|
|
195
194
|
}
|
|
196
195
|
case "executeBatch": {
|
|
@@ -207,7 +206,7 @@ class GovernorContract extends import_sdk.BaseContract {
|
|
|
207
206
|
data: (0, import_sdk.json_stringify)(
|
|
208
207
|
this.#decodeFunctionData(target, calldata)?.args ?? calldata
|
|
209
208
|
),
|
|
210
|
-
eta: (0,
|
|
209
|
+
eta: (0, import_sdk.formatTimestamp)(Number(eta))
|
|
211
210
|
};
|
|
212
211
|
})
|
|
213
212
|
)
|
|
@@ -22,7 +22,6 @@ __export(format_exports, {
|
|
|
22
22
|
deepJsonParse: () => deepJsonParse,
|
|
23
23
|
formatBytecodeSize: () => formatBytecodeSize,
|
|
24
24
|
formatBytecodeVersion: () => formatBytecodeVersion,
|
|
25
|
-
formatTimestamp: () => formatTimestamp,
|
|
26
25
|
shortenHash: () => shortenHash,
|
|
27
26
|
significantTrunc: () => significantTrunc
|
|
28
27
|
});
|
|
@@ -38,12 +37,6 @@ function formatBytecodeVersion(version) {
|
|
|
38
37
|
const patch = version % 10;
|
|
39
38
|
return `v${major}.${minor}.${patch}`;
|
|
40
39
|
}
|
|
41
|
-
function formatTimestamp(timestamp) {
|
|
42
|
-
return new Date(timestamp * 1e3).toLocaleString("en-GB", {
|
|
43
|
-
dateStyle: "short",
|
|
44
|
-
timeStyle: "short"
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
40
|
function shortenHash(hash, chars = 4) {
|
|
48
41
|
if (!hash) return "";
|
|
49
42
|
const start = hash.slice(0, chars + 2);
|
|
@@ -91,7 +84,6 @@ function deepJsonParse(value) {
|
|
|
91
84
|
deepJsonParse,
|
|
92
85
|
formatBytecodeSize,
|
|
93
86
|
formatBytecodeVersion,
|
|
94
|
-
formatTimestamp,
|
|
95
87
|
shortenHash,
|
|
96
88
|
significantTrunc
|
|
97
89
|
});
|
|
@@ -50,7 +50,7 @@ class CreditFacadeV300Contract extends import_base.BaseContract {
|
|
|
50
50
|
expirable: this.expirable,
|
|
51
51
|
isDegenMode: this.degenNFT !== import_constants.ADDRESS_0X0,
|
|
52
52
|
degenNFT: this.labelAddress(this.degenNFT),
|
|
53
|
-
expirationDate: this.expirationDate,
|
|
53
|
+
expirationDate: (0, import_utils.formatTimestamp)(this.expirationDate),
|
|
54
54
|
maxDebtPerBlockMultiplier: this.maxDebtPerBlockMultiplier,
|
|
55
55
|
botList: this.labelAddress(this.botList),
|
|
56
56
|
minDebt: (0, import_utils.formatBNvalue)(this.minDebt, decimals),
|
|
@@ -50,7 +50,7 @@ class CreditFacadeV310Contract extends import_base.BaseContract {
|
|
|
50
50
|
expirable: this.expirable,
|
|
51
51
|
isDegenMode: this.degenNFT !== import_constants.ADDRESS_0X0,
|
|
52
52
|
degenNFT: this.labelAddress(this.degenNFT),
|
|
53
|
-
expirationDate: this.expirationDate,
|
|
53
|
+
expirationDate: (0, import_utils.formatTimestamp)(this.expirationDate),
|
|
54
54
|
maxDebtPerBlockMultiplier: this.maxDebtPerBlockMultiplier,
|
|
55
55
|
botList: this.labelAddress(this.botList),
|
|
56
56
|
minDebt: (0, import_utils.formatBNvalue)(this.minDebt, decimals),
|
|
@@ -23,6 +23,7 @@ __export(formatter_exports, {
|
|
|
23
23
|
formatBNvalue: () => formatBNvalue,
|
|
24
24
|
formatDuration: () => formatDuration,
|
|
25
25
|
formatNumberToString_: () => formatNumberToString_,
|
|
26
|
+
formatTimestamp: () => formatTimestamp,
|
|
26
27
|
numberWithCommas: () => numberWithCommas,
|
|
27
28
|
percentFmt: () => percentFmt,
|
|
28
29
|
toBigInt: () => toBigInt
|
|
@@ -121,6 +122,12 @@ function formatDuration(seconds, raw = true) {
|
|
|
121
122
|
function formatNumberToString_(value) {
|
|
122
123
|
return value.toLocaleString("en-US", { minimumIntegerDigits: 1, useGrouping: true }).replaceAll(",", "_");
|
|
123
124
|
}
|
|
125
|
+
function formatTimestamp(timestamp) {
|
|
126
|
+
return new Date(timestamp * 1e3).toLocaleString("en-GB", {
|
|
127
|
+
dateStyle: "short",
|
|
128
|
+
timeStyle: "short"
|
|
129
|
+
});
|
|
130
|
+
}
|
|
124
131
|
// Annotate the CommonJS export names for ESM import in node:
|
|
125
132
|
0 && (module.exports = {
|
|
126
133
|
fmtBinaryMask,
|
|
@@ -128,6 +135,7 @@ function formatNumberToString_(value) {
|
|
|
128
135
|
formatBNvalue,
|
|
129
136
|
formatDuration,
|
|
130
137
|
formatNumberToString_,
|
|
138
|
+
formatTimestamp,
|
|
131
139
|
numberWithCommas,
|
|
132
140
|
percentFmt,
|
|
133
141
|
toBigInt
|
|
@@ -6,8 +6,11 @@ import {
|
|
|
6
6
|
} from "viem";
|
|
7
7
|
import { formatAbiItem } from "viem/utils";
|
|
8
8
|
import { governorAbi } from "../../../abi/governance/governor.js";
|
|
9
|
-
import {
|
|
10
|
-
|
|
9
|
+
import {
|
|
10
|
+
BaseContract,
|
|
11
|
+
formatTimestamp,
|
|
12
|
+
json_stringify
|
|
13
|
+
} from "../../../sdk/index.js";
|
|
11
14
|
import { MarketConfiguratorContract } from "../market-configurator.js";
|
|
12
15
|
import { TreasurySplitterContract } from "../treasury-splitter.js";
|
|
13
16
|
import { BatchesChainContract } from "./batches-chain.js";
|
|
@@ -9,12 +9,6 @@ function formatBytecodeVersion(version) {
|
|
|
9
9
|
const patch = version % 10;
|
|
10
10
|
return `v${major}.${minor}.${patch}`;
|
|
11
11
|
}
|
|
12
|
-
function formatTimestamp(timestamp) {
|
|
13
|
-
return new Date(timestamp * 1e3).toLocaleString("en-GB", {
|
|
14
|
-
dateStyle: "short",
|
|
15
|
-
timeStyle: "short"
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
12
|
function shortenHash(hash, chars = 4) {
|
|
19
13
|
if (!hash) return "";
|
|
20
14
|
const start = hash.slice(0, chars + 2);
|
|
@@ -61,7 +55,6 @@ export {
|
|
|
61
55
|
deepJsonParse,
|
|
62
56
|
formatBytecodeSize,
|
|
63
57
|
formatBytecodeVersion,
|
|
64
|
-
formatTimestamp,
|
|
65
58
|
shortenHash,
|
|
66
59
|
significantTrunc
|
|
67
60
|
};
|
|
@@ -5,7 +5,11 @@ import {
|
|
|
5
5
|
} from "../../../abi/v300.js";
|
|
6
6
|
import { BaseContract } from "../../base/index.js";
|
|
7
7
|
import { ADDRESS_0X0 } from "../../constants/index.js";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
fmtBinaryMask,
|
|
10
|
+
formatBNvalue,
|
|
11
|
+
formatTimestamp
|
|
12
|
+
} from "../../utils/index.js";
|
|
9
13
|
const abi = [
|
|
10
14
|
...iCreditFacadeV300Abi,
|
|
11
15
|
...iCreditFacadeV300MulticallAbi,
|
|
@@ -30,7 +34,7 @@ class CreditFacadeV300Contract extends BaseContract {
|
|
|
30
34
|
expirable: this.expirable,
|
|
31
35
|
isDegenMode: this.degenNFT !== ADDRESS_0X0,
|
|
32
36
|
degenNFT: this.labelAddress(this.degenNFT),
|
|
33
|
-
expirationDate: this.expirationDate,
|
|
37
|
+
expirationDate: formatTimestamp(this.expirationDate),
|
|
34
38
|
maxDebtPerBlockMultiplier: this.maxDebtPerBlockMultiplier,
|
|
35
39
|
botList: this.labelAddress(this.botList),
|
|
36
40
|
minDebt: formatBNvalue(this.minDebt, decimals),
|
|
@@ -5,7 +5,11 @@ import {
|
|
|
5
5
|
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
6
6
|
import { BaseContract } from "../../base/index.js";
|
|
7
7
|
import { ADDRESS_0X0 } from "../../constants/index.js";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
fmtBinaryMask,
|
|
10
|
+
formatBNvalue,
|
|
11
|
+
formatTimestamp
|
|
12
|
+
} from "../../utils/index.js";
|
|
9
13
|
const abi = [
|
|
10
14
|
...iCreditFacadeV310Abi,
|
|
11
15
|
...iCreditFacadeMulticallV310Abi,
|
|
@@ -30,7 +34,7 @@ class CreditFacadeV310Contract extends BaseContract {
|
|
|
30
34
|
expirable: this.expirable,
|
|
31
35
|
isDegenMode: this.degenNFT !== ADDRESS_0X0,
|
|
32
36
|
degenNFT: this.labelAddress(this.degenNFT),
|
|
33
|
-
expirationDate: this.expirationDate,
|
|
37
|
+
expirationDate: formatTimestamp(this.expirationDate),
|
|
34
38
|
maxDebtPerBlockMultiplier: this.maxDebtPerBlockMultiplier,
|
|
35
39
|
botList: this.labelAddress(this.botList),
|
|
36
40
|
minDebt: formatBNvalue(this.minDebt, decimals),
|
|
@@ -91,12 +91,19 @@ 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", {
|
|
96
|
+
dateStyle: "short",
|
|
97
|
+
timeStyle: "short"
|
|
98
|
+
});
|
|
99
|
+
}
|
|
94
100
|
export {
|
|
95
101
|
fmtBinaryMask,
|
|
96
102
|
formatBN,
|
|
97
103
|
formatBNvalue,
|
|
98
104
|
formatDuration,
|
|
99
105
|
formatNumberToString_,
|
|
106
|
+
formatTimestamp,
|
|
100
107
|
numberWithCommas,
|
|
101
108
|
percentFmt,
|
|
102
109
|
toBigInt
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export declare function formatBytecodeSize(size: number): string;
|
|
2
2
|
export declare function formatBytecodeVersion(version: number): string;
|
|
3
|
-
export declare function formatTimestamp(timestamp: number): string;
|
|
4
3
|
export declare function shortenHash(hash: string, chars?: number): string;
|
|
5
4
|
export declare function convertPercent(percent: number): number;
|
|
6
5
|
export declare function significantTrunc(x: number): string;
|
|
@@ -72,7 +72,7 @@ export interface CreditFacadeStateHuman extends BaseContractStateHuman {
|
|
|
72
72
|
expirable: boolean;
|
|
73
73
|
isDegenMode: boolean;
|
|
74
74
|
degenNFT: string;
|
|
75
|
-
expirationDate:
|
|
75
|
+
expirationDate: string;
|
|
76
76
|
maxDebtPerBlockMultiplier: number;
|
|
77
77
|
botList: string;
|
|
78
78
|
minDebt: string;
|
|
@@ -9,3 +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;
|