diff --git a/src.ts/utils/ProtoBuf/proto-block.proto b/src.ts/utils/ProtoBuf/proto-block.proto deleted file mode 100644 index 21fc3969..00000000 --- a/src.ts/utils/ProtoBuf/proto-block.proto +++ /dev/null @@ -1,59 +0,0 @@ -syntax = "proto3"; - -package block; -option go_package = "github.com/dominant-strategies/go-quai/core/types"; - -import "proto_common.proto"; - -message ProtoTransaction { - optional uint64 type = 1; - optional bytes to = 2; - optional uint64 nonce = 3; - optional bytes value = 4; - optional uint64 gas = 5; - optional bytes data = 6; - optional bytes chain_id = 7; - optional bytes gas_fee_cap = 8; - optional bytes gas_tip_cap = 9; - optional ProtoAccessList access_list = 10; - optional uint64 etx_gas_limit = 11; - optional bytes etx_gas_price = 12; - optional bytes etx_gas_tip = 13; - optional bytes etx_data = 14; - optional ProtoAccessList etx_access_list = 15; - optional bytes v = 16; - optional bytes r = 17; - optional bytes s = 18; - optional common.ProtoHash originating_tx_hash = 19; - optional uint32 etx_index = 20; - optional bytes etx_sender = 21; - optional ProtoTxIns tx_ins = 22; - optional ProtoTxOuts tx_outs = 23; - optional bytes signature = 24; -} - -message ProtoAccessList { repeated ProtoAccessTuple access_tuples = 1; } - -message ProtoTxIns { repeated ProtoTxIn tx_ins = 1; } - -message ProtoTxOuts { repeated ProtoTxOut tx_outs = 1; } - -message ProtoTxIn { - optional ProtoOutPoint previous_out_point = 1; - optional bytes pub_key = 2; -} - -message ProtoOutPoint { - optional common.ProtoHash hash = 1; - optional uint32 index = 2; -} - -message ProtoTxOut { - optional uint32 denomination = 1; - optional bytes address = 2; -} - -message ProtoAccessTuple { - bytes address = 1; - repeated common.ProtoHash storage_key = 2; -} \ No newline at end of file diff --git a/src.ts/utils/ProtoBuf/proto-block.ts b/src.ts/utils/ProtoBuf/proto-block.ts deleted file mode 100644 index f78a39ff..00000000 --- a/src.ts/utils/ProtoBuf/proto-block.ts +++ /dev/null @@ -1,1552 +0,0 @@ -/** - * Generated by the protoc-gen-ts. DO NOT EDIT! - * compiler version: 4.25.3 - * source: proto-block.proto - * git: https://github.com/thesayyn/protoc-gen-ts */ -import * as dependency_1 from "./proto_common"; -import * as pb_1 from "google-protobuf"; -export namespace block { - export class ProtoTransaction extends pb_1.Message { - one_of_decls: number[][] = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24]]; - constructor(data?: any[] | ({} & (({ - type?: number; - }) | ({ - to?: Uint8Array; - }) | ({ - nonce?: number; - }) | ({ - value?: Uint8Array; - }) | ({ - gas?: number; - }) | ({ - data?: Uint8Array; - }) | ({ - chain_id?: Uint8Array; - }) | ({ - gas_fee_cap?: Uint8Array; - }) | ({ - gas_tip_cap?: Uint8Array; - }) | ({ - access_list?: ProtoAccessList; - }) | ({ - etx_gas_limit?: number; - }) | ({ - etx_gas_price?: Uint8Array; - }) | ({ - etx_gas_tip?: Uint8Array; - }) | ({ - etx_data?: Uint8Array; - }) | ({ - etx_access_list?: ProtoAccessList; - }) | ({ - v?: Uint8Array; - }) | ({ - r?: Uint8Array; - }) | ({ - s?: Uint8Array; - }) | ({ - originating_tx_hash?: dependency_1.common.ProtoHash; - }) | ({ - etx_index?: number; - }) | ({ - etx_sender?: Uint8Array; - }) | ({ - tx_ins?: ProtoTxIns; - }) | ({ - tx_outs?: ProtoTxOuts; - }) | ({ - signature?: Uint8Array; - })))) { - super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.one_of_decls); - if (!Array.isArray(data) && typeof data == "object") { - if ("type" in data && data.type != undefined) { - this.type = data.type; - } - if ("to" in data && data.to != undefined) { - this.to = data.to; - } - if ("nonce" in data && data.nonce != undefined) { - this.nonce = data.nonce; - } - if ("value" in data && data.value != undefined) { - this.value = data.value; - } - if ("gas" in data && data.gas != undefined) { - this.gas = data.gas; - } - if ("data" in data && data.data != undefined) { - this.data = data.data; - } - if ("chain_id" in data && data.chain_id != undefined) { - this.chain_id = data.chain_id; - } - if ("gas_fee_cap" in data && data.gas_fee_cap != undefined) { - this.gas_fee_cap = data.gas_fee_cap; - } - if ("gas_tip_cap" in data && data.gas_tip_cap != undefined) { - this.gas_tip_cap = data.gas_tip_cap; - } - if ("access_list" in data && data.access_list != undefined) { - this.access_list = data.access_list; - } - if ("etx_gas_limit" in data && data.etx_gas_limit != undefined) { - this.etx_gas_limit = data.etx_gas_limit; - } - if ("etx_gas_price" in data && data.etx_gas_price != undefined) { - this.etx_gas_price = data.etx_gas_price; - } - if ("etx_gas_tip" in data && data.etx_gas_tip != undefined) { - this.etx_gas_tip = data.etx_gas_tip; - } - if ("etx_data" in data && data.etx_data != undefined) { - this.etx_data = data.etx_data; - } - if ("etx_access_list" in data && data.etx_access_list != undefined) { - this.etx_access_list = data.etx_access_list; - } - if ("v" in data && data.v != undefined) { - this.v = data.v; - } - if ("r" in data && data.r != undefined) { - this.r = data.r; - } - if ("s" in data && data.s != undefined) { - this.s = data.s; - } - if ("originating_tx_hash" in data && data.originating_tx_hash != undefined) { - this.originating_tx_hash = data.originating_tx_hash; - } - if ("etx_index" in data && data.etx_index != undefined) { - this.etx_index = data.etx_index; - } - if ("etx_sender" in data && data.etx_sender != undefined) { - this.etx_sender = data.etx_sender; - } - if ("tx_ins" in data && data.tx_ins != undefined) { - this.tx_ins = data.tx_ins; - } - if ("tx_outs" in data && data.tx_outs != undefined) { - this.tx_outs = data.tx_outs; - } - if ("signature" in data && data.signature != undefined) { - this.signature = data.signature; - } - } - } - get type() { - return pb_1.Message.getFieldWithDefault(this, 1, 0) as number; - } - set type(value: number) { - pb_1.Message.setOneofField(this, 1, this.one_of_decls[0], value); - } - get has_type() { - return pb_1.Message.getField(this, 1) != null; - } - get to() { - return pb_1.Message.getFieldWithDefault(this, 2, new Uint8Array(0)) as Uint8Array; - } - set to(value: Uint8Array) { - pb_1.Message.setOneofField(this, 2, this.one_of_decls[1], value); - } - get has_to() { - return pb_1.Message.getField(this, 2) != null; - } - get nonce() { - return pb_1.Message.getFieldWithDefault(this, 3, 0) as number; - } - set nonce(value: number) { - pb_1.Message.setOneofField(this, 3, this.one_of_decls[2], value); - } - get has_nonce() { - return pb_1.Message.getField(this, 3) != null; - } - get value() { - return pb_1.Message.getFieldWithDefault(this, 4, new Uint8Array(0)) as Uint8Array; - } - set value(value: Uint8Array) { - pb_1.Message.setOneofField(this, 4, this.one_of_decls[3], value); - } - get has_value() { - return pb_1.Message.getField(this, 4) != null; - } - get gas() { - return pb_1.Message.getFieldWithDefault(this, 5, 0) as number; - } - set gas(value: number) { - pb_1.Message.setOneofField(this, 5, this.one_of_decls[4], value); - } - get has_gas() { - return pb_1.Message.getField(this, 5) != null; - } - get data() { - return pb_1.Message.getFieldWithDefault(this, 6, new Uint8Array(0)) as Uint8Array; - } - set data(value: Uint8Array) { - pb_1.Message.setOneofField(this, 6, this.one_of_decls[5], value); - } - get has_data() { - return pb_1.Message.getField(this, 6) != null; - } - get chain_id() { - return pb_1.Message.getFieldWithDefault(this, 7, new Uint8Array(0)) as Uint8Array; - } - set chain_id(value: Uint8Array) { - pb_1.Message.setOneofField(this, 7, this.one_of_decls[6], value); - } - get has_chain_id() { - return pb_1.Message.getField(this, 7) != null; - } - get gas_fee_cap() { - return pb_1.Message.getFieldWithDefault(this, 8, new Uint8Array(0)) as Uint8Array; - } - set gas_fee_cap(value: Uint8Array) { - pb_1.Message.setOneofField(this, 8, this.one_of_decls[7], value); - } - get has_gas_fee_cap() { - return pb_1.Message.getField(this, 8) != null; - } - get gas_tip_cap() { - return pb_1.Message.getFieldWithDefault(this, 9, new Uint8Array(0)) as Uint8Array; - } - set gas_tip_cap(value: Uint8Array) { - pb_1.Message.setOneofField(this, 9, this.one_of_decls[8], value); - } - get has_gas_tip_cap() { - return pb_1.Message.getField(this, 9) != null; - } - get access_list() { - return pb_1.Message.getWrapperField(this, ProtoAccessList, 10) as ProtoAccessList; - } - set access_list(value: ProtoAccessList) { - pb_1.Message.setOneofWrapperField(this, 10, this.one_of_decls[9], value); - } - get has_access_list() { - return pb_1.Message.getField(this, 10) != null; - } - get etx_gas_limit() { - return pb_1.Message.getFieldWithDefault(this, 11, 0) as number; - } - set etx_gas_limit(value: number) { - pb_1.Message.setOneofField(this, 11, this.one_of_decls[10], value); - } - get has_etx_gas_limit() { - return pb_1.Message.getField(this, 11) != null; - } - get etx_gas_price() { - return pb_1.Message.getFieldWithDefault(this, 12, new Uint8Array(0)) as Uint8Array; - } - set etx_gas_price(value: Uint8Array) { - pb_1.Message.setOneofField(this, 12, this.one_of_decls[11], value); - } - get has_etx_gas_price() { - return pb_1.Message.getField(this, 12) != null; - } - get etx_gas_tip() { - return pb_1.Message.getFieldWithDefault(this, 13, new Uint8Array(0)) as Uint8Array; - } - set etx_gas_tip(value: Uint8Array) { - pb_1.Message.setOneofField(this, 13, this.one_of_decls[12], value); - } - get has_etx_gas_tip() { - return pb_1.Message.getField(this, 13) != null; - } - get etx_data() { - return pb_1.Message.getFieldWithDefault(this, 14, new Uint8Array(0)) as Uint8Array; - } - set etx_data(value: Uint8Array) { - pb_1.Message.setOneofField(this, 14, this.one_of_decls[13], value); - } - get has_etx_data() { - return pb_1.Message.getField(this, 14) != null; - } - get etx_access_list() { - return pb_1.Message.getWrapperField(this, ProtoAccessList, 15) as ProtoAccessList; - } - set etx_access_list(value: ProtoAccessList) { - pb_1.Message.setOneofWrapperField(this, 15, this.one_of_decls[14], value); - } - get has_etx_access_list() { - return pb_1.Message.getField(this, 15) != null; - } - get v() { - return pb_1.Message.getFieldWithDefault(this, 16, new Uint8Array(0)) as Uint8Array; - } - set v(value: Uint8Array) { - pb_1.Message.setOneofField(this, 16, this.one_of_decls[15], value); - } - get has_v() { - return pb_1.Message.getField(this, 16) != null; - } - get r() { - return pb_1.Message.getFieldWithDefault(this, 17, new Uint8Array(0)) as Uint8Array; - } - set r(value: Uint8Array) { - pb_1.Message.setOneofField(this, 17, this.one_of_decls[16], value); - } - get has_r() { - return pb_1.Message.getField(this, 17) != null; - } - get s() { - return pb_1.Message.getFieldWithDefault(this, 18, new Uint8Array(0)) as Uint8Array; - } - set s(value: Uint8Array) { - pb_1.Message.setOneofField(this, 18, this.one_of_decls[17], value); - } - get has_s() { - return pb_1.Message.getField(this, 18) != null; - } - get originating_tx_hash() { - return pb_1.Message.getWrapperField(this, dependency_1.common.ProtoHash, 19) as dependency_1.common.ProtoHash; - } - set originating_tx_hash(value: dependency_1.common.ProtoHash) { - pb_1.Message.setOneofWrapperField(this, 19, this.one_of_decls[18], value); - } - get has_originating_tx_hash() { - return pb_1.Message.getField(this, 19) != null; - } - get etx_index() { - return pb_1.Message.getFieldWithDefault(this, 20, 0) as number; - } - set etx_index(value: number) { - pb_1.Message.setOneofField(this, 20, this.one_of_decls[19], value); - } - get has_etx_index() { - return pb_1.Message.getField(this, 20) != null; - } - get etx_sender() { - return pb_1.Message.getFieldWithDefault(this, 21, new Uint8Array(0)) as Uint8Array; - } - set etx_sender(value: Uint8Array) { - pb_1.Message.setOneofField(this, 21, this.one_of_decls[20], value); - } - get has_etx_sender() { - return pb_1.Message.getField(this, 21) != null; - } - get tx_ins() { - return pb_1.Message.getWrapperField(this, ProtoTxIns, 22) as ProtoTxIns; - } - set tx_ins(value: ProtoTxIns) { - pb_1.Message.setOneofWrapperField(this, 22, this.one_of_decls[21], value); - } - get has_tx_ins() { - return pb_1.Message.getField(this, 22) != null; - } - get tx_outs() { - return pb_1.Message.getWrapperField(this, ProtoTxOuts, 23) as ProtoTxOuts; - } - set tx_outs(value: ProtoTxOuts) { - pb_1.Message.setOneofWrapperField(this, 23, this.one_of_decls[22], value); - } - get has_tx_outs() { - return pb_1.Message.getField(this, 23) != null; - } - get signature() { - return pb_1.Message.getFieldWithDefault(this, 24, new Uint8Array(0)) as Uint8Array; - } - set signature(value: Uint8Array) { - pb_1.Message.setOneofField(this, 24, this.one_of_decls[23], value); - } - get has_signature() { - return pb_1.Message.getField(this, 24) != null; - } - get _type() { - const cases: { - [index: number]: "none" | "type"; - } = { - 0: "none", - 1: "type" - }; - return cases[pb_1.Message.computeOneofCase(this, [1])]; - } - get _to() { - const cases: { - [index: number]: "none" | "to"; - } = { - 0: "none", - 2: "to" - }; - return cases[pb_1.Message.computeOneofCase(this, [2])]; - } - get _nonce() { - const cases: { - [index: number]: "none" | "nonce"; - } = { - 0: "none", - 3: "nonce" - }; - return cases[pb_1.Message.computeOneofCase(this, [3])]; - } - get _value() { - const cases: { - [index: number]: "none" | "value"; - } = { - 0: "none", - 4: "value" - }; - return cases[pb_1.Message.computeOneofCase(this, [4])]; - } - get _gas() { - const cases: { - [index: number]: "none" | "gas"; - } = { - 0: "none", - 5: "gas" - }; - return cases[pb_1.Message.computeOneofCase(this, [5])]; - } - get _data() { - const cases: { - [index: number]: "none" | "data"; - } = { - 0: "none", - 6: "data" - }; - return cases[pb_1.Message.computeOneofCase(this, [6])]; - } - get _chain_id() { - const cases: { - [index: number]: "none" | "chain_id"; - } = { - 0: "none", - 7: "chain_id" - }; - return cases[pb_1.Message.computeOneofCase(this, [7])]; - } - get _gas_fee_cap() { - const cases: { - [index: number]: "none" | "gas_fee_cap"; - } = { - 0: "none", - 8: "gas_fee_cap" - }; - return cases[pb_1.Message.computeOneofCase(this, [8])]; - } - get _gas_tip_cap() { - const cases: { - [index: number]: "none" | "gas_tip_cap"; - } = { - 0: "none", - 9: "gas_tip_cap" - }; - return cases[pb_1.Message.computeOneofCase(this, [9])]; - } - get _access_list() { - const cases: { - [index: number]: "none" | "access_list"; - } = { - 0: "none", - 10: "access_list" - }; - return cases[pb_1.Message.computeOneofCase(this, [10])]; - } - get _etx_gas_limit() { - const cases: { - [index: number]: "none" | "etx_gas_limit"; - } = { - 0: "none", - 11: "etx_gas_limit" - }; - return cases[pb_1.Message.computeOneofCase(this, [11])]; - } - get _etx_gas_price() { - const cases: { - [index: number]: "none" | "etx_gas_price"; - } = { - 0: "none", - 12: "etx_gas_price" - }; - return cases[pb_1.Message.computeOneofCase(this, [12])]; - } - get _etx_gas_tip() { - const cases: { - [index: number]: "none" | "etx_gas_tip"; - } = { - 0: "none", - 13: "etx_gas_tip" - }; - return cases[pb_1.Message.computeOneofCase(this, [13])]; - } - get _etx_data() { - const cases: { - [index: number]: "none" | "etx_data"; - } = { - 0: "none", - 14: "etx_data" - }; - return cases[pb_1.Message.computeOneofCase(this, [14])]; - } - get _etx_access_list() { - const cases: { - [index: number]: "none" | "etx_access_list"; - } = { - 0: "none", - 15: "etx_access_list" - }; - return cases[pb_1.Message.computeOneofCase(this, [15])]; - } - get _v() { - const cases: { - [index: number]: "none" | "v"; - } = { - 0: "none", - 16: "v" - }; - return cases[pb_1.Message.computeOneofCase(this, [16])]; - } - get _r() { - const cases: { - [index: number]: "none" | "r"; - } = { - 0: "none", - 17: "r" - }; - return cases[pb_1.Message.computeOneofCase(this, [17])]; - } - get _s() { - const cases: { - [index: number]: "none" | "s"; - } = { - 0: "none", - 18: "s" - }; - return cases[pb_1.Message.computeOneofCase(this, [18])]; - } - get _originating_tx_hash() { - const cases: { - [index: number]: "none" | "originating_tx_hash"; - } = { - 0: "none", - 19: "originating_tx_hash" - }; - return cases[pb_1.Message.computeOneofCase(this, [19])]; - } - get _etx_index() { - const cases: { - [index: number]: "none" | "etx_index"; - } = { - 0: "none", - 20: "etx_index" - }; - return cases[pb_1.Message.computeOneofCase(this, [20])]; - } - get _etx_sender() { - const cases: { - [index: number]: "none" | "etx_sender"; - } = { - 0: "none", - 21: "etx_sender" - }; - return cases[pb_1.Message.computeOneofCase(this, [21])]; - } - get _tx_ins() { - const cases: { - [index: number]: "none" | "tx_ins"; - } = { - 0: "none", - 22: "tx_ins" - }; - return cases[pb_1.Message.computeOneofCase(this, [22])]; - } - get _tx_outs() { - const cases: { - [index: number]: "none" | "tx_outs"; - } = { - 0: "none", - 23: "tx_outs" - }; - return cases[pb_1.Message.computeOneofCase(this, [23])]; - } - get _signature() { - const cases: { - [index: number]: "none" | "signature"; - } = { - 0: "none", - 24: "signature" - }; - return cases[pb_1.Message.computeOneofCase(this, [24])]; - } - static fromObject(data: { - type?: number; - to?: Uint8Array; - nonce?: number; - value?: Uint8Array; - gas?: number; - data?: Uint8Array; - chain_id?: Uint8Array; - gas_fee_cap?: Uint8Array; - gas_tip_cap?: Uint8Array; - access_list?: ReturnType; - etx_gas_limit?: number; - etx_gas_price?: Uint8Array; - etx_gas_tip?: Uint8Array; - etx_data?: Uint8Array; - etx_access_list?: ReturnType; - v?: Uint8Array; - r?: Uint8Array; - s?: Uint8Array; - originating_tx_hash?: ReturnType; - etx_index?: number; - etx_sender?: Uint8Array; - tx_ins?: ReturnType; - tx_outs?: ReturnType; - signature?: Uint8Array; - }): ProtoTransaction { - const message = new ProtoTransaction({}); - if (data.type != null) { - message.type = data.type; - } - if (data.to != null) { - message.to = data.to; - } - if (data.nonce != null) { - message.nonce = data.nonce; - } - if (data.value != null) { - message.value = data.value; - } - if (data.gas != null) { - message.gas = data.gas; - } - if (data.data != null) { - message.data = data.data; - } - if (data.chain_id != null) { - message.chain_id = data.chain_id; - } - if (data.gas_fee_cap != null) { - message.gas_fee_cap = data.gas_fee_cap; - } - if (data.gas_tip_cap != null) { - message.gas_tip_cap = data.gas_tip_cap; - } - if (data.access_list != null) { - message.access_list = ProtoAccessList.fromObject(data.access_list); - } - if (data.etx_gas_limit != null) { - message.etx_gas_limit = data.etx_gas_limit; - } - if (data.etx_gas_price != null) { - message.etx_gas_price = data.etx_gas_price; - } - if (data.etx_gas_tip != null) { - message.etx_gas_tip = data.etx_gas_tip; - } - if (data.etx_data != null) { - message.etx_data = data.etx_data; - } - if (data.etx_access_list != null) { - message.etx_access_list = ProtoAccessList.fromObject(data.etx_access_list); - } - if (data.v != null) { - message.v = data.v; - } - if (data.r != null) { - message.r = data.r; - } - if (data.s != null) { - message.s = data.s; - } - if (data.originating_tx_hash != null) { - message.originating_tx_hash = dependency_1.common.ProtoHash.fromObject(data.originating_tx_hash); - } - if (data.etx_index != null) { - message.etx_index = data.etx_index; - } - if (data.etx_sender != null) { - message.etx_sender = data.etx_sender; - } - if (data.tx_ins != null) { - message.tx_ins = ProtoTxIns.fromObject(data.tx_ins); - } - if (data.tx_outs != null) { - message.tx_outs = ProtoTxOuts.fromObject(data.tx_outs); - } - if (data.signature != null) { - message.signature = data.signature; - } - return message; - } - toObject() { - const data: { - type?: number; - to?: Uint8Array; - nonce?: number; - value?: Uint8Array; - gas?: number; - data?: Uint8Array; - chain_id?: Uint8Array; - gas_fee_cap?: Uint8Array; - gas_tip_cap?: Uint8Array; - access_list?: ReturnType; - etx_gas_limit?: number; - etx_gas_price?: Uint8Array; - etx_gas_tip?: Uint8Array; - etx_data?: Uint8Array; - etx_access_list?: ReturnType; - v?: Uint8Array; - r?: Uint8Array; - s?: Uint8Array; - originating_tx_hash?: ReturnType; - etx_index?: number; - etx_sender?: Uint8Array; - tx_ins?: ReturnType; - tx_outs?: ReturnType; - signature?: Uint8Array; - } = {}; - if (this.type != null) { - data.type = this.type; - } - if (this.to != null) { - data.to = this.to; - } - if (this.nonce != null) { - data.nonce = this.nonce; - } - if (this.value != null) { - data.value = this.value; - } - if (this.gas != null) { - data.gas = this.gas; - } - if (this.data != null) { - data.data = this.data; - } - if (this.chain_id != null) { - data.chain_id = this.chain_id; - } - if (this.gas_fee_cap != null) { - data.gas_fee_cap = this.gas_fee_cap; - } - if (this.gas_tip_cap != null) { - data.gas_tip_cap = this.gas_tip_cap; - } - if (this.access_list != null) { - data.access_list = this.access_list.toObject(); - } - if (this.etx_gas_limit != null) { - data.etx_gas_limit = this.etx_gas_limit; - } - if (this.etx_gas_price != null) { - data.etx_gas_price = this.etx_gas_price; - } - if (this.etx_gas_tip != null) { - data.etx_gas_tip = this.etx_gas_tip; - } - if (this.etx_data != null) { - data.etx_data = this.etx_data; - } - if (this.etx_access_list != null) { - data.etx_access_list = this.etx_access_list.toObject(); - } - if (this.v != null) { - data.v = this.v; - } - if (this.r != null) { - data.r = this.r; - } - if (this.s != null) { - data.s = this.s; - } - if (this.originating_tx_hash != null) { - data.originating_tx_hash = this.originating_tx_hash.toObject(); - } - if (this.etx_index != null) { - data.etx_index = this.etx_index; - } - if (this.etx_sender != null) { - data.etx_sender = this.etx_sender; - } - if (this.tx_ins != null) { - data.tx_ins = this.tx_ins.toObject(); - } - if (this.tx_outs != null) { - data.tx_outs = this.tx_outs.toObject(); - } - if (this.signature != null) { - data.signature = this.signature; - } - return data; - } - serialize(): Uint8Array; - serialize(w: pb_1.BinaryWriter): void; - serialize(w?: pb_1.BinaryWriter): Uint8Array | void { - const writer = w || new pb_1.BinaryWriter(); - if (this.has_type) - writer.writeUint64(1, this.type); - if (this.has_to) - writer.writeBytes(2, this.to); - if (this.has_nonce) - writer.writeUint64(3, this.nonce); - if (this.has_value) - writer.writeBytes(4, this.value); - if (this.has_gas) - writer.writeUint64(5, this.gas); - if (this.has_data) - writer.writeBytes(6, this.data); - if (this.has_chain_id) - writer.writeBytes(7, this.chain_id); - if (this.has_gas_fee_cap) - writer.writeBytes(8, this.gas_fee_cap); - if (this.has_gas_tip_cap) - writer.writeBytes(9, this.gas_tip_cap); - if (this.has_access_list) - writer.writeMessage(10, this.access_list, () => this.access_list.serialize(writer)); - if (this.has_etx_gas_limit) - writer.writeUint64(11, this.etx_gas_limit); - if (this.has_etx_gas_price) - writer.writeBytes(12, this.etx_gas_price); - if (this.has_etx_gas_tip) - writer.writeBytes(13, this.etx_gas_tip); - if (this.has_etx_data) - writer.writeBytes(14, this.etx_data); - if (this.has_etx_access_list) - writer.writeMessage(15, this.etx_access_list, () => this.etx_access_list.serialize(writer)); - if (this.has_v) - writer.writeBytes(16, this.v); - if (this.has_r) - writer.writeBytes(17, this.r); - if (this.has_s) - writer.writeBytes(18, this.s); - if (this.has_originating_tx_hash) - writer.writeMessage(19, this.originating_tx_hash, () => this.originating_tx_hash.serialize(writer)); - if (this.has_etx_index) - writer.writeUint32(20, this.etx_index); - if (this.has_etx_sender) - writer.writeBytes(21, this.etx_sender); - if (this.has_tx_ins) - writer.writeMessage(22, this.tx_ins, () => this.tx_ins.serialize(writer)); - if (this.has_tx_outs) - writer.writeMessage(23, this.tx_outs, () => this.tx_outs.serialize(writer)); - if (this.has_signature) - writer.writeBytes(24, this.signature); - if (!w) - return writer.getResultBuffer(); - } - static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoTransaction { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoTransaction(); - while (reader.nextField()) { - if (reader.isEndGroup()) - break; - switch (reader.getFieldNumber()) { - case 1: - message.type = reader.readUint64(); - break; - case 2: - message.to = reader.readBytes(); - break; - case 3: - message.nonce = reader.readUint64(); - break; - case 4: - message.value = reader.readBytes(); - break; - case 5: - message.gas = reader.readUint64(); - break; - case 6: - message.data = reader.readBytes(); - break; - case 7: - message.chain_id = reader.readBytes(); - break; - case 8: - message.gas_fee_cap = reader.readBytes(); - break; - case 9: - message.gas_tip_cap = reader.readBytes(); - break; - case 10: - reader.readMessage(message.access_list, () => message.access_list = ProtoAccessList.deserialize(reader)); - break; - case 11: - message.etx_gas_limit = reader.readUint64(); - break; - case 12: - message.etx_gas_price = reader.readBytes(); - break; - case 13: - message.etx_gas_tip = reader.readBytes(); - break; - case 14: - message.etx_data = reader.readBytes(); - break; - case 15: - reader.readMessage(message.etx_access_list, () => message.etx_access_list = ProtoAccessList.deserialize(reader)); - break; - case 16: - message.v = reader.readBytes(); - break; - case 17: - message.r = reader.readBytes(); - break; - case 18: - message.s = reader.readBytes(); - break; - case 19: - reader.readMessage(message.originating_tx_hash, () => message.originating_tx_hash = dependency_1.common.ProtoHash.deserialize(reader)); - break; - case 20: - message.etx_index = reader.readUint32(); - break; - case 21: - message.etx_sender = reader.readBytes(); - break; - case 22: - reader.readMessage(message.tx_ins, () => message.tx_ins = ProtoTxIns.deserialize(reader)); - break; - case 23: - reader.readMessage(message.tx_outs, () => message.tx_outs = ProtoTxOuts.deserialize(reader)); - break; - case 24: - message.signature = reader.readBytes(); - break; - default: reader.skipField(); - } - } - return message; - } - serializeBinary(): Uint8Array { - return this.serialize(); - } - static deserializeBinary(bytes: Uint8Array): ProtoTransaction { - return ProtoTransaction.deserialize(bytes); - } - } - export class ProtoAccessList extends pb_1.Message { - one_of_decls: number[][] = []; - constructor(data?: any[] | { - access_tuples?: ProtoAccessTuple[]; - }) { - super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.one_of_decls); - if (!Array.isArray(data) && typeof data == "object") { - if ("access_tuples" in data && data.access_tuples != undefined) { - this.access_tuples = data.access_tuples; - } - } - } - get access_tuples() { - return pb_1.Message.getRepeatedWrapperField(this, ProtoAccessTuple, 1) as ProtoAccessTuple[]; - } - set access_tuples(value: ProtoAccessTuple[]) { - pb_1.Message.setRepeatedWrapperField(this, 1, value); - } - static fromObject(data: { - access_tuples?: ReturnType[]; - }): ProtoAccessList { - const message = new ProtoAccessList({}); - if (data.access_tuples != null) { - message.access_tuples = data.access_tuples.map(item => ProtoAccessTuple.fromObject(item)); - } - return message; - } - toObject() { - const data: { - access_tuples?: ReturnType[]; - } = {}; - if (this.access_tuples != null) { - data.access_tuples = this.access_tuples.map((item: ProtoAccessTuple) => item.toObject()); - } - return data; - } - serialize(): Uint8Array; - serialize(w: pb_1.BinaryWriter): void; - serialize(w?: pb_1.BinaryWriter): Uint8Array | void { - const writer = w || new pb_1.BinaryWriter(); - if (this.access_tuples.length) - writer.writeRepeatedMessage(1, this.access_tuples, (item: ProtoAccessTuple) => item.serialize(writer)); - if (!w) - return writer.getResultBuffer(); - } - static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoAccessList { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoAccessList(); - while (reader.nextField()) { - if (reader.isEndGroup()) - break; - switch (reader.getFieldNumber()) { - case 1: - reader.readMessage(message.access_tuples, () => pb_1.Message.addToRepeatedWrapperField(message, 1, ProtoAccessTuple.deserialize(reader), ProtoAccessTuple)); - break; - default: reader.skipField(); - } - } - return message; - } - serializeBinary(): Uint8Array { - return this.serialize(); - } - static deserializeBinary(bytes: Uint8Array): ProtoAccessList { - return ProtoAccessList.deserialize(bytes); - } - } - export class ProtoTxIns extends pb_1.Message { - one_of_decls: number[][] = []; - constructor(data?: any[] | { - tx_ins?: ProtoTxIn[]; - }) { - super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.one_of_decls); - if (!Array.isArray(data) && typeof data == "object") { - if ("tx_ins" in data && data.tx_ins != undefined) { - this.tx_ins = data.tx_ins; - } - } - } - get tx_ins() { - return pb_1.Message.getRepeatedWrapperField(this, ProtoTxIn, 1) as ProtoTxIn[]; - } - set tx_ins(value: ProtoTxIn[]) { - pb_1.Message.setRepeatedWrapperField(this, 1, value); - } - static fromObject(data: { - tx_ins?: ReturnType[]; - }): ProtoTxIns { - const message = new ProtoTxIns({}); - if (data.tx_ins != null) { - message.tx_ins = data.tx_ins.map(item => ProtoTxIn.fromObject(item)); - } - return message; - } - toObject() { - const data: { - tx_ins?: ReturnType[]; - } = {}; - if (this.tx_ins != null) { - data.tx_ins = this.tx_ins.map((item: ProtoTxIn) => item.toObject()); - } - return data; - } - serialize(): Uint8Array; - serialize(w: pb_1.BinaryWriter): void; - serialize(w?: pb_1.BinaryWriter): Uint8Array | void { - const writer = w || new pb_1.BinaryWriter(); - if (this.tx_ins.length) - writer.writeRepeatedMessage(1, this.tx_ins, (item: ProtoTxIn) => item.serialize(writer)); - if (!w) - return writer.getResultBuffer(); - } - static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoTxIns { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoTxIns(); - while (reader.nextField()) { - if (reader.isEndGroup()) - break; - switch (reader.getFieldNumber()) { - case 1: - reader.readMessage(message.tx_ins, () => pb_1.Message.addToRepeatedWrapperField(message, 1, ProtoTxIn.deserialize(reader), ProtoTxIn)); - break; - default: reader.skipField(); - } - } - return message; - } - serializeBinary(): Uint8Array { - return this.serialize(); - } - static deserializeBinary(bytes: Uint8Array): ProtoTxIns { - return ProtoTxIns.deserialize(bytes); - } - } - export class ProtoTxOuts extends pb_1.Message { - one_of_decls: number[][] = []; - constructor(data?: any[] | { - tx_outs?: ProtoTxOut[]; - }) { - super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.one_of_decls); - if (!Array.isArray(data) && typeof data == "object") { - if ("tx_outs" in data && data.tx_outs != undefined) { - this.tx_outs = data.tx_outs; - } - } - } - get tx_outs() { - return pb_1.Message.getRepeatedWrapperField(this, ProtoTxOut, 1) as ProtoTxOut[]; - } - set tx_outs(value: ProtoTxOut[]) { - pb_1.Message.setRepeatedWrapperField(this, 1, value); - } - static fromObject(data: { - tx_outs?: ReturnType[]; - }): ProtoTxOuts { - const message = new ProtoTxOuts({}); - if (data.tx_outs != null) { - message.tx_outs = data.tx_outs.map(item => ProtoTxOut.fromObject(item)); - } - return message; - } - toObject() { - const data: { - tx_outs?: ReturnType[]; - } = {}; - if (this.tx_outs != null) { - data.tx_outs = this.tx_outs.map((item: ProtoTxOut) => item.toObject()); - } - return data; - } - serialize(): Uint8Array; - serialize(w: pb_1.BinaryWriter): void; - serialize(w?: pb_1.BinaryWriter): Uint8Array | void { - const writer = w || new pb_1.BinaryWriter(); - if (this.tx_outs.length) - writer.writeRepeatedMessage(1, this.tx_outs, (item: ProtoTxOut) => item.serialize(writer)); - if (!w) - return writer.getResultBuffer(); - } - static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoTxOuts { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoTxOuts(); - while (reader.nextField()) { - if (reader.isEndGroup()) - break; - switch (reader.getFieldNumber()) { - case 1: - reader.readMessage(message.tx_outs, () => pb_1.Message.addToRepeatedWrapperField(message, 1, ProtoTxOut.deserialize(reader), ProtoTxOut)); - break; - default: reader.skipField(); - } - } - return message; - } - serializeBinary(): Uint8Array { - return this.serialize(); - } - static deserializeBinary(bytes: Uint8Array): ProtoTxOuts { - return ProtoTxOuts.deserialize(bytes); - } - } - export class ProtoTxIn extends pb_1.Message { - one_of_decls: number[][] = [[1], [2]]; - constructor(data?: any[] | ({} & (({ - previous_out_point?: ProtoOutPoint; - }) | ({ - pub_key?: Uint8Array; - })))) { - super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.one_of_decls); - if (!Array.isArray(data) && typeof data == "object") { - if ("previous_out_point" in data && data.previous_out_point != undefined) { - this.previous_out_point = data.previous_out_point; - } - if ("pub_key" in data && data.pub_key != undefined) { - this.pub_key = data.pub_key; - } - } - } - get previous_out_point() { - return pb_1.Message.getWrapperField(this, ProtoOutPoint, 1) as ProtoOutPoint; - } - set previous_out_point(value: ProtoOutPoint) { - pb_1.Message.setOneofWrapperField(this, 1, this.one_of_decls[0], value); - } - get has_previous_out_point() { - return pb_1.Message.getField(this, 1) != null; - } - get pub_key() { - return pb_1.Message.getFieldWithDefault(this, 2, new Uint8Array(0)) as Uint8Array; - } - set pub_key(value: Uint8Array) { - pb_1.Message.setOneofField(this, 2, this.one_of_decls[1], value); - } - get has_pub_key() { - return pb_1.Message.getField(this, 2) != null; - } - get _previous_out_point() { - const cases: { - [index: number]: "none" | "previous_out_point"; - } = { - 0: "none", - 1: "previous_out_point" - }; - return cases[pb_1.Message.computeOneofCase(this, [1])]; - } - get _pub_key() { - const cases: { - [index: number]: "none" | "pub_key"; - } = { - 0: "none", - 2: "pub_key" - }; - return cases[pb_1.Message.computeOneofCase(this, [2])]; - } - static fromObject(data: { - previous_out_point?: ReturnType; - pub_key?: Uint8Array; - }): ProtoTxIn { - const message = new ProtoTxIn({}); - if (data.previous_out_point != null) { - message.previous_out_point = ProtoOutPoint.fromObject(data.previous_out_point); - } - if (data.pub_key != null) { - message.pub_key = data.pub_key; - } - return message; - } - toObject() { - const data: { - previous_out_point?: ReturnType; - pub_key?: Uint8Array; - } = {}; - if (this.previous_out_point != null) { - data.previous_out_point = this.previous_out_point.toObject(); - } - if (this.pub_key != null) { - data.pub_key = this.pub_key; - } - return data; - } - serialize(): Uint8Array; - serialize(w: pb_1.BinaryWriter): void; - serialize(w?: pb_1.BinaryWriter): Uint8Array | void { - const writer = w || new pb_1.BinaryWriter(); - if (this.has_previous_out_point) - writer.writeMessage(1, this.previous_out_point, () => this.previous_out_point.serialize(writer)); - if (this.has_pub_key) - writer.writeBytes(2, this.pub_key); - if (!w) - return writer.getResultBuffer(); - } - static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoTxIn { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoTxIn(); - while (reader.nextField()) { - if (reader.isEndGroup()) - break; - switch (reader.getFieldNumber()) { - case 1: - reader.readMessage(message.previous_out_point, () => message.previous_out_point = ProtoOutPoint.deserialize(reader)); - break; - case 2: - message.pub_key = reader.readBytes(); - break; - default: reader.skipField(); - } - } - return message; - } - serializeBinary(): Uint8Array { - return this.serialize(); - } - static deserializeBinary(bytes: Uint8Array): ProtoTxIn { - return ProtoTxIn.deserialize(bytes); - } - } - export class ProtoOutPoint extends pb_1.Message { - one_of_decls: number[][] = [[1], [2]]; - constructor(data?: any[] | ({} & (({ - hash?: dependency_1.common.ProtoHash; - }) | ({ - index?: number; - })))) { - super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.one_of_decls); - if (!Array.isArray(data) && typeof data == "object") { - if ("hash" in data && data.hash != undefined) { - this.hash = data.hash; - } - if ("index" in data && data.index != undefined) { - this.index = data.index; - } - } - } - get hash() { - return pb_1.Message.getWrapperField(this, dependency_1.common.ProtoHash, 1) as dependency_1.common.ProtoHash; - } - set hash(value: dependency_1.common.ProtoHash) { - pb_1.Message.setOneofWrapperField(this, 1, this.one_of_decls[0], value); - } - get has_hash() { - return pb_1.Message.getField(this, 1) != null; - } - get index() { - return pb_1.Message.getFieldWithDefault(this, 2, 0) as number; - } - set index(value: number) { - pb_1.Message.setOneofField(this, 2, this.one_of_decls[1], value); - } - get has_index() { - return pb_1.Message.getField(this, 2) != null; - } - get _hash() { - const cases: { - [index: number]: "none" | "hash"; - } = { - 0: "none", - 1: "hash" - }; - return cases[pb_1.Message.computeOneofCase(this, [1])]; - } - get _index() { - const cases: { - [index: number]: "none" | "index"; - } = { - 0: "none", - 2: "index" - }; - return cases[pb_1.Message.computeOneofCase(this, [2])]; - } - static fromObject(data: { - hash?: ReturnType; - index?: number; - }): ProtoOutPoint { - const message = new ProtoOutPoint({}); - if (data.hash != null) { - message.hash = dependency_1.common.ProtoHash.fromObject(data.hash); - } - if (data.index != null) { - message.index = data.index; - } - return message; - } - toObject() { - const data: { - hash?: ReturnType; - index?: number; - } = {}; - if (this.hash != null) { - data.hash = this.hash.toObject(); - } - if (this.index != null) { - data.index = this.index; - } - return data; - } - serialize(): Uint8Array; - serialize(w: pb_1.BinaryWriter): void; - serialize(w?: pb_1.BinaryWriter): Uint8Array | void { - const writer = w || new pb_1.BinaryWriter(); - if (this.has_hash) - writer.writeMessage(1, this.hash, () => this.hash.serialize(writer)); - if (this.has_index) - writer.writeUint32(2, this.index); - if (!w) - return writer.getResultBuffer(); - } - static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoOutPoint { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoOutPoint(); - while (reader.nextField()) { - if (reader.isEndGroup()) - break; - switch (reader.getFieldNumber()) { - case 1: - reader.readMessage(message.hash, () => message.hash = dependency_1.common.ProtoHash.deserialize(reader)); - break; - case 2: - message.index = reader.readUint32(); - break; - default: reader.skipField(); - } - } - return message; - } - serializeBinary(): Uint8Array { - return this.serialize(); - } - static deserializeBinary(bytes: Uint8Array): ProtoOutPoint { - return ProtoOutPoint.deserialize(bytes); - } - } - export class ProtoTxOut extends pb_1.Message { - one_of_decls: number[][] = [[1], [2]]; - constructor(data?: any[] | ({} & (({ - denomination?: number; - }) | ({ - address?: Uint8Array; - })))) { - super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.one_of_decls); - if (!Array.isArray(data) && typeof data == "object") { - if ("denomination" in data && data.denomination != undefined) { - this.denomination = data.denomination; - } - if ("address" in data && data.address != undefined) { - this.address = data.address; - } - } - } - get denomination() { - return pb_1.Message.getFieldWithDefault(this, 1, 0) as number; - } - set denomination(value: number) { - pb_1.Message.setOneofField(this, 1, this.one_of_decls[0], value); - } - get has_denomination() { - return pb_1.Message.getField(this, 1) != null; - } - get address() { - return pb_1.Message.getFieldWithDefault(this, 2, new Uint8Array(0)) as Uint8Array; - } - set address(value: Uint8Array) { - pb_1.Message.setOneofField(this, 2, this.one_of_decls[1], value); - } - get has_address() { - return pb_1.Message.getField(this, 2) != null; - } - get _denomination() { - const cases: { - [index: number]: "none" | "denomination"; - } = { - 0: "none", - 1: "denomination" - }; - return cases[pb_1.Message.computeOneofCase(this, [1])]; - } - get _address() { - const cases: { - [index: number]: "none" | "address"; - } = { - 0: "none", - 2: "address" - }; - return cases[pb_1.Message.computeOneofCase(this, [2])]; - } - static fromObject(data: { - denomination?: number; - address?: Uint8Array; - }): ProtoTxOut { - const message = new ProtoTxOut({}); - if (data.denomination != null) { - message.denomination = data.denomination; - } - if (data.address != null) { - message.address = data.address; - } - return message; - } - toObject() { - const data: { - denomination?: number; - address?: Uint8Array; - } = {}; - if (this.denomination != null) { - data.denomination = this.denomination; - } - if (this.address != null) { - data.address = this.address; - } - return data; - } - serialize(): Uint8Array; - serialize(w: pb_1.BinaryWriter): void; - serialize(w?: pb_1.BinaryWriter): Uint8Array | void { - const writer = w || new pb_1.BinaryWriter(); - if (this.has_denomination) - writer.writeUint32(1, this.denomination); - if (this.has_address) - writer.writeBytes(2, this.address); - if (!w) - return writer.getResultBuffer(); - } - static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoTxOut { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoTxOut(); - while (reader.nextField()) { - if (reader.isEndGroup()) - break; - switch (reader.getFieldNumber()) { - case 1: - message.denomination = reader.readUint32(); - break; - case 2: - message.address = reader.readBytes(); - break; - default: reader.skipField(); - } - } - return message; - } - serializeBinary(): Uint8Array { - return this.serialize(); - } - static deserializeBinary(bytes: Uint8Array): ProtoTxOut { - return ProtoTxOut.deserialize(bytes); - } - } - export class ProtoAccessTuple extends pb_1.Message { - one_of_decls: number[][] = []; - constructor(data?: any[] | { - address?: Uint8Array; - storage_key?: dependency_1.common.ProtoHash[]; - }) { - super(); - pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.one_of_decls); - if (!Array.isArray(data) && typeof data == "object") { - if ("address" in data && data.address != undefined) { - this.address = data.address; - } - if ("storage_key" in data && data.storage_key != undefined) { - this.storage_key = data.storage_key; - } - } - } - get address() { - return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array(0)) as Uint8Array; - } - set address(value: Uint8Array) { - pb_1.Message.setField(this, 1, value); - } - get storage_key() { - return pb_1.Message.getRepeatedWrapperField(this, dependency_1.common.ProtoHash, 2) as dependency_1.common.ProtoHash[]; - } - set storage_key(value: dependency_1.common.ProtoHash[]) { - pb_1.Message.setRepeatedWrapperField(this, 2, value); - } - static fromObject(data: { - address?: Uint8Array; - storage_key?: ReturnType[]; - }): ProtoAccessTuple { - const message = new ProtoAccessTuple({}); - if (data.address != null) { - message.address = data.address; - } - if (data.storage_key != null) { - message.storage_key = data.storage_key.map(item => dependency_1.common.ProtoHash.fromObject(item)); - } - return message; - } - toObject() { - const data: { - address?: Uint8Array; - storage_key?: ReturnType[]; - } = {}; - if (this.address != null) { - data.address = this.address; - } - if (this.storage_key != null) { - data.storage_key = this.storage_key.map((item: dependency_1.common.ProtoHash) => item.toObject()); - } - return data; - } - serialize(): Uint8Array; - serialize(w: pb_1.BinaryWriter): void; - serialize(w?: pb_1.BinaryWriter): Uint8Array | void { - const writer = w || new pb_1.BinaryWriter(); - if (this.address.length) - writer.writeBytes(1, this.address); - if (this.storage_key.length) - writer.writeRepeatedMessage(2, this.storage_key, (item: dependency_1.common.ProtoHash) => item.serialize(writer)); - if (!w) - return writer.getResultBuffer(); - } - static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoAccessTuple { - const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoAccessTuple(); - while (reader.nextField()) { - if (reader.isEndGroup()) - break; - switch (reader.getFieldNumber()) { - case 1: - message.address = reader.readBytes(); - break; - case 2: - reader.readMessage(message.storage_key, () => pb_1.Message.addToRepeatedWrapperField(message, 2, dependency_1.common.ProtoHash.deserialize(reader), dependency_1.common.ProtoHash)); - break; - default: reader.skipField(); - } - } - return message; - } - serializeBinary(): Uint8Array { - return this.serialize(); - } - static deserializeBinary(bytes: Uint8Array): ProtoAccessTuple { - return ProtoAccessTuple.deserialize(bytes); - } - } -} diff --git a/src.ts/utils/ProtoBuf/proto_block.proto b/src.ts/utils/ProtoBuf/proto_block.proto new file mode 100644 index 00000000..c56cdccd --- /dev/null +++ b/src.ts/utils/ProtoBuf/proto_block.proto @@ -0,0 +1,145 @@ +syntax = "proto3"; + +package block; +option go_package = "github.com/dominant-strategies/go-quai/core/types"; + +import "proto_common.proto"; + +// This file defines all the ProtoBuf definitions related to core +message ProtoBlock { + optional ProtoHeader header = 1; + optional ProtoBody body = 2; +} + +message ProtoBody { + optional ProtoTransactions txs = 1; + optional ProtoHeaders uncles = 2; + optional ProtoTransactions etxs = 3; + optional ProtoManifest manifest = 4; +} + +message ProtoHeader { + repeated common.ProtoHash parent_hash = 1; + optional common.ProtoHash uncle_hash = 2; + optional bytes coinbase = 3; + optional common.ProtoHash evm_root = 4; + optional common.ProtoHash tx_hash = 5; + optional common.ProtoHash etx_hash = 6; + optional common.ProtoHash etx_rollup_hash = 7; + repeated common.ProtoHash manifest_hash = 8; + optional common.ProtoHash receipt_hash = 9; + optional bytes difficulty = 10; + repeated bytes parent_entropy = 11; + repeated bytes parent_delta_s = 12; + repeated bytes number = 13; + optional uint64 gas_limit = 14; + optional uint64 gas_used = 15; + optional bytes base_fee = 16; + optional common.ProtoLocation location = 17; + optional uint64 time = 18; + optional bytes extra = 19; + optional common.ProtoHash mix_hash = 20; + optional uint64 nonce = 21; + optional common.ProtoHash utxo_root = 22; + optional common.ProtoHash etx_set_hash = 23; +} + +message ProtoTransaction { + optional uint64 type = 1; + optional bytes to = 2; + optional uint64 nonce = 3; + optional bytes value = 4; + optional uint64 gas = 5; + optional bytes data = 6; + optional bytes chain_id = 7; + optional bytes gas_fee_cap = 8; + optional bytes gas_tip_cap = 9; + optional ProtoAccessList access_list = 10; + optional bytes v = 11; + optional bytes r = 12; + optional bytes s = 13; + optional common.ProtoHash originating_tx_hash = 14; + optional uint32 etx_index = 15; + optional ProtoTxIns tx_ins = 16; + optional ProtoTxOuts tx_outs = 17; + optional bytes signature = 18; + optional bytes etx_sender = 19; +} + +message ProtoTransactions { repeated ProtoTransaction transactions = 1; } + +message ProtoHeaders { repeated ProtoHeader headers = 1; } + +message ProtoManifest { repeated common.ProtoHash manifest = 1; } + +message ProtoAccessList { repeated ProtoAccessTuple access_tuples = 1; } + +message ProtoAccessTuple { + bytes address = 1; + repeated common.ProtoHash storage_key = 2; +} + +message ProtoReceiptForStorage { + bytes post_state_or_status = 1; + uint64 cumulative_gas_used = 2; + common.ProtoHash tx_hash = 3; + common.ProtoAddress contract_address = 4; + ProtoLogsForStorage logs = 5; + ProtoTransactions etxs = 6; + uint64 gas_used = 7; +} + +message ProtoReceiptsForStorage { + repeated ProtoReceiptForStorage receipts = 1; +} + +message ProtoLogForStorage { + common.ProtoAddress address = 1; + repeated common.ProtoHash topics = 2; + bytes data = 3; +} + +message ProtoLogsForStorage { repeated ProtoLogForStorage logs = 1; } + +message ProtoPendingHeader { + optional ProtoHeader header = 1; + optional ProtoTermini termini = 2; +} + +message ProtoTermini { + repeated common.ProtoHash dom_termini = 1; + repeated common.ProtoHash sub_termini = 2; +} + +message ProtoEtxSet { + optional bytes etx_hashes = 1; +} + +message ProtoPendingEtxs { + optional ProtoHeader header = 1; + optional ProtoTransactions etxs = 2; +} + +message ProtoPendingEtxsRollup { + optional ProtoHeader header = 1; + optional ProtoTransactions etxs_rollup = 2; +} + +message ProtoTxIns { repeated ProtoTxIn tx_ins = 1; } + +message ProtoTxOuts { repeated ProtoTxOut tx_outs = 1; } + +message ProtoTxIn { + optional ProtoOutPoint previous_out_point = 1; + optional bytes pub_key = 2; +} + +message ProtoOutPoint { + optional common.ProtoHash hash = 1; + optional uint32 index = 2; +} + +message ProtoTxOut { + optional uint32 denomination = 1; + optional bytes address = 2; +} diff --git a/src.ts/utils/ProtoBuf/proto_block.ts b/src.ts/utils/ProtoBuf/proto_block.ts new file mode 100644 index 00000000..8c397c0a --- /dev/null +++ b/src.ts/utils/ProtoBuf/proto_block.ts @@ -0,0 +1,3663 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 4.25.3 + * source: proto_block.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as dependency_1 from "./proto_common"; +import * as pb_1 from "google-protobuf"; +export namespace block { + export class ProtoBlock extends pb_1.Message { + #one_of_decls: number[][] = [[1], [2]]; + constructor(data?: any[] | ({} & (({ + header?: ProtoHeader; + }) | ({ + body?: ProtoBody; + })))) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("header" in data && data.header != undefined) { + this.header = data.header; + } + if ("body" in data && data.body != undefined) { + this.body = data.body; + } + } + } + get header() { + return pb_1.Message.getWrapperField(this, ProtoHeader, 1) as ProtoHeader; + } + set header(value: ProtoHeader) { + pb_1.Message.setOneofWrapperField(this, 1, this.#one_of_decls[0], value); + } + get has_header() { + return pb_1.Message.getField(this, 1) != null; + } + get body() { + return pb_1.Message.getWrapperField(this, ProtoBody, 2) as ProtoBody; + } + set body(value: ProtoBody) { + pb_1.Message.setOneofWrapperField(this, 2, this.#one_of_decls[1], value); + } + get has_body() { + return pb_1.Message.getField(this, 2) != null; + } + get _header() { + const cases: { + [index: number]: "none" | "header"; + } = { + 0: "none", + 1: "header" + }; + return cases[pb_1.Message.computeOneofCase(this, [1])]; + } + get _body() { + const cases: { + [index: number]: "none" | "body"; + } = { + 0: "none", + 2: "body" + }; + return cases[pb_1.Message.computeOneofCase(this, [2])]; + } + static fromObject(data: { + header?: ReturnType; + body?: ReturnType; + }): ProtoBlock { + const message = new ProtoBlock({}); + if (data.header != null) { + message.header = ProtoHeader.fromObject(data.header); + } + if (data.body != null) { + message.body = ProtoBody.fromObject(data.body); + } + return message; + } + toObject() { + const data: { + header?: ReturnType; + body?: ReturnType; + } = {}; + if (this.header != null) { + data.header = this.header.toObject(); + } + if (this.body != null) { + data.body = this.body.toObject(); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.has_header) + writer.writeMessage(1, this.header, () => this.header.serialize(writer)); + if (this.has_body) + writer.writeMessage(2, this.body, () => this.body.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoBlock { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoBlock(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.header, () => message.header = ProtoHeader.deserialize(reader)); + break; + case 2: + reader.readMessage(message.body, () => message.body = ProtoBody.deserialize(reader)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoBlock { + return ProtoBlock.deserialize(bytes); + } + } + export class ProtoBody extends pb_1.Message { + #one_of_decls: number[][] = [[1], [2], [3], [4]]; + constructor(data?: any[] | ({} & (({ + txs?: ProtoTransactions; + }) | ({ + uncles?: ProtoHeaders; + }) | ({ + etxs?: ProtoTransactions; + }) | ({ + manifest?: ProtoManifest; + })))) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("txs" in data && data.txs != undefined) { + this.txs = data.txs; + } + if ("uncles" in data && data.uncles != undefined) { + this.uncles = data.uncles; + } + if ("etxs" in data && data.etxs != undefined) { + this.etxs = data.etxs; + } + if ("manifest" in data && data.manifest != undefined) { + this.manifest = data.manifest; + } + } + } + get txs() { + return pb_1.Message.getWrapperField(this, ProtoTransactions, 1) as ProtoTransactions; + } + set txs(value: ProtoTransactions) { + pb_1.Message.setOneofWrapperField(this, 1, this.#one_of_decls[0], value); + } + get has_txs() { + return pb_1.Message.getField(this, 1) != null; + } + get uncles() { + return pb_1.Message.getWrapperField(this, ProtoHeaders, 2) as ProtoHeaders; + } + set uncles(value: ProtoHeaders) { + pb_1.Message.setOneofWrapperField(this, 2, this.#one_of_decls[1], value); + } + get has_uncles() { + return pb_1.Message.getField(this, 2) != null; + } + get etxs() { + return pb_1.Message.getWrapperField(this, ProtoTransactions, 3) as ProtoTransactions; + } + set etxs(value: ProtoTransactions) { + pb_1.Message.setOneofWrapperField(this, 3, this.#one_of_decls[2], value); + } + get has_etxs() { + return pb_1.Message.getField(this, 3) != null; + } + get manifest() { + return pb_1.Message.getWrapperField(this, ProtoManifest, 4) as ProtoManifest; + } + set manifest(value: ProtoManifest) { + pb_1.Message.setOneofWrapperField(this, 4, this.#one_of_decls[3], value); + } + get has_manifest() { + return pb_1.Message.getField(this, 4) != null; + } + get _txs() { + const cases: { + [index: number]: "none" | "txs"; + } = { + 0: "none", + 1: "txs" + }; + return cases[pb_1.Message.computeOneofCase(this, [1])]; + } + get _uncles() { + const cases: { + [index: number]: "none" | "uncles"; + } = { + 0: "none", + 2: "uncles" + }; + return cases[pb_1.Message.computeOneofCase(this, [2])]; + } + get _etxs() { + const cases: { + [index: number]: "none" | "etxs"; + } = { + 0: "none", + 3: "etxs" + }; + return cases[pb_1.Message.computeOneofCase(this, [3])]; + } + get _manifest() { + const cases: { + [index: number]: "none" | "manifest"; + } = { + 0: "none", + 4: "manifest" + }; + return cases[pb_1.Message.computeOneofCase(this, [4])]; + } + static fromObject(data: { + txs?: ReturnType; + uncles?: ReturnType; + etxs?: ReturnType; + manifest?: ReturnType; + }): ProtoBody { + const message = new ProtoBody({}); + if (data.txs != null) { + message.txs = ProtoTransactions.fromObject(data.txs); + } + if (data.uncles != null) { + message.uncles = ProtoHeaders.fromObject(data.uncles); + } + if (data.etxs != null) { + message.etxs = ProtoTransactions.fromObject(data.etxs); + } + if (data.manifest != null) { + message.manifest = ProtoManifest.fromObject(data.manifest); + } + return message; + } + toObject() { + const data: { + txs?: ReturnType; + uncles?: ReturnType; + etxs?: ReturnType; + manifest?: ReturnType; + } = {}; + if (this.txs != null) { + data.txs = this.txs.toObject(); + } + if (this.uncles != null) { + data.uncles = this.uncles.toObject(); + } + if (this.etxs != null) { + data.etxs = this.etxs.toObject(); + } + if (this.manifest != null) { + data.manifest = this.manifest.toObject(); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.has_txs) + writer.writeMessage(1, this.txs, () => this.txs.serialize(writer)); + if (this.has_uncles) + writer.writeMessage(2, this.uncles, () => this.uncles.serialize(writer)); + if (this.has_etxs) + writer.writeMessage(3, this.etxs, () => this.etxs.serialize(writer)); + if (this.has_manifest) + writer.writeMessage(4, this.manifest, () => this.manifest.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoBody { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoBody(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.txs, () => message.txs = ProtoTransactions.deserialize(reader)); + break; + case 2: + reader.readMessage(message.uncles, () => message.uncles = ProtoHeaders.deserialize(reader)); + break; + case 3: + reader.readMessage(message.etxs, () => message.etxs = ProtoTransactions.deserialize(reader)); + break; + case 4: + reader.readMessage(message.manifest, () => message.manifest = ProtoManifest.deserialize(reader)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoBody { + return ProtoBody.deserialize(bytes); + } + } + export class ProtoHeader extends pb_1.Message { + #one_of_decls: number[][] = [[2], [3], [4], [5], [6], [7], [9], [10], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23]]; + constructor(data?: any[] | ({ + parent_hash?: dependency_1.common.ProtoHash[]; + manifest_hash?: dependency_1.common.ProtoHash[]; + parent_entropy?: Uint8Array[]; + parent_delta_s?: Uint8Array[]; + number?: Uint8Array[]; + } & (({ + uncle_hash?: dependency_1.common.ProtoHash; + }) | ({ + coinbase?: Uint8Array; + }) | ({ + evm_root?: dependency_1.common.ProtoHash; + }) | ({ + tx_hash?: dependency_1.common.ProtoHash; + }) | ({ + etx_hash?: dependency_1.common.ProtoHash; + }) | ({ + etx_rollup_hash?: dependency_1.common.ProtoHash; + }) | ({ + receipt_hash?: dependency_1.common.ProtoHash; + }) | ({ + difficulty?: Uint8Array; + }) | ({ + gas_limit?: number; + }) | ({ + gas_used?: number; + }) | ({ + base_fee?: Uint8Array; + }) | ({ + location?: dependency_1.common.ProtoLocation; + }) | ({ + time?: number; + }) | ({ + extra?: Uint8Array; + }) | ({ + mix_hash?: dependency_1.common.ProtoHash; + }) | ({ + nonce?: number; + }) | ({ + utxo_root?: dependency_1.common.ProtoHash; + }) | ({ + etx_set_hash?: dependency_1.common.ProtoHash; + })))) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 8, 11, 12, 13], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("parent_hash" in data && data.parent_hash != undefined) { + this.parent_hash = data.parent_hash; + } + if ("uncle_hash" in data && data.uncle_hash != undefined) { + this.uncle_hash = data.uncle_hash; + } + if ("coinbase" in data && data.coinbase != undefined) { + this.coinbase = data.coinbase; + } + if ("evm_root" in data && data.evm_root != undefined) { + this.evm_root = data.evm_root; + } + if ("tx_hash" in data && data.tx_hash != undefined) { + this.tx_hash = data.tx_hash; + } + if ("etx_hash" in data && data.etx_hash != undefined) { + this.etx_hash = data.etx_hash; + } + if ("etx_rollup_hash" in data && data.etx_rollup_hash != undefined) { + this.etx_rollup_hash = data.etx_rollup_hash; + } + if ("manifest_hash" in data && data.manifest_hash != undefined) { + this.manifest_hash = data.manifest_hash; + } + if ("receipt_hash" in data && data.receipt_hash != undefined) { + this.receipt_hash = data.receipt_hash; + } + if ("difficulty" in data && data.difficulty != undefined) { + this.difficulty = data.difficulty; + } + if ("parent_entropy" in data && data.parent_entropy != undefined) { + this.parent_entropy = data.parent_entropy; + } + if ("parent_delta_s" in data && data.parent_delta_s != undefined) { + this.parent_delta_s = data.parent_delta_s; + } + if ("number" in data && data.number != undefined) { + this.number = data.number; + } + if ("gas_limit" in data && data.gas_limit != undefined) { + this.gas_limit = data.gas_limit; + } + if ("gas_used" in data && data.gas_used != undefined) { + this.gas_used = data.gas_used; + } + if ("base_fee" in data && data.base_fee != undefined) { + this.base_fee = data.base_fee; + } + if ("location" in data && data.location != undefined) { + this.location = data.location; + } + if ("time" in data && data.time != undefined) { + this.time = data.time; + } + if ("extra" in data && data.extra != undefined) { + this.extra = data.extra; + } + if ("mix_hash" in data && data.mix_hash != undefined) { + this.mix_hash = data.mix_hash; + } + if ("nonce" in data && data.nonce != undefined) { + this.nonce = data.nonce; + } + if ("utxo_root" in data && data.utxo_root != undefined) { + this.utxo_root = data.utxo_root; + } + if ("etx_set_hash" in data && data.etx_set_hash != undefined) { + this.etx_set_hash = data.etx_set_hash; + } + } + } + get parent_hash() { + return pb_1.Message.getRepeatedWrapperField(this, dependency_1.common.ProtoHash, 1) as dependency_1.common.ProtoHash[]; + } + set parent_hash(value: dependency_1.common.ProtoHash[]) { + pb_1.Message.setRepeatedWrapperField(this, 1, value); + } + get uncle_hash() { + return pb_1.Message.getWrapperField(this, dependency_1.common.ProtoHash, 2) as dependency_1.common.ProtoHash; + } + set uncle_hash(value: dependency_1.common.ProtoHash) { + pb_1.Message.setOneofWrapperField(this, 2, this.#one_of_decls[0], value); + } + get has_uncle_hash() { + return pb_1.Message.getField(this, 2) != null; + } + get coinbase() { + return pb_1.Message.getFieldWithDefault(this, 3, new Uint8Array(0)) as Uint8Array; + } + set coinbase(value: Uint8Array) { + pb_1.Message.setOneofField(this, 3, this.#one_of_decls[1], value); + } + get has_coinbase() { + return pb_1.Message.getField(this, 3) != null; + } + get evm_root() { + return pb_1.Message.getWrapperField(this, dependency_1.common.ProtoHash, 4) as dependency_1.common.ProtoHash; + } + set evm_root(value: dependency_1.common.ProtoHash) { + pb_1.Message.setOneofWrapperField(this, 4, this.#one_of_decls[2], value); + } + get has_evm_root() { + return pb_1.Message.getField(this, 4) != null; + } + get tx_hash() { + return pb_1.Message.getWrapperField(this, dependency_1.common.ProtoHash, 5) as dependency_1.common.ProtoHash; + } + set tx_hash(value: dependency_1.common.ProtoHash) { + pb_1.Message.setOneofWrapperField(this, 5, this.#one_of_decls[3], value); + } + get has_tx_hash() { + return pb_1.Message.getField(this, 5) != null; + } + get etx_hash() { + return pb_1.Message.getWrapperField(this, dependency_1.common.ProtoHash, 6) as dependency_1.common.ProtoHash; + } + set etx_hash(value: dependency_1.common.ProtoHash) { + pb_1.Message.setOneofWrapperField(this, 6, this.#one_of_decls[4], value); + } + get has_etx_hash() { + return pb_1.Message.getField(this, 6) != null; + } + get etx_rollup_hash() { + return pb_1.Message.getWrapperField(this, dependency_1.common.ProtoHash, 7) as dependency_1.common.ProtoHash; + } + set etx_rollup_hash(value: dependency_1.common.ProtoHash) { + pb_1.Message.setOneofWrapperField(this, 7, this.#one_of_decls[5], value); + } + get has_etx_rollup_hash() { + return pb_1.Message.getField(this, 7) != null; + } + get manifest_hash() { + return pb_1.Message.getRepeatedWrapperField(this, dependency_1.common.ProtoHash, 8) as dependency_1.common.ProtoHash[]; + } + set manifest_hash(value: dependency_1.common.ProtoHash[]) { + pb_1.Message.setRepeatedWrapperField(this, 8, value); + } + get receipt_hash() { + return pb_1.Message.getWrapperField(this, dependency_1.common.ProtoHash, 9) as dependency_1.common.ProtoHash; + } + set receipt_hash(value: dependency_1.common.ProtoHash) { + pb_1.Message.setOneofWrapperField(this, 9, this.#one_of_decls[6], value); + } + get has_receipt_hash() { + return pb_1.Message.getField(this, 9) != null; + } + get difficulty() { + return pb_1.Message.getFieldWithDefault(this, 10, new Uint8Array(0)) as Uint8Array; + } + set difficulty(value: Uint8Array) { + pb_1.Message.setOneofField(this, 10, this.#one_of_decls[7], value); + } + get has_difficulty() { + return pb_1.Message.getField(this, 10) != null; + } + get parent_entropy() { + return pb_1.Message.getFieldWithDefault(this, 11, []) as Uint8Array[]; + } + set parent_entropy(value: Uint8Array[]) { + pb_1.Message.setField(this, 11, value); + } + get parent_delta_s() { + return pb_1.Message.getFieldWithDefault(this, 12, []) as Uint8Array[]; + } + set parent_delta_s(value: Uint8Array[]) { + pb_1.Message.setField(this, 12, value); + } + get number() { + return pb_1.Message.getFieldWithDefault(this, 13, []) as Uint8Array[]; + } + set number(value: Uint8Array[]) { + pb_1.Message.setField(this, 13, value); + } + get gas_limit() { + return pb_1.Message.getFieldWithDefault(this, 14, 0) as number; + } + set gas_limit(value: number) { + pb_1.Message.setOneofField(this, 14, this.#one_of_decls[8], value); + } + get has_gas_limit() { + return pb_1.Message.getField(this, 14) != null; + } + get gas_used() { + return pb_1.Message.getFieldWithDefault(this, 15, 0) as number; + } + set gas_used(value: number) { + pb_1.Message.setOneofField(this, 15, this.#one_of_decls[9], value); + } + get has_gas_used() { + return pb_1.Message.getField(this, 15) != null; + } + get base_fee() { + return pb_1.Message.getFieldWithDefault(this, 16, new Uint8Array(0)) as Uint8Array; + } + set base_fee(value: Uint8Array) { + pb_1.Message.setOneofField(this, 16, this.#one_of_decls[10], value); + } + get has_base_fee() { + return pb_1.Message.getField(this, 16) != null; + } + get location() { + return pb_1.Message.getWrapperField(this, dependency_1.common.ProtoLocation, 17) as dependency_1.common.ProtoLocation; + } + set location(value: dependency_1.common.ProtoLocation) { + pb_1.Message.setOneofWrapperField(this, 17, this.#one_of_decls[11], value); + } + get has_location() { + return pb_1.Message.getField(this, 17) != null; + } + get time() { + return pb_1.Message.getFieldWithDefault(this, 18, 0) as number; + } + set time(value: number) { + pb_1.Message.setOneofField(this, 18, this.#one_of_decls[12], value); + } + get has_time() { + return pb_1.Message.getField(this, 18) != null; + } + get extra() { + return pb_1.Message.getFieldWithDefault(this, 19, new Uint8Array(0)) as Uint8Array; + } + set extra(value: Uint8Array) { + pb_1.Message.setOneofField(this, 19, this.#one_of_decls[13], value); + } + get has_extra() { + return pb_1.Message.getField(this, 19) != null; + } + get mix_hash() { + return pb_1.Message.getWrapperField(this, dependency_1.common.ProtoHash, 20) as dependency_1.common.ProtoHash; + } + set mix_hash(value: dependency_1.common.ProtoHash) { + pb_1.Message.setOneofWrapperField(this, 20, this.#one_of_decls[14], value); + } + get has_mix_hash() { + return pb_1.Message.getField(this, 20) != null; + } + get nonce() { + return pb_1.Message.getFieldWithDefault(this, 21, 0) as number; + } + set nonce(value: number) { + pb_1.Message.setOneofField(this, 21, this.#one_of_decls[15], value); + } + get has_nonce() { + return pb_1.Message.getField(this, 21) != null; + } + get utxo_root() { + return pb_1.Message.getWrapperField(this, dependency_1.common.ProtoHash, 22) as dependency_1.common.ProtoHash; + } + set utxo_root(value: dependency_1.common.ProtoHash) { + pb_1.Message.setOneofWrapperField(this, 22, this.#one_of_decls[16], value); + } + get has_utxo_root() { + return pb_1.Message.getField(this, 22) != null; + } + get etx_set_hash() { + return pb_1.Message.getWrapperField(this, dependency_1.common.ProtoHash, 23) as dependency_1.common.ProtoHash; + } + set etx_set_hash(value: dependency_1.common.ProtoHash) { + pb_1.Message.setOneofWrapperField(this, 23, this.#one_of_decls[17], value); + } + get has_etx_set_hash() { + return pb_1.Message.getField(this, 23) != null; + } + get _uncle_hash() { + const cases: { + [index: number]: "none" | "uncle_hash"; + } = { + 0: "none", + 2: "uncle_hash" + }; + return cases[pb_1.Message.computeOneofCase(this, [2])]; + } + get _coinbase() { + const cases: { + [index: number]: "none" | "coinbase"; + } = { + 0: "none", + 3: "coinbase" + }; + return cases[pb_1.Message.computeOneofCase(this, [3])]; + } + get _evm_root() { + const cases: { + [index: number]: "none" | "evm_root"; + } = { + 0: "none", + 4: "evm_root" + }; + return cases[pb_1.Message.computeOneofCase(this, [4])]; + } + get _tx_hash() { + const cases: { + [index: number]: "none" | "tx_hash"; + } = { + 0: "none", + 5: "tx_hash" + }; + return cases[pb_1.Message.computeOneofCase(this, [5])]; + } + get _etx_hash() { + const cases: { + [index: number]: "none" | "etx_hash"; + } = { + 0: "none", + 6: "etx_hash" + }; + return cases[pb_1.Message.computeOneofCase(this, [6])]; + } + get _etx_rollup_hash() { + const cases: { + [index: number]: "none" | "etx_rollup_hash"; + } = { + 0: "none", + 7: "etx_rollup_hash" + }; + return cases[pb_1.Message.computeOneofCase(this, [7])]; + } + get _receipt_hash() { + const cases: { + [index: number]: "none" | "receipt_hash"; + } = { + 0: "none", + 9: "receipt_hash" + }; + return cases[pb_1.Message.computeOneofCase(this, [9])]; + } + get _difficulty() { + const cases: { + [index: number]: "none" | "difficulty"; + } = { + 0: "none", + 10: "difficulty" + }; + return cases[pb_1.Message.computeOneofCase(this, [10])]; + } + get _gas_limit() { + const cases: { + [index: number]: "none" | "gas_limit"; + } = { + 0: "none", + 14: "gas_limit" + }; + return cases[pb_1.Message.computeOneofCase(this, [14])]; + } + get _gas_used() { + const cases: { + [index: number]: "none" | "gas_used"; + } = { + 0: "none", + 15: "gas_used" + }; + return cases[pb_1.Message.computeOneofCase(this, [15])]; + } + get _base_fee() { + const cases: { + [index: number]: "none" | "base_fee"; + } = { + 0: "none", + 16: "base_fee" + }; + return cases[pb_1.Message.computeOneofCase(this, [16])]; + } + get _location() { + const cases: { + [index: number]: "none" | "location"; + } = { + 0: "none", + 17: "location" + }; + return cases[pb_1.Message.computeOneofCase(this, [17])]; + } + get _time() { + const cases: { + [index: number]: "none" | "time"; + } = { + 0: "none", + 18: "time" + }; + return cases[pb_1.Message.computeOneofCase(this, [18])]; + } + get _extra() { + const cases: { + [index: number]: "none" | "extra"; + } = { + 0: "none", + 19: "extra" + }; + return cases[pb_1.Message.computeOneofCase(this, [19])]; + } + get _mix_hash() { + const cases: { + [index: number]: "none" | "mix_hash"; + } = { + 0: "none", + 20: "mix_hash" + }; + return cases[pb_1.Message.computeOneofCase(this, [20])]; + } + get _nonce() { + const cases: { + [index: number]: "none" | "nonce"; + } = { + 0: "none", + 21: "nonce" + }; + return cases[pb_1.Message.computeOneofCase(this, [21])]; + } + get _utxo_root() { + const cases: { + [index: number]: "none" | "utxo_root"; + } = { + 0: "none", + 22: "utxo_root" + }; + return cases[pb_1.Message.computeOneofCase(this, [22])]; + } + get _etx_set_hash() { + const cases: { + [index: number]: "none" | "etx_set_hash"; + } = { + 0: "none", + 23: "etx_set_hash" + }; + return cases[pb_1.Message.computeOneofCase(this, [23])]; + } + static fromObject(data: { + parent_hash?: ReturnType[]; + uncle_hash?: ReturnType; + coinbase?: Uint8Array; + evm_root?: ReturnType; + tx_hash?: ReturnType; + etx_hash?: ReturnType; + etx_rollup_hash?: ReturnType; + manifest_hash?: ReturnType[]; + receipt_hash?: ReturnType; + difficulty?: Uint8Array; + parent_entropy?: Uint8Array[]; + parent_delta_s?: Uint8Array[]; + number?: Uint8Array[]; + gas_limit?: number; + gas_used?: number; + base_fee?: Uint8Array; + location?: ReturnType; + time?: number; + extra?: Uint8Array; + mix_hash?: ReturnType; + nonce?: number; + utxo_root?: ReturnType; + etx_set_hash?: ReturnType; + }): ProtoHeader { + const message = new ProtoHeader({}); + if (data.parent_hash != null) { + message.parent_hash = data.parent_hash.map(item => dependency_1.common.ProtoHash.fromObject(item)); + } + if (data.uncle_hash != null) { + message.uncle_hash = dependency_1.common.ProtoHash.fromObject(data.uncle_hash); + } + if (data.coinbase != null) { + message.coinbase = data.coinbase; + } + if (data.evm_root != null) { + message.evm_root = dependency_1.common.ProtoHash.fromObject(data.evm_root); + } + if (data.tx_hash != null) { + message.tx_hash = dependency_1.common.ProtoHash.fromObject(data.tx_hash); + } + if (data.etx_hash != null) { + message.etx_hash = dependency_1.common.ProtoHash.fromObject(data.etx_hash); + } + if (data.etx_rollup_hash != null) { + message.etx_rollup_hash = dependency_1.common.ProtoHash.fromObject(data.etx_rollup_hash); + } + if (data.manifest_hash != null) { + message.manifest_hash = data.manifest_hash.map(item => dependency_1.common.ProtoHash.fromObject(item)); + } + if (data.receipt_hash != null) { + message.receipt_hash = dependency_1.common.ProtoHash.fromObject(data.receipt_hash); + } + if (data.difficulty != null) { + message.difficulty = data.difficulty; + } + if (data.parent_entropy != null) { + message.parent_entropy = data.parent_entropy; + } + if (data.parent_delta_s != null) { + message.parent_delta_s = data.parent_delta_s; + } + if (data.number != null) { + message.number = data.number; + } + if (data.gas_limit != null) { + message.gas_limit = data.gas_limit; + } + if (data.gas_used != null) { + message.gas_used = data.gas_used; + } + if (data.base_fee != null) { + message.base_fee = data.base_fee; + } + if (data.location != null) { + message.location = dependency_1.common.ProtoLocation.fromObject(data.location); + } + if (data.time != null) { + message.time = data.time; + } + if (data.extra != null) { + message.extra = data.extra; + } + if (data.mix_hash != null) { + message.mix_hash = dependency_1.common.ProtoHash.fromObject(data.mix_hash); + } + if (data.nonce != null) { + message.nonce = data.nonce; + } + if (data.utxo_root != null) { + message.utxo_root = dependency_1.common.ProtoHash.fromObject(data.utxo_root); + } + if (data.etx_set_hash != null) { + message.etx_set_hash = dependency_1.common.ProtoHash.fromObject(data.etx_set_hash); + } + return message; + } + toObject() { + const data: { + parent_hash?: ReturnType[]; + uncle_hash?: ReturnType; + coinbase?: Uint8Array; + evm_root?: ReturnType; + tx_hash?: ReturnType; + etx_hash?: ReturnType; + etx_rollup_hash?: ReturnType; + manifest_hash?: ReturnType[]; + receipt_hash?: ReturnType; + difficulty?: Uint8Array; + parent_entropy?: Uint8Array[]; + parent_delta_s?: Uint8Array[]; + number?: Uint8Array[]; + gas_limit?: number; + gas_used?: number; + base_fee?: Uint8Array; + location?: ReturnType; + time?: number; + extra?: Uint8Array; + mix_hash?: ReturnType; + nonce?: number; + utxo_root?: ReturnType; + etx_set_hash?: ReturnType; + } = {}; + if (this.parent_hash != null) { + data.parent_hash = this.parent_hash.map((item: dependency_1.common.ProtoHash) => item.toObject()); + } + if (this.uncle_hash != null) { + data.uncle_hash = this.uncle_hash.toObject(); + } + if (this.coinbase != null) { + data.coinbase = this.coinbase; + } + if (this.evm_root != null) { + data.evm_root = this.evm_root.toObject(); + } + if (this.tx_hash != null) { + data.tx_hash = this.tx_hash.toObject(); + } + if (this.etx_hash != null) { + data.etx_hash = this.etx_hash.toObject(); + } + if (this.etx_rollup_hash != null) { + data.etx_rollup_hash = this.etx_rollup_hash.toObject(); + } + if (this.manifest_hash != null) { + data.manifest_hash = this.manifest_hash.map((item: dependency_1.common.ProtoHash) => item.toObject()); + } + if (this.receipt_hash != null) { + data.receipt_hash = this.receipt_hash.toObject(); + } + if (this.difficulty != null) { + data.difficulty = this.difficulty; + } + if (this.parent_entropy != null) { + data.parent_entropy = this.parent_entropy; + } + if (this.parent_delta_s != null) { + data.parent_delta_s = this.parent_delta_s; + } + if (this.number != null) { + data.number = this.number; + } + if (this.gas_limit != null) { + data.gas_limit = this.gas_limit; + } + if (this.gas_used != null) { + data.gas_used = this.gas_used; + } + if (this.base_fee != null) { + data.base_fee = this.base_fee; + } + if (this.location != null) { + data.location = this.location.toObject(); + } + if (this.time != null) { + data.time = this.time; + } + if (this.extra != null) { + data.extra = this.extra; + } + if (this.mix_hash != null) { + data.mix_hash = this.mix_hash.toObject(); + } + if (this.nonce != null) { + data.nonce = this.nonce; + } + if (this.utxo_root != null) { + data.utxo_root = this.utxo_root.toObject(); + } + if (this.etx_set_hash != null) { + data.etx_set_hash = this.etx_set_hash.toObject(); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.parent_hash.length) + writer.writeRepeatedMessage(1, this.parent_hash, (item: dependency_1.common.ProtoHash) => item.serialize(writer)); + if (this.has_uncle_hash) + writer.writeMessage(2, this.uncle_hash, () => this.uncle_hash.serialize(writer)); + if (this.has_coinbase) + writer.writeBytes(3, this.coinbase); + if (this.has_evm_root) + writer.writeMessage(4, this.evm_root, () => this.evm_root.serialize(writer)); + if (this.has_tx_hash) + writer.writeMessage(5, this.tx_hash, () => this.tx_hash.serialize(writer)); + if (this.has_etx_hash) + writer.writeMessage(6, this.etx_hash, () => this.etx_hash.serialize(writer)); + if (this.has_etx_rollup_hash) + writer.writeMessage(7, this.etx_rollup_hash, () => this.etx_rollup_hash.serialize(writer)); + if (this.manifest_hash.length) + writer.writeRepeatedMessage(8, this.manifest_hash, (item: dependency_1.common.ProtoHash) => item.serialize(writer)); + if (this.has_receipt_hash) + writer.writeMessage(9, this.receipt_hash, () => this.receipt_hash.serialize(writer)); + if (this.has_difficulty) + writer.writeBytes(10, this.difficulty); + if (this.parent_entropy.length) + writer.writeRepeatedBytes(11, this.parent_entropy); + if (this.parent_delta_s.length) + writer.writeRepeatedBytes(12, this.parent_delta_s); + if (this.number.length) + writer.writeRepeatedBytes(13, this.number); + if (this.has_gas_limit) + writer.writeUint64(14, this.gas_limit); + if (this.has_gas_used) + writer.writeUint64(15, this.gas_used); + if (this.has_base_fee) + writer.writeBytes(16, this.base_fee); + if (this.has_location) + writer.writeMessage(17, this.location, () => this.location.serialize(writer)); + if (this.has_time) + writer.writeUint64(18, this.time); + if (this.has_extra) + writer.writeBytes(19, this.extra); + if (this.has_mix_hash) + writer.writeMessage(20, this.mix_hash, () => this.mix_hash.serialize(writer)); + if (this.has_nonce) + writer.writeUint64(21, this.nonce); + if (this.has_utxo_root) + writer.writeMessage(22, this.utxo_root, () => this.utxo_root.serialize(writer)); + if (this.has_etx_set_hash) + writer.writeMessage(23, this.etx_set_hash, () => this.etx_set_hash.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoHeader { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoHeader(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.parent_hash, () => pb_1.Message.addToRepeatedWrapperField(message, 1, dependency_1.common.ProtoHash.deserialize(reader), dependency_1.common.ProtoHash)); + break; + case 2: + reader.readMessage(message.uncle_hash, () => message.uncle_hash = dependency_1.common.ProtoHash.deserialize(reader)); + break; + case 3: + message.coinbase = reader.readBytes(); + break; + case 4: + reader.readMessage(message.evm_root, () => message.evm_root = dependency_1.common.ProtoHash.deserialize(reader)); + break; + case 5: + reader.readMessage(message.tx_hash, () => message.tx_hash = dependency_1.common.ProtoHash.deserialize(reader)); + break; + case 6: + reader.readMessage(message.etx_hash, () => message.etx_hash = dependency_1.common.ProtoHash.deserialize(reader)); + break; + case 7: + reader.readMessage(message.etx_rollup_hash, () => message.etx_rollup_hash = dependency_1.common.ProtoHash.deserialize(reader)); + break; + case 8: + reader.readMessage(message.manifest_hash, () => pb_1.Message.addToRepeatedWrapperField(message, 8, dependency_1.common.ProtoHash.deserialize(reader), dependency_1.common.ProtoHash)); + break; + case 9: + reader.readMessage(message.receipt_hash, () => message.receipt_hash = dependency_1.common.ProtoHash.deserialize(reader)); + break; + case 10: + message.difficulty = reader.readBytes(); + break; + case 11: + pb_1.Message.addToRepeatedField(message, 11, reader.readBytes()); + break; + case 12: + pb_1.Message.addToRepeatedField(message, 12, reader.readBytes()); + break; + case 13: + pb_1.Message.addToRepeatedField(message, 13, reader.readBytes()); + break; + case 14: + message.gas_limit = reader.readUint64(); + break; + case 15: + message.gas_used = reader.readUint64(); + break; + case 16: + message.base_fee = reader.readBytes(); + break; + case 17: + reader.readMessage(message.location, () => message.location = dependency_1.common.ProtoLocation.deserialize(reader)); + break; + case 18: + message.time = reader.readUint64(); + break; + case 19: + message.extra = reader.readBytes(); + break; + case 20: + reader.readMessage(message.mix_hash, () => message.mix_hash = dependency_1.common.ProtoHash.deserialize(reader)); + break; + case 21: + message.nonce = reader.readUint64(); + break; + case 22: + reader.readMessage(message.utxo_root, () => message.utxo_root = dependency_1.common.ProtoHash.deserialize(reader)); + break; + case 23: + reader.readMessage(message.etx_set_hash, () => message.etx_set_hash = dependency_1.common.ProtoHash.deserialize(reader)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoHeader { + return ProtoHeader.deserialize(bytes); + } + } + export class ProtoTransaction extends pb_1.Message { + #one_of_decls: number[][] = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19]]; + constructor(data?: any[] | ({} & (({ + type?: number; + }) | ({ + to?: Uint8Array; + }) | ({ + nonce?: number; + }) | ({ + value?: Uint8Array; + }) | ({ + gas?: number; + }) | ({ + data?: Uint8Array; + }) | ({ + chain_id?: Uint8Array; + }) | ({ + gas_fee_cap?: Uint8Array; + }) | ({ + gas_tip_cap?: Uint8Array; + }) | ({ + access_list?: ProtoAccessList; + }) | ({ + v?: Uint8Array; + }) | ({ + r?: Uint8Array; + }) | ({ + s?: Uint8Array; + }) | ({ + originating_tx_hash?: dependency_1.common.ProtoHash; + }) | ({ + etx_index?: number; + }) | ({ + tx_ins?: ProtoTxIns; + }) | ({ + tx_outs?: ProtoTxOuts; + }) | ({ + signature?: Uint8Array; + }) | ({ + etx_sender?: Uint8Array; + })))) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("type" in data && data.type != undefined) { + this.type = data.type; + } + if ("to" in data && data.to != undefined) { + this.to = data.to; + } + if ("nonce" in data && data.nonce != undefined) { + this.nonce = data.nonce; + } + if ("value" in data && data.value != undefined) { + this.value = data.value; + } + if ("gas" in data && data.gas != undefined) { + this.gas = data.gas; + } + if ("data" in data && data.data != undefined) { + this.data = data.data; + } + if ("chain_id" in data && data.chain_id != undefined) { + this.chain_id = data.chain_id; + } + if ("gas_fee_cap" in data && data.gas_fee_cap != undefined) { + this.gas_fee_cap = data.gas_fee_cap; + } + if ("gas_tip_cap" in data && data.gas_tip_cap != undefined) { + this.gas_tip_cap = data.gas_tip_cap; + } + if ("access_list" in data && data.access_list != undefined) { + this.access_list = data.access_list; + } + if ("v" in data && data.v != undefined) { + this.v = data.v; + } + if ("r" in data && data.r != undefined) { + this.r = data.r; + } + if ("s" in data && data.s != undefined) { + this.s = data.s; + } + if ("originating_tx_hash" in data && data.originating_tx_hash != undefined) { + this.originating_tx_hash = data.originating_tx_hash; + } + if ("etx_index" in data && data.etx_index != undefined) { + this.etx_index = data.etx_index; + } + if ("tx_ins" in data && data.tx_ins != undefined) { + this.tx_ins = data.tx_ins; + } + if ("tx_outs" in data && data.tx_outs != undefined) { + this.tx_outs = data.tx_outs; + } + if ("signature" in data && data.signature != undefined) { + this.signature = data.signature; + } + if ("etx_sender" in data && data.etx_sender != undefined) { + this.etx_sender = data.etx_sender; + } + } + } + get type() { + return pb_1.Message.getFieldWithDefault(this, 1, 0) as number; + } + set type(value: number) { + pb_1.Message.setOneofField(this, 1, this.#one_of_decls[0], value); + } + get has_type() { + return pb_1.Message.getField(this, 1) != null; + } + get to() { + return pb_1.Message.getFieldWithDefault(this, 2, new Uint8Array(0)) as Uint8Array; + } + set to(value: Uint8Array) { + pb_1.Message.setOneofField(this, 2, this.#one_of_decls[1], value); + } + get has_to() { + return pb_1.Message.getField(this, 2) != null; + } + get nonce() { + return pb_1.Message.getFieldWithDefault(this, 3, 0) as number; + } + set nonce(value: number) { + pb_1.Message.setOneofField(this, 3, this.#one_of_decls[2], value); + } + get has_nonce() { + return pb_1.Message.getField(this, 3) != null; + } + get value() { + return pb_1.Message.getFieldWithDefault(this, 4, new Uint8Array(0)) as Uint8Array; + } + set value(value: Uint8Array) { + pb_1.Message.setOneofField(this, 4, this.#one_of_decls[3], value); + } + get has_value() { + return pb_1.Message.getField(this, 4) != null; + } + get gas() { + return pb_1.Message.getFieldWithDefault(this, 5, 0) as number; + } + set gas(value: number) { + pb_1.Message.setOneofField(this, 5, this.#one_of_decls[4], value); + } + get has_gas() { + return pb_1.Message.getField(this, 5) != null; + } + get data() { + return pb_1.Message.getFieldWithDefault(this, 6, new Uint8Array(0)) as Uint8Array; + } + set data(value: Uint8Array) { + pb_1.Message.setOneofField(this, 6, this.#one_of_decls[5], value); + } + get has_data() { + return pb_1.Message.getField(this, 6) != null; + } + get chain_id() { + return pb_1.Message.getFieldWithDefault(this, 7, new Uint8Array(0)) as Uint8Array; + } + set chain_id(value: Uint8Array) { + pb_1.Message.setOneofField(this, 7, this.#one_of_decls[6], value); + } + get has_chain_id() { + return pb_1.Message.getField(this, 7) != null; + } + get gas_fee_cap() { + return pb_1.Message.getFieldWithDefault(this, 8, new Uint8Array(0)) as Uint8Array; + } + set gas_fee_cap(value: Uint8Array) { + pb_1.Message.setOneofField(this, 8, this.#one_of_decls[7], value); + } + get has_gas_fee_cap() { + return pb_1.Message.getField(this, 8) != null; + } + get gas_tip_cap() { + return pb_1.Message.getFieldWithDefault(this, 9, new Uint8Array(0)) as Uint8Array; + } + set gas_tip_cap(value: Uint8Array) { + pb_1.Message.setOneofField(this, 9, this.#one_of_decls[8], value); + } + get has_gas_tip_cap() { + return pb_1.Message.getField(this, 9) != null; + } + get access_list() { + return pb_1.Message.getWrapperField(this, ProtoAccessList, 10) as ProtoAccessList; + } + set access_list(value: ProtoAccessList) { + pb_1.Message.setOneofWrapperField(this, 10, this.#one_of_decls[9], value); + } + get has_access_list() { + return pb_1.Message.getField(this, 10) != null; + } + get v() { + return pb_1.Message.getFieldWithDefault(this, 11, new Uint8Array(0)) as Uint8Array; + } + set v(value: Uint8Array) { + pb_1.Message.setOneofField(this, 11, this.#one_of_decls[10], value); + } + get has_v() { + return pb_1.Message.getField(this, 11) != null; + } + get r() { + return pb_1.Message.getFieldWithDefault(this, 12, new Uint8Array(0)) as Uint8Array; + } + set r(value: Uint8Array) { + pb_1.Message.setOneofField(this, 12, this.#one_of_decls[11], value); + } + get has_r() { + return pb_1.Message.getField(this, 12) != null; + } + get s() { + return pb_1.Message.getFieldWithDefault(this, 13, new Uint8Array(0)) as Uint8Array; + } + set s(value: Uint8Array) { + pb_1.Message.setOneofField(this, 13, this.#one_of_decls[12], value); + } + get has_s() { + return pb_1.Message.getField(this, 13) != null; + } + get originating_tx_hash() { + return pb_1.Message.getWrapperField(this, dependency_1.common.ProtoHash, 14) as dependency_1.common.ProtoHash; + } + set originating_tx_hash(value: dependency_1.common.ProtoHash) { + pb_1.Message.setOneofWrapperField(this, 14, this.#one_of_decls[13], value); + } + get has_originating_tx_hash() { + return pb_1.Message.getField(this, 14) != null; + } + get etx_index() { + return pb_1.Message.getFieldWithDefault(this, 15, 0) as number; + } + set etx_index(value: number) { + pb_1.Message.setOneofField(this, 15, this.#one_of_decls[14], value); + } + get has_etx_index() { + return pb_1.Message.getField(this, 15) != null; + } + get tx_ins() { + return pb_1.Message.getWrapperField(this, ProtoTxIns, 16) as ProtoTxIns; + } + set tx_ins(value: ProtoTxIns) { + pb_1.Message.setOneofWrapperField(this, 16, this.#one_of_decls[15], value); + } + get has_tx_ins() { + return pb_1.Message.getField(this, 16) != null; + } + get tx_outs() { + return pb_1.Message.getWrapperField(this, ProtoTxOuts, 17) as ProtoTxOuts; + } + set tx_outs(value: ProtoTxOuts) { + pb_1.Message.setOneofWrapperField(this, 17, this.#one_of_decls[16], value); + } + get has_tx_outs() { + return pb_1.Message.getField(this, 17) != null; + } + get signature() { + return pb_1.Message.getFieldWithDefault(this, 18, new Uint8Array(0)) as Uint8Array; + } + set signature(value: Uint8Array) { + pb_1.Message.setOneofField(this, 18, this.#one_of_decls[17], value); + } + get has_signature() { + return pb_1.Message.getField(this, 18) != null; + } + get etx_sender() { + return pb_1.Message.getFieldWithDefault(this, 19, new Uint8Array(0)) as Uint8Array; + } + set etx_sender(value: Uint8Array) { + pb_1.Message.setOneofField(this, 19, this.#one_of_decls[18], value); + } + get has_etx_sender() { + return pb_1.Message.getField(this, 19) != null; + } + get _type() { + const cases: { + [index: number]: "none" | "type"; + } = { + 0: "none", + 1: "type" + }; + return cases[pb_1.Message.computeOneofCase(this, [1])]; + } + get _to() { + const cases: { + [index: number]: "none" | "to"; + } = { + 0: "none", + 2: "to" + }; + return cases[pb_1.Message.computeOneofCase(this, [2])]; + } + get _nonce() { + const cases: { + [index: number]: "none" | "nonce"; + } = { + 0: "none", + 3: "nonce" + }; + return cases[pb_1.Message.computeOneofCase(this, [3])]; + } + get _value() { + const cases: { + [index: number]: "none" | "value"; + } = { + 0: "none", + 4: "value" + }; + return cases[pb_1.Message.computeOneofCase(this, [4])]; + } + get _gas() { + const cases: { + [index: number]: "none" | "gas"; + } = { + 0: "none", + 5: "gas" + }; + return cases[pb_1.Message.computeOneofCase(this, [5])]; + } + get _data() { + const cases: { + [index: number]: "none" | "data"; + } = { + 0: "none", + 6: "data" + }; + return cases[pb_1.Message.computeOneofCase(this, [6])]; + } + get _chain_id() { + const cases: { + [index: number]: "none" | "chain_id"; + } = { + 0: "none", + 7: "chain_id" + }; + return cases[pb_1.Message.computeOneofCase(this, [7])]; + } + get _gas_fee_cap() { + const cases: { + [index: number]: "none" | "gas_fee_cap"; + } = { + 0: "none", + 8: "gas_fee_cap" + }; + return cases[pb_1.Message.computeOneofCase(this, [8])]; + } + get _gas_tip_cap() { + const cases: { + [index: number]: "none" | "gas_tip_cap"; + } = { + 0: "none", + 9: "gas_tip_cap" + }; + return cases[pb_1.Message.computeOneofCase(this, [9])]; + } + get _access_list() { + const cases: { + [index: number]: "none" | "access_list"; + } = { + 0: "none", + 10: "access_list" + }; + return cases[pb_1.Message.computeOneofCase(this, [10])]; + } + get _v() { + const cases: { + [index: number]: "none" | "v"; + } = { + 0: "none", + 11: "v" + }; + return cases[pb_1.Message.computeOneofCase(this, [11])]; + } + get _r() { + const cases: { + [index: number]: "none" | "r"; + } = { + 0: "none", + 12: "r" + }; + return cases[pb_1.Message.computeOneofCase(this, [12])]; + } + get _s() { + const cases: { + [index: number]: "none" | "s"; + } = { + 0: "none", + 13: "s" + }; + return cases[pb_1.Message.computeOneofCase(this, [13])]; + } + get _originating_tx_hash() { + const cases: { + [index: number]: "none" | "originating_tx_hash"; + } = { + 0: "none", + 14: "originating_tx_hash" + }; + return cases[pb_1.Message.computeOneofCase(this, [14])]; + } + get _etx_index() { + const cases: { + [index: number]: "none" | "etx_index"; + } = { + 0: "none", + 15: "etx_index" + }; + return cases[pb_1.Message.computeOneofCase(this, [15])]; + } + get _tx_ins() { + const cases: { + [index: number]: "none" | "tx_ins"; + } = { + 0: "none", + 16: "tx_ins" + }; + return cases[pb_1.Message.computeOneofCase(this, [16])]; + } + get _tx_outs() { + const cases: { + [index: number]: "none" | "tx_outs"; + } = { + 0: "none", + 17: "tx_outs" + }; + return cases[pb_1.Message.computeOneofCase(this, [17])]; + } + get _signature() { + const cases: { + [index: number]: "none" | "signature"; + } = { + 0: "none", + 18: "signature" + }; + return cases[pb_1.Message.computeOneofCase(this, [18])]; + } + get _etx_sender() { + const cases: { + [index: number]: "none" | "etx_sender"; + } = { + 0: "none", + 19: "etx_sender" + }; + return cases[pb_1.Message.computeOneofCase(this, [19])]; + } + static fromObject(data: { + type?: number; + to?: Uint8Array; + nonce?: number; + value?: Uint8Array; + gas?: number; + data?: Uint8Array; + chain_id?: Uint8Array; + gas_fee_cap?: Uint8Array; + gas_tip_cap?: Uint8Array; + access_list?: ReturnType; + v?: Uint8Array; + r?: Uint8Array; + s?: Uint8Array; + originating_tx_hash?: ReturnType; + etx_index?: number; + tx_ins?: ReturnType; + tx_outs?: ReturnType; + signature?: Uint8Array; + etx_sender?: Uint8Array; + }): ProtoTransaction { + const message = new ProtoTransaction({}); + if (data.type != null) { + message.type = data.type; + } + if (data.to != null) { + message.to = data.to; + } + if (data.nonce != null) { + message.nonce = data.nonce; + } + if (data.value != null) { + message.value = data.value; + } + if (data.gas != null) { + message.gas = data.gas; + } + if (data.data != null) { + message.data = data.data; + } + if (data.chain_id != null) { + message.chain_id = data.chain_id; + } + if (data.gas_fee_cap != null) { + message.gas_fee_cap = data.gas_fee_cap; + } + if (data.gas_tip_cap != null) { + message.gas_tip_cap = data.gas_tip_cap; + } + if (data.access_list != null) { + message.access_list = ProtoAccessList.fromObject(data.access_list); + } + if (data.v != null) { + message.v = data.v; + } + if (data.r != null) { + message.r = data.r; + } + if (data.s != null) { + message.s = data.s; + } + if (data.originating_tx_hash != null) { + message.originating_tx_hash = dependency_1.common.ProtoHash.fromObject(data.originating_tx_hash); + } + if (data.etx_index != null) { + message.etx_index = data.etx_index; + } + if (data.tx_ins != null) { + message.tx_ins = ProtoTxIns.fromObject(data.tx_ins); + } + if (data.tx_outs != null) { + message.tx_outs = ProtoTxOuts.fromObject(data.tx_outs); + } + if (data.signature != null) { + message.signature = data.signature; + } + if (data.etx_sender != null) { + message.etx_sender = data.etx_sender; + } + return message; + } + toObject() { + const data: { + type?: number; + to?: Uint8Array; + nonce?: number; + value?: Uint8Array; + gas?: number; + data?: Uint8Array; + chain_id?: Uint8Array; + gas_fee_cap?: Uint8Array; + gas_tip_cap?: Uint8Array; + access_list?: ReturnType; + v?: Uint8Array; + r?: Uint8Array; + s?: Uint8Array; + originating_tx_hash?: ReturnType; + etx_index?: number; + tx_ins?: ReturnType; + tx_outs?: ReturnType; + signature?: Uint8Array; + etx_sender?: Uint8Array; + } = {}; + if (this.type != null) { + data.type = this.type; + } + if (this.to != null) { + data.to = this.to; + } + if (this.nonce != null) { + data.nonce = this.nonce; + } + if (this.value != null) { + data.value = this.value; + } + if (this.gas != null) { + data.gas = this.gas; + } + if (this.data != null) { + data.data = this.data; + } + if (this.chain_id != null) { + data.chain_id = this.chain_id; + } + if (this.gas_fee_cap != null) { + data.gas_fee_cap = this.gas_fee_cap; + } + if (this.gas_tip_cap != null) { + data.gas_tip_cap = this.gas_tip_cap; + } + if (this.access_list != null) { + data.access_list = this.access_list.toObject(); + } + if (this.v != null) { + data.v = this.v; + } + if (this.r != null) { + data.r = this.r; + } + if (this.s != null) { + data.s = this.s; + } + if (this.originating_tx_hash != null) { + data.originating_tx_hash = this.originating_tx_hash.toObject(); + } + if (this.etx_index != null) { + data.etx_index = this.etx_index; + } + if (this.tx_ins != null) { + data.tx_ins = this.tx_ins.toObject(); + } + if (this.tx_outs != null) { + data.tx_outs = this.tx_outs.toObject(); + } + if (this.signature != null) { + data.signature = this.signature; + } + if (this.etx_sender != null) { + data.etx_sender = this.etx_sender; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.has_type) + writer.writeUint64(1, this.type); + if (this.has_to) + writer.writeBytes(2, this.to); + if (this.has_nonce) + writer.writeUint64(3, this.nonce); + if (this.has_value) + writer.writeBytes(4, this.value); + if (this.has_gas) + writer.writeUint64(5, this.gas); + if (this.has_data) + writer.writeBytes(6, this.data); + if (this.has_chain_id) + writer.writeBytes(7, this.chain_id); + if (this.has_gas_fee_cap) + writer.writeBytes(8, this.gas_fee_cap); + if (this.has_gas_tip_cap) + writer.writeBytes(9, this.gas_tip_cap); + if (this.has_access_list) + writer.writeMessage(10, this.access_list, () => this.access_list.serialize(writer)); + if (this.has_v) + writer.writeBytes(11, this.v); + if (this.has_r) + writer.writeBytes(12, this.r); + if (this.has_s) + writer.writeBytes(13, this.s); + if (this.has_originating_tx_hash) + writer.writeMessage(14, this.originating_tx_hash, () => this.originating_tx_hash.serialize(writer)); + if (this.has_etx_index) + writer.writeUint32(15, this.etx_index); + if (this.has_tx_ins) + writer.writeMessage(16, this.tx_ins, () => this.tx_ins.serialize(writer)); + if (this.has_tx_outs) + writer.writeMessage(17, this.tx_outs, () => this.tx_outs.serialize(writer)); + if (this.has_signature) + writer.writeBytes(18, this.signature); + if (this.has_etx_sender) + writer.writeBytes(19, this.etx_sender); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoTransaction { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoTransaction(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.type = reader.readUint64(); + break; + case 2: + message.to = reader.readBytes(); + break; + case 3: + message.nonce = reader.readUint64(); + break; + case 4: + message.value = reader.readBytes(); + break; + case 5: + message.gas = reader.readUint64(); + break; + case 6: + message.data = reader.readBytes(); + break; + case 7: + message.chain_id = reader.readBytes(); + break; + case 8: + message.gas_fee_cap = reader.readBytes(); + break; + case 9: + message.gas_tip_cap = reader.readBytes(); + break; + case 10: + reader.readMessage(message.access_list, () => message.access_list = ProtoAccessList.deserialize(reader)); + break; + case 11: + message.v = reader.readBytes(); + break; + case 12: + message.r = reader.readBytes(); + break; + case 13: + message.s = reader.readBytes(); + break; + case 14: + reader.readMessage(message.originating_tx_hash, () => message.originating_tx_hash = dependency_1.common.ProtoHash.deserialize(reader)); + break; + case 15: + message.etx_index = reader.readUint32(); + break; + case 16: + reader.readMessage(message.tx_ins, () => message.tx_ins = ProtoTxIns.deserialize(reader)); + break; + case 17: + reader.readMessage(message.tx_outs, () => message.tx_outs = ProtoTxOuts.deserialize(reader)); + break; + case 18: + message.signature = reader.readBytes(); + break; + case 19: + message.etx_sender = reader.readBytes(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoTransaction { + return ProtoTransaction.deserialize(bytes); + } + } + export class ProtoTransactions extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + transactions?: ProtoTransaction[]; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("transactions" in data && data.transactions != undefined) { + this.transactions = data.transactions; + } + } + } + get transactions() { + return pb_1.Message.getRepeatedWrapperField(this, ProtoTransaction, 1) as ProtoTransaction[]; + } + set transactions(value: ProtoTransaction[]) { + pb_1.Message.setRepeatedWrapperField(this, 1, value); + } + static fromObject(data: { + transactions?: ReturnType[]; + }): ProtoTransactions { + const message = new ProtoTransactions({}); + if (data.transactions != null) { + message.transactions = data.transactions.map(item => ProtoTransaction.fromObject(item)); + } + return message; + } + toObject() { + const data: { + transactions?: ReturnType[]; + } = {}; + if (this.transactions != null) { + data.transactions = this.transactions.map((item: ProtoTransaction) => item.toObject()); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.transactions.length) + writer.writeRepeatedMessage(1, this.transactions, (item: ProtoTransaction) => item.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoTransactions { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoTransactions(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.transactions, () => pb_1.Message.addToRepeatedWrapperField(message, 1, ProtoTransaction.deserialize(reader), ProtoTransaction)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoTransactions { + return ProtoTransactions.deserialize(bytes); + } + } + export class ProtoHeaders extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + headers?: ProtoHeader[]; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("headers" in data && data.headers != undefined) { + this.headers = data.headers; + } + } + } + get headers() { + return pb_1.Message.getRepeatedWrapperField(this, ProtoHeader, 1) as ProtoHeader[]; + } + set headers(value: ProtoHeader[]) { + pb_1.Message.setRepeatedWrapperField(this, 1, value); + } + static fromObject(data: { + headers?: ReturnType[]; + }): ProtoHeaders { + const message = new ProtoHeaders({}); + if (data.headers != null) { + message.headers = data.headers.map(item => ProtoHeader.fromObject(item)); + } + return message; + } + toObject() { + const data: { + headers?: ReturnType[]; + } = {}; + if (this.headers != null) { + data.headers = this.headers.map((item: ProtoHeader) => item.toObject()); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.headers.length) + writer.writeRepeatedMessage(1, this.headers, (item: ProtoHeader) => item.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoHeaders { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoHeaders(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.headers, () => pb_1.Message.addToRepeatedWrapperField(message, 1, ProtoHeader.deserialize(reader), ProtoHeader)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoHeaders { + return ProtoHeaders.deserialize(bytes); + } + } + export class ProtoManifest extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + manifest?: dependency_1.common.ProtoHash[]; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("manifest" in data && data.manifest != undefined) { + this.manifest = data.manifest; + } + } + } + get manifest() { + return pb_1.Message.getRepeatedWrapperField(this, dependency_1.common.ProtoHash, 1) as dependency_1.common.ProtoHash[]; + } + set manifest(value: dependency_1.common.ProtoHash[]) { + pb_1.Message.setRepeatedWrapperField(this, 1, value); + } + static fromObject(data: { + manifest?: ReturnType[]; + }): ProtoManifest { + const message = new ProtoManifest({}); + if (data.manifest != null) { + message.manifest = data.manifest.map(item => dependency_1.common.ProtoHash.fromObject(item)); + } + return message; + } + toObject() { + const data: { + manifest?: ReturnType[]; + } = {}; + if (this.manifest != null) { + data.manifest = this.manifest.map((item: dependency_1.common.ProtoHash) => item.toObject()); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.manifest.length) + writer.writeRepeatedMessage(1, this.manifest, (item: dependency_1.common.ProtoHash) => item.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoManifest { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoManifest(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.manifest, () => pb_1.Message.addToRepeatedWrapperField(message, 1, dependency_1.common.ProtoHash.deserialize(reader), dependency_1.common.ProtoHash)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoManifest { + return ProtoManifest.deserialize(bytes); + } + } + export class ProtoAccessList extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + access_tuples?: ProtoAccessTuple[]; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("access_tuples" in data && data.access_tuples != undefined) { + this.access_tuples = data.access_tuples; + } + } + } + get access_tuples() { + return pb_1.Message.getRepeatedWrapperField(this, ProtoAccessTuple, 1) as ProtoAccessTuple[]; + } + set access_tuples(value: ProtoAccessTuple[]) { + pb_1.Message.setRepeatedWrapperField(this, 1, value); + } + static fromObject(data: { + access_tuples?: ReturnType[]; + }): ProtoAccessList { + const message = new ProtoAccessList({}); + if (data.access_tuples != null) { + message.access_tuples = data.access_tuples.map(item => ProtoAccessTuple.fromObject(item)); + } + return message; + } + toObject() { + const data: { + access_tuples?: ReturnType[]; + } = {}; + if (this.access_tuples != null) { + data.access_tuples = this.access_tuples.map((item: ProtoAccessTuple) => item.toObject()); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.access_tuples.length) + writer.writeRepeatedMessage(1, this.access_tuples, (item: ProtoAccessTuple) => item.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoAccessList { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoAccessList(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.access_tuples, () => pb_1.Message.addToRepeatedWrapperField(message, 1, ProtoAccessTuple.deserialize(reader), ProtoAccessTuple)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoAccessList { + return ProtoAccessList.deserialize(bytes); + } + } + export class ProtoAccessTuple extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + address?: Uint8Array; + storage_key?: dependency_1.common.ProtoHash[]; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("address" in data && data.address != undefined) { + this.address = data.address; + } + if ("storage_key" in data && data.storage_key != undefined) { + this.storage_key = data.storage_key; + } + } + } + get address() { + return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array(0)) as Uint8Array; + } + set address(value: Uint8Array) { + pb_1.Message.setField(this, 1, value); + } + get storage_key() { + return pb_1.Message.getRepeatedWrapperField(this, dependency_1.common.ProtoHash, 2) as dependency_1.common.ProtoHash[]; + } + set storage_key(value: dependency_1.common.ProtoHash[]) { + pb_1.Message.setRepeatedWrapperField(this, 2, value); + } + static fromObject(data: { + address?: Uint8Array; + storage_key?: ReturnType[]; + }): ProtoAccessTuple { + const message = new ProtoAccessTuple({}); + if (data.address != null) { + message.address = data.address; + } + if (data.storage_key != null) { + message.storage_key = data.storage_key.map(item => dependency_1.common.ProtoHash.fromObject(item)); + } + return message; + } + toObject() { + const data: { + address?: Uint8Array; + storage_key?: ReturnType[]; + } = {}; + if (this.address != null) { + data.address = this.address; + } + if (this.storage_key != null) { + data.storage_key = this.storage_key.map((item: dependency_1.common.ProtoHash) => item.toObject()); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.address.length) + writer.writeBytes(1, this.address); + if (this.storage_key.length) + writer.writeRepeatedMessage(2, this.storage_key, (item: dependency_1.common.ProtoHash) => item.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoAccessTuple { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoAccessTuple(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.address = reader.readBytes(); + break; + case 2: + reader.readMessage(message.storage_key, () => pb_1.Message.addToRepeatedWrapperField(message, 2, dependency_1.common.ProtoHash.deserialize(reader), dependency_1.common.ProtoHash)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoAccessTuple { + return ProtoAccessTuple.deserialize(bytes); + } + } + export class ProtoReceiptForStorage extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + post_state_or_status?: Uint8Array; + cumulative_gas_used?: number; + tx_hash?: dependency_1.common.ProtoHash; + contract_address?: dependency_1.common.ProtoAddress; + logs?: ProtoLogsForStorage; + etxs?: ProtoTransactions; + gas_used?: number; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("post_state_or_status" in data && data.post_state_or_status != undefined) { + this.post_state_or_status = data.post_state_or_status; + } + if ("cumulative_gas_used" in data && data.cumulative_gas_used != undefined) { + this.cumulative_gas_used = data.cumulative_gas_used; + } + if ("tx_hash" in data && data.tx_hash != undefined) { + this.tx_hash = data.tx_hash; + } + if ("contract_address" in data && data.contract_address != undefined) { + this.contract_address = data.contract_address; + } + if ("logs" in data && data.logs != undefined) { + this.logs = data.logs; + } + if ("etxs" in data && data.etxs != undefined) { + this.etxs = data.etxs; + } + if ("gas_used" in data && data.gas_used != undefined) { + this.gas_used = data.gas_used; + } + } + } + get post_state_or_status() { + return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array(0)) as Uint8Array; + } + set post_state_or_status(value: Uint8Array) { + pb_1.Message.setField(this, 1, value); + } + get cumulative_gas_used() { + return pb_1.Message.getFieldWithDefault(this, 2, 0) as number; + } + set cumulative_gas_used(value: number) { + pb_1.Message.setField(this, 2, value); + } + get tx_hash() { + return pb_1.Message.getWrapperField(this, dependency_1.common.ProtoHash, 3) as dependency_1.common.ProtoHash; + } + set tx_hash(value: dependency_1.common.ProtoHash) { + pb_1.Message.setWrapperField(this, 3, value); + } + get has_tx_hash() { + return pb_1.Message.getField(this, 3) != null; + } + get contract_address() { + return pb_1.Message.getWrapperField(this, dependency_1.common.ProtoAddress, 4) as dependency_1.common.ProtoAddress; + } + set contract_address(value: dependency_1.common.ProtoAddress) { + pb_1.Message.setWrapperField(this, 4, value); + } + get has_contract_address() { + return pb_1.Message.getField(this, 4) != null; + } + get logs() { + return pb_1.Message.getWrapperField(this, ProtoLogsForStorage, 5) as ProtoLogsForStorage; + } + set logs(value: ProtoLogsForStorage) { + pb_1.Message.setWrapperField(this, 5, value); + } + get has_logs() { + return pb_1.Message.getField(this, 5) != null; + } + get etxs() { + return pb_1.Message.getWrapperField(this, ProtoTransactions, 6) as ProtoTransactions; + } + set etxs(value: ProtoTransactions) { + pb_1.Message.setWrapperField(this, 6, value); + } + get has_etxs() { + return pb_1.Message.getField(this, 6) != null; + } + get gas_used() { + return pb_1.Message.getFieldWithDefault(this, 7, 0) as number; + } + set gas_used(value: number) { + pb_1.Message.setField(this, 7, value); + } + static fromObject(data: { + post_state_or_status?: Uint8Array; + cumulative_gas_used?: number; + tx_hash?: ReturnType; + contract_address?: ReturnType; + logs?: ReturnType; + etxs?: ReturnType; + gas_used?: number; + }): ProtoReceiptForStorage { + const message = new ProtoReceiptForStorage({}); + if (data.post_state_or_status != null) { + message.post_state_or_status = data.post_state_or_status; + } + if (data.cumulative_gas_used != null) { + message.cumulative_gas_used = data.cumulative_gas_used; + } + if (data.tx_hash != null) { + message.tx_hash = dependency_1.common.ProtoHash.fromObject(data.tx_hash); + } + if (data.contract_address != null) { + message.contract_address = dependency_1.common.ProtoAddress.fromObject(data.contract_address); + } + if (data.logs != null) { + message.logs = ProtoLogsForStorage.fromObject(data.logs); + } + if (data.etxs != null) { + message.etxs = ProtoTransactions.fromObject(data.etxs); + } + if (data.gas_used != null) { + message.gas_used = data.gas_used; + } + return message; + } + toObject() { + const data: { + post_state_or_status?: Uint8Array; + cumulative_gas_used?: number; + tx_hash?: ReturnType; + contract_address?: ReturnType; + logs?: ReturnType; + etxs?: ReturnType; + gas_used?: number; + } = {}; + if (this.post_state_or_status != null) { + data.post_state_or_status = this.post_state_or_status; + } + if (this.cumulative_gas_used != null) { + data.cumulative_gas_used = this.cumulative_gas_used; + } + if (this.tx_hash != null) { + data.tx_hash = this.tx_hash.toObject(); + } + if (this.contract_address != null) { + data.contract_address = this.contract_address.toObject(); + } + if (this.logs != null) { + data.logs = this.logs.toObject(); + } + if (this.etxs != null) { + data.etxs = this.etxs.toObject(); + } + if (this.gas_used != null) { + data.gas_used = this.gas_used; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.post_state_or_status.length) + writer.writeBytes(1, this.post_state_or_status); + if (this.cumulative_gas_used != 0) + writer.writeUint64(2, this.cumulative_gas_used); + if (this.has_tx_hash) + writer.writeMessage(3, this.tx_hash, () => this.tx_hash.serialize(writer)); + if (this.has_contract_address) + writer.writeMessage(4, this.contract_address, () => this.contract_address.serialize(writer)); + if (this.has_logs) + writer.writeMessage(5, this.logs, () => this.logs.serialize(writer)); + if (this.has_etxs) + writer.writeMessage(6, this.etxs, () => this.etxs.serialize(writer)); + if (this.gas_used != 0) + writer.writeUint64(7, this.gas_used); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoReceiptForStorage { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoReceiptForStorage(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.post_state_or_status = reader.readBytes(); + break; + case 2: + message.cumulative_gas_used = reader.readUint64(); + break; + case 3: + reader.readMessage(message.tx_hash, () => message.tx_hash = dependency_1.common.ProtoHash.deserialize(reader)); + break; + case 4: + reader.readMessage(message.contract_address, () => message.contract_address = dependency_1.common.ProtoAddress.deserialize(reader)); + break; + case 5: + reader.readMessage(message.logs, () => message.logs = ProtoLogsForStorage.deserialize(reader)); + break; + case 6: + reader.readMessage(message.etxs, () => message.etxs = ProtoTransactions.deserialize(reader)); + break; + case 7: + message.gas_used = reader.readUint64(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoReceiptForStorage { + return ProtoReceiptForStorage.deserialize(bytes); + } + } + export class ProtoReceiptsForStorage extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + receipts?: ProtoReceiptForStorage[]; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("receipts" in data && data.receipts != undefined) { + this.receipts = data.receipts; + } + } + } + get receipts() { + return pb_1.Message.getRepeatedWrapperField(this, ProtoReceiptForStorage, 1) as ProtoReceiptForStorage[]; + } + set receipts(value: ProtoReceiptForStorage[]) { + pb_1.Message.setRepeatedWrapperField(this, 1, value); + } + static fromObject(data: { + receipts?: ReturnType[]; + }): ProtoReceiptsForStorage { + const message = new ProtoReceiptsForStorage({}); + if (data.receipts != null) { + message.receipts = data.receipts.map(item => ProtoReceiptForStorage.fromObject(item)); + } + return message; + } + toObject() { + const data: { + receipts?: ReturnType[]; + } = {}; + if (this.receipts != null) { + data.receipts = this.receipts.map((item: ProtoReceiptForStorage) => item.toObject()); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.receipts.length) + writer.writeRepeatedMessage(1, this.receipts, (item: ProtoReceiptForStorage) => item.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoReceiptsForStorage { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoReceiptsForStorage(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.receipts, () => pb_1.Message.addToRepeatedWrapperField(message, 1, ProtoReceiptForStorage.deserialize(reader), ProtoReceiptForStorage)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoReceiptsForStorage { + return ProtoReceiptsForStorage.deserialize(bytes); + } + } + export class ProtoLogForStorage extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + address?: dependency_1.common.ProtoAddress; + topics?: dependency_1.common.ProtoHash[]; + data?: Uint8Array; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("address" in data && data.address != undefined) { + this.address = data.address; + } + if ("topics" in data && data.topics != undefined) { + this.topics = data.topics; + } + if ("data" in data && data.data != undefined) { + this.data = data.data; + } + } + } + get address() { + return pb_1.Message.getWrapperField(this, dependency_1.common.ProtoAddress, 1) as dependency_1.common.ProtoAddress; + } + set address(value: dependency_1.common.ProtoAddress) { + pb_1.Message.setWrapperField(this, 1, value); + } + get has_address() { + return pb_1.Message.getField(this, 1) != null; + } + get topics() { + return pb_1.Message.getRepeatedWrapperField(this, dependency_1.common.ProtoHash, 2) as dependency_1.common.ProtoHash[]; + } + set topics(value: dependency_1.common.ProtoHash[]) { + pb_1.Message.setRepeatedWrapperField(this, 2, value); + } + get data() { + return pb_1.Message.getFieldWithDefault(this, 3, new Uint8Array(0)) as Uint8Array; + } + set data(value: Uint8Array) { + pb_1.Message.setField(this, 3, value); + } + static fromObject(data: { + address?: ReturnType; + topics?: ReturnType[]; + data?: Uint8Array; + }): ProtoLogForStorage { + const message = new ProtoLogForStorage({}); + if (data.address != null) { + message.address = dependency_1.common.ProtoAddress.fromObject(data.address); + } + if (data.topics != null) { + message.topics = data.topics.map(item => dependency_1.common.ProtoHash.fromObject(item)); + } + if (data.data != null) { + message.data = data.data; + } + return message; + } + toObject() { + const data: { + address?: ReturnType; + topics?: ReturnType[]; + data?: Uint8Array; + } = {}; + if (this.address != null) { + data.address = this.address.toObject(); + } + if (this.topics != null) { + data.topics = this.topics.map((item: dependency_1.common.ProtoHash) => item.toObject()); + } + if (this.data != null) { + data.data = this.data; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.has_address) + writer.writeMessage(1, this.address, () => this.address.serialize(writer)); + if (this.topics.length) + writer.writeRepeatedMessage(2, this.topics, (item: dependency_1.common.ProtoHash) => item.serialize(writer)); + if (this.data.length) + writer.writeBytes(3, this.data); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoLogForStorage { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoLogForStorage(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.address, () => message.address = dependency_1.common.ProtoAddress.deserialize(reader)); + break; + case 2: + reader.readMessage(message.topics, () => pb_1.Message.addToRepeatedWrapperField(message, 2, dependency_1.common.ProtoHash.deserialize(reader), dependency_1.common.ProtoHash)); + break; + case 3: + message.data = reader.readBytes(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoLogForStorage { + return ProtoLogForStorage.deserialize(bytes); + } + } + export class ProtoLogsForStorage extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + logs?: ProtoLogForStorage[]; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("logs" in data && data.logs != undefined) { + this.logs = data.logs; + } + } + } + get logs() { + return pb_1.Message.getRepeatedWrapperField(this, ProtoLogForStorage, 1) as ProtoLogForStorage[]; + } + set logs(value: ProtoLogForStorage[]) { + pb_1.Message.setRepeatedWrapperField(this, 1, value); + } + static fromObject(data: { + logs?: ReturnType[]; + }): ProtoLogsForStorage { + const message = new ProtoLogsForStorage({}); + if (data.logs != null) { + message.logs = data.logs.map(item => ProtoLogForStorage.fromObject(item)); + } + return message; + } + toObject() { + const data: { + logs?: ReturnType[]; + } = {}; + if (this.logs != null) { + data.logs = this.logs.map((item: ProtoLogForStorage) => item.toObject()); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.logs.length) + writer.writeRepeatedMessage(1, this.logs, (item: ProtoLogForStorage) => item.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoLogsForStorage { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoLogsForStorage(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.logs, () => pb_1.Message.addToRepeatedWrapperField(message, 1, ProtoLogForStorage.deserialize(reader), ProtoLogForStorage)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoLogsForStorage { + return ProtoLogsForStorage.deserialize(bytes); + } + } + export class ProtoPendingHeader extends pb_1.Message { + #one_of_decls: number[][] = [[1], [2]]; + constructor(data?: any[] | ({} & (({ + header?: ProtoHeader; + }) | ({ + termini?: ProtoTermini; + })))) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("header" in data && data.header != undefined) { + this.header = data.header; + } + if ("termini" in data && data.termini != undefined) { + this.termini = data.termini; + } + } + } + get header() { + return pb_1.Message.getWrapperField(this, ProtoHeader, 1) as ProtoHeader; + } + set header(value: ProtoHeader) { + pb_1.Message.setOneofWrapperField(this, 1, this.#one_of_decls[0], value); + } + get has_header() { + return pb_1.Message.getField(this, 1) != null; + } + get termini() { + return pb_1.Message.getWrapperField(this, ProtoTermini, 2) as ProtoTermini; + } + set termini(value: ProtoTermini) { + pb_1.Message.setOneofWrapperField(this, 2, this.#one_of_decls[1], value); + } + get has_termini() { + return pb_1.Message.getField(this, 2) != null; + } + get _header() { + const cases: { + [index: number]: "none" | "header"; + } = { + 0: "none", + 1: "header" + }; + return cases[pb_1.Message.computeOneofCase(this, [1])]; + } + get _termini() { + const cases: { + [index: number]: "none" | "termini"; + } = { + 0: "none", + 2: "termini" + }; + return cases[pb_1.Message.computeOneofCase(this, [2])]; + } + static fromObject(data: { + header?: ReturnType; + termini?: ReturnType; + }): ProtoPendingHeader { + const message = new ProtoPendingHeader({}); + if (data.header != null) { + message.header = ProtoHeader.fromObject(data.header); + } + if (data.termini != null) { + message.termini = ProtoTermini.fromObject(data.termini); + } + return message; + } + toObject() { + const data: { + header?: ReturnType; + termini?: ReturnType; + } = {}; + if (this.header != null) { + data.header = this.header.toObject(); + } + if (this.termini != null) { + data.termini = this.termini.toObject(); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.has_header) + writer.writeMessage(1, this.header, () => this.header.serialize(writer)); + if (this.has_termini) + writer.writeMessage(2, this.termini, () => this.termini.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoPendingHeader { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoPendingHeader(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.header, () => message.header = ProtoHeader.deserialize(reader)); + break; + case 2: + reader.readMessage(message.termini, () => message.termini = ProtoTermini.deserialize(reader)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoPendingHeader { + return ProtoPendingHeader.deserialize(bytes); + } + } + export class ProtoTermini extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + dom_termini?: dependency_1.common.ProtoHash[]; + sub_termini?: dependency_1.common.ProtoHash[]; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 2], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("dom_termini" in data && data.dom_termini != undefined) { + this.dom_termini = data.dom_termini; + } + if ("sub_termini" in data && data.sub_termini != undefined) { + this.sub_termini = data.sub_termini; + } + } + } + get dom_termini() { + return pb_1.Message.getRepeatedWrapperField(this, dependency_1.common.ProtoHash, 1) as dependency_1.common.ProtoHash[]; + } + set dom_termini(value: dependency_1.common.ProtoHash[]) { + pb_1.Message.setRepeatedWrapperField(this, 1, value); + } + get sub_termini() { + return pb_1.Message.getRepeatedWrapperField(this, dependency_1.common.ProtoHash, 2) as dependency_1.common.ProtoHash[]; + } + set sub_termini(value: dependency_1.common.ProtoHash[]) { + pb_1.Message.setRepeatedWrapperField(this, 2, value); + } + static fromObject(data: { + dom_termini?: ReturnType[]; + sub_termini?: ReturnType[]; + }): ProtoTermini { + const message = new ProtoTermini({}); + if (data.dom_termini != null) { + message.dom_termini = data.dom_termini.map(item => dependency_1.common.ProtoHash.fromObject(item)); + } + if (data.sub_termini != null) { + message.sub_termini = data.sub_termini.map(item => dependency_1.common.ProtoHash.fromObject(item)); + } + return message; + } + toObject() { + const data: { + dom_termini?: ReturnType[]; + sub_termini?: ReturnType[]; + } = {}; + if (this.dom_termini != null) { + data.dom_termini = this.dom_termini.map((item: dependency_1.common.ProtoHash) => item.toObject()); + } + if (this.sub_termini != null) { + data.sub_termini = this.sub_termini.map((item: dependency_1.common.ProtoHash) => item.toObject()); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.dom_termini.length) + writer.writeRepeatedMessage(1, this.dom_termini, (item: dependency_1.common.ProtoHash) => item.serialize(writer)); + if (this.sub_termini.length) + writer.writeRepeatedMessage(2, this.sub_termini, (item: dependency_1.common.ProtoHash) => item.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoTermini { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoTermini(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.dom_termini, () => pb_1.Message.addToRepeatedWrapperField(message, 1, dependency_1.common.ProtoHash.deserialize(reader), dependency_1.common.ProtoHash)); + break; + case 2: + reader.readMessage(message.sub_termini, () => pb_1.Message.addToRepeatedWrapperField(message, 2, dependency_1.common.ProtoHash.deserialize(reader), dependency_1.common.ProtoHash)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoTermini { + return ProtoTermini.deserialize(bytes); + } + } + export class ProtoEtxSet extends pb_1.Message { + #one_of_decls: number[][] = [[1]]; + constructor(data?: any[] | ({} & (({ + etx_hashes?: Uint8Array; + })))) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("etx_hashes" in data && data.etx_hashes != undefined) { + this.etx_hashes = data.etx_hashes; + } + } + } + get etx_hashes() { + return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array(0)) as Uint8Array; + } + set etx_hashes(value: Uint8Array) { + pb_1.Message.setOneofField(this, 1, this.#one_of_decls[0], value); + } + get has_etx_hashes() { + return pb_1.Message.getField(this, 1) != null; + } + get _etx_hashes() { + const cases: { + [index: number]: "none" | "etx_hashes"; + } = { + 0: "none", + 1: "etx_hashes" + }; + return cases[pb_1.Message.computeOneofCase(this, [1])]; + } + static fromObject(data: { + etx_hashes?: Uint8Array; + }): ProtoEtxSet { + const message = new ProtoEtxSet({}); + if (data.etx_hashes != null) { + message.etx_hashes = data.etx_hashes; + } + return message; + } + toObject() { + const data: { + etx_hashes?: Uint8Array; + } = {}; + if (this.etx_hashes != null) { + data.etx_hashes = this.etx_hashes; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.has_etx_hashes) + writer.writeBytes(1, this.etx_hashes); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoEtxSet { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoEtxSet(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.etx_hashes = reader.readBytes(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoEtxSet { + return ProtoEtxSet.deserialize(bytes); + } + } + export class ProtoPendingEtxs extends pb_1.Message { + #one_of_decls: number[][] = [[1], [2]]; + constructor(data?: any[] | ({} & (({ + header?: ProtoHeader; + }) | ({ + etxs?: ProtoTransactions; + })))) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("header" in data && data.header != undefined) { + this.header = data.header; + } + if ("etxs" in data && data.etxs != undefined) { + this.etxs = data.etxs; + } + } + } + get header() { + return pb_1.Message.getWrapperField(this, ProtoHeader, 1) as ProtoHeader; + } + set header(value: ProtoHeader) { + pb_1.Message.setOneofWrapperField(this, 1, this.#one_of_decls[0], value); + } + get has_header() { + return pb_1.Message.getField(this, 1) != null; + } + get etxs() { + return pb_1.Message.getWrapperField(this, ProtoTransactions, 2) as ProtoTransactions; + } + set etxs(value: ProtoTransactions) { + pb_1.Message.setOneofWrapperField(this, 2, this.#one_of_decls[1], value); + } + get has_etxs() { + return pb_1.Message.getField(this, 2) != null; + } + get _header() { + const cases: { + [index: number]: "none" | "header"; + } = { + 0: "none", + 1: "header" + }; + return cases[pb_1.Message.computeOneofCase(this, [1])]; + } + get _etxs() { + const cases: { + [index: number]: "none" | "etxs"; + } = { + 0: "none", + 2: "etxs" + }; + return cases[pb_1.Message.computeOneofCase(this, [2])]; + } + static fromObject(data: { + header?: ReturnType; + etxs?: ReturnType; + }): ProtoPendingEtxs { + const message = new ProtoPendingEtxs({}); + if (data.header != null) { + message.header = ProtoHeader.fromObject(data.header); + } + if (data.etxs != null) { + message.etxs = ProtoTransactions.fromObject(data.etxs); + } + return message; + } + toObject() { + const data: { + header?: ReturnType; + etxs?: ReturnType; + } = {}; + if (this.header != null) { + data.header = this.header.toObject(); + } + if (this.etxs != null) { + data.etxs = this.etxs.toObject(); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.has_header) + writer.writeMessage(1, this.header, () => this.header.serialize(writer)); + if (this.has_etxs) + writer.writeMessage(2, this.etxs, () => this.etxs.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoPendingEtxs { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoPendingEtxs(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.header, () => message.header = ProtoHeader.deserialize(reader)); + break; + case 2: + reader.readMessage(message.etxs, () => message.etxs = ProtoTransactions.deserialize(reader)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoPendingEtxs { + return ProtoPendingEtxs.deserialize(bytes); + } + } + export class ProtoPendingEtxsRollup extends pb_1.Message { + #one_of_decls: number[][] = [[1], [2]]; + constructor(data?: any[] | ({} & (({ + header?: ProtoHeader; + }) | ({ + etxs_rollup?: ProtoTransactions; + })))) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("header" in data && data.header != undefined) { + this.header = data.header; + } + if ("etxs_rollup" in data && data.etxs_rollup != undefined) { + this.etxs_rollup = data.etxs_rollup; + } + } + } + get header() { + return pb_1.Message.getWrapperField(this, ProtoHeader, 1) as ProtoHeader; + } + set header(value: ProtoHeader) { + pb_1.Message.setOneofWrapperField(this, 1, this.#one_of_decls[0], value); + } + get has_header() { + return pb_1.Message.getField(this, 1) != null; + } + get etxs_rollup() { + return pb_1.Message.getWrapperField(this, ProtoTransactions, 2) as ProtoTransactions; + } + set etxs_rollup(value: ProtoTransactions) { + pb_1.Message.setOneofWrapperField(this, 2, this.#one_of_decls[1], value); + } + get has_etxs_rollup() { + return pb_1.Message.getField(this, 2) != null; + } + get _header() { + const cases: { + [index: number]: "none" | "header"; + } = { + 0: "none", + 1: "header" + }; + return cases[pb_1.Message.computeOneofCase(this, [1])]; + } + get _etxs_rollup() { + const cases: { + [index: number]: "none" | "etxs_rollup"; + } = { + 0: "none", + 2: "etxs_rollup" + }; + return cases[pb_1.Message.computeOneofCase(this, [2])]; + } + static fromObject(data: { + header?: ReturnType; + etxs_rollup?: ReturnType; + }): ProtoPendingEtxsRollup { + const message = new ProtoPendingEtxsRollup({}); + if (data.header != null) { + message.header = ProtoHeader.fromObject(data.header); + } + if (data.etxs_rollup != null) { + message.etxs_rollup = ProtoTransactions.fromObject(data.etxs_rollup); + } + return message; + } + toObject() { + const data: { + header?: ReturnType; + etxs_rollup?: ReturnType; + } = {}; + if (this.header != null) { + data.header = this.header.toObject(); + } + if (this.etxs_rollup != null) { + data.etxs_rollup = this.etxs_rollup.toObject(); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.has_header) + writer.writeMessage(1, this.header, () => this.header.serialize(writer)); + if (this.has_etxs_rollup) + writer.writeMessage(2, this.etxs_rollup, () => this.etxs_rollup.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoPendingEtxsRollup { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoPendingEtxsRollup(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.header, () => message.header = ProtoHeader.deserialize(reader)); + break; + case 2: + reader.readMessage(message.etxs_rollup, () => message.etxs_rollup = ProtoTransactions.deserialize(reader)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoPendingEtxsRollup { + return ProtoPendingEtxsRollup.deserialize(bytes); + } + } + export class ProtoTxIns extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + tx_ins?: ProtoTxIn[]; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("tx_ins" in data && data.tx_ins != undefined) { + this.tx_ins = data.tx_ins; + } + } + } + get tx_ins() { + return pb_1.Message.getRepeatedWrapperField(this, ProtoTxIn, 1) as ProtoTxIn[]; + } + set tx_ins(value: ProtoTxIn[]) { + pb_1.Message.setRepeatedWrapperField(this, 1, value); + } + static fromObject(data: { + tx_ins?: ReturnType[]; + }): ProtoTxIns { + const message = new ProtoTxIns({}); + if (data.tx_ins != null) { + message.tx_ins = data.tx_ins.map(item => ProtoTxIn.fromObject(item)); + } + return message; + } + toObject() { + const data: { + tx_ins?: ReturnType[]; + } = {}; + if (this.tx_ins != null) { + data.tx_ins = this.tx_ins.map((item: ProtoTxIn) => item.toObject()); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.tx_ins.length) + writer.writeRepeatedMessage(1, this.tx_ins, (item: ProtoTxIn) => item.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoTxIns { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoTxIns(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.tx_ins, () => pb_1.Message.addToRepeatedWrapperField(message, 1, ProtoTxIn.deserialize(reader), ProtoTxIn)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoTxIns { + return ProtoTxIns.deserialize(bytes); + } + } + export class ProtoTxOuts extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + tx_outs?: ProtoTxOut[]; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("tx_outs" in data && data.tx_outs != undefined) { + this.tx_outs = data.tx_outs; + } + } + } + get tx_outs() { + return pb_1.Message.getRepeatedWrapperField(this, ProtoTxOut, 1) as ProtoTxOut[]; + } + set tx_outs(value: ProtoTxOut[]) { + pb_1.Message.setRepeatedWrapperField(this, 1, value); + } + static fromObject(data: { + tx_outs?: ReturnType[]; + }): ProtoTxOuts { + const message = new ProtoTxOuts({}); + if (data.tx_outs != null) { + message.tx_outs = data.tx_outs.map(item => ProtoTxOut.fromObject(item)); + } + return message; + } + toObject() { + const data: { + tx_outs?: ReturnType[]; + } = {}; + if (this.tx_outs != null) { + data.tx_outs = this.tx_outs.map((item: ProtoTxOut) => item.toObject()); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.tx_outs.length) + writer.writeRepeatedMessage(1, this.tx_outs, (item: ProtoTxOut) => item.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoTxOuts { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoTxOuts(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.tx_outs, () => pb_1.Message.addToRepeatedWrapperField(message, 1, ProtoTxOut.deserialize(reader), ProtoTxOut)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoTxOuts { + return ProtoTxOuts.deserialize(bytes); + } + } + export class ProtoTxIn extends pb_1.Message { + #one_of_decls: number[][] = [[1], [2]]; + constructor(data?: any[] | ({} & (({ + previous_out_point?: ProtoOutPoint; + }) | ({ + pub_key?: Uint8Array; + })))) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("previous_out_point" in data && data.previous_out_point != undefined) { + this.previous_out_point = data.previous_out_point; + } + if ("pub_key" in data && data.pub_key != undefined) { + this.pub_key = data.pub_key; + } + } + } + get previous_out_point() { + return pb_1.Message.getWrapperField(this, ProtoOutPoint, 1) as ProtoOutPoint; + } + set previous_out_point(value: ProtoOutPoint) { + pb_1.Message.setOneofWrapperField(this, 1, this.#one_of_decls[0], value); + } + get has_previous_out_point() { + return pb_1.Message.getField(this, 1) != null; + } + get pub_key() { + return pb_1.Message.getFieldWithDefault(this, 2, new Uint8Array(0)) as Uint8Array; + } + set pub_key(value: Uint8Array) { + pb_1.Message.setOneofField(this, 2, this.#one_of_decls[1], value); + } + get has_pub_key() { + return pb_1.Message.getField(this, 2) != null; + } + get _previous_out_point() { + const cases: { + [index: number]: "none" | "previous_out_point"; + } = { + 0: "none", + 1: "previous_out_point" + }; + return cases[pb_1.Message.computeOneofCase(this, [1])]; + } + get _pub_key() { + const cases: { + [index: number]: "none" | "pub_key"; + } = { + 0: "none", + 2: "pub_key" + }; + return cases[pb_1.Message.computeOneofCase(this, [2])]; + } + static fromObject(data: { + previous_out_point?: ReturnType; + pub_key?: Uint8Array; + }): ProtoTxIn { + const message = new ProtoTxIn({}); + if (data.previous_out_point != null) { + message.previous_out_point = ProtoOutPoint.fromObject(data.previous_out_point); + } + if (data.pub_key != null) { + message.pub_key = data.pub_key; + } + return message; + } + toObject() { + const data: { + previous_out_point?: ReturnType; + pub_key?: Uint8Array; + } = {}; + if (this.previous_out_point != null) { + data.previous_out_point = this.previous_out_point.toObject(); + } + if (this.pub_key != null) { + data.pub_key = this.pub_key; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.has_previous_out_point) + writer.writeMessage(1, this.previous_out_point, () => this.previous_out_point.serialize(writer)); + if (this.has_pub_key) + writer.writeBytes(2, this.pub_key); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoTxIn { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoTxIn(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.previous_out_point, () => message.previous_out_point = ProtoOutPoint.deserialize(reader)); + break; + case 2: + message.pub_key = reader.readBytes(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoTxIn { + return ProtoTxIn.deserialize(bytes); + } + } + export class ProtoOutPoint extends pb_1.Message { + #one_of_decls: number[][] = [[1], [2]]; + constructor(data?: any[] | ({} & (({ + hash?: dependency_1.common.ProtoHash; + }) | ({ + index?: number; + })))) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("hash" in data && data.hash != undefined) { + this.hash = data.hash; + } + if ("index" in data && data.index != undefined) { + this.index = data.index; + } + } + } + get hash() { + return pb_1.Message.getWrapperField(this, dependency_1.common.ProtoHash, 1) as dependency_1.common.ProtoHash; + } + set hash(value: dependency_1.common.ProtoHash) { + pb_1.Message.setOneofWrapperField(this, 1, this.#one_of_decls[0], value); + } + get has_hash() { + return pb_1.Message.getField(this, 1) != null; + } + get index() { + return pb_1.Message.getFieldWithDefault(this, 2, 0) as number; + } + set index(value: number) { + pb_1.Message.setOneofField(this, 2, this.#one_of_decls[1], value); + } + get has_index() { + return pb_1.Message.getField(this, 2) != null; + } + get _hash() { + const cases: { + [index: number]: "none" | "hash"; + } = { + 0: "none", + 1: "hash" + }; + return cases[pb_1.Message.computeOneofCase(this, [1])]; + } + get _index() { + const cases: { + [index: number]: "none" | "index"; + } = { + 0: "none", + 2: "index" + }; + return cases[pb_1.Message.computeOneofCase(this, [2])]; + } + static fromObject(data: { + hash?: ReturnType; + index?: number; + }): ProtoOutPoint { + const message = new ProtoOutPoint({}); + if (data.hash != null) { + message.hash = dependency_1.common.ProtoHash.fromObject(data.hash); + } + if (data.index != null) { + message.index = data.index; + } + return message; + } + toObject() { + const data: { + hash?: ReturnType; + index?: number; + } = {}; + if (this.hash != null) { + data.hash = this.hash.toObject(); + } + if (this.index != null) { + data.index = this.index; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.has_hash) + writer.writeMessage(1, this.hash, () => this.hash.serialize(writer)); + if (this.has_index) + writer.writeUint32(2, this.index); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoOutPoint { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoOutPoint(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.hash, () => message.hash = dependency_1.common.ProtoHash.deserialize(reader)); + break; + case 2: + message.index = reader.readUint32(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoOutPoint { + return ProtoOutPoint.deserialize(bytes); + } + } + export class ProtoTxOut extends pb_1.Message { + #one_of_decls: number[][] = [[1], [2]]; + constructor(data?: any[] | ({} & (({ + denomination?: number; + }) | ({ + address?: Uint8Array; + })))) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("denomination" in data && data.denomination != undefined) { + this.denomination = data.denomination; + } + if ("address" in data && data.address != undefined) { + this.address = data.address; + } + } + } + get denomination() { + return pb_1.Message.getFieldWithDefault(this, 1, 0) as number; + } + set denomination(value: number) { + pb_1.Message.setOneofField(this, 1, this.#one_of_decls[0], value); + } + get has_denomination() { + return pb_1.Message.getField(this, 1) != null; + } + get address() { + return pb_1.Message.getFieldWithDefault(this, 2, new Uint8Array(0)) as Uint8Array; + } + set address(value: Uint8Array) { + pb_1.Message.setOneofField(this, 2, this.#one_of_decls[1], value); + } + get has_address() { + return pb_1.Message.getField(this, 2) != null; + } + get _denomination() { + const cases: { + [index: number]: "none" | "denomination"; + } = { + 0: "none", + 1: "denomination" + }; + return cases[pb_1.Message.computeOneofCase(this, [1])]; + } + get _address() { + const cases: { + [index: number]: "none" | "address"; + } = { + 0: "none", + 2: "address" + }; + return cases[pb_1.Message.computeOneofCase(this, [2])]; + } + static fromObject(data: { + denomination?: number; + address?: Uint8Array; + }): ProtoTxOut { + const message = new ProtoTxOut({}); + if (data.denomination != null) { + message.denomination = data.denomination; + } + if (data.address != null) { + message.address = data.address; + } + return message; + } + toObject() { + const data: { + denomination?: number; + address?: Uint8Array; + } = {}; + if (this.denomination != null) { + data.denomination = this.denomination; + } + if (this.address != null) { + data.address = this.address; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.has_denomination) + writer.writeUint32(1, this.denomination); + if (this.has_address) + writer.writeBytes(2, this.address); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ProtoTxOut { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new ProtoTxOut(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.denomination = reader.readUint32(); + break; + case 2: + message.address = reader.readBytes(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): ProtoTxOut { + return ProtoTxOut.deserialize(bytes); + } + } +}