# Atualizar escrow

### Requisitos para usar:

1. Apenas a entidade com o papel de plataforma tem permissão para executar este endpoint
2. Se um escrow tiver fundos, a única coisa que a plataforma pode fazer é adicionar mais marcos. As outras propriedades não podem ser modificadas em hipótese alguma.

### Cabeçalhos

<table><thead><tr><th width="366">Nome</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>

### Papéis:

| Nome            | Tipo   | Descrição                                                                                     |
| --------------- | ------ | --------------------------------------------------------------------------------------------- |
| approver        | string | Endereço da entidade que solicita o serviço.                                                  |
| serviceProvider | string | Endereço da entidade que fornece o serviço.                                                   |
| platformAddress | string | Endereço da entidade que possui o escrow                                                      |
| releaseSigner   | string | Endereço do usuário responsável por liberar os fundos do escrow para o prestador de serviços. |
| disputeResolver | string | Endereço responsável por resolver disputas dentro do escrow.                                  |
| receiver        | string | Endereço para o qual os recursos do escrow serão enviados                                     |

### Marco:

| Nome        | Tipo    | Descrição                                               |
| ----------- | ------- | ------------------------------------------------------- |
| description | string  | Texto descrevendo a função do marco.                    |
| status      | string  | Status do marco. Ex: Aprovado, Em disputa, etc...       |
| approved    | boolean | Flag indicando se um marco foi aprovado pelo aprovador. |

### Flags

| Nome     | Tipo    | Descrição                                                  |
| -------- | ------- | ---------------------------------------------------------- |
| disputed | boolean | Flag indicando que um escrow está em disputa.              |
| released | boolean | Flag indicando que os fundos do escrow já foram liberados. |
| resolved | boolean | Flag indicando que um escrow em disputa já foi resolvido.  |

### Trustline

| Nome    | Tipo   | Descrição                                                                          |
| ------- | ------ | ---------------------------------------------------------------------------------- |
| address | string | Endereço público que estabelece permissão para aceitar e usar um 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/04c193e7fe67038d85aa843153838d14f8754683" alt=""><figcaption></figcaption></figure>

### **O que este endpoint retorna?**

Este endpoint retorna a transação não assinada para que a transação possa ser assinada por meio de uma carteira do cliente.

### Exemplo 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 () => {
    // Obtenha o endereço do assinante
    const { address } = await kit.getAddress();

    const response = await http.put(
      "/escrow/single-release/update-escrow",
      {
        // corpo solicitado para o endpoint
      },
    ); 
    
    // Obtenha o hash da transação não assinada
    const { unsignedTransaction } = response.data;

    // Assine a transação pela carteira
    const { signedTxXdr } = await signTransaction(unsignedTransaction, {
      address,
      networkPassphrase: WalletNetwork.TESTNET,
    });

    // Envie a transação para a Rede 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-pt/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.
