node-red-contrib-iota-chrysalis
Version:
Node Red integration whith IOTA for Chrysalis. A new Dawn.
130 lines (119 loc) • 5.32 kB
HTML
<script type="text/javascript">
RED.nodes.registerType('iotatransfers',{
category: 'IOTA 1.5',
color: '#3FADB5',
defaults: {
iotaNode: {value: "", type:"iotaserver"},
iotaSeedKey: {value: ""},
iotaAddressTo: {value: ""},
iotaValue: {value: 0},
iotaMessage: {value: "message from node-red"},
iotaSelect: {value: "SendTokens"},
name: {value:""}
},
inputs:1,
outputs:1,
icon: "iota15.png",
label: function() {
return this.name||"iotatransfers";
}
});
</script>
<script type="text/x-red" data-template-name="iotatransfers">
<div class="form-row">
<label for="node-function-iotaNode"><i class="fa fa-server"></i> IOTA node</label>
<input type="text" id="node-input-iotaNode" placeholder="node">
</div>
<div class="form-row">
<label for="node-function-iotaSelect"><i class="icon-tag"></i> Select Function</label>
<select id="node-input-iotaSelect">
<option value="GetBalanceSeed">GetBalanceSeed</option>
<option value="NewAddresses">NewAddresses</option>
<option value="SendTokens">SendTokens</option>
</select>
</div>
<div class="form-row">
<label for="node-function-iotaSeedKey"><i class="icon-tasks"></i> SeedKey</label>
<input type="text" id="node-input-iotaSeedKey" placeholder="HEX64 format seed key">
</div>
<div class="form-row">
<label for="node-function-iotaAddressTo"><i class="icon-tasks"></i> AddressTo</label>
<input type="text" id="node-input-iotaAddressTo" placeholder="Bech32 format address to">
</div>
<div class="form-row">
<label for="node-function-iotaValue"><i class="icon-tasks"></i> Amount</label>
<input type="text" id="node-input-iotaValue" placeholder="integer amount to send in iota value units (i)">
</div>
<div class="form-row">
<label for="node-function-iotaMessage"><i class="icon-tasks"></i> Message</label>
<input type="text" id="node-input-iotaMessage" placeholder="insert a message to attach with the transaction">
</div>
<div class="form-row">
<label for="node-function-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" class="paletteLabel" placeholder="Name">
</div>
</script>
<script type="text/x-red" data-help-name="iotatransfers">
<p>Connects to IOTA Tangle Chrysalis.</p>
<b>IOTAnode: </b> Setup IOTA Chrysalis node provider settings like host, port (14265 or 443 - are usual).<br><br>
<b>Select Function:</b> Enter yout type of function to run.<br><br>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload
<span class="property-type">string | json</span>
</dt>
<dd> the payload injected for seedkey field, or json format:
</dd>
<dt class="optional">topic <span class="property-type">string</span></dt>
<dd> topic value not used.</dd>
</dl>
<h3>Outputs</h3>
<ol class="node-ports">
<li>Standard output
<dl class="message-properties">
<dt>payload <span class="property-type">string | object</span></dt>
<dd>the standard output of the command.</dd>
</dl>
</li>
<li>Standard error
<dl class="message-properties">
<dt>payload <span class="property-type">string</span></dt>
<dd>the standard error of the command.</dd>
</dl>
</li>
</ol>
<h3>Details</h3>
<p><code>msg.payload</code> is used as the payload of the node.
If payload is string will be used as seedkey field.
If it contains an JSON object are used as value fields.
<h3>GetBalanceSeed</h3>
<p>Assume injected msg.payload as String is a <code>seedkey</code> or you can inject Json format like this:</p>
<p><code>payload = {
<p> seedkey : String or Hex}
</code></p>
<h3>NewAddresses</h3>
<p>Injected msg.payload as String is <code>seedkey</code> field and default number of <code>new Addresses to create</code> is 1.</p>
<p>For better integration, you can inject Json format like this:</p>
<p><code>payload = {
<p> seedkey : String or Hex, num_addresses : Integer}
</code></p>
<h3>SendTokens</h3>
<p>Injected msg.payload as String is <code>addressto</code> field and rest of fields from gui node.</p>
<p>For better integration, you can inject Json format like this:</p>
</code></p>
<p><code>payload = {
<p> seedkey : String or Hex,
<p> addressto : String or Hex,
<p> amounttosend : Integer,
<p> messagekey : String.Default "node-red-contrib-iota-chrysalis",
<p> messagedata : String or Json
<p>}
</code></p>
<p>If a json field not exist, it will be used value field from gui node</p>
</p>
<h3>References</h3>
<ul>
<li><a href = "https://github.com/iotaledger/iota.js/tree/main/docs"> GitHub</a>
<p>Read more about iota.js API.</p></li>
</ul>
</script>