@metamask/utils 8.2.0 → 8.3.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/CHANGELOG.md +11 -1
- package/dist/assert.js +3 -3
- package/dist/assert.mjs +2 -2
- package/dist/base64.js +4 -4
- package/dist/base64.mjs +3 -3
- package/dist/bytes.js +4 -4
- package/dist/bytes.mjs +3 -3
- package/dist/checksum.js +5 -5
- package/dist/checksum.mjs +4 -4
- package/dist/{chunk-ZRNIY7OW.js → chunk-4D6XQBHA.js} +4 -4
- package/dist/chunk-4NIRTM4M.js +23 -0
- package/dist/chunk-4NIRTM4M.js.map +1 -0
- package/dist/{chunk-VL5DYXC5.mjs → chunk-52OU772R.mjs} +2 -2
- package/dist/chunk-5AVWINSB.js +1 -0
- package/dist/chunk-622IOGVI.mjs +1 -0
- package/dist/{chunk-65KBH4FZ.mjs → chunk-6C35XQOF.mjs} +2 -2
- package/dist/{chunk-WRBN6DWM.js → chunk-6NZW4WK4.js} +3 -3
- package/dist/{chunk-VBYRLAP6.js → chunk-6ZDHSOUV.js} +3 -3
- package/dist/{chunk-CSDMTDND.mjs → chunk-74DGVJVE.mjs} +2 -2
- package/dist/chunk-B7LIM2PK.mjs +23 -0
- package/dist/chunk-B7LIM2PK.mjs.map +1 -0
- package/dist/{chunk-WQDTPIQK.js → chunk-BFQDMI3M.js} +12 -12
- package/dist/{chunk-JCYFTGED.js → chunk-DHVKFDHQ.js} +9 -9
- package/dist/{chunk-XYYGZF5Y.js → chunk-E4C7EW4R.js} +3 -3
- package/dist/{chunk-N53OILN6.mjs → chunk-GZS3IQBZ.mjs} +2 -2
- package/dist/{chunk-DMPG3H3G.js → chunk-IZC266HS.js} +7 -13
- package/dist/chunk-IZC266HS.js.map +1 -0
- package/dist/{chunk-HLDWS2JR.mjs → chunk-NQMRFZHB.mjs} +2 -2
- package/dist/{chunk-2CY4F77D.mjs → chunk-O3EIM33O.mjs} +3 -3
- package/dist/{chunk-5WQRFJVQ.js → chunk-OLLG4H35.js} +11 -11
- package/dist/{chunk-YQJBIHC7.js → chunk-QEPVHEP7.js} +20 -20
- package/dist/{chunk-G66TREC6.mjs → chunk-ROQSKDP5.mjs} +2 -2
- package/dist/{chunk-VSEW3V2L.mjs → chunk-S3UHBN2Z.mjs} +3 -3
- package/dist/{chunk-BKR45GQY.mjs → chunk-VA2DRBDE.mjs} +2 -2
- package/dist/chunk-VFXTVNXN.js +44 -0
- package/dist/{chunk-7S5AWFX7.mjs → chunk-XYGUOY6N.mjs} +7 -13
- package/dist/{chunk-7S5AWFX7.mjs.map → chunk-XYGUOY6N.mjs.map} +1 -1
- package/dist/coercers.js +5 -5
- package/dist/coercers.mjs +4 -4
- package/dist/errors.js +2 -2
- package/dist/errors.mjs +1 -1
- package/dist/fs.js +3 -3
- package/dist/fs.mjs +2 -2
- package/dist/hex.js +4 -4
- package/dist/hex.mjs +3 -3
- package/dist/index.js +15 -11
- package/dist/index.mjs +14 -10
- package/dist/json.js +4 -4
- package/dist/json.mjs +3 -3
- package/dist/node.js +16 -12
- package/dist/node.mjs +15 -11
- package/dist/number.js +5 -5
- package/dist/number.mjs +4 -4
- package/dist/promise.js +8 -0
- package/dist/promise.js.map +1 -0
- package/dist/promise.mjs +8 -0
- package/dist/promise.mjs.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/promise.d.ts +35 -0
- package/dist/types/promise.d.ts.map +1 -0
- package/dist/versions.js +4 -4
- package/dist/versions.mjs +3 -3
- package/package.json +2 -2
- package/dist/chunk-2TBCL6EF.js +0 -1
- package/dist/chunk-4JNG5UTO.js +0 -44
- package/dist/chunk-DMPG3H3G.js.map +0 -1
- package/dist/chunk-DYMCEQIV.mjs +0 -1
- /package/dist/{chunk-ZRNIY7OW.js.map → chunk-4D6XQBHA.js.map} +0 -0
- /package/dist/{chunk-VL5DYXC5.mjs.map → chunk-52OU772R.mjs.map} +0 -0
- /package/dist/{chunk-2TBCL6EF.js.map → chunk-5AVWINSB.js.map} +0 -0
- /package/dist/{chunk-DYMCEQIV.mjs.map → chunk-622IOGVI.mjs.map} +0 -0
- /package/dist/{chunk-65KBH4FZ.mjs.map → chunk-6C35XQOF.mjs.map} +0 -0
- /package/dist/{chunk-WRBN6DWM.js.map → chunk-6NZW4WK4.js.map} +0 -0
- /package/dist/{chunk-VBYRLAP6.js.map → chunk-6ZDHSOUV.js.map} +0 -0
- /package/dist/{chunk-CSDMTDND.mjs.map → chunk-74DGVJVE.mjs.map} +0 -0
- /package/dist/{chunk-WQDTPIQK.js.map → chunk-BFQDMI3M.js.map} +0 -0
- /package/dist/{chunk-JCYFTGED.js.map → chunk-DHVKFDHQ.js.map} +0 -0
- /package/dist/{chunk-XYYGZF5Y.js.map → chunk-E4C7EW4R.js.map} +0 -0
- /package/dist/{chunk-N53OILN6.mjs.map → chunk-GZS3IQBZ.mjs.map} +0 -0
- /package/dist/{chunk-HLDWS2JR.mjs.map → chunk-NQMRFZHB.mjs.map} +0 -0
- /package/dist/{chunk-2CY4F77D.mjs.map → chunk-O3EIM33O.mjs.map} +0 -0
- /package/dist/{chunk-5WQRFJVQ.js.map → chunk-OLLG4H35.js.map} +0 -0
- /package/dist/{chunk-YQJBIHC7.js.map → chunk-QEPVHEP7.js.map} +0 -0
- /package/dist/{chunk-G66TREC6.mjs.map → chunk-ROQSKDP5.mjs.map} +0 -0
- /package/dist/{chunk-VSEW3V2L.mjs.map → chunk-S3UHBN2Z.mjs.map} +0 -0
- /package/dist/{chunk-BKR45GQY.mjs.map → chunk-VA2DRBDE.mjs.map} +0 -0
- /package/dist/{chunk-4JNG5UTO.js.map → chunk-VFXTVNXN.js.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-622IOGVI.mjs";
|
|
2
2
|
import {
|
|
3
3
|
bigIntToHex,
|
|
4
4
|
hexToBigInt,
|
|
5
5
|
hexToNumber,
|
|
6
6
|
numberToHex
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-S3UHBN2Z.mjs";
|
|
8
8
|
import "./chunk-AY6FDCBT.mjs";
|
|
9
|
+
import {
|
|
10
|
+
createDeferredPromise
|
|
11
|
+
} from "./chunk-B7LIM2PK.mjs";
|
|
9
12
|
import {
|
|
10
13
|
Duration,
|
|
11
14
|
inMilliseconds,
|
|
@@ -22,7 +25,7 @@ import {
|
|
|
22
25
|
isValidSemVerRange,
|
|
23
26
|
isValidSemVerVersion,
|
|
24
27
|
satisfiesVersionRange
|
|
25
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-ROQSKDP5.mjs";
|
|
26
29
|
import {
|
|
27
30
|
JsonRpcErrorStruct,
|
|
28
31
|
JsonRpcFailureStruct,
|
|
@@ -57,7 +60,7 @@ import {
|
|
|
57
60
|
isValidJson,
|
|
58
61
|
jsonrpc2,
|
|
59
62
|
object
|
|
60
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-6C35XQOF.mjs";
|
|
61
64
|
import "./chunk-I575FZFH.mjs";
|
|
62
65
|
import {
|
|
63
66
|
createModuleLogger,
|
|
@@ -84,16 +87,16 @@ import {
|
|
|
84
87
|
} from "./chunk-TGOMTREC.mjs";
|
|
85
88
|
import {
|
|
86
89
|
ChecksumStruct
|
|
87
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-GZS3IQBZ.mjs";
|
|
88
91
|
import {
|
|
89
92
|
base64
|
|
90
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-NQMRFZHB.mjs";
|
|
91
94
|
import {
|
|
92
95
|
createBigInt,
|
|
93
96
|
createBytes,
|
|
94
97
|
createHex,
|
|
95
98
|
createNumber
|
|
96
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-O3EIM33O.mjs";
|
|
97
100
|
import {
|
|
98
101
|
HexAddressStruct,
|
|
99
102
|
HexChecksumAddressStruct,
|
|
@@ -125,20 +128,20 @@ import {
|
|
|
125
128
|
signedBigIntToBytes,
|
|
126
129
|
stringToBytes,
|
|
127
130
|
valueToBytes
|
|
128
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-VA2DRBDE.mjs";
|
|
129
132
|
import {
|
|
130
133
|
AssertionError,
|
|
131
134
|
assert,
|
|
132
135
|
assertExhaustive,
|
|
133
136
|
assertStruct
|
|
134
|
-
} from "./chunk-
|
|
137
|
+
} from "./chunk-74DGVJVE.mjs";
|
|
135
138
|
import {
|
|
136
139
|
getErrorMessage,
|
|
137
140
|
isErrorWithCode,
|
|
138
141
|
isErrorWithMessage,
|
|
139
142
|
isErrorWithStack,
|
|
140
143
|
wrapError
|
|
141
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-XYGUOY6N.mjs";
|
|
142
145
|
import {
|
|
143
146
|
ESCAPE_CHARACTERS_REGEXP,
|
|
144
147
|
JsonSize,
|
|
@@ -226,6 +229,7 @@ export {
|
|
|
226
229
|
createBigInt,
|
|
227
230
|
createBytes,
|
|
228
231
|
createDataView,
|
|
232
|
+
createDeferredPromise,
|
|
229
233
|
createHex,
|
|
230
234
|
createModuleLogger,
|
|
231
235
|
createNumber,
|
package/dist/json.js
CHANGED
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
var
|
|
36
|
-
require('./chunk-
|
|
37
|
-
require('./chunk-
|
|
35
|
+
var _chunkOLLG4H35js = require('./chunk-OLLG4H35.js');
|
|
36
|
+
require('./chunk-6ZDHSOUV.js');
|
|
37
|
+
require('./chunk-IZC266HS.js');
|
|
38
38
|
require('./chunk-QVEKZRZ2.js');
|
|
39
39
|
require('./chunk-3W5G4CYI.js');
|
|
40
40
|
|
|
@@ -71,5 +71,5 @@ require('./chunk-3W5G4CYI.js');
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
exports.JsonRpcErrorStruct =
|
|
74
|
+
exports.JsonRpcErrorStruct = _chunkOLLG4H35js.JsonRpcErrorStruct; exports.JsonRpcFailureStruct = _chunkOLLG4H35js.JsonRpcFailureStruct; exports.JsonRpcIdStruct = _chunkOLLG4H35js.JsonRpcIdStruct; exports.JsonRpcNotificationStruct = _chunkOLLG4H35js.JsonRpcNotificationStruct; exports.JsonRpcParamsStruct = _chunkOLLG4H35js.JsonRpcParamsStruct; exports.JsonRpcRequestStruct = _chunkOLLG4H35js.JsonRpcRequestStruct; exports.JsonRpcResponseStruct = _chunkOLLG4H35js.JsonRpcResponseStruct; exports.JsonRpcSuccessStruct = _chunkOLLG4H35js.JsonRpcSuccessStruct; exports.JsonRpcVersionStruct = _chunkOLLG4H35js.JsonRpcVersionStruct; exports.JsonStruct = _chunkOLLG4H35js.JsonStruct; exports.PendingJsonRpcResponseStruct = _chunkOLLG4H35js.PendingJsonRpcResponseStruct; exports.UnsafeJsonStruct = _chunkOLLG4H35js.UnsafeJsonStruct; exports.assertIsJsonRpcError = _chunkOLLG4H35js.assertIsJsonRpcError; exports.assertIsJsonRpcFailure = _chunkOLLG4H35js.assertIsJsonRpcFailure; exports.assertIsJsonRpcNotification = _chunkOLLG4H35js.assertIsJsonRpcNotification; exports.assertIsJsonRpcRequest = _chunkOLLG4H35js.assertIsJsonRpcRequest; exports.assertIsJsonRpcResponse = _chunkOLLG4H35js.assertIsJsonRpcResponse; exports.assertIsJsonRpcSuccess = _chunkOLLG4H35js.assertIsJsonRpcSuccess; exports.assertIsPendingJsonRpcResponse = _chunkOLLG4H35js.assertIsPendingJsonRpcResponse; exports.exactOptional = _chunkOLLG4H35js.exactOptional; exports.getJsonRpcIdValidator = _chunkOLLG4H35js.getJsonRpcIdValidator; exports.getJsonSize = _chunkOLLG4H35js.getJsonSize; exports.getSafeJson = _chunkOLLG4H35js.getSafeJson; exports.isJsonRpcError = _chunkOLLG4H35js.isJsonRpcError; exports.isJsonRpcFailure = _chunkOLLG4H35js.isJsonRpcFailure; exports.isJsonRpcNotification = _chunkOLLG4H35js.isJsonRpcNotification; exports.isJsonRpcRequest = _chunkOLLG4H35js.isJsonRpcRequest; exports.isJsonRpcResponse = _chunkOLLG4H35js.isJsonRpcResponse; exports.isJsonRpcSuccess = _chunkOLLG4H35js.isJsonRpcSuccess; exports.isPendingJsonRpcResponse = _chunkOLLG4H35js.isPendingJsonRpcResponse; exports.isValidJson = _chunkOLLG4H35js.isValidJson; exports.jsonrpc2 = _chunkOLLG4H35js.jsonrpc2; exports.object = _chunkOLLG4H35js.object;
|
|
75
75
|
//# sourceMappingURL=json.js.map
|
package/dist/json.mjs
CHANGED
|
@@ -32,9 +32,9 @@ import {
|
|
|
32
32
|
isValidJson,
|
|
33
33
|
jsonrpc2,
|
|
34
34
|
object
|
|
35
|
-
} from "./chunk-
|
|
36
|
-
import "./chunk-
|
|
37
|
-
import "./chunk-
|
|
35
|
+
} from "./chunk-6C35XQOF.mjs";
|
|
36
|
+
import "./chunk-74DGVJVE.mjs";
|
|
37
|
+
import "./chunk-XYGUOY6N.mjs";
|
|
38
38
|
import "./chunk-H4YFDLB7.mjs";
|
|
39
39
|
import "./chunk-X66SUIEF.mjs";
|
|
40
40
|
export {
|
package/dist/node.js
CHANGED
|
@@ -8,17 +8,20 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
12
|
-
require('./chunk-
|
|
11
|
+
var _chunkBFQDMI3Mjs = require('./chunk-BFQDMI3M.js');
|
|
12
|
+
require('./chunk-5AVWINSB.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunkVFXTVNXNjs = require('./chunk-VFXTVNXN.js');
|
|
19
19
|
require('./chunk-LC2CRSWD.js');
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
var _chunk4NIRTM4Mjs = require('./chunk-4NIRTM4M.js');
|
|
23
|
+
|
|
24
|
+
|
|
22
25
|
|
|
23
26
|
|
|
24
27
|
var _chunk4RMX5YWEjs = require('./chunk-4RMX5YWE.js');
|
|
@@ -33,7 +36,7 @@ require('./chunk-UOTVU7OQ.js');
|
|
|
33
36
|
|
|
34
37
|
|
|
35
38
|
|
|
36
|
-
var
|
|
39
|
+
var _chunk4D6XQBHAjs = require('./chunk-4D6XQBHA.js');
|
|
37
40
|
|
|
38
41
|
|
|
39
42
|
|
|
@@ -68,7 +71,7 @@ var _chunkZRNIY7OWjs = require('./chunk-ZRNIY7OW.js');
|
|
|
68
71
|
|
|
69
72
|
|
|
70
73
|
|
|
71
|
-
var
|
|
74
|
+
var _chunkOLLG4H35js = require('./chunk-OLLG4H35.js');
|
|
72
75
|
require('./chunk-RKRGAFXY.js');
|
|
73
76
|
|
|
74
77
|
|
|
@@ -95,16 +98,16 @@ var _chunk2LBGT4GHjs = require('./chunk-2LBGT4GH.js');
|
|
|
95
98
|
var _chunkU7ZUGCE7js = require('./chunk-U7ZUGCE7.js');
|
|
96
99
|
|
|
97
100
|
|
|
98
|
-
var
|
|
101
|
+
var _chunkE4C7EW4Rjs = require('./chunk-E4C7EW4R.js');
|
|
99
102
|
|
|
100
103
|
|
|
101
|
-
var
|
|
104
|
+
var _chunk6NZW4WK4js = require('./chunk-6NZW4WK4.js');
|
|
102
105
|
|
|
103
106
|
|
|
104
107
|
|
|
105
108
|
|
|
106
109
|
|
|
107
|
-
var
|
|
110
|
+
var _chunkDHVKFDHQjs = require('./chunk-DHVKFDHQ.js');
|
|
108
111
|
|
|
109
112
|
|
|
110
113
|
|
|
@@ -136,20 +139,20 @@ var _chunkJCYFTGEDjs = require('./chunk-JCYFTGED.js');
|
|
|
136
139
|
|
|
137
140
|
|
|
138
141
|
|
|
139
|
-
var
|
|
142
|
+
var _chunkQEPVHEP7js = require('./chunk-QEPVHEP7.js');
|
|
140
143
|
|
|
141
144
|
|
|
142
145
|
|
|
143
146
|
|
|
144
147
|
|
|
145
|
-
var
|
|
148
|
+
var _chunk6ZDHSOUVjs = require('./chunk-6ZDHSOUV.js');
|
|
146
149
|
|
|
147
150
|
|
|
148
151
|
|
|
149
152
|
|
|
150
153
|
|
|
151
154
|
|
|
152
|
-
var
|
|
155
|
+
var _chunkIZC266HSjs = require('./chunk-IZC266HS.js');
|
|
153
156
|
|
|
154
157
|
|
|
155
158
|
|
|
@@ -305,5 +308,6 @@ require('./chunk-EQMZL4XU.js');
|
|
|
305
308
|
|
|
306
309
|
|
|
307
310
|
|
|
308
|
-
|
|
311
|
+
|
|
312
|
+
exports.AssertionError = _chunk6ZDHSOUVjs.AssertionError; exports.CAIP_ACCOUNT_ADDRESS_REGEX = _chunkU7ZUGCE7js.CAIP_ACCOUNT_ADDRESS_REGEX; exports.CAIP_ACCOUNT_ID_REGEX = _chunkU7ZUGCE7js.CAIP_ACCOUNT_ID_REGEX; exports.CAIP_CHAIN_ID_REGEX = _chunkU7ZUGCE7js.CAIP_CHAIN_ID_REGEX; exports.CAIP_NAMESPACE_REGEX = _chunkU7ZUGCE7js.CAIP_NAMESPACE_REGEX; exports.CAIP_REFERENCE_REGEX = _chunkU7ZUGCE7js.CAIP_REFERENCE_REGEX; exports.CaipAccountAddressStruct = _chunkU7ZUGCE7js.CaipAccountAddressStruct; exports.CaipAccountIdStruct = _chunkU7ZUGCE7js.CaipAccountIdStruct; exports.CaipChainIdStruct = _chunkU7ZUGCE7js.CaipChainIdStruct; exports.CaipNamespaceStruct = _chunkU7ZUGCE7js.CaipNamespaceStruct; exports.CaipReferenceStruct = _chunkU7ZUGCE7js.CaipReferenceStruct; exports.ChecksumStruct = _chunkE4C7EW4Rjs.ChecksumStruct; exports.Duration = _chunk4RMX5YWEjs.Duration; exports.ESCAPE_CHARACTERS_REGEXP = _chunkQVEKZRZ2js.ESCAPE_CHARACTERS_REGEXP; exports.FrozenMap = _chunkZ2RGWDD7js.FrozenMap; exports.FrozenSet = _chunkZ2RGWDD7js.FrozenSet; exports.HexAddressStruct = _chunkQEPVHEP7js.HexAddressStruct; exports.HexChecksumAddressStruct = _chunkQEPVHEP7js.HexChecksumAddressStruct; exports.HexStruct = _chunkQEPVHEP7js.HexStruct; exports.JsonRpcErrorStruct = _chunkOLLG4H35js.JsonRpcErrorStruct; exports.JsonRpcFailureStruct = _chunkOLLG4H35js.JsonRpcFailureStruct; exports.JsonRpcIdStruct = _chunkOLLG4H35js.JsonRpcIdStruct; exports.JsonRpcNotificationStruct = _chunkOLLG4H35js.JsonRpcNotificationStruct; exports.JsonRpcParamsStruct = _chunkOLLG4H35js.JsonRpcParamsStruct; exports.JsonRpcRequestStruct = _chunkOLLG4H35js.JsonRpcRequestStruct; exports.JsonRpcResponseStruct = _chunkOLLG4H35js.JsonRpcResponseStruct; exports.JsonRpcSuccessStruct = _chunkOLLG4H35js.JsonRpcSuccessStruct; exports.JsonRpcVersionStruct = _chunkOLLG4H35js.JsonRpcVersionStruct; exports.JsonSize = _chunkQVEKZRZ2js.JsonSize; exports.JsonStruct = _chunkOLLG4H35js.JsonStruct; exports.PendingJsonRpcResponseStruct = _chunkOLLG4H35js.PendingJsonRpcResponseStruct; exports.StrictHexStruct = _chunkQEPVHEP7js.StrictHexStruct; exports.UnsafeJsonStruct = _chunkOLLG4H35js.UnsafeJsonStruct; exports.VersionRangeStruct = _chunk4D6XQBHAjs.VersionRangeStruct; exports.VersionStruct = _chunk4D6XQBHAjs.VersionStruct; exports.add0x = _chunkQEPVHEP7js.add0x; exports.assert = _chunk6ZDHSOUVjs.assert; exports.assertExhaustive = _chunk6ZDHSOUVjs.assertExhaustive; exports.assertIsBytes = _chunkQEPVHEP7js.assertIsBytes; exports.assertIsHexString = _chunkQEPVHEP7js.assertIsHexString; exports.assertIsJsonRpcError = _chunkOLLG4H35js.assertIsJsonRpcError; exports.assertIsJsonRpcFailure = _chunkOLLG4H35js.assertIsJsonRpcFailure; exports.assertIsJsonRpcNotification = _chunkOLLG4H35js.assertIsJsonRpcNotification; exports.assertIsJsonRpcRequest = _chunkOLLG4H35js.assertIsJsonRpcRequest; exports.assertIsJsonRpcResponse = _chunkOLLG4H35js.assertIsJsonRpcResponse; exports.assertIsJsonRpcSuccess = _chunkOLLG4H35js.assertIsJsonRpcSuccess; exports.assertIsPendingJsonRpcResponse = _chunkOLLG4H35js.assertIsPendingJsonRpcResponse; exports.assertIsSemVerRange = _chunk4D6XQBHAjs.assertIsSemVerRange; exports.assertIsSemVerVersion = _chunk4D6XQBHAjs.assertIsSemVerVersion; exports.assertIsStrictHexString = _chunkQEPVHEP7js.assertIsStrictHexString; exports.assertStruct = _chunk6ZDHSOUVjs.assertStruct; exports.base64 = _chunk6NZW4WK4js.base64; exports.base64ToBytes = _chunkQEPVHEP7js.base64ToBytes; exports.bigIntToBytes = _chunkQEPVHEP7js.bigIntToBytes; exports.bigIntToHex = _chunkVFXTVNXNjs.bigIntToHex; exports.bytesToBase64 = _chunkQEPVHEP7js.bytesToBase64; exports.bytesToBigInt = _chunkQEPVHEP7js.bytesToBigInt; exports.bytesToHex = _chunkQEPVHEP7js.bytesToHex; exports.bytesToNumber = _chunkQEPVHEP7js.bytesToNumber; exports.bytesToSignedBigInt = _chunkQEPVHEP7js.bytesToSignedBigInt; exports.bytesToString = _chunkQEPVHEP7js.bytesToString; exports.calculateNumberSize = _chunkQVEKZRZ2js.calculateNumberSize; exports.calculateStringSize = _chunkQVEKZRZ2js.calculateStringSize; exports.concatBytes = _chunkQEPVHEP7js.concatBytes; exports.createBigInt = _chunkDHVKFDHQjs.createBigInt; exports.createBytes = _chunkDHVKFDHQjs.createBytes; exports.createDataView = _chunkQEPVHEP7js.createDataView; exports.createDeferredPromise = _chunk4NIRTM4Mjs.createDeferredPromise; exports.createHex = _chunkDHVKFDHQjs.createHex; exports.createModuleLogger = _chunk2LBGT4GHjs.createModuleLogger; exports.createNumber = _chunkDHVKFDHQjs.createNumber; exports.createProjectLogger = _chunk2LBGT4GHjs.createProjectLogger; exports.createSandbox = _chunkBFQDMI3Mjs.createSandbox; exports.directoryExists = _chunkBFQDMI3Mjs.directoryExists; exports.ensureDirectoryStructureExists = _chunkBFQDMI3Mjs.ensureDirectoryStructureExists; exports.exactOptional = _chunkOLLG4H35js.exactOptional; exports.fileExists = _chunkBFQDMI3Mjs.fileExists; exports.forceRemove = _chunkBFQDMI3Mjs.forceRemove; exports.getChecksumAddress = _chunkQEPVHEP7js.getChecksumAddress; exports.getErrorMessage = _chunkIZC266HSjs.getErrorMessage; exports.getJsonRpcIdValidator = _chunkOLLG4H35js.getJsonRpcIdValidator; exports.getJsonSize = _chunkOLLG4H35js.getJsonSize; exports.getKnownPropertyNames = _chunkQVEKZRZ2js.getKnownPropertyNames; exports.getSafeJson = _chunkOLLG4H35js.getSafeJson; exports.gtRange = _chunk4D6XQBHAjs.gtRange; exports.gtVersion = _chunk4D6XQBHAjs.gtVersion; exports.hasProperty = _chunkQVEKZRZ2js.hasProperty; exports.hexToBigInt = _chunkVFXTVNXNjs.hexToBigInt; exports.hexToBytes = _chunkQEPVHEP7js.hexToBytes; exports.hexToNumber = _chunkVFXTVNXNjs.hexToNumber; exports.inMilliseconds = _chunk4RMX5YWEjs.inMilliseconds; exports.isASCII = _chunkQVEKZRZ2js.isASCII; exports.isBytes = _chunkQEPVHEP7js.isBytes; exports.isCaipAccountAddress = _chunkU7ZUGCE7js.isCaipAccountAddress; exports.isCaipAccountId = _chunkU7ZUGCE7js.isCaipAccountId; exports.isCaipChainId = _chunkU7ZUGCE7js.isCaipChainId; exports.isCaipNamespace = _chunkU7ZUGCE7js.isCaipNamespace; exports.isCaipReference = _chunkU7ZUGCE7js.isCaipReference; exports.isErrorWithCode = _chunkIZC266HSjs.isErrorWithCode; exports.isErrorWithMessage = _chunkIZC266HSjs.isErrorWithMessage; exports.isErrorWithStack = _chunkIZC266HSjs.isErrorWithStack; exports.isHexString = _chunkQEPVHEP7js.isHexString; exports.isJsonRpcError = _chunkOLLG4H35js.isJsonRpcError; exports.isJsonRpcFailure = _chunkOLLG4H35js.isJsonRpcFailure; exports.isJsonRpcNotification = _chunkOLLG4H35js.isJsonRpcNotification; exports.isJsonRpcRequest = _chunkOLLG4H35js.isJsonRpcRequest; exports.isJsonRpcResponse = _chunkOLLG4H35js.isJsonRpcResponse; exports.isJsonRpcSuccess = _chunkOLLG4H35js.isJsonRpcSuccess; exports.isNonEmptyArray = _chunkQVEKZRZ2js.isNonEmptyArray; exports.isNullOrUndefined = _chunkQVEKZRZ2js.isNullOrUndefined; exports.isObject = _chunkQVEKZRZ2js.isObject; exports.isPendingJsonRpcResponse = _chunkOLLG4H35js.isPendingJsonRpcResponse; exports.isPlainObject = _chunkQVEKZRZ2js.isPlainObject; exports.isStrictHexString = _chunkQEPVHEP7js.isStrictHexString; exports.isValidChecksumAddress = _chunkQEPVHEP7js.isValidChecksumAddress; exports.isValidHexAddress = _chunkQEPVHEP7js.isValidHexAddress; exports.isValidJson = _chunkOLLG4H35js.isValidJson; exports.isValidSemVerRange = _chunk4D6XQBHAjs.isValidSemVerRange; exports.isValidSemVerVersion = _chunk4D6XQBHAjs.isValidSemVerVersion; exports.jsonrpc2 = _chunkOLLG4H35js.jsonrpc2; exports.numberToBytes = _chunkQEPVHEP7js.numberToBytes; exports.numberToHex = _chunkVFXTVNXNjs.numberToHex; exports.object = _chunkOLLG4H35js.object; exports.parseCaipAccountId = _chunkU7ZUGCE7js.parseCaipAccountId; exports.parseCaipChainId = _chunkU7ZUGCE7js.parseCaipChainId; exports.readFile = _chunkBFQDMI3Mjs.readFile; exports.readJsonFile = _chunkBFQDMI3Mjs.readJsonFile; exports.remove0x = _chunkQEPVHEP7js.remove0x; exports.satisfiesVersionRange = _chunk4D6XQBHAjs.satisfiesVersionRange; exports.signedBigIntToBytes = _chunkQEPVHEP7js.signedBigIntToBytes; exports.stringToBytes = _chunkQEPVHEP7js.stringToBytes; exports.timeSince = _chunk4RMX5YWEjs.timeSince; exports.valueToBytes = _chunkQEPVHEP7js.valueToBytes; exports.wrapError = _chunkIZC266HSjs.wrapError; exports.writeFile = _chunkBFQDMI3Mjs.writeFile; exports.writeJsonFile = _chunkBFQDMI3Mjs.writeJsonFile;
|
|
309
313
|
//# sourceMappingURL=node.js.map
|
package/dist/node.mjs
CHANGED
|
@@ -8,15 +8,18 @@ import {
|
|
|
8
8
|
readJsonFile,
|
|
9
9
|
writeFile,
|
|
10
10
|
writeJsonFile
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-52OU772R.mjs";
|
|
12
|
+
import "./chunk-622IOGVI.mjs";
|
|
13
13
|
import {
|
|
14
14
|
bigIntToHex,
|
|
15
15
|
hexToBigInt,
|
|
16
16
|
hexToNumber,
|
|
17
17
|
numberToHex
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-S3UHBN2Z.mjs";
|
|
19
19
|
import "./chunk-AY6FDCBT.mjs";
|
|
20
|
+
import {
|
|
21
|
+
createDeferredPromise
|
|
22
|
+
} from "./chunk-B7LIM2PK.mjs";
|
|
20
23
|
import {
|
|
21
24
|
Duration,
|
|
22
25
|
inMilliseconds,
|
|
@@ -33,7 +36,7 @@ import {
|
|
|
33
36
|
isValidSemVerRange,
|
|
34
37
|
isValidSemVerVersion,
|
|
35
38
|
satisfiesVersionRange
|
|
36
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-ROQSKDP5.mjs";
|
|
37
40
|
import {
|
|
38
41
|
JsonRpcErrorStruct,
|
|
39
42
|
JsonRpcFailureStruct,
|
|
@@ -68,7 +71,7 @@ import {
|
|
|
68
71
|
isValidJson,
|
|
69
72
|
jsonrpc2,
|
|
70
73
|
object
|
|
71
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-6C35XQOF.mjs";
|
|
72
75
|
import "./chunk-I575FZFH.mjs";
|
|
73
76
|
import {
|
|
74
77
|
createModuleLogger,
|
|
@@ -95,16 +98,16 @@ import {
|
|
|
95
98
|
} from "./chunk-TGOMTREC.mjs";
|
|
96
99
|
import {
|
|
97
100
|
ChecksumStruct
|
|
98
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-GZS3IQBZ.mjs";
|
|
99
102
|
import {
|
|
100
103
|
base64
|
|
101
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-NQMRFZHB.mjs";
|
|
102
105
|
import {
|
|
103
106
|
createBigInt,
|
|
104
107
|
createBytes,
|
|
105
108
|
createHex,
|
|
106
109
|
createNumber
|
|
107
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-O3EIM33O.mjs";
|
|
108
111
|
import {
|
|
109
112
|
HexAddressStruct,
|
|
110
113
|
HexChecksumAddressStruct,
|
|
@@ -136,20 +139,20 @@ import {
|
|
|
136
139
|
signedBigIntToBytes,
|
|
137
140
|
stringToBytes,
|
|
138
141
|
valueToBytes
|
|
139
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-VA2DRBDE.mjs";
|
|
140
143
|
import {
|
|
141
144
|
AssertionError,
|
|
142
145
|
assert,
|
|
143
146
|
assertExhaustive,
|
|
144
147
|
assertStruct
|
|
145
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-74DGVJVE.mjs";
|
|
146
149
|
import {
|
|
147
150
|
getErrorMessage,
|
|
148
151
|
isErrorWithCode,
|
|
149
152
|
isErrorWithMessage,
|
|
150
153
|
isErrorWithStack,
|
|
151
154
|
wrapError
|
|
152
|
-
} from "./chunk-
|
|
155
|
+
} from "./chunk-XYGUOY6N.mjs";
|
|
153
156
|
import {
|
|
154
157
|
ESCAPE_CHARACTERS_REGEXP,
|
|
155
158
|
JsonSize,
|
|
@@ -237,6 +240,7 @@ export {
|
|
|
237
240
|
createBigInt,
|
|
238
241
|
createBytes,
|
|
239
242
|
createDataView,
|
|
243
|
+
createDeferredPromise,
|
|
240
244
|
createHex,
|
|
241
245
|
createModuleLogger,
|
|
242
246
|
createNumber,
|
package/dist/number.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
require('./chunk-
|
|
8
|
-
require('./chunk-
|
|
9
|
-
require('./chunk-
|
|
6
|
+
var _chunkVFXTVNXNjs = require('./chunk-VFXTVNXN.js');
|
|
7
|
+
require('./chunk-QEPVHEP7.js');
|
|
8
|
+
require('./chunk-6ZDHSOUV.js');
|
|
9
|
+
require('./chunk-IZC266HS.js');
|
|
10
10
|
require('./chunk-QVEKZRZ2.js');
|
|
11
11
|
require('./chunk-3W5G4CYI.js');
|
|
12
12
|
|
|
@@ -14,5 +14,5 @@ require('./chunk-3W5G4CYI.js');
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
exports.bigIntToHex =
|
|
17
|
+
exports.bigIntToHex = _chunkVFXTVNXNjs.bigIntToHex; exports.hexToBigInt = _chunkVFXTVNXNjs.hexToBigInt; exports.hexToNumber = _chunkVFXTVNXNjs.hexToNumber; exports.numberToHex = _chunkVFXTVNXNjs.numberToHex;
|
|
18
18
|
//# sourceMappingURL=number.js.map
|
package/dist/number.mjs
CHANGED
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
hexToBigInt,
|
|
4
4
|
hexToNumber,
|
|
5
5
|
numberToHex
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-S3UHBN2Z.mjs";
|
|
7
|
+
import "./chunk-VA2DRBDE.mjs";
|
|
8
|
+
import "./chunk-74DGVJVE.mjs";
|
|
9
|
+
import "./chunk-XYGUOY6N.mjs";
|
|
10
10
|
import "./chunk-H4YFDLB7.mjs";
|
|
11
11
|
import "./chunk-X66SUIEF.mjs";
|
|
12
12
|
export {
|
package/dist/promise.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunk4NIRTM4Mjs = require('./chunk-4NIRTM4M.js');
|
|
4
|
+
require('./chunk-3W5G4CYI.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
exports.createDeferredPromise = _chunk4NIRTM4Mjs.createDeferredPromise;
|
|
8
|
+
//# sourceMappingURL=promise.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/promise.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A deferred Promise.
|
|
3
|
+
*
|
|
4
|
+
* A deferred Promise is one that can be resolved or rejected independently of
|
|
5
|
+
* the Promise construction.
|
|
6
|
+
* @template Result - The result type of the Promise.
|
|
7
|
+
*/
|
|
8
|
+
export declare type DeferredPromise<Result = void> = {
|
|
9
|
+
/**
|
|
10
|
+
* The Promise that has been deferred.
|
|
11
|
+
*/
|
|
12
|
+
promise: Promise<Result>;
|
|
13
|
+
/**
|
|
14
|
+
* A function that resolves the Promise.
|
|
15
|
+
*/
|
|
16
|
+
resolve: (result: Result) => void;
|
|
17
|
+
/**
|
|
18
|
+
* A function that rejects the Promise.
|
|
19
|
+
*/
|
|
20
|
+
reject: (error: unknown) => void;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Create a defered Promise.
|
|
24
|
+
*
|
|
25
|
+
* @param args - The arguments.
|
|
26
|
+
* @param args.suppressUnhandledRejection - This option adds an empty error handler
|
|
27
|
+
* to the Promise to suppress the UnhandledPromiseRejection error. This can be
|
|
28
|
+
* useful if the deferred Promise is sometimes intentionally not used.
|
|
29
|
+
* @returns A deferred Promise.
|
|
30
|
+
* @template Result - The result type of the Promise.
|
|
31
|
+
*/
|
|
32
|
+
export declare function createDeferredPromise<Result = void>({ suppressUnhandledRejection, }?: {
|
|
33
|
+
suppressUnhandledRejection?: boolean;
|
|
34
|
+
}): DeferredPromise<Result>;
|
|
35
|
+
//# sourceMappingURL=promise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../../src/promise.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,oBAAY,eAAe,CAAC,MAAM,GAAG,IAAI,IAAI;IAC3C;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB;;OAEG;IACH,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;OAEG;IACH,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,GAAG,IAAI,EAAE,EACnD,0BAAkC,GACnC,GAAE;IACD,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACjC,GAAG,eAAe,CAAC,MAAM,CAAC,CAqB/B"}
|
package/dist/versions.js
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
12
|
-
require('./chunk-
|
|
13
|
-
require('./chunk-
|
|
11
|
+
var _chunk4D6XQBHAjs = require('./chunk-4D6XQBHA.js');
|
|
12
|
+
require('./chunk-6ZDHSOUV.js');
|
|
13
|
+
require('./chunk-IZC266HS.js');
|
|
14
14
|
require('./chunk-QVEKZRZ2.js');
|
|
15
15
|
require('./chunk-3W5G4CYI.js');
|
|
16
16
|
|
|
@@ -23,5 +23,5 @@ require('./chunk-3W5G4CYI.js');
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
exports.VersionRangeStruct =
|
|
26
|
+
exports.VersionRangeStruct = _chunk4D6XQBHAjs.VersionRangeStruct; exports.VersionStruct = _chunk4D6XQBHAjs.VersionStruct; exports.assertIsSemVerRange = _chunk4D6XQBHAjs.assertIsSemVerRange; exports.assertIsSemVerVersion = _chunk4D6XQBHAjs.assertIsSemVerVersion; exports.gtRange = _chunk4D6XQBHAjs.gtRange; exports.gtVersion = _chunk4D6XQBHAjs.gtVersion; exports.isValidSemVerRange = _chunk4D6XQBHAjs.isValidSemVerRange; exports.isValidSemVerVersion = _chunk4D6XQBHAjs.isValidSemVerVersion; exports.satisfiesVersionRange = _chunk4D6XQBHAjs.satisfiesVersionRange;
|
|
27
27
|
//# sourceMappingURL=versions.js.map
|
package/dist/versions.mjs
CHANGED
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
isValidSemVerRange,
|
|
9
9
|
isValidSemVerVersion,
|
|
10
10
|
satisfiesVersionRange
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-ROQSKDP5.mjs";
|
|
12
|
+
import "./chunk-74DGVJVE.mjs";
|
|
13
|
+
import "./chunk-XYGUOY6N.mjs";
|
|
14
14
|
import "./chunk-H4YFDLB7.mjs";
|
|
15
15
|
import "./chunk-X66SUIEF.mjs";
|
|
16
16
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/utils",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.0",
|
|
4
4
|
"description": "Various JavaScript/TypeScript utilities of wide relevance to the MetaMask codebase",
|
|
5
5
|
"homepage": "https://github.com/MetaMask/utils#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"stdio-mock": "^1.2.0",
|
|
92
92
|
"ts-jest": "^29.0.3",
|
|
93
93
|
"ts-node": "^10.7.0",
|
|
94
|
-
"tsd": "^0.
|
|
94
|
+
"tsd": "^0.29.0",
|
|
95
95
|
"tsup": "^7.2.0",
|
|
96
96
|
"typedoc": "^0.23.15",
|
|
97
97
|
"typescript": "~4.8.4"
|
package/dist/chunk-2TBCL6EF.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";//# sourceMappingURL=chunk-2TBCL6EF.js.map
|
package/dist/chunk-4JNG5UTO.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkYQJBIHC7js = require('./chunk-YQJBIHC7.js');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _chunkVBYRLAP6js = require('./chunk-VBYRLAP6.js');
|
|
8
|
-
|
|
9
|
-
// src/number.ts
|
|
10
|
-
var numberToHex = (value) => {
|
|
11
|
-
_chunkVBYRLAP6js.assert.call(void 0, typeof value === "number", "Value must be a number.");
|
|
12
|
-
_chunkVBYRLAP6js.assert.call(void 0, value >= 0, "Value must be a non-negative number.");
|
|
13
|
-
_chunkVBYRLAP6js.assert.call(void 0,
|
|
14
|
-
Number.isSafeInteger(value),
|
|
15
|
-
"Value is not a safe integer. Use `bigIntToHex` instead."
|
|
16
|
-
);
|
|
17
|
-
return _chunkYQJBIHC7js.add0x.call(void 0, value.toString(16));
|
|
18
|
-
};
|
|
19
|
-
var bigIntToHex = (value) => {
|
|
20
|
-
_chunkVBYRLAP6js.assert.call(void 0, typeof value === "bigint", "Value must be a bigint.");
|
|
21
|
-
_chunkVBYRLAP6js.assert.call(void 0, value >= 0, "Value must be a non-negative bigint.");
|
|
22
|
-
return _chunkYQJBIHC7js.add0x.call(void 0, value.toString(16));
|
|
23
|
-
};
|
|
24
|
-
var hexToNumber = (value) => {
|
|
25
|
-
_chunkYQJBIHC7js.assertIsHexString.call(void 0, value);
|
|
26
|
-
const numberValue = parseInt(value, 16);
|
|
27
|
-
_chunkVBYRLAP6js.assert.call(void 0,
|
|
28
|
-
Number.isSafeInteger(numberValue),
|
|
29
|
-
"Value is not a safe integer. Use `hexToBigInt` instead."
|
|
30
|
-
);
|
|
31
|
-
return numberValue;
|
|
32
|
-
};
|
|
33
|
-
var hexToBigInt = (value) => {
|
|
34
|
-
_chunkYQJBIHC7js.assertIsHexString.call(void 0, value);
|
|
35
|
-
return BigInt(_chunkYQJBIHC7js.add0x.call(void 0, value));
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
exports.numberToHex = numberToHex; exports.bigIntToHex = bigIntToHex; exports.hexToNumber = hexToNumber; exports.hexToBigInt = hexToBigInt;
|
|
44
|
-
//# sourceMappingURL=chunk-4JNG5UTO.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors.ts"],"names":[],"mappings":";;;;;;AAAA,SAAS,sBAAsB;AAY/B,SAAS,QAAQ,OAAgC;AAC/C,SACE,iBAAiB,SAChB,SAAS,KAAK,KAAK,MAAM,YAAY,SAAS;AAEnD;AAUO,SAAS,gBAAgB,OAA2C;AACzE,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU;AAClE;AASO,SAAS,mBACd,OAC8B;AAC9B,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,aAAa;AACrE;AASO,SAAS,iBAAiB,OAA4C;AAC3E,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,WAAW;AACnE;AAWO,SAAS,gBAAgB,OAAwB;AACtD,MAAI,mBAAmB,KAAK,KAAK,OAAO,MAAM,YAAY,UAAU;AAClE,WAAO,MAAM;AAAA,EACf;AAEA,MAAI,kBAAkB,KAAK,GAAG;AAC5B,WAAO;AAAA,EACT;AAEA,SAAO,OAAO,KAAK;AACrB;AAeO,SAAS,UACd,eACA,SAC2B;AAC3B,MAAI,QAAQ,aAAa,GAAG;AAC1B,UAAM,QACJ,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAUb,IAAI,MAAM,SAAS,EAAE,OAAO,cAAc,CAAC;AAAA,QAC3C,IAAI,eAAe,SAAS,EAAE,OAAO,cAAc,CAAC;AAE1D,QAAI,gBAAgB,aAAa,GAAG;AAClC,YAAM,OAAO,cAAc;AAAA,IAC7B;AAEA,WAAO;AAAA,EACT;AAEA,MAAI,QAAQ,SAAS,GAAG;AACtB,WAAO,IAAI,MAAM,GAAG,OAAO,aAAa,CAAC,KAAK,OAAO,EAAE;AAAA,EACzD;AAEA,SAAO,IAAI,MAAM,OAAO,aAAa,CAAC;AACxC","sourcesContent":["import { ErrorWithCause } from 'pony-cause';\n\nimport { isNullOrUndefined, isObject } from './misc';\n\n/**\n * Type guard for determining whether the given value is an instance of Error.\n * For errors generated via `fs.promises`, `error instanceof Error` won't work,\n * so we have to come up with another way of testing.\n *\n * @param error - The object to check.\n * @returns A boolean.\n */\nfunction isError(error: unknown): error is Error {\n return (\n error instanceof Error ||\n (isObject(error) && error.constructor.name === 'Error')\n );\n}\n\n/**\n * Type guard for determining whether the given value is an error object with a\n * `code` property such as the type of error that Node throws for filesystem\n * operations, etc.\n *\n * @param error - The object to check.\n * @returns A boolean.\n */\nexport function isErrorWithCode(error: unknown): error is { code: string } {\n return typeof error === 'object' && error !== null && 'code' in error;\n}\n\n/**\n * Type guard for determining whether the given value is an error object with a\n * `message` property, such as an instance of Error.\n *\n * @param error - The object to check.\n * @returns A boolean.\n */\nexport function isErrorWithMessage(\n error: unknown,\n): error is { message: string } {\n return typeof error === 'object' && error !== null && 'message' in error;\n}\n\n/**\n * Type guard for determining whether the given value is an error object with a\n * `stack` property, such as an instance of Error.\n *\n * @param error - The object to check.\n * @returns A boolean.\n */\nexport function isErrorWithStack(error: unknown): error is { stack: string } {\n return typeof error === 'object' && error !== null && 'stack' in error;\n}\n\n/**\n * Attempts to obtain the message from a possible error object, defaulting to an\n * empty string if it is impossible to do so.\n *\n * @param error - The possible error to get the message from.\n * @returns The message if `error` is an object with a `message` property;\n * the string version of `error` if it is not `undefined` or `null`; otherwise\n * an empty string.\n */\nexport function getErrorMessage(error: unknown): string {\n if (isErrorWithMessage(error) && typeof error.message === 'string') {\n return error.message;\n }\n\n if (isNullOrUndefined(error)) {\n return '';\n }\n\n return String(error);\n}\n\n/**\n * Builds a new error object, linking it to the original error via the `cause`\n * property if it is an Error.\n *\n * This function is useful to reframe error messages in general, but is\n * _critical_ when interacting with any of Node's filesystem functions as\n * provided via `fs.promises`, because these do not produce stack traces in the\n * case of an I/O error (see <https://github.com/nodejs/node/issues/30944>).\n *\n * @param originalError - The error to be wrapped (something throwable).\n * @param message - The desired message of the new error.\n * @returns A new error object.\n */\nexport function wrapError<Throwable>(\n originalError: Throwable,\n message: string,\n): Error & { code?: string } {\n if (isError(originalError)) {\n const error: Error & { code?: string } =\n Error.length === 2\n ? // This branch is getting tested by using the Node version that\n // supports `cause` on the Error constructor.\n // istanbul ignore next\n // Also, for some reason `tsserver` is not complaining that the\n // Error constructor doesn't support a second argument in the editor,\n // but `tsc` does. I'm not sure why, but we disable this in the\n // meantime.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n new Error(message, { cause: originalError })\n : new ErrorWithCause(message, { cause: originalError });\n\n if (isErrorWithCode(originalError)) {\n error.code = originalError.code;\n }\n\n return error;\n }\n\n if (message.length > 0) {\n return new Error(`${String(originalError)}: ${message}`);\n }\n\n return new Error(String(originalError));\n}\n"]}
|
package/dist/chunk-DYMCEQIV.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=chunk-DYMCEQIV.mjs.map
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|