github wevm/viem viem@2.54.0

12 hours ago

Minor Changes

  • #4767 0def05663277a93e645bc28740a78bfc916810ec Thanks @jxom! - Breaking (viem/tempo): Changed Tempo token balance and allowance reads to return Amount objects.

    -const balance = await client.token.getBalance({ token })
    -// ^? bigint
    +const balance = await client.token.getBalance({ token })
    +// ^? { amount: bigint; decimals: number; formatted: string }
    
    -const allowance = await client.token.getAllowance({ account, spender, token })
    -// ^? bigint
    +const allowance = await client.token.getAllowance({ account, spender, token })
    +// ^? { amount: bigint; decimals: number; formatted: string }
  • #4767 0def05663277a93e645bc28740a78bfc916810ec Thanks @jxom! - Breaking (viem/tempo): Changed Tempo token .call helpers to take the client before their action arguments.

    -Actions.token.transfer.call({ token, to, amount })
    +Actions.token.transfer.call(client, { token, to, amount })
    
    -Actions.token.getBalance.call({ account, token })
    +Actions.token.getBalance.call(client, { account, token })
  • #4767 0def05663277a93e645bc28740a78bfc916810ec Thanks @jxom! - Breaking: Changed ERC-20 token actions to resolve token symbols from the Client tokens array instead of built-in chain tokens config.

     import { createPublicClient, http } from 'viem'
     import { mainnet } from 'viem/chains'
    +import { usdc } from 'viem/tokens'
    
    -const client = createPublicClient({ chain: mainnet, transport: http() })
    +const client = createPublicClient({
    +  chain: mainnet,
    +  tokens: [usdc],
    +  transport: http(),
    +})
    
     const balance = await client.token.getBalance({ account, token: 'usdc' })
  • #4767 0def05663277a93e645bc28740a78bfc916810ec Thanks @jxom! - Added viem/tokens entrypoint.

Patch Changes

Don't miss a new viem release

NewReleases is sending notifications on new releases.