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 s
    • 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
  • 💻Developer Resources
    • Smart Escrow Design
      • What does a Smart Escrow "look like"?
      • Roles in Trustless Work
    • Escrow Lifecycle
      • Initiation Phase
      • Funding Phase
      • Complete phase
      • Approval phase
      • Release phase
      • Dispute Resolution
    • Referencia de API
      • Introduction
        • How to Integrate us
      • Deploy
        • Initialize Escrow
      • Autenticación
        • Request Api Key
      • Escrows
        • Schema
        • Fund Escrow
        • Get Escrow by Contract ID
        • Resolve Dispute
        • Change Milestone Status
        • Change Milestone Flag
        • Change Dispute Flag
        • Get Multiple Escrow Balance
        • Distribute Escrow Earnings
      • Helpers
        • Set Trustline
        • Send Transaction
    • Stellar Wallets
      • Freighter Wallet
      • Albedo Wallet
      • xBull Wallet
      • Rabet Wallet
      • Lobstr Wallet
      • Hana Wallet
      • Additional Resources
      • Troubleshooting & FAQs
  • 🫂Community and Roadmap
    • Community
      • Notion for Startups
      • Meru
    • Get Involved
    • 🛣️Roadmap: The Journey Ahead
  • 🎒Historical Context
    • 📜Escrow History:
      • 🗿Ancient to Colonial Era
      • 🏦Banking Era (19th - 20th Century)
      • 💻The Digital Era and Online Escrow
    • ⛓️Blockchain Era: Smart Escrows
  • 📢Appendices
    • Contact and Support
    • Links
      • ⚒️Trustless Work dApp
      • 🌐Trustless Work Website
      • 📣Telegram Chat
      • 💎Only Dust Profile
      • 👩‍💻Swagger for API
      • 📜Github
Powered by GitBook
LogoLogo

Links

  • Website
On this page
  • Headers
  • Body

Was this helpful?

Export as PDF
  1. Developer Resources
  2. Referencia de API
  3. Escrows

Distribute Escrow Earnings

You release the escrow funds to the service provider through the approver.

POST escrow/distribute-escrow-earnings

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Body

Name
Type
Description

contractId

string

ID (address) that identifies the escrow contract

releaseSigner

string

Address of the signatory in charge of releasing the escrow funds.

Example of 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"
}

What this Endpoint returns?

This endpoint returns the transaction unsigned so that the transaction can be signed by means of a customer wallet.

Use example (Using 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;
}
PreviousGet Multiple Escrow BalanceNextHelpers

Was this helpful?

💻