viem

TypeScript Interface for Ethereum

OTHER License

Downloads
2.5M
Stars
2K
Committers
391

Bot releases are visible (Hide)

viem - [email protected]

Published by github-actions[bot] about 1 year ago

Patch Changes

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

Published by github-actions[bot] about 1 year ago

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)"
      ])
    });
    
  • #957 7950df80 Thanks @jxom! - Added hexToSignature & signatureToHex.

  • #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
      >,
    >
    
viem - [email protected]

Published by github-actions[bot] about 1 year ago

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.

viem - [email protected]

Published by github-actions[bot] over 1 year ago

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.

viem - [email protected]

Published by github-actions[bot] over 1 year ago

Minor Changes

Patch Changes

viem - [email protected]

Published by github-actions[bot] over 1 year ago

Patch Changes

viem - [email protected]

Published by github-actions[bot] over 1 year ago

Minor Changes

viem - [email protected]

Published by github-actions[bot] over 1 year ago

Patch Changes

viem - [email protected]

Published by github-actions[bot] over 1 year ago

Patch Changes

viem - [email protected]

Published by github-actions[bot] over 1 year ago

Patch Changes

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

Published by github-actions[bot] over 1 year ago

Patch Changes

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

Published by github-actions[bot] over 1 year ago

Minor Changes

viem - [email protected]

Published by github-actions[bot] over 1 year ago

Patch Changes

viem - [email protected]

Published by github-actions[bot] over 1 year ago

Patch Changes

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

Published by github-actions[bot] over 1 year ago

Patch Changes

viem - [email protected]

Published by github-actions[bot] over 1 year ago

Patch Changes

  • #808 7567f58e Thanks @jxom! - Fixed RpcTransaction type to not include typeHex.

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

viem - [email protected]

Published by github-actions[bot] over 1 year ago

Patch Changes

viem - [email protected]

Published by github-actions[bot] over 1 year ago

Patch Changes

viem - [email protected]

Published by github-actions[bot] over 1 year ago

Patch Changes

viem - [email protected]

Published by github-actions[bot] over 1 year ago

Patch Changes