@ardier16/q-js-sdk
Version:
Typescript Library to interact with Q System Contracts
46 lines • 1.89 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TimeLockHelperInstance = void 0;
const SystemContractInstance_1 = require("./SystemContractInstance");
/**
* Abstract Timelock instance to interact with QVault, Saving, RootNodes and Validators contracts.
* See [onchain documentation](@system-contracts-repo/@network/ATimeLockBase/) for more details.
*/
class TimeLockHelperInstance extends SystemContractInstance_1.SystemContractInstance {
constructor(web3, abi, address) {
super(web3, abi, address);
}
/**
* [External documentation](@system-contracts-repo/@network/ATimeLockBase/#depositonbehalfof)
*/
async depositOnBehalfOf(account, start, end, txOptions) {
return this.submitTransaction(this.instance.methods.depositOnBehalfOf(account, start, end), txOptions);
}
/**
* [External documentation](@system-contracts-repo/@network/ATimeLockBase/#gettimelocks)
*/
async getTimeLocks(account) {
const timelocks = this.instance.methods.getTimeLocks(account).call();
return (await timelocks).map(e => {
return {
amount: e[0],
releaseStart: e[1],
releaseEnd: e[2]
};
});
}
/**
* [External documentation](@system-contracts-repo/@network/ATimeLockBase/#getminimumbalance)
*/
async getMinimumBalance(account, timestamp) {
return this.instance.methods.getMinimumBalance(account, timestamp).call();
}
/**
* [External documentation](@system-contracts-repo/@network/ATimeLockBase/#purgetimelocks)
*/
async purgeTimeLocks(account, txOptions) {
return this.submitTransaction(this.instance.methods.purgeTimeLocks(account), txOptions);
}
}
exports.TimeLockHelperInstance = TimeLockHelperInstance;
//# sourceMappingURL=TimeLockHelperInstance.js.map