Skip to content

Latest commit

 

History

History

ft

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Fungible token (FT)

Mint a fungible token with metadata.

Get started

import { Contract } from "./mod.ts";
import {
  Blockfrost,
  Lucid,
} from "https://deno.land/x/[email protected]/mod.ts";

const lucid = await Lucid.new(
  new Blockfrost(
    "https://cardano-preprod.blockfrost.io/api/v0",
    "<project_id>",
  ),
  "Preprod",
);

lucid.selectWalletFromSeed(
  "<seed_phrase>",
);

const totalSupply = 1000000000n;

const { instanceId } = await new Contract(lucid)
  .deploy(totalSupply, {
    name: "MyFT",
    description: "This is my fungible token.",
    decimals: 2,
  });

// ... wait for confirmation

const contract = new Contract(
  lucid,
  instanceId,
);

console.log(await contract.getMetadata());

// Burn specific quantity of FT
await contract.burn(2000n);

Contract instance

deploy(totalSupply: bigint, metadata: Metadata): Promise<{ txHash: string; instanceId: string; }>
getMetadata(): Promise<Metadata>
changeMetadata(metadata: Metadata): Promise<string>
burn(quantity: bigint): Promise<string>
transferOwnership(address: string, datum?: string | undefined): Promise<string>
renounceOwnership(): Promise<string>