Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

144
Views
Passing eventlisteners in promisses

Code process:

  1. Transaction is created with completeorders() function.
  2. Created transaction event listener activates and logs to console.
  3. Once the created transaction event listener activates, the confirmed transaction or failed transaction event will be waiting to be completed.
  4. once either the confirmed transaction or failed transaction event occurs, the script stops running.

I am having issues with creating the promise to wait for the transaction confirmation or transaction failed once the created transaction event is triggered. Here is my attempt at this process so far:

async function logging() {
    seaport.addListener(openseajs.EventType.TransactionCreated, ({ transactionHash, event }) => {
      console.log(`Transaction Created : ${transactionHash} Waiting for confirmation`);
      return await new Promise(function(resolve){ 
        seaport.addListener(openseajs.EventType.TransactionConfirmed, ({ transactionHash, event }) => {
          console.log(`Transaction Confirmed : ${transactionHash}`);
          resolve();
        }) || 
        seaport.addListener(openseajs.EventType.TransactionFailed, ({ transactionHash, event }) => {
          console.log(`Transaction Failed : ${transactionHash}`)});
          resolve();
      })
    
    
     })
      console.log("listening...")
    
    };

async function main() {
  await function1();
  await function2();
  await completeorders();
}
setInterval(main,5000);
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!