import type { JsonRpcProvider } from '@ethersproject/providers'; import { Signer } from 'ethers'; import { OnCreatePlugin, SupportedContracts } from '../../Fct/createPlugin'; import { IPluginCall, Variable } from '../plugins/corelibTypes'; import { AssetFlow, ChainId, FlowType, IPluginParams, ParamJSONData, PluginParamsInput, PluginParamsOutput, Protocol, RequiredApprovalInterface, RequiredApprovals, SetMethodParamsArgs, SetOutputParamsArgs, Type } from './FctParams'; import { Input } from './Input'; import { Output } from './Output'; export type PluginProviderType = { provider: JsonRpcProvider; signer: Signer; }; export type MethodParams = { name: string; type: string; value?: unknown; }[]; type MethodType = K & T; type Alert = { message: string; type: 'onError' | 'onSuccess' | 'onAny'; }; type ParamsWithMeta = { [key: string]: ParamJSONData; }; export interface JSONParams

extends JSON { protocol: P; type: T; method: M; name: PluginName; methodInterface: string; methodInterfaceHash: string; input: PluginParamsInput; output: PluginParamsOutput; contractInterface: string; contractInterfaceReturns: string; inputWithMeta: { [key: string]: ParamJSONData | ParamsWithMeta; }; outputWithMeta: { [key: string]: ParamJSONData | ParamsWithMeta; }; inputList: ParamJSONData[]; outputList: ParamJSONData[]; _flowType: FlowType; alerts?: Alert[]; } type Callback = (value: JSONParams, error: string | undefined, chainId: ChainId, gasLimit: string | undefined) => void; export type PluginName = undefined extends N ? M : N; export declare class Plugin

{ _protocol: P; _type: T; _method: M; _name: N | M; requiredApprovals?: ((params: Params['input'], chainId: ChainId, walletAddress?: string, waultAddress?: string, provider?: JsonRpcProvider, method?: M, isEstimation?: boolean) => RequiredApprovals) | undefined; assetFlow?: ((params: Params['input'], chainId: ChainId, walletAddress?: string, vaultAddress?: string, provider?: JsonRpcProvider, method?: M) => AssetFlow) | undefined; _walletAddress?: string | undefined; _vaultAddress?: string | undefined; _provider?: JsonRpcProvider | undefined; _flowType?: FlowType; input: Input; output: Output; chainId: ChainId; toEns?: string; create({ call }: { call: IPluginCall; }): Promise; get gasLimit(): string | undefined; get type(): T; get protocol(): P; get method(): MethodType; get provider(): JsonRpcProvider | undefined; get walletAddress(): string | undefined; get vaultAddress(): string | undefined; setMethod: (method: M) => void; payerIndex: number | undefined; constructor(_protocol: P, _type: T, _method: M, _name: N | M, chainId: ChainId, params: Params, requiredApprovals?: ((params: Params['input'], chainId: ChainId, walletAddress?: string, waultAddress?: string, provider?: JsonRpcProvider, method?: M, isEstimation?: boolean) => RequiredApprovals) | undefined, assetFlow?: ((params: Params['input'], chainId: ChainId, walletAddress?: string, vaultAddress?: string, provider?: JsonRpcProvider, method?: M) => AssetFlow) | undefined, initParams?: ParamsInput, _walletAddress?: string | undefined, _vaultAddress?: string | undefined, _provider?: JsonRpcProvider | undefined, _flowType?: FlowType); _description: string | undefined; _supportedContracts: Omit; _falseMeansFail: boolean | undefined; _usePureMethod: boolean | undefined; get name(): PluginName; setName(name: string): void; get description(): string; get supportedContracts(): Omit; get falseMeansFail(): boolean; get usePureMethod(): boolean; get methodParams(): { name: keyof Params['input']['methodParams'] & string; type: Params['input']['methodParams'][keyof Params['input']['methodParams']]['fctType']; value: Params['input']['methodParams'][keyof Params['input']['methodParams']]['value']; innerIndex?: number | undefined; messageType?: string | undefined; virtual?: boolean | undefined; }[]; get outputParams(): { name: keyof Params['input']['methodParams'] & string; type: Params['input']['methodParams'][keyof Params['input']['methodParams']]['fctType']; value: Params['input']['methodParams'][keyof Params['input']['methodParams']]['value']; innerIndex?: number | undefined; messageType?: string | undefined; virtual?: boolean | undefined; }[]; getMethodParams({ params }: { params: IPluginParams['input']['methodParams']; }): { name: keyof Params['input']['methodParams'] & string; type: Params['input']['methodParams'][keyof Params['input']['methodParams']]['fctType']; value: Params['input']['methodParams'][keyof Params['input']['methodParams']]['value']; innerIndex?: number | undefined; messageType?: string | undefined; virtual?: boolean | undefined; }[]; get contractInterface(): string; get contractInterfaceReturns(): string; get methodInterface(): string; get methodInterfaceHash(): string; calculateValuesOnUserInput?: { get: (p: { changedParamKey?: string; inputs?: Partial>; service?: any; signer?: Signer; }) => Promise>; error: string | undefined; }>; depParamKeys: string[] | (() => string[]); isSimulationNeeded?: boolean; } | undefined; setMethodParams: (params: SetMethodParamsArgs, method: string) => void; setOutputParams: (params: SetOutputParamsArgs) => void; estimateGasOnParams?: ((params: Params['input'], method: M, chainId: ChainId) => string) | undefined; beforeSimulate?: (p: { chainId: ChainId; input: Params['input']; output: Params['output']; provider?: { provider: InstanceType; signer: InstanceType; }; }) => Promise; get abi(): { protocol: P; method: MethodType; contractAddress?: string | Variable; inputs: { name: keyof Params['input']['methodParams'] & string; type: Params['input']['methodParams'][keyof Params['input']['methodParams']]['fctType']; value: Params['input']['methodParams'][keyof Params['input']['methodParams']]['value']; innerIndex?: number | undefined; messageType?: string | undefined; virtual?: boolean | undefined; }[]; }[]; set abi(abiInterface: { protocol: P; method: MethodType; contractAddress?: string | Variable; inputs: { name: keyof Params['input']['methodParams'] & string; type: Params['input']['methodParams'][keyof Params['input']['methodParams']]['fctType']; value: Params['input']['methodParams'][keyof Params['input']['methodParams']]['value']; innerIndex?: number | undefined; messageType?: string | undefined; virtual?: boolean | undefined; }[]; }[]); getOutputValues: ({ provider, execute, setEstimated, abi, walletSigner, withAutoApprovals, }: { provider: PluginProviderType; walletSigner?: Signer | undefined; withAutoApprovals?: boolean | undefined; abi?: string | undefined; execute?: boolean | undefined; setEstimated?: boolean | undefined; }) => Promise | { result?: undefined; } | { result: string | undefined; }>; getCalldata: (isEstimation?: boolean, testProvider?: JsonRpcProvider) => Promise<{ target: { value: string; type: string; }; callType: { value: string; type: string; }; value: { value: string; type: string; }; method: { value: string; type: string; }; data: { value: string; type: string; }; } | undefined>; private variableToValue; toJSONWithMeta(): JSONParams & string; fromJSONWithMeta(jsonWithMeta: string): boolean; toJSON(): JSONParams & string; fromJSON(json: string): boolean; private initMethodParams; private inputParamsTo; getRequiredApprovals: (isEstimation?: boolean) => RequiredApprovalInterface[]; getAssetFlow: () => AssetFlow; subscribe: ({ callback, id, }: { callback: Callback & string>; id: string; }) => void; unsubscribe: ({ id }: { id: string; }) => void; updateSubscriptions: () => void; get error(): string | undefined; setError(e: string | undefined): void; setValuesAsync?: (p: { chainId: ChainId; account: string; input?: Params['input']; output?: Params['output']; provider?: JsonRpcProvider; }) => Promise; _error: string | undefined; get currentGasLimit(): string | undefined; set currentGasLimit(gasLimit: string | undefined); getParamsOnCreate?: (p: { chainId: ChainId; params: Params['input']; isEstimation?: boolean; }) => Promise<{ params: IPluginParams['input']; method: string; gasLimit: string | undefined; plugin?: OnCreatePlugin; } | undefined>; observers: Map & string>>; private _currentGasLimit; private alerts; resetAlerts: () => void; getAlerts: () => Alert[] | undefined; setAlert: (alert: Alert) => void; private outputParamsTo; } export {};