I'm learning to do a minting dApp, it works fine when I mint, associate, transfer...
But now when I wanted to add hbarTransfer, I have invalid signature
What makes it don't work between this that works :
let tokenTransferTx = await new TransferTransaction()
.addNftTransfer('0.0.47855058', restenft, treasuryId, accountId)
.freezeWith(client)
.sign(treasuryKey);
let tokenTransferSubmit = await tokenTransferTx.execute(client);
let tokenTransferRx = await tokenTransferSubmit.getReceipt(client);
And this by just adding hbarTransfer
let tokenTransferTx = await new TransferTransaction()
.addNftTransfer('0.0.47855058', restenft, treasuryId, accountId)
.addHbarTransfer(AccountId.fromString(accountId), -200)
.addHbarTransfer(AccountId.fromString('0.0.47853116'), 200)
.freezeWith(client)
.sign(treasuryKey);
let tokenTransferSubmit = await tokenTransferTx.execute(client);
let tokenTransferRx = await tokenTransferSubmit.getReceipt(client);
All sender accounts (the accounts that are being debited from) are required to sign the transaction. In the second code snippet you would need to sign with the private key for account 0.0.47853116.
let tokenTransferTx = await new TransferTransaction()
.addNftTransfer('0.0.47855058', restenft, treasuryId, accountId)
.addHbarTransfer(AccountId.fromString(accountId), -200)
.addHbarTransfer(AccountId.fromString('0.0.47853116'), 200)
.freezeWith(client)
.sign(treasuryKey)
.sign(accountKey);