Desplegar
Despliega el contrato de escrow y define las propiedades del escrow.
Encabezados
Content-Type
application/json
x-api-key
<token>
Hito
descripción
cadena
Texto que describe la función del hito
estado
cadena (Valor por defecto: "peding")
Estado del hito. Ej: Aprobado, En disputa, etc...
aprobado
booleano (Valor por defecto: false)
Indicador que señala si un hito ha sido aprobado por el aprobador
Roles:
aprobador
cadena
Dirección de la entidad que requiere el servicio.
proveedorDeServicios
cadena
Dirección de la entidad que ofrece el servicio.
direccionPlataforma
cadena
Dirección de la entidad que posee el escrow
firmanteDeLiberacion
cadena
Dirección del usuario a cargo de liberar los fondos del escrow al proveedor del servicio.
resolutorDeDisputas
cadena
Dirección encargada de resolver disputas dentro del escrow.
receptor
cadena
Dirección a la que se enviarán los fondos del escrow
Trustline:
dirección
cadena
Dirección pública que establece permiso para aceptar y usar un token específico.
Inicializar Escrow
Entity that signs the transaction that deploys and initializes the escrow
GABC...XYZUnique identifier for the escrow
ENG12345Name of the escrow
Escrow TestText describing the function of the escrow
Escrow Test descriptionRoles that make up the escrow structure
Amount to be transferred upon completion of escrow milestones
1000Commission that the platform will receive when the escrow is completed
5Objectives to be completed to define the escrow as completed. (In this case it is not necessary to send the properties “approvedFlag” and “status” inside the objects of these milestones)
Information on the trustline that will manage the movement of funds in escrow
This endpoint returns an unsigned transaction in XDR format. This XDR is then used to sign the transaction using the “/helper/send-transaction” endpoint.
Bad request
Unauthorized access
Too Many Requests
Possible errors:
- Amount cannot be zero
- Escrow already initialized
- The platform fee cannot exceed 99%
- Escrow initialized without milestone
- Cannot define more than 50 milestones in an escrow
- All flags (approved, disputed, released) must be false in order to execute this function
- An unexpected error occurred
POST /deployer/single-release HTTP/1.1
Host:
Content-Type: application/json
Accept: */*
Content-Length: 586
{
"signer": "GAPPROVER1234567890...",
"engagementId": "ENG12345",
"title": "Project Title",
"description": "This is a detailed description of the project.",
"roles": {
"approver": "GAPPROVER1234567890...",
"serviceProvider": "GAPPROVER1234567890...",
"platformAddress": "GAPPROVER1234567890...",
"releaseSigner": "GAPPROVER1234567890...",
"disputeResolver": "GAPPROVER1234567890...",
"receiver": "GAPPROVER1234567890..."
},
"amount": 1000,
"platformFee": 50,
"milestones": [
{
"description": "Initial phase of the project"
},
{
"description": "Completion of design work"
}
],
"trusline": {
"address": "CBIELTK6YBZJU5UP2WWQ..."
}
}{
"status": "SUCCESS",
"unsignedTransaction": "AAAAAgAAAAAtWsgedQ...."
}
¿Qué devuelve este endpoint?
Este endpoint devuelve la transacción sin firmar para que la transacción pueda ser firmada por medio de la billetera del cliente.
Ejemplo de uso:
import axios from "axios";
const http = axios.create({
baseURL: "https://dev.api.trustlesswork.com",
timeout: 10000,
headers: {
"Content-Type": "application/json",
"x-api-key": your_api_key,
},
});
export const useExample = async () => {
// Obtener la dirección del firmante
const { address } = await kit.getAddress();
// Ejecutar el endpoint
const response = await http.post(
"/deployer/single-release",
{
// cuerpo solicitado para el endpoint
},
);
// Obtener el hash de la transacción sin firmar
const { unsignedTransaction } = response.data;
// Firmar la transacción con la billetera
const { signedTxXdr } = await signTransaction(unsignedTransaction, {
address,
networkPassphrase: WalletNetwork.TESTNET,
});
// Enviar la transacción a la Red Stellar
const tx = await http.post("/helper/send-transaction", {
signedXdr: signedTxXdr,
});
const { data } = tx;
return data;
}Última actualización
¿Te fue útil?