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
await account.signPreparedTransaction(prepared)Parameters
| Field | Required | Description |
|---|---|---|
| prepared | Yes | `PreparedTx` — from cloud `transactions.prepare`. |
PreparedTx (input shape):
{
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>
{ 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
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
| Field | Required | Description |
|---|---|---|
| unsupported_capability | No | UTXO family — "UTXO client signing not enabled here". Monero — use `account.monero.prepareTransfer` / `signTransfer`. Watch-only. |
| invalid_argument | No | Malformed prepared payload or `from` mismatch. |
| unauthorized | No | Cannot access signing keys. |