-
Notifications
You must be signed in to change notification settings - Fork 570
Gateway Integration Requirements
This document will describe how an exchange can integrate their services to the Bitshares UI Reference Wallet in a simple and controlled manner. The exchange has to provide a few API calls, where this document will go through the requirements of these.
There are five API calls that are required.
Returns a JSON array containing all assets and backed assets.
For example, if the gateway exchange supports Bitcoin, lets call them DAC.xxx assets, it should include the following two entries.
object = {
coinType: "dac.btc"
walletName: null
name: "Exchange Backed BTC"
symbol: "DAC.BTC"
walletSymbol: "DAC.BTC"
walletType: null
transactionFee: "0"
precision: "100000000"
supportsOutputMemos: false
restricted: false
authorized: null
notAuthorizedReasons: null
backingCoinType: "btc"
gateFee: "0.000000"
intermediateAccount: "dac-dex"
coinPriora: 0
maintenanceReason: null
}
object = {
coinType: "btc"
walletName: "BTC"
name: "BTC"
symbol: "BTC"
walletSymbol: "BTC"
walletType: "btc"
transactionFee: "0"
precision: "100000000"
supportsOutputMemos: false
restricted: false
authorized: null
notAuthorizedReasons: null
backingCoinType: null
gateFee: "0.000900"
intermediateAccount: "dac-dex"
coinPriora: 0
maintenanceReason: ""
}
The second API call we require is a list of corresponding tradeable assets. This should also return one entry for the coin and the backing coin.
object = {
inputCoinType: "dac.btc"
outputCoinType: "btc"
rateFee: "0."
}
object = {
inputCoinType: "btc"
outputCoinType: "dac.btc"
rateFee: "0."
}
The third API call we require is a list of available coin wallets. This will make sure that only assets with a walletType
entry available in this list is enabled. This makes the gateway exchange disable wallets and make sure users can't deposit or withdraw assets during maintenance periods.
["btc","muse","incnt","esc","xdrac"]
The fourth API call required is an address validation
The address should be situated at the address of /wallets/<walletType>/address-validator?address=<address>
-
walletType
element is the walletType from the coins list. -
address
element is the supplied user address the UI required validation.
The response should return the following if the address is valid
isValid: true
The fifth API call required is an address generator
This address should be situated at the address of /simple-api/initiate-trade
and accept a POST query.
The POST query will be the following format
inputCoinType: html
outputAddress: userBitSharesAccountName
outputCoinType: open.html
The response should return a coin wallet address for the user to deposit to. If a memo should be used, this should be included as well.
{
"inputAddress": "HoRNZ6opWQ4P9vAADn3cufNWf3yDPQD8m3",
"inputMemo": null,
"inputCoinType": "html",
"outputAddress": "userBisSharesAccountName",
"outputCoinType": "open.html",
"refundAddress": null,
"comment": ""
}
This file contains the API call address.
Lets assume we wish to add a new exchange called "DAC".
export const dacAPIs = {
BASE: "https://api.dacexchange.info/api/v1",
COINS_LIST: "/coins",
ACTIVE_WALLETS: "/active-wallets",
TRADING_PAIRS: "/trading-pairs",
};
We then add it to the gateways.js file as the following
- Object name and
id
should always be the same and the same as the backed asset prepend name. -
name
can be the full name -
baseAPI
is the same as the const in apiConfig.js -
isEnabled
can be set to false to disable the gateway -
selected
is deprecated, and can be ignored -
options{}
is visual placeholders and will be changed on runtime.
DAC: {
id: "DAC",
name: "DAC Exchange Gateway",
baseAPI: dacAPIs,
isEnabled: true,
selected: false,
options: {
enabled: false,
selected: false
},
},