File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,7 @@ npm install cryptomarket
1111```
1212# Documentation
1313
14- [ The api documentation] ( https://api.exchange.cryptomkt.com )
15-
14+ This sdk makes use of the [ api version 2] ( https://api.exchange.cryptomkt.com/v2 ) of cryptomarket.
1615
1716# Quick Start
1817
Original file line number Diff line number Diff line change @@ -39,7 +39,9 @@ class Client {
3939
4040 async makeRequest ( method , endpoint , params , publc = false ) {
4141 let url = new URL ( apiUrl + apiVersion + endpoint )
42- let query = new URLSearchParams ( params ) . toString ( )
42+ let rawQuery = new URLSearchParams ( params )
43+ rawQuery . sort ( )
44+ let query = rawQuery . toString ( )
4345
4446 // build fetch options
4547 let opts = {
@@ -53,7 +55,7 @@ class Client {
5355 if ( ! publc ) opts . headers [ 'Authorization' ] = this . buildCredential ( method , endpoint , query )
5456
5557 // include query params to call
56- if ( method === methodGet ) url . search = query
58+ if ( method === methodGet || method === methodPut ) url . search = query
5759 else opts . body = query
5860
5961 // make request
@@ -79,7 +81,7 @@ class Client {
7981 let timestamp = Math . floor ( Date . now ( ) / 1000 ) . toString ( )
8082 let msg = httpMethod + timestamp + apiVersion + method
8183 if ( query ) {
82- if ( httpMethod === methodGet ) msg += "?"
84+ if ( httpMethod === methodGet || httpMethod === methodPut ) msg += "?"
8385 msg += query
8486 }
8587 let signature = CryptoJS . HmacSHA256 ( msg , this . apiSecret ) . toString ( )
You can’t perform that action at this time.
0 commit comments