Skip to content

Added RPC Subscription Support to the Client#154

Merged
lmittmann merged 5 commits intomainfrom
feat/subscription
Jun 12, 2024
Merged

Added RPC Subscription Support to the Client#154
lmittmann merged 5 commits intomainfrom
feat/subscription

Conversation

@lmittmann
Copy link
Copy Markdown
Owner

This PR adds support for RPC subscription (resolves #38)

New API

// package w3:
func (c *Client) SubscribeCtx(ctx context.Context, s w3types.RPCSubscriber) (*rpc.ClientSubscription, error)
func (c *Client) Subscribe(s w3types.RPCSubscriber) (*rpc.ClientSubscription, error)

// package w3types:
type RPCSubscriber {
	CreateRequest() (namespace string, ch any, params []any, err error)
}

// package module/eth:
func NewHeads(ch chan<- *types.Header) w3types.RPCSubscriber
func PendingTransactions(ch chan<- *types.Transaction) w3types.RPCSubscriber
func NewLogs(ch chan<- *types.Log, q ethereum.FilterQuery) w3types.RPCSubscriber

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Jun 12, 2024

Deploying w3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 55eafb7
Status: ✅  Deploy successful!
Preview URL: https://99cc621c.w3-7ji.pages.dev
Branch Preview URL: https://feat-subscription.w3-7ji.pages.dev

View logs

@lmittmann lmittmann merged commit 43b46de into main Jun 12, 2024
@lmittmann lmittmann deleted the feat/subscription branch June 12, 2024 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Subscription

1 participant