Deploy
Implemente o contrato de caução e defina as propriedades da caução.
Cabeçalhos
Content-Type
application/json
x-api-key
<token>
Marco
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:
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:
endereco
string
Endereço público que estabelece permissão para aceitar e usar um 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...."
}
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?