UNPKG

@solana/wallet-standard-features

Version:
55 lines (44 loc) 1.57 kB
import type { WalletAccount } from '@wallet-standard/base'; /** Name of the feature. */ export const SolanaSignMessage = 'solana:signMessage'; /** TODO: docs */ export type SolanaSignMessageFeature = { /** Name of the feature. */ readonly [SolanaSignMessage]: { /** Version of the feature API. */ readonly version: SolanaSignMessageVersion; /** Sign messages (arbitrary bytes) using the account's secret key. */ readonly signMessage: SolanaSignMessageMethod; }; }; /** Version of the feature. */ export type SolanaSignMessageVersion = '1.1.0' | '1.0.0'; /** TODO: docs */ export type SolanaSignMessageMethod = ( ...inputs: readonly SolanaSignMessageInput[] ) => Promise<readonly SolanaSignMessageOutput[]>; /** Input for signing a message. */ export interface SolanaSignMessageInput { /** Account to use. */ readonly account: WalletAccount; /** Message to sign, as raw bytes. */ readonly message: Uint8Array; } /** Output of signing a message. */ export interface SolanaSignMessageOutput { /** * Message bytes that were signed. * The wallet may prefix or otherwise modify the message before signing it. */ readonly signedMessage: Uint8Array; /** * Message signature produced. * If the signature type is provided, the signature must be Ed25519. */ readonly signature: Uint8Array; /** * Optional type of the message signature produced. * If not provided, the signature must be Ed25519. */ readonly signatureType?: 'ed25519'; }