av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

創(chuàng)新互聯(lián)Moralis教程:Moralis轉移NFTs

轉移 ERC721 代幣(不可替代)

要轉移 ERC721 代幣,請執(zhí)行以下步驟:

  1. 構造一個options對象并設置:
    1. type:“erc721”
    2. receiver: "0x000..." //錢包地址
    3. contractAddress: "0x..." //ERC721 代幣的合約
    4. tokenId:1
  2. 調用 Moralis 傳遞函數(shù)如下圖,你可以使用?JS?或者?React?
// sending a token with token id = 1
const options = {
  type: "erc721",
  receiver: "0x..",
  contractAddress: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
  tokenId: 1,
};
let transaction = await Moralis.transfer(options);
import React from "react";
import { useWeb3Transfer } from "react-moralis";

const TransferNFT = () => {
  const { fetch, error, isFetching } = useWeb3Transfer({
    type: "erc721",
    receiver: "0x..",
    contractAddress: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
    tokenId: 1,
  });

  return (
    // Use your custom error component to show errors
    
{error && }
); };

轉移 ERC1155 代幣(半同質化)

要轉移 ERC1155 代幣,請按以下步驟操作:

  1. 構造一個options對象并設置:
    1. type:“erc721”
    2. receiver: "0x000..." //錢包地址
    3. contractAddress: "0x..." //ERC721 代幣的合約
    4. tokenId:1
    5. amount: 15 //要轉賬的代幣數(shù)量
  2. 調用 Moralis 傳遞函數(shù)如下圖,你可以使用?JS?或者?React?
// sending 15 tokens with token id = 1
const options = {
  type: "erc1155",
  receiver: "0x..",
  contractAddress: "0x..",
  tokenId: 1,
  amount: 15,
};
let transaction = await Moralis.transfer(options);
import React from "react";
import { useWeb3Transfer } from "react-moralis";

const TransferNFT = () => {
  const { fetch, error, isFetching } = useWeb3Transfer({
    type: "erc1155",
    receiver: "0x..",
    contractAddress: "0x..",
    tokenId: 1,
    amount: 15,
  });

  return (
    // Use your custom error component to show errors
    
{error && }
); };

解決結果

?Moralis.transfer()? 執(zhí)行后返回交易響應。


本文標題:創(chuàng)新互聯(lián)Moralis教程:Moralis轉移NFTs
瀏覽地址:http://uogjgqi.cn/article/dpohsgg.html
掃二維碼與項目經理溝通

我們在微信上24小時期待你的聲音

解答本文疑問/技術咨詢/運營咨詢/技術建議/互聯(lián)網交流