viem 0.3.0-jxom-refactor-pkgs.20230404T000548 → 0.3.0-jxom-get-value.20230405T010624
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.d.ts +3 -3
- package/dist/abi.js +2 -2
- package/dist/abi.mjs +1 -1
- package/dist/accounts/index.d.ts +14 -23
- package/dist/accounts/index.js +29 -38
- package/dist/accounts/index.js.map +1 -1
- package/dist/accounts/index.mjs +22 -31
- package/dist/accounts/index.mjs.map +1 -1
- package/dist/{chain-5507c6f0.d.ts → chain-02c77999.d.ts} +4 -2
- package/dist/{chain-fe47467d.d.ts → chain-29e97b48.d.ts} +1 -1
- package/dist/chains.d.ts +3 -3
- package/dist/chains.js +89 -89
- package/dist/chains.mjs +1 -1
- package/dist/{chunk-FYDOJUVR.js → chunk-237UQSMF.js} +6 -6
- package/dist/{chunk-IDHPAZVJ.js → chunk-26JXKZA7.js} +26 -22
- package/dist/chunk-26JXKZA7.js.map +1 -0
- package/dist/{chunk-AZCTVIMY.mjs → chunk-AUNKNGBO.mjs} +26 -22
- package/dist/chunk-AUNKNGBO.mjs.map +1 -0
- package/dist/{chunk-TDEQU4WU.mjs → chunk-VIJ4MQP3.mjs} +2 -2
- package/dist/contract.d.ts +9 -8
- package/dist/contract.js +2 -2
- package/dist/contract.mjs +1 -1
- package/dist/{createTransport-21a0d2b3.d.ts → createTransport-55339615.d.ts} +2 -2
- package/dist/{eip1193-2f3a9cd2.d.ts → eip1193-07d9c47f.d.ts} +1 -1
- package/dist/{encodeFunctionResult-c5185b98.d.ts → encodeFunctionResult-f7c8e382.d.ts} +12 -8
- package/dist/{encodePacked-98f67d09.d.ts → encodePacked-462bce62.d.ts} +1 -1
- package/dist/ens.d.ts +5 -5
- package/dist/ens.js +2 -2
- package/dist/ens.mjs +1 -1
- package/dist/ethers.d.ts +2 -2
- package/dist/ethers.js +4 -4
- package/dist/ethers.mjs +2 -2
- package/dist/{formatAbiItem-56dff508.d.ts → formatAbiItem-e5bbcadb.d.ts} +1 -1
- package/dist/{getAbiItem-bfba73d1.d.ts → getAbiItem-443d91a0.d.ts} +1 -1
- package/dist/{getEnsResolver-9e26c596.d.ts → getEnsResolver-314de6e9.d.ts} +5 -5
- package/dist/index.d.ts +17 -16
- package/dist/index.js +95 -95
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{parseGwei-d2147f8b.d.ts → parseGwei-4fb29d96.d.ts} +5 -5
- package/dist/public.d.ts +5 -5
- package/dist/public.js +2 -2
- package/dist/public.mjs +1 -1
- package/dist/{publicKeyToAddress-623eb398.d.ts → publicKeyToAddress-52476df3.d.ts} +2 -2
- package/dist/{test-b67569fe.d.ts → test-2d6d9a8d.d.ts} +3 -3
- package/dist/test.d.ts +5 -5
- package/dist/test.js +2 -2
- package/dist/test.mjs +1 -1
- package/dist/{typedData-46b4d81f.d.ts → typedData-337e8d8f.d.ts} +2 -2
- package/dist/utils/index.d.ts +16 -15
- package/dist/utils/index.js +2 -2
- package/dist/utils/index.mjs +1 -1
- package/dist/wallet.d.ts +5 -5
- package/dist/wallet.js +2 -2
- package/dist/wallet.mjs +1 -1
- package/dist/window.d.ts +2 -2
- package/package.json +1 -1
- package/dist/chunk-AZCTVIMY.mjs.map +0 -1
- package/dist/chunk-IDHPAZVJ.js.map +0 -1
- /package/dist/{chunk-FYDOJUVR.js.map → chunk-237UQSMF.js.map} +0 -0
- /package/dist/{chunk-TDEQU4WU.mjs.map → chunk-VIJ4MQP3.mjs.map} +0 -0
@@ -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.5",
|
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",
|
@@ -33,7 +33,7 @@ var package_default = {
|
|
33
33
|
"contracts:build": "wagmi generate",
|
34
34
|
dev: "DEV=true tsup",
|
35
35
|
"dev:docs": "pnpm -r --filter site dev",
|
36
|
-
format: "rome format
|
36
|
+
format: "rome format . --write",
|
37
37
|
lint: "rome check .",
|
38
38
|
"lint:fix": "pnpm lint --apply",
|
39
39
|
playground: "pnpm --filter playground-browser dev",
|
@@ -46,7 +46,6 @@ var package_default = {
|
|
46
46
|
"test:ci": "CI=true vitest --coverage --no-threads",
|
47
47
|
"test:typecheck": "SKIP_GLOBAL_SETUP=true vitest typecheck",
|
48
48
|
"test:ui": "vitest dev --ui --no-threads",
|
49
|
-
"ts-node": "bun",
|
50
49
|
typecheck: "tsc --noEmit"
|
51
50
|
},
|
52
51
|
tsup: {
|
@@ -1657,6 +1656,15 @@ var UrlRequiredError = class extends BaseError {
|
|
1657
1656
|
}
|
1658
1657
|
};
|
1659
1658
|
|
1659
|
+
// src/utils/data/isHex.ts
|
1660
|
+
function isHex(value) {
|
1661
|
+
if (!value)
|
1662
|
+
return false;
|
1663
|
+
if (typeof value !== "string")
|
1664
|
+
return false;
|
1665
|
+
return /^0x[0-9a-fA-F]*$/.test(value);
|
1666
|
+
}
|
1667
|
+
|
1660
1668
|
// src/utils/data/concat.ts
|
1661
1669
|
function concat(values) {
|
1662
1670
|
if (typeof values[0] === "string")
|
@@ -1694,15 +1702,6 @@ function isBytes(value) {
|
|
1694
1702
|
return value.BYTES_PER_ELEMENT === 1 && value.constructor.name === "Uint8Array";
|
1695
1703
|
}
|
1696
1704
|
|
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
1705
|
// src/utils/data/pad.ts
|
1707
1706
|
function pad(hexOrBytes, { dir, size: size2 = 32 } = {}) {
|
1708
1707
|
if (typeof hexOrBytes === "string")
|
@@ -1857,7 +1856,7 @@ function toBytes(value) {
|
|
1857
1856
|
return numberToBytes(value);
|
1858
1857
|
if (typeof value === "boolean")
|
1859
1858
|
return boolToBytes(value);
|
1860
|
-
if (value
|
1859
|
+
if (isHex(value))
|
1861
1860
|
return hexToBytes(value);
|
1862
1861
|
return stringToBytes(value);
|
1863
1862
|
}
|
@@ -2118,7 +2117,7 @@ var getFunctionSelector = (fn) => slice(hashFunction(fn), 0, 4);
|
|
2118
2117
|
|
2119
2118
|
// src/utils/hash/isHash.ts
|
2120
2119
|
function isHash(hash2) {
|
2121
|
-
return hash2
|
2120
|
+
return isHex(hash2) && size(hash2) === 32;
|
2122
2121
|
}
|
2123
2122
|
|
2124
2123
|
// src/utils/address/isAddress.ts
|
@@ -4027,10 +4026,10 @@ function getSerializedTransactionType(serializedTransaction) {
|
|
4027
4026
|
function getTransactionType(transaction) {
|
4028
4027
|
if (transaction.type)
|
4029
4028
|
return transaction.type;
|
4030
|
-
if (
|
4029
|
+
if (typeof transaction.maxFeePerGas !== "undefined" || typeof transaction.maxPriorityFeePerGas !== "undefined")
|
4031
4030
|
return "eip1559";
|
4032
|
-
if (
|
4033
|
-
if (
|
4031
|
+
if (typeof transaction.gasPrice !== "undefined") {
|
4032
|
+
if (typeof transaction.accessList !== "undefined")
|
4034
4033
|
return "eip2930";
|
4035
4034
|
return "legacy";
|
4036
4035
|
}
|
@@ -4286,7 +4285,7 @@ function packetToBytes(packet) {
|
|
4286
4285
|
function length(value2) {
|
4287
4286
|
if (value2 === "." || value2 === "..")
|
4288
4287
|
return 1;
|
4289
|
-
return
|
4288
|
+
return stringToBytes(value2.replace(/^\.|\.$/gm, "")).length + 2;
|
4290
4289
|
}
|
4291
4290
|
const bytes = new Uint8Array(length(packet));
|
4292
4291
|
const value = packet.replace(/^\.|\.$/gm, "");
|
@@ -4295,7 +4294,7 @@ function packetToBytes(packet) {
|
|
4295
4294
|
let offset = 0;
|
4296
4295
|
const list = value.split(".");
|
4297
4296
|
for (let i = 0; i < list.length; i++) {
|
4298
|
-
const encoded =
|
4297
|
+
const encoded = stringToBytes(list[i]);
|
4299
4298
|
bytes[offset] = encoded.length;
|
4300
4299
|
bytes.set(encoded, offset + 1);
|
4301
4300
|
offset += encoded.length + 1;
|
@@ -5614,11 +5613,14 @@ async function getEnsAddress(client, {
|
|
5614
5613
|
blockNumber,
|
5615
5614
|
blockTag
|
5616
5615
|
});
|
5617
|
-
|
5616
|
+
if (res[0] === "0x")
|
5617
|
+
return null;
|
5618
|
+
const address = decodeFunctionResult({
|
5618
5619
|
abi: singleAddressResolverAbi,
|
5619
5620
|
functionName: "addr",
|
5620
5621
|
data: res[0]
|
5621
5622
|
});
|
5623
|
+
return trim(address) === "0x0" ? null : address;
|
5622
5624
|
}
|
5623
5625
|
|
5624
5626
|
// src/actions/ens/getEnsText.ts
|
@@ -5656,6 +5658,8 @@ async function getEnsText(client, {
|
|
5656
5658
|
blockNumber,
|
5657
5659
|
blockTag
|
5658
5660
|
});
|
5661
|
+
if (res[0] === "0x")
|
5662
|
+
return null;
|
5659
5663
|
const record = decodeFunctionResult({
|
5660
5664
|
abi: textResolverAbi,
|
5661
5665
|
functionName: "text",
|
@@ -7015,11 +7019,11 @@ export {
|
|
7015
7019
|
RpcError,
|
7016
7020
|
TimeoutError,
|
7017
7021
|
UrlRequiredError,
|
7022
|
+
isHex,
|
7018
7023
|
concat,
|
7019
7024
|
concatBytes,
|
7020
7025
|
concatHex,
|
7021
7026
|
isBytes,
|
7022
|
-
isHex,
|
7023
7027
|
pad,
|
7024
7028
|
padHex,
|
7025
7029
|
padBytes,
|
@@ -7219,4 +7223,4 @@ export {
|
|
7219
7223
|
writeContract,
|
7220
7224
|
getContract
|
7221
7225
|
};
|
7222
|
-
//# sourceMappingURL=chunk-
|
7226
|
+
//# sourceMappingURL=chunk-AUNKNGBO.mjs.map
|