@superfluid-finance/sdk-core
Version:
SDK Core for building with Superfluid Protocol
59 lines • 2.76 kB
TypeScript
import { JsonFragment } from "@ethersproject/abi";
import { ethers } from "ethers";
import Host from "./Host";
import Operation, { BatchOperationType } from "./Operation";
export interface IBatchCallOptions {
hostAddress: string;
operations: ReadonlyArray<Operation>;
}
export interface OperationStruct {
readonly operationType: number;
readonly target: string;
readonly data: string;
readonly value?: ethers.BigNumber;
}
export declare const batchOperationTypeStringToTypeMap: Map<BatchOperationType, number>;
/**
* Gets function arguments given an ABI and callData.
* @param abi the abi fragments of a contract/function
* @param callData call data of the function
* @returns {ethers.utils.Result} call agreement function arguments
*/
export declare const getCallDataFunctionArgs: (abi: string | readonly (string | ethers.utils.Fragment | JsonFragment)[], callData: string) => ethers.utils.Result;
/**
* BatchCall Helper Class
* @description A helper class to create `BatchCall` objects which can be executed.
*/
export default class BatchCall {
options: IBatchCallOptions;
host: Host;
constructor(options: IBatchCallOptions);
getCallDataFunctionArgs: (abi: string | readonly (string | ethers.utils.Fragment | JsonFragment)[], callData: string) => ethers.utils.Result;
/**
* Given an `Operation` object, gets the `OperationStruct` object.
* @param operation an `Operation` object
* @param index the index of the `Operation` in the batchCall
* @returns {Promise<OperationStruct>} OperationStruct object for batchCall
*/
getOperationStruct: (operation: Operation, index: number) => Promise<OperationStruct>;
/**
* Gets an array of `OperationStruct` objects to be passed to batchCall.
* @returns {Promise<OperationStruct>[]} array of operation struct promises
*/
get getOperationStructArrayPromises(): Promise<OperationStruct>[];
toOperation(): Promise<Operation>;
/**
* Executes a batch call given the operations on this class.
* @param signer the signer of the transaction
* @param gasLimitMultiplier A multiplier to provide gasLimit buffer on top of the estimated gas limit (1.2x is the default)
* @returns {Promise<ethers.ContractTransaction>} ContractTransaction object
*/
exec: (signer: ethers.Signer, gasLimitMultiplier?: number) => Promise<ethers.ContractTransaction>;
/**
* Executes a forward batch call given the operations on this class.
* @param signer the signer of the transaction
* @returns {Promise<ethers.ContractTransaction>} ContractTransaction object
*/
execForward: (signer: ethers.Signer) => Promise<ethers.ContractTransaction>;
}
//# sourceMappingURL=BatchCall.d.ts.map