/** * Copyright 2023 Fluence Labs Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { JSONArray, JSONValue, ServiceDef } from "@fluencelabs/interfaces"; import { ClientPeer } from "../clientPeer/ClientPeer.js"; import { ClientConfig, RelayOptions } from "../clientPeer/types.js"; import { ServiceImpl } from "../compilerSupport/types.js"; import { IConnection } from "../connection/interfaces.js"; import { FluencePeer } from "../jsPeer/FluencePeer.js"; import { CallServiceResultType, ParticleContext } from "../jsServiceHost/interfaces.js"; import { KeyPair } from "../keypair/index.js"; import { IMarineHost } from "../marine/interfaces.js"; import { Particle } from "../particle/Particle.js"; export declare const registerHandlersHelper: (peer: FluencePeer, particle: Particle, handlers: Record CallServiceResultType | undefined>>) => void; export type CompiledFnCall = (peer: FluencePeer, args: PassedArgs) => Promise; export type CompiledFile = { functions: { [key: string]: CompiledFnCall; }; services: { [key: string]: ServiceDef; }; }; /** * Type for callback passed as aqua function argument */ export type ArgCallbackFunction = ServiceImpl[string]; /** * Arguments passed to Aqua function */ export type PassedArgs = { [key: string]: JSONValue | ArgCallbackFunction; }; export declare const compileAqua: (aquaFile: string) => Promise; export declare class TestPeer extends FluencePeer { constructor(keyPair: KeyPair, connection: IConnection, marine: IMarineHost); } export declare const mkTestPeer: () => Promise; export declare const withPeer: (action: (p: FluencePeer) => Promise) => Promise; export declare const withClient: (relay: RelayOptions, config: ClientConfig, action: (client: ClientPeer) => Promise) => Promise; export declare const makeTestTetraplet: (initPeerId: string, serviceId: string, fnName: string) => ParticleContext;