Table of Contents
Overview
The Action Codes SDK provides a set of methods to interact with the Action Codes Protocol, enabling you to register, resolve, attach, and finalize action codes on Solana.Method Reference
resolve
code(string): The code to resolve.
Promise<ActionCode> (see ActionCode)
getStatus
code(string): The code to check.
Promise<ActionCodeStatusResponse> (see ActionCodeStatusResponse)
observeStatus
code(string): The code to observe.options(object):{ interval?: number, timeout?: number }(see ObserveStatusOptions)
AsyncGenerator<ActionCodeStatusResponse> (see ActionCodeStatusResponse)
register
pubkey(PublicKey): Userβs public key.sign(function): Function to sign a message.metadata(object, optional): Additional metadata (see ActionCodeMeta).
Promise<ActionCode> (see ActionCode)
attachTransaction
code(string): The code to attach to.transaction(string): The transaction data.meta(object, optional): Additional metadata (see ActionCodeMeta).
Promise<AttachCodeResponse> (see AttachCodeResponse)
attachMessage
code(string): The code to attach to.message(string): The message to attach.meta(object, optional): Additional metadata (see ActionCodeMeta).
Promise<AttachCodeResponse> (see AttachCodeResponse)
finalizeTransaction
code(string): The code to finalize.signature(string): The transaction signature.
Promise<FinalizeCodeResponse> (see FinalizeCodeResponse)
finalizeMessage
code(string): The code to finalize.signedMessage(string): The signed message.
Promise<FinalizeCodeResponse> (see FinalizeCodeResponse)
Error Handling
The SDK throws custom errors for various failure scenarios:CodeNotFoundError: The code does not exist.UnauthorizedError: The request is unauthorized.ExpiredCodeError: The code has expired.ActionCodesBaseError: Base error for ActionCodes.InvalidCodeFormatError: The code format is invalid.