// @generated by protobuf-ts 2.11.1 with parameter add_pb_suffix
// @generated from protobuf file "injective/peggy/v1/rate_limit.proto" (package "injective.peggy.v1", syntax proto3)
// tslint:disable
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
import type { IBinaryWriter } from "@protobuf-ts/runtime";
import { WireType } from "@protobuf-ts/runtime";
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
import type { IBinaryReader } from "@protobuf-ts/runtime";
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
import type { PartialMessage } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
import { OracleType } from "../../oracle/v1beta1/oracle_pb";
/**
 * @generated from protobuf message injective.peggy.v1.RateLimit
 */
export interface RateLimit {
    /**
     * address of the ERC20 token
     *
     * @generated from protobuf field: string token_address = 1
     */
    tokenAddress: string;
    /**
     * decimals of the ERC20 token
     *
     * @generated from protobuf field: uint32 token_decimals = 2
     */
    tokenDecimals: number;
    /**
     * unique ID used to obtain the notional USD value of the ERC20 token from
     * oracle
     *
     * @generated from protobuf field: string token_price_id = 3
     */
    tokenPriceId: string;
    /**
     * length of the sliding window in which inbound (outbound) traffic is
     * measured
     *
     * @generated from protobuf field: uint64 rate_limit_window = 4
     */
    rateLimitWindow: bigint;
    /**
     * the notional USD limit imposed on all outgoing traffic (per token)
     *
     * @generated from protobuf field: string rate_limit_usd = 5
     */
    rateLimitUsd: string;
    /**
     * [DEPRECATED] the absolute amount of tokens that can be minted on Injective
     *
     * @deprecated
     * @generated from protobuf field: string absolute_mint_limit = 6 [deprecated = true]
     */
    absoluteMintLimit: string;
    /**
     * transfers that occurred within the sliding window
     *
     * @deprecated
     * @generated from protobuf field: repeated injective.peggy.v1.BridgeTransfer transfers = 7 [deprecated = true]
     */
    transfers: BridgeTransfer[];
    /**
     * oracle type used to obtain the USD price of the ERC20 token (in relation
     * with token_price_id)
     *
     * @generated from protobuf field: injective.oracle.v1beta1.OracleType token_oracle_type = 8
     */
    tokenOracleType: OracleType;
}
/**
 * @deprecated
 * @generated from protobuf message injective.peggy.v1.BridgeTransfer
 */
export interface BridgeTransfer {
    /**
     * quantity that was bridged (chain format)
     *
     * @generated from protobuf field: string amount = 1
     */
    amount: string;
    /**
     * the Injective block at which this amount was bridged
     *
     * @generated from protobuf field: uint64 block_number = 2
     */
    blockNumber: bigint;
    /**
     * type of transfer (withdrawal/deposit)
     *
     * @generated from protobuf field: bool is_deposit = 3
     */
    isDeposit: boolean;
}
/**
 * @generated from protobuf message injective.peggy.v1.RateLimitTransfers
 */
export interface RateLimitTransfers {
    /**
     * contract address of the erc20 on Ethereum
     *
     * @generated from protobuf field: string token = 1
     */
    token: string;
    /**
     * records of deposit transfers across blocks
     *
     * @generated from protobuf field: repeated injective.peggy.v1.BlockTransferRecord inflows = 2
     */
    inflows: BlockTransferRecord[];
    /**
     * records of withdrawal transfers across blocks
     *
     * @generated from protobuf field: repeated injective.peggy.v1.BlockTransferRecord outflows = 3
     */
    outflows: BlockTransferRecord[];
}
/**
 * @generated from protobuf message injective.peggy.v1.BlockTransferRecord
 */
export interface BlockTransferRecord {
    /**
     * block number at which the transfers occurred
     *
     * @generated from protobuf field: uint64 block_number = 1
     */
    blockNumber: bigint;
    /**
     * sum amount of transfers that happened in that block
     *
     * @generated from protobuf field: string amount = 2
     */
    amount: string;
}
/**
 * @generated from protobuf message injective.peggy.v1.MintAmount
 */
export interface MintAmount {
    /**
     * address of the erc20 bridged in
     *
     * @generated from protobuf field: string token = 1
     */
    token: string;
    /**
     * amount currently minted on chain
     *
     * @generated from protobuf field: string amount = 2
     */
    amount: string;
}
// @generated message type with reflection information, may provide speed optimized methods
class RateLimit$Type extends MessageType<RateLimit> {
    constructor() {
        super("injective.peggy.v1.RateLimit", [
            { no: 1, name: "token_address", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "token_decimals", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
            { no: 3, name: "token_price_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "rate_limit_window", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
            { no: 5, name: "rate_limit_usd", kind: "scalar", T: 9 /*ScalarType.STRING*/, options: { "gogoproto.nullable": false, "gogoproto.customtype": "cosmossdk.io/math.LegacyDec" } },
            { no: 6, name: "absolute_mint_limit", kind: "scalar", T: 9 /*ScalarType.STRING*/, options: { "gogoproto.nullable": false, "gogoproto.customtype": "cosmossdk.io/math.Int" } },
            { no: 7, name: "transfers", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => BridgeTransfer },
            { no: 8, name: "token_oracle_type", kind: "enum", T: () => ["injective.oracle.v1beta1.OracleType", OracleType] }
        ]);
    }
    create(value?: PartialMessage<RateLimit>): RateLimit {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.tokenAddress = "";
        message.tokenDecimals = 0;
        message.tokenPriceId = "";
        message.rateLimitWindow = 0n;
        message.rateLimitUsd = "";
        message.absoluteMintLimit = "";
        message.transfers = [];
        message.tokenOracleType = 0;
        if (value !== undefined)
            reflectionMergePartial<RateLimit>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: RateLimit): RateLimit {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string token_address */ 1:
                    message.tokenAddress = reader.string();
                    break;
                case /* uint32 token_decimals */ 2:
                    message.tokenDecimals = reader.uint32();
                    break;
                case /* string token_price_id */ 3:
                    message.tokenPriceId = reader.string();
                    break;
                case /* uint64 rate_limit_window */ 4:
                    message.rateLimitWindow = reader.uint64().toBigInt();
                    break;
                case /* string rate_limit_usd */ 5:
                    message.rateLimitUsd = reader.string();
                    break;
                case /* string absolute_mint_limit = 6 [deprecated = true] */ 6:
                    message.absoluteMintLimit = reader.string();
                    break;
                case /* repeated injective.peggy.v1.BridgeTransfer transfers = 7 [deprecated = true] */ 7:
                    message.transfers.push(BridgeTransfer.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* injective.oracle.v1beta1.OracleType token_oracle_type */ 8:
                    message.tokenOracleType = reader.int32();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message: RateLimit, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string token_address = 1; */
        if (message.tokenAddress !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.tokenAddress);
        /* uint32 token_decimals = 2; */
        if (message.tokenDecimals !== 0)
            writer.tag(2, WireType.Varint).uint32(message.tokenDecimals);
        /* string token_price_id = 3; */
        if (message.tokenPriceId !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.tokenPriceId);
        /* uint64 rate_limit_window = 4; */
        if (message.rateLimitWindow !== 0n)
            writer.tag(4, WireType.Varint).uint64(message.rateLimitWindow);
        /* string rate_limit_usd = 5; */
        if (message.rateLimitUsd !== "")
            writer.tag(5, WireType.LengthDelimited).string(message.rateLimitUsd);
        /* string absolute_mint_limit = 6 [deprecated = true]; */
        if (message.absoluteMintLimit !== "")
            writer.tag(6, WireType.LengthDelimited).string(message.absoluteMintLimit);
        /* repeated injective.peggy.v1.BridgeTransfer transfers = 7 [deprecated = true]; */
        for (let i = 0; i < message.transfers.length; i++)
            BridgeTransfer.internalBinaryWrite(message.transfers[i], writer.tag(7, WireType.LengthDelimited).fork(), options).join();
        /* injective.oracle.v1beta1.OracleType token_oracle_type = 8; */
        if (message.tokenOracleType !== 0)
            writer.tag(8, WireType.Varint).int32(message.tokenOracleType);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message injective.peggy.v1.RateLimit
 */
export const RateLimit = new RateLimit$Type();
// @generated message type with reflection information, may provide speed optimized methods
class BridgeTransfer$Type extends MessageType<BridgeTransfer> {
    constructor() {
        super("injective.peggy.v1.BridgeTransfer", [
            { no: 1, name: "amount", kind: "scalar", T: 9 /*ScalarType.STRING*/, options: { "gogoproto.nullable": false, "gogoproto.customtype": "cosmossdk.io/math.Int" } },
            { no: 2, name: "block_number", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
            { no: 3, name: "is_deposit", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
        ]);
    }
    create(value?: PartialMessage<BridgeTransfer>): BridgeTransfer {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.amount = "";
        message.blockNumber = 0n;
        message.isDeposit = false;
        if (value !== undefined)
            reflectionMergePartial<BridgeTransfer>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: BridgeTransfer): BridgeTransfer {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string amount */ 1:
                    message.amount = reader.string();
                    break;
                case /* uint64 block_number */ 2:
                    message.blockNumber = reader.uint64().toBigInt();
                    break;
                case /* bool is_deposit */ 3:
                    message.isDeposit = reader.bool();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message: BridgeTransfer, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string amount = 1; */
        if (message.amount !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.amount);
        /* uint64 block_number = 2; */
        if (message.blockNumber !== 0n)
            writer.tag(2, WireType.Varint).uint64(message.blockNumber);
        /* bool is_deposit = 3; */
        if (message.isDeposit !== false)
            writer.tag(3, WireType.Varint).bool(message.isDeposit);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @deprecated
 * @generated MessageType for protobuf message injective.peggy.v1.BridgeTransfer
 */
export const BridgeTransfer = new BridgeTransfer$Type();
// @generated message type with reflection information, may provide speed optimized methods
class RateLimitTransfers$Type extends MessageType<RateLimitTransfers> {
    constructor() {
        super("injective.peggy.v1.RateLimitTransfers", [
            { no: 1, name: "token", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "inflows", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => BlockTransferRecord },
            { no: 3, name: "outflows", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => BlockTransferRecord }
        ]);
    }
    create(value?: PartialMessage<RateLimitTransfers>): RateLimitTransfers {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.token = "";
        message.inflows = [];
        message.outflows = [];
        if (value !== undefined)
            reflectionMergePartial<RateLimitTransfers>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: RateLimitTransfers): RateLimitTransfers {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string token */ 1:
                    message.token = reader.string();
                    break;
                case /* repeated injective.peggy.v1.BlockTransferRecord inflows */ 2:
                    message.inflows.push(BlockTransferRecord.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* repeated injective.peggy.v1.BlockTransferRecord outflows */ 3:
                    message.outflows.push(BlockTransferRecord.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message: RateLimitTransfers, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string token = 1; */
        if (message.token !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.token);
        /* repeated injective.peggy.v1.BlockTransferRecord inflows = 2; */
        for (let i = 0; i < message.inflows.length; i++)
            BlockTransferRecord.internalBinaryWrite(message.inflows[i], writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* repeated injective.peggy.v1.BlockTransferRecord outflows = 3; */
        for (let i = 0; i < message.outflows.length; i++)
            BlockTransferRecord.internalBinaryWrite(message.outflows[i], writer.tag(3, WireType.LengthDelimited).fork(), options).join();
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message injective.peggy.v1.RateLimitTransfers
 */
export const RateLimitTransfers = new RateLimitTransfers$Type();
// @generated message type with reflection information, may provide speed optimized methods
class BlockTransferRecord$Type extends MessageType<BlockTransferRecord> {
    constructor() {
        super("injective.peggy.v1.BlockTransferRecord", [
            { no: 1, name: "block_number", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
            { no: 2, name: "amount", kind: "scalar", T: 9 /*ScalarType.STRING*/, options: { "gogoproto.nullable": false, "gogoproto.customtype": "cosmossdk.io/math.Int" } }
        ]);
    }
    create(value?: PartialMessage<BlockTransferRecord>): BlockTransferRecord {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.blockNumber = 0n;
        message.amount = "";
        if (value !== undefined)
            reflectionMergePartial<BlockTransferRecord>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: BlockTransferRecord): BlockTransferRecord {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* uint64 block_number */ 1:
                    message.blockNumber = reader.uint64().toBigInt();
                    break;
                case /* string amount */ 2:
                    message.amount = reader.string();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message: BlockTransferRecord, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* uint64 block_number = 1; */
        if (message.blockNumber !== 0n)
            writer.tag(1, WireType.Varint).uint64(message.blockNumber);
        /* string amount = 2; */
        if (message.amount !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.amount);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message injective.peggy.v1.BlockTransferRecord
 */
export const BlockTransferRecord = new BlockTransferRecord$Type();
// @generated message type with reflection information, may provide speed optimized methods
class MintAmount$Type extends MessageType<MintAmount> {
    constructor() {
        super("injective.peggy.v1.MintAmount", [
            { no: 1, name: "token", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "amount", kind: "scalar", T: 9 /*ScalarType.STRING*/, options: { "gogoproto.nullable": false, "gogoproto.customtype": "cosmossdk.io/math.Int" } }
        ]);
    }
    create(value?: PartialMessage<MintAmount>): MintAmount {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.token = "";
        message.amount = "";
        if (value !== undefined)
            reflectionMergePartial<MintAmount>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MintAmount): MintAmount {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string token */ 1:
                    message.token = reader.string();
                    break;
                case /* string amount */ 2:
                    message.amount = reader.string();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message: MintAmount, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string token = 1; */
        if (message.token !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.token);
        /* string amount = 2; */
        if (message.amount !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.amount);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message injective.peggy.v1.MintAmount
 */
export const MintAmount = new MintAmount$Type();
