import { SetPrimaryButtonOptions, AddFrame, HostEndpoint, SignIn, FrameHost, Context } from '@farcaster/frame-host'; import { ParseFramesV2ResultWithFrameworkDetails } from 'frames.js/frame-parsers'; import { Provider } from 'ox/Provider'; import { ExtractRequest, Default } from 'ox/RpcSchema'; type SendTransactionRpcRequest = ExtractRequest; type SignMessageRpcRequest = ExtractRequest; type SignTypedDataRpcRequest = ExtractRequest; type EthProvider = Provider & { setEventHandlers: (handlers: SharedEthProviderEventHandlers) => void; }; /** * Function called when the frame app requests sending transaction. * * If false is returned then the request is cancelled and user rejected error is thrown */ type OnSendTransactionRequestFunction = (request: SendTransactionRpcRequest) => Promise; /** * Function called when the frame app requests signing message. * * If false is returned signing is cancelled and user rejected error is thrown */ type OnSignMessageRequestFunction = (request: SignMessageRpcRequest) => Promise; /** * Function called when the frame app requests signing typed data. * * If false is returned then the request is cancelled and user rejected error is thrown */ type OnSignTypedDataRequestFunction = (request: SignTypedDataRpcRequest) => Promise; type SharedEthProviderEventHandlers = { onSendTransactionRequest: OnSendTransactionRequestFunction; onSignMessageRequest: OnSignMessageRequestFunction; onSignTypedDataRequest: OnSignTypedDataRequestFunction; }; type FramePrimaryButton = SetPrimaryButtonOptions; type OnPrimaryButtonSetFunction = (options: FramePrimaryButton, pressedCallback: () => void) => void; /** * Returns false if user rejected the request, otherwise it returns the notification details */ type OnAddFrameRequestedFunction = (frame: ParseFramesV2ResultWithFrameworkDetails) => Promise>; type OnEIP6963RequestProviderRequestedFunctionOptions = { endpoint: HostEndpoint; }; /** * Function that must emit eip6963:announceProvider event on endpoint to announce available providers */ type OnEIP6963RequestProviderRequestedFunction = (options: OnEIP6963RequestProviderRequestedFunctionOptions) => unknown; type OnSignInFunctionOptions = SignIn.SignInOptions & { frame: ParseFramesV2ResultWithFrameworkDetails; }; type OnSignInFunction = (options: OnSignInFunctionOptions) => Promise; type OnViewProfileFunction = FrameHost["viewProfile"]; type FrameContext = Context.FrameContext; type ResolveContextFunctionOptions = { /** * Called when hook is unmounted */ signal: AbortSignal; }; /** * Function called when the frame app is loaded and needs a context to be rendered */ type ResolveContextFunction = (options: ResolveContextFunctionOptions) => Promise; type HostEndpointEmitter = Pick; export type { EthProvider, FrameContext, FramePrimaryButton, HostEndpointEmitter, OnAddFrameRequestedFunction, OnEIP6963RequestProviderRequestedFunction, OnEIP6963RequestProviderRequestedFunctionOptions, OnPrimaryButtonSetFunction, OnSendTransactionRequestFunction, OnSignInFunction, OnSignInFunctionOptions, OnSignMessageRequestFunction, OnSignTypedDataRequestFunction, OnViewProfileFunction, ResolveContextFunction, ResolveContextFunctionOptions, SendTransactionRpcRequest, SharedEthProviderEventHandlers, SignMessageRpcRequest, SignTypedDataRpcRequest };