Resolución de Disputas

Resuelve disputas de escrow distribuyendo fondos al aprobador y al proveedor de servicios según lo determinado por el solucionador de disputas (dispute resolver).

POST escrow/resolving-disputes

Encabezados

Nombre
Valor

Content-Type

application/json

Authorization

Bearer <token>

Cuerpo

Nombre
Tipo
Descripción
contractId

string

ID (dirección) que identifica el contrato de escrow.

disputeResolver

string

Dirección del solucionador de disputas, quien resuelve disputas en un escrow.

approverFunds

string

Monto a transferir al aprobador para la resolución de disputas.

 serviceProviderFunds 

string

Monto a transferir al proveedor de servicios por la solución de disputas.

Ejemplo de un cuerpo de solicitud (request body):

{
	"contractId": "GC3DJY4LLQYJHEONXFDLQVVRCFZQCPFX7VD33KP4P7QSVZY3SJHQBZGV",
	"disputeResolver": "GBY3PAJY5R3ZIXTYBGFW4URB4RINEXQBC3T4RWDDKJ5TZXQYZUN6A4TP", 
	"approverFunds": "100",
	"serviceProviderFunds": "50"
}

Respuestas posibles

{    
    "status": "SUCCESS",
    "unsignedTransaction": "AAAAAgAAAABfQAm/gS..."  // XDR Hash Transaction
}

¿Qué retorna este endpoint?

Este endpoint retorna la transacción sin firmar, para que pueda ser firmada mediante una billetera del usuario.

Ejemplo de uso (usando axios):

import axios from "axios";

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

export const useExample = async () => {
    // Get the signer address
    const { address } = await kit.getAddress();

    const response = await http.post(
      "/escrow/resolving-disputes",
      {
        // body requested for the endpoint
      },
    ); 
    
    // Get the unsigned transaction hash
    const { unsignedTransaction } = response.data;

    // Sign the transaction by wallet
    const { signedTxXdr } = await signTransaction(unsignedTransaction, {
      address,
      networkPassphrase: WalletNetwork.TESTNET,
    });

    // Send the transaction to Stellar Network
    const tx = await http.post("/helper/send-transaction", {
      signedXdr: signedTxXdr,
      returnValueIsRequired: true,
    });

    const { data } = tx;

    return data;
}

Last updated

Was this helpful?