How to broadcast transactions?

  • broadcastTransaction

This function is used to broadcast a transaction.

import { L1XProvider, GetStakeArg } from "@l1x/l1x-wallet-sdk";

let l1xProvider = new L1XProvider({
  clusterType: "mainnet",
  endpoint: "https://v2-mainnet-rpc.l1x.foundation",
});

l1xProvider.core.getSignedPayloadForTransfer({
  receipient_address: "3f26a392527cb2f3328a15d3b9fe66d9225d8ec0",
  value: 1 * (10 ** 18),
  private_key: "YOUR_PRIVATE_KEY"
}).then((_responsePayload) => {
  l1xProvider.core
  .broadcastTransaction(_responsePayload)
  .then((response) => console.log(response)) // log response
  .catch((err) => console.error(err));
})

Parameters:

The parameters to broadcast a transaction.

{
    "receipient_address": "3f26a392527cb2f3328a15d3b9fe66d9225d8ec0",
    "value": 1 * (10 ** 18),
    "private_key": "YOUR_PRIVATE_KEY"
}

Returns:

A promise that resolves with the broadcast transaction.

{
    "hash": "aa3307dbd6a8c1d807564ca688046b518f903ad9fa601c9e115140d17401b255"
}

Last updated