@cheqd/ts-proto
Version:
A TypeScript package for all transpiled cheqd ProtoBuf definitions.
182 lines (164 loc) • 5.56 kB
text/typescript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.6.1
// protoc unknown
// source: cheqd/resource/v2/fee.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { Coin } from "../../../cosmos/base/v1beta1/coin.js";
/**
* FeeParams defines the parameters for the cheqd Resource module fixed fee.
* Creation requests for different IANA media types are charged different fees.
*/
export interface FeeParams {
/**
* Fixed fee for creating a resource with media type 'image/*'
*
* Default: 10 CHEQ or 10000000000ncheq
*/
image:
| Coin
| undefined;
/**
* Fixed fee for creating a resource with media type 'application/json'
*
* Default: 2.5 CHEQ or 2500000000ncheq
*/
json:
| Coin
| undefined;
/**
* Fixed fee for creating a resource with all other media types
*
* Default: 5 CHEQ or 5000000000ncheq
*/
default:
| Coin
| undefined;
/**
* Percentage of the fixed fee that will be burned
*
* Default: 0.5 (50%)
*/
burnFactor: string;
}
function createBaseFeeParams(): FeeParams {
return { image: undefined, json: undefined, default: undefined, burnFactor: "" };
}
export const FeeParams: MessageFns<FeeParams> = {
encode(message: FeeParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.image !== undefined) {
Coin.encode(message.image, writer.uint32(10).fork()).join();
}
if (message.json !== undefined) {
Coin.encode(message.json, writer.uint32(18).fork()).join();
}
if (message.default !== undefined) {
Coin.encode(message.default, writer.uint32(26).fork()).join();
}
if (message.burnFactor !== "") {
writer.uint32(34).string(message.burnFactor);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): FeeParams {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseFeeParams();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.image = Coin.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.json = Coin.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.default = Coin.decode(reader, reader.uint32());
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.burnFactor = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): FeeParams {
return {
image: isSet(object.image) ? Coin.fromJSON(object.image) : undefined,
json: isSet(object.json) ? Coin.fromJSON(object.json) : undefined,
default: isSet(object.default) ? Coin.fromJSON(object.default) : undefined,
burnFactor: isSet(object.burnFactor) ? globalThis.String(object.burnFactor) : "",
};
},
toJSON(message: FeeParams): unknown {
const obj: any = {};
if (message.image !== undefined) {
obj.image = Coin.toJSON(message.image);
}
if (message.json !== undefined) {
obj.json = Coin.toJSON(message.json);
}
if (message.default !== undefined) {
obj.default = Coin.toJSON(message.default);
}
if (message.burnFactor !== "") {
obj.burnFactor = message.burnFactor;
}
return obj;
},
create<I extends Exact<DeepPartial<FeeParams>, I>>(base?: I): FeeParams {
return FeeParams.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<FeeParams>, I>>(object: I): FeeParams {
const message = createBaseFeeParams();
message.image = (object.image !== undefined && object.image !== null) ? Coin.fromPartial(object.image) : undefined;
message.json = (object.json !== undefined && object.json !== null) ? Coin.fromPartial(object.json) : undefined;
message.default = (object.default !== undefined && object.default !== null)
? Coin.fromPartial(object.default)
: undefined;
message.burnFactor = object.burnFactor ?? "";
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
type DeepPartial<T> = T extends Builtin ? T
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never;
type Exact<P, I extends P> = P extends Builtin ? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}
interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
fromJSON(object: any): T;
toJSON(message: T): unknown;
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
}