Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(async () => {
let accounts = await web3.eth.getAccounts();
this.EscrowContract = await deployContract();
// Generating data each two second
setInterval(async () => {
await this.EscrowContract.methods
.createEscrow(Math.floor(Date.now() / 1000), accounts[0], accounts[1])
.send({ from: accounts[0] });
}, 1 * 1000);
// ======================
const eventSyncer = new Phoenix(web3.currentProvider);
await eventSyncer.init();
const typeDefs = `
type Escrow {
buyer: String!
seller: String!
escrowId: Int!
}
type Query {
escrows: Escrow!
}
`;
const resolvers = {
Query: {
export default function serverPipeMiddleware({ getState, dispatch }) {
// we can create a pipe immediately
// phoenix will connect it ASAP
const phoenix = createPhoenix(WebSocket, {
uri: buildEndpointUri(config['server-endpoint']['uri']),
timeout: config['server-endpoint']['timeout']
});
//just for messages emulation
if (process.env.NODE_ENV !== 'production') {
window.dispatch = dispatch;
window.handleServerMessage = handleServerMessage;
window.MESSAGE_NAME = MESSAGE_NAME;
}
phoenix
.on('connected', () => {
log('server connected');
dispatch(updateConnectionStatus(true));
export default function serverPipeMiddleware({ getState, dispatch }) {
// we can create a pipe immediately
// phoenix will connect it ASAP
const phoenix = createPhoenix(WebSocket, {
uri: buildEndpointUri(config['server-endpoint']['uri']),
timeout: config['server-endpoint']['timeout'],
});
//just for messages emulation
if (process.env.NODE_ENV !== 'production') {
window.dispatch = dispatch;
window.handleServerMessage = handleServerMessage;
window.MESSAGE_NAME = MESSAGE_NAME;
}
phoenix
.on('connected', () => {
log('server connected');
dispatch(updateConnectionStatus(true));
})