dappKit Documentation
  • About dappKit
  • Start building
    • Installation
    • How To Guides
      • Create a Web3Connection
      • Create an ERC20 Token
      • Create an ERC1155
      • Create an ERC721
      • Create your NFT Art Gallery
      • Create other Project
      • Create custom Object
    • Examples
  • Use Cases
  • How to Contribute
  • External Links
    • SDK Documentation
    • GitHub
  • Community
    • Discord Server
    • Support
Powered by GitBook
On this page
  1. Start building
  2. How To Guides

Create an ERC1155

PreviousCreate an ERC20 TokenNextCreate an ERC721

Last updated 3 years ago

A very simple example on how to deploy/access your own ERC-1155 contract aka Multi Token Contract.

In order to instantiate the ERC1155 you will need to provide a instance object or a

import { ERC1155Standard, Web3Connection } from '@taikai/dappkit';

/* Create your web3Connection */
const web3Connection = new Web3Connection({ 
 web3Host: 'WEB3_LINK',
 /* privateKey: '' */
});

await web3Connection.start();
await web3Connection.connect(); // if a privateKey was provided, can be ignored

/* Create an ERC1155Standard Deployer */
const deployer = new ERC1155Standard(web3Connection);

/* Deploy the ERC1155 Contract */
await deployer.loadAbi();
const tx = await deployer.deployJsonAbi('http://localhost:1337/');
 
/* Instantiate and use your new ERC1155 Token Contract*/
const erc1155Contract = new ERC1155Standard(web3connection, tx.contractAddress);
await erc1155Contract.start();

erc1155Contract.mint('0xTO_ADDRESS', 0, 1000, '0x12345678');

If you prefer your contract to be ownable, you can appeal to the erc-1155 ownable version:

import { ERC1155Ownable, Web3Connection } from '@taikai/dappkit';

/* Create your web3Connection */
const web3Connection = new Web3Connection({ 
 web3Host: 'WEB3_LINK',
 /* privateKey: '' */
});

await web3Connection.start();
await web3Connection.connect(); // if a privateKey was provided, can be ignored

/* Create an ERC1155Ownable Deployer */
const deployer = new ERC1155Ownable(web3Connection);

/* Deploy the ERC1155 Contract */
await deployer.loadAbi();
const tx = await deployer.deployJsonAbi('http://localhost:1337/');
 
/* Instantiate and use your new ERC1155 Token Contract*/
const erc1155Contract = new ERC1155Ownable(web3connection, tx.contractAddress);
await erc1155Contract.start();

erc1155Contract.mint('0xTO_ADDRESS', 0, 1000, '0x12345678');

Looking for more functions?

See all available functions

Web3Connection
Web3ConnectionOptions
here