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
import WebSocket from 'isomorphic-ws'; | |
import { EventEmitter } from 'events'; | |
const CONNECTION_TIMEOUT = 2000; | |
const ACKNOWLEDGMENT_TIMEOUT = 2000; | |
const RESPONSE_TIMEOUT = 3000; | |
const timeout = async (ms, message) => new Promise((_, reject) => { | |
const id = setTimeout(() => { | |
clearTimeout(id); |
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
await reducerHandler.invoke("token:debit", { | |
address: senderAddress, | |
amount: asset.value, | |
}); |
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
await reducerHandler.invoke("token:credit", { | |
address: organization.ownerAddress, | |
amount: asset.value, | |
}); |
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
await reducerHandler.invoke("event:soldTicket", { | |
eventId: asset.eventId, | |
typeId: asset.typeId, | |
}); |
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
const soldTicket = async ({params, stateStore}) => { | |
const { eventId, typeId } = params; | |
const registeredEventsBuffer = await stateStore.chain.get( | |
CHAIN_STATE_EVENTS | |
); | |
if (!registeredEventsBuffer) { | |
throw new Error('No events found'); | |
} |
OlderNewer