All files / lib MessageType.ts

100% Statements 82/82
100% Branches 12/12
100% Functions 6/6
100% Lines 82/82

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141            1x     1x   1x 1x 1x     1x 1x 1x 1x   1x 1x   1x 1x 1x 1x 1x   1x     1x 1x 1x 1x 1x 1x   1x   1x 1x   1x 1x   1x 1x 1x   1x 1x   1x   1x 1x   1x 1x   1x 1x     1x 1x 1x   1x 1x   1x 1x         1x 1x 1x 1x 1x 1x         1x 1x         1x 1x 1x 1x 1x   1x 1x   1x   1x   1x   1x 1x       1x 1x 1x     1x 1x 1x     1x 1x 1x     1x 1x 1x     1x 1x 1x    
/**
 * Defined in DLC Messaging Spec
 * https://github.com/discreetlogcontracts/dlcspecs/blob/master/Messaging.md
 */
 
// Protocol version as defined in dlcspecs PR #163
export const PROTOCOL_VERSION = 1;
 
// Wire message types (remain unchanged for backward compatibility)
export enum MessageType {
  // Core DLC Message Types (remain as wire format with u16 prefix)
  DlcOffer = 42778,
  DlcAccept = 42780,
  DlcSign = 42782,
 
  // Legacy contract types (keeping for backward compatibility during transition)
  ContractInfoV0 = 55342,
  SingleContractInfo = 55342,
  ContractInfoV1 = 55344,
  DisjointContractInfo = 55344,
 
  ContractDescriptorV0 = 42768,
  ContractDescriptorV1 = 42784,
 
  OracleInfoV0 = 42770,
  SingleOracleInfo = 42770,
  OracleInfoV1 = 42786,
  MultiOracleInfo = 42786,
  OracleInfoV2 = 55340,
 
  OracleParamsV0 = 55338,
 
  // Oracle message types (remain as TLV for backward compatibility)
  OracleAnnouncement = 55332,
  OracleAnnouncementV0 = OracleAnnouncement, // Backward compatibility alias
  OracleAttestation = 55400,
  OracleAttestationV0 = OracleAttestation, // Backward compatibility alias
  OracleEvent = 55330,
  OracleEventV0 = OracleEvent, // Backward compatibility alias
 
  OracleEventContainer = 61632,
 
  EnumEventDescriptor = 55302,
  EnumEventDescriptorV0 = EnumEventDescriptor, // Backward compatibility alias
 
  DigitDecompositionEventDescriptor = 55306,
  DigitDecompositionEventDescriptorV0 = DigitDecompositionEventDescriptor, // Backward compatibility alias
 
  NegotiationFieldsV0 = 55334,
  NegotiationFieldsV1 = 55336,
  NegotiationFieldsV2 = 55346,
 
  FundingInput = 42772,
  FundingInputV0 = FundingInput, // Backward compatibility alias
 
  DlcInput = 42773,
 
  CetAdaptorSignatures = 42774,
  CetAdaptorSignaturesV0 = CetAdaptorSignatures, // Backward compatibility alias
 
  FundingSignatures = 42776,
  FundingSignaturesV0 = FundingSignatures, // Backward compatibility alias
 
  PayoutFunction = 42790,
  PayoutFunctionV0 = PayoutFunction, // Backward compatibility alias
 
  // PayoutCurvePiece types - kept for backward compatibility
  PolynomialPayoutCurvePiece = 42792,
  HyperbolaPayoutCurvePiece = 42794,
  OldHyperbolaPayoutCurvePiece = 42796, // Legacy support
 
  RoundingIntervals = 42788,
  RoundingIntervalsV0 = RoundingIntervals, // Backward compatibility alias
 
  DlcClose = 52170, // TODO: Temporary type
  DlcCancel = 52172,
 
  /**
   * Dlc Storage Types
   */
  DlcTransactions = 61230,
  DlcTransactionsV0 = DlcTransactions, // Backward compatibility alias
  DlcIds = 61232,
  DlcIdsV0 = DlcIds, // Backward compatibility alias
  DlcInfo = 61234,
  DlcInfoV0 = DlcInfo, // Backward compatibility alias
 
  /**
   * Oracle Identifier
   */
  OracleIdentifier = 61472,
  OracleIdentifierV0 = OracleIdentifier, // Backward compatibility alias
 
  /**
   * Order Message Types
   */
  OrderOffer = 62770,
  OrderAccept = 62772,
  OrderMetadataV0 = 62774,
  OrderIrcInfoV0 = 62776,
  OrderPositionInfo = 62778,
 
  OrderNegotiationFieldsV0 = 65334,
  OrderNegotiationFieldsV1 = 65336,
 
  AddressCache = 65132,
 
  BatchFundingGroup = 65430,
 
  IrcMessageV0 = 59314,
 
  NodeAnnouncement = 51394,
  NodeAnnouncementAddress = 51396,
}
 
// New sub-type identifiers for sibling sub-types (as per dlcspecs PR #163)
export enum ContractInfoType {
  Single = 0,
  Disjoint = 1,
}
 
export enum ContractDescriptorType {
  Enumerated = 0,
  NumericOutcome = 1,
}
 
export enum OracleInfoType {
  Single = 0,
  Multi = 1,
}
 
export enum NegotiationFieldsType {
  Single = 0,
  Disjoint = 1,
}
 
export enum PayoutCurvePieceType {
  Polynomial = 0,
  Hyperbola = 1,
}