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

Issue Bridging native SUI #20526

Open
xhuppa opened this issue Dec 5, 2024 · 10 comments
Open

Issue Bridging native SUI #20526

xhuppa opened this issue Dec 5, 2024 · 10 comments
Assignees

Comments

@xhuppa
Copy link

xhuppa commented Dec 5, 2024

I'm running into issues when trying to bridge native SUI to any other chain, Im seeing a No valid gas coins found for the transaction. error. And I ONLY get this when bridging native SUI, not getting this for other assets like usdc or eth. Pasting the error trace below:

Transaction failed: Error: No valid gas coins found for the transaction.
    at _TransactionBlock.prepareGasPayment_fn (popup.js:723406:11)
    at async _TransactionBlock.prepare_fn (popup.js:723562:5)
    at async _TransactionBlock.build (popup.js:723308:5)
    at async WhSuiSigner.signAndSend (popup.js:591451:47)
    at async ssw (popup.js:791151:28)
    at async signSendWait (popup.js:791120:22)
    at async AutomaticTokenBridgeRoute.initiate (popup.js:793246:23)
    at async WormholeClient.executeSwap (popup.js:590902:25)
    at async sendTransactionWormhole (popup.js:569983:12)
    at async popup.js:570386:38

And when I try setting a gas owner, budget & payment, I get a MutableObjectUsedMoreThanOnce error,
Error checking transaction input objects: MutableObjectUsedMoreThanOnce { object_id: 0x7f7...ce1fc8 }

@MystenLabs MystenLabs deleted a comment Dec 5, 2024
@stefan-mysten
Copy link
Member

@xhuppa there is no official Sui support team, so do not attempt to engage with such actors as the one that I just deleted (in case you saw the previous comment).

I will pass this to the right team member and have a look at it asap. Thanks for the report!

@petvaizAkhtar
Copy link

Yes

@stefan-mysten
Copy link
Member

It does not sound like you are using the native bridge in Sui. Are you using Wormhole or another bridge?

@xhuppa
Copy link
Author

xhuppa commented Dec 12, 2024

It does not sound like you are using the native bridge in Sui. Are you using Wormhole or another bridge?

@stefan-mysten correct, I'm using wormhole

@stefan-mysten
Copy link
Member

@xhuppa thanks for confirming. We'd suggest to ask the Wormhole folks on how to deal with this error, that's probably the best place to get help!

@xhuppa
Copy link
Author

xhuppa commented Dec 16, 2024

@stefan-mysten Im not sure if this is a wormhole issue, regardless of the bridge I use, Im getting this error when trying to build the transaction using the mysten sdk.

I'm able to build any other tx, but when I build a native SUI tx I run into this issue. Is there a step I'm missing when constructing a native SUI swap/bridge? Heres some code for context:

   const { transaction } = txn as {
        transaction: SuiTransaction;
      };
      transaction.setSender(senderAddress);
      transaction.setGasBudget(SUI_DEFAULT_TX_BUDGET);

      const serializedTransaction = await transaction.build({
        client: this.client.provider,
      });

      const dryRun = await this.client.simTransaction({
        tx: Buffer.from(serializedTransaction).toString("base64"),
        senderAddress,
      });

@stefan-mysten
Copy link
Member

@xhuppa did you manage to figure it out? From the first error, it might be that you need first to split the SUI coin into two, and use one to pay gas. Usually, this is done by the SDK, but maybe it's worth trying manually?

@xhuppa
Copy link
Author

xhuppa commented Jan 7, 2025

@stefan-mysten Still no luck. Anytime I tried splitting into two it would throw an error for having duplicate input objects:

Error checking transaction input objects: MutableObjectUsedMoreThanOnce { object_id: 0x7f7e... e1fc8 }

@stefan-mysten
Copy link
Member

Thanks @xhuppa. Can you share a more complete code example so that we can dig a bit more into it?

@hayes-mysten
Copy link
Contributor

All the errors mentioned above are the result of constructing an invalid transaction, but without a more complete version of your code its hard to tell whats going on.

When a transaction uses sui, you need to be careful to not use the same coin for gas and other inputs. The easiest way to avoid this is to use coinWithBalance: https://sdk.mystenlabs.com/typescript/transaction-building/intents#the-coinwithbalance-intent

To do this manually, your address likely only has a single sui coin. Rather than selecting coins to use directly in your transaction, the common pattern is to split off new coins off the gas coin (const newCoin = tx.splitCoins([amount], tx.gas)). If you don't manually specify a gas coin, the SDK will automatically use all you sui coins for gas

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

No branches or pull requests

5 participants