aboutsummaryrefslogtreecommitdiffstats
path: root/packages/testnet-faucets/src/ts/handler.ts
diff options
context:
space:
mode:
authorLeonid <logvinov.leon@gmail.com>2018-02-12 22:01:24 +0800
committerGitHub <noreply@github.com>2018-02-12 22:01:24 +0800
commit7f1e789264e2b67c7feffc633bd64caa257657cc (patch)
tree721cee22fbc45c71ea21fd296dda88c0a03d75a5 /packages/testnet-faucets/src/ts/handler.ts
parentba57c34adb0348af61210aa0bbee3e734b477f58 (diff)
parent07d00cc515e0f9825b81595386b358593b7a3d6f (diff)
downloaddexon-sol-tools-7f1e789264e2b67c7feffc633bd64caa257657cc.tar
dexon-sol-tools-7f1e789264e2b67c7feffc633bd64caa257657cc.tar.gz
dexon-sol-tools-7f1e789264e2b67c7feffc633bd64caa257657cc.tar.bz2
dexon-sol-tools-7f1e789264e2b67c7feffc633bd64caa257657cc.tar.lz
dexon-sol-tools-7f1e789264e2b67c7feffc633bd64caa257657cc.tar.xz
dexon-sol-tools-7f1e789264e2b67c7feffc633bd64caa257657cc.tar.zst
dexon-sol-tools-7f1e789264e2b67c7feffc633bd64caa257657cc.zip
Merge branch 'development' into fix/windows_install
Diffstat (limited to 'packages/testnet-faucets/src/ts/handler.ts')
-rw-r--r--packages/testnet-faucets/src/ts/handler.ts18
1 files changed, 9 insertions, 9 deletions
diff --git a/packages/testnet-faucets/src/ts/handler.ts b/packages/testnet-faucets/src/ts/handler.ts
index 5ed9ce628..5f6ada186 100644
--- a/packages/testnet-faucets/src/ts/handler.ts
+++ b/packages/testnet-faucets/src/ts/handler.ts
@@ -129,18 +129,18 @@ export class Handler {
}
const zeroEx = networkConfig.zeroEx;
res.setHeader('Content-Type', 'application/json');
- const makerTokenAddress = await zeroEx.tokenRegistry.getTokenAddressBySymbolIfExistsAsync(requestedAssetType);
- if (_.isUndefined(makerTokenAddress)) {
+ const makerToken = await zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(requestedAssetType);
+ if (_.isUndefined(makerToken)) {
throw new Error(`Unsupported asset type: ${requestedAssetType}`);
}
const takerTokenSymbol =
requestedAssetType === RequestedAssetType.WETH ? RequestedAssetType.ZRX : RequestedAssetType.WETH;
- const takerTokenAddress = await zeroEx.tokenRegistry.getTokenAddressBySymbolIfExistsAsync(takerTokenSymbol);
- if (_.isUndefined(takerTokenAddress)) {
+ const takerToken = await zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(takerTokenSymbol);
+ if (_.isUndefined(takerToken)) {
throw new Error(`Unsupported asset type: ${requestedAssetType}`);
}
- const makerTokenAmount = new BigNumber(0.1);
- const takerTokenAmount = new BigNumber(0.1);
+ const makerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(0.1), makerToken.decimals);
+ const takerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(0.1), takerToken.decimals);
const order: Order = {
maker: configs.DISPENSER_ADDRESS,
taker: req.params.recipient,
@@ -148,8 +148,8 @@ export class Handler {
takerFee: new BigNumber(0),
makerTokenAmount,
takerTokenAmount,
- makerTokenAddress,
- takerTokenAddress,
+ makerTokenAddress: makerToken.address,
+ takerTokenAddress: takerToken.address,
salt: ZeroEx.generatePseudoRandomSalt(),
exchangeContractAddress: zeroEx.exchange.getContractAddress(),
feeRecipient: ZeroEx.NULL_ADDRESS,
@@ -159,7 +159,7 @@ export class Handler {
const signature = await zeroEx.signOrderHashAsync(orderHash, configs.DISPENSER_ADDRESS, false);
const signedOrder = {
...order,
- signature,
+ ecSignature: signature,
};
const signedOrderHash = ZeroEx.getOrderHashHex(signedOrder);
const payload = JSON.stringify(signedOrder);