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

Simplify the operation sdk #893

Open
gregLibert opened this issue Mar 1, 2024 · 2 comments
Open

Simplify the operation sdk #893

gregLibert opened this issue Mar 1, 2024 · 2 comments

Comments

@gregLibert
Copy link
Contributor

To facilitate the reuse of our SDK by external projects beyond wallets, we need to simplify the interconnection of objects:

Replace sendOperation.MakeOperation by directly using an expiration slot instead of the client and expiration delta (calculation to be done on the caller side).
This choice allows to:

  • Simplify the function signature (reduce the number of parameters)
  • Avoid unnecessarily carrying around a network client (if an operation is created on the caller side, a network client is already necessary at least to properly retrieve the chain ID)
  • Remove the func (n *NodeFetcher) MakeOperation and the unnecessary instantiation of a new network client
  • Remove a method from the interface func (n *NodeFetcher) MakeOperation

Modify operation.SendOperation by removing the chainID and deducing it directly from the network client.
This choice allows to:

  • Simplify the function signature (reduce the number of parameters)
  • Remove the unnecessary instantiation of a network client in GetChainID()
@gregLibert
Copy link
Contributor Author

@Thykof wdyt?

@Thykof
Copy link
Contributor

Thykof commented Mar 4, 2024

sendOperation.MakeOperation is in the station repo, so we can create an issue there and after solving it we can update station-massa-wallet dependency to station and refactor:

  • Remove the func (n *NodeFetcher) MakeOperation and the unnecessary instantiation of a new network client
  • Remove a method from the interface func (n *NodeFetcher) MakeOperation

for "Modify operation.SendOperation" I see low benefit because in internal/handler/wallet/rolls.go we need the chain id for the prompt request, so we will keep the call to GetChainID. However we can do it, and benefit from this refacto:

Remove the unnecessary instantiation of a network client in GetChainID()

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

No branches or pull requests

2 participants