ActionCode class represents an action code in the Action Codes Protocol. It encapsulates all the data and logic for a single action code, including its status, metadata, transaction details, and utility methods for validation and display.
Reference
ActionCode
The
Represents the status of an action code.
Metadata for the action code, including an optional description and parameters.
Represents transaction or message data attached to an action code.
All fields required to construct an ActionCode instance.
Creates a new ActionCode instance from the provided fields.
Creates an ActionCode from a plain object. Throws if required fields are missing.
Creates an ActionCode from a base64-encoded string.
Returns a base64-encoded string of the action code fields.
Checks if the action code is valid for the given protocol (signature, code format, not expired).
Updates the status of the action code.
Returns the raw fields as a plain object.
Milliseconds remaining until expiration (0 if expired).
Returns true if the code is expired.
Returns the chain identifier (e.g., ‘solana’).
Returns the current status of the action code.
Returns the 8-character action code string.
Returns the normalized prefix for the code.
Returns the user’s public key.
Returns the transaction data, if any.
Returns the metadata object, if any.
Returns the human-readable description from metadata.
Returns the parameters from metadata.
Returns the timestamp when the code was generated.
Returns the user’s signature string.
Returns a formatted string for display (e.g., “PREFIX-XXXXXX (solana, pending)“).
Returns a human-readable string for remaining time (e.g., “1m 30s remaining” or “Expired”).
Returns the code hash (used as code ID in protocol meta).
Returns the intent type for the action code.