@mirrorworld/evm.asset-minting
Client SDK
This SDK contains the client side methods for the Asset Minting EVM Smart Contract
Installation
🚨 Please make sure to add this NPM token in your .npmrc
file:
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
yarn add @mirrorworld/evm.asset-minting
Usage
Import the AssetMintingLib
instance into your client for using the Asset Minting 1155 Smart Contract. It expects
a contractAddress
and provider
instance.
Import the AssetMinting721Lib
instance into your client for using the Asset Minting 721 Smart Contract. It expects
a contractAddress
and provider
instance.
Import the TokenLib
instance into your client for using the ERC 1155 Token Smart Contract. It expects
a contractAddress
and provider
instance.
Import the Token721Lib
instance into your client for using the ERC 721 Token Smart Contract. It expects
a contractAddress
and provider
instance.
import {
AssetMintingLib,
TokenLib,
AssetMinting721Lib,
Token721Lib
} from "@mirrorworld/evm.asset-minting";
const RPC = "http://localhost:8500";
let provider = new ethers.providers.JsonRpcProvider(RPC);
const assetMinting1155Lib: AssetMintingLib = new AssetMintingLib("Contract Address", provider);
const token1155Lib: TokenLib = new TokenLib("Contract Address", provider);
const assetMinting721Lib: AssetMinting721Lib = new AssetMinting721Lib("Contract Address", provider);
const token721Lib: Token721Lib = new Token721Lib("Contract Address", provider);
Demo
Example:
You can see example project in this
repo for
721
and
1155
Deploy 721 Token
Deploy the new 721 token from the contract.
const messageHash = assetMintingLib.getDeployTokenMessageHash(salt, tokenOwnerAddress.address, baseUrl, name, symbol, trackMint, burnEnable, mintEnable, mintStartId, mintEndId);
const sig = await assetMintingLib.signMessage(ownerWallet, messageHash);
const tx: TransactionRequest = await assetMintingLib.createDeployTokenTransactionRequest(salt,
tokenOwnerAddress.address,
baseUrl,
name,
symbol,
trackMint,
burnEnable,
mintEnable,
mintStartId,
mintEndId,
sig,
gasPrice,
gasLimit);
const sigTx = await tokenOwnerAddress.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();
tokenAddress = txRe.logs[0].address;
Deploy 1155 Token
Deploy the new 1155 token from the contract.
const messageHash = assetMintingLib.getDeployTokenMessageHash(salt, tokenOwnerAddress.address, baseUrl, trackMint, burnEnable, mintEnable, mintStartId, mintEndId, mintAmount);
const sig = await assetMintingLib.signMessage(ownerWallet, messageHash);
const tx: TransactionRequest = await assetMintingLib.createDeployTokenTransactionRequest(salt,
tokenOwnerAddress.address,
baseUrl,
trackMint,
burnEnable,
mintEnable,
mintStartId,
mintEndId,
mintAmount,
sig,
gasPrice,
gasLimit);
const sigTx = await tokenOwnerAddress.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();
tokenAddress = txRe.logs[0].address;
Mint 721 Token
Mint method for minting the 721 token from the contract.
const messageHash = assetMintingLib.getMintTokenMessageHash(salt, tokenAddress, caller.address, toAddress, tokenId);
const sig = await assetMintingLib.signMessage(ownerWallet, messageHash);
const tx: TransactionRequest = await assetMintingLib.createMintTokenTransactionRequest(salt,
tokenAddress,
caller.address,
toAddress,
tokenId,
sig,
gasPrice,
gasLimit);
const sigTx = await caller.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();
Safe Mint 721 Token
Safe Mint method for minting the 721 token from the contract.
const messageHash = assetMintingLib.getSafeMintTokenMessageHash(salt, tokenAddress, caller.address, toAddress, tokenId);
const sig = await assetMintingLib.signMessage(ownerWallet, messageHash);
const tx: TransactionRequest = await assetMintingLib.createSafeMintTokenTransactionRequest(salt,
tokenAddress,
caller.address,
toAddress,
tokenId,
sig,
gasPrice,
gasLimit);
const sigTx = await caller.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();
Mint Single 1155 Token
Mint method for minting single 1155 token from the contract.
const messageHash = assetMintingLib.getMintTokenMessageHash(salt, tokenAddress, caller.address, toAddress, tokenId, amount, tokenData);
const sig = await assetMintingLib.signMessage(ownerWallet, messageHash);
const tx: TransactionRequest = await assetMintingLib.createMintTokenTransactionRequest(salt,
tokenAddress,
caller.address,
toAddress,
tokenId,
amount,
tokenData,
sig,
gasPrice,
gasLimit);
const sigTx = await caller.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();
Mint Batch 1155 Tokens
Mint method for minting batch 1155 tokens from the contract.
const messageHash = assetMintingLib.getMintBatchTokenMessageHash(salt, tokenAddress, caller.address, toAddress, tokenIds, amounts, tokenData);
const sig = await assetMintingLib.signMessage(ownerWallet, messageHash);
const tx: TransactionRequest = await assetMintingLib.createMintBatchTokenTransactionRequest(salt,
tokenAddress,
caller.address,
toAddress,
tokenIds,
amounts,
tokenData,
sig,
gasPrice,
gasLimit);
const sigTx = await caller.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();
Enable Or Disable Minting By Token Owner
Enable or disable minting by token owner for asset minting 721 and 1155 contract.
const messageHash = assetMintingLib.getEnableOrDisableMintingByTokenOwnerMessageHash(salt, tokenAddress, tokenOwnerWallet.address, value);
const sig = await assetMintingLib.signMessage(ownerWallet, messageHash);
const tx: TransactionRequest = await assetMintingLib.createEnableOrDisableMintingByTokenOwnerTransactionRequest(salt,
tokenAddress,
tokenOwnerWallet.address,
value,
sig,
gasPrice,
gasLimit);
const sigTx = await tokenOwnerWallet.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();
Enable Or Disable Burn By Token Owner
Enable or disable burn by token owner for asset minting 721 and 1155 contract.
const messageHash = assetMintingLib.getEnableOrDisableBurnByTokenOwnerMessageHash(salt, tokenAddress, tokenOwnerWallet.address, value);
const sig = await assetMintingLib.signMessage(ownerWallet, messageHash);
const tx: TransactionRequest = await assetMintingLib.createEnableOrDisableBurnByTokenOwnerTransactionRequest(salt,
tokenAddress,
tokenOwnerWallet.address,
value,
sig,
gasPrice,
gasLimit);
const sigTx = await tokenOwnerWallet.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();
Token Paused Or Unpaused By Token Owner
Token paused or unpaused by token owner for asset minting 721 and 1155 contract.
const messageHash = assetMintingLib.getTokenPausedOrUnpausedByTokenOwnerMessageHash(salt, tokenAddress, tokenOwnerWallet.address, value);
const sig = await assetMintingLib.signMessage(ownerWallet, messageHash);
const tx: TransactionRequest = await assetMintingLib.createTokenPausedOrUnpausedByTokenOwnerTransactionRequest(salt,
tokenAddress,
tokenOwnerWallet.address,
value,
sig,
gasPrice,
gasLimit);
const sigTx = await tokenOwnerWallet.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();
Append Mint End Id By Token Owner
Append mint end id by token owner for asset minting 721 and 1155 contract.
const messageHash = assetMintingLib.getAppendMintEndIdByTokenOwnerMessageHash(salt, tokenAddress, tokenOwnerWallet.address, value);
const sig = await assetMintingLib.signMessage(ownerWallet, messageHash);
const tx: TransactionRequest = await assetMintingLib.createAppendMintEndIdByTokenOwnerTransactionRequest(salt,
tokenAddress,
tokenOwnerWallet.address,
value,
sig,
gasPrice,
gasLimit);
const sigTx = await tokenOwnerWallet.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();
Append Mint Amount By Token Owner
Append mint amount by token owner for asset minting 1155 contract.
const messageHash = assetMintingLib.getAppendMintAmountByTokenOwnerMessageHash(salt, tokenAddress, tokenOwnerWallet.address, value);
const sig = await assetMintingLib.signMessage(ownerWallet, messageHash);
const tx: TransactionRequest = await assetMintingLib.createAppendMintAmountByTokenOwnerTransactionRequest(salt,
tokenAddress,
tokenOwnerWallet.address,
value,
sig,
gasPrice,
gasLimit);
const sigTx = await tokenOwnerWallet.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();
Unlimited Mint Ids And Amount By Token Owner
Unlimited mint ids and amount by token owner for asset minting 721 and 1155 contract.
const messageHash = assetMintingLib.getUnlimitedMintIdsAndAmountByTokenOwnerMessageHash(salt, tokenAddress, tokenOwnerWallet.address);
const sig = await assetMintingLib.signMessage(ownerWallet, messageHash);
const tx: TransactionRequest = await assetMintingLib.createSetUnlimitedMintIdsAndAmountByTokenOwnerTransactionRequest(salt,
tokenAddress,
tokenOwnerWallet.address,
sig,
gasPrice,
gasLimit);
const sigTx = await tokenOwnerWallet.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();
Set Verify Sig Address
Set verify sig contract address for asset minting 721 and 1155 contract.
const tx: TransactionRequest = await assetMintingLib.createSetVerifySigAddressTransactionRequest(
contractOwnerWallet.address,
address,
gasPrice,
gasLimit);
const sigTx = await contractOwnerWallet.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();
Set Messages Address
Set messages contract address for asset minting 721 and 1155 contract.
const tx: TransactionRequest = await assetMintingLib.createSetMessagesAddressTransactionRequest(
contractOwnerWallet.address,
address,
gasPrice,
gasLimit);
const sigTx = await contractOwnerWallet.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();
Set Token Factory Address
Set token factory contract Address for asset minting 721 and 1155 contract.
const tx: TransactionRequest = await assetMintingLib.createSetTokenFactoryAddressTransactionRequest(
contractOwnerWallet.address,
address,
gasPrice,
gasLimit);
const sigTx = await contractOwnerWallet.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();
Deactivate Token
Deactivate token for asset minting 721 and 1155 contract.
const tx: TransactionRequest = await assetMintingLib.createDeactivateTokenTransactionRequest(
contractOwnerWallet.address,
tokenAddress,
gasPrice,
gasLimit);
const sigTx = await contractOwnerWallet.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();
Activate Token
Activate token for asset minting 721 and 1155 contract.
const tx: TransactionRequest = await assetMintingLib.createActivateTokenTransactionRequest(
contractOwnerWallet.address,
tokenAddress,
gasPrice,
gasLimit);
const sigTx = await contractOwnerWallet.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();
Deactivate And Paused Token
Deactivate and paused token for asset minting 721 and 1155 contract.
const tx: TransactionRequest = await assetMintingLib.createDeactivateAndPausedTokenTransactionRequest(
contractOwnerWallet.address,
tokenAddress,
gasPrice,
gasLimit);
const sigTx = await contractOwnerWallet.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();
Activate And Unpaused Token
Activate and unpaused token for asset minting 721 and 1155 contract.
const tx: TransactionRequest = await assetMintingLib.createActivateAndUnpausedTokenTransactionRequest(
contractOwnerWallet.address,
tokenAddress,
gasPrice,
gasLimit);
const sigTx = await contractOwnerWallet.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();
Enable Or Disable Token Minting
Enable or disable token minting for asset minting 721 and 1155 contract.
const tx: TransactionRequest = await assetMintingLib.createEnableOrDisableTokenMintingTransactionRequest(
contractOwnerWallet.address,
tokenAddress,
value,
gasPrice,
gasLimit);
const sigTx = await contractOwnerWallet.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();
Enable Or Disable Token Burn
Enable or disable token burn for asset minting 721 and 1155 contract.
const tx: TransactionRequest = await assetMintingLib.createEnableOrDisableTokenBurnTransactionRequest(
contractOwnerWallet.address,
tokenAddress,
value,
gasPrice,
gasLimit);
const sigTx = await contractOwnerWallet.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();
Pause Or Unpause Token
Pause or unpause token for asset minting 721 and 1155 contract.
const tx: TransactionRequest = await assetMintingLib.createPauseOrUnpauseTokenTransactionRequest(
contractOwnerWallet.address,
tokenAddress,
value,
gasPrice,
gasLimit);
const sigTx = await contractOwnerWallet.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();
Pause Or Unpause Contract
Pause or unpause contract for asset minting 721 and 1155 contract.
const tx: TransactionRequest = await assetMintingLib.createPauseOrUnpauseContractTransactionRequest(
contractOwnerWallet.address,
value,
gasPrice,
gasLimit);
const sigTx = await contractOwnerWallet.signTransaction(tx);
const sentTx = await provider.sendTransaction(sigTx);
const txRe = await sentTx.wait();