-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
socket auction integrate auction, order, drop remove polling code remove unused code upadte comment update env websocket add socket url and trade event for sell
- Loading branch information
1 parent
3eb900c
commit c2e9549
Showing
13 changed files
with
386 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
export enum EventName { | ||
ping = 'ping', | ||
pong = 'pong', | ||
startSession = 'startSession', | ||
stopSession = 'stopSession', | ||
orderOpened = 'orderOpened', | ||
orderFilled = 'orderFilled', | ||
orderCanceled = 'orderCanceled', | ||
traded = 'traded', | ||
auctionCreated = 'auctionCreated', | ||
auctionUpdated = 'auctionUpdated', | ||
auctionUpdateBid = 'auctionUpdateBid', | ||
auctionUpdateStatus = 'auctionUpdateStatus', | ||
getAuctionByAddressAndWallet = 'getAuctionByAddressAndWallet', | ||
dropCreatedOrUpdated = 'dropCreatedOrUpdated' | ||
} | ||
|
||
export function parseSocketMessage<T>(message: string): { event: EventName; data: T } | undefined { | ||
try { | ||
return JSON.parse(message); | ||
} catch (error) { | ||
console.log('Parse socket message error=', error); | ||
} | ||
} | ||
|
||
export function stringifyMessage(data: { event: EventName; data: any }): string { | ||
return JSON.stringify(data); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.