Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Require the Helix libraries
- const Helix = require("@helixnetwork/core");
- const Converter = require("@helixnetwork/converter");
- // Create a new instance of the Helix object
- // Use the provider field to specify which node to connect to
- const helix = Helix.composeAPI({
- provider: "http://hlxtest.net:8085"
- });
- // Sender
- const senderSeed =
- "d2ebccb3cff4ea6a6c7ba4d2528cf60c14e0f4d1af762bdda9442efb94cdc857";
- const senderAddress =
- "d3bb5bf8b306647ea5ca7e53b3497716e9daa99443a67c17f64cccda572821965477bc51";
- // Receiver
- const receiverSeed =
- "4de4fc4ef7432cb3aaa6e7c8d1d858d52ba935e038746722ffd5da3104aff75e";
- const receiverAddress1 =
- "9a8dfc66b22223bf90157a50b00e1628ab49b74617ebcdd605409a7a69c806a8423862b1";
- // Store the TxBytes that are returned from prepareTransfers function
- var storedTxBytes;
- var transfer = {
- address: receiverAddress1,
- value: 1,
- message: Converter.asciiToTxHex("abcd"),
- tag: Converter.asciiToTxHex("abcd")
- };
- // Create bundle and return the TxBytes of the prepared TXs
- helix
- .prepareTransfers(senderSeed, [transfer])
- .then(function(TxBytes) {
- storedTxBytes = TxBytes;
- // Finalize and broadcast the bundle to the node
- return helix.sendTransactionStrings(
- storedTxBytes,
- 5 /*depth*/,
- 2 /*minimum weight magnitude*/
- );
- })
- .then(results => console.log(results))
- .catch(err => {
- console.log(err);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement