viem 0.2.0-jxom-local-accounts.20230321T212822 → 0.2.0-main.20230323T084936
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/abi.d.ts +3 -3
- package/dist/abi.js +2 -2
- package/dist/abi.mjs +1 -1
- package/dist/{chain-75b0942e.d.ts → chain-1b53ef88.d.ts} +48 -53
- package/dist/{chain-f8db473f.d.ts → chain-ec8c485d.d.ts} +1 -1
- package/dist/chains.d.ts +3 -3
- package/dist/chains.js +63 -63
- package/dist/chains.mjs +1 -1
- package/dist/{chunk-NJSAEA2H.js → chunk-BHAAXXGO.js} +154 -461
- package/dist/chunk-BHAAXXGO.js.map +1 -0
- package/dist/{chunk-IVRML3IK.mjs → chunk-FOJL5WVL.mjs} +85 -392
- package/dist/chunk-FOJL5WVL.mjs.map +1 -0
- package/dist/{chunk-6UKHPIXX.mjs → chunk-R7WEI5MQ.mjs} +2 -2
- package/dist/chunk-R7WEI5MQ.mjs.map +1 -0
- package/dist/{chunk-LYQKHD7R.js → chunk-ZIT7BMZO.js} +19 -19
- package/dist/{chunk-LYQKHD7R.js.map → chunk-ZIT7BMZO.js.map} +1 -1
- package/dist/contract.d.ts +7 -9
- package/dist/contract.js +2 -2
- package/dist/contract.mjs +1 -1
- package/dist/{createClient-f87255c1.d.ts → createClient-a28317a9.d.ts} +6 -6
- package/dist/{createPublicClient-d2c37c92.d.ts → createPublicClient-75540130.d.ts} +206 -160
- package/dist/{eip1193-ae706fd8.d.ts → eip1193-4f4e240c.d.ts} +1 -1
- package/dist/{encodeFunctionResult-4792a6a3.d.ts → encodeFunctionResult-1f324375.d.ts} +1 -1
- package/dist/{encodePacked-3fcdd54b.d.ts → encodePacked-d5d5264a.d.ts} +1 -1
- package/dist/ens.d.ts +4 -6
- package/dist/ens.js +3 -3
- package/dist/ens.mjs +2 -2
- package/dist/ethers.d.ts +6 -5
- package/dist/ethers.js +5 -7
- package/dist/ethers.js.map +1 -1
- package/dist/ethers.mjs +5 -7
- package/dist/ethers.mjs.map +1 -1
- package/dist/{formatAbiItem-765ebc53.d.ts → formatAbiItem-15e8817d.d.ts} +1 -1
- package/dist/{getAbiItem-693e6e1b.d.ts → getAbiItem-3e809ff9.d.ts} +1 -1
- package/dist/index.d.ts +13 -15
- package/dist/index.js +91 -99
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -13
- package/dist/index.mjs.map +1 -1
- package/dist/{parseGwei-377678bc.d.ts → parseGwei-6fff7cbe.d.ts} +13 -49
- package/dist/public.d.ts +4 -6
- package/dist/public.js +2 -2
- package/dist/public.mjs +1 -1
- package/dist/{test-98c0b642.d.ts → test-2bd23d7e.d.ts} +32 -33
- package/dist/test.d.ts +10 -10
- package/dist/test.js +2 -2
- package/dist/test.mjs +1 -1
- package/dist/utils/index.d.ts +18 -30
- package/dist/utils/index.js +2 -10
- package/dist/utils/index.mjs +5 -13
- package/dist/wallet.d.ts +4 -6
- package/dist/wallet.js +2 -2
- package/dist/wallet.mjs +1 -1
- package/dist/window.d.ts +2 -2
- package/package.json +1 -9
- package/accounts/package.json +0 -4
- package/dist/accounts/index.d.ts +0 -33
- package/dist/accounts/index.js +0 -89
- package/dist/accounts/index.js.map +0 -1
- package/dist/accounts/index.mjs +0 -89
- package/dist/accounts/index.mjs.map +0 -1
- package/dist/chunk-6UKHPIXX.mjs.map +0 -1
- package/dist/chunk-FNVFGFWN.mjs +0 -31
- package/dist/chunk-FNVFGFWN.mjs.map +0 -1
- package/dist/chunk-FQM5MF6U.js +0 -31
- package/dist/chunk-FQM5MF6U.js.map +0 -1
- package/dist/chunk-IVRML3IK.mjs.map +0 -1
- package/dist/chunk-NJSAEA2H.js.map +0 -1
- package/dist/parseAccount-2d7ea01d.d.ts +0 -6
- package/dist/typedData-ade018d6.d.ts +0 -93
@@ -1,17 +1,27 @@
|
|
1
|
-
import { W as WalletPermission, a as WatchAssetParams, P as PublicRequests } from './eip1193-
|
2
|
-
import { a as Transport, b as ClientConfig, C as Client } from './createClient-
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
account: Account | Address;
|
9
|
-
} : {
|
10
|
-
account?: Account | Address;
|
1
|
+
import { W as WalletPermission, a as WatchAssetParams, P as PublicRequests } from './eip1193-4f4e240c.js';
|
2
|
+
import { a as Transport, b as ClientConfig, C as Client } from './createClient-a28317a9.js';
|
3
|
+
import { Abi, Narrow, Address, AbiEvent, ExtractAbiEvent, TypedData, TypedDataDomain, TypedDataToPrimitiveTypes } from 'abitype';
|
4
|
+
import { C as Chain, H as Hex, h as ExtractConstructorArgsFromAbi, W as ExtractFormatter, a1 as Formatters, a2 as Formatter, X as Formatted, c as Block, R as RpcBlock, O as Transaction, T as TransactionReceipt, z as RpcTransactionReceipt, a3 as TransactionType, D as RpcTransactionRequest, I as TransactionRequest, f as BlockTag, a4 as MergeIntersectionProperties, g as ContractConfig, a5 as GetValue, p as ExtractResultFromAbi, a6 as MaybeAbiEventName, a7 as MaybeExtractEventArgsFromAbi, e as BlockNumber, m as ExtractEventNameFromAbi, a as Hash, F as FeeHistory, L as Log, Y as FormattedTransaction, Z as TransactionFormatter, k as ExtractEventArgsFromAbi, a8 as Prettify } from './chain-1b53ef88.js';
|
5
|
+
|
6
|
+
type AddChainParameters = {
|
7
|
+
chain: Chain;
|
11
8
|
};
|
12
|
-
|
9
|
+
declare function addChain(client: WalletClient, { chain }: AddChainParameters): Promise<void>;
|
10
|
+
|
11
|
+
type DeployContractParameters<TChain extends Chain = Chain, TAbi extends Abi | readonly unknown[] = Abi> = Omit<SendTransactionParameters<TChain>, 'accessList' | 'to' | 'data' | 'value'> & {
|
12
|
+
abi: Narrow<TAbi>;
|
13
|
+
bytecode: Hex;
|
14
|
+
} & ExtractConstructorArgsFromAbi<TAbi>;
|
15
|
+
type DeployContractReturnType = SendTransactionReturnType;
|
16
|
+
declare function deployContract<TChain extends Chain, TAbi extends Abi | readonly unknown[]>(walletClient: WalletClient, { abi, args, bytecode, ...request }: DeployContractParameters<TChain, TAbi>): Promise<DeployContractReturnType>;
|
13
17
|
|
14
|
-
type
|
18
|
+
type GetAddressesReturnType = Address[];
|
19
|
+
declare function getAddresses(client: WalletClient): Promise<GetAddressesReturnType>;
|
20
|
+
|
21
|
+
type GetChainIdReturnType = number;
|
22
|
+
declare function getChainId(client: PublicClient | WalletClient): Promise<GetChainIdReturnType>;
|
23
|
+
|
24
|
+
type BlockFormatter<TChain extends Chain = Chain> = ExtractFormatter<TChain, 'block', NonNullable<Formatters['block']>>;
|
15
25
|
type FormattedBlock<TFormatter extends Formatter | undefined = Formatter> = Formatted<TFormatter, Block>;
|
16
26
|
declare function formatBlock(block: Partial<RpcBlock>): Block<bigint, Transaction<bigint, number>>;
|
17
27
|
declare const defineBlock: <TFormat extends Formatter<Partial<RpcBlock>, Partial<Block<bigint, Transaction<bigint, number>>> & {
|
@@ -23,7 +33,7 @@ declare const defineBlock: <TFormat extends Formatter<Partial<RpcBlock>, Partial
|
|
23
33
|
[key: string]: unknown;
|
24
34
|
}) => Block<bigint, Transaction<bigint, number>> & ReturnType<TFormat> & { [K in TExclude[number]]: never; };
|
25
35
|
|
26
|
-
type TransactionReceiptFormatter<TChain extends Chain
|
36
|
+
type TransactionReceiptFormatter<TChain extends Chain = Chain> = ExtractFormatter<TChain, 'transactionReceipt', NonNullable<Formatters['transactionReceipt']>>;
|
27
37
|
type FormattedTransactionReceipt<TFormatter extends Formatter | undefined = Formatter> = Formatted<TFormatter, TransactionReceipt>;
|
28
38
|
declare const defineTransactionReceipt: <TFormat extends Formatter<Partial<RpcTransactionReceipt>, Partial<TransactionReceipt<bigint, number, "success" | "reverted", TransactionType>> & {
|
29
39
|
[key: string]: unknown;
|
@@ -34,7 +44,7 @@ declare const defineTransactionReceipt: <TFormat extends Formatter<Partial<RpcTr
|
|
34
44
|
[key: string]: unknown;
|
35
45
|
}) => TransactionReceipt<bigint, number, "success" | "reverted", TransactionType> & ReturnType<TFormat> & { [K in TExclude[number]]: never; };
|
36
46
|
|
37
|
-
type TransactionRequestFormatter<TChain extends Chain
|
47
|
+
type TransactionRequestFormatter<TChain extends Chain = Chain> = ExtractFormatter<TChain, 'transactionRequest', NonNullable<Formatters['transactionRequest']>>;
|
38
48
|
type FormattedTransactionRequest$1<TFormatter extends Formatter | undefined = Formatter> = Formatted<TFormatter, RpcTransactionRequest>;
|
39
49
|
declare function formatTransactionRequest(transactionRequest: Partial<TransactionRequest>): RpcTransactionRequest;
|
40
50
|
declare const defineTransactionRequest: <TFormat extends Formatter<Partial<TransactionRequest<bigint, number>>, Partial<RpcTransactionRequest> & {
|
@@ -47,8 +57,8 @@ declare const defineTransactionRequest: <TFormat extends Formatter<Partial<Trans
|
|
47
57
|
}) => RpcTransactionRequest & ReturnType<TFormat> & { [K in TExclude[number]]: never; };
|
48
58
|
|
49
59
|
type FormattedCall<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Omit<Formatted<TFormatter, TransactionRequest, true>, 'from'>, TransactionRequest>;
|
50
|
-
type CallParameters<TChain extends Chain
|
51
|
-
account?: Account
|
60
|
+
type CallParameters<TChain extends Chain = Chain> = FormattedCall<TransactionRequestFormatter<TChain>> & {
|
61
|
+
account?: Account;
|
52
62
|
} & ({
|
53
63
|
/** The balance of the account at a block number. */
|
54
64
|
blockNumber?: bigint;
|
@@ -61,97 +71,24 @@ type CallParameters<TChain extends Chain | undefined = Chain> = FormattedCall<Tr
|
|
61
71
|
type CallReturnType = {
|
62
72
|
data: Hex | undefined;
|
63
73
|
};
|
64
|
-
declare function call<TChain extends Chain
|
65
|
-
|
66
|
-
type AddChainParameters = {
|
67
|
-
chain: Chain;
|
68
|
-
};
|
69
|
-
declare function addChain(client: WalletClientArg, { chain }: AddChainParameters): Promise<void>;
|
70
|
-
|
71
|
-
type DeployContractParameters<TChain extends Chain | undefined = Chain | undefined, TAbi extends Abi | readonly unknown[] = Abi, TAccount extends Account | undefined = undefined, TChainOverride extends Chain | undefined = TChain> = Omit<SendTransactionParameters<TChain, TAccount, TChainOverride>, 'accessList' | 'chain' | 'to' | 'data' | 'value'> & {
|
72
|
-
abi: Narrow<TAbi>;
|
73
|
-
bytecode: Hex;
|
74
|
-
} & GetChain<TChain, TChainOverride> & ExtractConstructorArgsFromAbi<TAbi>;
|
75
|
-
type DeployContractReturnType = SendTransactionReturnType;
|
76
|
-
declare function deployContract<TChain extends Chain | undefined, TAbi extends Abi | readonly unknown[], TAccount extends Account | undefined, TChainOverride extends Chain | undefined = TChain>(walletClient: WalletClientArg<Transport, TChain, TAccount>, { abi, args, bytecode, ...request }: DeployContractParameters<TChain, TAbi, TAccount, TChainOverride>): Promise<DeployContractReturnType>;
|
77
|
-
|
78
|
-
type GetAddressesReturnType = Address[];
|
79
|
-
declare function getAddresses(client: WalletClientArg): Promise<GetAddressesReturnType>;
|
80
|
-
|
81
|
-
type GetChainIdReturnType = number;
|
82
|
-
declare function getChainId(client: PublicClientArg | WalletClientArg): Promise<GetChainIdReturnType>;
|
83
|
-
|
84
|
-
type GetPermissionsReturnType = WalletPermission[];
|
85
|
-
declare function getPermissions(client: WalletClientArg): Promise<WalletPermission[]>;
|
86
|
-
|
87
|
-
type RequestAddressesReturnType = Address[];
|
88
|
-
declare function requestAddresses(client: WalletClientArg): Promise<RequestAddressesReturnType>;
|
89
|
-
|
90
|
-
type RequestPermissionsParameters = {
|
91
|
-
eth_accounts: Record<string, any>;
|
92
|
-
} & {
|
93
|
-
[key: string]: Record<string, any>;
|
94
|
-
};
|
95
|
-
type RequestPermissionsReturnType = WalletPermission[];
|
96
|
-
declare function requestPermissions(client: WalletClientArg, permissions: RequestPermissionsParameters): Promise<WalletPermission[]>;
|
97
|
-
|
98
|
-
type FormattedTransactionRequest<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Omit<Formatted<TFormatter, TransactionRequest, true>, 'from'>, TransactionRequest>;
|
99
|
-
type SendTransactionParameters<TChain extends Chain | undefined = Chain, TAccount extends Account | undefined = undefined, TChainOverride extends Chain | undefined = TChain> = FormattedTransactionRequest<TransactionRequestFormatter<TChainOverride>> & GetAccountParameter<TAccount> & GetChain<TChain, TChainOverride>;
|
100
|
-
type SendTransactionReturnType = Hash;
|
101
|
-
declare function sendTransaction<TChain extends Chain | undefined, TAccount extends Account | undefined, TChainOverride extends Chain | undefined = TChain>(client: WalletClientArg<Transport, TChain, TAccount>, args: SendTransactionParameters<TChain, TAccount, TChainOverride>): Promise<SendTransactionReturnType>;
|
102
|
-
|
103
|
-
type SignMessageParameters<TAccount extends Account | undefined = undefined> = GetAccountParameter<TAccount> & ({
|
104
|
-
/** @deprecated – `data` will be removed in 0.2.0; use `message` instead. */
|
105
|
-
data: string;
|
106
|
-
message?: never;
|
107
|
-
} | {
|
108
|
-
data?: never;
|
109
|
-
message: string;
|
110
|
-
});
|
111
|
-
type SignMessageReturnType = Hex;
|
112
|
-
declare function signMessage<TAccount extends Account | undefined>(client: WalletClientArg<Transport, Chain | undefined, TAccount>, { account: account_, data, message, }: SignMessageParameters<TAccount>): Promise<SignMessageReturnType>;
|
74
|
+
declare function call<TChain extends Chain>(client: PublicClient<any, TChain>, args: CallParameters<TChain>): Promise<CallReturnType>;
|
113
75
|
|
114
|
-
type
|
115
|
-
[key: string]: unknown;
|
116
|
-
} = TypedData, TPrimaryType extends string = string, TAccount extends Account | undefined = undefined> = GetAccountParameter<TAccount> & TypedDataDefinition<TTypedData, TPrimaryType>;
|
117
|
-
type SignTypedDataReturnType = Hex;
|
118
|
-
declare function signTypedData<TTypedData extends TypedData | {
|
119
|
-
[key: string]: unknown;
|
120
|
-
}, TPrimaryType extends string = string, TAccount extends Account | undefined = undefined>(client: WalletClientArg<Transport, Chain | undefined, TAccount>, { account: account_, domain, message, primaryType, types: types_, }: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>): Promise<SignTypedDataReturnType>;
|
121
|
-
|
122
|
-
type SwitchChainParameters = {
|
123
|
-
id: Chain['id'];
|
124
|
-
};
|
125
|
-
declare function switchChain(client: WalletClientArg, { id }: SwitchChainParameters): Promise<void>;
|
126
|
-
|
127
|
-
type WatchAssetParameters = WatchAssetParams;
|
128
|
-
type WatchAssetReturnType = boolean;
|
129
|
-
declare function watchAsset(client: WalletClientArg, params: WatchAssetParameters): Promise<WatchAssetReturnType>;
|
130
|
-
|
131
|
-
type WriteContractParameters<TChain extends Chain | undefined = Chain, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, TAccount extends Account | undefined = undefined, TChainOverride extends Chain | undefined = TChain> = Omit<SendTransactionParameters<TChain, TAccount, TChainOverride>, 'chain' | 'to' | 'data' | 'value'> & {
|
132
|
-
value?: GetValue<TAbi, TFunctionName, SendTransactionParameters<TChain>['value']>;
|
133
|
-
} & GetChain<TChain, TChainOverride> & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'>;
|
134
|
-
type WriteContractReturnType = SendTransactionReturnType;
|
135
|
-
declare function writeContract<TChain extends Chain | undefined, TAbi extends Abi | readonly unknown[], TFunctionName extends string, TAccount extends Account | undefined, TChainOverride extends Chain | undefined = TChain>(client: WalletClientArg<Transport, TChain, TAccount>, { abi, address, args, functionName, ...request }: WriteContractParameters<TChain, TAbi, TFunctionName, TAccount, TChainOverride>): Promise<WriteContractReturnType>;
|
136
|
-
|
137
|
-
type SimulateContractParameters<TChain extends Chain | undefined = Chain, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any, TChainOverride extends Chain | undefined = undefined> = Omit<CallParameters<TChainOverride extends Chain ? TChainOverride : TChain>, 'to' | 'data' | 'value'> & {
|
76
|
+
type SimulateContractParameters<TChain extends Chain = Chain, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any, TChainOverride extends Chain | undefined = undefined> = Omit<CallParameters<TChainOverride extends Chain ? TChainOverride : TChain>, 'to' | 'data' | 'value'> & {
|
138
77
|
chain?: TChainOverride;
|
139
78
|
} & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'> & {
|
140
79
|
value?: GetValue<TAbi, TFunctionName, CallParameters<TChain>['value']>;
|
141
80
|
};
|
142
|
-
type SimulateContractReturnType<TChain extends Chain
|
81
|
+
type SimulateContractReturnType<TChain extends Chain = Chain, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = {
|
143
82
|
result: ExtractResultFromAbi<TAbi, TFunctionName>;
|
144
|
-
request:
|
145
|
-
chain: TChainOverride;
|
146
|
-
} & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'>;
|
83
|
+
request: WriteContractParameters<TChain, TAbi, TFunctionName> & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'>;
|
147
84
|
};
|
148
|
-
declare function simulateContract<TChain extends Chain
|
85
|
+
declare function simulateContract<TChain extends Chain, TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain | undefined>(client: PublicClient<any, TChain>, { abi, address, args, functionName, ...callRequest }: SimulateContractParameters<TChain, TAbi, TFunctionName, TChainOverride>): Promise<SimulateContractReturnType<TChainOverride extends Chain ? TChainOverride : TChain, TAbi, TFunctionName>>;
|
149
86
|
|
150
87
|
type CreatePendingTransactionFilterReturnType = Filter<'transaction'>;
|
151
|
-
declare function createPendingTransactionFilter(client:
|
88
|
+
declare function createPendingTransactionFilter(client: PublicClient): Promise<CreatePendingTransactionFilterReturnType>;
|
152
89
|
|
153
90
|
type CreateBlockFilterReturnType = Filter<'block'>;
|
154
|
-
declare function createBlockFilter(client:
|
91
|
+
declare function createBlockFilter(client: PublicClient): Promise<CreateBlockFilterReturnType>;
|
155
92
|
|
156
93
|
type CreateEventFilterParameters<TAbiEvent extends AbiEvent | undefined = undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined = undefined> = {
|
157
94
|
address?: Address | Address[];
|
@@ -171,7 +108,7 @@ type CreateEventFilterParameters<TAbiEvent extends AbiEvent | undefined = undefi
|
|
171
108
|
event?: never;
|
172
109
|
});
|
173
110
|
type CreateEventFilterReturnType<TAbiEvent extends AbiEvent | undefined = undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined = undefined> = Filter<'event', TAbi, TEventName, TArgs>;
|
174
|
-
declare function createEventFilter<TAbiEvent extends AbiEvent | undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined = undefined>(client:
|
111
|
+
declare function createEventFilter<TAbiEvent extends AbiEvent | undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined = undefined>(client: PublicClient, { address, args, event, fromBlock, toBlock, }?: CreateEventFilterParameters<TAbiEvent, TAbi, TEventName, TArgs>): Promise<CreateEventFilterReturnType<TAbiEvent, TAbi, TEventName, TArgs>>;
|
175
112
|
|
176
113
|
type CreateContractEventFilterParameters<TAbi extends Abi | readonly unknown[] = Abi, TEventName extends string | undefined = undefined, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined = undefined> = {
|
177
114
|
address?: Address | Address[];
|
@@ -187,10 +124,12 @@ type CreateContractEventFilterParameters<TAbi extends Abi | readonly unknown[] =
|
|
187
124
|
args?: never;
|
188
125
|
});
|
189
126
|
type CreateContractEventFilterReturnType<TAbi extends Abi | readonly unknown[] = Abi, TEventName extends string | undefined = undefined, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined = undefined> = Filter<'event', TAbi, TEventName, TArgs>;
|
190
|
-
declare function createContractEventFilter<TAbi extends Abi | readonly unknown[], TEventName extends string | undefined, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined>(client:
|
127
|
+
declare function createContractEventFilter<TAbi extends Abi | readonly unknown[], TEventName extends string | undefined, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined>(client: PublicClient, { address, abi, args, eventName, fromBlock, toBlock, }: CreateContractEventFilterParameters<TAbi, TEventName, TArgs>): Promise<CreateContractEventFilterReturnType<TAbi, TEventName, TArgs>>;
|
191
128
|
|
192
129
|
type FormattedEstimateGas<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Omit<Formatted<TFormatter, TransactionRequest, true>, 'from'>, TransactionRequest>;
|
193
|
-
type EstimateGasParameters<TChain extends Chain
|
130
|
+
type EstimateGasParameters<TChain extends Chain = Chain> = FormattedEstimateGas<TransactionRequestFormatter<TChain>> & {
|
131
|
+
account: Account;
|
132
|
+
} & ({
|
194
133
|
/** The balance of the account at a block number. */
|
195
134
|
blockNumber?: bigint;
|
196
135
|
blockTag?: never;
|
@@ -203,13 +142,13 @@ type EstimateGasReturnType = bigint;
|
|
203
142
|
/**
|
204
143
|
* @description Estimates the gas necessary to complete a transaction without submitting it to the network.
|
205
144
|
*/
|
206
|
-
declare function estimateGas<TChain extends Chain
|
145
|
+
declare function estimateGas<TChain extends Chain>(client: PublicClient<any, TChain> | WalletClient, args: EstimateGasParameters<TChain>): Promise<EstimateGasReturnType>;
|
207
146
|
|
208
|
-
type EstimateContractGasParameters<TChain extends Chain
|
147
|
+
type EstimateContractGasParameters<TChain extends Chain = Chain, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any> = Omit<EstimateGasParameters<TChain>, 'data' | 'to' | 'value'> & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'> & {
|
209
148
|
value?: GetValue<TAbi, TFunctionName, EstimateGasParameters<TChain>['value']>;
|
210
149
|
};
|
211
150
|
type EstimateContractGasReturnType = bigint;
|
212
|
-
declare function estimateContractGas<TChain extends Chain
|
151
|
+
declare function estimateContractGas<TChain extends Chain, TAbi extends Abi | readonly unknown[], TFunctionName extends string>(client: PublicClient<any, TChain>, { abi, address, args, functionName, ...request }: EstimateContractGasParameters<TChain, TAbi, TFunctionName>): Promise<EstimateContractGasReturnType>;
|
213
152
|
|
214
153
|
type GetBalanceParameters = {
|
215
154
|
/** The address of the account. */
|
@@ -227,7 +166,7 @@ type GetBalanceReturnType = bigint;
|
|
227
166
|
/**
|
228
167
|
* @description Returns the balance of an address in wei.
|
229
168
|
*/
|
230
|
-
declare function getBalance(client:
|
169
|
+
declare function getBalance(client: PublicClient, { address, blockNumber, blockTag }: GetBalanceParameters): Promise<GetBalanceReturnType>;
|
231
170
|
|
232
171
|
type GetBlockParameters = {
|
233
172
|
/** Whether or not to include transaction data in the response. */
|
@@ -248,8 +187,8 @@ type GetBlockParameters = {
|
|
248
187
|
/** The block tag. Defaults to 'latest'. */
|
249
188
|
blockTag?: BlockTag;
|
250
189
|
});
|
251
|
-
type GetBlockReturnType<TChain extends Chain
|
252
|
-
declare function getBlock<TChain extends Chain
|
190
|
+
type GetBlockReturnType<TChain extends Chain = Chain> = FormattedBlock<BlockFormatter<TChain>>;
|
191
|
+
declare function getBlock<TChain extends Chain>(client: PublicClient<any, TChain> | WalletClient, { blockHash, blockNumber, blockTag, includeTransactions, }?: GetBlockParameters): Promise<GetBlockReturnType<TChain>>;
|
253
192
|
|
254
193
|
type GetBlockNumberParameters = {
|
255
194
|
/** The maximum age (in ms) of the cached value. */
|
@@ -281,7 +220,7 @@ declare function getBlockNumberCache(id: string): {
|
|
281
220
|
/**
|
282
221
|
* @description Returns the number of the most recent block seen.
|
283
222
|
*/
|
284
|
-
declare function getBlockNumber(client:
|
223
|
+
declare function getBlockNumber(client: PublicClient<any, any, any>, { maxAge }?: GetBlockNumberParameters): Promise<GetBlockNumberReturnType>;
|
285
224
|
|
286
225
|
type GetBlockTransactionCountParameters = {
|
287
226
|
/** Hash of the block. */
|
@@ -300,7 +239,7 @@ type GetBlockTransactionCountParameters = {
|
|
300
239
|
blockTag?: BlockTag;
|
301
240
|
};
|
302
241
|
type GetBlockTransactionCountReturnType = number;
|
303
|
-
declare function getBlockTransactionCount<TChain extends Chain
|
242
|
+
declare function getBlockTransactionCount<TChain extends Chain>(client: PublicClient<any, TChain>, { blockHash, blockNumber, blockTag, }?: GetBlockTransactionCountParameters): Promise<GetBlockTransactionCountReturnType>;
|
304
243
|
|
305
244
|
type GetBytecodeParameters = {
|
306
245
|
address: Address;
|
@@ -312,7 +251,7 @@ type GetBytecodeParameters = {
|
|
312
251
|
blockTag?: never;
|
313
252
|
});
|
314
253
|
type GetBytecodeReturnType = Hex | undefined;
|
315
|
-
declare function getBytecode(client:
|
254
|
+
declare function getBytecode(client: PublicClient, { address, blockNumber, blockTag }: GetBytecodeParameters): Promise<GetBytecodeReturnType>;
|
316
255
|
|
317
256
|
type GetFeeHistoryParameters = {
|
318
257
|
blockCount: number;
|
@@ -328,25 +267,25 @@ type GetFeeHistoryReturnType = FeeHistory;
|
|
328
267
|
/**
|
329
268
|
* @description Returns a collection of historical gas information.
|
330
269
|
*/
|
331
|
-
declare function getFeeHistory(client:
|
270
|
+
declare function getFeeHistory(client: PublicClient, { blockCount, blockNumber, blockTag, rewardPercentiles, }: GetFeeHistoryParameters): Promise<GetFeeHistoryReturnType>;
|
332
271
|
|
333
272
|
type GetFilterChangesParameters<TFilterType extends FilterType = FilterType, TAbiEvent extends AbiEvent | undefined = undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = {
|
334
273
|
filter: Filter<TFilterType, TAbi, TEventName, any>;
|
335
274
|
};
|
336
275
|
type GetFilterChangesReturnType<TFilterType extends FilterType = FilterType, TAbiEvent extends AbiEvent | undefined = undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = TFilterType extends 'event' ? Log<bigint, number, TAbiEvent, TAbi, TEventName>[] : Hash[];
|
337
|
-
declare function getFilterChanges<TFilterType extends FilterType, TAbiEvent extends AbiEvent | undefined, TAbi extends Abi | readonly unknown[], TEventName extends string | undefined>(client:
|
276
|
+
declare function getFilterChanges<TFilterType extends FilterType, TAbiEvent extends AbiEvent | undefined, TAbi extends Abi | readonly unknown[], TEventName extends string | undefined>(client: PublicClient, { filter, }: GetFilterChangesParameters<TFilterType, TAbiEvent, TAbi, TEventName>): Promise<GetFilterChangesReturnType<TFilterType, TAbiEvent, TAbi, TEventName>>;
|
338
277
|
|
339
278
|
type GetFilterLogsParameters<TAbiEvent extends AbiEvent | undefined = undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = {
|
340
279
|
filter: Filter<'event', TAbi, TEventName, any>;
|
341
280
|
};
|
342
281
|
type GetFilterLogsReturnType<TAbiEvent extends AbiEvent | undefined = undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = Log<bigint, number, TAbiEvent, TAbi, TEventName>[];
|
343
|
-
declare function getFilterLogs<TAbiEvent extends AbiEvent | undefined, TAbi extends Abi | readonly unknown[], TEventName extends string | undefined>(client:
|
282
|
+
declare function getFilterLogs<TAbiEvent extends AbiEvent | undefined, TAbi extends Abi | readonly unknown[], TEventName extends string | undefined>(client: PublicClient, { filter }: GetFilterLogsParameters<TAbiEvent, TAbi, TEventName>): Promise<GetFilterLogsReturnType<TAbiEvent, TAbi, TEventName>>;
|
344
283
|
|
345
284
|
type GetGasPriceReturnType = bigint;
|
346
285
|
/**
|
347
286
|
* @description Returns the current price of gas (in wei).
|
348
287
|
*/
|
349
|
-
declare function getGasPrice(client:
|
288
|
+
declare function getGasPrice(client: PublicClient | WalletClient): Promise<GetGasPriceReturnType>;
|
350
289
|
|
351
290
|
type GetLogsParameters<TAbiEvent extends AbiEvent | undefined = undefined, TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = {
|
352
291
|
/** Address or list of addresses from which logs originated */
|
@@ -373,7 +312,7 @@ type GetLogsReturnType<TAbiEvent extends AbiEvent | undefined = undefined, TEven
|
|
373
312
|
/**
|
374
313
|
* @description Returns a collection of event logs.
|
375
314
|
*/
|
376
|
-
declare function getLogs<TAbiEvent extends AbiEvent | undefined>(client:
|
315
|
+
declare function getLogs<TAbiEvent extends AbiEvent | undefined>(client: PublicClient, { address, blockHash, fromBlock, toBlock, event, args, }?: GetLogsParameters<TAbiEvent>): Promise<GetLogsReturnType<TAbiEvent>>;
|
377
316
|
|
378
317
|
type GetStorageAtParameters = {
|
379
318
|
address: Address;
|
@@ -386,7 +325,7 @@ type GetStorageAtParameters = {
|
|
386
325
|
blockTag?: never;
|
387
326
|
});
|
388
327
|
type GetStorageAtReturnType = Hex | undefined;
|
389
|
-
declare function getStorageAt(client:
|
328
|
+
declare function getStorageAt(client: PublicClient, { address, blockNumber, blockTag, slot }: GetStorageAtParameters): Promise<GetStorageAtReturnType>;
|
390
329
|
|
391
330
|
type GetTransactionParameters = {
|
392
331
|
/** The block hash */
|
@@ -420,11 +359,11 @@ type GetTransactionParameters = {
|
|
420
359
|
hash: Hash;
|
421
360
|
index?: number;
|
422
361
|
};
|
423
|
-
type GetTransactionReturnType<TChain extends Chain
|
362
|
+
type GetTransactionReturnType<TChain extends Chain = Chain> = FormattedTransaction<TransactionFormatter<TChain>>;
|
424
363
|
/** @description Returns information about a transaction given a hash or block identifier. */
|
425
|
-
declare function getTransaction<TChain extends Chain
|
364
|
+
declare function getTransaction<TChain extends Chain>(client: PublicClient<any, TChain>, { blockHash, blockNumber, blockTag, hash, index, }: GetTransactionParameters): Promise<GetTransactionReturnType<TChain>>;
|
426
365
|
|
427
|
-
type GetTransactionConfirmationsParameters<TChain extends Chain
|
366
|
+
type GetTransactionConfirmationsParameters<TChain extends Chain = Chain> = {
|
428
367
|
/** The transaction hash. */
|
429
368
|
hash: Hash;
|
430
369
|
transactionReceipt?: never;
|
@@ -434,7 +373,7 @@ type GetTransactionConfirmationsParameters<TChain extends Chain | undefined = Ch
|
|
434
373
|
transactionReceipt: FormattedTransactionReceipt<TransactionReceiptFormatter<TChain>>;
|
435
374
|
};
|
436
375
|
type GetTransactionConfirmationsReturnType = bigint;
|
437
|
-
declare function getTransactionConfirmations<TChain extends Chain
|
376
|
+
declare function getTransactionConfirmations<TChain extends Chain>(client: PublicClient<any, TChain>, { hash, transactionReceipt }: GetTransactionConfirmationsParameters<TChain>): Promise<GetTransactionConfirmationsReturnType>;
|
438
377
|
|
439
378
|
type GetTransactionCountParameters = {
|
440
379
|
/** The account address. */
|
@@ -452,14 +391,14 @@ type GetTransactionCountReturnType = number;
|
|
452
391
|
/**
|
453
392
|
* @description Returns the number of transactions an account has broadcast / sent.
|
454
393
|
*/
|
455
|
-
declare function getTransactionCount(client:
|
394
|
+
declare function getTransactionCount(client: PublicClient | WalletClient, { address, blockTag, blockNumber }: GetTransactionCountParameters): Promise<GetTransactionCountReturnType>;
|
456
395
|
|
457
396
|
type GetTransactionReceiptParameters = {
|
458
397
|
/** The hash of the transaction. */
|
459
398
|
hash: Hash;
|
460
399
|
};
|
461
|
-
type GetTransactionReceiptReturnType<TChain extends Chain
|
462
|
-
declare function getTransactionReceipt<TChain extends Chain
|
400
|
+
type GetTransactionReceiptReturnType<TChain extends Chain = Chain> = FormattedTransactionReceipt<TransactionReceiptFormatter<TChain>>;
|
401
|
+
declare function getTransactionReceipt<TChain extends Chain>(client: PublicClient<any, TChain>, { hash }: GetTransactionReceiptParameters): Promise<Formatted<ExtractFormatter<TChain, "transactionReceipt", Formatter<RpcTransactionReceipt, TransactionReceipt<bigint, number, "success" | "reverted", TransactionType>>>, TransactionReceipt<bigint, number, "success" | "reverted", TransactionType>, false, false>>;
|
463
402
|
|
464
403
|
type MAXIMUM_DEPTH = 20;
|
465
404
|
type Contract<TAbi extends Abi | readonly unknown[] = Abi | readonly unknown[], TFunctionName extends string = string> = {
|
@@ -509,27 +448,27 @@ type MulticallParameters<TContracts extends ContractConfig[] = ContractConfig[],
|
|
509
448
|
multicallAddress?: Address;
|
510
449
|
};
|
511
450
|
type MulticallReturnType<TContracts extends ContractConfig[] = ContractConfig[], TAllowFailure extends boolean = true> = MulticallResults<TContracts, TAllowFailure>;
|
512
|
-
declare function multicall<TContracts extends ContractConfig[], TAllowFailure extends boolean = true>(client:
|
451
|
+
declare function multicall<TContracts extends ContractConfig[], TAllowFailure extends boolean = true>(client: PublicClient, args: MulticallParameters<TContracts, TAllowFailure>): Promise<MulticallReturnType<TContracts, TAllowFailure>>;
|
513
452
|
|
514
453
|
type ReadContractParameters<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = Pick<CallParameters, 'blockNumber' | 'blockTag'> & ContractConfig<TAbi, TFunctionName, 'view' | 'pure'>;
|
515
454
|
type ReadContractReturnType<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = ExtractResultFromAbi<TAbi, TFunctionName>;
|
516
|
-
declare function readContract<TAbi extends Abi | readonly unknown[], TFunctionName extends string>(client:
|
455
|
+
declare function readContract<TAbi extends Abi | readonly unknown[], TFunctionName extends string>(client: PublicClient, { abi, address, args, functionName, ...callRequest }: ReadContractParameters<TAbi, TFunctionName>): Promise<ReadContractReturnType<TAbi, TFunctionName>>;
|
517
456
|
|
518
457
|
type UninstallFilterParameters = {
|
519
458
|
filter: Filter<any>;
|
520
459
|
};
|
521
460
|
type UninstallFilterReturnType = boolean;
|
522
|
-
declare function uninstallFilter(client:
|
461
|
+
declare function uninstallFilter(client: PublicClient, { filter }: UninstallFilterParameters): Promise<UninstallFilterReturnType>;
|
523
462
|
|
524
463
|
type ReplacementReason = 'cancelled' | 'replaced' | 'repriced';
|
525
|
-
type ReplacementReturnType<TChain extends Chain
|
464
|
+
type ReplacementReturnType<TChain extends Chain = Chain> = {
|
526
465
|
reason: ReplacementReason;
|
527
466
|
replacedTransaction: Transaction;
|
528
467
|
transaction: Transaction;
|
529
468
|
transactionReceipt: GetTransactionReceiptReturnType<TChain>;
|
530
469
|
};
|
531
|
-
type WaitForTransactionReceiptReturnType<TChain extends Chain
|
532
|
-
type WaitForTransactionReceiptParameters<TChain extends Chain
|
470
|
+
type WaitForTransactionReceiptReturnType<TChain extends Chain = Chain> = GetTransactionReceiptReturnType<TChain>;
|
471
|
+
type WaitForTransactionReceiptParameters<TChain extends Chain = Chain> = {
|
533
472
|
/** The number of confirmations (blocks that have passed) to wait before resolving. */
|
534
473
|
confirmations?: number;
|
535
474
|
/** The hash of the transaction. */
|
@@ -540,7 +479,7 @@ type WaitForTransactionReceiptParameters<TChain extends Chain | undefined = Chai
|
|
540
479
|
/** Optional timeout (in milliseconds) to wait before stopping polling. */
|
541
480
|
timeout?: number;
|
542
481
|
};
|
543
|
-
declare function waitForTransactionReceipt<TChain extends Chain
|
482
|
+
declare function waitForTransactionReceipt<TChain extends Chain>(client: PublicClient<any, TChain>, { confirmations, hash, onReplaced, pollingInterval, timeout, }: WaitForTransactionReceiptParameters<TChain>): Promise<WaitForTransactionReceiptReturnType<TChain>>;
|
544
483
|
|
545
484
|
type OnBlockNumberParameter = GetBlockNumberReturnType;
|
546
485
|
type OnBlockNumberFn = (blockNumber: OnBlockNumberParameter, prevBlockNumber: OnBlockNumberParameter | undefined) => void;
|
@@ -557,11 +496,11 @@ type WatchBlockNumberParameters = {
|
|
557
496
|
pollingInterval?: number;
|
558
497
|
};
|
559
498
|
/** @description Watches and returns incoming block numbers. */
|
560
|
-
declare function watchBlockNumber(client:
|
499
|
+
declare function watchBlockNumber(client: PublicClient<any, any, any>, { emitOnBegin, emitMissed, onBlockNumber, onError, pollingInterval, }: WatchBlockNumberParameters): () => void;
|
561
500
|
|
562
|
-
type OnBlockParameter<TChain extends Chain
|
563
|
-
type OnBlock<TChain extends Chain
|
564
|
-
type WatchBlocksParameters<TChain extends Chain
|
501
|
+
type OnBlockParameter<TChain extends Chain = Chain, TIncludeTransactions = false> = Omit<GetBlockReturnType<TChain>, TIncludeTransactions extends false ? 'transactions' : ''>;
|
502
|
+
type OnBlock<TChain extends Chain = Chain, TIncludeTransactions = false> = (block: OnBlockParameter<TChain, TIncludeTransactions>, prevBlock: OnBlockParameter<TChain, TIncludeTransactions> | undefined) => void;
|
503
|
+
type WatchBlocksParameters<TChain extends Chain = Chain> = {
|
565
504
|
/** The block tag. Defaults to "latest". */
|
566
505
|
blockTag?: BlockTag;
|
567
506
|
/** Whether or not to emit the missed blocks to the callback. */
|
@@ -584,7 +523,7 @@ type WatchBlocksParameters<TChain extends Chain | undefined = Chain> = {
|
|
584
523
|
onBlock: OnBlock<TChain>;
|
585
524
|
});
|
586
525
|
/** @description Watches and returns information for incoming blocks. */
|
587
|
-
declare function watchBlocks<TChain extends Chain
|
526
|
+
declare function watchBlocks<TChain extends Chain, TWatchBlocksParameters extends WatchBlocksParameters<TChain>>(client: PublicClient<any, TChain>, { blockTag, emitMissed, emitOnBegin, onBlock, onError, includeTransactions, pollingInterval, }: TWatchBlocksParameters): () => void;
|
588
527
|
|
589
528
|
type OnLogsParameter$1<TAbi extends Abi | readonly unknown[] = readonly unknown[], TEventName extends string = string> = TAbi extends Abi ? Log<bigint, number, ExtractAbiEvent<TAbi, TEventName>>[] : Log[];
|
590
529
|
type OnLogsFn$1<TAbi extends Abi | readonly unknown[] = readonly unknown[], TEventName extends string = string> = (logs: OnLogsParameter$1<TAbi, TEventName>) => void;
|
@@ -605,7 +544,7 @@ type WatchContractEventParameters<TAbi extends Abi | readonly unknown[] = readon
|
|
605
544
|
/** Polling frequency (in ms). Defaults to Client's pollingInterval config. */
|
606
545
|
pollingInterval?: number;
|
607
546
|
};
|
608
|
-
declare function watchContractEvent<TAbi extends Abi | readonly unknown[], TEventName extends string>(client:
|
547
|
+
declare function watchContractEvent<TAbi extends Abi | readonly unknown[], TEventName extends string>(client: PublicClient, { abi, address, args, batch, eventName, onError, onLogs, pollingInterval, }: WatchContractEventParameters<TAbi, TEventName>): () => void;
|
609
548
|
|
610
549
|
type OnLogsParameter<TAbiEvent extends AbiEvent | undefined = undefined, TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = Log<bigint, number, TAbiEvent, [TAbiEvent], TEventName>[];
|
611
550
|
type OnLogsFn<TAbiEvent extends AbiEvent | undefined = undefined, TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = (logs: OnLogsParameter<TAbiEvent, TEventName>) => void;
|
@@ -627,7 +566,7 @@ type WatchEventParameters<TAbiEvent extends AbiEvent | undefined = undefined, TE
|
|
627
566
|
event?: never;
|
628
567
|
args?: never;
|
629
568
|
});
|
630
|
-
declare function watchEvent<TAbiEvent extends AbiEvent | undefined, TEventName extends string | undefined>(client:
|
569
|
+
declare function watchEvent<TAbiEvent extends AbiEvent | undefined, TEventName extends string | undefined>(client: PublicClient, { address, args, batch, event, onError, onLogs, pollingInterval, }: WatchEventParameters<TAbiEvent>): () => void;
|
631
570
|
|
632
571
|
type OnTransactionsParameter = Hash[];
|
633
572
|
type OnTransactionsFn = (transactions: OnTransactionsParameter) => void;
|
@@ -641,7 +580,119 @@ type WatchPendingTransactionsParameters = {
|
|
641
580
|
/** Polling frequency (in ms). Defaults to Client's pollingInterval config. */
|
642
581
|
pollingInterval?: number;
|
643
582
|
};
|
644
|
-
declare function watchPendingTransactions(client:
|
583
|
+
declare function watchPendingTransactions(client: PublicClient, { batch, onError, onTransactions, pollingInterval, }: WatchPendingTransactionsParameters): () => void;
|
584
|
+
|
585
|
+
type GetPermissionsReturnType = WalletPermission[];
|
586
|
+
declare function getPermissions(client: WalletClient): Promise<WalletPermission[]>;
|
587
|
+
|
588
|
+
type RequestAddressesReturnType = Address[];
|
589
|
+
declare function requestAddresses(client: WalletClient): Promise<RequestAddressesReturnType>;
|
590
|
+
|
591
|
+
type RequestPermissionsParameters = {
|
592
|
+
eth_accounts: Record<string, any>;
|
593
|
+
} & {
|
594
|
+
[key: string]: Record<string, any>;
|
595
|
+
};
|
596
|
+
type RequestPermissionsReturnType = WalletPermission[];
|
597
|
+
declare function requestPermissions(client: WalletClient, permissions: RequestPermissionsParameters): Promise<WalletPermission[]>;
|
598
|
+
|
599
|
+
type FormattedTransactionRequest<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Omit<Formatted<TFormatter, TransactionRequest, true>, 'from'>, TransactionRequest>;
|
600
|
+
type SendTransactionParameters<TChain extends Chain = Chain> = FormattedTransactionRequest<TransactionRequestFormatter<TChain>> & {
|
601
|
+
account: Account;
|
602
|
+
} & ({
|
603
|
+
assertChain?: false;
|
604
|
+
chain?: TChain;
|
605
|
+
} | {
|
606
|
+
assertChain: true;
|
607
|
+
chain: TChain;
|
608
|
+
});
|
609
|
+
type SendTransactionReturnType = Hash;
|
610
|
+
declare function sendTransaction<TChain extends Chain>(client: WalletClient<any, any>, args: SendTransactionParameters<TChain>): Promise<SendTransactionReturnType>;
|
611
|
+
|
612
|
+
type SignMessageParameters = {
|
613
|
+
account: Account;
|
614
|
+
} & ({
|
615
|
+
/** @deprecated – `data` will be removed in 0.2.0; use `message` instead. */
|
616
|
+
data: string;
|
617
|
+
message?: never;
|
618
|
+
} | {
|
619
|
+
data?: never;
|
620
|
+
message: string;
|
621
|
+
});
|
622
|
+
type SignMessageReturnType = Hex;
|
623
|
+
declare function signMessage(client: WalletClient, { account, data, message }: SignMessageParameters): Promise<SignMessageReturnType>;
|
624
|
+
|
625
|
+
type SignTypedDataParameters<TTypedData extends TypedData | {
|
626
|
+
[key: string]: unknown;
|
627
|
+
} = TypedData, TPrimaryType extends string = string> = {
|
628
|
+
account: Account;
|
629
|
+
} & TypedDataDefinition<TTypedData, TPrimaryType>;
|
630
|
+
type TypedDataDefinition<TTypedData extends TypedData | {
|
631
|
+
[key: string]: unknown;
|
632
|
+
} = TypedData, TPrimaryType extends string = string> = {
|
633
|
+
domain?: TypedDataDomain;
|
634
|
+
types: Narrow<TTypedData>;
|
635
|
+
primaryType: GetPrimaryType<TTypedData, TPrimaryType>;
|
636
|
+
} & GetMessage<TTypedData, TPrimaryType>;
|
637
|
+
type GetPrimaryType<TTypedData extends TypedData | {
|
638
|
+
[key: string]: unknown;
|
639
|
+
} = TypedData, TPrimaryType extends string = string> = TTypedData extends TypedData ? keyof TTypedData extends infer AbiFunctionNames ? AbiFunctionNames | (TPrimaryType extends AbiFunctionNames ? TPrimaryType : never) | (TypedData extends TTypedData ? string : never) : never : TPrimaryType;
|
640
|
+
type GetMessage<TTypedData extends TypedData | {
|
641
|
+
[key: string]: unknown;
|
642
|
+
} = TypedData, TPrimaryType extends string = string, TSchema = TTypedData extends TypedData ? TypedDataToPrimitiveTypes<TTypedData> : {
|
643
|
+
[key: string]: any;
|
644
|
+
}, TMessage = TSchema[TPrimaryType extends keyof TSchema ? TPrimaryType : keyof TSchema]> = {
|
645
|
+
[key: string]: any;
|
646
|
+
} extends TMessage ? {
|
647
|
+
/**
|
648
|
+
* Data to sign
|
649
|
+
*
|
650
|
+
* Use a [const assertion](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions) on {@link types} for type inference.
|
651
|
+
*/
|
652
|
+
message: {
|
653
|
+
[key: string]: unknown;
|
654
|
+
};
|
655
|
+
} : {
|
656
|
+
/** Data to sign */
|
657
|
+
message: TMessage;
|
658
|
+
};
|
659
|
+
type SignTypedDataReturnType = Hex;
|
660
|
+
declare function signTypedData<TTypedData extends TypedData | {
|
661
|
+
[key: string]: unknown;
|
662
|
+
}, TPrimaryType extends string = string>(client: WalletClient, { account, domain, message, primaryType, types: types_, }: SignTypedDataParameters<TTypedData, TPrimaryType>): Promise<SignTypedDataReturnType>;
|
663
|
+
|
664
|
+
type SwitchChainParameters = {
|
665
|
+
id: Chain['id'];
|
666
|
+
};
|
667
|
+
declare function switchChain(client: WalletClient, { id }: SwitchChainParameters): Promise<void>;
|
668
|
+
|
669
|
+
type WatchAssetParameters = WatchAssetParams;
|
670
|
+
type WatchAssetReturnType = boolean;
|
671
|
+
declare function watchAsset(client: WalletClient, params: WatchAssetParameters): Promise<WatchAssetReturnType>;
|
672
|
+
|
673
|
+
type WriteContractParameters<TChain extends Chain = Chain, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = Omit<SendTransactionParameters<TChain>, 'to' | 'data' | 'value'> & {
|
674
|
+
value?: GetValue<TAbi, TFunctionName, SendTransactionParameters<TChain>['value']>;
|
675
|
+
} & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'>;
|
676
|
+
type WriteContractReturnType = SendTransactionReturnType;
|
677
|
+
declare function writeContract<TChain extends Chain, TAbi extends Abi | readonly unknown[], TFunctionName extends string>(client: WalletClient, { abi, address, args, functionName, ...request }: WriteContractParameters<TChain, TAbi, TFunctionName>): Promise<WriteContractReturnType>;
|
678
|
+
|
679
|
+
type Account = JsonRpcAccount | LocalAccount;
|
680
|
+
type JsonRpcAccount = {
|
681
|
+
address: Address;
|
682
|
+
type: 'json-rpc';
|
683
|
+
};
|
684
|
+
type LocalAccount = {
|
685
|
+
address: Address;
|
686
|
+
signMessage: (message: string) => Promise<Hash>;
|
687
|
+
signTransaction: (transaction: Omit<TransactionRequest, 'from'> & {
|
688
|
+
chainId: number;
|
689
|
+
from: Address;
|
690
|
+
}) => Promise<Hash>;
|
691
|
+
signTypedData: <TTypedData extends TypedData | {
|
692
|
+
[key: string]: unknown;
|
693
|
+
}, TPrimaryType extends string = string>(typedData: TypedDataDefinition<TTypedData, TPrimaryType>) => Promise<Hash>;
|
694
|
+
type: 'local';
|
695
|
+
};
|
645
696
|
|
646
697
|
type FilterType = 'transaction' | 'block' | 'event';
|
647
698
|
type Filter<TFilterType extends FilterType = 'event', TAbi extends Abi | readonly unknown[] = Abi, TEventName extends string | undefined = undefined, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined = MaybeExtractEventArgsFromAbi<TAbi, TEventName>> = {
|
@@ -686,7 +737,7 @@ type GetEnsAddressReturnType = Address;
|
|
686
737
|
* })
|
687
738
|
* // '0xd2135CfB216b74109775236E36d4b433F1DF507B'
|
688
739
|
*/
|
689
|
-
declare function getEnsAddress(client:
|
740
|
+
declare function getEnsAddress(client: PublicClient, { blockNumber, blockTag, name, universalResolverAddress: universalResolverAddress_, }: GetEnsAddressParameters): Promise<GetEnsAddressReturnType>;
|
690
741
|
|
691
742
|
type GetEnsNameParameters = Prettify<Pick<ReadContractParameters, 'blockNumber' | 'blockTag'> & {
|
692
743
|
/** Address to get ENS name for. */
|
@@ -706,15 +757,15 @@ type GetEnsNameReturnType = string | null;
|
|
706
757
|
* })
|
707
758
|
* // 'wagmi-dev.eth'
|
708
759
|
*/
|
709
|
-
declare function getEnsName(client:
|
760
|
+
declare function getEnsName(client: PublicClient, { address, blockNumber, blockTag, universalResolverAddress: universalResolverAddress_, }: GetEnsNameParameters): Promise<GetEnsNameReturnType>;
|
710
761
|
|
711
|
-
type PublicActions<TChain extends Chain
|
762
|
+
type PublicActions<TChain extends Chain = Chain> = {
|
712
763
|
call: (args: CallParameters<TChain>) => Promise<CallReturnType>;
|
713
764
|
createBlockFilter: () => Promise<CreateBlockFilterReturnType>;
|
714
765
|
createContractEventFilter: <TAbi extends Abi | readonly unknown[], TEventName extends string | undefined, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined>(args: CreateContractEventFilterParameters<TAbi, TEventName, TArgs>) => Promise<CreateContractEventFilterReturnType<TAbi, TEventName, TArgs>>;
|
715
766
|
createEventFilter: <TAbiEvent extends AbiEvent | undefined, TAbi extends Abi | readonly unknown[], TEventName extends string | undefined, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined>(args?: CreateEventFilterParameters<TAbiEvent, TAbi, TEventName, TArgs>) => Promise<CreateEventFilterReturnType<TAbiEvent, TAbi, TEventName, TArgs>>;
|
716
767
|
createPendingTransactionFilter: () => Promise<CreatePendingTransactionFilterReturnType>;
|
717
|
-
estimateContractGas: <TChain extends Chain
|
768
|
+
estimateContractGas: <TChain extends Chain, TAbi extends Abi | readonly unknown[], TFunctionName extends string>(args: EstimateContractGasParameters<TChain, TAbi, TFunctionName>) => Promise<EstimateContractGasReturnType>;
|
718
769
|
estimateGas: (args: EstimateGasParameters<TChain>) => Promise<EstimateGasReturnType>;
|
719
770
|
getBalance: (args: GetBalanceParameters) => Promise<GetBalanceReturnType>;
|
720
771
|
getBlock: (args?: GetBlockParameters) => Promise<GetBlockReturnType<TChain>>;
|
@@ -736,7 +787,7 @@ type PublicActions<TChain extends Chain | undefined = Chain> = {
|
|
736
787
|
getTransactionReceipt: (args: GetTransactionReceiptParameters) => Promise<GetTransactionReceiptReturnType<TChain>>;
|
737
788
|
multicall: <TContracts extends ContractConfig[], TAllowFailure extends boolean = true>(args: MulticallParameters<TContracts, TAllowFailure>) => Promise<MulticallReturnType<TContracts, TAllowFailure>>;
|
738
789
|
readContract: <TAbi extends Abi | readonly unknown[], TFunctionName extends string>(args: ReadContractParameters<TAbi, TFunctionName>) => Promise<ReadContractReturnType<TAbi, TFunctionName>>;
|
739
|
-
simulateContract: <TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any, TChainOverride extends Chain | undefined = undefined>(args: SimulateContractParameters<TChain, TAbi, TFunctionName, TChainOverride>) => Promise<SimulateContractReturnType<TChain, TAbi, TFunctionName
|
790
|
+
simulateContract: <TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any, TChainOverride extends Chain | undefined = undefined>(args: SimulateContractParameters<TChain, TAbi, TFunctionName, TChainOverride>) => Promise<SimulateContractReturnType<TChainOverride extends Chain ? TChainOverride : TChain, TAbi, TFunctionName>>;
|
740
791
|
uninstallFilter: (args: UninstallFilterParameters) => Promise<UninstallFilterReturnType>;
|
741
792
|
waitForTransactionReceipt: (args: WaitForTransactionReceiptParameters<TChain>) => Promise<WaitForTransactionReceiptReturnType<TChain>>;
|
742
793
|
watchBlockNumber: (args: WatchBlockNumberParameters) => ReturnType<typeof watchBlockNumber>;
|
@@ -746,9 +797,8 @@ type PublicActions<TChain extends Chain | undefined = Chain> = {
|
|
746
797
|
watchPendingTransactions: (args: WatchPendingTransactionsParameters) => ReturnType<typeof watchPendingTransactions>;
|
747
798
|
};
|
748
799
|
|
749
|
-
type WalletClientConfig<TTransport extends Transport = Transport, TChain extends Chain
|
750
|
-
|
751
|
-
chain?: TChain;
|
800
|
+
type WalletClientConfig<TTransport extends Transport = Transport, TChain extends Chain = Chain> = {
|
801
|
+
chain?: ClientConfig<TTransport, TChain>['chain'];
|
752
802
|
/** The key of the Wallet Client. */
|
753
803
|
key?: ClientConfig['key'];
|
754
804
|
/** The name of the Wallet Client. */
|
@@ -757,39 +807,35 @@ type WalletClientConfig<TTransport extends Transport = Transport, TChain extends
|
|
757
807
|
pollingInterval?: ClientConfig['pollingInterval'];
|
758
808
|
transport: ClientConfig<TTransport, TChain>['transport'];
|
759
809
|
};
|
760
|
-
type WalletClient<TTransport extends Transport = Transport, TChain extends Chain
|
761
|
-
account: TAccount;
|
762
|
-
} & (TIncludeActions extends true ? WalletActions<TChain, TAccount> : {});
|
763
|
-
type WalletClientArg<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined, TIncludeActions extends boolean = boolean> = WalletClient<TTransport, TChain, TAccount, TIncludeActions>;
|
810
|
+
type WalletClient<TTransport extends Transport = Transport, TChain extends Chain = Chain, TIncludeActions extends boolean = true> = Client<TTransport, TChain> & (TIncludeActions extends true ? WalletActions<TChain> : {});
|
764
811
|
/**
|
765
812
|
* @description Creates a wallet client with a given transport.
|
766
813
|
*/
|
767
|
-
declare function createWalletClient<TTransport extends Transport, TChain extends Chain
|
814
|
+
declare function createWalletClient<TTransport extends Transport, TChain extends Chain>({ chain, transport, key, name, pollingInterval, }: WalletClientConfig<TTransport, TChain>): WalletClient<TTransport, TChain, true>;
|
768
815
|
|
769
|
-
type WalletActions<TChain extends Chain
|
816
|
+
type WalletActions<TChain extends Chain = Chain> = {
|
770
817
|
addChain: (args: AddChainParameters) => Promise<void>;
|
771
|
-
deployContract: <TAbi extends Abi | readonly unknown[]
|
818
|
+
deployContract: <TAbi extends Abi | readonly unknown[]>(args: DeployContractParameters<TChain, TAbi>) => Promise<DeployContractReturnType>;
|
772
819
|
getAddresses: () => Promise<GetAddressesReturnType>;
|
773
820
|
getChainId: () => Promise<GetChainIdReturnType>;
|
774
821
|
getPermissions: () => Promise<GetPermissionsReturnType>;
|
775
822
|
requestAddresses: () => Promise<RequestAddressesReturnType>;
|
776
823
|
requestPermissions: (args: RequestPermissionsParameters) => Promise<RequestPermissionsReturnType>;
|
777
|
-
sendTransaction: <TChainOverride extends Chain
|
778
|
-
signMessage: (args: SignMessageParameters
|
824
|
+
sendTransaction: <TChainOverride extends Chain>(args: SendTransactionParameters<TChainOverride>) => Promise<SendTransactionReturnType>;
|
825
|
+
signMessage: (args: SignMessageParameters) => Promise<SignMessageReturnType>;
|
779
826
|
signTypedData: <TTypedData extends TypedData | {
|
780
827
|
[key: string]: unknown;
|
781
|
-
}
|
828
|
+
}>(args: SignTypedDataParameters<TTypedData>) => Promise<SignTypedDataReturnType>;
|
782
829
|
switchChain: (args: SwitchChainParameters) => Promise<void>;
|
783
830
|
watchAsset: (args: WatchAssetParameters) => Promise<WatchAssetReturnType>;
|
784
|
-
writeContract: <TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain
|
831
|
+
writeContract: <TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain>(args: WriteContractParameters<TChainOverride, TAbi, TFunctionName>) => Promise<WriteContractReturnType>;
|
785
832
|
};
|
786
833
|
|
787
|
-
type PublicClientConfig<TTransport extends Transport = Transport, TChain extends Chain
|
788
|
-
type PublicClient<TTransport extends Transport = Transport, TChain extends Chain
|
789
|
-
type PublicClientArg<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TIncludeActions extends boolean = boolean> = PublicClient<TTransport, TChain, TIncludeActions>;
|
834
|
+
type PublicClientConfig<TTransport extends Transport = Transport, TChain extends Chain = Chain> = Pick<ClientConfig<TTransport, TChain>, 'chain' | 'key' | 'name' | 'pollingInterval' | 'transport'>;
|
835
|
+
type PublicClient<TTransport extends Transport = Transport, TChain extends Chain = Chain, TIncludeActions extends boolean = true> = Client<TTransport, TChain, PublicRequests> & (TIncludeActions extends true ? PublicActions<TChain> : {});
|
790
836
|
/**
|
791
837
|
* @description Creates a public client with a given transport.
|
792
838
|
*/
|
793
|
-
declare function createPublicClient<TTransport extends Transport, TChain extends Chain
|
839
|
+
declare function createPublicClient<TTransport extends Transport, TChain extends Chain>({ chain, key, name, transport, pollingInterval, }: PublicClientConfig<TTransport, TChain>): PublicClient<TTransport, TChain, true>;
|
794
840
|
|
795
|
-
export {
|
841
|
+
export { writeContract as $, Account as A, BlockFormatter as B, CallParameters as C, estimateContractGas as D, EstimateGasParameters as E, FormattedBlock as F, GetBytecodeParameters as G, getBytecode as H, getStorageAt as I, JsonRpcAccount as J, multicall as K, LocalAccount as L, MulticallParameters as M, readContract as N, OnLogsFn as O, PublicClient as P, simulateContract as Q, ReadContractParameters as R, SendTransactionParameters as S, TransactionReceiptFormatter as T, watchContractEvent as U, DeployContractParameters as V, WalletClient as W, DeployContractReturnType as X, WriteContractParameters as Y, WriteContractReturnType as Z, deployContract as _, PublicClientConfig as a, OnTransactionsFn as a$, GetEnsAddressParameters as a0, GetEnsNameParameters as a1, getEnsAddress as a2, getEnsName as a3, call as a4, createBlockFilter as a5, createEventFilter as a6, createPendingTransactionFilter as a7, estimateGas as a8, getBalance as a9, GetBalanceParameters as aA, GetBalanceReturnType as aB, GetBlockParameters as aC, GetBlockNumberParameters as aD, GetBlockNumberReturnType as aE, GetBlockReturnType as aF, GetBlockTransactionCountParameters as aG, GetBlockTransactionCountReturnType as aH, GetFeeHistoryParameters as aI, GetFeeHistoryReturnType as aJ, GetFilterChangesParameters as aK, GetFilterChangesReturnType as aL, GetFilterLogsParameters as aM, GetFilterLogsReturnType as aN, GetGasPriceReturnType as aO, GetTransactionParameters as aP, GetTransactionConfirmationsParameters as aQ, GetTransactionConfirmationsReturnType as aR, GetTransactionCountParameters as aS, GetTransactionCountReturnType as aT, GetTransactionReceiptParameters as aU, GetTransactionReceiptReturnType as aV, GetTransactionReturnType as aW, OnBlock as aX, OnBlockNumberFn as aY, OnBlockNumberParameter as aZ, OnBlockParameter as a_, getBlock as aa, getBlockNumber as ab, getBlockNumberCache as ac, getBlockTransactionCount as ad, getChainId as ae, getFeeHistory as af, getFilterChanges as ag, getFilterLogs as ah, getLogs as ai, getGasPrice as aj, getTransaction as ak, getTransactionConfirmations as al, getTransactionCount as am, getTransactionReceipt as an, uninstallFilter as ao, waitForTransactionReceipt as ap, watchBlockNumber as aq, watchBlocks as ar, watchEvent as as, watchPendingTransactions as at, CallReturnType as au, CreateBlockFilterReturnType as av, CreateEventFilterParameters as aw, CreateEventFilterReturnType as ax, CreatePendingTransactionFilterReturnType as ay, EstimateGasReturnType as az, WalletClientConfig as b, OnTransactionsParameter as b0, ReplacementReason as b1, ReplacementReturnType as b2, UninstallFilterParameters as b3, UninstallFilterReturnType as b4, WaitForTransactionReceiptParameters as b5, WaitForTransactionReceiptReturnType as b6, WatchBlockNumberParameters as b7, WatchBlocksParameters as b8, WatchPendingTransactionsParameters as b9, addChain as ba, getAddresses as bb, getPermissions as bc, requestAddresses as bd, requestPermissions as be, sendTransaction as bf, signMessage as bg, signTypedData as bh, switchChain as bi, watchAsset as bj, AddChainParameters as bk, FormattedTransactionRequest as bl, GetPermissionsReturnType as bm, GetAddressesReturnType as bn, RequestAddressesReturnType as bo, RequestPermissionsReturnType as bp, SendTransactionReturnType as bq, SignMessageParameters as br, SignMessageReturnType as bs, SignTypedDataParameters as bt, SignTypedDataReturnType as bu, SwitchChainParameters as bv, WatchAssetParameters as bw, WatchAssetReturnType as bx, createPublicClient as c, createWalletClient as d, FormattedTransactionReceipt as e, FormattedTransactionRequest$1 as f, TransactionRequestFormatter as g, defineBlock as h, defineTransactionReceipt as i, defineTransactionRequest as j, formatBlock as k, formatTransactionRequest as l, CreateContractEventFilterParameters as m, CreateContractEventFilterReturnType as n, EstimateContractGasParameters as o, EstimateContractGasReturnType as p, GetBytecodeReturnType as q, GetStorageAtParameters as r, GetStorageAtReturnType as s, MulticallReturnType as t, OnLogsParameter as u, ReadContractReturnType as v, SimulateContractParameters as w, SimulateContractReturnType as x, WatchContractEventParameters as y, createContractEventFilter as z };
|