transactions – Unable to signal PSBT at index, Error: No taproot scripts signed

0
93


hello I’m making an attempt to create a switch transaction utilizing Hiro/ leather-based pockets and ship one transaction of switch of ordinals

Switch operate
`const walletAddress = localStorage.getItem(‘walletAddress’);
const inscription = await getWalletInscription(
walletAddress,
nftData.tokenId
);

  const userAddresses = await window.btc?.request('getAddresses');
  console.log(userAddresses);

  const usersNativeP2trAddress = userAddresses?.outcome.addresses.discover(
    (handle) => handle.sort === 'p2tr'
  );
  console.log('usersNativeP2trAddress', usersNativeP2trAddress);

  const tx = buildTaprootPsbtRequestOptions1(
    usersNativeP2trAddress.publicKey,
    inscription[0]
  );

  const outcome = await window.btc?.request('signPsbt', tx);
  console.log('RESULT', outcome);
  let response = await submitTx(outcome); `

the results of getWalletINscription is
[ { "id": "4e314a7f7181a524ba072ff8aad4008633d63b916b4eac13d0a04478cce65069i0", "number": 19863051, "address": "bc1pu28tq4c7c2ce0cdhxgz2h47plj78g33fp09at2jukvlw9f79nvzsv750a9", "genesis_address": "bc1p34g2zw48a2k0ax29sttrlg892pzpzln59mwcr8v4v2y5gtrgn4uqyjrnej", "genesis_block_height": 800599, "genesis_block_hash": "000000000000000000008350c92e4d14dc2850a2c1c5cb138e999ef031ac8692", "genesis_tx_id": "4e314a7f7181a524ba072ff8aad4008633d63b916b4eac13d0a04478cce65069", "genesis_fee": "16000", "genesis_timestamp": 1690533848000, "tx_id": "812c5246ddf8fb9ac47309ffdfc94b99dc14c6698a9a0cb298cca221e2b2590c", "location": "812c5246ddf8fb9ac47309ffdfc94b99dc14c6698a9a0cb298cca221e2b2590c:0:1932", "output": "812c5246ddf8fb9ac47309ffdfc94b99dc14c6698a9a0cb298cca221e2b2590c:0", "value": "9112", "offset": "1932", "sat_ordinal": "1931936770109261", "sat_rarity": "common", "sat_coinbase_height": 781098, "mime_type": "image/jpeg", "content_type": "image/jpeg", "content_length": 5827, "timestamp": 1694428161000, "curse_type": null, "recursive": false, "recursion_refs": null } ]

Construct tx Perform

` const bitcoinMainnet = {
bech32: ‘bc’,
pubKeyHash: 0x00,
scriptHash: 0x05,
wif: 0x80,
};
const ecdsaPublicKeyLength = 66;

export operate ecdsaPublicKeyToSchnorr(pubKey) {
console.log(‘LEN’, pubKey.size);
if (pubKey.size !== ecdsaPublicKeyLength)
throw new Error(‘Invalid public key size’);
return pubKey.slice(1);
}

operate getTaprootPayment(publicKey) {
return btc.p2tr(
Buffer.from(ecdsaPublicKeyToSchnorr(publicKey), ‘hex’),
undefined,
btc.NETWORK
);
}

// Related instance request choices for Taproot
operate buildTaprootPsbtRequestOptions1(pubKey, inscription) {
// Taproot pubKey used right here is supplied by way of auth response
strive {
const cost = getTaprootPayment(pubKey);
const tx = new btc.Transaction();

tx.addInput({
  index: 0,
  txid: inscription.tx_id,
  witnessUtxo: {
    quantity: BigInt(inscription.worth),
    script: cost.script,
  },
  tapInternalKey: cost.tapInternalKey,
  redeemScript: cost.redeemScript,
});

tx.addOutputAddress(
  'bc1p34g2zw48a2k0ax29sttrlg892pzpzln59mwcr8v4v2y5gtrgn4uqyjrnej',
  BigInt(inscription.worth),
  bitcoinMainnet
);
console.log('howdy');

const psbt = tx.toPSBT();

return { hex: bytesToHex(psbt) };

} catch (e) {
console.log(e);
}
}`

However when the person is promted to signal it the payment is alos displaying 0 Btc and that i get the error Unable to signal PSBT at index, Error: No taproot scripts signed

enter image description here

LEAVE A REPLY

Please enter your comment!
Please enter your name here