mesh icon indicating copy to clipboard operation
mesh copied to clipboard

Decommit error when using OffchainCode

Open independenceee opened this issue 5 months ago • 1 comments

Summary

I use offchain to commit UTxO to L2 - Hydra

 it("2- Commit UTXOs into the Hydra head to make them available for off-chain transactions.", async () => {
            // return;
            await hydraProvider.connect();
            const utxos = await meshWallet.getUtxos();
            const utxoOnlyLovelace = getLovelaceOnlyUTxO(utxos);
            console.log(utxoOnlyLovelace);

            const walletAddress = await meshWallet.getChangeAddress();
            const unsignedTx = await meshTxBuilder
                .txIn(utxoOnlyLovelace.input.txHash, utxoOnlyLovelace.input.outputIndex)
                .txOut(await meshWallet.getChangeAddress(), utxoOnlyLovelace.output.amount)
                .changeAddress(walletAddress)
                .selectUtxosFrom(utxos)
                .setNetwork("preview")
                .complete();

            const unsignedCommitTx = await hydraInstance.commitBlueprint(utxoOnlyLovelace.input.txHash, utxoOnlyLovelace.input.outputIndex, {
                cborHex: unsignedTx,
                description: "Commit Funds",
                type: "Tx ConwayEra",
            });

            const signedCommitTx = await meshWallet.signTx(unsignedCommitTx, true);
            const commitTxHash = await meshWallet.submitTx(signedCommitTx);
            console.log("https://preview.cexplorer.io/tx/" + commitTxHash);
            expect(typeof commitTxHash).toBe("string");
        });

And I got the following error

4129 |       (utxo2) => utxo2.input.outputIndex === input.txIn.txIndex
4130 |     );
4131 |     const amount = utxo?.output.amount;
4132 |     const address = utxo?.output.address;
4133 |     if (!amount || amount.length === 0)
4134 |       throw Error(
                   ^
error: Couldn't find value information for 974041bfd81feffc060c65a89be9f3c4c5bb2c47dc8bc35d58bc62d60d7dbcb3#1
      at completeInputInfo (D:\Workspaces\hydra\tipjar\node_modules\@meshsdk\transaction\dist\index.js:4134:13)
      at completeTxInformation (D:\Workspaces\hydra\tipjar\node_modules\@meshsdk\transaction\dist\index.js:4119:12)
      at <anonymous> (D:\Workspaces\hydra\tipjar\node_modules\@meshsdk\transaction\dist\index.js:4329:12)
      at forEach (1:11)
      at <anonymous> (D:\Workspaces\hydra\tipjar\node_modules\@meshsdk\transaction\dist\index.js:4328:21)

Steps to reproduce the bug

No response

Actual Result

.

Expected Result

4129 |       (utxo2) => utxo2.input.outputIndex === input.txIn.txIndex
4130 |     );
4131 |     const amount = utxo?.output.amount;
4132 |     const address = utxo?.output.address;
4133 |     if (!amount || amount.length === 0)
4134 |       throw Error(
                   ^
error: Couldn't find value information for 974041bfd81feffc060c65a89be9f3c4c5bb2c47dc8bc35d58bc62d60d7dbcb3#1
      at completeInputInfo (D:\Workspaces\hydra\tipjar\node_modules\@meshsdk\transaction\dist\index.js:4134:13)
      at completeTxInformation (D:\Workspaces\hydra\tipjar\node_modules\@meshsdk\transaction\dist\index.js:4119:12)
      at <anonymous> (D:\Workspaces\hydra\tipjar\node_modules\@meshsdk\transaction\dist\index.js:4329:12)
      at forEach (1:11)
      at <anonymous> (D:\Workspaces\hydra\tipjar\node_modules\@meshsdk\transaction\dist\index.js:4328:21)

SDK version

1.9.0-beta.72

Environment type

  • [x] Node.js
  • [ ] Browser
  • [ ] Browser Extension
  • [ ] Other

Environment details

No response

independenceee avatar Sep 04 '25 14:09 independenceee

@independenceee has this been resolved because the error message shows if the utxo is not in head yet maybe the provider you used for your mesh wallet is the hydra instead of L1

Temasar1 avatar Oct 20 '25 22:10 Temasar1