Skip to content

Commit

Permalink
chore: add prettier config
Browse files Browse the repository at this point in the history
  • Loading branch information
stephancill committed Oct 24, 2024
1 parent a076c85 commit 6ee4716
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 28 deletions.
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"trailingComma": "all"
}
59 changes: 31 additions & 28 deletions packages/render/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export type OnTransactionArgs = {
};

export type OnTransactionFunc = (
arg: OnTransactionArgs
arg: OnTransactionArgs,
) => Promise<`0x${string}` | null>;

export type OnSignatureArgs = {
Expand All @@ -41,7 +41,7 @@ export type OnSignatureArgs = {
};

export type OnSignatureFunc = (
args: OnSignatureArgs
args: OnSignatureArgs,
) => Promise<`0x${string}` | null>;

type OnComposerFormActionFuncArgs = {
Expand All @@ -62,7 +62,7 @@ export type OnComposeFormActionFuncReturnType =
* If the function resolves to undefined it means that the dialog was probably closed resulting in no operation at all.
*/
export type OnComposerFormActionFunc = (
arg: OnComposerFormActionFuncArgs
arg: OnComposerFormActionFuncArgs,
) => Promise<OnComposeFormActionFuncReturnType>;

/**
Expand All @@ -78,17 +78,20 @@ export type OnConnectWalletFunc = () => void;
export type SignFrameActionFunc<
TSignerStorageType = Record<string, unknown>,
TFrameActionBodyType extends FrameActionBodyPayload = FrameActionBodyPayload,
TFrameContextType extends FrameContext = FarcasterFrameContext
TFrameContextType extends FrameContext = FarcasterFrameContext,
> = (
actionContext: SignerStateActionContext<TSignerStorageType, TFrameContextType>
actionContext: SignerStateActionContext<
TSignerStorageType,
TFrameContextType
>,
) => Promise<SignedFrameAction<TFrameActionBodyType>>;

export type UseFetchFrameSignFrameActionFunction<
TSignerStateActionContext extends SignerStateActionContext<
unknown,
Record<string, unknown>
>,
TFrameActionBodyType extends FrameActionBodyPayload = FrameActionBodyPayload
TFrameActionBodyType extends FrameActionBodyPayload = FrameActionBodyPayload,
> = (arg: {
actionContext: TSignerStateActionContext;
/**
Expand All @@ -100,7 +103,7 @@ export type UseFetchFrameSignFrameActionFunction<
export type UseFetchFrameOptions<
TSignerStorageType = Record<string, unknown>,
TFrameActionBodyType extends FrameActionBodyPayload = FrameActionBodyPayload,
TFrameContextType extends FrameContext = FarcasterFrameContext
TFrameContextType extends FrameContext = FarcasterFrameContext,
> = {
stackAPI: FrameStackAPI;
stackDispatch: React.Dispatch<FrameReducerActions>;
Expand Down Expand Up @@ -216,7 +219,7 @@ export type UseFetchFrameOptions<
export type UseFrameOptions<
TSignerStorageType = Record<string, unknown>,
TFrameActionBodyType extends FrameActionBodyPayload = FrameActionBodyPayload,
TFrameContextType extends FrameContext = FarcasterFrameContext
TFrameContextType extends FrameContext = FarcasterFrameContext,
> = {
/** skip frame signing, for frames that don't verify signatures */
dangerousSkipSigning?: boolean;
Expand Down Expand Up @@ -290,7 +293,7 @@ export type UseFrameOptions<

type SignerStateActionSharedContext<
TSignerStorageType = Record<string, unknown>,
TFrameContextType extends FrameContext = FarcasterFrameContext
TFrameContextType extends FrameContext = FarcasterFrameContext,
> = {
target?: string;
frameButton: FrameButton;
Expand All @@ -307,14 +310,14 @@ type SignerStateActionSharedContext<

export type SignerStateDefaultActionContext<
TSignerStorageType = Record<string, unknown>,
TFrameContextType extends FrameContext = FarcasterFrameContext
TFrameContextType extends FrameContext = FarcasterFrameContext,
> = {
type?: "default";
} & SignerStateActionSharedContext<TSignerStorageType, TFrameContextType>;

export type SignerStateTransactionDataActionContext<
TSignerStorageType = Record<string, unknown>,
TFrameContextType extends FrameContext = FarcasterFrameContext
TFrameContextType extends FrameContext = FarcasterFrameContext,
> = {
type: "tx-data";
/** Wallet address used to create the transaction, available only for "tx" button actions */
Expand All @@ -323,7 +326,7 @@ export type SignerStateTransactionDataActionContext<

export type SignerStateTransactionPostActionContext<
TSignerStorageType = Record<string, unknown>,
TFrameContextType extends FrameContext = FarcasterFrameContext
TFrameContextType extends FrameContext = FarcasterFrameContext,
> = {
type: "tx-post";
/** Wallet address used to create the transaction, available only for "tx" button actions */
Expand All @@ -333,7 +336,7 @@ export type SignerStateTransactionPostActionContext<

export type SignerStateActionContext<
TSignerStorageType = Record<string, unknown>,
TFrameContextType extends FrameContext = FarcasterFrameContext
TFrameContextType extends FrameContext = FarcasterFrameContext,
> =
| SignerStateDefaultActionContext<TSignerStorageType, TFrameContextType>
| SignerStateTransactionDataActionContext<
Expand All @@ -346,7 +349,7 @@ export type SignerStateActionContext<
>;

export type SignedFrameAction<
TFrameActionBodyType extends FrameActionBodyPayload = FrameActionBodyPayload
TFrameActionBodyType extends FrameActionBodyPayload = FrameActionBodyPayload,
> = {
body: TFrameActionBodyType;
searchParams: URLSearchParams;
Expand All @@ -357,15 +360,15 @@ export type SignFrameActionFunction<
unknown,
Record<string, unknown>
> = SignerStateActionContext,
TFrameActionBodyType extends FrameActionBodyPayload = FrameActionBodyPayload
TFrameActionBodyType extends FrameActionBodyPayload = FrameActionBodyPayload,
> = (
actionContext: TSignerStateActionContext
actionContext: TSignerStateActionContext,
) => Promise<SignedFrameAction<TFrameActionBodyType>>;

export interface SignerStateInstance<
TSignerStorageType = Record<string, unknown>,
TFrameActionBodyType extends FrameActionBodyPayload = FrameActionBodyPayload,
TFrameContextType extends FrameContext = FarcasterFrameContext
TFrameContextType extends FrameContext = FarcasterFrameContext,
> {
signer: TSignerStorageType | null;
/**
Expand All @@ -392,7 +395,7 @@ export type FramePOSTRequest<
TSignerStateActionContext extends SignerStateActionContext<
unknown,
Record<string, unknown>
> = SignerStateActionContext
> = SignerStateActionContext,
> =
| {
method: "POST";
Expand All @@ -418,7 +421,7 @@ export type FrameRequest<
TSignerStateActionContext extends SignerStateActionContext<
unknown,
Record<string, unknown>
> = SignerStateActionContext
> = SignerStateActionContext,
> = FrameGETRequest | FramePOSTRequest<TSignerStateActionContext>;

export type FrameStackBase = {
Expand Down Expand Up @@ -531,12 +534,12 @@ type ButtonPressFunction<
TSignerStateActionContext extends SignerStateActionContext<
unknown,
Record<string, unknown>
>
>,
> = (
frame: Frame,
frameButton: FrameButton,
index: number,
fetchFrameOverride?: FetchFrameFunction<TSignerStateActionContext>
fetchFrameOverride?: FetchFrameFunction<TSignerStateActionContext>,
) => void | Promise<void>;

type CastActionButtonPressFunctionArg = {
Expand All @@ -551,7 +554,7 @@ type CastActionButtonPressFunctionArg = {
};

export type CastActionButtonPressFunction = (
arg: CastActionButtonPressFunctionArg
arg: CastActionButtonPressFunctionArg,
) => Promise<void>;

type ComposerActionButtonPressFunctionArg = {
Expand All @@ -567,14 +570,14 @@ type ComposerActionButtonPressFunctionArg = {
};

export type ComposerActionButtonPressFunction = (
arg: ComposerActionButtonPressFunctionArg
arg: ComposerActionButtonPressFunctionArg,
) => Promise<void>;

export type CastActionRequest<
TSignerStateActionContext extends SignerStateActionContext<
unknown,
Record<string, unknown>
> = SignerStateActionContext
> = SignerStateActionContext,
> = Omit<
FramePOSTRequest,
"method" | "frameButton" | "sourceFrame" | "signerStateActionContext"
Expand All @@ -593,7 +596,7 @@ export type ComposerActionRequest<
TSignerStateActionContext extends SignerStateActionContext<
unknown,
Record<string, unknown>
> = SignerStateActionContext
> = SignerStateActionContext,
> = Omit<
FramePOSTRequest,
"method" | "frameButton" | "sourceFrame" | "signerStateActionContext"
Expand All @@ -613,7 +616,7 @@ export type FetchFrameFunction<
TSignerStateActionContext extends SignerStateActionContext<
unknown,
Record<string, unknown>
> = SignerStateActionContext
> = SignerStateActionContext,
> = (
request:
| FrameRequest<TSignerStateActionContext>
Expand All @@ -624,12 +627,12 @@ export type FetchFrameFunction<
*
* @defaultValue false
*/
shouldClear?: boolean
shouldClear?: boolean,
) => Promise<void>;

export type FrameState<
TSignerStorageType = Record<string, unknown>,
TFrameContextType extends FrameContext = FarcasterFrameContext
TFrameContextType extends FrameContext = FarcasterFrameContext,
> = {
fetchFrame: FetchFrameFunction<
SignerStateActionContext<TSignerStorageType, TFrameContextType>
Expand Down

0 comments on commit 6ee4716

Please sign in to comment.