要转移 ERC721 代币,请执行以下步骤:
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 代币,请按以下步骤操作:
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()
执行后返回交易响应。
文章题目:创新互联Moralis教程:Moralis转移NFTs
网址分享:http://www.shufengxianlan.com/qtweb/news26/383726.html
网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联