viem 0.0.1-alpha.9 → 0.0.1-cjs.10

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,44 +0,0 @@
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-b77c5aee.js';
2
- import { Chain, Formatter, Formatters } from './chains.js';
3
-
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;
5
- type FormatOptions<TSource, TTarget> = {
6
- formatter: Formatter<TSource, TTarget>;
7
- };
8
- /**
9
- * Creates a type that is the result of applying `TFormatter` to `TSource`.
10
- *
11
- * @example
12
- * Formatted<() => { a: undefined, b: bigint }, { a: bigint }>
13
- * => { a: undefined, b: bigint }
14
- *
15
- * @example
16
- * Formatted<() => {}, { a: bigint }>
17
- * => { a: bigint }
18
- *
19
- * @example
20
- * Formatted<() => { a: bigint | undefined, b: bigint }, { a: bigint, b: bigint }, true>
21
- * => { a?: bigint | undefined, b: bigint }
22
- */
23
- type Formatted<TFormatter, TFallback, TAllowOptional = false> = TFormatter extends Formatter ? ReturnType<TFormatter> extends Record<string, never> ? TFallback : TAllowOptional extends true ? OptionalNullable<ReturnType<TFormatter>> : ReturnType<TFormatter> : never;
24
- /**
25
- * @description Formats a data object using the given replacer and an optional formatter.
26
- */
27
- declare function format<TFormatter, TSource extends Record<string, any>, TTarget>(data: TSource, { formatter }: FormatOptions<TSource, TTarget>): Formatted<TFormatter, TTarget, false>;
28
-
29
- type BlockFormatter<TChain extends Chain = Chain> = ExtractFormatter<TChain, 'block', NonNullable<Formatters['block']>>;
30
- type FormattedBlock<TFormatter extends Formatter | undefined = Formatter> = Formatted<TFormatter, Block>;
31
- declare function formatBlock(block: Partial<RpcBlock>): Block<bigint, Transaction<bigint, number>>;
32
-
33
- type TransactionFormatter<TChain extends Chain = Chain> = ExtractFormatter<TChain, 'transaction', NonNullable<Formatters['transaction']>>;
34
- type FormattedTransaction<TFormatter extends Formatter | undefined = Formatter> = Formatted<TFormatter, Transaction>;
35
- declare function formatTransaction(transaction: Partial<RpcTransaction>): Transaction<bigint, number>;
36
-
37
- type TransactionReceiptFormatter<TChain extends Chain = Chain> = ExtractFormatter<TChain, 'transactionReceipt', NonNullable<Formatters['transactionReceipt']>>;
38
- type FormattedTransactionReceipt<TFormatter extends Formatter | undefined = Formatter> = Formatted<TFormatter, TransactionReceipt>;
39
-
40
- type TransactionRequestFormatter<TChain extends Chain = Chain> = ExtractFormatter<TChain, 'transactionRequest', NonNullable<Formatters['transactionRequest']>>;
41
- type FormattedTransactionRequest<TFormatter extends Formatter | undefined = Formatter> = Formatted<TFormatter, RpcTransactionRequest>;
42
- declare function formatTransactionRequest(transactionRequest: Partial<TransactionRequest>): RpcTransactionRequest;
43
-
44
- export { BlockFormatter as B, ExtractFormatter as E, FormattedBlock as F, TransactionRequestFormatter as T, FormattedTransaction as a, FormattedTransactionRequest as b, formatTransaction as c, formatTransactionRequest as d, Formatted as e, formatBlock as f, TransactionFormatter as g, FormattedTransactionReceipt as h, TransactionReceiptFormatter as i, format as j };