Last active
October 7, 2024 04:31
-
-
Save rubpy/555c8a2ed4024a0284986c0e416e46f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
address, | |
createDefaultRpcSubscriptionsTransport, | |
createSubscriptionRpc, | |
} from '@solana/web3.js'; | |
import { DEFAULT_RPC_CONFIG } from '@solana/rpc'; | |
import { createSolanaRpcEnhancedSubscriptionsApi } from './enhanced-notifications'; | |
// ----------------------------------------------------------------------------- | |
(async (rpcSubscriptionsUrl: string) => { | |
const api = createSolanaRpcEnhancedSubscriptionsApi( | |
DEFAULT_RPC_CONFIG, | |
); | |
const transport = createDefaultRpcSubscriptionsTransport({ url: rpcSubscriptionsUrl }); | |
const rpcSubscriptions = createSubscriptionRpc({ api, transport }); | |
const abortController = new AbortController(); | |
const transactionNotifications = await rpcSubscriptions | |
.transactionNotifications({ | |
accountInclude: [address('5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1')], | |
}, { | |
commitment: 'processed', | |
showRewards: false, | |
encoding: 'jsonParsed', | |
transactionDetails: 'full', | |
maxSupportedTransactionVersion: 0, | |
}) | |
.subscribe({ abortSignal: abortController.signal }); | |
for await (const notification of transactionNotifications) { | |
console.log(notification); | |
} | |
})(process.env.SOL_ATLAS_WS_URL || 'wss://atlas-mainnet.helius-rpc.com/?api-key=00000000-0000-0000-0000-000000000000'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment