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

Was this helpful?

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

Change Milestone Status

Responsible for modifying the "status" property of a specific milestone in the escrow.

POST escrow/change-milestone-status

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Body

Name
Type
Description

contractId

string

ID (address) that identifies the escrow contract

milestoneIndex

string

Position that identifies the milestone within the group of milestones in the escrow

newStatus

string

New value for the "status" property within the escrow milestone

serviceProvider

string

Address of the service provider who will modify the contract's "status" property

Example of Request Body:

{
	"contractId": "GC3DJY4LLQYJHEONXFDLQVVRCFZQCPFX7VD33KP4P7QSVZY3SJHQBZGV",
	"milestoneIndex": "0", 
	"newStatus": "Approved",
	"serviceProvider": "GBY3PAJY5R3ZIXTYBGFW4URB4RINEXQBC3T4RWDDKJ5TZXQYZUN6A4TP"
}

Possible Responses

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

Not Found

{
  "status": "FAILED"
  "messgae": "Only the dispute resolver can execute this function"
}

Only the service provider can change milestone status

{
  "status": "FAILED"
  "messgae": "Only the service provider can change milestone status"
}

Invalid milestone index

{
  "status": "FAILED"
  "messgae": "Invalid milestone index"
}

No milestone defined

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

Not Found

{
  "status": "FAILED"
  "message": "Escrow not found"
}
{
    "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/change-milestone-status",
      {
        // 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;
}

PreviousResolve DisputeNextChange Milestone Flag

Was this helpful?

💻