Skip to content
Docs

Client: signing

Sign a prepared transaction

Sign transactions prepared by the Cloud API. UTXO and Monero throw unsupported_capability.

Overview

The preferred send path for most families is to call the Cloud API prepare route, sign with signPreparedTransaction, and then call broadcast. Keys never leave the device.

Not supported here: family: "utxo" and family: "monero" throw unsupported_capability. Monero uses account.monero.prepareTransfer / signTransfer. UTXO needs a PSBT-capable signer.

Signature

js
await account.signPreparedTransaction(prepared)

Parameters

FieldRequiredDescription
preparedYes`PreparedTx` — from cloud `transactions.prepare`.

PreparedTx (input shape):

ts
{
  chainId: GrayChainId;
  from: string;
  to: string;
  value: string;
  kind: "transfer" | "token_transfer" | "nft_transfer" | "contract_call" | "from_request";
  unsignedPayload: {
    family: ChainFamily | "move";
    unsigned: EvmUnsignedTx | Record<string, unknown>;
    id?: string;
    warnings?: string[];
  };
}

Response

Promise<SignedTx>

ts
{ signedPayload: string; txHash?: string }

txHash is set for Gram (TON): the transaction hash computed while signing (64 hexadecimal characters). Pass it to broadcast so the response and any linked Ledger API record carry the hash. A wallet that has never sent anything is deployed by its first transfer automatically.

Usage

js
const prepared = await gray.transactions.prepare({
  kind: "transfer",
  chainId: "ethereum",
  from: a.address("evm"),
  to: recipient,
  value: "1000000000000000",
});

const { signedPayload, txHash } = await a.signPreparedTransaction(prepared);

await gray.transactions.broadcast({
  chainId: "ethereum",
  signedPayload,
  txHash, // set for Gram (TON); undefined elsewhere
});

Throws

FieldRequiredDescription
unsupported_capabilityNoUTXO family — "UTXO client signing not enabled here". Monero — use `account.monero.prepareTransfer` / `signTransfer`. Watch-only.
invalid_argumentNoMalformed prepared payload or `from` mismatch.
unauthorizedNoCannot access signing keys.