Transactions with lisk-sdk 3.0.0^

Hello,

I struggle to create proper transaction object after updating to 3.0.1.

        const createTransaction = (amount, betNumber, passphrase) => {
          let tx =  new BetTransaction({
            asset: {
              data: betNumber.toString(),
              amount: `${utils.convertLSKToBeddows(amount)}`,
              recipientId: "0L",
            },
            fee: `${utils.convertLSKToBeddows('0.1')}`,
            timestamp: getTimestamp(),
            networkIdentifier: "ldice"
          });
          tx.sign(passphrase);
          return tx;
        };

3.0.0 introduced network identifier, block has string community name, however transaction requires hash string, there are no docs yet. Did anyone figured it yet?

Cheers
K.

Hi,

Network identifier can be formed of the genesisBlock payloadHash and communityIdentifier.

With the lisk-cryptography elements getNetworkIdentifier you can get the networkIdentifier.

import {getNetworkIdentifier} from "@liskhq/lisk-cryptography";
const networkIdentifier = getNetworkIdentifier(
    genesisBlock.payloadHash,
    "communityIdentifier",
);

Hope this helps.

2 Likes

It works - perfect!

Thank you
k.

2 Likes