# Actualizar escrow

### Requisitos para usar:

1. Solo la entidad con el rol de plataforma tiene permisos para ejecutar este endpoint
2. Si un escrow tiene fondos, lo único que la plataforma puede hacer es añadir más hitos. Las demás propiedades no pueden modificarse bajo ninguna circunstancia.

### Encabezados

<table><thead><tr><th width="366">Nombre</th><th>Valor</th></tr></thead><tbody><tr><td>Content-Type</td><td><code>application/json</code></td></tr><tr><td>x-api-key</td><td><code>&#x3C;token></code></td></tr></tbody></table>

### Roles:

| Nombre          | Tipo   | Descripción                                                                                 |
| --------------- | ------ | ------------------------------------------------------------------------------------------- |
| approver        | string | Dirección de la entidad que solicita el servicio.                                           |
| serviceProvider | string | Dirección de la entidad que presta el servicio.                                             |
| platformAddress | string | Dirección de la entidad que posee el escrow                                                 |
| releaseSigner   | string | Dirección del usuario encargado de liberar los fondos del escrow al proveedor del servicio. |
| disputeResolver | string | Dirección encargada de resolver disputas dentro del escrow.                                 |
| receiver        | string | Dirección a la que se enviarán los ingresos del escrow                                      |

### Hito:

| Nombre      | Tipo    | Descripción                                                      |
| ----------- | ------- | ---------------------------------------------------------------- |
| description | string  | Texto que describe la función del hito.                          |
| status      | string  | Estado del hito. Ej: Aprobado, En disputa, etc...                |
| approved    | boolean | Bandera que indica si un hito ha sido aprobado por el aprobador. |

### Indicadores

| Nombre   | Tipo    | Descripción                                                         |
| -------- | ------- | ------------------------------------------------------------------- |
| disputed | boolean | Bandera que indica que un escrow está en disputa.                   |
| released | boolean | Bandera que indica que los fondos del escrow ya han sido liberados. |
| resolved | boolean | Bandera que indica que un escrow en disputa ya ha sido resuelto.    |

### Trustline

| Nombre  | Tipo   | Descripción                                                                      |
| ------- | ------ | -------------------------------------------------------------------------------- |
| address | string | Dirección pública que establece permiso para aceptar y usar un token específico. |

### Open API

## PUT /escrow/single-release/update-escrow

>

```json
{"openapi":"3.0.0","info":{"title":"Trustless Work API","version":"1.0"},"security":[{}],"paths":{"/escrow/single-release/update-escrow":{"put":{"operationId":"SingleReleaseController_updateEscrow","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSingleReleaseEscrow"}}}},"responses":{"200":{"description":"This endpoint returns an unsigned transaction in XDR format. This XDR is then used to sign the transaction using the “/helper/send-transaction” endpoint.","content":{"application/json":{}}},"400":{"description":"Bad request"},"401":{"description":"Unauthorized access"},"429":{"description":"Too Many Requests"},"500":{"description":"Possible errors:\n- Escrow not found\n- The platform fee cannot exceed 99%\n- Amount cannot be equal to or less than zero\n- Escrow initialized without milestone\n- Cannot define more than 50 milestones in an escrow\n- Only the platform address should be able to execute this function\n- The platform address of the escrow cannot be changed\n- Escrow has been opened for dispute resolution\n- All flags (approved, disputed, released) must be false in order to execute this function\n- The provided escrow properties do not match the stored escrow\n- You can't change the escrow properties after the milestone is approved\n- An unexpected error occurred","content":{"application/json":{}}}},"tags":["Single Release"]}}},"components":{"schemas":{"UpdateSingleReleaseEscrow":{"type":"object","properties":{"signer":{"type":"string","description":"Entity that signs the transaction that deploys and initializes the escrow"},"contractId":{"type":"string","description":"ID (address) that identifies the escrow contract"},"escrow":{"description":"Escrow data to update","allOf":[{"$ref":"#/components/schemas/EscrowData"}]}},"required":["signer","contractId","escrow"]},"EscrowData":{"type":"object","properties":{"engagementId":{"type":"string","description":"Unique identifier for the escrow"},"title":{"type":"string","description":"Name of the escrow"},"description":{"type":"string","description":"Text describing the function of the escrow"},"roles":{"description":"Roles that make up the escrow structure","type":"array","items":{"type":"object"}},"amount":{"type":"number","description":"Amount to be transferred upon completion of escrow milestones"},"platformFee":{"type":"number","description":"Commission that the platform will receive when the escrow is completed"},"milestones":{"description":"Objectives to be completed to define the escrow as completed","type":"array","items":{"type":"string"}},"flags":{"description":"Flags validating certain escrow life states","type":"array","items":{"type":"object"}},"isActive":{"type":"boolean","description":"Flag indicating whether the escrow is active or not at the database level. Makes only a logical deletion, the escrow will continue to function at the blockchain level."},"receiverMemo":{"type":"number","description":"Field used to identify the recipient's address in transactions through an intermediary account. This value is included as a memo in the transaction and allows the funds to be correctly routed to the wallet of the specified recipient"},"trustline":{"description":"Information on the trustline that will manage the movement of funds in escrow","type":"array","items":{"type":"object"}}},"required":["engagementId","title","description","roles","amount","platformFee","milestones","flags","isActive","receiverMemo","trustline"]}}}}
```

<figure><img src="/files/33f8c30c292e4ca3b1126b6173156113440d1d07" alt=""><figcaption></figcaption></figure>

### **¿Qué devuelve este Endpoint?**

Este endpoint devuelve la transacción sin firmar para que la transacción pueda ser firmada mediante la cartera del cliente.

### Ejemplo de uso:

```typescript
import axios from "axios";

const http = axios.create({
  baseURL: "https://dev.api.trustlesswork.com",
  timeout: 10000,
  headers: {
    "Content-Type": "application/json",
    "x-api-key": your_api_key,
  },
});

export const useExample = async () => {
    // Obtener la dirección del firmante
    const { address } = await kit.getAddress();

    const response = await http.put(
      "/escrow/single-release/update-escrow",
      {
        // cuerpo solicitado para el endpoint
      },
    ); 
    
    // Obtener el hash de la transacción sin firmar
    const { unsignedTransaction } = response.data;

    // Firmar la transacción con la cartera
    const { signedTxXdr } = await signTransaction(unsignedTransaction, {
      address,
      networkPassphrase: WalletNetwork.TESTNET,
    });

    // Enviar la transacción a la Red Stellar
    const tx = await http.post("/helper/send-transaction", {
      signedXdr: signedTxXdr,
    });

    const { data } = tx;

    return data;
}
```


---

# 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.trustlesswork.com/trustless-work/v1-es/api-rest/deploy/update-escrow-properties.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.
