# SignatureEnvelope.sortMultisigApprovals

Orders native multisig owner approvals into the strictly-ascending recovered-owner order the Tempo node requires for the multisig `signatures` array (the node enforces "recovered owners must be strictly ascending").

Each approval is signed over the multisig owner approval digest ([`MultisigConfig.getSignPayload`](/tempo/reference/MultisigConfig/getSignPayload)), so the signer of every approval is recovered against that digest and the list is sorted by the recovered owner address. Works for any owner key type (secp256k1, p256, webAuthn).

Config updates never change `account`, so the genesis config is the correct input even for post-update transactions.

## Imports

:::code-group
```ts [Named]
import { SignatureEnvelope } from 'ox/tempo'
```

```ts [Entrypoint]
import * as SignatureEnvelope from 'ox/tempo/SignatureEnvelope'
```
:::

## Examples

```ts twoslash
import { Secp256k1 } from 'ox'
import {
  MultisigConfig,
  SignatureEnvelope,
  TxEnvelopeTempo
} from 'ox/tempo'

const genesisConfig = MultisigConfig.from({
  threshold: 2,
  owners: [
    {
      owner: '0x1111111111111111111111111111111111111111',
      weight: 1
    },
    {
      owner: '0x2222222222222222222222222222222222222222',
      weight: 1
    }
  ]
})

const tx = TxEnvelopeTempo.from({ chainId: 1, calls: [] })
const payload = TxEnvelopeTempo.getSignPayload(tx)

const privateKeys = [
  Secp256k1.randomPrivateKey(),
  Secp256k1.randomPrivateKey()
]
const digest = MultisigConfig.getSignPayload({
  payload,
  genesisConfig
})
const signatures = privateKeys.map((privateKey) =>
  SignatureEnvelope.from(
    Secp256k1.sign({ payload: digest, privateKey })
  )
)

const ordered = SignatureEnvelope.sortMultisigApprovals({
  // [!code focus]
  genesisConfig, // [!code focus]
  payload, // [!code focus]
  signatures // [!code focus]
}) // [!code focus]
```

## Definition

```ts
function sortMultisigApprovals(
  value: sortMultisigApprovals.Value,
): readonly SignatureEnvelope[]
```

**Source:** [src/tempo/SignatureEnvelope.ts](https://github.com/wevm/ox/blob/main/src/tempo/SignatureEnvelope.ts#L1794)

## Parameters

### value

* **Type:** `sortMultisigApprovals.Value`

The approval ordering parameters.

#### value.account

* **Type:** `abitype_Address`

The native multisig account address.

#### value.genesisConfig

* **Type:** `{ salt?: 0x${string}; threshold: number; owners: readonly Owner[]; }`

The initial multisig config (the bootstrap config that derived the
permanent `account`). Used to derive the account automatically.

#### value.payload

* **Type:** `0x${string} | Uint8Array`

The inner transaction sign payload (`tx.signature_hash()`).

#### value.signatures

* **Type:** `readonly SignatureEnvelope[]`

The owner approvals to order.

## Return Type

The owner approvals ordered ascending by recovered owner address.

`readonly SignatureEnvelope[]`
