Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add inference to getLogs event #363

Merged
merged 1 commit into from
Apr 12, 2023
Merged

feat: add inference to getLogs event #363

merged 1 commit into from
Apr 12, 2023

Conversation

tmm
Copy link
Member

@tmm tmm commented Apr 12, 2023

Adds type inference to getLogs event property

#359 (reply in thread)


Automated Summary

🤖 Generated by Copilot at 3f8d114

This pull request enhances the type inference of the getLogs function, which fetches logs from a smart contract event. It uses the Narrow and AbiEvent types from abitype to narrow down the possible types of the event parameter and the returned logs. It also adds some type tests using vitest and documents the changeset in a markdown file.

@changeset-bot
Copy link

changeset-bot bot commented Apr 12, 2023

🦋 Changeset detected

Latest commit: 3f8d114

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Apr 12, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
viem ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 12, 2023 3:47pm
viem-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 12, 2023 3:47pm

@github-actions
Copy link
Contributor

Size Change: 0 B

Total Size: 246 kB

ℹ️ View Unchanged
Filename Size
dist/cjs/abi.js 322 B
dist/cjs/accounts/generateMnemonic.js 220 B
dist/cjs/accounts/generatePrivateKey.js 263 B
dist/cjs/accounts/hdKeyToAccount.js 369 B
dist/cjs/accounts/index.js 715 B
dist/cjs/accounts/mnemonicToAccount.js 296 B
dist/cjs/accounts/privateKeyToAccount.js 454 B
dist/cjs/accounts/toAccount.js 394 B
dist/cjs/accounts/types.js 124 B
dist/cjs/accounts/utils/index.js 366 B
dist/cjs/accounts/utils/parseAccount.js 225 B
dist/cjs/accounts/utils/publicKeyToAddress.js 290 B
dist/cjs/accounts/utils/sign.js 328 B
dist/cjs/accounts/utils/signatureToHex.js 313 B
dist/cjs/accounts/utils/signMessage.js 300 B
dist/cjs/accounts/utils/signTransaction.js 313 B
dist/cjs/accounts/utils/signTypedData.js 310 B
dist/cjs/accounts/wordlists/czech.js 222 B
dist/cjs/accounts/wordlists/english.js 223 B
dist/cjs/accounts/wordlists/french.js 223 B
dist/cjs/accounts/wordlists/italian.js 223 B
dist/cjs/accounts/wordlists/japanese.js 225 B
dist/cjs/accounts/wordlists/korean.js 223 B
dist/cjs/accounts/wordlists/simplifiedChinese.js 242 B
dist/cjs/accounts/wordlists/spanish.js 223 B
dist/cjs/accounts/wordlists/traditionalChinese.js 242 B
dist/cjs/actions/ens/getEnsAddress.js 638 B
dist/cjs/actions/ens/getEnsAvatar.js 388 B
dist/cjs/actions/ens/getEnsName.js 754 B
dist/cjs/actions/ens/getEnsResolver.js 573 B
dist/cjs/actions/ens/getEnsText.js 636 B
dist/cjs/actions/ens/index.js 321 B
dist/cjs/actions/getContract.js 962 B
dist/cjs/actions/index.js 1.42 kB
dist/cjs/actions/public/call.js 658 B
dist/cjs/actions/public/createBlockFilter.js 320 B
dist/cjs/actions/public/createContractEventFilter.js 523 B
dist/cjs/actions/public/createEventFilter.js 566 B
dist/cjs/actions/public/createPendingTransactionFilter.js 326 B
dist/cjs/actions/public/estimateContractGas.js 460 B
dist/cjs/actions/public/estimateGas.js 728 B
dist/cjs/actions/public/getBalance.js 344 B
dist/cjs/actions/public/getBlock.js 490 B
dist/cjs/actions/public/getBlockNumber.js 389 B
dist/cjs/actions/public/getBlockTransactionCount.js 409 B
dist/cjs/actions/public/getBytecode.js 365 B
dist/cjs/actions/public/getChainId.js 272 B
dist/cjs/actions/public/getFeeHistory.js 396 B
dist/cjs/actions/public/getFilterChanges.js 490 B
dist/cjs/actions/public/getFilterLogs.js 465 B
dist/cjs/actions/public/getGasPrice.js 232 B
dist/cjs/actions/public/getLogs.js 627 B
dist/cjs/actions/public/getStorageAt.js 354 B
dist/cjs/actions/public/getTransaction.js 546 B
dist/cjs/actions/public/getTransactionConfirmations.js 367 B
dist/cjs/actions/public/getTransactionCount.js 338 B
dist/cjs/actions/public/getTransactionReceipt.js 383 B
dist/cjs/actions/public/index.js 1.04 kB
dist/cjs/actions/public/multicall.js 864 B
dist/cjs/actions/public/readContract.js 447 B
dist/cjs/actions/public/simulateContract.js 537 B
dist/cjs/actions/public/uninstallFilter.js 232 B
dist/cjs/actions/public/waitForTransactionReceipt.js 1.04 kB
dist/cjs/actions/public/watchBlockNumber.js 870 B
dist/cjs/actions/public/watchBlocks.js 921 B
dist/cjs/actions/public/watchContractEvent.js 895 B
dist/cjs/actions/public/watchEvent.js 837 B
dist/cjs/actions/public/watchPendingTransactions.js 907 B
dist/cjs/actions/test/dropTransaction.js 236 B
dist/cjs/actions/test/getAutomine.js 218 B
dist/cjs/actions/test/getTxpoolContent.js 218 B
dist/cjs/actions/test/getTxpoolStatus.js 304 B
dist/cjs/actions/test/impersonateAccount.js 241 B
dist/cjs/actions/test/increaseTime.js 282 B
dist/cjs/actions/test/index.js 938 B
dist/cjs/actions/test/inspectTxpool.js 214 B
dist/cjs/actions/test/mine.js 298 B
dist/cjs/actions/test/removeBlockTimestampInterval.js 230 B
dist/cjs/actions/test/reset.js 265 B
dist/cjs/actions/test/revert.js 223 B
dist/cjs/actions/test/sendUnsignedTransaction.js 302 B
dist/cjs/actions/test/setAutomine.js 231 B
dist/cjs/actions/test/setBalance.js 293 B
dist/cjs/actions/test/setBlockGasLimit.js 287 B
dist/cjs/actions/test/setBlockTimestampInterval.js 247 B
dist/cjs/actions/test/setCode.js 240 B
dist/cjs/actions/test/setCoinbase.js 237 B
dist/cjs/actions/test/setIntervalMining.js 234 B
dist/cjs/actions/test/setLoggingEnabled.js 239 B
dist/cjs/actions/test/setMinGasPrice.js 289 B
dist/cjs/actions/test/setNextBlockBaseFeePerGas.js 300 B
dist/cjs/actions/test/setNextBlockTimestamp.js 290 B
dist/cjs/actions/test/setNonce.js 291 B
dist/cjs/actions/test/setRpcUrl.js 234 B
dist/cjs/actions/test/setStorageAt.js 329 B
dist/cjs/actions/test/snapshot.js 209 B
dist/cjs/actions/test/stopImpersonatingAccount.js 245 B
dist/cjs/actions/wallet/addChain.js 422 B
dist/cjs/actions/wallet/deployContract.js 316 B
dist/cjs/actions/wallet/getAddresses.js 283 B
dist/cjs/actions/wallet/getPermissions.js 222 B
dist/cjs/actions/wallet/index.js 545 B
dist/cjs/actions/wallet/requestAddresses.js 277 B
dist/cjs/actions/wallet/requestPermissions.js 228 B
dist/cjs/actions/wallet/sendTransaction.js 871 B
dist/cjs/actions/wallet/signMessage.js 422 B
dist/cjs/actions/wallet/signTypedData.js 700 B
dist/cjs/actions/wallet/switchChain.js 305 B
dist/cjs/actions/wallet/watchAsset.js 242 B
dist/cjs/actions/wallet/writeContract.js 341 B
dist/cjs/adapters/ethers.js 631 B
dist/cjs/chains.js 1.98 kB
dist/cjs/clients/createClient.js 347 B
dist/cjs/clients/createPublicClient.js 345 B
dist/cjs/clients/createTestClient.js 355 B
dist/cjs/clients/createWalletClient.js 424 B
dist/cjs/clients/decorators/index.js 269 B
dist/cjs/clients/decorators/public.js 648 B
dist/cjs/clients/decorators/test.js 595 B
dist/cjs/clients/decorators/wallet.js 385 B
dist/cjs/clients/index.js 395 B
dist/cjs/clients/transports/createTransport.js 307 B
dist/cjs/clients/transports/custom.js 341 B
dist/cjs/clients/transports/fallback.js 1.34 kB
dist/cjs/clients/transports/http.js 564 B
dist/cjs/clients/transports/index.js 323 B
dist/cjs/clients/transports/webSocket.js 840 B
dist/cjs/constants/abis.js 466 B
dist/cjs/constants/index.js 341 B
dist/cjs/constants/solidity.js 552 B
dist/cjs/constants/unit.js 198 B
dist/cjs/contract.js 626 B
dist/cjs/ens.js 363 B
dist/cjs/errors/abi.js 2.14 kB
dist/cjs/errors/account.js 422 B
dist/cjs/errors/address.js 300 B
dist/cjs/errors/base.js 623 B
dist/cjs/errors/block.js 372 B
dist/cjs/errors/chain.js 815 B
dist/cjs/errors/contract.js 1.76 kB
dist/cjs/errors/data.js 363 B
dist/cjs/errors/encoding.js 826 B
dist/cjs/errors/ens.js 661 B
dist/cjs/errors/estimateGas.js 678 B
dist/cjs/errors/index.js 2.08 kB
dist/cjs/errors/log.js 310 B
dist/cjs/errors/node.js 1.61 kB
dist/cjs/errors/request.js 688 B
dist/cjs/errors/rpc.js 1.5 kB
dist/cjs/errors/transaction.js 1.9 kB
dist/cjs/errors/transport.js 296 B
dist/cjs/errors/utils.js 256 B
dist/cjs/errors/version.js 148 B
dist/cjs/ethers.js 224 B
dist/cjs/index.js 3.2 kB
dist/cjs/public.js 627 B
dist/cjs/test.js 675 B
dist/cjs/types/account.js 125 B
dist/cjs/types/block.js 125 B
dist/cjs/types/chain.js 125 B
dist/cjs/types/contract.js 128 B
dist/cjs/types/eip1193.js 277 B
dist/cjs/types/ens.js 123 B
dist/cjs/types/fee.js 123 B
dist/cjs/types/filter.js 125 B
dist/cjs/types/formatter.js 127 B
dist/cjs/types/index.js 125 B
dist/cjs/types/log.js 124 B
dist/cjs/types/misc.js 124 B
dist/cjs/types/multicall.js 127 B
dist/cjs/types/rpc.js 123 B
dist/cjs/types/transaction.js 128 B
dist/cjs/types/transport.js 128 B
dist/cjs/types/typedData.js 128 B
dist/cjs/types/utils.js 124 B
dist/cjs/types/window.js 126 B
dist/cjs/utils/abi/decodeAbiParameters.js 1.53 kB
dist/cjs/utils/abi/decodeDeployData.js 465 B
dist/cjs/utils/abi/decodeErrorResult.js 587 B
dist/cjs/utils/abi/decodeEventLog.js 1.03 kB
dist/cjs/utils/abi/decodeFunctionData.js 522 B
dist/cjs/utils/abi/decodeFunctionResult.js 451 B
dist/cjs/utils/abi/encodeAbiParameters.js 1.7 kB
dist/cjs/utils/abi/encodeDeployData.js 470 B
dist/cjs/utils/abi/encodeErrorResult.js 538 B
dist/cjs/utils/abi/encodeEventTopics.js 768 B
dist/cjs/utils/abi/encodeFunctionData.js 520 B
dist/cjs/utils/abi/encodeFunctionResult.js 451 B
dist/cjs/utils/abi/encodePacked.js 859 B
dist/cjs/utils/abi/formatAbiItem.js 489 B
dist/cjs/utils/abi/formatAbiItemWithArgs.js 389 B
dist/cjs/utils/abi/getAbiItem.js 922 B
dist/cjs/utils/abi/index.js 650 B
dist/cjs/utils/accounts.js 262 B
dist/cjs/utils/address/getAddress.js 516 B
dist/cjs/utils/address/getContractAddress.js 570 B
dist/cjs/utils/address/index.js 343 B
dist/cjs/utils/address/isAddress.js 215 B
dist/cjs/utils/address/isAddressEqual.js 298 B
dist/cjs/utils/buildRequest.js 956 B
dist/cjs/utils/chain.js 397 B
dist/cjs/utils/contract/extractFunctionParts.js 463 B
dist/cjs/utils/contract/index.js 264 B
dist/cjs/utils/data/concat.js 381 B
dist/cjs/utils/data/index.js 426 B
dist/cjs/utils/data/isBytes.js 273 B
dist/cjs/utils/data/isHex.js 230 B
dist/cjs/utils/data/pad.js 580 B
dist/cjs/utils/data/size.js 240 B
dist/cjs/utils/data/slice.js 478 B
dist/cjs/utils/data/trim.js 399 B
dist/cjs/utils/encoding/fromBytes.js 516 B
dist/cjs/utils/encoding/fromHex.js 599 B
dist/cjs/utils/encoding/fromRlp.js 914 B
dist/cjs/utils/encoding/index.js 544 B
dist/cjs/utils/encoding/toBytes.js 659 B
dist/cjs/utils/encoding/toHex.js 876 B
dist/cjs/utils/encoding/toRlp.js 544 B
dist/cjs/utils/ens/avatar/index.js 216 B
dist/cjs/utils/ens/avatar/parseAvatarRecord.js 626 B
dist/cjs/utils/ens/avatar/utils.js 2.06 kB
dist/cjs/utils/ens/index.js 309 B
dist/cjs/utils/ens/labelhash.js 304 B
dist/cjs/utils/ens/namehash.js 408 B
dist/cjs/utils/ens/normalize.js 217 B
dist/cjs/utils/ens/packetToBytes.js 441 B
dist/cjs/utils/errors/getCallError.js 315 B
dist/cjs/utils/errors/getContractError.js 550 B
dist/cjs/utils/errors/getEstimateGasError.js 321 B
dist/cjs/utils/errors/getNodeError.js 679 B
dist/cjs/utils/errors/getTransactionError.js 317 B
dist/cjs/utils/errors/index.js 351 B
dist/cjs/utils/filters/createFilterRequestScope.js 332 B
dist/cjs/utils/formatters/block.js 508 B
dist/cjs/utils/formatters/extract.js 280 B
dist/cjs/utils/formatters/feeHistory.js 273 B
dist/cjs/utils/formatters/format.js 309 B
dist/cjs/utils/formatters/index.js 462 B
dist/cjs/utils/formatters/log.js 306 B
dist/cjs/utils/formatters/transaction.js 608 B
dist/cjs/utils/formatters/transactionReceipt.js 553 B
dist/cjs/utils/formatters/transactionRequest.js 402 B
dist/cjs/utils/hash/getEventSelector.js 210 B
dist/cjs/utils/hash/getFunctionSelector.js 238 B
dist/cjs/utils/hash/hashFunction.js 381 B
dist/cjs/utils/hash/index.js 307 B
dist/cjs/utils/hash/isHash.js 229 B
dist/cjs/utils/hash/keccak256.js 332 B
dist/cjs/utils/index.js 2.08 kB
dist/cjs/utils/observe.js 542 B
dist/cjs/utils/poll.js 384 B
dist/cjs/utils/promise/index.js 286 B
dist/cjs/utils/promise/withCache.js 509 B
dist/cjs/utils/promise/withRetry.js 457 B
dist/cjs/utils/promise/withTimeout.js 422 B
dist/cjs/utils/regex.js 293 B
dist/cjs/utils/rpc.js 1.59 kB
dist/cjs/utils/signature/hashMessage.js 337 B
dist/cjs/utils/signature/hashTypedData.js 1.34 kB
dist/cjs/utils/signature/index.js 374 B
dist/cjs/utils/signature/recoverAddress.js 469 B
dist/cjs/utils/signature/recoverMessageAddress.js 265 B
dist/cjs/utils/signature/recoverTypedDataAddress.js 311 B
dist/cjs/utils/signature/verifyMessage.js 272 B
dist/cjs/utils/signature/verifyTypedData.js 327 B
dist/cjs/utils/stringify.js 258 B
dist/cjs/utils/transaction/assertRequest.js 521 B
dist/cjs/utils/transaction/assertTransaction.js 613 B
dist/cjs/utils/transaction/getSerializedTransactionType.js 377 B
dist/cjs/utils/transaction/getTransactionType.js 358 B
dist/cjs/utils/transaction/index.js 423 B
dist/cjs/utils/transaction/parseTransaction.js 1.47 kB
dist/cjs/utils/transaction/prepareRequest.js 835 B
dist/cjs/utils/transaction/serializeTransaction.js 1.04 kB
dist/cjs/utils/typedData.js 738 B
dist/cjs/utils/uid.js 316 B
dist/cjs/utils/unit/formatEther.js 258 B
dist/cjs/utils/unit/formatGwei.js 254 B
dist/cjs/utils/unit/formatUnits.js 360 B
dist/cjs/utils/unit/index.js 331 B
dist/cjs/utils/unit/parseEther.js 255 B
dist/cjs/utils/unit/parseGwei.js 255 B
dist/cjs/utils/unit/parseUnits.js 465 B
dist/cjs/utils/wait.js 197 B
dist/cjs/wallet.js 377 B
dist/cjs/window.js 143 B
dist/esm/abi.js 147 B
dist/esm/accounts/generateMnemonic.js 146 B
dist/esm/accounts/generatePrivateKey.js 182 B
dist/esm/accounts/hdKeyToAccount.js 286 B
dist/esm/accounts/index.js 320 B
dist/esm/accounts/mnemonicToAccount.js 214 B
dist/esm/accounts/privateKeyToAccount.js 367 B
dist/esm/accounts/toAccount.js 312 B
dist/esm/accounts/types.js 64 B
dist/esm/accounts/utils/index.js 171 B
dist/esm/accounts/utils/parseAccount.js 157 B
dist/esm/accounts/utils/publicKeyToAddress.js 209 B
dist/esm/accounts/utils/sign.js 248 B
dist/esm/accounts/utils/signatureToHex.js 231 B
dist/esm/accounts/utils/signMessage.js 212 B
dist/esm/accounts/utils/signTransaction.js 232 B
dist/esm/accounts/utils/signTypedData.js 222 B
dist/esm/accounts/wordlists/czech.js 107 B
dist/esm/accounts/wordlists/english.js 107 B
dist/esm/accounts/wordlists/french.js 106 B
dist/esm/accounts/wordlists/italian.js 109 B
dist/esm/accounts/wordlists/japanese.js 110 B
dist/esm/accounts/wordlists/korean.js 108 B
dist/esm/accounts/wordlists/simplifiedChinese.js 125 B
dist/esm/accounts/wordlists/spanish.js 109 B
dist/esm/accounts/wordlists/traditionalChinese.js 126 B
dist/esm/actions/ens/getEnsAddress.js 569 B
dist/esm/actions/ens/getEnsAvatar.js 307 B
dist/esm/actions/ens/getEnsName.js 669 B
dist/esm/actions/ens/getEnsResolver.js 492 B
dist/esm/actions/ens/getEnsText.js 564 B
dist/esm/actions/ens/index.js 142 B
dist/esm/actions/getContract.js 879 B
dist/esm/actions/index.js 604 B
dist/esm/actions/public/call.js 584 B
dist/esm/actions/public/createBlockFilter.js 240 B
dist/esm/actions/public/createContractEventFilter.js 439 B
dist/esm/actions/public/createEventFilter.js 482 B
dist/esm/actions/public/createPendingTransactionFilter.js 246 B
dist/esm/actions/public/estimateContractGas.js 377 B
dist/esm/actions/public/estimateGas.js 654 B
dist/esm/actions/public/getBalance.js 272 B
dist/esm/actions/public/getBlock.js 412 B
dist/esm/actions/public/getBlockNumber.js 307 B
dist/esm/actions/public/getBlockTransactionCount.js 333 B
dist/esm/actions/public/getBytecode.js 291 B
dist/esm/actions/public/getChainId.js 194 B
dist/esm/actions/public/getFeeHistory.js 318 B
dist/esm/actions/public/getFilterChanges.js 410 B
dist/esm/actions/public/getFilterLogs.js 383 B
dist/esm/actions/public/getGasPrice.js 164 B
dist/esm/actions/public/getLogs.js 548 B
dist/esm/actions/public/getStorageAt.js 278 B
dist/esm/actions/public/getTransaction.js 457 B
dist/esm/actions/public/getTransactionConfirmations.js 283 B
dist/esm/actions/public/getTransactionCount.js 263 B
dist/esm/actions/public/getTransactionReceipt.js 300 B
dist/esm/actions/public/index.js 430 B
dist/esm/actions/public/multicall.js 794 B
dist/esm/actions/public/readContract.js 366 B
dist/esm/actions/public/simulateContract.js 460 B
dist/esm/actions/public/uninstallFilter.js 164 B
dist/esm/actions/public/waitForTransactionReceipt.js 945 B
dist/esm/actions/public/watchBlockNumber.js 781 B
dist/esm/actions/public/watchBlocks.js 836 B
dist/esm/actions/public/watchContractEvent.js 793 B
dist/esm/actions/public/watchEvent.js 739 B
dist/esm/actions/public/watchPendingTransactions.js 818 B
dist/esm/actions/test/dropTransaction.js 170 B
dist/esm/actions/test/getAutomine.js 150 B
dist/esm/actions/test/getTxpoolContent.js 149 B
dist/esm/actions/test/getTxpoolStatus.js 228 B
dist/esm/actions/test/impersonateAccount.js 174 B
dist/esm/actions/test/increaseTime.js 205 B
dist/esm/actions/test/index.js 408 B
dist/esm/actions/test/inspectTxpool.js 146 B
dist/esm/actions/test/mine.js 221 B
dist/esm/actions/test/removeBlockTimestampInterval.js 162 B
dist/esm/actions/test/reset.js 198 B
dist/esm/actions/test/revert.js 156 B
dist/esm/actions/test/sendUnsignedTransaction.js 228 B
dist/esm/actions/test/setAutomine.js 163 B
dist/esm/actions/test/setBalance.js 218 B
dist/esm/actions/test/setBlockGasLimit.js 208 B
dist/esm/actions/test/setBlockTimestampInterval.js 180 B
dist/esm/actions/test/setCode.js 173 B
dist/esm/actions/test/setCoinbase.js 169 B
dist/esm/actions/test/setIntervalMining.js 168 B
dist/esm/actions/test/setLoggingEnabled.js 171 B
dist/esm/actions/test/setMinGasPrice.js 214 B
dist/esm/actions/test/setNextBlockBaseFeePerGas.js 226 B
dist/esm/actions/test/setNextBlockTimestamp.js 213 B
dist/esm/actions/test/setNonce.js 214 B
dist/esm/actions/test/setRpcUrl.js 165 B
dist/esm/actions/test/setStorageAt.js 254 B
dist/esm/actions/test/snapshot.js 140 B
dist/esm/actions/test/stopImpersonatingAccount.js 179 B
dist/esm/actions/wallet/addChain.js 353 B
dist/esm/actions/wallet/deployContract.js 238 B
dist/esm/actions/wallet/getAddresses.js 208 B
dist/esm/actions/wallet/getPermissions.js 157 B
dist/esm/actions/wallet/index.js 244 B
dist/esm/actions/wallet/requestAddresses.js 203 B
dist/esm/actions/wallet/requestPermissions.js 161 B
dist/esm/actions/wallet/sendTransaction.js 792 B
dist/esm/actions/wallet/signMessage.js 339 B
dist/esm/actions/wallet/signTypedData.js 626 B
dist/esm/actions/wallet/switchChain.js 227 B
dist/esm/actions/wallet/watchAsset.js 174 B
dist/esm/actions/wallet/writeContract.js 260 B
dist/esm/adapters/ethers.js 551 B
dist/esm/chains.js 1.15 kB
dist/esm/clients/createClient.js 273 B
dist/esm/clients/createPublicClient.js 265 B
dist/esm/clients/createTestClient.js 273 B
dist/esm/clients/createWalletClient.js 336 B
dist/esm/clients/decorators/index.js 117 B
dist/esm/clients/decorators/public.js 693 B
dist/esm/clients/decorators/test.js 604 B
dist/esm/clients/decorators/wallet.js 351 B
dist/esm/clients/index.js 173 B
dist/esm/clients/transports/createTransport.js 236 B
dist/esm/clients/transports/custom.js 264 B
dist/esm/clients/transports/fallback.js 1.24 kB
dist/esm/clients/transports/http.js 485 B
dist/esm/clients/transports/index.js 144 B
dist/esm/clients/transports/webSocket.js 758 B
dist/esm/constants/abis.js 392 B
dist/esm/constants/index.js 159 B
dist/esm/constants/solidity.js 486 B
dist/esm/constants/unit.js 127 B
dist/esm/contract.js 297 B
dist/esm/ens.js 168 B
dist/esm/errors/abi.js 1.79 kB
dist/esm/errors/account.js 361 B
dist/esm/errors/address.js 245 B
dist/esm/errors/base.js 568 B
dist/esm/errors/block.js 317 B
dist/esm/errors/chain.js 722 B
dist/esm/errors/contract.js 1.63 kB
dist/esm/errors/data.js 309 B
dist/esm/errors/encoding.js 694 B
dist/esm/errors/ens.js 565 B
dist/esm/errors/estimateGas.js 614 B
dist/esm/errors/index.js 933 B
dist/esm/errors/log.js 254 B
dist/esm/errors/node.js 1.46 kB
dist/esm/errors/request.js 585 B
dist/esm/errors/rpc.js 1.21 kB
dist/esm/errors/transaction.js 1.72 kB
dist/esm/errors/transport.js 224 B
dist/esm/errors/utils.js 162 B
dist/esm/errors/version.js 82 B
dist/esm/ethers.js 104 B
dist/esm/index.js 1.31 kB
dist/esm/public.js 279 B
dist/esm/test.js 311 B
dist/esm/types/account.js 66 B
dist/esm/types/block.js 64 B
dist/esm/types/chain.js 64 B
dist/esm/types/contract.js 67 B
dist/esm/types/eip1193.js 234 B
dist/esm/types/ens.js 62 B
dist/esm/types/fee.js 62 B
dist/esm/types/filter.js 65 B
dist/esm/types/formatter.js 68 B
dist/esm/types/index.js 64 B
dist/esm/types/log.js 62 B
dist/esm/types/misc.js 63 B
dist/esm/types/multicall.js 68 B
dist/esm/types/rpc.js 62 B
dist/esm/types/transaction.js 70 B
dist/esm/types/transport.js 66 B
dist/esm/types/typedData.js 68 B
dist/esm/types/utils.js 64 B
dist/esm/types/window.js 65 B
dist/esm/utils/abi/decodeAbiParameters.js 1.44 kB
dist/esm/utils/abi/decodeDeployData.js 389 B
dist/esm/utils/abi/decodeErrorResult.js 496 B
dist/esm/utils/abi/decodeEventLog.js 952 B
dist/esm/utils/abi/decodeFunctionData.js 419 B
dist/esm/utils/abi/decodeFunctionResult.js 373 B
dist/esm/utils/abi/encodeAbiParameters.js 1.61 kB
dist/esm/utils/abi/encodeDeployData.js 389 B
dist/esm/utils/abi/encodeErrorResult.js 442 B
dist/esm/utils/abi/encodeEventTopics.js 679 B
dist/esm/utils/abi/encodeFunctionData.js 414 B
dist/esm/utils/abi/encodeFunctionResult.js 375 B
dist/esm/utils/abi/encodePacked.js 803 B
dist/esm/utils/abi/formatAbiItem.js 402 B
dist/esm/utils/abi/formatAbiItemWithArgs.js 309 B
dist/esm/utils/abi/getAbiItem.js 835 B
dist/esm/utils/abi/index.js 274 B
dist/esm/utils/accounts.js 127 B
dist/esm/utils/address/getAddress.js 414 B
dist/esm/utils/address/getContractAddress.js 450 B
dist/esm/utils/address/index.js 154 B
dist/esm/utils/address/isAddress.js 144 B
dist/esm/utils/address/isAddressEqual.js 220 B
dist/esm/utils/buildRequest.js 927 B
dist/esm/utils/chain.js 310 B
dist/esm/utils/contract/extractFunctionParts.js 364 B
dist/esm/utils/contract/index.js 117 B
dist/esm/utils/data/concat.js 295 B
dist/esm/utils/data/index.js 168 B
dist/esm/utils/data/isBytes.js 206 B
dist/esm/utils/data/isHex.js 163 B
dist/esm/utils/data/pad.js 489 B
dist/esm/utils/data/size.js 162 B
dist/esm/utils/data/slice.js 376 B
dist/esm/utils/data/trim.js 334 B
dist/esm/utils/encoding/fromBytes.js 357 B
dist/esm/utils/encoding/fromHex.js 463 B
dist/esm/utils/encoding/fromRlp.js 833 B
dist/esm/utils/encoding/index.js 213 B
dist/esm/utils/encoding/toBytes.js 538 B
dist/esm/utils/encoding/toHex.js 757 B
dist/esm/utils/encoding/toRlp.js 445 B
dist/esm/utils/ens/avatar/index.js 97 B
dist/esm/utils/ens/avatar/parseAvatarRecord.js 553 B
dist/esm/utils/ens/avatar/utils.js 1.94 kB
dist/esm/utils/ens/index.js 145 B
dist/esm/utils/ens/labelhash.js 227 B
dist/esm/utils/ens/namehash.js 324 B
dist/esm/utils/ens/normalize.js 138 B
dist/esm/utils/ens/packetToBytes.js 362 B
dist/esm/utils/errors/getCallError.js 237 B
dist/esm/utils/errors/getContractError.js 482 B
dist/esm/utils/errors/getEstimateGasError.js 245 B
dist/esm/utils/errors/getNodeError.js 626 B
dist/esm/utils/errors/getTransactionError.js 243 B
dist/esm/utils/errors/index.js 164 B
dist/esm/utils/filters/createFilterRequestScope.js 268 B
dist/esm/utils/formatters/block.js 432 B
dist/esm/utils/formatters/extract.js 224 B
dist/esm/utils/formatters/feeHistory.js 206 B
dist/esm/utils/formatters/format.js 234 B
dist/esm/utils/formatters/index.js 204 B
dist/esm/utils/formatters/log.js 236 B
dist/esm/utils/formatters/transaction.js 532 B
dist/esm/utils/formatters/transactionReceipt.js 470 B
dist/esm/utils/formatters/transactionRequest.js 328 B
dist/esm/utils/hash/getEventSelector.js 132 B
dist/esm/utils/hash/getFunctionSelector.js 160 B
dist/esm/utils/hash/hashFunction.js 303 B
dist/esm/utils/hash/index.js 140 B
dist/esm/utils/hash/isHash.js 150 B
dist/esm/utils/hash/keccak256.js 249 B
dist/esm/utils/index.js 821 B
dist/esm/utils/observe.js 468 B
dist/esm/utils/poll.js 309 B
dist/esm/utils/promise/index.js 124 B
dist/esm/utils/promise/withCache.js 431 B
dist/esm/utils/promise/withRetry.js 382 B
dist/esm/utils/promise/withTimeout.js 358 B
dist/esm/utils/regex.js 224 B
dist/esm/utils/rpc.js 1.44 kB
dist/esm/utils/signature/hashMessage.js 250 B
dist/esm/utils/signature/hashTypedData.js 1.24 kB
dist/esm/utils/signature/index.js 165 B
dist/esm/utils/signature/recoverAddress.js 378 B
dist/esm/utils/signature/recoverMessageAddress.js 180 B
dist/esm/utils/signature/recoverTypedDataAddress.js 223 B
dist/esm/utils/signature/verifyMessage.js 196 B
dist/esm/utils/signature/verifyTypedData.js 243 B
dist/esm/utils/stringify.js 195 B
dist/esm/utils/transaction/assertRequest.js 437 B
dist/esm/utils/transaction/assertTransaction.js 520 B
dist/esm/utils/transaction/getSerializedTransactionType.js 297 B
dist/esm/utils/transaction/getTransactionType.js 286 B
dist/esm/utils/transaction/index.js 196 B
dist/esm/utils/transaction/parseTransaction.js 1.36 kB
dist/esm/utils/transaction/prepareRequest.js 752 B
dist/esm/utils/transaction/serializeTransaction.js 955 B
dist/esm/utils/typedData.js 660 B
dist/esm/utils/uid.js 251 B
dist/esm/utils/unit/formatEther.js 172 B
dist/esm/utils/unit/formatGwei.js 172 B
dist/esm/utils/unit/formatUnits.js 298 B
dist/esm/utils/unit/index.js 139 B
dist/esm/utils/unit/parseEther.js 171 B
dist/esm/utils/unit/parseGwei.js 172 B
dist/esm/utils/unit/parseUnits.js 396 B
dist/esm/utils/wait.js 131 B
dist/esm/wallet.js 177 B
dist/esm/window.js 75 B

compressed-size-action

@fubhy
Copy link
Collaborator

fubhy commented Apr 12, 2023

Imho, there's also another issue with getAbiItem: We shouldn't specify generics to override the return type of functions. (TReturnType in this case).

This woudl be better imho:

export function getAbiItem<
  TAbi extends Abi | readonly unknown[],
  TItemName extends string,
>({
  abi,
  args = [],
  name,
}: GetAbiItemParameters<TAbi, TItemName>): GetAbiItemReturnType<
  TAbi,
  TItemName
> {
  const abiItems = (abi as Abi).filter((x) => 'name' in x && x.name === name)

  if (abiItems.length === 0) return undefined as any

  for (const abiItem of abiItems) {
    if (!('inputs' in abiItem)) continue
    if (!args || args.length === 0) {
      if (!abiItem.inputs || abiItem.inputs.length === 0) return abiItem as any
      continue
    }
    if (!abiItem.inputs) continue
    if (abiItem.inputs.length === 0) continue
    const matched = (args as readonly unknown[]).every((arg, index) => {
      const abiParameter = 'inputs' in abiItem && abiItem.inputs![index]
      if (!abiParameter) return false
      return isArgOfType(arg, abiParameter as AbiParameter)
    })
    if (matched) return abiItem as any
  }
  return abiItems[0] as any
}

@codecov
Copy link

codecov bot commented Apr 12, 2023

Codecov Report

Merging #363 (3f8d114) into main (7d3ca19) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #363   +/-   ##
=======================================
  Coverage   99.88%   99.88%           
=======================================
  Files         264      264           
  Lines       19714    19714           
  Branches     1848     1850    +2     
=======================================
  Hits        19692    19692           
  Misses         20       20           
  Partials        2        2           
Impacted Files Coverage Δ
src/actions/public/getLogs.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@tmm
Copy link
Member Author

tmm commented Apr 12, 2023

@fubhy nice catch! Want to make that a separate PR?

@tmm tmm merged commit ee1cb7f into main Apr 12, 2023
@tmm tmm deleted the tmm/get-logs-event branch April 12, 2023 16:14
@github-actions github-actions bot mentioned this pull request Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants