Flows

Here you'll find the basic flow in order to use Trustless Work API.

Before you start:

A public and private address must be generated with this stellar resource:

Then stellar funds must be given to this address by placing the public key in this stellar resource:

USDC on testnet faucet Stellar testnet:

  1. To be able to interact with USDC from a stellar address you have to define the trustline. For this you can use this api endpoint:

Case 1:

Normal case where a escrow is created and the escrow are completed correctly:

  1. The escrow contract must be deployed, which in turn initializes the escrow with its metadata.

Among the information returned you will get the id of the contract you have just deployed, which you will need to enter to be able to use the other endpoints.

NOTE: This 50 percent that is being transferred goes directly to the balance of the deployed contract, not to the service provider. The escrow must then be funded so that the service provider can be assured of 50 percent of the escrow value.

  1. To do this, the following endpoint must be executed:

  1. The following endpoint must be executed in order to complete the escrow after mutual agreement:

With this step the other 50 percent of the escrow value will be transferred to the balance of the deployed contract.

  1. After the escrow is completed, the service provider may claim the proceeds of the escrow through this endpoint:

Case 2:

Case in which the contract is deployed and the escrow is initialized and funded but the service provider decides to cancel the escrow:

  1. The escrow contract must be deployed, which in turn initializes the escrow with its metadata.

Among the information returned you will get the id of the contract you have just deployed, which you will need to enter to be able to use the other endpoints.

NOTE: This 50 percent that is being transferred goes directly to the balance of the deployed contract, not to the service provider.

  1. The escrow must then be funded so that the service provider can be assured of 50 percent of the escrow value.

  1. Due to an external cause the service provider decided to cancel the escrow.

  1. The escrow owner (signer) will be able to refund to his account the 50 percent that he financed for the escrow due to the above mentioned situation.

IMPORTANT NOTE: All endpoints related to escrow management return the transaction unsigned. This is done by means of a string returned in XDR (External Data Representation) format, which is a format that stellar uses to encode transactions. This string is what you should use to sign the transaction with the wallet of your choice. After being signed it will return the transaction signed in the same way by means of a string in XDR format.

  1. This string is the one that must be sent to the next endpoint for the transaction to be sent to the Stellar network:

The only endpoints that do not require the previous step since they are signed and sent to the network directly when executed, are the following (mentioning them by the name they have in the documentation):

  1. Invoke Deployer Contract

  2. Get Escrow by Engagement ID

  3. Set Trustline

Last updated