@archwayhq/arch3-proto
Version:
Protobuf definitions and RPC clients for the Archway Network
511 lines • 21.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TxTracking = exports.BlockTracking = exports.ContractOperationInfo = exports.TxInfo = exports.contractOperationToJSON = exports.contractOperationFromJSON = exports.ContractOperationAmino = exports.ContractOperation = void 0;
/* eslint-disable */
const binary_1 = require("../../../binary");
const helpers_1 = require("../../../helpers");
/** ContractOperation denotes which operation consumed gas. */
var ContractOperation;
(function (ContractOperation) {
/** CONTRACT_OPERATION_UNSPECIFIED - Invalid or unknown operation */
ContractOperation[ContractOperation["CONTRACT_OPERATION_UNSPECIFIED"] = 0] = "CONTRACT_OPERATION_UNSPECIFIED";
/** CONTRACT_OPERATION_INSTANTIATION - Instantiate operation */
ContractOperation[ContractOperation["CONTRACT_OPERATION_INSTANTIATION"] = 1] = "CONTRACT_OPERATION_INSTANTIATION";
/** CONTRACT_OPERATION_EXECUTION - Execute operation */
ContractOperation[ContractOperation["CONTRACT_OPERATION_EXECUTION"] = 2] = "CONTRACT_OPERATION_EXECUTION";
/** CONTRACT_OPERATION_QUERY - Query */
ContractOperation[ContractOperation["CONTRACT_OPERATION_QUERY"] = 3] = "CONTRACT_OPERATION_QUERY";
/** CONTRACT_OPERATION_MIGRATE - Migrate operation */
ContractOperation[ContractOperation["CONTRACT_OPERATION_MIGRATE"] = 4] = "CONTRACT_OPERATION_MIGRATE";
/** CONTRACT_OPERATION_IBC - IBC operations */
ContractOperation[ContractOperation["CONTRACT_OPERATION_IBC"] = 5] = "CONTRACT_OPERATION_IBC";
/** CONTRACT_OPERATION_SUDO - Sudo operation */
ContractOperation[ContractOperation["CONTRACT_OPERATION_SUDO"] = 6] = "CONTRACT_OPERATION_SUDO";
/** CONTRACT_OPERATION_REPLY - Reply callback operation */
ContractOperation[ContractOperation["CONTRACT_OPERATION_REPLY"] = 7] = "CONTRACT_OPERATION_REPLY";
ContractOperation[ContractOperation["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(ContractOperation || (exports.ContractOperation = ContractOperation = {}));
exports.ContractOperationAmino = ContractOperation;
function contractOperationFromJSON(object) {
switch (object) {
case 0:
case "CONTRACT_OPERATION_UNSPECIFIED":
return ContractOperation.CONTRACT_OPERATION_UNSPECIFIED;
case 1:
case "CONTRACT_OPERATION_INSTANTIATION":
return ContractOperation.CONTRACT_OPERATION_INSTANTIATION;
case 2:
case "CONTRACT_OPERATION_EXECUTION":
return ContractOperation.CONTRACT_OPERATION_EXECUTION;
case 3:
case "CONTRACT_OPERATION_QUERY":
return ContractOperation.CONTRACT_OPERATION_QUERY;
case 4:
case "CONTRACT_OPERATION_MIGRATE":
return ContractOperation.CONTRACT_OPERATION_MIGRATE;
case 5:
case "CONTRACT_OPERATION_IBC":
return ContractOperation.CONTRACT_OPERATION_IBC;
case 6:
case "CONTRACT_OPERATION_SUDO":
return ContractOperation.CONTRACT_OPERATION_SUDO;
case 7:
case "CONTRACT_OPERATION_REPLY":
return ContractOperation.CONTRACT_OPERATION_REPLY;
case -1:
case "UNRECOGNIZED":
default:
return ContractOperation.UNRECOGNIZED;
}
}
exports.contractOperationFromJSON = contractOperationFromJSON;
function contractOperationToJSON(object) {
switch (object) {
case ContractOperation.CONTRACT_OPERATION_UNSPECIFIED:
return "CONTRACT_OPERATION_UNSPECIFIED";
case ContractOperation.CONTRACT_OPERATION_INSTANTIATION:
return "CONTRACT_OPERATION_INSTANTIATION";
case ContractOperation.CONTRACT_OPERATION_EXECUTION:
return "CONTRACT_OPERATION_EXECUTION";
case ContractOperation.CONTRACT_OPERATION_QUERY:
return "CONTRACT_OPERATION_QUERY";
case ContractOperation.CONTRACT_OPERATION_MIGRATE:
return "CONTRACT_OPERATION_MIGRATE";
case ContractOperation.CONTRACT_OPERATION_IBC:
return "CONTRACT_OPERATION_IBC";
case ContractOperation.CONTRACT_OPERATION_SUDO:
return "CONTRACT_OPERATION_SUDO";
case ContractOperation.CONTRACT_OPERATION_REPLY:
return "CONTRACT_OPERATION_REPLY";
case ContractOperation.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
exports.contractOperationToJSON = contractOperationToJSON;
function createBaseTxInfo() {
return {
id: BigInt(0),
height: BigInt(0),
totalGas: BigInt(0)
};
}
exports.TxInfo = {
typeUrl: "/archway.tracking.v1.TxInfo",
encode(message, writer = binary_1.BinaryWriter.create()) {
if (message.id !== BigInt(0)) {
writer.uint32(8).uint64(message.id);
}
if (message.height !== BigInt(0)) {
writer.uint32(16).int64(message.height);
}
if (message.totalGas !== BigInt(0)) {
writer.uint32(24).uint64(message.totalGas);
}
return writer;
},
decode(input, length) {
const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTxInfo();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.id = reader.uint64();
break;
case 2:
message.height = reader.int64();
break;
case 3:
message.totalGas = reader.uint64();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object) {
return {
id: (0, helpers_1.isSet)(object.id) ? BigInt(object.id.toString()) : BigInt(0),
height: (0, helpers_1.isSet)(object.height) ? BigInt(object.height.toString()) : BigInt(0),
totalGas: (0, helpers_1.isSet)(object.totalGas) ? BigInt(object.totalGas.toString()) : BigInt(0)
};
},
toJSON(message) {
const obj = {};
message.id !== undefined && (obj.id = (message.id || BigInt(0)).toString());
message.height !== undefined && (obj.height = (message.height || BigInt(0)).toString());
message.totalGas !== undefined && (obj.totalGas = (message.totalGas || BigInt(0)).toString());
return obj;
},
fromPartial(object) {
const message = createBaseTxInfo();
message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0);
message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0);
message.totalGas = object.totalGas !== undefined && object.totalGas !== null ? BigInt(object.totalGas.toString()) : BigInt(0);
return message;
},
fromAmino(object) {
const message = createBaseTxInfo();
if (object.id !== undefined && object.id !== null) {
message.id = BigInt(object.id);
}
if (object.height !== undefined && object.height !== null) {
message.height = BigInt(object.height);
}
if (object.total_gas !== undefined && object.total_gas !== null) {
message.totalGas = BigInt(object.total_gas);
}
return message;
},
toAmino(message) {
const obj = {};
obj.id = message.id ? message.id.toString() : undefined;
obj.height = message.height ? message.height.toString() : undefined;
obj.total_gas = message.totalGas ? message.totalGas.toString() : undefined;
return obj;
},
fromAminoMsg(object) {
return exports.TxInfo.fromAmino(object.value);
},
fromProtoMsg(message) {
return exports.TxInfo.decode(message.value);
},
toProto(message) {
return exports.TxInfo.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/archway.tracking.v1.TxInfo",
value: exports.TxInfo.encode(message).finish()
};
}
};
function createBaseContractOperationInfo() {
return {
id: BigInt(0),
txId: BigInt(0),
contractAddress: "",
operationType: 0,
vmGas: BigInt(0),
sdkGas: BigInt(0)
};
}
exports.ContractOperationInfo = {
typeUrl: "/archway.tracking.v1.ContractOperationInfo",
encode(message, writer = binary_1.BinaryWriter.create()) {
if (message.id !== BigInt(0)) {
writer.uint32(8).uint64(message.id);
}
if (message.txId !== BigInt(0)) {
writer.uint32(16).uint64(message.txId);
}
if (message.contractAddress !== "") {
writer.uint32(26).string(message.contractAddress);
}
if (message.operationType !== 0) {
writer.uint32(32).int32(message.operationType);
}
if (message.vmGas !== BigInt(0)) {
writer.uint32(40).uint64(message.vmGas);
}
if (message.sdkGas !== BigInt(0)) {
writer.uint32(48).uint64(message.sdkGas);
}
return writer;
},
decode(input, length) {
const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseContractOperationInfo();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.id = reader.uint64();
break;
case 2:
message.txId = reader.uint64();
break;
case 3:
message.contractAddress = reader.string();
break;
case 4:
message.operationType = reader.int32();
break;
case 5:
message.vmGas = reader.uint64();
break;
case 6:
message.sdkGas = reader.uint64();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object) {
return {
id: (0, helpers_1.isSet)(object.id) ? BigInt(object.id.toString()) : BigInt(0),
txId: (0, helpers_1.isSet)(object.txId) ? BigInt(object.txId.toString()) : BigInt(0),
contractAddress: (0, helpers_1.isSet)(object.contractAddress) ? String(object.contractAddress) : "",
operationType: (0, helpers_1.isSet)(object.operationType) ? contractOperationFromJSON(object.operationType) : -1,
vmGas: (0, helpers_1.isSet)(object.vmGas) ? BigInt(object.vmGas.toString()) : BigInt(0),
sdkGas: (0, helpers_1.isSet)(object.sdkGas) ? BigInt(object.sdkGas.toString()) : BigInt(0)
};
},
toJSON(message) {
const obj = {};
message.id !== undefined && (obj.id = (message.id || BigInt(0)).toString());
message.txId !== undefined && (obj.txId = (message.txId || BigInt(0)).toString());
message.contractAddress !== undefined && (obj.contractAddress = message.contractAddress);
message.operationType !== undefined && (obj.operationType = contractOperationToJSON(message.operationType));
message.vmGas !== undefined && (obj.vmGas = (message.vmGas || BigInt(0)).toString());
message.sdkGas !== undefined && (obj.sdkGas = (message.sdkGas || BigInt(0)).toString());
return obj;
},
fromPartial(object) {
var _a, _b;
const message = createBaseContractOperationInfo();
message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0);
message.txId = object.txId !== undefined && object.txId !== null ? BigInt(object.txId.toString()) : BigInt(0);
message.contractAddress = (_a = object.contractAddress) !== null && _a !== void 0 ? _a : "";
message.operationType = (_b = object.operationType) !== null && _b !== void 0 ? _b : 0;
message.vmGas = object.vmGas !== undefined && object.vmGas !== null ? BigInt(object.vmGas.toString()) : BigInt(0);
message.sdkGas = object.sdkGas !== undefined && object.sdkGas !== null ? BigInt(object.sdkGas.toString()) : BigInt(0);
return message;
},
fromAmino(object) {
const message = createBaseContractOperationInfo();
if (object.id !== undefined && object.id !== null) {
message.id = BigInt(object.id);
}
if (object.tx_id !== undefined && object.tx_id !== null) {
message.txId = BigInt(object.tx_id);
}
if (object.contract_address !== undefined && object.contract_address !== null) {
message.contractAddress = object.contract_address;
}
if (object.operation_type !== undefined && object.operation_type !== null) {
message.operationType = contractOperationFromJSON(object.operation_type);
}
if (object.vm_gas !== undefined && object.vm_gas !== null) {
message.vmGas = BigInt(object.vm_gas);
}
if (object.sdk_gas !== undefined && object.sdk_gas !== null) {
message.sdkGas = BigInt(object.sdk_gas);
}
return message;
},
toAmino(message) {
const obj = {};
obj.id = message.id ? message.id.toString() : undefined;
obj.tx_id = message.txId ? message.txId.toString() : undefined;
obj.contract_address = message.contractAddress;
obj.operation_type = message.operationType;
obj.vm_gas = message.vmGas ? message.vmGas.toString() : undefined;
obj.sdk_gas = message.sdkGas ? message.sdkGas.toString() : undefined;
return obj;
},
fromAminoMsg(object) {
return exports.ContractOperationInfo.fromAmino(object.value);
},
fromProtoMsg(message) {
return exports.ContractOperationInfo.decode(message.value);
},
toProto(message) {
return exports.ContractOperationInfo.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/archway.tracking.v1.ContractOperationInfo",
value: exports.ContractOperationInfo.encode(message).finish()
};
}
};
function createBaseBlockTracking() {
return {
txs: []
};
}
exports.BlockTracking = {
typeUrl: "/archway.tracking.v1.BlockTracking",
encode(message, writer = binary_1.BinaryWriter.create()) {
for (const v of message.txs) {
exports.TxTracking.encode(v, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseBlockTracking();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.txs.push(exports.TxTracking.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object) {
return {
txs: Array.isArray(object === null || object === void 0 ? void 0 : object.txs) ? object.txs.map((e) => exports.TxTracking.fromJSON(e)) : []
};
},
toJSON(message) {
const obj = {};
if (message.txs) {
obj.txs = message.txs.map(e => e ? exports.TxTracking.toJSON(e) : undefined);
}
else {
obj.txs = [];
}
return obj;
},
fromPartial(object) {
var _a;
const message = createBaseBlockTracking();
message.txs = ((_a = object.txs) === null || _a === void 0 ? void 0 : _a.map(e => exports.TxTracking.fromPartial(e))) || [];
return message;
},
fromAmino(object) {
var _a;
const message = createBaseBlockTracking();
message.txs = ((_a = object.txs) === null || _a === void 0 ? void 0 : _a.map(e => exports.TxTracking.fromAmino(e))) || [];
return message;
},
toAmino(message) {
const obj = {};
if (message.txs) {
obj.txs = message.txs.map(e => e ? exports.TxTracking.toAmino(e) : undefined);
}
else {
obj.txs = [];
}
return obj;
},
fromAminoMsg(object) {
return exports.BlockTracking.fromAmino(object.value);
},
fromProtoMsg(message) {
return exports.BlockTracking.decode(message.value);
},
toProto(message) {
return exports.BlockTracking.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/archway.tracking.v1.BlockTracking",
value: exports.BlockTracking.encode(message).finish()
};
}
};
function createBaseTxTracking() {
return {
info: exports.TxInfo.fromPartial({}),
contractOperations: []
};
}
exports.TxTracking = {
typeUrl: "/archway.tracking.v1.TxTracking",
encode(message, writer = binary_1.BinaryWriter.create()) {
if (message.info !== undefined) {
exports.TxInfo.encode(message.info, writer.uint32(10).fork()).ldelim();
}
for (const v of message.contractOperations) {
exports.ContractOperationInfo.encode(v, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTxTracking();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.info = exports.TxInfo.decode(reader, reader.uint32());
break;
case 2:
message.contractOperations.push(exports.ContractOperationInfo.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object) {
return {
info: (0, helpers_1.isSet)(object.info) ? exports.TxInfo.fromJSON(object.info) : undefined,
contractOperations: Array.isArray(object === null || object === void 0 ? void 0 : object.contractOperations) ? object.contractOperations.map((e) => exports.ContractOperationInfo.fromJSON(e)) : []
};
},
toJSON(message) {
const obj = {};
message.info !== undefined && (obj.info = message.info ? exports.TxInfo.toJSON(message.info) : undefined);
if (message.contractOperations) {
obj.contractOperations = message.contractOperations.map(e => e ? exports.ContractOperationInfo.toJSON(e) : undefined);
}
else {
obj.contractOperations = [];
}
return obj;
},
fromPartial(object) {
var _a;
const message = createBaseTxTracking();
message.info = object.info !== undefined && object.info !== null ? exports.TxInfo.fromPartial(object.info) : undefined;
message.contractOperations = ((_a = object.contractOperations) === null || _a === void 0 ? void 0 : _a.map(e => exports.ContractOperationInfo.fromPartial(e))) || [];
return message;
},
fromAmino(object) {
var _a;
const message = createBaseTxTracking();
if (object.info !== undefined && object.info !== null) {
message.info = exports.TxInfo.fromAmino(object.info);
}
message.contractOperations = ((_a = object.contract_operations) === null || _a === void 0 ? void 0 : _a.map(e => exports.ContractOperationInfo.fromAmino(e))) || [];
return message;
},
toAmino(message) {
const obj = {};
obj.info = message.info ? exports.TxInfo.toAmino(message.info) : undefined;
if (message.contractOperations) {
obj.contract_operations = message.contractOperations.map(e => e ? exports.ContractOperationInfo.toAmino(e) : undefined);
}
else {
obj.contract_operations = [];
}
return obj;
},
fromAminoMsg(object) {
return exports.TxTracking.fromAmino(object.value);
},
fromProtoMsg(message) {
return exports.TxTracking.decode(message.value);
},
toProto(message) {
return exports.TxTracking.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/archway.tracking.v1.TxTracking",
value: exports.TxTracking.encode(message).finish()
};
}
};
//# sourceMappingURL=tracking.js.map