From 0d4f2edfbb4742847f4c67146449a80755fb47c4 Mon Sep 17 00:00:00 2001 From: Stephan Cilliers <5469870+stephancill@users.noreply.github.com> Date: Tue, 26 Mar 2024 17:44:08 +0200 Subject: [PATCH] fix: update use-frame docs --- docs/pages/reference/render/use-frame.mdx | 153 +++++++++++++++++++--- 1 file changed, 135 insertions(+), 18 deletions(-) diff --git a/docs/pages/reference/render/use-frame.mdx b/docs/pages/reference/render/use-frame.mdx index 299b47d86..dc0115491 100644 --- a/docs/pages/reference/render/use-frame.mdx +++ b/docs/pages/reference/render/use-frame.mdx @@ -2,24 +2,141 @@ ## Props -```ts -type Props = { - /** the route used to POST frame actions. The post_url will be added as a the `url` query parameter */ - frameActionProxy: string; - /** the route used to GET the initial frame via proxy */ - frameGetProxy: string; - /** an auth state object used to determine what actions are possible */ - signerState: SignerStateInstance; - /** the url of the homeframe, if null won't load a frame */ - homeframeUrl: string | null; - /** the initial frame. if not specified will fetch it from the url prop */ - frame?: Frame; - /** a function to handle mint buttons */ - onMint?: (t: onMintArgs) => void; - /** the context of this frame, used for generating Frame Action payloads */ - frameContext: FrameContext; -}; -``` +### `dangerousSkipSigning` + +- Type: `boolean` + +If true, the frame will not be signed before being sent to the frameActionProxy. This is useful for frames that don't verify signatures. + +### `frameActionProxy` + +- Type: `string` + +The route used to POST frame actions. The post_url will be added as a the `url` query parameter. + +### `frameGetProxy` + +- Type: `string` + +The route used to GET the initial frame via proxy. + +### `signerState` + +- Type: `SignerStateInstance` + +An signer state object used to determine what actions are possible. + +### `homeframeUrl` + +- Type: `string | null` + +The url of the homeframe, if null won't load a frame. + +### `frame` + +- Type: `Frame` + +The initial frame. if not specified will fetch it from the url prop. + +### `onMint` + +- Type: `(t: onMintArgs) => void` + +A function to handle mint buttons. + +### `onTransaction` + +- Type: `OnTransactionFunc` + +A function to handle transaction button presses, returns the transaction hash or null. + +### `frameContext` + +- Type: `FrameContext` + +The context of this frame, used for generating Frame Action payloads. + +### `extraButtonRequestPayload` + +- Type: `Record` + +Extra data appended to the frame action payload. + +## Returns + +- Type: `FrameState` + +### `fetchFrame` + +- Type: `(request: FrameRequest) => void` + +Fetches a frame from the frameGetProxy. + +### `clearFrameStack` + +- Type: `() => void` + +Clears the frame stack. + +### `frame` + +- Type: `Frame | null` + +The frame at the top of the stack (at index 0). + +### `framesStack` + +- Type: `FramesStack` + +A stack of frames with additional context, with the most recent frame at index 0. + +### `isLoading` + +- Type: `null | FrameStackPending` + +Whether the frame is loading. + +### `inputText` + +- Type: `string` + +The input text. + +### `setInputText` + +- Type: `(s: string) => void` + +Sets the input text. + +### `onButtonPress` + +- Type: `(frameButton: FrameButton, index: number) => void` + +Handles a button press. + +### `isFrameValid` + +- Type: `boolean | undefined` + +Whether the frame at the top of the stack has any frame validation errors. Undefined when the frame is not loaded or set. + +### `frameValidationErrors` + +- Type: `Record | undefined | null` + +The frame validation errors. + +### `error` + +- Type: `null | unknown` + +Whether there was an error loading the frame. + +### `homeframeUrl` + +- Type: `string | null` + +The url of the frame. ## Usage