Atualizar a partir do Hash da Tx

Este endpoint permite que você altere as propriedades de uma caução desde que uma série de requisitos seja atendida, os quais serão mencionados nesta seção.

Requisitos para Uso:

  • Você deve ter o txHash gerado a partir de uma transação enviada diretamente para a rede Stellar.

  • Os dados de escrow associados a este txHash já devem existir na fila interna.

Cabeçalhos

Nome
Valor

Content-Type

application/json

x-api-key

<token>

Fluxo de Trabalho:

  1. O XDR é obtido de qualquer transação (não assinada) gerada com qualquer um dos endpoints da nossa API REST.

  2. Um XDR não assinado é gerado e retornado.

  3. O XDR é assinado externamente e enviado diretamente ao Stellar.

  4. O txHash resultante é recuperado.

  5. O txHash é enviado para /indexer/update-from-txHash.

  6. As informações de escrow são recuperadas da fila interna e armazenadas no Firebase.

Open API

put
Autorizações
Corpo
txHashstringObrigatório

Transaction hash

Example: b0e61d4...f1cb2d29
Respostas
200

Returns the escrow object that was just saved/updated in the indexer and the success or failure of the response.

application/json
put
/indexer/update-from-txhash
PUT /indexer/update-from-txhash HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 31

{
  "txHash": "b0e61d4...f1cb2d29"
}
{
  "status": "SUCCESS",
  "message": "Escrow saved successfully / The escrow has been correctly indexed in our database.",
  "savedEscrow": {
    "contractId": "CB25FW....",
    "signer": "GBPUA....",
    "type": "multi-release",
    "engagementId": "ENG-003",
    "title": "Title of the Escrow",
    "description": "Description of the Escrow",
    "milestones": [
      {
        "description": "Initial payment",
        "amount": 2,
        "status": "pending",
        "flags": {
          "disputed": false,
          "released": false,
          "resolved": false,
          "approved": false
        }
      },
      {
        "description": "Final payment",
        "amount": 5,
        "status": "pending",
        "flags": {
          "disputed": false,
          "released": false,
          "resolved": false,
          "approved": false
        }
      }
    ],
    "platformFee": 5,
    "receiverMemo": 0,
    "roles": {
      "approver": "GBPUACN....",
      "serviceProvider": "GA2RRI....",
      "platformAddress": "GBPA2LO....",
      "releaseSigner": "GCPZUO....",
      "disputeResolver": "GDBMRV...",
      "receiver": "GA2RRI...",
      "issuer": "GBPUAC..."
    },
    "trustline": {
      "address": "CBIELT...",
      "name": "USDC"
    },
    "isActive": true,
    "updatedAt": {
      "_seconds": 1750698602,
      "_nanoseconds": 356000000
    },
    "createdAt": {
      "_seconds": 1750698602,
      "_nanoseconds": 356000000
    },
    "balance": 0
  }
}

Exemplo de Uso:

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 updateEscrowFromTxHash = async (txHash) => {
  const response = await http.post("/indexer/update-from-txHash", { txHash });
  return response.data;
};

Atualizado

Isto foi útil?