Changeset View
Changeset View
Standalone View
Standalone View
modules/chronik-client/proto/chronik.ts
Show First 20 Lines • Show All 718 Lines • ▼ Show 20 Lines | export interface WsSub { | ||||
/** Subscription to block updates */ | /** Subscription to block updates */ | ||||
blocks?: WsSubBlocks | undefined; | blocks?: WsSubBlocks | undefined; | ||||
/** Subscription to a script */ | /** Subscription to a script */ | ||||
script?: WsSubScript | undefined; | script?: WsSubScript | undefined; | ||||
/** Subscription to a token ID */ | /** Subscription to a token ID */ | ||||
tokenId?: WsSubTokenId | undefined; | tokenId?: WsSubTokenId | undefined; | ||||
/** Subscription to a lokad ID */ | /** Subscription to a lokad ID */ | ||||
lokadId?: WsSubLokadId | undefined; | lokadId?: WsSubLokadId | undefined; | ||||
/** Subscription to a plugin group */ | |||||
plugin?: WsPlugin | undefined; | |||||
} | } | ||||
/** | /** | ||||
* Subscription to blocks. They will be sent any time a block got connected, | * Subscription to blocks. They will be sent any time a block got connected, | ||||
* disconnected or finalized. | * disconnected or finalized. | ||||
*/ | */ | ||||
export interface WsSubBlocks {} | export interface WsSubBlocks {} | ||||
Show All 29 Lines | |||||
* - `OP_RETURN OP_RESERVED "<LOKAD_ID>..." "<LOKAD_ID>..." ...`: The first output has an eMPP encoded OP_RETURN, and one (or more) of the pushops has the LOKAD ID as prefix. | * - `OP_RETURN OP_RESERVED "<LOKAD_ID>..." "<LOKAD_ID>..." ...`: The first output has an eMPP encoded OP_RETURN, and one (or more) of the pushops has the LOKAD ID as prefix. | ||||
* - `<LOKAD ID> ...`: An input's scriptSig has the given LOKAD ID as the first pushop | * - `<LOKAD ID> ...`: An input's scriptSig has the given LOKAD ID as the first pushop | ||||
*/ | */ | ||||
export interface WsSubLokadId { | export interface WsSubLokadId { | ||||
/** 4-byte LOKAD ID. */ | /** 4-byte LOKAD ID. */ | ||||
lokadId: Uint8Array; | lokadId: Uint8Array; | ||||
} | } | ||||
/** Subscription to a group assigned by a plugin to outputs. */ | |||||
export interface WsPlugin { | |||||
/** Name of the plugin to subscribe to */ | |||||
pluginName: string; | |||||
/** Group assigned by the plugin to subscribe to */ | |||||
group: Uint8Array; | |||||
} | |||||
/** Message coming from the WebSocket */ | /** Message coming from the WebSocket */ | ||||
export interface WsMsg { | export interface WsMsg { | ||||
/** Error, e.g. when a bad message has been sent into the WebSocket. */ | /** Error, e.g. when a bad message has been sent into the WebSocket. */ | ||||
error?: Error | undefined; | error?: Error | undefined; | ||||
/** Block got connected, disconnected, finalized, etc. */ | /** Block got connected, disconnected, finalized, etc. */ | ||||
block?: MsgBlock | undefined; | block?: MsgBlock | undefined; | ||||
/** Tx got added to/removed from the mempool, or confirmed in a block. */ | /** Tx got added to/removed from the mempool, or confirmed in a block. */ | ||||
tx?: MsgTx | undefined; | tx?: MsgTx | undefined; | ||||
▲ Show 20 Lines • Show All 4,464 Lines • ▼ Show 20 Lines | |||||
function createBaseWsSub(): WsSub { | function createBaseWsSub(): WsSub { | ||||
return { | return { | ||||
isUnsub: false, | isUnsub: false, | ||||
blocks: undefined, | blocks: undefined, | ||||
script: undefined, | script: undefined, | ||||
tokenId: undefined, | tokenId: undefined, | ||||
lokadId: undefined, | lokadId: undefined, | ||||
plugin: undefined, | |||||
}; | }; | ||||
} | } | ||||
export const WsSub = { | export const WsSub = { | ||||
encode( | encode( | ||||
message: WsSub, | message: WsSub, | ||||
writer: _m0.Writer = _m0.Writer.create(), | writer: _m0.Writer = _m0.Writer.create(), | ||||
): _m0.Writer { | ): _m0.Writer { | ||||
Show All 19 Lines | ): _m0.Writer { | ||||
).ldelim(); | ).ldelim(); | ||||
} | } | ||||
if (message.lokadId !== undefined) { | if (message.lokadId !== undefined) { | ||||
WsSubLokadId.encode( | WsSubLokadId.encode( | ||||
message.lokadId, | message.lokadId, | ||||
writer.uint32(42).fork(), | writer.uint32(42).fork(), | ||||
).ldelim(); | ).ldelim(); | ||||
} | } | ||||
if (message.plugin !== undefined) { | |||||
WsPlugin.encode(message.plugin, writer.uint32(50).fork()).ldelim(); | |||||
} | |||||
return writer; | return writer; | ||||
}, | }, | ||||
decode(input: _m0.Reader | Uint8Array, length?: number): WsSub { | decode(input: _m0.Reader | Uint8Array, length?: number): WsSub { | ||||
const reader = | const reader = | ||||
input instanceof _m0.Reader ? input : _m0.Reader.create(input); | input instanceof _m0.Reader ? input : _m0.Reader.create(input); | ||||
let end = length === undefined ? reader.len : reader.pos + length; | let end = length === undefined ? reader.len : reader.pos + length; | ||||
const message = createBaseWsSub(); | const message = createBaseWsSub(); | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | decode(input: _m0.Reader | Uint8Array, length?: number): WsSub { | ||||
break; | break; | ||||
} | } | ||||
message.lokadId = WsSubLokadId.decode( | message.lokadId = WsSubLokadId.decode( | ||||
reader, | reader, | ||||
reader.uint32(), | reader.uint32(), | ||||
); | ); | ||||
continue; | continue; | ||||
case 6: | |||||
if (tag !== 50) { | |||||
break; | |||||
} | |||||
message.plugin = WsPlugin.decode(reader, reader.uint32()); | |||||
continue; | |||||
} | } | ||||
if ((tag & 7) === 4 || tag === 0) { | if ((tag & 7) === 4 || tag === 0) { | ||||
break; | break; | ||||
} | } | ||||
reader.skipType(tag & 7); | reader.skipType(tag & 7); | ||||
} | } | ||||
return message; | return message; | ||||
}, | }, | ||||
Show All 10 Lines | fromJSON(object: any): WsSub { | ||||
? WsSubScript.fromJSON(object.script) | ? WsSubScript.fromJSON(object.script) | ||||
: undefined, | : undefined, | ||||
tokenId: isSet(object.tokenId) | tokenId: isSet(object.tokenId) | ||||
? WsSubTokenId.fromJSON(object.tokenId) | ? WsSubTokenId.fromJSON(object.tokenId) | ||||
: undefined, | : undefined, | ||||
lokadId: isSet(object.lokadId) | lokadId: isSet(object.lokadId) | ||||
? WsSubLokadId.fromJSON(object.lokadId) | ? WsSubLokadId.fromJSON(object.lokadId) | ||||
: undefined, | : undefined, | ||||
plugin: isSet(object.plugin) | |||||
? WsPlugin.fromJSON(object.plugin) | |||||
: undefined, | |||||
}; | }; | ||||
}, | }, | ||||
toJSON(message: WsSub): unknown { | toJSON(message: WsSub): unknown { | ||||
const obj: any = {}; | const obj: any = {}; | ||||
if (message.isUnsub === true) { | if (message.isUnsub === true) { | ||||
obj.isUnsub = message.isUnsub; | obj.isUnsub = message.isUnsub; | ||||
} | } | ||||
if (message.blocks !== undefined) { | if (message.blocks !== undefined) { | ||||
obj.blocks = WsSubBlocks.toJSON(message.blocks); | obj.blocks = WsSubBlocks.toJSON(message.blocks); | ||||
} | } | ||||
if (message.script !== undefined) { | if (message.script !== undefined) { | ||||
obj.script = WsSubScript.toJSON(message.script); | obj.script = WsSubScript.toJSON(message.script); | ||||
} | } | ||||
if (message.tokenId !== undefined) { | if (message.tokenId !== undefined) { | ||||
obj.tokenId = WsSubTokenId.toJSON(message.tokenId); | obj.tokenId = WsSubTokenId.toJSON(message.tokenId); | ||||
} | } | ||||
if (message.lokadId !== undefined) { | if (message.lokadId !== undefined) { | ||||
obj.lokadId = WsSubLokadId.toJSON(message.lokadId); | obj.lokadId = WsSubLokadId.toJSON(message.lokadId); | ||||
} | } | ||||
if (message.plugin !== undefined) { | |||||
obj.plugin = WsPlugin.toJSON(message.plugin); | |||||
} | |||||
return obj; | return obj; | ||||
}, | }, | ||||
create<I extends Exact<DeepPartial<WsSub>, I>>(base?: I): WsSub { | create<I extends Exact<DeepPartial<WsSub>, I>>(base?: I): WsSub { | ||||
return WsSub.fromPartial(base ?? ({} as any)); | return WsSub.fromPartial(base ?? ({} as any)); | ||||
}, | }, | ||||
fromPartial<I extends Exact<DeepPartial<WsSub>, I>>(object: I): WsSub { | fromPartial<I extends Exact<DeepPartial<WsSub>, I>>(object: I): WsSub { | ||||
const message = createBaseWsSub(); | const message = createBaseWsSub(); | ||||
Show All 9 Lines | fromPartial<I extends Exact<DeepPartial<WsSub>, I>>(object: I): WsSub { | ||||
message.tokenId = | message.tokenId = | ||||
object.tokenId !== undefined && object.tokenId !== null | object.tokenId !== undefined && object.tokenId !== null | ||||
? WsSubTokenId.fromPartial(object.tokenId) | ? WsSubTokenId.fromPartial(object.tokenId) | ||||
: undefined; | : undefined; | ||||
message.lokadId = | message.lokadId = | ||||
object.lokadId !== undefined && object.lokadId !== null | object.lokadId !== undefined && object.lokadId !== null | ||||
? WsSubLokadId.fromPartial(object.lokadId) | ? WsSubLokadId.fromPartial(object.lokadId) | ||||
: undefined; | : undefined; | ||||
message.plugin = | |||||
object.plugin !== undefined && object.plugin !== null | |||||
? WsPlugin.fromPartial(object.plugin) | |||||
: undefined; | |||||
return message; | return message; | ||||
}, | }, | ||||
}; | }; | ||||
function createBaseWsSubBlocks(): WsSubBlocks { | function createBaseWsSubBlocks(): WsSubBlocks { | ||||
return {}; | return {}; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 263 Lines • ▼ Show 20 Lines | fromPartial<I extends Exact<DeepPartial<WsSubLokadId>, I>>( | ||||
object: I, | object: I, | ||||
): WsSubLokadId { | ): WsSubLokadId { | ||||
const message = createBaseWsSubLokadId(); | const message = createBaseWsSubLokadId(); | ||||
message.lokadId = object.lokadId ?? new Uint8Array(0); | message.lokadId = object.lokadId ?? new Uint8Array(0); | ||||
return message; | return message; | ||||
}, | }, | ||||
}; | }; | ||||
function createBaseWsPlugin(): WsPlugin { | |||||
return { pluginName: '', group: new Uint8Array(0) }; | |||||
} | |||||
export const WsPlugin = { | |||||
encode( | |||||
message: WsPlugin, | |||||
writer: _m0.Writer = _m0.Writer.create(), | |||||
): _m0.Writer { | |||||
if (message.pluginName !== '') { | |||||
writer.uint32(10).string(message.pluginName); | |||||
} | |||||
if (message.group.length !== 0) { | |||||
writer.uint32(18).bytes(message.group); | |||||
} | |||||
return writer; | |||||
}, | |||||
decode(input: _m0.Reader | Uint8Array, length?: number): WsPlugin { | |||||
const reader = | |||||
input instanceof _m0.Reader ? input : _m0.Reader.create(input); | |||||
let end = length === undefined ? reader.len : reader.pos + length; | |||||
const message = createBaseWsPlugin(); | |||||
while (reader.pos < end) { | |||||
const tag = reader.uint32(); | |||||
switch (tag >>> 3) { | |||||
case 1: | |||||
if (tag !== 10) { | |||||
break; | |||||
} | |||||
message.pluginName = reader.string(); | |||||
continue; | |||||
case 2: | |||||
if (tag !== 18) { | |||||
break; | |||||
} | |||||
message.group = reader.bytes(); | |||||
continue; | |||||
} | |||||
if ((tag & 7) === 4 || tag === 0) { | |||||
break; | |||||
} | |||||
reader.skipType(tag & 7); | |||||
} | |||||
return message; | |||||
}, | |||||
fromJSON(object: any): WsPlugin { | |||||
return { | |||||
pluginName: isSet(object.pluginName) | |||||
? globalThis.String(object.pluginName) | |||||
: '', | |||||
group: isSet(object.group) | |||||
? bytesFromBase64(object.group) | |||||
: new Uint8Array(0), | |||||
}; | |||||
}, | |||||
toJSON(message: WsPlugin): unknown { | |||||
const obj: any = {}; | |||||
if (message.pluginName !== '') { | |||||
obj.pluginName = message.pluginName; | |||||
} | |||||
if (message.group.length !== 0) { | |||||
obj.group = base64FromBytes(message.group); | |||||
} | |||||
return obj; | |||||
}, | |||||
create<I extends Exact<DeepPartial<WsPlugin>, I>>(base?: I): WsPlugin { | |||||
return WsPlugin.fromPartial(base ?? ({} as any)); | |||||
}, | |||||
fromPartial<I extends Exact<DeepPartial<WsPlugin>, I>>( | |||||
object: I, | |||||
): WsPlugin { | |||||
const message = createBaseWsPlugin(); | |||||
message.pluginName = object.pluginName ?? ''; | |||||
message.group = object.group ?? new Uint8Array(0); | |||||
return message; | |||||
}, | |||||
}; | |||||
function createBaseWsMsg(): WsMsg { | function createBaseWsMsg(): WsMsg { | ||||
return { error: undefined, block: undefined, tx: undefined }; | return { error: undefined, block: undefined, tx: undefined }; | ||||
} | } | ||||
export const WsMsg = { | export const WsMsg = { | ||||
encode( | encode( | ||||
message: WsMsg, | message: WsMsg, | ||||
writer: _m0.Writer = _m0.Writer.create(), | writer: _m0.Writer = _m0.Writer.create(), | ||||
▲ Show 20 Lines • Show All 453 Lines • Show Last 20 Lines |