@gearbox-protocol/sdk 10.7.1 → 10.7.3
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/RevolverTransport.js +6 -8
- package/dist/cjs/permissionless/bindings/bytecode-repository.js +11 -0
- package/dist/esm/dev/RevolverTransport.js +6 -9
- package/dist/esm/permissionless/bindings/bytecode-repository.js +11 -0
- package/dist/types/permissionless/bindings/bytecode-repository.d.ts +2 -0
- package/dist/types/permissionless/core/bytecode.d.ts +0 -15
- package/package.json +1 -1
|
@@ -184,20 +184,18 @@ const retryCodes = /* @__PURE__ */ new Set([
|
|
|
184
184
|
const defaultShouldRetry = ({
|
|
185
185
|
error
|
|
186
186
|
}) => {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
187
|
+
if ("code" in error && typeof error.code === "number") {
|
|
188
|
+
return retryCodes.has(error.code);
|
|
189
|
+
}
|
|
190
|
+
const msg = error.message?.toLowerCase() ?? `${error}`.toLowerCase();
|
|
191
|
+
if ([
|
|
191
192
|
"unknown block",
|
|
192
193
|
"header not found",
|
|
193
194
|
"resource unavailable",
|
|
194
195
|
"requested resource not available"
|
|
195
|
-
].some((s) =>
|
|
196
|
+
].some((s) => msg.includes(s))) {
|
|
196
197
|
return true;
|
|
197
198
|
}
|
|
198
|
-
if ("code" in error && typeof error.code === "number") {
|
|
199
|
-
return retryCodes.has(error.code);
|
|
200
|
-
}
|
|
201
199
|
return false;
|
|
202
200
|
};
|
|
203
201
|
class AbstractTransportSelector {
|
|
@@ -51,11 +51,22 @@ class BytecodeRepositoryContract extends import_base_contract.BaseContract {
|
|
|
51
51
|
(0, import_viem.stringToHex)(type_, { size: 32 })
|
|
52
52
|
]);
|
|
53
53
|
}
|
|
54
|
+
async getAllowedBytecodeHash(type_, version) {
|
|
55
|
+
return await this.contract.read.getAllowedBytecodeHash([
|
|
56
|
+
(0, import_viem.stringToHex)(type_, { size: 32 }),
|
|
57
|
+
BigInt(version)
|
|
58
|
+
]);
|
|
59
|
+
}
|
|
54
60
|
async isPublicDomain(domain) {
|
|
55
61
|
return await this.contract.read.isPublicDomain([
|
|
56
62
|
(0, import_viem.stringToHex)(domain, { size: 32 })
|
|
57
63
|
]);
|
|
58
64
|
}
|
|
65
|
+
async isSystemDomain(domain) {
|
|
66
|
+
return await this.contract.read.isSystemDomain([
|
|
67
|
+
(0, import_viem.stringToHex)(domain, { size: 32 })
|
|
68
|
+
]);
|
|
69
|
+
}
|
|
59
70
|
// // Write functions
|
|
60
71
|
// async uploadBytecode(bytecode: Bytecode) {
|
|
61
72
|
// return await this.contract.write.uploadBytecode([bytecode]);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseError,
|
|
3
|
-
CallExecutionError,
|
|
4
3
|
HttpRequestError,
|
|
5
4
|
http,
|
|
6
5
|
InvalidInputRpcError,
|
|
@@ -172,20 +171,18 @@ const retryCodes = /* @__PURE__ */ new Set([
|
|
|
172
171
|
const defaultShouldRetry = ({
|
|
173
172
|
error
|
|
174
173
|
}) => {
|
|
175
|
-
|
|
176
|
-
(
|
|
177
|
-
|
|
178
|
-
|
|
174
|
+
if ("code" in error && typeof error.code === "number") {
|
|
175
|
+
return retryCodes.has(error.code);
|
|
176
|
+
}
|
|
177
|
+
const msg = error.message?.toLowerCase() ?? `${error}`.toLowerCase();
|
|
178
|
+
if ([
|
|
179
179
|
"unknown block",
|
|
180
180
|
"header not found",
|
|
181
181
|
"resource unavailable",
|
|
182
182
|
"requested resource not available"
|
|
183
|
-
].some((s) =>
|
|
183
|
+
].some((s) => msg.includes(s))) {
|
|
184
184
|
return true;
|
|
185
185
|
}
|
|
186
|
-
if ("code" in error && typeof error.code === "number") {
|
|
187
|
-
return retryCodes.has(error.code);
|
|
188
|
-
}
|
|
189
186
|
return false;
|
|
190
187
|
};
|
|
191
188
|
class AbstractTransportSelector {
|
|
@@ -34,11 +34,22 @@ class BytecodeRepositoryContract extends BaseContract {
|
|
|
34
34
|
stringToHex(type_, { size: 32 })
|
|
35
35
|
]);
|
|
36
36
|
}
|
|
37
|
+
async getAllowedBytecodeHash(type_, version) {
|
|
38
|
+
return await this.contract.read.getAllowedBytecodeHash([
|
|
39
|
+
stringToHex(type_, { size: 32 }),
|
|
40
|
+
BigInt(version)
|
|
41
|
+
]);
|
|
42
|
+
}
|
|
37
43
|
async isPublicDomain(domain) {
|
|
38
44
|
return await this.contract.read.isPublicDomain([
|
|
39
45
|
stringToHex(domain, { size: 32 })
|
|
40
46
|
]);
|
|
41
47
|
}
|
|
48
|
+
async isSystemDomain(domain) {
|
|
49
|
+
return await this.contract.read.isSystemDomain([
|
|
50
|
+
stringToHex(domain, { size: 32 })
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
42
53
|
// // Write functions
|
|
43
54
|
// async uploadBytecode(bytecode: Bytecode) {
|
|
44
55
|
// return await this.contract.write.uploadBytecode([bytecode]);
|
|
@@ -1169,7 +1169,9 @@ export declare class BytecodeRepositoryContract extends BaseContract<typeof abi>
|
|
|
1169
1169
|
isBytecodeUploaded(hash: `0x${string}`): Promise<boolean>;
|
|
1170
1170
|
isBytecodeAudited(hash: `0x${string}`): Promise<boolean>;
|
|
1171
1171
|
getLatestVersion(type_: string): Promise<bigint>;
|
|
1172
|
+
getAllowedBytecodeHash(type_: string, version: number): Promise<Hex>;
|
|
1172
1173
|
isPublicDomain(domain: string): Promise<boolean>;
|
|
1174
|
+
isSystemDomain(domain: string): Promise<boolean>;
|
|
1173
1175
|
getUploadBytecodeEvents(fromBlock: bigint, toBlock: bigint, chunkSize?: number): Promise<Omit<Bytecode, "uploadedAt">[]>;
|
|
1174
1176
|
getAddAuditorEvents(fromBlock: bigint, toBlock: bigint): Promise<Auditor[]>;
|
|
1175
1177
|
getDeployContractEvents(fromBlock: bigint, toBlock: bigint): Promise<Omit<DeploymentExtended, "timestamp">[]>;
|
|
@@ -11,21 +11,6 @@ export interface Bytecode {
|
|
|
11
11
|
transactionHash: Hex;
|
|
12
12
|
blockNumber: number;
|
|
13
13
|
}
|
|
14
|
-
export interface BytecodeShort extends Omit<Bytecode, "initCode" | "transactionHash" | "blockNumber" | "source" | "author"> {
|
|
15
|
-
auditorNames: string[];
|
|
16
|
-
}
|
|
17
|
-
export interface BytecodeExtended extends Bytecode {
|
|
18
|
-
verificationData?: unknown;
|
|
19
|
-
deployments: Deployment[];
|
|
20
|
-
audits: Audit[];
|
|
21
|
-
}
|
|
22
|
-
export interface Audit {
|
|
23
|
-
report: string;
|
|
24
|
-
auditor: Address;
|
|
25
|
-
auditorName: string;
|
|
26
|
-
isAuditorRemoved: boolean;
|
|
27
|
-
timestamp: number;
|
|
28
|
-
}
|
|
29
14
|
export interface AuditEvent {
|
|
30
15
|
reportUrl: string;
|
|
31
16
|
auditor: Address;
|