bigchaindb-driver - TypeError: Cannot read property '1' of undefined

63 views Asked by At
TypeError: Cannot read property '1' of undefined
at /mnt/d/Ayan Ali/Fiverr/TestingBooth/node_modules/bigchaindb-driver/dist/node/transaction.js:231:41
at Array.map (<anonymous>)
at Function.makeTransferTransaction (/mnt/d/Ayan Ali/Fiverr/TestingBooth/node_modules/bigchaindb-driver/dist/node/transaction.js:223:54)
at combineTokens (/mnt/d/Ayan Ali/Fiverr/TestingBooth/transtokenunify.js:214:46)
at /mnt/d/Ayan Ali/Fiverr/TestingBooth/transtokenunify.js:138:7
at processTicksAndRejections (internal/process/task_queues.js:95:5)

I am getting this error while calling this function

  transaction1,
  outputIndex1,
  transaction2,
  outputIndex2,
  totalTokens
) => {
  const bestFriend = new driver.Ed25519Keypair();
  const combineTransfer = driver.Transaction.makeTransferTransaction(
    [
      {
        tx: transaction1,
        output_index: outputIndex1,
      },
      {
        tx: transaction2,
        output_index: outputIndex2,
      },
    ],
    // Output
    [
      driver.Transaction.makeOutput(
        driver.Transaction.makeEd25519Condition(bestFriend.publicKey),
        totalTokens.toString()
      ),
    ],
    {
      transfer_to: "my best friend",
    }
  );

  // Sign the transaction with the newUser key
  const signedTransfer = await driver.Transaction.signTransaction(
    combineTransfer,
    privateKey
  );

  return conn.postTransactionCommit(signedTransfer);
};

a similar function is also present on the official documentation: https://www.bigchaindb.com/developers/guide/tutorial-token-launch/

0

There are 0 answers