要转移 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
<div>
{error && <ErrorMessage error={error} />}
<button onClick={() => fetch()} disabled={isFetching}>
Transfer
</button>
</div>
);
};
要转移 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
<div>
{error && <ErrorMessage error={error} />}
<button onClick={() => fetch()} disabled={isFetching}>
Transfer
</button>
</div>
);
};
Moralis.transfer()
执行后返回交易响应。
在SAS中日期有一种特殊的计算方式,以1960年1月1日为中心点进行计算,该日期为0,下一个日期的日期为1,以此类推。该日期之前的...
SAS程序的输出可以转换为更加用户友好的形式,如.html或PDF。 这是通过使用SAS中提供的ODS语句来完成的。 ODS代表输出传递系统。...
当开始开发一个 HarmonyOS 应用时,首先需要根据工程创建向导,创建一个新的工程,工具会自动生成对应的代码和资源模板。如果创...
Formatterjava.lang.Object |---java.util.Formatterpublic final class Formatterextends Objectimplements Closeable, Flushab...
StringTokenizerjava.lang.Object |---java.util.StringTokenizerpublic class StringTokenizerextends Objectimplements Enumer...