viem 0.2.2 → 0.2.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/abi.js +2 -2
- package/dist/abi.mjs +1 -1
- package/dist/accounts/index.js +17 -17
- package/dist/accounts/index.mjs +2 -2
- package/dist/chains.js +89 -89
- package/dist/chains.mjs +1 -1
- package/dist/{chunk-IGFTD4HW.js → chunk-E6JLGC6W.js} +16 -16
- package/dist/chunk-E6JLGC6W.js.map +1 -0
- package/dist/{chunk-ZXUGY7ZA.mjs → chunk-FYMFYRJQ.mjs} +2 -2
- package/dist/{chunk-EP6BQLGR.js → chunk-TXGT3ARS.js} +6 -6
- package/dist/{chunk-GJGV3W5S.mjs → chunk-ZM26BDGF.mjs} +16 -16
- package/dist/chunk-ZM26BDGF.mjs.map +1 -0
- package/dist/contract.js +2 -2
- package/dist/contract.mjs +1 -1
- package/dist/ens.js +2 -2
- package/dist/ens.mjs +1 -1
- package/dist/ethers.js +4 -4
- package/dist/ethers.mjs +2 -2
- package/dist/index.js +94 -94
- package/dist/index.mjs +1 -1
- package/dist/public.js +2 -2
- package/dist/public.mjs +1 -1
- package/dist/test.js +2 -2
- package/dist/test.mjs +1 -1
- package/dist/utils/index.js +2 -2
- package/dist/utils/index.mjs +1 -1
- package/dist/wallet.js +2 -2
- package/dist/wallet.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-GJGV3W5S.mjs.map +0 -1
- package/dist/chunk-IGFTD4HW.js.map +0 -1
- /package/dist/{chunk-ZXUGY7ZA.mjs.map → chunk-FYMFYRJQ.mjs.map} +0 -0
- /package/dist/{chunk-EP6BQLGR.js.map → chunk-TXGT3ARS.js.map} +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
import {
|
2
2
|
InvalidAddressError,
|
3
3
|
isAddress
|
4
|
-
} from "./chunk-
|
4
|
+
} from "./chunk-ZM26BDGF.mjs";
|
5
5
|
|
6
6
|
// src/accounts/toAccount.ts
|
7
7
|
function toAccount(source) {
|
@@ -28,4 +28,4 @@ function toAccount(source) {
|
|
28
28
|
export {
|
29
29
|
toAccount
|
30
30
|
};
|
31
|
-
//# sourceMappingURL=chunk-
|
31
|
+
//# sourceMappingURL=chunk-FYMFYRJQ.mjs.map
|
@@ -1,20 +1,20 @@
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
2
2
|
|
3
3
|
|
4
|
-
var
|
4
|
+
var _chunkE6JLGC6Wjs = require('./chunk-E6JLGC6W.js');
|
5
5
|
|
6
6
|
// src/accounts/toAccount.ts
|
7
7
|
function toAccount(source) {
|
8
8
|
if (typeof source === "string") {
|
9
|
-
if (!
|
10
|
-
throw new (0,
|
9
|
+
if (!_chunkE6JLGC6Wjs.isAddress.call(void 0, source))
|
10
|
+
throw new (0, _chunkE6JLGC6Wjs.InvalidAddressError)({ address: source });
|
11
11
|
return {
|
12
12
|
address: source,
|
13
13
|
type: "json-rpc"
|
14
14
|
};
|
15
15
|
}
|
16
|
-
if (!
|
17
|
-
throw new (0,
|
16
|
+
if (!_chunkE6JLGC6Wjs.isAddress.call(void 0, source.address))
|
17
|
+
throw new (0, _chunkE6JLGC6Wjs.InvalidAddressError)({ address: source.address });
|
18
18
|
return {
|
19
19
|
address: source.address,
|
20
20
|
signMessage: source.signMessage,
|
@@ -28,4 +28,4 @@ function toAccount(source) {
|
|
28
28
|
|
29
29
|
|
30
30
|
exports.toAccount = toAccount;
|
31
|
-
//# sourceMappingURL=chunk-
|
31
|
+
//# sourceMappingURL=chunk-TXGT3ARS.js.map
|
@@ -20,7 +20,7 @@ import "abitype";
|
|
20
20
|
var package_default = {
|
21
21
|
name: "viem",
|
22
22
|
description: "TypeScript Interface for Ethereum",
|
23
|
-
version: "0.2.
|
23
|
+
version: "0.2.3",
|
24
24
|
scripts: {
|
25
25
|
anvil: "dotenv -- sh -c 'anvil --fork-url $VITE_ANVIL_FORK_URL --fork-block-number $VITE_ANVIL_BLOCK_NUMBER --block-time $VITE_ANVIL_BLOCK_TIME'",
|
26
26
|
bench: "vitest bench --no-threads",
|
@@ -1657,6 +1657,15 @@ var UrlRequiredError = class extends BaseError {
|
|
1657
1657
|
}
|
1658
1658
|
};
|
1659
1659
|
|
1660
|
+
// src/utils/data/isHex.ts
|
1661
|
+
function isHex(value) {
|
1662
|
+
if (!value)
|
1663
|
+
return false;
|
1664
|
+
if (typeof value !== "string")
|
1665
|
+
return false;
|
1666
|
+
return /^0x[0-9a-fA-F]*$/.test(value);
|
1667
|
+
}
|
1668
|
+
|
1660
1669
|
// src/utils/data/concat.ts
|
1661
1670
|
function concat(values) {
|
1662
1671
|
if (typeof values[0] === "string")
|
@@ -1694,15 +1703,6 @@ function isBytes(value) {
|
|
1694
1703
|
return value.BYTES_PER_ELEMENT === 1 && value.constructor.name === "Uint8Array";
|
1695
1704
|
}
|
1696
1705
|
|
1697
|
-
// src/utils/data/isHex.ts
|
1698
|
-
function isHex(value) {
|
1699
|
-
if (!value)
|
1700
|
-
return false;
|
1701
|
-
if (typeof value !== "string")
|
1702
|
-
return false;
|
1703
|
-
return /^0x[0-9a-fA-F]*$/.test(value);
|
1704
|
-
}
|
1705
|
-
|
1706
1706
|
// src/utils/data/pad.ts
|
1707
1707
|
function pad(hexOrBytes, { dir, size: size2 = 32 } = {}) {
|
1708
1708
|
if (typeof hexOrBytes === "string")
|
@@ -1857,7 +1857,7 @@ function toBytes(value) {
|
|
1857
1857
|
return numberToBytes(value);
|
1858
1858
|
if (typeof value === "boolean")
|
1859
1859
|
return boolToBytes(value);
|
1860
|
-
if (value
|
1860
|
+
if (isHex(value))
|
1861
1861
|
return hexToBytes(value);
|
1862
1862
|
return stringToBytes(value);
|
1863
1863
|
}
|
@@ -2118,7 +2118,7 @@ var getFunctionSelector = (fn) => slice(hashFunction(fn), 0, 4);
|
|
2118
2118
|
|
2119
2119
|
// src/utils/hash/isHash.ts
|
2120
2120
|
function isHash(hash2) {
|
2121
|
-
return hash2
|
2121
|
+
return isHex(hash2) && size(hash2) === 32;
|
2122
2122
|
}
|
2123
2123
|
|
2124
2124
|
// src/utils/address/isAddress.ts
|
@@ -4286,7 +4286,7 @@ function packetToBytes(packet) {
|
|
4286
4286
|
function length(value2) {
|
4287
4287
|
if (value2 === "." || value2 === "..")
|
4288
4288
|
return 1;
|
4289
|
-
return
|
4289
|
+
return stringToBytes(value2.replace(/^\.|\.$/gm, "")).length + 2;
|
4290
4290
|
}
|
4291
4291
|
const bytes = new Uint8Array(length(packet));
|
4292
4292
|
const value = packet.replace(/^\.|\.$/gm, "");
|
@@ -4295,7 +4295,7 @@ function packetToBytes(packet) {
|
|
4295
4295
|
let offset = 0;
|
4296
4296
|
const list = value.split(".");
|
4297
4297
|
for (let i = 0; i < list.length; i++) {
|
4298
|
-
const encoded =
|
4298
|
+
const encoded = stringToBytes(list[i]);
|
4299
4299
|
bytes[offset] = encoded.length;
|
4300
4300
|
bytes.set(encoded, offset + 1);
|
4301
4301
|
offset += encoded.length + 1;
|
@@ -7015,11 +7015,11 @@ export {
|
|
7015
7015
|
RpcError,
|
7016
7016
|
TimeoutError,
|
7017
7017
|
UrlRequiredError,
|
7018
|
+
isHex,
|
7018
7019
|
concat,
|
7019
7020
|
concatBytes,
|
7020
7021
|
concatHex,
|
7021
7022
|
isBytes,
|
7022
|
-
isHex,
|
7023
7023
|
pad,
|
7024
7024
|
padHex,
|
7025
7025
|
padBytes,
|
@@ -7219,4 +7219,4 @@ export {
|
|
7219
7219
|
writeContract,
|
7220
7220
|
getContract
|
7221
7221
|
};
|
7222
|
-
//# sourceMappingURL=chunk-
|
7222
|
+
//# sourceMappingURL=chunk-ZM26BDGF.mjs.map
|