Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a Wrapped Client for Optional Method Chaining #10

Open
robbie-wasabi opened this issue Sep 7, 2023 · 0 comments
Open

Implement a Wrapped Client for Optional Method Chaining #10

robbie-wasabi opened this issue Sep 7, 2023 · 0 comments

Comments

@robbie-wasabi
Copy link
Owner

After much deliberation with developers, it became apparent that many of them preferred Method Chaining instead of the current implementation.

Currently, transactions can be signed and sent like so:

client := NewGlowClient().Start()

collector, err := client.CreateDisposableAccount()
if err != nil {
  panic(err)
}

txRes, err := client.NewTxFromFile(
  TxPath("account_setup"),
  *collector, // account passed as an arg
).SignAndSend()

This implementation would allow for Method Chaining like this:

client := NewWrappedGlowClient() // instantiate wrapped client

collector, err := wclient.CreateDisposableActor() // create an "Actor" (an account wrapped with a reference to a client)
if err != nil {
  panic(err)
}

// can create, sign and send a transaction with method chaining from an Actor
txRes, err := collector.NewTxFromFile(
  TxPath("account_setup"),
).SignAndSend()

Let's create a wrapped client package to allow for method chaining. This will give developers substantially more flexibility when developing with Glow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant