Source:
dev 36c457d
Client for RAILGUN broadcasters over Waku. It reads signed fee quotes and sends an encrypted transact request to the broadcaster of a quote. The broadcaster sends the transaction from its own address and takes the fee from the first output note.
The client matches the wire format of the running broadcasters (ppoi-safe-broadcaster-example-V2): Waku cluster 5, shard 1, and content topics /railgun/v2/0-{chainId}-{fees|transact|transact-response}/json.
import { feeForGas, startBroadcasterClient } from '@railgun-reloaded/broadcaster-client/node'
const client = await startBroadcasterClient(11155111)
const quote = await client.waitForQuote(tokenAddress)
// Build with wallet-sdk: a broadcaster transport with a fee note to quote.railgunAddress,
// minGasPrice, and preTransactionPoi with quote.requiredPOIListKeys.
const txHash = await client.send({ chainId: 11155111, to, data, minGasPrice, preTransactionPOIsPerTxidLeafPerList }, quote)
await client.stop()
@railgun-reloaded/broadcaster-client has no Node built-ins. BroadcasterClient.start takes libp2p options.@railgun-reloaded/broadcaster-client/node adds startBroadcasterClient, which uses the TCP transport. The edge peer of the broadcaster network listens on TCP only, so a browser cannot reach it yet.