viem 0.0.1-alpha.6 → 0.0.1-alpha.7
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/actions/index.js +3 -3
- package/dist/chains.js +2 -2
- package/dist/{chunk-2ISXYVSQ.js → chunk-26LBGCAV.js} +1 -1
- package/dist/{chunk-LZSCKQVJ.js → chunk-3N57H2YM.js} +17 -1
- package/dist/{chunk-WOXHZO4H.js → chunk-6NVPLWQM.js} +2 -2
- package/dist/{chunk-JND4MCSB.js → chunk-TKAGJYBH.js} +17 -1
- package/dist/clients/index.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -4
- package/dist/{parseGwei-0c9cad8a.d.ts → parseGwei-9cc6638c.d.ts} +9 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +4 -2
- package/package.json +1 -1
package/dist/actions/index.js
CHANGED
@@ -58,9 +58,9 @@ import {
|
|
58
58
|
watchBlockNumber,
|
59
59
|
watchBlocks,
|
60
60
|
watchPendingTransactions
|
61
|
-
} from "../chunk-
|
62
|
-
import "../chunk-
|
63
|
-
import "../chunk-
|
61
|
+
} from "../chunk-6NVPLWQM.js";
|
62
|
+
import "../chunk-TKAGJYBH.js";
|
63
|
+
import "../chunk-3N57H2YM.js";
|
64
64
|
export {
|
65
65
|
addChain,
|
66
66
|
call,
|
package/dist/chains.js
CHANGED
@@ -9,7 +9,7 @@ var __publicField = (obj, key, value) => {
|
|
9
9
|
var package_default = {
|
10
10
|
name: "viem",
|
11
11
|
description: "TypeScript (& JavaScript) Interface for Ethereum",
|
12
|
-
version: "0.0.1-alpha.
|
12
|
+
version: "0.0.1-alpha.7",
|
13
13
|
scripts: {
|
14
14
|
anvil: "source .env && anvil --fork-url $ANVIL_FORK_URL --fork-block-number $VITE_ANVIL_BLOCK_NUMBER --block-time $VITE_ANVIL_BLOCK_TIME",
|
15
15
|
bench: "vitest bench --no-threads",
|
@@ -227,6 +227,21 @@ var AbiEncodingLengthMismatchError = class extends BaseError {
|
|
227
227
|
__publicField(this, "name", "AbiEncodingLengthMismatchError");
|
228
228
|
}
|
229
229
|
};
|
230
|
+
var AbiErrorSignatureNotFoundError = class extends BaseError {
|
231
|
+
constructor(signature) {
|
232
|
+
super(
|
233
|
+
[
|
234
|
+
`Encoded error signature "${signature}" not found on ABI.`,
|
235
|
+
"Make sure you are using the correct ABI and that the error exists on it.",
|
236
|
+
`You can look up the signature "${signature}" here: https://sig.eth.samczsun.com/.`
|
237
|
+
].join("\n"),
|
238
|
+
{
|
239
|
+
docsPath: "/docs/contract/decodeErrorResult"
|
240
|
+
}
|
241
|
+
);
|
242
|
+
__publicField(this, "name", "AbiErrorSignatureNotFoundError");
|
243
|
+
}
|
244
|
+
};
|
230
245
|
var AbiFunctionNotFoundError = class extends BaseError {
|
231
246
|
constructor(functionName) {
|
232
247
|
super(
|
@@ -993,6 +1008,7 @@ export {
|
|
993
1008
|
AbiDecodingDataSizeInvalidError,
|
994
1009
|
AbiEncodingArrayLengthMismatchError,
|
995
1010
|
AbiEncodingLengthMismatchError,
|
1011
|
+
AbiErrorSignatureNotFoundError,
|
996
1012
|
AbiFunctionNotFoundError,
|
997
1013
|
AbiFunctionOutputsNotFoundError,
|
998
1014
|
AbiFunctionSignatureNotFoundError,
|
@@ -11,7 +11,7 @@ import {
|
|
11
11
|
getAddress,
|
12
12
|
hexToNumber,
|
13
13
|
numberToHex
|
14
|
-
} from "./chunk-
|
14
|
+
} from "./chunk-TKAGJYBH.js";
|
15
15
|
import {
|
16
16
|
BaseError,
|
17
17
|
BlockNotFoundError,
|
@@ -22,7 +22,7 @@ import {
|
|
22
22
|
getCache,
|
23
23
|
wait,
|
24
24
|
withCache
|
25
|
-
} from "./chunk-
|
25
|
+
} from "./chunk-3N57H2YM.js";
|
26
26
|
|
27
27
|
// src/actions/public/call.ts
|
28
28
|
async function call(client, {
|
@@ -4,6 +4,7 @@ import {
|
|
4
4
|
AbiDecodingDataSizeInvalidError,
|
5
5
|
AbiEncodingArrayLengthMismatchError,
|
6
6
|
AbiEncodingLengthMismatchError,
|
7
|
+
AbiErrorSignatureNotFoundError,
|
7
8
|
AbiFunctionNotFoundError,
|
8
9
|
AbiFunctionOutputsNotFoundError,
|
9
10
|
AbiFunctionSignatureNotFoundError,
|
@@ -19,7 +20,7 @@ import {
|
|
19
20
|
InvalidHexValueError,
|
20
21
|
OffsetOutOfBoundsError,
|
21
22
|
SizeExceedsPaddingSizeError
|
22
|
-
} from "./chunk-
|
23
|
+
} from "./chunk-3N57H2YM.js";
|
23
24
|
|
24
25
|
// src/utils/data/concat.ts
|
25
26
|
function concat(values) {
|
@@ -932,6 +933,20 @@ function getParam(param) {
|
|
932
933
|
return param.type;
|
933
934
|
}
|
934
935
|
|
936
|
+
// src/utils/abi/decodeErrorResult.ts
|
937
|
+
function decodeErrorResult({ abi, data }) {
|
938
|
+
const signature = slice(data, 0, 4);
|
939
|
+
const description = abi.find(
|
940
|
+
(x) => signature === getFunctionSignature(getDefinition(x))
|
941
|
+
);
|
942
|
+
if (!description)
|
943
|
+
throw new AbiErrorSignatureNotFoundError(signature);
|
944
|
+
return {
|
945
|
+
errorName: description.name,
|
946
|
+
args: "inputs" in description && description.inputs && description.inputs.length > 0 ? decodeAbi({ data: slice(data, 4), params: description.inputs }) : void 0
|
947
|
+
};
|
948
|
+
}
|
949
|
+
|
935
950
|
// src/utils/abi/decodeFunctionData.ts
|
936
951
|
function decodeFunctionData({ abi, data }) {
|
937
952
|
const signature = slice(data, 0, 4);
|
@@ -1252,6 +1267,7 @@ export {
|
|
1252
1267
|
isAddressEqual,
|
1253
1268
|
encodeAbi,
|
1254
1269
|
decodeAbi,
|
1270
|
+
decodeErrorResult,
|
1255
1271
|
decodeFunctionData,
|
1256
1272
|
decodeFunctionResult,
|
1257
1273
|
encodeDeployData,
|
package/dist/clients/index.js
CHANGED
package/dist/index.d.ts
CHANGED
@@ -3,7 +3,7 @@ export { C as Client, a as ClientConfig, P as PublicClient, b as PublicClientCon
|
|
3
3
|
export { C as CustomTransport, a as CustomTransportConfig, F as FallbackTransport, b as FallbackTransportConfig, H as HttpTransport, c as HttpTransportConfig, W as WebSocketTransport, d as WebSocketTransportConfig, e as custom, f as fallback, h as http, w as webSocket } from './webSocket-f4abf66c.js';
|
4
4
|
import { H as Hex, A as Address, a as Hash, B as ByteArray, b as BlockTag } from './rpc-b77c5aee.js';
|
5
5
|
export { c as AccessList, A as Address, d as Block, f as BlockIdentifier, h as BlockNumber, b as BlockTag, B as ByteArray, F as FeeHistory, i as FeeValues, j as FeeValuesEIP1559, k as FeeValuesLegacy, a as Hash, H as Hex, L as Log, R as RpcBlock, l as RpcBlockIdentifier, m as RpcBlockNumber, n as RpcFeeHistory, o as RpcFeeValues, p as RpcLog, q as RpcTransaction, r as RpcTransactionReceipt, s as RpcTransactionRequest, u as RpcUncle, D as Transaction, E as TransactionBase, G as TransactionEIP1559, I as TransactionEIP2930, J as TransactionLegacy, T as TransactionReceipt, v as TransactionRequest, x as TransactionRequestBase, y as TransactionRequestEIP1559, z as TransactionRequestEIP2930, C as TransactionRequestLegacy, U as Uncle, e as etherUnits, g as gweiUnits, t as transactionType, w as weiUnits } from './rpc-b77c5aee.js';
|
6
|
-
export { E as EncodeRlpResponse, G as GetContractAddressOptions, b as GetCreate2AddressOptions, a as GetCreateAddressOptions, e as boolToBytes, f as boolToHex, g as bytesToBigint, h as bytesToBool, c as bytesToHex, i as bytesToNumber, d as bytesToString, j as decodeAbi, k as decodeBytes, l as
|
6
|
+
export { E as EncodeRlpResponse, G as GetContractAddressOptions, b as GetCreate2AddressOptions, a as GetCreateAddressOptions, e as boolToBytes, f as boolToHex, g as bytesToBigint, h as bytesToBool, c as bytesToHex, i as bytesToNumber, d as bytesToString, j as decodeAbi, k as decodeBytes, l as decodeErrorResult, m as decodeFunctionData, n as decodeFunctionResult, o as decodeHex, p as decodeRlp, q as encodeAbi, r as encodeBytes, s as encodeDeployData, t as encodeFunctionData, u as encodeFunctionResult, v as encodeHex, w as encodeRlp, D as formatEther, W as formatGwei, X as formatUnit, x as getAddress, y as getContractAddress, A as getCreate2Address, z as getCreateAddress, B as getEventSignature, C as getFunctionSignature, K as hexToBigInt, L as hexToBool, M as hexToBytes, Y as hexToNumber, N as hexToString, F as isAddress, H as isAddressEqual, I as isBytes, J as isHex, O as keccak256, P as numberToBytes, Z as numberToHex, Q as pad, R as padBytes, S as padHex, T as parseEther, U as parseGwei, V as parseUnit, _ as size, $ as slice, a0 as sliceBytes, a1 as sliceHex, a2 as stringToBytes, a3 as stringToHex, a4 as trim } from './parseGwei-9cc6638c.js';
|
7
7
|
export { F as FormattedBlock, a as FormattedTransaction, b as FormattedTransactionRequest, f as formatBlock, c as formatTransaction, d as formatTransactionRequest } from './transactionRequest-3e463099.js';
|
8
8
|
import './chains.js';
|
9
9
|
import '@wagmi/chains';
|
package/dist/index.js
CHANGED
@@ -57,7 +57,7 @@ import {
|
|
57
57
|
watchBlockNumber,
|
58
58
|
watchBlocks,
|
59
59
|
watchPendingTransactions
|
60
|
-
} from "./chunk-
|
60
|
+
} from "./chunk-6NVPLWQM.js";
|
61
61
|
import {
|
62
62
|
createClient,
|
63
63
|
createPublicClient,
|
@@ -68,7 +68,7 @@ import {
|
|
68
68
|
fallback,
|
69
69
|
http,
|
70
70
|
webSocket
|
71
|
-
} from "./chunk-
|
71
|
+
} from "./chunk-26LBGCAV.js";
|
72
72
|
import {
|
73
73
|
boolToBytes,
|
74
74
|
boolToHex,
|
@@ -79,6 +79,7 @@ import {
|
|
79
79
|
bytesToString,
|
80
80
|
decodeAbi,
|
81
81
|
decodeBytes,
|
82
|
+
decodeErrorResult,
|
82
83
|
decodeFunctionData,
|
83
84
|
decodeFunctionResult,
|
84
85
|
decodeHex,
|
@@ -131,7 +132,7 @@ import {
|
|
131
132
|
transactionType,
|
132
133
|
trim,
|
133
134
|
weiUnits
|
134
|
-
} from "./chunk-
|
135
|
+
} from "./chunk-TKAGJYBH.js";
|
135
136
|
import {
|
136
137
|
AbiConstructorNotFoundError,
|
137
138
|
AbiConstructorParamsNotFoundError,
|
@@ -179,7 +180,7 @@ import {
|
|
179
180
|
UrlRequiredError,
|
180
181
|
WaitForTransactionReceiptTimeoutError,
|
181
182
|
WebSocketRequestError
|
182
|
-
} from "./chunk-
|
183
|
+
} from "./chunk-3N57H2YM.js";
|
183
184
|
export {
|
184
185
|
AbiConstructorNotFoundError,
|
185
186
|
AbiConstructorParamsNotFoundError,
|
@@ -246,6 +247,7 @@ export {
|
|
246
247
|
custom,
|
247
248
|
decodeAbi,
|
248
249
|
decodeBytes,
|
250
|
+
decodeErrorResult,
|
249
251
|
decodeFunctionData,
|
250
252
|
decodeFunctionResult,
|
251
253
|
decodeHex,
|
@@ -57,6 +57,14 @@ declare function decodeAbi<TParams extends readonly AbiParameter[]>({ data, para
|
|
57
57
|
params: TParams;
|
58
58
|
}): AbiParametersToPrimitiveTypes<TParams>;
|
59
59
|
|
60
|
+
declare function decodeErrorResult({ abi, data }: {
|
61
|
+
abi: Abi;
|
62
|
+
data: Hex;
|
63
|
+
}): {
|
64
|
+
errorName: string;
|
65
|
+
args: readonly unknown[] | undefined;
|
66
|
+
};
|
67
|
+
|
60
68
|
declare function decodeFunctionData({ abi, data }: {
|
61
69
|
abi: Abi;
|
62
70
|
data: Hex;
|
@@ -295,4 +303,4 @@ declare function parseEther(ether: `${number}`, unit?: 'wei' | 'gwei'): bigint;
|
|
295
303
|
|
296
304
|
declare function parseGwei(ether: `${number}`, unit?: 'wei'): bigint;
|
297
305
|
|
298
|
-
export {
|
306
|
+
export { slice as $, getCreate2Address as A, getEventSignature as B, getFunctionSignature as C, formatEther as D, EncodeRlpResponse as E, isAddress as F, GetContractAddressOptions as G, isAddressEqual as H, isBytes as I, isHex as J, hexToBigInt as K, hexToBool as L, hexToBytes as M, hexToString as N, keccak256 as O, numberToBytes as P, pad as Q, padBytes as R, padHex as S, parseEther as T, parseGwei as U, parseUnit as V, formatGwei as W, formatUnit as X, hexToNumber as Y, numberToHex as Z, size as _, GetCreateAddressOptions as a, sliceBytes as a0, sliceHex as a1, stringToBytes as a2, stringToHex as a3, trim as a4, GetCreate2AddressOptions as b, bytesToHex as c, bytesToString as d, boolToBytes as e, boolToHex as f, bytesToBigint as g, bytesToBool as h, bytesToNumber as i, decodeAbi as j, decodeBytes as k, decodeErrorResult as l, decodeFunctionData as m, decodeFunctionResult as n, decodeHex as o, decodeRlp as p, encodeAbi as q, encodeBytes as r, encodeDeployData as s, encodeFunctionData as t, encodeFunctionResult as u, encodeHex as v, encodeRlp as w, getAddress as x, getContractAddress as y, getCreateAddress as z };
|
package/dist/utils/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export { E as EncodeRlpResponse, G as GetContractAddressOptions, b as GetCreate2AddressOptions, a as GetCreateAddressOptions, e as boolToBytes, f as boolToHex, g as bytesToBigint, h as bytesToBool, c as bytesToHex, i as bytesToNumber, d as bytesToString, j as decodeAbi, k as decodeBytes, l as
|
1
|
+
export { E as EncodeRlpResponse, G as GetContractAddressOptions, b as GetCreate2AddressOptions, a as GetCreateAddressOptions, e as boolToBytes, f as boolToHex, g as bytesToBigint, h as bytesToBool, c as bytesToHex, i as bytesToNumber, d as bytesToString, j as decodeAbi, k as decodeBytes, l as decodeErrorResult, m as decodeFunctionData, n as decodeFunctionResult, o as decodeHex, p as decodeRlp, q as encodeAbi, r as encodeBytes, s as encodeDeployData, t as encodeFunctionData, u as encodeFunctionResult, v as encodeHex, w as encodeRlp, D as formatEther, W as formatGwei, X as formatUnit, x as getAddress, y as getContractAddress, A as getCreate2Address, z as getCreateAddress, B as getEventSignature, C as getFunctionSignature, K as hexToBigInt, L as hexToBool, M as hexToBytes, Y as hexToNumber, N as hexToString, F as isAddress, H as isAddressEqual, I as isBytes, J as isHex, O as keccak256, P as numberToBytes, Z as numberToHex, Q as pad, R as padBytes, S as padHex, T as parseEther, U as parseGwei, V as parseUnit, _ as size, $ as slice, a0 as sliceBytes, a1 as sliceHex, a2 as stringToBytes, a3 as stringToHex, a4 as trim } from '../parseGwei-9cc6638c.js';
|
2
2
|
export { B as BlockFormatter, E as ExtractFormatter, e as Formatted, F as FormattedBlock, a as FormattedTransaction, h as FormattedTransactionReceipt, b as FormattedTransactionRequest, g as TransactionFormatter, i as TransactionReceiptFormatter, T as TransactionRequestFormatter, j as format, f as formatBlock, c as formatTransaction, d as formatTransactionRequest } from '../transactionRequest-3e463099.js';
|
3
3
|
export { r as rpc } from '../rpc-26932bae.js';
|
4
4
|
import 'abitype';
|
package/dist/utils/index.js
CHANGED
@@ -8,6 +8,7 @@ import {
|
|
8
8
|
bytesToString,
|
9
9
|
decodeAbi,
|
10
10
|
decodeBytes,
|
11
|
+
decodeErrorResult,
|
11
12
|
decodeFunctionData,
|
12
13
|
decodeFunctionResult,
|
13
14
|
decodeHex,
|
@@ -60,11 +61,11 @@ import {
|
|
60
61
|
stringToBytes,
|
61
62
|
stringToHex,
|
62
63
|
trim
|
63
|
-
} from "../chunk-
|
64
|
+
} from "../chunk-TKAGJYBH.js";
|
64
65
|
import {
|
65
66
|
buildRequest,
|
66
67
|
rpc
|
67
|
-
} from "../chunk-
|
68
|
+
} from "../chunk-3N57H2YM.js";
|
68
69
|
export {
|
69
70
|
boolToBytes,
|
70
71
|
boolToHex,
|
@@ -76,6 +77,7 @@ export {
|
|
76
77
|
bytesToString,
|
77
78
|
decodeAbi,
|
78
79
|
decodeBytes,
|
80
|
+
decodeErrorResult,
|
79
81
|
decodeFunctionData,
|
80
82
|
decodeFunctionResult,
|
81
83
|
decodeHex,
|