Client: signing
Sign a message
Sign login or auth messages for an explicit chain or family.
Overview
Signs an arbitrary message for a specific chain or family. Not tied to activeChain—always pass chainOrFamily explicitly. Watch-only wallets cannot sign.
Signature
js
await account.signMessage(message, chainOrFamily, options?)Parameters
| Field | Required | Description |
|---|---|---|
| message | Yes | `string` — message to sign. |
| chainOrFamily | Yes | `GrayChainId | ChainFamily` — e.g. `"ethereum"` or `"evm"`. |
| options.recipient | No | `string` — NEAR (NEP-413) only, and required there: the app or recipient identifier. |
| options.nonce | No | `Uint8Array` — NEAR only: 32-byte nonce. Random when omitted; returned in the result. |
| options.callbackUrl | No | `string` — NEAR only: optional NEP-413 callback URL. |
| options.cosmosChainId | No | `string` — Cosmos (ADR-036) only: chain ID in the sign document. Defaults to an empty string. |
Response
Promise<SignMessageResult>
ts
{
signature: string; // encoding depends on the standard
address: string; // signer address
standard: MessageSignStandard;
publicKey?: string; // Cosmos and NEAR, where verifiers need the key
nonce?: string; // NEAR only: base64 nonce that was signed
}The standard field tells verifiers how the message was signed:
| Field | Required | Description |
|---|---|---|
| eip191 | No | EVM personal_sign. |
| tip191 | No | Tron signed message. |
| adr036 | No | Cosmos ADR-036 sign document. |
| bip137 | No | Bitcoin-style signed message on UTXO chains that define one. |
| nep413 | No | NEAR NEP-413 (requires options.recipient). |
| algorand-mx | No | Algorand MX-prefixed message. |
| sui-personal-message | No | Sui personal message. |
| solana-raw | No | Ed25519 signature over the raw message bytes. |
| sep53 | No | Stellar SEP-53 message. |
| kaspa | No | Kaspa message signing (Node.js only). |
Usage
js
const a = wallet.account(0);
const { signature, address, standard } = await a.signMessage(
"Login to Acme",
"ethereum",
);
// standard === "eip191"
const near = await a.signMessage("Login to Acme", "near", { recipient: "acme.near" });
// near.standard === "nep413"; near.publicKey and near.nonce are setThrows
| Field | Required | Description |
|---|---|---|
| unsupported_capability | No | Watch-only account, a family without a message-signing standard, or Kaspa outside Node.js. |
| invalid_argument | No | Unknown chain/family for this account. |
| unauthorized | No | Secrets unavailable (locked storage / watch). |