import { Address } from 'viem'; import { Communicator as Communicator$1, AutomationLogResponse as AutomationLogResponse$1, AutomationSubscription as AutomationSubscription$1, BuilderParams as BuilderParams$1, AddAutomationParams as AddAutomationParams$1, CancelAutomationParams as CancelAutomationParams$1, PreComputedAddressData as PreComputedAddressData$1, AutomationSubscriptionLimits as AutomationSubscriptionLimits$1, TransferCalldataResponse as TransferCalldataResponse$1, PrecomputeResponse as PrecomputeResponse$1, TaskStatusData as TaskStatusData$1 } from '@/types'; declare class AutomationContextFetcher { private readonly communicator; constructor(communicator: Communicator$1, apiKey: string); fetchAutomationLogs(automationId: string): Promise; fetchAutomationSubscriptions(accountAddress: Address, chainId: number): Promise; } declare class BuilderCaller { private readonly communicator; constructor(communicator: Communicator$1, apiKey: string); addToTxnBuilder(params: BuilderParams$1, automationName: string): Promise; addAutomation(params: AddAutomationParams$1): Promise; cancelAutomation(params: CancelAutomationParams$1): Promise; } type TAsset = { name: string; symbol?: string; icon?: React.ReactNode | string; address: Address; chainId: number; logo: string; decimals: number; balanceOf?: BalanceOf; value: string; prices: { default: number; [key: string]: number; }; apy?: number; assetSubtitle?: string; actions: Action[]; verified?: boolean; isImported?: boolean; core?: boolean; }; type ActionCategory = "strategy" | "action" | "automation"; type Action = { id: number; name: string; logo: string; apy: number; chainId: number; category: ActionCategory; getTransactionCustomView?: (params?: any) => React.ReactNode; getTransactionExpandedCustomView?: (params?: any) => React.ReactNode; metadata?: { overview: string; supportedAssets?: string[]; baseEntityId: number; canStack: boolean; }; }; type BalanceOf = { decimals: number; formatted: string; symbol: string; value: bigint; }; type UserClientFactory = { eoa: Address; accountAddress: Address; chainId: number; assets: TAsset[]; }; interface Communicator { send(method: M, params: P): Promise>; } type SDKRequestData = { id: RequestId; params: P; env: { sdkVersion: string; }; method: M; }; type SDKMessageEvent = MessageEvent; declare enum Methods { getClientFactory = "getClientFactory", addToTxnBuilder = "addToTxnBuilder", addAutomation = "addAutomation", cancelAutomation = "cancelAutomation" } type RequestId = string; interface MethodToResponse { [Methods.getClientFactory]: UserClientFactory; [Methods.addToTxnBuilder]: void; [Methods.addAutomation]: void; [Methods.cancelAutomation]: void; } type ErrorResponse = { id: RequestId; success: false; error: string; version?: string; }; type SuccessResponse = { id: RequestId; data: T; version?: string; success: true; }; type InterfaceMessageEvent = MessageEvent; type Response = ErrorResponse | SuccessResponse; /******** Automation Context Types **********/ type AutomationLogResponse = { id: string; subaccount_address: Address; chain_id: number; metadata: { req: { to: string; data: string; value: string; chainID: number; operation: number; subaccount: Address; }; taskID: string; transitionState: { prev: { feesAmount: string; inputAmount: string; targetVault: Address; generatedYield: string; } | null; current: { feesAmount: "1000"; inputAmount: "7999"; targetVault: Address; generatedYield: "-1"; }; }; }; message: string; sub_id: string; createdAt: string; outputTxHash: string; }; type AutomationSubscription = { chainId: number; commitHash: string; createdAt: string; duration: number; feeAmount: string; feeToken: Address; id: string; metadata: { baseToken: string; every: string; }; registryId: string; status: number; subAccountAddress: Address; tokenInputs: Record; tokenLimits: Record; }; /******** Builder Caller Types **************/ type Transaction = { toAddress: string; callData: string; value: bigint; }; type BuilderParams = { transactions: Transaction[]; }; type AddToTxnBuilderParams = { params: BuilderParams; automationName: string; }; type AddAutomationParams = { tokenLimits: Record<`0x${string}`, string>; tokenInputs: Record<`0x${string}`, string>; registryId: string; feeToken: Address; feeAmount: string; metadata: Record; }; type CancelAutomationParams = { subaccount: Address; }; /********* Public Deployer Types *************/ type AutomationSubscriptionLimits = { duration: number; tokenInputs: Record; tokenLimits: Record; }; type PreComputedAddressData = { precomputedAddress: Address; feeEstimate: string; feeEstimateSignature: string; }; type TransferCalldataResponse = { signaturePayload: { domain: { verifyingContract: Address; chainId: string; name: string; salt: string; version: string; }; message: { to: Address; baseGas: number; data: string; gasPrice: number; gasToken: Address; nonce: number; operation: number; refundReceiver: Address; safeTxGas: number; value: number; }; primaryType: "SafeTx"; types: { SafeTx: { name: string; type: string; }[]; }; }; subAccountPolicyCommit: string; subscriptionDraftID: string; }; type PrecomputeResponse = { subAccountAddress: string; consoleAddress: string; }; type TaskIdStatusType = "pending" | "executing" | "cancelled" | "successful" | "failed"; type TaskStatusData = { taskId: string; metadata: { request: unknown; response: { isSuccessful: boolean; error: string | null; transactionHash: string | null; }; }; outputTransactionHash: string | null; status: TaskIdStatusType; createdAt: string; }; declare class InterfaceCommunicator implements Communicator { private callbacks; private isServer; constructor(); private isValidMessage; private logIncomingMessage; private onParentMessage; private handleIncomingMessage; send: (method: M, params: P) => Promise>; } declare const getSDKVersion: () => string; declare class MessageFormatter { static makeRequest: (method: M, params: P) => SDKRequestData; static makeResponse: (id: RequestId, data: MethodToResponse[Methods], version: string) => SuccessResponse; static makeErrorResponse: (id: RequestId, error: string, version: string) => ErrorResponse; } declare class PublicDeployer { private readonly communicator; constructor(communicator: Communicator$1, apiKey: string); /** * Fetches the precomputed address data for a given owner, chain ID, and fee token. * @param {Address} owner - The address of the owner. * @param {number} chainId - Chain ID for connected network. * @param {Address} feeToken - The address of the fee token. * @returns {Promise} The precomputed address data or null if an error occurs. */ fetchPreComputeAddress(owner: Address, chainId: number, feeToken: Address): Promise; /** * Generates an automation sub-account for a given set of parameters. * @param {Address} owner - The address of the owner. * @param {Address} precomputedConsoleAddress - The precomputed account address (from /pre-compute response) * @param {number} chainID - Chain ID for connected network. * @param {string} registryID - The registry ID. (Hardcoded) * @param {Address} feeToken - The address of the fee token. (from /pre-compute response) * @param {string} feeEstimate - The estimated fee. * @param {Address[]} tokens - The list of token addresses. * @param {string[]} amounts - The list of token amounts. * @param {AutomationSubscriptionLimits} automationSubscriptionLimits - The subscription limits. * @param {Record} metadata - Additional metadata. * @returns {Promise} The transfer calldata response or null if an error occurs. */ generateAutomationSubAccount(owner: Address, precomputedConsoleAddress: Address, chainID: number, registryID: string, feeToken: Address, feeEstimate: string, tokens: Address[], amounts: string[], automationSubscriptionLimits: AutomationSubscriptionLimits$1, metadata: Record): Promise; /** * Computes the deployment addresses for account and sub-account setup. * @param {Address} owner - The address of the owner. * @param {number} chainID - Chain ID for connected network. * @param {string} registryID - The registry ID (Hardcoded). * @param {string} subscriptionDraftID - The subscription draft ID (from /signature response). * @param {string} subAccountPolicyCommit - The sub-account policy commit (from /signature response). * @param {Address} feeToken - The address of the fee token. * @param {Address[]} tokens - The list of token addresses. * @param {string[]} amounts - The list of token amounts. * @param {string} subAccountChainerSignature - The sub-account chainer signature (from /signature response). * @param {string} feeEstimateSignature - The fee estimate signature (from /pre-compute response). * @param {string} feeEstimate - The estimated fee. * @param {Record} metadata - Additional metadata. * @returns {Promise} The precomputed deployment addresses or null if an error occurs. */ computeDeploymentAddresses(owner: Address, chainID: number, registryID: string, subscriptionDraftID: string, subAccountPolicyCommit: string, feeToken: Address, tokens: Address[], amounts: string[], subAccountChainerSignature: string, feeEstimateSignature: string, feeEstimate: string, metadata: Record): Promise; /** * Deploys a account and sub-account with the given parameters. * @param {Address} owner - The address of the owner. * @param {number} chainID - The ID of the blockchain network. * @param {string} registryID - The registry ID. (Hardcoded) * @param {string} subscriptionDraftID - The subscription draft ID. (from /signature response) * @param {string} subAccountPolicyCommit - The sub-account policy commit. (from /signature response) * @param {Address} feeToken - The address of the fee token. * @param {Address[]} tokens - The list of token addresses. * @param {string[]} amounts - The list of token amounts. * @param {string} subAccountChainerSignature - The sub-account chainer signature. (from /signature response) * @param {string} feeEstimateSignature - The fee estimate signature. (from /pre-compute response) * @param {string} feeEstimate - The estimated fee. (from /pre-compute response) * @param {Record} metadata - Additional metadata. * @returns {Promise<{ taskId: string } | null>} The task ID or null if an error occurs. */ deployBrahmaAccount(owner: Address, chainID: number, registryID: string, subscriptionDraftID: string, subAccountPolicyCommit: string, feeToken: Address, tokens: Address[], amounts: string[], subAccountChainerSignature: string, feeEstimateSignature: string, feeEstimate: string, metadata: Record): Promise<{ taskId: string; } | null>; /** * Fetches the status of a task by its ID. * @param {string} taskId - The ID of the task. (from /deploy endpoint) * @returns {Promise} The task status data. * @throws Will throw an error if the request fails. */ fetchDeploymentStatus(taskId: string): Promise; } declare class TemplatesSDK { private readonly communicator; private readonly apiKey; automationContextFetcher: AutomationContextFetcher; builderCaller: BuilderCaller; publicDeployer: PublicDeployer; constructor(apiKey: string); getClientFactory(): Promise; } export { type AddAutomationParams, type AddToTxnBuilderParams, type AutomationLogResponse, type AutomationSubscription, type AutomationSubscriptionLimits, type BuilderParams, type CancelAutomationParams, type Communicator, type ErrorResponse, InterfaceCommunicator, type InterfaceMessageEvent, MessageFormatter, type MethodToResponse, Methods, type PreComputedAddressData, type PrecomputeResponse, type RequestId, type Response, type SDKMessageEvent, type SDKRequestData, type SuccessResponse, type TAsset, type TaskIdStatusType, type TaskStatusData, TemplatesSDK, type Transaction, type TransferCalldataResponse, type UserClientFactory, getSDKVersion };