viem 0.0.1-alpha.16 → 0.0.1-alpha.17

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.
Files changed (84) hide show
  1. package/dist/chains.d.ts +1 -1
  2. package/dist/chains.js +5 -5
  3. package/dist/chains.mjs +1 -1
  4. package/dist/{chunk-LQXQPPTU.js → chunk-BL2ZZ7UN.js} +14 -14
  5. package/dist/{chunk-LQXQPPTU.js.map → chunk-BL2ZZ7UN.js.map} +0 -0
  6. package/dist/{chunk-4XREGFHD.js → chunk-EOY65E5E.js} +36 -13
  7. package/dist/chunk-EOY65E5E.js.map +1 -0
  8. package/dist/{chunk-WTXKCAG7.js → chunk-EVOCIEHK.js} +109 -53
  9. package/dist/chunk-EVOCIEHK.js.map +1 -0
  10. package/dist/{chunk-TSJ3OOJW.mjs → chunk-HF44N2P3.mjs} +2 -2
  11. package/dist/{chunk-TSJ3OOJW.mjs.map → chunk-HF44N2P3.mjs.map} +0 -0
  12. package/dist/{chunk-KCMYVU3Z.mjs → chunk-JNAHFK7Z.mjs} +26 -3
  13. package/dist/chunk-JNAHFK7Z.mjs.map +1 -0
  14. package/dist/{chunk-XJKOJIX3.js → chunk-KCXMY4FZ.js} +12 -12
  15. package/dist/{chunk-XJKOJIX3.js.map → chunk-KCXMY4FZ.js.map} +0 -0
  16. package/dist/{chunk-KM6AFT2K.mjs → chunk-KQI5IRRL.mjs} +2 -2
  17. package/dist/{chunk-KM6AFT2K.mjs.map → chunk-KQI5IRRL.mjs.map} +0 -0
  18. package/dist/{chunk-B7A2CAHU.mjs → chunk-KWHCOWNW.mjs} +63 -7
  19. package/dist/chunk-KWHCOWNW.mjs.map +1 -0
  20. package/dist/{chunk-U7QDLGQL.mjs → chunk-WQFS6KDQ.mjs} +2 -2
  21. package/dist/{chunk-U7QDLGQL.mjs.map → chunk-WQFS6KDQ.mjs.map} +0 -0
  22. package/dist/{chunk-EWTLCB3N.js → chunk-XEGTPY6M.js} +2 -2
  23. package/dist/{chunk-EWTLCB3N.js.map → chunk-XEGTPY6M.js.map} +0 -0
  24. package/dist/clients/index.d.ts +7 -7
  25. package/dist/clients/index.js +3 -3
  26. package/dist/clients/index.mjs +2 -2
  27. package/dist/{createClient-cd948138.d.ts → createClient-aadeff37.d.ts} +1 -1
  28. package/dist/{createPublicClient-989a0556.d.ts → createPublicClient-88f35518.d.ts} +2 -2
  29. package/dist/{createTestClient-81507f58.d.ts → createTestClient-fbf66ec2.d.ts} +2 -2
  30. package/dist/{createWalletClient-43f801b9.d.ts → createWalletClient-b13dabd6.d.ts} +2 -2
  31. package/dist/{eip1193-4330b722.d.ts → eip1193-3a40c941.d.ts} +9 -6
  32. package/dist/index.d.ts +47 -16
  33. package/dist/index.js +10 -6
  34. package/dist/index.mjs +13 -9
  35. package/dist/{parseGwei-f2d23de6.d.ts → parseGwei-e6f49667.d.ts} +2 -2
  36. package/dist/public.d.ts +9 -9
  37. package/dist/public.js +4 -4
  38. package/dist/public.mjs +5 -5
  39. package/dist/{rpc-b77c5aee.d.ts → rpc-858670f1.d.ts} +12 -1
  40. package/dist/{sendTransaction-7a9d241a.d.ts → sendTransaction-bd109cd4.d.ts} +3 -3
  41. package/dist/{stopImpersonatingAccount-8113150e.d.ts → stopImpersonatingAccount-6603ebdd.d.ts} +2 -2
  42. package/dist/test.d.ts +5 -5
  43. package/dist/test.js +3 -3
  44. package/dist/test.mjs +2 -2
  45. package/dist/{transactionReceipt-5d332aab.d.ts → transactionReceipt-86c1094c.d.ts} +30 -4
  46. package/dist/{transactionRequest-327eb7c2.d.ts → transactionRequest-8e970b0e.d.ts} +1 -1
  47. package/dist/utils/index.d.ts +5 -5
  48. package/dist/utils/index.js +2 -2
  49. package/dist/utils/index.mjs +1 -1
  50. package/dist/wallet.d.ts +7 -7
  51. package/dist/wallet.js +3 -3
  52. package/dist/wallet.mjs +2 -2
  53. package/dist/{watchAsset-0088384c.d.ts → watchAsset-7ef25553.d.ts} +3 -3
  54. package/dist/{watchPendingTransactions-670a7ca3.d.ts → watchPendingTransactions-2563071e.d.ts} +26 -11
  55. package/dist/{webSocket-9a3b0b26.d.ts → webSocket-2a77cdb3.d.ts} +2 -2
  56. package/dist/window.d.ts +2 -2
  57. package/package.json +1 -1
  58. package/src/actions/index.test.ts +3 -1
  59. package/src/actions/index.ts +9 -3
  60. package/src/actions/public/createEventFilter.ts +2 -4
  61. package/src/actions/public/deployContract.test.ts +8 -8
  62. package/src/actions/public/getLogs.test.ts +105 -0
  63. package/src/actions/public/getLogs.ts +83 -0
  64. package/src/actions/public/index.test.ts +2 -1
  65. package/src/actions/public/index.ts +8 -5
  66. package/src/actions/public/simulateContract.bench.ts +31 -0
  67. package/src/actions/public/simulateContract.test.ts +238 -0
  68. package/src/actions/public/{callContract.ts → simulateContract.ts} +34 -12
  69. package/src/actions/wallet/index.test.ts +1 -0
  70. package/src/actions/wallet/index.ts +3 -0
  71. package/src/actions/wallet/writeContract.test.ts +54 -0
  72. package/src/actions/wallet/writeContract.ts +61 -0
  73. package/src/index.test.ts +3 -1
  74. package/src/index.ts +9 -3
  75. package/src/public.ts +3 -3
  76. package/src/types/eip1193.ts +9 -6
  77. package/src/types/index.ts +1 -1
  78. package/src/types/misc.ts +1 -0
  79. package/dist/chunk-4XREGFHD.js.map +0 -1
  80. package/dist/chunk-B7A2CAHU.mjs.map +0 -1
  81. package/dist/chunk-KCMYVU3Z.mjs.map +0 -1
  82. package/dist/chunk-WTXKCAG7.js.map +0 -1
  83. package/src/actions/public/callContract.bench.ts +0 -24
  84. package/src/actions/public/callContract.test.ts +0 -285
@@ -72,7 +72,7 @@
72
72
 
73
73
 
74
74
 
75
- var _chunkEWTLCB3Njs = require('../chunk-EWTLCB3N.js');
75
+ var _chunkXEGTPY6Mjs = require('../chunk-XEGTPY6M.js');
76
76
 
77
77
 
78
78
 
@@ -147,5 +147,5 @@ var _chunkEWTLCB3Njs = require('../chunk-EWTLCB3N.js');
147
147
 
148
148
 
149
149
 
150
- exports.boolToBytes = _chunkEWTLCB3Njs.boolToBytes; exports.boolToHex = _chunkEWTLCB3Njs.boolToHex; exports.buildRequest = _chunkEWTLCB3Njs.buildRequest; exports.bytesToBigint = _chunkEWTLCB3Njs.bytesToBigint; exports.bytesToBool = _chunkEWTLCB3Njs.bytesToBool; exports.bytesToHex = _chunkEWTLCB3Njs.bytesToHex; exports.bytesToNumber = _chunkEWTLCB3Njs.bytesToNumber; exports.bytesToString = _chunkEWTLCB3Njs.bytesToString; exports.decodeAbi = _chunkEWTLCB3Njs.decodeAbi; exports.decodeBytes = _chunkEWTLCB3Njs.decodeBytes; exports.decodeErrorResult = _chunkEWTLCB3Njs.decodeErrorResult; exports.decodeFunctionData = _chunkEWTLCB3Njs.decodeFunctionData; exports.decodeFunctionResult = _chunkEWTLCB3Njs.decodeFunctionResult; exports.decodeHex = _chunkEWTLCB3Njs.decodeHex; exports.decodeRlp = _chunkEWTLCB3Njs.decodeRlp; exports.encodeAbi = _chunkEWTLCB3Njs.encodeAbi; exports.encodeBytes = _chunkEWTLCB3Njs.encodeBytes; exports.encodeDeployData = _chunkEWTLCB3Njs.encodeDeployData; exports.encodeErrorResult = _chunkEWTLCB3Njs.encodeErrorResult; exports.encodeEventTopics = _chunkEWTLCB3Njs.encodeEventTopics; exports.encodeFunctionData = _chunkEWTLCB3Njs.encodeFunctionData; exports.encodeFunctionResult = _chunkEWTLCB3Njs.encodeFunctionResult; exports.encodeHex = _chunkEWTLCB3Njs.encodeHex; exports.encodeRlp = _chunkEWTLCB3Njs.encodeRlp; exports.extract = _chunkEWTLCB3Njs.extract; exports.extractFunctionName = _chunkEWTLCB3Njs.extractFunctionName; exports.extractFunctionParams = _chunkEWTLCB3Njs.extractFunctionParams; exports.extractFunctionParts = _chunkEWTLCB3Njs.extractFunctionParts; exports.extractFunctionType = _chunkEWTLCB3Njs.extractFunctionType; exports.format = _chunkEWTLCB3Njs.format; exports.formatAbiItemWithArgs = _chunkEWTLCB3Njs.formatAbiItemWithArgs; exports.formatAbiItemWithParams = _chunkEWTLCB3Njs.formatAbiItemWithParams; exports.formatBlock = _chunkEWTLCB3Njs.formatBlock; exports.formatEther = _chunkEWTLCB3Njs.formatEther; exports.formatGwei = _chunkEWTLCB3Njs.formatGwei; exports.formatTransaction = _chunkEWTLCB3Njs.formatTransaction; exports.formatTransactionRequest = _chunkEWTLCB3Njs.formatTransactionRequest; exports.formatUnit = _chunkEWTLCB3Njs.formatUnit; exports.getAbiItem = _chunkEWTLCB3Njs.getAbiItem; exports.getAddress = _chunkEWTLCB3Njs.getAddress; exports.getContractAddress = _chunkEWTLCB3Njs.getContractAddress; exports.getContractError = _chunkEWTLCB3Njs.getContractError; exports.getCreate2Address = _chunkEWTLCB3Njs.getCreate2Address; exports.getCreateAddress = _chunkEWTLCB3Njs.getCreateAddress; exports.getEventSignature = _chunkEWTLCB3Njs.getEventSignature; exports.getFunctionSignature = _chunkEWTLCB3Njs.getFunctionSignature; exports.hexToBigInt = _chunkEWTLCB3Njs.hexToBigInt; exports.hexToBool = _chunkEWTLCB3Njs.hexToBool; exports.hexToBytes = _chunkEWTLCB3Njs.hexToBytes; exports.hexToNumber = _chunkEWTLCB3Njs.hexToNumber; exports.hexToString = _chunkEWTLCB3Njs.hexToString; exports.isAddress = _chunkEWTLCB3Njs.isAddress; exports.isAddressEqual = _chunkEWTLCB3Njs.isAddressEqual; exports.isBytes = _chunkEWTLCB3Njs.isBytes; exports.isHex = _chunkEWTLCB3Njs.isHex; exports.keccak256 = _chunkEWTLCB3Njs.keccak256; exports.numberToBytes = _chunkEWTLCB3Njs.numberToBytes; exports.numberToHex = _chunkEWTLCB3Njs.numberToHex; exports.pad = _chunkEWTLCB3Njs.pad; exports.padBytes = _chunkEWTLCB3Njs.padBytes; exports.padHex = _chunkEWTLCB3Njs.padHex; exports.parseEther = _chunkEWTLCB3Njs.parseEther; exports.parseGwei = _chunkEWTLCB3Njs.parseGwei; exports.parseUnit = _chunkEWTLCB3Njs.parseUnit; exports.rpc = _chunkEWTLCB3Njs.rpc; exports.size = _chunkEWTLCB3Njs.size; exports.slice = _chunkEWTLCB3Njs.slice; exports.sliceBytes = _chunkEWTLCB3Njs.sliceBytes; exports.sliceHex = _chunkEWTLCB3Njs.sliceHex; exports.stringToBytes = _chunkEWTLCB3Njs.stringToBytes; exports.stringToHex = _chunkEWTLCB3Njs.stringToHex; exports.stringify = _chunkEWTLCB3Njs.stringify; exports.trim = _chunkEWTLCB3Njs.trim;
150
+ exports.boolToBytes = _chunkXEGTPY6Mjs.boolToBytes; exports.boolToHex = _chunkXEGTPY6Mjs.boolToHex; exports.buildRequest = _chunkXEGTPY6Mjs.buildRequest; exports.bytesToBigint = _chunkXEGTPY6Mjs.bytesToBigint; exports.bytesToBool = _chunkXEGTPY6Mjs.bytesToBool; exports.bytesToHex = _chunkXEGTPY6Mjs.bytesToHex; exports.bytesToNumber = _chunkXEGTPY6Mjs.bytesToNumber; exports.bytesToString = _chunkXEGTPY6Mjs.bytesToString; exports.decodeAbi = _chunkXEGTPY6Mjs.decodeAbi; exports.decodeBytes = _chunkXEGTPY6Mjs.decodeBytes; exports.decodeErrorResult = _chunkXEGTPY6Mjs.decodeErrorResult; exports.decodeFunctionData = _chunkXEGTPY6Mjs.decodeFunctionData; exports.decodeFunctionResult = _chunkXEGTPY6Mjs.decodeFunctionResult; exports.decodeHex = _chunkXEGTPY6Mjs.decodeHex; exports.decodeRlp = _chunkXEGTPY6Mjs.decodeRlp; exports.encodeAbi = _chunkXEGTPY6Mjs.encodeAbi; exports.encodeBytes = _chunkXEGTPY6Mjs.encodeBytes; exports.encodeDeployData = _chunkXEGTPY6Mjs.encodeDeployData; exports.encodeErrorResult = _chunkXEGTPY6Mjs.encodeErrorResult; exports.encodeEventTopics = _chunkXEGTPY6Mjs.encodeEventTopics; exports.encodeFunctionData = _chunkXEGTPY6Mjs.encodeFunctionData; exports.encodeFunctionResult = _chunkXEGTPY6Mjs.encodeFunctionResult; exports.encodeHex = _chunkXEGTPY6Mjs.encodeHex; exports.encodeRlp = _chunkXEGTPY6Mjs.encodeRlp; exports.extract = _chunkXEGTPY6Mjs.extract; exports.extractFunctionName = _chunkXEGTPY6Mjs.extractFunctionName; exports.extractFunctionParams = _chunkXEGTPY6Mjs.extractFunctionParams; exports.extractFunctionParts = _chunkXEGTPY6Mjs.extractFunctionParts; exports.extractFunctionType = _chunkXEGTPY6Mjs.extractFunctionType; exports.format = _chunkXEGTPY6Mjs.format; exports.formatAbiItemWithArgs = _chunkXEGTPY6Mjs.formatAbiItemWithArgs; exports.formatAbiItemWithParams = _chunkXEGTPY6Mjs.formatAbiItemWithParams; exports.formatBlock = _chunkXEGTPY6Mjs.formatBlock; exports.formatEther = _chunkXEGTPY6Mjs.formatEther; exports.formatGwei = _chunkXEGTPY6Mjs.formatGwei; exports.formatTransaction = _chunkXEGTPY6Mjs.formatTransaction; exports.formatTransactionRequest = _chunkXEGTPY6Mjs.formatTransactionRequest; exports.formatUnit = _chunkXEGTPY6Mjs.formatUnit; exports.getAbiItem = _chunkXEGTPY6Mjs.getAbiItem; exports.getAddress = _chunkXEGTPY6Mjs.getAddress; exports.getContractAddress = _chunkXEGTPY6Mjs.getContractAddress; exports.getContractError = _chunkXEGTPY6Mjs.getContractError; exports.getCreate2Address = _chunkXEGTPY6Mjs.getCreate2Address; exports.getCreateAddress = _chunkXEGTPY6Mjs.getCreateAddress; exports.getEventSignature = _chunkXEGTPY6Mjs.getEventSignature; exports.getFunctionSignature = _chunkXEGTPY6Mjs.getFunctionSignature; exports.hexToBigInt = _chunkXEGTPY6Mjs.hexToBigInt; exports.hexToBool = _chunkXEGTPY6Mjs.hexToBool; exports.hexToBytes = _chunkXEGTPY6Mjs.hexToBytes; exports.hexToNumber = _chunkXEGTPY6Mjs.hexToNumber; exports.hexToString = _chunkXEGTPY6Mjs.hexToString; exports.isAddress = _chunkXEGTPY6Mjs.isAddress; exports.isAddressEqual = _chunkXEGTPY6Mjs.isAddressEqual; exports.isBytes = _chunkXEGTPY6Mjs.isBytes; exports.isHex = _chunkXEGTPY6Mjs.isHex; exports.keccak256 = _chunkXEGTPY6Mjs.keccak256; exports.numberToBytes = _chunkXEGTPY6Mjs.numberToBytes; exports.numberToHex = _chunkXEGTPY6Mjs.numberToHex; exports.pad = _chunkXEGTPY6Mjs.pad; exports.padBytes = _chunkXEGTPY6Mjs.padBytes; exports.padHex = _chunkXEGTPY6Mjs.padHex; exports.parseEther = _chunkXEGTPY6Mjs.parseEther; exports.parseGwei = _chunkXEGTPY6Mjs.parseGwei; exports.parseUnit = _chunkXEGTPY6Mjs.parseUnit; exports.rpc = _chunkXEGTPY6Mjs.rpc; exports.size = _chunkXEGTPY6Mjs.size; exports.slice = _chunkXEGTPY6Mjs.slice; exports.sliceBytes = _chunkXEGTPY6Mjs.sliceBytes; exports.sliceHex = _chunkXEGTPY6Mjs.sliceHex; exports.stringToBytes = _chunkXEGTPY6Mjs.stringToBytes; exports.stringToHex = _chunkXEGTPY6Mjs.stringToHex; exports.stringify = _chunkXEGTPY6Mjs.stringify; exports.trim = _chunkXEGTPY6Mjs.trim;
151
151
  //# sourceMappingURL=index.js.map
@@ -72,7 +72,7 @@ import {
72
72
  stringToHex,
73
73
  stringify,
74
74
  trim
75
- } from "../chunk-KM6AFT2K.mjs";
75
+ } from "../chunk-KQI5IRRL.mjs";
76
76
  export {
77
77
  boolToBytes,
78
78
  boolToHex,
package/dist/wallet.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export { G as GetPermissionsResponse, R as RequestPermissionsResponse, S as SignMessageArgs, a as SignMessageResponse, b as SwitchChainArgs, W as WatchAssetArgs, c as WatchAssetResponse, d as addChain, g as getAccounts, e as getPermissions, r as requestAccounts, f as requestPermissions, s as signMessage, h as switchChain, w as watchAsset } from './watchAsset-0088384c.js';
2
- export { F as FormattedTransactionRequest, S as SendTransactionArgs, a as SendTransactionResponse, s as sendTransaction } from './sendTransaction-7a9d241a.js';
1
+ export { G as GetPermissionsResponse, R as RequestPermissionsResponse, S as SignMessageArgs, a as SignMessageResponse, b as SwitchChainArgs, W as WatchAssetArgs, c as WatchAssetResponse, d as addChain, g as getAccounts, e as getPermissions, r as requestAccounts, f as requestPermissions, s as signMessage, h as switchChain, w as watchAsset } from './watchAsset-7ef25553.js';
2
+ export { F as FormattedTransactionRequest, S as SendTransactionArgs, a as SendTransactionResponse, s as sendTransaction } from './sendTransaction-bd109cd4.js';
3
3
  import './chains.js';
4
- import './rpc-b77c5aee.js';
4
+ import './rpc-858670f1.js';
5
5
  import '@wagmi/chains';
6
- import './createWalletClient-43f801b9.js';
7
- import './eip1193-4330b722.js';
8
- import './createClient-cd948138.js';
9
- import './transactionRequest-327eb7c2.js';
6
+ import './createWalletClient-b13dabd6.js';
7
+ import './eip1193-3a40c941.js';
8
+ import './createClient-aadeff37.js';
9
+ import './transactionRequest-8e970b0e.js';
package/dist/wallet.js CHANGED
@@ -8,8 +8,8 @@
8
8
 
9
9
 
10
10
 
11
- var _chunk4XREGFHDjs = require('./chunk-4XREGFHD.js');
12
- require('./chunk-EWTLCB3N.js');
11
+ var _chunkEOY65E5Ejs = require('./chunk-EOY65E5E.js');
12
+ require('./chunk-XEGTPY6M.js');
13
13
 
14
14
 
15
15
 
@@ -20,5 +20,5 @@ require('./chunk-EWTLCB3N.js');
20
20
 
21
21
 
22
22
 
23
- exports.addChain = _chunk4XREGFHDjs.addChain; exports.getAccounts = _chunk4XREGFHDjs.getAccounts; exports.getPermissions = _chunk4XREGFHDjs.getPermissions; exports.requestAccounts = _chunk4XREGFHDjs.requestAccounts; exports.requestPermissions = _chunk4XREGFHDjs.requestPermissions; exports.sendTransaction = _chunk4XREGFHDjs.sendTransaction; exports.signMessage = _chunk4XREGFHDjs.signMessage; exports.switchChain = _chunk4XREGFHDjs.switchChain; exports.watchAsset = _chunk4XREGFHDjs.watchAsset;
23
+ exports.addChain = _chunkEOY65E5Ejs.addChain; exports.getAccounts = _chunkEOY65E5Ejs.getAccounts; exports.getPermissions = _chunkEOY65E5Ejs.getPermissions; exports.requestAccounts = _chunkEOY65E5Ejs.requestAccounts; exports.requestPermissions = _chunkEOY65E5Ejs.requestPermissions; exports.sendTransaction = _chunkEOY65E5Ejs.sendTransaction; exports.signMessage = _chunkEOY65E5Ejs.signMessage; exports.switchChain = _chunkEOY65E5Ejs.switchChain; exports.watchAsset = _chunkEOY65E5Ejs.watchAsset;
24
24
  //# sourceMappingURL=wallet.js.map
package/dist/wallet.mjs CHANGED
@@ -8,8 +8,8 @@ import {
8
8
  signMessage,
9
9
  switchChain,
10
10
  watchAsset
11
- } from "./chunk-KCMYVU3Z.mjs";
12
- import "./chunk-KM6AFT2K.mjs";
11
+ } from "./chunk-JNAHFK7Z.mjs";
12
+ import "./chunk-KQI5IRRL.mjs";
13
13
  export {
14
14
  addChain,
15
15
  getAccounts,
@@ -1,7 +1,7 @@
1
1
  import { Chain } from './chains.js';
2
- import { W as WalletClient } from './createWalletClient-43f801b9.js';
3
- import { a as WalletPermission, b as WatchAssetParams } from './eip1193-4330b722.js';
4
- import { A as Address, H as Hex, B as ByteArray } from './rpc-b77c5aee.js';
2
+ import { W as WalletClient } from './createWalletClient-b13dabd6.js';
3
+ import { a as WalletPermission, b as WatchAssetParams } from './eip1193-3a40c941.js';
4
+ import { A as Address, b as Hex, c as ByteArray } from './rpc-858670f1.js';
5
5
 
6
6
  declare function addChain(client: WalletClient, chain: Chain): Promise<void>;
7
7
 
@@ -1,11 +1,11 @@
1
1
  import { Abi } from 'abitype';
2
2
  import { Chain, Formatter } from './chains.js';
3
- import { H as Hex, A as Address, b as BlockTag, M as MergeIntersectionProperties, v as TransactionRequest, K as EstimateGasParameters, a as Hash, F as FeeHistory, L as Log, r as RpcTransactionReceipt, T as TransactionReceipt, N as TransactionType, D as Transaction } from './rpc-b77c5aee.js';
4
- import { E as ExtractFunctionNameFromAbi, G as GetValue, c as ExtractArgsFromAbi, d as ExtractResultFromAbi, e as ExtractConstructorArgsFromAbi, F as FormattedBlock, B as BlockFormatter, a as FormattedTransaction, T as TransactionFormatter, g as FormattedTransactionReceipt, h as TransactionReceiptFormatter } from './transactionReceipt-5d332aab.js';
5
- import { P as PublicClient } from './createPublicClient-989a0556.js';
6
- import { T as TransactionRequestFormatter, a as Formatted, E as ExtractFormatter } from './transactionRequest-327eb7c2.js';
7
- import { W as WalletClient } from './createWalletClient-43f801b9.js';
8
- import { S as SendTransactionArgs, a as SendTransactionResponse } from './sendTransaction-7a9d241a.js';
3
+ import { b as Hex, A as Address, a as BlockTag, M as MergeIntersectionProperties, v as TransactionRequest, K as EstimateGasParameters, H as Hash, F as FeeHistory, L as Log, r as RpcTransactionReceipt, T as TransactionReceipt, N as TransactionType, D as Transaction } from './rpc-858670f1.js';
4
+ import { c as ExtractFunctionNameFromAbi, G as GetValue, d as ExtractArgsFromAbi, e as ExtractResultFromAbi, g as ExtractConstructorArgsFromAbi, F as FormattedBlock, B as BlockFormatter, a as FormattedTransaction, T as TransactionFormatter, h as FormattedTransactionReceipt, i as TransactionReceiptFormatter } from './transactionReceipt-86c1094c.js';
5
+ import { P as PublicClient } from './createPublicClient-88f35518.js';
6
+ import { W as WalletClient } from './createWalletClient-b13dabd6.js';
7
+ import { S as SendTransactionArgs, a as SendTransactionResponse } from './sendTransaction-bd109cd4.js';
8
+ import { T as TransactionRequestFormatter, a as Formatted, E as ExtractFormatter } from './transactionRequest-8e970b0e.js';
9
9
 
10
10
  type FilterType = 'transaction' | 'block' | 'event';
11
11
  type Filter<TFilterType extends FilterType = 'event'> = {
@@ -31,15 +31,30 @@ type CallResponse = {
31
31
  };
32
32
  declare function call<TChain extends Chain>(client: PublicClient, { blockNumber, blockTag, chain, from, accessList, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, ...rest }: CallArgs<TChain>): Promise<CallResponse>;
33
33
 
34
- type CallContractArgs<TChain extends Chain = Chain, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any> = Omit<CallArgs<TChain>, 'from' | 'to' | 'data' | 'value'> & {
34
+ type WriteContractArgs<TChain extends Chain = Chain, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any> = Omit<SendTransactionArgs<TChain>, 'to' | 'data' | 'value'> & {
35
35
  address: Address;
36
36
  abi: TAbi;
37
- from?: Address;
38
37
  functionName: ExtractFunctionNameFromAbi<TAbi, TFunctionName>;
38
+ value?: GetValue<TAbi, TFunctionName, SendTransactionArgs<TChain>['value']>;
39
+ } & ExtractArgsFromAbi<TAbi, TFunctionName>;
40
+ type WriteContractResponse = SendTransactionResponse;
41
+ declare function writeContract<TChain extends Chain, TAbi extends Abi = Abi, TFunctionName extends string = any>(client: WalletClient, { abi, address, args, functionName, ...request }: WriteContractArgs<TChain, TAbi, TFunctionName>): Promise<WriteContractResponse>;
42
+
43
+ type SimulateContractArgs<TChain extends Chain = Chain, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any> = Omit<CallArgs<TChain>, 'to' | 'data' | 'value'> & {
44
+ address: Address;
45
+ abi: TAbi;
46
+ functionName: ExtractFunctionNameFromAbi<TAbi, TFunctionName, 'payable' | 'nonpayable'>;
39
47
  value?: GetValue<TAbi, TFunctionName, CallArgs<TChain>['value']>;
40
48
  } & ExtractArgsFromAbi<TAbi, TFunctionName>;
41
- type CallContractResponse<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = ExtractResultFromAbi<TAbi, TFunctionName>;
42
- declare function callContract<TChain extends Chain, TAbi extends Abi = Abi, TFunctionName extends string = any>(client: PublicClient, { abi, address, args, functionName, ...callRequest }: CallContractArgs<TChain, TAbi, TFunctionName>): Promise<CallContractResponse<TAbi, TFunctionName>>;
49
+ type SimulateContractResponse<TChain extends Chain = Chain, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = {
50
+ result: ExtractResultFromAbi<TAbi, TFunctionName>;
51
+ request: WriteContractArgs<TChain, TAbi, TFunctionName> & {
52
+ address: Address;
53
+ abi: TAbi;
54
+ functionName: ExtractFunctionNameFromAbi<TAbi, TFunctionName>;
55
+ } & ExtractArgsFromAbi<TAbi, TFunctionName>;
56
+ };
57
+ declare function simulateContract<TChain extends Chain, TAbi extends Abi = Abi, TFunctionName extends string = any>(client: PublicClient, { abi, address, args, functionName, ...callRequest }: SimulateContractArgs<TChain, TAbi, TFunctionName>): Promise<SimulateContractResponse<TChain, TAbi, TFunctionName>>;
43
58
 
44
59
  type CreatePendingTransactionFilterResponse = Filter<'transaction'>;
45
60
  declare function createPendingTransactionFilter(client: PublicClient): Promise<CreatePendingTransactionFilterResponse>;
@@ -360,4 +375,4 @@ type WatchPendingTransactionsArgs = {
360
375
  };
361
376
  declare function watchPendingTransactions(client: PublicClient, { batch, onError, onTransactions, pollingInterval, }: WatchPendingTransactionsArgs): () => void;
362
377
 
363
- export { estimateGas as $, GetTransactionCountArgs as A, GetTransactionCountResponse as B, CallArgs as C, DeployContractArgs as D, EstimateGasArgs as E, GetTransactionResponse as F, GetBalanceArgs as G, GetTransactionReceiptArgs as H, GetTransactionReceiptResponse as I, OnBlockNumber as J, OnBlockNumberResponse as K, OnBlockResponse as L, OnTransactions as M, OnTransactionsResponse as N, OnBlock as O, UninstallFilterResponse as P, WaitForTransactionReceiptResponse as Q, WatchBlockNumberArgs as R, WatchBlocksArgs as S, WatchPendingTransactionsArgs as T, UninstallFilterArgs as U, call as V, WaitForTransactionReceiptArgs as W, callContract as X, createBlockFilter as Y, createPendingTransactionFilter as Z, deployContract as _, CallContractArgs as a, getBalance as a0, getBlock as a1, getBlockNumber as a2, getBlockTransactionCount as a3, getBytecode as a4, getChainId as a5, getFeeHistory as a6, getFilterChanges as a7, getFilterLogs as a8, getGasPrice as a9, getTransaction as aa, getTransactionConfirmations as ab, getTransactionCount as ac, getTransactionReceipt as ad, uninstallFilter as ae, waitForTransactionReceipt as af, watchBlockNumber as ag, watchBlocks as ah, watchPendingTransactions as ai, getBlockNumberCache as aj, ReplacementReason as ak, ReplacementResponse as al, CallContractResponse as b, CallResponse as c, CreateBlockFilterResponse as d, CreatePendingTransactionFilterResponse as e, EstimateGasResponse as f, DeployContractResponse as g, GetBalanceResponse as h, GetBlockArgs as i, GetBlockNumberArgs as j, GetBlockNumberResponse as k, GetBlockResponse as l, GetBlockTransactionCountArgs as m, GetBlockTransactionCountResponse as n, GetBytecodeArgs as o, GetBytecodeResponse as p, GetFeeHistoryArgs as q, GetFeeHistoryResponse as r, GetFilterChangesArgs as s, GetFilterChangesResponse as t, GetFilterLogsArgs as u, GetFilterLogsResponse as v, GetGasPriceResponse as w, GetTransactionArgs as x, GetTransactionConfirmationsArgs as y, GetTransactionConfirmationsResponse as z };
378
+ export { deployContract as $, GetTransactionResponse as A, GetTransactionReceiptArgs as B, CallArgs as C, DeployContractArgs as D, EstimateGasArgs as E, GetTransactionReceiptResponse as F, GetBalanceArgs as G, OnBlockNumber as H, OnBlockNumberResponse as I, OnBlockResponse as J, OnTransactions as K, OnTransactionsResponse as L, SimulateContractResponse as M, UninstallFilterResponse as N, OnBlock as O, WaitForTransactionReceiptResponse as P, WatchBlockNumberArgs as Q, WatchBlocksArgs as R, SimulateContractArgs as S, WatchPendingTransactionsArgs as T, UninstallFilterArgs as U, WriteContractArgs as V, WaitForTransactionReceiptArgs as W, WriteContractResponse as X, call as Y, createBlockFilter as Z, createPendingTransactionFilter as _, CallResponse as a, estimateGas as a0, getBalance as a1, getBlock as a2, getBlockNumber as a3, getBlockTransactionCount as a4, getBytecode as a5, getChainId as a6, getFeeHistory as a7, getFilterChanges as a8, getFilterLogs as a9, getGasPrice as aa, getTransaction as ab, getTransactionConfirmations as ac, getTransactionCount as ad, getTransactionReceipt as ae, simulateContract as af, uninstallFilter as ag, waitForTransactionReceipt as ah, watchBlockNumber as ai, watchBlocks as aj, watchPendingTransactions as ak, writeContract as al, getBlockNumberCache as am, ReplacementReason as an, ReplacementResponse as ao, CreateBlockFilterResponse as b, CreatePendingTransactionFilterResponse as c, EstimateGasResponse as d, DeployContractResponse as e, GetBalanceResponse as f, GetBlockArgs as g, GetBlockNumberArgs as h, GetBlockNumberResponse as i, GetBlockResponse as j, GetBlockTransactionCountArgs as k, GetBlockTransactionCountResponse as l, GetBytecodeArgs as m, GetBytecodeResponse as n, GetFeeHistoryArgs as o, GetFeeHistoryResponse as p, GetFilterChangesArgs as q, GetFilterChangesResponse as r, GetFilterLogsArgs as s, GetFilterLogsResponse as t, GetGasPriceResponse as u, GetTransactionArgs as v, GetTransactionConfirmationsArgs as w, GetTransactionConfirmationsResponse as x, GetTransactionCountArgs as y, GetTransactionCountResponse as z };
@@ -1,5 +1,5 @@
1
- import { b as TransportConfig, T as Transport, B as BaseRpcRequests } from './createClient-cd948138.js';
2
- import { a as Hash } from './rpc-b77c5aee.js';
1
+ import { b as TransportConfig, T as Transport, B as BaseRpcRequests } from './createClient-aadeff37.js';
2
+ import { H as Hash } from './rpc-858670f1.js';
3
3
  import { R as RpcResponse } from './rpc-26932bae.js';
4
4
 
5
5
  type EthereumProvider = {
package/dist/window.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as Requests, E as Events } from './eip1193-4330b722.js';
2
- import './rpc-b77c5aee.js';
1
+ import { R as Requests, E as Events } from './eip1193-3a40c941.js';
2
+ import './rpc-858670f1.js';
3
3
 
4
4
  type WindowProvider = Requests & Events;
5
5
  declare global {
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "@wagmi/chains": "0.0.0-20230201210619",
7
7
  "abitype": "^0.2.5"
8
8
  },
9
- "version": "0.0.1-alpha.16",
9
+ "version": "0.0.1-alpha.17",
10
10
  "files": [
11
11
  "/actions",
12
12
  "/chains",
@@ -7,7 +7,6 @@ test('exports actions', () => {
7
7
  {
8
8
  "addChain": [Function],
9
9
  "call": [Function],
10
- "callContract": [Function],
11
10
  "createBlockFilter": [Function],
12
11
  "createPendingTransactionFilter": [Function],
13
12
  "deployContract": [Function],
@@ -26,6 +25,7 @@ test('exports actions', () => {
26
25
  "getFilterChanges": [Function],
27
26
  "getFilterLogs": [Function],
28
27
  "getGasPrice": [Function],
28
+ "getLogs": [Function],
29
29
  "getPermissions": [Function],
30
30
  "getTransaction": [Function],
31
31
  "getTransactionConfirmations": [Function],
@@ -58,6 +58,7 @@ test('exports actions', () => {
58
58
  "setNonce": [Function],
59
59
  "setStorageAt": [Function],
60
60
  "signMessage": [Function],
61
+ "simulateContract": [Function],
61
62
  "snapshot": [Function],
62
63
  "stopImpersonatingAccount": [Function],
63
64
  "switchChain": [Function],
@@ -67,6 +68,7 @@ test('exports actions', () => {
67
68
  "watchBlockNumber": [Function],
68
69
  "watchBlocks": [Function],
69
70
  "watchPendingTransactions": [Function],
71
+ "writeContract": [Function],
70
72
  }
71
73
  `)
72
74
  })
@@ -1,6 +1,5 @@
1
1
  export {
2
2
  call,
3
- callContract,
4
3
  createBlockFilter,
5
4
  createPendingTransactionFilter,
6
5
  deployContract,
@@ -16,10 +15,12 @@ export {
16
15
  getFilterChanges,
17
16
  getFilterLogs,
18
17
  getGasPrice,
18
+ getLogs,
19
19
  getTransaction,
20
20
  getTransactionConfirmations,
21
21
  getTransactionCount,
22
22
  getTransactionReceipt,
23
+ simulateContract,
23
24
  uninstallFilter,
24
25
  waitForTransactionReceipt,
25
26
  watchBlockNumber,
@@ -28,8 +29,6 @@ export {
28
29
  } from './public'
29
30
  export type {
30
31
  CallArgs,
31
- CallContractArgs,
32
- CallContractResponse,
33
32
  CallResponse,
34
33
  CreateBlockFilterResponse,
35
34
  CreatePendingTransactionFilterResponse,
@@ -54,6 +53,8 @@ export type {
54
53
  GetFilterLogsArgs,
55
54
  GetFilterLogsResponse,
56
55
  GetGasPriceResponse,
56
+ GetLogsArgs,
57
+ GetLogsResponse,
57
58
  GetTransactionArgs,
58
59
  GetTransactionConfirmationsArgs,
59
60
  GetTransactionConfirmationsResponse,
@@ -70,6 +71,8 @@ export type {
70
71
  OnTransactionsResponse,
71
72
  ReplacementReason,
72
73
  ReplacementResponse,
74
+ SimulateContractArgs,
75
+ SimulateContractResponse,
73
76
  UninstallFilterArgs,
74
77
  UninstallFilterResponse,
75
78
  WaitForTransactionReceiptArgs,
@@ -141,6 +144,7 @@ export {
141
144
  signMessage,
142
145
  switchChain,
143
146
  watchAsset,
147
+ writeContract,
144
148
  } from './wallet'
145
149
  export type {
146
150
  FormattedTransactionRequest,
@@ -153,4 +157,6 @@ export type {
153
157
  SwitchChainArgs,
154
158
  WatchAssetArgs,
155
159
  WatchAssetResponse,
160
+ WriteContractArgs,
161
+ WriteContractResponse,
156
162
  } from './wallet'
@@ -6,7 +6,7 @@ import type {
6
6
  BlockTag,
7
7
  ExtractArgsFromEventDefinition,
8
8
  Filter,
9
- Hex,
9
+ LogTopic,
10
10
  } from '../../types'
11
11
  import { getEventSignature, numberToHex } from '../../utils'
12
12
 
@@ -31,8 +31,6 @@ export type CreateEventFilterArgs<
31
31
  )
32
32
  export type CreateEventFilterResponse = Filter<'event'>
33
33
 
34
- type EncodedArg = Hex | Hex[] | null
35
-
36
34
  export async function createEventFilter<
37
35
  TEventDefinition extends `${string}(${string})`,
38
36
  >(
@@ -45,7 +43,7 @@ export async function createEventFilter<
45
43
  toBlock,
46
44
  }: CreateEventFilterArgs<TEventDefinition> = {},
47
45
  ): Promise<CreateEventFilterResponse> {
48
- let topics: EncodedArg[] = []
46
+ let topics: LogTopic[] = []
49
47
  if (event) {
50
48
  topics = buildFilterTopics({ event, args })
51
49
  }
@@ -3,10 +3,10 @@ import { accounts, publicClient, testClient, walletClient } from '../../_test'
3
3
  import { baycContractConfig } from '../../_test/abis'
4
4
  import { parseEther } from '../../utils'
5
5
  import { mine, setBalance } from '../test'
6
- import { callContract } from './callContract'
7
6
 
8
7
  import { deployContract } from './deployContract'
9
8
  import { getTransactionReceipt } from './getTransactionReceipt'
9
+ import { simulateContract } from './simulateContract'
10
10
 
11
11
  test('default', async () => {
12
12
  const hash = await deployContract(walletClient, {
@@ -21,13 +21,13 @@ test('default', async () => {
21
21
  hash,
22
22
  })
23
23
 
24
- expect(
25
- await callContract(publicClient, {
26
- abi: baycContractConfig.abi,
27
- address: contractAddress!,
28
- functionName: 'symbol',
29
- }),
30
- ).toBe('BAYC')
24
+ // expect(
25
+ // await simulateContract(publicClient, {
26
+ // abi: baycContractConfig.abi,
27
+ // address: contractAddress!,
28
+ // functionName: 'symbol',
29
+ // }),
30
+ // ).toBe('BAYC')
31
31
  })
32
32
 
33
33
  test('no funds', async () => {
@@ -0,0 +1,105 @@
1
+ import { afterAll, assertType, beforeAll, describe, expect, test } from 'vitest'
2
+
3
+ import {
4
+ accounts,
5
+ initialBlockNumber,
6
+ publicClient,
7
+ testClient,
8
+ transfer1Data,
9
+ usdcAddress,
10
+ vitalikAddress,
11
+ walletClient,
12
+ } from '../../_test'
13
+
14
+ import {
15
+ impersonateAccount,
16
+ mine,
17
+ setIntervalMining,
18
+ stopImpersonatingAccount,
19
+ } from '../test'
20
+ import { sendTransaction } from '../wallet'
21
+ import type { Log } from '../../types'
22
+ import { getLogs } from './getLogs'
23
+ import { getBlock } from './getBlock'
24
+
25
+ beforeAll(async () => {
26
+ await setIntervalMining(testClient, { interval: 0 })
27
+ await impersonateAccount(testClient, {
28
+ address: vitalikAddress,
29
+ })
30
+ })
31
+
32
+ afterAll(async () => {
33
+ await setIntervalMining(testClient, { interval: 1 })
34
+ await stopImpersonatingAccount(testClient, {
35
+ address: vitalikAddress,
36
+ })
37
+ })
38
+
39
+ test('default', async () => {
40
+ const logs = await getLogs(publicClient)
41
+ expect(logs).toMatchInlineSnapshot('[]')
42
+ })
43
+
44
+ describe('events', () => {
45
+ test('no args', async () => {
46
+ await sendTransaction(walletClient, {
47
+ from: vitalikAddress,
48
+ to: usdcAddress,
49
+ data: transfer1Data(accounts[0].address),
50
+ })
51
+ await sendTransaction(walletClient, {
52
+ from: vitalikAddress,
53
+ to: usdcAddress,
54
+ data: transfer1Data(accounts[1].address),
55
+ })
56
+ await mine(testClient, { blocks: 1 })
57
+
58
+ let logs = await getLogs(publicClient)
59
+ assertType<Log[]>(logs)
60
+ expect(logs.length).toBe(2)
61
+ })
62
+
63
+ test('args: event', async () => {
64
+ await sendTransaction(walletClient, {
65
+ from: vitalikAddress,
66
+ to: usdcAddress,
67
+ data: transfer1Data(accounts[0].address),
68
+ })
69
+ await sendTransaction(walletClient, {
70
+ from: vitalikAddress,
71
+ to: usdcAddress,
72
+ data: transfer1Data(accounts[1].address),
73
+ })
74
+
75
+ await mine(testClient, { blocks: 1 })
76
+
77
+ let logs = await getLogs(publicClient, {
78
+ event: 'Transfer(address from, address to, uint256 value)',
79
+ })
80
+ assertType<Log[]>(logs)
81
+ expect(logs.length).toBe(2)
82
+ })
83
+
84
+ test('args: fromBlock/toBlock', async () => {
85
+ let logs = await getLogs(publicClient, {
86
+ event: 'Transfer(address from, address to, uint256 value)',
87
+ fromBlock: initialBlockNumber - 5n,
88
+ toBlock: initialBlockNumber,
89
+ })
90
+ assertType<Log[]>(logs)
91
+ expect(logs.length).toBe(1056)
92
+ })
93
+
94
+ test('args: blockHash', async () => {
95
+ const block = await getBlock(publicClient, {
96
+ blockNumber: initialBlockNumber - 1n,
97
+ })
98
+ let logs = await getLogs(publicClient, {
99
+ event: 'Transfer(address from, address to, uint256 value)',
100
+ blockHash: block.hash!,
101
+ })
102
+ assertType<Log[]>(logs)
103
+ expect(logs.length).toBe(118)
104
+ })
105
+ })
@@ -0,0 +1,83 @@
1
+ import type { PublicClient } from '../../clients'
2
+ import type {
3
+ Log,
4
+ RpcLog,
5
+ Address,
6
+ BlockNumber,
7
+ BlockTag,
8
+ Hash,
9
+ LogTopic,
10
+ } from '../../types'
11
+ import { numberToHex } from '../../utils'
12
+ import { formatLog } from '../../utils/formatters/log'
13
+ import { buildFilterTopics, EventFilterArgs } from './createEventFilter'
14
+
15
+ export type GetLogsArgs<TEventDefinition extends `${string}(${string})`> = {
16
+ /** Address or list of addresses from which logs originated */
17
+ address?: Address | Address[]
18
+ } & (
19
+ | { event: TEventDefinition; args?: EventFilterArgs<TEventDefinition> }
20
+ | {
21
+ event?: never
22
+ args?: never
23
+ }
24
+ ) &
25
+ (
26
+ | {
27
+ /** Block number or tag after which to include logs */
28
+ fromBlock?: BlockNumber<bigint> | BlockTag
29
+ /** Block number or tag before which to include logs */
30
+ toBlock?: BlockNumber<bigint> | BlockTag
31
+ blockHash?: never
32
+ }
33
+ | {
34
+ fromBlock?: never
35
+ toBlock?: never
36
+ /** Hash of block to include logs from */
37
+ blockHash?: Hash
38
+ }
39
+ )
40
+
41
+ export type GetLogsResponse = Log[]
42
+
43
+ /**
44
+ * @description Returns a collection of event logs.
45
+ */
46
+ export async function getLogs<TEventDefinition extends `${string}(${string})`,>(
47
+ client: PublicClient,
48
+ {
49
+ address,
50
+ blockHash,
51
+ fromBlock,
52
+ toBlock,
53
+ event,
54
+ args,
55
+ }: GetLogsArgs<TEventDefinition> = {},
56
+ ): Promise<GetLogsResponse> {
57
+ let topics: LogTopic[] = []
58
+ if (event) {
59
+ topics = buildFilterTopics({ event, args })
60
+ }
61
+ let logs: RpcLog[]
62
+ if (blockHash) {
63
+ logs = await client.request({
64
+ method: 'eth_getLogs',
65
+ params: [{ address, topics, blockHash }],
66
+ })
67
+ } else {
68
+ logs = await client.request({
69
+ method: 'eth_getLogs',
70
+ params: [
71
+ {
72
+ address,
73
+ topics,
74
+ fromBlock:
75
+ typeof fromBlock === 'bigint' ? numberToHex(fromBlock) : fromBlock,
76
+ toBlock: typeof toBlock === 'bigint' ? numberToHex(toBlock) : toBlock,
77
+ },
78
+ ],
79
+ })
80
+ }
81
+
82
+ return logs.map(formatLog)
83
+ }
@@ -6,7 +6,6 @@ test('exports actions', () => {
6
6
  expect(actions).toMatchInlineSnapshot(`
7
7
  {
8
8
  "call": [Function],
9
- "callContract": [Function],
10
9
  "createBlockFilter": [Function],
11
10
  "createPendingTransactionFilter": [Function],
12
11
  "deployContract": [Function],
@@ -22,10 +21,12 @@ test('exports actions', () => {
22
21
  "getFilterChanges": [Function],
23
22
  "getFilterLogs": [Function],
24
23
  "getGasPrice": [Function],
24
+ "getLogs": [Function],
25
25
  "getTransaction": [Function],
26
26
  "getTransactionConfirmations": [Function],
27
27
  "getTransactionCount": [Function],
28
28
  "getTransactionReceipt": [Function],
29
+ "simulateContract": [Function],
29
30
  "uninstallFilter": [Function],
30
31
  "waitForTransactionReceipt": [Function],
31
32
  "watchBlockNumber": [Function],
@@ -1,12 +1,12 @@
1
1
  export { call } from './call'
2
2
  export type { CallArgs, CallResponse, FormattedCall } from './call'
3
3
 
4
- export { callContract } from './callContract'
4
+ export { simulateContract } from './simulateContract'
5
5
  export type {
6
- CallContractArgs,
7
- CallContractResponse,
8
- FormattedCallContract,
9
- } from './callContract'
6
+ SimulateContractArgs,
7
+ SimulateContractResponse,
8
+ FormattedSimulateContract,
9
+ } from './simulateContract'
10
10
 
11
11
  export { createPendingTransactionFilter } from './createPendingTransactionFilter'
12
12
  export type { CreatePendingTransactionFilterResponse } from './createPendingTransactionFilter'
@@ -64,6 +64,9 @@ export type {
64
64
  export { getGasPrice } from './getGasPrice'
65
65
  export type { GetGasPriceResponse } from './getGasPrice'
66
66
 
67
+ export { getLogs } from './getLogs'
68
+ export type { GetLogsArgs, GetLogsResponse } from './getLogs'
69
+
67
70
  export { getTransaction } from './getTransaction'
68
71
  export type {
69
72
  GetTransactionArgs,
@@ -0,0 +1,31 @@
1
+ import { Contract } from 'ethers'
2
+ import { bench, describe } from 'vitest'
3
+
4
+ import {
5
+ accounts,
6
+ ethersProvider,
7
+ publicClient,
8
+ wagmiContractConfig,
9
+ } from '../../_test'
10
+
11
+ import { simulateContract } from './simulateContract'
12
+
13
+ describe('Simulate Contract', () => {
14
+ bench('viem: `simulateContract`', async () => {
15
+ await simulateContract(publicClient, {
16
+ ...wagmiContractConfig,
17
+ functionName: 'mint',
18
+ args: [1n],
19
+ from: accounts[0].address,
20
+ })
21
+ })
22
+
23
+ bench('ethers: `callStatic`', async () => {
24
+ const wagmi = new Contract(
25
+ wagmiContractConfig.address,
26
+ wagmiContractConfig.abi,
27
+ ethersProvider,
28
+ )
29
+ await wagmi.callStatic.mint(1)
30
+ })
31
+ })