viem 0.0.0-w-20230904174840 → 0.0.0-w-20230904201641
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/types/types/chain.d.ts +20 -20
- package/dist/types/types/chain.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/types/chain.ts +48 -36
@@ -9,7 +9,7 @@ import type { TransactionSerializable, TransactionSerializableGeneric } from '..
|
|
9
9
|
import type { IsUndefined, Prettify } from '../types/utils.js';
|
10
10
|
import type { FormattedBlock } from '../utils/formatters/block.js';
|
11
11
|
import type { SerializeTransactionFn } from '../utils/transaction/serializeTransaction.js';
|
12
|
-
export type Chain<formatters extends ChainFormatters | undefined = ChainFormatters | undefined> = ChainConstants & ChainConfig<formatters
|
12
|
+
export type Chain<formatters extends ChainFormatters | undefined = ChainFormatters | undefined> = Prettify<ChainConstants & ChainConfig<formatters>>;
|
13
13
|
export type ChainBlockExplorer = {
|
14
14
|
name: string;
|
15
15
|
url: string;
|
@@ -18,18 +18,18 @@ export type ChainConstants = {
|
|
18
18
|
/** Collection of block explorers */
|
19
19
|
blockExplorers?: {
|
20
20
|
default: ChainBlockExplorer;
|
21
|
-
etherscan?: ChainBlockExplorer;
|
22
|
-
};
|
21
|
+
etherscan?: ChainBlockExplorer | undefined;
|
22
|
+
} | undefined;
|
23
23
|
/** Collection of contracts */
|
24
|
-
contracts?: {
|
24
|
+
contracts?: Prettify<{
|
25
25
|
[key: string]: ChainContract | {
|
26
26
|
[chainId: number]: ChainContract;
|
27
27
|
};
|
28
28
|
} & {
|
29
|
-
ensRegistry?: ChainContract;
|
30
|
-
ensUniversalResolver?: ChainContract;
|
31
|
-
multicall3?: ChainContract;
|
32
|
-
}
|
29
|
+
ensRegistry?: ChainContract | undefined;
|
30
|
+
ensUniversalResolver?: ChainContract | undefined;
|
31
|
+
multicall3?: ChainContract | undefined;
|
32
|
+
}>;
|
33
33
|
/** ID in number form */
|
34
34
|
id: number;
|
35
35
|
/** Human-readable name */
|
@@ -48,13 +48,13 @@ export type ChainConstants = {
|
|
48
48
|
public: ChainRpcUrls;
|
49
49
|
};
|
50
50
|
/** Source Chain ID (ie. the L1 chain) */
|
51
|
-
sourceId?: number;
|
51
|
+
sourceId?: number | undefined;
|
52
52
|
/** Flag for test networks */
|
53
|
-
testnet?: boolean;
|
53
|
+
testnet?: boolean | undefined;
|
54
54
|
};
|
55
55
|
export type ChainContract = {
|
56
56
|
address: Address;
|
57
|
-
blockCreated?: number;
|
57
|
+
blockCreated?: number | undefined;
|
58
58
|
};
|
59
59
|
export type ChainNativeCurrency = {
|
60
60
|
name: string;
|
@@ -64,7 +64,7 @@ export type ChainNativeCurrency = {
|
|
64
64
|
};
|
65
65
|
export type ChainRpcUrls = {
|
66
66
|
http: readonly string[];
|
67
|
-
webSocket?: readonly string[];
|
67
|
+
webSocket?: readonly string[] | undefined;
|
68
68
|
};
|
69
69
|
export type ChainConfig<formatters extends ChainFormatters | undefined = ChainFormatters | undefined> = {
|
70
70
|
/**
|
@@ -91,23 +91,23 @@ export type ChainFees<formatters extends ChainFormatters | undefined = ChainForm
|
|
91
91
|
*
|
92
92
|
* Overrides the return value in the [`estimateMaxPriorityFeePerGas` Action](/docs/actions/public/estimateMaxPriorityFeePerGas).
|
93
93
|
*/
|
94
|
-
defaultPriorityFee?: bigint | ((args: ChainFeesFnParameters<formatters>) => Promise<bigint> | bigint);
|
94
|
+
defaultPriorityFee?: bigint | ((args: ChainFeesFnParameters<formatters>) => Promise<bigint> | bigint) | undefined;
|
95
95
|
/**
|
96
96
|
* Allows customization of fee per gas values (e.g. `maxFeePerGas`/`maxPriorityFeePerGas`).
|
97
97
|
*
|
98
98
|
* Overrides the return value in the [`estimateFeesPerGas` Action](/docs/actions/public/estimateFeesPerGas).
|
99
99
|
*/
|
100
|
-
estimateFeesPerGas?: (args: ChainEstimateFeesPerGasFnParameters<formatters>) => Promise<EstimateFeesPerGasReturnType> | bigint;
|
100
|
+
estimateFeesPerGas?: ((args: ChainEstimateFeesPerGasFnParameters<formatters>) => Promise<EstimateFeesPerGasReturnType>) | bigint | undefined;
|
101
101
|
};
|
102
102
|
export type ChainFormatters = {
|
103
103
|
/** Modifies how the Block structure is formatted & typed. */
|
104
|
-
block?: ChainFormatter<'block'
|
104
|
+
block?: ChainFormatter<'block'> | undefined;
|
105
105
|
/** Modifies how the Transaction structure is formatted & typed. */
|
106
|
-
transaction?: ChainFormatter<'transaction'
|
106
|
+
transaction?: ChainFormatter<'transaction'> | undefined;
|
107
107
|
/** Modifies how the TransactionReceipt structure is formatted & typed. */
|
108
|
-
transactionReceipt?: ChainFormatter<'transactionReceipt'
|
108
|
+
transactionReceipt?: ChainFormatter<'transactionReceipt'> | undefined;
|
109
109
|
/** Modifies how the TransactionRequest structure is formatted & typed. */
|
110
|
-
transactionRequest?: ChainFormatter<'transactionRequest'
|
110
|
+
transactionRequest?: ChainFormatter<'transactionRequest'> | undefined;
|
111
111
|
};
|
112
112
|
export type ChainFormatter<type extends string = string> = {
|
113
113
|
format: (args: any) => any;
|
@@ -115,7 +115,7 @@ export type ChainFormatter<type extends string = string> = {
|
|
115
115
|
};
|
116
116
|
export type ChainSerializers<formatters extends ChainFormatters | undefined = undefined> = {
|
117
117
|
/** Modifies how Transactions are serialized. */
|
118
|
-
transaction?: SerializeTransactionFn<formatters extends ChainFormatters ? formatters['transactionRequest'] extends ChainFormatter ? TransactionSerializableGeneric & Parameters<formatters['transactionRequest']['format']>[0] : TransactionSerializable : TransactionSerializable
|
118
|
+
transaction?: SerializeTransactionFn<formatters extends ChainFormatters ? formatters['transactionRequest'] extends ChainFormatter ? TransactionSerializableGeneric & Parameters<formatters['transactionRequest']['format']>[0] : TransactionSerializable : TransactionSerializable> | undefined;
|
119
119
|
};
|
120
120
|
export type ChainFeesFnParameters<formatters extends ChainFormatters | undefined = ChainFormatters | undefined> = {
|
121
121
|
/** The latest block. */
|
@@ -130,7 +130,7 @@ export type ChainFeesFnParameters<formatters extends ChainFormatters | undefined
|
|
130
130
|
*/
|
131
131
|
request?: PrepareTransactionRequestParameters<Omit<Chain, 'formatters'> & {
|
132
132
|
formatters: formatters;
|
133
|
-
}, Account | undefined, undefined
|
133
|
+
}, Account | undefined, undefined> | undefined;
|
134
134
|
};
|
135
135
|
export type ChainEstimateFeesPerGasFnParameters<formatters extends ChainFormatters | undefined = ChainFormatters | undefined> = {
|
136
136
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../src/types/chain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAA;AAC3F,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,gDAAgD,CAAA;AACzG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAA;AACzE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,KAAK,EACV,uBAAuB,EACvB,8BAA8B,EAC/B,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAClE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAA;AAE1F,MAAM,MAAM,KAAK,CACf,UAAU,SAAS,eAAe,GAAG,SAAS,GAAG,eAAe,GAAG,SAAS,IAC1E,cAAc,GAAG,WAAW,CAAC,UAAU,CAAC,CAAA;
|
1
|
+
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../src/types/chain.ts"],"names":[],"mappings":"AAAA,OAAO,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AAS,IAAI,GAC/B;IAAE,KAAK,EAAE,aAAa,GAAG,IAAI,CAAA;CAAE,GAC/B;IAAE,KAAK,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;CAAE,CAAA"}
|
package/package.json
CHANGED
package/src/types/chain.ts
CHANGED
@@ -16,7 +16,7 @@ import type { SerializeTransactionFn } from '../utils/transaction/serializeTrans
|
|
16
16
|
|
17
17
|
export type Chain<
|
18
18
|
formatters extends ChainFormatters | undefined = ChainFormatters | undefined,
|
19
|
-
> = ChainConstants & ChainConfig<formatters
|
19
|
+
> = Prettify<ChainConstants & ChainConfig<formatters>>
|
20
20
|
|
21
21
|
/////////////////////////////////////////////////////////////////////
|
22
22
|
// Constants
|
@@ -28,18 +28,22 @@ export type ChainBlockExplorer = {
|
|
28
28
|
|
29
29
|
export type ChainConstants = {
|
30
30
|
/** Collection of block explorers */
|
31
|
-
blockExplorers?:
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
blockExplorers?:
|
32
|
+
| {
|
33
|
+
default: ChainBlockExplorer
|
34
|
+
etherscan?: ChainBlockExplorer | undefined
|
35
|
+
}
|
36
|
+
| undefined
|
35
37
|
/** Collection of contracts */
|
36
|
-
contracts?:
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
contracts?: Prettify<
|
39
|
+
{
|
40
|
+
[key: string]: ChainContract | { [chainId: number]: ChainContract }
|
41
|
+
} & {
|
42
|
+
ensRegistry?: ChainContract | undefined
|
43
|
+
ensUniversalResolver?: ChainContract | undefined
|
44
|
+
multicall3?: ChainContract | undefined
|
45
|
+
}
|
46
|
+
>
|
43
47
|
/** ID in number form */
|
44
48
|
id: number
|
45
49
|
/** Human-readable name */
|
@@ -58,9 +62,9 @@ export type ChainConstants = {
|
|
58
62
|
public: ChainRpcUrls
|
59
63
|
}
|
60
64
|
/** Source Chain ID (ie. the L1 chain) */
|
61
|
-
sourceId?: number
|
65
|
+
sourceId?: number | undefined
|
62
66
|
/** Flag for test networks */
|
63
|
-
testnet?: boolean
|
67
|
+
testnet?: boolean | undefined
|
64
68
|
|
65
69
|
// TODO(v2): remove `rpcUrls` in favor of `publicRpcUrls`.
|
66
70
|
// publicRpcUrls: ChainRpcUrls,
|
@@ -68,7 +72,7 @@ export type ChainConstants = {
|
|
68
72
|
|
69
73
|
export type ChainContract = {
|
70
74
|
address: Address
|
71
|
-
blockCreated?: number
|
75
|
+
blockCreated?: number | undefined
|
72
76
|
}
|
73
77
|
|
74
78
|
export type ChainNativeCurrency = {
|
@@ -80,7 +84,7 @@ export type ChainNativeCurrency = {
|
|
80
84
|
|
81
85
|
export type ChainRpcUrls = {
|
82
86
|
http: readonly string[]
|
83
|
-
webSocket?: readonly string[]
|
87
|
+
webSocket?: readonly string[] | undefined
|
84
88
|
}
|
85
89
|
|
86
90
|
/////////////////////////////////////////////////////////////////////
|
@@ -121,25 +125,29 @@ export type ChainFees<
|
|
121
125
|
defaultPriorityFee?:
|
122
126
|
| bigint
|
123
127
|
| ((args: ChainFeesFnParameters<formatters>) => Promise<bigint> | bigint)
|
128
|
+
| undefined
|
124
129
|
/**
|
125
130
|
* Allows customization of fee per gas values (e.g. `maxFeePerGas`/`maxPriorityFeePerGas`).
|
126
131
|
*
|
127
132
|
* Overrides the return value in the [`estimateFeesPerGas` Action](/docs/actions/public/estimateFeesPerGas).
|
128
133
|
*/
|
129
|
-
estimateFeesPerGas?:
|
130
|
-
|
131
|
-
|
134
|
+
estimateFeesPerGas?:
|
135
|
+
| ((
|
136
|
+
args: ChainEstimateFeesPerGasFnParameters<formatters>,
|
137
|
+
) => Promise<EstimateFeesPerGasReturnType>)
|
138
|
+
| bigint
|
139
|
+
| undefined
|
132
140
|
}
|
133
141
|
|
134
142
|
export type ChainFormatters = {
|
135
143
|
/** Modifies how the Block structure is formatted & typed. */
|
136
|
-
block?: ChainFormatter<'block'>
|
144
|
+
block?: ChainFormatter<'block'> | undefined
|
137
145
|
/** Modifies how the Transaction structure is formatted & typed. */
|
138
|
-
transaction?: ChainFormatter<'transaction'>
|
146
|
+
transaction?: ChainFormatter<'transaction'> | undefined
|
139
147
|
/** Modifies how the TransactionReceipt structure is formatted & typed. */
|
140
|
-
transactionReceipt?: ChainFormatter<'transactionReceipt'>
|
148
|
+
transactionReceipt?: ChainFormatter<'transactionReceipt'> | undefined
|
141
149
|
/** Modifies how the TransactionRequest structure is formatted & typed. */
|
142
|
-
transactionRequest?: ChainFormatter<'transactionRequest'>
|
150
|
+
transactionRequest?: ChainFormatter<'transactionRequest'> | undefined
|
143
151
|
}
|
144
152
|
|
145
153
|
export type ChainFormatter<type extends string = string> = {
|
@@ -151,14 +159,16 @@ export type ChainSerializers<
|
|
151
159
|
formatters extends ChainFormatters | undefined = undefined,
|
152
160
|
> = {
|
153
161
|
/** Modifies how Transactions are serialized. */
|
154
|
-
transaction?:
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
+
transaction?:
|
163
|
+
| SerializeTransactionFn<
|
164
|
+
formatters extends ChainFormatters
|
165
|
+
? formatters['transactionRequest'] extends ChainFormatter
|
166
|
+
? TransactionSerializableGeneric &
|
167
|
+
Parameters<formatters['transactionRequest']['format']>[0]
|
168
|
+
: TransactionSerializable
|
169
|
+
: TransactionSerializable
|
170
|
+
>
|
171
|
+
| undefined
|
162
172
|
}
|
163
173
|
|
164
174
|
/////////////////////////////////////////////////////////////////////
|
@@ -175,11 +185,13 @@ export type ChainFeesFnParameters<
|
|
175
185
|
* is outside of a transaction request context (e.g. a direct call to
|
176
186
|
* the `estimateFeesPerGas` Action).
|
177
187
|
*/
|
178
|
-
request?:
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
188
|
+
request?:
|
189
|
+
| PrepareTransactionRequestParameters<
|
190
|
+
Omit<Chain, 'formatters'> & { formatters: formatters },
|
191
|
+
Account | undefined,
|
192
|
+
undefined
|
193
|
+
>
|
194
|
+
| undefined
|
183
195
|
}
|
184
196
|
|
185
197
|
export type ChainEstimateFeesPerGasFnParameters<
|