import * as react_jsx_runtime from 'react/jsx-runtime'; import { E as EVMTransaction, C as ChainConfig, A as ActionMetadata } from '../types-DD9rJ58Y.mjs'; import React from 'react'; type MlinkStatus = 'idle' | 'loading' | 'validating' | 'ready' | 'executing' | 'success' | 'error' | 'unregistered' | 'blocked'; type RegistrationStatus = 'pending' | 'approved' | 'blocked' | null; interface RegistrationResult { isRegistered: boolean; status: RegistrationStatus; error?: string; warning?: string; mlink?: { mlinkId: string; name: string; description: string; icon: string; status: RegistrationStatus; }; } interface MlinkInstance { status: MlinkStatus; metadata: ActionMetadata | null; error: string | null; url: string; refresh: () => Promise; registration: RegistrationResult | null; isRegistered: boolean; } interface MlinkAdapter { connect: () => Promise; signAndSendTransaction: (transaction: EVMTransaction) => Promise; isConnected: () => boolean; getAddress: () => string | null; } interface WagmiAdapterConfig { sendTransaction: (args: { to: `0x${string}`; value: bigint; data: `0x${string}`; chainId: number; }) => Promise<`0x${string}`>; address: `0x${string}` | undefined; isConnected: boolean; connect: () => Promise; } interface EthersAdapterConfig { signer: { getAddress: () => Promise; sendTransaction: (tx: { to: string; value: bigint; data: string; chainId: number; }) => Promise<{ hash: string; wait: () => Promise; }>; } | null; connect: () => Promise; } interface MlinkTheme { '--mlink-bg-primary': string; '--mlink-bg-secondary': string; '--mlink-border-color': string; '--mlink-text-primary': string; '--mlink-text-secondary': string; '--mlink-text-link': string; '--mlink-button-bg': string; '--mlink-button-text': string; '--mlink-button-hover': string; '--mlink-button-disabled': string; '--mlink-input-bg': string; '--mlink-input-border': string; '--mlink-input-text': string; '--mlink-input-placeholder': string; '--mlink-success': string; '--mlink-error': string; '--mlink-warning': string; '--mlink-border-radius': string; '--mlink-button-radius': string; '--mlink-input-radius': string; '--mlink-shadow': string; } type MlinkThemePreset = 'light' | 'dark' | 'mantle'; interface MlinkProviderConfig { theme?: Partial | MlinkThemePreset; defaultChain?: ChainConfig; } interface MlinkProps { url: string; adapter: MlinkAdapter; theme?: Partial | MlinkThemePreset; onSuccess?: (txHash: string, action: string) => void; onError?: (error: string) => void; className?: string; stylePreset?: 'default' | 'compact' | 'minimal'; /** Registry URL for validation (defaults to https://mlinks-fe.vercel.app) */ registryUrl?: string; /** Whether to require registration for the mlink to work (defaults to true) */ requireRegistration?: boolean; /** Whether to allow pending mlinks (defaults to true) */ allowPending?: boolean; /** Whether to allow blocked mlinks (defaults to false) */ allowBlocked?: boolean; } interface ActionButtonProps { label: string; value: string; type: 'button' | 'input'; placeholder?: string; disabled?: boolean; loading?: boolean; onClick: (value: string, input?: string) => void; } interface ExecutionResult { success: boolean; txHash?: string; error?: string; message?: string; } interface UseMlinkOptions { refreshInterval?: number; enabled?: boolean; /** Registry URL for validation (defaults to https://mlinks-fe.vercel.app) */ registryUrl?: string; /** Whether to require registration for the mlink to work (defaults to true) */ requireRegistration?: boolean; /** Whether to allow pending mlinks (defaults to true) */ allowPending?: boolean; /** Whether to allow blocked mlinks (defaults to false) */ allowBlocked?: boolean; } interface UseExecuteMlinkReturn { execute: (action: string, input?: string) => Promise; status: MlinkStatus; txHash: string | null; error: string | null; reset: () => void; } declare function Mlink({ url, adapter, theme: themeProp, onSuccess, onError, className, stylePreset, registryUrl, requireRegistration, allowPending, allowBlocked, }: MlinkProps): react_jsx_runtime.JSX.Element; interface MlinkContextValue { theme: MlinkTheme; defaultChain: ChainConfig; } interface MlinkProviderProps extends MlinkProviderConfig { children: React.ReactNode; } declare function MlinkProvider({ children, theme, defaultChain, }: MlinkProviderProps): react_jsx_runtime.JSX.Element; declare function useMlinkContext(): MlinkContextValue; declare function useMlink(url: string, options?: UseMlinkOptions): MlinkInstance; interface UseExecuteMlinkOptions { adapter: MlinkAdapter; actionUrl: string; onSuccess?: (txHash: string, action: string) => void; onError?: (error: string) => void; } /** * Enhanced UseExecuteMlinkReturn with data parameter support */ interface UseExecuteMlinkReturnEnhanced extends Omit { execute: (action: string, input?: string, data?: Record) => Promise; } declare function useExecuteMlink(options: UseExecuteMlinkOptions): UseExecuteMlinkReturnEnhanced; /** * Create a Mlink adapter from wagmi hooks * * @example * ```tsx * import { useAccount, useConnect, useSendTransaction } from 'wagmi'; * import { useMlinkWagmiAdapter } from '@dipansrimany/mlink-sdk/react'; * * function MyComponent() { * const { address, isConnected } = useAccount(); * const { connectAsync, connectors } = useConnect(); * const { sendTransactionAsync } = useSendTransaction(); * * const adapter = useMlinkWagmiAdapter({ * address, * isConnected, * connect: async () => { * await connectAsync({ connector: connectors[0] }); * }, * sendTransaction: sendTransactionAsync, * }); * * return ; * } * ``` */ declare function useMlinkWagmiAdapter(config: WagmiAdapterConfig): MlinkAdapter; /** * Create a Mlink adapter from ethers.js signer * * @example * ```tsx * import { useSigner } from 'some-ethers-provider'; * import { useMlinkEthersAdapter } from '@dipansrimany/mlink-sdk/react'; * * function MyComponent() { * const { signer, connect } = useSigner(); * * const adapter = useMlinkEthersAdapter({ * signer, * connect, * }); * * return ; * } * ``` */ declare function useMlinkEthersAdapter(config: EthersAdapterConfig): MlinkAdapter; /** * Create a custom Mlink adapter * * @example * ```tsx * import { createMlinkAdapter } from '@dipansrimany/mlink-sdk/react'; * * const adapter = createMlinkAdapter({ * connect: async () => { * // Your connect logic * return '0x...'; * }, * signAndSendTransaction: async (tx) => { * // Your transaction logic * return '0x...txHash'; * }, * isConnected: () => true, * getAddress: () => '0x...', * }); * ``` */ declare function createMlinkAdapter(adapter: MlinkAdapter): MlinkAdapter; declare const lightTheme: MlinkTheme; declare const darkTheme: MlinkTheme; declare const mantleTheme: MlinkTheme; declare const themePresets: Record; declare function resolveTheme(theme?: Partial | MlinkThemePreset): MlinkTheme; export { type ActionButtonProps, type EthersAdapterConfig, type ExecutionResult, Mlink, type MlinkAdapter, Mlink as MlinkComponent, type MlinkInstance, type MlinkProps, MlinkProvider, type MlinkProviderConfig, type MlinkStatus, type MlinkTheme, type MlinkThemePreset, type RegistrationResult, type RegistrationStatus, type UseExecuteMlinkReturn, type UseExecuteMlinkReturnEnhanced, type UseMlinkOptions, type WagmiAdapterConfig, createMlinkAdapter, darkTheme, lightTheme, mantleTheme, resolveTheme, themePresets, useExecuteMlink, useMlink, useMlinkContext, useMlinkEthersAdapter, useMlinkWagmiAdapter };