viem 0.0.1-alpha.2 → 0.0.1-alpha.4

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.
@@ -1,7 +1,5 @@
1
1
  import { Abi, AbiFunction, ExtractAbiFunction, AbiParametersToPrimitiveTypes, AbiParameter, ExtractAbiFunctionNames } from 'abitype';
2
- import { H as Hex, A as Address, f as ByteArray } from './rpc-655c0ba4.js';
3
- import { B as BaseError } from './BaseError-7688f84e.js';
4
- import { R as RpcError } from './rpc-3c0e3985.js';
2
+ import { a as Hex, A as Address, B as ByteArray } from './rpc-15b85963.js';
5
3
 
6
4
  type ExtractArgsFromAbi<TAbi extends Abi | readonly unknown[], TFunctionName extends string, TAbiFunction extends AbiFunction & {
7
5
  type: 'function';
@@ -24,14 +22,20 @@ declare function decodeAbi<TParams extends readonly AbiParameter[]>({ data, para
24
22
  data: Hex;
25
23
  params: TParams;
26
24
  }): AbiParametersToPrimitiveTypes<TParams>;
27
- declare class AbiDecodingDataSizeInvalidError extends BaseError {
28
- name: string;
29
- constructor(size: number);
30
- }
31
- declare class InvalidAbiDecodingTypeError extends BaseError {
32
- name: string;
33
- constructor(type: string);
34
- }
25
+
26
+ declare function decodeFunctionData({ abi, data }: {
27
+ abi: Abi;
28
+ data: Hex;
29
+ }): {
30
+ functionName: string;
31
+ args: readonly unknown[] | undefined;
32
+ };
33
+
34
+ declare function decodeFunctionResult<TAbi extends Abi = Abi, TFunctionName extends ExtractAbiFunctionNames<TAbi> = any>({ abi, functionName, data, }: {
35
+ abi: TAbi;
36
+ functionName: TFunctionName;
37
+ data: Hex;
38
+ }): unknown;
35
39
 
36
40
  /**
37
41
  * @description Encodes a list of primitive values into an ABI-encoded hex value.
@@ -40,31 +44,8 @@ declare function encodeAbi<TParams extends readonly AbiParameter[]>({ params, va
40
44
  params: TParams;
41
45
  values: AbiParametersToPrimitiveTypes<TParams>;
42
46
  }): `0x${string}` | undefined;
43
- declare class AbiEncodingArrayLengthMismatchError extends BaseError {
44
- name: string;
45
- constructor({ expectedLength, givenLength, type, }: {
46
- expectedLength: number;
47
- givenLength: number;
48
- type: string;
49
- });
50
- }
51
- declare class AbiEncodingLengthMismatchError extends BaseError {
52
- name: string;
53
- constructor({ expectedLength, givenLength, }: {
54
- expectedLength: number;
55
- givenLength: number;
56
- });
57
- }
58
- declare class InvalidAbiEncodingTypeError extends BaseError {
59
- name: string;
60
- constructor(type: string);
61
- }
62
- declare class InvalidArrayError extends BaseError {
63
- name: string;
64
- constructor(value: unknown);
65
- }
66
-
67
- declare function encodeFunctionParams<TAbi extends Abi = Abi, TFunctionName extends ExtractAbiFunctionNames<TAbi> = any>({ abi, args, functionName, }: {
47
+
48
+ declare function encodeFunctionData<TAbi extends Abi = Abi, TFunctionName extends ExtractAbiFunctionNames<TAbi> = any>({ abi, args, functionName, }: {
68
49
  abi: TAbi;
69
50
  functionName: TFunctionName;
70
51
  } & ExtractArgsFromAbi<TAbi, TFunctionName>): `0x${string}`;
@@ -93,81 +74,6 @@ declare function isAddress(address: Address): boolean;
93
74
 
94
75
  declare function isAddressEqual(a: Address, b: Address): boolean;
95
76
 
96
- declare function buildRequest<TRequest extends (args: any) => Promise<any>>(request: TRequest): TRequest;
97
- declare class RequestError extends BaseError {
98
- constructor(err: Error, { docsPath, humanMessage }: {
99
- docsPath?: string;
100
- humanMessage: string;
101
- });
102
- }
103
- declare class RpcRequestError extends RequestError {
104
- code: number;
105
- constructor(err: RpcError, { docsPath, humanMessage }: {
106
- docsPath?: string;
107
- humanMessage: string;
108
- });
109
- }
110
- declare class ParseRpcError extends RpcRequestError {
111
- name: string;
112
- code: number;
113
- constructor(err: RpcError);
114
- }
115
- declare class InvalidRequestRpcError extends RpcRequestError {
116
- name: string;
117
- code: number;
118
- constructor(err: RpcError);
119
- }
120
- declare class MethodNotFoundRpcError extends RpcRequestError {
121
- name: string;
122
- code: number;
123
- constructor(err: RpcError);
124
- }
125
- declare class InvalidParamsRpcError extends RpcRequestError {
126
- name: string;
127
- code: number;
128
- constructor(err: RpcError);
129
- }
130
- declare class InternalRpcError extends RpcRequestError {
131
- name: string;
132
- code: number;
133
- constructor(err: RpcError);
134
- }
135
- declare class InvalidInputRpcError extends RpcRequestError {
136
- name: string;
137
- code: number;
138
- constructor(err: RpcError);
139
- }
140
- declare class ResourceNotFoundRpcError extends RpcRequestError {
141
- name: string;
142
- code: number;
143
- constructor(err: RpcError);
144
- }
145
- declare class ResourceUnavailableRpcError extends RpcRequestError {
146
- name: string;
147
- code: number;
148
- constructor(err: RpcError);
149
- }
150
- declare class TransactionRejectedRpcError extends RpcRequestError {
151
- name: string;
152
- code: number;
153
- constructor(err: RpcError);
154
- }
155
- declare class MethodNotSupportedRpcError extends RpcRequestError {
156
- name: string;
157
- code: number;
158
- constructor(err: RpcError);
159
- }
160
- declare class LimitExceededRpcError extends RpcRequestError {
161
- name: string;
162
- code: number;
163
- constructor(err: RpcError);
164
- }
165
- declare class JsonRpcVersionUnsupportedError extends RpcRequestError {
166
- name: string;
167
- code: number;
168
- constructor(err: RpcError);
169
- }
170
-
171
77
  declare function isBytes(value: any): boolean;
172
78
 
173
79
  declare function isHex(value: any): boolean;
@@ -345,4 +251,4 @@ declare function parseEther(ether: `${number}`, unit?: 'wei' | 'gwei'): bigint;
345
251
 
346
252
  declare function parseGwei(ether: `${number}`, unit?: 'wei'): bigint;
347
253
 
348
- export { hexToString as $, AbiDecodingDataSizeInvalidError as A, encodeFunctionParams as B, encodeHex as C, encodeRlp as D, EncodeRlpResponse as E, getAddress as F, GetContractAddressOptions as G, getContractAddress as H, InvalidAbiDecodingTypeError as I, JsonRpcVersionUnsupportedError as J, getCreateAddress as K, LimitExceededRpcError as L, MethodNotFoundRpcError as M, getCreate2Address as N, getEventSignature as O, ParseRpcError as P, getFunctionSignature as Q, ResourceNotFoundRpcError as R, formatEther as S, TransactionRejectedRpcError as T, isAddress as U, isAddressEqual as V, isBytes as W, isHex as X, hexToBigInt as Y, hexToBool as Z, hexToBytes as _, AbiEncodingArrayLengthMismatchError as a, keccak256 as a0, numberToBytes as a1, pad as a2, padBytes as a3, padHex as a4, parseEther as a5, parseGwei as a6, parseUnit as a7, formatGwei as a8, formatUnit as a9, hexToNumber as aa, numberToHex as ab, size as ac, slice as ad, sliceBytes as ae, sliceHex as af, stringToBytes as ag, stringToHex as ah, trim as ai, buildRequest as aj, AbiEncodingLengthMismatchError as b, GetCreateAddressOptions as c, GetCreate2AddressOptions as d, InvalidAbiEncodingTypeError as e, InvalidArrayError as f, InternalRpcError as g, InvalidInputRpcError as h, InvalidParamsRpcError as i, InvalidRequestRpcError as j, MethodNotSupportedRpcError as k, ResourceUnavailableRpcError as l, RpcRequestError as m, bytesToHex as n, bytesToString as o, boolToBytes as p, boolToHex as q, bytesToBigint as r, bytesToBool as s, bytesToNumber as t, decodeAbi as u, decodeBytes as v, decodeHex as w, decodeRlp as x, encodeAbi as y, encodeBytes as z };
254
+ export { stringToBytes as $, formatEther as A, isAddress as B, isAddressEqual as C, isBytes as D, EncodeRlpResponse as E, isHex as F, GetContractAddressOptions as G, hexToBigInt as H, hexToBool as I, hexToBytes as J, hexToString as K, keccak256 as L, numberToBytes as M, pad as N, padBytes as O, padHex as P, parseEther as Q, parseGwei as R, parseUnit as S, formatGwei as T, formatUnit as U, hexToNumber as V, numberToHex as W, size as X, slice as Y, sliceBytes as Z, sliceHex as _, GetCreateAddressOptions as a, stringToHex as a0, trim as a1, 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, decodeFunctionData as l, decodeFunctionResult as m, decodeHex as n, decodeRlp as o, encodeAbi as p, encodeBytes as q, encodeFunctionData as r, encodeHex as s, encodeRlp as t, getAddress as u, getContractAddress as v, getCreateAddress as w, getCreate2Address as x, getEventSignature as y, getFunctionSignature as z };
@@ -289,4 +289,4 @@ type RpcTransactionReceipt = TransactionReceipt<Quantity, Index, Status, Transac
289
289
  type RpcTransactionRequest = TransactionRequest<Quantity, Index>;
290
290
  type RpcTransaction = TransactionLegacy<Quantity, Index, '0x0'> | TransactionEIP2930<Quantity, Index, '0x1'> | TransactionEIP1559<Quantity, Index, '0x2'>;
291
291
 
292
- export { Address as A, Block as B, TransactionRequestLegacy as C, Transaction as D, TransactionBase as E, FeeHistory as F, TransactionEIP1559 as G, Hex as H, TransactionEIP2930 as I, TransactionLegacy as J, EstimateGasParameters as K, Log as L, MergeIntersectionProperties as M, TransactionType$1 as N, OptionalNullable as O, RpcEstimateGasParameters as P, Quantity as Q, RpcBlock as R, TransactionReceipt as T, Uncle as U, AccessList as a, BlockIdentifier as b, BlockNumber as c, BlockTag as d, etherUnits as e, ByteArray as f, gweiUnits as g, FeeValues as h, FeeValuesEIP1559 as i, FeeValuesLegacy as j, Hash as k, RpcBlockIdentifier as l, RpcBlockNumber as m, RpcFeeHistory as n, RpcFeeValues as o, RpcLog as p, RpcTransaction as q, RpcTransactionReceipt as r, RpcTransactionRequest as s, transactionType as t, RpcUncle as u, TransactionRequest as v, weiUnits as w, TransactionRequestBase as x, TransactionRequestEIP1559 as y, TransactionRequestEIP2930 as z };
292
+ export { Address as A, ByteArray as B, TransactionRequestLegacy as C, Transaction as D, TransactionBase as E, FeeHistory as F, TransactionEIP1559 as G, Hash as H, TransactionEIP2930 as I, TransactionLegacy as J, EstimateGasParameters as K, Log as L, MergeIntersectionProperties as M, TransactionType$1 as N, OptionalNullable as O, RpcEstimateGasParameters as P, Quantity as Q, RpcBlock as R, TransactionReceipt as T, Uncle as U, Hex as a, BlockTag as b, AccessList as c, Block as d, etherUnits as e, BlockIdentifier as f, gweiUnits as g, BlockNumber as h, FeeValues as i, FeeValuesEIP1559 as j, FeeValuesLegacy as k, RpcBlockIdentifier as l, RpcBlockNumber as m, RpcFeeHistory as n, RpcFeeValues as o, RpcLog as p, RpcTransaction as q, RpcTransactionReceipt as r, RpcTransactionRequest as s, transactionType as t, RpcUncle as u, TransactionRequest as v, weiUnits as w, TransactionRequestBase as x, TransactionRequestEIP1559 as y, TransactionRequestEIP2930 as z };
@@ -1,5 +1,3 @@
1
- import { B as BaseError } from './BaseError-7688f84e.js';
2
-
3
1
  type SuccessResult<T> = {
4
2
  method?: never;
5
3
  result: T;
@@ -59,40 +57,5 @@ declare const rpc: {
59
57
  webSocket: typeof webSocket;
60
58
  webSocketAsync: typeof webSocketAsync;
61
59
  };
62
- declare class HttpRequestError extends BaseError {
63
- name: string;
64
- status: number;
65
- constructor({ body, details, status, url, }: {
66
- body: {
67
- [key: string]: unknown;
68
- };
69
- details: string;
70
- status: number;
71
- url: string;
72
- });
73
- }
74
- declare class RpcError extends BaseError {
75
- code: number;
76
- name: string;
77
- constructor({ body, error, url, }: {
78
- body: {
79
- [key: string]: unknown;
80
- };
81
- error: {
82
- code: number;
83
- message: string;
84
- };
85
- url: string;
86
- });
87
- }
88
- declare class TimeoutError extends BaseError {
89
- name: string;
90
- constructor({ body, url, }: {
91
- body: {
92
- [key: string]: unknown;
93
- };
94
- url: string;
95
- });
96
- }
97
60
 
98
- export { HttpRequestError as H, RpcError as R, TimeoutError as T, RpcResponse as a, rpc as r };
61
+ export { RpcResponse as R, rpc as r };
@@ -1,4 +1,4 @@
1
- import { O as OptionalNullable, B as Block, R as RpcBlock, D as Transaction, q as RpcTransaction, T as TransactionReceipt, s as RpcTransactionRequest, v as TransactionRequest } from './rpc-655c0ba4.js';
1
+ import { O as OptionalNullable, d as Block, R as RpcBlock, D as Transaction, q as RpcTransaction, T as TransactionReceipt, s as RpcTransactionRequest, v as TransactionRequest } from './rpc-15b85963.js';
2
2
  import { Chain, Formatter, Formatters } from './chains.js';
3
3
 
4
4
  type ExtractFormatter<TChain extends Chain, TKey extends keyof NonNullable<TChain['formatters']>, TFallbackFormatter extends Formatter = Formatter> = NonNullable<TChain['formatters']>[TKey] extends NonNullable<unknown> ? NonNullable<TChain['formatters']>[TKey] : TFallbackFormatter;
@@ -1,12 +1,13 @@
1
- export { A as AbiDecodingDataSizeInvalidError, a as AbiEncodingArrayLengthMismatchError, b as AbiEncodingLengthMismatchError, E as EncodeRlpResponse, G as GetContractAddressOptions, d as GetCreate2AddressOptions, c as GetCreateAddressOptions, g as InternalRpcError, I as InvalidAbiDecodingTypeError, e as InvalidAbiEncodingTypeError, f as InvalidArrayError, h as InvalidInputRpcError, i as InvalidParamsRpcError, j as InvalidRequestRpcError, J as JsonRpcVersionUnsupportedError, L as LimitExceededRpcError, M as MethodNotFoundRpcError, k as MethodNotSupportedRpcError, P as ParseRpcError, R as ResourceNotFoundRpcError, l as ResourceUnavailableRpcError, m as RpcRequestError, T as TransactionRejectedRpcError, p as boolToBytes, q as boolToHex, aj as buildRequest, r as bytesToBigint, s as bytesToBool, n as bytesToHex, t as bytesToNumber, o as bytesToString, u as decodeAbi, v as decodeBytes, w as decodeHex, x as decodeRlp, y as encodeAbi, z as encodeBytes, B as encodeFunctionParams, C as encodeHex, D as encodeRlp, S as formatEther, a8 as formatGwei, a9 as formatUnit, F as getAddress, H as getContractAddress, N as getCreate2Address, K as getCreateAddress, O as getEventSignature, Q as getFunctionSignature, Y as hexToBigInt, Z as hexToBool, _ as hexToBytes, aa as hexToNumber, $ as hexToString, U as isAddress, V as isAddressEqual, W as isBytes, X as isHex, a0 as keccak256, a1 as numberToBytes, ab as numberToHex, a2 as pad, a3 as padBytes, a4 as padHex, a5 as parseEther, a6 as parseGwei, a7 as parseUnit, ac as size, ad as slice, ae as sliceBytes, af as sliceHex, ag as stringToBytes, ah as stringToHex, ai as trim } from '../parseGwei-fd7a0f7d.js';
2
- export { B as BaseError } from '../BaseError-7688f84e.js';
3
- 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-ade896ac.js';
4
- export { H as HttpRequestError, R as RpcError, T as TimeoutError, r as rpc } from '../rpc-3c0e3985.js';
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 decodeFunctionData, m as decodeFunctionResult, n as decodeHex, o as decodeRlp, p as encodeAbi, q as encodeBytes, r as encodeFunctionData, s as encodeHex, t as encodeRlp, A as formatEther, T as formatGwei, U as formatUnit, u as getAddress, v as getContractAddress, x as getCreate2Address, w as getCreateAddress, y as getEventSignature, z as getFunctionSignature, H as hexToBigInt, I as hexToBool, J as hexToBytes, V as hexToNumber, K as hexToString, B as isAddress, C as isAddressEqual, D as isBytes, F as isHex, L as keccak256, M as numberToBytes, W as numberToHex, N as pad, O as padBytes, P as padHex, Q as parseEther, R as parseGwei, S as parseUnit, X as size, Y as slice, Z as sliceBytes, _ as sliceHex, $ as stringToBytes, a0 as stringToHex, a1 as trim } from '../parseGwei-a952d720.js';
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-f538ea86.js';
3
+ export { r as rpc } from '../rpc-26932bae.js';
5
4
  import 'abitype';
6
- import '../rpc-655c0ba4.js';
5
+ import '../rpc-15b85963.js';
7
6
  import '../chains.js';
8
7
  import '@wagmi/chains';
9
8
 
9
+ declare function buildRequest<TRequest extends (args: any) => Promise<any>>(request: TRequest): TRequest;
10
+
10
11
  declare function extractFunctionName(def: string): string | undefined;
11
12
  declare function extractFunctionParams(def: string): {
12
13
  indexed?: boolean | undefined;
@@ -15,4 +16,4 @@ declare function extractFunctionParams(def: string): {
15
16
  }[] | undefined;
16
17
  declare function extractFunctionType(def: string): string | undefined;
17
18
 
18
- export { extractFunctionName, extractFunctionParams, extractFunctionType };
19
+ export { buildRequest, extractFunctionName, extractFunctionParams, extractFunctionType };
@@ -1,24 +1,6 @@
1
1
  import {
2
- BaseError,
3
- HttpRequestError,
4
- InternalRpcError,
5
- InvalidInputRpcError,
6
- InvalidParamsRpcError,
7
- InvalidRequestRpcError,
8
- JsonRpcVersionUnsupportedError,
9
- LimitExceededRpcError,
10
- MethodNotFoundRpcError,
11
- MethodNotSupportedRpcError,
12
- ParseRpcError,
13
- ResourceNotFoundRpcError,
14
- ResourceUnavailableRpcError,
15
- RpcError,
16
- RpcRequestError,
17
- TimeoutError,
18
- TransactionRejectedRpcError,
19
2
  boolToBytes,
20
3
  boolToHex,
21
- buildRequest,
22
4
  bytesToBigint,
23
5
  bytesToBool,
24
6
  bytesToHex,
@@ -26,11 +8,13 @@ import {
26
8
  bytesToString,
27
9
  decodeAbi,
28
10
  decodeBytes,
11
+ decodeFunctionData,
12
+ decodeFunctionResult,
29
13
  decodeHex,
30
14
  decodeRlp,
31
15
  encodeAbi,
32
16
  encodeBytes,
33
- encodeFunctionParams,
17
+ encodeFunctionData,
34
18
  encodeHex,
35
19
  encodeRlp,
36
20
  extractFunctionName,
@@ -67,7 +51,6 @@ import {
67
51
  parseEther,
68
52
  parseGwei,
69
53
  parseUnit,
70
- rpc,
71
54
  size,
72
55
  slice,
73
56
  sliceBytes,
@@ -75,25 +58,12 @@ import {
75
58
  stringToBytes,
76
59
  stringToHex,
77
60
  trim
78
- } from "../chunk-3EOU525X.js";
61
+ } from "../chunk-ROF2KQ2X.js";
62
+ import {
63
+ buildRequest,
64
+ rpc
65
+ } from "../chunk-COHLCIQM.js";
79
66
  export {
80
- BaseError,
81
- HttpRequestError,
82
- InternalRpcError,
83
- InvalidInputRpcError,
84
- InvalidParamsRpcError,
85
- InvalidRequestRpcError,
86
- JsonRpcVersionUnsupportedError,
87
- LimitExceededRpcError,
88
- MethodNotFoundRpcError,
89
- MethodNotSupportedRpcError,
90
- ParseRpcError,
91
- ResourceNotFoundRpcError,
92
- ResourceUnavailableRpcError,
93
- RpcError,
94
- RpcRequestError,
95
- TimeoutError,
96
- TransactionRejectedRpcError,
97
67
  boolToBytes,
98
68
  boolToHex,
99
69
  buildRequest,
@@ -104,11 +74,13 @@ export {
104
74
  bytesToString,
105
75
  decodeAbi,
106
76
  decodeBytes,
77
+ decodeFunctionData,
78
+ decodeFunctionResult,
107
79
  decodeHex,
108
80
  decodeRlp,
109
81
  encodeAbi,
110
82
  encodeBytes,
111
- encodeFunctionParams,
83
+ encodeFunctionData,
112
84
  encodeHex,
113
85
  encodeRlp,
114
86
  extractFunctionName,
@@ -1,9 +1,8 @@
1
1
  import { Chain, Formatter } from './chains.js';
2
- import { H as Hex, d as BlockTag, M as MergeIntersectionProperties, v as TransactionRequest, K as EstimateGasParameters, A as Address, k as Hash, F as FeeHistory, L as Log, r as RpcTransactionReceipt, T as TransactionReceipt, N as TransactionType, D as Transaction, q as RpcTransaction, Q as Quantity, f as ByteArray } from './rpc-655c0ba4.js';
3
- import { T as TransactionRequestFormatter, e as Formatted, F as FormattedBlock, B as BlockFormatter, a as FormattedTransaction, g as TransactionFormatter, h as FormattedTransactionReceipt, i as TransactionReceiptFormatter, E as ExtractFormatter } from './transactionRequest-ade896ac.js';
4
- import { P as PublicClient, T as TestClient, W as WalletClient } from './createWalletClient-915223f3.js';
5
- import { B as BaseError } from './BaseError-7688f84e.js';
6
- import { W as WalletPermission, a as WatchAssetParams } from './eip1193-8f7c22ce.js';
2
+ import { a as Hex, b as BlockTag, M as MergeIntersectionProperties, v as TransactionRequest, K as EstimateGasParameters, A as Address, H as Hash, F as FeeHistory, L as Log, r as RpcTransactionReceipt, T as TransactionReceipt, N as TransactionType, D as Transaction, q as RpcTransaction, Q as Quantity, B as ByteArray } from './rpc-15b85963.js';
3
+ import { P as PublicClient, T as TestClient, W as WalletClient } from './createWalletClient-15ad1601.js';
4
+ import { T as TransactionRequestFormatter, e as Formatted, F as FormattedBlock, B as BlockFormatter, a as FormattedTransaction, g as TransactionFormatter, h as FormattedTransactionReceipt, i as TransactionReceiptFormatter, E as ExtractFormatter } from './transactionRequest-f538ea86.js';
5
+ import { W as WalletPermission, a as WatchAssetParams } from './eip1193-8b4d90ce.js';
7
6
 
8
7
  type FilterType = 'transaction' | 'block' | 'event';
9
8
  type Filter<TFilterType extends FilterType = 'event'> = {
@@ -275,12 +274,6 @@ type WaitForTransactionReceiptArgs<TChain extends Chain = Chain> = {
275
274
  timeout?: number;
276
275
  };
277
276
  declare function waitForTransactionReceipt<TChain extends Chain>(client: PublicClient<any, TChain>, { confirmations, hash, onReplaced, pollingInterval, timeout, }: WaitForTransactionReceiptArgs<TChain>): Promise<WaitForTransactionReceiptResponse<TChain>>;
278
- declare class WaitForTransactionReceiptTimeoutError extends BaseError {
279
- name: string;
280
- constructor({ hash }: {
281
- hash: Hash;
282
- });
283
- }
284
277
 
285
278
  type OnBlockNumberResponse = GetBlockNumberResponse;
286
279
  type OnBlockNumber = (blockNumber: OnBlockNumberResponse, prevBlockNumber: OnBlockNumberResponse | undefined) => void;
@@ -509,10 +502,6 @@ type SendTransactionArgs<TChain extends Chain = Chain> = FormattedTransactionReq
509
502
  };
510
503
  type SendTransactionResponse = Hash;
511
504
  declare function sendTransaction<TChain extends Chain>(client: WalletClient, { chain, from, accessList, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, ...rest }: SendTransactionArgs<TChain>): Promise<SendTransactionResponse>;
512
- declare class InvalidGasArgumentsError extends BaseError {
513
- name: string;
514
- constructor();
515
- }
516
505
 
517
506
  type SignMessageArgs = {
518
507
  from: Address;
@@ -530,4 +519,4 @@ type WatchAssetArgs = WatchAssetParams;
530
519
  type WatchAssetResponse = boolean;
531
520
  declare function watchAsset(client: WalletClient, params: WatchAssetParams): Promise<WatchAssetResponse>;
532
521
 
533
- export { SetBlockTimestampIntervalArgs as $, GetTransactionReceiptResponse as A, IncreaseTimeArgs as B, CallArgs as C, DropTransactionArgs as D, EstimateGasArgs as E, OnBlockNumber as F, GetBalanceArgs as G, OnBlockNumberResponse as H, ImpersonateAccountArgs as I, OnBlockResponse as J, OnTransactions as K, OnTransactionsResponse as L, MineArgs as M, RequestPermissionsResponse as N, OnBlock as O, RevertArgs as P, SendTransactionResponse as Q, ResetArgs as R, SendTransactionArgs as S, SendUnsignedTransactionArgs as T, SendUnsignedTransactionResponse as U, SetBalanceArgs as V, SetBlockGasLimitArgs as W, SetCodeArgs as X, SetCoinbaseArgs as Y, SetIntervalMiningArgs as Z, SetMinGasPriceArgs as _, CallResponse as a, setNonce as a$, SetNextBlockTimestampArgs as a0, SetNextBlockBaseFeePerGasArgs as a1, SetNonceArgs as a2, SetStorageAtArgs as a3, SignMessageArgs as a4, SignMessageResponse as a5, StopImpersonatingAccountArgs as a6, SwitchChainArgs as a7, UninstallFilterArgs as a8, UninstallFilterResponse as a9, getTransactionConfirmations as aA, getTransactionCount as aB, getTransactionReceipt as aC, getTxpoolContent as aD, getTxpoolStatus as aE, impersonateAccount as aF, increaseTime as aG, inspectTxpool as aH, mine as aI, removeBlockTimestampInterval as aJ, reset as aK, requestAccounts as aL, requestPermissions as aM, revert as aN, sendTransaction as aO, sendUnsignedTransaction as aP, setAutomine as aQ, setBalance as aR, setBlockGasLimit as aS, setBlockTimestampInterval as aT, setCode as aU, setCoinbase as aV, setIntervalMining as aW, setLoggingEnabled as aX, setMinGasPrice as aY, setNextBlockBaseFeePerGas as aZ, setNextBlockTimestamp as a_, WaitForTransactionReceiptArgs as aa, WaitForTransactionReceiptResponse as ab, WatchAssetArgs as ac, WatchAssetResponse as ad, WatchBlockNumberArgs as ae, WatchBlocksArgs as af, WatchPendingTransactionsArgs as ag, addChain as ah, call as ai, createBlockFilter as aj, createPendingTransactionFilter as ak, estimateGas as al, dropTransaction as am, getAccounts as an, getAutomine as ao, getBalance as ap, getBlock as aq, getBlockNumber as ar, getBlockTransactionCount as as, getChainId as at, getFeeHistory as au, getFilterChanges as av, getFilterLogs as aw, getGasPrice as ax, getPermissions as ay, getTransaction as az, CreateBlockFilterResponse as b, setStorageAt as b0, signMessage as b1, snapshot as b2, stopImpersonatingAccount as b3, switchChain as b4, uninstallFilter as b5, waitForTransactionReceipt as b6, watchAsset as b7, watchBlockNumber as b8, watchBlocks as b9, watchPendingTransactions as ba, getBlockNumberCache as bb, ReplacementReason as bc, ReplacementResponse as bd, WaitForTransactionReceiptTimeoutError as be, FormattedTransactionRequest as bf, InvalidGasArgumentsError as bg, CreatePendingTransactionFilterResponse as c, EstimateGasResponse as d, GetBalanceResponse as e, GetBlockArgs as f, GetBlockNumberArgs as g, GetBlockNumberResponse as h, GetBlockResponse as i, GetBlockTransactionCountArgs as j, GetBlockTransactionCountResponse as k, GetFeeHistoryArgs as l, GetFeeHistoryResponse as m, GetFilterChangesArgs as n, GetFilterChangesResponse as o, GetFilterLogsArgs as p, GetFilterLogsResponse as q, GetGasPriceResponse as r, GetPermissionsResponse as s, GetTransactionArgs as t, GetTransactionConfirmationsArgs as u, GetTransactionConfirmationsResponse as v, GetTransactionCountArgs as w, GetTransactionCountResponse as x, GetTransactionResponse as y, GetTransactionReceiptArgs as z };
522
+ export { SetBlockTimestampIntervalArgs as $, GetTransactionReceiptResponse as A, IncreaseTimeArgs as B, CallArgs as C, DropTransactionArgs as D, EstimateGasArgs as E, OnBlockNumber as F, GetBalanceArgs as G, OnBlockNumberResponse as H, ImpersonateAccountArgs as I, OnBlockResponse as J, OnTransactions as K, OnTransactionsResponse as L, MineArgs as M, RequestPermissionsResponse as N, OnBlock as O, RevertArgs as P, SendTransactionResponse as Q, ResetArgs as R, SendTransactionArgs as S, SendUnsignedTransactionArgs as T, SendUnsignedTransactionResponse as U, SetBalanceArgs as V, SetBlockGasLimitArgs as W, SetCodeArgs as X, SetCoinbaseArgs as Y, SetIntervalMiningArgs as Z, SetMinGasPriceArgs as _, CallResponse as a, setNonce as a$, SetNextBlockTimestampArgs as a0, SetNextBlockBaseFeePerGasArgs as a1, SetNonceArgs as a2, SetStorageAtArgs as a3, SignMessageArgs as a4, SignMessageResponse as a5, StopImpersonatingAccountArgs as a6, SwitchChainArgs as a7, UninstallFilterArgs as a8, UninstallFilterResponse as a9, getTransactionConfirmations as aA, getTransactionCount as aB, getTransactionReceipt as aC, getTxpoolContent as aD, getTxpoolStatus as aE, impersonateAccount as aF, increaseTime as aG, inspectTxpool as aH, mine as aI, removeBlockTimestampInterval as aJ, reset as aK, requestAccounts as aL, requestPermissions as aM, revert as aN, sendTransaction as aO, sendUnsignedTransaction as aP, setAutomine as aQ, setBalance as aR, setBlockGasLimit as aS, setBlockTimestampInterval as aT, setCode as aU, setCoinbase as aV, setIntervalMining as aW, setLoggingEnabled as aX, setMinGasPrice as aY, setNextBlockBaseFeePerGas as aZ, setNextBlockTimestamp as a_, WaitForTransactionReceiptArgs as aa, WaitForTransactionReceiptResponse as ab, WatchAssetArgs as ac, WatchAssetResponse as ad, WatchBlockNumberArgs as ae, WatchBlocksArgs as af, WatchPendingTransactionsArgs as ag, addChain as ah, call as ai, createBlockFilter as aj, createPendingTransactionFilter as ak, estimateGas as al, dropTransaction as am, getAccounts as an, getAutomine as ao, getBalance as ap, getBlock as aq, getBlockNumber as ar, getBlockTransactionCount as as, getChainId as at, getFeeHistory as au, getFilterChanges as av, getFilterLogs as aw, getGasPrice as ax, getPermissions as ay, getTransaction as az, CreateBlockFilterResponse as b, setStorageAt as b0, signMessage as b1, snapshot as b2, stopImpersonatingAccount as b3, switchChain as b4, uninstallFilter as b5, waitForTransactionReceipt as b6, watchAsset as b7, watchBlockNumber as b8, watchBlocks as b9, watchPendingTransactions as ba, getBlockNumberCache as bb, ReplacementReason as bc, ReplacementResponse as bd, FormattedTransactionRequest as be, CreatePendingTransactionFilterResponse as c, EstimateGasResponse as d, GetBalanceResponse as e, GetBlockArgs as f, GetBlockNumberArgs as g, GetBlockNumberResponse as h, GetBlockResponse as i, GetBlockTransactionCountArgs as j, GetBlockTransactionCountResponse as k, GetFeeHistoryArgs as l, GetFeeHistoryResponse as m, GetFilterChangesArgs as n, GetFilterChangesResponse as o, GetFilterLogsArgs as p, GetFilterLogsResponse as q, GetGasPriceResponse as r, GetPermissionsResponse as s, GetTransactionArgs as t, GetTransactionConfirmationsArgs as u, GetTransactionConfirmationsResponse as v, GetTransactionCountArgs as w, GetTransactionCountResponse as x, GetTransactionResponse as y, GetTransactionReceiptArgs as z };
@@ -1,11 +1,6 @@
1
- import { B as BaseError } from './BaseError-7688f84e.js';
2
- import { e as TransportConfig, d as Transport, B as BaseRpcRequests } from './createWalletClient-915223f3.js';
3
- import { k as Hash } from './rpc-655c0ba4.js';
4
- import { a as RpcResponse } from './rpc-3c0e3985.js';
5
-
6
- declare class UrlRequiredError extends BaseError {
7
- constructor();
8
- }
1
+ import { e as TransportConfig, d as Transport, B as BaseRpcRequests } from './createWalletClient-15ad1601.js';
2
+ import { H as Hash } from './rpc-15b85963.js';
3
+ import { R as RpcResponse } from './rpc-26932bae.js';
9
4
 
10
5
  type EthereumProvider = {
11
6
  request: BaseRpcRequests['request'];
@@ -85,4 +80,4 @@ declare function webSocket(
85
80
  /** URL of the JSON-RPC API. Defaults to the chain's public RPC URL. */
86
81
  url?: string, { key, name, }?: WebSocketTransportConfig): WebSocketTransport;
87
82
 
88
- export { CustomTransport as C, FallbackTransport as F, HttpTransport as H, UrlRequiredError as U, WebSocketTransport as W, CustomTransportConfig as a, FallbackTransportConfig as b, HttpTransportConfig as c, WebSocketTransportConfig as d, custom as e, fallback as f, http as h, webSocket as w };
83
+ export { CustomTransport as C, FallbackTransport as F, HttpTransport as H, WebSocketTransport as W, CustomTransportConfig as a, FallbackTransportConfig as b, HttpTransportConfig as c, WebSocketTransportConfig as d, custom as e, fallback as f, http as h, webSocket as w };
package/dist/window.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as Requests, E as Events } from './eip1193-8f7c22ce.js';
2
- import './rpc-655c0ba4.js';
1
+ import { R as Requests, E as Events } from './eip1193-8b4d90ce.js';
2
+ import './rpc-15b85963.js';
3
3
 
4
4
  type WindowProvider = Requests & Events;
5
5
  declare global {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "viem",
3
3
  "description": "TypeScript (& JavaScript) Interface for Ethereum",
4
- "version": "0.0.1-alpha.2",
4
+ "version": "0.0.1-alpha.4",
5
5
  "files": [
6
6
  "/actions",
7
7
  "/chains",
@@ -1,18 +0,0 @@
1
- type BaseErrorArgs = {
2
- docsPath?: string;
3
- } & ({
4
- cause?: never;
5
- details?: string;
6
- } | {
7
- cause: BaseError | Error;
8
- details?: never;
9
- });
10
- declare class BaseError extends Error {
11
- humanMessage: string;
12
- details: string;
13
- docsPath?: string;
14
- name: string;
15
- constructor(humanMessage: string, args?: BaseErrorArgs);
16
- }
17
-
18
- export { BaseError as B };