sdk.context. This object provides basic information about the user, the
client, and where your app was opened from:
Properties
location
Contains information about the context from which the Mini App was launched.
Cast Embed
Indicates that the Mini App was launched from a cast (where it is an embed).Cast Share
Indicates that the Mini App was launched when a user shared a cast to your app (similar to sharing content to an app on mobile platforms).Notification
Indicates that the Mini App was launched from a notification triggered by the frame.Launcher
Indicates that the Mini App was launched directly by the client app outside of a context, e.g. via some type of catalog or a notification triggered by the client.Open Mini App
Indicates that the Mini App was launched from another Mini App using theopenMiniApp action. This enables app-to-app navigation and referral tracking.
referrerDomain contains the domain of the Mini App that opened the current app. This can be used for:
- Tracking referrals and attribution
- Customizing the experience based on the referring app
- Building app-to-app workflows
Cast Object Structure
When your Mini App is launched from a cast context (eithercast_embed or cast_share), you receive a comprehensive cast object with the following metadata:
- author: The user who created the cast, including their FID, username, display name, and profile picture
- hash: The unique identifier for the cast
- parentHash (optional): If this is a reply, the hash of the parent cast
- parentFid (optional): If this is a reply, the FID of the parent cast author
- timestamp (optional): Unix timestamp in milliseconds when the cast was created
- mentions (optional): Array of users mentioned in the cast
- embeds (optional): Array of URLs embedded in the cast
- channelKey (optional): The channel where the cast was posted
user
Details about the calling user which can be used to customize the interface. This should be considered untrusted since it is passed in by the application, and there is no guarantee that it was authorized by the user.
client
Details about the Farcaster client running the Mini App. This should be considered untrustedplatformType: indicates whether the Mini App is running on ‘web’ or ‘mobile’ platformclientFid: the self-reported FID of the client (e.g. 9152 for Warpcast)added: whether the user has added the Mini App to the clientsafeAreaInsets: insets to avoid areas covered by navigation elements that obscure the viewnotificationDetails: in case the user has enabled notifications, includes theurlandtokenfor sending notifications
Using safeAreaInsets
Mobile devices render navigation elements that obscure the view of an app. Use thesafeAreaInsets to render content in the safe area that won’t be obstructed.
A basic usage would to wrap your view in a container that adds margin:
features
Optional object that indicates which features are available and their current state in the client.haptics: Indicates whether haptic feedback is supported on the current platformcameraAndMicrophoneAccess: Indicates whether camera and microphone permissions have been granted and stored for this mini app. Whentrue, the user has previously granted access and won’t be prompted again. This field is optional and may not be present on all platforms.
Using features for capability detection
You can use thefeatures object to conditionally enable functionality based on platform support:
getCapabilities() method which returns specific SDK methods supported by the host.
