All objects are created in a similar fashion, and we will use StakingContract as an example
Line 1 Import the Object
Line 7 Create a new Object
Line 13 Login to access the Address & Network via Metamask
Line 20 Deploy the new Object
Line 23 Access Functions
Here you can create a Staking Contract with a given ERC20 Contract Address, login with metamask & connect with solidity methods available
import { Application, DexStorage, ERC20Contract, StakingContract, ERC20TokenLock, ERC721Collectibles, ERC721Standard} from'bepro-js';/* 1.1 - Instantiate the App for Metamask functionality */let app =newApplication({ opt : { web3Connection :'WEB3_LINK' } });/* 1.2 - Instantiate Object Object or any other in a similar way (Staking, ERC20 etc..) */let staking =newStakingContract({ contractAddress :null,/* Contract Address (optional) */ opt : { web3Connection :'WEB3_LINK' } }):/* 2 - Connect the App/Contract to the Metamask Web3 Injected wallet*/awaitapp.login();awaitstaking.login();/* or instantiate with the provided web3Connection, for tests it was already done at object creation */awaitapp.start();awaitstaking.start();/* 4 - Deploy Data */awaitstaking.deploy();/* 5 - Access other Methods */awaitstaking.availableTokens();
What if the contract was deployed already?
If the Contract is already deployed the use case is very similar
Line 1 Import the Object
Line 7 Create a new Object
Line 13 Login to access the Address & Network via Metamask
Line 20 Assert the Object
Line 23 Access Functions
import { Application, DexStorage, ERC20Contract, StakingContract, ERC20TokenLock, ERC721Collectibles, ERC721Standard} from'bepro-js';/* 1.1 - Instantiate the App for Metamask functionality */let app =newApplication({ opt : { web3Connection :'WEB3_LINK' } });/* 1.2 - Instantiate Object Object or any other in a similar way (Staking, ERC20 etc..) */let staking =newStakingContract({ contractAddress :null,/* Contract Address (optional) */ opt : { web3Connection :'WEB3_LINK' } }):/* 2 - Connect the App/Contract to the Metamask Web3 Injected wallet*/awaitapp.login();awaitstaking.login();/* or instantiate with the provided web3Connection, for tests it was already done at object creation */awaitapp.start();awaitstaking.start();/* 4 - Deploy Data */awaitstaking.__assert();/* 5 - Access other Methods */awaitstaking.availableTokens();