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 other Project

Simple Usage of the dappkit

All objects are created in a similar fashion, and we will use StakingContract as an example

Here you can create a Staking Contract with a given ERC20 Contract Address, login with metamask & connect with solidity methods available

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

const web3Connection = new Web3Connection({ 
    web3Host: 'WEB3_LINK'
});

await web3Connection.start();

const deployer = new StakingContract(web3Connection);
await deployer.loadAbi();

await web3Connection.connect();

const tx = await deployer.deployJsonAbi('0xCONTRACT_ADDRESS');

// Creating new Instance of StakingContract to be able to access the tokens
const stakingContract = new StakingContract(web3Connection, tx.contractAddress);
await stakingContract.start();
​
console.log(await stakingContract.availableTokens());

What if the contract was deployed already?

If the Contract is already deployed the use case is very similar

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

const web3Connection = new Web3Connection({
    web3Host: 'WEB3_LINK'
});

await web3Connection.start();

const stakingContrat = new StakingContract(web3Connection, '0xCONTRACT_ADDRESS');
await stakingContrat.start();

await web3Connection.connect();

console.log(await stakingContrat.availableTokens());
PreviousCreate your NFT Art GalleryNextCreate custom Object

Last updated 3 years ago