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: default priority fee per-chain #1006

Merged
merged 15 commits into from
Aug 10, 2023
Merged

feat: default priority fee per-chain #1006

merged 15 commits into from
Aug 10, 2023

Conversation

jxom
Copy link
Member

@jxom jxom commented Aug 9, 2023

Added fees to chain config that includes a getDefaultPriorityFee for setting a default priority fee for a chain.

import type { Chain } from 'viem'

export const example = {
  // ...
  fees: {
    getDefaultPriorityFee: () => 1_000_000n, // 0.001 gwei
  },
  // ...
} as const satifies Chain

Also cleaned up the chain serializers & formatters types. Probably makes more sense to have them in types/chain.ts rather than separate files since they aren't related to anything else apart from the chain. Will also help if we scale to more than just fees, serializers & formatters on the chain config (and also when we chose to move the chains into a separate package).


PR-Codex overview

Focus of this PR:

This PR focuses on adding a fees field to the chain configuration, which includes a defaultPriorityFee for setting a default priority fee (maxFeePerGas) for a chain.

Detailed summary:

  • Added fees field to chain config
  • fees field includes a defaultPriorityFee for setting a default priority fee (maxFeePerGas) for a chain
  • Updated multiple files to include the fees field in the chain configuration

The following files were skipped due to too many changes: src/utils/formatters/block.ts, src/index.ts, src/actions/wallet/sendTransaction.ts, src/actions/wallet/writeContract.ts, src/chains/index.ts, src/types/chain.ts, src/utils/transaction/prepareRequest.ts, src/utils/transaction/prepareRequest.test.ts

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@vercel
Copy link

vercel bot commented Aug 9, 2023

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

Name Status Preview Updated (UTC)
viem ✅ Ready (Inspect) Visit Preview Aug 10, 2023 3:43am

@changeset-bot
Copy link

changeset-bot bot commented Aug 9, 2023

🦋 Changeset detected

Latest commit: 14e6140

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

@github-actions
Copy link
Contributor

github-actions bot commented Aug 9, 2023

Size Change: +185 B (0%)

Total Size: 316 kB

Filename Size Change
dist/cjs/actions/public/estimateGas.js 828 B +6 B (+1%)
dist/cjs/chains/index.js 1.55 kB +32 B (+2%)
dist/cjs/types/formatter.js 0 B -127 B (removed) 🏆
dist/cjs/types/serializer.js 0 B -128 B (removed) 🏆
dist/cjs/utils/chain.js 530 B +27 B (+5%) 🔍
dist/cjs/utils/transaction/prepareRequest.js 944 B +78 B (+9%) 🔍
dist/esm/actions/public/estimateGas.js 1.18 kB +7 B (+1%)
dist/esm/actions/wallet/sendTransaction.js 1.48 kB +1 B (0%)
dist/esm/chains/celo/formatters.js 574 B +2 B (0%)
dist/esm/chains/index.js 1.11 kB +27 B (+2%)
dist/esm/chains/optimism/formatters.js 592 B +2 B (0%)
dist/esm/types/formatter.js 0 B -68 B (removed) 🏆
dist/esm/types/serializer.js 0 B -69 B (removed) 🏆
dist/esm/utils/chain.js 437 B +24 B (+6%) 🔍
dist/esm/utils/transaction/prepareRequest.js 905 B +76 B (+9%) 🔍
dist/cjs/chains/optimism/fees.js 170 B +170 B (new file) 🆕
dist/esm/chains/optimism/fees.js 125 B +125 B (new file) 🆕
ℹ️ View Unchanged
Filename Size
dist/cjs/abi.js 376 B
dist/cjs/accounts/generateMnemonic.js 220 B
dist/cjs/accounts/generatePrivateKey.js 267 B
dist/cjs/accounts/hdKeyToAccount.js 375 B
dist/cjs/accounts/index.js 797 B
dist/cjs/accounts/mnemonicToAccount.js 296 B
dist/cjs/accounts/privateKeyToAccount.js 511 B
dist/cjs/accounts/toAccount.js 393 B
dist/cjs/accounts/types.js 124 B
dist/cjs/accounts/utils/parseAccount.js 225 B
dist/cjs/accounts/utils/publicKeyToAddress.js 298 B
dist/cjs/accounts/utils/sign.js 332 B
dist/cjs/accounts/utils/signMessage.js 303 B
dist/cjs/accounts/utils/signTransaction.js 333 B
dist/cjs/accounts/utils/signTypedData.js 313 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 826 B
dist/cjs/actions/ens/getEnsAvatar.js 390 B
dist/cjs/actions/ens/getEnsName.js 646 B
dist/cjs/actions/ens/getEnsResolver.js 599 B
dist/cjs/actions/ens/getEnsText.js 752 B
dist/cjs/actions/getContract.js 1.07 kB
dist/cjs/actions/index.js 2.13 kB
dist/cjs/actions/public/call.js 1.8 kB
dist/cjs/actions/public/createBlockFilter.js 320 B
dist/cjs/actions/public/createContractEventFilter.js 548 B
dist/cjs/actions/public/createEventFilter.js 652 B
dist/cjs/actions/public/createPendingTransactionFilter.js 326 B
dist/cjs/actions/public/estimateContractGas.js 504 B
dist/cjs/actions/public/getBalance.js 350 B
dist/cjs/actions/public/getBlock.js 534 B
dist/cjs/actions/public/getBlockNumber.js 394 B
dist/cjs/actions/public/getBlockTransactionCount.js 427 B
dist/cjs/actions/public/getBytecode.js 369 B
dist/cjs/actions/public/getChainId.js 282 B
dist/cjs/actions/public/getFeeHistory.js 406 B
dist/cjs/actions/public/getFilterChanges.js 656 B
dist/cjs/actions/public/getFilterLogs.js 636 B
dist/cjs/actions/public/getGasPrice.js 232 B
dist/cjs/actions/public/getLogs.js 890 B
dist/cjs/actions/public/getStorageAt.js 359 B
dist/cjs/actions/public/getTransaction.js 563 B
dist/cjs/actions/public/getTransactionConfirmations.js 367 B
dist/cjs/actions/public/getTransactionCount.js 355 B
dist/cjs/actions/public/getTransactionReceipt.js 372 B
dist/cjs/actions/public/multicall.js 1.16 kB
dist/cjs/actions/public/readContract.js 477 B
dist/cjs/actions/public/simulateContract.js 639 B
dist/cjs/actions/public/uninstallFilter.js 232 B
dist/cjs/actions/public/verifyHash.js 542 B
dist/cjs/actions/public/verifyMessage.js 311 B
dist/cjs/actions/public/verifyTypedData.js 336 B
dist/cjs/actions/public/waitForTransactionReceipt.js 1.19 kB
dist/cjs/actions/public/watchBlockNumber.js 889 B
dist/cjs/actions/public/watchBlocks.js 997 B
dist/cjs/actions/public/watchContractEvent.js 974 B
dist/cjs/actions/public/watchEvent.js 925 B
dist/cjs/actions/public/watchPendingTransactions.js 911 B
dist/cjs/actions/test/dropTransaction.js 233 B
dist/cjs/actions/test/getAutomine.js 255 B
dist/cjs/actions/test/getTxpoolContent.js 218 B
dist/cjs/actions/test/getTxpoolStatus.js 312 B
dist/cjs/actions/test/impersonateAccount.js 238 B
dist/cjs/actions/test/increaseTime.js 287 B
dist/cjs/actions/test/inspectTxpool.js 214 B
dist/cjs/actions/test/mine.js 346 B
dist/cjs/actions/test/removeBlockTimestampInterval.js 226 B
dist/cjs/actions/test/reset.js 261 B
dist/cjs/actions/test/revert.js 217 B
dist/cjs/actions/test/sendUnsignedTransaction.js 473 B
dist/cjs/actions/test/setAutomine.js 283 B
dist/cjs/actions/test/setBalance.js 337 B
dist/cjs/actions/test/setBlockGasLimit.js 288 B
dist/cjs/actions/test/setBlockTimestampInterval.js 243 B
dist/cjs/actions/test/setCode.js 236 B
dist/cjs/actions/test/setCoinbase.js 233 B
dist/cjs/actions/test/setIntervalMining.js 230 B
dist/cjs/actions/test/setLoggingEnabled.js 235 B
dist/cjs/actions/test/setMinGasPrice.js 289 B
dist/cjs/actions/test/setNextBlockBaseFeePerGas.js 301 B
dist/cjs/actions/test/setNextBlockTimestamp.js 291 B
dist/cjs/actions/test/setNonce.js 291 B
dist/cjs/actions/test/setRpcUrl.js 229 B
dist/cjs/actions/test/setStorageAt.js 331 B
dist/cjs/actions/test/snapshot.js 209 B
dist/cjs/actions/test/stopImpersonatingAccount.js 241 B
dist/cjs/actions/wallet/addChain.js 427 B
dist/cjs/actions/wallet/deployContract.js 324 B
dist/cjs/actions/wallet/getAddresses.js 282 B
dist/cjs/actions/wallet/getPermissions.js 222 B
dist/cjs/actions/wallet/requestAddresses.js 279 B
dist/cjs/actions/wallet/requestPermissions.js 228 B
dist/cjs/actions/wallet/sendTransaction.js 958 B
dist/cjs/actions/wallet/signMessage.js 517 B
dist/cjs/actions/wallet/signTypedData.js 758 B
dist/cjs/actions/wallet/switchChain.js 309 B
dist/cjs/actions/wallet/watchAsset.js 235 B
dist/cjs/actions/wallet/writeContract.js 386 B
dist/cjs/chains/celo/formatters.js 641 B
dist/cjs/chains/celo/serializers.js 1.19 kB
dist/cjs/chains/celo/types.js 124 B
dist/cjs/chains/optimism/formatters.js 650 B
dist/cjs/chains/optimism/types.js 124 B
dist/cjs/chains/utils.js 304 B
dist/cjs/clients/createClient.js 570 B
dist/cjs/clients/createPublicClient.js 318 B
dist/cjs/clients/createTestClient.js 347 B
dist/cjs/clients/createWalletClient.js 356 B
dist/cjs/clients/decorators/public.js 1.1 kB
dist/cjs/clients/decorators/test.js 937 B
dist/cjs/clients/decorators/wallet.js 535 B
dist/cjs/clients/transports/createTransport.js 308 B
dist/cjs/clients/transports/custom.js 341 B
dist/cjs/clients/transports/fallback.js 1.34 kB
dist/cjs/clients/transports/http.js 805 B
dist/cjs/clients/transports/webSocket.js 894 B
dist/cjs/constants/abis.js 750 B
dist/cjs/constants/address.js 154 B
dist/cjs/constants/contract.js 167 B
dist/cjs/constants/contracts.js 1.32 kB
dist/cjs/constants/number.js 975 B
dist/cjs/constants/solidity.js 552 B
dist/cjs/constants/unit.js 198 B
dist/cjs/contract.js 837 B
dist/cjs/ens.js 414 B
dist/cjs/errors/abi.js 2.18 kB
dist/cjs/errors/account.js 422 B
dist/cjs/errors/address.js 300 B
dist/cjs/errors/base.js 723 B
dist/cjs/errors/block.js 372 B
dist/cjs/errors/ccip.js 776 B
dist/cjs/errors/chain.js 853 B
dist/cjs/errors/contract.js 2.12 kB
dist/cjs/errors/data.js 474 B
dist/cjs/errors/encoding.js 900 B
dist/cjs/errors/ens.js 661 B
dist/cjs/errors/estimateGas.js 693 B
dist/cjs/errors/log.js 310 B
dist/cjs/errors/node.js 1.62 kB
dist/cjs/errors/request.js 691 B
dist/cjs/errors/rpc.js 1.69 kB
dist/cjs/errors/transaction.js 1.91 kB
dist/cjs/errors/transport.js 296 B
dist/cjs/errors/utils.js 256 B
dist/cjs/errors/version.js 149 B
dist/cjs/index.js 6.08 kB
dist/cjs/public.js 881 B
dist/cjs/test.js 950 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 285 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/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.58 kB
dist/cjs/utils/abi/decodeDeployData.js 462 B
dist/cjs/utils/abi/decodeErrorResult.js 595 B
dist/cjs/utils/abi/decodeEventLog.js 1.11 kB
dist/cjs/utils/abi/decodeFunctionData.js 525 B
dist/cjs/utils/abi/decodeFunctionResult.js 484 B
dist/cjs/utils/abi/encodeAbiParameters.js 1.78 kB
dist/cjs/utils/abi/encodeDeployData.js 470 B
dist/cjs/utils/abi/encodeErrorResult.js 570 B
dist/cjs/utils/abi/encodeEventTopics.js 888 B
dist/cjs/utils/abi/encodeFunctionData.js 566 B
dist/cjs/utils/abi/encodeFunctionResult.js 512 B
dist/cjs/utils/abi/encodePacked.js 907 B
dist/cjs/utils/abi/formatAbiItem.js 488 B
dist/cjs/utils/abi/formatAbiItemWithArgs.js 386 B
dist/cjs/utils/abi/getAbiItem.js 929 B
dist/cjs/utils/accounts.js 262 B
dist/cjs/utils/address/getAddress.js 571 B
dist/cjs/utils/address/getContractAddress.js 616 B
dist/cjs/utils/address/isAddress.js 215 B
dist/cjs/utils/address/isAddressEqual.js 296 B
dist/cjs/utils/buildRequest.js 1.01 kB
dist/cjs/utils/ccip.js 1.26 kB
dist/cjs/utils/contract/extractFunctionParts.js 463 B
dist/cjs/utils/data/concat.js 381 B
dist/cjs/utils/data/isBytes.js 273 B
dist/cjs/utils/data/isBytesEqual.js 288 B
dist/cjs/utils/data/isHex.js 263 B
dist/cjs/utils/data/pad.js 578 B
dist/cjs/utils/data/size.js 250 B
dist/cjs/utils/data/slice.js 583 B
dist/cjs/utils/data/trim.js 413 B
dist/cjs/utils/encoding/fromBytes.js 640 B
dist/cjs/utils/encoding/fromHex.js 810 B
dist/cjs/utils/encoding/fromRlp.js 915 B
dist/cjs/utils/encoding/toBytes.js 781 B
dist/cjs/utils/encoding/toHex.js 936 B
dist/cjs/utils/encoding/toRlp.js 543 B
dist/cjs/utils/ens/avatar/parseAvatarRecord.js 626 B
dist/cjs/utils/ens/avatar/utils.js 2.08 kB
dist/cjs/utils/ens/encodedLabelToLabelhash.js 303 B
dist/cjs/utils/ens/encodeLabelhash.js 193 B
dist/cjs/utils/ens/errors.js 465 B
dist/cjs/utils/ens/labelhash.js 349 B
dist/cjs/utils/ens/namehash.js 487 B
dist/cjs/utils/ens/normalize.js 217 B
dist/cjs/utils/ens/packetToBytes.js 490 B
dist/cjs/utils/errors/getCallError.js 317 B
dist/cjs/utils/errors/getContractError.js 589 B
dist/cjs/utils/errors/getEstimateGasError.js 321 B
dist/cjs/utils/errors/getNodeError.js 693 B
dist/cjs/utils/errors/getTransactionError.js 317 B
dist/cjs/utils/filters/createFilterRequestScope.js 332 B
dist/cjs/utils/formatters/block.js 509 B
dist/cjs/utils/formatters/extract.js 273 B
dist/cjs/utils/formatters/feeHistory.js 273 B
dist/cjs/utils/formatters/formatter.js 307 B
dist/cjs/utils/formatters/log.js 308 B
dist/cjs/utils/formatters/transaction.js 622 B
dist/cjs/utils/formatters/transactionReceipt.js 559 B
dist/cjs/utils/formatters/transactionRequest.js 401 B
dist/cjs/utils/hash/getEventSelector.js 256 B
dist/cjs/utils/hash/getFunctionSelector.js 282 B
dist/cjs/utils/hash/hashFunction.js 414 B
dist/cjs/utils/hash/isHash.js 239 B
dist/cjs/utils/hash/keccak256.js 354 B
dist/cjs/utils/index.js 2.96 kB
dist/cjs/utils/observe.js 542 B
dist/cjs/utils/poll.js 384 B
dist/cjs/utils/promise/createBatchScheduler.js 626 B
dist/cjs/utils/promise/withCache.js 517 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.67 kB
dist/cjs/utils/signature/hashMessage.js 421 B
dist/cjs/utils/signature/hashTypedData.js 1.36 kB
dist/cjs/utils/signature/hexToSignature.js 340 B
dist/cjs/utils/signature/recoverAddress.js 279 B
dist/cjs/utils/signature/recoverMessageAddress.js 265 B
dist/cjs/utils/signature/recoverPublicKey.js 481 B
dist/cjs/utils/signature/recoverTypedDataAddress.js 311 B
dist/cjs/utils/signature/signatureToHex.js 331 B
dist/cjs/utils/signature/verifyMessage.js 298 B
dist/cjs/utils/signature/verifyTypedData.js 338 B
dist/cjs/utils/stringify.js 258 B
dist/cjs/utils/transaction/assertRequest.js 537 B
dist/cjs/utils/transaction/assertTransaction.js 646 B
dist/cjs/utils/transaction/getSerializedTransactionType.js 384 B
dist/cjs/utils/transaction/getTransactionType.js 358 B
dist/cjs/utils/transaction/parseTransaction.js 1.51 kB
dist/cjs/utils/transaction/serializeAccessList.js 459 B
dist/cjs/utils/transaction/serializeTransaction.js 879 B
dist/cjs/utils/typedData.js 756 B
dist/cjs/utils/uid.js 316 B
dist/cjs/utils/unit/formatEther.js 251 B
dist/cjs/utils/unit/formatGwei.js 250 B
dist/cjs/utils/unit/formatUnits.js 360 B
dist/cjs/utils/unit/parseEther.js 251 B
dist/cjs/utils/unit/parseGwei.js 250 B
dist/cjs/utils/unit/parseUnits.js 542 B
dist/cjs/utils/wait.js 197 B
dist/cjs/wallet.js 467 B
dist/cjs/window.js 143 B
dist/esm/abi.js 175 B
dist/esm/accounts/generateMnemonic.js 239 B
dist/esm/accounts/generatePrivateKey.js 231 B
dist/esm/accounts/hdKeyToAccount.js 335 B
dist/esm/accounts/index.js 350 B
dist/esm/accounts/mnemonicToAccount.js 263 B
dist/esm/accounts/privateKeyToAccount.js 453 B
dist/esm/accounts/toAccount.js 370 B
dist/esm/accounts/types.js 64 B
dist/esm/accounts/utils/parseAccount.js 157 B
dist/esm/accounts/utils/publicKeyToAddress.js 282 B
dist/esm/accounts/utils/sign.js 327 B
dist/esm/accounts/utils/signMessage.js 354 B
dist/esm/accounts/utils/signTransaction.js 243 B
dist/esm/accounts/utils/signTypedData.js 382 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 1.3 kB
dist/esm/actions/ens/getEnsAvatar.js 918 B
dist/esm/actions/ens/getEnsName.js 935 B
dist/esm/actions/ens/getEnsResolver.js 1.1 kB
dist/esm/actions/ens/getEnsText.js 1.22 kB
dist/esm/actions/getContract.js 1.53 kB
dist/esm/actions/index.js 890 B
dist/esm/actions/public/call.js 2.25 kB
dist/esm/actions/public/createBlockFilter.js 601 B
dist/esm/actions/public/createContractEventFilter.js 784 B
dist/esm/actions/public/createEventFilter.js 939 B
dist/esm/actions/public/createPendingTransactionFilter.js 622 B
dist/esm/actions/public/estimateContractGas.js 846 B
dist/esm/actions/public/getBalance.js 718 B
dist/esm/actions/public/getBlock.js 820 B
dist/esm/actions/public/getBlockNumber.js 659 B
dist/esm/actions/public/getBlockTransactionCount.js 671 B
dist/esm/actions/public/getBytecode.js 619 B
dist/esm/actions/public/getChainId.js 481 B
dist/esm/actions/public/getFeeHistory.js 622 B
dist/esm/actions/public/getFilterChanges.js 1.39 kB
dist/esm/actions/public/getFilterLogs.js 1.08 kB
dist/esm/actions/public/getGasPrice.js 434 B
dist/esm/actions/public/getLogs.js 1.24 kB
dist/esm/actions/public/getStorageAt.js 631 B
dist/esm/actions/public/getTransaction.js 911 B
dist/esm/actions/public/getTransactionConfirmations.js 741 B
dist/esm/actions/public/getTransactionCount.js 639 B
dist/esm/actions/public/getTransactionReceipt.js 721 B
dist/esm/actions/public/multicall.js 1.59 kB
dist/esm/actions/public/readContract.js 1.07 kB
dist/esm/actions/public/simulateContract.js 1.2 kB
dist/esm/actions/public/uninstallFilter.js 568 B
dist/esm/actions/public/verifyHash.js 694 B
dist/esm/actions/public/verifyMessage.js 465 B
dist/esm/actions/public/verifyTypedData.js 406 B
dist/esm/actions/public/waitForTransactionReceipt.js 2.22 kB
dist/esm/actions/public/watchBlockNumber.js 1.41 kB
dist/esm/actions/public/watchBlocks.js 1.56 kB
dist/esm/actions/public/watchContractEvent.js 1.71 kB
dist/esm/actions/public/watchEvent.js 1.66 kB
dist/esm/actions/public/watchPendingTransactions.js 1.35 kB
dist/esm/actions/test/dropTransaction.js 441 B
dist/esm/actions/test/getAutomine.js 425 B
dist/esm/actions/test/getTxpoolContent.js 443 B
dist/esm/actions/test/getTxpoolStatus.js 517 B
dist/esm/actions/test/impersonateAccount.js 490 B
dist/esm/actions/test/increaseTime.js 447 B
dist/esm/actions/test/inspectTxpool.js 447 B
dist/esm/actions/test/mine.js 477 B
dist/esm/actions/test/removeBlockTimestampInterval.js 358 B
dist/esm/actions/test/reset.js 421 B
dist/esm/actions/test/revert.js 384 B
dist/esm/actions/test/sendUnsignedTransaction.js 841 B
dist/esm/actions/test/setAutomine.js 443 B
dist/esm/actions/test/setBalance.js 540 B
dist/esm/actions/test/setBlockGasLimit.js 432 B
dist/esm/actions/test/setBlockTimestampInterval.js 467 B
dist/esm/actions/test/setCode.js 511 B
dist/esm/actions/test/setCoinbase.js 440 B
dist/esm/actions/test/setIntervalMining.js 421 B
dist/esm/actions/test/setLoggingEnabled.js 361 B
dist/esm/actions/test/setMinGasPrice.js 525 B
dist/esm/actions/test/setNextBlockBaseFeePerGas.js 462 B
dist/esm/actions/test/setNextBlockTimestamp.js 440 B
dist/esm/actions/test/setNonce.js 493 B
dist/esm/actions/test/setRpcUrl.js 389 B
dist/esm/actions/test/setStorageAt.js 538 B
dist/esm/actions/test/snapshot.js 336 B
dist/esm/actions/test/stopImpersonatingAccount.js 473 B
dist/esm/actions/wallet/addChain.js 599 B
dist/esm/actions/wallet/deployContract.js 657 B
dist/esm/actions/wallet/getAddresses.js 487 B
dist/esm/actions/wallet/getPermissions.js 417 B
dist/esm/actions/wallet/requestAddresses.js 613 B
dist/esm/actions/wallet/requestPermissions.js 458 B
dist/esm/actions/wallet/signMessage.js 1.04 kB
dist/esm/actions/wallet/signTypedData.js 1.51 kB
dist/esm/actions/wallet/switchChain.js 489 B
dist/esm/actions/wallet/watchAsset.js 577 B
dist/esm/actions/wallet/writeContract.js 1.1 kB
dist/esm/chains/celo/serializers.js 1.41 kB
dist/esm/chains/celo/types.js 64 B
dist/esm/chains/optimism/types.js 64 B
dist/esm/chains/utils.js 150 B
dist/esm/clients/createClient.js 499 B
dist/esm/clients/createPublicClient.js 238 B
dist/esm/clients/createTestClient.js 261 B
dist/esm/clients/createWalletClient.js 271 B
dist/esm/clients/decorators/public.js 875 B
dist/esm/clients/decorators/test.js 766 B
dist/esm/clients/decorators/wallet.js 414 B
dist/esm/clients/transports/createTransport.js 280 B
dist/esm/clients/transports/custom.js 327 B
dist/esm/clients/transports/fallback.js 1.46 kB
dist/esm/clients/transports/http.js 792 B
dist/esm/clients/transports/webSocket.js 888 B
dist/esm/constants/abis.js 826 B
dist/esm/constants/address.js 87 B
dist/esm/constants/contract.js 104 B
dist/esm/constants/contracts.js 1.24 kB
dist/esm/constants/number.js 636 B
dist/esm/constants/solidity.js 550 B
dist/esm/constants/unit.js 127 B
dist/esm/contract.js 380 B
dist/esm/ens.js 189 B
dist/esm/errors/abi.js 1.83 kB
dist/esm/errors/account.js 361 B
dist/esm/errors/address.js 245 B
dist/esm/errors/base.js 665 B
dist/esm/errors/block.js 317 B
dist/esm/errors/ccip.js 682 B
dist/esm/errors/chain.js 746 B
dist/esm/errors/contract.js 1.95 kB
dist/esm/errors/data.js 403 B
dist/esm/errors/encoding.js 757 B
dist/esm/errors/ens.js 565 B
dist/esm/errors/estimateGas.js 619 B
dist/esm/errors/log.js 254 B
dist/esm/errors/node.js 1.62 kB
dist/esm/errors/request.js 587 B
dist/esm/errors/rpc.js 1.75 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/index.js 2.34 kB
dist/esm/public.js 382 B
dist/esm/test.js 433 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 249 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/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 2.04 kB
dist/esm/utils/abi/decodeDeployData.js 388 B
dist/esm/utils/abi/decodeErrorResult.js 502 B
dist/esm/utils/abi/decodeEventLog.js 1.07 kB
dist/esm/utils/abi/decodeFunctionData.js 426 B
dist/esm/utils/abi/decodeFunctionResult.js 404 B
dist/esm/utils/abi/encodeAbiParameters.js 1.91 kB
dist/esm/utils/abi/encodeDeployData.js 389 B
dist/esm/utils/abi/encodeErrorResult.js 476 B
dist/esm/utils/abi/encodeEventTopics.js 778 B
dist/esm/utils/abi/encodeFunctionData.js 462 B
dist/esm/utils/abi/encodeFunctionResult.js 429 B
dist/esm/utils/abi/encodePacked.js 838 B
dist/esm/utils/abi/formatAbiItem.js 400 B
dist/esm/utils/abi/formatAbiItemWithArgs.js 307 B
dist/esm/utils/abi/getAbiItem.js 1.01 kB
dist/esm/utils/accounts.js 276 B
dist/esm/utils/address/getAddress.js 470 B
dist/esm/utils/address/getContractAddress.js 468 B
dist/esm/utils/address/isAddress.js 144 B
dist/esm/utils/address/isAddressEqual.js 217 B
dist/esm/utils/buildRequest.js 1.11 kB
dist/esm/utils/ccip.js 1.14 kB
dist/esm/utils/contract/extractFunctionParts.js 364 B
dist/esm/utils/data/concat.js 295 B
dist/esm/utils/data/isBytes.js 206 B
dist/esm/utils/data/isBytesEqual.js 209 B
dist/esm/utils/data/isHex.js 201 B
dist/esm/utils/data/pad.js 489 B
dist/esm/utils/data/size.js 255 B
dist/esm/utils/data/slice.js 600 B
dist/esm/utils/data/trim.js 350 B
dist/esm/utils/encoding/fromBytes.js 902 B
dist/esm/utils/encoding/fromHex.js 1.12 kB
dist/esm/utils/encoding/fromRlp.js 835 B
dist/esm/utils/encoding/toBytes.js 1.1 kB
dist/esm/utils/encoding/toHex.js 1.25 kB
dist/esm/utils/encoding/toRlp.js 444 B
dist/esm/utils/ens/avatar/parseAvatarRecord.js 697 B
dist/esm/utils/ens/avatar/utils.js 2.27 kB
dist/esm/utils/ens/encodedLabelToLabelhash.js 227 B
dist/esm/utils/ens/encodeLabelhash.js 119 B
dist/esm/utils/ens/errors.js 478 B
dist/esm/utils/ens/labelhash.js 609 B
dist/esm/utils/ens/namehash.js 804 B
dist/esm/utils/ens/normalize.js 352 B
dist/esm/utils/ens/packetToBytes.js 538 B
dist/esm/utils/errors/getCallError.js 239 B
dist/esm/utils/errors/getContractError.js 526 B
dist/esm/utils/errors/getEstimateGasError.js 244 B
dist/esm/utils/errors/getNodeError.js 637 B
dist/esm/utils/errors/getTransactionError.js 239 B
dist/esm/utils/filters/createFilterRequestScope.js 349 B
dist/esm/utils/formatters/block.js 446 B
dist/esm/utils/formatters/extract.js 303 B
dist/esm/utils/formatters/feeHistory.js 206 B
dist/esm/utils/formatters/formatter.js 242 B
dist/esm/utils/formatters/log.js 238 B
dist/esm/utils/formatters/transaction.js 553 B
dist/esm/utils/formatters/transactionReceipt.js 486 B
dist/esm/utils/formatters/transactionRequest.js 337 B
dist/esm/utils/hash/getEventSelector.js 183 B
dist/esm/utils/hash/getFunctionSelector.js 205 B
dist/esm/utils/hash/hashFunction.js 312 B
dist/esm/utils/hash/isHash.js 154 B
dist/esm/utils/hash/keccak256.js 266 B
dist/esm/utils/index.js 1.18 kB
dist/esm/utils/observe.js 589 B
dist/esm/utils/poll.js 345 B
dist/esm/utils/promise/createBatchScheduler.js 576 B
dist/esm/utils/promise/withCache.js 691 B
dist/esm/utils/promise/withRetry.js 382 B
dist/esm/utils/promise/withTimeout.js 358 B
dist/esm/utils/regex.js 322 B
dist/esm/utils/rpc.js 1.86 kB
dist/esm/utils/signature/hashMessage.js 330 B
dist/esm/utils/signature/hashTypedData.js 1.42 kB
dist/esm/utils/signature/hexToSignature.js 461 B
dist/esm/utils/signature/recoverAddress.js 198 B
dist/esm/utils/signature/recoverMessageAddress.js 180 B
dist/esm/utils/signature/recoverPublicKey.js 498 B
dist/esm/utils/signature/recoverTypedDataAddress.js 223 B
dist/esm/utils/signature/signatureToHex.js 457 B
dist/esm/utils/signature/verifyMessage.js 457 B
dist/esm/utils/signature/verifyTypedData.js 498 B
dist/esm/utils/stringify.js 195 B
dist/esm/utils/transaction/assertRequest.js 451 B
dist/esm/utils/transaction/assertTransaction.js 537 B
dist/esm/utils/transaction/getSerializedTransactionType.js 301 B
dist/esm/utils/transaction/getTransactionType.js 286 B
dist/esm/utils/transaction/parseTransaction.js 1.39 kB
dist/esm/utils/transaction/serializeAccessList.js 515 B
dist/esm/utils/transaction/serializeTransaction.js 779 B
dist/esm/utils/typedData.js 738 B
dist/esm/utils/uid.js 251 B
dist/esm/utils/unit/formatEther.js 171 B
dist/esm/utils/unit/formatGwei.js 171 B
dist/esm/utils/unit/formatUnits.js 298 B
dist/esm/utils/unit/parseEther.js 170 B
dist/esm/utils/unit/parseGwei.js 171 B
dist/esm/utils/unit/parseUnits.js 522 B
dist/esm/utils/wait.js 131 B
dist/esm/wallet.js 217 B
dist/esm/window.js 75 B

compressed-size-action

@codecov
Copy link

codecov bot commented Aug 9, 2023

Codecov Report

Merging #1006 (dd74ecf) into main (6df4308) will decrease coverage by 2.38%.
The diff coverage is 99.64%.

❗ Current head dd74ecf differs from pull request most recent head 14e6140. Consider uploading reports for the commit 14e6140 to get more accurate results

@@            Coverage Diff             @@
##             main    #1006      +/-   ##
==========================================
- Coverage   99.81%   97.43%   -2.38%     
==========================================
  Files         264      260       -4     
  Lines       25802    25622     -180     
  Branches     2080     1830     -250     
==========================================
- Hits        25754    24966     -788     
- Misses         45      653     +608     
  Partials        3        3              
Files Changed Coverage Δ
src/actions/wallet/sendTransaction.ts 81.05% <88.88%> (-18.95%) ⬇️
src/actions/public/estimateGas.ts 96.68% <100.00%> (-3.32%) ⬇️
src/actions/public/simulateContract.ts 92.26% <100.00%> (-7.74%) ⬇️
src/actions/wallet/deployContract.ts 100.00% <100.00%> (ø)
src/actions/wallet/writeContract.ts 99.27% <100.00%> (-0.73%) ⬇️
src/chains/celo/formatters.ts 85.88% <100.00%> (-14.12%) ⬇️
src/chains/celo/serializers.ts 100.00% <100.00%> (ø)
src/chains/index.ts 92.35% <100.00%> (+0.80%) ⬆️
src/chains/optimism/fees.ts 100.00% <100.00%> (ø)
src/chains/optimism/formatters.ts 100.00% <100.00%> (ø)
... and 10 more

... and 48 files with indirect coverage changes

src/index.ts Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deprecated 💆‍♂️

Comment on lines 33 to 39
config?: ChainConfig<formatters>,
): Assign<chain, ChainConfig<formatters>> {
const {
fees = chain.fees,
formatters = chain.formatters,
serializers = chain.serializers,
} = config || {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick

Suggested change
config?: ChainConfig<formatters>,
): Assign<chain, ChainConfig<formatters>> {
const {
fees = chain.fees,
formatters = chain.formatters,
serializers = chain.serializers,
} = config || {}
config: ChainConfig<formatters> = {},
): Assign<chain, ChainConfig<formatters>> {
const {
fees = chain.fees,
formatters = chain.formatters,
serializers = chain.serializers,
} = config

Comment on lines 32 to 37
getDefaultPriorityFee(args: {
block: Prettify<FormattedBlock<{ formatters: formatters }>>
request: PrepareRequestParameters<
Omit<Chain, 'formatters'> & { formatters: formatters }
>
}): Promise<bigint> | bigint
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not worth adding another type here, but think it's worthwhile if this could also just be a bigint in addition to async/sync function that returns bigint? In that world, maybe it makes sense to rename the key from getDefaultPriorityFee to defaultPriorityFee.

import type { ChainFees } from '../../types/chain.js'

export const feesOptimism = {
  defaultPriorityFee: 1_000_000n, // 0.001 gwei
} as const satisfies ChainFees

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense!

@jxom jxom merged commit 7311e20 into main Aug 10, 2023
7 of 12 checks passed
@jxom jxom deleted the jxom/chain-fees branch August 10, 2023 03:44
@github-actions github-actions bot mentioned this pull request Aug 10, 2023
block,
request: request as PrepareRequestParameters,
})
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:chefkiss:

aaronmgdr pushed a commit to celo-org/viem that referenced this pull request Aug 18, 2023
* feat: optimism transaction receipt formatter

* refactor: restructure

* feat: chain fees config

* chore: changeset

* chore: update test

* chore: impl

* refactor: cleanup formatters & serializers types

* chore: fix

* refactor

* chore: snapshots

* Update sweet-lemons-explain.md

* Update sweet-lemons-explain.md

* refactor

* refactor

* refactor
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.

3 participants