@superfluid-finance/sdk-core
Version:
SDK Core for building with Superfluid Protocol
42 lines • 2.13 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const ethers_1 = require("ethers");
const Operation_1 = __importDefault(require("./Operation"));
const typechain_types_1 = require("./typechain-types");
/**
* Host Helper Class
* @description A helper class which can be used as a standalone class to populate call agreement transactions.
*/
class Host {
constructor(hostAddress) {
/**
* Creates an Operation of the `callAgreement` function on the host contract.
* @param agreementAddress the agreement address (cfa or ida address)
* @param callData the encoded callData for the function
* @param userData any additional user data
* @param overrides ethers overrides object for more control over the transaction sent.
* @returns {Operation} an `Operation` class
*/
this.callAgreement = (agreementAddress, callData, userData, overrides) => {
const txn = this.contract.populateTransaction.callAgreement(agreementAddress, callData, userData || "0x", overrides || {});
return new Operation_1.default(txn, "SUPERFLUID_CALL_AGREEMENT");
};
/**
* Creates an Operation of the `callAppAction` function on the host contract.
* @param app the address of the Super App you are calling
* @param callData the encoded callData for the function
* @param overrides ethers overrides object for more control over the transaction sent.
* @returns {Operation} an `Operation` class
*/
this.callAppAction = (app, callData, overrides) => {
const txn = this.contract.populateTransaction.callAppAction(app, callData, overrides || {});
return new Operation_1.default(txn, "CALL_APP_ACTION");
};
this.contract = new ethers_1.ethers.Contract(hostAddress, typechain_types_1.Superfluid__factory.abi);
}
}
exports.default = Host;
//# sourceMappingURL=Host.js.map
;