UNPKG

@newfound8ion/newcoin.pools-js

Version:

js module to fetch data from the newcoin.pools smart contract

64 lines (63 loc) 2.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ActionGenerator = void 0; /* tslint:disable:variable-name */ class ActionGenerator { constructor(contract, token_contract) { this.contract = contract; this.token_contract = token_contract; } async open(authorization, owner, symbol, payer) { return this._pack(this.contract, authorization, "open", { owner, symbol, payer, }); } async close(authorization, owner, symbol) { return this._pack(this.contract, authorization, "close", { owner, symbol, }); } async createPool(authorization, owner, description, ticker, is_inflatable, is_deflatable, is_treasury) { return this._pack(this.contract, authorization, "createpool", { owner, description, ticker, is_inflatable, is_deflatable, is_treasury, }); } async addToWhiteList(authorization, pool_id, user) { return this._pack(this.contract, authorization, "addwhlst", { pool_id, user, }); } async rmvFromWhiteList(authorization, pool_id, user) { return this._pack(this.contract, authorization, "rmvwhlst", { pool_id, user, }); } async stakeToPool(authorization, from, quantity, pool_id) { return this._pack(this.token_contract, authorization, "transfer", { from: from, to: this.contract, quantity: quantity, memo: "pool:" + pool_id, }); } async withdrawFromPool(authorization, owner, quantity) { return this._pack(this.contract, authorization, "withdraw", { owner, quantity, }); } _pack(account, authorization, name, data) { return [{ account, name, authorization, data }]; } } exports.ActionGenerator = ActionGenerator;