import type { OverloadDesc, SStmt } from "./ast"; export * from './ast'; export declare const compilerVersion: number; export type HexString = `0x${string}`; export type VaultConfig = { rpcUrl: string; vaultAddress: HexString; } & OptionalConfig; export declare function compileRawBytecode(cfg: VaultConfig, code: string): Promise; export type DataToSign = { types: any; domain: any; message: any; primaryType: string; }; export type RequiredSignature = { description: string; dataToSign: DataToSign; execute: (signedData: string) => Promise; }; export interface GaslessTx { bytecode: HexString; dataToSign: DataToSign; execute: (signedData: string) => Promise; } export interface Gasless712Tx { dataToSign: DataToSign; buildGaslessTx: (signature: string) => Promise; } export interface GaslessBundledTxs { bytecodes: HexString[]; dataToSign: DataToSign; schedule: (signature: string) => Promise; buildTxs: (signature: string) => Promise; unbundledTxs: Tx[]; } export interface SynthetixV3Metadata { tag: "SynthetixV3Metadata"; market: string; indexPrice: number; desiredFillPrice: number; requiredMargin: number | null; marginFees: { order: number; settlement: number; } | null; } export interface GmxMetadata { tag: "GmxMetadata"; acceptablePrice: number; markPrice: number; maxExecutionFee: number; entryPrice: number; prevEntryPrice: number; liquidationPrice: number; prevLiquidationPrice: number; leverage: number; prevLeverage: number; } export interface MuxMetadata { tag: "MuxMetadata"; assetPrice: number; feeUsd: number; prev: MuxSubAccountComputed | null; next: MuxSubAccountComputed; } export interface MuxSubAccount { collateral: number; size: number; lastIncreasedTime: number; entryPrice: number; entryFunding: number; } export interface MuxSubAccountComputed { subAccount: MuxSubAccount; positionValueUsd: number; leverage: number; fundingFeeUsd: number; pendingPnlUsd: number; liquidationPrice: number; withdrawableCollateral: number; } export interface InputSwapMetadata { tag: "InputSwapMetadata"; dex: string; chainId: number; inputToken: string; inputTokenDecimals: number; inputAmount: HexString; outputToken: string; outputTokenDecimals: number; outputAmount: HexString; slippage: number; price: number; } export interface DeBridgeMetadata { tag: "DeBridgeMetadata"; inputAmount: number; outputAmount: number; estimatedExecutionDelay: number; fees: { fixedNativeFee: number; inputUsedForFixedNativeFee: number; inputUsedForMarketMakerFee: number; }; } export interface WarningMedata { tag: "WarningMedata"; message: string; } export interface PositionMetadata { index: number; line: number; column: number; } export type LocMetadata = { loc: { start: PositionMetadata; end: PositionMetadata; }; }; export type CompilationMetadata = LocMetadata & (InputSwapMetadata | SynthetixV3Metadata | GmxMetadata | MuxMetadata | DeBridgeMetadata | WarningMedata); export interface CompiledVaultOperation { tx: Tx | null; txGasless: GaslessTx | null; txGasless712: Gasless712Tx | null; txGaslessBundled: GaslessBundledTxs | null; requiredApproves: RequiredApprove[]; requiredSignatures: RequiredSignature[]; vaultAddress: HexString; source: string; metadata: CompilationMetadata[]; } export interface CreateVaultAndExecuteOperation { dataToSign: DataToSign; buildTx: (signature: string) => Tx; buildGaslessTx: (signature: string) => Promise; vaultAddress: HexString; metadata: CompilationMetadata[]; } export declare function callVault(cfg: VaultConfig, code: string): Promise; export interface OptionalConfig { rpcHeaders?: Record; skipVerification?: boolean; coingeckoProApiKey?: string; excludedDexes?: string[]; emitAdvancedMetadata?: boolean; vaultOwnerAddress?: HexString; } export type PredictVaultConfig = { rpcUrl: string; creatorAddress: HexString; salt: HexString; } & OptionalConfig; export type CreationConfig = { rpcUrl: string; creatorAddress: HexString; salt?: HexString; } & OptionalConfig; export interface RequiredApprove { token: HexString; knownAmount: RequiredApproveAmount | null; performApproveMax: Tx; revert: Tx; } export interface RequiredApproveAmount { amount: bigint; performApprove: Tx; } export interface Tx { to: HexString; data: HexString; value: bigint; } export interface DecompiledAst { isVaultCreation: boolean; ast?: SStmt; } export interface DecompiledCode extends DecompiledAst { code: string; } export declare function createVault(cfg: CreationConfig): Promise; export declare function createVaultAndExecute(cfg: CreationConfig, code: string): Promise; export declare function computeExpectedVaultAddress(cfg: PredictVaultConfig): Promise; export declare function getVaultCallCompilerVersion(bytecode: string): number | null; export declare function getRawCodeCompilerVersion(bytecode: string): number | null; export declare function verifyRawBytecode(cfg: VaultConfig, bytecode: HexString): Promise; export declare function verifyCalldata(cfg: VaultConfig, calldata: HexString): Promise; export declare function prettyPrint(code: string): string | null; export declare function decompileRawBytecodeToCode(cfg: VaultConfig, bytecode: HexString): Promise; export declare function decompileCalldataToCode(cfg: VaultConfig, calldata: HexString): Promise; export declare function decompileCalldataToAst(cfg: VaultConfig, calldata: HexString): Promise; export interface FnDesc { name: string; overloads: OverloadDesc[]; } export declare function availableFunctions(): FnDesc[]; export declare function fetchVaultOwner(rpcUrl: string, vaultAddress: HexString): Promise;