# Strategy Assignment

Strategy selection is off-chain metadata signed by the vault owner. There's no on-chain transaction and no gas cost — you sign an EIP‑712 typed-data message with the owner wallet and POST it to the Public API. Tesseract picks the vault up and starts managing it.

Strategy can be set and changed freely before the vault starts being actively managed. Once a vault is actively managed, changes may be restricted — if your change isn't accepted, contact Tesseract to arrange a managed transition.

### Discover available strategies

The set of strategies and their IDs is in the [Tesseract app](https://app.tesseract.fi) and exposed via the Public API. Each strategy has a UUID and is tied to a specific underlying asset (a USDC strategy can only be assigned to a USDC vault).

### Sign the message

The EIP‑712 schema is defined in the [Reference → Public API](/dedicated-client-vaults/reference/public-api.md#strategy-assignment-eip-712) page. Using viem:

```ts
import {createWalletClient, http} from 'viem'
import {mainnet} from 'viem/chains'

const walletClient = createWalletClient({
  chain: mainnet,
  account: /* your signer */,
  transport: http(),
})

const timestamp = Math.floor(Date.now() / 1000)

const signature = await walletClient.signTypedData({
  domain: {
    name: 'Tesseract Public API',
    version: '1',
    chainId: 1,
  },
  types: {
    SetStrategy: [
      {name: 'vaultAddress', type: 'address'},
      {name: 'strategyId',   type: 'string'},
      {name: 'timestamp',    type: 'uint256'},
    ],
  },
  primaryType: 'SetStrategy',
  message: {
    vaultAddress: vault,
    strategyId: selectedStrategyId,
    timestamp: BigInt(timestamp),
  },
})
```

### Submit to the Public API

```ts
const response = await fetch(
  `https://api.vault.tesseract.fi/public/vaults/${vault}/strategy`,
  {
    method: 'PUT',
    headers: {'content-type': 'application/json'},
    body: JSON.stringify({
      clientAddress: owner,
      strategyId: selectedStrategyId,
      signature,
      timestamp,
    }),
  },
)

if (!response.ok) {
  throw new Error(`Failed to assign strategy: ${response.status}`)
}
```

The API verifies:

* The signature recovers to `clientAddress`.
* `clientAddress` is the owner of the vault.
* `timestamp` is recent (a few minutes — sign and submit in the same flow).
* The vault is eligible for strategy change (see note above about actively-managed vaults).

### After assignment

Once the signature is accepted, Tesseract's management process picks up the vault on its next cycle and begins allocating positions according to the selected strategy. You can see the assignment reflected in the vault's detail via `GET /vaults/{vault}` — see [Reading Vault Data](/dedicated-client-vaults/integration-guide/scenario-a/reading-vault-data.md).

### Changing strategy later

Re-sign and re-submit with a different `strategyId` — each submission replaces the previous assignment. Strategy changes may be restricted once the vault is actively managed; if your submission is rejected, contact Tesseract to arrange a managed transition.

***

Continue to [**Reading Vault Data**](/dedicated-client-vaults/integration-guide/scenario-a/reading-vault-data.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tesseract.fi/dedicated-client-vaults/integration-guide/scenario-a/strategy-assignment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
