viem 0.0.0-w-20230904174840 → 0.0.0-w-20230904202352
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 +22 -22
- package/dist/types/types/chain.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/types/chain.ts +53 -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
|
-
[chainId: number]: ChainContract;
|
27
|
-
};
|
26
|
+
[chainId: number]: ChainContract | undefined;
|
27
|
+
} | undefined;
|
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
|
+
}> | undefined;
|
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","sour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AS,EAC/B,aAAa,SAAS,KAAK,GAAG,SAAS,GAAG,SAAS,IACjD,WAAW,CAAC,KAAK,CAAC,SAAS,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,27 @@ 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?:
|
39
|
+
| Prettify<
|
40
|
+
{
|
41
|
+
[key: string]:
|
42
|
+
| ChainContract
|
43
|
+
| { [chainId: number]: ChainContract | undefined }
|
44
|
+
| undefined
|
45
|
+
} & {
|
46
|
+
ensRegistry?: ChainContract | undefined
|
47
|
+
ensUniversalResolver?: ChainContract | undefined
|
48
|
+
multicall3?: ChainContract | undefined
|
49
|
+
}
|
50
|
+
>
|
51
|
+
| undefined
|
43
52
|
/** ID in number form */
|
44
53
|
id: number
|
45
54
|
/** Human-readable name */
|
@@ -58,9 +67,9 @@ export type ChainConstants = {
|
|
58
67
|
public: ChainRpcUrls
|
59
68
|
}
|
60
69
|
/** Source Chain ID (ie. the L1 chain) */
|
61
|
-
sourceId?: number
|
70
|
+
sourceId?: number | undefined
|
62
71
|
/** Flag for test networks */
|
63
|
-
testnet?: boolean
|
72
|
+
testnet?: boolean | undefined
|
64
73
|
|
65
74
|
// TODO(v2): remove `rpcUrls` in favor of `publicRpcUrls`.
|
66
75
|
// publicRpcUrls: ChainRpcUrls,
|
@@ -68,7 +77,7 @@ export type ChainConstants = {
|
|
68
77
|
|
69
78
|
export type ChainContract = {
|
70
79
|
address: Address
|
71
|
-
blockCreated?: number
|
80
|
+
blockCreated?: number | undefined
|
72
81
|
}
|
73
82
|
|
74
83
|
export type ChainNativeCurrency = {
|
@@ -80,7 +89,7 @@ export type ChainNativeCurrency = {
|
|
80
89
|
|
81
90
|
export type ChainRpcUrls = {
|
82
91
|
http: readonly string[]
|
83
|
-
webSocket?: readonly string[]
|
92
|
+
webSocket?: readonly string[] | undefined
|
84
93
|
}
|
85
94
|
|
86
95
|
/////////////////////////////////////////////////////////////////////
|
@@ -121,25 +130,29 @@ export type ChainFees<
|
|
121
130
|
defaultPriorityFee?:
|
122
131
|
| bigint
|
123
132
|
| ((args: ChainFeesFnParameters<formatters>) => Promise<bigint> | bigint)
|
133
|
+
| undefined
|
124
134
|
/**
|
125
135
|
* Allows customization of fee per gas values (e.g. `maxFeePerGas`/`maxPriorityFeePerGas`).
|
126
136
|
*
|
127
137
|
* Overrides the return value in the [`estimateFeesPerGas` Action](/docs/actions/public/estimateFeesPerGas).
|
128
138
|
*/
|
129
|
-
estimateFeesPerGas?:
|
130
|
-
|
131
|
-
|
139
|
+
estimateFeesPerGas?:
|
140
|
+
| ((
|
141
|
+
args: ChainEstimateFeesPerGasFnParameters<formatters>,
|
142
|
+
) => Promise<EstimateFeesPerGasReturnType>)
|
143
|
+
| bigint
|
144
|
+
| undefined
|
132
145
|
}
|
133
146
|
|
134
147
|
export type ChainFormatters = {
|
135
148
|
/** Modifies how the Block structure is formatted & typed. */
|
136
|
-
block?: ChainFormatter<'block'>
|
149
|
+
block?: ChainFormatter<'block'> | undefined
|
137
150
|
/** Modifies how the Transaction structure is formatted & typed. */
|
138
|
-
transaction?: ChainFormatter<'transaction'>
|
151
|
+
transaction?: ChainFormatter<'transaction'> | undefined
|
139
152
|
/** Modifies how the TransactionReceipt structure is formatted & typed. */
|
140
|
-
transactionReceipt?: ChainFormatter<'transactionReceipt'>
|
153
|
+
transactionReceipt?: ChainFormatter<'transactionReceipt'> | undefined
|
141
154
|
/** Modifies how the TransactionRequest structure is formatted & typed. */
|
142
|
-
transactionRequest?: ChainFormatter<'transactionRequest'>
|
155
|
+
transactionRequest?: ChainFormatter<'transactionRequest'> | undefined
|
143
156
|
}
|
144
157
|
|
145
158
|
export type ChainFormatter<type extends string = string> = {
|
@@ -151,14 +164,16 @@ export type ChainSerializers<
|
|
151
164
|
formatters extends ChainFormatters | undefined = undefined,
|
152
165
|
> = {
|
153
166
|
/** Modifies how Transactions are serialized. */
|
154
|
-
transaction?:
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
167
|
+
transaction?:
|
168
|
+
| SerializeTransactionFn<
|
169
|
+
formatters extends ChainFormatters
|
170
|
+
? formatters['transactionRequest'] extends ChainFormatter
|
171
|
+
? TransactionSerializableGeneric &
|
172
|
+
Parameters<formatters['transactionRequest']['format']>[0]
|
173
|
+
: TransactionSerializable
|
174
|
+
: TransactionSerializable
|
175
|
+
>
|
176
|
+
| undefined
|
162
177
|
}
|
163
178
|
|
164
179
|
/////////////////////////////////////////////////////////////////////
|
@@ -175,11 +190,13 @@ export type ChainFeesFnParameters<
|
|
175
190
|
* is outside of a transaction request context (e.g. a direct call to
|
176
191
|
* the `estimateFeesPerGas` Action).
|
177
192
|
*/
|
178
|
-
request?:
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
193
|
+
request?:
|
194
|
+
| PrepareTransactionRequestParameters<
|
195
|
+
Omit<Chain, 'formatters'> & { formatters: formatters },
|
196
|
+
Account | undefined,
|
197
|
+
undefined
|
198
|
+
>
|
199
|
+
| undefined
|
183
200
|
}
|
184
201
|
|
185
202
|
export type ChainEstimateFeesPerGasFnParameters<
|