Client: signing
Prepare intents locally
Offline intent shapes for Cloud prepare: transfer, token, NFT, contract_call.
Overview
Intent objects describe what you send to Cloud transactions.prepare. You can build them offline in the client, then prepare / sign / broadcast. Sign response is always { signedPayload }, plus txHash for Gram (TON).
transfer
ts
{
kind: "transfer";
chainId: GrayChainId;
from: string;
to: string;
value: string; // native smallest unit
data?: string;
}token_transfer
ts
{
kind: "token_transfer";
chainId: GrayChainId;
from: string;
to: string;
token: string; // ERC-20 / SPL mint / TRC-20 / Move coin type
amount: string; // token smallest unit
}nft_transfer
ts
{
kind: "nft_transfer";
chainId: GrayChainId;
from: string;
to: string;
contract: string;
tokenId: string;
}contract_call
ts
{
kind: "contract_call";
chainId: GrayChainId;
from: string;
to: string;
data: string;
value?: string;
}Helper: buildErc20ApproveIntent returns a contract_call — see Encode helpers.
Usage
js
const intent = {
kind: "transfer",
chainId: "base",
from: a.address("evm"),
to: recipient,
value: "1000000000000000",
};
const prepared = await gray.transactions.prepare(intent);
const { signedPayload } = await a.signPreparedTransaction(prepared);
await gray.transactions.broadcast({ chainId: "base", signedPayload });Limits
- Custom EVM networks: native
transferonly via user RPC — see Capability matrix - Monero: do not use Cloud prepare — use prepareTransfer / signTransfer
- UTXO: Cloud may prepare;
signPreparedTransactionthrowsunsupported_capability
Throws
Intent construction itself is plain data. Downstream signPreparedTransaction throws as documented on Sign a prepared Cloud transaction. Cloud prepare returns HTTP error codes for plan / capability gates.