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 Flag

Responsible for modifying the "flag" property of a specific milestone in the escrow to approve that milestone.

POST escrow/change-milestone-flag

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

newFlag

boolean

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

client

string

Address of the client who will approve the milestone

Example of Request Body:

{
	"contractId": "GC3DJY4LLQYJHEONXFDLQVVRCFZQCPFX7VD33KP4P7QSVZY3SJHQBZGV",
	"milestoneIndex": "0", 
	"newFlag": true,
	"client": "GBY3PAJY5R3ZIXTYBGFW4URB4RINEXQBC3T4RWDDKJ5TZXQYZUN6A4TP"
}

Possible Responses

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

Not Found

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

Only the approver can change the

{
  "status": "FAILED"
  "messgae": "Only the approver can change milestone flag"
}

No milestones defined

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

Invalid milestone index

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

500

{
  "status": "500"
  "messgae": "An unexpected error occurred"
}
{
    "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-approved-flag",
      {
        // 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;
}
PreviousChange Milestone StatusNextChange Dispute Flag

Was this helpful?

💻