ng-ansible

0.0.2 • Public • Published

ng-ansible

An Angular service for using Ansibles, generalised state channels enforced on the Ethereum blockchain. This service is provided as a wrapper for an Ansible Relay to make some of the operations more convenient - it does not handle any custom Speaker interaction.

Events

To get all past events for a given Ansible, use the getAnsibleEvents(ansibleID) method, and use watchAnsibleEvents(ansibleID) to watch for future events.

Examples

constructor(
    private ansibleService : AnsibleService
){}

watchSpeakerOpens() {
    let speaker = "0x0";
    this.ansibleService.watchSpeakerOpens(speaker).subscribe(e => {
        // will be fired every time an event is found
    });
}

getAnsibleCheckpoints() {
    let id = 1000;
    this.ansibleService.getAnsibleCheckpoints(id).subscribe(events => {
        // an array of all prior checkpoints
    });
}

watchSpeakerEvents() {
    let speaker = "0x0";
    this.ansibleService.watchSpeakerEvents(speaker).subscribe(e => {
        // will be fired every time an event is found
    });
}

watchAnsibleEvents() {
    let ansibleID = 1000;
    this.ansibleService.watchAnsibleEvents(ansibleID).subscribe(e => {
        // will be fired every time an event is found
    });
}

watchSpeakerEvents() {
    let speaker = "0x0";
    this.ansibleService.watchSpeakerEvents(speaker).subscribe(e => {
        // will be fired every time an event is found
    });
}

Package Sidebar

Install

npm i ng-ansible

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

42.5 kB

Total Files

14

Last publish

Collaborators

  • alexender