Skip to content

createERC721TransferVoucher

Utility to create a Voucher to transfer ERC-721 from the application to a destination address on the base layer.

Usage

The example below shows how to create a Voucher to withdraw 1 CTSI to the msg_sender of the an input.

import { createApp } from "@deroll/app";
import { createERC721TransferVoucher } from "@deroll/wallet";
 
// create app
const app = createApp({ url: "http://127.0.0.1:5004" });
 
const application = "0xab7528bb862fb57e8a2bcd567a2e929a0be56a5e";
const token = "0xc6582A9b48F211Fa8c2B5b16CB615eC39bcA653B"; // ERC-721 address
app.addAdvanceHandler(async ({ metadata }) => {
    const voucher = createERC721TransferVoucher( 
        token, 
        application, 
        metadata.msg_sender, 
        1n, 
    ); 
    await app.createVoucher(voucher);
    return "accept";
});

Returns

Type: Voucher

Parameters

Type: Address

ERC-721 token address.

Type: Address

Source address.

Type: Address

Destination address.

Type: bigint

Token id.