@ardier16/q-js-sdk
Version:
Typescript Library to interact with Q System Contracts
59 lines • 2.52 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SavingInstance = void 0;
const SystemContractInstance_1 = require("../SystemContractInstance");
const CompoundRateKeeperInstance_1 = require("../common/CompoundRateKeeperInstance");
/**
* Saving instance to interact with Saving contract.
* See [onchain documentation](@system-contracts-repo/@network/Saving/) for more details.
* An instance of this class for a deployed network can be obtained via {@link ContractRegistryInstance.saving}
*/
class SavingInstance extends SystemContractInstance_1.SystemContractInstance {
constructor(web3, address) {
super(web3, 'Saving.json', address);
}
/** @deprecated use getCompoundRateKeeper */
async compoundRateKeeper() {
return this.instance.methods.compoundRateKeeper().call();
}
/**
* [External documentation](@system-contracts-repo/@network/Saving/#getcompoundratekeeper)
*/
async getCompoundRateKeeper() {
const compoundRateKeeperAddress = await this.instance.methods.compoundRateKeeper().call();
return new CompoundRateKeeperInstance_1.CompoundRateKeeperInstance(this.adapter.web3, compoundRateKeeperAddress);
}
/**
* [External documentation](@system-contracts-repo/@network/Saving/#normalizedcapitals)
*/
async normalizedCapitals(address) {
return this.instance.methods.normalizedCapitals(address).call();
}
/**
* [External documentation](@system-contracts-repo/@network/Saving/#getbalancedetails)
*/
async getBalanceDetails(address) {
const balanceDe = await this.instance.methods.getBalanceDetails().call({ from: address });
return balanceDe;
}
/**
* [External documentation](@system-contracts-repo/@network/Saving/#updatecompoundrate)
*/
async updateCompoundRate(txOptions) {
return this.submitTransaction(this.instance.methods.updateCompoundRate(), txOptions);
}
/**
* [External documentation](@system-contracts-repo/@network/Saving/#deposit)
*/
async deposit(amount, txOptions) {
return this.submitTransaction(this.instance.methods.deposit(amount), txOptions);
}
/**
* [External documentation](@system-contracts-repo/@network/Saving/#withdraw)
*/
async withdraw(amount, txOptions) {
return this.submitTransaction(this.instance.methods.withdraw(amount), txOptions);
}
}
exports.SavingInstance = SavingInstance;
//# sourceMappingURL=SavingInstance.js.map