chia-agent
Version:
chia rpc/websocket client library
95 lines (94 loc) • 6.76 kB
TypeScript
import { ProofOfSpace } from "../../chia/types/blockchain_format/proof_of_space";
import { DeclareProofOfSpace, NewSignagePoint } from "../../chia/protocols/farmer_protocol";
import { bytes32 } from "../../chia_rs/wheel/python/sized_bytes";
import { bool, float, Optional, str } from "../../chia/types/_python_types_";
import { uint32, uint64 } from "../../chia_rs/wheel/python/sized_ints";
import { TDaemon } from "../../../daemon/index";
import { GetMessageType, TConnectionGeneral } from "../../types";
import { Receiver } from "../../chia/plot-sync/receiver";
export declare const chia_farmer_service = "chia_farmer";
export type chia_farmer_service = typeof chia_farmer_service;
export declare const get_connections_command = "get_connections";
export type get_connections_command = typeof get_connections_command;
export type TGetConnectionsBroadCast = {
connections: TConnectionGeneral[];
};
export type WsGetConnectionFarmerMessage = GetMessageType<chia_farmer_service, get_connections_command, TGetConnectionsBroadCast>;
export declare function on_get_connections(daemon: TDaemon, callback: (e: WsGetConnectionFarmerMessage) => unknown): Promise<() => void>;
export declare const new_farming_info_command = "new_farming_info";
export type new_farming_info_command = typeof new_farming_info_command;
export type TNewFarmingInfoBroadCast = {
farming_info: {
challenge_hash: bytes32;
signage_point: bytes32;
passed_filter: uint32;
proofs: uint32;
total_plots: uint32;
timestamp: uint64;
node_id: bytes32;
lookup_time: uint64;
};
};
export type WsNewFarmingInfoMessage = GetMessageType<chia_farmer_service, new_farming_info_command, TNewFarmingInfoBroadCast>;
export declare function on_new_farming_info(daemon: TDaemon, callback: (e: WsNewFarmingInfoMessage) => unknown): Promise<() => void>;
export declare const new_signage_point_command = "new_signage_point";
export type new_signage_point_command = typeof new_signage_point_command;
export type TNewSignagePointBroadCast = {
proofs: ProofOfSpace[];
signage_point: NewSignagePoint;
missing_signage_points: Optional<[uint64, uint32]>;
};
export type WsNewSignagePointMessage = GetMessageType<chia_farmer_service, new_signage_point_command, TNewSignagePointBroadCast>;
export declare function on_new_signage_point(daemon: TDaemon, callback: (e: WsNewSignagePointMessage) => unknown): Promise<() => void>;
export declare const harvester_update_command = "harvester_update";
export type harvester_update_command = typeof harvester_update_command;
export type THarvesterUpdateBroadCast = Receiver<true>;
export type WsHarvesterUpdateMessage = GetMessageType<chia_farmer_service, harvester_update_command, THarvesterUpdateBroadCast>;
export declare function on_harvester_update(daemon: TDaemon, callback: (e: WsHarvesterUpdateMessage) => unknown): Promise<() => void>;
export declare const harvester_removed_command = "harvester_removed";
export type harvester_removed_command = typeof harvester_removed_command;
export type THarvesterRemovedBroadCast = {
node_id: bytes32;
};
export type WsHarvesterRemovedMessage = GetMessageType<chia_farmer_service, harvester_removed_command, THarvesterRemovedBroadCast>;
export declare function on_harvester_removed(daemon: TDaemon, callback: (e: WsHarvesterRemovedMessage) => unknown): Promise<() => void>;
export declare const proof_command = "proof";
export type proof_command = typeof proof_command;
export type TProofBroadCast = {
proof: DeclareProofOfSpace;
passed_filter: bool;
};
export type WsProofMessage = GetMessageType<chia_farmer_service, proof_command, TProofBroadCast>;
export declare function on_proof(daemon: TDaemon, callback: (e: WsProofMessage) => unknown): Promise<() => void>;
export declare const submitted_partial_command = "submitted_partial";
export type submitted_partial_command = typeof submitted_partial_command;
export type TSubmittedPartialBroadCast = {
launcher_id: str;
pool_url: str;
current_difficulty: uint64;
points_acknowledged_since_start: uint64;
points_acknowledged_24h: Array<[float, uint64]>;
};
export type WsSubmittedPartialMessage = GetMessageType<chia_farmer_service, submitted_partial_command, TSubmittedPartialBroadCast>;
export declare function on_submitted_partial(daemon: TDaemon, callback: (e: WsSubmittedPartialMessage) => unknown): Promise<() => void>;
export declare const failed_partial_command = "failed_partial";
export type failed_partial_command = typeof failed_partial_command;
export type TFailedPartialBroadCast = {
p2_singleton_puzzle_hash: str;
};
export type WsFailedPartialMessage = GetMessageType<chia_farmer_service, failed_partial_command, TFailedPartialBroadCast>;
export declare function on_failed_partial(daemon: TDaemon, callback: (e: WsFailedPartialMessage) => unknown): Promise<() => void>;
export declare const add_connection_command = "add_connection";
export type add_connection_command = typeof add_connection_command;
export type TAddConnectionBroadCast = Record<string, never>;
export type WsAddConnectionMessage = GetMessageType<chia_farmer_service, add_connection_command, TAddConnectionBroadCast>;
export declare function on_add_connection(daemon: TDaemon, callback: (e: WsAddConnectionMessage) => unknown): Promise<() => void>;
export declare const close_connection_command = "close_connection";
export type close_connection_command = typeof close_connection_command;
export type TCloseConnectionBroadCast = Record<string, never>;
export type WsCloseConnectionMessage = GetMessageType<chia_farmer_service, close_connection_command, TCloseConnectionBroadCast>;
export declare function on_close_connection(daemon: TDaemon, callback: (e: WsCloseConnectionMessage) => unknown): Promise<() => void>;
export type WsFarmerMessage = WsGetConnectionFarmerMessage | WsNewFarmingInfoMessage | WsNewSignagePointMessage | WsHarvesterUpdateMessage | WsHarvesterRemovedMessage | WsProofMessage | WsSubmittedPartialMessage | WsFailedPartialMessage | WsAddConnectionMessage | WsCloseConnectionMessage;
export type chia_farmer_commands = get_connections_command | new_farming_info_command | new_signage_point_command | harvester_update_command | harvester_removed_command | proof_command | submitted_partial_command | add_connection_command | close_connection_command;
export type TChiaFarmerBroadcast = TGetConnectionsBroadCast | TNewFarmingInfoBroadCast | TNewSignagePointBroadCast | THarvesterUpdateBroadCast | THarvesterRemovedBroadCast | TProofBroadCast | TSubmittedPartialBroadCast | TAddConnectionBroadCast | TCloseConnectionBroadCast;
export declare function on_message_from_farmer(daemon: TDaemon, callback: (e: WsFarmerMessage) => unknown): Promise<() => void>;