UNPKG

@node-dlc/messaging

Version:
67 lines (66 loc) 2.05 kB
/// <reference types="node" /> import { MessageType } from '../MessageType'; import { IDlcMessage } from './DlcMessage'; import { HyperbolaPayoutCurvePieceJSON, PayoutCurvePiece, PolynomialPayoutCurvePieceJSON } from './PayoutCurvePiece'; /** * PayoutFunction contains the payout curve definition for numeric outcome contracts. * Updated to match rust-dlc format exactly. */ export declare class PayoutFunction implements IDlcMessage { static type: MessageType; /** * Creates a PayoutFunction from JSON data * @param json JSON object representing a payout function */ static fromJSON(json: any): PayoutFunction; /** * Deserializes a payout_function message * @param buf */ static deserialize(buf: Buffer): PayoutFunction; /** * The type for payout_function message. payout_function = 42790 */ type: MessageType; payoutFunctionPieces: IPayoutFunctionPiece[]; lastEndpoint: IPayoutPoint; /** * Constructor that ensures proper initialization */ constructor(); /** * Converts payout_function to JSON */ toJSON(): PayoutFunctionJSON; /** * Serializes the payout_function message into a Buffer */ serialize(): Buffer; } export declare const PayoutFunctionV0: typeof PayoutFunction; export type PayoutFunctionV0 = PayoutFunction; interface IPayoutPoint { eventOutcome: bigint; outcomePayout: bigint; extraPrecision: number; } interface IPayoutPointJSON { eventOutcome: number; outcomePayout: number; extraPrecision: number; } interface IPayoutFunctionPiece { endPoint: IPayoutPoint; payoutCurvePiece: PayoutCurvePiece; } interface IPayoutFunctionPieceJSON { endPoint: IPayoutPointJSON; payoutCurvePiece: PolynomialPayoutCurvePieceJSON | HyperbolaPayoutCurvePieceJSON; } export interface PayoutFunctionJSON { type?: number; payoutFunctionPieces: IPayoutFunctionPieceJSON[]; lastEndpoint: IPayoutPointJSON; } export type PayoutFunctionV0JSON = PayoutFunctionJSON; export {};