fluidex/dingir-exchange

Auth: sig check for put order

Opened this issue · 3 comments

lispc commented

Better implement this in restapi process?

not only put_order but also cancel_order and transfer

and it's kind of related to #59

BTW, we need 2 signature:

  1. sign the rpc/restapi payload (which is not exactly the same as a L2tx)
  2. sign the L2tx hash (to be used in circuit)

BTW, this seems not of priority for demo verison

lispc commented

WIP

Step1: add POST 'restapi/order' endpoint in 'src/bin/restapi'

The following request will be processed by https://github.com/Fluidex/grpc-dynamic-gateway. ( See https://github.com/Fluidex/dingir-exchange/blob/0f8cc5f2080ebcb3f42983c1c2a7c2f78b72f692/docker/docker-compose.yaml#L13 for deployment details) .

curl 'http://18.180.248.43:50052/api/order' \
  -H 'Connection: keep-alive' \
  -H 'Pragma: no-cache' \
  -H 'Cache-Control: no-cache' \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36' \
  -H 'Content-Type: application/json;charset=UTF-8' \
  -H 'Origin: http://18.180.248.43:8763' \
  -H 'Referer: http://18.180.248.43:8763/exchange/trade/ETH_USDT' \
  -H 'Accept-Language: en-US,en;q=0.9,ja;q=0.8,zh-CN;q=0.7,zh;q=0.6,zh-TW;q=0.5,de;q=0.4,es;q=0.3' \
  -H 'Cookie: _ga=GA1.1.1669125053.1609401719; lang=en; _gid=GA1.1.1582601408.1623746909' \
  --data-raw '{"market":"ETH_USDT","order_type":0,"order_side":0,"amount":"0.001","taker_fee":"0","maker_fee":"0","price":"2298.25","user_id":null}' \
  --compressed \
  --insecure
{"id":"197370","market":"ETH_USDT","order_side":"ASK","order_type":"LIMIT","user_id":0,"create_time":1623747132.308194,"update_time":1623747132.308351,"price":"2298.25","amount":"0.001","taker_fee":"0","maker_fee":"0","remain":"0.000","finished_base":"0.001","finished_quote":"2.29825","finished_fee":"0"}

Currently we convert to json to grpc request by the node repo. We need to implement this in Rust in the production system. So (1) add the endpoint here, (2)