viem 1.16.5 → 1.17.0
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/CHANGELOG.md +20 -0
- package/_cjs/actions/ens/getEnsAddress.js +2 -1
- package/_cjs/actions/ens/getEnsAddress.js.map +1 -1
- package/_cjs/actions/ens/getEnsAvatar.js +2 -1
- package/_cjs/actions/ens/getEnsAvatar.js.map +1 -1
- package/_cjs/actions/ens/getEnsName.js +2 -1
- package/_cjs/actions/ens/getEnsName.js.map +1 -1
- package/_cjs/actions/ens/getEnsResolver.js +2 -1
- package/_cjs/actions/ens/getEnsResolver.js.map +1 -1
- package/_cjs/actions/ens/getEnsText.js +2 -1
- package/_cjs/actions/ens/getEnsText.js.map +1 -1
- package/_cjs/actions/getContract.js +8 -7
- package/_cjs/actions/getContract.js.map +1 -1
- package/_cjs/actions/public/estimateContractGas.js +2 -1
- package/_cjs/actions/public/estimateContractGas.js.map +1 -1
- package/_cjs/actions/public/estimateFeesPerGas.js +3 -2
- package/_cjs/actions/public/estimateFeesPerGas.js.map +1 -1
- package/_cjs/actions/public/estimateMaxPriorityFeePerGas.js +4 -3
- package/_cjs/actions/public/estimateMaxPriorityFeePerGas.js.map +1 -1
- package/_cjs/actions/public/getContractEvents.js +2 -1
- package/_cjs/actions/public/getContractEvents.js.map +1 -1
- package/_cjs/actions/public/getTransactionConfirmations.js +3 -2
- package/_cjs/actions/public/getTransactionConfirmations.js.map +1 -1
- package/_cjs/actions/public/multicall.js +2 -1
- package/_cjs/actions/public/multicall.js.map +1 -1
- package/_cjs/actions/public/readContract.js +2 -1
- package/_cjs/actions/public/readContract.js.map +1 -1
- package/_cjs/actions/public/simulateContract.js +2 -1
- package/_cjs/actions/public/simulateContract.js.map +1 -1
- package/_cjs/actions/public/verifyHash.js +2 -1
- package/_cjs/actions/public/verifyHash.js.map +1 -1
- package/_cjs/actions/public/waitForTransactionReceipt.js +6 -5
- package/_cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/_cjs/actions/public/watchBlockNumber.js +2 -1
- package/_cjs/actions/public/watchBlockNumber.js.map +1 -1
- package/_cjs/actions/public/watchBlocks.js +4 -3
- package/_cjs/actions/public/watchBlocks.js.map +1 -1
- package/_cjs/actions/public/watchContractEvent.js +6 -5
- package/_cjs/actions/public/watchContractEvent.js.map +1 -1
- package/_cjs/actions/public/watchEvent.js +6 -5
- package/_cjs/actions/public/watchEvent.js.map +1 -1
- package/_cjs/actions/public/watchPendingTransactions.js +4 -3
- package/_cjs/actions/public/watchPendingTransactions.js.map +1 -1
- package/_cjs/actions/wallet/getAddresses.js +2 -0
- package/_cjs/actions/wallet/getAddresses.js.map +1 -1
- package/_cjs/actions/wallet/prepareTransactionRequest.js +4 -3
- package/_cjs/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_cjs/actions/wallet/sendTransaction.js +5 -4
- package/_cjs/actions/wallet/sendTransaction.js.map +1 -1
- package/_cjs/actions/wallet/signTransaction.js +2 -1
- package/_cjs/actions/wallet/signTransaction.js.map +1 -1
- package/_cjs/actions/wallet/writeContract.js +2 -1
- package/_cjs/actions/wallet/writeContract.js.map +1 -1
- package/_cjs/chains/definitions/arbitrumGoerli.js +2 -2
- package/_cjs/chains/definitions/arbitrumGoerli.js.map +1 -1
- package/_cjs/chains/definitions/modeTestnet.js +6 -0
- package/_cjs/chains/definitions/modeTestnet.js.map +1 -1
- package/_cjs/clients/createClient.js.map +1 -1
- package/_cjs/errors/node.js +11 -11
- package/_cjs/errors/node.js.map +1 -1
- package/_cjs/errors/rpc.js +18 -18
- package/_cjs/errors/rpc.js.map +1 -1
- package/_cjs/utils/getAction.js +8 -0
- package/_cjs/utils/getAction.js.map +1 -0
- package/_esm/actions/ens/getEnsAddress.js +2 -1
- package/_esm/actions/ens/getEnsAddress.js.map +1 -1
- package/_esm/actions/ens/getEnsAvatar.js +2 -1
- package/_esm/actions/ens/getEnsAvatar.js.map +1 -1
- package/_esm/actions/ens/getEnsName.js +2 -1
- package/_esm/actions/ens/getEnsName.js.map +1 -1
- package/_esm/actions/ens/getEnsResolver.js +2 -1
- package/_esm/actions/ens/getEnsResolver.js.map +1 -1
- package/_esm/actions/ens/getEnsText.js +2 -1
- package/_esm/actions/ens/getEnsText.js.map +1 -1
- package/_esm/actions/getContract.js +8 -7
- package/_esm/actions/getContract.js.map +1 -1
- package/_esm/actions/public/estimateContractGas.js +2 -1
- package/_esm/actions/public/estimateContractGas.js.map +1 -1
- package/_esm/actions/public/estimateFeesPerGas.js +3 -2
- package/_esm/actions/public/estimateFeesPerGas.js.map +1 -1
- package/_esm/actions/public/estimateMaxPriorityFeePerGas.js +4 -3
- package/_esm/actions/public/estimateMaxPriorityFeePerGas.js.map +1 -1
- package/_esm/actions/public/getContractEvents.js +2 -1
- package/_esm/actions/public/getContractEvents.js.map +1 -1
- package/_esm/actions/public/getTransactionConfirmations.js +3 -2
- package/_esm/actions/public/getTransactionConfirmations.js.map +1 -1
- package/_esm/actions/public/multicall.js +2 -1
- package/_esm/actions/public/multicall.js.map +1 -1
- package/_esm/actions/public/readContract.js +2 -1
- package/_esm/actions/public/readContract.js.map +1 -1
- package/_esm/actions/public/simulateContract.js +2 -1
- package/_esm/actions/public/simulateContract.js.map +1 -1
- package/_esm/actions/public/verifyHash.js +2 -1
- package/_esm/actions/public/verifyHash.js.map +1 -1
- package/_esm/actions/public/waitForTransactionReceipt.js +6 -5
- package/_esm/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/_esm/actions/public/watchBlockNumber.js +2 -1
- package/_esm/actions/public/watchBlockNumber.js.map +1 -1
- package/_esm/actions/public/watchBlocks.js +4 -3
- package/_esm/actions/public/watchBlocks.js.map +1 -1
- package/_esm/actions/public/watchContractEvent.js +6 -5
- package/_esm/actions/public/watchContractEvent.js.map +1 -1
- package/_esm/actions/public/watchEvent.js +6 -5
- package/_esm/actions/public/watchEvent.js.map +1 -1
- package/_esm/actions/public/watchPendingTransactions.js +4 -3
- package/_esm/actions/public/watchPendingTransactions.js.map +1 -1
- package/_esm/actions/wallet/getAddresses.js +2 -0
- package/_esm/actions/wallet/getAddresses.js.map +1 -1
- package/_esm/actions/wallet/prepareTransactionRequest.js +4 -3
- package/_esm/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_esm/actions/wallet/sendTransaction.js +5 -4
- package/_esm/actions/wallet/sendTransaction.js.map +1 -1
- package/_esm/actions/wallet/signTransaction.js +2 -1
- package/_esm/actions/wallet/signTransaction.js.map +1 -1
- package/_esm/actions/wallet/writeContract.js +2 -1
- package/_esm/actions/wallet/writeContract.js.map +1 -1
- package/_esm/chains/definitions/arbitrumGoerli.js +2 -2
- package/_esm/chains/definitions/arbitrumGoerli.js.map +1 -1
- package/_esm/chains/definitions/modeTestnet.js +6 -0
- package/_esm/chains/definitions/modeTestnet.js.map +1 -1
- package/_esm/clients/createClient.js.map +1 -1
- package/_esm/errors/node.js +11 -22
- package/_esm/errors/node.js.map +1 -1
- package/_esm/errors/rpc.js +18 -36
- package/_esm/errors/rpc.js.map +1 -1
- package/_esm/utils/getAction.js +4 -0
- package/_esm/utils/getAction.js.map +1 -0
- package/_types/actions/ens/getEnsAddress.d.ts.map +1 -1
- package/_types/actions/ens/getEnsAvatar.d.ts.map +1 -1
- package/_types/actions/ens/getEnsName.d.ts.map +1 -1
- package/_types/actions/ens/getEnsResolver.d.ts.map +1 -1
- package/_types/actions/ens/getEnsText.d.ts.map +1 -1
- package/_types/actions/getContract.d.ts.map +1 -1
- package/_types/actions/public/estimateContractGas.d.ts.map +1 -1
- package/_types/actions/public/estimateFeesPerGas.d.ts.map +1 -1
- package/_types/actions/public/estimateMaxPriorityFeePerGas.d.ts.map +1 -1
- package/_types/actions/public/getContractEvents.d.ts.map +1 -1
- package/_types/actions/public/getTransactionConfirmations.d.ts.map +1 -1
- package/_types/actions/public/multicall.d.ts.map +1 -1
- package/_types/actions/public/readContract.d.ts.map +1 -1
- package/_types/actions/public/simulateContract.d.ts.map +1 -1
- package/_types/actions/public/verifyHash.d.ts.map +1 -1
- package/_types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
- package/_types/actions/public/watchBlockNumber.d.ts.map +1 -1
- package/_types/actions/public/watchBlocks.d.ts.map +1 -1
- package/_types/actions/public/watchContractEvent.d.ts.map +1 -1
- package/_types/actions/public/watchEvent.d.ts.map +1 -1
- package/_types/actions/public/watchPendingTransactions.d.ts.map +1 -1
- package/_types/actions/wallet/getAddresses.d.ts.map +1 -1
- package/_types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -1
- package/_types/actions/wallet/sendTransaction.d.ts.map +1 -1
- package/_types/actions/wallet/signTransaction.d.ts.map +1 -1
- package/_types/actions/wallet/writeContract.d.ts.map +1 -1
- package/_types/chains/definitions/arbitrumGoerli.d.ts +2 -2
- package/_types/chains/definitions/modeTestnet.d.ts +6 -0
- package/_types/chains/definitions/modeTestnet.d.ts.map +1 -1
- package/_types/clients/createClient.d.ts +6 -2
- package/_types/clients/createClient.d.ts.map +1 -1
- package/_types/utils/getAction.d.ts +3 -0
- package/_types/utils/getAction.d.ts.map +1 -0
- package/actions/ens/getEnsAddress.ts +5 -1
- package/actions/ens/getEnsAvatar.ts +5 -1
- package/actions/ens/getEnsName.ts +5 -1
- package/actions/ens/getEnsResolver.ts +5 -1
- package/actions/ens/getEnsText.ts +5 -1
- package/actions/getContract.ts +29 -7
- package/actions/public/estimateContractGas.ts +5 -1
- package/actions/public/estimateFeesPerGas.ts +4 -2
- package/actions/public/estimateMaxPriorityFeePerGas.ts +4 -3
- package/actions/public/getContractEvents.ts +5 -1
- package/actions/public/getTransactionConfirmations.ts +3 -2
- package/actions/public/multicall.ts +5 -1
- package/actions/public/readContract.ts +5 -1
- package/actions/public/simulateContract.ts +5 -1
- package/actions/public/verifyHash.ts +5 -1
- package/actions/public/waitForTransactionReceipt.ts +19 -6
- package/actions/public/watchBlockNumber.ts +5 -1
- package/actions/public/watchBlocks.ts +10 -3
- package/actions/public/watchContractEvent.ts +12 -5
- package/actions/public/watchEvent.ts +12 -5
- package/actions/public/watchPendingTransactions.ts +7 -3
- package/actions/wallet/getAddresses.ts +1 -0
- package/actions/wallet/prepareTransactionRequest.ts +10 -3
- package/actions/wallet/sendTransaction.ts +11 -4
- package/actions/wallet/signTransaction.ts +2 -1
- package/actions/wallet/writeContract.ts +5 -1
- package/chains/definitions/arbitrumGoerli.ts +2 -2
- package/chains/definitions/modeTestnet.ts +6 -0
- package/clients/createClient.ts +39 -2
- package/package.json +1 -1
- package/utils/getAction.ts +13 -0
@@ -26,11 +26,11 @@ export declare const arbitrumGoerli: import("../../types/utils.js").Assign<{
|
|
26
26
|
readonly blockExplorers: {
|
27
27
|
readonly etherscan: {
|
28
28
|
readonly name: "Arbiscan";
|
29
|
-
readonly url: "https://goerli.arbiscan.io
|
29
|
+
readonly url: "https://goerli.arbiscan.io";
|
30
30
|
};
|
31
31
|
readonly default: {
|
32
32
|
readonly name: "Arbiscan";
|
33
|
-
readonly url: "https://goerli.arbiscan.io
|
33
|
+
readonly url: "https://goerli.arbiscan.io";
|
34
34
|
};
|
35
35
|
};
|
36
36
|
readonly contracts: {
|
@@ -21,6 +21,12 @@ export declare const modeTestnet: import("../../types/utils.js").Assign<{
|
|
21
21
|
readonly url: "https://sepolia.explorer.mode.network";
|
22
22
|
};
|
23
23
|
};
|
24
|
+
readonly contracts: {
|
25
|
+
readonly multicall3: {
|
26
|
+
readonly address: "0xBAba8373113Fb7a68f195deF18732e01aF8eDfCF";
|
27
|
+
readonly blockCreated: 3019007;
|
28
|
+
};
|
29
|
+
};
|
24
30
|
readonly testnet: true;
|
25
31
|
}, import("../../types/chain.js").ChainConfig<import("../../index.js").ChainFormatters>>;
|
26
32
|
//# sourceMappingURL=modeTestnet.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"modeTestnet.d.ts","sourceRoot":"","sources":["../../../chains/definitions/modeTestnet.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW
|
1
|
+
{"version":3,"file":"modeTestnet.d.ts","sourceRoot":"","sources":["../../../chains/definitions/modeTestnet.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wFA0BtB,CAAA"}
|
@@ -1,10 +1,13 @@
|
|
1
1
|
import type { Address } from 'abitype';
|
2
|
-
import type {
|
2
|
+
import type { JsonRpcAccount } from '../accounts/types.js';
|
3
3
|
import type { ParseAccountErrorType } from '../accounts/utils/parseAccount.js';
|
4
4
|
import type { ErrorType } from '../errors/utils.js';
|
5
|
+
import type { Account } from '../types/account.js';
|
5
6
|
import type { Chain } from '../types/chain.js';
|
6
7
|
import type { EIP1193RequestFn, EIP1474Methods, RpcSchema } from '../types/eip1193.js';
|
7
8
|
import type { Prettify } from '../types/utils.js';
|
9
|
+
import type { PublicActions } from './decorators/public.js';
|
10
|
+
import type { WalletActions } from './decorators/wallet.js';
|
8
11
|
import type { Transport } from './transports/createTransport.js';
|
9
12
|
export type ClientConfig<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, accountOrAddress extends Account | Address | undefined = Account | Address | undefined> = {
|
10
13
|
/** The Account to use for the Client. This will be used for Actions that require an account as an argument. */
|
@@ -35,8 +38,9 @@ export type ClientConfig<transport extends Transport = Transport, chain extends
|
|
35
38
|
/** The type of client. */
|
36
39
|
type?: string | undefined;
|
37
40
|
};
|
41
|
+
type ExtendableProtectedActions = Pick<PublicActions, 'call' | 'createContractEventFilter' | 'createEventFilter' | 'estimateContractGas' | 'estimateGas' | 'getBlock' | 'getBlockNumber' | 'getChainId' | 'getContractEvents' | 'getEnsText' | 'getFilterChanges' | 'getGasPrice' | 'getLogs' | 'getTransaction' | 'getTransactionCount' | 'getTransactionReceipt' | 'prepareTransactionRequest' | 'readContract' | 'sendRawTransaction' | 'simulateContract' | 'uninstallFilter' | 'watchBlockNumber' | 'watchContractEvent'> & Pick<WalletActions, 'sendTransaction' | 'writeContract'>;
|
38
42
|
export type Client<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined, rpcSchema extends RpcSchema | undefined = undefined, extended extends Extended | undefined = Extended | undefined> = Client_Base<transport, chain, account, rpcSchema> & (extended extends Extended ? extended : unknown) & {
|
39
|
-
extend: <const client extends Extended
|
43
|
+
extend: <const client extends Extended & Partial<ExtendableProtectedActions>>(fn: (client: Client<transport, chain, account, rpcSchema, extended>) => client) => Client<transport, chain, account, rpcSchema, Prettify<client> & (extended extends Extended ? extended : unknown)>;
|
40
44
|
};
|
41
45
|
type Client_Base<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined, rpcSchema extends RpcSchema | undefined = undefined> = {
|
42
46
|
/** The Account of the Client. */
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createClient.d.ts","sourceRoot":"","sources":["../../clients/createClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"createClient.d.ts","sourceRoot":"","sources":["../../clients/createClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAA;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,SAAS,EACV,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAGjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAA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OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,EAElE,UAAU,EAAE,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,gBAAgB,CAAC,GAC3D,QAAQ,CACT,MAAM,CACJ,SAAS,EACT,KAAK,EACL,gBAAgB,SAAS,OAAO,GAC5B,QAAQ,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,GAC1C,gBAAgB,CACrB,CACF,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getAction.d.ts","sourceRoot":"","sources":["../../utils/getAction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAExD,wBAAgB,SAAS,CAAC,MAAM,SAAS,EAAE,EAAE,UAAU,SAAS,EAAE,EAChE,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,KAAK,UAAU,uBAErB,UAAU,CAMpC"}
|
@@ -29,6 +29,7 @@ import {
|
|
29
29
|
type PacketToBytesErrorType,
|
30
30
|
packetToBytes,
|
31
31
|
} from '../../utils/ens/packetToBytes.js'
|
32
|
+
import { getAction } from '../../utils/getAction.js'
|
32
33
|
import {
|
33
34
|
type ReadContractParameters,
|
34
35
|
readContract,
|
@@ -118,7 +119,10 @@ export async function getEnsAddress<TChain extends Chain | undefined,>(
|
|
118
119
|
: { args: [namehash(name)] }),
|
119
120
|
})
|
120
121
|
|
121
|
-
const res = await
|
122
|
+
const res = await getAction(
|
123
|
+
client,
|
124
|
+
readContract,
|
125
|
+
)({
|
122
126
|
address: universalResolverAddress,
|
123
127
|
abi: universalResolverResolveAbi,
|
124
128
|
functionName: 'resolve',
|
@@ -8,6 +8,7 @@ import {
|
|
8
8
|
type ParseAvatarRecordErrorType,
|
9
9
|
parseAvatarRecord,
|
10
10
|
} from '../../utils/ens/avatar/parseAvatarRecord.js'
|
11
|
+
import { getAction } from '../../utils/getAction.js'
|
11
12
|
|
12
13
|
import {
|
13
14
|
type GetEnsTextErrorType,
|
@@ -67,7 +68,10 @@ export async function getEnsAvatar<TChain extends Chain | undefined>(
|
|
67
68
|
universalResolverAddress,
|
68
69
|
}: GetEnsAvatarParameters,
|
69
70
|
): Promise<GetEnsAvatarReturnType> {
|
70
|
-
const record = await
|
71
|
+
const record = await getAction(
|
72
|
+
client,
|
73
|
+
getEnsText,
|
74
|
+
)({
|
71
75
|
blockNumber,
|
72
76
|
blockTag,
|
73
77
|
key: 'avatar',
|
@@ -16,6 +16,7 @@ import {
|
|
16
16
|
type PacketToBytesErrorType,
|
17
17
|
packetToBytes,
|
18
18
|
} from '../../utils/ens/packetToBytes.js'
|
19
|
+
import { getAction } from '../../utils/getAction.js'
|
19
20
|
import {
|
20
21
|
type ReadContractErrorType,
|
21
22
|
type ReadContractParameters,
|
@@ -91,7 +92,10 @@ export async function getEnsName<TChain extends Chain | undefined>(
|
|
91
92
|
|
92
93
|
const reverseNode = `${address.toLowerCase().substring(2)}.addr.reverse`
|
93
94
|
try {
|
94
|
-
const res = await
|
95
|
+
const res = await getAction(
|
96
|
+
client,
|
97
|
+
readContract,
|
98
|
+
)({
|
95
99
|
address: universalResolverAddress,
|
96
100
|
abi: universalResolverReverseAbi,
|
97
101
|
functionName: 'reverse',
|
@@ -14,6 +14,7 @@ import {
|
|
14
14
|
type PacketToBytesErrorType,
|
15
15
|
packetToBytes,
|
16
16
|
} from '../../utils/ens/packetToBytes.js'
|
17
|
+
import { getAction } from '../../utils/getAction.js'
|
17
18
|
import {
|
18
19
|
type ReadContractParameters,
|
19
20
|
readContract,
|
@@ -87,7 +88,10 @@ export async function getEnsResolver<TChain extends Chain | undefined>(
|
|
87
88
|
})
|
88
89
|
}
|
89
90
|
|
90
|
-
const [resolverAddress] = await
|
91
|
+
const [resolverAddress] = await getAction(
|
92
|
+
client,
|
93
|
+
readContract,
|
94
|
+
)({
|
91
95
|
address: universalResolverAddress,
|
92
96
|
abi: [
|
93
97
|
{
|
@@ -27,6 +27,7 @@ import {
|
|
27
27
|
type PacketToBytesErrorType,
|
28
28
|
packetToBytes,
|
29
29
|
} from '../../utils/ens/packetToBytes.js'
|
30
|
+
import { getAction } from '../../utils/getAction.js'
|
30
31
|
import {
|
31
32
|
type ReadContractErrorType,
|
32
33
|
type ReadContractParameters,
|
@@ -109,7 +110,10 @@ export async function getEnsText<TChain extends Chain | undefined>(
|
|
109
110
|
}
|
110
111
|
|
111
112
|
try {
|
112
|
-
const res = await
|
113
|
+
const res = await getAction(
|
114
|
+
client,
|
115
|
+
readContract,
|
116
|
+
)({
|
113
117
|
address: universalResolverAddress,
|
114
118
|
abi: universalResolverResolveAbi,
|
115
119
|
functionName: 'resolve',
|
package/actions/getContract.ts
CHANGED
@@ -28,6 +28,7 @@ import type {
|
|
28
28
|
} from '../types/utils.js'
|
29
29
|
|
30
30
|
import type { ErrorType } from '../errors/utils.js'
|
31
|
+
import { getAction } from '../utils/getAction.js'
|
31
32
|
import {
|
32
33
|
type CreateContractEventFilterParameters,
|
33
34
|
type CreateContractEventFilterReturnType,
|
@@ -485,7 +486,10 @@ export function getContract<
|
|
485
486
|
]
|
486
487
|
) => {
|
487
488
|
const { args, options } = getFunctionParameters(parameters)
|
488
|
-
return
|
489
|
+
return getAction(
|
490
|
+
publicClient,
|
491
|
+
readContract,
|
492
|
+
)({
|
489
493
|
abi,
|
490
494
|
address,
|
491
495
|
functionName,
|
@@ -512,7 +516,10 @@ export function getContract<
|
|
512
516
|
]
|
513
517
|
) => {
|
514
518
|
const { args, options } = getFunctionParameters(parameters)
|
515
|
-
return
|
519
|
+
return getAction(
|
520
|
+
publicClient,
|
521
|
+
simulateContract,
|
522
|
+
)({
|
516
523
|
abi,
|
517
524
|
address,
|
518
525
|
functionName,
|
@@ -545,7 +552,10 @@ export function getContract<
|
|
545
552
|
parameters,
|
546
553
|
abiEvent!,
|
547
554
|
)
|
548
|
-
return
|
555
|
+
return getAction(
|
556
|
+
publicClient,
|
557
|
+
createContractEventFilter,
|
558
|
+
)({
|
549
559
|
abi,
|
550
560
|
address,
|
551
561
|
eventName,
|
@@ -576,7 +586,10 @@ export function getContract<
|
|
576
586
|
parameters,
|
577
587
|
abiEvent!,
|
578
588
|
)
|
579
|
-
return
|
589
|
+
return getAction(
|
590
|
+
publicClient,
|
591
|
+
getContractEvents,
|
592
|
+
)({
|
580
593
|
abi,
|
581
594
|
address,
|
582
595
|
eventName,
|
@@ -607,7 +620,10 @@ export function getContract<
|
|
607
620
|
parameters,
|
608
621
|
abiEvent!,
|
609
622
|
)
|
610
|
-
return
|
623
|
+
return getAction(
|
624
|
+
publicClient,
|
625
|
+
watchContractEvent,
|
626
|
+
)({
|
611
627
|
abi,
|
612
628
|
address,
|
613
629
|
eventName,
|
@@ -637,7 +653,10 @@ export function getContract<
|
|
637
653
|
]
|
638
654
|
) => {
|
639
655
|
const { args, options } = getFunctionParameters(parameters)
|
640
|
-
return
|
656
|
+
return getAction(
|
657
|
+
walletClient,
|
658
|
+
writeContract,
|
659
|
+
)({
|
641
660
|
abi,
|
642
661
|
address,
|
643
662
|
functionName,
|
@@ -672,7 +691,10 @@ export function getContract<
|
|
672
691
|
) => {
|
673
692
|
const { args, options } = getFunctionParameters(parameters)
|
674
693
|
const client = (publicClient ?? walletClient)!
|
675
|
-
return
|
694
|
+
return getAction(
|
695
|
+
client,
|
696
|
+
estimateContractGas,
|
697
|
+
)({
|
676
698
|
abi,
|
677
699
|
address,
|
678
700
|
functionName,
|
@@ -20,6 +20,7 @@ import {
|
|
20
20
|
type GetContractErrorReturnType,
|
21
21
|
getContractError,
|
22
22
|
} from '../../utils/errors/getContractError.js'
|
23
|
+
import { getAction } from '../../utils/getAction.js'
|
23
24
|
import {
|
24
25
|
type EstimateGasErrorType,
|
25
26
|
type EstimateGasParameters,
|
@@ -95,7 +96,10 @@ export async function estimateContractGas<
|
|
95
96
|
functionName,
|
96
97
|
} as unknown as EncodeFunctionDataParameters<TAbi, TFunctionName>)
|
97
98
|
try {
|
98
|
-
const gas = await
|
99
|
+
const gas = await getAction(
|
100
|
+
client,
|
101
|
+
estimateGas,
|
102
|
+
)({
|
99
103
|
data,
|
100
104
|
to: address,
|
101
105
|
...request,
|
@@ -19,6 +19,7 @@ import type {
|
|
19
19
|
FeeValuesLegacy,
|
20
20
|
FeeValuesType,
|
21
21
|
} from '../../types/fee.js'
|
22
|
+
import { getAction } from '../../utils/getAction.js'
|
22
23
|
import type { PrepareTransactionRequestParameters } from '../wallet/prepareTransactionRequest.js'
|
23
24
|
import {
|
24
25
|
type EstimateMaxPriorityFeePerGasErrorType,
|
@@ -125,7 +126,7 @@ export async function internal_estimateFeesPerGas<
|
|
125
126
|
(base * BigInt(Math.ceil(baseFeeMultiplier * denominator))) /
|
126
127
|
BigInt(denominator)
|
127
128
|
|
128
|
-
const block = block_ ? block_ : await
|
129
|
+
const block = block_ ? block_ : await getAction(client, getBlock)({})
|
129
130
|
|
130
131
|
if (typeof chain?.fees?.estimateFeesPerGas === 'function')
|
131
132
|
return chain.fees.estimateFeesPerGas({
|
@@ -161,7 +162,8 @@ export async function internal_estimateFeesPerGas<
|
|
161
162
|
} as EstimateFeesPerGasReturnType<type>
|
162
163
|
}
|
163
164
|
|
164
|
-
const gasPrice =
|
165
|
+
const gasPrice =
|
166
|
+
request?.gasPrice ?? multiply(await getAction(client, getGasPrice)({}))
|
165
167
|
return {
|
166
168
|
gasPrice,
|
167
169
|
} as EstimateFeesPerGasReturnType<type>
|
@@ -14,6 +14,7 @@ import {
|
|
14
14
|
type HexToBigIntErrorType,
|
15
15
|
hexToBigInt,
|
16
16
|
} from '../../utils/encoding/fromHex.js'
|
17
|
+
import { getAction } from '../../utils/getAction.js'
|
17
18
|
import type { PrepareTransactionRequestParameters } from '../wallet/prepareTransactionRequest.js'
|
18
19
|
import { type GetBlockErrorType, getBlock } from './getBlock.js'
|
19
20
|
import { type GetGasPriceErrorType, getGasPrice } from './getGasPrice.js'
|
@@ -82,7 +83,7 @@ export async function internal_estimateMaxPriorityFeePerGas<
|
|
82
83
|
): Promise<EstimateMaxPriorityFeePerGasReturnType> {
|
83
84
|
const { block: block_, chain = client.chain, request } = args || {}
|
84
85
|
if (typeof chain?.fees?.defaultPriorityFee === 'function') {
|
85
|
-
const block = block_ || (await
|
86
|
+
const block = block_ || (await getAction(client, getBlock)({}))
|
86
87
|
return chain.fees.defaultPriorityFee({
|
87
88
|
block,
|
88
89
|
client,
|
@@ -101,8 +102,8 @@ export async function internal_estimateMaxPriorityFeePerGas<
|
|
101
102
|
// fall back to calculating it manually via `gasPrice - baseFeePerGas`.
|
102
103
|
// See: https://github.com/ethereum/pm/issues/328#:~:text=eth_maxPriorityFeePerGas%20after%20London%20will%20effectively%20return%20eth_gasPrice%20%2D%20baseFee
|
103
104
|
const [block, gasPrice] = await Promise.all([
|
104
|
-
block_ ? Promise.resolve(block_) :
|
105
|
-
|
105
|
+
block_ ? Promise.resolve(block_) : getAction(client, getBlock)({}),
|
106
|
+
getAction(client, getGasPrice)({}),
|
106
107
|
])
|
107
108
|
|
108
109
|
if (typeof block.baseFeePerGas !== 'bigint')
|
@@ -13,6 +13,7 @@ import {
|
|
13
13
|
type GetAbiItemParameters,
|
14
14
|
getAbiItem,
|
15
15
|
} from '../../utils/abi/getAbiItem.js'
|
16
|
+
import { getAction } from '../../utils/getAction.js'
|
16
17
|
import {
|
17
18
|
type GetLogsErrorType,
|
18
19
|
type GetLogsParameters,
|
@@ -130,7 +131,10 @@ export async function getContractEvents<
|
|
130
131
|
const events = !event
|
131
132
|
? (abi as Abi).filter((x) => x.type === 'event')
|
132
133
|
: undefined
|
133
|
-
return
|
134
|
+
return getAction(
|
135
|
+
client,
|
136
|
+
getLogs,
|
137
|
+
)({
|
134
138
|
address,
|
135
139
|
args,
|
136
140
|
blockHash,
|
@@ -4,6 +4,7 @@ import type { ErrorType } from '../../errors/utils.js'
|
|
4
4
|
import type { Chain } from '../../types/chain.js'
|
5
5
|
import type { Hash } from '../../types/misc.js'
|
6
6
|
import type { FormattedTransactionReceipt } from '../../utils/formatters/transactionReceipt.js'
|
7
|
+
import { getAction } from '../../utils/getAction.js'
|
7
8
|
|
8
9
|
import {
|
9
10
|
type GetBlockNumberErrorType,
|
@@ -66,8 +67,8 @@ export async function getTransactionConfirmations<
|
|
66
67
|
{ hash, transactionReceipt }: GetTransactionConfirmationsParameters<TChain>,
|
67
68
|
): Promise<GetTransactionConfirmationsReturnType> {
|
68
69
|
const [blockNumber, transaction] = await Promise.all([
|
69
|
-
|
70
|
-
hash ?
|
70
|
+
getAction(client, getBlockNumber)({}),
|
71
|
+
hash ? getAction(client, getTransaction)({ hash }) : undefined,
|
71
72
|
])
|
72
73
|
const transactionBlockNumber =
|
73
74
|
transactionReceipt?.blockNumber || transaction?.blockNumber
|
@@ -32,6 +32,7 @@ import {
|
|
32
32
|
} from '../../utils/errors/getContractError.js'
|
33
33
|
|
34
34
|
import type { ErrorType } from '../../errors/utils.js'
|
35
|
+
import { getAction } from '../../utils/getAction.js'
|
35
36
|
import type { CallParameters } from './call.js'
|
36
37
|
import { type ReadContractErrorType, readContract } from './readContract.js'
|
37
38
|
|
@@ -200,7 +201,10 @@ export async function multicall<
|
|
200
201
|
|
201
202
|
const aggregate3Results = await Promise.allSettled(
|
202
203
|
chunkedCalls.map((calls) =>
|
203
|
-
|
204
|
+
getAction(
|
205
|
+
client,
|
206
|
+
readContract,
|
207
|
+
)({
|
204
208
|
abi: multicall3Abi,
|
205
209
|
address: multicallAddress!,
|
206
210
|
args: [calls],
|
@@ -22,6 +22,7 @@ import {
|
|
22
22
|
type GetContractErrorReturnType,
|
23
23
|
getContractError,
|
24
24
|
} from '../../utils/errors/getContractError.js'
|
25
|
+
import { getAction } from '../../utils/getAction.js'
|
25
26
|
|
26
27
|
import { type CallErrorType, type CallParameters, call } from './call.js'
|
27
28
|
|
@@ -91,7 +92,10 @@ export async function readContract<
|
|
91
92
|
functionName,
|
92
93
|
} as unknown as EncodeFunctionDataParameters<TAbi, TFunctionName>)
|
93
94
|
try {
|
94
|
-
const { data } = await
|
95
|
+
const { data } = await getAction(
|
96
|
+
client,
|
97
|
+
call,
|
98
|
+
)({
|
95
99
|
data: calldata,
|
96
100
|
to: address,
|
97
101
|
...callRequest,
|
@@ -32,6 +32,7 @@ import {
|
|
32
32
|
import type { WriteContractParameters } from '../wallet/writeContract.js'
|
33
33
|
|
34
34
|
import type { ErrorType } from '../../errors/utils.js'
|
35
|
+
import { getAction } from '../../utils/getAction.js'
|
35
36
|
import { type CallErrorType, type CallParameters, call } from './call.js'
|
36
37
|
|
37
38
|
export type SimulateContractParameters<
|
@@ -142,7 +143,10 @@ export async function simulateContract<
|
|
142
143
|
functionName,
|
143
144
|
} as unknown as EncodeFunctionDataParameters<TAbi, TFunctionName>)
|
144
145
|
try {
|
145
|
-
const { data } = await
|
146
|
+
const { data } = await getAction(
|
147
|
+
client,
|
148
|
+
call,
|
149
|
+
)({
|
146
150
|
batch: false,
|
147
151
|
data: `${calldata}${dataSuffix ? dataSuffix.replace('0x', '') : ''}`,
|
148
152
|
to: address,
|
@@ -15,6 +15,7 @@ import {
|
|
15
15
|
} from '../../utils/data/isBytesEqual.js'
|
16
16
|
import type { IsHexErrorType } from '../../utils/data/isHex.js'
|
17
17
|
import type { ToHexErrorType } from '../../utils/encoding/toHex.js'
|
18
|
+
import { getAction } from '../../utils/getAction.js'
|
18
19
|
import { encodeDeployData, isHex, toHex } from '../../utils/index.js'
|
19
20
|
import { type CallErrorType, type CallParameters, call } from './call.js'
|
20
21
|
|
@@ -54,7 +55,10 @@ export async function verifyHash<TChain extends Chain | undefined,>(
|
|
54
55
|
const signatureHex = isHex(signature) ? signature : toHex(signature)
|
55
56
|
|
56
57
|
try {
|
57
|
-
const { data } = await
|
58
|
+
const { data } = await getAction(
|
59
|
+
client,
|
60
|
+
call,
|
61
|
+
)({
|
58
62
|
data: encodeDeployData({
|
59
63
|
abi: universalSignatureValidatorAbi,
|
60
64
|
args: [address, hash, signatureHex],
|
@@ -9,6 +9,7 @@ import type { ErrorType } from '../../errors/utils.js'
|
|
9
9
|
import type { Chain } from '../../types/chain.js'
|
10
10
|
import type { Hash } from '../../types/misc.js'
|
11
11
|
import type { Transaction } from '../../types/transaction.js'
|
12
|
+
import { getAction } from '../../utils/getAction.js'
|
12
13
|
import { type ObserveErrorType, observe } from '../../utils/observe.js'
|
13
14
|
import { withRetry } from '../../utils/promise/withRetry.js'
|
14
15
|
import { stringify } from '../../utils/stringify.js'
|
@@ -140,7 +141,10 @@ export async function waitForTransactionReceipt<
|
|
140
141
|
observerId,
|
141
142
|
{ onReplaced, resolve, reject },
|
142
143
|
(emit) => {
|
143
|
-
const _unwatch =
|
144
|
+
const _unwatch = getAction(
|
145
|
+
client,
|
146
|
+
watchBlockNumber,
|
147
|
+
)({
|
144
148
|
emitMissed: true,
|
145
149
|
emitOnBegin: true,
|
146
150
|
poll: true,
|
@@ -178,7 +182,10 @@ export async function waitForTransactionReceipt<
|
|
178
182
|
retrying = true
|
179
183
|
await withRetry(
|
180
184
|
async () => {
|
181
|
-
transaction = await
|
185
|
+
transaction = (await getAction(
|
186
|
+
client,
|
187
|
+
getTransaction,
|
188
|
+
)({ hash })) as GetTransactionReturnType<TChain>
|
182
189
|
if (transaction.blockNumber)
|
183
190
|
blockNumber = transaction.blockNumber
|
184
191
|
},
|
@@ -192,7 +199,7 @@ export async function waitForTransactionReceipt<
|
|
192
199
|
}
|
193
200
|
|
194
201
|
// Get the receipt to check if it's been processed.
|
195
|
-
receipt = await
|
202
|
+
receipt = await getAction(client, getTransactionReceipt)({ hash })
|
196
203
|
|
197
204
|
// Check if we have enough confirmations. If not, continue polling.
|
198
205
|
if (
|
@@ -215,13 +222,16 @@ export async function waitForTransactionReceipt<
|
|
215
222
|
replacedTransaction = transaction
|
216
223
|
|
217
224
|
// Let's retrieve the transactions from the current block.
|
218
|
-
const block = await
|
225
|
+
const block = await getAction(
|
226
|
+
client,
|
227
|
+
getBlock,
|
228
|
+
)({
|
219
229
|
blockNumber,
|
220
230
|
includeTransactions: true,
|
221
231
|
})
|
222
232
|
|
223
233
|
const replacementTransaction = (
|
224
|
-
block.transactions as Transaction[]
|
234
|
+
block.transactions as {} as Transaction[]
|
225
235
|
).find(
|
226
236
|
({ from, nonce }) =>
|
227
237
|
from === replacedTransaction!.from &&
|
@@ -232,7 +242,10 @@ export async function waitForTransactionReceipt<
|
|
232
242
|
if (!replacementTransaction) return
|
233
243
|
|
234
244
|
// If we found a replacement transaction, return it's receipt.
|
235
|
-
receipt = await
|
245
|
+
receipt = await getAction(
|
246
|
+
client,
|
247
|
+
getTransactionReceipt,
|
248
|
+
)({
|
236
249
|
hash: replacementTransaction.hash,
|
237
250
|
})
|
238
251
|
|
@@ -4,6 +4,7 @@ import type { ErrorType } from '../../errors/utils.js'
|
|
4
4
|
import type { Chain } from '../../types/chain.js'
|
5
5
|
import type { GetTransportConfig } from '../../types/transport.js'
|
6
6
|
import { hexToBigInt } from '../../utils/encoding/fromHex.js'
|
7
|
+
import { getAction } from '../../utils/getAction.js'
|
7
8
|
import { observe } from '../../utils/observe.js'
|
8
9
|
import { type PollErrorType, poll } from '../../utils/poll.js'
|
9
10
|
import { stringify } from '../../utils/stringify.js'
|
@@ -108,7 +109,10 @@ export function watchBlockNumber<
|
|
108
109
|
poll(
|
109
110
|
async () => {
|
110
111
|
try {
|
111
|
-
const blockNumber = await
|
112
|
+
const blockNumber = await getAction(
|
113
|
+
client,
|
114
|
+
getBlockNumber,
|
115
|
+
)({ cacheTime: 0 })
|
112
116
|
|
113
117
|
if (prevBlockNumber) {
|
114
118
|
// If the current block number is the same as the previous,
|
@@ -5,6 +5,7 @@ import type { BlockTag } from '../../types/block.js'
|
|
5
5
|
import type { Chain } from '../../types/chain.js'
|
6
6
|
import type { GetTransportConfig } from '../../types/transport.js'
|
7
7
|
import { formatBlock } from '../../utils/formatters/block.js'
|
8
|
+
import { getAction } from '../../utils/getAction.js'
|
8
9
|
import { observe } from '../../utils/observe.js'
|
9
10
|
import { type PollErrorType, poll } from '../../utils/poll.js'
|
10
11
|
import { type StringifyErrorType, stringify } from '../../utils/stringify.js'
|
@@ -140,7 +141,10 @@ export function watchBlocks<
|
|
140
141
|
poll(
|
141
142
|
async () => {
|
142
143
|
try {
|
143
|
-
const block = await
|
144
|
+
const block = await getAction(
|
145
|
+
client,
|
146
|
+
getBlock,
|
147
|
+
)({
|
144
148
|
blockTag,
|
145
149
|
includeTransactions,
|
146
150
|
})
|
@@ -153,10 +157,13 @@ export function watchBlocks<
|
|
153
157
|
// `emitMissed` flag is truthy, let's emit those blocks.
|
154
158
|
if (block.number - prevBlock.number > 1 && emitMissed) {
|
155
159
|
for (let i = prevBlock?.number + 1n; i < block.number; i++) {
|
156
|
-
const block = await
|
160
|
+
const block = (await getAction(
|
161
|
+
client,
|
162
|
+
getBlock,
|
163
|
+
)({
|
157
164
|
blockNumber: i,
|
158
165
|
includeTransactions,
|
159
|
-
})
|
166
|
+
})) as GetBlockReturnType<TChain>
|
160
167
|
emit.onBlock(block as any, prevBlock as any)
|
161
168
|
prevBlock = block
|
162
169
|
}
|