Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const Indexer = require('airswap.js/src/indexer/index')
const Router = require('airswap.js/src/protocolMessaging/index.js')
const ethers = require('ethers')
const indexer = new Indexer()
let message
process.on('message', msg => {
message = msg
})
indexer.ready.then(async () => {
const router = new Router({ requireAuthentication: false, address: ethers.Wallet.createRandom().address })
try {
const intents = await indexer.getIntents()
const { method, senderToken, signerToken, senderParam, signerParam } = message
const filteredIntents = intents.filter(intent => {
if (
intent.signerToken === signerToken.toLowerCase() && // eslint-disable-line
intent.senderToken === senderToken.toLowerCase() && // eslint-disable-line
indexer.ready.then(async () => {
const router = new Router({ requireAuthentication: false, address: ethers.Wallet.createRandom().address })
try {
const intents = await indexer.getIntents()
const { method, senderToken, signerToken, senderParam, signerParam } = message
const filteredIntents = intents.filter(intent => {
if (
intent.signerToken === signerToken.toLowerCase() && // eslint-disable-line
intent.senderToken === senderToken.toLowerCase() && // eslint-disable-line
intent.locatorType === 'https'
) {
return true
}
return false
})
if (method === 'getSenderSideQuotes') {
const quotePromises = filteredIntents.map(intent => {