Skip to content
This repository has been archived by the owner on Mar 18, 2019. It is now read-only.

Commit

Permalink
add getOrderByHash
Browse files Browse the repository at this point in the history
  • Loading branch information
lyddream committed Oct 10, 2018
1 parent 17b746c commit 710dcab
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@ const loopring = require('./lib/index');
module.exports = {
common: loopring.common,
ethereum: loopring.ethereum,
relay: loopring.relay
relay: loopring.relay,
WalletUtils: loopring.WalletUtils,
ContractUtils: loopring.ContractUtils,
EthRpcUtils: loopring.EthRpcUtils,
RelayRpcUtils: loopring.RelayRpcUtils,
SocketUtils: loopring.SocketUtils,
Utils: loopring.Utils
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "loopring.js",
"version": "2.0.1",
"version": "2.0.2",
"description": "Loopring javascript library",
"scripts": {
"lint": "eslint . --fix",
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import relay from './relay';
import WalletUtils from './WalletUtils';
import ContractUtils from './ethereum/contracts/Contracts';
import EthRpcUtils from './ethereum/eth';
import RelayRpcUitls from './relay/relay';
import RelayRpcUtils from './relay/relay';
import SocketUtils from './relay/socket';
import Utils from './common/utils';
export {
Expand All @@ -14,7 +14,7 @@ export {
WalletUtils,
ContractUtils,
EthRpcUtils,
RelayRpcUitls,
RelayRpcUtils,
SocketUtils,
Utils
};
22 changes: 19 additions & 3 deletions src/relay/rpc/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ export default class Order
{
return setTempStore(this.host, key, value);
}

getOrderByHash (filter)
{
return getOrderHash(this.host, filter);
}
}

/**
Expand Down Expand Up @@ -83,9 +88,7 @@ export function getOrders (host, filter)
/**
* @description Get cut off time of the address.
* @param host
* @param address
* @param delegateAddress
* @param blockNumber
* @param filter
* @returns {Promise.<*>}
*/
export function getCutoff (host, filter)
Expand Down Expand Up @@ -314,3 +317,16 @@ export function cancelOrder (host, {sign, orderHash, tokenS, tokenB, cutoff, typ
return Promise.resolve(new Response(code.PARAM_INVALID.code, code.PARAM_INVALID.msg));
}
}

export function getOrderByHash (host, filter)
{
const body = {};
body.method = 'loopring_getOrderByHash';
body.params = [{orderHash: filter.orderHash}];
body.id = id();
body.jsonrpc = '2.0';
return request(host, {
method: 'post',
body
});
}

0 comments on commit 710dcab

Please sign in to comment.