# 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).

## 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 config = MultisigConfig.from({
  owners: [
    {
      owner: '0x1111111111111111111111111111111111111111',
      weight: 1
    },
    {
      owner: '0x2222222222222222222222222222222222222222',
      weight: 1
    }
  ],
  threshold: 2
})
const account = MultisigConfig.getAddress(config)

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

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

const ordered = SignatureEnvelope.sortMultisigApprovals({
  // [!code focus]
  account, // [!code focus]
  config, // [!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#L1489)

## Parameters

### value

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

The approval ordering parameters.

#### value.account

* **Type:** `abitype_Address`

The native multisig account address.

#### value.config

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

Complete applicable multisig configuration witness.

#### 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[]`
