Skip to content

thirdweb@5.26.0

Compare
Choose a tag to compare
@jnsdls jnsdls released this 31 May 19:23
· 6040 commits to main since this release
c1e155d

Minor Changes

  • #3161 b569eb4 Thanks @gregfromstl! - Adds waitForBundle function to await a sendCalls bundle's complete confirmation.

    Usage

    import { waitForBundle } from "thirdweb/wallets/eip5792";
    const result = await waitForBundle({
      client,
      chain,
      wallet,
      bundleId: "0x123...",
    });
  • #3161 b569eb4 Thanks @gregfromstl! - Adds EIP-5792 react hooks

    useSendCalls

    useSendCalls will automatically revalidate all reads from contracts that are interacted with.

    import { useSendCalls } from "thirdweb/react";
    
    const sendTx1 = approve({
      contract: USDT_CONTRACT,
      amount: 100,
      spender: "0x33d9B8BEfE81027E2C859EDc84F5636cbb202Ed6",
    });
    const sendTx2 = approve({
      contract: USDT_CONTRACT,
      amount: 100,
      spender: "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709",
    });
    const { mutate: sendCalls, data: bundleId } = useSendCalls({ client });
    await sendCalls({
      wallet,
      client,
      calls: [sendTx1, sendTx2],
    });

    Await the bundle's full confirmation:

    const { mutate: sendCalls, data: bundleId } = useSendCalls({
      client,
      waitForResult: true,
    });
    await sendCalls({
      wallet,
      client,
      calls: [sendTx1, sendTx2],
    });

    Sponsor transactions with a paymaster:

    const { mutate: sendCalls, data: bundleId } = useSendCalls();
    await sendCalls({
      client,
      calls: [sendTx1, sendTx2],
      capabilities: {
        paymasterService: {
          url: `https://${CHAIN.id}.bundler.thirdweb.com/${client.clientId}`,
        },
      },
    });

    useCapabilities

    import { useCapabilities } from "thirdweb/react";
    const { data: capabilities, isLoading } = useCapabilities();

    useCallsStatus

    import { useCallsStatus } from "thirdweb/react";
    const { data: status, isLoading } = useCallsStatus({ bundleId, client });

Patch Changes