orionx-sdk
Advanced tools
Comparing version 2.0.0-rc6 to 2.0.0-rc7
@@ -39,3 +39,3 @@ "use strict"; | ||
}); | ||
return response; | ||
return response.wallet; | ||
}); | ||
@@ -47,15 +47,17 @@ } | ||
query sdk_getAccounts { | ||
wallets { | ||
_id | ||
currency { | ||
code | ||
units | ||
me { | ||
wallets { | ||
_id | ||
currency { | ||
code | ||
units | ||
} | ||
balance | ||
availableBalance | ||
availableNetworks { | ||
code | ||
} | ||
balanceUSD | ||
balanceCLP | ||
} | ||
balance | ||
availableBalance | ||
availableNetworks { | ||
code | ||
} | ||
balanceUSD | ||
balanceCLP | ||
} | ||
@@ -65,3 +67,3 @@ } | ||
const response = yield this.apiClient.call(query, {}); | ||
return response; | ||
return response.me.wallets; | ||
}); | ||
@@ -68,0 +70,0 @@ } |
@@ -52,2 +52,5 @@ "use strict"; | ||
const data = yield response.json(); | ||
if (response.status === 500) { | ||
throw new Error(data.message); | ||
} | ||
return data; | ||
@@ -57,2 +60,3 @@ }); | ||
call(query, variables) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -69,8 +73,16 @@ try { | ||
}; | ||
if (this.callMock) | ||
return this.callMock(this.apiEndpoint, body, headers); | ||
return this.apiCall(this.apiEndpoint, body, headers); | ||
const apiFunction = (_a = this.callMock) !== null && _a !== void 0 ? _a : this.apiCall; | ||
const response = yield apiFunction(this.apiEndpoint, body, headers); | ||
if (response.errors) { | ||
if (response.errors[0].path && | ||
response.errors.length !== Object.keys(response.data).length) { | ||
return response.data; | ||
} | ||
throw new Error(response.errors[0].message); | ||
} | ||
return response.data; | ||
} | ||
catch (error) { | ||
console.error('Error:', error); | ||
console.error(error.message); | ||
throw new Error(error.message); | ||
} | ||
@@ -77,0 +89,0 @@ }); |
@@ -42,3 +42,3 @@ "use strict"; | ||
}); | ||
return response; | ||
return response.market; | ||
}); | ||
@@ -67,3 +67,3 @@ } | ||
const response = yield this.apiClient.call(query, {}); | ||
return response; | ||
return response.markets; | ||
}); | ||
@@ -93,3 +93,3 @@ } | ||
}); | ||
return response; | ||
return response.marketOrderBook; | ||
}); | ||
@@ -96,0 +96,0 @@ } |
@@ -48,3 +48,3 @@ "use strict"; | ||
}); | ||
return response; | ||
return response.order; | ||
}); | ||
@@ -82,3 +82,3 @@ } | ||
const response = yield this.apiClient.call(query, parameters); | ||
return response; | ||
return response.orders; | ||
}); | ||
@@ -123,3 +123,3 @@ } | ||
}); | ||
return response; | ||
return response.placeLimitOrder; | ||
}); | ||
@@ -161,3 +161,3 @@ } | ||
}); | ||
return response; | ||
return response.placeMarketOrder; | ||
}); | ||
@@ -208,3 +208,3 @@ } | ||
}); | ||
return response; | ||
return response.placeStopLimitOrder; | ||
}); | ||
@@ -252,3 +252,3 @@ } | ||
}); | ||
return response; | ||
return response.placeStopMarketOrder; | ||
}); | ||
@@ -271,3 +271,3 @@ } | ||
}); | ||
return response; | ||
return response.cancelOrder; | ||
}); | ||
@@ -274,0 +274,0 @@ } |
@@ -17,4 +17,4 @@ import Api from './api'; | ||
transactions: Transactions; | ||
constructor(apiKey: string, apiSecret: string, apiEndpoint: string, callMock?: (endpoint: string, body: any, headers: any) => Response, hasherMock?: (secret: string, timestamp: any, payload: string) => string); | ||
constructor(apiKey: string, apiSecret: string, apiEndpoint: string, callMock?: (endpoint: string, body: any, headers: any) => any, hasherMock?: (secret: string, timestamp: any, payload: string) => string); | ||
} | ||
export default Orionx; |
@@ -9,3 +9,3 @@ import { GetTransactionsParameters } from './types'; | ||
withdrawalRequest(walletId: string, accountId: string, amount: number): Promise<any>; | ||
convert(quoteOptionId: string, amount: number, marketCode: string, sell: boolean): Promise<void>; | ||
convert(quoteOptionId: string, amount: number, marketCode: string, sell: boolean): Promise<any>; | ||
} |
@@ -19,4 +19,4 @@ "use strict"; | ||
const query = ` | ||
query sdk_getTransaction($transaction: ID!) { | ||
transaction(transactionId: $transactionId) { | ||
query sdk_getTransaction($_id: ID!) { | ||
transaction(_id: $_id) { | ||
_id | ||
@@ -57,5 +57,5 @@ amount | ||
const response = yield this.apiClient.call(query, { | ||
transactionId, | ||
_id: transactionId, | ||
}); | ||
return response; | ||
return response.transaction; | ||
}); | ||
@@ -103,3 +103,3 @@ } | ||
const response = yield this.apiClient.call(query, parameters); | ||
return response; | ||
return response.transactions; | ||
}); | ||
@@ -111,6 +111,6 @@ } | ||
mutation sdk_send( | ||
$fromWalletId: ID | ||
$fromWalletId: ID! | ||
$contactId: ID | ||
$network: String | ||
$amount: BigInt | ||
$network: String! | ||
$amount: BigInt! | ||
$description: String | ||
@@ -130,9 +130,11 @@ $clientId: ID | ||
amount | ||
limitPrice | ||
status | ||
createdAt | ||
price | ||
hash | ||
date | ||
market { | ||
code | ||
} | ||
clientId | ||
meta { | ||
status | ||
} | ||
} | ||
@@ -149,3 +151,3 @@ } | ||
}); | ||
return response; | ||
return response.sendCrypto; | ||
}); | ||
@@ -161,3 +163,3 @@ } | ||
) { | ||
withdrawalRequest( | ||
requestWithdrawal( | ||
walletId: $walletId | ||
@@ -170,3 +172,2 @@ accountId: $accountId | ||
commission | ||
currency | ||
date | ||
@@ -183,3 +184,3 @@ type | ||
}); | ||
return response; | ||
return response.requestWithdrawal; | ||
}); | ||
@@ -191,6 +192,6 @@ } | ||
mutation sdk_convert( | ||
$quoteOptionId: ID | ||
$amount: BigInt | ||
$marketCode: ID | ||
$sell: Boolean | ||
$quoteOptionId: String | ||
$amount: BigInt! | ||
$marketCode: String! | ||
$sell: Boolean! | ||
) { | ||
@@ -211,2 +212,3 @@ instantTransaction( | ||
}); | ||
return response.instantTransaction; | ||
}); | ||
@@ -213,0 +215,0 @@ } |
@@ -6,4 +6,4 @@ import Api from './api'; | ||
constructor(apiClient: Api); | ||
getUserId(): Promise<any>; | ||
getUserId(): Promise<string>; | ||
getMe(): Promise<any>; | ||
} |
@@ -18,2 +18,3 @@ "use strict"; | ||
getUserId() { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -28,3 +29,3 @@ const query = ` | ||
const response = yield this.apiClient.call(query, {}); | ||
return response; | ||
return (_a = response.me) === null || _a === void 0 ? void 0 : _a._id; | ||
}); | ||
@@ -53,3 +54,3 @@ } | ||
const response = yield this.apiClient.call(query, {}); | ||
return response; | ||
return response.me; | ||
}); | ||
@@ -56,0 +57,0 @@ } |
{ | ||
"name": "orionx-sdk", | ||
"version": "2.0.0-rc6", | ||
"version": "2.0.0-rc7", | ||
"description": "Official Orionx SDK for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
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
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
58650
952