Linked Actions support fixed and parameterized values, both specified in the optional parameters attribute.
Parameterized actions signal to the client that users may provide a variable input for the action, such as in a text field. In addition to text fields, ActionParameter now also accepts other input types as specified in ActionParameterType.
Here's what that looks like in the code:
exportinterfaceLinkedAction {/** URL endpoint for an action */ href:string;/** button text rendered to the user */ label:string;/** * Parameters to accept user input within an action * @see{ActionParameter} * @see{ActionParameterSelectable} */ parameters?:Array<TypedActionParameter>;}/** Parameter to accept user input within an action */exportinterfaceActionParameter {/** input field type */ type?:ActionParameterType;/** parameter name in url */ name:string;/** placeholder text for the user input field */ label?:string;/** declare if this field is required (defaults to `false`) */ required?:boolean;/** regular expression pattern to validate user input client side */ pattern?:string;/** human-readable description of the `type` and/or `pattern`, represents a caption and error, if value doesn't match */ patternDescription?:string;/** the minimum value allowed based on the `type` */ min?:string|number;/** the maximum value allowed based on the `type` */ max?:string|number;}/** * Input field type to present to the user * @default `text` */exporttypeActionParameterType=|"text"|"email"|"url"|"number"|"date"|"datetime-local"|"checkbox"|"radio"|"textarea"|"select";/** * note: for ease of reading, this is a simplified type of the actual */interfaceActionParameterSelectableextendsActionParameter { options:Array<{/** displayed UI label of this selectable option */ label:string;/** value of this selectable option */ value:string;/** whether or not this option should be selected by default */ selected?:boolean; }>;}
When type is set as select, checkbox, or radio then the Action should include an array of options .
Only Linked Actions Support Parameters
Only linked actions support parameters. The Actions spec extends Solana Pay and must remain interoperable with it. As a result, all URLs that can be called via GET requests must also support POST requests. Parameterized actions are underspecified by construction, and therefore signable transactions are not possible via POST routes.
Blinks with Multi-Input Forms
You can also build a Blink with multiple input fields, similar to the one in the previous section, with a simple change in the structure of the GET response.
The following example demonstrates how you can format the GET response to allow two different inputs, a custom SOL amount and a "thank you" note.
{ icon:'<image-url>', label:'Donate SOL', title:'Donate to Alice', description:'Cybersecurity Enthusiast | Support my research with a donation.', links: { actions: [ { href:`/api/donate/{${amountParameterName}}/{${thankYouNote}}`, label:'Donate', parameters: [ { name: amountParameterName, label:'Enter a custom SOL amount', }, { name: thankYouNote, label:'Thank you note', }, ], }, ], },}
The Blink would unfurl like this:
NOTE: If you have a previously defined Action with multiple parameters, those will be overridden, and only the most recent Action will be rendered.