Deploy

Implemente o contrato de caução e defina as propriedades da caução.

Cabeçalhos

Nome
Valor

Content-Type

application/json

x-api-key

<token>

Marco

Nome
Tipo
Descrição

descrição

string

Texto descrevendo a função do marco

status

string (Valor padrão: "peding")

Status do marco. Ex: Aprovado, Em disputa, etc...

aprovado

booleano (Valor padrão: false)

Indicador que informa se um marco foi aprovado pelo aprovador

Funções:

Nome
Tipo
Descrição

aprovador

string

Endereço da entidade que requer o serviço.

prestadorDeServiço

string

Endereço da entidade que fornece o serviço.

enderecoDaPlataforma

string

Endereço da entidade que possui a conta escrow

assinadoDeLiberacao

string

Endereço do usuário responsável por liberar os fundos do escrow ao prestador de serviço.

resolvedorDeDisputa

string

Endereço responsável por resolver disputas dentro do escrow.

receptor

string

Endereço para onde os valores do escrow serão enviados

Trustline:

Nome
Tipo
Descrição

endereco

string

Endereço público que estabelece permissão para aceitar e usar um token específico.

Inicializar Escrow

post
Autorizações
Corpo
signerstringObrigatório

Entity that signs the transaction that deploys and initializes the escrow

Example: GABC...XYZ
engagementIdstringObrigatório

Unique identifier for the escrow

Example: ENG12345
titlestringObrigatório

Name of the escrow

Example: Escrow Test
descriptionstringObrigatório

Text describing the function of the escrow

Example: Escrow Test description
rolesobject[]Obrigatório

Roles that make up the escrow structure

amountnumberObrigatório

Amount to be transferred upon completion of escrow milestones

Example: 1000
platformFeenumberObrigatório

Commission that the platform will receive when the escrow is completed

Example: 5
milestonesobject[]Obrigatório

Objectives 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)

trustlineobject[]Obrigatório

Information on the trustline that will manage the movement of funds in escrow

Respostas
post
/deployer/single-release
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...."
}

O que este Endpoint retorna?

Este endpoint retorna a transação não assinada para que a transação possa ser assinada por meio da carteira do cliente.

Exemplo 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": sua_chave_api,
  },
});

export const useExample = async () => {
    // Obter o endereço do assinante
    const { address } = await kit.getAddress();

    // Executar o endpoint
    const response = await http.post(
      "/deployer/single-release",
      {
        // corpo solicitado para o endpoint
      },
    );
    
    // Obter o hash da transação não assinada
    const { unsignedTransaction } = response.data;

    // Assinar a transação pela carteira
    const { signedTxXdr } = await signTransaction(unsignedTransaction, {
      address,
      networkPassphrase: WalletNetwork.TESTNET,
    });

    // Enviar a transação para a Rede Stellar
    const tx = await http.post("/helper/send-transaction", {
      signedXdr: signedTxXdr,
    });

    const { data } = tx;

    return data; 
}

Atualizado

Isto foi útil?