@cfxjs/sirius-next-common 0.3.2 → 0.3.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/{chunk-SFULLYYL.js → chunk-32HFN5MP.js} +3 -3
- package/dist/{chunk-CMM72NR3.js → chunk-47HU5DGL.js} +2 -2
- package/dist/{chunk-I6OWD4P4.js → chunk-4DX7CRRE.js} +7 -7
- package/dist/{chunk-D6INJ4N5.js → chunk-4TF33JZW.js} +2 -2
- package/dist/{chunk-2FGJPE3T.js → chunk-5OYITIUX.js} +5 -5
- package/dist/{chunk-IKPPUNBU.js → chunk-6H5XKOXM.js} +2 -2
- package/dist/{chunk-A64ILFRR.js → chunk-7NFRRT77.js} +4 -4
- package/dist/{chunk-7NVZPYT3.js → chunk-7U24RYWX.js} +2 -2
- package/dist/{chunk-IXMDBWQH.js → chunk-DHTXUMRS.js} +2 -2
- package/dist/{chunk-2KJLNPUL.js → chunk-EJDYTF4C.js} +6 -6
- package/dist/{chunk-FLFDRCTI.js → chunk-FYDF5QZ6.js} +3 -3
- package/dist/{chunk-FLFDRCTI.js.map → chunk-FYDF5QZ6.js.map} +1 -1
- package/dist/{chunk-SEIHZVZU.js → chunk-GC3XWDVL.js} +2 -2
- package/dist/{chunk-4AAV4RRZ.js → chunk-GRPL5QSE.js} +5 -5
- package/dist/{chunk-FBGAFVDW.js → chunk-GYK2VPUW.js} +5 -5
- package/dist/{chunk-SCTG3SCG.js → chunk-HU3XDAH5.js} +2 -2
- package/dist/{chunk-CWTDFCRF.js → chunk-HUBXGHJC.js} +3 -3
- package/dist/{chunk-7BAN6GKP.js → chunk-K6M3ZRL6.js} +3 -3
- package/dist/{chunk-VYI4IZMQ.js → chunk-LDCBSWPD.js} +2 -2
- package/dist/{chunk-NSSKV676.js → chunk-LJUDPQQ6.js} +3 -3
- package/dist/{chunk-G56ZGF4A.js → chunk-NC5OXZ7Z.js} +2 -2
- package/dist/{chunk-NAHXYZZO.js → chunk-NUKWAN7M.js} +2 -2
- package/dist/{chunk-2MY3T2VH.js → chunk-NZVJYR5B.js} +4 -2
- package/dist/{chunk-2MY3T2VH.js.map → chunk-NZVJYR5B.js.map} +1 -1
- package/dist/{chunk-IIXNSHSS.js → chunk-OO5UHQV4.js} +5 -5
- package/dist/{chunk-A3VDKIWS.js → chunk-PJHNQX2G.js} +2 -2
- package/dist/{chunk-6JLI3Y4J.js → chunk-PYDEMSMB.js} +3 -3
- package/dist/{chunk-QFIJS6P3.js → chunk-RHW2TVMC.js} +5 -5
- package/dist/{chunk-YNRXB6J7.js → chunk-RMFJW6N6.js} +2 -2
- package/dist/{chunk-LB2T7W2A.js → chunk-ST5N4WQW.js} +3 -3
- package/dist/{chunk-EZVQ6JRV.js → chunk-UVKAL7G5.js} +3 -3
- package/dist/{chunk-WJPIKXWT.js → chunk-V3CTDOE7.js} +2 -2
- package/dist/{chunk-4QR5LKPG.js → chunk-X7QBDC3I.js} +2 -2
- package/dist/{chunk-63ULYLAC.js → chunk-XBQLSMRE.js} +3 -3
- package/dist/{chunk-JLEQ7K57.js → chunk-XNJGXQHS.js} +2 -2
- package/dist/{chunk-AJB2BZ6T.js → chunk-XQ4LT4SB.js} +2 -2
- package/dist/{chunk-2G2TQQMQ.js → chunk-ZDH3XNRJ.js} +6 -6
- package/dist/{chunk-A4QSFRUF.js → chunk-ZJNDRSE3.js} +6 -6
- package/dist/{chunk-VRA7CSHI.js → chunk-ZVSCII5U.js} +2 -2
- package/dist/{chunk-XQ246UQW.js → chunk-ZWZMVVVB.js} +3 -3
- package/dist/chunk-ZWZMVVVB.js.map +1 -0
- package/dist/components/AAFailedReason/index.js +5 -5
- package/dist/components/AceEditor/index.js +4 -4
- package/dist/components/AddressContainer/CoreAddressContainer.js +10 -10
- package/dist/components/AddressContainer/EVMAddressContainer.js +9 -9
- package/dist/components/AddressContainer/addressSwitcher.js +7 -7
- package/dist/components/AddressContainer/addressView.js +6 -6
- package/dist/components/AddressContainer/label.js +3 -3
- package/dist/components/AddressContainer/utils.js +3 -3
- package/dist/components/Age/index.js +4 -4
- package/dist/components/AutoComplete/index.js +3 -3
- package/dist/components/ContractAbi/IntValueFormatter.js +5 -5
- package/dist/components/ContractAbi/ParamTitle.js +5 -5
- package/dist/components/ContractAbi/index.js +9 -9
- package/dist/components/ContractAbi/utils.js +3 -3
- package/dist/components/CookieTip/index.js +1 -1
- package/dist/components/CopyButton/index.js +3 -3
- package/dist/components/DecimalsSelect/index.js +4 -4
- package/dist/components/DownloadCSV/index.js +4 -4
- package/dist/components/GasPriceDropdown/index.js +2 -2
- package/dist/components/IncreasePercent/index.js +2 -2
- package/dist/components/InfoIconWithTooltip/index.js +4 -4
- package/dist/components/InputData/AddressLabel.js +8 -8
- package/dist/components/InputData/ContractDetail.js +4 -4
- package/dist/components/InputData/FunctionName.d.ts +1 -0
- package/dist/components/InputData/JsonDecode.d.ts +1 -0
- package/dist/components/InputData/JsonDecode.js +5 -5
- package/dist/components/InputData/OptimizationDecode.d.ts +1 -0
- package/dist/components/InputData/OptimizationDecode.js +11 -11
- package/dist/components/InputData/Original.js +3 -3
- package/dist/components/InputData/UTF8.js +3 -3
- package/dist/components/InputData/index.d.ts +1 -0
- package/dist/components/InputData/index.js +16 -16
- package/dist/components/Modal/index.js +3 -3
- package/dist/components/NetworkIcon/index.js +2 -2
- package/dist/components/OutputData/ErrorDecode.js +16 -16
- package/dist/components/OutputData/index.d.ts +1 -0
- package/dist/components/OutputData/index.js +18 -18
- package/dist/components/PhishingAddressContainer/index.js +4 -4
- package/dist/components/Popover/index.js +3 -3
- package/dist/components/Price/index.js +3 -3
- package/dist/components/ProxyContractAddress/index.d.ts +1 -0
- package/dist/components/ProxyContractAddress/index.js +6 -6
- package/dist/components/Radio/index.js +2 -2
- package/dist/components/SearchInput/index.js +4 -4
- package/dist/components/Select/index.js +4 -4
- package/dist/components/Select/select.js +3 -3
- package/dist/components/SmartAccountAddress/index.js +6 -6
- package/dist/components/Text/index.js +4 -4
- package/dist/components/Tooltip/index.js +3 -3
- package/dist/components/TransactionAction/coreTransactionAction.js +10 -10
- package/dist/components/TransactionAction/evmTransactionAction.js +9 -9
- package/dist/components/TransactionTrace/TraceDetail.d.ts +1 -0
- package/dist/components/TransactionTrace/TraceDetail.js +25 -25
- package/dist/components/TransactionTrace/TreeTraceTable.d.ts +1 -0
- package/dist/components/TransactionTrace/TreeTraceTable.js +26 -26
- package/dist/components/TransactionTrace/index.d.ts +1 -0
- package/dist/components/TransactionTrace/index.js +26 -26
- package/dist/utils/address.js +2 -2
- package/dist/utils/calldataUrl.d.ts +35 -0
- package/dist/utils/calldataUrl.js +253 -0
- package/dist/utils/calldataUrl.js.map +1 -0
- package/dist/utils/cive-plugins.js +2 -2
- package/dist/utils/constants.d.ts +2 -1
- package/dist/utils/constants.js +3 -1
- package/dist/utils/contractManagerTool.js +2 -2
- package/dist/utils/hooks/useAddressLabel.js +3 -3
- package/dist/utils/hooks/useAge.js +1 -1
- package/dist/utils/hooks/useAutoSetHolderFilterParams.js +2 -2
- package/dist/utils/hooks/useDecodeFunctionData.d.ts +2 -2
- package/dist/utils/hooks/useDecodeFunctionData.js +5 -5
- package/dist/utils/hooks/useDecodeFunctionError.js +5 -5
- package/dist/utils/hooks/useDecodedDataType.d.ts +1 -0
- package/dist/utils/hooks/useENS.js +3 -3
- package/dist/utils/hooks/useSimulateTrace.d.ts +13 -6
- package/dist/utils/hooks/useSimulateTrace.js +21 -16
- package/dist/utils/hooks/useSimulateTrace.js.map +1 -1
- package/dist/utils/hooks/useTxTrace.d.ts +1 -0
- package/dist/utils/hooks/useTxTrace.js +4 -4
- package/dist/utils/index.js +2 -2
- package/dist/utils/sdk.d.ts +3 -3
- package/dist/utils/sdk.js +3 -3
- package/dist/utils/types.d.ts +4 -0
- package/dist/utils/types.js +1 -0
- package/dist/utils/types.js.map +1 -0
- package/package.json +2 -2
- package/dist/chunk-XQ246UQW.js.map +0 -1
- /package/dist/{chunk-SFULLYYL.js.map → chunk-32HFN5MP.js.map} +0 -0
- /package/dist/{chunk-CMM72NR3.js.map → chunk-47HU5DGL.js.map} +0 -0
- /package/dist/{chunk-I6OWD4P4.js.map → chunk-4DX7CRRE.js.map} +0 -0
- /package/dist/{chunk-D6INJ4N5.js.map → chunk-4TF33JZW.js.map} +0 -0
- /package/dist/{chunk-2FGJPE3T.js.map → chunk-5OYITIUX.js.map} +0 -0
- /package/dist/{chunk-IKPPUNBU.js.map → chunk-6H5XKOXM.js.map} +0 -0
- /package/dist/{chunk-A64ILFRR.js.map → chunk-7NFRRT77.js.map} +0 -0
- /package/dist/{chunk-7NVZPYT3.js.map → chunk-7U24RYWX.js.map} +0 -0
- /package/dist/{chunk-IXMDBWQH.js.map → chunk-DHTXUMRS.js.map} +0 -0
- /package/dist/{chunk-2KJLNPUL.js.map → chunk-EJDYTF4C.js.map} +0 -0
- /package/dist/{chunk-SEIHZVZU.js.map → chunk-GC3XWDVL.js.map} +0 -0
- /package/dist/{chunk-4AAV4RRZ.js.map → chunk-GRPL5QSE.js.map} +0 -0
- /package/dist/{chunk-FBGAFVDW.js.map → chunk-GYK2VPUW.js.map} +0 -0
- /package/dist/{chunk-SCTG3SCG.js.map → chunk-HU3XDAH5.js.map} +0 -0
- /package/dist/{chunk-CWTDFCRF.js.map → chunk-HUBXGHJC.js.map} +0 -0
- /package/dist/{chunk-7BAN6GKP.js.map → chunk-K6M3ZRL6.js.map} +0 -0
- /package/dist/{chunk-VYI4IZMQ.js.map → chunk-LDCBSWPD.js.map} +0 -0
- /package/dist/{chunk-NSSKV676.js.map → chunk-LJUDPQQ6.js.map} +0 -0
- /package/dist/{chunk-G56ZGF4A.js.map → chunk-NC5OXZ7Z.js.map} +0 -0
- /package/dist/{chunk-NAHXYZZO.js.map → chunk-NUKWAN7M.js.map} +0 -0
- /package/dist/{chunk-IIXNSHSS.js.map → chunk-OO5UHQV4.js.map} +0 -0
- /package/dist/{chunk-A3VDKIWS.js.map → chunk-PJHNQX2G.js.map} +0 -0
- /package/dist/{chunk-6JLI3Y4J.js.map → chunk-PYDEMSMB.js.map} +0 -0
- /package/dist/{chunk-QFIJS6P3.js.map → chunk-RHW2TVMC.js.map} +0 -0
- /package/dist/{chunk-YNRXB6J7.js.map → chunk-RMFJW6N6.js.map} +0 -0
- /package/dist/{chunk-LB2T7W2A.js.map → chunk-ST5N4WQW.js.map} +0 -0
- /package/dist/{chunk-EZVQ6JRV.js.map → chunk-UVKAL7G5.js.map} +0 -0
- /package/dist/{chunk-WJPIKXWT.js.map → chunk-V3CTDOE7.js.map} +0 -0
- /package/dist/{chunk-4QR5LKPG.js.map → chunk-X7QBDC3I.js.map} +0 -0
- /package/dist/{chunk-63ULYLAC.js.map → chunk-XBQLSMRE.js.map} +0 -0
- /package/dist/{chunk-JLEQ7K57.js.map → chunk-XNJGXQHS.js.map} +0 -0
- /package/dist/{chunk-AJB2BZ6T.js.map → chunk-XQ4LT4SB.js.map} +0 -0
- /package/dist/{chunk-2G2TQQMQ.js.map → chunk-ZDH3XNRJ.js.map} +0 -0
- /package/dist/{chunk-A4QSFRUF.js.map → chunk-ZJNDRSE3.js.map} +0 -0
- /package/dist/{chunk-VRA7CSHI.js.map → chunk-ZVSCII5U.js.map} +0 -0
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TreeTraceTable
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-NUKWAN7M.js";
|
|
4
4
|
import {
|
|
5
5
|
TraceDetail
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-4DX7CRRE.js";
|
|
7
|
+
import "../../chunk-ZWZMVVVB.js";
|
|
7
8
|
import "../../chunk-UM5J477V.js";
|
|
8
|
-
import "../../chunk-XQ246UQW.js";
|
|
9
9
|
import "../../chunk-UARYZ4C2.js";
|
|
10
10
|
import "../../chunk-4WLXG7ZY.js";
|
|
11
|
-
import "../../chunk-
|
|
12
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-XBQLSMRE.js";
|
|
12
|
+
import "../../chunk-6H5XKOXM.js";
|
|
13
13
|
import "../../chunk-NWVSTRCG.js";
|
|
14
|
-
import "../../chunk-
|
|
15
|
-
import "../../chunk-
|
|
16
|
-
import "../../chunk-
|
|
17
|
-
import "../../chunk-
|
|
18
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-OO5UHQV4.js";
|
|
15
|
+
import "../../chunk-GYK2VPUW.js";
|
|
16
|
+
import "../../chunk-GRPL5QSE.js";
|
|
17
|
+
import "../../chunk-XNJGXQHS.js";
|
|
18
|
+
import "../../chunk-NC5OXZ7Z.js";
|
|
19
19
|
import "../../chunk-OYHBJBBP.js";
|
|
20
20
|
import "../../chunk-JVCFVNGV.js";
|
|
21
|
-
import "../../chunk-
|
|
22
|
-
import "../../chunk-
|
|
23
|
-
import "../../chunk-
|
|
24
|
-
import "../../chunk-
|
|
25
|
-
import "../../chunk-
|
|
21
|
+
import "../../chunk-UVKAL7G5.js";
|
|
22
|
+
import "../../chunk-ZDH3XNRJ.js";
|
|
23
|
+
import "../../chunk-7NFRRT77.js";
|
|
24
|
+
import "../../chunk-HU3XDAH5.js";
|
|
25
|
+
import "../../chunk-ST5N4WQW.js";
|
|
26
26
|
import "../../chunk-FGUCFE4W.js";
|
|
27
27
|
import "../../chunk-FYLAXC3R.js";
|
|
28
28
|
import "../../chunk-XI5WO2NW.js";
|
|
@@ -31,28 +31,28 @@ import "../../chunk-O6NJ56NA.js";
|
|
|
31
31
|
import "../../chunk-XCKMXAL2.js";
|
|
32
32
|
import "../../chunk-2Y57U43P.js";
|
|
33
33
|
import "../../chunk-TGK5LP2H.js";
|
|
34
|
-
import "../../chunk-
|
|
34
|
+
import "../../chunk-ZJNDRSE3.js";
|
|
35
|
+
import "../../chunk-FYDF5QZ6.js";
|
|
35
36
|
import "../../chunk-NDGJLSZN.js";
|
|
36
|
-
import "../../chunk-FLFDRCTI.js";
|
|
37
37
|
import "../../chunk-XN2TDIIK.js";
|
|
38
|
-
import "../../chunk-
|
|
38
|
+
import "../../chunk-LDCBSWPD.js";
|
|
39
39
|
import "../../chunk-CGDNDBBP.js";
|
|
40
40
|
import "../../chunk-S6O6Q2GQ.js";
|
|
41
41
|
import "../../chunk-LBAEFEJU.js";
|
|
42
42
|
import "../../chunk-5TGK2EA2.js";
|
|
43
43
|
import "../../chunk-ADNS57X5.js";
|
|
44
|
-
import "../../chunk-
|
|
45
|
-
import "../../chunk-
|
|
46
|
-
import "../../chunk-
|
|
44
|
+
import "../../chunk-47HU5DGL.js";
|
|
45
|
+
import "../../chunk-32HFN5MP.js";
|
|
46
|
+
import "../../chunk-DHTXUMRS.js";
|
|
47
47
|
import "../../chunk-BESFVHAM.js";
|
|
48
|
-
import "../../chunk-
|
|
49
|
-
import "../../chunk-
|
|
48
|
+
import "../../chunk-X7QBDC3I.js";
|
|
49
|
+
import "../../chunk-HUBXGHJC.js";
|
|
50
50
|
import "../../chunk-TOKKKTFG.js";
|
|
51
|
-
import "../../chunk-
|
|
51
|
+
import "../../chunk-V3CTDOE7.js";
|
|
52
52
|
import "../../chunk-BMO4IZHV.js";
|
|
53
53
|
import "../../chunk-LRCAKRPK.js";
|
|
54
|
-
import "../../chunk-
|
|
55
|
-
import "../../chunk-
|
|
54
|
+
import "../../chunk-4TF33JZW.js";
|
|
55
|
+
import "../../chunk-NZVJYR5B.js";
|
|
56
56
|
import "../../chunk-EN25IHGP.js";
|
|
57
57
|
import "../../chunk-ZZLGINAC.js";
|
|
58
58
|
import "../../chunk-YEINMVAR.js";
|
package/dist/utils/address.js
CHANGED
|
@@ -23,8 +23,8 @@ import {
|
|
|
23
23
|
isSimplyZeroAddress,
|
|
24
24
|
isSpecialAddress,
|
|
25
25
|
isZeroAddress
|
|
26
|
-
} from "../chunk-
|
|
27
|
-
import "../chunk-
|
|
26
|
+
} from "../chunk-X7QBDC3I.js";
|
|
27
|
+
import "../chunk-NZVJYR5B.js";
|
|
28
28
|
import "../chunk-EN25IHGP.js";
|
|
29
29
|
import "../chunk-ZZLGINAC.js";
|
|
30
30
|
import "../chunk-YEINMVAR.js";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Hex } from './types.js';
|
|
2
|
+
|
|
3
|
+
declare const MAX_CALLDATA_BYTES: number;
|
|
4
|
+
declare const CALLDATA_URL_PASSTHROUGH_MAX_BYTES = 256;
|
|
5
|
+
declare const MAX_BASE64URL_PAYLOAD_LENGTH: number;
|
|
6
|
+
declare const MAX_DEFLATE_BYTES: number;
|
|
7
|
+
declare const MAX_DEFLATE_PAYLOAD_LENGTH: number;
|
|
8
|
+
declare const BASE64URL_PATTERN: RegExp;
|
|
9
|
+
declare const HEX_PATTERN: RegExp;
|
|
10
|
+
declare const BASE64URL_PREFIX = "b1.";
|
|
11
|
+
declare const DEFLATE_PREFIX = "d1.";
|
|
12
|
+
type CalldataCodec = 'hex' | 'base64url' | 'deflate';
|
|
13
|
+
type CalldataDecodeError = 'missing' | 'invalid-format' | 'too-large';
|
|
14
|
+
type CalldataDecodeResult = {
|
|
15
|
+
ok: true;
|
|
16
|
+
data: Hex;
|
|
17
|
+
codec: CalldataCodec;
|
|
18
|
+
} | {
|
|
19
|
+
ok: false;
|
|
20
|
+
error: CalldataDecodeError;
|
|
21
|
+
codec?: CalldataCodec;
|
|
22
|
+
};
|
|
23
|
+
interface DecodeCalldataFromUrlOptions {
|
|
24
|
+
/** Treat a missing, null, or blank URL value as canonical empty calldata. */
|
|
25
|
+
allowEmptyData?: boolean;
|
|
26
|
+
}
|
|
27
|
+
declare const hexToBytes: (hex: string) => Uint8Array;
|
|
28
|
+
declare const bytesToHex: (bytes: Uint8Array) => Hex;
|
|
29
|
+
declare const bytesToBase64Url: (bytes: Uint8Array) => string;
|
|
30
|
+
declare const base64UrlToBytes: (value: string) => Uint8Array | undefined;
|
|
31
|
+
declare const concatBytes: (chunks: Uint8Array[], length: number) => Uint8Array;
|
|
32
|
+
declare const encodeCalldataForUrl: (data?: Hex | '') => string;
|
|
33
|
+
declare const decodeCalldataFromUrl: (value?: string | null, { allowEmptyData }?: DecodeCalldataFromUrlOptions) => CalldataDecodeResult;
|
|
34
|
+
|
|
35
|
+
export { BASE64URL_PATTERN, BASE64URL_PREFIX, CALLDATA_URL_PASSTHROUGH_MAX_BYTES, CalldataCodec, CalldataDecodeError, CalldataDecodeResult, DEFLATE_PREFIX, DecodeCalldataFromUrlOptions, HEX_PATTERN, MAX_BASE64URL_PAYLOAD_LENGTH, MAX_CALLDATA_BYTES, MAX_DEFLATE_BYTES, MAX_DEFLATE_PAYLOAD_LENGTH, base64UrlToBytes, bytesToBase64Url, bytesToHex, concatBytes, decodeCalldataFromUrl, encodeCalldataForUrl, hexToBytes };
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import "../chunk-WQG2LZMB.js";
|
|
2
|
+
|
|
3
|
+
// src/utils/calldataUrl.ts
|
|
4
|
+
import { deflateRaw, Inflate } from "pako";
|
|
5
|
+
var MAX_CALLDATA_BYTES = 1024 * 1024;
|
|
6
|
+
var CALLDATA_URL_PASSTHROUGH_MAX_BYTES = 256;
|
|
7
|
+
var MAX_BASE64URL_PAYLOAD_LENGTH = Math.ceil(
|
|
8
|
+
MAX_CALLDATA_BYTES * 4 / 3
|
|
9
|
+
);
|
|
10
|
+
var MAX_DEFLATE_BYTES = MAX_CALLDATA_BYTES + 1024;
|
|
11
|
+
var MAX_DEFLATE_PAYLOAD_LENGTH = Math.ceil(
|
|
12
|
+
MAX_DEFLATE_BYTES * 4 / 3
|
|
13
|
+
);
|
|
14
|
+
var BASE64URL_PATTERN = /^[A-Za-z0-9_-]*$/;
|
|
15
|
+
var HEX_PATTERN = /^0x(?:[0-9a-fA-F]{2})*$/;
|
|
16
|
+
var BASE64URL_PREFIX = "b1.";
|
|
17
|
+
var DEFLATE_PREFIX = "d1.";
|
|
18
|
+
var BINARY_STRING_CHUNK_SIZE = 32768;
|
|
19
|
+
var EMPTY_CALLDATA = "0x";
|
|
20
|
+
var hexToBytes = (hex) => {
|
|
21
|
+
const bytes = new Uint8Array((hex.length - 2) / 2);
|
|
22
|
+
for (let index = 0; index < bytes.length; index += 1) {
|
|
23
|
+
bytes[index] = Number.parseInt(hex.slice(index * 2 + 2, index * 2 + 4), 16);
|
|
24
|
+
}
|
|
25
|
+
return bytes;
|
|
26
|
+
};
|
|
27
|
+
var bytesToHex = (bytes) => {
|
|
28
|
+
let hex = "0x";
|
|
29
|
+
for (let index = 0; index < bytes.length; index += 1) {
|
|
30
|
+
hex += bytes[index].toString(16).padStart(2, "0");
|
|
31
|
+
}
|
|
32
|
+
return hex;
|
|
33
|
+
};
|
|
34
|
+
var bytesToBase64Url = (bytes) => {
|
|
35
|
+
let binary = "";
|
|
36
|
+
for (let offset = 0; offset < bytes.length; offset += BINARY_STRING_CHUNK_SIZE) {
|
|
37
|
+
binary += String.fromCharCode(
|
|
38
|
+
...bytes.subarray(offset, offset + BINARY_STRING_CHUNK_SIZE)
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
|
|
42
|
+
};
|
|
43
|
+
var base64UrlToBytes = (value) => {
|
|
44
|
+
if (!BASE64URL_PATTERN.test(value) || value.length % 4 === 1) {
|
|
45
|
+
return void 0;
|
|
46
|
+
}
|
|
47
|
+
const paddingLength = (4 - value.length % 4) % 4;
|
|
48
|
+
const base64 = value.replace(/-/g, "+").replace(/_/g, "/").padEnd(value.length + paddingLength, "=");
|
|
49
|
+
try {
|
|
50
|
+
const binary = atob(base64);
|
|
51
|
+
const bytes = new Uint8Array(binary.length);
|
|
52
|
+
for (let index = 0; index < binary.length; index += 1) {
|
|
53
|
+
bytes[index] = binary.charCodeAt(index);
|
|
54
|
+
}
|
|
55
|
+
return bytesToBase64Url(bytes) === value ? bytes : void 0;
|
|
56
|
+
} catch {
|
|
57
|
+
return void 0;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
var concatBytes = (chunks, length) => {
|
|
61
|
+
const bytes = new Uint8Array(length);
|
|
62
|
+
let offset = 0;
|
|
63
|
+
chunks.forEach((chunk) => {
|
|
64
|
+
bytes.set(chunk, offset);
|
|
65
|
+
offset += chunk.length;
|
|
66
|
+
});
|
|
67
|
+
return bytes;
|
|
68
|
+
};
|
|
69
|
+
var encodeCalldataForUrl = (data = EMPTY_CALLDATA) => {
|
|
70
|
+
const calldata = data === "" ? EMPTY_CALLDATA : data;
|
|
71
|
+
if (!HEX_PATTERN.test(calldata)) {
|
|
72
|
+
throw new TypeError(
|
|
73
|
+
"Calldata must be an even-length 0x-prefixed hex value."
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
if ((calldata.length - 2) / 2 > MAX_CALLDATA_BYTES) {
|
|
77
|
+
throw new RangeError("Calldata exceeds the 1 MiB limit.");
|
|
78
|
+
}
|
|
79
|
+
const bytes = hexToBytes(calldata);
|
|
80
|
+
const hexCandidate = calldata.toLowerCase();
|
|
81
|
+
if (bytes.length <= CALLDATA_URL_PASSTHROUGH_MAX_BYTES) {
|
|
82
|
+
return hexCandidate;
|
|
83
|
+
}
|
|
84
|
+
const candidates = [
|
|
85
|
+
hexCandidate,
|
|
86
|
+
`${BASE64URL_PREFIX}${bytesToBase64Url(bytes)}`,
|
|
87
|
+
`${DEFLATE_PREFIX}${bytesToBase64Url(
|
|
88
|
+
deflateRaw(bytes, {
|
|
89
|
+
level: 9
|
|
90
|
+
})
|
|
91
|
+
)}`
|
|
92
|
+
];
|
|
93
|
+
return candidates.reduce(
|
|
94
|
+
(shortest, candidate) => candidate.length < shortest.length ? candidate : shortest
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
var INFLATE_CHUNK_SIZE = 64 * 1024;
|
|
98
|
+
var OUTPUT_LIMIT_EXCEEDED = {};
|
|
99
|
+
var inflateRawWithLimit = (compressed) => {
|
|
100
|
+
const chunks = [];
|
|
101
|
+
let outputLength = 0;
|
|
102
|
+
let inflateStatus;
|
|
103
|
+
const inflater = new Inflate({
|
|
104
|
+
raw: true,
|
|
105
|
+
chunkSize: INFLATE_CHUNK_SIZE
|
|
106
|
+
});
|
|
107
|
+
inflater.onEnd = (status) => {
|
|
108
|
+
inflateStatus = status;
|
|
109
|
+
};
|
|
110
|
+
inflater.onData = (chunk) => {
|
|
111
|
+
outputLength += chunk.length;
|
|
112
|
+
if (outputLength > MAX_CALLDATA_BYTES) {
|
|
113
|
+
throw OUTPUT_LIMIT_EXCEEDED;
|
|
114
|
+
}
|
|
115
|
+
chunks.push(chunk);
|
|
116
|
+
};
|
|
117
|
+
try {
|
|
118
|
+
inflater.push(compressed, true);
|
|
119
|
+
} catch (error) {
|
|
120
|
+
return error === OUTPUT_LIMIT_EXCEEDED ? "too-large" : "invalid-format";
|
|
121
|
+
}
|
|
122
|
+
if (inflateStatus !== 0 || inflater.strm.avail_in !== 0) {
|
|
123
|
+
return "invalid-format";
|
|
124
|
+
}
|
|
125
|
+
return concatBytes(chunks, outputLength);
|
|
126
|
+
};
|
|
127
|
+
var decodeCalldataFromUrl = (value, { allowEmptyData = true } = {}) => {
|
|
128
|
+
if (value === void 0 || value === null || value === "") {
|
|
129
|
+
if (allowEmptyData) {
|
|
130
|
+
return {
|
|
131
|
+
ok: true,
|
|
132
|
+
data: EMPTY_CALLDATA,
|
|
133
|
+
codec: "hex"
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
ok: false,
|
|
138
|
+
error: "missing"
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
if (value.startsWith("0x")) {
|
|
142
|
+
if (!HEX_PATTERN.test(value)) {
|
|
143
|
+
return {
|
|
144
|
+
ok: false,
|
|
145
|
+
error: "invalid-format",
|
|
146
|
+
codec: "hex"
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
if ((value.length - 2) / 2 > MAX_CALLDATA_BYTES) {
|
|
150
|
+
return {
|
|
151
|
+
ok: false,
|
|
152
|
+
error: "too-large",
|
|
153
|
+
codec: "hex"
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
ok: true,
|
|
158
|
+
data: value.toLowerCase(),
|
|
159
|
+
codec: "hex"
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
if (value.startsWith(BASE64URL_PREFIX)) {
|
|
163
|
+
const payload = value.slice(BASE64URL_PREFIX.length);
|
|
164
|
+
if (payload.length > MAX_BASE64URL_PAYLOAD_LENGTH) {
|
|
165
|
+
return {
|
|
166
|
+
ok: false,
|
|
167
|
+
error: "too-large",
|
|
168
|
+
codec: "base64url"
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
const bytes = base64UrlToBytes(payload);
|
|
172
|
+
if (!bytes) {
|
|
173
|
+
return {
|
|
174
|
+
ok: false,
|
|
175
|
+
error: "invalid-format",
|
|
176
|
+
codec: "base64url"
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
if (bytes.length > MAX_CALLDATA_BYTES) {
|
|
180
|
+
return {
|
|
181
|
+
ok: false,
|
|
182
|
+
error: "too-large",
|
|
183
|
+
codec: "base64url"
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
ok: true,
|
|
188
|
+
data: bytesToHex(bytes),
|
|
189
|
+
codec: "base64url"
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
if (value.startsWith(DEFLATE_PREFIX)) {
|
|
193
|
+
const payload = value.slice(DEFLATE_PREFIX.length);
|
|
194
|
+
if (payload.length > MAX_DEFLATE_PAYLOAD_LENGTH) {
|
|
195
|
+
return {
|
|
196
|
+
ok: false,
|
|
197
|
+
error: "too-large",
|
|
198
|
+
codec: "deflate"
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
const compressed = base64UrlToBytes(payload);
|
|
202
|
+
if (!compressed) {
|
|
203
|
+
return {
|
|
204
|
+
ok: false,
|
|
205
|
+
error: "invalid-format",
|
|
206
|
+
codec: "deflate"
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
if (compressed.length > MAX_DEFLATE_BYTES) {
|
|
210
|
+
return {
|
|
211
|
+
ok: false,
|
|
212
|
+
error: "too-large",
|
|
213
|
+
codec: "deflate"
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
const bytes = inflateRawWithLimit(compressed);
|
|
217
|
+
if (typeof bytes === "string") {
|
|
218
|
+
return {
|
|
219
|
+
ok: false,
|
|
220
|
+
error: bytes,
|
|
221
|
+
codec: "deflate"
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
return {
|
|
225
|
+
ok: true,
|
|
226
|
+
data: bytesToHex(bytes),
|
|
227
|
+
codec: "deflate"
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
ok: false,
|
|
232
|
+
error: "invalid-format"
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
export {
|
|
236
|
+
BASE64URL_PATTERN,
|
|
237
|
+
BASE64URL_PREFIX,
|
|
238
|
+
CALLDATA_URL_PASSTHROUGH_MAX_BYTES,
|
|
239
|
+
DEFLATE_PREFIX,
|
|
240
|
+
HEX_PATTERN,
|
|
241
|
+
MAX_BASE64URL_PAYLOAD_LENGTH,
|
|
242
|
+
MAX_CALLDATA_BYTES,
|
|
243
|
+
MAX_DEFLATE_BYTES,
|
|
244
|
+
MAX_DEFLATE_PAYLOAD_LENGTH,
|
|
245
|
+
base64UrlToBytes,
|
|
246
|
+
bytesToBase64Url,
|
|
247
|
+
bytesToHex,
|
|
248
|
+
concatBytes,
|
|
249
|
+
decodeCalldataFromUrl,
|
|
250
|
+
encodeCalldataForUrl,
|
|
251
|
+
hexToBytes
|
|
252
|
+
};
|
|
253
|
+
//# sourceMappingURL=calldataUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/calldataUrl.ts"],"sourcesContent":["import { deflateRaw, Inflate } from 'pako';\nimport type { Hex } from './types';\n\nexport const MAX_CALLDATA_BYTES = 1024 * 1024;\nexport const CALLDATA_URL_PASSTHROUGH_MAX_BYTES = 256;\nexport const MAX_BASE64URL_PAYLOAD_LENGTH = Math.ceil(\n (MAX_CALLDATA_BYTES * 4) / 3,\n);\nexport const MAX_DEFLATE_BYTES = MAX_CALLDATA_BYTES + 1024;\nexport const MAX_DEFLATE_PAYLOAD_LENGTH = Math.ceil(\n (MAX_DEFLATE_BYTES * 4) / 3,\n);\n\nexport const BASE64URL_PATTERN = /^[A-Za-z0-9_-]*$/;\nexport const HEX_PATTERN = /^0x(?:[0-9a-fA-F]{2})*$/;\nexport const BASE64URL_PREFIX = 'b1.';\nexport const DEFLATE_PREFIX = 'd1.';\nconst BINARY_STRING_CHUNK_SIZE = 0x8000;\nconst EMPTY_CALLDATA: Hex = '0x';\n\nexport type CalldataCodec = 'hex' | 'base64url' | 'deflate';\nexport type CalldataDecodeError = 'missing' | 'invalid-format' | 'too-large';\n\nexport type CalldataDecodeResult =\n | {\n ok: true;\n data: Hex;\n codec: CalldataCodec;\n }\n | {\n ok: false;\n error: CalldataDecodeError;\n codec?: CalldataCodec;\n };\n\nexport interface DecodeCalldataFromUrlOptions {\n /** Treat a missing, null, or blank URL value as canonical empty calldata. */\n allowEmptyData?: boolean;\n}\n\nexport const hexToBytes = (hex: string): Uint8Array => {\n const bytes = new Uint8Array((hex.length - 2) / 2);\n for (let index = 0; index < bytes.length; index += 1) {\n bytes[index] = Number.parseInt(hex.slice(index * 2 + 2, index * 2 + 4), 16);\n }\n return bytes;\n};\n\nexport const bytesToHex = (bytes: Uint8Array): Hex => {\n let hex = '0x';\n for (let index = 0; index < bytes.length; index += 1) {\n hex += bytes[index]!.toString(16).padStart(2, '0');\n }\n return hex as Hex;\n};\n\nexport const bytesToBase64Url = (bytes: Uint8Array): string => {\n let binary = '';\n for (\n let offset = 0;\n offset < bytes.length;\n offset += BINARY_STRING_CHUNK_SIZE\n ) {\n binary += String.fromCharCode(\n ...bytes.subarray(offset, offset + BINARY_STRING_CHUNK_SIZE),\n );\n }\n return btoa(binary)\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=+$/g, '');\n};\n\nexport const base64UrlToBytes = (value: string): Uint8Array | undefined => {\n if (!BASE64URL_PATTERN.test(value) || value.length % 4 === 1) {\n return undefined;\n }\n\n const paddingLength = (4 - (value.length % 4)) % 4;\n const base64 = value\n .replace(/-/g, '+')\n .replace(/_/g, '/')\n .padEnd(value.length + paddingLength, '=');\n\n try {\n const binary = atob(base64);\n const bytes = new Uint8Array(binary.length);\n for (let index = 0; index < binary.length; index += 1) {\n bytes[index] = binary.charCodeAt(index);\n }\n return bytesToBase64Url(bytes) === value ? bytes : undefined;\n } catch {\n return undefined;\n }\n};\n\nexport const concatBytes = (\n chunks: Uint8Array[],\n length: number,\n): Uint8Array => {\n const bytes = new Uint8Array(length);\n let offset = 0;\n chunks.forEach(chunk => {\n bytes.set(chunk, offset);\n offset += chunk.length;\n });\n return bytes;\n};\n\nexport const encodeCalldataForUrl = (\n data: Hex | '' = EMPTY_CALLDATA,\n): string => {\n const calldata = data === '' ? EMPTY_CALLDATA : data;\n if (!HEX_PATTERN.test(calldata)) {\n throw new TypeError(\n 'Calldata must be an even-length 0x-prefixed hex value.',\n );\n }\n\n if ((calldata.length - 2) / 2 > MAX_CALLDATA_BYTES) {\n throw new RangeError('Calldata exceeds the 1 MiB limit.');\n }\n const bytes = hexToBytes(calldata);\n\n const hexCandidate = calldata.toLowerCase();\n if (bytes.length <= CALLDATA_URL_PASSTHROUGH_MAX_BYTES) {\n return hexCandidate;\n }\n\n const candidates = [\n hexCandidate,\n `${BASE64URL_PREFIX}${bytesToBase64Url(bytes)}`,\n `${DEFLATE_PREFIX}${bytesToBase64Url(\n deflateRaw(bytes, {\n level: 9,\n }),\n )}`,\n ];\n\n return candidates.reduce((shortest, candidate) =>\n candidate.length < shortest.length ? candidate : shortest,\n );\n};\n\nconst INFLATE_CHUNK_SIZE = 64 * 1024;\nconst OUTPUT_LIMIT_EXCEEDED = {};\ntype InflateWithInputState = Inflate & {\n strm: {\n avail_in: number;\n };\n};\n\nconst inflateRawWithLimit = (\n compressed: Uint8Array,\n): Uint8Array | 'invalid-format' | 'too-large' => {\n const chunks: Uint8Array[] = [];\n let outputLength = 0;\n let inflateStatus: number | undefined;\n const inflater = new Inflate({\n raw: true,\n chunkSize: INFLATE_CHUNK_SIZE,\n }) as InflateWithInputState;\n\n inflater.onEnd = status => {\n inflateStatus = status;\n };\n\n inflater.onData = (chunk: Uint8Array) => {\n outputLength += chunk.length;\n if (outputLength > MAX_CALLDATA_BYTES) {\n throw OUTPUT_LIMIT_EXCEEDED;\n }\n chunks.push(chunk);\n };\n\n try {\n inflater.push(compressed, true);\n } catch (error) {\n return error === OUTPUT_LIMIT_EXCEEDED ? 'too-large' : 'invalid-format';\n }\n\n if (inflateStatus !== 0 || inflater.strm.avail_in !== 0) {\n return 'invalid-format';\n }\n\n return concatBytes(chunks, outputLength);\n};\n\nexport const decodeCalldataFromUrl = (\n value?: string | null,\n { allowEmptyData = true }: DecodeCalldataFromUrlOptions = {},\n): CalldataDecodeResult => {\n if (value === undefined || value === null || value === '') {\n if (allowEmptyData) {\n return {\n ok: true,\n data: EMPTY_CALLDATA,\n codec: 'hex',\n };\n }\n return {\n ok: false,\n error: 'missing',\n };\n }\n\n if (value.startsWith('0x')) {\n if (!HEX_PATTERN.test(value)) {\n return {\n ok: false,\n error: 'invalid-format',\n codec: 'hex',\n };\n }\n if ((value.length - 2) / 2 > MAX_CALLDATA_BYTES) {\n return {\n ok: false,\n error: 'too-large',\n codec: 'hex',\n };\n }\n return {\n ok: true,\n data: value.toLowerCase() as Hex,\n codec: 'hex',\n };\n }\n\n if (value.startsWith(BASE64URL_PREFIX)) {\n const payload = value.slice(BASE64URL_PREFIX.length);\n if (payload.length > MAX_BASE64URL_PAYLOAD_LENGTH) {\n return {\n ok: false,\n error: 'too-large',\n codec: 'base64url',\n };\n }\n const bytes = base64UrlToBytes(payload);\n if (!bytes) {\n return {\n ok: false,\n error: 'invalid-format',\n codec: 'base64url',\n };\n }\n if (bytes.length > MAX_CALLDATA_BYTES) {\n return {\n ok: false,\n error: 'too-large',\n codec: 'base64url',\n };\n }\n return {\n ok: true,\n data: bytesToHex(bytes),\n codec: 'base64url',\n };\n }\n\n if (value.startsWith(DEFLATE_PREFIX)) {\n const payload = value.slice(DEFLATE_PREFIX.length);\n if (payload.length > MAX_DEFLATE_PAYLOAD_LENGTH) {\n return {\n ok: false,\n error: 'too-large',\n codec: 'deflate',\n };\n }\n const compressed = base64UrlToBytes(payload);\n if (!compressed) {\n return {\n ok: false,\n error: 'invalid-format',\n codec: 'deflate',\n };\n }\n if (compressed.length > MAX_DEFLATE_BYTES) {\n return {\n ok: false,\n error: 'too-large',\n codec: 'deflate',\n };\n }\n\n const bytes = inflateRawWithLimit(compressed);\n if (typeof bytes === 'string') {\n return {\n ok: false,\n error: bytes,\n codec: 'deflate',\n };\n }\n return {\n ok: true,\n data: bytesToHex(bytes),\n codec: 'deflate',\n };\n }\n\n return {\n ok: false,\n error: 'invalid-format',\n };\n};\n"],"mappings":";;;AAAA,SAAS,YAAY,eAAe;AAG7B,IAAM,qBAAqB,OAAO;AAClC,IAAM,qCAAqC;AAC3C,IAAM,+BAA+B,KAAK;AAAA,EAC9C,qBAAqB,IAAK;AAC7B;AACO,IAAM,oBAAoB,qBAAqB;AAC/C,IAAM,6BAA6B,KAAK;AAAA,EAC5C,oBAAoB,IAAK;AAC5B;AAEO,IAAM,oBAAoB;AAC1B,IAAM,cAAc;AACpB,IAAM,mBAAmB;AACzB,IAAM,iBAAiB;AAC9B,IAAM,2BAA2B;AACjC,IAAM,iBAAsB;AAsBrB,IAAM,aAAa,CAAC,QAA4B;AACrD,QAAM,QAAQ,IAAI,YAAY,IAAI,SAAS,KAAK,CAAC;AACjD,WAAS,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS,GAAG;AACpD,UAAM,KAAK,IAAI,OAAO,SAAS,IAAI,MAAM,QAAQ,IAAI,GA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AI;AAAA,QACJ,OAAO;AAAA,QACP,OAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,MAAM,WAAW,KAAK;AAAA,MACtB,OAAO;AAAA,IACT;AAAA,EACF;AAEA,MAAI,MAAM,WAAW,cAAc,GAAG;AACpC,UAAM,UAAU,MAAM,MAAM,eAAe,MAAM;AACjD,QAAI,QAAQ,SAAS,4BAA4B;AAC/C,aAAO;AAAA,QACL,IAAI;AAAA,QACJ,OAAO;AAAA,QACP,OAAO;AAAA,MACT;AAAA,IACF;AACA,UAAM,aAAa,iBAAiB,OAAO;AAC3C,QAAI,CAAC,YAAY;AACf,aAAO;AAAA,QACL,IAAI;AAAA,QACJ,OAAO;AAAA,QACP,OAAO;AAAA,MACT;AAAA,IACF;AACA,QAAI,WAAW,SAAS,mBAAmB;AACzC,aAAO;AAAA,QACL,IAAI;AAAA,QACJ,OAAO;AAAA,QACP,OAAO;AAAA,MACT;AAAA,IACF;AAEA,UAAM,QAAQ,oBAAoB,UAAU;AAC5C,QAAI,OAAO,UAAU,UAAU;AAC7B,aAAO;AAAA,QACL,IAAI;AAAA,QACJ,OAAO;AAAA,QACP,OAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,MAAM,WAAW,KAAK;AAAA,MACtB,OAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,OAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decodeErrorResult,
|
|
3
3
|
defineChain2 as defineChain
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-LDCBSWPD.js";
|
|
5
5
|
import "../chunk-CGDNDBBP.js";
|
|
6
6
|
import "../chunk-S6O6Q2GQ.js";
|
|
7
7
|
import "../chunk-LBAEFEJU.js";
|
|
8
8
|
import "../chunk-5TGK2EA2.js";
|
|
9
9
|
import "../chunk-ADNS57X5.js";
|
|
10
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-NZVJYR5B.js";
|
|
11
11
|
import "../chunk-L4AFJGXJ.js";
|
|
12
12
|
import "../chunk-WQG2LZMB.js";
|
|
13
13
|
export {
|
|
@@ -30,5 +30,6 @@ declare const getCurrencySymbol: () => string | undefined;
|
|
|
30
30
|
declare const NETWORK_ID: any;
|
|
31
31
|
declare const COMMON_ERROR_OUTPUT_PREFIX = "0x08c379a0";
|
|
32
32
|
declare const COMMON_PANIC_OUTPUT_PREFIX = "0x4e487b71";
|
|
33
|
+
declare const ZERO_ADDRESS_HEX = "0x0000000000000000000000000000000000000000";
|
|
33
34
|
|
|
34
|
-
export { COMMON_ERROR_OUTPUT_PREFIX, COMMON_PANIC_OUTPUT_PREFIX, CURRENCY_SYMBOLS, LOCALSTORAGE_KEYS_MAP, NETWORK_ID, apiPrefix, getCurrency, getCurrencySymbol };
|
|
35
|
+
export { COMMON_ERROR_OUTPUT_PREFIX, COMMON_PANIC_OUTPUT_PREFIX, CURRENCY_SYMBOLS, LOCALSTORAGE_KEYS_MAP, NETWORK_ID, ZERO_ADDRESS_HEX, apiPrefix, getCurrency, getCurrencySymbol };
|
package/dist/utils/constants.js
CHANGED
|
@@ -4,10 +4,11 @@ import {
|
|
|
4
4
|
CURRENCY_SYMBOLS,
|
|
5
5
|
LOCALSTORAGE_KEYS_MAP,
|
|
6
6
|
NETWORK_ID,
|
|
7
|
+
ZERO_ADDRESS_HEX,
|
|
7
8
|
apiPrefix,
|
|
8
9
|
getCurrency,
|
|
9
10
|
getCurrencySymbol
|
|
10
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-NZVJYR5B.js";
|
|
11
12
|
import "../chunk-L4AFJGXJ.js";
|
|
12
13
|
import "../chunk-WQG2LZMB.js";
|
|
13
14
|
export {
|
|
@@ -16,6 +17,7 @@ export {
|
|
|
16
17
|
CURRENCY_SYMBOLS,
|
|
17
18
|
LOCALSTORAGE_KEYS_MAP,
|
|
18
19
|
NETWORK_ID,
|
|
20
|
+
ZERO_ADDRESS_HEX,
|
|
19
21
|
apiPrefix,
|
|
20
22
|
getCurrency,
|
|
21
23
|
getCurrencySymbol
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useAddressLabel
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-HU3XDAH5.js";
|
|
4
|
+
import "../../chunk-X7QBDC3I.js";
|
|
5
|
+
import "../../chunk-NZVJYR5B.js";
|
|
6
6
|
import "../../chunk-EN25IHGP.js";
|
|
7
7
|
import "../../chunk-ZZLGINAC.js";
|
|
8
8
|
import "../../chunk-YEINMVAR.js";
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
} from "../../chunk-CPSXYQJ7.js";
|
|
4
4
|
import {
|
|
5
5
|
isAddressEqual
|
|
6
|
-
} from "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
6
|
+
} from "../../chunk-X7QBDC3I.js";
|
|
7
|
+
import "../../chunk-NZVJYR5B.js";
|
|
8
8
|
import "../../chunk-EN25IHGP.js";
|
|
9
9
|
import "../../chunk-ZZLGINAC.js";
|
|
10
10
|
import "../../chunk-YEINMVAR.js";
|
|
@@ -2,8 +2,8 @@ import { AbiFunctionWithoutGas } from '../sdk.js';
|
|
|
2
2
|
import 'viem';
|
|
3
3
|
import 'cive/accounts';
|
|
4
4
|
import 'cive';
|
|
5
|
+
import '../types.js';
|
|
5
6
|
|
|
6
|
-
type Hex = `0x${string}`;
|
|
7
7
|
interface DecodedFunctionData {
|
|
8
8
|
decodedParams?: {
|
|
9
9
|
args: readonly unknown[] | undefined;
|
|
@@ -28,4 +28,4 @@ declare const useDecodeFunctionData: ({ to, abi: outerAbi, implementation: _impl
|
|
|
28
28
|
withOutput?: boolean | undefined;
|
|
29
29
|
}) => [DecodedFunctionData, boolean];
|
|
30
30
|
|
|
31
|
-
export { DecodedFunctionData,
|
|
31
|
+
export { DecodedFunctionData, useDecodeFunctionData };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useDecodeFunctionData
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-ZWZMVVVB.js";
|
|
4
4
|
import "../../chunk-UARYZ4C2.js";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-FYDF5QZ6.js";
|
|
6
6
|
import "../../chunk-XN2TDIIK.js";
|
|
7
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-LDCBSWPD.js";
|
|
8
8
|
import "../../chunk-CGDNDBBP.js";
|
|
9
9
|
import "../../chunk-S6O6Q2GQ.js";
|
|
10
10
|
import "../../chunk-LBAEFEJU.js";
|
|
11
11
|
import "../../chunk-5TGK2EA2.js";
|
|
12
12
|
import "../../chunk-ADNS57X5.js";
|
|
13
|
-
import "../../chunk-
|
|
14
|
-
import "../../chunk-
|
|
13
|
+
import "../../chunk-4TF33JZW.js";
|
|
14
|
+
import "../../chunk-NZVJYR5B.js";
|
|
15
15
|
import "../../chunk-EN25IHGP.js";
|
|
16
16
|
import "../../chunk-ZZLGINAC.js";
|
|
17
17
|
import "../../chunk-YEINMVAR.js";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useDecodeFunctionError
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-ZJNDRSE3.js";
|
|
4
|
+
import "../../chunk-FYDF5QZ6.js";
|
|
4
5
|
import "../../chunk-NDGJLSZN.js";
|
|
5
|
-
import "../../chunk-FLFDRCTI.js";
|
|
6
6
|
import "../../chunk-XN2TDIIK.js";
|
|
7
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-LDCBSWPD.js";
|
|
8
8
|
import "../../chunk-CGDNDBBP.js";
|
|
9
9
|
import "../../chunk-S6O6Q2GQ.js";
|
|
10
10
|
import "../../chunk-LBAEFEJU.js";
|
|
11
11
|
import "../../chunk-5TGK2EA2.js";
|
|
12
12
|
import "../../chunk-ADNS57X5.js";
|
|
13
|
-
import "../../chunk-
|
|
14
|
-
import "../../chunk-
|
|
13
|
+
import "../../chunk-4TF33JZW.js";
|
|
14
|
+
import "../../chunk-NZVJYR5B.js";
|
|
15
15
|
import "../../chunk-EN25IHGP.js";
|
|
16
16
|
import "../../chunk-ZZLGINAC.js";
|
|
17
17
|
import "../../chunk-YEINMVAR.js";
|
|
@@ -3,6 +3,7 @@ import '../sdk.js';
|
|
|
3
3
|
import 'viem';
|
|
4
4
|
import 'cive/accounts';
|
|
5
5
|
import 'cive';
|
|
6
|
+
import '../types.js';
|
|
6
7
|
|
|
7
8
|
type DataType = 'original' | 'json' | 'utf8' | 'generalDecode' | 'optimizationDecode';
|
|
8
9
|
declare const useDecodedDataType: ({ to, input, isContractCreated, decodedData, }: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useENS
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-32HFN5MP.js";
|
|
4
|
+
import "../../chunk-X7QBDC3I.js";
|
|
5
|
+
import "../../chunk-NZVJYR5B.js";
|
|
6
6
|
import "../../chunk-EN25IHGP.js";
|
|
7
7
|
import "../../chunk-ZZLGINAC.js";
|
|
8
8
|
import "../../chunk-YEINMVAR.js";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as swr from 'swr';
|
|
2
2
|
import { ProxyType, TreeTraceForUI } from './useTxTrace.js';
|
|
3
3
|
import { AddressNameMap } from '../request.types.js';
|
|
4
|
-
import { Space } from '../
|
|
4
|
+
import { Hex, Space } from '../types.js';
|
|
5
|
+
import '../sdk.js';
|
|
5
6
|
import 'viem';
|
|
6
7
|
import 'cive/accounts';
|
|
7
8
|
import 'cive';
|
|
@@ -12,6 +13,7 @@ interface SimulateLog {
|
|
|
12
13
|
data: string;
|
|
13
14
|
transactionLogIndex?: number;
|
|
14
15
|
}
|
|
16
|
+
type BlockTag = 'latest' | 'safe' | 'finalized' | 'earliest' | 'pending' | Hex;
|
|
15
17
|
interface SimulateTraceCall {
|
|
16
18
|
from: string;
|
|
17
19
|
to: string;
|
|
@@ -35,10 +37,10 @@ interface SimulateTraceResponse {
|
|
|
35
37
|
nameMap?: Record<string, AddressNameMap>;
|
|
36
38
|
}
|
|
37
39
|
interface SimulateTraceTxParams {
|
|
38
|
-
from
|
|
39
|
-
to?:
|
|
40
|
+
from: Hex;
|
|
41
|
+
to?: Hex;
|
|
40
42
|
value?: string;
|
|
41
|
-
data?:
|
|
43
|
+
data?: Hex;
|
|
42
44
|
gas?: string;
|
|
43
45
|
gasPrice?: string;
|
|
44
46
|
maxFeePerGas?: string;
|
|
@@ -56,8 +58,13 @@ interface SimulateTraceConfig {
|
|
|
56
58
|
timeout?: number;
|
|
57
59
|
};
|
|
58
60
|
}
|
|
59
|
-
declare const querySimulateTrace: (tx: SimulateTraceTxParams, tag?:
|
|
60
|
-
declare const useSimulateTrace: (
|
|
61
|
+
declare const querySimulateTrace: (tx: SimulateTraceTxParams, tag?: BlockTag, params?: SimulateTraceConfig) => Promise<SimulateTraceResponse>;
|
|
62
|
+
declare const useSimulateTrace: ({ tx, tag, params, disabled, }: {
|
|
63
|
+
tx?: SimulateTraceTxParams | undefined;
|
|
64
|
+
tag?: BlockTag | undefined;
|
|
65
|
+
params?: SimulateTraceConfig | undefined;
|
|
66
|
+
disabled?: boolean | undefined;
|
|
67
|
+
}) => swr.SWRResponse<{
|
|
61
68
|
total: number;
|
|
62
69
|
list: TreeTraceForUI[];
|
|
63
70
|
logs: {
|