This package has been deprecated

Author message:

Moved to organization https://www.npmjs.com/org/spartan-hc

@whi/holochain-agent-client

0.2.4 • Public • Published

Holochain Agent Client

A Javascript client for communicating with Holochain's App Interface API.

Overview

This client is guided by the interfaces defined in the holochain/holochain project.

Features

  • Get app info
  • Create client via app info call
  • Call zome function
  • Zome call serialization and signing

Install

npm i @whi/holochain-agent-client

Basic Usage

Each example assumes this code is present

import { AgentClient, HoloHashes } from '@whi/holochain-agent-client';

const { AgentPubKey, DnaHash } = HoloHashes;
const agent_hash = new AgentPubKey("uhCAkXZ1bRsAdulmQ5Tjw5rNJPXXudEVxMvhqEMPZtCyyoeyY68rH");
const dna_hash = new DnaHash("uhC0kzbVYMh7gso8s-O26hL4PfDTajGqHFkljyL8mdtokzoL-gRdd");
const app_interface_port = 45678;

Example

const client = new AgentClient( agent_hash, {
    "memory": dna_hash,
}, app_interface_port );

await client.call("memory", "mere_memory", "save_bytes", Buffer.from("Hello World") );

Example of using AgentClient with defined zomes

const client = new AgentClient( agent_hash, {
    "memory": [ dna_hash, [ "mere_memory" ] ],
}, app_interface_port );

await client.call("memory", "mere_memory", "save_bytes", Buffer.from("Hello World") );

Example of using AgentClient with defined zomes and functions

const client = new AgentClient( agent_hash, {
    "memory": [ dna_hash, {
        "mere_memory": [ "save_bytes", "retrieve_bytes" ],
    }],
}, app_interface_port );

await client.call("memory", "mere_memory", "save_bytes", Buffer.from("Hello World") );

API Reference

See docs/API.md

Contributing

See CONTRIBUTING.md

Readme

Keywords

none

Package Sidebar

Install

npm i @whi/holochain-agent-client

Weekly Downloads

0

Version

0.2.4

License

ISC

Unpacked Size

728 kB

Total Files

14

Last publish

Collaborators

  • brisebom