Skip to content

Latest commit

 

History

History
1700 lines (984 loc) · 81.6 KB

CHANGELOG.md

File metadata and controls

1700 lines (984 loc) · 81.6 KB

viem

1.6.4

Patch Changes

  • #1040 1e5bd4a0 Thanks @jxom! - Made value optional on writeContract/simulateContract for payable functions.
  • #1022 2eb56bc7 Thanks @Songkeys! - Fixed an issue where waitForTransactionReceipt would be infinitely pending when an error is thrown after a transaction has been replaced.

1.6.3

Patch Changes

1.6.2

Patch Changes

1.6.1

Patch Changes

1.6.0

Minor Changes

  • #984 e1032c7b Thanks @holic! - Added signTransaction & privateKeyToAddress exports to viem/accounts entrypoint.
  • #1006 7311e201 Thanks @jxom! - Added fees to chain config that includes a defaultPriorityFee for setting a default priority fee (maxPriorityFeePerGas) for a chain.

    import type { Chain } from 'viem'
    
    export const example = {
      // ...
      fees: {
        defaultPriorityFee: 1_000_000n, // 0.001 gwei
        // or
        async defaultPriorityFee() {
          // ... some async behavior to derive the fee.
        }
      },
      // ...
    } as const satifies Chain
  • #886 fef66bfb Thanks @jxom! - Added formatter for Optimism transaction receipts (format l1GasPrice, l1GasUsed, etc).
  • #886 fef66bfb Thanks @jxom! - Added entrypoints for chain utilities (viem/chains/utils) with exports for chain-specific chains, formatters, serializers, and types.

    Examples:

    import {
      type CeloBlock,
      type CeloTransaction,
      type OptimismBlock,
      type OptimismTransaction,
      serializeTransactionCelo,
    } from 'viem/chains/utils'

Patch Changes

  • #1008 9d93953f Thanks @holic! - Added "already known" as a node message matcher to NonceTooLowError.

1.5.4

Patch Changes

  • #999 de94d81f Thanks @jxom! - Support passing gasPrice for chains that include baseFeePerGas but do not support EIP-1559 Transactions (e.g. BSC).

1.5.3

Patch Changes

  • ae4ab844 Thanks @jxom! - Fixed performance bottleneck in ABI encoding for dynamic bytes.

1.5.2

Patch Changes

  • #974 11410bab Thanks @jxom! - Fixed issue where getFunctionSelector & getEventSelector were returning incorrect selectors for tuple parameters.

1.5.1

Patch Changes

  • #954 e98e2651 Thanks @jaxernst! - Added filter reinitialization logic for watchContractEvent and watchEvent for when a filter has been uninstalled.
  • #967 eb8954a0 Thanks @Zil-B! - Moved @types/ws into dependencies to fix an issue where required runtime types weren't being exported.

1.5.0

Minor Changes

  • #847 1e5d4545 Thanks @jxom! - Narrowed getBlock, watchBlocks, getFilterChanges, getFilterLogs & getLogs return types for when blockTag or includeTransactions is provided.

    • When blockTag !== 'pending', the return type will now include some non-nullish properties if it were dependent on pending blocks. Example: For getBlock, the block.number type is now non-nullish since blockTag !== 'pending'.
    • On the other hand, when blockTag: 'pending', some properties will be nullish. Example: For getBlock, the block.number type is now null since blockTag === 'pending'.
    • When includeTransactions is provided, the return type of will narrow the transactions property type. Example: block.transactions will be Transaction[] when includeTransactions: true instead of Hash[] | Transaction[].

    TLDR;

    // Before
    const block = publicClient.getBlock({ includeTransactions: true });
    block.transactions;
    //    ^? Hash[] | Transaction[]
    block.transactions[0].blockNumber;
    //                    ^? bigint | null
    
    // After
    const block = publicClient.getBlock({ includeTransactions: true });
    block.transactions;
    //    ^? Transaction[]
    block.transactions[0].blockNumber;
    //                    ^? bigint
    
    // Before
    const block = publicClient.getBlock({
      blockTag: "pending",
      includeTransactions: true
    });
    block.number;
    //    ^? number | null
    block.transactions[0].blockNumber;
    //                    ^? bigint | null
    
    // After
    const block = publicClient.getBlock({
      blockTag: "pending",
      includeTransactions: true
    });
    block.number;
    //    ^? null
    block.transactions[0].blockNumber;
    //                    ^? null
  • #847 1e5d4545 Thanks @jxom! - Type Change: TPending has been added to slot 2 of the Log generics.

    type Log<
      TQuantity = bigint,
      TIndex = number,
    + TPending extends boolean = boolean,
      TAbiEvent extends AbiEvent | undefined = undefined,
      TStrict extends boolean | undefined = undefined,
      TAbi extends Abi | readonly unknown[] = [TAbiEvent],
      TEventName extends string | undefined = TAbiEvent extends AbiEvent
        ? TAbiEvent['name']
        : undefined,
    >
  • #958 f7976fd0 Thanks @jxom! - Added cacheTime as a parameter to getBlockNumber & createClient.
  • 28a82125 Thanks @jxom! - Exported number constants (ie. maxInt128, maxUint256, etc).
  • #951 c75d3b60 Thanks @jxom! - Added support for multiple events on Filters/Log Actions:

    • createEventFilter
    • getLogs
    • watchEvent

    Example:

    import { parseAbi } from "viem";
    import { publicClient } from "./client";
    
    const logs = publicClient.getLogs({
      events: parseAbi([
        "event Approval(address indexed owner, address indexed sender, uint256 value)",
        "event Transfer(address indexed from, address indexed to, uint256 value)"
      ])
    });
  • #847 1e5d4545 Thanks @jxom! - Type Change: TIncludeTransactions & TBlockTag has been added to slot 1 & 2 of the Block generics.

    type Block<
      TQuantity = bigint,
    + TIncludeTransactions extends boolean = boolean,
    + TBlockTag extends BlockTag = BlockTag,
      TTransaction = Transaction<
        bigint,
        number,
        TBlockTag extends 'pending' ? true : false
      >,
    >

1.4.2

Patch Changes

  • #941 12c685a1 Thanks @jxom! - Capture error signatures that do not exist on the ABI in ContractFunctionRevertedError.
  • #942 e26e356c Thanks @alexfertel! - Deprecated OnLogParameter & OnLogFn in favor of WatchEventOnLogParameter & WatchEventOnLogFn types. Added WatchContractEventOnLogParameter & WatchContractEventOnLogFn types.

1.4.1

Patch Changes

  • 789592dc Thanks @jxom! - Fixed an issue where calling encodePacked with an empty bytes[] array would return an Uint8Array instead of Hex value.
  • #922 71c9c933 Thanks @mikemcdonald! - Fixed an issue where parseUnits would throw Cannot convert to a BigInt for large numbers with a fraction component.

1.4.0

Minor Changes

Patch Changes

1.3.1

Patch Changes

1.3.0

Minor Changes

1.2.15

Patch Changes

1.2.14

Patch Changes

1.2.13

Patch Changes

  • #874 a9bc9f6d Thanks @Alexsey! - Fixed BaseError.walk to return null if the predicate callback is not satisfied.

1.2.12

Patch Changes

  • #864 b851c41b Thanks @jxom! - Fixed an issue where dataSuffix was not being provided to the request returned from simulateTransaction.

1.2.11

Minor Changes

1.2.10

Patch Changes

1.2.9

Patch Changes

  • d24e5bc4 Thanks @jxom! - Fixed a race condition in waitForTransactionReceipt causing multiple parallel instances to not resolve.

1.2.8

Patch Changes

1.2.7

Patch Changes

1.2.6

Patch Changes

  • #808 7567f58e Thanks @jxom! - Fixed an issue where TransactionRequest did not narrow based on type.

1.2.5

Patch Changes

1.2.4

Patch Changes

1.2.3

Patch Changes

1.2.2

Patch Changes

1.2.1

Patch Changes

1.2.0

Minor Changes

  • #791 98fd9172 Thanks @jxom! - Implemented ability to "extend" Clients via client.extend & refactored Actions to accept a tree-shakable Client.

1.1.8

Patch Changes

1.1.7

Patch Changes

1.1.6

Patch Changes

  • ec58ed1b Thanks @jxom! - Fixed type narrowing on EIP1474 schemas

1.1.5

Patch Changes

  • c4e996b8 Thanks @jxom! - Fixed errorneous type defition being generated by tsc.

1.1.4

Patch Changes

1.1.3

Patch Changes

  • #758 67b628df Thanks @jxom! - Added support for empty string in EIP712Domain name field.

1.1.2

Patch Changes

1.1.1

Patch Changes

1.1.0

Minor Changes

Patch Changes

  • #709 043b2cba Thanks @jxom! - Refactored serializable/serialized transaction types.
  • #735 e7ee66c8 Thanks @holic! - Fixed block formatting in watchBlocks for WebSocket subscriptions.

1.0.7

Patch Changes

  • #707 3fc045d1 Thanks @tmm! - Made TypeScript requirement explicit (was missing previously).

1.0.6

Patch Changes

  • 90fd40ba Thanks @jxom! - Fixed potential nullish chainId conflict in sendTransaction (for Local Accounts).

1.0.5

Patch Changes

  • #699 79d1b4af Thanks @jxom! - Support custom transaction formatters on sendUnsignedTransaction.

1.0.4

Patch Changes

  • 8407fdcc Thanks @jxom! - Fixed fraction length overflow edge-case.

1.0.3

Patch Changes

  • #672 e033f467 Thanks @sambacha! - Turned off esModuleInterop & allowSyntheticDefaultImports in tsconfig.

1.0.2

Patch Changes

  • #677 a0a2ebb Thanks @hexcowboy! - Added ability to pass an AbiFunction to getFunctionSelector, and AbiEvent to getEventSelector.

1.0.1

Patch Changes

1.0.0

Major Changes

  • #576 7d42767 Thanks @jxom! - Breaking (edge case): decodeEventLog no longer attempts to partially decode events. If the log does not conform to the ABI (mismatch between the number of indexed/non-indexed arguments to topics/data), it will throw an error.
  • #576 7d42767 Thanks @jxom! - Breaking: logIndex & transactionIndex on Log now return a number instead of a bigint
  • #576 7d42767 Thanks @jxom! - Breaking: Removed ethersWalletToAccount adapter.

    This adapter was introduced when viem did not have Private Key & HD Accounts. Since 0.2, viem provides all the utilities needed to create and import Private Key & HD Accounts.

    If you still need it, you can copy + paste the old implementation.

Patch Changes

  • #657 af48368 Thanks @izayl! - Fixed getAbiItem from returning mismatched type when overload with different lengths.
  • #576 7d42767 Thanks @jxom! - Upgraded ENS Universal Resolver contract address.
  • #576 7d42767 Thanks @jxom! - Added support for labels larger than 255 bytes when resolving ENS names.
  • #576 7d42767 Thanks @jxom! - Added a strict parameter to getLogs, createEventFilter & createContractEventFilter.

    When strict mode is turned on, only logs that conform to the indexed/non-indexed arguments on the event definition/ABI (event) will be returned. When strict mode is turned off (default), logs that do not conform to the indexed/non-indexed arguments on the event definition/ABI (event) will be included, but the args property will be undefined (as we cannot decode these events).

0.3.50

Patch Changes

0.3.49

Patch Changes

  • 0b92f3a Thanks @jxom! - Added more chains from @wagmi/chains.

0.3.47

Patch Changes

0.3.46

Patch Changes

0.3.45

Patch Changes

0.3.44

Patch Changes

  • #610 06ee89c5 Thanks @jxom! - Added ability to hash data representation of message via a raw attribute in signMessage, verifyMessage, recoverMessageAddress.

    await walletClient.signMessage({
      message: { raw: "0x68656c6c6f20776f726c64" }
    });

0.3.43

Patch Changes

0.3.42

Patch Changes

0.3.41

Patch Changes

  • 1b3f584 Thanks @jxom! - Fixed chainId type on Transaction types.

0.3.40

Patch Changes

0.3.39

Patch Changes

0.3.38

Patch Changes

0.3.37

Patch Changes

0.3.36

Patch Changes

0.3.35

Patch Changes

  • 1cc1dc2 Thanks @jxom! - Fixed account parameter type on readContract.

0.3.34

Patch Changes

  • 5c75ee5 Thanks @jxom! - Added EstimateContractGasParameters & EstimateContractGasReturnType types.

0.3.33

Patch Changes

  • 0cb8f31 Thanks @jxom! - Fixed an issue where watchContractEvent would throw a serialize error for bigint args.

0.3.32

Patch Changes

  • fb5b321 Thanks @jxom! - Allowed recovery id as v when recovering public key.
  • 9df44ce Thanks @jxom! - Added ganache as another mode for Test Client

0.3.31

Patch Changes

  • #540 0d8f154 Thanks @jxom! - Added proxy packages to support bundlers that are not compatible with package.json#exports.

0.3.30

Patch Changes

  • 228d949 Thanks @jxom! - Bumped waitForTransactionReceipt retry count.

0.3.29

Patch Changes

  • #527 840d3d7 Thanks @jxom! - Fixed trim to trim trailing zero byte data instead of all trailing zeros.

0.3.28

Patch Changes

  • ffee4f8 Thanks @jxom! - Bumped waitForTransactionReceipt exponential backoff scalar

0.3.27

Patch Changes

  • #518 65a0896 Thanks @jxom! - Added strict option to isHex & optimized data utilities.
  • #515 c1b81dc Thanks @jxom! - Optimized getTransaction strategy in waitForTransactionReceipt.

0.3.26

Patch Changes

0.3.25

Patch Changes

0.3.24

Patch Changes

  • 9852bcd Thanks @jxom! - Fixed custom solidity errors with no args.

0.3.23

Patch Changes

  • 670d825 Thanks @jxom! - Fixed `call` revert data for node clients that have nested error data.

0.3.22

Patch Changes

  • 9ae5eaa Thanks @jxom! - Fixed functionName type inference in SimulateContractReturnType.

0.3.21

Patch Changes

  • #475 64a2f51 Thanks @jxom! - Fixed `hashMessage` string conversion for messages that have same format as hex bytes.

0.3.20

Patch Changes

  • #470 be9501e Thanks @jxom! - Fixed issue where waitForTransactionReceipt would throw immediately for RPC Providers which may be slow to sync mined transactions.

0.3.19

Patch Changes

  • #320 6d6d092 Thanks @janek26! - Added support for Contract Wallet signature verification (EIP-6492) via publicClient.verifyMessage & publicClient.verifyTypedData.

0.3.18

Patch Changes

  • #448 29cf036 Thanks @jxom! - Refactored inferred types on Log (eventName, args, topics), getLogs, getFilterLogs & getFilterChanges.
  • #445 9e096a9 Thanks @jxom! - Made "name" parameter (eventName, functionName, etc) optional on contract encoding/decoding utilities when only one ABI item is provided.

0.3.17

Patch Changes

  • #443 ca0cb85 Thanks @jxom! - Fixed eth_call & eth_estimateGas calls for nodes that conform to the older JSON-RPC spec.

0.3.16

Patch Changes

  • 482aaa1 Thanks @jxom! - Wrapped slice offset out-of-bounds error in a BaseError.

0.3.15

Patch Changes

  • #436 72ed656 Thanks @jxom! - Fixed an issue where multicall's return type was incorrectly flattening when allowFailure: false.

0.3.14

Patch Changes

  • #431 31aafb3 Thanks @jxom! - Added a dataSuffix argument to writeContract and simulateContract

0.3.13

Patch Changes

  • eb32e6c Thanks @fubhy! - Fixed mine() to resolve to undefined instead of null.

0.3.12

Patch Changes

  • 6f8151c Thanks @jxom! - Flagged 403 as non-deterministic error for fallback Transport.

0.3.11

Patch Changes

  • #398 cbb4f1f Thanks @jxom! - Added a new batchSize parameter to multicall which limits the size of each calldata chunk.

0.3.10

Patch Changes

0.3.9

Patch Changes

0.3.8

Patch Changes

  • 8371ad9 Thanks @jxom! - Fixed WebSocket import on Vite environments.

0.3.7

Patch Changes

0.3.6

Patch Changes

  • ae6d388 Thanks @jxom! - Fixed unpublished type declarations.

0.3.5

Patch Changes

  • 0d38807 Thanks @jxom! - Fixed batch config in createPublicClient.

0.3.4

Patch Changes

  • #387 230fcfd Thanks @jxom! - Added support for eth_call batch aggregation via multicall aggregate3.
  • #388 bc254d8 Thanks @jxom! - Added size as an argument to hex/bytes encoding/decoding utilities.
  • 03816ec Thanks @jxom! - Disabled fallback transport ranking by default.

0.3.3

Patch Changes

  • #383 7e9731c Thanks @Raiden1411! - Fixed an issue where serializeTransaction was incorrectly encoding zero-ish properties.

0.3.2

Patch Changes

0.3.1

Patch Changes

  • #365 f4dcc33 Thanks @fubhy! - Fixed getAbiItem to not use a generic type variable for the return type

0.3.0

Minor Changes

  • #355 b1acfc9 Thanks @jxom! - Breaking: Renamed RequestError to RpcError. Breaking: Removed RpcRequestError – use RpcError instead. Breaking: Renamed RpcError to RpcRequestError.

Patch Changes

  • #355 b1acfc9 Thanks @jxom! - Added ProviderRpcError subclass.

    Added EIP-1193 UnauthorizedProviderError, UnsupportedProviderMethodError, ProviderDisconnectedError, and ChainDisconnectedError.

  • #349 b275811 Thanks @jxom! - Fixed an issue where Filter querying (eth_getFilterChanges, etc) was not being scoped to the Transport that created the Filter.

0.2.14

Patch Changes

0.2.13

Patch Changes

  • #331 cd7b642 Thanks @jxom! - Migrated to TypeScript 5. Migrated build process from tsup to tsc.
  • #343 579171d Thanks @fubhy! - Fixed conditional types for poll options on watchBlocks & watchPendingTransactions.

0.2.12

Patch Changes

  • #328 ee87fe7 Thanks @jxom! - Tweaked error inheritence for UserRejectedRequestError & SwitchChainError to be more friendly with custom errors.

0.2.11

Patch Changes

  • #326 c83616a Thanks @jxom! - Fixed an issue where filtered logs that do not conform to the provided ABI would cause getLogs, getFilterLogs or getFilterChanges to throw – these logs are now skipped. See #323 for more info.

0.2.10

Patch Changes

  • #322 ea019d7 Thanks @tmm! - Fixed properties passed to ethers adapter signTransaction

0.2.9

Patch Changes

  • #317 2720ba5 Thanks @jxom! - Fixed transports property type on FallbackTransport.

0.2.8

Patch Changes

  • #313 eb2280c Thanks @jxom! - Migrated from idna-uts46-hx to @adraffy/ens-normalize for normalize.

0.2.7

Patch Changes

  • #310 6dfc225 Thanks @jxom! - Made GetValue return { value?: never } instead of unknown for contract functions that are not payable.

0.2.6

Patch Changes

  • #295 9a15a61 Thanks @fubhy! - Return discrimated union type from decodeFunctionData
  • #304 8e1b712 Thanks @fubhy! - Fixed getTransactionType to honor undefined EIP-1559, EIP-2930 or Legacy attributes.
  • #302 c00a459 Thanks @fubhy! - Fixed forwarding of options to transport for wallet client

0.2.5

Patch Changes

0.2.4

Patch Changes

  • #293 859352c Thanks @TateB! - Fixed ENS address resolution for when resolver returns with a null address, or resolvers that do not support addr. getEnsAddress returns null for these cases.

0.2.3

Patch Changes

  • #290 ef2bbaf Thanks @holic! - Fixed ENS address resolution for "0x"-prefixed names.

0.2.2

Patch Changes

  • #289 8c51f93 Thanks @jxom! - Made @scure/bip39/wordlists/* & idna-uts46-hx exports ESM friendly.

0.2.1

Patch Changes

  • #285 ab9fd12 Thanks @tmm! - Exported hdKeyToAccount and mnemonicToAccount.

0.2.0 – Migration Guide

Minor Changes

  • #229 098f342 Thanks @jxom! - Breaking: Removed the getAccount function.

    For JSON-RPC Accounts, use the address itself.

    import { createWalletClient, custom } from 'viem'
    import { mainnet } from 'viem/chains'
    
    const address = '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2'
    
    const client = createWalletClient({
    - account: getAccount(address),
    + account: address,
      chain: mainnet,
      transport: custom(window.ethereum)
    })

    For Ethers Wallet Adapter, use ethersWalletToAccount.

    If you were using the Ethers Wallet adapter, you can use the ethersWalletToAccount function.

    Note: viem 0.2.0 now has a Private Key & Mnemonic Account implementation. You probably do not need this adapter anymore. This adapter may be removed in a future version.

    import { createWalletClient, custom } from 'viem'
    import { mainnet } from 'viem/chains'
    - import { getAccount } from 'viem/ethers'
    + import { ethersWalletToAccount } from 'viem/ethers'
    import { Wallet } from 'ethers'
    
    - const account = getAccount(new Wallet('0x...'))
    + const account = ethersWalletToAccount(new Wallet('0x...'))
    
    const client = createWalletClient({
      account,
      chain: mainnet,
      transport: custom(window.ethereum)
    })

    For Local Accounts, use toAccount.

    - import { createWalletClient, http, getAccount } from 'viem'
    + import { createWalletClient, http } from 'viem'
    + import { toAccount } from 'viem/accounts'
    import { mainnet } from 'viem/chains'
    import { getAddress, signMessage, signTransaction } from './sign-utils'
    
    const privateKey = '0x...'
    - const account = getAccount({
    + const account = toAccount({
      address: getAddress(privateKey),
      signMessage(message) {
        return signMessage(message, privateKey)
      },
      signTransaction(transaction) {
        return signTransaction(transaction, privateKey)
      },
      signTypedData(typedData) {
        return signTypedData(typedData, privateKey)
      }
    })
    
    const client = createWalletClient({
      account,
      chain: mainnet,
      transport: http()
    })
  • #229 098f342 Thanks @jxom! - Breaking: Removed assertChain argument on sendTransaction, writeContract & deployContract. If you wish to bypass the chain check (not recommended unless for testing purposes), you can pass chain: null.

    await walletClient.sendTransaction({
    - assertChain: false,
    + chain: null,
      ...
    })
  • #229 098f342 Thanks @jxom! - Breaking: A chain is now required for the sendTransaction, writeContract, deployContract Actions.

    You can hoist the Chain on the Client:

    import { createWalletClient, custom, getAccount } from 'viem'
    import { mainnet } from 'viem/chains'
    
    export const walletClient = createWalletClient({
    + chain: mainnet,
      transport: custom(window.ethereum)
    })
    
    const account = getAccount('0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266')
    
    const hash = await walletClient.sendTransaction({
      account,
      to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
      value: 1000000000000000000n
    })

    Alternatively, you can pass the Chain directly to the Action:

    import { createWalletClient, custom, getAccount } from 'viem'
    import { mainnet } from 'viem/chains'
    
    export const walletClient = createWalletClient({
    - chain: mainnet,
      transport: custom(window.ethereum)
    })
    
    const account = getAccount('0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266')
    
    const hash = await walletClient.sendTransaction({
      account,
    + chain: mainnet,
      to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
      value: 1000000000000000000n
    })
  • #229 098f342 Thanks @jxom! - Breaking: Updated utility type names to reflect their purposes:

    • ExtractErrorNameFromAbi is now InferErrorName
    • ExtractEventNameFromAbi is now InferEventName
    • ExtractFunctionNameFromAbi is now InferFunctionName
    • ExtractItemNameFromAbi is now InferItemName
    • ExtractConstructorArgsFromAbi is now GetConstructorArgs
    • ExtractErrorArgsFromAbi is now GetErrorArgs
    • ExtractEventArgsFromAbi is now GetEventArgs
    • ExtractEventArgsFromTopics is now GetEventArgsFromTopics
    • ExtractArgsFromAbi is now GetFunctionArgs
  • #229 098f342 Thanks @jxom! - Breaking: The following functions are now async functions instead of synchronous functions:

    • recoverAddress
    • recoverMessageAddress
    • verifyMessage
    import { recoverMessageAddress } from 'viem'
    
    - recoverMessageAddress({ message: 'hello world', signature: '0x...' })
    + await recoverMessageAddress({ message: 'hello world', signature: '0x...' })

Patch Changes

  • #229 098f342 Thanks @jxom! - Added Local Account implementations:

    • privateKeyToAccount
    • mnemonicToAccount
    • hdKeyToAccount

    If you were previously relying on the viem/ethers wallet adapter, you no longer need to use this.

    - import { Wallet } from 'ethers'
    - import { getAccount } from 'viem/ethers'
    + import { privateKeyToAccount } from 'viem/accounts'
    
    const privateKey = '0x...'
    - const account = getAccount(new Wallet(privateKey))
    + const account = privateKeyToAccount(privateKey)
    
    const client = createWalletClient({
      account,
      chain: mainnet,
      transport: http()
    })
  • #229 098f342 Thanks @jxom! - Added WebSocket eth_subscribe support watchBlocks, watchBlockNumber, and watchPendingTransactions.
  • #229 098f342 Thanks @jxom! - Added verifyTypedData, hashTypedData, recoverTypedDataMessage
  • #229 098f342 Thanks @jxom! - Added the ability to hoist an Account to the Wallet Client.

    import { createWalletClient, http } from 'viem'
    import { mainnnet } from 'viem/chains'
    
    const [account] = await window.ethereum.request({ method: 'eth_requestAccounts' })
    
    const client = createWalletClient({
    + account,
      chain: mainnet,
      transport: http()
    })
    
    const hash = await client.sendTransaction({
    - account,
      to: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
      value: parseEther('0.001')
    })

0.1.26

Patch Changes

  • 93e402d Thanks @jxom! - Fixed a decodeAbiParameters case where static arrays with a dynamic child would consume the size of the child instead of 32 bytes.

0.1.25

Patch Changes

  • #263 53fda1a Thanks @fubhy! - Fixed issue where ABIs with constructors would throw for decodeFunctionData.

0.1.24

Patch Changes

0.1.23

Patch Changes

  • #251 153e97e Thanks @tmm! - Fixed signTypedData inference for primaryType field.

0.1.22

Patch Changes

  • 07000b6 Thanks @jxom! - Removed unnecessary trimming of decoded RLP hex value

0.1.21

Patch Changes

  • #223 2e9c000 Thanks @jxom! - Added an assertion in sendTransaction & writeContract to check that the client chain matches the wallet's current chain.

0.1.20

Patch Changes

  • #220 9a80fca Thanks @jxom! - Fixed an issue where watchEvent would not emit events on missed blocks for the getLogs fallback.

0.1.19

Patch Changes

  • 74f8e1d Thanks @jxom! - Added missing recoverMessageAddress and verifyMessage exports.

0.1.18

Patch Changes

  • 9c45397 Thanks @jxom! - Fixed signTypedData support for Ethers.js v5 wallets

0.1.17

Patch Changes

  • #213 46f823a Thanks @jxom! - Fixed return type for allowFailure: false on multicall
  • c3d932a Thanks @jxom! - Fixed signTypedData support for Ethers.js v5 Wallets

0.1.16

Patch Changes

  • #207 8e5768f Thanks @jxom! - Added assertion in watchBlocks and watchBlockNumber to check that the next block number is higher than the previously seen block number.
  • #209 ae3e0b6 Thanks @jxom! - Added verifyMessage, recoverAddress, recoverMessageAddress, and hashMessage.

0.1.15

Patch Changes

  • #205 36fa97a Thanks @jxom! - Added an assertion to check for existence of an event signature on topics for decodeEventLog

0.1.14

Patch Changes

  • #198 e805e7e Thanks @wighawag! - Added an assertion in decodeEventLog to check for a mismatch between topics + indexed event parameters.

0.1.13

Patch Changes

0.1.12

Patch Changes

0.1.11

Patch Changes

0.1.10

Patch Changes

0.1.9

Patch Changes

  • #170 35a7508 Thanks @jxom! - Added inference for multicall address from client chain.

0.1.8

Patch Changes

  • 36c908c Thanks @jxom! - Fixed an issue where empty strings were not being decoded properly in decodeAbiParameters.

0.1.7

Patch Changes

  • #159 574ae22 Thanks @jxom! - Fixed issue where decoding error logs would break if constructor was in ABI.

0.1.6

Patch Changes

  • #153 bbb998a Thanks @jxom! - Formatted undefined values from RPC as null to conform to EIP-1474.

0.1.5

Patch Changes

0.1.4

Patch Changes

  • #139 304a436 Thanks @jxom! - Added the following chains:

    • baseGoerli
    • boba
    • filecoinCalibration
    • flare
    • flareTestnet
    • harmonyOne
    • moonbaseAlpha
    • moonbeam
    • moonriver
    • okc
    • polygonZkEvmTestnet
    • shardeumSphinx
    • songbird
    • songbirdTestnet
    • telos
    • telosTestnet
    • zhejiang

0.1.3

Patch Changes

  • #136 dcca090 Thanks @jxom! - Fixed ABI encoding for strings larger than 32 bytes.

0.1.2

Patch Changes

0.1.1

Patch Changes

0.1.0

Minor Changes

0.0.1-alpha.39

Patch Changes

  • 68c3816 Thanks @jxom! - Made keccak256 accept a hex value (as well as byte array).

0.0.1-alpha.38

Patch Changes

0.0.1-alpha.37

Patch Changes

  • e07f212 Thanks @jxom! - Breaking: Renamed formatUnit and parseUnit to formatUnits and parseUnits.

0.0.1-alpha.36

Patch Changes

  • #100 6bb8ce4 Thanks @jxom! - Breaking: Renamed requestAccounts Wallet Action to requestAddresses

    Breaking: Renamed getAccounts Wallet Action to getAddresses

  • #100 6bb8ce4 Thanks @jxom! - Breaking: The from argument has been removed from Actions in favour of account to distinguish between Account types:

    + import { getAccount } from 'viem'
    
    const [address] = await walletClient.requestAddresses()
    + const account = getAccount(address)
    
    const hash = await walletClient.sendTransaction({
    - from: address,
    + account,
      to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
      value: 1000000000000000000n
    })

    Affected actions:

    • call
    • estimateGas
    • sendTransaction
    • signMessage
    • estimateContractGas
    • multicall
    • readContract
    • simulateContract
    • writeContract

0.0.1-alpha.35

Patch Changes

  • 057e01e Thanks @jxom! - - testClient.getTxPoolContenttestClient.getTxpoolContent
    • testClient.getTxPoolStatustestClient.getTxpoolStatus
  • #85 2350d1a Thanks @jxom! - Breaking: Renamed encodeAbi & decodeAbi to encodeAbiParameters & decodeAbiParameters, and modified API from named arguments to inplace arguments:

    import {
    - encodeAbi,
    - decodeAbi,
    + encodeAbiParameters,
    + decodeAbiParameters,
    } from 'viem'
    
    -const result = encodeAbi({ params, values })
    +const result = encodeAbiParameters(params, values)
    
    -const result = decodeAbi({ params, data })
    +const result = decodeAbiParameters(params, data)

0.0.1-alpha.34

Patch Changes

  • e1634b5 Thanks @jxom! - Fixed ABI encoding dynamic tuple child derivation

0.0.1-alpha.33

Patch Changes

  • 1971e6a Thanks @jxom! - Added assertion to check if addresses are valid for sendTransaction, estimateGas & call.

0.0.1-alpha.32

Patch Changes

  • 7243744 Thanks @jxom! - Added support for 4001 & 4902 RPC error codes.

0.0.1-alpha.31

Patch Changes

  • #91 0ac32c2 Thanks @jxom! - Breaking: Renamed getFunctionSignature and getEventSignature to getFunctionSelector and getEventSelector.

0.0.1-alpha.30

Patch Changes

  • #81 eb572b0 Thanks @jxom! - Improved transaction & contract error messaging & coalesce error messages from nodes.

0.0.1-alpha.29

Patch Changes

  • 6bdee9c Thanks @jxom! - Fixed issue where fallback transport was not falling back on timeouts

0.0.1-alpha.28

Patch Changes

  • 8ef068b Thanks @jxom! - Added 502, 503 and 504 error codes as "non-deterministic" errors for fallback transport & retries.
  • #79 db9caa9 Thanks @jxom! - Added timeout as a config option to the http and webSocket Transports.
  • #77 d6a29f5 Thanks @jxom! - Decorated Clients with their respective Actions.

    Example:

    import { createPublicClient, http } from 'viem'
    import { mainnet } from 'viem/chains'
    -import { getBlockNumber } from 'viem/public'
    
    const client = createPublicClient({
      chain: mainnet,
      transport: http(),
    })
    
    - const blockNumber = await getBlockNumber(client)
    + const blockNumber = await client.getBlockNumber()

0.0.1-alpha.26

Patch Changes

Breaking: Renamed encoding utils.

  • encodeBytes/decodeBytestoBytes/fromBytes
  • encodeHex/decodeHextoHex/fromHex
  • encodeRlp/decodeRlptoRlp/fromRlp

0.0.1-alpha.26

Patch Changes

  • 7d9a241 Thanks @jxom! - Added retryCount and retryDelay config to Transports.

0.0.1-alpha.25

Patch Changes

  • #68 1be77b3 Thanks @jxom! - Breaking: Removed all public/wallet/test actions & utils from the viem entrypoint to their respective entrypoints:

    • viem = Clients & Transport exports
    • viem/chains = Chains exports
    • viem/contract = Contract Actions & Utils exports
    • viem/ens = ENS Actions & Utils exports
    • viem/public = Public Actions exports
    • viem/test = Test Actions exports
    • viem/utils = Utils exports
    • viem/wallet = Wallet Actions exports
  • #66 f19fc32 Thanks @tmm! - Added ENS actions getEnsAddress and getEnsName.

0.0.1-alpha.24

Patch Changes

  • #63 7473582 Thanks @tmm! - Exported missing watchContractEvent and watchEvent actions.

0.0.1-alpha.23

Patch Changes

0.0.1-alpha.22

Patch Changes

  • #56 3e90197 Thanks @jxom! - - Breaking: Renamed humanMessage to shortMessage in BaseError.
    • Added multicall.
    • Support overloaded contract functions.

0.0.1-alpha.21

Patch Changes

  • 5a6bdf8 Thanks @jxom! - Fixed an issue where encodeAbi couldn't encode dynamic bytes larger than 32 bytes"

0.0.1-alpha.20

Patch Changes

  • ae90357 Thanks @jxom! - Made watchBlocks more type safe with the includeTransactions arg.

0.0.1-alpha.19

Patch Changes

0.0.1-alpha.18

Patch Changes

0.0.1-alpha.17

Patch Changes

  • ac69d16 Thanks @jxom! - Breaking: Replaced callContract with simulateContract.

0.0.1-alpha.16

Patch Changes

0.0.1-alpha.15

Patch Changes

  • a74d643 Thanks @jxom! - Breaking: Removed the viem/actions export in favor of viem/public, viem/test & viem/wallet exports.

0.0.1-alpha.14

Patch Changes

0.0.1-alpha.13

Patch Changes

0.0.1-alpha.12

Patch Changes

0.0.1-alpha.11

Patch Changes

  • 43700d9 Thanks @jxom! - Fixed issue where preinstall/postinstall scripts were being published to NPM.

0.0.1-alpha.10

Patch Changes

0.0.1-alpha.9

Patch Changes

0.0.1-alpha.8

Patch Changes

0.0.1-alpha.7

Patch Changes

0.0.1-alpha.6

Patch Changes

0.0.1-alpha.5

Patch Changes

0.0.1-alpha.4

Patch Changes

0.0.1-alpha.3

Patch Changes

  • 849653f Thanks @jxom! - - Breaking: Renamed encodeFunctionParams to encodeFunctionData.
    • Added decodeFunctionData.

0.0.1-alpha.2

Patch Changes

0.0.1-alpha.1

Patch Changes

  • d722728 Thanks @jxom! - - Breaking: Renamed ethereumProvider Transport to custom.
    • Breaking: Refactored Transport APIs.
    • Breaking: Flattened sendTransaction, call & estimateGas APIs.
    • Added encodeAbi & decodeAbi.
    • Added fallback Transport.
    • Added getFilterLogs.