# xrpl_signTransactionFor

Add one multisignature from the connected account to a transaction.

`xrpl_signTransactionFor` adds a single `Signers` entry for the connected account, over the transaction **exactly as sent**. It never autofills and never submits: you collect signatures from every signer, combine them, and submit.

## Request

```ts
{
  tx_json: Transaction; // Account is the multisigned account, not the connected one
  tx_signer?: string;   // if present, must be the connected account
  submit?: false;       // submit: true is refused
}
```

## Usage

```ts
const result = await provider.request(
  {
    method: 'xrpl_signTransactionFor',
    params: {
      tx_signer: 'r…', // the connected account
      tx_json: {
        TransactionType: 'Payment',
        Account: 'rMultisigAccount…',
        Destination: 'r…',
        Amount: '1000000',
        Fee: '36',
        Sequence: 42,
        SigningPubKey: '',
      },
    },
  },
  'xrpl:0',
);
```

Set `Fee` and `Sequence` yourself so every signer signs identical bytes. `LastLedgerSequence` is optional, which allows ticket-based multisign.

## Refused requests

| Request | Error |
|---|---|
| `submit: true` | `-32000` |
| `tx_signer` isn't the connected account | `4100` |
| `tx_json.Account` is the connected account | `-32000` (an account can't be one of its own signers) |
| `tx_json` already has a `TxnSignature` | `-32000` |
| Required fields missing | `-32000` |
| The connected account has already signed | `-32000` |

An XLS-56 `Batch` is handled as a batch co-signature instead, and these checks don't apply to it.

## Response

```ts
{ tx_json: { hash: string; Signers: [/* …with this account's entry added */]; /* … */ } }
```

## With wc-client

```ts
import core from '@joey-wallet/wc-client/core';

const response = await core.methods.signTransactionFor({
  provider,
  chainId: chain,
  request: {
    tx_signer: connectedAddress,
    tx_json: {
      TransactionType: 'Payment',
      Account: 'rMultisigAccount…',
      Destination: 'r…',
      Amount: '1000000',
      Fee: '36',
      Sequence: 42,
      SigningPubKey: '',
    },
  },
});
```
