Skip to content
This repository was archived by the owner on Mar 18, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Include the following script tags in your HTML:
<script src="../bower_components/async/dist/async.js"></script>
<script src="../bower_components/axios/dist/axios.min.js"></script>
<script src="../bower_components/bignumber.js/bignumber.min.js"></script>
<script src="../bower_components/axios/lib/bn.js"></script>
<script src="../node_modules/bn.js/lib/bn.js"></script>
<script src="../bower_components/lodash/dist/lodash.min.js"></script>
<script src="../bower_components/loopring.js/dist/loopring.min.js"></script>
```
Expand Down
2 changes: 1 addition & 1 deletion dist/loopring.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/keystore.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ exports.decryptKeystoreToPkey = (keystore, password) =>
return wallet;
};

exports.pkeyToKeystore = function (privateKey, password)
exports.pkeyToKeystore = (privateKey, password) =>
{
const salt = crypto.randomBytes(32);
const iv = crypto.randomBytes(16);
Expand Down
4 changes: 2 additions & 2 deletions src/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function Order (data)
'uint8'
];

this.sign = function (privateKey)
this.sign = (privateKey) =>
{
const validation = ajv.validate(orderSchema, data);

Expand Down Expand Up @@ -161,7 +161,7 @@ function Order (data)
};
};

this.cancel = function (amount, privateKey)
this.cancel = (amount, privateKey) =>
{
if (!r || !v || !s)
{
Expand Down
16 changes: 8 additions & 8 deletions src/relay.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ function relay (host)
return new BigNumber(Number(await this.call(params, tag)));
};

this.submitLoopringOrder = async function (order)
this.submitLoopringOrder = async (order) =>
{
request.method = 'loopring_submitOrder';
request.params = [order];
Expand All @@ -362,7 +362,7 @@ function relay (host)
return this.sendSignedTx(tx.signedTx);
};

this.getOrders = async function (filter)
this.getOrders = async (filter) =>
{
request.method = 'loopring_getOrders';
request.params = [filter];
Expand All @@ -381,7 +381,7 @@ function relay (host)
});
};

this.getDepth = async function (filter)
this.getDepth = async (filter) =>
{
request.method = 'loopring_getDepth';
request.params = [ filter ];
Expand All @@ -400,7 +400,7 @@ function relay (host)
});
};

this.getTicker = async function (market)
this.getTicker = async (market) =>
{
request.method = 'loopring_getTicker';
request.params = [market];
Expand All @@ -419,7 +419,7 @@ function relay (host)
});
};

this.getFills = async function (filter)
this.getFills = async (filter) =>
{
// filter:market, address, pageIndex, pageSize,contractVersion
request.method = 'loopring_getFills';
Expand All @@ -439,7 +439,7 @@ function relay (host)
});
};

this.getTrend = async function (market)
this.getTrend = async (market) =>
{
// filter:market
request.method = 'loopring_getTrend';
Expand All @@ -459,7 +459,7 @@ function relay (host)
});
};

this.getRingMined = async function (filter)
this.getRingMined = async (filter) =>
{
// filter:ringHash, orderHash, miner, pageIndex, pageSize,contractVersion
request.method = 'loopring_getRingMined';
Expand All @@ -479,7 +479,7 @@ function relay (host)
});
};

this.getBalances = async function (address)
this.getBalances = async (address) =>
{
request.method = 'loopring_getBalance';
request.params = [{ address }];
Expand Down
16 changes: 8 additions & 8 deletions src/signer.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const transactionSchema = {
};

const ajv = new Ajv();
exports.solSHA3 = function (types, data)
exports.solSHA3 = (types, data) =>
{
const hash = abi.soliditySHA3(types, data);
return hash;
Expand All @@ -82,7 +82,7 @@ exports.signEthTx = (tx, privateKey) =>
return '0x' + ethTx.serialize().toString('hex');
};

exports.generateCancelOrderData = function (order)
exports.generateCancelOrderData = (order) =>
{
const data = abi.rawEncode([
'address[3]',
Expand Down Expand Up @@ -114,42 +114,42 @@ exports.generateCancelOrderData = function (order)
return '0x' + method + data;
};

exports.generateCutOffData = function (timestamp)
exports.generateCutOffData = (timestamp) =>
{
const method = abi.methodID('setCutoff', ['uint']).toString('hex');
const data = abi.rawEncode(['uint'], [timestamp]).toString('hex');
return '0x' + method + data;
};

exports.generateApproveData = function (address, amount)
exports.generateApproveData = (address, amount) =>
{
const method = abi.methodID('approve', ['address', 'uint']).toString('hex');
const data = abi.rawEncode(['address', 'uint'], [address, amount]).toString('hex');
return '0x' + method + data;
};

exports.generateWithdrawData = function (amount)
exports.generateWithdrawData = (amount) =>
{
const method = abi.methodID('withdraw', ['uint']).toString('hex');
const data = abi.rawEncode(['uint'], [amount]).toString('hex');
return '0x' + method + data;
};

exports.generateTransferData = function (address, amount)
exports.generateTransferData = (address, amount) =>
{
const method = abi.methodID('transfer', ['address', 'uint']).toString('hex');
const data = abi.rawEncode(['address', 'uint'], [address, amount]).toString('hex');
return '0x' + method + data;
};

exports.generateBalanceOfData = function (address)
exports.generateBalanceOfData = (address) =>
{
const method = abi.methodID('balanceOf', ['address']).toString('hex');
const data = abi.rawEncode(['address'], [address]).toString('hex');
return '0x' + method + data;
};

exports.generateAllowanceData = function (owner, spender)
exports.generateAllowanceData = (owner, spender) =>
{
const method = abi.methodID('allowance', ['address', 'address']).toString('hex');
const data = abi.rawEncode(['address', 'address'], [owner, spender]).toString('hex');
Expand Down
8 changes: 4 additions & 4 deletions src/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ function Wallet ()
let publicKey;
let address;

this.generate = function ()
this.generate = () =>
{
privateKey = crypto.randomBytes(32);
publicKey = ethereumUtil.privateToPublic(privateKey);
address = ethereumUtil.publicToAddress(publicKey);
};

this.setPrivateKey = function (key)
this.setPrivateKey = (key) =>
{
if (typeof key === 'string')
{
Expand All @@ -44,12 +44,12 @@ function Wallet ()
address = ethereumUtil.publicToAddress(publicKey);
};

this.getAddress = function ()
this.getAddress = () =>
{
return ethereumUtil.toChecksumAddress('0x' + address.toString('hex'));
};

this.toKeystore = function (password)
this.toKeystore = (password) =>
{
return keystore.pkeyToKeystore(privateKey, password);
};
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = {
parallel: true,
uglifyOptions: {
beautify: false,
ecma: 5,
ecma: 6,
compress: true,
comments: false
}
Expand Down