MeshJS / mesh

An open-source library to advance Web3 development on Cardano

Home Page:https://meshjs.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BrowserWallet] An error occurred during signTx: {"code":-1,"info":"Inputs do not conform to this spec or are otherwise invalid."}.

besiwims opened this issue · comments

Uncaught (in promise) Error: [BrowserWallet] An error occurred during signTx: {"code":-1,"info":"Inputs do not conform to this spec or are otherwise invalid."}.

Here is the code below:

const tx = new Transaction({ initiator: wallet })
.sendAssets(
{
address: scriptAddr,
datum: {
value: d,
},
},
[
{
unit: "144a5f65ed8d4d10570d28d2c6764f8c63261696da6d4baa0d35998f57494d53454255546573746e6574546f6b656e73",
quantity: "1",
},
],
);
const unsignedTx = await tx.build();
const signedTx = await wallet.signTx(unsignedTx);

Solution found, thanks to @jelil from Mesh discord

The above problem is cause by running the smart contract on a wrong network and code that selects the network in found in a folder named config and in a file named contract.ts

"resolvePlutusScriptAddress(script, 1); gets the mainnet address of a script." change the 1 number which points to mainnet to 0 which is pointing to preproduction testnet as show below

"resolvePlutusScriptAddress(script, 0); gets the testnet address of a script."