diff --git a/package.json b/package.json index 95256bc..df3495e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "deversifi-api-docs", - "version": "0.0.9", + "version": "0.1.0", "private": true, "scripts": { "start": "parcel src/index.html", @@ -12,6 +12,8 @@ "dependencies": { "@babel/polyfill": "^7.8.3", "highlight-words-core": "^1.2.2", + "lodash": "^4.17.21", + "lodash.mapvalues": "^4.6.0", "lodash.merge": "^4.6.2", "prismjs": "^1.23.0", "react": "^16.12.0", diff --git a/src/spec/forEachEndpoint.js b/src/spec/forEachEndpoint.js index 3488dd0..7a0ab5b 100644 --- a/src/spec/forEachEndpoint.js +++ b/src/spec/forEachEndpoint.js @@ -1,6 +1,10 @@ export function forEachEndpoint(spec, cb) { for (const path in spec.paths) { - for (const method in spec.paths[path]) { + const methods = Object.keys(spec.paths[path]) + // TODO: Multiple methods per path was flaky + // hence the choice of taking the first vs. all + if (methods.length > 0) { + const method = methods[0] cb(spec.paths[path][method], path, method); } } diff --git a/src/spec/getBodyExample.js b/src/spec/getBodyExample.js index 11b20dc..db1d740 100644 --- a/src/spec/getBodyExample.js +++ b/src/spec/getBodyExample.js @@ -10,7 +10,7 @@ export function getExampleFromSchema(schema) { case 'number': return schema.example; case 'object': - return mapValues(schema.properties, getExampleFromSchema); + return schema.example || mapValues(schema.properties, getExampleFromSchema); } } diff --git a/src/spec/getEndpoints.js b/src/spec/getEndpoints.js index ba3e788..747d70f 100644 --- a/src/spec/getEndpoints.js +++ b/src/spec/getEndpoints.js @@ -1,3 +1,4 @@ +import mapValues from 'lodash.mapvalues' import {forEachEndpoint} from './forEachEndpoint'; import {getBodyExample} from './getBodyExample'; import {makeJsCode, makeWsJsCode} from './makeJsCode'; @@ -5,25 +6,30 @@ import {makePythonCode, makeWsPythonCode} from './makePythonCode'; import {makeCppCode, makeWsCppCode} from './mapeCppCode'; import {makeCurlCode} from './makeCurlCode'; import {makeWscatCode} from './makeWscatCode'; +import { getParamExample } from './getParamExample'; +import { sortBy } from 'lodash'; -export function getEndpoints(spec) { +export function getEndpoints(spec, categoriesToExclude) { const endpoints = []; forEachEndpoint(spec, (entry, orgPath, method) => { + if(!entry.tags) return; + const categoryName = entry.tags && entry.tags[0]; + if(categoriesToExclude.includes(categoryName.toLowerCase())) return; // workaround for unique ws socket endpoint const path = orgPath.replace(/{ws-uid-\d+}/g, ''); const responses = getResponses(entry); const calls = getCalls(spec, entry, path, method); const parameters = getParameters(entry); + const headers = getHeaders(entry); const body = getBodyExample(entry); const responsesDetails = getResponsesDetails(entry); const protocol = method === 'ws' ? 'wss' : 'https'; - const requestDetails = getRequestDetails(entry) const endpoint = { method: method.toUpperCase(), - title: entry.title, + title: entry.title || path, name: entry.operationId, link: '#' + entry.operationId, path: `${protocol}://${spec.host}${path}`, @@ -31,19 +37,12 @@ export function getEndpoints(spec) { calls, responses, parameters, + headers, body: body ? JSON.stringify(body, null, 4) : undefined, responsesDetails, requestDetails }; - if (method === 'ws') { - const wscat = makeWscatCode(spec, entry, path); - endpoint.wscat = wscat; - } else { - const curl = makeCurlCode(spec, entry, path, method); - endpoint.curl = curl; - } - endpoints.push(endpoint); }); return endpoints; @@ -51,11 +50,23 @@ export function getEndpoints(spec) { function getParameters(entry) { if (!entry.parameters) return; - return entry.parameters.filter(parameter => parameter.in !== 'body'); + return entry.parameters.filter(parameter => parameter.in !== 'body' && parameter.in !== 'header'); +} + +function getHeaders(entry) { + if (!entry.parameters) return; + return entry.parameters.filter(parameter => parameter.in === 'header'); } function getCalls(spec, entry, path, method) { return [ + { + language: 'bash', + name: method === 'ws' ? 'wscat' : 'cURL', + content: method === 'ws' + ? makeWscatCode(spec, entry, path) + : makeCurlCode(spec, entry, path, method) + }, { language: 'js', name: 'JavaScript', @@ -76,17 +87,52 @@ function getCalls(spec, entry, path, method) { content: method === 'ws' ? makeWsCppCode(spec, entry, path) : makeCppCode(spec, entry, path, method) - }, + } ]; } +function buildExample(schema) { + const schemaWideExample = getParamExample(schema) + if (schemaWideExample !== undefined) { + return schemaWideExample + } + if (schema.properties) { + return mapValues(schema.properties, prop => { + const propExample = getParamExample(prop) || buildExample(prop) + if (propExample === undefined) { + console.warn('Missing example in one of object properties', schema, prop) + throw new Error('Missing example in one of object properties', {schema, prop}) + } + return propExample + }) + } else if (schema.items) { + return [ buildExample(schema.items) ] + } + +} + function getResponses(entry) { const responses = []; - const hasDefault = Object.keys(entry.responses).includes('default'); + + if (!entry.responses) { + console.warn('No responses for entry', entry) + } + + const hasDefault = entry.responses.default && + entry.responses.default.schema for (const key in entry.responses) { const response = entry.responses[key]; + // Overlay let example = response.examples && response.examples['application/json']; + + // Examples directly from Joi + if (!example && response.schema) { + try { + example = buildExample(response.schema) + } catch (e) {} + } + example = example && JSON.stringify(example, null, 2); if (hasDefault && key === '200') { @@ -101,14 +147,15 @@ function getResponses(entry) { // TODO: details }); } - return responses; + return sortBy(responses, response => response.code !== 'default'); } function getResponsesDetails(entry) { - // TODO: currently docs don't support model $ref, - // all default responses are defined manually in overlay - - const hasDefault = Object.keys(entry.responses).includes('default'); + if (!entry.responses) { + console.warn('No responses for entry', entry) + } + const hasDefault = entry.responses.default && + entry.responses.default.schema; if (!hasDefault) { entry.responses.default = entry.responses['200']; diff --git a/src/spec/getExtraHeaders.js b/src/spec/getExtraHeaders.js new file mode 100644 index 0000000..8208142 --- /dev/null +++ b/src/spec/getExtraHeaders.js @@ -0,0 +1,15 @@ + + +// Extracts headers to be added in examples and code snippets +// In this case, we want to add authorization headers so example queries + +import { getParamExample } from './getParamExample' + +export function getExtraHeaders(headerParams = []) { + const extraHeaders = {} + headerParams.forEach(header => { + ['authorization'].includes(header.name) + extraHeaders[header.name] = getParamExample(header) + }) + return extraHeaders +} diff --git a/src/spec/getHeadersWithExtras.js b/src/spec/getHeadersWithExtras.js new file mode 100644 index 0000000..414186d --- /dev/null +++ b/src/spec/getHeadersWithExtras.js @@ -0,0 +1,9 @@ +import { getExtraHeaders } from './getExtraHeaders'; + +export function getHeadersWithExtras(extraHeaderParams) { + return { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + ...getExtraHeaders(extraHeaderParams) + } +} diff --git a/src/spec/getParamExample.js b/src/spec/getParamExample.js new file mode 100644 index 0000000..6acf3d0 --- /dev/null +++ b/src/spec/getParamExample.js @@ -0,0 +1,15 @@ + +export function getParamExample(params = {}) { + if (params.hasOwnProperty('example')) { + return params['example'] + } + if (params.hasOwnProperty('x-example')) { + return params['x-example'] + } + if (params.hasOwnProperty('default')) { + return params.default + } + if (params.enum && params.enum.length > 0) { + return params.enum[0] + } +} diff --git a/src/spec/getSidebar.js b/src/spec/getSidebar.js index 6fbf9a4..76475f3 100644 --- a/src/spec/getSidebar.js +++ b/src/spec/getSidebar.js @@ -1,16 +1,40 @@ import {forEachEndpoint} from './forEachEndpoint'; -export function getSidebar(spec) { + +var categoriesOrder = [ + 'platform', + 'wallet', + 'trading', + 'amm', + 'market', + 'governance', + 'dlm', + 'account', + 'public', + 'integration' +]; + +const getCategoryWeight = (category) => { + return categoriesOrder.length - categoriesOrder.indexOf(category.name.toLowerCase()) +}; + +export function getSidebar(spec, categoriesToExclude) { const categories = new Map(); - forEachEndpoint(spec, (entry) => { + forEachEndpoint(spec, (entry, orgPath, method) => { + if(!entry.tags) return; const categoryName = entry.tags && entry.tags[0]; const category = categories.get(categoryName) || {name: categoryName, items: []}; category.items.push({ - title: entry.title, + title: + entry.title || // From swagger overlay JSON when entered manually + entry.description || // From 'notes' field of dvf-pub-api route options if exists + `${method.toUpperCase()} ${orgPath}`, // GET/POST by default name: entry.operationId, link: '#' + entry.operationId, }); categories.set(categoryName, category); }); - return [...categories.values()]; + return [...categories.values()] + .filter(category => !categoriesToExclude.includes(category.name.toLowerCase())) + .sort((categoryA, categoryB) => getCategoryWeight(categoryB) - getCategoryWeight(categoryA)) } diff --git a/src/spec/index.js b/src/spec/index.js index 6697450..a2a8deb 100644 --- a/src/spec/index.js +++ b/src/spec/index.js @@ -1,26 +1,35 @@ -import swaggerData from './swagger-v11--submitted.json'; import swaggerMarketData from './swagger-market-data.json'; import swaggerOverlay from './swagger-overlay.json'; import {preprocess} from './preprocess'; import merge from 'lodash.merge'; +import request from 'request'; + +// Swagger URL to be fetched from prod +const swaggerJsonUrl = process.env.SWAGGER_URL || 'https://api.deversifi.com/v1/trading/docs/swagger.json' +// But endpoints to be reached on staging for "Try Endpoint" buttons +const endpointsHost = process.env.ENDPOINTS_HOST || 'api.stg.deversifi.com' const parseRefs = (properties, definitions) => { Object.keys(properties).forEach(propKey => { // if sub param is object check its subtree if (properties[propKey].type === 'object' && properties[propKey].properties) { parseRefs(properties[propKey].properties, definitions) + } else if (properties[propKey].type === 'array') { + parseRefs(properties[propKey], definitions) // if has $ref, replace with definition } else if (properties[propKey].$ref) { - properties[propKey] = definitions[properties[propKey].$ref.replace('#/definitions/', '')] + const definitionKey = properties[propKey].$ref.replace('#/definitions/', '') + properties[propKey] = definitions[definitionKey] // also parse definition if it has subtrees - parseRefs(properties[propKey]) + parseRefs(properties[propKey], definitions) } }) } const conciliation = data => { const {paths, definitions} = data; + parseRefs(definitions, definitions) Object.keys(paths).forEach(pathKey => { Object.keys(paths[pathKey]).forEach(methodKey => { const item = paths[pathKey][methodKey] || {}; @@ -31,12 +40,16 @@ const conciliation = data => { parameters.forEach(param => { if (param.schema && param.schema.$ref) { param.schema = definitions[param.schema.$ref.replace('#/definitions/', '')]; - parseRefs(param.schema.properties, definitions) } }); Object.keys(responses).forEach(responseKey => { + const response = responses[responseKey] + if (!response) { + console.warn(`Ignoring key ${responseKey} for responses because it is empty`) + return + } const {schema} = responses[responseKey]; if (schema && schema.$ref) { responses[responseKey].schema = definitions[schema.$ref.replace('#/definitions/', '')]; @@ -48,8 +61,21 @@ const conciliation = data => { return data; }; -export function loadSpec() { - const spec = conciliation(swaggerData); - const fullSpec = merge(spec, swaggerMarketData, swaggerOverlay); - return preprocess(fullSpec); +export function loadSpecAsync() { + return new Promise((resolve, reject) => { + return request(swaggerJsonUrl, function (error, response, body) { + if (error) { + return reject(error); + } + const fetchedSwaggerData = JSON.parse(body); + const swaggerDataToUse = { + ...fetchedSwaggerData, + host: endpointsHost, + schemes: ['https'] + }; + const spec = conciliation(swaggerDataToUse); + const fullSpec = merge(spec, swaggerMarketData, swaggerOverlay); + return resolve(preprocess(fullSpec)); + }); + }); } diff --git a/src/spec/makeCurlCode.js b/src/spec/makeCurlCode.js index 3a7da19..7ff1085 100644 --- a/src/spec/makeCurlCode.js +++ b/src/spec/makeCurlCode.js @@ -1,13 +1,19 @@ import {getBodyExample} from './getBodyExample'; +import { getExtraHeaders } from './getExtraHeaders'; +import { getHeadersWithExtras } from './getHeadersWithExtras'; export function makeCurlCode(spec, entry, path, method) { let url = `https://${spec.host}${path}`; - for (const variable of (entry.parameters || [])) { + + const parameters = entry.parameters || [] + for (const variable of parameters) { if (variable.in === 'path') { const value = variable['x-example'] ? variable['x-example'] : '???'; url = url.replace(`{${variable.name}}`, value); } } + + const headers = getHeadersWithExtras(parameters.filter(variable => variable.in === 'header')) const queryParams = (entry.parameters || []) .filter(x => x.in === 'query' && x['x-example']) .map(x => `${x.name}=${x['x-example']}`) @@ -17,12 +23,11 @@ export function makeCurlCode(spec, entry, path, method) { } let code = `curl \\ -X ${method.toUpperCase()} \\ - -H "Accept: application/json" \\ - -H "Content-Type: application/json" \\\n`; + ${Object.entries(headers).map(([key, value]) => `-H "${key}: ${value}"`).join(` \\\n `)} \\\n`; const body = getBodyExample(entry); if (body) { code += ` -d '${JSON.stringify(body).replace(/'/g, '\\\'')}' \\\n`; } - code += ` ${url}`; + code += ` "${url}"`; return code; } diff --git a/src/spec/makeJsCode.js b/src/spec/makeJsCode.js index d4e659a..9d9df87 100644 --- a/src/spec/makeJsCode.js +++ b/src/spec/makeJsCode.js @@ -1,4 +1,5 @@ import {getExampleFromSchema} from './getBodyExample'; +import { getHeadersWithExtras } from './getHeadersWithExtras'; export function makeJsCode(spec, entry, path, method) { const queryLine = getQueryLine(entry.parameters); @@ -10,7 +11,7 @@ export function makeJsCode(spec, entry, path, method) { ' const response = await fetch(url, {\n' + getMethod(method) + getBody(entry.parameters) + - getHeaders() + + getHeaders(entry.parameters) + ' });\n' + ' return response.json();\n' + '}' @@ -119,11 +120,13 @@ export function getWsSubscribeParams(parameters, operationId) { return subParams; } -function getHeaders() { +function getHeaders(parameters = []) { return ( ' headers: {\n' + - ' "Accept": "application/json",\n' + - ' "Content-Type": "application/json",\n' + + Object.entries( + getHeadersWithExtras(parameters.filter(parameter => parameter.in === 'header')) + ).map(([key, value]) => ` "${key}": "${value}"`) + .join(',\n') + '\n' + ' },\n' ); } diff --git a/src/spec/makePythonCode.js b/src/spec/makePythonCode.js index b467ceb..d950856 100644 --- a/src/spec/makePythonCode.js +++ b/src/spec/makePythonCode.js @@ -1,4 +1,5 @@ import {getExampleFromSchema} from './getBodyExample'; +import { getHeadersWithExtras } from './getHeadersWithExtras'; import {getWsSubscribeParams} from './makeJsCode'; export function makePythonCode(spec, entry, path, method) { @@ -7,7 +8,7 @@ export function makePythonCode(spec, entry, path, method) { 'import requests\n' + 'import json\n' + '\n' + - getHeaders() + + getHeaders(entry.parameters) + getParams(entry.parameters) + getUrlLine(spec.host, path) + queryLine + @@ -24,7 +25,7 @@ export function makePythonCode(spec, entry, path, method) { } export function makeWsPythonCode(spec, entry, path) { - const url = `'wss://${spec.host}/${path}'`; + const url = `'wss://${spec.host}${path}'`; const subParams = getWsSubscribeParams(entry.parameters, entry.operationId); return ( `ws = websocket.WebSocketApp(${url})\n` + @@ -80,11 +81,13 @@ function getBody(parameters) { : ''; } -function getHeaders() { +function getHeaders(parameters = []) { return ( 'headers = {\n' + - ' "Accept": "application/json",\n' + - ' "Content-Type": "application/json",\n' + + Object.entries( + getHeadersWithExtras(parameters.filter(parameter => parameter.in === 'header')) + ).map(([key, value]) => ` "${key}": "${value}"`) + .join(',\n') + '\n' + '}\n\n' ); } diff --git a/src/spec/makeWscatCode.js b/src/spec/makeWscatCode.js index bfb1ffb..af51156 100644 --- a/src/spec/makeWscatCode.js +++ b/src/spec/makeWscatCode.js @@ -1,11 +1,10 @@ import {getWsSubscribeParams} from './makeJsCode'; export function makeWscatCode(spec, entry, path) { - const url = `'wss://${spec.host}/${path}'`; + const url = `'wss://${spec.host}${path}'`; const subParams = getWsSubscribeParams(entry.parameters, entry.operationId); const code = `wscat -c ${url} - < {"event":"info","version":2,"serverId":"11111111-1111-1111-1111-111111111111","platform":{"status":1}} - > {${subParams.map((p) => `${p.name}:${p.value}`)}}`; + {${subParams.map((p) => `${p.name}:${p.value}`)}}`; return code; } diff --git a/src/spec/mapeCppCode.js b/src/spec/mapeCppCode.js index f3fe782..f8e585a 100644 --- a/src/spec/mapeCppCode.js +++ b/src/spec/mapeCppCode.js @@ -1,8 +1,10 @@ import {getExampleFromSchema} from './getBodyExample'; +import { getHeadersWithExtras } from './getHeadersWithExtras'; import {getWsSubscribeParams} from './makeJsCode'; export function makeCppCode(spec, entry, path, method) { - const variableInit = (entry.parameters || []) + const parameters = (entry.parameters || []) + const variableInit = parameters .filter(variable => variable.in === 'path' || variable.in === 'query') .map(variable => `std::string param_${variable.name} = ${JSON.stringify(variable['x-example'])};`); @@ -15,6 +17,9 @@ export function makeCppCode(spec, entry, path, method) { ?.join('&'); const queryStringCode = queryString ? `url += "?${queryString}";\n` : ''; + const headersCode = Object.entries(getHeadersWithExtras(parameters)) + .map(([key, value]) => `headers.push_back("${key}: ${value}");`) + .join('\n') const bodyParam = entry.parameters?.find(x => x.in === 'body'); const bodyParamCode = bodyParam ? `std::string body = "${escapeString(JSON.stringify(getExampleFromSchema(bodyParam.schema)))}";` : ''; const bodyOpts = bodyParam ? ` @@ -30,7 +35,11 @@ ${queryStringCode} curlpp::Easy request; std::ostringstream response; +std::list headers; +${headersCode} + // set the request options +request.setOpt(new curlpp::options::HttpHeader(headers)); request.setOpt(new curlpp::options::Url(url)); request.setOpt(new curlpp::options::WriteStream(&response)); ${bodyOpts} @@ -44,7 +53,7 @@ std::cout << response.str() << std::endl; } export function makeWsCppCode(spec, entry, path) { - const url = `wss://${spec.host}/${path}`; + const url = `wss://${spec.host}${path}`; const subParams = getWsSubscribeParams(entry.parameters, entry.operationId); return `// Required on Windows ix::initNetSystem(); diff --git a/src/spec/preprocess.js b/src/spec/preprocess.js index 14fdb2c..a784db7 100644 --- a/src/spec/preprocess.js +++ b/src/spec/preprocess.js @@ -2,8 +2,13 @@ import {getSidebar} from './getSidebar'; import {getEndpoints} from './getEndpoints'; export function preprocess(spec) { + var categoriesToExclude = [ + 'internal', // Here to stay but for internal use + 'deprecated', // Is meant to disapear in the future / not to be used anymore + 'hidden' // Hidden for other reasons (ex: feature not released yet) + ]; return { - sidebar: getSidebar(spec), - endpoints: getEndpoints(spec), + sidebar: getSidebar(spec, categoriesToExclude), + endpoints: getEndpoints(spec, categoriesToExclude), }; } diff --git a/src/spec/swagger-overlay.json b/src/spec/swagger-overlay.json index 261c512..d86eb09 100644 --- a/src/spec/swagger-overlay.json +++ b/src/spec/swagger-overlay.json @@ -196,7 +196,7 @@ "type":"string", "required":false, "description":"The end date and time (Unix timestamp in milliseconds) for which the trade volumes are requested. If startDate and endDate are not provided, it returns the volume ranking if all time.", - "x-example":1577923200000 + "x-example":1747384800000 } ], "tags":[ @@ -262,7 +262,7 @@ "type":"string", "required":false, "description":"The end date and time (Unix timestamp in milliseconds) for which events are requested.If startDate and endDate are not provided, it returns the volume ranking if all time.", - "x-example":1577923200000 + "x-example":1747384800000 } ], "tags":[ @@ -304,52 +304,7 @@ } } }, - "/v1/trading/r/feeRate": { - "get": { - "title":"Get Fee Rate", - "summary": "Return current fee rate for a given address. This rate is dependent on the trading volume of the user.", - "operationId": "getV1TradingRFeerate", - "parameters": [ - { - "type": "string", - "description": "This nonce which used to provide the time until which this nonce is valid. It is presented as seconds since epoch.", - "name": "nonce", - "in": "query", - "required": true, - "x-example": "1579901055.575" - }, - { - "type": "string", - "description": "The signature obtained by signing the nonce with your private ethereum key.", - "name": "signature", - "in": "query", - "required": true, - "x-example": "0x494a2c166f95518dcf5a9484fcb702a454382f281f96ba41639fe3a2af279fdc1e3b4e5aa2f585a9a40fb5aaabf10b5390ed5592d502c7799a261f81219491f001" - }, - { - "type": "string", - "name": "token", - "in": "query", - "x-example": "ETH" - } - ], - "tags": ["Trading"], - "responses": { - "default": { - "examples": { - "application/json": { - "address": "0x116f494a2ce567067f319fea1c9f294f23d2fe68", - "timestamp": 1590263332427, - "fees": { - "maker": 15, - "taker": 20 - } - } - } - } - } - } - }, + "/v1/trading/r/30DaysVolume": { "get":{ "title":"User 30-day volume", @@ -362,7 +317,7 @@ "name": "nonce", "in": "query", "required": true, - "x-example": "1579901055.575" + "x-example": "v2-1704114061.000" }, { "type": "string", @@ -370,7 +325,7 @@ "name": "signature", "in": "query", "required": true, - "x-example": "0x494a2c166f95518dcf5a9484fcb702a454382f281f96ba41639fe3a2af279fdc1e3b4e5aa2f585a9a40fb5aaabf10b5390ed5592d502c7799a261f81219491f001" + "x-example": "0x2b48d53f2e3a696630ebdcd1ff057556bbc9de9c294adfaa5b1f13df91b67b347fdd88c29594c377ba0024dec40cd9808829e7f4447772482f50a7a8e9a903561c" } ], "tags":[ @@ -440,7 +395,7 @@ "name": "nonce", "in": "query", "required": true, - "x-example": "1579901055.575" + "x-example": "v2-1704114061.000" }, { "type": "string", @@ -448,7 +403,7 @@ "name": "signature", "in": "query", "required": true, - "x-example": "0x494a2c166f95518dcf5a9484fcb702a454382f281f96ba41639fe3a2af279fdc1e3b4e5aa2f585a9a40fb5aaabf10b5390ed5592d502c7799a261f81219491f001" + "x-example": "0x2b48d53f2e3a696630ebdcd1ff057556bbc9de9c294adfaa5b1f13df91b67b347fdd88c29594c377ba0024dec40cd9808829e7f4447772482f50a7a8e9a903561c" } ], "tags":[ @@ -561,62 +516,6 @@ } } }, - "/v1/trading/r/getConf":{ - "post":{ - "title":"Get Config", - "responses":{ - "default":{ - "examples":{ - "application/json":{ - "DVF": { - "defaultFeeRate": 0.002, - "deversifiAddress": "0x9ab450355b4ab504cbc0e4de484781dac08e6a26", - "starkExContractAddress": "0x94E84779D79E34b9166C850c3123d42C273F8843", - "exchangeSymbols": [ - "tETHUSD", - "tZRXUSD", - "tZRXETH", - "tBTCUSD" - ], - "tempStarkVaultId": 1 - }, - "tokenRegistry": { - "ETH": { - "decimals": 18, - "quantization": 10000000000, - "minOrderSize": 0.05, - "starkTokenId": "0xb333e3142fe16b78628f19bb15afddaef437e72d6d7f5c6c20c6801a27fba6" - }, - "USDT": { - "decimals": 6, - "quantization": 1, - "minOrderSize": 10, - "settleSpread": 0, - "starkTokenId": "0x180bef8ae3462e919489763b84dc1dc700c45a249dec4d1136814a639f2dd7b", - "tokenAddress": "0x4c5f66596197a86fb30a2435e2ef4ddcb39342c9" - }, - "ZRX": { - "decimals": 18, - "quantization": 10000000000, - "minOrderSize": 20, - "starkTokenId": "0x3901ee6a6c5ac0f6e284f4273b961b7e9f29d25367d31d90b75820473a202f7", - "tokenAddress": "0xcd077abedd831a3443ffbe24fb76661bbb17eb69" - }, - "BTC": { - "decimals": 18, - "quantization": 10000000000, - "minOrderSize": 0.0004, - "starkTokenId": "0x21ef21d6b234cd669edd702dd3d1d017be888337010b950ae3679eb4194b4bc", - "tokenAddress": "0x40d8978500bf68324a51533cd6a21e3e59be324a" - } - } - } - - } - } - } - } - }, "/v1/trading/r/getDeposits":{ "post":{ "title":"Deposit History", @@ -642,29 +541,6 @@ } } }, - "/v1/trading/r/getOrder":{ - "post":{ - "title":"Order", - "responses":{ - "default":{ - "examples":{ - "application/json":[ - { - "_id": "HrPujXPVQBY", - "symbol": "ETH:USDT", - "amount": -0.3, - "price": 280, - "totalFilled": 0, - "pending": false, - "canceled": false, - "active": true - } - ] - } - } - } - } - }, "/v1/trading/r/getPendingWithdrawals":{ "post":{ "title":"Pending Withdrawals", @@ -763,7 +639,7 @@ "isRegistered":true, "ethAddress":"0x341e46a49f15785373ede443df0220dea6a41bbc" } - + } } } @@ -771,14 +647,7 @@ }, "/v1/trading/r/getVaultId":{ "post":{ - "title":"Get Vault Id", - "responses":{ - "default":{ - "examples":{ - "application/json":1851736 - } - } - } + "title":"Get Vault Id" } }, "/v1/trading/w/withdraw":{ @@ -814,607 +683,30 @@ } } }, - "/v1/trading/r/getWithdrawal":{ - "post":{ - "title":"Get Withdrawal", - "responses":{ - "default":{ - "examples":{ - "application/json":[ - { - "_id":"53cb6b9b4f4ddef1ad47f943", - "ethAddress":"0x14d06788090769f669427b6aea1c0240d2321f34", - "starkKey":"77a3b314db07c45076d11f62b6f9e748a39790441823307743cf00d6597ea43", - "token":"USDT", - "amount":1000, - "createdAt":"2020-01-29T14:13:05.898Z" - } - ] - } - } - } - } - }, - "/v1/trading/r/openOrders":{ - "post":{ - "title":"All Orders", - "responses":{ - "default":{ - "examples":{ - "application/json":[ - { - "_id": "L1tarX5wUem", - "user": "0xc1caf2d76c49e4a60635635c329a3ac22ddeb547", - "symbol": "ETH:USDT", - "amount": -0.3, - "totalFilled": -0.2, - "price": 200, - "averagePrice": 199.20, - "feeRate": "0.002", - "tokenBuy": "USDT", - "totalBought": "4990000000", - "tokenSell": "ETH", - "totalSold": "45555500", - "active": true, - "type": "EXCHANGE LIMIT", - "createdAt": "2020-05-09T18:29:56.882Z", - "updatedAt": "2020-05-09T18:29:56.893Z", - "activatedAt": "2020-05-09T18:29:56.893Z" - }, - { - "_id": "L1tarX5wUem", - "user": "0xc1caf2d76c49e4a60635635c329a3ac22ddeb547", - "symbol": "BTC:USDT", - "amount": -0.03, - "totalFilled": -0.01, - "price": 8000, - "averagePrice": 7950, - "feeRate": "0.002", - "tokenBuy": "USDT", - "totalBought": "2400000000", - "tokenSell": "BTC", - "totalSold": "30000000", - "active": true, - "type": "EXCHANGE LIMIT", - "createdAt": "2020-05-09T18:29:56.882Z", - "updatedAt": "2020-05-09T18:29:56.893Z", - "activatedAt": "2020-05-09T18:29:56.893Z" - } - ] - } - } - } - } - }, - "/v1/trading/r/orderHistory":{ - "post":{ - "title":"Order History", - "responses":{ - "default":{ - "examples":{ - "application/json":[ - { - "_id": "L1tarX5wUem", - "user": "0xc1caf2d76c49e4a60635635c329a3ac22ddeb547", - "symbol": "ETH:USDT", - "amount": -0.3, - "totalFilled": -0.2, - "price": 200, - "averagePrice": 199.20, - "feeRate": "0.002", - "tokenBuy": "USDT", - "totalBought": "4990000000", - "tokenSell": "ETH", - "totalSold": "45555500", - "active": true, - "type": "EXCHANGE LIMIT", - "createdAt": "2020-05-09T18:29:56.882Z", - "updatedAt": "2020-05-09T18:29:56.893Z", - "activatedAt": "2020-05-09T18:29:56.893Z" - }, - { - "_id": "L1tarX5wUem", - "user": "0xc1caf2d76c49e4a60635635c329a3ac22ddeb547", - "symbol": "BTC:USDT", - "amount": -0.03, - "totalFilled": -0.01, - "price": 8000, - "averagePrice": 7950, - "feeRate": "0.002", - "tokenBuy": "USDT", - "totalBought": "2400000000", - "tokenSell": "BTC", - "totalSold": "30000000", - "active": true, - "type": "EXCHANGE LIMIT", - "createdAt": "2020-05-09T18:29:56.882Z", - "updatedAt": "2020-05-09T18:29:56.893Z", - "activatedAt": "2020-05-09T18:29:56.893Z" - }, - { - "_id": "L1tarX5wUem", - "user": "0xc1caf2d76c49e4a60635635c329a3ac22ddeb547", - "symbol": "BTC:USDT", - "amount": -0.03, - "totalFilled": -0.01, - "price": 8000, - "averagePrice": 7950, - "feeRate": "0.002", - "tokenBuy": "USDT", - "totalBought": "2400000000", - "tokenSell": "BTC", - "totalSold": "30000000", - "active": true, - "type": "EXCHANGE LIMIT", - "createdAt": "2020-05-09T18:29:56.882Z", - "updatedAt": "2020-05-09T18:29:56.893Z", - "activatedAt": "2020-05-09T18:29:56.893Z" - } - ] - } - } - } - } - }, "/v1/trading/r/withdrawHistory":{ "post":{ - "title":"Withdrawal History", - "responses":{ - "default":{ - "examples":{ - "application/json":[ - { - "_id":"5e318fc4948cc789bb5f7bb4", - "token":"ETH", - "amount":100, - "createdAt":"2020-01-29T14:13:05.898Z", - "readyToWithdrawOnChain": false - }, - { - "_id":"5e318fc4948cc789bb5f7bb5", - "token":"USD", - "amount":27, - "createdAt":"2020-01-30T14:13:05.898Z", - "readyToWithdrawOnChain": true - } - ] - } - } - } + "title":"Withdrawal History" } }, "/v1/trading/w/cancelOrder":{ "post":{ - "title":"Cancel Order", - "responses":{ - "default":{ - "examples":{ - "application/json":{ - "orderId":"d7c8b9" - } - } - }, - "Server Error": { - "examples": { - "application/json":{ - "statusCode": 502, - "error": "Unable to determine the status of order cancellation request" - } - } - } - } + "title":"Cancel Order" } }, "/v1/trading/w/cancelWithdrawal":{ "post":{ - "title":"Cancel Withdrawal", - "responses":{ - "default":{ - "examples":{ - "application/json":{ - "_id": "LCafcGC6tBH", - "token": "USDT", - "amount": "100", - "createdAt": "2020-01-01T22:57:47.323Z", - "readyToWithdrawOnChain": false, - "canceled": true - } - } - }, - "withdrawal not found": { - "examples": { - "application/json":{ - "statusCode": 422, - "error": "WITHDRAWAL_NOT_FOUND", - "message": "WITHDRAWAL_NOT_FOUND", - "type": "DVFError" - } - } - } - } - } - }, - "/v1/trading/w/deposit":{ - "post":{ - "title":"New Deposit", - "operationId": "postV1TradingWDeposit", - "responses":{ - "default":{ - "examples":{ - "application/json":{ - "pending": true, - "user": "0x52d92399dfb73df49383614170880ba09b66338e", - "token": "ETH", - "amount": "1020400", - "meta": { - "ethAddress": "0x52d92399dfb73df49383614170880ba09b66338e", - "starkKey": "00e0326547480bc8bf0fb143f08d23d3ff85aa450e6253bb721dee1410a83b73", - "starkVaultId": 1937164364, - "starkTokenId": "0xb333e3142fe16b78628f19bb15afddaef437e72d6d7f5c6c20c6801a27fba6", - "expireTime": 442425, - "starkMessage": "598f0f08033ca8bf16552d460b2510715c689d630ef5480d50c17ada5541821", - "starkSignature": { - "r": "5a00d9ebdfac03fdbe55f393b34fd252447cdee79179c8c0a5227b2fe2e577", - "s": "58e2d3972f1d482b26440197b518bb0bdeb50d03750e731118bafe3a819989d", - "recoveryParam": 1 - }, - "nonce": 162543006 - }, - "_id": "FyqJSSXFXPU", - "createdAt": "2020-05-22T09:43:36.348Z", - "updatedAt": "2020-05-22T09:43:36.348Z" - } - } - } - } + "title":"Cancel Withdrawal" } }, + "/v1/trading/w/register":{ "post":{ - "title":"Register", - "responses":{ - "default":{ - "examples":{ - "application/json":{ - "DVF":{ - "depositExpiry":720, - "depositNonce":1, - "deversifiAddress":"0x9ab450355b4ab504cbc0e4de484781dac08e6a26", - "starkExContractAddress":"0xF3731d0cdC9834f6F32104580bD226EF1bc1A9F9", - "exchangeSymbols":[ - "tETHUSD", - "tZRXUSD", - "tZRXETH" - ], - "tempStarkVaultId":1 - }, - "tokenRegistry":{ - "ETH":{ - "decimals":18, - "minOrderSize":0.1, - "starkTokenId":"0x1" - }, - "USD":{ - "decimals":6, - "minOrderSize":25, - "settleSpread":-0.026, - "starkTokenId":"0x2", - "tokenAddress":"0xdac17f958d2ee523a2206206994597c13d831ec7" - }, - "ZRX":{ - "decimals":18, - "minOrderSize":40, - "starkTokenId":"22e6d888f32dea3c6e8ba64609a314eebbe1eb704e9e9febe368b0bacb21efe", - "tokenAddress":"0xe41d2489571d322189246dafa5ebde1f4699f498" - } - }, - "isRegistered":true, - "ethAddress":"0x341e46a49f15785373ede443df0220dea6a41bbc" - } - } - } - } + "title":"Register" } }, "/v1/trading/w/submitOrder": { "post": { - "title": "Submit Order", - "summary": "This authenticated endpoint is used to submit an order.", - "operationId": "postV1TradingWSubmitorder", - "parameters": [ - { - "in": "body", - "name": "body", - "schema": { - "$ref": "#/definitions/submitOrderPayload" - } - } - ], - "tags": ["Trading"], - "responses": { - "default": { - "examples": { - "application/json":{ - "pending": true, - "_id": "", - "user": "0xc2fff68dbdb8c0dcceb2b84a921cc2c8004104fa", - "symbol": "ZRX:ETH", - "amount": 50, - "type": "EXCHANGE LIMIT", - "price": 0.005, - "feeRate": 0.002, - "partnerId": "P1", - "meta": { - "ethAddress": "0xc2fff68dbdb8c0dcceb2b84a921cc2c8004104fa", - "starkPublicKey": { - "x": "07fc758ce6d8591c46b34c4c94f37c81f9a2763cf7b4abce7779bfeea582a754", - "y": "12e340b350a82322bae0106b952d5b9a3a80265dfa4228acb8c4e309bacd826" - }, - "starkOrder": { - "vaultIdSell": 1845686579, - "vaultIdBuy": 1671627635, - "amountSell": "25000000", - "amountBuy": "4990000000", - "tokenSell": "0xb333e3142fe16b78628f19bb15afddaef437e72d6d7f5c6c20c6801a27fba6", - "tokenBuy": "0x3901ee6a6c5ac0f6e284f4273b961b7e9f29d25367d31d90b75820473a202f7", - "nonce": 143600912, - "expirationTimestamp": 442384 - }, - "starkMessage": "6157ce5d1df3572f43cfae5742454988218e4106797f0fcbe820a984215803e", - "starkSignature": { - "r": "34fbf0f9eab6b26388e96abfaa9903c257e64f268ab0a3246ac2bcbfc3f5154", - "s": "4836111bf1cb0683b6145ebf667ec01030d7e25d3832f28fadb0dfcd9522b43", - "recoveryParam": 0 - } - }, - "tokenSell": "ETH", - "tokenSellLockedBalance": "25000000", - "tokenBuy": "ZRX", - "createdAt": "2020-05-20T16:24:36.452Z", - "updatedAt": "2020-05-20T16:24:36.452Z" - } - } - }, - "Server Error": { - "examples": { - "application/json": { - "statusCode": 502, - "error": "Unable to determine the status of order submission request" - } - } - } - } - } - }, - "/v1/trading/r/getGasPrice": { - "get": { - "title": "Get Gas Price", - "responses": { - "default": { - "examples": { - "application/json": { - "fast": 70000000000, - "fastWait": 0.5, - "average": 67000000000, - "averageWait": 1.4, - "cheap": 66000000000, - "cheapWait": 10.5 - } - } - } - } - } - }, - "/v1/trading/r/trades/{Symbol}": { - "get": { - "title": "Trades History", - "operationId":"getV1TradingRTrades", - "parameters":[ - { - "in":"path", - "name":"Symbol", - "type":"string", - "required":true, - "description":"The market trading pair in rhinofi format i.e BASE:QUOTE", - "x-example":"ETH:USDT" - } - ], - "tags":[ - "Market" - ], - "responses":{ - "default":{ - "examples":{ - "application/json":[ - { - "trade_id":1, - "price":275.23, - "base_volume":1.5, - "quote_volume":347.81, - "timestamp": 1527836800000, - "type": "buy" - }, - { - "trade_id":2, - "price":183.5, - "base_volume":1.8, - "quote_volume":381.28, - "timestamp": 1577923200000, - "type": "buy" - } - ] - } - } - } - } - }, - "/v1/trading/r/tradesSince/{Symbol}/{StartDate}/{Limit}": { - "get": { - "title": "Trades Since Date History", - "operationId":"getV1TradingRTradessince", - "parameters":[ - { - "in":"path", - "name":"Symbol", - "type":"string", - "required":true, - "description":"The market trading pair in rhinofi format i.e BASE:QUOTE", - "x-example":"ETH:USDT" - }, - { - "in":"path", - "name":"StartDate", - "type":"number", - "description":"Date of the last trade returned.", - "x-example":1547384800 - }, - { - "in":"path", - "name":"Limit", - "type":"number", - "required":false, - "description":"Limit of trades that will be returned. With a maximum limit of 1000.", - "x-example":60 - } - ], - "tags":[ - "Market" - ], - "responses":{ - "default":{ - "examples":{ - "application/json":[ - { - "trade_id":1, - "price":275.23, - "base_volume":1.5, - "quote_volume":347.81, - "timestamp": 1548028800, - "type": "buy" - }, - { - "trade_id":2, - "price":183.5, - "base_volume":1.8, - "quote_volume":381.28, - "timestamp": 1558396800, - "type": "buy" - } - ] - } - } - } - } - }, - "/v1/trading/r/getBalanceForUser/{userEthAddress}": { - "post": { - "title": "Get User Balances", - "summary": "This is used to retrieve the total and active balances of a user per token. Active balance is the balance that is currently available. Total balance (specified as balance) is the sum of all the balances including those locked for trading.", - "operationId": "postV1TradingRGetbalanceforuserUserethaddress", - "parameters": [ - { - "type": "string", - "description": "The ETH address of a potential user", - "name": "userEthAddress", - "in": "path", - "required": true - }, - { - "in": "body", - "name": "body", - "schema": { - "type": "object", - "properties": { - "token": { - "type": "string", - "description": "The token which the balance is specifically requested for.", - "example": "ETH" - }, - "fields": { - "type": "array", - "description": "Specific fields to be returned for balance information", - "example": [ - "balance", - "updatedAt" - ], - "items": { - "type": "string", - "enum": [ - "balance", - "available", - "locked", - "updatedAt" - ] - } - } - } - } - } - ], - "tags": [ - "Trading", - "public" - ], - "responses": { - "default": { - "schema": { - "type": "array", - "items": { - "type": "object", - "properties": { - "token": { - "type": "string", - "description": "The token for which the balances are provided.", - "example": "ETH" - }, - "balance": { - "type": "number", - "description": "It is the total balance for the user corresponding to the specified token.", - "example": 42 - }, - "available": { - "type": "number", - "description": "It is the part of the balance available for use.", - "example": 23 - }, - "locked": { - "type": "number", - "description": "It is the part of the balance currently in open orders or pending withdrawal.", - "example": 19 - } - } - } - }, - "examples": { - "application/json": [ - { - "token": "BTC", - "balance": 0, - "available": 0, - "locked": 0 - }, - { - "token": "ETH", - "balance": 114036369, - "available": 89036369, - "locked": 25000000 - }, - { - "token": "KON", - "balance": 99800000, - "available": 99800000, - "locked": 0 - }, - { - "token": "USDT", - "balance": 2781535529, - "available": 2781535529, - "locked": 0 - } - ] - } - } - } + "title": "Submit Order" } }, "/v1/trading/r/publicTradeHistory/{user}": { @@ -1530,7 +822,7 @@ "nonce": { "type": "string", "description": "This nonce which used to provide the time until which this nonce is valid. It is presented as seconds since epoch.", - "example": "1776156902.058" + "example": "v2-1704114061.000" }, "signature": { "type": "string", @@ -1704,123 +996,6 @@ } } } -}, -"/v1/trading/fills": { - "get": { - "title": "Fills history", - "operationId": "getV1TradingFills", - "summary": "This method is used to get the history of fills (executed trades) for the authenticated user", - "responses": { - "default": { - "schema": { - "type": "object", - "properties": { - "pagination": { - "type": "object", - "properties": { - "totalItems": { - "type": "number", - "description": "Total number of items matching the query", - "example": 1559, - "minimum": 0 - }, - "limit": { - "type": "number", - "description": "Limit applied on returned items", - "example": 5 - }, - "skip": { - "type": "number", - "description": "Skip applied on returned items", - "example": 2 - } - } - }, - "items": { - "type": "object", - "properties": { - "_id": { - "type": "string", - "description": "Unique identifier representing this transfer", - "example": "MphMkBBZjnS" - }, - "token": { - "type": "string", - "description": "Token transfered", - "example": "ETH" - }, - "amount": { - "type": "number", - "description": "Amount transfered (effective amount received by the recipient)", - "example": 3.14, - "minimum": 0 - }, - "feeAmount": { - "type": "number", - "description": "Transfer fee amount (in transfer token units)", - "example": 3.14, - "minimum": 0 - }, - "source": { - "type": "string", - "description": "Source Ethereum address", - "example": "0x08152c1265dBc218ccc8Ab5C574e6bD52279b3B7" - }, - "recipient": { - "type": "string", - "description": "Recipient Ethereum address", - "example": "0xeb3ea3ea9239577951523cafa9fd3072bc88e50a" - }, - "date": { - "type": "string", - "format": "date", - "description": "Date and time of the transfer", - "example": "1990-04-14T00:20:00.000Z" - } - } - } - } - }, - "examples": { - "application/json": { - "items": [ - { - "price": 190, - "fillAmount": -0.1, - "symbol": "ETH:USDT", - "fillId": "6093ba95ec05a4226816bc3c", - "orderId": "Fy1qTx38JMZ", - "orderType": "EXCHANGE LIMIT", - "orderCreationDate": "2021-05-06T09:44:53.541Z", - "orderAmount": -0.1, - "date": "2021-05-06T09:44:54.833Z", - "orderActive": false, - "orderCanceled": false - }, - { - "price": 190, - "fillAmount": 0.1, - "symbol": "ETH:USDT", - "fillId": "6093ba95ec05a4226816bc3b", - "orderId": "2fh4oeSZQxW", - "orderType": "EXCHANGE LIMIT", - "orderCreationDate": "2021-05-06T09:44:35.020Z", - "orderAmount": 0.3, - "date": "2021-05-06T09:44:54.334Z", - "orderActive": false, - "orderCanceled": true - } - ], - "pagination": { - "totalItems": 13, - "skip": 0, - "limit": 20 - } - } - } - } - } - } }, "/market-data/book/{symbol}/{precision}/{length}": { "get":{ @@ -1980,7 +1155,7 @@ "examples":{ "application/json":[ [ - "BTC:USD", + "BTC:USDT", 8719.7, 34.58126956, 8722.2, @@ -2139,7 +1314,7 @@ "type":"string", "required":false, "description":"Filter end (time since epoch in ms). Only when section is 'hist' Defaults to now.", - "x-example":"1577923200000" + "x-example":"1747384800000" }, { "in":"query", diff --git a/src/spec/swagger-v11--submitted.json b/src/spec/swagger-v11--submitted.json deleted file mode 100644 index 75999c9..0000000 --- a/src/spec/swagger-v11--submitted.json +++ /dev/null @@ -1,3285 +0,0 @@ -{ - "swagger":"2.0", - "host":"api.stg.rhino.fi", - "basePath":"/", - "schemes":[ - "https" - ], - "info":{ - "title":"rhino.fi API documentation", - "version":"1.0.0", - "description":"dvf-pub-api" - }, - "tags":[], - "paths":{ - "/v1/trading/r/24HoursVolume/{Year}/{Month}/{Day}":{ - "get":{ - "summary":"Request information regarding the trading volume for a specific date. The request returns the overall trading volume details for all tokens in USD as well as the trading volume per token.", - "operationId":"getV1TradingR24hoursvolume", - "parameters":[ - { - "type":"string", - "description":"The year of the specific trading volume request date - in this case 2020.", - "name":"year", - "in":"query", - "required":true - }, - { - "type":"string", - "description":"The month of the specific trading volume request date - in this case 01 (January).", - "name":"month", - "in":"query", - "required":true - }, - { - "type":"number", - "description":"The day of the specific trading volume request date - in this case 01 (1st of a month).", - "name":"day", - "in":"query", - "required":true - } - ], - "tags":[ - "Market" - ], - "responses":{ - "default":{ - "schema":{ - "$ref":"#/definitions/24HoursVolumeResponse" - }, - "description":"Returns the overall trading volume details for all tokens in USD as well as the trading volume per trading pair." - } - } - } - }, - "/v1/trading/r/30DaysVolume":{ - "get":{ - "summary":"Request information regarding the trading volume of a specific address for the last 30 days. The request returns the overall trading volume details for all tokens in USD as well as the trading volume per token. Results are cached for 60 minutes.", - "operationId":"getV1TradingR30daysvolume", - "parameters":[ - { - "type":"string", - "name":"nonce", - "in":"query", - "required":true, - "example": "1579901055.575" - }, - { - "type":"string", - "name":"signature", - "in":"query", - "required":true, - "example": "0x0277b6e85ffdfb8cdc34c89b8b60c42a1a96a57e1b528ca3ff203b2dac8c9a200dbedd5ab8d2ed7ef19e915daf00327db91c1f5a1988666089e6b8420881699501" - } - ], - "tags":[ - "Market" - ], - "responses":{ - "default":{ - "schema":{ - "$ref":"#/definitions/30DaysVolumeResponse" - }, - "description":"Returns the trading volume of the last 30 days for a specific address. The request returns the overall trading volume details for all tokens in USD as well as the trading volume per trading pair. Results are cached for 60 minutes." - } - } - } - }, - "/v1/trading/r/User24HoursVolume":{ - "get":{ - "summary": "Request information regarding the trading volume of a specific address for the last 24 hours. The request returns the overall trading volume details for all tokens in USD as well as the trading volume per token. Results are cached for 2 minutes.", - "operationId":"getV1Pub24HoursVolumeSpecificAddress", - "parameters":[ - { - "type":"string", - "name":"nonce", - "in":"query", - "required":true, - "example": "1579901055.575" - }, - { - "type":"string", - "name":"signature", - "in":"query", - "required":true, - "example": "0x0277b6e85ffdfb8cdc34c89b8b60c42a1a96a57e1b528ca3ff203b2dac8c9a200dbedd5ab8d2ed7ef19e915daf00327db91c1f5a1988666089e6b8420881699501" - } - ], - "tags":[ - "Market" - ], - "responses":{ - "default":{ - "schema":{ - "$ref":"#/definitions/User24HoursVolumeResponse" - }, - "description": "Returns the overall trading volume details of a specific address for all tokens in USD as well as the trading volume per trading pair fot the last 24 hours." - } - } - } - }, - "/v1/trading/r/USDRanking":{ - "get":{ - "summary":"This returns a user ranking by overall trading volume quoted in USD. If the parameters startDate and endDate are provided, the ranking includes only trading volume within that window of time.", - "operationId":"getV1TradingRUsdranking", - "parameters":[ - { - "type":"number", - "description":"The start date and time (Unix timestamp in milliseconds) for which the trade volumes are requested. If startDate and endDate are not provided, it returns the volume ranking if all time.", - "name":"startDate", - "in":"query" - }, - { - "type":"number", - "description":"The end date and time (Unix timestamp in milliseconds) for which events are requested.If startDate and endDate are not provided, it returns the volume ranking if all time.", - "name":"endDate", - "in":"query" - } - ], - "tags":[ - "Market" - ], - "responses":{ - "default":{ - "schema":{ - "$ref":"#/definitions/USDRankingResponse" - }, - "description":"Ranked output of all trading volumes for all the tokens." - } - } - } - }, - "/v1/trading/r/estimatedNextBatchTime":{ - "get":{ - "summary":"Returns a countdown until the expected next batch proof is submitted onto the blockchain and the average time of previous batches. The next batch will include all pending withdrawals.", - "operationId":"getV1TradingREstimatednextbatchtime", - "tags":[ - "Market" - ], - "responses":{ - "default":{ - "schema":{ - "$ref":"#/definitions/estimatedNextBatchResponse" - }, - "description":"Returns the amount of time remaining until the batch is posted to Ethereum." - } - } - } - }, - "/v1/trading/r/feeRate":{ - "get":{ - "summary":"Return current fee rate for a given address. This rate is dependent on user trading volume.", - "operationId":"getV1TradingRFeerate", - "parameters":[ - { - "type":"string", - "name":"nonce", - "description": "This nonce which used to provide the time until which this nonce is valid. It is presented as seconds since epoch.", - "in":"query", - "required":true, - "example": "1579901055.575" - }, - { - "type":"string", - "name":"signature", - "in":"query", - "required":true, - "description": "The signature obtained by signing the nonce with your private ethereum key.", - "example": "0x0277b6e85ffdfb8cdc34c89b8b60c42a1a96a57e1b528ca3ff203b2dac8c9a200dbedd5ab8d2ed7ef19e915daf00327db91c1f5a1988666089e6b8420881699501" - }, - { - "type":"string", - "name":"token", - "in":"query", - "example": "ETH" - } - ], - "tags":[ - "Trading" - ], - "responses":{ - "default": { - "schema": { - "$ref": "#/definitions/feeRateResponse" - }, - "description": "Returns the fee rate for the user based on past trading volume." - } - } - } - }, - "/v1/trading/r/last24HoursVolume":{ - "get":{ - "summary":"Request information regarding the trading volume for the last 24 hours. The request returns the overall trading volume details in USD as well as the trading volume per token in USD and the native token.", - "operationId":"getV1TradingRLast24hoursvolume", - "tags":[ - "Market" - ], - "responses":{ - "default":{ - "schema":{ - "$ref":"#/definitions/last24HoursVolumeResponse" - }, - "description":"Returns the trading volume of the last 24 hours." - } - } - } - }, - "/v1/trading/r/tokenRanking":{ - "get":{ - "summary":"This returns a user ranking by trading volume for a chosen token. If the parameters startDate and endDate are provided, the ranking includes only trading volume within that window of time. All volumes are quoted in ETH.", - "operationId":"getV1TradingRTokenranking", - "parameters":[ - { - "type":"string", - "description":"The currency relating to the requested trading volume information.", - "name":"currency", - "in":"query", - "required":true - }, - { - "type":"number", - "description":"The start date and time (Unix timestamp in milliseconds) for which the trade volumes are requested. If startDate and endDate are not provided, it returns the volume ranking if all time.", - "name":"startDate", - "in":"query" - }, - { - "type":"number", - "description":"The end date and time (Unix timestamp in milliseconds) for which the trade volumes are requested. If startDate and endDate are not provided, it returns the volume ranking if all time.", - "name":"endDate", - "in":"query" - } - ], - "tags":[ - "Market" - ], - "responses":{ - "default":{ - "schema":{ - "$ref":"#/definitions/tokenRankingResponse" - }, - "description":"Returns a ranked output of all the trading volumes for a given crypto currency. All the Volumes are quoted in ETH." - } - } - } - }, - "/v1/trading/r/getBalance":{ - "post":{ - "summary":"This is used to retrieve the total and active balances of a user per token. Active balance is the balance that is currently available. Total balance (specified as balance) is the sum of all the balances including those locked for trading.", - "operationId":"postV1TradingRGetbalance", - "parameters":[ - { - "in":"body", - "name":"body", - "schema":{ - "$ref":"#/definitions/getBalancePayload" - } - } - ], - "tags":[ - "Trading" - ], - "responses":{ - "default":{ - "schema":{ - "$ref":"#/definitions/getBalanceResponse" - }, - "description":"Returns the total and active balances of a user per token." - } - } - } - }, - "/v1/trading/r/getConf":{ - "post":{ - "summary":"Returns the rhino.fi application configuration details.", - "operationId":"postV1TradingRGetconf", - "tags":[ - "Trading" - ], - "responses":{ - "default":{ - "schema":{ - "$ref":"#/definitions/getConfResponse" - }, - "description":"Returns the overall trading volume details for all tokens in USD as well as the trading volume per trading pair." - } - } - } - }, - "/v1/trading/r/getDeposits":{ - "post":{ - "summary":"This is an authenticated endpoint used to retrieve deposits. A token can be specified to get deposits for a specific token. The limit of deposits returned is 1000.", - "operationId":"postV1TradingRGetdeposits", - "parameters":[ - { - "in":"body", - "name":"body", - "schema":{ - "$ref":"#/definitions/getBalancePayload" - } - }, - { - "type":"number", - "description":"Date of the last deposit returned.", - "name":"startDate", - "in":"query", - "x-example":1595337548241 - }, - { - "type":"number", - "description":"Limit of deposits that will be returned. With a maximum limit of 1000.", - "name":"limit", - "in":"query", - "x-example":60 - } - ], - "tags":[ - "Trading" - ], - "responses":{ - "default":{ - "schema":{ - "$ref":"#/definitions/getDepositsResponse" - }, - "description":"Returns the list of deposits. A token can be specified to get deposits for a specific token." - } - } - } - }, - "/v1/trading/r/getOrder": { - "post": { - "summary": "This is endpoint is used to retrieve the details for a specific order using the order ID.", - "operationId": "postV1TradingRGetorder", - "parameters": [ - { - "in": "body", - "name": "body", - "schema": { "$ref": "#/definitions/getOrderPayload" } - } - ], - "tags": ["Trading"], - "responses": { - "default": { - "schema": { "$ref": "#/definitions/getOrderResponse" }, - "description": "Returns details relating to a particular order." - } - } - } - }, - "/v1/trading/r/getPendingWithdrawals":{ - "post":{ - "summary":"This endpoint is used to retrieve all pending withdrawals. If a token is specified, withdrawals pertaining to only that particular token are provided.", - "operationId":"postV1TradingRGetpendingwithdrawals", - "parameters":[ - { - "in":"body", - "name":"body", - "schema":{ - "$ref":"#/definitions/getPendingWithdrawalsPayload" - } - } - ], - "tags":[ - "Trading" - ], - "responses":{ - "default":{ - "schema":{ - "type":"string" - }, - "description":"Successful" - } - } - } - }, - "/v1/trading/r/getUserConf":{ - "post":{ - "summary":"Returns the rhino.fi application and user configuration details.", - "operationId":"postV1TradingRGetuserconf", - "parameters":[ - { - "in":"body", - "name":"body", - "schema":{ - "$ref":"#/definitions/getUserConfPayload" - } - } - ], - "tags":[ - "Trading" - ], - "responses":{ - "default":{ - "schema":{ - "$ref":"#/definitions/getUserConfResponse" - }, - "description":"Returns the overall trading volume details for all tokens in USD as well as the trading volume per trading pair." - } - } - } - }, - "/v1/trading/r/getVaultId":{ - "post":{ - "summary":"An authenticated endpoint used to retrieve a vaultId for given token.", - "operationId":"postV1TradingRGetvaultid", - "parameters":[ - { - "in": "body", - "name": "body", - "schema": { - "$ref": "#/definitions/getVaultIdPayload" - } - } - ], - "tags":[ - "Trading" - ], - "responses":{ - "default": { - "schema": { - "$ref": "#/definitions/getVaultIdResponse" - }, - "description": "Returns a the vault id allocated for the requested token." - } - } - } - }, - "/v1/trading/r/getWithdrawal":{ - "post":{ - "summary":"This endpoint is used to retrieve details relating to a particular withdrawal.", - "operationId":"postV1TradingRGetwithdrawal", - "parameters":[ - { - "in":"body", - "name":"body", - "schema":{ - "$ref":"#/definitions/getWithdrawalPayload" - } - } - ], - "tags":[ - "Trading" - ], - "responses":{ - "default":{ - "schema":{ - "$ref":"#/definitions/getWithdrawalResponse" - }, - "description":"Returns details relating to a particular withdrawal." - } - } - } - }, - "/v1/trading/r/openOrders": { - "post": { - "summary": "This endpoints allows to retrieve details on all open orders.", - "operationId": "postV1TradingROpenorders", - "parameters": [ - { - "in": "body", - "name": "body", - "schema": { "$ref": "#/definitions/openOrdersPayload" } - } - ], - "tags": ["Trading"], - "responses": { - "default": { - "schema": { "$ref": "#/definitions/openOrdersResponse" }, - "description": "Returns all open orders." - } - } - } - }, - "/v1/trading/r/orderHistory": { - "post": { - "summary": "This method is used to retrieve a list of all past orders for a user. This includes executed trades, as well as expired and cancelled orders. The limit of orders returned is 1000.", - "operationId": "postV1TradingROrderhistory", - "parameters": [ - { - "in": "body", - "name": "body", - "schema": { "$ref": "#/definitions/orderHistoryPayload" } - }, - { - "type":"number", - "description":"Date of the last order returned.", - "name":"startDate", - "in":"query", - "x-example":1595337548241 - }, - { - "type":"number", - "description":"Limit of orders that will be returned. With a maximum limit of 1000.", - "name":"limit", - "in":"query", - "x-example":60 - } - ], - "tags": ["Trading"], - "responses": { - "default": { - "schema": { "$ref": "#/definitions/orderHistoryResponse" }, - "description": "Returns a list of all a user's past orders." - } - } - } - }, - "/v1/trading/r/withdrawHistory":{ - "post":{ - "summary":"An authenticated endpoint used to retrieve a list of user's past withdrawals. This includes ready, completed, as well as cancelled withdrawals. The limit of withdrawals returned is 1000.", - "operationId":"postV1TradingRWithdrawhistory", - "parameters":[ - { - "in":"body", - "name":"body", - "schema":{ - "$ref":"#/definitions/getPendingWithdrawalsPayload" - } - }, - { - "type":"number", - "description":"Date of the last withdraw returned.", - "name":"startDate", - "in":"query", - "x-example":1595337548241 - }, - { - "type":"number", - "description":"Limit of withdraws that will be returned. With a maximum limit of 1000.", - "name":"limit", - "in":"query", - "x-example":60 - } - ], - "tags":[ - "Trading" - ], - "responses":{ - "default":{ - "schema":{ - "$ref":"#/definitions/withdrawHistoryResponse" - }, - "description":"Returns a list of user's past withdrawals." - } - } - } - }, - "/v1/trading/w/cancelOrder":{ - "post":{ - "summary":"This endpoint allows to cancel a specific order.", - "operationId":"postV1TradingWCancelorder", - "parameters":[ - { - "in":"body", - "name":"body", - "schema":{ - "$ref":"#/definitions/cancelOrderPayload" - } - } - ], - "tags":[ - "Trading" - ], - "responses":{ - "default":{ - "schema":{ - "$ref":"#/definitions/cancelOrderResponse" - }, - "description":"Queues cancellation request and returns the order ID of the cancelled order." - } - } - } - }, - "/v1/trading/w/cancelWithdrawal":{ - "post":{ - "summary":"This endpoint allows to cancel a specific withdrawal with a given id.", - "operationId":"postV1TradingWCancelwithdrawal", - "parameters":[ - { - "in":"body", - "name":"body", - "schema":{ - "$ref":"#/definitions/cancelWithdrawalPayload" - } - } - ], - "tags":[ - "Trading" - ], - "responses":{ - "default":{ - "schema":{ - "$ref":"#/definitions/cancelWithdrawalResponse" - }, - "description":"Returns the cancelled withdrawal." - }, - "withdrawal not found": { - "schema": { - "type":"object", - "properties":{ - "statusCode":{ - "type":"number", - "description":"The request code status.", - "example":422 - }, - "error":{ - "type":"string", - "description":"What was the error.", - "example":"WITHDRAWAL_NOT_FOUND" - }, - "message":{ - "type":"string", - "description":"Message returned.", - "example":"WITHDRAWAL_NOT_FOUND" - }, - "type":{ - "type":"string", - "description":"The error type.", - "example":"DVFError" - } - } - } - } - } - } - }, - "/v1/trading/w/deposit":{ - "post":{ - "summary":"Submit a signed notification of a new deposit made.", - "operationId":"postV1TradingWDeposit", - "parameters":[ - { - "in":"body", - "name":"body", - "schema":{ - "$ref":"#/definitions/depositPayload" - } - } - ], - "tags":[ - "Trading" - ], - "responses":{ - "default":{ - "schema":{ - "$ref":"#/definitions/depositResponse" - }, - "description":"Returns the deposit notifcation." - } - } - } - }, - "/v1/trading/w/register":{ - "post":{ - "summary":"This method is used to register a Stark key that corresponds to an Ethereum public address. This will return rhino.fi Signature or rhino.fi application and user configuration details.", - "operationId":"postV1TradingWRegister", - "parameters":[ - { - "in":"body", - "name":"body", - "schema":{ - "$ref":"#/definitions/registerPayload" - } - } - ], - "tags":[ - "Trading" - ], - "responses":{ - "default":{ - "schema":{ - "$ref":"#/definitions/registerResponse" - }, - "description":"Returns a rhino.fi Signature (defiSignature) which is required to register on StarkEx Smart Contract. Returns the rhino.fi application as well as the user configuration details if use is already registered." - } - } - } - }, - "/v1/trading/w/submitOrder": { - "post": { - "summary": "This authenticated endpoint is used to submit an order.", - "operationId": "postV1TradingWSubmitorder", - "parameters": [ - { - "in": "body", - "name": "body", - "schema": { "$ref": "#/definitions/submitOrderPayload" } - } - ], - "tags": [ - "Trading" - ], - "responses": { - "default": { - "schema": { - "$ref": "#/definitions/submitOrderResponse" - }, - "description": "Queues order for market submission and returns the order ID of the submitted order." - } - } - } - }, - "/v1/trading/w/transfer": { - "post": { - "title": "Transfer", - "summary": "Submit a request for internal transfer.", - "operationId": "postV1TradingWTransfer", - "parameters": [ - { - "in": "body", - "name": "body", - "schema": { - "$ref": "#/definitions/transferPayload" - } - } - ], - "tags": ["Trading"], - "responses": { - "default": { - "schema": { - "type": "object", - "properties": { - "_id": { - "type": "string", - "description": "Transfer ID.", - "example": "LCafcGC6tBH" - }, - "token": { - "type": "string", - "description": "The token that was transferred.", - "example": "USDT" - }, - "amount": { - "type": "string", - "description": "The amount that was transferred (in quantised units).", - "example": "100", - "pattern": "^[0-9]*$" - }, - "recipient": { - "type": "string", - "description": "rhino.fi user id of recipient of the transfer.", - "example": "0x948cd3ad67c5f21412bfcd07a7981322f9fa01f0" - }, - "createdAt": { - "type": "string", - "format": "date", - "description": "The date and time transfer request was received.", - "example": "2020-01-29T14:13:05.898Z" - }, - "updatedAt": { - "type": "string", - "format": "date", - "description": "The date and time transfer request was received.", - "example": "2020-01-29T14:13:05.898Z" - }, - "tx": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "TransferRequest" - ] - }, - "amount": { - "type": "string", - "pattern": "^[0-9]*$" - }, - "expirationTimestamp": { - "type": "integer", - "minimum": 0 - }, - "nonce": { - "type": "integer", - "minimum": 0 - }, - "receiverPublicKey": { - "type": "string", - "pattern": "^0x[a-f0-9]+$" - }, - "receiverVaultId": { - "type": "integer" - }, - "senderPublicKey": { - "type": "string", - "pattern": "^0x[a-f0-9]+$" - }, - "senderVaultId": { - "type": "integer" - }, - "signature": { - "$ref": "#/definitions/signature" - }, - "token": { - "type": "string", - "pattern": "^0x[a-f0-9]+$" - } - } - } - }, - "required": [ - "_id", - "token", - "createdAt", - "updatedAt" - ] - }, - "examples": { - "application/json": { - "_id": "LCafcGC6tBH", - "token": "USDT", - "amount": "100", - "recipient":"0x948cd3ad67c5f21412bfcd07a7981322f9fa01f0", - "createdAt": "2020-01-29T14:13:05.898Z", - "updatedAt": "2020-01-29T14:13:05.898Z", - "tx": { - "type": "TransferRequest", - "amount": "100", - "expirationTimestamp": 456890, - "nonce": 120, - "receiverPublicKey": "0x341E46a49F15785373edE443Df0220DEa6a41Bbc", - "receiverVaultId": 15678, - "senderPublicKey": "0x341E46a49F15785373edE443Df0220DEa6a41Bbc", - "senderVaultId": 1234, - "signature": { - "r": "5d14357fcf8f489218de0855267c6f64bc463135debf62680ad796e63cd6d3b", - "s": "786ab874d91e3a5871134955fcb768914754760a0ada326af67f758f32819cf" - }, - "token": "0x341E46a49F15785373edE443Df0220DEa6a41Bbc" - } - } - } - } - } - } - }, - "/v1/trading/w/withdraw":{ - "post":{ - "summary":"Submit a request for a new withdrawal.", - "operationId":"postV1TradingWWithdraw", - "parameters":[ - { - "in":"body", - "name":"body", - "schema":{ - "$ref":"#/definitions/withdrawalPayload" - } - } - ], - "tags":[ - "Trading" - ], - "responses":{ - "default":{ - "schema":{ - "type":"string" - }, - "description":"Successful" - } - } - } - }, - "/v1/trading/r/getGasPrice":{ - "get":{ - "summary":"Returns a range of gas prices in Wei to use with on chain transactions.", - "operationId":"getV1TradingRGetGasPrice", - "tags":[ - "Trading" - ], - "responses":{ - "default":{ - "schema":{ - "$ref":"#/definitions/getGasPriceResponse" - }, - "description":"Range of gas prices for on chain confirmation speed." - } - } - } - }, - "/v1/trading/r/trades/{Symbol}":{ - "get":{ - "summary":"Request information regarding all recently completed trades for a given market pair.", - "operationId":"getV1TradingRTrades", - "parameters":[ - { - "in":"path", - "name":"Symbol", - "type":"string", - "required":true, - "description":"The market trading pair in rhino.fi format i.e BASE:QUOTE", - "x-example":"ETH:USDT" - } - ], - "tags":[ - "Market" - ], - "responses":{ - "default":{ - "schema":{ - "$ref":"#/definitions/tradesResponse" - }, - "description":"The trades endpoint returns data on all recently completed trades for a given market pair for the past 24 hours." - } - } - } - }, - "/v1/trading/r/tradesSince/{Symbol}/{StartDate}/{Limit}": { - "get": { - "summary": "Request information regarding all completed trades in a time range for a given market pair", - "operationId":"getV1TradingRTradessince", - "parameters":[ - { - "in":"path", - "name":"Symbol", - "type":"string", - "required":true, - "description":"The market trading pair in rhino.fi format i.e BASE:QUOTE", - "x-example":"ETH:USDT" - }, - { - "in":"path", - "name":"StartDate", - "type":"number", - "description":"The Unix timestamp in milliseconds for the start period for the query.", - "x-example":1547384800 - }, - { - "in":"path", - "name":"Limit", - "type":"number", - "required":false, - "description":"Limit of trades that will be returned. With a maximum limit of 1000.", - "x-example":60 - } - ], - "tags":[ - "Market" - ], - "responses":{ - "default":{ - "schema":{ - "$ref":"#/definitions/tradesResponse" - }, - "description":"Returns data on all recently completed trades for a given market pair during a time range." - } - } - } - }, - "/v1/trading/r/getBalanceForUser/{userEthAddress}": { - "post": { - "summary": "This is used to retrieve the total and active balances of a user per token. Active balance is the balance that is currently available. Total balance (specified as balance) is the sum of all the balances including those locked for trading.", - "operationId": "postV1TradingRGetbalanceforuserUserethaddress", - "parameters": [ - { - "type": "string", - "description": "The ETH address of a potential user", - "name": "userEthAddress", - "in": "path", - "required": true - }, - { - "in": "body", - "name": "body", - "schema": { - "type": "array", - "items": { - "type": "object", - "properties": { - "token": { - "type": "string", - "description": "The token for which the balances are provided.", - "example": "ETH" - }, - "balance": { - "type": "number", - "description": "It is the total balance for the user corresponding to the specified token.", - "example": 42 - }, - "available": { - "type": "number", - "description": "It is the part of the balance available for use.", - "example": 23 - }, - "locked": { - "type": "number", - "description": "It is the part of the balance currently in open orders or pending withdrawal.", - "example": 19 - } - } - } - } - } - ], - "tags": [ - "Trading", - "public" - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/getBalanceResponse" - }, - "description": "Successful" - } - } - } - }, - "/v1/trading/r/publicTradeHistory/{user}": { - "get": { - "summary": "This method is used to retrieve a list of all past executed trades for a user. This includes the different trades that have been settled for each fully executed or partially executed order.", - "operationId": "getV1TradingRPublictradehistoryUser", - "parameters": [ - { - "type": "string", - "description": "The ETH address of a potential user", - "name": "user", - "in": "path", - "required": true - } - ], - "tags": [ - "Trading", - "public" - ], - "responses": { - "200": { - "schema": { - "type": "object", - "properties": { - "items": { - "type": "array", - "items": { - "type": "object", - "properties": { - "fillAmount": { - "type": "number", - "description": "amount filled" - }, - "user": { - "type": "string", - "description": "User ETH address" - }, - "date": { - "type": "string", - "format": "date", - "description": "Date of the settlement" - }, - "tokenBuy": { - "type": "string", - "description": "Buy token" - }, - "tokenSell": { - "type": "string", - "description": "Sell token" - }, - "amountBuy": { - "type": "string", - "description": "Amount of buy order" - }, - "amountSell": { - "type": "string", - "description": "Amount of sell order" - }, - "orderId": { - "type": "string", - "description": "Id of the order" - }, - "feeCurrency": { - "type": "string", - "description": "Currency of the fee" - }, - "feeAmount": { - "type": "string", - "description": "Amount of fee" - } - } - } - } - } - }, - "description": "Successful" - } - } - } - }, - "/v1/trading/r/getPublicUserPermissions": { - "post": { - "summary": "Used to get all configured permissions for the authenticated user", - "operationId": "postV1TradingRGetpublicuserpermissions", - "parameters": [ - { - "in": "body", - "name": "body", - "schema": { - "type": "object", - "properties": { - "nonce": { - "type": "string", - "description": "This nonce which used to provide the time until which this nonce is valid. It is presented as seconds since epoch.", - "example": "1776156902.058" - }, - "signature": { - "type": "string", - "description": "The signature obtained by signing the nonce with your private ethereum key.", - "example": "0x0277b6e85ffdfb8cdc34c89b8b60c42a1a96a57e1b528ca3ff203b2dac8c9a200dbedd5ab8d2ed7ef19e915daf00327db91c1f5a1988666089e6b8420881699501" - } - } - } - } - ], - "tags": [ - "Trading", "public" - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/permissionsResponse" - }, - "description": "Successful" - } - } - } - }, - "/v1/trading/r/setPublicUserPermissions": { - "post": { - "summary": "Used to set a specific permission for a given user", - "operationId": "postV1TradingRSetpublicuserpermissions", - "parameters": [ - { - "in": "body", - "name": "body", - "schema": { - "$ref": "#/definitions/permissionsPayload" - } - } - ], - "tags": [ - "Trading" - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/permissionsResponse" - }, - "description": "Successful" - } - } - } - } - }, - "/v1/trading/transfers": { - "get": { - "summary": "This method is used to get the history of transfers for the authenticated user", - "operationId": "getV1TradingTransfers", - "parameters": [ - { - "type": "string", - "x-convert": { - "case": "upper" - }, - "name": "token", - "in": "query" - }, - { - "type": "string", - "format": "date", - "name": "startDate", - "in": "query" - }, - { - "type": "string", - "format": "date", - "name": "endDate", - "in": "query" - }, - { - "type": "string", - "default": "date", - "enum": [ - "date" - ], - "name": "sortBy", - "in": "query" - }, - { - "type": "string", - "default": "DESC", - "enum": [ - "ASC", - "DESC" - ], - "name": "sortDirection", - "in": "query" - }, - { - "type": "integer", - "default": 0, - "minimum": 0, - "name": "skip", - "in": "query" - }, - { - "type": "integer", - "default": 20, - "minimum": 1, - "maximum": 100, - "name": "limit", - "in": "query" - } - ], - "tags": [ - "Trading" - ], - "responses": { - "200": { - "schema": { - "x-alternatives": [ - { - "type": "object", - "properties": { - "pagination": { - "type": "object", - "properties": { - "totalItems": { - "type": "number", - "description": "Total number of items matching the query", - "example": 1559, - "minimum": 0 - }, - "limit": { - "type": "number", - "description": "Limit applied on returned items", - "example": 5 - }, - "skip": { - "type": "number", - "description": "Skip applied on returned items", - "example": 2 - } - } - }, - "items": { - "type": "array", - "items": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "TransferRequest" - ] - }, - "amount": { - "type": "string", - "pattern": "^[0-9]*$" - }, - "expirationTimestamp": { - "type": "integer", - "minimum": 0 - }, - "nonce": { - "type": "integer", - "minimum": 0 - }, - "receiverPublicKey": { - "type": "string", - "pattern": "^0x[a-f0-9]+$" - }, - "receiverVaultId": { - "type": "integer" - }, - "senderPublicKey": { - "type": "string", - "pattern": "^0x[a-f0-9]+$" - }, - "senderVaultId": { - "type": "integer" - }, - "signature": { - "$ref": "#/definitions/signature" - }, - "token": { - "type": "string", - "pattern": "^0x[a-f0-9]+$" - } - } - } - } - } - }, - { - "type": "string", - "description": "List of past transfers in CSV format", - "example": "id,token,amount,feeAmount,source,recipient,date9oWC74UdzWJ,ZRX,0.05,0.001,0x08152c1265dBc218ccc8Ab5C574e6bD52279b3B7,0xeb3ea3ea9239577951523cafa9fd3072bc88e50a,1990-04-14T00:00:00.000ZJtCAHChHhmU,ZRX,0.05,0.001,0x08152c1265dBc218ccc8Ab5C574e6bD52279b3B7,0xeb3ea3ea9239577951523cafa9fd3072bc88e50a,1990-04-14T00:02:00.000ZA1vFQzqYMXu,ZRX,0.05,0.001,0x08152c1265dBc218ccc8Ab5C574e6bD52279b3B7,0xeb3ea3ea9239577951523cafa9fd3072bc88e50a,1990-04-14T00:04:00.000Z8xFu925f72r,ZRX,0.05,0.001,0x08152c1265dBc218ccc8Ab5C574e6bD52279b3B7,0xeb3ea3ea9239577951523cafa9fd3072bc88e50a,1990-04-14T00:06:00.000Z" - } - ] - }, - "description": "Successful" - } - } - } - }, - "/v1/trading/fills": { - "get": { - "summary": "This method is used to get the history of fills (executed trades) for the authenticated user", - "operationId": "getV1TradingFills", - "parameters": [ - { - "type": "string", - "x-convert": { - "case": "upper" - }, - "name": "symbol", - "in": "query" - }, - { - "type": "string", - "format": "date", - "name": "startDate", - "in": "query" - }, - { - "type": "string", - "format": "date", - "name": "endDate", - "in": "query" - }, - { - "type": "string", - "default": "date", - "enum": [ - "date" - ], - "name": "sortBy", - "in": "query" - }, - { - "type": "string", - "default": "DESC", - "enum": [ - "ASC", - "DESC" - ], - "name": "sortDirection", - "in": "query" - }, - { - "type": "integer", - "default": 0, - "minimum": 0, - "name": "skip", - "in": "query" - }, - { - "type": "integer", - "default": 20, - "minimum": 1, - "maximum": 100, - "name": "limit", - "in": "query" - } - ], - "tags": [ - "Trading" - ], - "responses": { - "200": { - "schema": { - "$ref": "#/definitions/getFillsResponse", - "x-alternatives": [ - { - "$ref": "#/definitions/getFillsResponse" - }, - { - "type": "string", - "description": "Response in CSV format", - "example": "fillId,orderId,symbol,fillAmount,orderAmount,price,date,orderCreationDate,orderType,orderActive,orderCanceled606f4123baed6ee2d25f1f1f,79qiFBVDfbz,ZRX:USDT,-0.125622,-1,209.9,1990-04-14T00:00:00.000Z,2020-11-11T16:37:05.262Z,EXCHANGE LIMIT,false,false606f4123baed6ee2d25f1f32,7vVPHzETRQY,ZRX:USDT,-0.125622,-1,209.9,1990-04-14T00:02:00.000Z,2020-11-11T16:37:05.262Z,EXCHANGE LIMIT,false,false606f4123baed6ee2d25f1f2d,GuKPHMafYU1,ZRX:USDT,-0.125622,-1,209.9,1990-04-14T00:04:00.000Z,2020-11-11T16:37:05.262Z,EXCHANGE LIMIT,false,false606f4123baed6ee2d25f1f25,6h1i8x5apLe,ZRX:USDT,-0.125622,-1,209.9,1990-04-14T00:06:00.000Z,2020-11-11T16:37:05.262Z,EXCHANGE LIMIT,false,false606f4123baed6ee2d25f1f27,MwEnHW1MF5y,ZRX:USDT,-0.125622,-1,209.9,1990-04-14T00:08:00.000Z,2020-11-11T16:37:05.262Z,EXCHANGE LIMIT,false,false" - } - ] - }, - "description": "Successful" - } - } - } - }, - "definitions":{ - "getVaultIdPayload": { - "type": "object", - "properties": { - "nonce": { - "type": "string", - "description": "This nonce which used to provide the time until which this nonce is valid. It is presented as seconds since epoch.", - "example": "1776156902.058" - }, - "signature": { - "type": "string", - "description": "The signature obtained by signing the nonce with your private ethereum key.", - "example": "0x0277b6e85ffdfb8cdc34c89b8b60c42a1a96a57e1b528ca3ff203b2dac8c9a200dbedd5ab8d2ed7ef19e915daf00327db91c1f5a1988666089e6b8420881699501" - }, - "token": { - "type": "string", - "description": "The new token for which a new vault Id needs to be allocated.", - "example": "DAI" - } - }, - "required": ["nonce", "signature"] - }, - "getVaultIdResponse": { - "type":"object", - "properties":{ - "":{ - "type": "number", - "description": "The vault id for the requested vault.", - "example": 1851736 - } - } - }, - "24HoursVolumeResponse":{ - "type":"object", - "properties":{ - "totalUSDVolume":{ - "type":"number", - "description":"The total trade volume in terms of USD.", - "example":3320.75 - }, - "tokens":{ - "$ref":"#/definitions/tokens" - }, - "startDate":{ - "type":"string", - "description":"The start date and time for the volume presented.", - "example":"2020-01-01T00:00:00.714Z" - }, - "endDate":{ - "type":"string", - "description":"The end date and time for the volume presented.", - "example":"2020-01-01T00:00:00.714Z" - } - } - }, - "feeRateResponse": { - "type": "object", - "properties": { - "address": { - "type": "string", - "description": "The Ethereum address of the user verified by nonce and signature.", - "example": "0x116f494a2ce567067f319fea1c9f294f23d2fe68" - }, - "timestamp": { - "type": "number", - "description": "Timestamp in milliseconds since epoch.", - "example": 1590263332427 - }, - "fees": { - "type": "object", - "properties": { - "maker": { - "type": "number", - "description": "The fee basis points for maker orders (adding bids or offers to the order book).", - "example": 15 - }, - "taker": { - "type": "number", - "description": "The fee basis points for taker orders (removing liquidity from the order book).", - "example": 20 - } - } - } - } - }, - "30DaysVolumeResponse":{ - "type":"object", - "properties":{ - "totalUSDVolume":{ - "type":"number", - "description":"The total trade volume in terms of USD.", - "example":73364.1749445 - }, - "tokens":{ - "$ref":"#/definitions/tokens" - }, - "startDate":{ - "type":"string", - "description":"The start date and time for the volume presented.", - "example":"2020-01-01T00:00:00.714Z" - }, - "endDate":{ - "type":"string", - "description":"The end date and time for the volume presented.", - "example":"2020-01-01T00:00:00.714Z" - } - } - }, - "User24HoursVolumeResponse": { - "type":"object", - "properties":{ - "totalUSDVolume":{ - "type":"number", - "description":"The total trade volume in terms of USD.", - "example":73364.1749445 - }, - "tokens":{ - "$ref":"#/definitions/tokens" - } - } - }, - "USDRankingResponse":{ - "type":"object", - "properties":{ - "address":{ - "type":"string", - "description":"The address of the trader.", - "example":"0xfc898b18a70ce49579f8d79a32e29928c15b4bc8" - }, - "USDValue":{ - "type":"number", - "description":"The trading volume for the address quoted in USD.", - "example":119128.566703 - } - } - }, - "estimatedNextBatchResponse":{ - "type":"object", - "properties":{ - "estimatedTime": { - "type": "number", - "description": "The number of seconds until the batch is sent to be processed and broadcast to the blockchain.", - "example": 608 - }, - "averageTime": { - "type": "number", - "description": "The configured number of seconds between batches.", - "example": 608 - }, - "finalisedBatchPendingConfirmation": { - "type": "bool", - "description": "True if the previous batch has been created but still pending confirmation on the blockchain.'", - "example": true - } - } - }, - "last24HoursVolumeResponse":{ - "type":"object", - "properties":{ - "totalUSDVolume":{ - "type":"number", - "description":"The total trade volume in terms of USD.", - "example":3320.75 - }, - "tokens":{ - "$ref":"#/definitions/tokens" - }, - "startDate":{ - "type":"string", - "description":"The start date and time for the volume presented.", - "example":"2020-01-01T00:00:00.714Z" - } - } - }, - "tokenRankingResponse":{ - "type":"object", - "properties":{ - "address":{ - "type":"string", - "description":"The address of the trader.", - "example":"0xfc898b18a70ce49579f8d79a32e29928c15b4bc8" - }, - "amount":{ - "type":"number", - "description":"The trading volume for the address", - "example":852.9290936325145 - } - } - }, - "getBalancePayload":{ - "type":"object", - "properties":{ - "nonce":{ - "type":"string", - "description":"This nonce is used to provide the time until which this nonce is valid. It is presented as seconds since epoch.", - "example":"1579901055.575" - }, - "signature":{ - "type":"string", - "description":"The signature obtained by signing the nonce with your private ethereum key.", - "example":"0x494a2c166f95518dcf5a9484fcb702a454382f281f96ba41639fe3a2af279fdc1e3b4e5aa2f585a9a40fb5aaabf10b5390ed5592d502c7799a261f81219491f001" - }, - "token":{ - "type":"string", - "description":"The token which the balance is specifically requested for.", - "example":"ETH" - } - }, - "required":[ - "nonce", - "signature" - ] - }, - "getBalanceResponse":{ - "type":"object", - "properties":{ - "balance":{ - "type":"number", - "description":"It is the total balance available for the user corresponding to the specified token.", - "example":1 - }, - "activeBalance":{ - "type":"number", - "description":"It is the active balance available for the user corresponding to the specified token.", - "example":0 - }, - "_id":{ - "type":"string", - "description":"User ID.", - "example":"5e318fc4948cc789bb5f7bb4" - }, - "ethAddress":{ - "type":"string", - "description":"The ethereum public address of the user.", - "example":"user-01" - }, - "token":{ - "type":"string", - "description":"The token for which the balances are provided.", - "example":"ETH" - } - } - }, - "withdrawHistoryResponse": { - "type":"object", - "properties":{ - "_id":{ - "type":"string", - "description":"Withdrawal ID.", - "example":"53cb6b9b4f4ddef1ad47f943" - }, - "token":{ - "type":"string", - "description":"The token that was withdrawn.", - "example":"USDT" - }, - "amount":{ - "type":"number", - "description":"The amount that was withdrawn.", - "example":100 - }, - "createdAt":{ - "type":"string", - "description":"The date and time of the withdrawal.", - "example":"2020-01-29T14:13:05.898Z" - }, - "readyToWithdrawOnChain":{ - "type":"bool", - "description":"The withdrawal is ready to be requested.", - "example":true - } - } - }, - "getConfResponse":{ - "type":"object", - "properties":{ - "DVF":{ - "type":"object", - "description":"This contains application configuration details to set up for deposits and trading.", - "example":{ - "defaultFeeRate":0.002, - "deversifiAddress":"0x9ab450355b4ab504cbc0e4de484781dac08e6a26", - "starkExContractAddress":"0xF3731d0cdC9834f6F32104580bD226EF1bc1A9F9", - "exchangeSymbols":"[\"tETHUSD\",\"tZRXUSD\",\"tZRXETH\"]", - "tempStarkVaultId":1 - }, - "properties":{ - "defaultFeeRate":{ - "type":"number", - "description":"The default fee rate, if no volume or maker discount." - }, - "deversifiAddress":{ - "type":"string", - "description":"The address of the rhino.fi exchange." - }, - "starkExContractAddress":{ - "type":"string", - "description":"Stark deposit contract address." - }, - "exchangeSymbols":{ - "type":"array", - "description":"Currency pairs available at the rhino.fi exchange for trading" - }, - "tempStarkVaultId":{ - "type":"number", - "description":"Transit Stark vault ID used for deposit privacy" - } - } - }, - "tokenRegistry":{ - "type":"object", - "description": "Detailed information related to each available token." - } - } - }, - "getDepositsResponse":{ - "type":"object", - "properties":{ - "ethAddress":{ - "type":"string", - "description":"The ethereum public address of the user.", - "example":"0x341E46a49F15785373edE443Df0220DEa6a41Bbc" - }, - "starkKey":{ - "type":"string", - "description":"The Stark public key.", - "example":"77a3b314db07c45076d11f62b6f9e748a39790441823307743cf00d6597ea43" - }, - "starkVaultId":{ - "type":"number", - "description":"The Stark vault ID.", - "example":123 - }, - "starkTokenId":{ - "type":"string", - "description":"The Stark token ID.", - "example":"0x7" - }, - "token":{ - "type":"string", - "description":"The token that was deposited", - "example":"USDT" - }, - "amount":{ - "type":"number", - "description":"The amount that was deposited.", - "example":1000 - }, - "createdAt":{ - "type":"string", - "description":"The date and time of the deposit.", - "example":"2020-01-29T14:02:08.477Z" - }, - "isPostedOffchain":{ - "type":"boolean", - "description":"Flag to indicate if the deposit was posted off chain.", - "example":false - }, - "isConfirmedOnChain":{ - "type":"boolean", - "description":"Flag to indicate if the deposit was confirmed off chain.", - "example":true - } - } - }, - "getOrderPayload": { - "type": "object", - "properties": { - "orderId": { - "type": "string", - "description": "The ID of the order. In case you want to view all open orders, check POST openOrders.", - "example": "123" - }, - "cid": { - "type": "string", - "description": "An optional user-defined identifier for this order", - "example": "satoshi-order-2083236893" - }, - "nonce": { - "type": "string", - "description": "This nonce is used to provide the time until which this nonce is valid. It is presented as seconds since epoch.", - "example": "1579901055.575" - }, - "signature": { - "type": "string", - "description": "The signature obtained by signing the nonce with your private ethereum key.", - "example": "0xec3606b6b0ee3e28b66803f65aafec4dfe9d4e49be68270fa7275dd8435349c45574c0476edd99641bc13523985ad0b29924f0d4204ce56bc6af00874a0126dc00" - } - }, - "required": ["orderId", "nonce", "signature"] - }, - "getOrderResponse": { - "type": "object", - "properties": { - "_id": { - "type": "string", - "description": "Id for the order. This can be used for orderId when calling cancelOrder or getOrder", - "example": "L1tarX5wUem" - }, - "amount": { - "type": "number", - "description": "Actual order amount.", - "example": "-0.15" - }, - "price": { - "type": "number", - "description": "Cost per unit.", - "example": "250" - }, - "symbol": { - "type": "string", - "description": "Trading symbol for the order", - "example": "ETH:USDT" - }, - "canceled": { - "type": "string", - "description": "Canceled status true or false.", - "example": "ACTIVE" - }, - "pending": { - "type": "string", - "description": "Pending status true or false.", - "example": "ACTIVE" - } - } - }, - "getPendingWithdrawalsPayload":{ - "type":"object", - "properties":{ - "nonce": { - "type": "string", - "description": "This nonce is used to provide the time until which this nonce is valid. It is presented as seconds since epoch.", - "example": "1579901055.575" - }, - "signature": { - "type": "string", - "description": "The signature obtained by signing the nonce with your private ethereum key.", - "example": "0x494a2c166f95518dcf5a9484fcb702a454382f281f96ba41639fe3a2af279fdc1e3b4e5aa2f585a9a40fb5aaabf10b5390ed5592d502c7799a261f81219491f001" - }, - "token":{ - "type":"string", - "description":"The token that will be withdrawn.", - "example":"ETH" - } - }, - "required":[ - "nonce", - "signature" - ] - }, - "getUserConfPayload":{ - "type":"object", - "properties":{ - "nonce":{ - "type":"string", - "description":"A user generated nonce.", - "example": "1579901055.575" - }, - "signature":{ - "type":"string", - "description":"The signed hash (signature) received during the pre-registration process.", - "example":"0x494a2c166f95518dcf5a9484fcb702a454382f281f96ba41639fe3a2af279fdc1e3b4e5aa2f585a9a40fb5aaabf10b5390ed5592d502c7799a261f81219491f001" - } - }, - "required":[ - "nonce", - "signature" - ] - }, - "getUserConfResponse":{ - "type":"object", - "properties":{ - "DVF":{ - "type":"object", - "description":"This contains application configuration details to set up for deposits and trading.", - "example":{ - "defaultFeeRate":0.002, - "deversifiAddress":"0x9ab450355b4ab504cbc0e4de484781dac08e6a26", - "starkExContractAddress":"0xF3731d0cdC9834f6F32104580bD226EF1bc1A9F9", - "exchangeSymbols":"[\"tETHUSD\",\"tZRXUSD\",\"tZRXETH\"]", - "tempStarkVaultId":1 - }, - "properties":{ - "defaultFeeRate":{ - "type":"number", - "description":"The default fee rate, if no volume or maker discount." - }, - "deversifiAddress":{ - "type":"string", - "description":"The address of the rhino.fi exchange." - }, - "starkExContractAddress":{ - "type":"string", - "description":"Stark deposit contract address." - }, - "exchangeSymbols":{ - "type":"string", - "description":"Currency pairs available at the rhino.fi exchange for trading" - }, - "tempStarkVaultId":{ - "type":"number", - "description":"Transit Stark vault ID used for deposit privacy" - } - } - }, - "tokenRegistry":{ - "type":"object", - "description": "Detailed information related to each available token." - }, - "isRegistered":{ - "type":"string", - "description":"Registration status.", - "example":"true" - }, - "ethAddress":{ - "type":"string", - "description":"Ethereum address.", - "example":"0x278ff3bb25c5b1bb7032e822661974479280fa74" - } - } - }, - "getWithdrawalPayload":{ - "type":"object", - "properties":{ - "withdrawalId":{ - "type":"string", - "description":"Used to identify a specific withdrawal.", - "example":"1a2b3c" - }, - "nonce":{ - "type":"string", - "description":"This nonce is used to provide the time until which this nonce is valid. It is presented as seconds since epoch.", - "example": "1579901055.575" - }, - "signature":{ - "type":"string", - "description":"The signature obtained by signing the nonce with your private ethereum key.", - "example":"0x494a2c166f95518dcf5a9484fcb702a454382f281f96ba41639fe3a2af279fdc1e3b4e5aa2f585a9a40fb5aaabf10b5390ed5592d502c7799a261f81219491f001" - } - }, - "required":[ - "withdrawalId", - "nonce", - "signature" - ] - }, - "getWithdrawalResponse":{ - "type":"object", - "properties":{ - "_id":{ - "type":"string", - "example":"53cb6b9b4f4ddef1ad47f943" - }, - "ethAddress":{ - "type":"string", - "description":"Ethereum public address of the user.", - "example":"0x14d06788090769f669427b6aea1c0240d2321f34" - }, - "starkKey":{ - "type":"string", - "description":"The Stark public key of the user.", - "example":"77a3b314db07c45076d11f62b6f9e748a39790441823307743cf00d6597ea43" - }, - "token":{ - "type":"string", - "description":"The token that was withdrawn.", - "example":"USDT" - }, - "amount":{ - "type":"number", - "description":"The amount that was withdrawn.", - "example":100 - }, - "createdAt":{ - "type":"string", - "description":"The date and time of the withdrawal.", - "example":"2020-01-29T14:13:05.898Z" - } - } - }, - "openOrdersPayload": { - "type": "object", - "properties": { - "nonce": { - "type": "string", - "description": "This nonce is used to provide the time until which this nonce is valid. It is presented as seconds since epoch.", - "example": "1579901055.575" - }, - "signature": { - "type": "string", - "description": "The signature obtained by signing the nonce with your private ethereum key.", - "example": "0x494a2c166f95518dcf5a9484fcb702a454382f281f96ba41639fe3a2af279fdc1e3b4e5aa2f585a9a40fb5aaabf10b5390ed5592d502c7799a261f81219491f001" - }, - "symbol": { - "type": "string", - "description": "Specifies the trading pair.", - "example": "ETH:USD" - } - }, - "required": ["nonce", "signature"] - }, - "openOrdersObject": { - "type": "object", - "properties": { - "_id": { - "type": "string", - "description": "Id for the order. This can be used for orderId when calling cancelOrder or getOrder", - "example": "L1tarX5wUem" - }, - "type": { - "type": "string", - "description": "Type of the order. Currently, \"EXCHANGE LIMIT\" is the only type that is supported.", - "example": "EXCHANGE LIMIT" - }, - "pair": { - "type": "string", - "description": "The trading pair that was used for this order.", - "example": "ETHUSD" - }, - "amount": { - "type": "number", - "description": "Actual order amount.", - "example": "-0.5" - }, - "totalFilled": { - "type": "number", - "description": "Total of all fills executed.", - "example": "-0.5" - }, - "price": { - "type": "number", - "description": "Cost per unit.", - "example": "250" - }, - "status": { - "type": "string", - "description": "The status of the order.", - "example": "CANCELED" - }, - "mtsTIF": { - "type": "number", - "description": "Milliseconds till order expires.", - "example": "250" - }, - "id": { "type": "string", "example": "1151079509" }, - "created_at": { - "type": "string", - "description": "The date and time when the order was created.", - "example": "2018-07-21 16:15:58" - }, - "updated_at": { - "type": "string", - "description": "The date and time when the order was last updated.", - "example": "2018-07-23 19:52:51" - } - } - }, - "openOrdersResponse": { - "type": "array", - "items": { - "type": "object", - "properties": { - "_id": { - "type": "string", - "description": "Id for the order. This can be used for orderId when calling cancelOrder or getOrder", - "example": "L1tarX5wUem" - }, - "type": { - "type": "string", - "description": "Type of the order. Currently, \"EXCHANGE LIMIT\" is the only type that is supported.", - "example": "EXCHANGE LIMIT" - }, - "pair": { - "type": "string", - "description": "The trading pair that was used for this order.", - "example": "ETHUSD" - }, - "amount": { - "type": "number", - "description": "Actual order amount.", - "example": "-0.5" - }, - "totalFilled": { - "type": "number", - "description": "Total of all fills executed.", - "example": "-0.5" - }, - "price": { - "type": "number", - "description": "Cost per unit.", - "example": "250" - }, - "status": { - "type": "string", - "description": "The status of the order.", - "example": "CANCELED" - }, - "mtsTIF": { - "type": "number", - "description": "Milliseconds till order expires.", - "example": "250" - }, - "id": { "type": "string", "example": "1151079509" }, - "created_at": { - "type": "string", - "description": "The date and time when the order was created.", - "example": "2018-07-21 16:15:58" - }, - "updated_at": { - "type": "string", - "description": "The date and time when the order was last updated.", - "example": "2018-07-23 19:52:51" - } - } - } - }, - "orderHistoryPayload": { - "type": "object", - "properties": { - "nonce": { - "type": "string", - "description": "This nonce is used to provide the time until which this nonce is valid. It is presented as seconds since epoch.", - "example": "1579901055.575" - }, - "signature": { - "type": "string", - "description": "The signature obtained by signing the nonce with your private ethereum key.", - "example": "0x494a2c166f95518dcf5a9484fcb702a454382f281f96ba41639fe3a2af279fdc1e3b4e5aa2f585a9a40fb5aaabf10b5390ed5592d502c7799a261f81219491f001" - }, - "symbol": { - "type": "string", - "description": "Specifies the trading pair.", - "example": "ETH:USD" - } - }, - "required": ["nonce", "signature"] - }, - "meta": { - "type": "object", - "description": "Contains metadata $F15 and auth.", - "properties": { - "orderId": { - "type": "string", - "description": "Id for the order. This can be used for orderId when calling cancelOrder or getOrder", - "example": "L1tarX5wUem" - }, - "auth": { - "type": "string", - "example": "0x97ebb3391b30f495ce8cb97857db9b72d3e9dbcb" - }, - "user": { - "type": "string", - "example": "0x97ebb3391b30f495ce8cb97857db9b72d3e9dbcb" - } - } - }, - "orderHistoryResponse": { - "type": "object", - "properties": { - "_id": { - "type": "string", - "description": "Order Id, this can be used as orderId when calling cancelOrder or getOrder.", - "example": "L1tarX5wUem" - }, - "user": { - "type": "string", - "description": "Ethereum address of the user.", - "example": "0x341e46a49f15785373ede443df0220dea6a41bbc" - }, - "symbol": { - "type": "string", - "description": "The trading pair symbol for this order.", - "example": "ZRX:ETH" - }, - "amount": { - "type": "number", - "description": "Original order size placed.", - "example": "50" - }, - "totalFilled": { - "type": "number", - "description": "Total of all fills executed.", - "example": "50" - }, - "tokenBuy": { - "type": "string", - "description": "Token being bought as part of this exchange order.", - "example": "ETH" - }, - "totalBought": { - "type": "number", - "description": "Total tokens bought, in quantized units.", - "example": "4990000000" - }, - "tokenSell": { - "type": "string", - "description": "Token being sold as part of this exchange order.", - "example": "ETH" - }, - "totalSold": { - "type": "number", - "description": "Total tokens sold, in quantized units.", - "example": "45555500" - }, - "type": { - "type": "string", - "description": "Type of the order. Currently, \"EXCHANGE LIMIT\" is the only type that is supported.", - "example": "EXCHANGE LIMIT" - }, - "price": { - "type": "number", - "description": "Cost per unit.", - "example": "0.01" - }, - "averagePrice": { - "type": "number", - "description": "Average price at which the order has been settled.", - "example": "0.0091111" - }, - "feeRate": { - "type": "number", - "description": "The max fee rate applicable for the order.", - "example": "0.002" - }, - "createdAt": { - "type": "string", - "description": "The date and time when the order was created.", - "example": "2020-05-13T14:11:02.205+00:002018-07-21 16:15:58" - }, - "updatedAt": { - "type": "string", - "description": "The date and time when the order was last updated.", - "example": "2020-05-13T14:13:10.403+00:00" - }, - "activatedAt": { - "type": "string", - "description": "The date and time when the order was activated.", - "example": "2020-05-13T14:11:03.000+00:00" - } - } - }, - "cancelOrderPayload":{ - "type":"object", - "properties":{ - "orderId":{ - "type":"string", - "description":"The order ID.", - "example":"d7c8b9" - }, - "cid": { - "type": "string", - "description": "An optional user-defined identifier for this order", - "example": "satoshi-order-2083236893" - }, - "nonce": { - "type": "string", - "description": "This nonce is used to provide the time until which this nonce is valid. It is presented as seconds since epoch.", - "example": "1579901055.575" - }, - "signature":{ - "type":"string", - "description":"The signed hash (signature) received during the pre-registration process.", - "example":"0x0277b6e85ffdfb8cdc34c89b8b60c42a1a96a57e1b528ca3ff203b2dac8c9a200dbedd5ab8d2ed7ef19e915daf00327db91c1f5a1988666089e6b8420881699501" - } - }, - "required":[ - "orderId", - "nonce", - "signature" - ] - }, - "cancelOrderResponse":{ - "type":"object", - "properties":{ - "orderId":{ - "type":"string", - "description":"The order ID.", - "example":"d7c8b9" - }, - "canceled":{ - "type":"boolean", - "description":"only if order is already canceled", - "example":true - } - } - }, - "cancelWithdrawalPayload":{ - "type":"object", - "properties":{ - "id":{ - "type":"string", - "description":"The withdrawal ID.", - "example":"q7w8e9" - }, - "nonce": { - "type": "string", - "description": "This nonce is used to provide the time until which this nonce is valid. It is presented as seconds since epoch.", - "example": "1579901055.575" - }, - "signature":{ - "type":"string", - "description":"The signed hash (signature) received during the pre-registration process.", - "example":"0x0277b6e85ffdfb8cdc34c89b8b60c42a1a96a57e1b528ca3ff203b2dac8c9a200dbedd5ab8d2ed7ef19e915daf00327db91c1f5a1988666089e6b8420881699501" - } - }, - "required":[ - "id" - ] - }, - "cancelWithdrawalResponse":{ - "type":"object", - "properties":{ - "_id":{ - "type":"string", - "description":"The withdrawal ID.", - "example":"q7w8e9" - }, - "token":{ - "type":"string", - "description":"The token for which the withdrawal was requested.", - "example":"USDT" - }, - "amount":{ - "type":"number", - "description":"The withdrawal amount.", - "example":1 - }, - "createdAt":{ - "type":"string", - "description":"The date and time of the withdrawal.", - "example":"2020-01-01T22:57:47.323Z" - }, - "readyToWithdrawOnChain":{ - "type":"bool", - "description":"IF the withdrawal is ready to be requested.", - "example":false - }, - "canceled": { - "type": "string", - "description": "Canceled status.", - "example": true - } - } - }, - "starkPublicKey":{ - "type":"object", - "description":"The Stark public key. Both the \"x\" and \"y\" part are required.", - "example":{ - "x":"6d840e6d0ecfcbcfa83c0f704439e16c69383d93f51427feb9a4f2d21fbe075", - "y":"58f7ce5eb6eb5bd24f70394622b1f4d2c54ebca317a3e61bf9f349dccf166cf" - }, - "properties":{ - "x":{ - "type":"string", - "description":"The \"x\" part of the Stark public key." - }, - "y":{ - "type":"string", - "description":"The \"y\" part of the Stark public key." - } - } - }, - "starkSignature":{ - "type":"object", - "description":"Stark signature consisting of consisting of \"r\", \"s\" and the recovery parameter.", - "example":{ - "r":"1f38f551d798562c16d28733c7e3ff6850898d82f0ac9ccd39d373303b1778c", - "s":"518560420e52a37e9f580f024fc0fe8572cb2f5437a839075bbf4b2b123d572", - "recoveryParam":1 - }, - "properties":{ - "r":{ - "type":"string", - "description":"The \"r\" part of the Stark signature." - }, - "s":{ - "type":"string", - "description":"The \"s\" part of the Stark signature." - }, - "recoveryParam":{ - "type":"number", - "description":"The recovery parameter of the Stark signature." - } - } - }, - "depositPayload":{ - "type":"object", - "properties":{ - "nonce": { - "type": "string", - "description": "This nonce is used to provide the time until which this nonce is valid. It is presented as seconds since epoch.", - "example": "1579901055.575", - "required":true - }, - "token":{ - "type":"string", - "description":"The token for which the deposit was made.", - "example":"ZRX" - }, - "amount":{ - "type":"number", - "description":"The deposit amount.", - "example":1 - }, - "starkPublicKey":{ - "type":"object", - "description":"The Stark public key. Both the \"x\" and \"y\" part are required.", - "example":{ - "x":"6d840e6d0ecfcbcfa83c0f704439e16c69383d93f51427feb9a4f2d21fbe075", - "y":"58f7ce5eb6eb5bd24f70394622b1f4d2c54ebca317a3e61bf9f349dccf166cf" - }, - "properties":{ - "x":{ - "type":"string", - "description":"The \"x\" part of the Stark public key." - }, - "y":{ - "type":"string", - "description":"The \"y\" part of the Stark public key." - } - } - }, - "starkSignature":{ - "type":"object", - "description":"Stark signature consisting of consisting of \"r\", \"s\" and the recovery parameter.", - "example":{ - "r":"1f38f551d798562c16d28733c7e3ff6850898d82f0ac9ccd39d373303b1778c", - "s":"518560420e52a37e9f580f024fc0fe8572cb2f5437a839075bbf4b2b123d572", - "recoveryParam":1 - }, - "properties":{ - "r":{ - "type":"string", - "description":"The \"r\" part of the Stark signature." - }, - "s":{ - "type":"string", - "description":"The \"s\" part of the Stark signature." - }, - "recoveryParam":{ - "type":"number", - "description":"The recovery parameter of the Stark signature." - } - } - }, - "starkVaultId":{ - "type":"number", - "description":"The Stark vault ID.", - "example":1000003 - }, - "expireTime":{ - "type":"number", - "example": 1 - } - }, - "required":[ - "token", - "amount", - "nonce", - "starkPublicKey", - "starkSignature", - "starkVaultId", - "expireTime" - ] - }, - "depositResponse":{ - "type":"object", - "properties":{ - "isPostedOffchain":{ - "type":"boolean", - "description":"Flag to indicate if the deposit was posted off chain.", - "example":false - }, - "isConfirmedOnChain":{ - "type":"boolean", - "description":"Flag to indicate if the deposit was confirmed off chain.", - "example":true - }, - "_id":{ - "type":"string", - "example":"5e335f88bdcd70001e52d0a7" - }, - "starkVaultId":{ - "type":"number", - "description":"The Stark vault ID.", - "example":1000003 - }, - "starkKey":{ - "type":"string", - "description":"The Stark public key.", - "example":"6d840e6d0ecfcbcfa83c0f704439e16c69383d93f51427feb9a4f2d21fbe075" - }, - "starkMessage":{ - "type":"string", - "description":"Stark Message ID.", - "example":"1d980821dab7adf8f422a4754b031585e663bb1f70d8adb550cde8a628fdbbb" - }, - "starkSignature":{ - "$ref":"#/definitions/starkSignature" - }, - "starkTokenId":{ - "type":"string", - "description":"The Stark token ID.", - "example":"0x3" - }, - "amount":{ - "type":"number", - "description":"The amount that was deposited.", - "example":1 - }, - "ethAddress":{ - "type":"string", - "description":"Ethereum public address of the user.", - "example":"0x341e46a49f15785373ede443df0220dea6a41bbc" - }, - "createdAt":{ - "type":"string", - "description":"The date and time of the deposit.", - "example":"2020-01-30T22:58:16.720Z" - } - }, - "required":[ - "starkSignature" - ] - }, - "registerPayload":{ - "type":"object", - "properties":{ - "starkKey":{ - "type":"string", - "description":"The Stark public key.", - "example":"6d840e6d0ecfcbcfa83c0f704439e16c69383d93f51427feb9a4f2d21fbe075" - }, - "nonce":{ - "type":"string", - "description":"A user generated nonce.", - "example":"1579783140.807" - }, - "signature":{ - "type":"string", - "description":"The signed hash (signature) received during the pre-registration process.", - "example":"0x7e83e5fb1eb382d06906efa984a1cbf9c7a5bd301cbbbfa68d5d23624f9d301358329465291f5b72a9680687badf8f01a474193bd738add3d89e8d7e0e034b2b00" - } - }, - "required":[ - "starkKey", - "nonce", - "signature" - ] - }, - "registerResponse":{ - "type":"object", - "properties":{ - "DVF":{ - "type":"object", - "description":"This contains application configuration details to set up for deposits and trading.", - "example":{ - "defaultFeeRate":0.002, - "deversifiAddress":"0x9ab450355b4ab504cbc0e4de484781dac08e6a26", - "starkExContractAddress":"0xF3731d0cdC9834f6F32104580bD226EF1bc1A9F9", - "exchangeSymbols":"[\"tETHUSD\",\"tZRXUSD\",\"tZRXETH\"]", - "tempStarkVaultId":1 - }, - "properties":{ - "defaultFeeRate":{ - "type":"number", - "description":"The default fee rate, if no volume or maker discount." - }, - "deversifiAddress":{ - "type":"string", - "description":"The address of the rhino.fi exchange." - }, - "starkExContractAddress":{ - "type":"string", - "description":"Stark deposit contract address." - }, - "exchangeSymbols":{ - "type":"string", - "description":"Currency pairs available at the rhino.fi exchange for trading" - }, - "tempStarkVaultId":{ - "type":"number", - "description":"Transit Stark vault ID used for deposit privacy" - } - } - }, - "tokenRegistry":{ - "type":"object", - "description": "Detailed information related to each available token." - }, - "isRegistered":{ - "type":"string", - "description":"Registration status.", - "example":"true" - }, - "ethAddress":{ - "type":"string", - "description":"Ethereum address.", - "example":"0x278ff3bb25c5b1bb7032e822661974479280fa74" - }, - "deFiSignature":{ - "type":"string", - "description":"rhino.fi Signature", - "example":"0x0277b6e85ffdfb8cdc34c89b8d7ef19e915daf00327db91c1f5a1988666089e6b8420881699501" - } - } - }, - "starkOrder": { - "type": "object", - "description": "Stark order related meta information.", - "properties": { - "vaultIdSell": { - "type": "number", - "description": "The vault ID of the seller." - }, - "vaultIdBuy": { - "type": "number", - "description": "The vault ID of the buyer." - }, - "amountSell": { - "type": "string", - "description": "The total amount to be sold." - }, - "amountBuy": { - "type": "string", - "description": "The total amount to be bought." - }, - "tokenSell": { - "type": "string", - "description": "The Stark token ID for the token being sold." - }, - "tokenBuy": { - "type": "string", - "description": "The Stark token ID for the token being bought." - }, - "nonce": { "type": "number", "description": "Nonce value." }, - "expirationTimestamp": { - "type": "number", - "description": "Expiration timestamp of the order." - } - } - }, - "submitOrderMeta": { - "type": "object", - "description": "A set of meta values.", - "example": { - "starkOrder": { - "vaultIdSell": 1000002, - "vaultIdBuy": 1000001, - "amountSell": "97400000", - "amountBuy": "100000000000000000", - "tokenSell": "0x2", - "tokenBuy": "0x1", - "nonce": 0, - "expirationTimestamp": 438947 - }, - "starkMessage": "597f31e19f2273413833ed1408edd7a2c60e9f82422852a1be7d11049be3268", - "ethAddress": "0x341E46a49F15785373edE443Df0220DEa6a41Bbc", - "starkPublicKey": { - "x": "6d840e6d0ecfcbcfa83c0f704439e16c69383d93f51427feb9a4f2d21fbe075", - "y": "58f7ce5eb6eb5bd24f70394622b1f4d2c54ebca317a3e61bf9f349dccf166cf" - }, - "starkSignature": { - "r": "5d14357fcf8f489218de0855267c6f64bc463135debf62680ad796e63cd6d3b", - "s": "786ab874d91e3a5871134955fcb768914754760a0ada326af67f758f32819cf", - "recoveryParam": 0 - } - }, - "properties": { - "starkOrder": { "$ref": "#/definitions/starkOrder" }, - "starkMessage": { - "type": "string", - "description": "Stark Message ID." - }, - "ethAddress": { - "type": "string", - "description": "The Ethereum public address." - }, - "starkPublicKey": { - "type":"object", - "description": "Detailed information related to each available token." - }, - "starkSignature": { - "type":"object", - "description": "Detailed information related to each available token." - } - } - }, - "submitOrderPayload": { - "type": "object", - "properties": { - "cid": { - "type": "string", - "description": "Optional custom order ID that could be set when placing order and used later to retrieve order. This ID is unique per user (user A and B can each have an order with cid = AAA, but the same user cannot have two orders with the same cid)", - "example": "long-123" - }, - "gid": { "type": "string" }, - "type": { - "type": "string", - "description": "The type of order. Currently only “EXCHANGE_LIMIT” is accepted.", - "example": "EXCHANGE LIMIT", - "enum": [ - "EXCHANGE LIMIT", - "exchange limit", - "EXCHANGE MARKET", - "exchange market" - ] - }, - "symbol": { - "type": "string", - "description": "The trading pair.", - "example": "ETH:USDT" - }, - "amount": { - "type": "number", - "description": "The token amount to be traded.", - "example": 0.1 - }, - "price": { - "type": "number", - "description": "The cost per unit.", - "example": 1000 - }, - "meta": { - "type": "object", - "description": "A set of meta values.", - "example": { - "starkOrder": { - "vaultIdSell": 1000002, - "vaultIdBuy": 1000001, - "amountSell": "97400000", - "amountBuy": "100000000000000000", - "tokenSell": "0x2", - "tokenBuy": "0x1", - "nonce": 0, - "expirationTimestamp": 438947 - }, - "starkMessage": "597f31e19f2273413833ed1408edd7a2c60e9f82422852a1be7d11049be3268", - "ethAddress": "0x341E46a49F15785373edE443Df0220DEa6a41Bbc", - "starkPublicKey": { - "x": "6d840e6d0ecfcbcfa83c0f704439e16c69383d93f51427feb9a4f2d21fbe075", - "y": "58f7ce5eb6eb5bd24f70394622b1f4d2c54ebca317a3e61bf9f349dccf166cf" - }, - "starkSignature": { - "r": "5d14357fcf8f489218de0855267c6f64bc463135debf62680ad796e63cd6d3b", - "s": "786ab874d91e3a5871134955fcb768914754760a0ada326af67f758f32819cf", - "recoveryParam": 0 - } - }, - "properties": { - "starkOrder": { "$ref": "#/definitions/starkOrder" }, - "starkMessage": { - "type": "string", - "description": "Stark Message ID." - }, - "ethAddress": { - "type": "string", - "description": "The Ethereum public address." - }, - "starkPublicKey": { - "type":"object", - "description": "Detailed information related to each available token." - }, - "starkSignature": { - "type":"object", - "description": "Detailed information related to each available token." - } - } - }, - "protocol": { "type": "string", "enum": ["stark"] }, - "partnerId": { "type": "string" }, - "feeRate": { "type": "string", "example": 0.1 } - }, - "required": ["type", "symbol", "amount", "price", "meta"] - }, - "submitOrderResponse": { - "type": "object", - "properties": { - "_id": { - "type": "string", - "description": "Id for the order. This can be used for orderId when calling cancelOrder or getOrder", - "example": "L1tarX5wUem" - }, - "user": { - "type": "string", - "description": "Ethereum address of the user", - "example": "E0xc1caf2d76c49e4a60635635c329a3ac22ddeb547" - }, - "symbol": { - "type": "string", - "description": "Trading symbol for the order", - "example": "ETH:USDT" - }, - "tokenSell": { - "type": "string", - "description": "The token which is being sold", - "example": "ETH" - }, - "tokenBuy": { - "type": "string", - "description": "The token which is being bought", - "example": "USDT" - }, - "amount": { - "type": "number", - "description": "Original order size placed being sold or bought.", - "example": "-0.5" - }, - "price": { - "type": "number", - "description": "Cost per unit.", - "example": "200" - }, - "type": { - "type": "string", - "description": "Type of the order. Currently, \"EXCHANGE LIMIT\" is the only type that is supported.", - "example": "EXCHANGE LIMIT" - }, - "createdAt": { - "type": "string", - "description": "The date and time when the order was created.", - "example": "2020-05-09T18:29:56.603Z" - }, - "updatedAt": { - "type": "string", - "description": "The date and time when the order was last updated.", - "example": "2020-05-09T18:29:56.945Z" - }, - "activatedAt": { - "type": "string", - "description": "The date and time when the order was activated.", - "example": "2020-05-09T18:29:56.944Z" - } - } - }, - "withdrawalPayload":{ - "type":"object", - "properties":{ - "token":{ - "type":"string", - "description":"The token for which the withdrawal is requested.", - "example":"ZRX" - }, - "amount":{ - "type":"number", - "description":"The withdrawal amount.", - "example":1 - }, - "nonce":{ - "type":"number", - "description": "This nonce which used to provide the time until which this nonce is valid. It is presented as seconds since epoch.", - "example": 1579901055.575 - }, - "starkPublicKey":{ - "type":"object", - "description":"The Stark public key. Both the \"x\" and \"y\" part are required.", - "example":{ - "x":"6d840e6d0ecfcbcfa83c0f704439e16c69383d93f51427feb9a4f2d21fbe075", - "y":"58f7ce5eb6eb5bd24f70394622b1f4d2c54ebca317a3e61bf9f349dccf166cf" - }, - "properties":{ - "x":{ - "type":"string", - "description":"The \"x\" part of the Stark public key." - }, - "y":{ - "type":"string", - "description":"The \"y\" part of the Stark public key." - } - } - }, - "starkSignature":{ - "type":"object", - "description":"Stark signature consisting of consisting of \"r\", \"s\" and the recovery parameter.", - "example":{ - "r":"1f38f551d798562c16d28733c7e3ff6850898d82f0ac9ccd39d373303b1778c", - "s":"518560420e52a37e9f580f024fc0fe8572cb2f5437a839075bbf4b2b123d572", - "recoveryParam":1 - }, - "properties":{ - "r":{ - "type":"string", - "description":"The \"r\" part of the Stark signature." - }, - "s":{ - "type":"string", - "description":"The \"s\" part of the Stark signature." - }, - "recoveryParam":{ - "type":"number", - "description":"The recovery parameter of the Stark signature." - } - } - }, - "starkVaultId":{ - "type":"number", - "description":"The Stark vault ID.", - "example":1000003 - }, - "expireTime":{ - "type":"number", - "example": 442438 - } - }, - "required":[ - "token", - "amount", - "nonce", - "starkPublicKey", - "starkSignature", - "starkVaultId", - "expireTime" - ] - }, - "getGasPriceResponse": { - "type":"object", - "properties":{ - "fast":{ - "type":"number", - "description":"Gas price in Wei for quickest onchain transaction confirmation.", - "example":70000000000 - }, - "average":{ - "type":"number", - "description":"Average gas price in Wei for average onchain transaction speed.", - "example":67000000000 - }, - "cheap":{ - "type":"number", - "description":"Low gas price in Wei and very slow transaction speed.", - "example":66000000000 - }, - "fastWait":{ - "type":"number", - "description":"The approximate time for a transaction confirmation when using fast as the gas price.", - "example":0.5 - }, - "averageWait":{ - "type":"number", - "description":"The approximate time for a transaction confirmation when using average as the gas price.", - "example":1.4 - }, - "cheapWait":{ - "type":"number", - "description":"The approximate time for a transaction confirmation when using cheap as the gas price.", - "example":10.5 - } - } - }, - "tradesResponse":{ - "type":"object", - "properties":{ - "trade_id":{ - "type":"number", - "description":"A unique ID associated with the trade for the currency pair transaction", - "example":1 - }, - "price":{ - "type":"number", - "description":"Last transacted price of base currency based on given quote currency.", - "example":275.23 - }, - "base_volume":{ - "type":"number", - "description":"Transaction amount in BASE currency.", - "example":1.5 - }, - "quote_volume":{ - "type":"number", - "description":"Transaction amount in QUOTE currency.", - "example":347.81 - }, - "timestamp":{ - "type":"number", - "description":"Unix timestamp in milliseconds for when the transaction occurred.", - "example":1548028800 - }, - "type":{ - "type":"number", - "description":"Used to determine whether or not the transaction originated as a buy or sell.", - "example":"buy" - } - } - }, - "permissionsResponse": { - "type": "object", - "properties": { - "balances": { - "type": "boolean", - "description": "is balances authorized" - }, - "tradingHistory": { - "type": "boolean", - "description": "is trading history authorized" - } - } - }, - "Model3": { - "type": "object", - "properties": { - "fillId": { - "type": "string", - "description": "Unique identifier representing the fill event", - "example": "606f207fc7aa2e91d028a17a" - }, - "orderId": { - "type": "string", - "description": "Unique identifier of the order associated with the fill", - "example": "BtHEvgY1Bz1" - }, - "symbol": { - "type": "string", - "description": "Symbol for the order associated with the fill", - "example": "ETH:USDT" - }, - "price": { - "type": "number", - "description": "Execution price of the fill", - "example": 209.9 - }, - "fillAmount": { - "type": "number", - "description": "Amount filled (negative amount for a sell event, positive for a buy event)", - "example": -0.125622 - }, - "orderAmount": { - "type": "number", - "description": "Initial amount for the placed order associated with the fill", - "example": -1 - }, - "date": { - "type": "string", - "format": "date", - "description": "Date and time of the fill event", - "example": "2020-11-11T16:37:05.957" - }, - "orderCreationDate": { - "type": "string", - "format": "date", - "description": "Date and time at which the order associated with the fill event was placed", - "example": "2020-11-11T16:37:05.262Z" - }, - "orderType": { - "type": "string", - "description": "Type of the order associated with the fill event", - "example": true, - "enum": [ - "EXCHANGE LIMIT", - "EXCHANGE MARKET" - ] - }, - "orderActive": { - "type": "boolean", - "description": "Whether the order associated with the fill event is still active", - "example": true - }, - "orderCanceled": { - "type": "boolean", - "description": "Whether the order associated with the fill event was canceled", - "example": false - } - } - }, - "Model4": { - "type": "array", - "items": { - "$ref": "#/definitions/Model3" - } - }, - "getFillsResponse": { - "type": "object", - "properties": { - "pagination": { - "$ref": "#/definitions/pagination" - }, - "items": { - "$ref": "#/definitions/Model4" - } - } - }, - "pagination": { - "type": "object", - "properties": { - "totalItems": { - "type": "number", - "description": "Total number of items matching the query", - "example": 1559, - "minimum": 0 - }, - "limit": { - "type": "number", - "description": "Limit applied on returned items", - "example": 5 - }, - "skip": { - "type": "number", - "description": "Skip applied on returned items", - "example": 2 - } - } - }, - "permissionsPayload": { - "type": "object", - "properties": { - "nonce": { - "type": "string", - "description": "This nonce which used to provide the time until which this nonce is valid. It is presented as seconds since epoch.", - "example": "1776156902.058" - }, - "signature": { - "type": "string", - "description": "The signature obtained by signing the nonce with your private ethereum key.", - "example": "0x0277b6e85ffdfb8cdc34c89b8b60c42a1a96a57e1b528ca3ff203b2dac8c9a200dbedd5ab8d2ed7ef19e915daf00327db91c1f5a1988666089e6b8420881699501" - }, - "key": { - "type": "string", - "description": "The permission key to change the access for", - "example": "balances" - }, - "value": { - "type": "boolean", - "description": "Whether to allow public access to the endpoints driven by provided permission", - "example": true - } - } - }, - "transferPayload": { - "type": "object", - "properties": { - "tx": { - "type": "object", - "description": "StarkWare TransferRequest for main transfer", - "example": { - "type": "TransferRequest", - "amount": "100", - "expirationTimestamp": 516578, - "nonce": 624865484, - "receiverPublicKey": "0x011869c13b32ab9b7ec84e2b31c1de58baaaa6bbb2443a33bbad8df739a6e958", - "receiverVaultId": 1478152318, - "senderPublicKey": "0x0435a5f41a1109379a143f931b6d2062623be35cc688a4f896e8689a1dd6f5c6", - "senderVaultId": 1252694399, - "signature": { - "r": "5d14357fcf8f489218de0855267c6f64bc463135debf62680ad796e63cd6d3b", - "s": "786ab874d91e3a5871134955fcb768914754760a0ada326af67f758f32819cf" - }, - "token": "0xb333e3142fe16b78628f19bb15afddaef437e72d6d7f5c6c20c6801a27fba7" - }, - "properties": { - "type": { - "type": "string", - "enum": [ - "TransferRequest" - ] - }, - "amount": { - "type": "string", - "pattern": "^[0-9]*$" - }, - "expirationTimestamp": { - "type": "integer", - "minimum": 0 - }, - "nonce": { - "type": "integer", - "minimum": 0 - }, - "receiverPublicKey": { - "type": "string", - "pattern": "^0x[a-f0-9]+$" - }, - "receiverVaultId": { - "type": "integer", - "example": 123 - }, - "senderPublicKey": { - "type": "string", - "pattern": "^0x[a-f0-9]+$" - }, - "senderVaultId": { - "type": "integer" - }, - "signature": { - "$ref": "#/definitions/signature" - }, - "token": { - "type": "string", - "pattern": "^0x[a-f0-9]+$" - } - } - }, - "feeTx": { - "type": "object", - "description": "StarkWare TansferRequest for service fee", - "example": { - "type": "TransferRequest", - "amount": "100", - "expirationTimestamp": 516578, - "nonce": 624865484, - "receiverPublicKey": "0x011869c13b32ab9b7ec84e2b31c1de58baaaa6bbb2443a33bbad8df739a6e958", - "receiverVaultId": 1478152318, - "senderPublicKey": "0x0435a5f41a1109379a143f931b6d2062623be35cc688a4f896e8689a1dd6f5c6", - "senderVaultId": 1252694399, - "signature": { - "r": "5d14357fcf8f489218de0855267c6f64bc463135debf62680ad796e63cd6d3b", - "s": "786ab874d91e3a5871134955fcb768914754760a0ada326af67f758f32819cf" - }, - "token": "0xb333e3142fe16b78628f19bb15afddaef437e72d6d7f5c6c20c6801a27fba7" - }, - "properties": { - "type": { - "type": "string", - "enum": [ - "TransferRequest" - ] - }, - "amount": { - "type": "string", - "pattern": "^[0-9]*$" - }, - "expirationTimestamp": { - "type": "integer", - "minimum": 0 - }, - "nonce": { - "type": "integer", - "minimum": 0 - }, - "receiverPublicKey": { - "type": "string", - "pattern": "^0x[a-f0-9]+$" - }, - "receiverVaultId": { - "type": "integer" - }, - "senderPublicKey": { - "type": "string", - "pattern": "^0x[a-f0-9]+$" - }, - "senderVaultId": { - "type": "integer" - }, - "signature": { - "$ref": "#/definitions/signature" - }, - "token": { - "type": "string", - "pattern": "^0x[a-f0-9]+$" - } - } - }, - "starkPublicKey": { - "$ref": "#/definitions/starkPublicKey" - }, - "memo": { - "type": "string", - "description": "Optional memo string", - "example": "my reference", - "maxLength": 42 - }, - "partnerId": { - "type": "string", - "description": "Optional partner Id string", - "example": "xxyyzz", - "maxLength": 42 - } - } - }, - "signature": { - "type": "object", - "properties": { - "r": { - "type": "string", - "pattern": "^0x[a-f0-9]+$" - }, - "s": { - "type": "string", - "pattern": "^0x[a-f0-9]+$" - } - } - } - } -} diff --git a/src/spec/tryEndpoint.js b/src/spec/tryEndpoint.js index 1bc4a3f..c51c456 100644 --- a/src/spec/tryEndpoint.js +++ b/src/spec/tryEndpoint.js @@ -1,20 +1,27 @@ +import { getExtraHeaders } from './getExtraHeaders'; +import { getParamExample } from './getParamExample'; + export async function tryEndpoint(endpoint, parameterValues, body) { try { const path = getUrl(endpoint.path, parameterValues, endpoint.parameters); + const extraHeaders = getExtraHeaders(endpoint.headers) const response = await fetch(path, { method: endpoint.method, headers: { Accept: 'application/json', 'Content-Type': 'application/json', + ...extraHeaders }, body, }); - const json = await response.json(); + const responseBody = response.headers.get('Content-Type').includes('application/json') + ? await response.json() + : await response.text() return [null, { status: response.status, statusText: response.statusText, - body: json, + body: responseBody, }]; } catch (err) { return [err]; @@ -23,7 +30,7 @@ export async function tryEndpoint(endpoint, parameterValues, body) { function getUrl(path, parameterValues, parameters) { const getParameterDefaultValue = (name) => - parameters.find((p) => p.name === name)?.['x-example']; + getParamExample(parameters.find((p) => p.name === name)) path = path.replace( /\{([^}]*)\}/g, (_, name) => parameterValues[name] ?? getParameterDefaultValue(name) @@ -32,7 +39,7 @@ function getUrl(path, parameterValues, parameters) { const formatedPath = parameters && parameters.length ? parameters.reduce((acc, current) => { - const currentExample = current['x-example']; + const currentExample = getParamExample(current); const currentValueInParameter = parameterValues[current.name]; if ( diff --git a/src/ui/Docs/DocsScreen.jsx b/src/ui/Docs/DocsScreen.jsx index 5fc9ec4..f7cc2f6 100644 --- a/src/ui/Docs/DocsScreen.jsx +++ b/src/ui/Docs/DocsScreen.jsx @@ -1,5 +1,5 @@ import React, {useState} from 'react'; -import {loadSpec} from '../../spec'; +import {loadSpecAsync} from '../../spec'; import {Sidebar} from '../common/Sidebar'; import {Breadcrumbs} from '../common/Breadcrumbs'; import {Endpoint} from './Endpoint'; @@ -9,13 +9,18 @@ import {Screen} from '../common/Screen'; import {SidebarLinks} from './SidebarLinks'; import {Content, Header, Main} from '../common/Layout/Layout'; import {TutorialsLink} from './TutorialsLink'; +import { useEffect } from 'react'; export const DocsScreen = () => { - const [spec] = useState(loadSpec); + const [spec, setSpec] = useState(null); const {sidebarLayout} = useLayout(); const [isSidebarExpanded] = sidebarLayout; + useEffect(() => { + loadSpecAsync().then(setSpec); + }, []); + return ( }> diff --git a/src/ui/Docs/TryEndpoint.jsx b/src/ui/Docs/TryEndpoint.jsx index 026edf4..8aea03d 100644 --- a/src/ui/Docs/TryEndpoint.jsx +++ b/src/ui/Docs/TryEndpoint.jsx @@ -10,6 +10,7 @@ import styled from 'styled-components'; import {useLayout} from '../common/Layout/LayoutProvider'; import {PrismCode} from './PrismCode'; import { Details } from './Details'; +import { getParamExample } from '../../spec/getParamExample'; export const TryEndpoint = ({endpoint, method}) => { const [parameterValues, setParameterValues] = useState({}); @@ -45,6 +46,8 @@ export const TryEndpoint = ({endpoint, method}) => { {endpoint.parameters.map((parameter, index) => { const {name, required, description, type} = parameter; + const example = getParamExample(parameter) + return ( { value={parameterValues[name]} onChange={value => setParameterValues(old => ({...old, [name]: value !== '' ? value : null}))} description={description} - placeholder={parameter['x-example']} + placeholder={example} /> ); })} diff --git a/src/ui/Tutorials/TutorialsSections/SmartContractsSection.jsx b/src/ui/Tutorials/TutorialsSections/SmartContractsSection.jsx index 0163674..4ebab14 100644 --- a/src/ui/Tutorials/TutorialsSections/SmartContractsSection.jsx +++ b/src/ui/Tutorials/TutorialsSections/SmartContractsSection.jsx @@ -27,7 +27,7 @@ export const SmartContractsSection = () => ( Ropsten Contracts - Exchange Contract - 0x5783323064dDa4A1ebe62defFeF46750BD2C560c
+ Exchange Contract - 0xe73a394ade4d94a073502da8703ea23490dc7b6a
diff --git a/src/ui/common/Tabs.jsx b/src/ui/common/Tabs.jsx index 95e481b..5244353 100644 --- a/src/ui/common/Tabs.jsx +++ b/src/ui/common/Tabs.jsx @@ -25,7 +25,6 @@ export const TabButton = styled.button` background: none; border: none; cursor: pointer; - text-transform: capitalize; &::after { content: ''; diff --git a/trading/js/SubmitOrder.js b/trading/js/SubmitOrder.js index 1944883..ea74c95 100644 --- a/trading/js/SubmitOrder.js +++ b/trading/js/SubmitOrder.js @@ -44,7 +44,7 @@ const payload = { "cid": "", "gid": "", "type": "EXCHANGE LIMIT", - "symbol": "ETH:USD", + "symbol": "ETH:USDT", "amount": "1", "price": 140, "meta": { diff --git a/trading/python/SubmitOrder.py b/trading/python/SubmitOrder.py index 48e6d09..dbd9d75 100644 --- a/trading/python/SubmitOrder.py +++ b/trading/python/SubmitOrder.py @@ -49,7 +49,7 @@ "cid": "", "gid": "", "type": "EXCHANGE LIMIT", - "symbol": "ETH:USD", + "symbol": "ETH:USDT", "amount": "1", "price": 140, "meta": { diff --git a/yarn.lock b/yarn.lock index 6995cbe..b01e842 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3935,6 +3935,11 @@ lodash.debounce@^4: resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168= +lodash.mapvalues@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/lodash.mapvalues/-/lodash.mapvalues-4.6.0.tgz#1bafa5005de9dd6f4f26668c30ca37230cc9689c" + integrity sha1-G6+lAF3p3W9PJmaMMMo3IwzJaJw= + lodash.memoize@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" @@ -3975,6 +3980,11 @@ lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17 resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b" integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ== +lodash@^4.17.21: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + log-symbols@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a"