Set up trustline
To set up a trustline, make sure that a user instance is loaded into the library.
#
1. Request for establishing a trustlineTrustlines consist of bi-directional credit agreements. That means, that they have to be accepted by both parties. The first step to establish a trustline is therefore to create an initial request or proposal to the counterparty.
The initiator creates a request where he is willing to lend a maximal denomination of 100
to the user with the address counterpartyAddress
in the currency network with the address networkAddress
.
He also proposes that he is willing to owe a maximal denomination of 200
to the counterparty.
If the walletType
is ethers
, delegationFees
are undefined
.
#
2. Accepting a trustline requestIn the next step the counterparty has to accept the request. Note that in the example below the loaded user is the counterparty of step 1.
The counterparty of step 1 first fetches all trustline requests in the currency network. The prepareAccept
function is then called where the attributes given
and received
have to be from the point of view of the caller. So in our case the counterparty or receiver of the initial request.
NOTE: All numerical values have to be provided in their largest unit. For example, if the currency network has two decimals, the values have to be in a format like 1.25
.