diff --git a/.gitignore b/.gitignore index dc1a312..a1ebaea 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ node_modules/ /protos/feemarket /protos/ibc-go /protos/neutron -/protos/slinky +/protos/connect /protos/wasmd /build/ @@ -25,7 +25,7 @@ node_modules/ /neutron/ /osmosis/ /sdk/ -/slinky/ +/connect/ /tendermint/ /binary.* /helpers.* diff --git a/.gitmodules b/.gitmodules index 64cb390..ea6382e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,9 +16,9 @@ [submodule "neutron"] path = protos/neutron-src url = git@github.com:neutron-org/neutron.git -[submodule "slinky"] - path = protos/slinky-src - url = git@github.com:skip-mev/slinky.git [submodule "wasmd"] path = protos/wasmd-src url = git@github.com:neutron-org/wasmd.git +[submodule "protos/connect-src"] + path = protos/connect-src + url = git@github.com:skip-mev/connect.git diff --git a/package.json b/package.json index ef5cda5..18525ae 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "neutron/", "osmosis/", "sdk/", - "slinky/", + "connect/", "tendermint/", "/binary.*", "/helpers.*", diff --git a/protos/block-sdk-src b/protos/block-sdk-src index 1ea62f3..7c8b78e 160000 --- a/protos/block-sdk-src +++ b/protos/block-sdk-src @@ -1 +1 @@ -Subproject commit 1ea62f3eed1927073562600ba25915f323ee15a3 +Subproject commit 7c8b78ee0fcd67e56dda86cebac1b449300d45f6 diff --git a/protos/connect-src b/protos/connect-src new file mode 160000 index 0000000..1508062 --- /dev/null +++ b/protos/connect-src @@ -0,0 +1 @@ +Subproject commit 1508062c5eb8165bac4754b24ff093af3c584367 diff --git a/protos/feemarket-src b/protos/feemarket-src index f1f216e..a529a71 160000 --- a/protos/feemarket-src +++ b/protos/feemarket-src @@ -1 +1 @@ -Subproject commit f1f216e15aa6bcc05075a7079496764820a0f545 +Subproject commit a529a71c7c9eb2e1edb821031e68098cb475695d diff --git a/protos/ibc-go-src b/protos/ibc-go-src index 6b25543..bd4dda0 160000 --- a/protos/ibc-go-src +++ b/protos/ibc-go-src @@ -1 +1 @@ -Subproject commit 6b2554360c0e3f0bbaa59da5b16b29fc05675c57 +Subproject commit bd4dda03734edf68741ace4b74a3fb1c93f3cdb1 diff --git a/protos/neutron-src b/protos/neutron-src index a319222..f54aa03 160000 --- a/protos/neutron-src +++ b/protos/neutron-src @@ -1 +1 @@ -Subproject commit a319222034843a91c9d6500dc75f7b633debfa45 +Subproject commit f54aa031df614e2f8dd47a394556f4b1fdf3bf03 diff --git a/protos/slinky-src b/protos/slinky-src deleted file mode 160000 index ef03f40..0000000 --- a/protos/slinky-src +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ef03f402c6ece9e26479c6f6cc9bf59e9fefc2d6 diff --git a/protos/wasmd-src b/protos/wasmd-src index 465a2a8..e51ea20 160000 --- a/protos/wasmd-src +++ b/protos/wasmd-src @@ -1 +1 @@ -Subproject commit 465a2a832752030837f9319ad8261bbd219d9cbb +Subproject commit e51ea20c5399615033a214577b33baa8fe101cc5 diff --git a/scripts/clean.sh b/scripts/clean.sh index 6461edf..71cd577 100755 --- a/scripts/clean.sh +++ b/scripts/clean.sh @@ -3,7 +3,7 @@ set -o errexit -o nounset -o pipefail command -v shellcheck >/dev/null && shellcheck "$0" -DIRS=(capability cosmos cosmos_proto cosmwasm feemarket gaia gogoproto google ibc neutron osmosis sdk slinky tendermint) +DIRS=(capability cosmos cosmos_proto cosmwasm feemarket gaia gogoproto google ibc neutron osmosis sdk connect tendermint) FILES=( binary.d.ts binary.js @@ -36,6 +36,6 @@ done rm -rf ./build -for dir in admin-module block-sdk cosmos-sdk feemarket ibc-go neutron slinky wasmd ; do +for dir in admin-module block-sdk cosmos-sdk feemarket ibc-go neutron connect wasmd ; do rm -rf "protos/$dir" done diff --git a/scripts/codegen.js b/scripts/codegen.js index f3a9850..29130e2 100755 --- a/scripts/codegen.js +++ b/scripts/codegen.js @@ -13,7 +13,7 @@ telescope({ "protos/feemarket", "protos/ibc-go", "protos/neutron", - "protos/slinky", + "protos/connect", "protos/wasmd", ], outPath: outPath, @@ -21,7 +21,11 @@ telescope({ logLevel: 0, useSDKTypes: false, tsDisable: { - files: ["slinky/oracle/v1/query.ts"], + files: [ + "connect/oracle/v2/query.ts", + "connect/marketmap/v2/tx.ts", + "connect/abci/v2/vote_extensions.ts", + ], }, eslintDisable: { disableAll: true, @@ -43,8 +47,8 @@ telescope({ protos: [ "neutron/dex/genesis.proto", "neutron/transfer/v1/query.proto", - "slinky/abci/v1/vote_extensions.proto", - "slinky/marketmap/v1/tx.proto", + "connect/abci/v1/vote_extensions.proto", + "connect/marketmap/v1/tx.proto", ], packages: ["google.api"], }, diff --git a/scripts/exports_protos.sh b/scripts/exports_protos.sh index 71f099e..12ac594 100755 --- a/scripts/exports_protos.sh +++ b/scripts/exports_protos.sh @@ -11,7 +11,7 @@ for dir in admin-module cosmos-sdk ibc-go wasmd ; do buf export "protos/$dir-src/" --output "protos/$dir" done -for dir in block-sdk feemarket slinky ; do +for dir in block-sdk feemarket connect ; do rm -rf "protos/$dir" mkdir -p "protos/$dir" echo "Autogenerated folder, see export_protos.sh" > "protos/$dir/README.md" @@ -19,6 +19,8 @@ for dir in block-sdk feemarket slinky ; do buf export "protos/$dir-src/proto" --output "protos/$dir" done +sed -i '' '/additional_bindings : \[\]/d' protos/connect/connect/oracle/v2/query.proto + for dir in neutron ; do rm -rf "protos/$dir" mkdir -p "protos/$dir" diff --git a/scripts/prepare-publishing.sh b/scripts/prepare-publishing.sh index fbf42e4..b6330f7 100755 --- a/scripts/prepare-publishing.sh +++ b/scripts/prepare-publishing.sh @@ -3,7 +3,7 @@ set -o errexit -o nounset -o pipefail command -v shellcheck >/dev/null && shellcheck "$0" -DIRS=(capability cosmos cosmos_proto cosmwasm feemarket gaia gogoproto google ibc neutron osmosis sdk slinky tendermint) +DIRS=(capability cosmos cosmos_proto cosmwasm feemarket gaia gogoproto google ibc neutron osmosis sdk connect tendermint) FILES=( binary.d.ts binary.js diff --git a/scripts/set-versions.sh b/scripts/set-versions.sh index fc33602..8e5e469 100755 --- a/scripts/set-versions.sh +++ b/scripts/set-versions.sh @@ -9,7 +9,7 @@ readonly COSMOS_SDK_DIR="cosmos-sdk-src" readonly FEEMARKET_DIR="feemarket-src" readonly IBC_GO_DIR="ibc-go-src" readonly NEUTRON_DIR="neutron-src" -readonly SLINKY_DIR="slinky-src" +readonly CONNECT_DIR="connect-src" readonly WASMD_DIR="wasmd-src" readonly ADMIN_MODULE_REV="v2.0.2" @@ -17,9 +17,9 @@ readonly BLOCK_SDK_REV="v2.1.5" readonly COSMOS_SDK_REV="v0.50.9-neutron" readonly FEEMARKET_REV="v1.1.1" readonly IBC_GO_REV="v8.5.1" -readonly NEUTRON_REV="main" -readonly SLINKY_REV="v1.0.12" -readonly WASMD_REV="v0.51.2-neutron" +readonly NEUTRON_REV="chore/ics-v6" +readonly CONNECT_REV="v2.0.1" +readonly WASMD_REV="v0.53.0-neutron" checkout_version () { git -C protos/$1 checkout $2 @@ -31,5 +31,5 @@ checkout_version $COSMOS_SDK_DIR $COSMOS_SDK_REV checkout_version $FEEMARKET_DIR $FEEMARKET_REV checkout_version $IBC_GO_DIR $IBC_GO_REV checkout_version $NEUTRON_DIR $NEUTRON_REV -checkout_version $SLINKY_DIR $SLINKY_REV +checkout_version $CONNECT_DIR $CONNECT_REV checkout_version $WASMD_DIR $WASMD_REV diff --git a/src/connect/abci/v2/vote_extensions.ts b/src/connect/abci/v2/vote_extensions.ts new file mode 100644 index 0000000..30b6b69 --- /dev/null +++ b/src/connect/abci/v2/vote_extensions.ts @@ -0,0 +1,157 @@ +//@ts-nocheck +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, Exact, isObject } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +export const protobufPackage = "connect.abci.v2"; +export interface OracleVoteExtension_PricesEntry { + key: bigint; + value: Uint8Array; +} +/** OracleVoteExtension defines the vote extension structure for oracle prices. */ +export interface OracleVoteExtension { + /** + * Prices defines a map of id(CurrencyPair) -> price.Bytes() . i.e. 1 -> + * 0x123.. (bytes). Notice the `id` function is determined by the + * `CurrencyPairIDStrategy` used in the VoteExtensionHandler. + */ + prices: { + [key: bigint]: Uint8Array; + }; +} +function createBaseOracleVoteExtension_PricesEntry(): OracleVoteExtension_PricesEntry { + return { + key: BigInt(0), + value: new Uint8Array(), + }; +} +export const OracleVoteExtension_PricesEntry = { + encode( + message: OracleVoteExtension_PricesEntry, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.key !== BigInt(0)) { + writer.uint32(8).uint64(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): OracleVoteExtension_PricesEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOracleVoteExtension_PricesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.uint64(); + break; + case 2: + message.value = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): OracleVoteExtension_PricesEntry { + const obj = createBaseOracleVoteExtension_PricesEntry(); + if (isSet(object.key)) obj.key = BigInt(object.key.toString()); + if (isSet(object.value)) obj.value = bytesFromBase64(object.value); + return obj; + }, + toJSON(message: OracleVoteExtension_PricesEntry): JsonSafe { + const obj: any = {}; + message.key !== undefined && (obj.key = (message.key || BigInt(0)).toString()); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + return obj; + }, + fromPartial, I>>( + object: I, + ): OracleVoteExtension_PricesEntry { + const message = createBaseOracleVoteExtension_PricesEntry(); + if (object.key !== undefined && object.key !== null) { + message.key = BigInt(object.key.toString()); + } + message.value = object.value ?? new Uint8Array(); + return message; + }, +}; +function createBaseOracleVoteExtension(): OracleVoteExtension { + return { + prices: {}, + }; +} +export const OracleVoteExtension = { + typeUrl: "/connect.abci.v2.OracleVoteExtension", + encode(message: OracleVoteExtension, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + Object.entries(message.prices).forEach(([key, value]) => { + OracleVoteExtension_PricesEntry.encode( + { + key: key as any, + value, + }, + writer.uint32(10).fork(), + ).ldelim(); + }); + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): OracleVoteExtension { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOracleVoteExtension(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + const entry1 = OracleVoteExtension_PricesEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.prices[entry1.key] = entry1.value; + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): OracleVoteExtension { + const obj = createBaseOracleVoteExtension(); + if (isObject(object.prices)) + obj.prices = Object.entries(object.prices).reduce<{ + [key: bigint]: bytes; + }>((acc, [key, value]) => { + acc[Number(key)] = bytes.fromJSON(value); + return acc; + }, {}); + return obj; + }, + toJSON(message: OracleVoteExtension): JsonSafe { + const obj: any = {}; + obj.prices = {}; + if (message.prices) { + Object.entries(message.prices).forEach(([k, v]) => { + obj.prices[k] = bytes.toJSON(v); + }); + } + return obj; + }, + fromPartial, I>>(object: I): OracleVoteExtension { + const message = createBaseOracleVoteExtension(); + message.prices = Object.entries(object.prices ?? {}).reduce<{ + [key: bigint]: bytes; + }>((acc, [key, value]) => { + if (value !== undefined) { + acc[Number(key)] = bytes.fromPartial(value); + } + return acc; + }, {}); + return message; + }, +}; diff --git a/src/slinky/marketmap/module/v1/module.ts b/src/connect/marketmap/module/v2/module.ts similarity index 95% rename from src/slinky/marketmap/module/v1/module.ts rename to src/connect/marketmap/module/v2/module.ts index 41c9296..e30f85f 100644 --- a/src/slinky/marketmap/module/v1/module.ts +++ b/src/connect/marketmap/module/v2/module.ts @@ -2,7 +2,7 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial, Exact } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; -export const protobufPackage = "slinky.marketmap.module.v1"; +export const protobufPackage = "connect.marketmap.module.v2"; /** Module is the config object of the builder module. */ export interface Module { /** @@ -24,7 +24,7 @@ function createBaseModule(): Module { }; } export const Module = { - typeUrl: "/slinky.marketmap.module.v1.Module", + typeUrl: "/connect.marketmap.module.v2.Module", encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.authority !== "") { writer.uint32(10).string(message.authority); diff --git a/src/slinky/marketmap/v1/genesis.ts b/src/connect/marketmap/v2/genesis.ts similarity index 97% rename from src/slinky/marketmap/v1/genesis.ts rename to src/connect/marketmap/v2/genesis.ts index f50ad60..d68f720 100644 --- a/src/slinky/marketmap/v1/genesis.ts +++ b/src/connect/marketmap/v2/genesis.ts @@ -4,7 +4,7 @@ import { Params } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, Exact } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -export const protobufPackage = "slinky.marketmap.v1"; +export const protobufPackage = "connect.marketmap.v2"; /** GenesisState defines the x/marketmap module's genesis state. */ export interface GenesisState { /** @@ -29,7 +29,7 @@ function createBaseGenesisState(): GenesisState { }; } export const GenesisState = { - typeUrl: "/slinky.marketmap.v1.GenesisState", + typeUrl: "/connect.marketmap.v2.GenesisState", encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.marketMap !== undefined) { MarketMap.encode(message.marketMap, writer.uint32(10).fork()).ldelim(); diff --git a/src/slinky/marketmap/v1/market.ts b/src/connect/marketmap/v2/market.ts similarity index 98% rename from src/slinky/marketmap/v1/market.ts rename to src/connect/marketmap/v2/market.ts index 98d26dc..9a242a0 100644 --- a/src/slinky/marketmap/v1/market.ts +++ b/src/connect/marketmap/v2/market.ts @@ -1,9 +1,9 @@ /* eslint-disable */ -import { CurrencyPair } from "../../types/v1/currency_pair"; +import { CurrencyPair } from "../../types/v2/currency_pair"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, Exact, isObject } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -export const protobufPackage = "slinky.marketmap.v1"; +export const protobufPackage = "connect.marketmap.v2"; /** Market encapsulates a Ticker and its provider-specific configuration. */ export interface Market { /** @@ -95,7 +95,7 @@ function createBaseMarket(): Market { }; } export const Market = { - typeUrl: "/slinky.marketmap.v1.Market", + typeUrl: "/connect.marketmap.v2.Market", encode(message: Market, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.ticker !== undefined) { Ticker.encode(message.ticker, writer.uint32(10).fork()).ldelim(); @@ -161,7 +161,7 @@ function createBaseTicker(): Ticker { }; } export const Ticker = { - typeUrl: "/slinky.marketmap.v1.Ticker", + typeUrl: "/connect.marketmap.v2.Ticker", encode(message: Ticker, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.currencyPair !== undefined) { CurrencyPair.encode(message.currencyPair, writer.uint32(10).fork()).ldelim(); @@ -255,7 +255,7 @@ function createBaseProviderConfig(): ProviderConfig { }; } export const ProviderConfig = { - typeUrl: "/slinky.marketmap.v1.ProviderConfig", + typeUrl: "/connect.marketmap.v2.ProviderConfig", encode(message: ProviderConfig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); @@ -399,7 +399,7 @@ function createBaseMarketMap(): MarketMap { }; } export const MarketMap = { - typeUrl: "/slinky.marketmap.v1.MarketMap", + typeUrl: "/connect.marketmap.v2.MarketMap", encode(message: MarketMap, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { Object.entries(message.markets).forEach(([key, value]) => { MarketMap_MarketsEntry.encode( diff --git a/src/slinky/marketmap/v1/params.ts b/src/connect/marketmap/v2/params.ts similarity index 96% rename from src/slinky/marketmap/v1/params.ts rename to src/connect/marketmap/v2/params.ts index b37f65d..8b08dfe 100644 --- a/src/slinky/marketmap/v1/params.ts +++ b/src/connect/marketmap/v2/params.ts @@ -2,7 +2,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, Exact } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -export const protobufPackage = "slinky.marketmap.v1"; +export const protobufPackage = "connect.marketmap.v2"; /** Params defines the parameters for the x/marketmap module. */ export interface Params { /** @@ -23,7 +23,7 @@ function createBaseParams(): Params { }; } export const Params = { - typeUrl: "/slinky.marketmap.v1.Params", + typeUrl: "/connect.marketmap.v2.Params", encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.marketAuthorities) { writer.uint32(10).string(v!); diff --git a/src/slinky/marketmap/v1/query.rpc.Query.ts b/src/connect/marketmap/v2/query.rpc.Query.ts similarity index 89% rename from src/slinky/marketmap/v1/query.rpc.Query.ts rename to src/connect/marketmap/v2/query.rpc.Query.ts index 254db55..0a0d937 100644 --- a/src/slinky/marketmap/v1/query.rpc.Query.ts +++ b/src/connect/marketmap/v2/query.rpc.Query.ts @@ -40,22 +40,22 @@ export class QueryClientImpl implements Query { } marketMap(request: MarketMapRequest = {}): Promise { const data = MarketMapRequest.encode(request).finish(); - const promise = this.rpc.request("slinky.marketmap.v1.Query", "MarketMap", data); + const promise = this.rpc.request("connect.marketmap.v2.Query", "MarketMap", data); return promise.then((data) => MarketMapResponse.decode(new BinaryReader(data))); } market(request: MarketRequest): Promise { const data = MarketRequest.encode(request).finish(); - const promise = this.rpc.request("slinky.marketmap.v1.Query", "Market", data); + const promise = this.rpc.request("connect.marketmap.v2.Query", "Market", data); return promise.then((data) => MarketResponse.decode(new BinaryReader(data))); } lastUpdated(request: LastUpdatedRequest = {}): Promise { const data = LastUpdatedRequest.encode(request).finish(); - const promise = this.rpc.request("slinky.marketmap.v1.Query", "LastUpdated", data); + const promise = this.rpc.request("connect.marketmap.v2.Query", "LastUpdated", data); return promise.then((data) => LastUpdatedResponse.decode(new BinaryReader(data))); } params(request: ParamsRequest = {}): Promise { const data = ParamsRequest.encode(request).finish(); - const promise = this.rpc.request("slinky.marketmap.v1.Query", "Params", data); + const promise = this.rpc.request("connect.marketmap.v2.Query", "Params", data); return promise.then((data) => ParamsResponse.decode(new BinaryReader(data))); } } diff --git a/src/slinky/marketmap/v1/query.ts b/src/connect/marketmap/v2/query.ts similarity index 96% rename from src/slinky/marketmap/v1/query.ts rename to src/connect/marketmap/v2/query.ts index ce5d867..ed5c58e 100644 --- a/src/slinky/marketmap/v1/query.ts +++ b/src/connect/marketmap/v2/query.ts @@ -1,11 +1,11 @@ /* eslint-disable */ -import { CurrencyPair } from "../../types/v1/currency_pair"; +import { CurrencyPair } from "../../types/v2/currency_pair"; import { MarketMap, Market } from "./market"; import { Params } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, Exact, isSet } from "../../../helpers"; -export const protobufPackage = "slinky.marketmap.v1"; +export const protobufPackage = "connect.marketmap.v2"; /** * MarketMapRequest is the query request for the MarketMap query. * It takes no arguments. @@ -65,7 +65,7 @@ function createBaseMarketMapRequest(): MarketMapRequest { return {}; } export const MarketMapRequest = { - typeUrl: "/slinky.marketmap.v1.MarketMapRequest", + typeUrl: "/connect.marketmap.v2.MarketMapRequest", encode(_: MarketMapRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -104,7 +104,7 @@ function createBaseMarketMapResponse(): MarketMapResponse { }; } export const MarketMapResponse = { - typeUrl: "/slinky.marketmap.v1.MarketMapResponse", + typeUrl: "/connect.marketmap.v2.MarketMapResponse", encode(message: MarketMapResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.marketMap !== undefined) { MarketMap.encode(message.marketMap, writer.uint32(10).fork()).ldelim(); @@ -173,7 +173,7 @@ function createBaseMarketRequest(): MarketRequest { }; } export const MarketRequest = { - typeUrl: "/slinky.marketmap.v1.MarketRequest", + typeUrl: "/connect.marketmap.v2.MarketRequest", encode(message: MarketRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.currencyPair !== undefined) { CurrencyPair.encode(message.currencyPair, writer.uint32(10).fork()).ldelim(); @@ -222,7 +222,7 @@ function createBaseMarketResponse(): MarketResponse { }; } export const MarketResponse = { - typeUrl: "/slinky.marketmap.v1.MarketResponse", + typeUrl: "/connect.marketmap.v2.MarketResponse", encode(message: MarketResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.market !== undefined) { Market.encode(message.market, writer.uint32(10).fork()).ldelim(); @@ -268,7 +268,7 @@ function createBaseParamsRequest(): ParamsRequest { return {}; } export const ParamsRequest = { - typeUrl: "/slinky.marketmap.v1.ParamsRequest", + typeUrl: "/connect.marketmap.v2.ParamsRequest", encode(_: ParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -305,7 +305,7 @@ function createBaseParamsResponse(): ParamsResponse { }; } export const ParamsResponse = { - typeUrl: "/slinky.marketmap.v1.ParamsResponse", + typeUrl: "/connect.marketmap.v2.ParamsResponse", encode(message: ParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.params !== undefined) { Params.encode(message.params, writer.uint32(10).fork()).ldelim(); @@ -351,7 +351,7 @@ function createBaseLastUpdatedRequest(): LastUpdatedRequest { return {}; } export const LastUpdatedRequest = { - typeUrl: "/slinky.marketmap.v1.LastUpdatedRequest", + typeUrl: "/connect.marketmap.v2.LastUpdatedRequest", encode(_: LastUpdatedRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -388,7 +388,7 @@ function createBaseLastUpdatedResponse(): LastUpdatedResponse { }; } export const LastUpdatedResponse = { - typeUrl: "/slinky.marketmap.v1.LastUpdatedResponse", + typeUrl: "/connect.marketmap.v2.LastUpdatedResponse", encode(message: LastUpdatedResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.lastUpdated !== BigInt(0)) { writer.uint32(8).uint64(message.lastUpdated); diff --git a/src/connect/marketmap/v2/tx.rpc.msg.ts b/src/connect/marketmap/v2/tx.rpc.msg.ts new file mode 100644 index 0000000..e43d38b --- /dev/null +++ b/src/connect/marketmap/v2/tx.rpc.msg.ts @@ -0,0 +1,74 @@ +/* eslint-disable */ +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { + MsgCreateMarkets, + MsgCreateMarketsResponse, + MsgUpdateMarkets, + MsgUpdateMarketsResponse, + MsgParams, + MsgParamsResponse, + MsgRemoveMarketAuthorities, + MsgRemoveMarketAuthoritiesResponse, + MsgUpsertMarkets, + MsgUpsertMarketsResponse, +} from "./tx"; +/** Msg is the message service for the x/marketmap module. */ +export interface Msg { + /** CreateMarkets creates markets from the given message. */ + createMarkets(request: MsgCreateMarkets): Promise; + /** UpdateMarkets updates markets from the given message. */ + updateMarkets(request: MsgUpdateMarkets): Promise; + /** + * UpdateParams defines a method for updating the x/marketmap module + * parameters. + */ + updateParams(request: MsgParams): Promise; + /** + * RemoveMarketAuthorities defines a method for removing market authorities + * from the x/marketmap module. the signer must be the admin. + */ + removeMarketAuthorities(request: MsgRemoveMarketAuthorities): Promise; + /** + * UpsertMarkets wraps both Create / Update markets into a single message. + * Specifically if a market does not exist it will be created, otherwise it + * will be updated. The response will be a map between ticker -> updated. + */ + upsertMarkets(request: MsgUpsertMarkets): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.createMarkets = this.createMarkets.bind(this); + this.updateMarkets = this.updateMarkets.bind(this); + this.updateParams = this.updateParams.bind(this); + this.removeMarketAuthorities = this.removeMarketAuthorities.bind(this); + this.upsertMarkets = this.upsertMarkets.bind(this); + } + createMarkets(request: MsgCreateMarkets): Promise { + const data = MsgCreateMarkets.encode(request).finish(); + const promise = this.rpc.request("connect.marketmap.v2.Msg", "CreateMarkets", data); + return promise.then((data) => MsgCreateMarketsResponse.decode(new BinaryReader(data))); + } + updateMarkets(request: MsgUpdateMarkets): Promise { + const data = MsgUpdateMarkets.encode(request).finish(); + const promise = this.rpc.request("connect.marketmap.v2.Msg", "UpdateMarkets", data); + return promise.then((data) => MsgUpdateMarketsResponse.decode(new BinaryReader(data))); + } + updateParams(request: MsgParams): Promise { + const data = MsgParams.encode(request).finish(); + const promise = this.rpc.request("connect.marketmap.v2.Msg", "UpdateParams", data); + return promise.then((data) => MsgParamsResponse.decode(new BinaryReader(data))); + } + removeMarketAuthorities(request: MsgRemoveMarketAuthorities): Promise { + const data = MsgRemoveMarketAuthorities.encode(request).finish(); + const promise = this.rpc.request("connect.marketmap.v2.Msg", "RemoveMarketAuthorities", data); + return promise.then((data) => MsgRemoveMarketAuthoritiesResponse.decode(new BinaryReader(data))); + } + upsertMarkets(request: MsgUpsertMarkets): Promise { + const data = MsgUpsertMarkets.encode(request).finish(); + const promise = this.rpc.request("connect.marketmap.v2.Msg", "UpsertMarkets", data); + return promise.then((data) => MsgUpsertMarketsResponse.decode(new BinaryReader(data))); + } +} diff --git a/src/connect/marketmap/v2/tx.ts b/src/connect/marketmap/v2/tx.ts new file mode 100644 index 0000000..c884261 --- /dev/null +++ b/src/connect/marketmap/v2/tx.ts @@ -0,0 +1,695 @@ +//@ts-nocheck +/* eslint-disable */ +import { Market } from "./market"; +import { Params } from "./params"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial, Exact, isObject } from "../../../helpers"; +import { JsonSafe } from "../../../json-safe"; +export const protobufPackage = "connect.marketmap.v2"; +/** + * MsgUpsertMarkets defines a message carrying a payload for performing market + * upserts (update or create if does not exist) in the x/marketmap module. + */ +export interface MsgUpsertMarkets { + /** + * Authority is the signer of this transaction. This authority must be + * authorized by the module to execute the message. + */ + authority: string; + /** + * CreateMarkets is the list of all markets to be created for the given + * transaction. + */ + markets: Market[]; +} +export interface MsgUpsertMarketsResponse_MarketUpdatesEntry { + key: string; + value: boolean; +} +/** + * MsgUpsertMarketsResponse is the response from the UpsertMarkets API in the + * x/marketmap module. + */ +export interface MsgUpsertMarketsResponse { + /** + * UpdatedMarkets is a map between the ticker and whether the market was + * updated. + * Deprecated: This field will be empty in all responses. + */ + /** @deprecated */ + marketUpdates: { + [key: string]: boolean; + }; +} +/** + * MsgCreateMarkets defines a message carrying a payload for creating markets in + * the x/marketmap module. + */ +export interface MsgCreateMarkets { + /** + * Authority is the signer of this transaction. This authority must be + * authorized by the module to execute the message. + */ + authority: string; + /** + * CreateMarkets is the list of all markets to be created for the given + * transaction. + */ + createMarkets: Market[]; +} +/** MsgUpdateMarketMapResponse is the response message for MsgUpdateMarketMap. */ +export interface MsgCreateMarketsResponse {} +/** + * MsgUpdateMarkets defines a message carrying a payload for updating the + * x/marketmap module. + */ +export interface MsgUpdateMarkets { + /** + * Authority is the signer of this transaction. This authority must be + * authorized by the module to execute the message. + */ + authority: string; + /** + * UpdateMarkets is the list of all markets to be updated for the given + * transaction. + */ + updateMarkets: Market[]; +} +/** MsgUpdateMarketsResponse is the response message for MsgUpdateMarkets. */ +export interface MsgUpdateMarketsResponse {} +/** + * MsgParams defines the Msg/Params request type. It contains the + * new parameters for the x/marketmap module. + */ +export interface MsgParams { + /** Params defines the new parameters for the x/marketmap module. */ + params: Params; + /** + * Authority defines the authority that is updating the x/marketmap module + * parameters. + */ + authority: string; +} +/** MsgParamsResponse defines the Msg/Params response type. */ +export interface MsgParamsResponse {} +/** + * MsgRemoveMarketAuthorities defines the Msg/RemoveMarketAuthoritiesResponse + * request type. It contains the new addresses to remove from the list of + * authorities + */ +export interface MsgRemoveMarketAuthorities { + /** RemoveAddresses is the list of addresses to remove. */ + removeAddresses: string[]; + /** + * Admin defines the authority that is the x/marketmap + * Admin account. This account is set in the module parameters. + */ + admin: string; +} +/** + * MsgRemoveMarketAuthoritiesResponse defines the + * Msg/RemoveMarketAuthoritiesResponse response type. + */ +export interface MsgRemoveMarketAuthoritiesResponse {} +function createBaseMsgUpsertMarkets(): MsgUpsertMarkets { + return { + authority: "", + markets: [], + }; +} +export const MsgUpsertMarkets = { + typeUrl: "/connect.marketmap.v2.MsgUpsertMarkets", + encode(message: MsgUpsertMarkets, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.markets) { + Market.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpsertMarkets { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpsertMarkets(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.markets.push(Market.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgUpsertMarkets { + const obj = createBaseMsgUpsertMarkets(); + if (isSet(object.authority)) obj.authority = String(object.authority); + if (Array.isArray(object?.markets)) obj.markets = object.markets.map((e: any) => Market.fromJSON(e)); + return obj; + }, + toJSON(message: MsgUpsertMarkets): JsonSafe { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + if (message.markets) { + obj.markets = message.markets.map((e) => (e ? Market.toJSON(e) : undefined)); + } else { + obj.markets = []; + } + return obj; + }, + fromPartial, I>>(object: I): MsgUpsertMarkets { + const message = createBaseMsgUpsertMarkets(); + message.authority = object.authority ?? ""; + message.markets = object.markets?.map((e) => Market.fromPartial(e)) || []; + return message; + }, +}; +function createBaseMsgUpsertMarketsResponse_MarketUpdatesEntry(): MsgUpsertMarketsResponse_MarketUpdatesEntry { + return { + key: "", + value: false, + }; +} +export const MsgUpsertMarketsResponse_MarketUpdatesEntry = { + encode( + message: MsgUpsertMarketsResponse_MarketUpdatesEntry, + writer: BinaryWriter = BinaryWriter.create(), + ): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value === true) { + writer.uint32(16).bool(message.value); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpsertMarketsResponse_MarketUpdatesEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpsertMarketsResponse_MarketUpdatesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + message.value = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgUpsertMarketsResponse_MarketUpdatesEntry { + const obj = createBaseMsgUpsertMarketsResponse_MarketUpdatesEntry(); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.value)) obj.value = Boolean(object.value); + return obj; + }, + toJSON( + message: MsgUpsertMarketsResponse_MarketUpdatesEntry, + ): JsonSafe { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + fromPartial, I>>( + object: I, + ): MsgUpsertMarketsResponse_MarketUpdatesEntry { + const message = createBaseMsgUpsertMarketsResponse_MarketUpdatesEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? false; + return message; + }, +}; +function createBaseMsgUpsertMarketsResponse(): MsgUpsertMarketsResponse { + return { + marketUpdates: {}, + }; +} +export const MsgUpsertMarketsResponse = { + typeUrl: "/connect.marketmap.v2.MsgUpsertMarketsResponse", + encode(message: MsgUpsertMarketsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + Object.entries(message.marketUpdates).forEach(([key, value]) => { + MsgUpsertMarketsResponse_MarketUpdatesEntry.encode( + { + key: key as any, + value, + }, + writer.uint32(8).fork(), + ).ldelim(); + }); + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpsertMarketsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpsertMarketsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + const entry1 = MsgUpsertMarketsResponse_MarketUpdatesEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.marketUpdates[entry1.key] = entry1.value; + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgUpsertMarketsResponse { + const obj = createBaseMsgUpsertMarketsResponse(); + if (isObject(object.marketUpdates)) + obj.marketUpdates = Object.entries(object.marketUpdates).reduce<{ + [key: string]: bool; + }>((acc, [key, value]) => { + acc[key] = bool.fromJSON(value); + return acc; + }, {}); + return obj; + }, + toJSON(message: MsgUpsertMarketsResponse): JsonSafe { + const obj: any = {}; + obj.marketUpdates = {}; + if (message.marketUpdates) { + Object.entries(message.marketUpdates).forEach(([k, v]) => { + obj.marketUpdates[k] = bool.toJSON(v); + }); + } + return obj; + }, + fromPartial, I>>( + object: I, + ): MsgUpsertMarketsResponse { + const message = createBaseMsgUpsertMarketsResponse(); + message.marketUpdates = Object.entries(object.marketUpdates ?? {}).reduce<{ + [key: string]: bool; + }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = bool.fromPartial(value); + } + return acc; + }, {}); + return message; + }, +}; +function createBaseMsgCreateMarkets(): MsgCreateMarkets { + return { + authority: "", + createMarkets: [], + }; +} +export const MsgCreateMarkets = { + typeUrl: "/connect.marketmap.v2.MsgCreateMarkets", + encode(message: MsgCreateMarkets, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.createMarkets) { + Market.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateMarkets { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateMarkets(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.createMarkets.push(Market.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgCreateMarkets { + const obj = createBaseMsgCreateMarkets(); + if (isSet(object.authority)) obj.authority = String(object.authority); + if (Array.isArray(object?.createMarkets)) + obj.createMarkets = object.createMarkets.map((e: any) => Market.fromJSON(e)); + return obj; + }, + toJSON(message: MsgCreateMarkets): JsonSafe { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + if (message.createMarkets) { + obj.createMarkets = message.createMarkets.map((e) => (e ? Market.toJSON(e) : undefined)); + } else { + obj.createMarkets = []; + } + return obj; + }, + fromPartial, I>>(object: I): MsgCreateMarkets { + const message = createBaseMsgCreateMarkets(); + message.authority = object.authority ?? ""; + message.createMarkets = object.createMarkets?.map((e) => Market.fromPartial(e)) || []; + return message; + }, +}; +function createBaseMsgCreateMarketsResponse(): MsgCreateMarketsResponse { + return {}; +} +export const MsgCreateMarketsResponse = { + typeUrl: "/connect.marketmap.v2.MsgCreateMarketsResponse", + encode(_: MsgCreateMarketsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateMarketsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateMarketsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgCreateMarketsResponse { + const obj = createBaseMsgCreateMarketsResponse(); + return obj; + }, + toJSON(_: MsgCreateMarketsResponse): JsonSafe { + const obj: any = {}; + return obj; + }, + fromPartial, I>>(_: I): MsgCreateMarketsResponse { + const message = createBaseMsgCreateMarketsResponse(); + return message; + }, +}; +function createBaseMsgUpdateMarkets(): MsgUpdateMarkets { + return { + authority: "", + updateMarkets: [], + }; +} +export const MsgUpdateMarkets = { + typeUrl: "/connect.marketmap.v2.MsgUpdateMarkets", + encode(message: MsgUpdateMarkets, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.updateMarkets) { + Market.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateMarkets { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateMarkets(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.updateMarkets.push(Market.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgUpdateMarkets { + const obj = createBaseMsgUpdateMarkets(); + if (isSet(object.authority)) obj.authority = String(object.authority); + if (Array.isArray(object?.updateMarkets)) + obj.updateMarkets = object.updateMarkets.map((e: any) => Market.fromJSON(e)); + return obj; + }, + toJSON(message: MsgUpdateMarkets): JsonSafe { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + if (message.updateMarkets) { + obj.updateMarkets = message.updateMarkets.map((e) => (e ? Market.toJSON(e) : undefined)); + } else { + obj.updateMarkets = []; + } + return obj; + }, + fromPartial, I>>(object: I): MsgUpdateMarkets { + const message = createBaseMsgUpdateMarkets(); + message.authority = object.authority ?? ""; + message.updateMarkets = object.updateMarkets?.map((e) => Market.fromPartial(e)) || []; + return message; + }, +}; +function createBaseMsgUpdateMarketsResponse(): MsgUpdateMarketsResponse { + return {}; +} +export const MsgUpdateMarketsResponse = { + typeUrl: "/connect.marketmap.v2.MsgUpdateMarketsResponse", + encode(_: MsgUpdateMarketsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateMarketsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateMarketsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgUpdateMarketsResponse { + const obj = createBaseMsgUpdateMarketsResponse(); + return obj; + }, + toJSON(_: MsgUpdateMarketsResponse): JsonSafe { + const obj: any = {}; + return obj; + }, + fromPartial, I>>(_: I): MsgUpdateMarketsResponse { + const message = createBaseMsgUpdateMarketsResponse(); + return message; + }, +}; +function createBaseMsgParams(): MsgParams { + return { + params: Params.fromPartial({}), + authority: "", + }; +} +export const MsgParams = { + typeUrl: "/connect.marketmap.v2.MsgParams", + encode(message: MsgParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + case 2: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgParams { + const obj = createBaseMsgParams(); + if (isSet(object.params)) obj.params = Params.fromJSON(object.params); + if (isSet(object.authority)) obj.authority = String(object.authority); + return obj; + }, + toJSON(message: MsgParams): JsonSafe { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + message.authority !== undefined && (obj.authority = message.authority); + return obj; + }, + fromPartial, I>>(object: I): MsgParams { + const message = createBaseMsgParams(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromPartial(object.params); + } + message.authority = object.authority ?? ""; + return message; + }, +}; +function createBaseMsgParamsResponse(): MsgParamsResponse { + return {}; +} +export const MsgParamsResponse = { + typeUrl: "/connect.marketmap.v2.MsgParamsResponse", + encode(_: MsgParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgParamsResponse { + const obj = createBaseMsgParamsResponse(); + return obj; + }, + toJSON(_: MsgParamsResponse): JsonSafe { + const obj: any = {}; + return obj; + }, + fromPartial, I>>(_: I): MsgParamsResponse { + const message = createBaseMsgParamsResponse(); + return message; + }, +}; +function createBaseMsgRemoveMarketAuthorities(): MsgRemoveMarketAuthorities { + return { + removeAddresses: [], + admin: "", + }; +} +export const MsgRemoveMarketAuthorities = { + typeUrl: "/connect.marketmap.v2.MsgRemoveMarketAuthorities", + encode(message: MsgRemoveMarketAuthorities, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.removeAddresses) { + writer.uint32(10).string(v!); + } + if (message.admin !== "") { + writer.uint32(18).string(message.admin); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRemoveMarketAuthorities { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRemoveMarketAuthorities(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.removeAddresses.push(reader.string()); + break; + case 2: + message.admin = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgRemoveMarketAuthorities { + const obj = createBaseMsgRemoveMarketAuthorities(); + if (Array.isArray(object?.removeAddresses)) + obj.removeAddresses = object.removeAddresses.map((e: any) => String(e)); + if (isSet(object.admin)) obj.admin = String(object.admin); + return obj; + }, + toJSON(message: MsgRemoveMarketAuthorities): JsonSafe { + const obj: any = {}; + if (message.removeAddresses) { + obj.removeAddresses = message.removeAddresses.map((e) => e); + } else { + obj.removeAddresses = []; + } + message.admin !== undefined && (obj.admin = message.admin); + return obj; + }, + fromPartial, I>>( + object: I, + ): MsgRemoveMarketAuthorities { + const message = createBaseMsgRemoveMarketAuthorities(); + message.removeAddresses = object.removeAddresses?.map((e) => e) || []; + message.admin = object.admin ?? ""; + return message; + }, +}; +function createBaseMsgRemoveMarketAuthoritiesResponse(): MsgRemoveMarketAuthoritiesResponse { + return {}; +} +export const MsgRemoveMarketAuthoritiesResponse = { + typeUrl: "/connect.marketmap.v2.MsgRemoveMarketAuthoritiesResponse", + encode(_: MsgRemoveMarketAuthoritiesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRemoveMarketAuthoritiesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRemoveMarketAuthoritiesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgRemoveMarketAuthoritiesResponse { + const obj = createBaseMsgRemoveMarketAuthoritiesResponse(); + return obj; + }, + toJSON(_: MsgRemoveMarketAuthoritiesResponse): JsonSafe { + const obj: any = {}; + return obj; + }, + fromPartial, I>>( + _: I, + ): MsgRemoveMarketAuthoritiesResponse { + const message = createBaseMsgRemoveMarketAuthoritiesResponse(); + return message; + }, +}; diff --git a/src/slinky/oracle/module/v1/module.ts b/src/connect/oracle/module/v2/module.ts similarity index 94% rename from src/slinky/oracle/module/v1/module.ts rename to src/connect/oracle/module/v2/module.ts index 2f38dae..e6428cb 100644 --- a/src/slinky/oracle/module/v1/module.ts +++ b/src/connect/oracle/module/v2/module.ts @@ -2,7 +2,7 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; import { isSet, DeepPartial, Exact } from "../../../../helpers"; import { JsonSafe } from "../../../../json-safe"; -export const protobufPackage = "slinky.oracle.module.v1"; +export const protobufPackage = "connect.oracle.module.v2"; /** Module is the config object of the builder module. */ export interface Module { /** @@ -17,7 +17,7 @@ function createBaseModule(): Module { }; } export const Module = { - typeUrl: "/slinky.oracle.module.v1.Module", + typeUrl: "/connect.oracle.module.v2.Module", encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.authority !== "") { writer.uint32(10).string(message.authority); diff --git a/src/slinky/oracle/v1/genesis.ts b/src/connect/oracle/v2/genesis.ts similarity index 97% rename from src/slinky/oracle/v1/genesis.ts rename to src/connect/oracle/v2/genesis.ts index 0f59579..4bb1845 100644 --- a/src/slinky/oracle/v1/genesis.ts +++ b/src/connect/oracle/v2/genesis.ts @@ -1,10 +1,10 @@ /* eslint-disable */ import { Timestamp } from "../../../google/protobuf/timestamp"; -import { CurrencyPair } from "../../types/v1/currency_pair"; +import { CurrencyPair } from "../../types/v2/currency_pair"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, fromJsonTimestamp, fromTimestamp, DeepPartial, Exact } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -export const protobufPackage = "slinky.oracle.v1"; +export const protobufPackage = "connect.oracle.v2"; /** * QuotePrice is the representation of the aggregated prices for a CurrencyPair, * where price represents the price of Base in terms of Quote @@ -77,7 +77,7 @@ function createBaseQuotePrice(): QuotePrice { }; } export const QuotePrice = { - typeUrl: "/slinky.oracle.v1.QuotePrice", + typeUrl: "/connect.oracle.v2.QuotePrice", encode(message: QuotePrice, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.price !== "") { writer.uint32(10).string(message.price); @@ -148,7 +148,7 @@ function createBaseCurrencyPairState(): CurrencyPairState { }; } export const CurrencyPairState = { - typeUrl: "/slinky.oracle.v1.CurrencyPairState", + typeUrl: "/connect.oracle.v2.CurrencyPairState", encode(message: CurrencyPairState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.price !== undefined) { QuotePrice.encode(message.price, writer.uint32(10).fork()).ldelim(); @@ -221,7 +221,7 @@ function createBaseCurrencyPairGenesis(): CurrencyPairGenesis { }; } export const CurrencyPairGenesis = { - typeUrl: "/slinky.oracle.v1.CurrencyPairGenesis", + typeUrl: "/connect.oracle.v2.CurrencyPairGenesis", encode(message: CurrencyPairGenesis, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.currencyPair !== undefined) { CurrencyPair.encode(message.currencyPair, writer.uint32(10).fork()).ldelim(); @@ -308,7 +308,7 @@ function createBaseGenesisState(): GenesisState { }; } export const GenesisState = { - typeUrl: "/slinky.oracle.v1.GenesisState", + typeUrl: "/connect.oracle.v2.GenesisState", encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.currencyPairGenesis) { CurrencyPairGenesis.encode(v!, writer.uint32(10).fork()).ldelim(); diff --git a/src/slinky/oracle/v1/query.rpc.Query.ts b/src/connect/oracle/v2/query.rpc.Query.ts similarity index 90% rename from src/slinky/oracle/v1/query.rpc.Query.ts rename to src/connect/oracle/v2/query.rpc.Query.ts index 9f6bf3b..69cbdc4 100644 --- a/src/slinky/oracle/v1/query.rpc.Query.ts +++ b/src/connect/oracle/v2/query.rpc.Query.ts @@ -40,24 +40,24 @@ export class QueryClientImpl implements Query { } getAllCurrencyPairs(request: GetAllCurrencyPairsRequest = {}): Promise { const data = GetAllCurrencyPairsRequest.encode(request).finish(); - const promise = this.rpc.request("slinky.oracle.v1.Query", "GetAllCurrencyPairs", data); + const promise = this.rpc.request("connect.oracle.v2.Query", "GetAllCurrencyPairs", data); return promise.then((data) => GetAllCurrencyPairsResponse.decode(new BinaryReader(data))); } getPrice(request: GetPriceRequest): Promise { const data = GetPriceRequest.encode(request).finish(); - const promise = this.rpc.request("slinky.oracle.v1.Query", "GetPrice", data); + const promise = this.rpc.request("connect.oracle.v2.Query", "GetPrice", data); return promise.then((data) => GetPriceResponse.decode(new BinaryReader(data))); } getPrices(request: GetPricesRequest): Promise { const data = GetPricesRequest.encode(request).finish(); - const promise = this.rpc.request("slinky.oracle.v1.Query", "GetPrices", data); + const promise = this.rpc.request("connect.oracle.v2.Query", "GetPrices", data); return promise.then((data) => GetPricesResponse.decode(new BinaryReader(data))); } getCurrencyPairMapping( request: GetCurrencyPairMappingRequest = {}, ): Promise { const data = GetCurrencyPairMappingRequest.encode(request).finish(); - const promise = this.rpc.request("slinky.oracle.v1.Query", "GetCurrencyPairMapping", data); + const promise = this.rpc.request("connect.oracle.v2.Query", "GetCurrencyPairMapping", data); return promise.then((data) => GetCurrencyPairMappingResponse.decode(new BinaryReader(data))); } } diff --git a/src/slinky/oracle/v1/query.ts b/src/connect/oracle/v2/query.ts similarity index 93% rename from src/slinky/oracle/v1/query.ts rename to src/connect/oracle/v2/query.ts index 9b74fc6..478e176 100644 --- a/src/slinky/oracle/v1/query.ts +++ b/src/connect/oracle/v2/query.ts @@ -1,11 +1,11 @@ //@ts-nocheck /* eslint-disable */ -import { CurrencyPair } from "../../types/v1/currency_pair"; +import { CurrencyPair } from "../../types/v2/currency_pair"; import { QuotePrice } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, Exact, isSet, isObject } from "../../../helpers"; -export const protobufPackage = "slinky.oracle.v1"; +export const protobufPackage = "connect.oracle.v2"; export interface GetAllCurrencyPairsRequest {} /** * GetAllCurrencyPairsResponse returns all CurrencyPairs that the module is @@ -15,12 +15,12 @@ export interface GetAllCurrencyPairsResponse { currencyPairs: CurrencyPair[]; } /** - * GetPriceRequest either takes a CurrencyPair, or an identifier for the + * GetPriceRequest takes an identifier for the * CurrencyPair in the format base/quote. */ export interface GetPriceRequest { /** CurrencyPair represents the pair that the user wishes to query. */ - currencyPair: CurrencyPair; + currencyPair: string; } /** * GetPriceResponse is the response from the GetPrice grpc method exposed from @@ -36,8 +36,7 @@ export interface GetPriceResponse { nonce: bigint; /** * decimals represents the number of decimals that the quote-price is - * represented in. For Pairs where ETHEREUM is the quote this will be 18, - * otherwise it will be 8. + * represented in. It is used to scale the QuotePrice to its proper value. */ decimals: bigint; /** ID represents the identifier for the CurrencyPair. */ @@ -77,7 +76,7 @@ function createBaseGetAllCurrencyPairsRequest(): GetAllCurrencyPairsRequest { return {}; } export const GetAllCurrencyPairsRequest = { - typeUrl: "/slinky.oracle.v1.GetAllCurrencyPairsRequest", + typeUrl: "/connect.oracle.v2.GetAllCurrencyPairsRequest", encode(_: GetAllCurrencyPairsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -114,7 +113,7 @@ function createBaseGetAllCurrencyPairsResponse(): GetAllCurrencyPairsResponse { }; } export const GetAllCurrencyPairsResponse = { - typeUrl: "/slinky.oracle.v1.GetAllCurrencyPairsResponse", + typeUrl: "/connect.oracle.v2.GetAllCurrencyPairsResponse", encode(message: GetAllCurrencyPairsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.currencyPairs) { CurrencyPair.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -163,14 +162,14 @@ export const GetAllCurrencyPairsResponse = { }; function createBaseGetPriceRequest(): GetPriceRequest { return { - currencyPair: CurrencyPair.fromPartial({}), + currencyPair: "", }; } export const GetPriceRequest = { - typeUrl: "/slinky.oracle.v1.GetPriceRequest", + typeUrl: "/connect.oracle.v2.GetPriceRequest", encode(message: GetPriceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.currencyPair !== undefined) { - CurrencyPair.encode(message.currencyPair, writer.uint32(10).fork()).ldelim(); + if (message.currencyPair !== "") { + writer.uint32(10).string(message.currencyPair); } return writer; }, @@ -182,7 +181,7 @@ export const GetPriceRequest = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.currencyPair = CurrencyPair.decode(reader, reader.uint32()); + message.currencyPair = reader.string(); break; default: reader.skipType(tag & 7); @@ -193,20 +192,17 @@ export const GetPriceRequest = { }, fromJSON(object: any): GetPriceRequest { const obj = createBaseGetPriceRequest(); - if (isSet(object.currencyPair)) obj.currencyPair = CurrencyPair.fromJSON(object.currencyPair); + if (isSet(object.currencyPair)) obj.currencyPair = String(object.currencyPair); return obj; }, toJSON(message: GetPriceRequest): JsonSafe { const obj: any = {}; - message.currencyPair !== undefined && - (obj.currencyPair = message.currencyPair ? CurrencyPair.toJSON(message.currencyPair) : undefined); + message.currencyPair !== undefined && (obj.currencyPair = message.currencyPair); return obj; }, fromPartial, I>>(object: I): GetPriceRequest { const message = createBaseGetPriceRequest(); - if (object.currencyPair !== undefined && object.currencyPair !== null) { - message.currencyPair = CurrencyPair.fromPartial(object.currencyPair); - } + message.currencyPair = object.currencyPair ?? ""; return message; }, }; @@ -219,7 +215,7 @@ function createBaseGetPriceResponse(): GetPriceResponse { }; } export const GetPriceResponse = { - typeUrl: "/slinky.oracle.v1.GetPriceResponse", + typeUrl: "/connect.oracle.v2.GetPriceResponse", encode(message: GetPriceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.price !== undefined) { QuotePrice.encode(message.price, writer.uint32(10).fork()).ldelim(); @@ -300,7 +296,7 @@ function createBaseGetPricesRequest(): GetPricesRequest { }; } export const GetPricesRequest = { - typeUrl: "/slinky.oracle.v1.GetPricesRequest", + typeUrl: "/connect.oracle.v2.GetPricesRequest", encode(message: GetPricesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.currencyPairIds) { writer.uint32(10).string(v!); @@ -351,7 +347,7 @@ function createBaseGetPricesResponse(): GetPricesResponse { }; } export const GetPricesResponse = { - typeUrl: "/slinky.oracle.v1.GetPricesResponse", + typeUrl: "/connect.oracle.v2.GetPricesResponse", encode(message: GetPricesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { for (const v of message.prices) { GetPriceResponse.encode(v!, writer.uint32(10).fork()).ldelim(); @@ -400,7 +396,7 @@ function createBaseGetCurrencyPairMappingRequest(): GetCurrencyPairMappingReques return {}; } export const GetCurrencyPairMappingRequest = { - typeUrl: "/slinky.oracle.v1.GetCurrencyPairMappingRequest", + typeUrl: "/connect.oracle.v2.GetCurrencyPairMappingRequest", encode(_: GetCurrencyPairMappingRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -509,7 +505,7 @@ function createBaseGetCurrencyPairMappingResponse(): GetCurrencyPairMappingRespo }; } export const GetCurrencyPairMappingResponse = { - typeUrl: "/slinky.oracle.v1.GetCurrencyPairMappingResponse", + typeUrl: "/connect.oracle.v2.GetCurrencyPairMappingResponse", encode( message: GetCurrencyPairMappingResponse, writer: BinaryWriter = BinaryWriter.create(), diff --git a/src/slinky/oracle/v1/tx.rpc.msg.ts b/src/connect/oracle/v2/tx.rpc.msg.ts similarity index 90% rename from src/slinky/oracle/v1/tx.rpc.msg.ts rename to src/connect/oracle/v2/tx.rpc.msg.ts index 99cda53..f27fc52 100644 --- a/src/slinky/oracle/v1/tx.rpc.msg.ts +++ b/src/connect/oracle/v2/tx.rpc.msg.ts @@ -31,12 +31,12 @@ export class MsgClientImpl implements Msg { } addCurrencyPairs(request: MsgAddCurrencyPairs): Promise { const data = MsgAddCurrencyPairs.encode(request).finish(); - const promise = this.rpc.request("slinky.oracle.v1.Msg", "AddCurrencyPairs", data); + const promise = this.rpc.request("connect.oracle.v2.Msg", "AddCurrencyPairs", data); return promise.then((data) => MsgAddCurrencyPairsResponse.decode(new BinaryReader(data))); } removeCurrencyPairs(request: MsgRemoveCurrencyPairs): Promise { const data = MsgRemoveCurrencyPairs.encode(request).finish(); - const promise = this.rpc.request("slinky.oracle.v1.Msg", "RemoveCurrencyPairs", data); + const promise = this.rpc.request("connect.oracle.v2.Msg", "RemoveCurrencyPairs", data); return promise.then((data) => MsgRemoveCurrencyPairsResponse.decode(new BinaryReader(data))); } } diff --git a/src/slinky/oracle/v1/tx.ts b/src/connect/oracle/v2/tx.ts similarity index 96% rename from src/slinky/oracle/v1/tx.ts rename to src/connect/oracle/v2/tx.ts index 91a3534..48a1ee2 100644 --- a/src/slinky/oracle/v1/tx.ts +++ b/src/connect/oracle/v2/tx.ts @@ -1,9 +1,9 @@ /* eslint-disable */ -import { CurrencyPair } from "../../types/v1/currency_pair"; +import { CurrencyPair } from "../../types/v2/currency_pair"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, Exact } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -export const protobufPackage = "slinky.oracle.v1"; +export const protobufPackage = "connect.oracle.v2"; /** * Given an authority + a set of CurrencyPairs, the x/oracle module will * check to see that the authority has permissions to update the set of @@ -50,7 +50,7 @@ function createBaseMsgAddCurrencyPairs(): MsgAddCurrencyPairs { }; } export const MsgAddCurrencyPairs = { - typeUrl: "/slinky.oracle.v1.MsgAddCurrencyPairs", + typeUrl: "/connect.oracle.v2.MsgAddCurrencyPairs", encode(message: MsgAddCurrencyPairs, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.authority !== "") { writer.uint32(10).string(message.authority); @@ -108,7 +108,7 @@ function createBaseMsgAddCurrencyPairsResponse(): MsgAddCurrencyPairsResponse { return {}; } export const MsgAddCurrencyPairsResponse = { - typeUrl: "/slinky.oracle.v1.MsgAddCurrencyPairsResponse", + typeUrl: "/connect.oracle.v2.MsgAddCurrencyPairsResponse", encode(_: MsgAddCurrencyPairsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -148,7 +148,7 @@ function createBaseMsgRemoveCurrencyPairs(): MsgRemoveCurrencyPairs { }; } export const MsgRemoveCurrencyPairs = { - typeUrl: "/slinky.oracle.v1.MsgRemoveCurrencyPairs", + typeUrl: "/connect.oracle.v2.MsgRemoveCurrencyPairs", encode(message: MsgRemoveCurrencyPairs, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.authority !== "") { writer.uint32(10).string(message.authority); @@ -206,7 +206,7 @@ function createBaseMsgRemoveCurrencyPairsResponse(): MsgRemoveCurrencyPairsRespo return {}; } export const MsgRemoveCurrencyPairsResponse = { - typeUrl: "/slinky.oracle.v1.MsgRemoveCurrencyPairsResponse", + typeUrl: "/connect.oracle.v2.MsgRemoveCurrencyPairsResponse", encode(_: MsgRemoveCurrencyPairsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, diff --git a/src/slinky/rpc.query.ts b/src/connect/rpc.query.ts similarity index 88% rename from src/slinky/rpc.query.ts rename to src/connect/rpc.query.ts index 3743fab..7d7a8de 100644 --- a/src/slinky/rpc.query.ts +++ b/src/connect/rpc.query.ts @@ -91,21 +91,12 @@ export const createRPCQueryClient = async ({ rpcEndpoint }: { rpcEndpoint: strin v1beta1: (await import("../cosmos/upgrade/v1beta1/query.rpc.Query")).createRpcQueryExtension(client), }, }, - slinky: { - alerts: { - v1: (await import("./alerts/v1/query.rpc.Query")).createRpcQueryExtension(client), - }, - incentives: { - v1: (await import("./incentives/v1/query.rpc.Query")).createRpcQueryExtension(client), - }, + connect: { marketmap: { - v1: (await import("./marketmap/v1/query.rpc.Query")).createRpcQueryExtension(client), + v2: (await import("./marketmap/v2/query.rpc.Query")).createRpcQueryExtension(client), }, oracle: { - v1: (await import("./oracle/v1/query.rpc.Query")).createRpcQueryExtension(client), - }, - sla: { - v1: (await import("./sla/v1/query.rpc.Query")).createRpcQueryExtension(client), + v2: (await import("./oracle/v2/query.rpc.Query")).createRpcQueryExtension(client), }, }, }; diff --git a/src/slinky/rpc.tx.ts b/src/connect/rpc.tx.ts similarity index 90% rename from src/slinky/rpc.tx.ts rename to src/connect/rpc.tx.ts index ba5e966..60c3a67 100644 --- a/src/slinky/rpc.tx.ts +++ b/src/connect/rpc.tx.ts @@ -58,15 +58,12 @@ export const createRPCMsgClient = async ({ rpc }: { rpc: Rpc }) => ({ v1beta1: new (await import("../cosmos/vesting/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc), }, }, - slinky: { - alerts: { - v1: new (await import("./alerts/v1/tx.rpc.msg")).MsgClientImpl(rpc), + connect: { + marketmap: { + v2: new (await import("./marketmap/v2/tx.rpc.msg")).MsgClientImpl(rpc), }, oracle: { - v1: new (await import("./oracle/v1/tx.rpc.msg")).MsgClientImpl(rpc), - }, - sla: { - v1: new (await import("./sla/v1/tx.rpc.msg")).MsgClientImpl(rpc), + v2: new (await import("./oracle/v2/tx.rpc.msg")).MsgClientImpl(rpc), }, }, }); diff --git a/src/slinky/service/v1/oracle.ts b/src/connect/service/v2/oracle.ts similarity index 96% rename from src/slinky/service/v1/oracle.ts rename to src/connect/service/v2/oracle.ts index 4e0a688..f7c12fd 100644 --- a/src/slinky/service/v1/oracle.ts +++ b/src/connect/service/v2/oracle.ts @@ -1,10 +1,10 @@ /* eslint-disable */ import { Timestamp } from "../../../google/protobuf/timestamp"; -import { MarketMap } from "../../marketmap/v1/market"; +import { MarketMap } from "../../marketmap/v2/market"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { JsonSafe } from "../../../json-safe"; import { DeepPartial, Exact, isSet, isObject, fromJsonTimestamp, fromTimestamp } from "../../../helpers"; -export const protobufPackage = "slinky.service.v1"; +export const protobufPackage = "connect.service.v2"; /** QueryPricesRequest defines the request type for the the Prices method. */ export interface QueryPricesRequest {} export interface QueryPricesResponse_PricesEntry { @@ -40,7 +40,7 @@ function createBaseQueryPricesRequest(): QueryPricesRequest { return {}; } export const QueryPricesRequest = { - typeUrl: "/slinky.service.v1.QueryPricesRequest", + typeUrl: "/connect.service.v2.QueryPricesRequest", encode(_: QueryPricesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -139,7 +139,7 @@ function createBaseQueryPricesResponse(): QueryPricesResponse { }; } export const QueryPricesResponse = { - typeUrl: "/slinky.service.v1.QueryPricesResponse", + typeUrl: "/connect.service.v2.QueryPricesResponse", encode(message: QueryPricesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { Object.entries(message.prices).forEach(([key, value]) => { QueryPricesResponse_PricesEntry.encode( @@ -230,7 +230,7 @@ function createBaseQueryMarketMapRequest(): QueryMarketMapRequest { return {}; } export const QueryMarketMapRequest = { - typeUrl: "/slinky.service.v1.QueryMarketMapRequest", + typeUrl: "/connect.service.v2.QueryMarketMapRequest", encode(_: QueryMarketMapRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -267,7 +267,7 @@ function createBaseQueryMarketMapResponse(): QueryMarketMapResponse { }; } export const QueryMarketMapResponse = { - typeUrl: "/slinky.service.v1.QueryMarketMapResponse", + typeUrl: "/connect.service.v2.QueryMarketMapResponse", encode(message: QueryMarketMapResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.marketMap !== undefined) { MarketMap.encode(message.marketMap, writer.uint32(10).fork()).ldelim(); @@ -314,7 +314,7 @@ function createBaseQueryVersionRequest(): QueryVersionRequest { return {}; } export const QueryVersionRequest = { - typeUrl: "/slinky.service.v1.QueryVersionRequest", + typeUrl: "/connect.service.v2.QueryVersionRequest", encode(_: QueryVersionRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { return writer; }, @@ -351,7 +351,7 @@ function createBaseQueryVersionResponse(): QueryVersionResponse { }; } export const QueryVersionResponse = { - typeUrl: "/slinky.service.v1.QueryVersionResponse", + typeUrl: "/connect.service.v2.QueryVersionResponse", encode(message: QueryVersionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.version !== "") { writer.uint32(10).string(message.version); diff --git a/src/slinky/types/v1/currency_pair.ts b/src/connect/types/v2/currency_pair.ts similarity index 95% rename from src/slinky/types/v1/currency_pair.ts rename to src/connect/types/v2/currency_pair.ts index de2f1e9..0092dc2 100644 --- a/src/slinky/types/v1/currency_pair.ts +++ b/src/connect/types/v2/currency_pair.ts @@ -2,7 +2,7 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, DeepPartial, Exact } from "../../../helpers"; import { JsonSafe } from "../../../json-safe"; -export const protobufPackage = "slinky.types.v1"; +export const protobufPackage = "connect.types.v2"; /** * CurrencyPair is the standard representation of a pair of assets, where one * (Base) is priced in terms of the other (Quote) @@ -18,7 +18,7 @@ function createBaseCurrencyPair(): CurrencyPair { }; } export const CurrencyPair = { - typeUrl: "/slinky.types.v1.CurrencyPair", + typeUrl: "/connect.types.v2.CurrencyPair", encode(message: CurrencyPair, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { if (message.base !== "") { writer.uint32(10).string(message.base); diff --git a/src/cosmwasm/wasm/v1/ibc.ts b/src/cosmwasm/wasm/v1/ibc.ts index 56c3614..76ec2bd 100644 --- a/src/cosmwasm/wasm/v1/ibc.ts +++ b/src/cosmwasm/wasm/v1/ibc.ts @@ -28,6 +28,8 @@ export interface MsgIBCSendResponse { /** Sequence number of the IBC packet sent */ sequence: bigint; } +/** MsgIBCWriteAcknowledgementResponse */ +export interface MsgIBCWriteAcknowledgementResponse {} /** MsgIBCCloseChannel port and channel need to be owned by the contract */ export interface MsgIBCCloseChannel { channel: string; @@ -163,6 +165,43 @@ export const MsgIBCSendResponse = { return message; }, }; +function createBaseMsgIBCWriteAcknowledgementResponse(): MsgIBCWriteAcknowledgementResponse { + return {}; +} +export const MsgIBCWriteAcknowledgementResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgIBCWriteAcknowledgementResponse", + encode(_: MsgIBCWriteAcknowledgementResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgIBCWriteAcknowledgementResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIBCWriteAcknowledgementResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgIBCWriteAcknowledgementResponse { + const obj = createBaseMsgIBCWriteAcknowledgementResponse(); + return obj; + }, + toJSON(_: MsgIBCWriteAcknowledgementResponse): JsonSafe { + const obj: any = {}; + return obj; + }, + fromPartial, I>>( + _: I, + ): MsgIBCWriteAcknowledgementResponse { + const message = createBaseMsgIBCWriteAcknowledgementResponse(); + return message; + }, +}; function createBaseMsgIBCCloseChannel(): MsgIBCCloseChannel { return { channel: "", diff --git a/src/cosmwasm/wasm/v1/tx.ts b/src/cosmwasm/wasm/v1/tx.ts index 4371f5b..d95f988 100644 --- a/src/cosmwasm/wasm/v1/tx.ts +++ b/src/cosmwasm/wasm/v1/tx.ts @@ -51,7 +51,7 @@ export interface MsgInstantiateContractResponse { } /** * MsgInstantiateContract2 create a new smart contract instance for the given - * code id with a predicable address. + * code id with a predictable address. */ export interface MsgInstantiateContract2 { /** Sender is the that actor that signed the messages */ diff --git a/src/slinky/alerts/module/v1/module.ts b/src/slinky/alerts/module/v1/module.ts deleted file mode 100644 index d858151..0000000 --- a/src/slinky/alerts/module/v1/module.ts +++ /dev/null @@ -1,60 +0,0 @@ -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../../helpers"; -import { JsonSafe } from "../../../../json-safe"; -export const protobufPackage = "slinky.alerts.module.v1"; -/** Module is the config object of the alerts module. */ -export interface Module { - /** - * Authority defines the custom module authority. The authority will default - * to the governance module account if not set. If the authority is set, the - * address provided must be a valid bech-32 address - */ - authority: string; -} -function createBaseModule(): Module { - return { - authority: "", - }; -} -export const Module = { - typeUrl: "/slinky.alerts.module.v1.Module", - encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.authority !== "") { - writer.uint32(10).string(message.authority); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): Module { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseModule(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.authority = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): Module { - const obj = createBaseModule(); - if (isSet(object.authority)) obj.authority = String(object.authority); - return obj; - }, - toJSON(message: Module): JsonSafe { - const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - return obj; - }, - fromPartial, I>>(object: I): Module { - const message = createBaseModule(); - message.authority = object.authority ?? ""; - return message; - }, -}; diff --git a/src/slinky/alerts/v1/alerts.ts b/src/slinky/alerts/v1/alerts.ts deleted file mode 100644 index 735c701..0000000 --- a/src/slinky/alerts/v1/alerts.ts +++ /dev/null @@ -1,615 +0,0 @@ -/* eslint-disable */ -import { CurrencyPair } from "../../types/v1/currency_pair"; -import { ExtendedCommitInfo } from "../../../tendermint/abci/types"; -import { Any } from "../../../google/protobuf/any"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, bytesFromBase64, base64FromBytes } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -export const protobufPackage = "slinky.alerts.v1"; -/** - * Alert defines the basic meta-data necessary for the alerts module to resolve - * a claim that the price of a CurrencyPair on-chain is deviating from the price - * off-chain. - */ -export interface Alert { - /** height represents the height for which the alert is filed. */ - height: bigint; - /** - * signer is the signer of this alert, this is the address that will receive - * the reward in the case of a positive conclusion, or whose bond will get - * slashed in the event of a negative conclusion. - */ - signer: string; - /** - * currency_pair is the currency-pair that this claim asserts is deviating - * from the price off-chain. - */ - currencyPair: CurrencyPair; -} -/** - * AlertStatus contains the module specific state for an alert: Has the alert - * been concluded? What height was the alert submitted, what height should the - * alert be purged? - */ -export interface AlertStatus { - /** ConclusionStatus determines whether the alert has been concluded. */ - conclusionStatus: bigint; - /** SubmissionHeight is the height that the alert was submitted in. */ - submissionHeight: bigint; - /** - * SubmissionTimestamp is the block-timestamp of the block that the alert was - * submitted in (as a UTC value in Unix time). - */ - submissionTimestamp: bigint; - /** PurgeHeight is the height at which the alert should be purged. */ - purgeHeight: bigint; -} -/** - * AlertWithStatus represents a wrapper around the Alert and AlertStatus - * objects, this is so that the module specific information about Alerts can be - * packaged together. - */ -export interface AlertWithStatus { - /** alert is the alert that this status corresponds to. */ - alert: Alert; - /** status is the status of the alert. */ - status: AlertStatus; -} -/** Signature is a container for a signer address mapped to a signature. */ -export interface Signature { - signer: string; - signature: Uint8Array; -} -/** - * MultiSigConcluson defines a conclusion that is accompanied by a set of - * signatures. The signature is defined over the alert UID, status, OracleData, - * and PriceBound. The signatures are used to verify that the conclusion is - * valid. - */ -export interface MultiSigConclusion { - /** alert is the alert that this conclusion corresponds to. */ - alert: Alert; - /** oracle_data is the oracle data that this conclusion references. */ - extendedCommitInfo: ExtendedCommitInfo; - /** - * signatures is a map of signer -> signature. Where the signature is over - * Alert.UID, PriceBound, the marshalled ExtendedCommitInfo, and status. - */ - signatures: Signature[]; - /** - * price-bound is the price bound of the currency-pair off-chain for the - * designated time-range. - */ - priceBound: PriceBound; - /** status is the status of the conclusion. */ - status: boolean; - /** - * CurrencyPairID is the ID of the currency-pair that this conclusion - * corresponds to. - */ - currencyPairID: bigint; -} -/** - * MultiSigConclusionVerificationParams defines the parameters necessary to - * verify a MultiSigConclusion. It contains a map between signer and public key. - * Notice, the public-key (value) are the base-64 encoded bytes of the public - * key. And the signer (key) is the bech32 encoded address of the signer. - * Notice, all public keys must be secp256 keys. - */ -export interface MultiSigConclusionVerificationParams { - /** signers is a map of signer -> public key. */ - signers: Any[]; -} -/** - * PriceBound represents the bounds of the price of a currency-pair off chain - * for a designated time-range - */ -export interface PriceBound { - high: string; - low: string; -} -function createBaseAlert(): Alert { - return { - height: BigInt(0), - signer: "", - currencyPair: CurrencyPair.fromPartial({}), - }; -} -export const Alert = { - typeUrl: "/slinky.alerts.v1.Alert", - encode(message: Alert, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.height !== BigInt(0)) { - writer.uint32(8).uint64(message.height); - } - if (message.signer !== "") { - writer.uint32(18).string(message.signer); - } - if (message.currencyPair !== undefined) { - CurrencyPair.encode(message.currencyPair, writer.uint32(26).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): Alert { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAlert(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.height = reader.uint64(); - break; - case 2: - message.signer = reader.string(); - break; - case 3: - message.currencyPair = CurrencyPair.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): Alert { - const obj = createBaseAlert(); - if (isSet(object.height)) obj.height = BigInt(object.height.toString()); - if (isSet(object.signer)) obj.signer = String(object.signer); - if (isSet(object.currencyPair)) obj.currencyPair = CurrencyPair.fromJSON(object.currencyPair); - return obj; - }, - toJSON(message: Alert): JsonSafe { - const obj: any = {}; - message.height !== undefined && (obj.height = (message.height || BigInt(0)).toString()); - message.signer !== undefined && (obj.signer = message.signer); - message.currencyPair !== undefined && - (obj.currencyPair = message.currencyPair ? CurrencyPair.toJSON(message.currencyPair) : undefined); - return obj; - }, - fromPartial, I>>(object: I): Alert { - const message = createBaseAlert(); - if (object.height !== undefined && object.height !== null) { - message.height = BigInt(object.height.toString()); - } - message.signer = object.signer ?? ""; - if (object.currencyPair !== undefined && object.currencyPair !== null) { - message.currencyPair = CurrencyPair.fromPartial(object.currencyPair); - } - return message; - }, -}; -function createBaseAlertStatus(): AlertStatus { - return { - conclusionStatus: BigInt(0), - submissionHeight: BigInt(0), - submissionTimestamp: BigInt(0), - purgeHeight: BigInt(0), - }; -} -export const AlertStatus = { - typeUrl: "/slinky.alerts.v1.AlertStatus", - encode(message: AlertStatus, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.conclusionStatus !== BigInt(0)) { - writer.uint32(8).uint64(message.conclusionStatus); - } - if (message.submissionHeight !== BigInt(0)) { - writer.uint32(16).uint64(message.submissionHeight); - } - if (message.submissionTimestamp !== BigInt(0)) { - writer.uint32(24).uint64(message.submissionTimestamp); - } - if (message.purgeHeight !== BigInt(0)) { - writer.uint32(32).uint64(message.purgeHeight); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AlertStatus { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAlertStatus(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.conclusionStatus = reader.uint64(); - break; - case 2: - message.submissionHeight = reader.uint64(); - break; - case 3: - message.submissionTimestamp = reader.uint64(); - break; - case 4: - message.purgeHeight = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AlertStatus { - const obj = createBaseAlertStatus(); - if (isSet(object.conclusionStatus)) obj.conclusionStatus = BigInt(object.conclusionStatus.toString()); - if (isSet(object.submissionHeight)) obj.submissionHeight = BigInt(object.submissionHeight.toString()); - if (isSet(object.submissionTimestamp)) - obj.submissionTimestamp = BigInt(object.submissionTimestamp.toString()); - if (isSet(object.purgeHeight)) obj.purgeHeight = BigInt(object.purgeHeight.toString()); - return obj; - }, - toJSON(message: AlertStatus): JsonSafe { - const obj: any = {}; - message.conclusionStatus !== undefined && - (obj.conclusionStatus = (message.conclusionStatus || BigInt(0)).toString()); - message.submissionHeight !== undefined && - (obj.submissionHeight = (message.submissionHeight || BigInt(0)).toString()); - message.submissionTimestamp !== undefined && - (obj.submissionTimestamp = (message.submissionTimestamp || BigInt(0)).toString()); - message.purgeHeight !== undefined && (obj.purgeHeight = (message.purgeHeight || BigInt(0)).toString()); - return obj; - }, - fromPartial, I>>(object: I): AlertStatus { - const message = createBaseAlertStatus(); - if (object.conclusionStatus !== undefined && object.conclusionStatus !== null) { - message.conclusionStatus = BigInt(object.conclusionStatus.toString()); - } - if (object.submissionHeight !== undefined && object.submissionHeight !== null) { - message.submissionHeight = BigInt(object.submissionHeight.toString()); - } - if (object.submissionTimestamp !== undefined && object.submissionTimestamp !== null) { - message.submissionTimestamp = BigInt(object.submissionTimestamp.toString()); - } - if (object.purgeHeight !== undefined && object.purgeHeight !== null) { - message.purgeHeight = BigInt(object.purgeHeight.toString()); - } - return message; - }, -}; -function createBaseAlertWithStatus(): AlertWithStatus { - return { - alert: Alert.fromPartial({}), - status: AlertStatus.fromPartial({}), - }; -} -export const AlertWithStatus = { - typeUrl: "/slinky.alerts.v1.AlertWithStatus", - encode(message: AlertWithStatus, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.alert !== undefined) { - Alert.encode(message.alert, writer.uint32(10).fork()).ldelim(); - } - if (message.status !== undefined) { - AlertStatus.encode(message.status, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AlertWithStatus { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAlertWithStatus(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.alert = Alert.decode(reader, reader.uint32()); - break; - case 2: - message.status = AlertStatus.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AlertWithStatus { - const obj = createBaseAlertWithStatus(); - if (isSet(object.alert)) obj.alert = Alert.fromJSON(object.alert); - if (isSet(object.status)) obj.status = AlertStatus.fromJSON(object.status); - return obj; - }, - toJSON(message: AlertWithStatus): JsonSafe { - const obj: any = {}; - message.alert !== undefined && (obj.alert = message.alert ? Alert.toJSON(message.alert) : undefined); - message.status !== undefined && - (obj.status = message.status ? AlertStatus.toJSON(message.status) : undefined); - return obj; - }, - fromPartial, I>>(object: I): AlertWithStatus { - const message = createBaseAlertWithStatus(); - if (object.alert !== undefined && object.alert !== null) { - message.alert = Alert.fromPartial(object.alert); - } - if (object.status !== undefined && object.status !== null) { - message.status = AlertStatus.fromPartial(object.status); - } - return message; - }, -}; -function createBaseSignature(): Signature { - return { - signer: "", - signature: new Uint8Array(), - }; -} -export const Signature = { - typeUrl: "/slinky.alerts.v1.Signature", - encode(message: Signature, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.signer !== "") { - writer.uint32(10).string(message.signer); - } - if (message.signature.length !== 0) { - writer.uint32(18).bytes(message.signature); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): Signature { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseSignature(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.signer = reader.string(); - break; - case 2: - message.signature = reader.bytes(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): Signature { - const obj = createBaseSignature(); - if (isSet(object.signer)) obj.signer = String(object.signer); - if (isSet(object.signature)) obj.signature = bytesFromBase64(object.signature); - return obj; - }, - toJSON(message: Signature): JsonSafe { - const obj: any = {}; - message.signer !== undefined && (obj.signer = message.signer); - message.signature !== undefined && - (obj.signature = base64FromBytes( - message.signature !== undefined ? message.signature : new Uint8Array(), - )); - return obj; - }, - fromPartial, I>>(object: I): Signature { - const message = createBaseSignature(); - message.signer = object.signer ?? ""; - message.signature = object.signature ?? new Uint8Array(); - return message; - }, -}; -function createBaseMultiSigConclusion(): MultiSigConclusion { - return { - alert: Alert.fromPartial({}), - extendedCommitInfo: ExtendedCommitInfo.fromPartial({}), - signatures: [], - priceBound: PriceBound.fromPartial({}), - status: false, - currencyPairID: BigInt(0), - }; -} -export const MultiSigConclusion = { - typeUrl: "/slinky.alerts.v1.MultiSigConclusion", - encode(message: MultiSigConclusion, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.alert !== undefined) { - Alert.encode(message.alert, writer.uint32(10).fork()).ldelim(); - } - if (message.extendedCommitInfo !== undefined) { - ExtendedCommitInfo.encode(message.extendedCommitInfo, writer.uint32(18).fork()).ldelim(); - } - for (const v of message.signatures) { - Signature.encode(v!, writer.uint32(26).fork()).ldelim(); - } - if (message.priceBound !== undefined) { - PriceBound.encode(message.priceBound, writer.uint32(34).fork()).ldelim(); - } - if (message.status === true) { - writer.uint32(40).bool(message.status); - } - if (message.currencyPairID !== BigInt(0)) { - writer.uint32(48).uint64(message.currencyPairID); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MultiSigConclusion { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMultiSigConclusion(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.alert = Alert.decode(reader, reader.uint32()); - break; - case 2: - message.extendedCommitInfo = ExtendedCommitInfo.decode(reader, reader.uint32()); - break; - case 3: - message.signatures.push(Signature.decode(reader, reader.uint32())); - break; - case 4: - message.priceBound = PriceBound.decode(reader, reader.uint32()); - break; - case 5: - message.status = reader.bool(); - break; - case 6: - message.currencyPairID = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): MultiSigConclusion { - const obj = createBaseMultiSigConclusion(); - if (isSet(object.alert)) obj.alert = Alert.fromJSON(object.alert); - if (isSet(object.extendedCommitInfo)) - obj.extendedCommitInfo = ExtendedCommitInfo.fromJSON(object.extendedCommitInfo); - if (Array.isArray(object?.signatures)) - obj.signatures = object.signatures.map((e: any) => Signature.fromJSON(e)); - if (isSet(object.priceBound)) obj.priceBound = PriceBound.fromJSON(object.priceBound); - if (isSet(object.status)) obj.status = Boolean(object.status); - if (isSet(object.currencyPairID)) obj.currencyPairID = BigInt(object.currencyPairID.toString()); - return obj; - }, - toJSON(message: MultiSigConclusion): JsonSafe { - const obj: any = {}; - message.alert !== undefined && (obj.alert = message.alert ? Alert.toJSON(message.alert) : undefined); - message.extendedCommitInfo !== undefined && - (obj.extendedCommitInfo = message.extendedCommitInfo - ? ExtendedCommitInfo.toJSON(message.extendedCommitInfo) - : undefined); - if (message.signatures) { - obj.signatures = message.signatures.map((e) => (e ? Signature.toJSON(e) : undefined)); - } else { - obj.signatures = []; - } - message.priceBound !== undefined && - (obj.priceBound = message.priceBound ? PriceBound.toJSON(message.priceBound) : undefined); - message.status !== undefined && (obj.status = message.status); - message.currencyPairID !== undefined && - (obj.currencyPairID = (message.currencyPairID || BigInt(0)).toString()); - return obj; - }, - fromPartial, I>>(object: I): MultiSigConclusion { - const message = createBaseMultiSigConclusion(); - if (object.alert !== undefined && object.alert !== null) { - message.alert = Alert.fromPartial(object.alert); - } - if (object.extendedCommitInfo !== undefined && object.extendedCommitInfo !== null) { - message.extendedCommitInfo = ExtendedCommitInfo.fromPartial(object.extendedCommitInfo); - } - message.signatures = object.signatures?.map((e) => Signature.fromPartial(e)) || []; - if (object.priceBound !== undefined && object.priceBound !== null) { - message.priceBound = PriceBound.fromPartial(object.priceBound); - } - message.status = object.status ?? false; - if (object.currencyPairID !== undefined && object.currencyPairID !== null) { - message.currencyPairID = BigInt(object.currencyPairID.toString()); - } - return message; - }, -}; -function createBaseMultiSigConclusionVerificationParams(): MultiSigConclusionVerificationParams { - return { - signers: [], - }; -} -export const MultiSigConclusionVerificationParams = { - typeUrl: "/slinky.alerts.v1.MultiSigConclusionVerificationParams", - encode( - message: MultiSigConclusionVerificationParams, - writer: BinaryWriter = BinaryWriter.create(), - ): BinaryWriter { - for (const v of message.signers) { - Any.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MultiSigConclusionVerificationParams { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMultiSigConclusionVerificationParams(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.signers.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): MultiSigConclusionVerificationParams { - const obj = createBaseMultiSigConclusionVerificationParams(); - if (Array.isArray(object?.signers)) obj.signers = object.signers.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: MultiSigConclusionVerificationParams): JsonSafe { - const obj: any = {}; - if (message.signers) { - obj.signers = message.signers.map((e) => (e ? Any.toJSON(e) : undefined)); - } else { - obj.signers = []; - } - return obj; - }, - fromPartial, I>>( - object: I, - ): MultiSigConclusionVerificationParams { - const message = createBaseMultiSigConclusionVerificationParams(); - message.signers = object.signers?.map((e) => Any.fromPartial(e)) || []; - return message; - }, -}; -function createBasePriceBound(): PriceBound { - return { - high: "", - low: "", - }; -} -export const PriceBound = { - typeUrl: "/slinky.alerts.v1.PriceBound", - encode(message: PriceBound, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.high !== "") { - writer.uint32(10).string(message.high); - } - if (message.low !== "") { - writer.uint32(18).string(message.low); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): PriceBound { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePriceBound(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.high = reader.string(); - break; - case 2: - message.low = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): PriceBound { - const obj = createBasePriceBound(); - if (isSet(object.high)) obj.high = String(object.high); - if (isSet(object.low)) obj.low = String(object.low); - return obj; - }, - toJSON(message: PriceBound): JsonSafe { - const obj: any = {}; - message.high !== undefined && (obj.high = message.high); - message.low !== undefined && (obj.low = message.low); - return obj; - }, - fromPartial, I>>(object: I): PriceBound { - const message = createBasePriceBound(); - message.high = object.high ?? ""; - message.low = object.low ?? ""; - return message; - }, -}; diff --git a/src/slinky/alerts/v1/genesis.ts b/src/slinky/alerts/v1/genesis.ts deleted file mode 100644 index f5bf7d6..0000000 --- a/src/slinky/alerts/v1/genesis.ts +++ /dev/null @@ -1,336 +0,0 @@ -/* eslint-disable */ -import { Coin } from "../../../cosmos/base/v1beta1/coin"; -import { Any } from "../../../google/protobuf/any"; -import { AlertWithStatus } from "./alerts"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -export const protobufPackage = "slinky.alerts.v1"; -/** - * AlertParams is the set of parameters for the x/Alerts module's Alerting. It - * defines whether or not Alerts can be submitted, and if so, the minimum - * bond amount required to submit an Alert. - */ -export interface AlertParams { - /** - * Enabled is a boolean defining whether or not Alerts can be submitted - * to the module - */ - enabled: boolean; - /** - * BondAmount is the minimum amount of bond required to submit an - * Alert - */ - bondAmount: Coin; - /** - * MaxBlockAge defines the maximum age of an Alert before it is pruned, notice - * this is defined wrt. the height that the Alert references, i.e Alerts are - * only relevant until Alert.Height + MaxBlockAge is reached. - */ - maxBlockAge: bigint; -} -/** PruningParams defines the criterion for pruning Alerts from the state. */ -export interface PruningParams { - /** Enabled defines whether Alerts are to be pruned */ - enabled: boolean; - /** - * BlocksToPrune defines the number of blocks until an Alert will be pruned - * from state, notice this is defined wrt. the current block height, i.e - * Alerts will be stored in state until current_height + BlocksToPrune is - * reached. - */ - blocksToPrune: bigint; -} -/** Params is the set of parameters for the x/Alerts module. */ -export interface Params { - /** AlertParams is the set of parameters for the x/Alerts module's Alerting. */ - alertParams: AlertParams; - /** - * ConclusionVerificationParams is the set of parameters for the x/Alerts - * module's conclusion verification. - */ - conclusionVerificationParams?: Any; - /** PruningParams is the set of parameters for the x/Alerts module's pruning. */ - pruningParams: PruningParams; -} -/** - * GenesisState is the state that must be provided at genesis. It contains - * params for the module, and the set initial Alerts. - */ -export interface GenesisState { - /** Params is the set of x/Alerts parameters */ - params: Params; - /** Alerts is the set of Alerts that have been submitted to the module */ - alerts: AlertWithStatus[]; -} -function createBaseAlertParams(): AlertParams { - return { - enabled: false, - bondAmount: Coin.fromPartial({}), - maxBlockAge: BigInt(0), - }; -} -export const AlertParams = { - typeUrl: "/slinky.alerts.v1.AlertParams", - encode(message: AlertParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.enabled === true) { - writer.uint32(8).bool(message.enabled); - } - if (message.bondAmount !== undefined) { - Coin.encode(message.bondAmount, writer.uint32(18).fork()).ldelim(); - } - if (message.maxBlockAge !== BigInt(0)) { - writer.uint32(24).uint64(message.maxBlockAge); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AlertParams { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAlertParams(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.enabled = reader.bool(); - break; - case 2: - message.bondAmount = Coin.decode(reader, reader.uint32()); - break; - case 3: - message.maxBlockAge = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AlertParams { - const obj = createBaseAlertParams(); - if (isSet(object.enabled)) obj.enabled = Boolean(object.enabled); - if (isSet(object.bondAmount)) obj.bondAmount = Coin.fromJSON(object.bondAmount); - if (isSet(object.maxBlockAge)) obj.maxBlockAge = BigInt(object.maxBlockAge.toString()); - return obj; - }, - toJSON(message: AlertParams): JsonSafe { - const obj: any = {}; - message.enabled !== undefined && (obj.enabled = message.enabled); - message.bondAmount !== undefined && - (obj.bondAmount = message.bondAmount ? Coin.toJSON(message.bondAmount) : undefined); - message.maxBlockAge !== undefined && (obj.maxBlockAge = (message.maxBlockAge || BigInt(0)).toString()); - return obj; - }, - fromPartial, I>>(object: I): AlertParams { - const message = createBaseAlertParams(); - message.enabled = object.enabled ?? false; - if (object.bondAmount !== undefined && object.bondAmount !== null) { - message.bondAmount = Coin.fromPartial(object.bondAmount); - } - if (object.maxBlockAge !== undefined && object.maxBlockAge !== null) { - message.maxBlockAge = BigInt(object.maxBlockAge.toString()); - } - return message; - }, -}; -function createBasePruningParams(): PruningParams { - return { - enabled: false, - blocksToPrune: BigInt(0), - }; -} -export const PruningParams = { - typeUrl: "/slinky.alerts.v1.PruningParams", - encode(message: PruningParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.enabled === true) { - writer.uint32(8).bool(message.enabled); - } - if (message.blocksToPrune !== BigInt(0)) { - writer.uint32(16).uint64(message.blocksToPrune); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): PruningParams { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePruningParams(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.enabled = reader.bool(); - break; - case 2: - message.blocksToPrune = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): PruningParams { - const obj = createBasePruningParams(); - if (isSet(object.enabled)) obj.enabled = Boolean(object.enabled); - if (isSet(object.blocksToPrune)) obj.blocksToPrune = BigInt(object.blocksToPrune.toString()); - return obj; - }, - toJSON(message: PruningParams): JsonSafe { - const obj: any = {}; - message.enabled !== undefined && (obj.enabled = message.enabled); - message.blocksToPrune !== undefined && - (obj.blocksToPrune = (message.blocksToPrune || BigInt(0)).toString()); - return obj; - }, - fromPartial, I>>(object: I): PruningParams { - const message = createBasePruningParams(); - message.enabled = object.enabled ?? false; - if (object.blocksToPrune !== undefined && object.blocksToPrune !== null) { - message.blocksToPrune = BigInt(object.blocksToPrune.toString()); - } - return message; - }, -}; -function createBaseParams(): Params { - return { - alertParams: AlertParams.fromPartial({}), - conclusionVerificationParams: undefined, - pruningParams: PruningParams.fromPartial({}), - }; -} -export const Params = { - typeUrl: "/slinky.alerts.v1.Params", - encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.alertParams !== undefined) { - AlertParams.encode(message.alertParams, writer.uint32(10).fork()).ldelim(); - } - if (message.conclusionVerificationParams !== undefined) { - Any.encode(message.conclusionVerificationParams, writer.uint32(18).fork()).ldelim(); - } - if (message.pruningParams !== undefined) { - PruningParams.encode(message.pruningParams, writer.uint32(26).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): Params { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseParams(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.alertParams = AlertParams.decode(reader, reader.uint32()); - break; - case 2: - message.conclusionVerificationParams = Any.decode(reader, reader.uint32()); - break; - case 3: - message.pruningParams = PruningParams.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): Params { - const obj = createBaseParams(); - if (isSet(object.alertParams)) obj.alertParams = AlertParams.fromJSON(object.alertParams); - if (isSet(object.conclusionVerificationParams)) - obj.conclusionVerificationParams = Any.fromJSON(object.conclusionVerificationParams); - if (isSet(object.pruningParams)) obj.pruningParams = PruningParams.fromJSON(object.pruningParams); - return obj; - }, - toJSON(message: Params): JsonSafe { - const obj: any = {}; - message.alertParams !== undefined && - (obj.alertParams = message.alertParams ? AlertParams.toJSON(message.alertParams) : undefined); - message.conclusionVerificationParams !== undefined && - (obj.conclusionVerificationParams = message.conclusionVerificationParams - ? Any.toJSON(message.conclusionVerificationParams) - : undefined); - message.pruningParams !== undefined && - (obj.pruningParams = message.pruningParams ? PruningParams.toJSON(message.pruningParams) : undefined); - return obj; - }, - fromPartial, I>>(object: I): Params { - const message = createBaseParams(); - if (object.alertParams !== undefined && object.alertParams !== null) { - message.alertParams = AlertParams.fromPartial(object.alertParams); - } - if (object.conclusionVerificationParams !== undefined && object.conclusionVerificationParams !== null) { - message.conclusionVerificationParams = Any.fromPartial(object.conclusionVerificationParams); - } - if (object.pruningParams !== undefined && object.pruningParams !== null) { - message.pruningParams = PruningParams.fromPartial(object.pruningParams); - } - return message; - }, -}; -function createBaseGenesisState(): GenesisState { - return { - params: Params.fromPartial({}), - alerts: [], - }; -} -export const GenesisState = { - typeUrl: "/slinky.alerts.v1.GenesisState", - encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.params !== undefined) { - Params.encode(message.params, writer.uint32(10).fork()).ldelim(); - } - for (const v of message.alerts) { - AlertWithStatus.encode(v!, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenesisState(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.params = Params.decode(reader, reader.uint32()); - break; - case 2: - message.alerts.push(AlertWithStatus.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): GenesisState { - const obj = createBaseGenesisState(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - if (Array.isArray(object?.alerts)) - obj.alerts = object.alerts.map((e: any) => AlertWithStatus.fromJSON(e)); - return obj; - }, - toJSON(message: GenesisState): JsonSafe { - const obj: any = {}; - message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); - if (message.alerts) { - obj.alerts = message.alerts.map((e) => (e ? AlertWithStatus.toJSON(e) : undefined)); - } else { - obj.alerts = []; - } - return obj; - }, - fromPartial, I>>(object: I): GenesisState { - const message = createBaseGenesisState(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } - message.alerts = object.alerts?.map((e) => AlertWithStatus.fromPartial(e)) || []; - return message; - }, -}; diff --git a/src/slinky/alerts/v1/query.rpc.Query.ts b/src/slinky/alerts/v1/query.rpc.Query.ts deleted file mode 100644 index 5c16362..0000000 --- a/src/slinky/alerts/v1/query.rpc.Query.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* eslint-disable */ -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { AlertsRequest, AlertsResponse, ParamsRequest, ParamsResponse } from "./query"; -/** Query is the query service for the x/alerts module. */ -export interface Query { - /** - * Alerts gets all alerts in state under the given status. If no status is - * given, all Alerts are returned - */ - alerts(request: AlertsRequest): Promise; - params(request?: ParamsRequest): Promise; -} -export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { - this.rpc = rpc; - this.alerts = this.alerts.bind(this); - this.params = this.params.bind(this); - } - alerts(request: AlertsRequest): Promise { - const data = AlertsRequest.encode(request).finish(); - const promise = this.rpc.request("slinky.alerts.v1.Query", "Alerts", data); - return promise.then((data) => AlertsResponse.decode(new BinaryReader(data))); - } - params(request: ParamsRequest = {}): Promise { - const data = ParamsRequest.encode(request).finish(); - const promise = this.rpc.request("slinky.alerts.v1.Query", "Params", data); - return promise.then((data) => ParamsResponse.decode(new BinaryReader(data))); - } -} -export const createRpcQueryExtension = (base: QueryClient) => { - const rpc = createProtobufRpcClient(base); - const queryService = new QueryClientImpl(rpc); - return { - alerts(request: AlertsRequest): Promise { - return queryService.alerts(request); - }, - params(request?: ParamsRequest): Promise { - return queryService.params(request); - }, - }; -}; diff --git a/src/slinky/alerts/v1/query.ts b/src/slinky/alerts/v1/query.ts deleted file mode 100644 index 1ec371a..0000000 --- a/src/slinky/alerts/v1/query.ts +++ /dev/null @@ -1,250 +0,0 @@ -/* eslint-disable */ -import { Alert } from "./alerts"; -import { Params } from "./genesis"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -export const protobufPackage = "slinky.alerts.v1"; -/** - * AlertStatus is the type for the status of an Alert, it can be Unconcluded or - * Concluded. - */ -export enum AlertStatusID { - CONCLUSION_STATUS_UNSPECIFIED = 0, - CONCLUSION_STATUS_UNCONCLUDED = 1, - CONCLUSION_STATUS_CONCLUDED = 2, - UNRECOGNIZED = -1, -} -export function alertStatusIDFromJSON(object: any): AlertStatusID { - switch (object) { - case 0: - case "CONCLUSION_STATUS_UNSPECIFIED": - return AlertStatusID.CONCLUSION_STATUS_UNSPECIFIED; - case 1: - case "CONCLUSION_STATUS_UNCONCLUDED": - return AlertStatusID.CONCLUSION_STATUS_UNCONCLUDED; - case 2: - case "CONCLUSION_STATUS_CONCLUDED": - return AlertStatusID.CONCLUSION_STATUS_CONCLUDED; - case -1: - case "UNRECOGNIZED": - default: - return AlertStatusID.UNRECOGNIZED; - } -} -export function alertStatusIDToJSON(object: AlertStatusID): string { - switch (object) { - case AlertStatusID.CONCLUSION_STATUS_UNSPECIFIED: - return "CONCLUSION_STATUS_UNSPECIFIED"; - case AlertStatusID.CONCLUSION_STATUS_UNCONCLUDED: - return "CONCLUSION_STATUS_UNCONCLUDED"; - case AlertStatusID.CONCLUSION_STATUS_CONCLUDED: - return "CONCLUSION_STATUS_CONCLUDED"; - case AlertStatusID.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} -/** - * AlertsRequest is the request type for the Query.Alerts RPC method, the status - * field indicates whether the request should return only Unconcluded / - * Concluded Alerts, or all Alerts. - */ -export interface AlertsRequest { - status: AlertStatusID; -} -/** - * AlertsResponse is the response type for the Query.Alerts RPC method, it - * contains the list of Alerts that are being tracked by the alerts module. - */ -export interface AlertsResponse { - alerts: Alert[]; -} -/** ParamsRequest is the request type for the Query.Params RPC method. */ -export interface ParamsRequest {} -/** - * ParamsResponse is the response type for the Query.Params RPC method, it - * contains the Params of the module. - */ -export interface ParamsResponse { - params: Params; -} -function createBaseAlertsRequest(): AlertsRequest { - return { - status: 0, - }; -} -export const AlertsRequest = { - typeUrl: "/slinky.alerts.v1.AlertsRequest", - encode(message: AlertsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.status !== 0) { - writer.uint32(8).int32(message.status); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AlertsRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAlertsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.status = reader.int32() as any; - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AlertsRequest { - const obj = createBaseAlertsRequest(); - if (isSet(object.status)) obj.status = alertStatusIDFromJSON(object.status); - return obj; - }, - toJSON(message: AlertsRequest): JsonSafe { - const obj: any = {}; - message.status !== undefined && (obj.status = alertStatusIDToJSON(message.status)); - return obj; - }, - fromPartial, I>>(object: I): AlertsRequest { - const message = createBaseAlertsRequest(); - message.status = object.status ?? 0; - return message; - }, -}; -function createBaseAlertsResponse(): AlertsResponse { - return { - alerts: [], - }; -} -export const AlertsResponse = { - typeUrl: "/slinky.alerts.v1.AlertsResponse", - encode(message: AlertsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.alerts) { - Alert.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AlertsResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAlertsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.alerts.push(Alert.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AlertsResponse { - const obj = createBaseAlertsResponse(); - if (Array.isArray(object?.alerts)) obj.alerts = object.alerts.map((e: any) => Alert.fromJSON(e)); - return obj; - }, - toJSON(message: AlertsResponse): JsonSafe { - const obj: any = {}; - if (message.alerts) { - obj.alerts = message.alerts.map((e) => (e ? Alert.toJSON(e) : undefined)); - } else { - obj.alerts = []; - } - return obj; - }, - fromPartial, I>>(object: I): AlertsResponse { - const message = createBaseAlertsResponse(); - message.alerts = object.alerts?.map((e) => Alert.fromPartial(e)) || []; - return message; - }, -}; -function createBaseParamsRequest(): ParamsRequest { - return {}; -} -export const ParamsRequest = { - typeUrl: "/slinky.alerts.v1.ParamsRequest", - encode(_: ParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): ParamsRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseParamsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(_: any): ParamsRequest { - const obj = createBaseParamsRequest(); - return obj; - }, - toJSON(_: ParamsRequest): JsonSafe { - const obj: any = {}; - return obj; - }, - fromPartial, I>>(_: I): ParamsRequest { - const message = createBaseParamsRequest(); - return message; - }, -}; -function createBaseParamsResponse(): ParamsResponse { - return { - params: Params.fromPartial({}), - }; -} -export const ParamsResponse = { - typeUrl: "/slinky.alerts.v1.ParamsResponse", - encode(message: ParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.params !== undefined) { - Params.encode(message.params, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): ParamsResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseParamsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.params = Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): ParamsResponse { - const obj = createBaseParamsResponse(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; - }, - toJSON(message: ParamsResponse): JsonSafe { - const obj: any = {}; - message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); - return obj; - }, - fromPartial, I>>(object: I): ParamsResponse { - const message = createBaseParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } - return message; - }, -}; diff --git a/src/slinky/alerts/v1/strategies.ts b/src/slinky/alerts/v1/strategies.ts deleted file mode 100644 index b28b9b9..0000000 --- a/src/slinky/alerts/v1/strategies.ts +++ /dev/null @@ -1,93 +0,0 @@ -/* eslint-disable */ -import { Validator } from "../../../tendermint/abci/types"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -export const protobufPackage = "slinky.alerts.v1"; -/** - * ValidatorAlertIncentive defines the incentive strategy to be executed for a - * validator that has been confirmed to have at fault for an x/alerts alert. - * This strategy is expected to slash half of the validator's stake. - */ -export interface ValidatorAlertIncentive { - /** The validator that has been confirmed to have been at fault for an alert. */ - validator: Validator; - /** - * AlertSigner is the signer of the alert referenced by the conclusion that - * created this incentive. - */ - alertSigner: string; - /** AlertHeight is the height at which the infraction occurred */ - alertHeight: bigint; -} -function createBaseValidatorAlertIncentive(): ValidatorAlertIncentive { - return { - validator: Validator.fromPartial({}), - alertSigner: "", - alertHeight: BigInt(0), - }; -} -export const ValidatorAlertIncentive = { - typeUrl: "/slinky.alerts.v1.ValidatorAlertIncentive", - encode(message: ValidatorAlertIncentive, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.validator !== undefined) { - Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); - } - if (message.alertSigner !== "") { - writer.uint32(18).string(message.alertSigner); - } - if (message.alertHeight !== BigInt(0)) { - writer.uint32(24).uint64(message.alertHeight); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): ValidatorAlertIncentive { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseValidatorAlertIncentive(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.validator = Validator.decode(reader, reader.uint32()); - break; - case 2: - message.alertSigner = reader.string(); - break; - case 3: - message.alertHeight = reader.uint64(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): ValidatorAlertIncentive { - const obj = createBaseValidatorAlertIncentive(); - if (isSet(object.validator)) obj.validator = Validator.fromJSON(object.validator); - if (isSet(object.alertSigner)) obj.alertSigner = String(object.alertSigner); - if (isSet(object.alertHeight)) obj.alertHeight = BigInt(object.alertHeight.toString()); - return obj; - }, - toJSON(message: ValidatorAlertIncentive): JsonSafe { - const obj: any = {}; - message.validator !== undefined && - (obj.validator = message.validator ? Validator.toJSON(message.validator) : undefined); - message.alertSigner !== undefined && (obj.alertSigner = message.alertSigner); - message.alertHeight !== undefined && (obj.alertHeight = (message.alertHeight || BigInt(0)).toString()); - return obj; - }, - fromPartial, I>>(object: I): ValidatorAlertIncentive { - const message = createBaseValidatorAlertIncentive(); - if (object.validator !== undefined && object.validator !== null) { - message.validator = Validator.fromPartial(object.validator); - } - message.alertSigner = object.alertSigner ?? ""; - if (object.alertHeight !== undefined && object.alertHeight !== null) { - message.alertHeight = BigInt(object.alertHeight.toString()); - } - return message; - }, -}; diff --git a/src/slinky/alerts/v1/tx.rpc.msg.ts b/src/slinky/alerts/v1/tx.rpc.msg.ts deleted file mode 100644 index b16540c..0000000 --- a/src/slinky/alerts/v1/tx.rpc.msg.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* eslint-disable */ -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { - MsgAlert, - MsgAlertResponse, - MsgConclusion, - MsgConclusionResponse, - MsgUpdateParams, - MsgUpdateParamsResponse, -} from "./tx"; -/** Msg is the message service for the x/alerts module. */ -export interface Msg { - /** - * Alert creates a new alert. On alert creation (if valid), the alert will be - * saved to state, and its bond will be escrowed until a corresponding - * Conclusion is filed to close the alert. - */ - alert(request: MsgAlert): Promise; - /** - * Conclusion closes an alert. On alert conclusion (if valid), the alert will - * be marked as Concluded, the bond for the alert will either be burned or - * returned, and a set of incentives will be issued to the validators deemed - * malicious by the conclusion. - */ - conclusion(request: MsgConclusion): Promise; - /** - * UpdateParams updates the parameters of the alerts module. Specifically, the - * only address that is capable of submitting this Msg is the - * module-authority, in general, the x/gov module-account. The process for - * executing this message will be via governance proposal - */ - updateParams(request: MsgUpdateParams): Promise; -} -export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { - this.rpc = rpc; - this.alert = this.alert.bind(this); - this.conclusion = this.conclusion.bind(this); - this.updateParams = this.updateParams.bind(this); - } - alert(request: MsgAlert): Promise { - const data = MsgAlert.encode(request).finish(); - const promise = this.rpc.request("slinky.alerts.v1.Msg", "Alert", data); - return promise.then((data) => MsgAlertResponse.decode(new BinaryReader(data))); - } - conclusion(request: MsgConclusion): Promise { - const data = MsgConclusion.encode(request).finish(); - const promise = this.rpc.request("slinky.alerts.v1.Msg", "Conclusion", data); - return promise.then((data) => MsgConclusionResponse.decode(new BinaryReader(data))); - } - updateParams(request: MsgUpdateParams): Promise { - const data = MsgUpdateParams.encode(request).finish(); - const promise = this.rpc.request("slinky.alerts.v1.Msg", "UpdateParams", data); - return promise.then((data) => MsgUpdateParamsResponse.decode(new BinaryReader(data))); - } -} diff --git a/src/slinky/alerts/v1/tx.ts b/src/slinky/alerts/v1/tx.ts deleted file mode 100644 index 83e0189..0000000 --- a/src/slinky/alerts/v1/tx.ts +++ /dev/null @@ -1,310 +0,0 @@ -/* eslint-disable */ -import { Alert } from "./alerts"; -import { Any } from "../../../google/protobuf/any"; -import { Params } from "./genesis"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -export const protobufPackage = "slinky.alerts.v1"; -/** MsgAlert defines a message to create an alert. */ -export interface MsgAlert { - /** alert is the alert to be filed */ - alert: Alert; -} -export interface MsgAlertResponse {} -/** - * MsgConclusion defines a message carrying a Conclusion made by the SecondTier, - * which will be used to close an alert. And trigger any ramifications of the - * conclusion. - */ -export interface MsgConclusion { - /** - * signer is the signer of this transaction (notice, this may not always be a - * node from the SecondTier) - */ - signer: string; - /** conclusion is the conclusion to be filed */ - conclusion?: Any; -} -export interface MsgConclusionResponse {} -/** - * MsgUpdateParams defines the message type expected by the UpdateParams rpc. It - * contains an authority address, and the new Params for the x/alerts module. - */ -export interface MsgUpdateParams { - /** authority is the address of the authority that is submitting the update */ - authority: string; - /** params is the new set of parameters for the x/alerts module */ - params: Params; -} -export interface MsgUpdateParamsResponse {} -function createBaseMsgAlert(): MsgAlert { - return { - alert: Alert.fromPartial({}), - }; -} -export const MsgAlert = { - typeUrl: "/slinky.alerts.v1.MsgAlert", - encode(message: MsgAlert, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.alert !== undefined) { - Alert.encode(message.alert, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgAlert { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgAlert(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.alert = Alert.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): MsgAlert { - const obj = createBaseMsgAlert(); - if (isSet(object.alert)) obj.alert = Alert.fromJSON(object.alert); - return obj; - }, - toJSON(message: MsgAlert): JsonSafe { - const obj: any = {}; - message.alert !== undefined && (obj.alert = message.alert ? Alert.toJSON(message.alert) : undefined); - return obj; - }, - fromPartial, I>>(object: I): MsgAlert { - const message = createBaseMsgAlert(); - if (object.alert !== undefined && object.alert !== null) { - message.alert = Alert.fromPartial(object.alert); - } - return message; - }, -}; -function createBaseMsgAlertResponse(): MsgAlertResponse { - return {}; -} -export const MsgAlertResponse = { - typeUrl: "/slinky.alerts.v1.MsgAlertResponse", - encode(_: MsgAlertResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgAlertResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgAlertResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(_: any): MsgAlertResponse { - const obj = createBaseMsgAlertResponse(); - return obj; - }, - toJSON(_: MsgAlertResponse): JsonSafe { - const obj: any = {}; - return obj; - }, - fromPartial, I>>(_: I): MsgAlertResponse { - const message = createBaseMsgAlertResponse(); - return message; - }, -}; -function createBaseMsgConclusion(): MsgConclusion { - return { - signer: "", - conclusion: undefined, - }; -} -export const MsgConclusion = { - typeUrl: "/slinky.alerts.v1.MsgConclusion", - encode(message: MsgConclusion, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.signer !== "") { - writer.uint32(10).string(message.signer); - } - if (message.conclusion !== undefined) { - Any.encode(message.conclusion, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgConclusion { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgConclusion(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.signer = reader.string(); - break; - case 2: - message.conclusion = Any.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): MsgConclusion { - const obj = createBaseMsgConclusion(); - if (isSet(object.signer)) obj.signer = String(object.signer); - if (isSet(object.conclusion)) obj.conclusion = Any.fromJSON(object.conclusion); - return obj; - }, - toJSON(message: MsgConclusion): JsonSafe { - const obj: any = {}; - message.signer !== undefined && (obj.signer = message.signer); - message.conclusion !== undefined && - (obj.conclusion = message.conclusion ? Any.toJSON(message.conclusion) : undefined); - return obj; - }, - fromPartial, I>>(object: I): MsgConclusion { - const message = createBaseMsgConclusion(); - message.signer = object.signer ?? ""; - if (object.conclusion !== undefined && object.conclusion !== null) { - message.conclusion = Any.fromPartial(object.conclusion); - } - return message; - }, -}; -function createBaseMsgConclusionResponse(): MsgConclusionResponse { - return {}; -} -export const MsgConclusionResponse = { - typeUrl: "/slinky.alerts.v1.MsgConclusionResponse", - encode(_: MsgConclusionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgConclusionResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgConclusionResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(_: any): MsgConclusionResponse { - const obj = createBaseMsgConclusionResponse(); - return obj; - }, - toJSON(_: MsgConclusionResponse): JsonSafe { - const obj: any = {}; - return obj; - }, - fromPartial, I>>(_: I): MsgConclusionResponse { - const message = createBaseMsgConclusionResponse(); - return message; - }, -}; -function createBaseMsgUpdateParams(): MsgUpdateParams { - return { - authority: "", - params: Params.fromPartial({}), - }; -} -export const MsgUpdateParams = { - typeUrl: "/slinky.alerts.v1.MsgUpdateParams", - encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.authority !== "") { - writer.uint32(10).string(message.authority); - } - if (message.params !== undefined) { - Params.encode(message.params, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgUpdateParams(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.authority = reader.string(); - break; - case 2: - message.params = Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): MsgUpdateParams { - const obj = createBaseMsgUpdateParams(); - if (isSet(object.authority)) obj.authority = String(object.authority); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; - }, - toJSON(message: MsgUpdateParams): JsonSafe { - const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); - return obj; - }, - fromPartial, I>>(object: I): MsgUpdateParams { - const message = createBaseMsgUpdateParams(); - message.authority = object.authority ?? ""; - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } - return message; - }, -}; -function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { - return {}; -} -export const MsgUpdateParamsResponse = { - typeUrl: "/slinky.alerts.v1.MsgUpdateParamsResponse", - encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgUpdateParamsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(_: any): MsgUpdateParamsResponse { - const obj = createBaseMsgUpdateParamsResponse(); - return obj; - }, - toJSON(_: MsgUpdateParamsResponse): JsonSafe { - const obj: any = {}; - return obj; - }, - fromPartial, I>>(_: I): MsgUpdateParamsResponse { - const message = createBaseMsgUpdateParamsResponse(); - return message; - }, -}; diff --git a/src/slinky/incentives/module/v1/module.ts b/src/slinky/incentives/module/v1/module.ts deleted file mode 100644 index 7e463e3..0000000 --- a/src/slinky/incentives/module/v1/module.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { JsonSafe } from "../../../../json-safe"; -import { DeepPartial, Exact } from "../../../../helpers"; -export const protobufPackage = "slinky.incentives.module.v1"; -/** Module is the config object of the incentives module. */ -export interface Module {} -function createBaseModule(): Module { - return {}; -} -export const Module = { - typeUrl: "/slinky.incentives.module.v1.Module", - encode(_: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): Module { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseModule(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(_: any): Module { - const obj = createBaseModule(); - return obj; - }, - toJSON(_: Module): JsonSafe { - const obj: any = {}; - return obj; - }, - fromPartial, I>>(_: I): Module { - const message = createBaseModule(); - return message; - }, -}; diff --git a/src/slinky/incentives/v1/examples/badprice.ts b/src/slinky/incentives/v1/examples/badprice.ts deleted file mode 100644 index 70c20b1..0000000 --- a/src/slinky/incentives/v1/examples/badprice.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../../helpers"; -import { JsonSafe } from "../../../../json-safe"; -export const protobufPackage = "slinky.incentives.v1"; -/** - * BadPriceIncentive is a message that contains the information about a bad - * price that was submitted by a validator. - * - * NOTE: This is an example of a bad price incentive. It is not used in - * production. - */ -export interface BadPriceIncentive { - /** Validator is the address of the validator that submitted the bad price. */ - validator: string; - /** Amount is the amount to slash. */ - amount: string; -} -function createBaseBadPriceIncentive(): BadPriceIncentive { - return { - validator: "", - amount: "", - }; -} -export const BadPriceIncentive = { - typeUrl: "/slinky.incentives.v1.BadPriceIncentive", - encode(message: BadPriceIncentive, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.validator !== "") { - writer.uint32(10).string(message.validator); - } - if (message.amount !== "") { - writer.uint32(18).string(message.amount); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): BadPriceIncentive { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBadPriceIncentive(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.validator = reader.string(); - break; - case 2: - message.amount = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): BadPriceIncentive { - const obj = createBaseBadPriceIncentive(); - if (isSet(object.validator)) obj.validator = String(object.validator); - if (isSet(object.amount)) obj.amount = String(object.amount); - return obj; - }, - toJSON(message: BadPriceIncentive): JsonSafe { - const obj: any = {}; - message.validator !== undefined && (obj.validator = message.validator); - message.amount !== undefined && (obj.amount = message.amount); - return obj; - }, - fromPartial, I>>(object: I): BadPriceIncentive { - const message = createBaseBadPriceIncentive(); - message.validator = object.validator ?? ""; - message.amount = object.amount ?? ""; - return message; - }, -}; diff --git a/src/slinky/incentives/v1/examples/goodprice.ts b/src/slinky/incentives/v1/examples/goodprice.ts deleted file mode 100644 index 7b5550e..0000000 --- a/src/slinky/incentives/v1/examples/goodprice.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../../helpers"; -import { JsonSafe } from "../../../../json-safe"; -export const protobufPackage = "slinky.incentives.v1"; -/** - * GoodPriceIncentive is a message that contains the information about a good - * price that was submitted by a validator. - * - * NOTE: This is an example of a good price incentive. It is not used in - * production. - */ -export interface GoodPriceIncentive { - /** Validator is the address of the validator that submitted the good price. */ - validator: string; - /** Amount is the amount to reward. */ - amount: string; -} -function createBaseGoodPriceIncentive(): GoodPriceIncentive { - return { - validator: "", - amount: "", - }; -} -export const GoodPriceIncentive = { - typeUrl: "/slinky.incentives.v1.GoodPriceIncentive", - encode(message: GoodPriceIncentive, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.validator !== "") { - writer.uint32(10).string(message.validator); - } - if (message.amount !== "") { - writer.uint32(18).string(message.amount); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): GoodPriceIncentive { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGoodPriceIncentive(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.validator = reader.string(); - break; - case 2: - message.amount = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): GoodPriceIncentive { - const obj = createBaseGoodPriceIncentive(); - if (isSet(object.validator)) obj.validator = String(object.validator); - if (isSet(object.amount)) obj.amount = String(object.amount); - return obj; - }, - toJSON(message: GoodPriceIncentive): JsonSafe { - const obj: any = {}; - message.validator !== undefined && (obj.validator = message.validator); - message.amount !== undefined && (obj.amount = message.amount); - return obj; - }, - fromPartial, I>>(object: I): GoodPriceIncentive { - const message = createBaseGoodPriceIncentive(); - message.validator = object.validator ?? ""; - message.amount = object.amount ?? ""; - return message; - }, -}; diff --git a/src/slinky/incentives/v1/genesis.ts b/src/slinky/incentives/v1/genesis.ts deleted file mode 100644 index c978b62..0000000 --- a/src/slinky/incentives/v1/genesis.ts +++ /dev/null @@ -1,138 +0,0 @@ -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { JsonSafe } from "../../../json-safe"; -import { DeepPartial, Exact, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; -export const protobufPackage = "slinky.incentives.v1"; -/** GenesisState is the genesis-state for the x/incentives module. */ -export interface GenesisState { - /** - * Registry is a list of incentives by type. The registry defined here - * should be a subset of the incentive types defined in the incentive - * module (keeper). - */ - registry: IncentivesByType[]; -} -/** - * IncentivesByType encapsulates a list of incentives by type. Each of the - * entries here must correspond to the same incentive type defined here. - */ -export interface IncentivesByType { - /** - * IncentiveType is the incentive type i.e. (BadPriceIncentiveType, - * GoodPriceIncentiveType). - */ - incentiveType: string; - /** Entries is a list of incentive bytes. */ - entries: Uint8Array[]; -} -function createBaseGenesisState(): GenesisState { - return { - registry: [], - }; -} -export const GenesisState = { - typeUrl: "/slinky.incentives.v1.GenesisState", - encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.registry) { - IncentivesByType.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenesisState(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.registry.push(IncentivesByType.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): GenesisState { - const obj = createBaseGenesisState(); - if (Array.isArray(object?.registry)) - obj.registry = object.registry.map((e: any) => IncentivesByType.fromJSON(e)); - return obj; - }, - toJSON(message: GenesisState): JsonSafe { - const obj: any = {}; - if (message.registry) { - obj.registry = message.registry.map((e) => (e ? IncentivesByType.toJSON(e) : undefined)); - } else { - obj.registry = []; - } - return obj; - }, - fromPartial, I>>(object: I): GenesisState { - const message = createBaseGenesisState(); - message.registry = object.registry?.map((e) => IncentivesByType.fromPartial(e)) || []; - return message; - }, -}; -function createBaseIncentivesByType(): IncentivesByType { - return { - incentiveType: "", - entries: [], - }; -} -export const IncentivesByType = { - typeUrl: "/slinky.incentives.v1.IncentivesByType", - encode(message: IncentivesByType, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.incentiveType !== "") { - writer.uint32(10).string(message.incentiveType); - } - for (const v of message.entries) { - writer.uint32(18).bytes(v!); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): IncentivesByType { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseIncentivesByType(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.incentiveType = reader.string(); - break; - case 2: - message.entries.push(reader.bytes()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): IncentivesByType { - const obj = createBaseIncentivesByType(); - if (isSet(object.incentiveType)) obj.incentiveType = String(object.incentiveType); - if (Array.isArray(object?.entries)) obj.entries = object.entries.map((e: any) => bytesFromBase64(e)); - return obj; - }, - toJSON(message: IncentivesByType): JsonSafe { - const obj: any = {}; - message.incentiveType !== undefined && (obj.incentiveType = message.incentiveType); - if (message.entries) { - obj.entries = message.entries.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.entries = []; - } - return obj; - }, - fromPartial, I>>(object: I): IncentivesByType { - const message = createBaseIncentivesByType(); - message.incentiveType = object.incentiveType ?? ""; - message.entries = object.entries?.map((e) => e) || []; - return message; - }, -}; diff --git a/src/slinky/incentives/v1/query.rpc.Query.ts b/src/slinky/incentives/v1/query.rpc.Query.ts deleted file mode 100644 index 1894f29..0000000 --- a/src/slinky/incentives/v1/query.rpc.Query.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* eslint-disable */ -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { - GetIncentivesByTypeRequest, - GetIncentivesByTypeResponse, - GetAllIncentivesRequest, - GetAllIncentivesResponse, -} from "./query"; -/** Query is the query service for the x/incentives module. */ -export interface Query { - /** - * GetIncentivesByType returns all incentives of a given type. If the type is - * not registered with the module, an error is returned. - */ - getIncentivesByType(request: GetIncentivesByTypeRequest): Promise; - /** GetAllIncentives returns all incentives. */ - getAllIncentives(request?: GetAllIncentivesRequest): Promise; -} -export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { - this.rpc = rpc; - this.getIncentivesByType = this.getIncentivesByType.bind(this); - this.getAllIncentives = this.getAllIncentives.bind(this); - } - getIncentivesByType(request: GetIncentivesByTypeRequest): Promise { - const data = GetIncentivesByTypeRequest.encode(request).finish(); - const promise = this.rpc.request("slinky.incentives.v1.Query", "GetIncentivesByType", data); - return promise.then((data) => GetIncentivesByTypeResponse.decode(new BinaryReader(data))); - } - getAllIncentives(request: GetAllIncentivesRequest = {}): Promise { - const data = GetAllIncentivesRequest.encode(request).finish(); - const promise = this.rpc.request("slinky.incentives.v1.Query", "GetAllIncentives", data); - return promise.then((data) => GetAllIncentivesResponse.decode(new BinaryReader(data))); - } -} -export const createRpcQueryExtension = (base: QueryClient) => { - const rpc = createProtobufRpcClient(base); - const queryService = new QueryClientImpl(rpc); - return { - getIncentivesByType(request: GetIncentivesByTypeRequest): Promise { - return queryService.getIncentivesByType(request); - }, - getAllIncentives(request?: GetAllIncentivesRequest): Promise { - return queryService.getAllIncentives(request); - }, - }; -}; diff --git a/src/slinky/incentives/v1/query.ts b/src/slinky/incentives/v1/query.ts deleted file mode 100644 index 66d9e08..0000000 --- a/src/slinky/incentives/v1/query.ts +++ /dev/null @@ -1,226 +0,0 @@ -/* eslint-disable */ -import { IncentivesByType } from "./genesis"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, bytesFromBase64, base64FromBytes } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -export const protobufPackage = "slinky.incentives.v1"; -/** - * GetIncentivesByTypeRequest is the request type for the - * Query/GetIncentivesByType RPC method. - */ -export interface GetIncentivesByTypeRequest { - /** - * IncentiveType is the incentive type i.e. (BadPriceIncentiveType, - * GoodPriceIncentiveType). - */ - incentiveType: string; -} -/** - * GetIncentivesByTypeResponse is the response type for the - * Query/GetIncentivesByType RPC method. - */ -export interface GetIncentivesByTypeResponse { - /** Entries is the list of incentives of the given type. */ - entries: Uint8Array[]; -} -/** - * GetAllIncentivesRequest is the request type for the Query/GetAllIncentives - * RPC method. - */ -export interface GetAllIncentivesRequest {} -/** - * GetAllIncentivesResponse is the response type for the Query/GetAllIncentives - * RPC method. - */ -export interface GetAllIncentivesResponse { - /** Registry is the list of all incentives, grouped by type. */ - registry: IncentivesByType[]; -} -function createBaseGetIncentivesByTypeRequest(): GetIncentivesByTypeRequest { - return { - incentiveType: "", - }; -} -export const GetIncentivesByTypeRequest = { - typeUrl: "/slinky.incentives.v1.GetIncentivesByTypeRequest", - encode(message: GetIncentivesByTypeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.incentiveType !== "") { - writer.uint32(10).string(message.incentiveType); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): GetIncentivesByTypeRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetIncentivesByTypeRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.incentiveType = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): GetIncentivesByTypeRequest { - const obj = createBaseGetIncentivesByTypeRequest(); - if (isSet(object.incentiveType)) obj.incentiveType = String(object.incentiveType); - return obj; - }, - toJSON(message: GetIncentivesByTypeRequest): JsonSafe { - const obj: any = {}; - message.incentiveType !== undefined && (obj.incentiveType = message.incentiveType); - return obj; - }, - fromPartial, I>>( - object: I, - ): GetIncentivesByTypeRequest { - const message = createBaseGetIncentivesByTypeRequest(); - message.incentiveType = object.incentiveType ?? ""; - return message; - }, -}; -function createBaseGetIncentivesByTypeResponse(): GetIncentivesByTypeResponse { - return { - entries: [], - }; -} -export const GetIncentivesByTypeResponse = { - typeUrl: "/slinky.incentives.v1.GetIncentivesByTypeResponse", - encode(message: GetIncentivesByTypeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.entries) { - writer.uint32(10).bytes(v!); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): GetIncentivesByTypeResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetIncentivesByTypeResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.entries.push(reader.bytes()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): GetIncentivesByTypeResponse { - const obj = createBaseGetIncentivesByTypeResponse(); - if (Array.isArray(object?.entries)) obj.entries = object.entries.map((e: any) => bytesFromBase64(e)); - return obj; - }, - toJSON(message: GetIncentivesByTypeResponse): JsonSafe { - const obj: any = {}; - if (message.entries) { - obj.entries = message.entries.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.entries = []; - } - return obj; - }, - fromPartial, I>>( - object: I, - ): GetIncentivesByTypeResponse { - const message = createBaseGetIncentivesByTypeResponse(); - message.entries = object.entries?.map((e) => e) || []; - return message; - }, -}; -function createBaseGetAllIncentivesRequest(): GetAllIncentivesRequest { - return {}; -} -export const GetAllIncentivesRequest = { - typeUrl: "/slinky.incentives.v1.GetAllIncentivesRequest", - encode(_: GetAllIncentivesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): GetAllIncentivesRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetAllIncentivesRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(_: any): GetAllIncentivesRequest { - const obj = createBaseGetAllIncentivesRequest(); - return obj; - }, - toJSON(_: GetAllIncentivesRequest): JsonSafe { - const obj: any = {}; - return obj; - }, - fromPartial, I>>(_: I): GetAllIncentivesRequest { - const message = createBaseGetAllIncentivesRequest(); - return message; - }, -}; -function createBaseGetAllIncentivesResponse(): GetAllIncentivesResponse { - return { - registry: [], - }; -} -export const GetAllIncentivesResponse = { - typeUrl: "/slinky.incentives.v1.GetAllIncentivesResponse", - encode(message: GetAllIncentivesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.registry) { - IncentivesByType.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): GetAllIncentivesResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetAllIncentivesResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.registry.push(IncentivesByType.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): GetAllIncentivesResponse { - const obj = createBaseGetAllIncentivesResponse(); - if (Array.isArray(object?.registry)) - obj.registry = object.registry.map((e: any) => IncentivesByType.fromJSON(e)); - return obj; - }, - toJSON(message: GetAllIncentivesResponse): JsonSafe { - const obj: any = {}; - if (message.registry) { - obj.registry = message.registry.map((e) => (e ? IncentivesByType.toJSON(e) : undefined)); - } else { - obj.registry = []; - } - return obj; - }, - fromPartial, I>>( - object: I, - ): GetAllIncentivesResponse { - const message = createBaseGetAllIncentivesResponse(); - message.registry = object.registry?.map((e) => IncentivesByType.fromPartial(e)) || []; - return message; - }, -}; diff --git a/src/slinky/sla/module/v1/module.ts b/src/slinky/sla/module/v1/module.ts deleted file mode 100644 index e257180..0000000 --- a/src/slinky/sla/module/v1/module.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* eslint-disable */ -import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../../helpers"; -import { JsonSafe } from "../../../../json-safe"; -export const protobufPackage = "slinky.sla.module.v1"; -/** Module is the config object of the builder module. */ -export interface Module { - /** - * Authority defines the custom module authority. If not set, defaults to the - * governance module. - */ - authority: string; -} -function createBaseModule(): Module { - return { - authority: "", - }; -} -export const Module = { - typeUrl: "/slinky.sla.module.v1.Module", - encode(message: Module, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.authority !== "") { - writer.uint32(10).string(message.authority); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): Module { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseModule(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.authority = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): Module { - const obj = createBaseModule(); - if (isSet(object.authority)) obj.authority = String(object.authority); - return obj; - }, - toJSON(message: Module): JsonSafe { - const obj: any = {}; - message.authority !== undefined && (obj.authority = message.authority); - return obj; - }, - fromPartial, I>>(object: I): Module { - const message = createBaseModule(); - message.authority = object.authority ?? ""; - return message; - }, -}; diff --git a/src/slinky/sla/v1/genesis.ts b/src/slinky/sla/v1/genesis.ts deleted file mode 100644 index b24db54..0000000 --- a/src/slinky/sla/v1/genesis.ts +++ /dev/null @@ -1,433 +0,0 @@ -/* eslint-disable */ -import { CurrencyPair } from "../../types/v1/currency_pair"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, bytesFromBase64, base64FromBytes } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -import { Decimal } from "@cosmjs/math"; -export const protobufPackage = "slinky.sla.v1"; -/** GenesisState defines the sla module's genesis state. */ -export interface GenesisState { - /** SLAs are the SLAs that are currently active. */ - slas: PriceFeedSLA[]; - /** PrceFeeds are the price feeds that are currently active. */ - priceFeeds: PriceFeed[]; - /** Params are the parameters for the sla module. */ - params: Params; -} -/** Params defines the parameters for the sla module. */ -export interface Params { - /** Enabled is a flag to enable or disable the sla module. */ - enabled: boolean; -} -/** - * PriceFeedSLA defines the the desired SLA for a given set of price feeds. A - * price feed is defined to be a set of price prices for the same (currency - * pair, validator). - */ -export interface PriceFeedSLA { - /** - * MaximumViableWindow is the maximum time window that we are interested - * for the SLA. This is used to determine the moving window of blocks that - * we are interested in. - */ - maximumViableWindow: bigint; - /** - * ExpectedUptime is the expected uptime for the given validator and price - * feed. - */ - expectedUptime: string; - /** - * SlashConstant is the constant by which we will multiply the deviation from - * the expected uptime. - */ - slashConstant: string; - /** - * MinimumBlockUpdates is the minimum number of blocks that the - * validator had to have voted on in the maximum viable window - * in order to be considered for the SLA. - */ - minimumBlockUpdates: bigint; - /** Frequency is the frequency at which we will check the SLA. */ - frequency: bigint; - /** ID is the unique identifier for the SLA. */ - id: string; -} -/** - * PriceFeed defines the object type that will be utilized to monitor how - * frequently validators are voting with price updates across the network. - */ -export interface PriceFeed { - /** UpdateMap represents the relevant moving window of price feed updates. */ - updateMap: Uint8Array; - /** - * InclusionMap represents the relevant moving window of blocks that the - * validator has voted on. - */ - inclusionMap: Uint8Array; - /** Index corresponds to the current index into the bitmap. */ - index: bigint; - /** Validator represents the validator that this SLA corresponds to. */ - validator: Uint8Array; - /** CurrencyPair represents the currency pair that this SLA corresponds to. */ - currencyPair: CurrencyPair; - /** - * MaximumViableWindow represents the maximum number of blocks that can be - * represented by the bit map. - */ - maximumViableWindow: bigint; - /** ID corresponds to the SLA ID that this price feed corresponds to. */ - id: string; -} -function createBaseGenesisState(): GenesisState { - return { - slas: [], - priceFeeds: [], - params: Params.fromPartial({}), - }; -} -export const GenesisState = { - typeUrl: "/slinky.sla.v1.GenesisState", - encode(message: GenesisState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.slas) { - PriceFeedSLA.encode(v!, writer.uint32(10).fork()).ldelim(); - } - for (const v of message.priceFeeds) { - PriceFeed.encode(v!, writer.uint32(18).fork()).ldelim(); - } - if (message.params !== undefined) { - Params.encode(message.params, writer.uint32(26).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenesisState(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.slas.push(PriceFeedSLA.decode(reader, reader.uint32())); - break; - case 2: - message.priceFeeds.push(PriceFeed.decode(reader, reader.uint32())); - break; - case 3: - message.params = Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): GenesisState { - const obj = createBaseGenesisState(); - if (Array.isArray(object?.slas)) obj.slas = object.slas.map((e: any) => PriceFeedSLA.fromJSON(e)); - if (Array.isArray(object?.priceFeeds)) - obj.priceFeeds = object.priceFeeds.map((e: any) => PriceFeed.fromJSON(e)); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; - }, - toJSON(message: GenesisState): JsonSafe { - const obj: any = {}; - if (message.slas) { - obj.slas = message.slas.map((e) => (e ? PriceFeedSLA.toJSON(e) : undefined)); - } else { - obj.slas = []; - } - if (message.priceFeeds) { - obj.priceFeeds = message.priceFeeds.map((e) => (e ? PriceFeed.toJSON(e) : undefined)); - } else { - obj.priceFeeds = []; - } - message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); - return obj; - }, - fromPartial, I>>(object: I): GenesisState { - const message = createBaseGenesisState(); - message.slas = object.slas?.map((e) => PriceFeedSLA.fromPartial(e)) || []; - message.priceFeeds = object.priceFeeds?.map((e) => PriceFeed.fromPartial(e)) || []; - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } - return message; - }, -}; -function createBaseParams(): Params { - return { - enabled: false, - }; -} -export const Params = { - typeUrl: "/slinky.sla.v1.Params", - encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.enabled === true) { - writer.uint32(8).bool(message.enabled); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): Params { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseParams(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.enabled = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): Params { - const obj = createBaseParams(); - if (isSet(object.enabled)) obj.enabled = Boolean(object.enabled); - return obj; - }, - toJSON(message: Params): JsonSafe { - const obj: any = {}; - message.enabled !== undefined && (obj.enabled = message.enabled); - return obj; - }, - fromPartial, I>>(object: I): Params { - const message = createBaseParams(); - message.enabled = object.enabled ?? false; - return message; - }, -}; -function createBasePriceFeedSLA(): PriceFeedSLA { - return { - maximumViableWindow: BigInt(0), - expectedUptime: "", - slashConstant: "", - minimumBlockUpdates: BigInt(0), - frequency: BigInt(0), - id: "", - }; -} -export const PriceFeedSLA = { - typeUrl: "/slinky.sla.v1.PriceFeedSLA", - encode(message: PriceFeedSLA, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.maximumViableWindow !== BigInt(0)) { - writer.uint32(8).uint64(message.maximumViableWindow); - } - if (message.expectedUptime !== "") { - writer.uint32(18).string(Decimal.fromUserInput(message.expectedUptime, 18).atomics); - } - if (message.slashConstant !== "") { - writer.uint32(26).string(Decimal.fromUserInput(message.slashConstant, 18).atomics); - } - if (message.minimumBlockUpdates !== BigInt(0)) { - writer.uint32(32).uint64(message.minimumBlockUpdates); - } - if (message.frequency !== BigInt(0)) { - writer.uint32(40).uint64(message.frequency); - } - if (message.id !== "") { - writer.uint32(50).string(message.id); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): PriceFeedSLA { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePriceFeedSLA(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.maximumViableWindow = reader.uint64(); - break; - case 2: - message.expectedUptime = Decimal.fromAtomics(reader.string(), 18).toString(); - break; - case 3: - message.slashConstant = Decimal.fromAtomics(reader.string(), 18).toString(); - break; - case 4: - message.minimumBlockUpdates = reader.uint64(); - break; - case 5: - message.frequency = reader.uint64(); - break; - case 6: - message.id = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): PriceFeedSLA { - const obj = createBasePriceFeedSLA(); - if (isSet(object.maximumViableWindow)) - obj.maximumViableWindow = BigInt(object.maximumViableWindow.toString()); - if (isSet(object.expectedUptime)) obj.expectedUptime = String(object.expectedUptime); - if (isSet(object.slashConstant)) obj.slashConstant = String(object.slashConstant); - if (isSet(object.minimumBlockUpdates)) - obj.minimumBlockUpdates = BigInt(object.minimumBlockUpdates.toString()); - if (isSet(object.frequency)) obj.frequency = BigInt(object.frequency.toString()); - if (isSet(object.id)) obj.id = String(object.id); - return obj; - }, - toJSON(message: PriceFeedSLA): JsonSafe { - const obj: any = {}; - message.maximumViableWindow !== undefined && - (obj.maximumViableWindow = (message.maximumViableWindow || BigInt(0)).toString()); - message.expectedUptime !== undefined && (obj.expectedUptime = message.expectedUptime); - message.slashConstant !== undefined && (obj.slashConstant = message.slashConstant); - message.minimumBlockUpdates !== undefined && - (obj.minimumBlockUpdates = (message.minimumBlockUpdates || BigInt(0)).toString()); - message.frequency !== undefined && (obj.frequency = (message.frequency || BigInt(0)).toString()); - message.id !== undefined && (obj.id = message.id); - return obj; - }, - fromPartial, I>>(object: I): PriceFeedSLA { - const message = createBasePriceFeedSLA(); - if (object.maximumViableWindow !== undefined && object.maximumViableWindow !== null) { - message.maximumViableWindow = BigInt(object.maximumViableWindow.toString()); - } - message.expectedUptime = object.expectedUptime ?? ""; - message.slashConstant = object.slashConstant ?? ""; - if (object.minimumBlockUpdates !== undefined && object.minimumBlockUpdates !== null) { - message.minimumBlockUpdates = BigInt(object.minimumBlockUpdates.toString()); - } - if (object.frequency !== undefined && object.frequency !== null) { - message.frequency = BigInt(object.frequency.toString()); - } - message.id = object.id ?? ""; - return message; - }, -}; -function createBasePriceFeed(): PriceFeed { - return { - updateMap: new Uint8Array(), - inclusionMap: new Uint8Array(), - index: BigInt(0), - validator: new Uint8Array(), - currencyPair: CurrencyPair.fromPartial({}), - maximumViableWindow: BigInt(0), - id: "", - }; -} -export const PriceFeed = { - typeUrl: "/slinky.sla.v1.PriceFeed", - encode(message: PriceFeed, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.updateMap.length !== 0) { - writer.uint32(10).bytes(message.updateMap); - } - if (message.inclusionMap.length !== 0) { - writer.uint32(18).bytes(message.inclusionMap); - } - if (message.index !== BigInt(0)) { - writer.uint32(24).uint64(message.index); - } - if (message.validator.length !== 0) { - writer.uint32(34).bytes(message.validator); - } - if (message.currencyPair !== undefined) { - CurrencyPair.encode(message.currencyPair, writer.uint32(42).fork()).ldelim(); - } - if (message.maximumViableWindow !== BigInt(0)) { - writer.uint32(48).uint64(message.maximumViableWindow); - } - if (message.id !== "") { - writer.uint32(58).string(message.id); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): PriceFeed { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePriceFeed(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.updateMap = reader.bytes(); - break; - case 2: - message.inclusionMap = reader.bytes(); - break; - case 3: - message.index = reader.uint64(); - break; - case 4: - message.validator = reader.bytes(); - break; - case 5: - message.currencyPair = CurrencyPair.decode(reader, reader.uint32()); - break; - case 6: - message.maximumViableWindow = reader.uint64(); - break; - case 7: - message.id = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): PriceFeed { - const obj = createBasePriceFeed(); - if (isSet(object.updateMap)) obj.updateMap = bytesFromBase64(object.updateMap); - if (isSet(object.inclusionMap)) obj.inclusionMap = bytesFromBase64(object.inclusionMap); - if (isSet(object.index)) obj.index = BigInt(object.index.toString()); - if (isSet(object.validator)) obj.validator = bytesFromBase64(object.validator); - if (isSet(object.currencyPair)) obj.currencyPair = CurrencyPair.fromJSON(object.currencyPair); - if (isSet(object.maximumViableWindow)) - obj.maximumViableWindow = BigInt(object.maximumViableWindow.toString()); - if (isSet(object.id)) obj.id = String(object.id); - return obj; - }, - toJSON(message: PriceFeed): JsonSafe { - const obj: any = {}; - message.updateMap !== undefined && - (obj.updateMap = base64FromBytes( - message.updateMap !== undefined ? message.updateMap : new Uint8Array(), - )); - message.inclusionMap !== undefined && - (obj.inclusionMap = base64FromBytes( - message.inclusionMap !== undefined ? message.inclusionMap : new Uint8Array(), - )); - message.index !== undefined && (obj.index = (message.index || BigInt(0)).toString()); - message.validator !== undefined && - (obj.validator = base64FromBytes( - message.validator !== undefined ? message.validator : new Uint8Array(), - )); - message.currencyPair !== undefined && - (obj.currencyPair = message.currencyPair ? CurrencyPair.toJSON(message.currencyPair) : undefined); - message.maximumViableWindow !== undefined && - (obj.maximumViableWindow = (message.maximumViableWindow || BigInt(0)).toString()); - message.id !== undefined && (obj.id = message.id); - return obj; - }, - fromPartial, I>>(object: I): PriceFeed { - const message = createBasePriceFeed(); - message.updateMap = object.updateMap ?? new Uint8Array(); - message.inclusionMap = object.inclusionMap ?? new Uint8Array(); - if (object.index !== undefined && object.index !== null) { - message.index = BigInt(object.index.toString()); - } - message.validator = object.validator ?? new Uint8Array(); - if (object.currencyPair !== undefined && object.currencyPair !== null) { - message.currencyPair = CurrencyPair.fromPartial(object.currencyPair); - } - if (object.maximumViableWindow !== undefined && object.maximumViableWindow !== null) { - message.maximumViableWindow = BigInt(object.maximumViableWindow.toString()); - } - message.id = object.id ?? ""; - return message; - }, -}; diff --git a/src/slinky/sla/v1/query.rpc.Query.ts b/src/slinky/sla/v1/query.rpc.Query.ts deleted file mode 100644 index 0651a5e..0000000 --- a/src/slinky/sla/v1/query.rpc.Query.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* eslint-disable */ -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; -import { - GetAllSLAsRequest, - GetAllSLAsResponse, - GetPriceFeedsRequest, - GetPriceFeedsResponse, - ParamsRequest, - ParamsResponse, -} from "./query"; -/** Query is the query service for the x/sla module. */ -export interface Query { - /** GetAllSLAs returns all SLAs that the module is currently enforcing. */ - getAllSLAs(request?: GetAllSLAsRequest): Promise; - /** - * GetPriceFeeds returns all price feeds that the module is currently - * tracking. This request type inputs the SLA ID to query price feeds for. - */ - getPriceFeeds(request: GetPriceFeedsRequest): Promise; - /** Params returns the current SLA module parameters. */ - params(request?: ParamsRequest): Promise; -} -export class QueryClientImpl implements Query { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { - this.rpc = rpc; - this.getAllSLAs = this.getAllSLAs.bind(this); - this.getPriceFeeds = this.getPriceFeeds.bind(this); - this.params = this.params.bind(this); - } - getAllSLAs(request: GetAllSLAsRequest = {}): Promise { - const data = GetAllSLAsRequest.encode(request).finish(); - const promise = this.rpc.request("slinky.sla.v1.Query", "GetAllSLAs", data); - return promise.then((data) => GetAllSLAsResponse.decode(new BinaryReader(data))); - } - getPriceFeeds(request: GetPriceFeedsRequest): Promise { - const data = GetPriceFeedsRequest.encode(request).finish(); - const promise = this.rpc.request("slinky.sla.v1.Query", "GetPriceFeeds", data); - return promise.then((data) => GetPriceFeedsResponse.decode(new BinaryReader(data))); - } - params(request: ParamsRequest = {}): Promise { - const data = ParamsRequest.encode(request).finish(); - const promise = this.rpc.request("slinky.sla.v1.Query", "Params", data); - return promise.then((data) => ParamsResponse.decode(new BinaryReader(data))); - } -} -export const createRpcQueryExtension = (base: QueryClient) => { - const rpc = createProtobufRpcClient(base); - const queryService = new QueryClientImpl(rpc); - return { - getAllSLAs(request?: GetAllSLAsRequest): Promise { - return queryService.getAllSLAs(request); - }, - getPriceFeeds(request: GetPriceFeedsRequest): Promise { - return queryService.getPriceFeeds(request); - }, - params(request?: ParamsRequest): Promise { - return queryService.params(request); - }, - }; -}; diff --git a/src/slinky/sla/v1/query.ts b/src/slinky/sla/v1/query.ts deleted file mode 100644 index 242b76b..0000000 --- a/src/slinky/sla/v1/query.ts +++ /dev/null @@ -1,302 +0,0 @@ -/* eslint-disable */ -import { PriceFeedSLA, PriceFeed, Params } from "./genesis"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { JsonSafe } from "../../../json-safe"; -import { DeepPartial, Exact, isSet } from "../../../helpers"; -export const protobufPackage = "slinky.sla.v1"; -/** QueryAllSLAsRequest is the request type for the Query/GetAllSLAs RPC method. */ -export interface GetAllSLAsRequest {} -/** - * QueryAllSLAsResponse is the response type for the Query/GetAllSLAs RPC - * method. - */ -export interface GetAllSLAsResponse { - slas: PriceFeedSLA[]; -} -/** - * QueryGetPriceFeedsRequest is the request type for the Query/GetPriceFeeds RPC - * method. - */ -export interface GetPriceFeedsRequest { - /** ID defines the SLA to query price feeds for. */ - id: string; -} -/** - * QueryGetPriceFeedsResponse is the response type for the Query/GetPriceFeeds - * RPC method. - */ -export interface GetPriceFeedsResponse { - /** PriceFeeds defines the price feeds for the given SLA. */ - priceFeeds: PriceFeed[]; -} -/** QueryParamsRequest is the request type for the Query/Params RPC method. */ -export interface ParamsRequest {} -/** QueryParamsResponse is the response type for the Query/Params RPC method. */ -export interface ParamsResponse { - params: Params; -} -function createBaseGetAllSLAsRequest(): GetAllSLAsRequest { - return {}; -} -export const GetAllSLAsRequest = { - typeUrl: "/slinky.sla.v1.GetAllSLAsRequest", - encode(_: GetAllSLAsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): GetAllSLAsRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetAllSLAsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(_: any): GetAllSLAsRequest { - const obj = createBaseGetAllSLAsRequest(); - return obj; - }, - toJSON(_: GetAllSLAsRequest): JsonSafe { - const obj: any = {}; - return obj; - }, - fromPartial, I>>(_: I): GetAllSLAsRequest { - const message = createBaseGetAllSLAsRequest(); - return message; - }, -}; -function createBaseGetAllSLAsResponse(): GetAllSLAsResponse { - return { - slas: [], - }; -} -export const GetAllSLAsResponse = { - typeUrl: "/slinky.sla.v1.GetAllSLAsResponse", - encode(message: GetAllSLAsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.slas) { - PriceFeedSLA.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): GetAllSLAsResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetAllSLAsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.slas.push(PriceFeedSLA.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): GetAllSLAsResponse { - const obj = createBaseGetAllSLAsResponse(); - if (Array.isArray(object?.slas)) obj.slas = object.slas.map((e: any) => PriceFeedSLA.fromJSON(e)); - return obj; - }, - toJSON(message: GetAllSLAsResponse): JsonSafe { - const obj: any = {}; - if (message.slas) { - obj.slas = message.slas.map((e) => (e ? PriceFeedSLA.toJSON(e) : undefined)); - } else { - obj.slas = []; - } - return obj; - }, - fromPartial, I>>(object: I): GetAllSLAsResponse { - const message = createBaseGetAllSLAsResponse(); - message.slas = object.slas?.map((e) => PriceFeedSLA.fromPartial(e)) || []; - return message; - }, -}; -function createBaseGetPriceFeedsRequest(): GetPriceFeedsRequest { - return { - id: "", - }; -} -export const GetPriceFeedsRequest = { - typeUrl: "/slinky.sla.v1.GetPriceFeedsRequest", - encode(message: GetPriceFeedsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.id !== "") { - writer.uint32(10).string(message.id); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): GetPriceFeedsRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetPriceFeedsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): GetPriceFeedsRequest { - const obj = createBaseGetPriceFeedsRequest(); - if (isSet(object.id)) obj.id = String(object.id); - return obj; - }, - toJSON(message: GetPriceFeedsRequest): JsonSafe { - const obj: any = {}; - message.id !== undefined && (obj.id = message.id); - return obj; - }, - fromPartial, I>>(object: I): GetPriceFeedsRequest { - const message = createBaseGetPriceFeedsRequest(); - message.id = object.id ?? ""; - return message; - }, -}; -function createBaseGetPriceFeedsResponse(): GetPriceFeedsResponse { - return { - priceFeeds: [], - }; -} -export const GetPriceFeedsResponse = { - typeUrl: "/slinky.sla.v1.GetPriceFeedsResponse", - encode(message: GetPriceFeedsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.priceFeeds) { - PriceFeed.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): GetPriceFeedsResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetPriceFeedsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.priceFeeds.push(PriceFeed.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): GetPriceFeedsResponse { - const obj = createBaseGetPriceFeedsResponse(); - if (Array.isArray(object?.priceFeeds)) - obj.priceFeeds = object.priceFeeds.map((e: any) => PriceFeed.fromJSON(e)); - return obj; - }, - toJSON(message: GetPriceFeedsResponse): JsonSafe { - const obj: any = {}; - if (message.priceFeeds) { - obj.priceFeeds = message.priceFeeds.map((e) => (e ? PriceFeed.toJSON(e) : undefined)); - } else { - obj.priceFeeds = []; - } - return obj; - }, - fromPartial, I>>(object: I): GetPriceFeedsResponse { - const message = createBaseGetPriceFeedsResponse(); - message.priceFeeds = object.priceFeeds?.map((e) => PriceFeed.fromPartial(e)) || []; - return message; - }, -}; -function createBaseParamsRequest(): ParamsRequest { - return {}; -} -export const ParamsRequest = { - typeUrl: "/slinky.sla.v1.ParamsRequest", - encode(_: ParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): ParamsRequest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseParamsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(_: any): ParamsRequest { - const obj = createBaseParamsRequest(); - return obj; - }, - toJSON(_: ParamsRequest): JsonSafe { - const obj: any = {}; - return obj; - }, - fromPartial, I>>(_: I): ParamsRequest { - const message = createBaseParamsRequest(); - return message; - }, -}; -function createBaseParamsResponse(): ParamsResponse { - return { - params: Params.fromPartial({}), - }; -} -export const ParamsResponse = { - typeUrl: "/slinky.sla.v1.ParamsResponse", - encode(message: ParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.params !== undefined) { - Params.encode(message.params, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): ParamsResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseParamsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.params = Params.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): ParamsResponse { - const obj = createBaseParamsResponse(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - return obj; - }, - toJSON(message: ParamsResponse): JsonSafe { - const obj: any = {}; - message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); - return obj; - }, - fromPartial, I>>(object: I): ParamsResponse { - const message = createBaseParamsResponse(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } - return message; - }, -}; diff --git a/src/slinky/sla/v1/tx.rpc.msg.ts b/src/slinky/sla/v1/tx.rpc.msg.ts deleted file mode 100644 index 2f846fd..0000000 --- a/src/slinky/sla/v1/tx.rpc.msg.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* eslint-disable */ -import { Rpc } from "../../../helpers"; -import { BinaryReader } from "../../../binary"; -import { - MsgAddSLAs, - MsgAddSLAsResponse, - MsgRemoveSLAs, - MsgRemoveSLAsResponse, - MsgParams, - MsgParamsResponse, -} from "./tx"; -/** Msg is the message service for the x/sla module. */ -export interface Msg { - /** - * AddSLA defines a method for adding a new SLAs to the store. Note, this will - * overwrite any existing SLA with the same ID. - */ - addSLAs(request: MsgAddSLAs): Promise; - /** - * RemoveSLA defines a method for removing existing SLAs from the store. Note, - * this will not panic if the SLA does not exist. - */ - removeSLAs(request: MsgRemoveSLAs): Promise; - /** Params defines a method for updating the SLA module parameters. */ - params(request: MsgParams): Promise; -} -export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { - this.rpc = rpc; - this.addSLAs = this.addSLAs.bind(this); - this.removeSLAs = this.removeSLAs.bind(this); - this.params = this.params.bind(this); - } - addSLAs(request: MsgAddSLAs): Promise { - const data = MsgAddSLAs.encode(request).finish(); - const promise = this.rpc.request("slinky.sla.v1.Msg", "AddSLAs", data); - return promise.then((data) => MsgAddSLAsResponse.decode(new BinaryReader(data))); - } - removeSLAs(request: MsgRemoveSLAs): Promise { - const data = MsgRemoveSLAs.encode(request).finish(); - const promise = this.rpc.request("slinky.sla.v1.Msg", "RemoveSLAs", data); - return promise.then((data) => MsgRemoveSLAsResponse.decode(new BinaryReader(data))); - } - params(request: MsgParams): Promise { - const data = MsgParams.encode(request).finish(); - const promise = this.rpc.request("slinky.sla.v1.Msg", "Params", data); - return promise.then((data) => MsgParamsResponse.decode(new BinaryReader(data))); - } -} diff --git a/src/slinky/sla/v1/tx.ts b/src/slinky/sla/v1/tx.ts deleted file mode 100644 index 3d92f0e..0000000 --- a/src/slinky/sla/v1/tx.ts +++ /dev/null @@ -1,325 +0,0 @@ -/* eslint-disable */ -import { PriceFeedSLA, Params } from "./genesis"; -import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; -import { JsonSafe } from "../../../json-safe"; -export const protobufPackage = "slinky.sla.v1"; -/** - * MsgAddSLAs defines the Msg/AddSLAs request type. It contains the - * SLAs to be added to the store. - */ -export interface MsgAddSLAs { - /** SLAs defines the SLAs to be added to the store. */ - slas: PriceFeedSLA[]; - /** Authority defines the authority that is adding the SLAs. */ - authority: string; -} -/** MsgAddSLAsResponse defines the Msg/AddSLAs response type. */ -export interface MsgAddSLAsResponse {} -/** - * MsgRemoveSLAs defines the Msg/RemoveSLAs request type. It contains the - * IDs of the SLAs to be removed from the store. - */ -export interface MsgRemoveSLAs { - /** IDs defines the IDs of the SLAs to be removed from the store. */ - ids: string[]; - /** Authority defines the authority that is removing the SLAs. */ - authority: string; -} -/** MsgRemoveSLAsResponse defines the Msg/RemoveSLAs response type. */ -export interface MsgRemoveSLAsResponse {} -/** - * MsgParams defines the Msg/Params request type. It contains the - * new parameters for the SLA module. - */ -export interface MsgParams { - /** Params defines the new parameters for the SLA module. */ - params: Params; - /** Authority defines the authority that is updating the SLA module parameters. */ - authority: string; -} -/** MsgParamsResponse defines the Msg/Params response type. */ -export interface MsgParamsResponse {} -function createBaseMsgAddSLAs(): MsgAddSLAs { - return { - slas: [], - authority: "", - }; -} -export const MsgAddSLAs = { - typeUrl: "/slinky.sla.v1.MsgAddSLAs", - encode(message: MsgAddSLAs, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.slas) { - PriceFeedSLA.encode(v!, writer.uint32(10).fork()).ldelim(); - } - if (message.authority !== "") { - writer.uint32(18).string(message.authority); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgAddSLAs { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgAddSLAs(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.slas.push(PriceFeedSLA.decode(reader, reader.uint32())); - break; - case 2: - message.authority = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): MsgAddSLAs { - const obj = createBaseMsgAddSLAs(); - if (Array.isArray(object?.slas)) obj.slas = object.slas.map((e: any) => PriceFeedSLA.fromJSON(e)); - if (isSet(object.authority)) obj.authority = String(object.authority); - return obj; - }, - toJSON(message: MsgAddSLAs): JsonSafe { - const obj: any = {}; - if (message.slas) { - obj.slas = message.slas.map((e) => (e ? PriceFeedSLA.toJSON(e) : undefined)); - } else { - obj.slas = []; - } - message.authority !== undefined && (obj.authority = message.authority); - return obj; - }, - fromPartial, I>>(object: I): MsgAddSLAs { - const message = createBaseMsgAddSLAs(); - message.slas = object.slas?.map((e) => PriceFeedSLA.fromPartial(e)) || []; - message.authority = object.authority ?? ""; - return message; - }, -}; -function createBaseMsgAddSLAsResponse(): MsgAddSLAsResponse { - return {}; -} -export const MsgAddSLAsResponse = { - typeUrl: "/slinky.sla.v1.MsgAddSLAsResponse", - encode(_: MsgAddSLAsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgAddSLAsResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgAddSLAsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(_: any): MsgAddSLAsResponse { - const obj = createBaseMsgAddSLAsResponse(); - return obj; - }, - toJSON(_: MsgAddSLAsResponse): JsonSafe { - const obj: any = {}; - return obj; - }, - fromPartial, I>>(_: I): MsgAddSLAsResponse { - const message = createBaseMsgAddSLAsResponse(); - return message; - }, -}; -function createBaseMsgRemoveSLAs(): MsgRemoveSLAs { - return { - ids: [], - authority: "", - }; -} -export const MsgRemoveSLAs = { - typeUrl: "/slinky.sla.v1.MsgRemoveSLAs", - encode(message: MsgRemoveSLAs, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - for (const v of message.ids) { - writer.uint32(10).string(v!); - } - if (message.authority !== "") { - writer.uint32(18).string(message.authority); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgRemoveSLAs { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgRemoveSLAs(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.ids.push(reader.string()); - break; - case 2: - message.authority = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): MsgRemoveSLAs { - const obj = createBaseMsgRemoveSLAs(); - if (Array.isArray(object?.ids)) obj.ids = object.ids.map((e: any) => String(e)); - if (isSet(object.authority)) obj.authority = String(object.authority); - return obj; - }, - toJSON(message: MsgRemoveSLAs): JsonSafe { - const obj: any = {}; - if (message.ids) { - obj.ids = message.ids.map((e) => e); - } else { - obj.ids = []; - } - message.authority !== undefined && (obj.authority = message.authority); - return obj; - }, - fromPartial, I>>(object: I): MsgRemoveSLAs { - const message = createBaseMsgRemoveSLAs(); - message.ids = object.ids?.map((e) => e) || []; - message.authority = object.authority ?? ""; - return message; - }, -}; -function createBaseMsgRemoveSLAsResponse(): MsgRemoveSLAsResponse { - return {}; -} -export const MsgRemoveSLAsResponse = { - typeUrl: "/slinky.sla.v1.MsgRemoveSLAsResponse", - encode(_: MsgRemoveSLAsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgRemoveSLAsResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgRemoveSLAsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(_: any): MsgRemoveSLAsResponse { - const obj = createBaseMsgRemoveSLAsResponse(); - return obj; - }, - toJSON(_: MsgRemoveSLAsResponse): JsonSafe { - const obj: any = {}; - return obj; - }, - fromPartial, I>>(_: I): MsgRemoveSLAsResponse { - const message = createBaseMsgRemoveSLAsResponse(); - return message; - }, -}; -function createBaseMsgParams(): MsgParams { - return { - params: Params.fromPartial({}), - authority: "", - }; -} -export const MsgParams = { - typeUrl: "/slinky.sla.v1.MsgParams", - encode(message: MsgParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.params !== undefined) { - Params.encode(message.params, writer.uint32(10).fork()).ldelim(); - } - if (message.authority !== "") { - writer.uint32(18).string(message.authority); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgParams { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgParams(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.params = Params.decode(reader, reader.uint32()); - break; - case 2: - message.authority = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): MsgParams { - const obj = createBaseMsgParams(); - if (isSet(object.params)) obj.params = Params.fromJSON(object.params); - if (isSet(object.authority)) obj.authority = String(object.authority); - return obj; - }, - toJSON(message: MsgParams): JsonSafe { - const obj: any = {}; - message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); - message.authority !== undefined && (obj.authority = message.authority); - return obj; - }, - fromPartial, I>>(object: I): MsgParams { - const message = createBaseMsgParams(); - if (object.params !== undefined && object.params !== null) { - message.params = Params.fromPartial(object.params); - } - message.authority = object.authority ?? ""; - return message; - }, -}; -function createBaseMsgParamsResponse(): MsgParamsResponse { - return {}; -} -export const MsgParamsResponse = { - typeUrl: "/slinky.sla.v1.MsgParamsResponse", - encode(_: MsgParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): MsgParamsResponse { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgParamsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(_: any): MsgParamsResponse { - const obj = createBaseMsgParamsResponse(); - return obj; - }, - toJSON(_: MsgParamsResponse): JsonSafe { - const obj: any = {}; - return obj; - }, - fromPartial, I>>(_: I): MsgParamsResponse { - const message = createBaseMsgParamsResponse(); - return message; - }, -};