1.0.7 • Published 2 years ago

@energyweb/greenproof-ddhub-client v1.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Green Proofs DDHUB Client

Installation

yarn add @energyweb/greenproof-ddhub-client

Example

const client = new DDHubClient({
    config: [
      {
        channelName: 'receive_input',
        channelType: 'sub',
        conditions: { roles: ['provider.roles.247.apps.energyweb.iam.ewc'], dids: [] },
        encrypted: true,
        topicName: 'data_provider',
        topicVersion: '1.0.0',
      },
      {
        channelName: 'send_results',
        channelType: 'upload',
        conditions: { roles: ['cache.roles.247.apps.energyweb.iam.ewc'], dids: [] },
        encrypted: true,
        topicName: 'result_provider',
        topicVersion: '1.0.0',
      },
    ],
    ownerNamespace: '247.apps.energyweb.iam.ewc',
    privateKey: 'fd055324f73...2ea45bc8114839e0703e185d',
    ddhubUrl: 'https://client-gateway.energyweb.org/api/v2/',
  });

  await client.setup();

  const [message] = await client.getMessages({
    fqcn: 'receive_input',
    amount: 1
  })

  const result = await someLogic(message);

  await client.sendMessage({
    fqcn: 'send_results',
    payload: JSON.stringify(result),
    transactionId: '1'
  })
1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago