@servrox/ng-iota
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

ng-iota

This package is a wrapper for the iota.js library. Currently, only access to the indexed data payload messages is supported.

The library uses the iota mainnet (chrysalis).

The default chrysalis node is set to https://chrysalis-nodes.iota.org.

It can be changed by providing a custom configuration object in the module.ts file:

  providers: [
    {
      provide: IotaServiceConfiguration,
      useValue: {
        apiEndpoint: 'https://your-custom-endpoint.org',
      }
    }
  ]

Following methods are supported:

 constructor(
    private iotaService: NgIotaService
  ) {
    const msg: Message = {data: "data message"};
   
    // creates a new message under the provided index
    this.iotaService.sendIndexedData("test", JSON.stringify(msg)).subscribe(console.log);
    
    // returns all message IDs for the provided index
    this.iotaService.readIndexedData("test").subscribe(console.log);
    
    // read all messages for the provided index
    this.iotaService.readAllIndexedMessages("test").subscribe(console.log);
    
    // read all messages for the provided index and parse the to the provided object
    this.iotaService.readAllIndexedMessagesData<Message>("test").subscribe(console.log);
    
    // read the message having the provided ID
    this.iotaService.readMessage("iotaxxxxxxxxxxxxxxxx").subscribe(console.log);
  }

Readme

Keywords

none

Package Sidebar

Install

npm i @servrox/ng-iota

Weekly Downloads

1

Version

0.0.2

License

none

Unpacked Size

30.2 kB

Total Files

15

Last publish

Collaborators

  • vaphen
  • servrox1337