How to use @airswap/swap - 1 common examples

To help you get started, we’ve selected a few @airswap/swap 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 airswap / airswap-protocols / utils / debugger / src / check-order.js View on Github external
const checkOrderSignature = async (order, provider, errors) => {
  // Check signature is valid
  const isValid = signatures.isSignatureValid(order)
  if (!isValid) {
    errors.push('Signature invalid')
  }

  // Check signer authorized signatory
  if (order['signature']['signatory'] !== order['signer']['wallet']) {
    const swapContract = new ethers.Contract(
      order['signature']['validator'],
      Swap.abi,
      provider
    )

    await swapContract
      .signerAuthorizations(
        order['signer']['wallet'],
        order['signature']['signatory']
      )
      .then(isAuthorized => {
        if (!isAuthorized) {
          errors.push(`Signatory not authorized`)
        }
      })
  }
  return errors
}

@airswap/swap

AirSwap: Atomic Token Swap

MIT
Latest version published 3 days ago

Package Health Score

73 / 100
Full package analysis

Popular @airswap/swap functions

Similar packages