Trustless Work
Spanish
Spanish
  • Bienvenido
  • Inicio
    • Guía rápida
    • Conceptos clave
    • Herramientas esenciales
  • ☀️Acerca de Trustless Work
    • Visión y Misión
    • 🛤️Nuestro Camino Hasta Ahora
      • 🤔El Problema: Orígen de Trustless Work
      • 👾El Equipo Se Une
      • 💡La Solución: Escrows
      • 🏆Hitos Clave
        • 🌠DraperU Stellar Astro Hacker House: Un Antes y Un Después
        • Lanzamiento de la API V1 en el Pura Vida ETH Hackathon
      • 🚀Programas Actuales
        • 🌟DraperU Embark Program
        • 💻OD Hack Campaigns
      • 🛠️Desarrollo Vertical
      • 🔮Visión a Futuro
    • Equipo
  • ⚒️Descripción de la Tecnología
    • 🚀Smart Escrow API
    • ⛓️Smart Contracts Open-Source de Escrow
    • 📂Plantillas Open-Source y Herramientas Para Desarrolladores
    • 💵USDC: La Stablecoin Detrás de Trustless Work
    • 🌟Stellar y Soroban: El Motor de Trustless Work
  • 🌍Casos de Uso: Escrow-as-a-Service Para Cualquier Industria
    • 🌎Proyecto Destacado: Kindfi
  • 🤖Tutorial de Trustless Work Dapp
    • Paso 1: Accediendo a la Trustless Work Dapp e Iniciando Sesión
    • Paso 2: Creación de Perfil y Solicitud de Clave API
    • Step 3: Crea un Escrow
    • Step 4: Financiando un Escrow
    • Paso 5: Marcando un Hito Como Completo ✅
    • Paso 6: Aprobando el Hito
    • Paso 7: Liberación del Pago
    • Cómo Obtener Testnet Tokens
  • 💻Recursos Para Desarrolladores
    • Smart Escrow Design
      • ¿Cómo Se Ve un Smart Escrow?
      • Roles En Trustless Work
    • Ciclo de Vida del Escrow
      • Fase de Iniciación
      • Fase de Financiamiento
      • Fase de Completamiento
      • Fase de Aprobación
      • Fase de Liberación
      • Resolución de Disputas
    • Referencia de API
      • Introducción
        • Cómo Integrarnos
      • Implementación (Deploy)
        • Inicia el escrow
      • Autenticación
        • Solicitar una Clave API
      • Escrows
        • Schema
        • Financiar Escrow
        • Obtener Escrow por Contract ID
        • Resolución de Disputas
        • Cambiar el Estado del Hito (Milestone)
        • Cambiar el Flag del Hito (Milestone)
        • Cambiar Flag de Disputa
        • Obtener el Balance de Múltiples Escrows
        • Distribuir Ganancias del Escrow
      • Helpers (Funciones Auxiliares)
        • Establecer Trustline
        • Enviar Transacción
    • Stellar Wallets
      • Freighter Wallet
      • Albedo Wallet
      • xBull Wallet
      • Rabet Wallet
      • Lobstr Wallet
      • Hana Wallet
      • Recursos adicionales
      • Solución de problemas y preguntas frecuentes
  • 🫂Comunidad y Roadmap
    • Comunidad
      • Notion para Startups
      • Meru
    • Involúcrate
    • 🛣️Roadmap: El Camino por Delante
  • 🎒Contexto Histórico
    • 📜Historia de los Escrows:
      • 🗿De la Era Antigua a la Colonial
      • 🏦La Era Bancaria (Siglo XIX - XX)
      • 💻La Era Digital y el Escrow en Línea
    • ⛓️La Era de la Blockchain: Smart Escrows
  • 📢Apéndices
    • Contacto y Soporte
    • Enlaces
      • ⚒️Trustless Work dApp
      • 🌐Trustless Work Website
      • 📣Telegram Chat
      • 💎Only Dust Profile
      • 👩‍💻Swagger for API
      • 📜Github
Powered by GitBook
LogoLogo

Links

  • Website
On this page
  • Encabezados
  • Cuerpo

Was this helpful?

Export as PDF
  1. Recursos Para Desarrolladores
  2. Referencia de API
  3. Escrows

Distribuir Ganancias del Escrow

Permite liberar los fondos del escrow al proveedor de servicios a través del aprobador.

POST escrow/distribute-escrow-earnings

Encabezados

Nombre
Valor

Content-Type

application/json

Authorization

Bearer <token>

Cuerpo

Name
Type
Description

contractId

string

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

signer

string

Ente que firma la transacción que implementa e inicializa el escrow.

releaseSigner

string

Dirección del firmante a cargo de liberar los fondos del escrow.

Ejemplo de cuerpo de solicitud (request body)

{
	"contractId": "GC3DJY4LLQYJHEONXFDLQVVRCFZQCPFX7VD33KP4P7QSVZY3SJHQBZGV",
	"signer": "GBY3PAJY5R3ZIXTYBGFW4URB4RINEXQBC3T4RWDDKJ5TZXQYZUN6A4TP", 
	"amount": "500.00"
}

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

Not found

{
    status: "FAILED"
    message: "Escrow not found"
}

Only release signer can distribute the escrow earnings

{
    status: "FAILED"
    message: "Only the release signer can claim escrow earnings"
}

No milestone defined

{
    status: "FAILED"
    message: "Escrow initialized without milestone"
}

Escrow not completed

{
    status: "FAILED"
    message: "The escrow must be completed to distribute earnings"
}

Escrow in dispute

{
    status: "FAILED"
    message: "Escrow has been opened for dispute resolution"
}

Escrow balance not enough

{
    status: "FAILED"
    message: "The escrow balance must be equal to the amount of earnings defined for the escrow"
}
{
    "message": "Message",
    "error": "Bad Request",
    "statusCode": 400
}
{
  "statusCode": 401,
  "message": "Unauthorized",
  "error": "Unauthorized"
}
{
    "statusCode": 429,
    "message": "ThrottlerException: Too Many Requests"
}

¿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/distribute-escrow-earnings",
      {
        // 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;
}
PreviousObtener el Balance de Múltiples EscrowsNextHelpers (Funciones Auxiliares)

Last updated 1 month ago

Was this helpful?

💻