Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

orionx-sdk

Package Overview
Dependencies
Maintainers
2
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

orionx-sdk - npm Package Compare versions

Comparing version 1.3.12 to 1.3.14

34

build/checkCredentials.js

@@ -1,23 +0,23 @@

'use strict';
"use strict";
require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
exports["default"] = _default;
exports.default = function () {
if (!this.credentials) (0, _throwCredentialsError2.default)('credentials');
var _credentials = this.credentials,
apiUri = _credentials.apiUri,
secretKey = _credentials.secretKey,
apiKey = _credentials.apiKey;
var _throwCredentialsError = _interopRequireDefault(require("./throwCredentialsError"));
if (!apiUri) (0, _throwCredentialsError2.default)('apiUri');
if (!apiKey) (0, _throwCredentialsError2.default)('apiKey');
if (!secretKey) (0, _throwCredentialsError2.default)('secretKey');
};
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _throwCredentialsError = require('./throwCredentialsError');
var _throwCredentialsError2 = _interopRequireDefault(_throwCredentialsError);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
if (!this.credentials) (0, _throwCredentialsError["default"])('credentials');
var _this$credentials = this.credentials,
apiUri = _this$credentials.apiUri,
secretKey = _this$credentials.secretKey,
apiKey = _this$credentials.apiKey;
if (!apiUri) (0, _throwCredentialsError["default"])('apiUri');
if (!apiKey) (0, _throwCredentialsError["default"])('apiKey');
if (!secretKey) (0, _throwCredentialsError["default"])('secretKey');
}

@@ -1,23 +0,25 @@

'use strict';
"use strict";
require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _jssha = require('jssha');
var _jssha = _interopRequireDefault(require("jssha"));
var _jssha2 = _interopRequireDefault(_jssha);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Generates a valid HMAC-SHA512 signature
exports.default = function (_ref) {
var _default = function _default(_ref) {
var body = _ref.body,
timestamp = _ref.timestamp,
secretKey = _ref.secretKey;
var shaObj = new _jssha2.default('SHA-512', 'TEXT');
var shaObj = new _jssha["default"]('SHA-512', 'TEXT');
shaObj.setHMACKey(secretKey, 'TEXT');
shaObj.update(timestamp + body);
return shaObj.getHMAC('HEX');
};
};
exports["default"] = _default;

@@ -1,41 +0,50 @@

'use strict';
"use strict";
require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = _default;
var _regenerator = require('babel-runtime/regenerator');
require("regenerator-runtime/runtime.js");
var _regenerator2 = _interopRequireDefault(_regenerator);
require("core-js/modules/es.object.to-string.js");
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
require("core-js/modules/es.promise.js");
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
require("core-js/modules/es.date.to-string.js");
var _generateSignature = require('./generateSignature');
var _generateSignature = _interopRequireDefault(require("./generateSignature"));
var _generateSignature2 = _interopRequireDefault(_generateSignature);
var _nodeFetch = _interopRequireDefault(require("node-fetch"));
var _nodeFetch = require('node-fetch');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _nodeFetch2 = _interopRequireDefault(_nodeFetch);
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
exports.default = function () {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(_ref2) {
var body = _ref2.body,
credentials = _ref2.credentials;
function _default(_x) {
return _ref2.apply(this, arguments);
}
var timestamp, signature, response, _ref3, data, errors;
function _ref2() {
_ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
var body, credentials, timestamp, signature, response, _yield$response$json, data, errors;
return _regenerator2.default.wrap(function _callee$(_context) {
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
body = _ref.body, credentials = _ref.credentials;
timestamp = new Date().getTime() / 1000;
signature = (0, _generateSignature2.default)({ body: body, timestamp: timestamp, secretKey: credentials.secretKey });
_context.prev = 2;
_context.next = 5;
return (0, _nodeFetch2.default)(credentials.apiUri, {
signature = (0, _generateSignature["default"])({
body: body,
timestamp: timestamp,
secretKey: credentials.secretKey
});
_context.prev = 3;
_context.next = 6;
return (0, _nodeFetch["default"])(credentials.apiUri, {
method: 'POST',

@@ -50,14 +59,14 @@ headers: {

case 5:
case 6:
response = _context.sent;
_context.next = 8;
_context.next = 9;
return response.json();
case 8:
_ref3 = _context.sent;
data = _ref3.data;
errors = _ref3.errors;
case 9:
_yield$response$json = _context.sent;
data = _yield$response$json.data;
errors = _yield$response$json.errors;
if (!errors) {
_context.next = 13;
_context.next = 14;
break;

@@ -68,21 +77,18 @@ }

case 13:
return _context.abrupt('return', data);
case 14:
return _context.abrupt("return", data);
case 16:
_context.prev = 16;
_context.t0 = _context['catch'](2);
case 17:
_context.prev = 17;
_context.t0 = _context["catch"](3);
throw Error(_context.t0.message);
case 19:
case 'end':
case 20:
case "end":
return _context.stop();
}
}
}, _callee, this, [[2, 16]]);
}, _callee, null, [[3, 17]]);
}));
return function (_x) {
return _ref.apply(this, arguments);
};
}();
return _ref2.apply(this, arguments);
}
"use strict";
require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = delay;
var _regenerator = require("babel-runtime/regenerator");
require("regenerator-runtime/runtime.js");
var _regenerator2 = _interopRequireDefault(_regenerator);
require("core-js/modules/es.object.to-string.js");
var _asyncToGenerator2 = require("babel-runtime/helpers/asyncToGenerator");
require("core-js/modules/es.promise.js");
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
require("core-js/modules/web.timers.js");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
var timeout = function timeout(ms) {

@@ -23,5 +28,9 @@ return new Promise(function (res) {

exports.default = function () {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
return _regenerator2.default.wrap(function _callee$(_context) {
function delay() {
return _delay.apply(this, arguments);
}
function _delay() {
_delay = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {

@@ -38,10 +47,5 @@ switch (_context.prev = _context.next) {

}
}, _callee, this);
}, _callee);
}));
function delay() {
return _ref.apply(this, arguments);
}
return delay;
}();
return _delay.apply(this, arguments);
}

@@ -1,20 +0,23 @@

'use strict';
"use strict";
require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _index = require('../index');
var _index = _interopRequireDefault(require("../index"));
var _index2 = _interopRequireDefault(_index);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
require('dotenv').config();
exports.default = function () {
_index2.default.setCredentials({
var _default = function _default() {
_index["default"].setCredentials({
apiKey: process.env.API_KEY,
secretKey: process.env.SECRET_KEY
});
};
};
exports["default"] = _default;

@@ -1,97 +0,113 @@

'use strict';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
require("core-js/modules/es.object.keys.js");
var _regenerator = require('babel-runtime/regenerator');
require("core-js/modules/es.symbol.js");
var _regenerator2 = _interopRequireDefault(_regenerator);
require("core-js/modules/es.array.filter.js");
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
require("core-js/modules/es.object.to-string.js");
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
require("core-js/modules/es.object.get-own-property-descriptor.js");
var _extends2 = require('babel-runtime/helpers/extends');
require("core-js/modules/es.array.for-each.js");
var _extends3 = _interopRequireDefault(_extends2);
require("core-js/modules/web.dom-collections.for-each.js");
var _callOrionx = require('./helpers/callOrionx');
require("core-js/modules/es.object.get-own-property-descriptors.js");
var _callOrionx2 = _interopRequireDefault(_callOrionx);
require("core-js/modules/es.object.define-properties.js");
var _setCredentials = require('./setCredentials');
require("core-js/modules/es.promise.js");
var _setCredentials2 = _interopRequireDefault(_setCredentials);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _checkCredentials = require('./checkCredentials');
require("core-js/modules/es.object.define-property.js");
var _checkCredentials2 = _interopRequireDefault(_checkCredentials);
require("regenerator-runtime/runtime.js");
var _queries = require('./queries');
var _callOrionx = _interopRequireDefault(require("./helpers/callOrionx"));
var _queries2 = _interopRequireDefault(_queries);
var _setCredentials = _interopRequireDefault(require("./setCredentials"));
var _mutations = require('./mutations');
var _checkCredentials = _interopRequireDefault(require("./checkCredentials"));
var _mutations2 = _interopRequireDefault(_mutations);
var _queries = _interopRequireDefault(require("./queries"));
var _graphqlTag = require('graphql-tag');
var _mutations = _interopRequireDefault(require("./mutations"));
var _graphqlTag2 = _interopRequireDefault(_graphqlTag);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
var Orionx = (0, _extends3.default)({
setCredentials: _setCredentials2.default,
getCredentials: function getCredentials() {
return this.credentials;
},
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
checkCredentials: _checkCredentials2.default,
graphql: function graphql(_ref) {
var _this = this;
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
var query = _ref.query,
variables = _ref.variables;
return (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
var body;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_this.checkCredentials();
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
if (query) {
_context.next = 3;
break;
}
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
throw new Error('Missing Query');
var Orionx = _objectSpread(_objectSpread({
setCredentials: _setCredentials["default"],
getCredentials: function getCredentials() {
return this.credentials;
},
checkCredentials: _checkCredentials["default"],
graphql: function graphql(_ref) {
var _this = this;
case 3:
if (variables) {
_context.next = 5;
break;
}
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
var query, variables, body;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
query = _ref.query, variables = _ref.variables;
throw new Error('Missing Variables');
_this.checkCredentials();
case 5:
body = JSON.stringify({ query: query, variables: variables });
_context.next = 8;
return (0, _callOrionx2.default)({ body: body, credentials: _this.credentials });
if (query) {
_context.next = 4;
break;
}
case 8:
return _context.abrupt('return', _context.sent);
throw new Error('Missing Query');
case 9:
case 'end':
return _context.stop();
}
}
}, _callee, _this);
}))();
}
}, _queries2.default, _mutations2.default);
exports.default = Orionx;
case 4:
if (variables) {
_context.next = 6;
break;
}
throw new Error('Missing Variables');
case 6:
body = JSON.stringify({
query: query,
variables: variables
});
_context.next = 9;
return (0, _callOrionx["default"])({
body: body,
credentials: _this.credentials
});
case 9:
return _context.abrupt("return", _context.sent);
case 10:
case "end":
return _context.stop();
}
}
}, _callee);
}))();
}
}, _queries["default"]), _mutations["default"]);
var _default = Orionx;
exports["default"] = _default;

@@ -1,62 +0,69 @@

'use strict';
"use strict";
require("core-js/modules/es.array.slice.js");
require("core-js/modules/es.object.freeze.js");
require("core-js/modules/es.object.define-properties.js");
require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
exports["default"] = _default;
var _regenerator = require('babel-runtime/regenerator');
require("regenerator-runtime/runtime.js");
var _regenerator2 = _interopRequireDefault(_regenerator);
require("core-js/modules/es.object.to-string.js");
var _taggedTemplateLiteral2 = require('babel-runtime/helpers/taggedTemplateLiteral');
require("core-js/modules/es.promise.js");
var _taggedTemplateLiteral3 = _interopRequireDefault(_taggedTemplateLiteral2);
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _templateObject;
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _templateObject = (0, _taggedTemplateLiteral3.default)(['\n\t\tmutation cancelOrder($orderId: ID) {\n\t\t\tcreatePayment(orderId: $orderId) {\n\t\t\t\t_id\n\t\t\t\ttype\n\t\t\t\tstatus\n\t\t\t}\n\t\t}\n\t'], ['\n\t\tmutation cancelOrder($orderId: ID) {\n\t\t\tcreatePayment(orderId: $orderId) {\n\t\t\t\t_id\n\t\t\t\ttype\n\t\t\t\tstatus\n\t\t\t}\n\t\t}\n\t']);
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var _graphqlTag = require('graphql-tag');
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
var _graphqlTag2 = _interopRequireDefault(_graphqlTag);
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var throwError = function throwError(param) {
throw new Error('Missing ' + param + ', try with Orionx.cancelOrder({orderId: ":orderId"})');
throw new Error("Missing ".concat(param, ", try with Orionx.cancelOrder({orderId: \":orderId\"})"));
};
exports.default = function () {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(variables) {
var query, response;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!variables.orderId) throwError('orderId');
function _default(_x) {
return _ref.apply(this, arguments);
}
query = (0, _graphqlTag2.default)(_templateObject);
_context.next = 4;
return this.graphql({
query: query,
variables: variables
});
function _ref() {
_ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(variables) {
var query, response;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!variables.orderId) throwError('orderId');
query = (0, _graphqlTag["default"])(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t\tmutation cancelOrder($orderId: ID) {\n\t\t\tcancelOrder(orderId: $orderId) {\n\t\t\t\t_id\n\t\t\t\ttype\n\t\t\t\tstatus\n\t\t\t}\n\t\t}\n\t"])));
_context.next = 4;
return this.graphql({
query: query,
variables: variables
});
case 4:
response = _context.sent;
return _context.abrupt('return', response.cancelOrder);
case 4:
response = _context.sent;
return _context.abrupt("return", response.cancelOrder);
case 6:
case 'end':
return _context.stop();
}
}
}, _callee, this);
}));
return function (_x) {
return _ref.apply(this, arguments);
};
}();
case 6:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
return _ref.apply(this, arguments);
}

@@ -1,65 +0,72 @@

'use strict';
"use strict";
require("core-js/modules/es.array.slice.js");
require("core-js/modules/es.object.freeze.js");
require("core-js/modules/es.object.define-properties.js");
require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
exports["default"] = _default;
var _regenerator = require('babel-runtime/regenerator');
require("regenerator-runtime/runtime.js");
var _regenerator2 = _interopRequireDefault(_regenerator);
require("core-js/modules/es.object.to-string.js");
var _taggedTemplateLiteral2 = require('babel-runtime/helpers/taggedTemplateLiteral');
require("core-js/modules/es.promise.js");
var _taggedTemplateLiteral3 = _interopRequireDefault(_taggedTemplateLiteral2);
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _templateObject;
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _templateObject = (0, _taggedTemplateLiteral3.default)(['\n\t\tmutation createPayment(\n\t\t\t$acceptedCurrenciesCodes: [ID]\n\t\t\t$amount: BigInt\n\t\t\t$callbackURL: String\n\t\t\t$description: String\n\t\t\t$mainCurrencyCode: ID\n\t\t\t$returnURL: String\n\t\t\t$title: String\n\t\t) {\n\t\t\tcreatePayment(\n\t\t\t\tacceptedCurrenciesCodes: $acceptedCurrenciesCodes\n\t\t\t\tamount: $amount\n\t\t\t\tcallbackURL: $callbackURL\n\t\t\t\tdescription: $description\n\t\t\t\tmainCurrencyCode: $mainCurrencyCode\n\t\t\t\treturnURL: $returnURL\n\t\t\t\ttitle: $title\n\t\t\t) {\n\t\t\t\t_id\n\t\t\t\tamount\n\t\t\t\tdescription\n\t\t\t\tmainCurrency {\n\t\t\t\t\tcode\n\t\t\t\t\tname\n\t\t\t\t}\n\t\t\t\treturnURL\n\t\t\t\tstatus\n\t\t\t\ttitle\n\t\t\t}\n\t\t}\n\t'], ['\n\t\tmutation createPayment(\n\t\t\t$acceptedCurrenciesCodes: [ID]\n\t\t\t$amount: BigInt\n\t\t\t$callbackURL: String\n\t\t\t$description: String\n\t\t\t$mainCurrencyCode: ID\n\t\t\t$returnURL: String\n\t\t\t$title: String\n\t\t) {\n\t\t\tcreatePayment(\n\t\t\t\tacceptedCurrenciesCodes: $acceptedCurrenciesCodes\n\t\t\t\tamount: $amount\n\t\t\t\tcallbackURL: $callbackURL\n\t\t\t\tdescription: $description\n\t\t\t\tmainCurrencyCode: $mainCurrencyCode\n\t\t\t\treturnURL: $returnURL\n\t\t\t\ttitle: $title\n\t\t\t) {\n\t\t\t\t_id\n\t\t\t\tamount\n\t\t\t\tdescription\n\t\t\t\tmainCurrency {\n\t\t\t\t\tcode\n\t\t\t\t\tname\n\t\t\t\t}\n\t\t\t\treturnURL\n\t\t\t\tstatus\n\t\t\t\ttitle\n\t\t\t}\n\t\t}\n\t']);
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var _graphqlTag = require('graphql-tag');
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
var _graphqlTag2 = _interopRequireDefault(_graphqlTag);
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var throwError = function throwError(param) {
throw new Error('Missing ' + param + ', try with Orionx.createPayment({acceptedCurrenciesCodes: ["BTC", "ETH"], amount: 1500, mainCurrencyCode "CLP", title: "test payment"}) method');
throw new Error("Missing ".concat(param, ", try with Orionx.createPayment({acceptedCurrenciesCodes: [\"BTC\", \"ETH\"], amount: 1500, mainCurrencyCode \"CLP\", title: \"test payment\"}) method"));
};
exports.default = function () {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(variables) {
var query, response;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!variables.acceptedCurrenciesCodes) throwError('acceptedCurrenciesCodes');
if (!variables.amount) throwError('amount');
if (!variables.mainCurrencyCode) throwError('mainCurrencyCode');
if (!variables.title) throwError('title');
function _default(_x) {
return _ref.apply(this, arguments);
}
query = (0, _graphqlTag2.default)(_templateObject);
_context.next = 7;
return this.graphql({
query: query,
variables: variables
});
function _ref() {
_ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(variables) {
var query, response;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!variables.acceptedCurrenciesCodes) throwError('acceptedCurrenciesCodes');
if (!variables.amount) throwError('amount');
if (!variables.mainCurrencyCode) throwError('mainCurrencyCode');
if (!variables.title) throwError('title');
query = (0, _graphqlTag["default"])(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t\tmutation createPayment(\n\t\t\t$acceptedCurrenciesCodes: [ID]\n\t\t\t$amount: BigInt\n\t\t\t$callbackURL: String\n\t\t\t$description: String\n\t\t\t$mainCurrencyCode: ID\n\t\t\t$returnURL: String\n\t\t\t$title: String\n\t\t) {\n\t\t\tcreatePayment(\n\t\t\t\tacceptedCurrenciesCodes: $acceptedCurrenciesCodes\n\t\t\t\tamount: $amount\n\t\t\t\tcallbackURL: $callbackURL\n\t\t\t\tdescription: $description\n\t\t\t\tmainCurrencyCode: $mainCurrencyCode\n\t\t\t\treturnURL: $returnURL\n\t\t\t\ttitle: $title\n\t\t\t) {\n\t\t\t\t_id\n\t\t\t\tamount\n\t\t\t\tdescription\n\t\t\t\tmainCurrency {\n\t\t\t\t\tcode\n\t\t\t\t\tname\n\t\t\t\t}\n\t\t\t\treturnURL\n\t\t\t\tstatus\n\t\t\t\ttitle\n\t\t\t}\n\t\t}\n\t"])));
_context.next = 7;
return this.graphql({
query: query,
variables: variables
});
case 7:
response = _context.sent;
return _context.abrupt('return', response.createPayment);
case 7:
response = _context.sent;
return _context.abrupt("return", response.createPayment);
case 9:
case 'end':
return _context.stop();
}
}
}, _callee, this);
}));
return function (_x) {
return _ref.apply(this, arguments);
};
}();
case 9:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
return _ref.apply(this, arguments);
}

@@ -1,35 +0,29 @@

'use strict';
"use strict";
require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _createPayment = require('./createPayment');
var _createPayment = _interopRequireDefault(require("./createPayment"));
var _createPayment2 = _interopRequireDefault(_createPayment);
var _cancelOrder = _interopRequireDefault(require("./cancelOrder"));
var _cancelOrder = require('./cancelOrder');
var _placeLimitOrder = _interopRequireDefault(require("./placeLimitOrder"));
var _cancelOrder2 = _interopRequireDefault(_cancelOrder);
var _placeMarketOrder = _interopRequireDefault(require("./placeMarketOrder"));
var _placeLimitOrder = require('./placeLimitOrder');
var _requestRealtimeToken = _interopRequireDefault(require("./requestRealtimeToken"));
var _placeLimitOrder2 = _interopRequireDefault(_placeLimitOrder);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _placeMarketOrder = require('./placeMarketOrder');
var _placeMarketOrder2 = _interopRequireDefault(_placeMarketOrder);
var _requestRealtimeToken = require('./requestRealtimeToken');
var _requestRealtimeToken2 = _interopRequireDefault(_requestRealtimeToken);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
cancelOrder: _cancelOrder2.default,
createPayment: _createPayment2.default,
placeLimitOrder: _placeLimitOrder2.default,
placeMarketOrder: _placeMarketOrder2.default,
requestRealtimeToken: _requestRealtimeToken2.default
};
var _default = {
cancelOrder: _cancelOrder["default"],
createPayment: _createPayment["default"],
placeLimitOrder: _placeLimitOrder["default"],
placeMarketOrder: _placeMarketOrder["default"],
requestRealtimeToken: _requestRealtimeToken["default"]
};
exports["default"] = _default;

@@ -1,69 +0,79 @@

'use strict';
"use strict";
require("core-js/modules/es.array.slice.js");
require("core-js/modules/es.object.freeze.js");
require("core-js/modules/es.object.define-properties.js");
require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
exports["default"] = _default;
var _regenerator = require('babel-runtime/regenerator');
require("regenerator-runtime/runtime.js");
var _regenerator2 = _interopRequireDefault(_regenerator);
require("core-js/modules/es.object.to-string.js");
var _taggedTemplateLiteral2 = require('babel-runtime/helpers/taggedTemplateLiteral');
require("core-js/modules/es.promise.js");
var _taggedTemplateLiteral3 = _interopRequireDefault(_taggedTemplateLiteral2);
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _templateObject;
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _templateObject = (0, _taggedTemplateLiteral3.default)(['\n\t\tmutation placeLimitOrder(\n\t\t\t$marketCode: ID\n\t\t\t$amount: BigInt\n\t\t\t$limitPrice: BigInt\n\t\t\t$sell: Boolean\n\t\t) {\n\t\t\tplaceLimitOrder(\n\t\t\t\tmarketCode: $marketCode\n\t\t\t\tamount: $amount\n\t\t\t\tlimitPrice: $limitPrice\n\t\t\t\tsell: $sell\n\t\t\t) {\n\t\t\t\t_id\n\t\t\t\ttype\n\t\t\t\tamount\n\t\t\t\tcreatedAt\n\t\t\t\tmarket {\n\t\t\t\t\tcode\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t'], ['\n\t\tmutation placeLimitOrder(\n\t\t\t$marketCode: ID\n\t\t\t$amount: BigInt\n\t\t\t$limitPrice: BigInt\n\t\t\t$sell: Boolean\n\t\t) {\n\t\t\tplaceLimitOrder(\n\t\t\t\tmarketCode: $marketCode\n\t\t\t\tamount: $amount\n\t\t\t\tlimitPrice: $limitPrice\n\t\t\t\tsell: $sell\n\t\t\t) {\n\t\t\t\t_id\n\t\t\t\ttype\n\t\t\t\tamount\n\t\t\t\tcreatedAt\n\t\t\t\tmarket {\n\t\t\t\t\tcode\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t']);
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var _graphqlTag = require('graphql-tag');
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
var _graphqlTag2 = _interopRequireDefault(_graphqlTag);
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var throwParamsError = function throwParamsError(param) {
throw new Error('Missing ' + param + ', try with Orionx.placeLimitOrder({marketCode: \':marketCode\', amount: :amount, limitPrice: :limitPrice, sell: :sell})\n Remember that the amount must be multiplied by 10^(currency units).\n ');
throw new Error("Missing ".concat(param, ", try with Orionx.placeLimitOrder({marketCode: ':marketCode', amount: :amount, limitPrice: :limitPrice, sell: :sell})\n Remember that the amount must be multiplied by 10^(currency units).\n "));
};
exports.default = function () {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(_ref2) {
var marketCode = _ref2.marketCode,
amount = _ref2.amount,
limitPrice = _ref2.limitPrice,
sell = _ref2.sell;
var query, response;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!marketCode) throwParamsError('marketCode');
if (!amount) throwParamsError('amount');
if (!amount) throwParamsError('limitPrice');
if (sell == null) throwParamsError('sell');
function _default(_x) {
return _ref2.apply(this, arguments);
}
query = (0, _graphqlTag2.default)(_templateObject);
_context.next = 7;
return this.graphql({
query: query,
variables: { marketCode: marketCode, amount: amount, limitPrice: limitPrice, sell: sell }
});
function _ref2() {
_ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
var marketCode, amount, limitPrice, sell, clientId, query, response;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
marketCode = _ref.marketCode, amount = _ref.amount, limitPrice = _ref.limitPrice, sell = _ref.sell, clientId = _ref.clientId;
if (!marketCode) throwParamsError('marketCode');
if (!amount) throwParamsError('amount');
if (!amount) throwParamsError('limitPrice');
if (sell == null) throwParamsError('sell');
query = (0, _graphqlTag["default"])(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t\tmutation placeLimitOrder(\n\t\t\t$marketCode: ID\n\t\t\t$amount: BigInt\n\t\t\t$limitPrice: BigInt\n\t\t\t$sell: Boolean\n\t\t\t$clientId: String\n\t\t) {\n\t\t\tplaceLimitOrder(\n\t\t\t\tmarketCode: $marketCode\n\t\t\t\tamount: $amount\n\t\t\t\tlimitPrice: $limitPrice\n\t\t\t\tsell: $sell\n\t\t\t\tclientId: $clientId\n\t\t\t) {\n\t\t\t\t_id\n\t\t\t\ttype\n\t\t\t\tamount\n\t\t\t\tcreatedAt\n\t\t\t\tmarket {\n\t\t\t\t\tcode\n\t\t\t\t}\n\t\t\t\tclientId\n\t\t\t}\n\t\t}\n\t"])));
_context.next = 8;
return this.graphql({
query: query,
variables: {
marketCode: marketCode,
amount: amount,
limitPrice: limitPrice,
sell: sell,
clientId: clientId
}
});
case 7:
response = _context.sent;
return _context.abrupt('return', response.placeLimitOrder);
case 8:
response = _context.sent;
return _context.abrupt("return", response.placeLimitOrder);
case 9:
case 'end':
return _context.stop();
}
}
}, _callee, this);
}));
return function (_x) {
return _ref.apply(this, arguments);
};
}();
case 10:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
return _ref2.apply(this, arguments);
}

@@ -1,58 +0,71 @@

'use strict';
"use strict";
require("core-js/modules/es.array.slice.js");
require("core-js/modules/es.object.freeze.js");
require("core-js/modules/es.object.define-properties.js");
require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = _default;
var _regenerator = require('babel-runtime/regenerator');
require("regenerator-runtime/runtime.js");
var _regenerator2 = _interopRequireDefault(_regenerator);
require("core-js/modules/es.object.to-string.js");
var _taggedTemplateLiteral2 = require('babel-runtime/helpers/taggedTemplateLiteral');
require("core-js/modules/es.promise.js");
var _taggedTemplateLiteral3 = _interopRequireDefault(_taggedTemplateLiteral2);
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _templateObject;
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _templateObject = (0, _taggedTemplateLiteral3.default)(['\n mutation placeMarketOrder($marketCode: ID, $amount: BigInt, $sell: Boolean) {\n placeMarketOrder(marketCode: $marketCode, amount: $amount, sell: $sell) {\n _id\n type\n amount\n createdAt\n market {\n code\n }\n }\n }\n '], ['\n mutation placeMarketOrder($marketCode: ID, $amount: BigInt, $sell: Boolean) {\n placeMarketOrder(marketCode: $marketCode, amount: $amount, sell: $sell) {\n _id\n type\n amount\n createdAt\n market {\n code\n }\n }\n }\n ']);
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var _graphqlTag = require('graphql-tag');
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
var _graphqlTag2 = _interopRequireDefault(_graphqlTag);
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var throwParamsError = function throwParamsError(param) {
throw new Error('Missing ' + param + ', try with Orionx.placeMarketOrder({marketCode: \':marketCode\', amount: :amount, sell: :sell})\n Remember that the amount must be multiplied by 10^(currency units).\n ');
throw new Error("Missing ".concat(param, ", try with Orionx.placeMarketOrder({marketCode: ':marketCode', amount: :amount, sell: :sell})\n Remember that the amount must be multiplied by 10^(currency units).\n "));
};
exports.default = function () {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(_ref2) {
var marketCode = _ref2.marketCode,
amount = _ref2.amount,
sell = _ref2.sell;
var query, response;
return _regenerator2.default.wrap(function _callee$(_context) {
function _default(_x) {
return _ref2.apply(this, arguments);
}
function _ref2() {
_ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
var marketCode, amount, sell, clientId, query, response;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
marketCode = _ref.marketCode, amount = _ref.amount, sell = _ref.sell, clientId = _ref.clientId;
if (!marketCode) throwParamsError('marketCode');
if (!amount) throwParamsError('amount');
if (sell == null) throwParamsError('sell');
query = (0, _graphqlTag2.default)(_templateObject);
_context.next = 6;
query = (0, _graphqlTag["default"])(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n mutation placeMarketOrder($marketCode: ID, $amount: BigInt, $sell: Boolean, clientId: String) {\n placeMarketOrder(marketCode: $marketCode, amount: $amount, sell: $sell, clientId: $clientId) {\n _id\n type\n amount\n createdAt\n market {\n code\n }\n }\n }\n "])));
_context.next = 7;
return this.graphql({
query: query,
variables: { marketCode: marketCode, amount: amount, sell: sell }
variables: {
marketCode: marketCode,
amount: amount,
sell: sell,
clientId: clientId
}
});
case 6:
case 7:
response = _context.sent;
return _context.abrupt('return', response.placeMarketOrder);
return _context.abrupt("return", response.placeMarketOrder);
case 8:
case 'end':
case 9:
case "end":
return _context.stop();

@@ -63,6 +76,3 @@ }

}));
return function (_x) {
return _ref.apply(this, arguments);
};
}();
return _ref2.apply(this, arguments);
}

@@ -1,50 +0,64 @@

'use strict';
"use strict";
require("core-js/modules/es.array.slice.js");
require("core-js/modules/es.object.freeze.js");
require("core-js/modules/es.object.define-properties.js");
require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = _default;
var _regenerator = require('babel-runtime/regenerator');
require("regenerator-runtime/runtime.js");
var _regenerator2 = _interopRequireDefault(_regenerator);
require("core-js/modules/es.object.to-string.js");
var _taggedTemplateLiteral2 = require('babel-runtime/helpers/taggedTemplateLiteral');
require("core-js/modules/es.promise.js");
var _taggedTemplateLiteral3 = _interopRequireDefault(_taggedTemplateLiteral2);
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _templateObject;
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _templateObject = (0, _taggedTemplateLiteral3.default)(['\n mutation {\n requestRealtimeToken\n }\n '], ['\n mutation {\n requestRealtimeToken\n }\n ']);
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var _graphqlTag = require('graphql-tag');
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
var _graphqlTag2 = _interopRequireDefault(_graphqlTag);
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return _ref.apply(this, arguments);
}
exports.default = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
var query, response;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
query = (0, _graphqlTag2.default)(_templateObject);
_context.next = 3;
return this.graphql({
query: query,
variables: {}
});
function _ref() {
_ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
var query, response;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
query = (0, _graphqlTag["default"])(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n mutation {\n requestRealtimeToken\n }\n "])));
_context.next = 3;
return this.graphql({
query: query,
variables: {}
});
case 3:
response = _context.sent;
return _context.abrupt('return', response.requestRealtimeToken);
case 3:
response = _context.sent;
return _context.abrupt("return", response.requestRealtimeToken);
case 5:
case 'end':
return _context.stop();
case 5:
case "end":
return _context.stop();
}
}
}
}, _callee, this);
}));
}, _callee, this);
}));
return _ref.apply(this, arguments);
}

@@ -1,50 +0,38 @@

'use strict';
"use strict";
require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _market = require('./market');
var _market = _interopRequireDefault(require("./market"));
var _market2 = _interopRequireDefault(_market);
var _marketOrderBook = _interopRequireDefault(require("./marketOrderBook"));
var _marketOrderBook = require('./marketOrderBook');
var _markets = _interopRequireDefault(require("./markets"));
var _marketOrderBook2 = _interopRequireDefault(_marketOrderBook);
var _me = _interopRequireDefault(require("./me"));
var _markets = require('./markets');
var _transactions = _interopRequireDefault(require("./transactions"));
var _markets2 = _interopRequireDefault(_markets);
var _wallet = _interopRequireDefault(require("./wallet"));
var _me = require('./me');
var _wallets = _interopRequireDefault(require("./wallets"));
var _me2 = _interopRequireDefault(_me);
var _openOrders = _interopRequireDefault(require("./openOrders"));
var _transactions = require('./transactions');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _transactions2 = _interopRequireDefault(_transactions);
var _wallet = require('./wallet');
var _wallet2 = _interopRequireDefault(_wallet);
var _wallets = require('./wallets');
var _wallets2 = _interopRequireDefault(_wallets);
var _openOrders = require('./openOrders');
var _openOrders2 = _interopRequireDefault(_openOrders);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
market: _market2.default,
marketOrderBook: _marketOrderBook2.default,
markets: _markets2.default,
me: _me2.default,
transactions: _transactions2.default,
wallet: _wallet2.default,
wallets: _wallets2.default,
openOrders: _openOrders2.default
};
var _default = {
market: _market["default"],
marketOrderBook: _marketOrderBook["default"],
markets: _markets["default"],
me: _me["default"],
transactions: _transactions["default"],
wallet: _wallet["default"],
wallets: _wallets["default"],
openOrders: _openOrders["default"]
};
exports["default"] = _default;

@@ -1,62 +0,76 @@

'use strict';
"use strict";
require("core-js/modules/es.array.slice.js");
require("core-js/modules/es.object.freeze.js");
require("core-js/modules/es.object.define-properties.js");
require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
exports["default"] = _default;
var _regenerator = require('babel-runtime/regenerator');
require("regenerator-runtime/runtime.js");
var _regenerator2 = _interopRequireDefault(_regenerator);
require("core-js/modules/es.object.to-string.js");
var _taggedTemplateLiteral2 = require('babel-runtime/helpers/taggedTemplateLiteral');
require("core-js/modules/es.promise.js");
var _taggedTemplateLiteral3 = _interopRequireDefault(_taggedTemplateLiteral2);
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _templateObject;
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _templateObject = (0, _taggedTemplateLiteral3.default)(['\n\t\tquery getMarket($code: ID) {\n\t\t\tmarket(code: $code) {\n\t\t\t\tname\n\t\t\t\tcode\n\t\t\t\tlastTrade {\n\t\t\t\t\tprice\n\t\t\t\t}\n\t\t\t\tmainCurrency {\n\t\t\t\t\tcode\n\t\t\t\t\tunits\n\t\t\t\t\tformat\n\t\t\t\t\tsymbol\n\t\t\t\t}\n\t\t\t\tsecondaryCurrency {\n\t\t\t\t\tcode\n\t\t\t\t\tunits\n\t\t\t\t\tformat\n\t\t\t\t\tsymbol\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t'], ['\n\t\tquery getMarket($code: ID) {\n\t\t\tmarket(code: $code) {\n\t\t\t\tname\n\t\t\t\tcode\n\t\t\t\tlastTrade {\n\t\t\t\t\tprice\n\t\t\t\t}\n\t\t\t\tmainCurrency {\n\t\t\t\t\tcode\n\t\t\t\t\tunits\n\t\t\t\t\tformat\n\t\t\t\t\tsymbol\n\t\t\t\t}\n\t\t\t\tsecondaryCurrency {\n\t\t\t\t\tcode\n\t\t\t\t\tunits\n\t\t\t\t\tformat\n\t\t\t\t\tsymbol\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t']);
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var _graphqlTag = require('graphql-tag');
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
var _graphqlTag2 = _interopRequireDefault(_graphqlTag);
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default(_x) {
return _ref2.apply(this, arguments);
}
exports.default = function () {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(_ref2) {
var code = _ref2.code;
var query, response;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (code) {
_context.next = 2;
break;
}
function _ref2() {
_ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
var code, query, response;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
code = _ref.code;
throw new Error('code missing, try with Orionx.market({code: \'LTCBTC\'})');
if (code) {
_context.next = 3;
break;
}
case 2:
query = (0, _graphqlTag2.default)(_templateObject);
_context.next = 5;
return this.graphql({ query: query, variables: { code: code } });
throw new Error('code missing, try with Orionx.market({code: \'LTCBTC\'})');
case 5:
response = _context.sent;
return _context.abrupt('return', response.market);
case 3:
query = (0, _graphqlTag["default"])(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n query getMarket($code: ID) {\n market(code: $code) {\n name\n code\n lastTrade {\n price\n }\n mainCurrency {\n code\n units\n format\n symbol\n }\n secondaryCurrency {\n code\n units\n format\n symbol\n }\n }\n }\n "])));
_context.next = 6;
return this.graphql({
query: query,
variables: {
code: code
}
});
case 7:
case 'end':
return _context.stop();
}
}
}, _callee, this);
}));
case 6:
response = _context.sent;
return _context.abrupt("return", response.market);
return function (_x) {
return _ref.apply(this, arguments);
};
}();
case 8:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
return _ref2.apply(this, arguments);
}

@@ -1,74 +0,86 @@

'use strict';
"use strict";
require("core-js/modules/es.array.slice.js");
require("core-js/modules/es.object.freeze.js");
require("core-js/modules/es.object.define-properties.js");
require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
exports["default"] = _default;
var _regenerator = require('babel-runtime/regenerator');
require("regenerator-runtime/runtime.js");
var _regenerator2 = _interopRequireDefault(_regenerator);
require("core-js/modules/es.object.to-string.js");
var _taggedTemplateLiteral2 = require('babel-runtime/helpers/taggedTemplateLiteral');
require("core-js/modules/es.promise.js");
var _taggedTemplateLiteral3 = _interopRequireDefault(_taggedTemplateLiteral2);
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _templateObject;
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _templateObject = (0, _taggedTemplateLiteral3.default)(['\n\t\tquery marketOrderBook($marketCode: ID!, $limit: Int) {\n\t\t\tmarketOrderBook(marketCode: $marketCode, limit: $limit) {\n\t\t\t\tsell {\n\t\t\t\t\tamount\n\t\t\t\t\tlimitPrice\n\t\t\t\t}\n\t\t\t\tbuy {\n\t\t\t\t\tamount\n\t\t\t\t\tlimitPrice\n\t\t\t\t}\n\t\t\t\tspread\n\t\t\t\tmid\n\t\t\t}\n\t\t}\n\t'], ['\n\t\tquery marketOrderBook($marketCode: ID!, $limit: Int) {\n\t\t\tmarketOrderBook(marketCode: $marketCode, limit: $limit) {\n\t\t\t\tsell {\n\t\t\t\t\tamount\n\t\t\t\t\tlimitPrice\n\t\t\t\t}\n\t\t\t\tbuy {\n\t\t\t\t\tamount\n\t\t\t\t\tlimitPrice\n\t\t\t\t}\n\t\t\t\tspread\n\t\t\t\tmid\n\t\t\t}\n\t\t}\n\t']);
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var _graphqlTag = require('graphql-tag');
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
var _graphqlTag2 = _interopRequireDefault(_graphqlTag);
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default(_x) {
return _ref2.apply(this, arguments);
}
exports.default = function () {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(_ref2) {
var marketCode = _ref2.marketCode,
limit = _ref2.limit;
var query, response;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (marketCode) {
_context.next = 2;
break;
}
function _ref2() {
_ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
var marketCode, limit, query, response;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
marketCode = _ref.marketCode, limit = _ref.limit;
throw new Error('marketCode missing, try with Orionx.marketOrderBook({marketCode: \'LTCBTC\', limit: 5})');
if (marketCode) {
_context.next = 3;
break;
}
case 2:
if (limit) {
_context.next = 4;
break;
}
throw new Error('marketCode missing, try with Orionx.marketOrderBook({marketCode: \'LTCBTC\', limit: 5})');
throw new Error('limit missing, try with Orionx.marketOrderBook({marketCode: \'LTCBTC\', limit: 5})');
case 3:
if (limit) {
_context.next = 5;
break;
}
case 4:
query = (0, _graphqlTag2.default)(_templateObject);
_context.next = 7;
return this.graphql({
query: query,
variables: { marketCode: marketCode, limit: limit }
});
throw new Error('limit missing, try with Orionx.marketOrderBook({marketCode: \'LTCBTC\', limit: 5})');
case 7:
response = _context.sent;
return _context.abrupt('return', response.marketOrderBook);
case 5:
query = (0, _graphqlTag["default"])(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n query marketOrderBook($marketCode: ID!, $limit: Int) {\n marketOrderBook(marketCode: $marketCode, limit: $limit) {\n sell {\n amount\n limitPrice\n }\n buy {\n amount\n limitPrice\n }\n spread\n mid\n }\n }\n "])));
_context.next = 8;
return this.graphql({
query: query,
variables: {
marketCode: marketCode,
limit: limit
}
});
case 9:
case 'end':
return _context.stop();
}
}
}, _callee, this);
}));
case 8:
response = _context.sent;
console.log('response', response);
return _context.abrupt("return", response.marketOrderBook);
return function (_x) {
return _ref.apply(this, arguments);
};
}();
case 11:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
return _ref2.apply(this, arguments);
}

@@ -1,47 +0,64 @@

'use strict';
"use strict";
require("core-js/modules/es.array.slice.js");
require("core-js/modules/es.object.freeze.js");
require("core-js/modules/es.object.define-properties.js");
require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
exports["default"] = _default;
var _regenerator = require('babel-runtime/regenerator');
require("regenerator-runtime/runtime.js");
var _regenerator2 = _interopRequireDefault(_regenerator);
require("core-js/modules/es.object.to-string.js");
var _taggedTemplateLiteral2 = require('babel-runtime/helpers/taggedTemplateLiteral');
require("core-js/modules/es.promise.js");
var _taggedTemplateLiteral3 = _interopRequireDefault(_taggedTemplateLiteral2);
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _templateObject;
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _templateObject = (0, _taggedTemplateLiteral3.default)(['\n\t\tquery {\n\t\t\tmarkets {\n\t\t\t\tcode\n\t\t\t\tname\n\t\t\t\tmainCurrency {\n\t\t\t\t\tcode\n\t\t\t\t\tname\n\t\t\t\t\tunits\n\t\t\t\t}\n\t\t\t\tsecondaryCurrency {\n\t\t\t\t\tcode\n\t\t\t\t\tname\n\t\t\t\t\tunits\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t'], ['\n\t\tquery {\n\t\t\tmarkets {\n\t\t\t\tcode\n\t\t\t\tname\n\t\t\t\tmainCurrency {\n\t\t\t\t\tcode\n\t\t\t\t\tname\n\t\t\t\t\tunits\n\t\t\t\t}\n\t\t\t\tsecondaryCurrency {\n\t\t\t\t\tcode\n\t\t\t\t\tname\n\t\t\t\t\tunits\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t']);
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var _graphqlTag = require('graphql-tag');
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
var _graphqlTag2 = _interopRequireDefault(_graphqlTag);
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return _ref.apply(this, arguments);
}
exports.default = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
var query, response;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
query = (0, _graphqlTag2.default)(_templateObject);
_context.next = 3;
return this.graphql({ query: query, variables: {} });
function _ref() {
_ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
var query, response;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
query = (0, _graphqlTag["default"])(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n query {\n markets {\n code\n name\n mainCurrency {\n code\n name\n units\n }\n secondaryCurrency {\n code\n name\n units\n }\n }\n }\n "])));
_context.next = 3;
return this.graphql({
query: query,
variables: {}
});
case 3:
response = _context.sent;
return _context.abrupt('return', response.markets);
case 3:
response = _context.sent;
return _context.abrupt("return", response.markets);
case 5:
case 'end':
return _context.stop();
}
}
}, _callee, this);
}));
case 5:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
return _ref.apply(this, arguments);
}

@@ -1,47 +0,64 @@

'use strict';
"use strict";
require("core-js/modules/es.array.slice.js");
require("core-js/modules/es.object.freeze.js");
require("core-js/modules/es.object.define-properties.js");
require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
exports["default"] = _default;
var _regenerator = require('babel-runtime/regenerator');
require("regenerator-runtime/runtime.js");
var _regenerator2 = _interopRequireDefault(_regenerator);
require("core-js/modules/es.object.to-string.js");
var _taggedTemplateLiteral2 = require('babel-runtime/helpers/taggedTemplateLiteral');
require("core-js/modules/es.promise.js");
var _taggedTemplateLiteral3 = _interopRequireDefault(_taggedTemplateLiteral2);
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _templateObject;
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _templateObject = (0, _taggedTemplateLiteral3.default)(['\n\t\tquery {\n\t\t\tme {\n\t\t\t\t_id\n\t\t\t\tname\n\t\t\t\temail\n\t\t\t\tcreatedAt\n\t\t\t}\n\t\t}\n\t'], ['\n\t\tquery {\n\t\t\tme {\n\t\t\t\t_id\n\t\t\t\tname\n\t\t\t\temail\n\t\t\t\tcreatedAt\n\t\t\t}\n\t\t}\n\t']);
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var _graphqlTag = require('graphql-tag');
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
var _graphqlTag2 = _interopRequireDefault(_graphqlTag);
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return _ref.apply(this, arguments);
}
exports.default = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
var query, response;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
query = (0, _graphqlTag2.default)(_templateObject);
_context.next = 3;
return this.graphql({ query: query, variables: {} });
function _ref() {
_ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
var query, response;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
query = (0, _graphqlTag["default"])(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n query {\n me {\n _id\n name\n email\n createdAt\n }\n }\n "])));
_context.next = 3;
return this.graphql({
query: query,
variables: {}
});
case 3:
response = _context.sent;
return _context.abrupt('return', response.me);
case 3:
response = _context.sent;
return _context.abrupt("return", response.me);
case 5:
case 'end':
return _context.stop();
}
}
}, _callee, this);
}));
case 5:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
return _ref.apply(this, arguments);
}
"use strict";
require("core-js/modules/es.array.slice.js");
require("core-js/modules/es.object.freeze.js");
require("core-js/modules/es.object.define-properties.js");
require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = _default;
var _regenerator = require("babel-runtime/regenerator");
require("regenerator-runtime/runtime.js");
var _regenerator2 = _interopRequireDefault(_regenerator);
require("core-js/modules/es.object.to-string.js");
var _taggedTemplateLiteral2 = require("babel-runtime/helpers/taggedTemplateLiteral");
require("core-js/modules/es.promise.js");
var _taggedTemplateLiteral3 = _interopRequireDefault(_taggedTemplateLiteral2);
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
var _asyncToGenerator2 = require("babel-runtime/helpers/asyncToGenerator");
var _templateObject;
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _templateObject = (0, _taggedTemplateLiteral3.default)(["\n query orders($marketCode: ID, $limit: Int) {\n orders(marketCode: $marketCode, limit: $limit, onlyOpen: true) {\n _id\n items {\n _id\n type\n amount\n amountToHold\n secondaryAmount\n limitPrice\n filled\n secondaryFilled\n sell\n createdAt\n closedAt\n activatedAt\n status\n isStop\n stopPriceUp\n stopPriceDown\n }\n }\n }\n "], ["\n query orders($marketCode: ID, $limit: Int) {\n orders(marketCode: $marketCode, limit: $limit, onlyOpen: true) {\n _id\n items {\n _id\n type\n amount\n amountToHold\n secondaryAmount\n limitPrice\n filled\n secondaryFilled\n sell\n createdAt\n closedAt\n activatedAt\n status\n isStop\n stopPriceUp\n stopPriceDown\n }\n }\n }\n "]);
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var _graphqlTag = require("graphql-tag");
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
var _graphqlTag2 = _interopRequireDefault(_graphqlTag);
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default(_x) {
return _ref2.apply(this, arguments);
}
exports.default = function () {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(_ref2) {
var marketCode = _ref2.marketCode,
limit = _ref2.limit;
var query, response;
return _regenerator2.default.wrap(function _callee$(_context) {
function _ref2() {
_ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
var marketCode, limit, query, response;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
marketCode = _ref.marketCode, limit = _ref.limit;
if (marketCode) {
_context.next = 2;
_context.next = 3;
break;
}
throw new Error("Missing marketCode, try Orionx.openOrders({marketCode: 'BTCCLP'})");
throw new Error('Missing marketCode, try Orionx.openOrders({marketCode: \'BTCCLP\'})');
case 2:
case 3:
if (!limit) limit = 15;
query = (0, _graphqlTag["default"])(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n query orders($marketCode: ID, $limit: Int) {\n orders(marketCode: $marketCode, limit: $limit, onlyOpen: true) {\n _id\n items {\n _id\n type\n amount\n amountToHold\n secondaryAmount\n limitPrice\n filled\n secondaryFilled\n sell\n createdAt\n closedAt\n activatedAt\n status\n isStop\n stopPriceUp\n stopPriceDown\n }\n }\n }\n "])));
_context.next = 7;
return this.graphql({
query: query,
variables: {
marketCode: marketCode,
limit: limit
}
});
query = (0, _graphqlTag2.default)(_templateObject);
_context.next = 6;
return this.graphql({ query: query, variables: { marketCode: marketCode, limit: limit } });
case 6:
case 7:
response = _context.sent;
return _context.abrupt("return", response.orders.items);
case 8:
case 9:
case "end":

@@ -62,6 +77,3 @@ return _context.stop();

}));
return function (_x) {
return _ref.apply(this, arguments);
};
}();
return _ref2.apply(this, arguments);
}

@@ -1,53 +0,68 @@

'use strict';
"use strict";
require("core-js/modules/es.array.slice.js");
require("core-js/modules/es.object.freeze.js");
require("core-js/modules/es.object.define-properties.js");
require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = _default;
var _regenerator = require('babel-runtime/regenerator');
require("regenerator-runtime/runtime.js");
var _regenerator2 = _interopRequireDefault(_regenerator);
require("core-js/modules/es.array.filter.js");
var _taggedTemplateLiteral2 = require('babel-runtime/helpers/taggedTemplateLiteral');
require("core-js/modules/es.object.to-string.js");
var _taggedTemplateLiteral3 = _interopRequireDefault(_taggedTemplateLiteral2);
require("core-js/modules/es.promise.js");
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _templateObject;
var _templateObject = (0, _taggedTemplateLiteral3.default)(['\n query getTransactions(\n $walletId: ID\n $filter: String\n $page: Int\n $limit: Int\n $sortBy: String\n $sortType: SortType\n ) {\n transactions(\n walletId: $walletId\n filter: $filter\n page: $page\n limit: $limit\n sortBy: $sortBy\n sortType: $sortType\n ) {\n _id\n page\n totalCount\n totalPages\n hasNextPage\n hasPreviousPage\n items {\n _id\n amount\n balance\n commission\n date\n type\n adds\n hash\n description\n price\n explorerURL\n currency {\n code\n isCrypto\n }\n market {\n code\n name\n }\n }\n }\n }\n '], ['\n query getTransactions(\n $walletId: ID\n $filter: String\n $page: Int\n $limit: Int\n $sortBy: String\n $sortType: SortType\n ) {\n transactions(\n walletId: $walletId\n filter: $filter\n page: $page\n limit: $limit\n sortBy: $sortBy\n sortType: $sortType\n ) {\n _id\n page\n totalCount\n totalPages\n hasNextPage\n hasPreviousPage\n items {\n _id\n amount\n balance\n commission\n date\n type\n adds\n hash\n description\n price\n explorerURL\n currency {\n code\n isCrypto\n }\n market {\n code\n name\n }\n }\n }\n }\n ']);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _graphqlTag = require('graphql-tag');
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var _graphqlTag2 = _interopRequireDefault(_graphqlTag);
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
exports.default = function () {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(_ref2) {
var walletId = _ref2.walletId,
filter = _ref2.filter,
page = _ref2.page,
limit = _ref2.limit,
sortBy = _ref2.sortBy,
sortType = _ref2.sortType;
var query, response;
return _regenerator2.default.wrap(function _callee$(_context) {
function _default(_x) {
return _ref2.apply(this, arguments);
}
function _ref2() {
_ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
var walletId, filter, page, limit, sortBy, sortType, query, response;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
query = (0, _graphqlTag2.default)(_templateObject);
_context.next = 3;
walletId = _ref.walletId, filter = _ref.filter, page = _ref.page, limit = _ref.limit, sortBy = _ref.sortBy, sortType = _ref.sortType;
query = (0, _graphqlTag["default"])(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n query getTransactions(\n $walletId: ID\n $filter: String\n $page: Int\n $limit: Int\n $sortBy: String\n $sortType: SortType\n ) {\n transactions(\n walletId: $walletId\n filter: $filter\n page: $page\n limit: $limit\n sortBy: $sortBy\n sortType: $sortType\n ) {\n _id\n page\n totalCount\n totalPages\n hasNextPage\n hasPreviousPage\n items {\n _id\n amount\n balance\n commission\n date\n type\n adds\n hash\n description\n price\n explorerURL\n currency {\n code\n isCrypto\n }\n market {\n code\n name\n }\n }\n }\n }\n "])));
_context.next = 4;
return this.graphql({
query: query,
variables: { walletId: walletId, filter: filter, page: page, limit: limit, sortBy: sortBy, sortType: sortType }
variables: {
walletId: walletId,
filter: filter,
page: page,
limit: limit,
sortBy: sortBy,
sortType: sortType
}
});
case 3:
case 4:
response = _context.sent;
return _context.abrupt('return', response.transactions);
return _context.abrupt("return", response.transactions);
case 5:
case 'end':
case 6:
case "end":
return _context.stop();

@@ -58,6 +73,3 @@ }

}));
return function (_x) {
return _ref.apply(this, arguments);
};
}();
return _ref2.apply(this, arguments);
}

@@ -1,62 +0,76 @@

'use strict';
"use strict";
require("core-js/modules/es.array.slice.js");
require("core-js/modules/es.object.freeze.js");
require("core-js/modules/es.object.define-properties.js");
require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
exports["default"] = _default;
var _regenerator = require('babel-runtime/regenerator');
require("regenerator-runtime/runtime.js");
var _regenerator2 = _interopRequireDefault(_regenerator);
require("core-js/modules/es.object.to-string.js");
var _taggedTemplateLiteral2 = require('babel-runtime/helpers/taggedTemplateLiteral');
require("core-js/modules/es.promise.js");
var _taggedTemplateLiteral3 = _interopRequireDefault(_taggedTemplateLiteral2);
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _templateObject;
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _templateObject = (0, _taggedTemplateLiteral3.default)(['\n\t\tquery getWallet($currencyCode: ID!) {\n\t\t\tme {\n\t\t\t\t_id\n\t\t\t\twallet(currencyCode: $currencyCode) {\n\t\t\t\t\t_id\n\t\t\t\t\tbalance\n\t\t\t\t\tavailableBalance\n\t\t\t\t\tcurrency {\n\t\t\t\t\t\tcode\n\t\t\t\t\t\tname\n\t\t\t\t\t\tsymbol\n\t\t\t\t\t\tformat\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t'], ['\n\t\tquery getWallet($currencyCode: ID!) {\n\t\t\tme {\n\t\t\t\t_id\n\t\t\t\twallet(currencyCode: $currencyCode) {\n\t\t\t\t\t_id\n\t\t\t\t\tbalance\n\t\t\t\t\tavailableBalance\n\t\t\t\t\tcurrency {\n\t\t\t\t\t\tcode\n\t\t\t\t\t\tname\n\t\t\t\t\t\tsymbol\n\t\t\t\t\t\tformat\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t']);
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var _graphqlTag = require('graphql-tag');
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
var _graphqlTag2 = _interopRequireDefault(_graphqlTag);
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default(_x) {
return _ref2.apply(this, arguments);
}
exports.default = function () {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(_ref2) {
var currencyCode = _ref2.currencyCode;
var query, response;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (currencyCode) {
_context.next = 2;
break;
}
function _ref2() {
_ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
var currencyCode, query, response;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
currencyCode = _ref.currencyCode;
throw new Error('Missing currencyCode, try Orionx.wallet({currencyCode: \'CLP\'})');
if (currencyCode) {
_context.next = 3;
break;
}
case 2:
query = (0, _graphqlTag2.default)(_templateObject);
_context.next = 5;
return this.graphql({ query: query, variables: { currencyCode: currencyCode } });
throw new Error('Missing currencyCode, try Orionx.wallet({currencyCode: \'CLP\'})');
case 5:
response = _context.sent;
return _context.abrupt('return', response.me.wallet);
case 3:
query = (0, _graphqlTag["default"])(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n query getWallet($currencyCode: ID!) {\n me {\n _id\n wallet(currencyCode: $currencyCode) {\n _id\n balance\n availableBalance\n currency {\n code\n name\n symbol\n format\n }\n }\n }\n }\n "])));
_context.next = 6;
return this.graphql({
query: query,
variables: {
currencyCode: currencyCode
}
});
case 7:
case 'end':
return _context.stop();
}
}
}, _callee, this);
}));
case 6:
response = _context.sent;
return _context.abrupt("return", response.me.wallet);
return function (_x) {
return _ref.apply(this, arguments);
};
}();
case 8:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
return _ref2.apply(this, arguments);
}

@@ -1,47 +0,64 @@

'use strict';
"use strict";
require("core-js/modules/es.array.slice.js");
require("core-js/modules/es.object.freeze.js");
require("core-js/modules/es.object.define-properties.js");
require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
exports["default"] = _default;
var _regenerator = require('babel-runtime/regenerator');
require("regenerator-runtime/runtime.js");
var _regenerator2 = _interopRequireDefault(_regenerator);
require("core-js/modules/es.object.to-string.js");
var _taggedTemplateLiteral2 = require('babel-runtime/helpers/taggedTemplateLiteral');
require("core-js/modules/es.promise.js");
var _taggedTemplateLiteral3 = _interopRequireDefault(_taggedTemplateLiteral2);
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _templateObject;
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _templateObject = (0, _taggedTemplateLiteral3.default)(['\n\t\tquery {\n\t\t\tme {\n\t\t\t\t_id\n\t\t\t\twallets {\n\t\t\t\t\t_id\n\t\t\t\t\tbalance\n\t\t\t\t\tavailableBalance\n\t\t\t\t\tcurrency {\n\t\t\t\t\t\tcode\n\t\t\t\t\t\tname\n\t\t\t\t\t\tsymbol\n\t\t\t\t\t\tformat\n\t\t\t\t\t\tunits\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t'], ['\n\t\tquery {\n\t\t\tme {\n\t\t\t\t_id\n\t\t\t\twallets {\n\t\t\t\t\t_id\n\t\t\t\t\tbalance\n\t\t\t\t\tavailableBalance\n\t\t\t\t\tcurrency {\n\t\t\t\t\t\tcode\n\t\t\t\t\t\tname\n\t\t\t\t\t\tsymbol\n\t\t\t\t\t\tformat\n\t\t\t\t\t\tunits\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t']);
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var _graphqlTag = require('graphql-tag');
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
var _graphqlTag2 = _interopRequireDefault(_graphqlTag);
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default() {
return _ref.apply(this, arguments);
}
exports.default = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
var query, response;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
query = (0, _graphqlTag2.default)(_templateObject);
_context.next = 3;
return this.graphql({ query: query, variables: {} });
function _ref() {
_ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
var query, response;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
query = (0, _graphqlTag["default"])(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n query {\n me {\n _id\n wallets {\n _id\n balance\n availableBalance\n currency {\n code\n name\n symbol\n format\n units\n }\n }\n }\n }\n "])));
_context.next = 3;
return this.graphql({
query: query,
variables: {}
});
case 3:
response = _context.sent;
return _context.abrupt('return', response.me.wallets);
case 3:
response = _context.sent;
return _context.abrupt("return", response.me.wallets);
case 5:
case 'end':
return _context.stop();
}
}
}, _callee, this);
}));
case 5:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
return _ref.apply(this, arguments);
}

@@ -1,22 +0,26 @@

'use strict';
"use strict";
require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
exports["default"] = _default;
exports.default = function (_ref) {
var apiKey = _ref.apiKey,
secretKey = _ref.secretKey,
apiUri = _ref.apiUri;
var _throwCredentialsError = _interopRequireDefault(require("./throwCredentialsError"));
if (!apiKey) (0, _throwCredentialsError2.default)('apiKey');
if (!secretKey) (0, _throwCredentialsError2.default)('secretKey');
if (!apiUri) apiUri = 'https://api2.orionx.io/graphql/';
this.credentials = { apiKey: apiKey, secretKey: secretKey, apiUri: apiUri };
};
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _throwCredentialsError = require('./throwCredentialsError');
var _throwCredentialsError2 = _interopRequireDefault(_throwCredentialsError);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default(_ref) {
var apiKey = _ref.apiKey,
secretKey = _ref.secretKey,
apiUri = _ref.apiUri;
if (!apiKey) (0, _throwCredentialsError["default"])('apiKey');
if (!secretKey) (0, _throwCredentialsError["default"])('secretKey');
if (!apiUri) apiUri = 'https://api2.orionx.io/graphql/';
this.credentials = {
apiKey: apiKey,
secretKey: secretKey,
apiUri: apiUri
};
}
"use strict";
require("core-js/modules/es.object.define-property.js");
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
exports["default"] = void 0;
exports.default = function (param) {
throw new Error("Missing " + param + ", try with Orionx.setCredentials({apiKey: :apiKey, secretKey: :secretKey, apiUri: :apiUri}) method");
};
var _default = function _default(param) {
throw new Error("Missing ".concat(param, ", try with Orionx.setCredentials({apiKey: :apiKey, secretKey: :secretKey, apiUri: :apiUri}) method"));
};
exports["default"] = _default;
{
"name": "orionx-sdk",
"version": "1.3.12",
"version": "1.3.14",
"description": "Help developers with Orionx integrations",

@@ -16,7 +16,8 @@ "main": "build/index.js",

],
"sources": [
"./lib/*"
"ignoredByWatcher": [
"**/node_modules/**",
".github/**"
],
"require": [
"babel-register"
"@babel/register"
]

@@ -36,15 +37,17 @@ },

"license": "MIT",
"dependencies": {
"core-js": "^3.6.2",
"graphql": "^15.0.0",
"graphql-tag": "^2.9.2",
"jssha": "^3.1.0",
"node-fetch": "^2.6.0",
"regenerator-runtime": "^0.13.3"
},
"devDependencies": {
"ava": "^0.25.0",
"babel-cli": "^6.26.0",
"babel-eslint": "^7.0.0",
"babel-loader": "^7.1.5",
"babel-plugin-module-resolver": "^3.1.1",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-runtime": "^6.15.0",
"babel-preset-env": "^1.7.0",
"babel-preset-es2015": "6.5.0",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-2": "^6.5.0",
"babel-register": "^6.26.0",
"ava": "^4.2.0",
"@babel/cli": "^7.7.7",
"@babel/core": "^7.7.7",
"@babel/node": "^7.7.7",
"@babel/preset-env": "^7.7.7",
"@babel/register": "^7.7.7",
"dotenv": "^8.2.0",

@@ -55,11 +58,4 @@ "eslint": "^6.8.0",

"eslint-plugin-standard": "^4.0.1",
"watch": "^1.0.2"
},
"dependencies": {
"babel-runtime": "6",
"graphql": "^15.0.0",
"graphql-tag": "^2.9.2",
"jssha": "^3.1.0",
"node-fetch": "^2.6.0"
"watch": "^0.13.0"
}
}
<p align="center">
<a href="https://orionx.com/">
<img alt="babel" src="https://orionx.com/logo.svg" width="546">
<img alt="Orionx" src="https://app.orionx.com/new-isologo.svg" width="546">
</a>

@@ -5,0 +5,0 @@ </p>

import throwCredentialsError from './throwCredentialsError'
export default function() {
if (!this.credentials) throwCredentialsError('credentials')
const { apiUri, secretKey, apiKey } = this.credentials
if (!apiUri) throwCredentialsError('apiUri')
if (!apiKey) throwCredentialsError('apiKey')
if (!secretKey) throwCredentialsError('secretKey')
if (!this.credentials) throwCredentialsError('credentials')
const { apiUri, secretKey, apiKey } = this.credentials
if (!apiUri) throwCredentialsError('apiUri')
if (!apiKey) throwCredentialsError('apiKey')
if (!secretKey) throwCredentialsError('secretKey')
}

@@ -6,20 +6,19 @@ import callOrionx from './helpers/callOrionx'

import mutations from './mutations'
import gql from 'graphql-tag'
const Orionx = {
setCredentials,
getCredentials() {
return this.credentials
},
checkCredentials,
async graphql({query, variables}) {
this.checkCredentials()
if (!query) throw new Error('Missing Query')
if (!variables) throw new Error('Missing Variables')
const body = JSON.stringify({query, variables})
return await callOrionx({body, credentials: this.credentials})
},
...queries,
...mutations
setCredentials,
getCredentials() {
return this.credentials
},
checkCredentials,
async graphql({query, variables}) {
this.checkCredentials()
if (!query) throw new Error('Missing Query')
if (!variables) throw new Error('Missing Variables')
const body = JSON.stringify({query, variables})
return await callOrionx({body, credentials: this.credentials})
},
...queries,
...mutations
}
export default Orionx
import gql from 'graphql-tag'
const throwError = param => {
throw new Error(
`Missing ${param}, try with Orionx.cancelOrder({orderId: ":orderId"})`
)
throw new Error(
`Missing ${param}, try with Orionx.cancelOrder({orderId: ":orderId"})`
)
}
export default async function(variables) {
if (!variables.orderId) throwError('orderId')
if (!variables.orderId) throwError('orderId')
const query = gql`
const query = gql`
mutation cancelOrder($orderId: ID) {

@@ -21,8 +21,8 @@ cancelOrder(orderId: $orderId) {

`
const response = await this.graphql({
query,
variables: variables
})
const response = await this.graphql({
query,
variables: variables
})
return response.cancelOrder
return response.cancelOrder
}
import gql from 'graphql-tag'
const throwError = param => {
throw new Error(
`Missing ${param}, try with Orionx.createPayment({acceptedCurrenciesCodes: ["BTC", "ETH"], amount: 1500, mainCurrencyCode "CLP", title: "test payment"}) method`
)
throw new Error(
`Missing ${param}, try with Orionx.createPayment({acceptedCurrenciesCodes: ["BTC", "ETH"], amount: 1500, mainCurrencyCode "CLP", title: "test payment"}) method`
)
}
export default async function(variables) {
if (!variables.acceptedCurrenciesCodes) throwError('acceptedCurrenciesCodes')
if (!variables.amount) throwError('amount')
if (!variables.mainCurrencyCode) throwError('mainCurrencyCode')
if (!variables.title) throwError('title')
if (!variables.acceptedCurrenciesCodes) throwError('acceptedCurrenciesCodes')
if (!variables.amount) throwError('amount')
if (!variables.mainCurrencyCode) throwError('mainCurrencyCode')
if (!variables.title) throwError('title')
const query = gql`
const query = gql`
mutation createPayment(

@@ -47,8 +47,8 @@ $acceptedCurrenciesCodes: [ID]

`
const response = await this.graphql({
query,
variables: variables
})
const response = await this.graphql({
query,
variables: variables
})
return response.createPayment
return response.createPayment
}
import gql from 'graphql-tag'
const throwParamsError = param => {
throw new Error(`Missing ${param}, try with Orionx.placeLimitOrder({marketCode: ':marketCode', amount: :amount, limitPrice: :limitPrice, sell: :sell})
throw new Error(`Missing ${param}, try with Orionx.placeLimitOrder({marketCode: ':marketCode', amount: :amount, limitPrice: :limitPrice, sell: :sell})
Remember that the amount must be multiplied by 10^(currency units).

@@ -10,8 +10,8 @@ `)

export default async function({ marketCode, amount, limitPrice, sell, clientId }) {
if (!marketCode) throwParamsError('marketCode')
if (!amount) throwParamsError('amount')
if (!amount) throwParamsError('limitPrice')
if (sell == null) throwParamsError('sell')
if (!marketCode) throwParamsError('marketCode')
if (!amount) throwParamsError('amount')
if (!amount) throwParamsError('limitPrice')
if (sell == null) throwParamsError('sell')
const query = gql`
const query = gql`
mutation placeLimitOrder(

@@ -43,8 +43,8 @@ $marketCode: ID

const response = await this.graphql({
query,
variables: { marketCode, amount, limitPrice, sell, clientId }
})
const response = await this.graphql({
query,
variables: { marketCode, amount, limitPrice, sell, clientId }
})
return response.placeLimitOrder
return response.placeLimitOrder
}
import throwCredentialsError from './throwCredentialsError'
export default function({ apiKey, secretKey, apiUri }) {
if (!apiKey) throwCredentialsError('apiKey')
if (!secretKey) throwCredentialsError('secretKey')
if (!apiUri) apiUri = 'https://api2.orionx.io/graphql/'
this.credentials = { apiKey, secretKey, apiUri }
if (!apiKey) throwCredentialsError('apiKey')
if (!secretKey) throwCredentialsError('secretKey')
if (!apiUri) apiUri = 'https://api2.orionx.io/graphql/'
this.credentials = { apiKey, secretKey, apiUri }
}
export default param => {
throw new Error(
`Missing ${param}, try with Orionx.setCredentials({apiKey: :apiKey, secretKey: :secretKey, apiUri: :apiUri}) method`
)
throw new Error(
`Missing ${param}, try with Orionx.setCredentials({apiKey: :apiKey, secretKey: :secretKey, apiUri: :apiUri}) method`
)
}

@@ -5,15 +5,15 @@ import test from 'ava'

test('Generate valid signature', t => {
const body = JSON.stringify({
foo: 'bar'
})
const body = JSON.stringify({
foo: 'bar'
})
const timestamp = 'Thu Sep 13 2018 22:07:55 GMT-0300 (Chile Summer Time)'
const secretKey =
const timestamp = 'Thu Sep 13 2018 22:07:55 GMT-0300 (Chile Summer Time)'
const secretKey =
'd3acc90185d8317a8028418d45ae7af1ae38d2086eaa74ac641305eb06d'
const signature = generateSignature({ body, timestamp, secretKey })
const signature = generateSignature({ body, timestamp, secretKey })
t.is(
signature,
'0b811edbec95ebc9bdd8595edf1c2b941a9de3aeae15e0cbcdb8d33e5d2a1fcf9a895a235e18d4168604a980360608d4cd4faf6e843ed4e20e8c149ba348e69d'
)
t.is(
signature,
'0b811edbec95ebc9bdd8595edf1c2b941a9de3aeae15e0cbcdb8d33e5d2a1fcf9a895a235e18d4168604a980360608d4cd4faf6e843ed4e20e8c149ba348e69d'
)
})

@@ -5,46 +5,46 @@ import test from 'ava'

test('Throws valid error without credentials', t => {
Orionx.credentials = null
const param = 'credentials'
const validMsg = `Missing ${param}, try with Orionx.setCredentials({apiKey: :apiKey, secretKey: :secretKey, apiUri: :apiUri}) method`
Orionx.credentials = null
const param = 'credentials'
const validMsg = `Missing ${param}, try with Orionx.setCredentials({apiKey: :apiKey, secretKey: :secretKey, apiUri: :apiUri}) method`
const error = t.throws(() => {
Orionx.checkCredentials()
})
const error = t.throws(() => {
Orionx.checkCredentials()
})
t.is(error.message, validMsg)
t.is(error.message, validMsg)
})
test('Throws valid error without apiKey', t => {
const param = 'apiKey'
const validMsg = `Missing ${param}, try with Orionx.setCredentials({apiKey: :apiKey, secretKey: :secretKey, apiUri: :apiUri}) method`
Orionx.credentials = { secretKey: 'bar', apiUri: 'foo' }
const param = 'apiKey'
const validMsg = `Missing ${param}, try with Orionx.setCredentials({apiKey: :apiKey, secretKey: :secretKey, apiUri: :apiUri}) method`
Orionx.credentials = { secretKey: 'bar', apiUri: 'foo' }
const error = t.throws(() => {
Orionx.checkCredentials()
})
const error = t.throws(() => {
Orionx.checkCredentials()
})
t.is(error.message, validMsg)
t.is(error.message, validMsg)
})
test('Throws valid error without secretKey', t => {
const param = 'secretKey'
const validMsg = `Missing ${param}, try with Orionx.setCredentials({apiKey: :apiKey, secretKey: :secretKey, apiUri: :apiUri}) method`
Orionx.credentials = { apiKey: 'bar', apiUri: 'foo' }
const param = 'secretKey'
const validMsg = `Missing ${param}, try with Orionx.setCredentials({apiKey: :apiKey, secretKey: :secretKey, apiUri: :apiUri}) method`
Orionx.credentials = { apiKey: 'bar', apiUri: 'foo' }
const error = t.throws(() => {
Orionx.checkCredentials()
})
const error = t.throws(() => {
Orionx.checkCredentials()
})
t.is(error.message, validMsg)
t.is(error.message, validMsg)
})
test('Throws valid error without apiUri', t => {
const param = 'apiUri'
const validMsg = `Missing ${param}, try with Orionx.setCredentials({apiKey: :apiKey, secretKey: :secretKey, apiUri: :apiUri}) method`
Orionx.credentials = { apiKey: 'bar', secretKey: 'foo' }
const param = 'apiUri'
const validMsg = `Missing ${param}, try with Orionx.setCredentials({apiKey: :apiKey, secretKey: :secretKey, apiUri: :apiUri}) method`
Orionx.credentials = { apiKey: 'bar', secretKey: 'foo' }
const error = t.throws(() => {
Orionx.checkCredentials()
})
const error = t.throws(() => {
Orionx.checkCredentials()
})
t.is(error.message, validMsg)
t.is(error.message, validMsg)
})

@@ -6,40 +6,40 @@ import test from 'ava'

test.before(() => {
setOrionxCredentials()
setOrionxCredentials()
})
test('Query wallet', async t => {
const wallet = await Orionx.wallet({ currencyCode: 'BTC' })
const wallet = await Orionx.wallet({ currencyCode: 'BTC' })
t.is(wallet.currency.code, 'BTC')
t.is(wallet.currency.code, 'BTC')
})
test('Query wallets', async t => {
const wallets = await Orionx.wallets()
t.true(Array.isArray(wallets))
const wallets = await Orionx.wallets()
t.true(Array.isArray(wallets))
})
test('Query me', async t => {
const me = await Orionx.me()
t.true(me.email.includes('@'))
const me = await Orionx.me()
t.true(me.email.includes('@'))
})
test('Query markets', async t => {
const markets = await Orionx.markets()
t.true(Array.isArray(markets))
const markets = await Orionx.markets()
t.true(Array.isArray(markets))
})
test('Query market', async t => {
const marketCode = 'BTCCLP'
const market = await Orionx.market({ code: marketCode })
t.is(market.code, marketCode)
const marketCode = 'BTCCLP'
const market = await Orionx.market({ code: marketCode })
t.is(market.code, marketCode)
})
test('Query marketOrderBook', async t => {
t.plan(2)
const marketCode = 'BTCCLP'
const marketOrderBook = await Orionx.marketOrderBook({ marketCode, limit: 2 })
t.true(Array.isArray(marketOrderBook.sell))
t.true(Array.isArray(marketOrderBook.buy))
t.plan(2)
const marketCode = 'BTCCLP'
const marketOrderBook = await Orionx.marketOrderBook({ marketCode, limit: 2 })
t.true(Array.isArray(marketOrderBook.sell))
t.true(Array.isArray(marketOrderBook.buy))
})
// Mising tests for Mutations

@@ -5,10 +5,10 @@ import test from 'ava'

const getErrorMsg = param =>
`Missing ${param}, try with Orionx.cancelOrder({orderId: ":orderId"})`
`Missing ${param}, try with Orionx.cancelOrder({orderId: ":orderId"})`
test('Throws error without orderId', async t => {
try {
await Orionx.cancelOrder({})
} catch (err) {
t.is(err.message, getErrorMsg('orderId'))
}
try {
await Orionx.cancelOrder({})
} catch (err) {
t.is(err.message, getErrorMsg('orderId'))
}
})

@@ -5,42 +5,42 @@ import test from 'ava'

const params = {
acceptedCurrenciesCodes: ['LTC', 'BTC'],
amount: 1000,
description: 'Testing...',
mainCurrencyCode: 'CLP',
title: 'Test'
acceptedCurrenciesCodes: ['LTC', 'BTC'],
amount: 1000,
description: 'Testing...',
mainCurrencyCode: 'CLP',
title: 'Test'
}
const getErrorMsg = param =>
`Missing ${param}, try with Orionx.createPayment({acceptedCurrenciesCodes: ["BTC", "ETH"], amount: 1500, mainCurrencyCode "CLP", title: "test payment"}) method`
`Missing ${param}, try with Orionx.createPayment({acceptedCurrenciesCodes: ["BTC", "ETH"], amount: 1500, mainCurrencyCode "CLP", title: "test payment"}) method`
test('Throws error without acceptedCurrenciesCodes', async t => {
try {
await Orionx.createPayment({ ...params, acceptedCurrenciesCodes: null })
} catch (err) {
t.is(err.message, getErrorMsg('acceptedCurrenciesCodes'))
}
try {
await Orionx.createPayment({ ...params, acceptedCurrenciesCodes: null })
} catch (err) {
t.is(err.message, getErrorMsg('acceptedCurrenciesCodes'))
}
})
test('Throws error without amount', async t => {
try {
await Orionx.createPayment({ ...params, amount: null })
} catch (err) {
t.is(err.message, getErrorMsg('amount'))
}
try {
await Orionx.createPayment({ ...params, amount: null })
} catch (err) {
t.is(err.message, getErrorMsg('amount'))
}
})
test('Throws error without mainCurrencyCode', async t => {
try {
await Orionx.createPayment({ ...params, mainCurrencyCode: null })
} catch (err) {
t.is(err.message, getErrorMsg('mainCurrencyCode'))
}
try {
await Orionx.createPayment({ ...params, mainCurrencyCode: null })
} catch (err) {
t.is(err.message, getErrorMsg('mainCurrencyCode'))
}
})
test('Throws error without title', async t => {
try {
await Orionx.createPayment({ ...params, title: null })
} catch (err) {
t.is(err.message, getErrorMsg('title'))
}
try {
await Orionx.createPayment({ ...params, title: null })
} catch (err) {
t.is(err.message, getErrorMsg('title'))
}
})

@@ -5,35 +5,35 @@ import test from 'ava'

test('Throws error without marketCode', async t => {
try {
await Orionx.placeLimitOrder({
amount: 1,
limitPrice: 1,
sell: false
})
} catch (err) {
t.true(/Missing marketCode/.test(err.message))
}
try {
await Orionx.placeLimitOrder({
amount: 1,
limitPrice: 1,
sell: false
})
} catch (err) {
t.true(/Missing marketCode/.test(err.message))
}
})
test('Throws error without amount', async t => {
try {
await Orionx.placeMarketOrder({
marketCode: 'CHACLP',
limitPrice: 1,
sell: true
})
} catch (err) {
t.true(/Missing amount/.test(err.message))
}
try {
await Orionx.placeMarketOrder({
marketCode: 'CHACLP',
limitPrice: 1,
sell: true
})
} catch (err) {
t.true(/Missing amount/.test(err.message))
}
})
test('Throws error without sell', async t => {
try {
await Orionx.placeMarketOrder({
marketCode: 'CHACLP',
limitPrice: 1,
amount: 1
})
} catch (err) {
t.true(/Missing sell/.test(err.message))
}
try {
await Orionx.placeMarketOrder({
marketCode: 'CHACLP',
limitPrice: 1,
amount: 1
})
} catch (err) {
t.true(/Missing sell/.test(err.message))
}
})

@@ -5,30 +5,30 @@ import test from 'ava'

test('Throws error without marketCode', async t => {
try {
await Orionx.placeMarketOrder({
amount: 1,
sell: true
})
} catch (err) {
t.true(/Missing marketCode/.test(err.message))
}
try {
await Orionx.placeMarketOrder({
amount: 1,
sell: true
})
} catch (err) {
t.true(/Missing marketCode/.test(err.message))
}
})
test('Throws error without amount', async t => {
try {
await Orionx.placeMarketOrder({
marketCode: 'CHACLP',
sell: false
})
} catch (err) {
t.true(/Missing amount/.test(err.message))
}
try {
await Orionx.placeMarketOrder({
marketCode: 'CHACLP',
sell: false
})
} catch (err) {
t.true(/Missing amount/.test(err.message))
}
})
test('Throws error without sell', async t => {
try {
await Orionx.placeMarketOrder({
marketCode: 'CHACLP',
amount: 1
})
} catch (err) {
t.true(/Missing sell/.test(err.message))
}
try {
await Orionx.placeMarketOrder({
marketCode: 'CHACLP',
amount: 1
})
} catch (err) {
t.true(/Missing sell/.test(err.message))
}
})

@@ -5,9 +5,9 @@ import test from 'ava'

test('Throws error without valid code', async t => {
const validMsg = 'code missing, try with Orionx.market({code: \'LTCBTC\'})'
const validMsg = 'code missing, try with Orionx.market({code: \'LTCBTC\'})'
try {
await Orionx.market({})
} catch (err) {
t.is(err.message, validMsg)
}
try {
await Orionx.market({})
} catch (err) {
t.is(err.message, validMsg)
}
})

@@ -5,20 +5,20 @@ import test from 'ava'

test('Throws error without valid code', async t => {
const validMsg =
const validMsg =
'limit missing, try with Orionx.marketOrderBook({marketCode: \'LTCBTC\', limit: 5})'
try {
await Orionx.marketOrderBook({ marketCode: 'BTCCLP' })
} catch (err) {
t.is(err.message, validMsg)
}
try {
await Orionx.marketOrderBook({ marketCode: 'BTCCLP' })
} catch (err) {
t.is(err.message, validMsg)
}
})
test('Throws error without valid code', async t => {
const validMsg =
const validMsg =
'marketCode missing, try with Orionx.marketOrderBook({marketCode: \'LTCBTC\', limit: 5})'
try {
await Orionx.marketOrderBook({ limit: 5 })
} catch (err) {
t.is(err.message, validMsg)
}
try {
await Orionx.marketOrderBook({ limit: 5 })
} catch (err) {
t.is(err.message, validMsg)
}
})

@@ -7,20 +7,20 @@ import test from 'ava'

test.beforeEach(t => {
setOrionxCredentials()
setOrionxCredentials()
})
test('Transactions method returns transactions', async t => {
t.plan(1)
try {
const wallets = await Orionx.wallets()
t.plan(1)
try {
const wallets = await Orionx.wallets()
const transactions = await Orionx.transactions({walletId: wallets[0]._id})
const transactions = await Orionx.transactions({walletId: wallets[0]._id})
t.true(transactions.items.length > 0)
} catch (e) {
t.fail(e.message)
}
t.true(transactions.items.length > 0)
} catch (e) {
t.fail(e.message)
}
})
test.afterEach(async t => {
await delay()
await delay()
})

@@ -5,10 +5,10 @@ import test from 'ava'

test('Throws error without valid currencyCode', async t => {
const validMsg =
const validMsg =
'Missing currencyCode, try Orionx.wallet({currencyCode: \'CLP\'})'
try {
await Orionx.wallet({})
} catch (err) {
t.is(err.message, validMsg)
}
try {
await Orionx.wallet({})
} catch (err) {
t.is(err.message, validMsg)
}
})

@@ -6,14 +6,14 @@ import test from 'ava'

test.beforeEach(t => {
setOrionxCredentials()
setOrionxCredentials()
})
test('Throws error when no wallets', async t => {
const validMsg = 'Function not returning wallets'
const validMsg = 'Function not returning wallets'
try {
const wallets = await Orionx.wallets()
t.true(wallets.length > 0)
} catch (err) {
t.is(err.message, validMsg)
}
try {
const wallets = await Orionx.wallets()
t.true(wallets.length > 0)
} catch (err) {
t.is(err.message, validMsg)
}
})

@@ -5,30 +5,30 @@ import test from 'ava'

test('Throws valid error without apiKey', t => {
const param = 'apiKey'
const validMsg = `Missing ${param}, try with Orionx.setCredentials({apiKey: :apiKey, secretKey: :secretKey, apiUri: :apiUri}) method`
const param = 'apiKey'
const validMsg = `Missing ${param}, try with Orionx.setCredentials({apiKey: :apiKey, secretKey: :secretKey, apiUri: :apiUri}) method`
const error = t.throws(() => {
Orionx.setCredentials({ secretKey: 'bar', apiUri: 'foo' })
})
const error = t.throws(() => {
Orionx.setCredentials({ secretKey: 'bar', apiUri: 'foo' })
})
t.is(error.message, validMsg)
t.is(error.message, validMsg)
})
test('Throws valid error without secretKey', t => {
const param = 'secretKey'
const validMsg = `Missing ${param}, try with Orionx.setCredentials({apiKey: :apiKey, secretKey: :secretKey, apiUri: :apiUri}) method`
const param = 'secretKey'
const validMsg = `Missing ${param}, try with Orionx.setCredentials({apiKey: :apiKey, secretKey: :secretKey, apiUri: :apiUri}) method`
const error = t.throws(() => {
Orionx.setCredentials({ apiKey: 'bar', apiUri: 'foo' })
})
const error = t.throws(() => {
Orionx.setCredentials({ apiKey: 'bar', apiUri: 'foo' })
})
t.is(error.message, validMsg)
t.is(error.message, validMsg)
})
test('Set credentials correctly', t => {
t.plan(3)
Orionx.setCredentials({ apiKey: 'bar', secretKey: 'boo', apiUri: 'foo' })
const { apiKey, secretKey, apiUri } = Orionx.credentials
t.is(apiKey, 'bar')
t.is(secretKey, 'boo')
t.is(apiUri, 'foo')
t.plan(3)
Orionx.setCredentials({ apiKey: 'bar', secretKey: 'boo', apiUri: 'foo' })
const { apiKey, secretKey, apiUri } = Orionx.credentials
t.is(apiKey, 'bar')
t.is(secretKey, 'boo')
t.is(apiUri, 'foo')
})

@@ -5,10 +5,10 @@ import test from 'ava'

test('Generate valid error msg', t => {
const param = 'foo'
const validMsg = `Missing ${param}, try with Orionx.setCredentials({apiKey: :apiKey, secretKey: :secretKey, apiUri: :apiUri}) method`
const param = 'foo'
const validMsg = `Missing ${param}, try with Orionx.setCredentials({apiKey: :apiKey, secretKey: :secretKey, apiUri: :apiUri}) method`
const error = t.throws(() => {
throwCredentialsError(param)
})
const error = t.throws(() => {
throwCredentialsError(param)
})
t.is(error.message, validMsg)
t.is(error.message, validMsg)
})

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc