@cfxjs/sirius-next-common 0.4.0 → 0.5.0
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/chunk-6A3FV7ST.js +106 -0
- package/dist/chunk-6A3FV7ST.js.map +1 -0
- package/dist/{chunk-6XQWKKL5.js → chunk-B7IDVT2B.js} +2 -2
- package/dist/{chunk-GGLZLKNJ.js → chunk-H26P76N6.js} +2 -2
- package/dist/{chunk-ZUO2WVSN.js → chunk-HTRUONHE.js} +2 -2
- package/dist/{chunk-EIDH56XO.js → chunk-IVE75CAC.js} +3 -3
- package/dist/{chunk-YL3I4UMA.js → chunk-OGZSZDXL.js} +2 -2
- package/dist/{chunk-RX44WEW6.js → chunk-QBF7EJFY.js} +2 -2
- package/dist/{chunk-OVGNIKRY.js → chunk-SBFEY7I7.js} +74 -4
- package/dist/{chunk-OVGNIKRY.js.map → chunk-SBFEY7I7.js.map} +1 -1
- package/dist/components/AAFailedReason/index.js +3 -2
- package/dist/components/AAFailedReason/index.js.map +1 -1
- package/dist/components/OutputData/ErrorDecode.js +4 -3
- package/dist/components/OutputData/index.js +5 -4
- package/dist/components/TransactionTrace/TraceDetail.js +7 -6
- package/dist/components/TransactionTrace/TreeTraceTable.js +8 -7
- package/dist/components/TransactionTrace/index.js +8 -7
- package/dist/utils/hooks/useDecodeFunctionData.js +3 -2
- package/dist/utils/hooks/useDecodeFunctionError.js +3 -2
- package/dist/utils/hooks/useSimulateTrace.d.ts +3 -1
- package/dist/utils/hooks/useSimulateTrace.js +26 -6
- package/dist/utils/hooks/useSimulateTrace.js.map +1 -1
- package/dist/utils/sdk.d.ts +29 -8
- package/dist/utils/sdk.js +2 -1
- package/dist/utils/transactionLists.d.ts +28 -0
- package/dist/utils/transactionLists.js +14 -0
- package/dist/utils/transactionLists.js.map +1 -0
- package/package.json +2 -2
- /package/dist/{chunk-6XQWKKL5.js.map → chunk-B7IDVT2B.js.map} +0 -0
- /package/dist/{chunk-GGLZLKNJ.js.map → chunk-H26P76N6.js.map} +0 -0
- /package/dist/{chunk-ZUO2WVSN.js.map → chunk-HTRUONHE.js.map} +0 -0
- /package/dist/{chunk-EIDH56XO.js.map → chunk-IVE75CAC.js.map} +0 -0
- /package/dist/{chunk-YL3I4UMA.js.map → chunk-OGZSZDXL.js.map} +0 -0
- /package/dist/{chunk-RX44WEW6.js.map → chunk-QBF7EJFY.js.map} +0 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// src/utils/transactionLists.ts
|
|
2
|
+
var MAX_TRANSACTION_LIST_URL_LENGTH = 128 * 1024;
|
|
3
|
+
var TransactionListError = class extends Error {
|
|
4
|
+
constructor(field, message) {
|
|
5
|
+
super(`${field}: ${message}`);
|
|
6
|
+
this.field = field;
|
|
7
|
+
this.name = "TransactionListError";
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
11
|
+
var isAddress = (value) => typeof value === "string" && /^0x[\da-fA-F]{40}$/.test(value);
|
|
12
|
+
var quantity = (value, bits, name) => {
|
|
13
|
+
if (typeof value !== "string" || !/^0x[\da-fA-F]+$/.test(value) || value.length > 2 + Math.ceil(bits / 4) || BigInt(value) >= 1n << BigInt(bits)) {
|
|
14
|
+
throw new TransactionListError(
|
|
15
|
+
"authorizationList",
|
|
16
|
+
`${name} must be a ${bits}-bit hex quantity`
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
return `0x${BigInt(value).toString(16)}`;
|
|
20
|
+
};
|
|
21
|
+
var normalizeTransactionLists = ({
|
|
22
|
+
accessList,
|
|
23
|
+
authorizationList,
|
|
24
|
+
to
|
|
25
|
+
}) => {
|
|
26
|
+
const result = {};
|
|
27
|
+
if (accessList !== void 0) {
|
|
28
|
+
if (!Array.isArray(accessList)) {
|
|
29
|
+
throw new TransactionListError("accessList", "must be an array");
|
|
30
|
+
}
|
|
31
|
+
result.accessList = accessList.map((entry) => {
|
|
32
|
+
if (!isObject(entry) || !isAddress(entry.address) || !Array.isArray(entry.storageKeys) || !entry.storageKeys.every(
|
|
33
|
+
(key) => typeof key === "string" && /^0x[\da-fA-F]{64}$/.test(key)
|
|
34
|
+
)) {
|
|
35
|
+
throw new TransactionListError(
|
|
36
|
+
"accessList",
|
|
37
|
+
"each entry requires an address and 32-byte storage keys"
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
return { address: entry.address, storageKeys: [...entry.storageKeys] };
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (authorizationList !== void 0) {
|
|
44
|
+
if (!Array.isArray(authorizationList) || authorizationList.length === 0) {
|
|
45
|
+
throw new TransactionListError(
|
|
46
|
+
"authorizationList",
|
|
47
|
+
"must be a non-empty array"
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
if (!isAddress(to)) {
|
|
51
|
+
throw new TransactionListError(
|
|
52
|
+
"authorizationList",
|
|
53
|
+
"requires a to address"
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
result.authorizationList = authorizationList.map((entry) => {
|
|
57
|
+
if (!isObject(entry) || !isAddress(entry.address)) {
|
|
58
|
+
throw new TransactionListError("authorizationList", "invalid address");
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
address: entry.address,
|
|
62
|
+
chainId: quantity(entry.chainId, 256, "chainId"),
|
|
63
|
+
nonce: quantity(entry.nonce, 64, "nonce"),
|
|
64
|
+
yParity: quantity(entry.yParity, 1, "yParity"),
|
|
65
|
+
r: quantity(entry.r, 256, "r"),
|
|
66
|
+
s: quantity(entry.s, 256, "s")
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return result;
|
|
71
|
+
};
|
|
72
|
+
var parseTransactionListsFromUrl = (params) => {
|
|
73
|
+
const parsed = {};
|
|
74
|
+
for (const field of ["accessList", "authorizationList"]) {
|
|
75
|
+
const value = params[field];
|
|
76
|
+
if (value === void 0)
|
|
77
|
+
continue;
|
|
78
|
+
if (typeof value !== "string" || value.length > MAX_TRANSACTION_LIST_URL_LENGTH) {
|
|
79
|
+
return { ok: false, field };
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
parsed[field] = JSON.parse(value);
|
|
83
|
+
} catch {
|
|
84
|
+
return { ok: false, field };
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
try {
|
|
88
|
+
return {
|
|
89
|
+
ok: true,
|
|
90
|
+
lists: normalizeTransactionLists({ ...parsed, to: params.to })
|
|
91
|
+
};
|
|
92
|
+
} catch (error) {
|
|
93
|
+
if (error instanceof TransactionListError) {
|
|
94
|
+
return { ok: false, field: error.field };
|
|
95
|
+
}
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export {
|
|
101
|
+
MAX_TRANSACTION_LIST_URL_LENGTH,
|
|
102
|
+
TransactionListError,
|
|
103
|
+
normalizeTransactionLists,
|
|
104
|
+
parseTransactionListsFromUrl
|
|
105
|
+
};
|
|
106
|
+
//# sourceMappingURL=chunk-6A3FV7ST.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/transactionLists.ts"],"sourcesContent":["import type { AccessList, Hex, RpcAuthorizationList } from 'viem';\n\nexport interface TransactionLists {\n accessList?: AccessList;\n authorizationList?: RpcAuthorizationList;\n}\n\nexport type TransactionListField = keyof TransactionLists;\nexport const MAX_TRANSACTION_LIST_URL_LENGTH = 128 * 1024;\n\nexport class TransactionListError extends Error {\n constructor(\n public readonly field: TransactionListField,\n message: string,\n ) {\n super(`${field}: ${message}`);\n this.name = 'TransactionListError';\n }\n}\n\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\nconst isAddress = (value: unknown): value is Hex =>\n typeof value === 'string' && /^0x[\\da-fA-F]{40}$/.test(value);\n\nconst quantity = (value: unknown, bits: number, name: string): Hex => {\n if (\n typeof value !== 'string' ||\n !/^0x[\\da-fA-F]+$/.test(value) ||\n value.length > 2 + Math.ceil(bits / 4) ||\n BigInt(value) >= 1n << BigInt(bits)\n ) {\n throw new TransactionListError(\n 'authorizationList',\n `${name} must be a ${bits}-bit hex quantity`,\n );\n }\n return `0x${BigInt(value).toString(16)}`;\n};\n\n/** Validate EVM lists and normalize quantities without changing list order. */\nexport const normalizeTransactionLists = ({\n accessList,\n authorizationList,\n to,\n}: {\n accessList?: unknown;\n authorizationList?: unknown;\n to?: unknown;\n}): TransactionLists => {\n const result: TransactionLists = {};\n if (accessList !== undefined) {\n if (!Array.isArray(accessList)) {\n throw new TransactionListError('accessList', 'must be an array');\n }\n result.accessList = accessList.map(entry => {\n if (\n !isObject(entry) ||\n !isAddress(entry.address) ||\n !Array.isArray(entry.storageKeys) ||\n !entry.storageKeys.every(\n key => typeof key === 'string' && /^0x[\\da-fA-F]{64}$/.test(key),\n )\n ) {\n throw new TransactionListError(\n 'accessList',\n 'each entry requires an address and 32-byte storage keys',\n );\n }\n return { address: entry.address, storageKeys: [...entry.storageKeys] };\n });\n }\n if (authorizationList !== undefined) {\n if (!Array.isArray(authorizationList) || authorizationList.length === 0) {\n throw new TransactionListError(\n 'authorizationList',\n 'must be a non-empty array',\n );\n }\n if (!isAddress(to)) {\n throw new TransactionListError(\n 'authorizationList',\n 'requires a to address',\n );\n }\n result.authorizationList = authorizationList.map(entry => {\n if (!isObject(entry) || !isAddress(entry.address)) {\n throw new TransactionListError('authorizationList', 'invalid address');\n }\n return {\n address: entry.address,\n chainId: quantity(entry.chainId, 256, 'chainId'),\n nonce: quantity(entry.nonce, 64, 'nonce'),\n yParity: quantity(entry.yParity, 1, 'yParity'),\n r: quantity(entry.r, 256, 'r'),\n s: quantity(entry.s, 256, 's'),\n };\n });\n }\n return result;\n};\n\n/** URL values must each be a single JSON array, never repeated query keys. */\nexport const parseTransactionListsFromUrl = (\n params: Record<string, unknown>,\n):\n | { ok: true; lists: TransactionLists }\n | { ok: false; field: TransactionListField } => {\n const parsed: Partial<Record<TransactionListField, unknown>> = {};\n for (const field of ['accessList', 'authorizationList'] as const) {\n const value = params[field];\n if (value === undefined) continue;\n if (\n typeof value !== 'string' ||\n value.length > MAX_TRANSACTION_LIST_URL_LENGTH\n ) {\n return { ok: false, field };\n }\n try {\n parsed[field] = JSON.parse(value);\n } catch {\n return { ok: false, field };\n }\n }\n try {\n return {\n ok: true,\n lists: normalizeTransactionLists({ ...parsed, to: params.to }),\n };\n } catch (error) {\n if (error instanceof TransactionListError) {\n return { ok: false, field: error.field };\n }\n throw error;\n }\n};\n"],"mappings":"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","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decodeErrorResult
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SBFEY7I7.js";
|
|
4
4
|
import {
|
|
5
5
|
useContractDetail
|
|
6
6
|
} from "./chunk-2WY3J56A.js";
|
|
@@ -198,4 +198,4 @@ var useDecodeFunctionError = ({
|
|
|
198
198
|
export {
|
|
199
199
|
useDecodeFunctionError
|
|
200
200
|
};
|
|
201
|
-
//# sourceMappingURL=chunk-
|
|
201
|
+
//# sourceMappingURL=chunk-B7IDVT2B.js.map
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "./chunk-GZMSESHY.js";
|
|
13
13
|
import {
|
|
14
14
|
useDecodeFunctionError
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-B7IDVT2B.js";
|
|
16
16
|
import {
|
|
17
17
|
cn
|
|
18
18
|
} from "./chunk-EGXD2GDI.js";
|
|
@@ -91,4 +91,4 @@ var ErrorDecode = ({
|
|
|
91
91
|
export {
|
|
92
92
|
ErrorDecode
|
|
93
93
|
};
|
|
94
|
-
//# sourceMappingURL=chunk-
|
|
94
|
+
//# sourceMappingURL=chunk-H26P76N6.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TraceDetail
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IVE75CAC.js";
|
|
4
4
|
import {
|
|
5
5
|
Table
|
|
6
6
|
} from "./chunk-4WLXG7ZY.js";
|
|
@@ -81,4 +81,4 @@ var TreeTraceTable = ({
|
|
|
81
81
|
export {
|
|
82
82
|
TreeTraceTable
|
|
83
83
|
};
|
|
84
|
-
//# sourceMappingURL=chunk-
|
|
84
|
+
//# sourceMappingURL=chunk-HTRUONHE.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useDecodeFunctionData
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OGZSZDXL.js";
|
|
4
4
|
import {
|
|
5
5
|
useDecodedDataType
|
|
6
6
|
} from "./chunk-UM5J477V.js";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-XJPWKT2J.js";
|
|
10
10
|
import {
|
|
11
11
|
OutputData
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-QBF7EJFY.js";
|
|
13
13
|
import {
|
|
14
14
|
InputData
|
|
15
15
|
} from "./chunk-TIWELXT7.js";
|
|
@@ -189,4 +189,4 @@ var TraceDetail = (props) => {
|
|
|
189
189
|
export {
|
|
190
190
|
TraceDetail
|
|
191
191
|
};
|
|
192
|
-
//# sourceMappingURL=chunk-
|
|
192
|
+
//# sourceMappingURL=chunk-IVE75CAC.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
decodeFunctionData,
|
|
6
6
|
decodeFunctionResult
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SBFEY7I7.js";
|
|
8
8
|
import {
|
|
9
9
|
useContractDetail
|
|
10
10
|
} from "./chunk-2WY3J56A.js";
|
|
@@ -203,4 +203,4 @@ var useDecodeFunctionData = ({
|
|
|
203
203
|
export {
|
|
204
204
|
useDecodeFunctionData
|
|
205
205
|
};
|
|
206
|
-
//# sourceMappingURL=chunk-
|
|
206
|
+
//# sourceMappingURL=chunk-OGZSZDXL.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ErrorDecode
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-H26P76N6.js";
|
|
4
4
|
import {
|
|
5
5
|
Original
|
|
6
6
|
} from "./chunk-XGSBVC7P.js";
|
|
@@ -69,4 +69,4 @@ var OutputData = ({
|
|
|
69
69
|
export {
|
|
70
70
|
OutputData
|
|
71
71
|
};
|
|
72
|
-
//# sourceMappingURL=chunk-
|
|
72
|
+
//# sourceMappingURL=chunk-QBF7EJFY.js.map
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
normalizeTransactionLists
|
|
3
|
+
} from "./chunk-6A3FV7ST.js";
|
|
1
4
|
import {
|
|
2
5
|
LruMap,
|
|
3
6
|
UrlRequiredError,
|
|
@@ -21352,28 +21355,95 @@ function getPublicClient(space) {
|
|
|
21352
21355
|
}
|
|
21353
21356
|
return clientMap[space];
|
|
21354
21357
|
}
|
|
21358
|
+
var getCoreEstimateEpoch = (tag) => {
|
|
21359
|
+
if (tag === void 0)
|
|
21360
|
+
return {};
|
|
21361
|
+
if (tag === "earliest" || tag === "latest_checkpoint" || tag === "latest_confirmed" || tag === "latest_state") {
|
|
21362
|
+
return { epochTag: tag };
|
|
21363
|
+
}
|
|
21364
|
+
if (typeof tag !== "string" || !/^0x[0-9a-fA-F]+$/.test(tag)) {
|
|
21365
|
+
throw new Error("Unsupported Core gas estimation tag");
|
|
21366
|
+
}
|
|
21367
|
+
const epochNumber = BigInt(tag);
|
|
21368
|
+
return epochNumber === 0n ? { epochTag: "earliest" } : { epochNumber };
|
|
21369
|
+
};
|
|
21355
21370
|
var estimateGas = async ({
|
|
21356
21371
|
to,
|
|
21357
21372
|
data,
|
|
21358
21373
|
value,
|
|
21359
21374
|
account,
|
|
21360
|
-
space
|
|
21375
|
+
space,
|
|
21376
|
+
accessList,
|
|
21377
|
+
authorizationList,
|
|
21378
|
+
tag,
|
|
21379
|
+
gasPrice,
|
|
21380
|
+
maxFeePerGas,
|
|
21381
|
+
maxPriorityFeePerGas
|
|
21361
21382
|
}) => {
|
|
21383
|
+
if (space === "core" && authorizationList !== void 0) {
|
|
21384
|
+
throw new Error(
|
|
21385
|
+
"Core Space gas estimation does not support authorizationList"
|
|
21386
|
+
);
|
|
21387
|
+
}
|
|
21362
21388
|
const publicClient = getPublicClient(space);
|
|
21363
21389
|
if (space === "core") {
|
|
21364
21390
|
const res = await publicClient.estimateGasAndCollateral({
|
|
21391
|
+
...getCoreEstimateEpoch(tag),
|
|
21365
21392
|
to,
|
|
21366
21393
|
data,
|
|
21367
21394
|
value: value ? BigInt(value) : void 0,
|
|
21368
|
-
account
|
|
21395
|
+
account,
|
|
21396
|
+
...gasPrice !== void 0 && { gasPrice: BigInt(gasPrice) },
|
|
21397
|
+
...maxFeePerGas !== void 0 && { maxFeePerGas: BigInt(maxFeePerGas) },
|
|
21398
|
+
...maxPriorityFeePerGas !== void 0 && {
|
|
21399
|
+
maxPriorityFeePerGas: BigInt(maxPriorityFeePerGas)
|
|
21400
|
+
},
|
|
21401
|
+
...accessList !== void 0 && {
|
|
21402
|
+
accessList: accessList.map((entry) => ({
|
|
21403
|
+
address: entry.address,
|
|
21404
|
+
storageKeys: [...entry.storageKeys]
|
|
21405
|
+
}))
|
|
21406
|
+
}
|
|
21369
21407
|
});
|
|
21370
21408
|
return res.gasLimit;
|
|
21371
21409
|
}
|
|
21410
|
+
const lists = normalizeTransactionLists({
|
|
21411
|
+
accessList,
|
|
21412
|
+
authorizationList,
|
|
21413
|
+
to
|
|
21414
|
+
});
|
|
21415
|
+
if (authorizationList !== void 0) {
|
|
21416
|
+
const toQuantity = (value2) => value2 === void 0 ? void 0 : `0x${BigInt(value2).toString(16)}`;
|
|
21417
|
+
const gas = await publicClient.request({
|
|
21418
|
+
method: "eth_estimateGas",
|
|
21419
|
+
params: [
|
|
21420
|
+
{
|
|
21421
|
+
from: account,
|
|
21422
|
+
to,
|
|
21423
|
+
data,
|
|
21424
|
+
value: toQuantity(value),
|
|
21425
|
+
gasPrice: toQuantity(gasPrice),
|
|
21426
|
+
maxFeePerGas: toQuantity(maxFeePerGas),
|
|
21427
|
+
maxPriorityFeePerGas: toQuantity(maxPriorityFeePerGas),
|
|
21428
|
+
...lists
|
|
21429
|
+
},
|
|
21430
|
+
tag ?? "latest"
|
|
21431
|
+
]
|
|
21432
|
+
});
|
|
21433
|
+
return BigInt(gas);
|
|
21434
|
+
}
|
|
21372
21435
|
return publicClient.estimateGas({
|
|
21373
21436
|
to,
|
|
21374
21437
|
data,
|
|
21375
21438
|
value: value ? BigInt(value) : void 0,
|
|
21376
|
-
account
|
|
21439
|
+
account,
|
|
21440
|
+
...lists.accessList !== void 0 && { accessList: lists.accessList },
|
|
21441
|
+
...gasPrice !== void 0 && { gasPrice: BigInt(gasPrice) },
|
|
21442
|
+
...maxFeePerGas !== void 0 && { maxFeePerGas: BigInt(maxFeePerGas) },
|
|
21443
|
+
...maxPriorityFeePerGas !== void 0 && {
|
|
21444
|
+
maxPriorityFeePerGas: BigInt(maxPriorityFeePerGas)
|
|
21445
|
+
},
|
|
21446
|
+
...tag === void 0 ? {} : tag.startsWith("0x") ? { blockNumber: BigInt(tag) } : { blockTag: tag }
|
|
21377
21447
|
});
|
|
21378
21448
|
};
|
|
21379
21449
|
var simulateContract2 = ({
|
|
@@ -21487,4 +21557,4 @@ export {
|
|
|
21487
21557
|
decodeFunctionResult3 as decodeFunctionResult,
|
|
21488
21558
|
decodeErrorResult3 as decodeErrorResult
|
|
21489
21559
|
};
|
|
21490
|
-
//# sourceMappingURL=chunk-
|
|
21560
|
+
//# sourceMappingURL=chunk-SBFEY7I7.js.map
|