import { type ContextModule } from "@ledgerhq/context-module"; import { type DeviceManagementKit, type DeviceSessionId } from "@ledgerhq/device-management-kit"; import { type GetAddressDAReturnType } from "../api/app-binder/GetAddressDeviceActionTypes"; import { type GetAppConfigurationDAReturnType } from "../api/app-binder/GetAppConfigurationDeviceActionTypes"; import { type SignMessageDAReturnType } from "../api/app-binder/SignMessageDeviceActionTypes"; import { type SignTransactionDAReturnType } from "../api/app-binder/SignTransactionDeviceActionTypes"; import { type AddressOptions } from "../api/model/AddressOption"; import { type MessageOptions } from "../api/model/MessageOptions"; import { type SolanaTransactionOptionalConfig } from "../api/model/SolanaTransactionOptionalConfig"; import { type Transaction } from "../api/model/Transaction"; import { type SignerSolana } from "../api/SignerSolana"; export type DefaultSignerSolanaConstructorArgs = { dmk: DeviceManagementKit; sessionId: DeviceSessionId; contextModule: ContextModule; solanaRPCURL?: string; }; export declare class DefaultSignerSolana implements SignerSolana { private _container; constructor({ dmk, sessionId, contextModule, solanaRPCURL, }: DefaultSignerSolanaConstructorArgs); /** * Securely sign a Solana or SPL transaction using **clear signing** on Ledger devices. * * ### Parameters * * **Required** * - **derivationPath** `string` * The derivation path used in the transaction (e.g. `"44'/501'/0'/0'"`). * * - **transaction** `Uint8Array` * The serialised transaction to sign. * * **Optional** * - **solanaTransactionOptionalConfig** `SolanaTransactionOptionalConfig` * Provides additional context for transaction signing. The * `transactionResolutionContext` is not required — the signer will attempt * to resolve metadata from the transaction itself. Explicitly providing it * is recommended when the information is available, as it removes ambiguity * and ensures accurate clear-signing details on the device. * * - **solanaRPCURL** `string` * Solana RPC endpoint for fetching a fresh blockhash when * `delayed: true`. If the signer was built with * `SignerSolanaBuilder({ solanaRPCURL })`, the value here overrides * that default for this call only. * * - **delayed** `boolean` * When `true`, uses the device’s two-step signing flow (preview then * delayed sign) so review time does not race the blockhash. Requires a * Solana app version that supports delayed signing, and either a * resolved RPC URL (builder and/or **solanaRPCURL** above) or * **fetchBlockhash**. Otherwise the signer falls back to legacy signing. * * - **fetchBlockhash** `() => Promise` * Optional. When `delayed: true`, use this instead of the default RPC * `getLatestBlockhash` (e.g. custom commitment or RPC). Must return the * 32-byte recent blockhash. If provided, an RPC URL is not required for * the delayed path. * * - **transactionResolutionContext** `object` * Lets you explicitly pass `tokenAddress` and ATA details, bypassing * extraction from the transaction itself. * * - **tokenAddress** `string` * SPL token address being transferred. * * - **createATA** `object` * Information about creating an associated token account (ATA). * * - **address** `string` – Address (owner) of the ATA. * - **mintAddress** `string` – Mint address of the ATA. * * - **tokenInternalId** `string` * Ledger internal token ID. * * - **skipOpenApp** `boolean` * If `true`, skips opening the Solana app on the device. * * ### Returns * * `{ observable, cancel }` where: * - `observable` emits `DeviceActionState` updates. * On **Completed**, `output` is a `Uint8Array` containing the 64-byte Ed25519 signature. * - `cancel` aborts the action on the Ledger device. * * @example * ```ts * const { observable } = signer.signTransaction("44'/501'/0'/0'", serializedTx, { * transactionResolutionContext: { tokenAddress: "EPjFWdd5..." }, * }); * observable.subscribe({ * next: (state) => { * if (state.status === DeviceActionStatus.Completed) { * console.log("Signature:", state.output); // Uint8Array * } * }, * }); * ``` */ signTransaction(derivationPath: string, transaction: Transaction, solanaTransactionOptionalConfig?: SolanaTransactionOptionalConfig): SignTransactionDAReturnType; /** * Sign a Solana off-chain message on the device. * * Supports multiple signing modes via `SignMessageVersion`: * - **V0** (default) — original header with `appDomain`, up to 65 515 bytes. * Falls back to Legacy on `6a81`. * - **V1** — simplified header per sRFC 38, up to 65 535 bytes. No `appDomain` * field; use `signers` to bind the message to a specific application instead. * Falls back to V0 then Legacy on `6a81`. Requires Solana device app version 1.14+. * - **Legacy** — compact header for backward compatibility with old Solana app firmware. * - **Raw** — pass-through: sends a caller-formatted `Uint8Array` payload * as-is, no header wrapping. * * ### Parameters * * **Required** * - **derivationPath** `string` * The derivation path used for signing (e.g. `"44'/501'/0'"`). * * - **message** `string | Uint8Array` * The message to sign. Pass a `string` for V0/V1/Legacy (UTF-8 encoded * automatically). Pass a `Uint8Array` for Raw mode when you have an * already-formatted binary payload. * * **Optional** * - **options** `MessageOptions` * - **skipOpenApp** `boolean` * If `true`, skips opening the Solana app on the device. * - **version** `SignMessageVersion` * Off-chain message signing mode. Defaults to `SignMessageVersion.V0`. * - **appDomain** `string` * V0 only: application domain included in the header (padded/truncated to 32 bytes). * Ignored for V1, Legacy, and Raw. * - **signers** `Uint8Array[]` * V1 only: additional required signers included in the off-chain message header * alongside the user's key. Per sRFC 38, this is the recommended replacement for * the V0 `appDomain` field — pass the dApp's public key here to bind the message * to a specific application. Signers are sorted and deduplicated automatically. * Each entry must be a 32-byte Ed25519 public key. At most 254 additional signers * are supported (1 slot reserved for the user's key). Invalid length or exceeding * the limit returns an error before any device communication. * Ignored for V0, Legacy, and Raw. * * ### Returns * * `{ observable, cancel }` where: * - `observable` emits `DeviceActionState<{ signature: string }, SignMessageDAError, IntermediateValue>` updates. * On **Completed**, `output.signature` is a base58-encoded string — a full * envelope (V0/V1/Legacy) or the plain Ed25519 signature (Raw). * - `cancel` aborts the action on the Ledger device. * * @example * ```ts * // V0 with app domain * const { observable } = signer.signMessage("44'/501'/0'", "Hello World", { * version: SignMessageVersion.V0, * appDomain: "my-app.com", * }); * * // V1 with additional required signer (replaces appDomain per sRFC 38) * const { observable } = signer.signMessage("44'/501'/0'", "Hello World", { * version: SignMessageVersion.V1, * signers: [dAppPubkeyBytes], * }); * * observable.subscribe({ * next: (state) => { * if (state.status === DeviceActionStatus.Completed) { * console.log("Signature:", state.output.signature); // base58 string * } * }, * }); * ``` */ signMessage(derivationPath: string, message: string | Uint8Array, options?: MessageOptions): SignMessageDAReturnType; /** * Derive and optionally display a Solana address on the device. * * ### Parameters * * **Required** * - **derivationPath** `string` * The derivation path of the account to retrieve the address from * (e.g. `"44'/501'/0'"`). * * **Optional** * - **options** `AddressOptions` * - **checkOnDevice** `boolean` * If `true`, prompts the user to verify the address on the device. * - **skipOpenApp** `boolean` * If `true`, skips opening the Solana app on the device. * * ### Returns * * `{ observable, cancel }` where: * - `observable` emits `DeviceActionState` updates. * On **Completed**, `output` is the base58-encoded Solana address. * - `cancel` aborts the action on the Ledger device. * * @example * ```ts * const { observable } = signer.getAddress("44'/501'/0'", { checkOnDevice: true }); * observable.subscribe({ * next: (state) => { * if (state.status === DeviceActionStatus.Completed) { * console.log("Address:", state.output); // base58 string * } * }, * }); * ``` */ getAddress(derivationPath: string, options?: AddressOptions): GetAddressDAReturnType; /** * Query the Solana app version and settings on the connected device. * * ### Parameters * * This method does not require any parameters. * * ### Returns * * `{ observable, cancel }` where: * - `observable` emits `DeviceActionState` updates. * On **Completed**, `output` contains: * - `blindSigningEnabled` `boolean` — whether blind signing is enabled. * - `pubKeyDisplayMode` `PublicKeyDisplayMode` — how the public key is displayed. * - `version` `string` — the Solana app version (e.g. `"1.14.0"`). * - `cancel` aborts the action on the Ledger device. * * @example * ```ts * const { observable } = signer.getAppConfiguration(); * observable.subscribe({ * next: (state) => { * if (state.status === DeviceActionStatus.Completed) { * console.log(`Solana app v${state.output.version}`); * } * }, * }); * ``` */ getAppConfiguration(): GetAppConfigurationDAReturnType; } //# sourceMappingURL=DefaultSignerSolana.d.ts.map