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

Allow multiple user-inputs in minting transaction #4

Open
mr-zwets opened this issue Nov 14, 2023 · 0 comments
Open

Allow multiple user-inputs in minting transaction #4

mr-zwets opened this issue Nov 14, 2023 · 0 comments

Comments

@mr-zwets
Copy link
Member

The cashscript code for the minting smart contract allows for the user to add multiple inputs.

  // Get userInput for mint
  const userAddress = await getUserAddress();
  const userUtxos = await electrumServer.getUtxos(userAddress);
  const networkFeeMint = 520;
  const filteredUserUtxos = userUtxos.filter(
    val => !val.token && val.satoshis >= mintPriceSats + networkFeeMint,
  );
  const bchBalanceUser = userUtxos.reduce((total, utxo) => utxo.token ? total : total + utxo.satoshis, 0n);
  const userInput = filteredUserUtxos[0];

this code could just as well select an array of userInputs to get to the required minting amount.

Next the fromP2PKH(userInput, userSig) in the transaction construction should be using this array of userInputs and then set the all signatures to be empty before adding each input to the listSourceOutputs .

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

No branches or pull requests

1 participant