A javascript SDK for web3 projects with curated community contracts to ease development and interactions with blockchain contracts.
$ npm install @taikai/dappkit
dappkit
offers tokens (ERC20, ERC721, ERC1155 and ERC4626) along with some other contracts, such as Staking and Voting, for ease of use. you can check all the models over at the SDK Documentation.
import {Web3Connection} from '@layerx-labs/dappkit';
const web3Connection = new Web3Connection({web3Host: 'https://rpc.tld'});
await web3Connection.connect();
console.log(`Address`, await web3Connection.getAddress());
It's possible to provide more options (such as privateKey
) to the Web3Connection
class.
Note: a Server side connection does not need to call
connect()
and should when needed provide aprivateKey
import {ERC20} from '@layerx-labs/dappkit';
const erc20 = new ERC20({ web3Host: 'http://rpc.tld' });
await erc20.deployJsonAbi(
'Token Name', // the name of the token
'$tokenSymbol', // the symbol of the token
"1000000000000000000000000", // the total amount of the token (with 18 decimals; 1M = 1000000000000000000000000)
"0xOwnerOfErc20Address" // the owner of the total amount of the tokens (your address)
);
console.log(`ERC20 address`, erc20.contractAddress);
Note: Full model documentation on the sdk
import {ERC721Collectibles} from '@layerx-labs/dappkit'
const erc721 = new ERC721Collectibles({web3Host: 'http://rpc.tld'});
await erc721.deployJsonAbi(
`Token Name`,
`$token_symbol`,
1, // how many packs can be open of this collectible (0 = infinite)
`0xAddressOfPurchasingAddress`, // address of the erc20 used to open packs
`0xBaseFeeAddress`, // address for where the main fee goes
`0xFeeAddress`, // address for where fee from purchases and pack shares
`0xAnotherAddress`); // adress for pack shares fee
console.log(`ERC721 address`, erc721.contractAddress)
Note: Full model documentation on the sdk
import {ERC1155Ownable} from "@layerx-labs/dappkit";
const erc1155 = new ERC1155Ownable({web3Host: 'http://rpc.tld'});
await erc1155.deployJsonAbi('http://my.token-uri.tld/');
console.log(`ERC1155 address`, erc1155.contractAddress);
Note: Full model documentation on the sdk
import {ERC4626} from "@layerx-labs/dappkit";
const erc4626 = new ERC4626({web3Host: 'http://rpc.tld'})
await erc4626.deployJsonAbi(`0xUnderlyingERC20Address`, `Vault Name`, `$vault_symbol`);
console.log(`ERC4626 address `, erc4626.contractAddress);
Note: Full model documentation on the sdk
Please refer to the test/
folder to read further usage examples of the various contracts available.
You can generate the documentation locally by issuing
$ npm run docs
and then serving the docs/
folder as a root http-server.
Contributions are welcomed, but we ask that you read existing code guidelines, specially the code format. Please review Contributor guidelines