Action Types

Linked Actions support both fixed as well as parameterized values, as specified by the optional parameters attribute.

export interface LinkedAction {
  /** URL endpoint for an action */
  href: string;
  /** button text rendered to the user */
  label: string;
  /** Parameter to accept user input within an action */
  parameters?: [ActionParameter];
}

/** Parameter to accept user input within an action */
export interface ActionParameter {
  /** 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;
}

Parameterized actions signal to the client that users may provide a variable input for the action.

Only Linked Actions Support Parameters

Only linked actions support parameters. The Actions Spec extends Solana Pay and must remain interoperable with Solana Pay. As a result, all URLs that may 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.

You can also build a blink with multiple input fields similar to the one in the previous section by a simple change in the structure of the GET response.

The following example demonstrates how you can structure 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',
        },
      ],
    },
  ],
 },
}

NOTE: If you have any actions before this action with a label and custom href for predefined amounts of a parameter, it will be ignored when the Blink is unfurled

Last updated