<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jeffrey Agabaenwere</title>
    <description>The latest articles on DEV Community by Jeffrey Agabaenwere (@jeffreybuilds).</description>
    <link>https://dev.to/jeffreybuilds</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3258308%2F2bf9a021-5305-41a2-8c8b-f370e56699ac.jpg</url>
      <title>DEV Community: Jeffrey Agabaenwere</title>
      <link>https://dev.to/jeffreybuilds</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jeffreybuilds"/>
    <language>en</language>
    <item>
      <title>Listening to Sui Transactions with JavaScript – A DevRel Use Case</title>
      <dc:creator>Jeffrey Agabaenwere</dc:creator>
      <pubDate>Wed, 11 Jun 2025 17:02:05 +0000</pubDate>
      <link>https://dev.to/jeffreybuilds/listening-to-sui-transactions-with-javascript-a-devrel-use-case-4c67</link>
      <guid>https://dev.to/jeffreybuilds/listening-to-sui-transactions-with-javascript-a-devrel-use-case-4c67</guid>
      <description>&lt;p&gt;When building blockchain or fintech apps, reacting to &lt;strong&gt;real-time blockchain events&lt;/strong&gt; is key.&lt;/p&gt;

&lt;p&gt;Whether you're sending confirmation emails, triggering fiat payouts, or updating dashboards — knowing exactly &lt;em&gt;when&lt;/em&gt; a transaction happens gives your app &lt;strong&gt;superpowers&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In this post, I’ll show you how to &lt;strong&gt;listen for Sui transactions in real time using JavaScript&lt;/strong&gt;, and walk through a real-world use case: &lt;strong&gt;triggering a Naira payout after receiving SUI&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This is the same pattern I used while building &lt;code&gt;suiFi&lt;/code&gt; — a swap engine that converts SUI directly to Nigerian Naira. 🚀&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Node.js installed&lt;/li&gt;
&lt;li&gt;A basic understanding of the &lt;a href="https://docs.sui.io/" rel="noopener noreferrer"&gt;Sui blockchain&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Familiarity with JavaScript/TypeScript&lt;/li&gt;
&lt;li&gt;An RPC provider (e.g. &lt;code&gt;wss://rpc.testnet.sui.io&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🔧 Step 1: Project Setup
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;sui-listener
&lt;span class="nb"&gt;cd &lt;/span&gt;sui-listener
npm init &lt;span class="nt"&gt;-y&lt;/span&gt;
npm &lt;span class="nb"&gt;install&lt;/span&gt; @mysten/sui.js

- Then create a file named index.js.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Connect to Sui WebSocket
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { WebSocketClient } = require('@mysten/sui.js');

const client = new WebSocketClient('wss://rpc.testnet.sui.io');//replace RPC with mainnet

client.connect().then(() =&amp;gt; {
  console.log('✅ Connected to Sui WebSocket');
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const walletAddress = '0xYOUR_WALLET_HERE';

client.subscribeTransactionEvents(
  {
    filter: {
      InputObject: walletAddress,
    },
  },
  (event) =&amp;gt; {
    console.log('🔔 New Sui Transaction Detected:');
    console.log(JSON.stringify(event, null, 2));

    // 🔁 Add your action logic here
  }
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
npm install axios

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const axios = require('axios');

async function sendPayout(ngnAmount, recipient) {
  await axios.post('https://your-fintech-api.com/payout', {
    amount: ngnAmount,
    recipientAccount: recipient,
  });
} 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;br&gt;
Listening to blockchain transactions is more than just reading data — it’s about empowering real-world action in real time.&lt;/p&gt;

&lt;p&gt;If this helped you or you build something with it, tag me — I’d love to see what you’re working on!&lt;/p&gt;

&lt;p&gt;Follow me for more DevRel content and practical guides on Web3, fintech, and developer experience.&lt;br&gt;
💬 Twitter/X: [https//:x.com/Jeffreyonsui/]&lt;br&gt;
📁 GitHub: [&lt;a href="https://github.com/Jeffreyxdev/" rel="noopener noreferrer"&gt;https://github.com/Jeffreyxdev/&lt;/a&gt;]&lt;/p&gt;

</description>
      <category>programming</category>
      <category>blockchain</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
