Skip to main content

Documentation Index

Fetch the complete documentation index at: https://unevenlabs-ted-sdk-integration-docs.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Parameters

PropertyDescriptionRequired
chainIdThe chain id to deposit funds on
toChainIdThe chain id to execute the txs on
txsAn array of either transaction objects (made up of a to, data and value properties) or viem request objects returned from viem’s simulateContract function. A code snippet is provided below which shows an example of this in conjunction with the Zora protocol SDK
walletA valid WalletClient from viem or an adapted wallet generated from an adapter that meets this interface.
precheckIf set to true this will just fetch the quote without executing the txs. Use this to display an estimated quote.
onProgressCallback to update UI state as execution progresses. Can also be used to get the transaction hash for a given step item.

Example

Custom Zora Mint
import { ConnectButton } from "@rainbow-me/rainbowkit";
import { useCallback } from "react";
import { getClient } from "@reservoir0x/relay-sdk";
import { createPublicClient, http, WriteContractParameters } from "viem";
import { useWalletClient } from "wagmi";
import { createMintClient } from "@zoralabs/protocol-sdk";
import { base, zora } from "viem/chains";

export default function App() {
  const { data: wallet } = useWalletClient({
    chainId: base.id,
  });

  const customMint = useCallback(async () => {
    if (!wallet || !wallet.account?.address) {
      throw "A wallet is required to mint!";
    }

    if (!sdkClient) {
      throw "Relay SDK not initialized";
    }

    const mintClient = createMintClient({ chain: zora });
    const publicClient = createPublicClient({
      chain: zora,
      transport: http(),
    });
    const prepared = await mintClient.makePrepareMintTokenParams({
      // token to mint
      tokenAddress: "0x03e4f2838b2e821d2117a78a278c4e3166d97339",
      tokenId: "4",
      mintArguments: {
        // address that will receive the token
        mintToAddress: wallet.account.address,
        // quantity of tokens to mint
        quantityToMint: 1,
        // comment to include with the mint
        mintComment: "Cross-Chain Minting via Reservoir Relay!",
      },
      // account that is to invoke the mint transaction
      minterAccount: wallet.account.address,
    });

    // simulate the transaction and get any validation errors
    const { request } = await publicClient.simulateContract(prepared);

    sdkClient.actions.call({
      chainId: base.id,
      toChainId: zora.id,
      txs: [request],
      wallet,
      onProgress: () => {},
    });
  }, [wallet]);

  return (
    ...
      <button
        className="button"
        onClick={customMint}
      >
        Custom Mint + Zora SDK
      </button>
    ...
  );
}

//This snippet demonstrates cross chain actions in the form of a mint on Zora from Base.
//The code snippet above assumes you've created the client, properly configured the
//chains and ensured that the user is currently connected to the correct chain.