Skip to content
Permalink
Browse files

Update Create Order Service

  • Loading branch information...
piavgh committed Feb 12, 2019
1 parent 66eb9c3 commit 88473c220487603beb6c0b362a620cd1260e6b33
Showing with 12 additions and 4 deletions.
  1. +12 −4 services/createOrder.js
@@ -1,5 +1,5 @@
import { BASE_URL, tokenAddresses, exchangeAddress } from '../config'
import ws from '../utils/socket'
import { sendToServer } from '../utils/socket'
import { createLocalWalletSigner, createRawOrder } from '../utils/signer'
import { fetchPair } from '../services/fetchPair'

@@ -26,14 +26,22 @@ export const prepareOrderParams = async (amount, price, side) => {

const order = await createRawOrder(params)
// console.log(order)
ws.send(JSON.stringify(order))

return order
}

export const createOrder = async (order, baseToken = null, quoteToken = null) => {
try {
baseToken = baseToken || tokenAddresses.ETH
quoteToken = quoteToken || tokenAddresses.TOMO
const createOrderMessage = {
channel: 'orders',
event: {
type: 'NEW_ORDER',
hash: order.hash,
payload: order,
},
}

sendToServer(createOrderMessage)

} catch (err) {
console.log(err)

0 comments on commit 88473c2

Please sign in to comment.
You can’t perform that action at this time.