@superfluid-finance/sdk-core
Version:
SDK Core for building with Superfluid Protocol
36 lines • 1.83 kB
JavaScript
import { ethers } from "ethers";
import Operation from "./Operation";
import { Superfluid__factory } from "./typechain-types";
/**
* Host Helper Class
* @description A helper class which can be used as a standalone class to populate call agreement transactions.
*/
export default 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(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(txn, "CALL_APP_ACTION");
};
this.contract = new ethers.Contract(hostAddress, Superfluid__factory.abi);
}
}
//# sourceMappingURL=Host.js.map