orionx-sdk
Advanced tools
Comparing version 1.3.9 to 1.3.10
@@ -13,3 +13,3 @@ { | ||
"rules": { | ||
"indent": ["error", "spaces"], | ||
"indent": ["error", 2], | ||
"linebreak-style": ["error", "unix"], | ||
@@ -16,0 +16,0 @@ "quotes": ["error", "single"], |
@@ -19,5 +19,5 @@ 'use strict'; | ||
var _requestPromise = require('request-promise'); | ||
var _nodeFetch = require('node-fetch'); | ||
var _requestPromise2 = _interopRequireDefault(_requestPromise); | ||
var _nodeFetch2 = _interopRequireDefault(_nodeFetch); | ||
@@ -31,3 +31,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var timestamp, signature, response, _JSON$parse, data, errors; | ||
var timestamp, signature, response, _ref3, data, errors; | ||
@@ -42,4 +42,3 @@ return _regenerator2.default.wrap(function _callee$(_context) { | ||
_context.next = 5; | ||
return (0, _requestPromise2.default)({ | ||
uri: credentials.apiUri, | ||
return (0, _nodeFetch2.default)(credentials.apiUri, { | ||
method: 'POST', | ||
@@ -56,6 +55,12 @@ headers: { | ||
response = _context.sent; | ||
_JSON$parse = JSON.parse(response), data = _JSON$parse.data, errors = _JSON$parse.errors; | ||
_context.next = 8; | ||
return response.json(); | ||
case 8: | ||
_ref3 = _context.sent; | ||
data = _ref3.data; | ||
errors = _ref3.errors; | ||
if (!errors) { | ||
_context.next = 9; | ||
_context.next = 13; | ||
break; | ||
@@ -66,11 +71,11 @@ } | ||
case 9: | ||
case 13: | ||
return _context.abrupt('return', data); | ||
case 12: | ||
_context.prev = 12; | ||
case 16: | ||
_context.prev = 16; | ||
_context.t0 = _context['catch'](2); | ||
throw Error(_context.t0.message); | ||
case 15: | ||
case 19: | ||
case 'end': | ||
@@ -80,3 +85,3 @@ return _context.stop(); | ||
} | ||
}, _callee, this, [[2, 12]]); | ||
}, _callee, this, [[2, 16]]); | ||
})); | ||
@@ -83,0 +88,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
value: true | ||
}); | ||
@@ -16,6 +16,6 @@ | ||
exports.default = function () { | ||
_index2.default.setCredentials({ | ||
apiKey: process.env.API_KEY, | ||
secretKey: process.env.SECRET_KEY | ||
}); | ||
_index2.default.setCredentials({ | ||
apiKey: process.env.API_KEY, | ||
secretKey: process.env.SECRET_KEY | ||
}); | ||
}; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
value: true | ||
}); | ||
@@ -23,9 +23,14 @@ | ||
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 | ||
cancelOrder: _cancelOrder2.default, | ||
createPayment: _createPayment2.default, | ||
placeLimitOrder: _placeLimitOrder2.default, | ||
placeMarketOrder: _placeMarketOrder2.default, | ||
requestRealtimeToken: _requestRealtimeToken2.default | ||
}; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
value: true | ||
}); | ||
@@ -35,12 +35,17 @@ | ||
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 | ||
market: _market2.default, | ||
marketOrderBook: _marketOrderBook2.default, | ||
markets: _markets2.default, | ||
me: _me2.default, | ||
transactions: _transactions2.default, | ||
wallet: _wallet2.default, | ||
wallets: _wallets2.default, | ||
openOrders: _openOrders2.default | ||
}; |
{ | ||
"name": "orionx-sdk", | ||
"version": "1.3.9", | ||
"version": "1.3.10", | ||
"description": "Help developers with Orionx integrations", | ||
@@ -48,8 +48,7 @@ "main": "build/index.js", | ||
"babel-register": "^6.26.0", | ||
"dotenv": "^6.0.0", | ||
"eslint": "^5.5.0", | ||
"dotenv": "^8.2.0", | ||
"eslint": "^6.8.0", | ||
"eslint-plugin-import": "^2.12.0", | ||
"eslint-plugin-node": "^6.0.1", | ||
"eslint-plugin-standard": "^3.1.0", | ||
"tap-nyan": "^1.1.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-standard": "^4.0.1", | ||
"watch": "^1.0.2" | ||
@@ -59,8 +58,7 @@ }, | ||
"babel-runtime": "6", | ||
"graphql": "^14.0.2", | ||
"graphql": "^15.0.0", | ||
"graphql-tag": "^2.9.2", | ||
"jssha": "^2.3.1", | ||
"request": "^2.88.2", | ||
"request-promise": "^4.2.2" | ||
"jssha": "^3.1.0", | ||
"node-fetch": "^2.6.0" | ||
} | ||
} |
204
README.md
@@ -42,5 +42,5 @@ <p align="center"> | ||
Orionx.setCredentials({ | ||
apiKey: '<apiKey>', | ||
secretKey: '<secretKey>', | ||
apiUri: '<https://apiUri.com/graphql>' | ||
apiKey: '<apiKey>', | ||
secretKey: '<secretKey>', | ||
apiUri: 'https://api2.orionx.com/graphql', | ||
}) | ||
@@ -50,194 +50,12 @@ | ||
Orionx.market({code: 'LTCBTC'}) | ||
.then(function(market) { | ||
console.log(market) | ||
}) | ||
.catch(function(err) { | ||
console.log(err) | ||
}) | ||
.then(function (market) { | ||
console.log(market) | ||
}) | ||
.catch(function (err) { | ||
console.log(err) | ||
}) | ||
``` | ||
## Methods | ||
## Documentation & Examples | ||
### cancelOrder | ||
Cancel an order by id. | ||
```js | ||
await Orionx.cancelOrder({orderId: 'asd73jksslksdf'}) | ||
``` | ||
#### Params | ||
**orderId:** Id of the order | ||
--- | ||
### createPayment | ||
The `createPayment()` creates a new payment and returns its data. | ||
```js | ||
await Orionx.createPayment({ | ||
acceptedCurrenciesCodes: ['LTC', 'BTC'], | ||
amount: 1000, | ||
description: 'Testing...', | ||
mainCurrencyCode: 'CLP', | ||
title: 'Test' | ||
}) | ||
``` | ||
#### Params | ||
**acceptedCurrenciesCodes:** The coin codes that the buyer will be able to use as payment | ||
**amount** The price in mainCurrencyCode units | ||
**description** Some descriptive text | ||
**mainCurrencyCode** The coin that you will recieve | ||
**title** Some descriptive title | ||
--- | ||
### me | ||
The `me()` method returns yours user data. | ||
```js | ||
await Orionx.me() | ||
``` | ||
--- | ||
### market | ||
The `market()` method returns the info of a specified market. | ||
```js | ||
await Orionx.market({code: ':marketCode'}) | ||
``` | ||
#### Params | ||
**code:** Market code | ||
--- | ||
### marketOrderBook | ||
The `marketOrderBook()` method returns the info of a specified market order book. | ||
```js | ||
await Orionx.marketOrderBook({marketCode: ':marketCode', limit: 5}) | ||
``` | ||
#### Params | ||
**marketCode:** Market code | ||
**limit** Number of buy/sell orders | ||
--- | ||
### markets | ||
The `markets()` method returns the info of all the markets. | ||
```js | ||
await Orionx.markets() | ||
``` | ||
--- | ||
### placeLimitOrder | ||
The `placeLimitOrder()` creates and returns a limit order . | ||
```js | ||
await Orionx.placeLimitOrder({marketCode: ':marketCode', amount: :amount, limitPrice: :limitPrice, sell: :sell}) | ||
``` | ||
#### Params | ||
**marketCode:** Market code | ||
**amount** The amount to be bought or sold, this amount must be multiplied by 10 ^ (unit amount) | ||
For example BTC units = 8 so to sell 1 BTC amount should be 1 \* 10⁸. | ||
**limitPrice** The price for the order | ||
**sell** Boolean that defines if you buy or sell | ||
--- | ||
### placeMarketOrder | ||
The `placeMarketOrder()` creates and returns a market order . | ||
```js | ||
await Orionx.placeMarketOrder({marketCode: ':marketCode', amount: :amount, sell: :sell}) | ||
``` | ||
#### Params | ||
**marketCode:** Market code | ||
**amount** The amount to be bought or sold, this amount must be multiplied by 10 ^ (unit amount) | ||
For example BTC units = 8 so to sell 1 BTC amount should be 1 \* 10⁸. | ||
**sell** Boolean that defines if you buy or sell | ||
--- | ||
### transactions | ||
The `transactions()` shows all transactions from the given wallet. It's results are paginated. | ||
```js | ||
await Orionx.transactions({walletId: ':walletId', page: :page, limit: :limit }) | ||
``` | ||
#### Params | ||
**walletId:** The ID of the wallet you want to display the transactions | ||
**page:** The page of results you want to display. | ||
**limit:** The number of items per page. | ||
### Wallet | ||
Get a wallet by an id | ||
```js | ||
await Orionx.wallet({currencyCode: ':currencyCode'}) | ||
``` | ||
#### Params | ||
**currencyCode:** Currency code | ||
--- | ||
### Wallets | ||
Gets all my wallets | ||
```js | ||
await Orionx.wallets() | ||
``` | ||
--- | ||
## Docs | ||
For further information about, visit our [Docs](http://docs.orionx.com/docs/getStarted/) | ||
## Opening Issues | ||
If you encounter a bug with the Orionx SDK for JavaScript we would like to hear about it. Search the [existing issues](https://github.com/orionx-dev/orionx-sdk-js/issues) and try to make sure your problem doesn’t already exist before opening a new issue. It’s helpful if you include the version of the SDK, Node.js and OS you’re using. | ||
## License | ||
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details | ||
All documentation is [over here](http://docs.orionx.com/docs/sdk-javascript/) |
import generateSignature from './generateSignature' | ||
import rp from 'request-promise' | ||
import fetch from 'node-fetch' | ||
export default async function({body, credentials}) { | ||
export default async function ({body, credentials}) { | ||
const timestamp = new Date().getTime() / 1000 | ||
@@ -9,4 +9,3 @@ const signature = generateSignature({body, timestamp, secretKey: credentials.secretKey}) | ||
try { | ||
const response = await rp({ | ||
uri: credentials.apiUri, | ||
const response = await fetch(credentials.apiUri, { | ||
method: 'POST', | ||
@@ -20,3 +19,3 @@ headers: { | ||
}) | ||
const {data, errors} = JSON.parse(response) | ||
const {data, errors} = await response.json() | ||
@@ -23,0 +22,0 @@ if (errors) throw Error(errors[0].message) |
@@ -5,6 +5,6 @@ require('dotenv').config() | ||
export default () => { | ||
Orionx.setCredentials({ | ||
apiKey: process.env.API_KEY, | ||
secretKey: process.env.SECRET_KEY | ||
}) | ||
Orionx.setCredentials({ | ||
apiKey: process.env.API_KEY, | ||
secretKey: process.env.SECRET_KEY | ||
}) | ||
} |
@@ -5,8 +5,10 @@ import createPayment from './createPayment' | ||
import placeMarketOrder from './placeMarketOrder' | ||
import requestRealtimeToken from './requestRealtimeToken' | ||
export default { | ||
cancelOrder, | ||
createPayment, | ||
placeLimitOrder, | ||
placeMarketOrder | ||
cancelOrder, | ||
createPayment, | ||
placeLimitOrder, | ||
placeMarketOrder, | ||
requestRealtimeToken | ||
} |
@@ -8,11 +8,13 @@ import market from './market' | ||
import wallets from './wallets' | ||
import openOrders from './openOrders' | ||
export default { | ||
market, | ||
marketOrderBook, | ||
markets, | ||
me, | ||
transactions, | ||
wallet, | ||
wallets | ||
market, | ||
marketOrderBook, | ||
markets, | ||
me, | ||
transactions, | ||
wallet, | ||
wallets, | ||
openOrders | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
74204
5
18
70
1726
60
+ Addednode-fetch@^2.6.0
+ Addedgraphql@15.9.0(transitive)
+ Addedjssha@3.3.1(transitive)
+ Addednode-fetch@2.7.0(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)
- Removedrequest@^2.88.2
- Removedrequest-promise@^4.2.2
- Removedajv@6.12.6(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedbluebird@3.7.2(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedgraphql@14.7.0(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removediterall@1.3.0(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedjssha@2.4.2(transitive)
- Removedlodash@4.17.21(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpsl@1.15.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedrequest-promise@4.2.6(transitive)
- Removedrequest-promise-core@1.1.4(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedstealthy-require@1.1.1(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)
Updatedgraphql@^15.0.0
Updatedjssha@^3.1.0