@sfpro/sdk
Version:
TypeScript SDK for Superfluid Protocol - stream money every second
47 lines (46 loc) • 1.74 kB
TypeScript
export declare const OPERATION_TYPE: {
readonly UNSUPPORTED: 0;
readonly ERC20_APPROVE: 1;
readonly ERC20_TRANSFER_FROM: 2;
/** @deprecated Prefer ERC20 transfer. */
readonly ERC777_SEND: 3;
readonly ERC20_INCREASE_ALLOWANCE: 4;
readonly ERC20_DECREASE_ALLOWANCE: 5;
readonly SUPERTOKEN_UPGRADE: 101;
readonly SUPERTOKEN_DOWNGRADE: 102;
readonly SUPERFLUID_CALL_AGREEMENT: 201;
readonly CALL_APP_ACTION: 202;
readonly SIMPLE_FORWARD_CALL: 301;
readonly ERC2771_FORWARD_CALL: 302;
};
export type OperationType = (typeof OPERATION_TYPE)[keyof typeof OPERATION_TYPE];
export type Operation = {
operationType: OperationType;
target: `0x${string}`;
data: `0x${string}`;
};
export declare const stripFunctionSelector: (callData: `0x${string}`) => `0x${string}`;
type PrepareOperationDataArgs<T extends OperationType> = T extends typeof OPERATION_TYPE.SUPERFLUID_CALL_AGREEMENT ? {
operationType: T;
data: `0x${string}`;
userData?: `0x${string}`;
} : {
operationType: T;
data: `0x${string}`;
};
export declare function prepareOperationData<T extends OperationType>({ operationType, data, ...rest }: PrepareOperationDataArgs<T>): `0x${string}`;
type PrepareOperationArgs<T extends OperationType> = {
target: `0x${string}`;
} & PrepareOperationDataArgs<T>;
export declare function prepareOperation<T extends OperationType>(args: PrepareOperationArgs<T>): Operation;
export declare const TIME_UNIT: {
readonly second: 1;
readonly minute: 60;
readonly hour: 3600;
readonly day: 86400;
readonly week: 604800;
readonly month: 2628000;
readonly year: 31536000;
};
export type TimeUnit = (typeof TIME_UNIT)[keyof typeof TIME_UNIT];
export {};