Actualizar desde Tx Hash

Este endpoint te permite cambiar las propiedades de un escrow siempre que se cumpla una serie de requisitos, que se mencionarán en esta sección.

Requisitos de uso:

  • Debe tener el txHash generado a partir de una transacción enviada directamente a la red Stellar.

  • Los datos de escrow asociados con este txHash ya deben existir en la cola interna.

Encabezados

Nombre
Valor

Content-Type

application/json

x-api-key

<token>

Flujo de trabajo:

  1. El XDR se obtiene de cualquier transacción (no firmada) generada con cualquiera de los endpoints de nuestra API REST.

  2. Se genera y devuelve un XDR no firmado.

  3. El XDR se firma externamente y se envía directamente a Stellar.

  4. Se recupera el txHash resultante.

  5. El txHash se envía a /indexer/update-from-txHash.

  6. La información de escrow se recupera de la cola interna y se almacena en Firebase.

Open API

put
Autorizaciones
Cuerpo
txHashstringRequerido

Transaction hash

Example: b0e61d4...f1cb2d29
Respuestas
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
  }
}

Ejemplo 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": tu_api_key,
  },
});

export const updateEscrowFromTxHash = async (txHash) => {
  const response = await http.post("/indexer/update-from-txHash", { txHash });
  return response.data;
};

Última actualización

¿Te fue útil?