import { x } from '../../interfaces';
* @param {X~Options} options
class X extends IContract {
constructor(params = {}) {
super({ abi: x, ...params });
* Asserts a new {@link ERC20Contract} on the current address
* @return {Promise<void>}
* @throws {Error} Contract is not deployed, first deploy it and provide a contract address
if (!this.getAddress()) {
'Contract is not deployed, first deploy it and provide a contract address',
this.params.contract.use(x, this.getAddress());
// Set Token Address Contract for easy access
this.params.ERC20Contract = new ERC20Contract({
web3Connection: this.web3Connection,
contractAddress: params.tokenAddress,
await this.params.ERC20Contract.__assert();
* @param {Object} params Parameters
* @param {number} params.itemId Item Id
* @returns {Promise<Transaction>} Transaction
action1 = async ({ itemId }) => await this.__sendTx(
this.params.contract.getContract().methods.action1(itemId),
* User deploys the contract
* @param {Object} params Parameters
* @param {string} params.variable1 Variable 1 of the Contract
* @param {string} params.variable2 Variable 2 of the Contract
* @param {Address} params.tokenAddress token Address of the purchase Token in use
* @returns {Promise<boolean>} Success the Tx Object if operation was successful
variable1, variable2, tokenAddress, callback,
const params = [variable1, variable2, tokenAddress];
const res = await this.__deploy(params, callback);
this.params.contractAddress = res.contractAddress;
/* Call to Backend API */
* @return ERC20Contract|undefined
getERC20Contract = () => this.params.ERC20Contract;