How to transfer native tokens

💡
This guide utilizes the thirdweb connect v5 SDK

Transferring native tokens on a blockchain is crucial for various tasks, like sending tokens, making payments, or integrating transfers into apps. Here are examples using the thirdweb SDK v5 in React, TypeScript, and Unity:

  1. how to transfer the native token of your blockchain using the thirdweb SDK v5 (React)
    1. import { ConnectButton, TransactionButton } from "thirdweb/react";
      import { createThirdwebClient, toWei } from "thirdweb";
      import { ethereum } from "thirdweb/chains";
      import { prepareTransaction } from "thirdweb";
      .
       const client = createThirdwebClient({ clientId: process.env.THIRDWEB_CLIENT_ID });
       .
        <ConnectButton client={client} chain={ethereum} />
                  <TransactionButton
                      transaction={() => {
                          // Create a transaction object and return it
                          const transaction = prepareTransaction({
                              to: "WALLET_ADDRESSS_TO_SEND_NATIVE_TOKEN",
                              chain: ethereum,
                              client: client,
                              value: toWei("1.0"),
                          });
                          return transaction;
                      }}
      
      
                  >
                      Confirm Transaction
                  </TransactionButton>
      
  1. how to transfer the native token of your blockchain using the thirdweb SDK v5 (typescript)
    1. import { prepareTransaction, toWei } from "thirdweb";
      import { ethereum } from "thirdweb/chains";
      const transaction = prepareTransaction({
        to: "WALLET_ADDRESSS_TO_SEND_NATIVE_TOKEN",
        chain: ethereum,
        client: thirdwebClient,
        value: toWei("1.0"),
      });
      
      const tx = await sendAndConfirmTransaction({ transaction, account, });
  1. how to transfer the native token of your blockchain using the thirdweb SDK (unity)
    1. var data = await sdk.Wallet.Transfer("{{to_address}}", "{{amount}}")
      
       

      That’s it, your issue is resolved now!

       

      Can’t get this working? If you’ve followed the above and still have issues, contact our support team for help.

Did this answer your question?
😞
😐
🤩