const sdk = new CryptumSdk({
environment: 'testnet',
apiKey: 'YOUR-API-KEY',
})
Create ERC20 token
sdk.token.create(opts)
The smart contract used in this deployment is already precompiled in Cryptum. For more details, you can see the source code here ./contracts/TokenERC20.sol.
opts.wallet (Wallet) (required) - wallet creating the token.
Now you must have or create a Wallet object using the SDK. This wallet will be used to send transactions to the blockchain in order to create your token, so make sure it has enough funds to perform all the desired interactions.
The function returns the transaction hash of the smart contract deployment to the blockchain. To use this new token you need its address which you can retrive it from like this:
Besides ERC20-based tokens, you also can transfer native tokens by passing the native token symbol instead of the token address. Depending on the protocol you're using there are the supported native tokens that you can transfer:
Now we must call the sdk.token.create function on the SDK. The smart contract used in this deployment is in the directory, so you must pass as arguments the token name, token symbol, decimals (integer number) and the amount of total supply.