How to use the airswap.js/src/indexer/index function in airswap

To help you get started, we’ve selected a few airswap examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github perich / ethereum-dex-prices-service / exchanges / airswapWorker.js View on Github external
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