Skip to content

transferERC721

Transfer L2 ERC-721 ownership from one user to another.

Usage

The following example is an advance handler that transfers token 1 of the 0xc6582A9b48F211Fa8c2B5b16CB615eC39bcA653B ERC-721 from the sender of the input to a recipient specified in the input payload. If the sender does not have ownership of the token an exception is raised, and that handler is aborted.

import { createApp } from "@deroll/app";
import { createWallet } from "@deroll/wallet";
 
// create app
const app = createApp({ url: "http://127.0.0.1:5004" });
 
// create wallet
const wallet = createWallet();
 
app.addAdvanceHandler(wallet.handler);
 
const token = "0xc6582A9b48F211Fa8c2B5b16CB615eC39bcA653B"; // NFT address
app.addAdvanceHandler(async ({ metadata, payload }) => {
    wallet.transferERC721(token, metadata.msg_sender, payload, 1n); 
    wallet.trasfer
    return "accept";
});
## Errors were thrown in the sample, but not included in an error tag These errors were not marked as being expected: 2339. Expected: // @errors: 2339 Compiler Errors: index.ts [2339] 478 - Property 'trasfer' does not exist on type 'WalletApp'.

Returns

Type: void

Parameters

Type: Address

Token address.

Type: string

From address.

Type: string

Recipiend address.

Type: bigint

Amount to transfer.