spacebudz / lucid

Lucid is a library, which allows you to create Cardano transactions and off-chain code for your Plutus contracts in JavaScript, Deno and Node.js.
https://lucid.spacebudz.io
MIT License
341 stars 142 forks source link

Not Implemented Error #164

Open TheGateKeeper1995 opened 1 year ago

TheGateKeeper1995 commented 1 year ago

I am trying to create a transaction to allow a user to claim a token of mine by clicking a button on my frontend dApp but I don't know why I am getting this error or how I to fix it. I most definitely have the wallet object but I am still getting this error, perhaps I am missing something. Thanks in advance.

Untitled

Here is the transaction code I am using

const lucid = await Lucid.new(
      new Blockfrost("https://cardano-preprod.blockfrost.io/api/v0", process.env.NEXT_PUBLIC_BLOCKFROST_API), 'Preprod'
    );

    console.log(wallet)

    const tx = await lucid.selectWalletFrom({ address: senderAddress })
      .newTx()
      .payToAddress(receiverAddress, { lovelace: 1000000n })
      .complete();
      console.log(tx);
    const signedTx = await tx.sign().complete();
    const txHash = await signedTx.submit();

    console.log(txHash);
alessandrokonrad commented 1 year ago

When you do lucid.selectWalletFrom you only select a wallet you can view. You don't have access to the private key and so on. So the sign operation fails obviously. This is not a bug, it's intended to fail.

TheGateKeeper1995 commented 1 year ago

So then how do I write this correctly so I can include the private key? And how do make a private key based on the cborhex in my payment.skey or payment.vkey file, whichever one I'm supposed to use.