Hey folks,
I’m attempting to implement buy nft functionality by grouping 3 txs on using atomic transfer.
1st tx is a buy function call on a smart contract created by the nft creator.
2nd tx is payment from buyer to creator.
3rd tx is an asset transfer transaction where the escrow address transfers the asset to the buyer.
I believe these transactions are constructed correctly however I’m not 100% sure. I was wondering if there is something wrong with my signing / logic signature code:
let txns = [
buyCallTx,
payTx,
axferTx
];
console.log('building tx group');
let txgroup = algosdk.assignGroupID(txns);
console.log('attempting signing txs');
let buyCallTxSigned = buyCallTx.signTxn(buyerPk);
let payTxSigned = payTx.signTxn(buyerPk);
let escrBytes = await escrowBytes(client);
let lsigacc = new algosdk.LogicSigAccount(escrBytes);
let axferTxSigned = algosdk.signLogicSigTransactionObject(axferTx, lsigacc).blob;
let signedTxs = [
buyCallTxSigned,
payTxSigned,
axferTxSigned];
console.log('attempting to send all signed txs...');
let tx = undefined;
try
{
tx = (await algodClient.sendRawTransaction(signedTxs).do());
console.log("Transaction : " + tx.txId);
}
catch(err)
{
console.log(err);
throw err
}
// Wait for transaction to be confirmed
confirmedTxn = await algosdk.waitForConfirmation(algodClient, tx.txId, 4);
//Get the completed Transaction
console.log("Transaction " + tx.txId + " confirmed in round " + confirmedTxn["confirmed-round"]);
However when attempting to submit the signed txs I’m getting a cryptic error, any ideas how to make sense of this error a bit better?
host: 'testnet-algorand.api.purestake.io',
protocol: 'https:',
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
text: '{"message":"transaction {_struct:{} Sig:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] Msig:{_struct:{} Version:0 Threshold:0 Subsigs:[]} Lsig:{_struct:{} Logic:[4 32 1 1 50 4 129 3 18 68 51 0 24 129 12 18 68 51 1 16 34 18 68 51 2 18 34 18 68 51 2 17 129 13 18 68 51 2 1 129 232 7 14 68 51 2 21 50 3 18 68 51 2 32 50 3 18 68 34 67] Sig:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] Msig:{_struct:{} Version:0 Threshold:0 Subsigs:[]} Args:[]} Txn:{_struct:{} Type:axfer Header:{_struct:{} Sender:MZOHB7QOWADVU6JVXT5UNGI3ZCYCFL7UMXWM7OHRNXRBMKABMVMZQCI6OE Fee:{Raw:1000} FirstValid:21098319 LastValid:21099319 Note:[] GenesisID:testnet-v1.0 GenesisHash:JBR3KGFEWPEE5SAQ6IWU6EEBZMHXD4CZU6WCBXWGF57XBZIJHIRA Group:7J4XJVFHLWNFWC6COLAZNBFVUKUU346VIMXX7ABPRDYSK646KWGQ Lease:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] RekeyTo:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ} KeyregTxnFields:{_struct:{} VotePK:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] SelectionPK:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] StateProofPK:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] VoteFirst:0 VoteLast:0 VoteKeyDilution:0 Nonparticipation:false} PaymentTxnFields:{_struct:{} Receiver:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ Amount:{Raw:0} CloseRemainderTo:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ} AssetConfigTxnFields:{_struct:{} ConfigAsset:0 AssetParams:{_struct:{} Total:0 Decimals:0 DefaultFrozen:false UnitName: AssetName: URL: MetadataHash:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] Manager:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ Reserve:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ Freeze:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ Clawback:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ}} AssetTransferTxnFields:{_struct:{} XferAsset:85037904 AssetAmount:1 AssetSender:DGNIWP77S7NBLRHPSNSSIZUJKH2IJM6BWULDHLFFIGOSBOI2DVUWXS2AUQ AssetReceiver:AYNOHLZIRBE4X4GDRSR7D5MG7KI2CYCFVFMOPY7CBSQN7C6E2X5I3HC7RI AssetCloseTo:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ} AssetFreezeTxnFields:{_struct:{} FreezeAccount:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ FreezeAsset:0 AssetFrozen:false} ApplicationCallTxnFields:{_struct:{} ApplicationID:0 OnCompletion:NoOpOC ApplicationArgs:[] Accounts:[] ForeignApps:[] ForeignAssets:[] LocalStateSchema:{_struct:{} NumUint:0 NumByteSlice:0} GlobalStateSchema:{_struct:{} NumUint:0 NumByteSlice:0} ApprovalProgram:[] ClearStateProgram:[] ExtraProgramPages:0} CompactCertTxnFields:{_struct:{} CertRound:0 CertType:0 Cert:{_struct:{} SigCommit:[] SignedWeight:0 SigProofs:{_struct:{} Path:[] HashFactory:{_struct:{} HashType:sha512_256} TreeDepth:0} PartProofs:{_struct:{} Path:[] HashFactory:{_struct:{} HashType:sha512_256} TreeDepth:0} Reveals:map[]}}} AuthAddr:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ} invalid : transaction KRZ4NSHE6TUNM53N2G6FTNWZTB35VXB5V4ZNEBFWYVTNUXQB3IKA: rejected by logic err=assert failed pc=16"}\n',
body: {
message: 'transaction {_struct:{} Sig:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] Msig:{_struct:{} Version:0 Threshold:0 Subsigs:[]} Lsig:{_struct:{} Logic:[4 32 1 1 50 4 129 3 18 68 51 0 24 129 12 18 68 51 1 16 34 18 68 51 2 18 34 18 68 51 2 17 129 13 18 68 51 2 1 129 232 7 14 68 51 2 21 50 3 18 68 51 2 32 50 3 18 68 34 67] Sig:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] Msig:{_struct:{} Version:0 Threshold:0 Subsigs:[]} Args:[]} Txn:{_struct:{} Type:axfer Header:{_struct:{} Sender:MZOHB7QOWADVU6JVXT5UNGI3ZCYCFL7UMXWM7OHRNXRBMKABMVMZQCI6OE Fee:{Raw:1000} FirstValid:21098319 LastValid:21099319 Note:[] GenesisID:testnet-v1.0 GenesisHash:JBR3KGFEWPEE5SAQ6IWU6EEBZMHXD4CZU6WCBXWGF57XBZIJHIRA Group:7J4XJVFHLWNFWC6COLAZNBFVUKUU346VIMXX7ABPRDYSK646KWGQ Lease:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] RekeyTo:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ} KeyregTxnFields:{_struct:{} VotePK:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] SelectionPK:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] StateProofPK:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] VoteFirst:0 VoteLast:0 VoteKeyDilution:0 Nonparticipation:false} PaymentTxnFields:{_struct:{} Receiver:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ Amount:{Raw:0} CloseRemainderTo:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ} AssetConfigTxnFields:{_struct:{} ConfigAsset:0 AssetParams:{_struct:{} Total:0 Decimals:0 DefaultFrozen:false UnitName: AssetName: URL: MetadataHash:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] Manager:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ Reserve:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ Freeze:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ Clawback:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ}} AssetTransferTxnFields:{_struct:{} XferAsset:85037904 AssetAmount:1 AssetSender:DGNIWP77S7NBLRHPSNSSIZUJKH2IJM6BWULDHLFFIGOSBOI2DVUWXS2AUQ AssetReceiver:AYNOHLZIRBE4X4GDRSR7D5MG7KI2CYCFVFMOPY7CBSQN7C6E2X5I3HC7RI AssetCloseTo:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ} AssetFreezeTxnFields:{_struct:{} FreezeAccount:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ FreezeAsset:0 AssetFrozen:false} ApplicationCallTxnFields:{_struct:{} ApplicationID:0 OnCompletion:NoOpOC ApplicationArgs:[] Accounts:[] ForeignApps:[] ForeignAssets:[] LocalStateSchema:{_struct:{} NumUint:0 NumByteSlice:0} GlobalStateSchema:{_struct:{} NumUint:0 NumByteSlice:0} ApprovalProgram:[] ClearStateProgram:[] ExtraProgramPages:0} CompactCertTxnFields:{_struct:{} CertRound:0 CertType:0 Cert:{_struct:{} SigCommit:[] SignedWeight:0 SigProofs:{_struct:{} Path:[] HashFactory:{_struct:{} HashType:sha512_256} TreeDepth:0} PartProofs:{_struct:{} Path:[] HashFactory:{_struct:{} HashType:sha512_256} TreeDepth:0} Reveals:map[]}}} AuthAddr:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ} invalid : transaction KRZ4NSHE6TUNM53N2G6FTNWZTB35VXB5V4ZNEBFWYVTNUXQB3IKA: rejected by logic err=assert failed pc=16'
},
files: undefined,
buffered: true,
headers: {