/** * Connection wrapper for Holochain DNA method calls * * :TODO: :WARNING: * * This layer is currently unsuitable for mixing with DNAs that use dna-local identifier formats, and * will cause encoding errors if 2-element lists of identifiers are passed. * * Such tuples are interpreted as [`DnaHash`, `AnyDhtHash`] pairs by the GraphQL <-> Holochain * serialisation layer and transformed into compound IDs at I/O time. So, this adapter should * *only* be used to wrap DNAs explicitly developed with multi-DNA references in mind. * * Also :TODO: - standardise a binary format for universally unique Holochain entry/header identifiers. * * @package: Holo-REA * @since: 2019-05-20 */ import { AppSignalCb, AppWebsocket } from '@connoropolous/holochain-client'; import { DNAIdMappings } from './types'; export declare function autoConnect(conductorUri?: string, appID?: string, traceAppSignals?: AppSignalCb): Promise<{ conn: AppWebsocket; dnaConfig: DNAIdMappings; conductorUri: string; }>; /** * Inits a connection for the given websocket URI. If no `socketURI` is provided, * a connection is attempted via the `REACT_APP_HC_CONN_URL` environment variable. * * This method gives calling code an opportunity to register globals for all future * instances of a connection of the same `socketURI`. To ensure this is done reliably, * a runtime error will be thrown by `getConnection` if no `openConnection` has * been previously performed for the same `socketURI`. */ export declare const openConnection: (socketURI: string, traceAppSignals?: AppSignalCb | undefined) => Promise; /** * Introspect an active Holochain connection's app cells to determine cell IDs * for mapping to the schema resolvers. */ export declare function sniffHolochainAppCells(conn: AppWebsocket, appID?: string): Promise; export declare function deserializeHash(hash: string): Uint8Array; export declare function serializeHash(hash: Uint8Array): string; export declare function remapCellId(originalId: any, newCellId: any): string; export declare type BoundZomeFn = (args: InputType) => OutputType; /** * External API for accessing zome methods, passing them through an optional intermediary DNA ID mapping * * @param mappings DNAIdMappings to use for this collaboration space. * `instance` must be present in the mapping, and the mapped CellId will be used instead of `instance` itself. * @param socketURI If provided, connects to the Holochain conductor on a different URI. * * @return bound async zome function which can be called directly */ export declare const mapZomeFn: (mappings: DNAIdMappings, socketURI: string, instance: string, zome: string, fn: string, skipEncodeDecode?: boolean | undefined) => BoundZomeFn>; export declare const extractEdges: (withEdges: { edges: { node: T; }[]; }) => T[];