dingir-exchange
dingir-exchange copied to clipboard
maintain nonce for users
in restapi or matchengine? Do we need to add this feature in our first demo version?
for demo, no.
But for L2 transfer/withdraw we need to sign the nonce.
BTW we also need to maintain "last_order_id" for user. so that he can sign
OrderInput
...
hash(): bigint {
// although there is no 'TxType.PlaceOrder' now, we can see it as a 'SignType'
let data = hash([TxType.PlaceOrder, this.orderId, this.tokenSell, this.tokenBuy, this.totalSell, this.totalBuy]);
//data = hash([data, accountID, nonce]);
// nonce and orderID seems redundant?
data = hash([data, this.accountID]);
return data;
}
signWith(account: Account) {
this.sig = account.signHash(this.hash());
}