lotus-sdk
Version:
Central repository for several classes of tools for integrating with, and building for, the Lotusia ecosystem
108 lines • 3.04 kB
TypeScript
import { P2PMessage, PeerInfo, IProtocolHandler } from '../types.js';
import { SwapPoolAnnouncement } from './types.js';
import type { SwapSigCoordinator } from './coordinator.js';
export interface PoolAnnouncePayload {
announcement: SwapPoolAnnouncement;
}
export interface PoolJoinPayload {
poolId: string;
participantIndex: number;
}
export interface ParticipantRegisteredPayload {
poolId: string;
participantIndex: number;
peerId: string;
publicKey: string;
inputTxId: string;
inputIndex: number;
ownershipProof: string;
finalOutputCommitment: string;
timestamp: number;
}
export interface RegistrationAckPayload {
poolId: string;
participantIndex: number;
acknowledgedBy: string;
timestamp: number;
}
export interface SetupTxBroadcastPayload {
poolId: string;
participantIndex: number;
txId: string;
timestamp: number;
}
export interface SetupConfirmedPayload {
poolId: string;
participantIndex: number;
txId: string;
confirmations: number;
timestamp: number;
}
export interface SetupCompletePayload {
poolId: string;
timestamp: number;
}
export interface DestinationRevealPayload {
poolId: string;
participantIndex: number;
finalAddress: string;
revealProof: string;
timestamp: number;
}
export interface RevealCompletePayload {
poolId: string;
timestamp: number;
}
export interface SettlementTxBroadcastPayload {
poolId: string;
outputIndex: number;
txId: string;
timestamp: number;
}
export interface SettlementConfirmedPayload {
poolId: string;
outputIndex: number;
txId: string;
confirmations: number;
timestamp: number;
}
export interface SettlementCompletePayload {
poolId: string;
timestamp: number;
}
export interface PoolAbortPayload {
poolId: string;
reason: string;
timestamp: number;
}
export interface ParticipantDroppedPayload {
poolId: string;
peerId: string;
reason: string;
timestamp: number;
}
export declare class SwapSigP2PProtocolHandler implements IProtocolHandler {
readonly protocolName = "swapsig";
readonly protocolId = "/lotus/swapsig/1.0.0";
private coordinator?;
setCoordinator(coordinator: SwapSigCoordinator): void;
handleMessage(message: P2PMessage, from: PeerInfo): Promise<void>;
onPeerConnected(peerId: string): Promise<void>;
onPeerDisconnected(peerId: string): Promise<void>;
private _handlePoolAnnounce;
private _handlePoolJoin;
private _handleParticipantRegistered;
private _handleRegistrationAck;
private _handleSetupTxBroadcast;
private _handleSetupConfirmed;
private _handleSetupComplete;
private _handleDestinationReveal;
private _handleRevealComplete;
private _handleSettlementTxBroadcast;
private _handleSettlementConfirmed;
private _handleSettlementComplete;
private _handlePoolAbort;
private _handleParticipantDropped;
private _sendPoolError;
}
//# sourceMappingURL=protocol-handler.d.ts.map