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

Provide a way to submit TXs without using subscriptions #3683

Open
arboleya opened this issue Feb 10, 2025 · 3 comments
Open

Provide a way to submit TXs without using subscriptions #3683

arboleya opened this issue Feb 10, 2025 · 3 comments
Labels
feat Issue is a feature

Comments

@arboleya
Copy link
Member

arboleya commented Feb 10, 2025

According to @LuizAsFight:

  • The Fuel Wallet does the sendTransaction which calls submitAndAwaitStatus on ts sdk side. Then the wallet just gets the transaction id , returns do the dapp and abruptly closes the wallet popup, not waiting for anything from this subscription anymore. could we have a way to submit a transaction that doesn't open a sub and instead just submit the tx? in the wallet use cases we dont need to wait for anything.

Follow-up issue:

@arboleya arboleya added the feat Issue is a feature label Feb 10, 2025
@arboleya arboleya changed the title Provide way to submit tx without using subscriptions Provide a way to submit TXs without using subscriptions Feb 10, 2025
@danielbate
Copy link
Member

We used to use the submit operation, and submitAndAwait would be opt in via an awaitExecution flag on sendTransaction.

The submit endpoint still exists on the client:

submit(
  tx: HexString!
): Transaction!

We could reimplement the reverse functionality, making the subscription opt out?

@Voxelot
Copy link
Member

Voxelot commented Feb 11, 2025

Since the default behavior is to have a subscription right now, it seems like it would be a breaking change if the default is only a submit.

@danielbate
Copy link
Member

danielbate commented Feb 11, 2025

@Voxelot agreed and we won't change the default behaviour, this will be optional. Ideally most consumers will still use the submitAndAwaitStatus route as that will use the smallest number of requests from submission -> summary.

I'd expect something like the below snippet:

    // Default behaviour
    const { waitForResult } = await wallet.sendTransaction(txRequest); // 1 request via `submitAndAwaitStatus`
    const result = await waitForResult(); // 0 requests to assemble summary, previous subscription used
    // `subscribe: false`
    const { waitForResult } = await wallet.sendTransaction(txRequest, { subscribe: false }); // 1 request made via `submit`
    const result = await waitForResult(); // 1 request made to `statusChange` to assemble summary

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

3 participants