Umbra SDK Docs

ISigner

Umbra SDK reference for ISigner.

client


Defined in: src/client/interface/signer.ts:64

Abstract base class defining the contract for Solana message and transaction signing.

Remarks

Implementations of this class must provide cryptographic signing capabilities for Solana blockchain operations. All methods are asynchronous to support hardware wallets, remote signers, and other async signing mechanisms.

Example

class WalletAdapterSigner extends ISigner {
  async signMessage(message: Bytes): Promise<SolanaSignature> {
    return await this.wallet.signMessage(message);
  }

  async signTransaction(tx: VersionedTransaction): Promise<VersionedTransaction> {
    return await this.wallet.signTransaction(tx);
  }

  async signTransactions(txs: VersionedTransaction[]): Promise<VersionedTransaction[]> {
    return await this.wallet.signAllTransactions(txs);
  }

  async getPublicKey(): Promise<SolanaAddress> {
    return this.wallet.publicKey as SolanaAddress;
  }
}

Constructors

Constructor

new ISigner(): ISigner

Returns

ISigner

Methods

getPublicKey()

abstract getPublicKey(): Promise<SolanaAddress>

Defined in: src/client/interface/signer.ts:155

Retrieves the public key (Solana address) associated with this signer.

Returns

Promise<SolanaAddress>

A promise resolving to the signer's public key as a branded SolanaAddress

Throws

SignerError When the public key cannot be retrieved (e.g., signer not initialized)

Remarks

The returned address is a branded type that ensures type safety when used in Solana-specific contexts. The underlying type is PublicKey from @solana/web3.js. Implementations may throw specific subclasses of SignerError such as PublicKeyRetrievalError.

Example

const publicKey = await signer.getPublicKey();
console.log(`Signer address: ${publicKey.toBase58()}`);

signMessage()

abstract signMessage(message): Promise<SolanaSignature>

Defined in: src/client/interface/signer.ts:85

Signs an arbitrary message using the signer's private key.

Parameters

message

Bytes

The message bytes to sign as a Uint8Array

Returns

Promise<SolanaSignature>

A promise resolving to a 64-byte Ed25519 signature

Throws

SignerError When signing fails due to unavailable signer, invalid message, or cryptographic error

Remarks

The returned signature is a standard Solana Ed25519 signature (64 bytes). This method is typically used for off-chain message signing and verification. Implementations may throw specific subclasses of SignerError such as MessageSigningError.

Example

const message = new TextEncoder().encode('Hello, Solana!');
const signature = await signer.signMessage(message);
// signature is a 64-byte Uint8Array

signTransaction()

abstract signTransaction(transaction): Promise<VersionedTransaction>

Defined in: src/client/interface/signer.ts:108

Signs a single Solana versioned transaction.

Parameters

transaction

VersionedTransaction

The VersionedTransaction to sign

Returns

Promise<VersionedTransaction>

A promise resolving to the signed transaction with signatures attached

Throws

SignerError When signing fails due to invalid transaction, missing required signers, or network error

Remarks

The transaction is modified in-place with the signature. The signer's public key must be included in the transaction's required signers list. Implementations may throw specific subclasses of SignerError such as TransactionSigningError.

Example

const transaction = new VersionedTransaction(message);
transaction.message.recentBlockhash = blockhash;
const signedTx = await signer.signTransaction(transaction);
await connection.sendTransaction(signedTx);

signTransactions()

abstract signTransactions(transactions): Promise<VersionedTransaction[]>

Defined in: src/client/interface/signer.ts:133

Signs multiple Solana versioned transactions in a single batch operation.

Parameters

transactions

VersionedTransaction[]

Array of VersionedTransaction objects to sign

Returns

Promise<VersionedTransaction[]>

A promise resolving to an array of signed transactions in the same order as input

Throws

SignerError When signing fails for any transaction in the batch

Remarks

This method should be preferred over calling signTransaction multiple times as it allows implementations to optimize batch signing operations, especially for hardware wallets that benefit from batch processing. Implementations may throw specific subclasses of SignerError such as BatchTransactionSigningError.

Example

const transactions = [tx1, tx2, tx3];
const signedTxs = await signer.signTransactions(transactions);
// All transactions are now signed and ready to send