/** * Canonical schema and metadata for the stable `window.host` bridge surface. * * This is the hand-maintained product contract model used by the JS bridge, * guest typings, tests, and docs. Hosts should treat this module as the * single source of truth for the current bridge version, method surface, * canonical event names, and canonical error codes. */ export declare const BRIDGE_VERSION: "1.0"; export declare const DEFAULT_BRIDGE_PROFILE: "web-srcdoc"; /** * Canonical stable surface entries for the current bridge generation. * * These entries define the supported names and namespaces, not unconditional * availability in every host profile. Products should still consult * `window.host.__bridge` before assuming a capability is implemented. */ export declare const BRIDGE_STABLE_SURFACE: readonly ["__bridge", "getAddress", "storage.get", "storage.set", "storage.remove", "statements.subscribe", "statements.write", "statements.status", "identity.resolveUsername", "on", "off"]; export declare const BRIDGE_EXPERIMENTAL_SURFACE: readonly ["ext.claw.ask", "ext.claw.status", "ext.data.getPeerId", "ext.data.connect", "ext.data.startListening", "ext.data.close", "ext.data.send", "ext.data.sendBytes", "ext.media.getUserMedia", "ext.media.getDisplayMedia", "ext.media.connect", "ext.media.accept", "ext.media.reject", "ext.media.close", "ext.media.attachTrack", "ext.media.getPeerId", "ext.media.startListening", "ext.media.setTrackEnabled", "ext.media.groupConnect", "ext.media.groupAccept", "ext.media.addTrack", "ext.media.removeTrack", "ext.media.getStats", "ext.files.save", "ext.mesh.transport.publish", "ext.mesh.transport.heartbeat", "ext.mesh.transport.subscribe", "ext.mesh.objects.put", "ext.mesh.objects.get", "ext.mesh.objects.getResult", "ext.mesh.query.request", "ext.mesh.query.scopedRequest", "ext.mesh.query.respond", "ext.mesh.query.scopedRespond", "ext.mesh.status.status", "ext.mesh.private.objects.put", "ext.mesh.private.objects.get", "ext.mesh.private.query.request", "ext.mesh.private.control.publish", "ext.mesh.private.control.subscribe", "ext.mesh.private.receipts.publish", "ext.mesh.private.receipts.subscribe", "ext.vrf.deriveMemberKey", "ext.vrf.sign", "ext.vrf.createProof", "ext.vrf.aliasInContext", "ext.crdt.join", "ext.crdt.applyUpdate", "ext.crdt.getStateVector", "ext.crdt.getFullState", "ext.crdt.setAwareness", "ext.crdt.destroy"]; export declare const BRIDGE_EVENT_NAMES: readonly ["dataConnected", "dataMessage", "dataBinary", "dataClosed", "dataError", "dataIncomingCall", "mediaTrackReady", "mediaConnected", "mediaRemoteTrack", "mediaClosed", "mediaError", "mediaIncomingCall", "mediaSignalingProgress", "mediaTrackStopped", "statement", "meshTopic", "meshQuery", "meshReply", "meshScopedQuery", "meshScopedReply", "meshPresence", "meshHeartbeat", "meshPrivateControl", "meshPrivateReceipt", "indexEvent", "indexSyncProgress", "indexScanCompleted", "crdtRemoteUpdate", "crdtAwareness", "crdtPeerChange"]; export declare const BRIDGE_ERROR_CODES: readonly ["ERR_BRIDGE_DESTROYED", "ERR_RATE_LIMIT", "ERR_UNSUPPORTED_CAPABILITY", "ERR_HOST_RUNTIME_UNAVAILABLE", "ERR_BINARY_BRIDGE_UNAVAILABLE", "ERR_INVALID_ARGUMENT", "ERR_TIMEOUT", "ERR_HOST_REJECTED"]; export type BridgeStableSurfaceEntry = (typeof BRIDGE_STABLE_SURFACE)[number]; export type BridgeExperimentalSurfaceEntry = (typeof BRIDGE_EXPERIMENTAL_SURFACE)[number]; export type BridgeEventName = (typeof BRIDGE_EVENT_NAMES)[number]; export type BridgeErrorCode = (typeof BRIDGE_ERROR_CODES)[number]; export type BridgeProfile = "web-srcdoc" | "web-relay" | "native-webview"; export interface BridgeExtensionCapabilities { readonly claw: boolean; readonly crdt: boolean; readonly data: boolean; readonly media: boolean; readonly files: boolean; readonly mesh: boolean; readonly vrf: boolean; } export interface BridgeCapabilities { readonly storage: boolean; readonly statements: boolean; readonly identity: boolean; readonly ext: BridgeExtensionCapabilities; } export interface BridgeProductProtocolMetadata { readonly package: "@polkadot/api-protocol"; readonly version: "v1"; readonly transport: "message-port"; readonly wireFormat: "scale-host-api"; } export interface BridgeMetadata { readonly version: string; readonly profile: BridgeProfile; readonly capabilities: BridgeCapabilities; readonly productProtocol: BridgeProductProtocolMetadata; } export interface BridgeMetadataOptions { /** Host profile implementing the canonical bridge. */ profile?: BridgeProfile; /** Optional overrides for stable core capabilities during phased rollouts. */ coreCapabilities?: Partial>; /** Optional extension capability flags exposed alongside the core bridge. */ extCapabilities?: Partial; } /** * Create the immutable metadata object exposed at `window.host.__bridge`. */ export declare function createBridgeMetadata(options: BridgeMetadataOptions | undefined, identitySupported: boolean): BridgeMetadata; //# sourceMappingURL=contract.d.ts.map