DEX Class
Constructor
Instances of DEX
cannot be constructed manually. They are only accessible as a return value of SDK.init()
. Each instance of the DEX class represents a connection to a particular instance of the Portal DEX network for a particular user.
The DEX instance returned by SDK.init()
contains no assets. Before any trades are executed on that instance, assets must be transferred into it using DEX.xfer()
.
Instance Properties
Returns the assets and their quantities currently available. The elements of the Array are Objects with format: { asset: String, qty: Number }
.
Instance Methods
Transfers one or more assets into the receiver from the specified source. Instances of DEX initially contain no assets and this method must be called before any trades are executed.
DEX.xfer
()
returns an Array whose elements are Objects with format:
Performs a swap of the specified assets under the specified conditions. Returns an instance of the Trade class. Will throw an exception if there are any errors in the arguments - thus it is advisable to call this function in a try/catch block.
Close the connection to receiver. Returns true
if successful else false
.
Returns the instance of Trade with the specified order_id
or undefined
if no trade with that order_id
was executed on the receiver.
Last updated