Blinks as they exist now have a single depth to interactions. You fetch the entrypoint of the blink with a GET request, then use one of the button actions to make a POST request to the server to fetch a transaction with the user’s account info.
This single depth prevents good error handling, and can be easily expanded to allow for blink chaining by just reusing the ActionGetResult for the POST request (with an optional transaction field) and rerendering the blink.
This allows branching logic on the part of the blink, where actions can be shown specific to the user’s account, and even multiple transactions could be carried out. This also allows for better error messages and error handling, giving more info to the end user.
So what does this look like?
Currently ActionGetRequest looks like this:
export interface ActionGetResponse {
/** url of some descriptive image for the action */
icon: string;
/** title of the action */
title: string;
/** brief description of the action */
description: string;
/** text to be rendered on the action button */
label: string;
/** optional state for disabling the action button(s) */
disabled?: boolean;
/** optional list of related Actions */
links?: {
actions: LinkedAction[];
};
/** optional (non-fatal) error message */
error?: ActionError;
}
we can expand it to add:
export interface ActionUnifiedResponse {
/** url of some descriptive image for the action */
icon: string;
/** title of the action */
title: string;
/** brief description of the action */
description: string;
/** text to be rendered on the action button */
label: string;
/** optional state for disabling the action button(s) */
disabled?: boolean;
/** optional list of related Actions */
links?: {
actions: LinkedAction[];
};
/** optional (non-fatal) error message */
error?: ActionError;
/** optional b64 encoded transaction */
transaction?: string
}
This would get rid of the ActionPostResponse completely, and just use this unified response for all blinks.
So what would this look like?
- User fetches the entrypoint to the blink with standard GET request and gets a list of actions
- User clicks on an action, which POST requests with their account to the given action URL
- This returns a new ActionUnifiedResponse with an optional transaction they can sign and rerender of potential links or errors the server had in case the account + path from previous request resulted in a transaction that didn’t work (like if that account was specifically timed out from interacting with that path).
- Loop until done
Notes
-
Does chaining mean that servers have to hold state?
- Not necessarily, all state can be URL encoded as path params
-
What are some other cool things this allows?
- Right now one of the biggest challenges is blink generation unique to user has to be done off platform :- if you want users to have their own blinks they have to go to telegram or discord or a website or something to generate a blink cause twitter api access is trash. With this you could give out new blinks to uses on twitter itself