/* tslint:disable */
/* eslint-disable */
/**
*/
export function start(): void;
/**
* set debug for wasm.
* if `true` will print `Debug` message in console,
* otherwise only print `error` message
* @param {boolean} value
*/
export function debug(value: boolean): void;
/**
* set log_level
* @param {string} level
*/
export function log_level(level: string): void;
/**
* Build InternalInfo
* @returns {InternalInfo}
*/
export function internal_info(): InternalInfo;
/**
*/
export enum SignerMode {
  DEFAULT,
  EIP712,
}
/**
*/
export enum AddressType {
  DEFAULT,
  ED25519,
}
/**
* rings-node browser client
* the process of initialize client.
* ``` typescript
* const unsignedInfo = new UnsignedInfo(account);
* const signed = await signer.signMessage(unsignedInfo.auth);
* const sig = new Uint8Array(web3.utils.hexToBytes(signed));
* const client: Client = await Client.new_client(unsignedInfo, sig, stunOrTurnUrl);
* ```
*/
export class Client {
  free(): void;
/**
* Creat a new client instance.
* @param {UnsignedInfo} unsigned_info
* @param {Uint8Array} signed_data
* @param {string} stuns
* @returns {Promise<any>}
*/
  static new_client(unsigned_info: UnsignedInfo, signed_data: Uint8Array, stuns: string): Promise<any>;
/**
* @param {UnsignedInfo} unsigned_info
* @param {Uint8Array} signed_data
* @param {string} stuns
* @param {string} storage_name
* @returns {Promise<any>}
*/
  static new_client_with_storage(unsigned_info: UnsignedInfo, signed_data: Uint8Array, stuns: string, storage_name: string): Promise<any>;
/**
* start backgroud listener without custom callback
* @returns {Promise<any>}
*/
  start(): Promise<any>;
/**
* listen message callback.
* ```typescript
* const intervalHandle = await client.listen(new MessageCallbackInstance(
*      async (relay: any, msg: any) => {
*        console.group('on custom message')
*        console.log(relay)
*        console.log(msg)
*        console.groupEnd()
*      }, async (
*        relay: any,
*      ) => {
*        console.group('on builtin message')
*        console.log(relay)
*        console.groupEnd()
*      },
* ))
* ```
* @param {MessageCallbackInstance} callback
* @returns {Promise<any>}
*/
  listen(callback: MessageCallbackInstance): Promise<any>;
/**
* connect peer with remote jsonrpc-server url
* @param {string} remote_url
* @returns {Promise<any>}
*/
  connect_peer_via_http(remote_url: string): Promise<any>;
/**
* connect peer with web3 address, without waiting for transport channel connected
* @param {string} address
* @param {number | undefined} addr_type
* @returns {Promise<any>}
*/
  connect_with_address_without_wait(address: string, addr_type?: number): Promise<any>;
/**
* connect peer with web3 address, and wait for transport channel connected
* example:
* ```typescript
* const client1 = new Client()
* const client2 = new Client()
* const client3 = new Client()
* await create_connection(client1, client2);
* await create_connection(client2, client3);
* await client1.connect_with_address(client3.address())
* ```
* @param {string} address
* @param {number | undefined} addr_type
* @returns {Promise<any>}
*/
  connect_with_address(address: string, addr_type?: number): Promise<any>;
/**
* Manually make handshake with remote peer
* @returns {Promise<any>}
*/
  create_offer(): Promise<any>;
/**
* Manually make handshake with remote peer
* @param {string} ice_info
* @returns {Promise<any>}
*/
  answer_offer(ice_info: string): Promise<any>;
/**
* Manually make handshake with remote peer
* @param {string} transport_id
* @param {string} ice
* @returns {Promise<any>}
*/
  accept_answer(transport_id: string, ice: string): Promise<any>;
/**
* list all connect peers
* @returns {Promise<any>}
*/
  list_peers(): Promise<any>;
/**
* disconnect a peer with web3 address
* @param {string} address
* @param {number | undefined} addr_type
* @returns {Promise<any>}
*/
  disconnect(address: string, addr_type?: number): Promise<any>;
/**
* @returns {Promise<any>}
*/
  list_pendings(): Promise<any>;
/**
* @param {string} transport_id
* @returns {Promise<any>}
*/
  close_pending_transport(transport_id: string): Promise<any>;
/**
* send custome message to peer.
* @param {string} destination
* @param {Uint8Array} msg
* @returns {Promise<any>}
*/
  send_message(destination: string, msg: Uint8Array): Promise<any>;
/**
* get peer by address
* @param {string} address
* @param {number | undefined} addr_type
* @returns {Promise<any>}
*/
  get_peer(address: string, addr_type?: number): Promise<any>;
/**
* get transport state by address
* @param {string} address
* @param {number | undefined} addr_type
* @returns {Promise<any>}
*/
  transport_state(address: string, addr_type?: number): Promise<any>;
/**
* wait for data channel open
*   * address: peer's address
* @param {string} address
* @param {number | undefined} addr_type
* @returns {Promise<any>}
*/
  wait_for_data_channel_open(address: string, addr_type?: number): Promise<any>;
/**
* get self web3 address
* @returns {string}
*/
  readonly address: string;
}
/**
* Internal Info struct
*/
export class InternalInfo {
  free(): void;
/**
* build_version getter
* @returns {string}
*/
  readonly build_version: string;
}
/**
*/
export class MessageCallbackInstance {
  free(): void;
/**
* @param {Function} custom_message
* @param {Function} builtin_message
*/
  constructor(custom_message: Function, builtin_message: Function);
}
/**
*/
export class Peer {
  free(): void;
/**
* @returns {string}
*/
  readonly address: string;
/**
* @returns {string | undefined}
*/
  readonly state: string | undefined;
/**
* @returns {string}
*/
  readonly transport_addr: string;
/**
* @returns {string}
*/
  readonly transport_id: string;
}
/**
*/
export class TransportAndIce {
  free(): void;
/**
* @param {string} transport_id
* @param {string} ice
* @returns {TransportAndIce}
*/
  static new(transport_id: string, ice: string): TransportAndIce;
/**
* @returns {string}
*/
  readonly ice: string;
/**
* @returns {string}
*/
  readonly transport_id: string;
}
/**
*/
export class UnsignedInfo {
  free(): void;
/**
* Create a new `UnsignedInfo` instance with SignerMode::EIP712
* @param {string} key_addr
*/
  constructor(key_addr: string);
/**
* Create a new `UnsignedInfo` instance
*   * key_addr: wallet address
*   * signer: `SignerMode`
* @param {string} key_addr
* @param {number} signer
* @returns {UnsignedInfo}
*/
  static new_with_signer(key_addr: string, signer: number): UnsignedInfo;
/**
* Create a new `UnsignedInfo` instance
*   * pubkey: solana wallet pubkey
* @param {string} address
* @param {number} addr_type
* @returns {UnsignedInfo}
*/
  static new_with_address(address: string, addr_type: number): UnsignedInfo;
/**
* @returns {string}
*/
  readonly auth: string;
}

export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;

export interface InitOutput {
  readonly memory: WebAssembly.Memory;
  readonly start: () => void;
  readonly debug: (a: number) => void;
  readonly log_level: (a: number, b: number) => void;
  readonly __wbg_unsignedinfo_free: (a: number) => void;
  readonly unsignedinfo_new: (a: number, b: number, c: number) => void;
  readonly unsignedinfo_new_with_signer: (a: number, b: number, c: number, d: number) => void;
  readonly unsignedinfo_new_with_address: (a: number, b: number, c: number, d: number) => void;
  readonly unsignedinfo_auth: (a: number, b: number) => void;
  readonly __wbg_client_free: (a: number) => void;
  readonly client_new_client: (a: number, b: number, c: number, d: number) => number;
  readonly client_new_client_with_storage: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
  readonly client_start: (a: number) => number;
  readonly client_address: (a: number, b: number) => void;
  readonly client_listen: (a: number, b: number) => number;
  readonly client_connect_peer_via_http: (a: number, b: number, c: number) => number;
  readonly client_connect_with_address_without_wait: (a: number, b: number, c: number, d: number) => number;
  readonly client_connect_with_address: (a: number, b: number, c: number, d: number) => number;
  readonly client_create_offer: (a: number) => number;
  readonly client_answer_offer: (a: number, b: number, c: number) => number;
  readonly client_accept_answer: (a: number, b: number, c: number, d: number, e: number) => number;
  readonly client_list_peers: (a: number) => number;
  readonly client_disconnect: (a: number, b: number, c: number, d: number) => number;
  readonly client_list_pendings: (a: number) => number;
  readonly client_close_pending_transport: (a: number, b: number, c: number) => number;
  readonly client_send_message: (a: number, b: number, c: number, d: number) => number;
  readonly client_get_peer: (a: number, b: number, c: number, d: number) => number;
  readonly client_transport_state: (a: number, b: number, c: number, d: number) => number;
  readonly client_wait_for_data_channel_open: (a: number, b: number, c: number, d: number) => number;
  readonly __wbg_messagecallbackinstance_free: (a: number) => void;
  readonly messagecallbackinstance_new: (a: number, b: number, c: number) => void;
  readonly __wbg_peer_free: (a: number) => void;
  readonly peer_transport_id: (a: number, b: number) => void;
  readonly peer_state: (a: number, b: number) => void;
  readonly peer_transport_addr: (a: number, b: number) => void;
  readonly __wbg_transportandice_free: (a: number) => void;
  readonly transportandice_new: (a: number, b: number, c: number, d: number) => number;
  readonly __wbg_internalinfo_free: (a: number) => void;
  readonly internalinfo_build_version: (a: number, b: number) => void;
  readonly internal_info: () => number;
  readonly transportandice_transport_id: (a: number, b: number) => void;
  readonly transportandice_ice: (a: number, b: number) => void;
  readonly peer_address: (a: number, b: number) => void;
  readonly __wbindgen_malloc: (a: number) => number;
  readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
  readonly __wbindgen_export_2: WebAssembly.Table;
  readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hd1afe0690b04ec3d: (a: number, b: number) => void;
  readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h51174bb1e7f36106: (a: number, b: number, c: number) => void;
  readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h34d8a03408387153: (a: number, b: number) => void;
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
  readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h879d9272355d01b9: (a: number, b: number, c: number, d: number) => void;
  readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__had18a334b3612576: (a: number, b: number, c: number) => void;
  readonly __wbindgen_free: (a: number, b: number) => void;
  readonly __wbindgen_exn_store: (a: number) => void;
  readonly wasm_bindgen__convert__closures__invoke2_mut__h5cba3184c5b65d27: (a: number, b: number, c: number, d: number) => void;
  readonly __wbindgen_start: () => void;
}

/**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {InitInput | Promise<InitInput>} module_or_path
*
* @returns {Promise<InitOutput>}
*/
export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
