@tanglemesh/compute.js

1.1.0 • Public • Published

compute.js

A simple package to do computing tasks for publishing to the tangle (eg. attatchToTangle)

This package provides you some computing features to outsource some computing intensive tasks like the attatchToTangle method many libraries of iotaledger needs. For more details have a look on https://tangle-mesh.io.

Installation

This is an npm-package and you can add it to your project by using npm with:

npm install @tangleMesh/compute.js

Usage

import Compute from '@tanglemesh/compute.js';
import { ApiAuthentificator } from "@tanglemesh/api-client.js";
import { composeAPI } from "@iota/core";

//Set credentials for using the tangleMesh:api
const apiIdentifier = "api-identifier",
      apiSecret = "api-secret";
const apiAuth = new ApiAuthentificator (apiIdentifier, apiSecret);

//Create the `compute` object for doing computation tasks
const compute = new Compute (apiAuth);

// Initialize the iota compose api and use our compute-method(s)
const iota = composeAPI ({
    provider: 'https://nodes.thetangle.org:443',
    compute: compute.attatchToTangle ("channel-id"),
});

Authorization / API key

In order to authorize your requests, you need to create an API key and secret at https://tangle-mesh.io. The generated values can then be simply passed to the methods listed below.

Methods

attatchToTangle

This method can be used to overwrite the default attatchToTangle method from the iotaledger packages.

compute.attatchToTangle (channelId)

Parameters:

  • channelId string - the channel id you want to pay your request with (the costs per request will be listed on our website)

Examples

For more examples just have a look on the /examples directory.

Run an example with the command:

node examples/send-transaction.example.js

Contact / Support

For requests or questions simply create an issue on our repository or contact us with our form.

Package Sidebar

Install

npm i @tanglemesh/compute.js

Weekly Downloads

5

Version

1.1.0

License

MIT

Unpacked Size

7.99 kB

Total Files

7

Last publish

Collaborators

  • jeremiaseh