Documentation
¶
Index ¶
- func NewBitcoinSubscriber(rpcUrl string) *bitcoinSubscriber
- func NewEthereumMainnetSubscriber(rpcUrl string, opts ...EthereumMainnetSubscriberOption) *ethereumMainnetSubscriber
- func NewSolanaMainnetSubscriber(rpcUrl string) *solanaMainnetSubscriber
- type ChainName
- type EthereumMainnetSubscriberOption
- type SubscriberManager
- type TrackedWalletEvent
- type TransactionSubscriber
- type WalletTransactionTracker
- type WithRpcClientOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBitcoinSubscriber ¶
func NewBitcoinSubscriber(rpcUrl string) *bitcoinSubscriber
func NewEthereumMainnetSubscriber ¶
func NewEthereumMainnetSubscriber(rpcUrl string, opts ...EthereumMainnetSubscriberOption) *ethereumMainnetSubscriber
func NewSolanaMainnetSubscriber ¶
func NewSolanaMainnetSubscriber(rpcUrl string) *solanaMainnetSubscriber
Types ¶
type EthereumMainnetSubscriberOption ¶
type EthereumMainnetSubscriberOption interface {
Apply(*ethereumMainnetSubscriber)
}
type SubscriberManager ¶
type SubscriberManager interface { WalletTransactionTracker // RegisterSubscribers registers new subscribers and calls its Init. // RegisterSubscriber should not be called concurrently. RegisterSubscribers(subscribers ...TransactionSubscriber) error // StartAll accepts a sink which will receive all tracked wallet events from // all of the registered subscribers. StartAll blocks and exits with an // error if something goes wrong in one of the registered subscribers. StartAll(sink chan<- *TrackedWalletEvent) error }
SubscriberManager manages all blockchain transaction subscribers within the application
func NewSubsciberManager ¶
func NewSubsciberManager() SubscriberManager
type TrackedWalletEvent ¶
type TrackedWalletEvent struct { ChainName ChainName Source string Destination string Amount *big.Int Fees *big.Int }
TrackedWalletEvent represents a tracked wallet event. For bitcoin events, Source will contain a string of comma separated addresses. For solana events, if amount is sender's value, Source will be a single wallet address and Destination will contain comma separated recipient addresses. If amount is recipient's value, Source will contain comma separated sender addresses and Destination will be a single wallet address. For solana, Fees will be non 0 only for fee payer Source.
type TransactionSubscriber ¶
type TransactionSubscriber interface { // Init initializes the subscriber, sets up any required connections and // prepares the subscriber to start receiving messages. Init() error // Start starts the subscriber. Returned channel will produce events // whenever a transaction for one of the registered wallets is received from // RPC provider. Start does not block. Start() (<-chan *TrackedWalletEvent, <-chan error) // TrackWallet starts to track transactions of provided wallet TrackWallet(wallet string) error // UntrackWallet stops tracking wallet's transactions UntrackWallet(wallet string) error // Name returns the chain name of given TransactionSubscriber Name() ChainName }
TransactionSubscriber subscribes to real time chain data for a particular blockchain.
type WalletTransactionTracker ¶
type WalletTransactionTracker interface { // TrackWallet starts tracking wallet's transactions within the given chain // subscriber. TrackWallet(wallet string, chain ChainName) error // UntrackWallet stops tracking wallet's transactions within the given chain // subscriber. UntrackWallet(wallet string, chain ChainName) error }
type WithRpcClientOptions ¶
type WithRpcClientOptions struct {
Opts []rpc.ClientOption
}
func (WithRpcClientOptions) Apply ¶
func (w WithRpcClientOptions) Apply(e *ethereumMainnetSubscriber)