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

Connector Aware Estimation #3736

Open
danielbate opened this issue Feb 24, 2025 · 2 comments
Open

Connector Aware Estimation #3736

danielbate opened this issue Feb 24, 2025 · 2 comments
Labels
feat Issue is a feature

Comments

@danielbate
Copy link
Member

danielbate commented Feb 24, 2025

TLDR

Connector Aware Estimation is the process of giving the SDK more awareness of the account level semantics earlier in the transaction flow to reduce round trips to the network.

Problem

Let's imagine the following transaction flow for non-native wallets:

Image

In the first stage, the SDK estimates the transaction as normal.

Once it hands off to the connector, and we introduce the non-native account, we must add the predicate to the transaction. Therefore meaning the transaction must be re-prepared.

This is obvious redundancy that could be mitigated by giving the SDK the context earlier in the flow:

Potential Solution

  1. Introduce a prepareTransaction function to the connector interface, that can alter a transaction request with any of it's own specifics, such as adding the non-native predicate.
  /**
   * Modifies a transaction request with anything connector specific.
   * 
   * @param transaction - The tx to prepare.
   *
   * @returns The prepared tx request
   */
  async prepareTransaction(transaction: TransactionRequestLike): Promise<TransactionRequest>;
  1. Introduce connector.prepareTransaction() at the estimation and funding SDK entry points.
  2. Remove connector level estimation and funding from within the connector.sendTransaction() calls.

Notes

@danielbate danielbate added the feat Issue is a feature label Feb 24, 2025
@danielbate
Copy link
Member Author

I have not done a proof of concept here yet, so this may evolve.

@danielbate
Copy link
Member Author

@petertonysmith94 I think I was overdoing it in our previous discussion, something simple like this would work by moving the connector level logic from submission -> preparation.

But have a look and see what you think, I will pick up any progress made next week :)

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

No branches or pull requests

1 participant