Transactions#
Transactions are used to exchange resources between two inventories. This is initiated through the
TransactionRoute -> then handled by the TransactionProcessor.
Initiating a Transaction#
To initiate a transaction, a request is sent to the TransactionRoute API, specifying the following:
1{
2 "to": "uid",
3 "from": "uid",
4 "resources": [
5 {
6 "uid": "uid",
7 "personaUid": "uid",
8 "resourceUid": "uid",
9 "quantity": 1
10 }
11 ]
12}
The resources array specifies the PersonaResource objects being exchanged, each containing:
uid: Unique identifier of the specific resource.
personaUid: UID of the persona or user that owns the resource.
resourceUid: UID of the base resource type.
quantity: The amount to transfer, which must be a positive number unless the recipient is the central bank.
Transaction Approval#
Transactions are only processed when both the sender and recipient approve the request. Approval is managed
through the API by setting the approval.to and approval.from properties to true.
Bi-Directional Transactions#
Transactions can be bi-directional, allowing resources to be exchanged between two parties. The personaUid field
in the resources object identifies which persona is trading the resource.
For example, in a bi-directional trade:
The sender’s
resourcesarray would list the resources being offered.The recipient’s
resourcesarray (if applicable) would list the resources being offered in return.