> For the complete documentation index, see [llms.txt](https://docs.lagoon.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lagoon.finance/developer-hub/lagoon-api/mutations.md).

# Mutations

Updating off-chain vault metadata with an EIP-712 signature from the vault owner.

The API exposes a single mutation today, used by vault owners to update **off-chain metadata** — the descriptive fields shown on the Lagoon frontend. None of these fields affect on-chain behaviour; for on-chain configuration, use the vault contract directly (see [Smart Contract Reference](/developer-hub/smart-contract-reference.md)).

## `updateVaultMetadata`

```graphql
mutation UpdateVaultMetadata(
  $vault: Address!
  $chainId: Int!
  $input: UpdateVaultMetadataInput!
  $signature: String!
  $deadline: Int!
) {
  updateVaultMetadata(
    vaultAddress: $vault
    chainId: $chainId
    input: $input
    signature: $signature
    deadline: $deadline
  ) {
    address
    name
    description
    shortDescription
    maxCapacity
    transparencyUrl
  }
}
```

[**Try in Apollo Sandbox →**](https://api.lagoon.finance/query?document=mutation%20UpdateVaultMetadata%28%0A%20%20%24vault%3A%20Address%21%0A%20%20%24chainId%3A%20Int%21%0A%20%20%24input%3A%20UpdateVaultMetadataInput%21%0A%20%20%24signature%3A%20String%21%0A%20%20%24deadline%3A%20Int%21%0A%29%20%7B%0A%20%20updateVaultMetadata%28%0A%20%20%20%20vaultAddress%3A%20%24vault%0A%20%20%20%20chainId%3A%20%24chainId%0A%20%20%20%20input%3A%20%24input%0A%20%20%20%20signature%3A%20%24signature%0A%20%20%20%20deadline%3A%20%24deadline%0A%20%20%29%20%7B%0A%20%20%20%20address%0A%20%20%20%20name%0A%20%20%20%20description%0A%20%20%20%20shortDescription%0A%20%20%20%20maxCapacity%0A%20%20%20%20transparencyUrl%0A%20%20%7D%0A%7D)

### Input fields

`UpdateVaultMetadataInput` — every field is optional; omitted fields are left unchanged.

| Field               | Type     | Description                                                                                                                                                            |
| ------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `description`       | `String` | Detailed description of the vault and its strategy.                                                                                                                    |
| `shortDescription`  | `String` | One-line summary.                                                                                                                                                      |
| `maxCapacity`       | `String` | Off-chain soft cap on total deposits, surfaced to the frontend so vault operators can limit incoming deposits via the UI. Purely informative, no on-chain enforcement. |
| `averageSettlement` | `Float`  | Average settlement time in hours.                                                                                                                                      |
| `transparencyUrl`   | `String` | URL to a transparency report or dashboard.                                                                                                                             |

### Authentication

The mutation is gated by an **EIP-712 signature** from the vault owner. The server recovers the signer from `signature` over the typed data, then checks that the recovered address matches the on-chain owner of `vaultAddress` on `chainId`. `deadline` is a Unix-seconds timestamp after which the signature is rejected (replay protection); the Lagoon dApp uses a 5-minute TTL.

#### Domain

```ts
{
  name: 'Lagoon Vault Admin',
  version: '1',
  chainId,            // uint256 — same chainId as the mutation argument
  verifyingContract,  // address — same vaultAddress as the mutation argument
}
```

#### Typed data

`primaryType: 'UpdateVaultMetadata'`

```ts
UpdateVaultMetadata: [
  { name: 'chainId',           type: 'uint256' },
  { name: 'vaultAddress',      type: 'address' },
  { name: 'description',       type: 'string'  },
  { name: 'shortDescription',  type: 'string'  },
  { name: 'transparencyUrl',   type: 'string'  },
  { name: 'maxCapacity',       type: 'string'  },
  { name: 'averageSettlement', type: 'string'  },
  { name: 'deadline',          type: 'uint256' },
]
```

{% hint style="warning" %}
**Defaults must match exactly or the signature will silently fail to verify.**

* Omitted `string` fields → `''` (empty string)
* Omitted `uint256` fields → `0n`
* `averageSettlement` is hashed as a **string**, not a number — format with `value.toFixed(6)` so the canonical decimal representation matches the backend.
  {% endhint %}

#### Signing with viem / wagmi

```ts
import { useSignTypedData } from 'wagmi';

const signature = await signTypedDataAsync({
  domain: {
    name: 'Lagoon Vault Admin',
    version: '1',
    chainId: BigInt(chainId),
    verifyingContract: vaultAddress,
  },
  types: {
    UpdateVaultMetadata: [
      { name: 'chainId',           type: 'uint256' },
      { name: 'vaultAddress',      type: 'address' },
      { name: 'description',       type: 'string'  },
      { name: 'shortDescription',  type: 'string'  },
      { name: 'transparencyUrl',   type: 'string'  },
      { name: 'maxCapacity',       type: 'string'  },
      { name: 'averageSettlement', type: 'string'  },
      { name: 'deadline',          type: 'uint256' },
    ],
  },
  primaryType: 'UpdateVaultMetadata',
  message: {
    chainId: BigInt(chainId),
    vaultAddress,
    description:       input.description       ?? '',
    shortDescription:  input.shortDescription  ?? '',
    transparencyUrl:   input.transparencyUrl   ?? '',
    maxCapacity:       input.maxCapacity       ?? '',
    averageSettlement: input.averageSettlement != null
      ? input.averageSettlement.toFixed(6)
      : '',
    deadline: BigInt(deadline),
  },
});
```

### Example call

Shape of the call (the `signature` below is a placeholder — produce yours by signing the EIP-712 payload with the vault owner's key):

```bash
curl -sS -X POST https://api.lagoon.finance/query \
  -H "Content-Type: application/json" \
  -d '{
    "query": "mutation UpdateVaultMetadata($vault: Address!, $chainId: Int!, $input: UpdateVaultMetadataInput!, $signature: String!, $deadline: Int!) { updateVaultMetadata(vaultAddress: $vault, chainId: $chainId, input: $input, signature: $signature, deadline: $deadline) { address name description shortDescription maxCapacity transparencyUrl } }",
    "variables": {
      "vault": "0x936facdf10c8c36294e7b9d28345255539d81bc7",
      "chainId": 1,
      "input": { "shortDescription": "rETH yield strategy.", "averageSettlement": 24 },
      "signature": "0x...",
      "deadline": 1800000000
    }
  }'
```

The mutation returns the updated `Vault` so the client can read back the new metadata without a follow-up query.
