diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/genesis.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/genesis.ts index 00311a9921..5ffc5a7edf 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/genesis.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/genesis.ts @@ -1,20 +1,136 @@ +import { AccountAuthenticator, AccountAuthenticatorSDKType } from "./models"; import { AccountState, AccountStateSDKType } from "./accountplus"; +import { Params, ParamsSDKType } from "./params"; import * as _m0 from "protobufjs/minimal"; -import { DeepPartial } from "../../helpers"; +import { DeepPartial, Long } from "../../helpers"; +/** + * AuthenticatorData represents a genesis exported account with Authenticators. + * The address is used as the key, and the account authenticators are stored in + * the authenticators field. + */ + +export interface AuthenticatorData { + /** address is an account address, one address can have many authenticators */ + address: string; + /** + * authenticators are the account's authenticators, these can be multiple + * types including SignatureVerification, AllOfs, CosmWasmAuthenticators, etc + */ + + authenticators: AccountAuthenticator[]; +} +/** + * AuthenticatorData represents a genesis exported account with Authenticators. + * The address is used as the key, and the account authenticators are stored in + * the authenticators field. + */ + +export interface AuthenticatorDataSDKType { + /** address is an account address, one address can have many authenticators */ + address: string; + /** + * authenticators are the account's authenticators, these can be multiple + * types including SignatureVerification, AllOfs, CosmWasmAuthenticators, etc + */ + + authenticators: AccountAuthenticatorSDKType[]; +} /** Module genesis state */ export interface GenesisState { accounts: AccountState[]; + /** params define the parameters for the authenticator module. */ + + params?: Params; + /** next_authenticator_id is the next available authenticator ID. */ + + nextAuthenticatorId: Long; + /** + * authenticator_data contains the data for multiple accounts, each with their + * authenticators. + */ + + authenticatorData: AuthenticatorData[]; } /** Module genesis state */ export interface GenesisStateSDKType { accounts: AccountStateSDKType[]; + /** params define the parameters for the authenticator module. */ + + params?: ParamsSDKType; + /** next_authenticator_id is the next available authenticator ID. */ + + next_authenticator_id: Long; + /** + * authenticator_data contains the data for multiple accounts, each with their + * authenticators. + */ + + authenticator_data: AuthenticatorDataSDKType[]; +} + +function createBaseAuthenticatorData(): AuthenticatorData { + return { + address: "", + authenticators: [] + }; } +export const AuthenticatorData = { + encode(message: AuthenticatorData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + + for (const v of message.authenticators) { + AccountAuthenticator.encode(v!, writer.uint32(18).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AuthenticatorData { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthenticatorData(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + + case 2: + message.authenticators.push(AccountAuthenticator.decode(reader, reader.uint32())); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): AuthenticatorData { + const message = createBaseAuthenticatorData(); + message.address = object.address ?? ""; + message.authenticators = object.authenticators?.map(e => AccountAuthenticator.fromPartial(e)) || []; + return message; + } + +}; + function createBaseGenesisState(): GenesisState { return { - accounts: [] + accounts: [], + params: undefined, + nextAuthenticatorId: Long.UZERO, + authenticatorData: [] }; } @@ -24,6 +140,18 @@ export const GenesisState = { AccountState.encode(v!, writer.uint32(10).fork()).ldelim(); } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + + if (!message.nextAuthenticatorId.isZero()) { + writer.uint32(24).uint64(message.nextAuthenticatorId); + } + + for (const v of message.authenticatorData) { + AuthenticatorData.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; }, @@ -40,6 +168,18 @@ export const GenesisState = { message.accounts.push(AccountState.decode(reader, reader.uint32())); break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + + case 3: + message.nextAuthenticatorId = (reader.uint64() as Long); + break; + + case 4: + message.authenticatorData.push(AuthenticatorData.decode(reader, reader.uint32())); + break; + default: reader.skipType(tag & 7); break; @@ -52,6 +192,9 @@ export const GenesisState = { fromPartial(object: DeepPartial): GenesisState { const message = createBaseGenesisState(); message.accounts = object.accounts?.map(e => AccountState.fromPartial(e)) || []; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.nextAuthenticatorId = object.nextAuthenticatorId !== undefined && object.nextAuthenticatorId !== null ? Long.fromValue(object.nextAuthenticatorId) : Long.UZERO; + message.authenticatorData = object.authenticatorData?.map(e => AuthenticatorData.fromPartial(e)) || []; return message; } diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/models.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/models.ts new file mode 100644 index 0000000000..2e7ce339aa --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/models.ts @@ -0,0 +1,117 @@ +import * as _m0 from "protobufjs/minimal"; +import { Long, DeepPartial } from "../../helpers"; +/** + * AccountAuthenticator represents a foundational model for all authenticators. + * It provides extensibility by allowing concrete types to interpret and + * validate transactions based on the encapsulated data. + */ + +export interface AccountAuthenticator { + /** ID uniquely identifies the authenticator instance. */ + id: Long; + /** + * Type specifies the category of the AccountAuthenticator. + * This type information is essential for differentiating authenticators + * and ensuring precise data retrieval from the storage layer. + */ + + type: string; + /** + * Config is a versatile field used in conjunction with the specific type of + * account authenticator to facilitate complex authentication processes. + * The interpretation of this field is overloaded, enabling multiple + * authenticators to utilize it for their respective purposes. + */ + + config: Uint8Array; +} +/** + * AccountAuthenticator represents a foundational model for all authenticators. + * It provides extensibility by allowing concrete types to interpret and + * validate transactions based on the encapsulated data. + */ + +export interface AccountAuthenticatorSDKType { + /** ID uniquely identifies the authenticator instance. */ + id: Long; + /** + * Type specifies the category of the AccountAuthenticator. + * This type information is essential for differentiating authenticators + * and ensuring precise data retrieval from the storage layer. + */ + + type: string; + /** + * Config is a versatile field used in conjunction with the specific type of + * account authenticator to facilitate complex authentication processes. + * The interpretation of this field is overloaded, enabling multiple + * authenticators to utilize it for their respective purposes. + */ + + config: Uint8Array; +} + +function createBaseAccountAuthenticator(): AccountAuthenticator { + return { + id: Long.UZERO, + type: "", + config: new Uint8Array() + }; +} + +export const AccountAuthenticator = { + encode(message: AccountAuthenticator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (!message.id.isZero()) { + writer.uint32(8).uint64(message.id); + } + + if (message.type !== "") { + writer.uint32(18).string(message.type); + } + + if (message.config.length !== 0) { + writer.uint32(26).bytes(message.config); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AccountAuthenticator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccountAuthenticator(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.id = (reader.uint64() as Long); + break; + + case 2: + message.type = reader.string(); + break; + + case 3: + message.config = reader.bytes(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): AccountAuthenticator { + const message = createBaseAccountAuthenticator(); + message.id = object.id !== undefined && object.id !== null ? Long.fromValue(object.id) : Long.UZERO; + message.type = object.type ?? ""; + message.config = object.config ?? new Uint8Array(); + return message; + } + +}; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/params.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/params.ts new file mode 100644 index 0000000000..e0c5fb5adb --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/params.ts @@ -0,0 +1,67 @@ +import * as _m0 from "protobufjs/minimal"; +import { DeepPartial } from "../../helpers"; +/** Params defines the parameters for the module. */ + +export interface Params { + /** + * IsSmartAccountActive defines the state of the authenticator. + * If set to false, the authenticator module will not be used + * and the classic cosmos sdk authentication will be used instead. + */ + isSmartAccountActive: boolean; +} +/** Params defines the parameters for the module. */ + +export interface ParamsSDKType { + /** + * IsSmartAccountActive defines the state of the authenticator. + * If set to false, the authenticator module will not be used + * and the classic cosmos sdk authentication will be used instead. + */ + is_smart_account_active: boolean; +} + +function createBaseParams(): Params { + return { + isSmartAccountActive: false + }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.isSmartAccountActive === true) { + writer.uint32(8).bool(message.isSmartAccountActive); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(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.isSmartAccountActive = reader.bool(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.isSmartAccountActive = object.isSmartAccountActive ?? false; + return message; + } + +}; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.lcd.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.lcd.ts new file mode 100644 index 0000000000..6331bc8560 --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.lcd.ts @@ -0,0 +1,38 @@ +import { LCDClient } from "@osmonauts/lcd"; +import { QueryParamsRequest, QueryParamsResponseSDKType, GetAuthenticatorRequest, GetAuthenticatorResponseSDKType, GetAuthenticatorsRequest, GetAuthenticatorsResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + this.params = this.params.bind(this); + this.getAuthenticator = this.getAuthenticator.bind(this); + this.getAuthenticators = this.getAuthenticators.bind(this); + } + /* Parameters queries the parameters of the module. */ + + + async params(_params: QueryParamsRequest = {}): Promise { + const endpoint = `dydxprotocol/accountplus/params`; + return await this.req.get(endpoint); + } + /* Queries a single authenticator by account and authenticator ID. */ + + + async getAuthenticator(params: GetAuthenticatorRequest): Promise { + const endpoint = `dydxprotocol/accountplus/authenticator/${params.account}/${params.authenticatorId}`; + return await this.req.get(endpoint); + } + /* Queries all authenticators for a given account. */ + + + async getAuthenticators(params: GetAuthenticatorsRequest): Promise { + const endpoint = `dydxprotocol/accountplus/authenticators/${params.account}`; + return await this.req.get(endpoint); + } + +} \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.rpc.Query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.rpc.Query.ts new file mode 100644 index 0000000000..ab66285450 --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.rpc.Query.ts @@ -0,0 +1,63 @@ +import { Rpc } from "../../helpers"; +import * as _m0 from "protobufjs/minimal"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +import { QueryParamsRequest, QueryParamsResponse, GetAuthenticatorRequest, GetAuthenticatorResponse, GetAuthenticatorsRequest, GetAuthenticatorsResponse } from "./query"; +/** Query defines the gRPC querier service. */ + +export interface Query { + /** Parameters queries the parameters of the module. */ + params(request?: QueryParamsRequest): Promise; + /** Queries a single authenticator by account and authenticator ID. */ + + getAuthenticator(request: GetAuthenticatorRequest): Promise; + /** Queries all authenticators for a given account. */ + + getAuthenticators(request: GetAuthenticatorsRequest): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + + constructor(rpc: Rpc) { + this.rpc = rpc; + this.params = this.params.bind(this); + this.getAuthenticator = this.getAuthenticator.bind(this); + this.getAuthenticators = this.getAuthenticators.bind(this); + } + + params(request: QueryParamsRequest = {}): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.accountplus.Query", "Params", data); + return promise.then(data => QueryParamsResponse.decode(new _m0.Reader(data))); + } + + getAuthenticator(request: GetAuthenticatorRequest): Promise { + const data = GetAuthenticatorRequest.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.accountplus.Query", "GetAuthenticator", data); + return promise.then(data => GetAuthenticatorResponse.decode(new _m0.Reader(data))); + } + + getAuthenticators(request: GetAuthenticatorsRequest): Promise { + const data = GetAuthenticatorsRequest.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.accountplus.Query", "GetAuthenticators", data); + return promise.then(data => GetAuthenticatorsResponse.decode(new _m0.Reader(data))); + } + +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return { + params(request?: QueryParamsRequest): Promise { + return queryService.params(request); + }, + + getAuthenticator(request: GetAuthenticatorRequest): Promise { + return queryService.getAuthenticator(request); + }, + + getAuthenticators(request: GetAuthenticatorsRequest): Promise { + return queryService.getAuthenticators(request); + } + + }; +}; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.ts new file mode 100644 index 0000000000..432a383d59 --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/query.ts @@ -0,0 +1,335 @@ +import { Params, ParamsSDKType } from "./params"; +import { AccountAuthenticator, AccountAuthenticatorSDKType } from "./models"; +import * as _m0 from "protobufjs/minimal"; +import { DeepPartial, Long } from "../../helpers"; +/** QueryParamsRequest is request type for the Query/Params RPC method. */ + +export interface QueryParamsRequest {} +/** QueryParamsRequest is request type for the Query/Params RPC method. */ + +export interface QueryParamsRequestSDKType {} +/** QueryParamsResponse is response type for the Query/Params RPC method. */ + +export interface QueryParamsResponse { + /** params holds all the parameters of this module. */ + params?: Params; +} +/** QueryParamsResponse is response type for the Query/Params RPC method. */ + +export interface QueryParamsResponseSDKType { + /** params holds all the parameters of this module. */ + params?: ParamsSDKType; +} +/** MsgGetAuthenticatorsRequest defines the Msg/GetAuthenticators request type. */ + +export interface GetAuthenticatorsRequest { + /** MsgGetAuthenticatorsRequest defines the Msg/GetAuthenticators request type. */ + account: string; +} +/** MsgGetAuthenticatorsRequest defines the Msg/GetAuthenticators request type. */ + +export interface GetAuthenticatorsRequestSDKType { + /** MsgGetAuthenticatorsRequest defines the Msg/GetAuthenticators request type. */ + account: string; +} +/** MsgGetAuthenticatorsResponse defines the Msg/GetAuthenticators response type. */ + +export interface GetAuthenticatorsResponse { + accountAuthenticators: AccountAuthenticator[]; +} +/** MsgGetAuthenticatorsResponse defines the Msg/GetAuthenticators response type. */ + +export interface GetAuthenticatorsResponseSDKType { + account_authenticators: AccountAuthenticatorSDKType[]; +} +/** MsgGetAuthenticatorRequest defines the Msg/GetAuthenticator request type. */ + +export interface GetAuthenticatorRequest { + account: string; + authenticatorId: Long; +} +/** MsgGetAuthenticatorRequest defines the Msg/GetAuthenticator request type. */ + +export interface GetAuthenticatorRequestSDKType { + account: string; + authenticator_id: Long; +} +/** MsgGetAuthenticatorResponse defines the Msg/GetAuthenticator response type. */ + +export interface GetAuthenticatorResponse { + accountAuthenticator?: AccountAuthenticator; +} +/** MsgGetAuthenticatorResponse defines the Msg/GetAuthenticator response type. */ + +export interface GetAuthenticatorResponseSDKType { + account_authenticator?: AccountAuthenticatorSDKType; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(_: DeepPartial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + } + +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: undefined + }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + + 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; + }, + + fromPartial(object: DeepPartial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + } + +}; + +function createBaseGetAuthenticatorsRequest(): GetAuthenticatorsRequest { + return { + account: "" + }; +} + +export const GetAuthenticatorsRequest = { + encode(message: GetAuthenticatorsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetAuthenticatorsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetAuthenticatorsRequest(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.account = reader.string(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): GetAuthenticatorsRequest { + const message = createBaseGetAuthenticatorsRequest(); + message.account = object.account ?? ""; + return message; + } + +}; + +function createBaseGetAuthenticatorsResponse(): GetAuthenticatorsResponse { + return { + accountAuthenticators: [] + }; +} + +export const GetAuthenticatorsResponse = { + encode(message: GetAuthenticatorsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.accountAuthenticators) { + AccountAuthenticator.encode(v!, writer.uint32(10).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetAuthenticatorsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetAuthenticatorsResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.accountAuthenticators.push(AccountAuthenticator.decode(reader, reader.uint32())); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): GetAuthenticatorsResponse { + const message = createBaseGetAuthenticatorsResponse(); + message.accountAuthenticators = object.accountAuthenticators?.map(e => AccountAuthenticator.fromPartial(e)) || []; + return message; + } + +}; + +function createBaseGetAuthenticatorRequest(): GetAuthenticatorRequest { + return { + account: "", + authenticatorId: Long.UZERO + }; +} + +export const GetAuthenticatorRequest = { + encode(message: GetAuthenticatorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.account !== "") { + writer.uint32(10).string(message.account); + } + + if (!message.authenticatorId.isZero()) { + writer.uint32(16).uint64(message.authenticatorId); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetAuthenticatorRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetAuthenticatorRequest(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.account = reader.string(); + break; + + case 2: + message.authenticatorId = (reader.uint64() as Long); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): GetAuthenticatorRequest { + const message = createBaseGetAuthenticatorRequest(); + message.account = object.account ?? ""; + message.authenticatorId = object.authenticatorId !== undefined && object.authenticatorId !== null ? Long.fromValue(object.authenticatorId) : Long.UZERO; + return message; + } + +}; + +function createBaseGetAuthenticatorResponse(): GetAuthenticatorResponse { + return { + accountAuthenticator: undefined + }; +} + +export const GetAuthenticatorResponse = { + encode(message: GetAuthenticatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.accountAuthenticator !== undefined) { + AccountAuthenticator.encode(message.accountAuthenticator, writer.uint32(10).fork()).ldelim(); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetAuthenticatorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetAuthenticatorResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.accountAuthenticator = AccountAuthenticator.decode(reader, reader.uint32()); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): GetAuthenticatorResponse { + const message = createBaseGetAuthenticatorResponse(); + message.accountAuthenticator = object.accountAuthenticator !== undefined && object.accountAuthenticator !== null ? AccountAuthenticator.fromPartial(object.accountAuthenticator) : undefined; + return message; + } + +}; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.rpc.msg.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.rpc.msg.ts new file mode 100644 index 0000000000..9582fd403d --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.rpc.msg.ts @@ -0,0 +1,47 @@ +import { Rpc } from "../../helpers"; +import * as _m0 from "protobufjs/minimal"; +import { MsgAddAuthenticator, MsgAddAuthenticatorResponse, MsgRemoveAuthenticator, MsgRemoveAuthenticatorResponse, MsgSetActiveState, MsgSetActiveStateResponse } from "./tx"; +/** Msg defines the Msg service. */ + +export interface Msg { + /** AddAuthenticator adds an authenticator to an account. */ + addAuthenticator(request: MsgAddAuthenticator): Promise; + /** RemoveAuthenticator removes an authenticator from an account. */ + + removeAuthenticator(request: MsgRemoveAuthenticator): Promise; + /** + * SetActiveState sets the active state of the authenticator. + * Primarily used for circuit breaking. + */ + + setActiveState(request: MsgSetActiveState): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + + constructor(rpc: Rpc) { + this.rpc = rpc; + this.addAuthenticator = this.addAuthenticator.bind(this); + this.removeAuthenticator = this.removeAuthenticator.bind(this); + this.setActiveState = this.setActiveState.bind(this); + } + + addAuthenticator(request: MsgAddAuthenticator): Promise { + const data = MsgAddAuthenticator.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.accountplus.Msg", "AddAuthenticator", data); + return promise.then(data => MsgAddAuthenticatorResponse.decode(new _m0.Reader(data))); + } + + removeAuthenticator(request: MsgRemoveAuthenticator): Promise { + const data = MsgRemoveAuthenticator.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.accountplus.Msg", "RemoveAuthenticator", data); + return promise.then(data => MsgRemoveAuthenticatorResponse.decode(new _m0.Reader(data))); + } + + setActiveState(request: MsgSetActiveState): Promise { + const data = MsgSetActiveState.encode(request).finish(); + const promise = this.rpc.request("dydxprotocol.accountplus.Msg", "SetActiveState", data); + return promise.then(data => MsgSetActiveStateResponse.decode(new _m0.Reader(data))); + } + +} \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.ts new file mode 100644 index 0000000000..bf7b78452a --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/accountplus/tx.ts @@ -0,0 +1,468 @@ +import * as _m0 from "protobufjs/minimal"; +import { DeepPartial, Long } from "../../helpers"; +/** MsgAddAuthenticatorRequest defines the Msg/AddAuthenticator request type. */ + +export interface MsgAddAuthenticator { + sender: string; + authenticatorType: string; + data: Uint8Array; +} +/** MsgAddAuthenticatorRequest defines the Msg/AddAuthenticator request type. */ + +export interface MsgAddAuthenticatorSDKType { + sender: string; + authenticator_type: string; + data: Uint8Array; +} +/** MsgAddAuthenticatorResponse defines the Msg/AddAuthenticator response type. */ + +export interface MsgAddAuthenticatorResponse { + /** MsgAddAuthenticatorResponse defines the Msg/AddAuthenticator response type. */ + success: boolean; +} +/** MsgAddAuthenticatorResponse defines the Msg/AddAuthenticator response type. */ + +export interface MsgAddAuthenticatorResponseSDKType { + /** MsgAddAuthenticatorResponse defines the Msg/AddAuthenticator response type. */ + success: boolean; +} +/** + * MsgRemoveAuthenticatorRequest defines the Msg/RemoveAuthenticator request + * type. + */ + +export interface MsgRemoveAuthenticator { + sender: string; + id: Long; +} +/** + * MsgRemoveAuthenticatorRequest defines the Msg/RemoveAuthenticator request + * type. + */ + +export interface MsgRemoveAuthenticatorSDKType { + sender: string; + id: Long; +} +/** + * MsgRemoveAuthenticatorResponse defines the Msg/RemoveAuthenticator response + * type. + */ + +export interface MsgRemoveAuthenticatorResponse { + /** + * MsgRemoveAuthenticatorResponse defines the Msg/RemoveAuthenticator response + * type. + */ + success: boolean; +} +/** + * MsgRemoveAuthenticatorResponse defines the Msg/RemoveAuthenticator response + * type. + */ + +export interface MsgRemoveAuthenticatorResponseSDKType { + /** + * MsgRemoveAuthenticatorResponse defines the Msg/RemoveAuthenticator response + * type. + */ + success: boolean; +} +/** MsgSetActiveState sets the active state of the module. */ + +export interface MsgSetActiveState { + sender: string; + active: boolean; +} +/** MsgSetActiveState sets the active state of the module. */ + +export interface MsgSetActiveStateSDKType { + sender: string; + active: boolean; +} +/** MsgSetActiveStateResponse defines the Msg/SetActiveState response type. */ + +export interface MsgSetActiveStateResponse {} +/** MsgSetActiveStateResponse defines the Msg/SetActiveState response type. */ + +export interface MsgSetActiveStateResponseSDKType {} +/** + * TxExtension allows for additional authenticator-specific data in + * transactions. + */ + +export interface TxExtension { + /** + * selected_authenticators holds the authenticator_id for the chosen + * authenticator per message. + */ + selectedAuthenticators: Long[]; +} +/** + * TxExtension allows for additional authenticator-specific data in + * transactions. + */ + +export interface TxExtensionSDKType { + /** + * selected_authenticators holds the authenticator_id for the chosen + * authenticator per message. + */ + selected_authenticators: Long[]; +} + +function createBaseMsgAddAuthenticator(): MsgAddAuthenticator { + return { + sender: "", + authenticatorType: "", + data: new Uint8Array() + }; +} + +export const MsgAddAuthenticator = { + encode(message: MsgAddAuthenticator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + + if (message.authenticatorType !== "") { + writer.uint32(18).string(message.authenticatorType); + } + + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgAddAuthenticator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAddAuthenticator(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + + case 2: + message.authenticatorType = reader.string(); + break; + + case 3: + message.data = reader.bytes(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): MsgAddAuthenticator { + const message = createBaseMsgAddAuthenticator(); + message.sender = object.sender ?? ""; + message.authenticatorType = object.authenticatorType ?? ""; + message.data = object.data ?? new Uint8Array(); + return message; + } + +}; + +function createBaseMsgAddAuthenticatorResponse(): MsgAddAuthenticatorResponse { + return { + success: false + }; +} + +export const MsgAddAuthenticatorResponse = { + encode(message: MsgAddAuthenticatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.success === true) { + writer.uint32(8).bool(message.success); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgAddAuthenticatorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAddAuthenticatorResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.success = reader.bool(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): MsgAddAuthenticatorResponse { + const message = createBaseMsgAddAuthenticatorResponse(); + message.success = object.success ?? false; + return message; + } + +}; + +function createBaseMsgRemoveAuthenticator(): MsgRemoveAuthenticator { + return { + sender: "", + id: Long.UZERO + }; +} + +export const MsgRemoveAuthenticator = { + encode(message: MsgRemoveAuthenticator, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + + if (!message.id.isZero()) { + writer.uint32(16).uint64(message.id); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgRemoveAuthenticator { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRemoveAuthenticator(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + + case 2: + message.id = (reader.uint64() as Long); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): MsgRemoveAuthenticator { + const message = createBaseMsgRemoveAuthenticator(); + message.sender = object.sender ?? ""; + message.id = object.id !== undefined && object.id !== null ? Long.fromValue(object.id) : Long.UZERO; + return message; + } + +}; + +function createBaseMsgRemoveAuthenticatorResponse(): MsgRemoveAuthenticatorResponse { + return { + success: false + }; +} + +export const MsgRemoveAuthenticatorResponse = { + encode(message: MsgRemoveAuthenticatorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.success === true) { + writer.uint32(8).bool(message.success); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgRemoveAuthenticatorResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRemoveAuthenticatorResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.success = reader.bool(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): MsgRemoveAuthenticatorResponse { + const message = createBaseMsgRemoveAuthenticatorResponse(); + message.success = object.success ?? false; + return message; + } + +}; + +function createBaseMsgSetActiveState(): MsgSetActiveState { + return { + sender: "", + active: false + }; +} + +export const MsgSetActiveState = { + encode(message: MsgSetActiveState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + + if (message.active === true) { + writer.uint32(16).bool(message.active); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetActiveState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetActiveState(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + + case 2: + message.active = reader.bool(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): MsgSetActiveState { + const message = createBaseMsgSetActiveState(); + message.sender = object.sender ?? ""; + message.active = object.active ?? false; + return message; + } + +}; + +function createBaseMsgSetActiveStateResponse(): MsgSetActiveStateResponse { + return {}; +} + +export const MsgSetActiveStateResponse = { + encode(_: MsgSetActiveStateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetActiveStateResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetActiveStateResponse(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(_: DeepPartial): MsgSetActiveStateResponse { + const message = createBaseMsgSetActiveStateResponse(); + return message; + } + +}; + +function createBaseTxExtension(): TxExtension { + return { + selectedAuthenticators: [] + }; +} + +export const TxExtension = { + encode(message: TxExtension, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + writer.uint32(10).fork(); + + for (const v of message.selectedAuthenticators) { + writer.uint64(v); + } + + writer.ldelim(); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): TxExtension { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxExtension(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + + while (reader.pos < end2) { + message.selectedAuthenticators.push((reader.uint64() as Long)); + } + } else { + message.selectedAuthenticators.push((reader.uint64() as Long)); + } + + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): TxExtension { + const message = createBaseTxExtension(); + message.selectedAuthenticators = object.selectedAuthenticators?.map(e => Long.fromValue(e)) || []; + return message; + } + +}; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts index 8357d1849d..ea45d3f68c 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts @@ -1,219 +1,229 @@ import * as _5 from "./accountplus/accountplus"; import * as _6 from "./accountplus/genesis"; -import * as _7 from "./affiliates/affiliates"; -import * as _8 from "./affiliates/genesis"; -import * as _9 from "./affiliates/query"; -import * as _10 from "./affiliates/tx"; -import * as _11 from "./assets/asset"; -import * as _12 from "./assets/genesis"; -import * as _13 from "./assets/query"; -import * as _14 from "./assets/tx"; -import * as _15 from "./blocktime/blocktime"; -import * as _16 from "./blocktime/genesis"; -import * as _17 from "./blocktime/params"; -import * as _18 from "./blocktime/query"; -import * as _19 from "./blocktime/tx"; -import * as _20 from "./bridge/bridge_event_info"; -import * as _21 from "./bridge/bridge_event"; -import * as _22 from "./bridge/genesis"; -import * as _23 from "./bridge/params"; -import * as _24 from "./bridge/query"; -import * as _25 from "./bridge/tx"; -import * as _26 from "./clob/block_rate_limit_config"; -import * as _27 from "./clob/clob_pair"; -import * as _28 from "./clob/equity_tier_limit_config"; -import * as _29 from "./clob/genesis"; -import * as _30 from "./clob/liquidations_config"; -import * as _31 from "./clob/liquidations"; -import * as _32 from "./clob/matches"; -import * as _33 from "./clob/mev"; -import * as _34 from "./clob/operation"; -import * as _35 from "./clob/order_removals"; -import * as _36 from "./clob/order"; -import * as _37 from "./clob/process_proposer_matches_events"; -import * as _38 from "./clob/query"; -import * as _39 from "./clob/tx"; -import * as _40 from "./daemons/bridge/bridge"; -import * as _41 from "./daemons/liquidation/liquidation"; -import * as _42 from "./daemons/pricefeed/price_feed"; -import * as _43 from "./delaymsg/block_message_ids"; -import * as _44 from "./delaymsg/delayed_message"; -import * as _45 from "./delaymsg/genesis"; -import * as _46 from "./delaymsg/query"; -import * as _47 from "./delaymsg/tx"; -import * as _48 from "./epochs/epoch_info"; -import * as _49 from "./epochs/genesis"; -import * as _50 from "./epochs/query"; -import * as _51 from "./feetiers/genesis"; -import * as _52 from "./feetiers/params"; -import * as _53 from "./feetiers/query"; -import * as _54 from "./feetiers/tx"; -import * as _55 from "./govplus/genesis"; -import * as _56 from "./govplus/query"; -import * as _57 from "./govplus/tx"; -import * as _58 from "./indexer/events/events"; -import * as _59 from "./indexer/indexer_manager/event"; -import * as _60 from "./indexer/off_chain_updates/off_chain_updates"; -import * as _61 from "./indexer/protocol/v1/clob"; -import * as _62 from "./indexer/protocol/v1/perpetual"; -import * as _63 from "./indexer/protocol/v1/subaccount"; -import * as _64 from "./indexer/redis/redis_order"; -import * as _65 from "./indexer/shared/removal_reason"; -import * as _66 from "./indexer/socks/messages"; -import * as _67 from "./listing/genesis"; -import * as _68 from "./listing/params"; -import * as _69 from "./listing/query"; -import * as _70 from "./listing/tx"; -import * as _71 from "./perpetuals/genesis"; -import * as _72 from "./perpetuals/params"; -import * as _73 from "./perpetuals/perpetual"; -import * as _74 from "./perpetuals/query"; -import * as _75 from "./perpetuals/tx"; -import * as _76 from "./prices/genesis"; -import * as _77 from "./prices/market_param"; -import * as _78 from "./prices/market_price"; -import * as _79 from "./prices/query"; -import * as _80 from "./prices/tx"; -import * as _81 from "./ratelimit/capacity"; -import * as _82 from "./ratelimit/genesis"; -import * as _83 from "./ratelimit/limit_params"; -import * as _84 from "./ratelimit/pending_send_packet"; -import * as _85 from "./ratelimit/query"; -import * as _86 from "./ratelimit/tx"; -import * as _87 from "./revshare/genesis"; -import * as _88 from "./revshare/params"; -import * as _89 from "./revshare/query"; -import * as _90 from "./revshare/revshare"; -import * as _91 from "./revshare/tx"; -import * as _92 from "./rewards/genesis"; -import * as _93 from "./rewards/params"; -import * as _94 from "./rewards/query"; -import * as _95 from "./rewards/reward_share"; -import * as _96 from "./rewards/tx"; -import * as _97 from "./sending/genesis"; -import * as _98 from "./sending/query"; -import * as _99 from "./sending/transfer"; -import * as _100 from "./sending/tx"; -import * as _101 from "./stats/genesis"; -import * as _102 from "./stats/params"; -import * as _103 from "./stats/query"; -import * as _104 from "./stats/stats"; -import * as _105 from "./stats/tx"; -import * as _106 from "./subaccounts/asset_position"; -import * as _107 from "./subaccounts/genesis"; -import * as _108 from "./subaccounts/perpetual_position"; -import * as _109 from "./subaccounts/query"; -import * as _110 from "./subaccounts/streaming"; -import * as _111 from "./subaccounts/subaccount"; -import * as _112 from "./vault/genesis"; -import * as _113 from "./vault/params"; -import * as _114 from "./vault/query"; -import * as _115 from "./vault/share"; -import * as _116 from "./vault/tx"; -import * as _117 from "./vault/vault"; -import * as _118 from "./vest/genesis"; -import * as _119 from "./vest/query"; -import * as _120 from "./vest/tx"; -import * as _121 from "./vest/vest_entry"; -import * as _129 from "./assets/query.lcd"; -import * as _130 from "./blocktime/query.lcd"; -import * as _131 from "./bridge/query.lcd"; -import * as _132 from "./clob/query.lcd"; -import * as _133 from "./delaymsg/query.lcd"; -import * as _134 from "./epochs/query.lcd"; -import * as _135 from "./feetiers/query.lcd"; -import * as _136 from "./listing/query.lcd"; -import * as _137 from "./perpetuals/query.lcd"; -import * as _138 from "./prices/query.lcd"; -import * as _139 from "./ratelimit/query.lcd"; -import * as _140 from "./revshare/query.lcd"; -import * as _141 from "./rewards/query.lcd"; -import * as _142 from "./stats/query.lcd"; -import * as _143 from "./subaccounts/query.lcd"; -import * as _144 from "./vault/query.lcd"; -import * as _145 from "./vest/query.lcd"; -import * as _146 from "./affiliates/query.rpc.Query"; -import * as _147 from "./assets/query.rpc.Query"; -import * as _148 from "./blocktime/query.rpc.Query"; -import * as _149 from "./bridge/query.rpc.Query"; -import * as _150 from "./clob/query.rpc.Query"; -import * as _151 from "./delaymsg/query.rpc.Query"; -import * as _152 from "./epochs/query.rpc.Query"; -import * as _153 from "./feetiers/query.rpc.Query"; -import * as _154 from "./govplus/query.rpc.Query"; -import * as _155 from "./listing/query.rpc.Query"; -import * as _156 from "./perpetuals/query.rpc.Query"; -import * as _157 from "./prices/query.rpc.Query"; -import * as _158 from "./ratelimit/query.rpc.Query"; -import * as _159 from "./revshare/query.rpc.Query"; -import * as _160 from "./rewards/query.rpc.Query"; -import * as _161 from "./sending/query.rpc.Query"; -import * as _162 from "./stats/query.rpc.Query"; -import * as _163 from "./subaccounts/query.rpc.Query"; -import * as _164 from "./vault/query.rpc.Query"; -import * as _165 from "./vest/query.rpc.Query"; -import * as _166 from "./affiliates/tx.rpc.msg"; -import * as _167 from "./blocktime/tx.rpc.msg"; -import * as _168 from "./bridge/tx.rpc.msg"; -import * as _169 from "./clob/tx.rpc.msg"; -import * as _170 from "./delaymsg/tx.rpc.msg"; -import * as _171 from "./feetiers/tx.rpc.msg"; -import * as _172 from "./govplus/tx.rpc.msg"; -import * as _173 from "./listing/tx.rpc.msg"; -import * as _174 from "./perpetuals/tx.rpc.msg"; -import * as _175 from "./prices/tx.rpc.msg"; -import * as _176 from "./ratelimit/tx.rpc.msg"; -import * as _177 from "./revshare/tx.rpc.msg"; -import * as _178 from "./rewards/tx.rpc.msg"; -import * as _179 from "./sending/tx.rpc.msg"; -import * as _180 from "./stats/tx.rpc.msg"; -import * as _181 from "./vault/tx.rpc.msg"; -import * as _182 from "./vest/tx.rpc.msg"; -import * as _183 from "./lcd"; -import * as _184 from "./rpc.query"; -import * as _185 from "./rpc.tx"; +import * as _7 from "./accountplus/models"; +import * as _8 from "./accountplus/params"; +import * as _9 from "./accountplus/query"; +import * as _10 from "./accountplus/tx"; +import * as _11 from "./affiliates/affiliates"; +import * as _12 from "./affiliates/genesis"; +import * as _13 from "./affiliates/query"; +import * as _14 from "./affiliates/tx"; +import * as _15 from "./assets/asset"; +import * as _16 from "./assets/genesis"; +import * as _17 from "./assets/query"; +import * as _18 from "./assets/tx"; +import * as _19 from "./blocktime/blocktime"; +import * as _20 from "./blocktime/genesis"; +import * as _21 from "./blocktime/params"; +import * as _22 from "./blocktime/query"; +import * as _23 from "./blocktime/tx"; +import * as _24 from "./bridge/bridge_event_info"; +import * as _25 from "./bridge/bridge_event"; +import * as _26 from "./bridge/genesis"; +import * as _27 from "./bridge/params"; +import * as _28 from "./bridge/query"; +import * as _29 from "./bridge/tx"; +import * as _30 from "./clob/block_rate_limit_config"; +import * as _31 from "./clob/clob_pair"; +import * as _32 from "./clob/equity_tier_limit_config"; +import * as _33 from "./clob/genesis"; +import * as _34 from "./clob/liquidations_config"; +import * as _35 from "./clob/liquidations"; +import * as _36 from "./clob/matches"; +import * as _37 from "./clob/mev"; +import * as _38 from "./clob/operation"; +import * as _39 from "./clob/order_removals"; +import * as _40 from "./clob/order"; +import * as _41 from "./clob/process_proposer_matches_events"; +import * as _42 from "./clob/query"; +import * as _43 from "./clob/tx"; +import * as _44 from "./daemons/bridge/bridge"; +import * as _45 from "./daemons/liquidation/liquidation"; +import * as _46 from "./daemons/pricefeed/price_feed"; +import * as _47 from "./delaymsg/block_message_ids"; +import * as _48 from "./delaymsg/delayed_message"; +import * as _49 from "./delaymsg/genesis"; +import * as _50 from "./delaymsg/query"; +import * as _51 from "./delaymsg/tx"; +import * as _52 from "./epochs/epoch_info"; +import * as _53 from "./epochs/genesis"; +import * as _54 from "./epochs/query"; +import * as _55 from "./feetiers/genesis"; +import * as _56 from "./feetiers/params"; +import * as _57 from "./feetiers/query"; +import * as _58 from "./feetiers/tx"; +import * as _59 from "./govplus/genesis"; +import * as _60 from "./govplus/query"; +import * as _61 from "./govplus/tx"; +import * as _62 from "./indexer/events/events"; +import * as _63 from "./indexer/indexer_manager/event"; +import * as _64 from "./indexer/off_chain_updates/off_chain_updates"; +import * as _65 from "./indexer/protocol/v1/clob"; +import * as _66 from "./indexer/protocol/v1/perpetual"; +import * as _67 from "./indexer/protocol/v1/subaccount"; +import * as _68 from "./indexer/redis/redis_order"; +import * as _69 from "./indexer/shared/removal_reason"; +import * as _70 from "./indexer/socks/messages"; +import * as _71 from "./listing/genesis"; +import * as _72 from "./listing/params"; +import * as _73 from "./listing/query"; +import * as _74 from "./listing/tx"; +import * as _75 from "./perpetuals/genesis"; +import * as _76 from "./perpetuals/params"; +import * as _77 from "./perpetuals/perpetual"; +import * as _78 from "./perpetuals/query"; +import * as _79 from "./perpetuals/tx"; +import * as _80 from "./prices/genesis"; +import * as _81 from "./prices/market_param"; +import * as _82 from "./prices/market_price"; +import * as _83 from "./prices/query"; +import * as _84 from "./prices/tx"; +import * as _85 from "./ratelimit/capacity"; +import * as _86 from "./ratelimit/genesis"; +import * as _87 from "./ratelimit/limit_params"; +import * as _88 from "./ratelimit/pending_send_packet"; +import * as _89 from "./ratelimit/query"; +import * as _90 from "./ratelimit/tx"; +import * as _91 from "./revshare/genesis"; +import * as _92 from "./revshare/params"; +import * as _93 from "./revshare/query"; +import * as _94 from "./revshare/revshare"; +import * as _95 from "./revshare/tx"; +import * as _96 from "./rewards/genesis"; +import * as _97 from "./rewards/params"; +import * as _98 from "./rewards/query"; +import * as _99 from "./rewards/reward_share"; +import * as _100 from "./rewards/tx"; +import * as _101 from "./sending/genesis"; +import * as _102 from "./sending/query"; +import * as _103 from "./sending/transfer"; +import * as _104 from "./sending/tx"; +import * as _105 from "./stats/genesis"; +import * as _106 from "./stats/params"; +import * as _107 from "./stats/query"; +import * as _108 from "./stats/stats"; +import * as _109 from "./stats/tx"; +import * as _110 from "./subaccounts/asset_position"; +import * as _111 from "./subaccounts/genesis"; +import * as _112 from "./subaccounts/perpetual_position"; +import * as _113 from "./subaccounts/query"; +import * as _114 from "./subaccounts/streaming"; +import * as _115 from "./subaccounts/subaccount"; +import * as _116 from "./vault/genesis"; +import * as _117 from "./vault/params"; +import * as _118 from "./vault/query"; +import * as _119 from "./vault/share"; +import * as _120 from "./vault/tx"; +import * as _121 from "./vault/vault"; +import * as _122 from "./vest/genesis"; +import * as _123 from "./vest/query"; +import * as _124 from "./vest/tx"; +import * as _125 from "./vest/vest_entry"; +import * as _133 from "./accountplus/query.lcd"; +import * as _134 from "./assets/query.lcd"; +import * as _135 from "./blocktime/query.lcd"; +import * as _136 from "./bridge/query.lcd"; +import * as _137 from "./clob/query.lcd"; +import * as _138 from "./delaymsg/query.lcd"; +import * as _139 from "./epochs/query.lcd"; +import * as _140 from "./feetiers/query.lcd"; +import * as _141 from "./listing/query.lcd"; +import * as _142 from "./perpetuals/query.lcd"; +import * as _143 from "./prices/query.lcd"; +import * as _144 from "./ratelimit/query.lcd"; +import * as _145 from "./revshare/query.lcd"; +import * as _146 from "./rewards/query.lcd"; +import * as _147 from "./stats/query.lcd"; +import * as _148 from "./subaccounts/query.lcd"; +import * as _149 from "./vault/query.lcd"; +import * as _150 from "./vest/query.lcd"; +import * as _151 from "./accountplus/query.rpc.Query"; +import * as _152 from "./affiliates/query.rpc.Query"; +import * as _153 from "./assets/query.rpc.Query"; +import * as _154 from "./blocktime/query.rpc.Query"; +import * as _155 from "./bridge/query.rpc.Query"; +import * as _156 from "./clob/query.rpc.Query"; +import * as _157 from "./delaymsg/query.rpc.Query"; +import * as _158 from "./epochs/query.rpc.Query"; +import * as _159 from "./feetiers/query.rpc.Query"; +import * as _160 from "./govplus/query.rpc.Query"; +import * as _161 from "./listing/query.rpc.Query"; +import * as _162 from "./perpetuals/query.rpc.Query"; +import * as _163 from "./prices/query.rpc.Query"; +import * as _164 from "./ratelimit/query.rpc.Query"; +import * as _165 from "./revshare/query.rpc.Query"; +import * as _166 from "./rewards/query.rpc.Query"; +import * as _167 from "./sending/query.rpc.Query"; +import * as _168 from "./stats/query.rpc.Query"; +import * as _169 from "./subaccounts/query.rpc.Query"; +import * as _170 from "./vault/query.rpc.Query"; +import * as _171 from "./vest/query.rpc.Query"; +import * as _172 from "./accountplus/tx.rpc.msg"; +import * as _173 from "./affiliates/tx.rpc.msg"; +import * as _174 from "./blocktime/tx.rpc.msg"; +import * as _175 from "./bridge/tx.rpc.msg"; +import * as _176 from "./clob/tx.rpc.msg"; +import * as _177 from "./delaymsg/tx.rpc.msg"; +import * as _178 from "./feetiers/tx.rpc.msg"; +import * as _179 from "./govplus/tx.rpc.msg"; +import * as _180 from "./listing/tx.rpc.msg"; +import * as _181 from "./perpetuals/tx.rpc.msg"; +import * as _182 from "./prices/tx.rpc.msg"; +import * as _183 from "./ratelimit/tx.rpc.msg"; +import * as _184 from "./revshare/tx.rpc.msg"; +import * as _185 from "./rewards/tx.rpc.msg"; +import * as _186 from "./sending/tx.rpc.msg"; +import * as _187 from "./stats/tx.rpc.msg"; +import * as _188 from "./vault/tx.rpc.msg"; +import * as _189 from "./vest/tx.rpc.msg"; +import * as _190 from "./lcd"; +import * as _191 from "./rpc.query"; +import * as _192 from "./rpc.tx"; export namespace dydxprotocol { export const accountplus = { ..._5, - ..._6 - }; - export const affiliates = { ..._7, + ..._6, + ..._7, ..._8, ..._9, ..._10, - ..._146, - ..._166 + ..._133, + ..._151, + ..._172 }; - export const assets = { ..._11, + export const affiliates = { ..._11, ..._12, ..._13, ..._14, - ..._129, - ..._147 + ..._152, + ..._173 }; - export const blocktime = { ..._15, + export const assets = { ..._15, ..._16, ..._17, ..._18, - ..._19, - ..._130, - ..._148, - ..._167 + ..._134, + ..._153 }; - export const bridge = { ..._20, + export const blocktime = { ..._19, + ..._20, ..._21, ..._22, ..._23, - ..._24, - ..._25, - ..._131, - ..._149, - ..._168 + ..._135, + ..._154, + ..._174 }; - export const clob = { ..._26, + export const bridge = { ..._24, + ..._25, + ..._26, ..._27, ..._28, ..._29, - ..._30, + ..._136, + ..._155, + ..._175 + }; + export const clob = { ..._30, ..._31, ..._32, ..._33, @@ -223,166 +233,170 @@ export namespace dydxprotocol { ..._37, ..._38, ..._39, - ..._132, - ..._150, - ..._169 + ..._40, + ..._41, + ..._42, + ..._43, + ..._137, + ..._156, + ..._176 }; export namespace daemons { - export const bridge = { ..._40 + export const bridge = { ..._44 }; - export const liquidation = { ..._41 + export const liquidation = { ..._45 }; - export const pricefeed = { ..._42 + export const pricefeed = { ..._46 }; } - export const delaymsg = { ..._43, - ..._44, - ..._45, - ..._46, - ..._47, - ..._133, - ..._151, - ..._170 - }; - export const epochs = { ..._48, + export const delaymsg = { ..._47, + ..._48, ..._49, ..._50, - ..._134, - ..._152 + ..._51, + ..._138, + ..._157, + ..._177 }; - export const feetiers = { ..._51, - ..._52, + export const epochs = { ..._52, ..._53, ..._54, - ..._135, - ..._153, - ..._171 + ..._139, + ..._158 }; - export const govplus = { ..._55, + export const feetiers = { ..._55, ..._56, ..._57, - ..._154, - ..._172 + ..._58, + ..._140, + ..._159, + ..._178 + }; + export const govplus = { ..._59, + ..._60, + ..._61, + ..._160, + ..._179 }; export namespace indexer { - export const events = { ..._58 + export const events = { ..._62 }; - export const indexer_manager = { ..._59 + export const indexer_manager = { ..._63 }; - export const off_chain_updates = { ..._60 + export const off_chain_updates = { ..._64 }; export namespace protocol { - export const v1 = { ..._61, - ..._62, - ..._63 + export const v1 = { ..._65, + ..._66, + ..._67 }; } - export const redis = { ..._64 + export const redis = { ..._68 }; - export const shared = { ..._65 + export const shared = { ..._69 }; - export const socks = { ..._66 + export const socks = { ..._70 }; } - export const listing = { ..._67, - ..._68, - ..._69, - ..._70, - ..._136, - ..._155, - ..._173 - }; - export const perpetuals = { ..._71, + export const listing = { ..._71, ..._72, ..._73, ..._74, - ..._75, - ..._137, - ..._156, - ..._174 + ..._141, + ..._161, + ..._180 }; - export const prices = { ..._76, + export const perpetuals = { ..._75, + ..._76, ..._77, ..._78, ..._79, - ..._80, - ..._138, - ..._157, - ..._175 + ..._142, + ..._162, + ..._181 }; - export const ratelimit = { ..._81, + export const prices = { ..._80, + ..._81, ..._82, ..._83, ..._84, - ..._85, - ..._86, - ..._139, - ..._158, - ..._176 + ..._143, + ..._163, + ..._182 }; - export const revshare = { ..._87, + export const ratelimit = { ..._85, + ..._86, + ..._87, ..._88, ..._89, ..._90, - ..._91, - ..._140, - ..._159, - ..._177 + ..._144, + ..._164, + ..._183 }; - export const rewards = { ..._92, + export const revshare = { ..._91, + ..._92, ..._93, ..._94, ..._95, - ..._96, - ..._141, - ..._160, - ..._178 + ..._145, + ..._165, + ..._184 }; - export const sending = { ..._97, + export const rewards = { ..._96, + ..._97, ..._98, ..._99, ..._100, - ..._161, - ..._179 + ..._146, + ..._166, + ..._185 }; - export const stats = { ..._101, + export const sending = { ..._101, ..._102, ..._103, ..._104, - ..._105, - ..._142, - ..._162, - ..._180 + ..._167, + ..._186 }; - export const subaccounts = { ..._106, + export const stats = { ..._105, + ..._106, ..._107, ..._108, ..._109, - ..._110, - ..._111, - ..._143, - ..._163 + ..._147, + ..._168, + ..._187 }; - export const vault = { ..._112, + export const subaccounts = { ..._110, + ..._111, + ..._112, ..._113, ..._114, ..._115, - ..._116, - ..._117, - ..._144, - ..._164, - ..._181 + ..._148, + ..._169 }; - export const vest = { ..._118, + export const vault = { ..._116, + ..._117, + ..._118, ..._119, ..._120, ..._121, - ..._145, - ..._165, - ..._182 + ..._149, + ..._170, + ..._188 }; - export const ClientFactory = { ..._183, - ..._184, - ..._185 + export const vest = { ..._122, + ..._123, + ..._124, + ..._125, + ..._150, + ..._171, + ..._189 + }; + export const ClientFactory = { ..._190, + ..._191, + ..._192 }; } \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/lcd.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/lcd.ts index 790d937a2e..dd77cee074 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/lcd.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/lcd.ts @@ -9,6 +9,9 @@ export const createLCDClient = async ({ }); return { dydxprotocol: { + accountplus: new (await import("./accountplus/query.lcd")).LCDQueryClient({ + requestClient + }), assets: new (await import("./assets/query.lcd")).LCDQueryClient({ requestClient }), diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts index 73541397db..dd9037fad1 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts @@ -9,6 +9,7 @@ export const createRPCQueryClient = async ({ const client = new QueryClient(tmClient); return { dydxprotocol: { + accountplus: (await import("./accountplus/query.rpc.Query")).createRpcQueryExtension(client), affiliates: (await import("./affiliates/query.rpc.Query")).createRpcQueryExtension(client), assets: (await import("./assets/query.rpc.Query")).createRpcQueryExtension(client), blocktime: (await import("./blocktime/query.rpc.Query")).createRpcQueryExtension(client), diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts index 1c3eedfabc..cfddfb350c 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts @@ -5,6 +5,7 @@ export const createRPCMsgClient = async ({ rpc: Rpc; }) => ({ dydxprotocol: { + accountplus: new (await import("./accountplus/tx.rpc.msg")).MsgClientImpl(rpc), affiliates: new (await import("./affiliates/tx.rpc.msg")).MsgClientImpl(rpc), blocktime: new (await import("./blocktime/tx.rpc.msg")).MsgClientImpl(rpc), bridge: new (await import("./bridge/tx.rpc.msg")).MsgClientImpl(rpc), diff --git a/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts b/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts index 790ad9003a..795d06bc47 100644 --- a/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts @@ -1,3 +1,3 @@ -import * as _122 from "./gogo"; -export const gogoproto = { ..._122 +import * as _126 from "./gogo"; +export const gogoproto = { ..._126 }; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/google/bundle.ts b/indexer/packages/v4-protos/src/codegen/google/bundle.ts index 1ed0c78141..6c02be50fc 100644 --- a/indexer/packages/v4-protos/src/codegen/google/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/google/bundle.ts @@ -1,16 +1,16 @@ -import * as _123 from "./api/annotations"; -import * as _124 from "./api/http"; -import * as _125 from "./protobuf/descriptor"; -import * as _126 from "./protobuf/duration"; -import * as _127 from "./protobuf/timestamp"; -import * as _128 from "./protobuf/any"; +import * as _127 from "./api/annotations"; +import * as _128 from "./api/http"; +import * as _129 from "./protobuf/descriptor"; +import * as _130 from "./protobuf/duration"; +import * as _131 from "./protobuf/timestamp"; +import * as _132 from "./protobuf/any"; export namespace google { - export const api = { ..._123, - ..._124 - }; - export const protobuf = { ..._125, - ..._126, - ..._127, + export const api = { ..._127, ..._128 }; + export const protobuf = { ..._129, + ..._130, + ..._131, + ..._132 + }; } \ No newline at end of file diff --git a/proto/dydxprotocol/accountplus/genesis.proto b/proto/dydxprotocol/accountplus/genesis.proto index 9358dca161..723893b855 100644 --- a/proto/dydxprotocol/accountplus/genesis.proto +++ b/proto/dydxprotocol/accountplus/genesis.proto @@ -3,10 +3,36 @@ package dydxprotocol.accountplus; import "gogoproto/gogo.proto"; import "dydxprotocol/accountplus/accountplus.proto"; +import "dydxprotocol/accountplus/models.proto"; +import "dydxprotocol/accountplus/params.proto"; option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/accountplus/types"; +// AuthenticatorData represents a genesis exported account with Authenticators. +// The address is used as the key, and the account authenticators are stored in +// the authenticators field. +message AuthenticatorData { + // address is an account address, one address can have many authenticators + string address = 1; + + // authenticators are the account's authenticators, these can be multiple + // types including SignatureVerification, AllOfs, CosmWasmAuthenticators, etc + repeated AccountAuthenticator authenticators = 2 + [ (gogoproto.nullable) = false ]; +} + // Module genesis state message GenesisState { repeated AccountState accounts = 1 [ (gogoproto.nullable) = false ]; + + // params define the parameters for the authenticator module. + Params params = 2 [ (gogoproto.nullable) = false ]; + + // next_authenticator_id is the next available authenticator ID. + uint64 next_authenticator_id = 3; + + // authenticator_data contains the data for multiple accounts, each with their + // authenticators. + repeated AuthenticatorData authenticator_data = 4 + [ (gogoproto.nullable) = false ]; } diff --git a/proto/dydxprotocol/accountplus/models.proto b/proto/dydxprotocol/accountplus/models.proto new file mode 100644 index 0000000000..50ff3732b7 --- /dev/null +++ b/proto/dydxprotocol/accountplus/models.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; +package dydxprotocol.accountplus; + +option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/accountplus/types"; + +// AccountAuthenticator represents a foundational model for all authenticators. +// It provides extensibility by allowing concrete types to interpret and +// validate transactions based on the encapsulated data. +message AccountAuthenticator { + // ID uniquely identifies the authenticator instance. + uint64 id = 1; + + // Type specifies the category of the AccountAuthenticator. + // This type information is essential for differentiating authenticators + // and ensuring precise data retrieval from the storage layer. + string type = 2; + + // Config is a versatile field used in conjunction with the specific type of + // account authenticator to facilitate complex authentication processes. + // The interpretation of this field is overloaded, enabling multiple + // authenticators to utilize it for their respective purposes. + bytes config = 3; +} diff --git a/proto/dydxprotocol/accountplus/params.proto b/proto/dydxprotocol/accountplus/params.proto new file mode 100644 index 0000000000..673b71d6fd --- /dev/null +++ b/proto/dydxprotocol/accountplus/params.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package dydxprotocol.accountplus; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/accountplus/types"; + +// Params defines the parameters for the module. +message Params { + // IsSmartAccountActive defines the state of the authenticator. + // If set to false, the authenticator module will not be used + // and the classic cosmos sdk authentication will be used instead. + bool is_smart_account_active = 1 + [ (gogoproto.moretags) = "yaml:\"is_smart_account_active\"" ]; +} diff --git a/proto/dydxprotocol/accountplus/query.proto b/proto/dydxprotocol/accountplus/query.proto new file mode 100644 index 0000000000..5314055957 --- /dev/null +++ b/proto/dydxprotocol/accountplus/query.proto @@ -0,0 +1,59 @@ +syntax = "proto3"; +package dydxprotocol.accountplus; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "dydxprotocol/accountplus/models.proto"; +import "dydxprotocol/accountplus/params.proto"; + +option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/accountplus/types"; + +// Query defines the gRPC querier service. +service Query { + // Parameters queries the parameters of the module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/dydxprotocol/accountplus/params"; + } + + // Queries a single authenticator by account and authenticator ID. + rpc GetAuthenticator(GetAuthenticatorRequest) + returns (GetAuthenticatorResponse) { + option (google.api.http).get = + "/dydxprotocol/accountplus/authenticator/{account}/{authenticator_id}"; + } + + // Queries all authenticators for a given account. + rpc GetAuthenticators(GetAuthenticatorsRequest) + returns (GetAuthenticatorsResponse) { + option (google.api.http).get = + "/dydxprotocol/accountplus/authenticators/{account}"; + } +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // params holds all the parameters of this module. + Params params = 1 [ (gogoproto.nullable) = false ]; +} + +// MsgGetAuthenticatorsRequest defines the Msg/GetAuthenticators request type. +message GetAuthenticatorsRequest { string account = 1; } + +// MsgGetAuthenticatorsResponse defines the Msg/GetAuthenticators response type. +message GetAuthenticatorsResponse { + repeated AccountAuthenticator account_authenticators = 1; +} + +// MsgGetAuthenticatorRequest defines the Msg/GetAuthenticator request type. +message GetAuthenticatorRequest { + string account = 1; + uint64 authenticator_id = 2; +} + +// MsgGetAuthenticatorResponse defines the Msg/GetAuthenticator response type. +message GetAuthenticatorResponse { + AccountAuthenticator account_authenticator = 1; +} diff --git a/proto/dydxprotocol/accountplus/tx.proto b/proto/dydxprotocol/accountplus/tx.proto new file mode 100644 index 0000000000..9f901688d2 --- /dev/null +++ b/proto/dydxprotocol/accountplus/tx.proto @@ -0,0 +1,68 @@ +syntax = "proto3"; +package dydxprotocol.accountplus; + +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; + +option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/accountplus/types"; + +// Msg defines the Msg service. +service Msg { + // AddAuthenticator adds an authenticator to an account. + rpc AddAuthenticator(MsgAddAuthenticator) + returns (MsgAddAuthenticatorResponse); + // RemoveAuthenticator removes an authenticator from an account. + rpc RemoveAuthenticator(MsgRemoveAuthenticator) + returns (MsgRemoveAuthenticatorResponse); + + // SetActiveState sets the active state of the authenticator. + // Primarily used for circuit breaking. + rpc SetActiveState(MsgSetActiveState) returns (MsgSetActiveStateResponse); +} + +// MsgAddAuthenticatorRequest defines the Msg/AddAuthenticator request type. +message MsgAddAuthenticator { + option (amino.name) = "dydxprotocol/accountplus/add-authenticator"; + option (cosmos.msg.v1.signer) = "sender"; + + string sender = 1; + string authenticator_type = 2; + bytes data = 3; +} + +// MsgAddAuthenticatorResponse defines the Msg/AddAuthenticator response type. +message MsgAddAuthenticatorResponse { bool success = 1; } + +// MsgRemoveAuthenticatorRequest defines the Msg/RemoveAuthenticator request +// type. +message MsgRemoveAuthenticator { + option (amino.name) = "dydxprotocol/accountplus/remove-authenticator"; + option (cosmos.msg.v1.signer) = "sender"; + + string sender = 1; + uint64 id = 2; +} + +// MsgRemoveAuthenticatorResponse defines the Msg/RemoveAuthenticator response +// type. +message MsgRemoveAuthenticatorResponse { bool success = 1; } + +// MsgSetActiveState sets the active state of the module. +message MsgSetActiveState { + option (amino.name) = "osmosis/smartaccount/set-active-state"; + option (cosmos.msg.v1.signer) = "sender"; + + string sender = 1; + bool active = 2; +} + +// MsgSetActiveStateResponse defines the Msg/SetActiveState response type. +message MsgSetActiveStateResponse {} + +// TxExtension allows for additional authenticator-specific data in +// transactions. +message TxExtension { + // selected_authenticators holds the authenticator_id for the chosen + // authenticator per message. + repeated uint64 selected_authenticators = 1; +} diff --git a/protocol/app/testdata/default_genesis_state.json b/protocol/app/testdata/default_genesis_state.json index bc6e831c7b..970ae13312 100644 --- a/protocol/app/testdata/default_genesis_state.json +++ b/protocol/app/testdata/default_genesis_state.json @@ -129,7 +129,12 @@ "validator_slash_events": [] }, "dydxaccountplus": { - "accounts": [] + "accounts": [], + "params": { + "is_smart_account_active": false + }, + "next_authenticator_id": "0", + "authenticator_data": [] }, "epochs": { "epoch_info_list": [ diff --git a/protocol/scripts/genesis/sample_pregenesis.json b/protocol/scripts/genesis/sample_pregenesis.json index 1ddea18c1a..5925ef792a 100644 --- a/protocol/scripts/genesis/sample_pregenesis.json +++ b/protocol/scripts/genesis/sample_pregenesis.json @@ -638,7 +638,12 @@ "validator_slash_events": [] }, "dydxaccountplus": { - "accounts": [] + "accounts": [], + "authenticator_data": [], + "next_authenticator_id": "0", + "params": { + "is_smart_account_active": false + } }, "epochs": { "epoch_info_list": [ diff --git a/protocol/x/accountplus/types/genesis.pb.go b/protocol/x/accountplus/types/genesis.pb.go index 13a13d224e..476dd31f5e 100644 --- a/protocol/x/accountplus/types/genesis.pb.go +++ b/protocol/x/accountplus/types/genesis.pb.go @@ -23,16 +23,81 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// AuthenticatorData represents a genesis exported account with Authenticators. +// The address is used as the key, and the account authenticators are stored in +// the authenticators field. +type AuthenticatorData struct { + // address is an account address, one address can have many authenticators + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // authenticators are the account's authenticators, these can be multiple + // types including SignatureVerification, AllOfs, CosmWasmAuthenticators, etc + Authenticators []AccountAuthenticator `protobuf:"bytes,2,rep,name=authenticators,proto3" json:"authenticators"` +} + +func (m *AuthenticatorData) Reset() { *m = AuthenticatorData{} } +func (m *AuthenticatorData) String() string { return proto.CompactTextString(m) } +func (*AuthenticatorData) ProtoMessage() {} +func (*AuthenticatorData) Descriptor() ([]byte, []int) { + return fileDescriptor_03516b8fa43b3a59, []int{0} +} +func (m *AuthenticatorData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthenticatorData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthenticatorData.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthenticatorData) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthenticatorData.Merge(m, src) +} +func (m *AuthenticatorData) XXX_Size() int { + return m.Size() +} +func (m *AuthenticatorData) XXX_DiscardUnknown() { + xxx_messageInfo_AuthenticatorData.DiscardUnknown(m) +} + +var xxx_messageInfo_AuthenticatorData proto.InternalMessageInfo + +func (m *AuthenticatorData) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *AuthenticatorData) GetAuthenticators() []AccountAuthenticator { + if m != nil { + return m.Authenticators + } + return nil +} + // Module genesis state type GenesisState struct { Accounts []AccountState `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts"` + // params define the parameters for the authenticator module. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` + // next_authenticator_id is the next available authenticator ID. + NextAuthenticatorId uint64 `protobuf:"varint,3,opt,name=next_authenticator_id,json=nextAuthenticatorId,proto3" json:"next_authenticator_id,omitempty"` + // authenticator_data contains the data for multiple accounts, each with their + // authenticators. + AuthenticatorData []AuthenticatorData `protobuf:"bytes,4,rep,name=authenticator_data,json=authenticatorData,proto3" json:"authenticator_data"` } func (m *GenesisState) Reset() { *m = GenesisState{} } func (m *GenesisState) String() string { return proto.CompactTextString(m) } func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_03516b8fa43b3a59, []int{0} + return fileDescriptor_03516b8fa43b3a59, []int{1} } func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -68,7 +133,29 @@ func (m *GenesisState) GetAccounts() []AccountState { return nil } +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetNextAuthenticatorId() uint64 { + if m != nil { + return m.NextAuthenticatorId + } + return 0 +} + +func (m *GenesisState) GetAuthenticatorData() []AuthenticatorData { + if m != nil { + return m.AuthenticatorData + } + return nil +} + func init() { + proto.RegisterType((*AuthenticatorData)(nil), "dydxprotocol.accountplus.AuthenticatorData") proto.RegisterType((*GenesisState)(nil), "dydxprotocol.accountplus.GenesisState") } @@ -77,20 +164,74 @@ func init() { } var fileDescriptor_03516b8fa43b3a59 = []byte{ - // 202 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4b, 0xa9, 0x4c, 0xa9, - 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, - 0x29, 0xc8, 0x29, 0x2d, 0xd6, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x03, 0x4b, 0x0a, - 0x49, 0x20, 0xab, 0xd3, 0x43, 0x52, 0x27, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x96, 0xd1, 0x07, - 0xb1, 0x20, 0xea, 0xa5, 0xb4, 0x70, 0x9a, 0x8b, 0xc4, 0x86, 0xa8, 0x55, 0x8a, 0xe0, 0xe2, 0x71, - 0x87, 0x58, 0x16, 0x5c, 0x92, 0x58, 0x92, 0x2a, 0xe4, 0xc1, 0xc5, 0x01, 0x55, 0x54, 0x2c, 0xc1, - 0xa8, 0xc0, 0xac, 0xc1, 0x6d, 0xa4, 0xa6, 0x87, 0xcb, 0x7a, 0x3d, 0x47, 0x08, 0x1b, 0xac, 0xd3, - 0x89, 0xe5, 0xc4, 0x3d, 0x79, 0x86, 0x20, 0xb8, 0x6e, 0xa7, 0xf0, 0x13, 0x8f, 0xe4, 0x18, 0x2f, - 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, - 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xb2, 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, - 0xd5, 0x47, 0x71, 0x6a, 0x99, 0x89, 0x6e, 0x72, 0x46, 0x62, 0x66, 0x9e, 0x3e, 0x5c, 0xa4, 0x02, - 0xc5, 0xf9, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x59, 0x63, 0x40, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xfa, 0x84, 0x6b, 0x24, 0x3f, 0x01, 0x00, 0x00, + // 362 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xc1, 0x4a, 0xf3, 0x40, + 0x14, 0x85, 0x33, 0x6d, 0xe9, 0xff, 0x3b, 0x15, 0xa1, 0xa3, 0xc2, 0xd0, 0x45, 0x0c, 0x05, 0x4b, + 0x50, 0x4c, 0xa0, 0xba, 0x55, 0xa8, 0x08, 0xea, 0x4e, 0xea, 0x42, 0x10, 0xa1, 0x4e, 0x33, 0x43, + 0x1a, 0x68, 0x33, 0x21, 0x33, 0x91, 0xf6, 0x19, 0xdc, 0xf8, 0x24, 0x3e, 0x47, 0x97, 0x5d, 0xba, + 0x12, 0x69, 0x5e, 0x44, 0x92, 0x8c, 0x25, 0xa9, 0xc4, 0xee, 0x6e, 0x72, 0xbe, 0x7b, 0xee, 0x3d, + 0xc9, 0x85, 0x1d, 0x3a, 0xa3, 0xd3, 0x20, 0xe4, 0x92, 0x3b, 0x7c, 0x6c, 0x13, 0xc7, 0xe1, 0x91, + 0x2f, 0x83, 0x71, 0x24, 0x6c, 0x97, 0xf9, 0x4c, 0x78, 0xc2, 0x4a, 0x45, 0x84, 0xf3, 0x9c, 0x95, + 0xe3, 0x5a, 0x7b, 0x2e, 0x77, 0x79, 0xaa, 0xd8, 0x49, 0x95, 0xf1, 0xad, 0xa3, 0x52, 0xdf, 0x5c, + 0xad, 0xd8, 0xc3, 0x52, 0x76, 0xc2, 0x29, 0x1b, 0x6f, 0xc6, 0x02, 0x12, 0x92, 0x89, 0xc2, 0xda, + 0xaf, 0x00, 0x36, 0x7b, 0x91, 0x1c, 0x31, 0x5f, 0x7a, 0x0e, 0x91, 0x3c, 0xbc, 0x22, 0x92, 0x20, + 0x0c, 0xff, 0x11, 0x4a, 0x43, 0x26, 0x04, 0x06, 0x06, 0x30, 0xb7, 0xfa, 0x3f, 0x8f, 0xe8, 0x09, + 0xee, 0x90, 0x3c, 0x2e, 0x70, 0xc5, 0xa8, 0x9a, 0x8d, 0xae, 0x65, 0x95, 0x45, 0xb6, 0x7a, 0x59, + 0x5d, 0x98, 0x72, 0x59, 0x9b, 0x7f, 0x1e, 0x68, 0xfd, 0x35, 0xaf, 0xf6, 0x7b, 0x05, 0x6e, 0x5f, + 0x67, 0x5f, 0xf2, 0x5e, 0x12, 0xc9, 0xd0, 0x0d, 0xfc, 0xaf, 0xac, 0x92, 0x4d, 0x92, 0x41, 0x9d, + 0x8d, 0x83, 0xd2, 0x4e, 0x35, 0x60, 0xd5, 0x8d, 0x2e, 0x60, 0x3d, 0x0b, 0x8e, 0x2b, 0x06, 0x30, + 0x1b, 0x5d, 0xa3, 0xdc, 0xe7, 0x2e, 0xe5, 0x94, 0x83, 0xea, 0x42, 0x5d, 0xb8, 0xef, 0xb3, 0xa9, + 0x1c, 0x14, 0x36, 0x1e, 0x78, 0x14, 0x57, 0x0d, 0x60, 0xd6, 0xfa, 0xbb, 0x89, 0x58, 0x88, 0x78, + 0x4b, 0xd1, 0x33, 0x44, 0x45, 0x9c, 0x12, 0x49, 0x70, 0x2d, 0xcd, 0x71, 0xfc, 0x47, 0x8e, 0xf5, + 0xff, 0xa1, 0x56, 0x69, 0x92, 0x5f, 0xc2, 0xc3, 0x7c, 0xa9, 0x83, 0xc5, 0x52, 0x07, 0x5f, 0x4b, + 0x1d, 0xbc, 0xc5, 0xba, 0xb6, 0x88, 0x75, 0xed, 0x23, 0xd6, 0xb5, 0xc7, 0x73, 0xd7, 0x93, 0xa3, + 0x68, 0x68, 0x39, 0x7c, 0x62, 0x17, 0x4e, 0xe1, 0xe5, 0xec, 0xc4, 0x19, 0x11, 0xcf, 0xb7, 0x57, + 0x6f, 0xa6, 0x85, 0xf3, 0x90, 0xb3, 0x80, 0x89, 0x61, 0x3d, 0x55, 0x4f, 0xbf, 0x03, 0x00, 0x00, + 0xff, 0xff, 0xda, 0x60, 0x35, 0x04, 0xf2, 0x02, 0x00, 0x00, +} + +func (m *AuthenticatorData) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AuthenticatorData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthenticatorData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Authenticators) > 0 { + for iNdEx := len(m.Authenticators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Authenticators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -113,6 +254,35 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.AuthenticatorData) > 0 { + for iNdEx := len(m.AuthenticatorData) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AuthenticatorData[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.NextAuthenticatorId != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.NextAuthenticatorId)) + i-- + dAtA[i] = 0x18 + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 if len(m.Accounts) > 0 { for iNdEx := len(m.Accounts) - 1; iNdEx >= 0; iNdEx-- { { @@ -141,6 +311,25 @@ func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *AuthenticatorData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + if len(m.Authenticators) > 0 { + for _, e := range m.Authenticators { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + func (m *GenesisState) Size() (n int) { if m == nil { return 0 @@ -153,6 +342,17 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + if m.NextAuthenticatorId != 0 { + n += 1 + sovGenesis(uint64(m.NextAuthenticatorId)) + } + if len(m.AuthenticatorData) > 0 { + for _, e := range m.AuthenticatorData { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -162,6 +362,122 @@ func sovGenesis(x uint64) (n int) { func sozGenesis(x uint64) (n int) { return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *AuthenticatorData) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AuthenticatorData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuthenticatorData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authenticators", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authenticators = append(m.Authenticators, AccountAuthenticator{}) + if err := m.Authenticators[len(m.Authenticators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *GenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -225,6 +541,92 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NextAuthenticatorId", wireType) + } + m.NextAuthenticatorId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NextAuthenticatorId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthenticatorData", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuthenticatorData = append(m.AuthenticatorData, AuthenticatorData{}) + if err := m.AuthenticatorData[len(m.AuthenticatorData)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/protocol/x/accountplus/types/models.pb.go b/protocol/x/accountplus/types/models.pb.go new file mode 100644 index 0000000000..86a51934d9 --- /dev/null +++ b/protocol/x/accountplus/types/models.pb.go @@ -0,0 +1,418 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dydxprotocol/accountplus/models.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// AccountAuthenticator represents a foundational model for all authenticators. +// It provides extensibility by allowing concrete types to interpret and +// validate transactions based on the encapsulated data. +type AccountAuthenticator struct { + // ID uniquely identifies the authenticator instance. + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // Type specifies the category of the AccountAuthenticator. + // This type information is essential for differentiating authenticators + // and ensuring precise data retrieval from the storage layer. + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + // Config is a versatile field used in conjunction with the specific type of + // account authenticator to facilitate complex authentication processes. + // The interpretation of this field is overloaded, enabling multiple + // authenticators to utilize it for their respective purposes. + Config []byte `protobuf:"bytes,3,opt,name=config,proto3" json:"config,omitempty"` +} + +func (m *AccountAuthenticator) Reset() { *m = AccountAuthenticator{} } +func (m *AccountAuthenticator) String() string { return proto.CompactTextString(m) } +func (*AccountAuthenticator) ProtoMessage() {} +func (*AccountAuthenticator) Descriptor() ([]byte, []int) { + return fileDescriptor_14404dbe8eb22d3f, []int{0} +} +func (m *AccountAuthenticator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AccountAuthenticator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AccountAuthenticator.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AccountAuthenticator) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccountAuthenticator.Merge(m, src) +} +func (m *AccountAuthenticator) XXX_Size() int { + return m.Size() +} +func (m *AccountAuthenticator) XXX_DiscardUnknown() { + xxx_messageInfo_AccountAuthenticator.DiscardUnknown(m) +} + +var xxx_messageInfo_AccountAuthenticator proto.InternalMessageInfo + +func (m *AccountAuthenticator) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *AccountAuthenticator) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *AccountAuthenticator) GetConfig() []byte { + if m != nil { + return m.Config + } + return nil +} + +func init() { + proto.RegisterType((*AccountAuthenticator)(nil), "dydxprotocol.accountplus.AccountAuthenticator") +} + +func init() { + proto.RegisterFile("dydxprotocol/accountplus/models.proto", fileDescriptor_14404dbe8eb22d3f) +} + +var fileDescriptor_14404dbe8eb22d3f = []byte{ + // 204 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0xa9, 0x4c, 0xa9, + 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, + 0x29, 0xc8, 0x29, 0x2d, 0xd6, 0xcf, 0xcd, 0x4f, 0x49, 0xcd, 0x29, 0xd6, 0x03, 0xcb, 0x09, 0x49, + 0x20, 0x2b, 0xd3, 0x43, 0x52, 0xa6, 0x14, 0xc4, 0x25, 0xe2, 0x08, 0xe1, 0x3a, 0x96, 0x96, 0x64, + 0xa4, 0xe6, 0x95, 0x64, 0x26, 0x27, 0x96, 0xe4, 0x17, 0x09, 0xf1, 0x71, 0x31, 0x65, 0xa6, 0x48, + 0x30, 0x2a, 0x30, 0x6a, 0xb0, 0x04, 0x31, 0x65, 0xa6, 0x08, 0x09, 0x71, 0xb1, 0x94, 0x54, 0x16, + 0xa4, 0x4a, 0x30, 0x29, 0x30, 0x6a, 0x70, 0x06, 0x81, 0xd9, 0x42, 0x62, 0x5c, 0x6c, 0xc9, 0xf9, + 0x79, 0x69, 0x99, 0xe9, 0x12, 0xcc, 0x0a, 0x8c, 0x1a, 0x3c, 0x41, 0x50, 0x9e, 0x53, 0xf8, 0x89, + 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, + 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0xd9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, + 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa3, 0xb8, 0xbc, 0xcc, 0x44, 0x37, 0x39, 0x23, 0x31, 0x33, 0x4f, + 0x1f, 0x2e, 0x52, 0x81, 0xe2, 0x1b, 0x90, 0x7d, 0xc5, 0x49, 0x6c, 0x60, 0x59, 0x63, 0x40, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xa0, 0x32, 0xd3, 0x28, 0xf6, 0x00, 0x00, 0x00, +} + +func (m *AccountAuthenticator) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AccountAuthenticator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AccountAuthenticator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Config) > 0 { + i -= len(m.Config) + copy(dAtA[i:], m.Config) + i = encodeVarintModels(dAtA, i, uint64(len(m.Config))) + i-- + dAtA[i] = 0x1a + } + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintModels(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0x12 + } + if m.Id != 0 { + i = encodeVarintModels(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintModels(dAtA []byte, offset int, v uint64) int { + offset -= sovModels(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *AccountAuthenticator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovModels(uint64(m.Id)) + } + l = len(m.Type) + if l > 0 { + n += 1 + l + sovModels(uint64(l)) + } + l = len(m.Config) + if l > 0 { + n += 1 + l + sovModels(uint64(l)) + } + return n +} + +func sovModels(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozModels(x uint64) (n int) { + return sovModels(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *AccountAuthenticator) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModels + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AccountAuthenticator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AccountAuthenticator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModels + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModels + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthModels + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthModels + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModels + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthModels + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthModels + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Config = append(m.Config[:0], dAtA[iNdEx:postIndex]...) + if m.Config == nil { + m.Config = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipModels(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthModels + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipModels(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowModels + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowModels + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowModels + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthModels + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupModels + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthModels + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthModels = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowModels = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupModels = fmt.Errorf("proto: unexpected end of group") +) diff --git a/protocol/x/accountplus/types/params.pb.go b/protocol/x/accountplus/types/params.pb.go new file mode 100644 index 0000000000..18da286443 --- /dev/null +++ b/protocol/x/accountplus/types/params.pb.go @@ -0,0 +1,315 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dydxprotocol/accountplus/params.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params defines the parameters for the module. +type Params struct { + // IsSmartAccountActive defines the state of the authenticator. + // If set to false, the authenticator module will not be used + // and the classic cosmos sdk authentication will be used instead. + IsSmartAccountActive bool `protobuf:"varint,1,opt,name=is_smart_account_active,json=isSmartAccountActive,proto3" json:"is_smart_account_active,omitempty" yaml:"is_smart_account_active"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_7db9dd150a39c6af, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetIsSmartAccountActive() bool { + if m != nil { + return m.IsSmartAccountActive + } + return false +} + +func init() { + proto.RegisterType((*Params)(nil), "dydxprotocol.accountplus.Params") +} + +func init() { + proto.RegisterFile("dydxprotocol/accountplus/params.proto", fileDescriptor_7db9dd150a39c6af) +} + +var fileDescriptor_7db9dd150a39c6af = []byte{ + // 210 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0xa9, 0x4c, 0xa9, + 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, + 0x29, 0xc8, 0x29, 0x2d, 0xd6, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x03, 0xcb, 0x09, 0x49, + 0x20, 0x2b, 0xd3, 0x43, 0x52, 0x26, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x96, 0xd1, 0x07, 0xb1, + 0x20, 0xea, 0x95, 0x92, 0xb9, 0xd8, 0x02, 0xc0, 0xfa, 0x85, 0x22, 0xb9, 0xc4, 0x33, 0x8b, 0xe3, + 0x8b, 0x73, 0x13, 0x8b, 0x4a, 0xe2, 0xa1, 0xfa, 0xe2, 0x13, 0x93, 0x4b, 0x32, 0xcb, 0x52, 0x25, + 0x18, 0x15, 0x18, 0x35, 0x38, 0x9c, 0x94, 0x3e, 0xdd, 0x93, 0x97, 0xab, 0x4c, 0xcc, 0xcd, 0xb1, + 0x52, 0xc2, 0xa1, 0x50, 0x29, 0x48, 0x24, 0xb3, 0x38, 0x18, 0x24, 0xe1, 0x08, 0x11, 0x77, 0x04, + 0x0b, 0x3b, 0x85, 0x9f, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, + 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x6d, 0x7a, + 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0x8a, 0x07, 0xcb, 0x4c, 0x74, 0x93, + 0x33, 0x12, 0x33, 0xf3, 0xf4, 0xe1, 0x22, 0x15, 0x28, 0x9e, 0x2e, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, + 0x62, 0x03, 0xcb, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x37, 0xad, 0x40, 0x1a, 0x1d, 0x01, + 0x00, 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.IsSmartAccountActive { + i-- + if m.IsSmartAccountActive { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.IsSmartAccountActive { + n += 2 + } + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsSmartAccountActive", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsSmartAccountActive = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/protocol/x/accountplus/types/query.pb.go b/protocol/x/accountplus/types/query.pb.go new file mode 100644 index 0000000000..f850e057f1 --- /dev/null +++ b/protocol/x/accountplus/types/query.pb.go @@ -0,0 +1,1365 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dydxprotocol/accountplus/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_3beaace7ec4b0b78, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3beaace7ec4b0b78, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgGetAuthenticatorsRequest defines the Msg/GetAuthenticators request type. +type GetAuthenticatorsRequest struct { + Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` +} + +func (m *GetAuthenticatorsRequest) Reset() { *m = GetAuthenticatorsRequest{} } +func (m *GetAuthenticatorsRequest) String() string { return proto.CompactTextString(m) } +func (*GetAuthenticatorsRequest) ProtoMessage() {} +func (*GetAuthenticatorsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_3beaace7ec4b0b78, []int{2} +} +func (m *GetAuthenticatorsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetAuthenticatorsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetAuthenticatorsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetAuthenticatorsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAuthenticatorsRequest.Merge(m, src) +} +func (m *GetAuthenticatorsRequest) XXX_Size() int { + return m.Size() +} +func (m *GetAuthenticatorsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetAuthenticatorsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetAuthenticatorsRequest proto.InternalMessageInfo + +func (m *GetAuthenticatorsRequest) GetAccount() string { + if m != nil { + return m.Account + } + return "" +} + +// MsgGetAuthenticatorsResponse defines the Msg/GetAuthenticators response type. +type GetAuthenticatorsResponse struct { + AccountAuthenticators []*AccountAuthenticator `protobuf:"bytes,1,rep,name=account_authenticators,json=accountAuthenticators,proto3" json:"account_authenticators,omitempty"` +} + +func (m *GetAuthenticatorsResponse) Reset() { *m = GetAuthenticatorsResponse{} } +func (m *GetAuthenticatorsResponse) String() string { return proto.CompactTextString(m) } +func (*GetAuthenticatorsResponse) ProtoMessage() {} +func (*GetAuthenticatorsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3beaace7ec4b0b78, []int{3} +} +func (m *GetAuthenticatorsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetAuthenticatorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetAuthenticatorsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetAuthenticatorsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAuthenticatorsResponse.Merge(m, src) +} +func (m *GetAuthenticatorsResponse) XXX_Size() int { + return m.Size() +} +func (m *GetAuthenticatorsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetAuthenticatorsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetAuthenticatorsResponse proto.InternalMessageInfo + +func (m *GetAuthenticatorsResponse) GetAccountAuthenticators() []*AccountAuthenticator { + if m != nil { + return m.AccountAuthenticators + } + return nil +} + +// MsgGetAuthenticatorRequest defines the Msg/GetAuthenticator request type. +type GetAuthenticatorRequest struct { + Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` + AuthenticatorId uint64 `protobuf:"varint,2,opt,name=authenticator_id,json=authenticatorId,proto3" json:"authenticator_id,omitempty"` +} + +func (m *GetAuthenticatorRequest) Reset() { *m = GetAuthenticatorRequest{} } +func (m *GetAuthenticatorRequest) String() string { return proto.CompactTextString(m) } +func (*GetAuthenticatorRequest) ProtoMessage() {} +func (*GetAuthenticatorRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_3beaace7ec4b0b78, []int{4} +} +func (m *GetAuthenticatorRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetAuthenticatorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetAuthenticatorRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetAuthenticatorRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAuthenticatorRequest.Merge(m, src) +} +func (m *GetAuthenticatorRequest) XXX_Size() int { + return m.Size() +} +func (m *GetAuthenticatorRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetAuthenticatorRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetAuthenticatorRequest proto.InternalMessageInfo + +func (m *GetAuthenticatorRequest) GetAccount() string { + if m != nil { + return m.Account + } + return "" +} + +func (m *GetAuthenticatorRequest) GetAuthenticatorId() uint64 { + if m != nil { + return m.AuthenticatorId + } + return 0 +} + +// MsgGetAuthenticatorResponse defines the Msg/GetAuthenticator response type. +type GetAuthenticatorResponse struct { + AccountAuthenticator *AccountAuthenticator `protobuf:"bytes,1,opt,name=account_authenticator,json=accountAuthenticator,proto3" json:"account_authenticator,omitempty"` +} + +func (m *GetAuthenticatorResponse) Reset() { *m = GetAuthenticatorResponse{} } +func (m *GetAuthenticatorResponse) String() string { return proto.CompactTextString(m) } +func (*GetAuthenticatorResponse) ProtoMessage() {} +func (*GetAuthenticatorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3beaace7ec4b0b78, []int{5} +} +func (m *GetAuthenticatorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GetAuthenticatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GetAuthenticatorResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GetAuthenticatorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAuthenticatorResponse.Merge(m, src) +} +func (m *GetAuthenticatorResponse) XXX_Size() int { + return m.Size() +} +func (m *GetAuthenticatorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetAuthenticatorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetAuthenticatorResponse proto.InternalMessageInfo + +func (m *GetAuthenticatorResponse) GetAccountAuthenticator() *AccountAuthenticator { + if m != nil { + return m.AccountAuthenticator + } + return nil +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "dydxprotocol.accountplus.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "dydxprotocol.accountplus.QueryParamsResponse") + proto.RegisterType((*GetAuthenticatorsRequest)(nil), "dydxprotocol.accountplus.GetAuthenticatorsRequest") + proto.RegisterType((*GetAuthenticatorsResponse)(nil), "dydxprotocol.accountplus.GetAuthenticatorsResponse") + proto.RegisterType((*GetAuthenticatorRequest)(nil), "dydxprotocol.accountplus.GetAuthenticatorRequest") + proto.RegisterType((*GetAuthenticatorResponse)(nil), "dydxprotocol.accountplus.GetAuthenticatorResponse") +} + +func init() { + proto.RegisterFile("dydxprotocol/accountplus/query.proto", fileDescriptor_3beaace7ec4b0b78) +} + +var fileDescriptor_3beaace7ec4b0b78 = []byte{ + // 486 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0x41, 0x6b, 0xd4, 0x40, + 0x14, 0xde, 0xa9, 0xeb, 0x8a, 0xd3, 0x83, 0x75, 0xdc, 0x6a, 0x5c, 0x24, 0x86, 0x41, 0x61, 0x05, + 0x9b, 0xc1, 0x74, 0x4f, 0x82, 0x42, 0x8b, 0x28, 0x82, 0x07, 0x0d, 0x88, 0xe0, 0xc1, 0x32, 0x4d, + 0x86, 0x6c, 0x20, 0x9b, 0x49, 0x33, 0x13, 0xe9, 0x52, 0x8a, 0xd0, 0x3f, 0xa0, 0xe0, 0xdd, 0xdf, + 0xe1, 0x3f, 0xb0, 0xc7, 0x82, 0x17, 0x4f, 0x22, 0xbb, 0xfe, 0x10, 0xe9, 0x64, 0xba, 0x76, 0x76, + 0x13, 0xb6, 0xb9, 0x25, 0xef, 0x7d, 0xdf, 0x7b, 0xdf, 0x37, 0xdf, 0x83, 0xf7, 0xc2, 0x71, 0xb8, + 0x9f, 0xe5, 0x5c, 0xf2, 0x80, 0x27, 0x84, 0x06, 0x01, 0x2f, 0x52, 0x99, 0x25, 0x85, 0x20, 0x7b, + 0x05, 0xcb, 0xc7, 0xae, 0x6a, 0x21, 0xeb, 0x3c, 0xca, 0x3d, 0x87, 0xea, 0x75, 0x23, 0x1e, 0x71, + 0xd5, 0x21, 0xa7, 0x5f, 0x25, 0xbe, 0x77, 0x27, 0xe2, 0x3c, 0x4a, 0x18, 0xa1, 0x59, 0x4c, 0x68, + 0x9a, 0x72, 0x49, 0x65, 0xcc, 0x53, 0xa1, 0xbb, 0xf7, 0x6b, 0x77, 0x8e, 0x78, 0xc8, 0x92, 0xe5, + 0xb0, 0x8c, 0xe6, 0x74, 0xa4, 0x61, 0xb8, 0x0b, 0xd1, 0x9b, 0x53, 0xa9, 0xaf, 0x55, 0xd1, 0x67, + 0x7b, 0x05, 0x13, 0x12, 0xbf, 0x85, 0x37, 0x8c, 0xaa, 0xc8, 0x78, 0x2a, 0x18, 0x7a, 0x0a, 0x3b, + 0x25, 0xd9, 0x02, 0x0e, 0xe8, 0xaf, 0x7a, 0x8e, 0x5b, 0xe7, 0xcc, 0x2d, 0x99, 0xdb, 0xed, 0xe3, + 0xdf, 0x77, 0x5b, 0xbe, 0x66, 0xe1, 0x01, 0xb4, 0x5e, 0x30, 0xb9, 0x55, 0xc8, 0x21, 0x4b, 0x65, + 0x1c, 0x50, 0xc9, 0xf3, 0xb3, 0x95, 0xc8, 0x82, 0x57, 0x34, 0x5f, 0x0d, 0xbf, 0xea, 0x9f, 0xfd, + 0xe2, 0x23, 0x00, 0x6f, 0x57, 0xd0, 0xb4, 0x26, 0x06, 0x6f, 0x6a, 0xe0, 0x0e, 0x35, 0x10, 0x16, + 0x70, 0x2e, 0xf5, 0x57, 0x3d, 0xb7, 0x5e, 0xe3, 0x56, 0xf9, 0x6d, 0x0c, 0xf6, 0xd7, 0x69, 0x45, + 0x55, 0xe0, 0x0f, 0xf0, 0xd6, 0xbc, 0x86, 0xa5, 0xca, 0xd1, 0x03, 0xb8, 0x66, 0x68, 0xda, 0x89, + 0x43, 0x6b, 0xc5, 0x01, 0xfd, 0xb6, 0x7f, 0xcd, 0xa8, 0xbf, 0x0c, 0xf1, 0xa7, 0xc5, 0xa7, 0x99, + 0x59, 0x0c, 0xe0, 0x7a, 0xa5, 0x45, 0x9d, 0x42, 0x53, 0x87, 0xdd, 0x2a, 0x87, 0xde, 0xb7, 0x36, + 0xbc, 0xac, 0x32, 0x47, 0x9f, 0x01, 0xec, 0x94, 0xf1, 0xa1, 0x87, 0xf5, 0xa3, 0x17, 0xaf, 0xa6, + 0xb7, 0x71, 0x41, 0x74, 0x69, 0x0b, 0xf7, 0x8f, 0x7e, 0xfe, 0xfd, 0xba, 0x82, 0x91, 0x43, 0x96, + 0x9c, 0x2a, 0xfa, 0x01, 0xe0, 0xda, 0xfc, 0xeb, 0xa0, 0x47, 0xf5, 0xdb, 0x6a, 0x92, 0xea, 0x79, + 0x4d, 0x28, 0x5a, 0xe5, 0x2b, 0xa5, 0xf2, 0x39, 0x7a, 0x56, 0xaf, 0xd2, 0x08, 0x85, 0x1c, 0xe8, + 0xd6, 0x21, 0x39, 0x98, 0x0f, 0xff, 0x10, 0x7d, 0x07, 0xf0, 0xfa, 0xc2, 0x2d, 0xa3, 0x06, 0xba, + 0x66, 0x8f, 0xbd, 0xd9, 0x88, 0xa3, 0xcd, 0x3c, 0x56, 0x66, 0x06, 0xc8, 0xbb, 0xa0, 0x19, 0xf1, + 0xdf, 0xcd, 0xf6, 0xbb, 0xe3, 0x89, 0x0d, 0x4e, 0x26, 0x36, 0xf8, 0x33, 0xb1, 0xc1, 0x97, 0xa9, + 0xdd, 0x3a, 0x99, 0xda, 0xad, 0x5f, 0x53, 0xbb, 0xf5, 0xfe, 0x49, 0x14, 0xcb, 0x61, 0xb1, 0xeb, + 0x06, 0x7c, 0x64, 0xce, 0xfd, 0x38, 0xd8, 0x08, 0x86, 0x34, 0x4e, 0xc9, 0xac, 0xb2, 0x6f, 0xec, + 0x92, 0xe3, 0x8c, 0x89, 0xdd, 0x8e, 0xea, 0x6e, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x8f, 0x3e, + 0x4f, 0x88, 0x4d, 0x05, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Queries a single authenticator by account and authenticator ID. + GetAuthenticator(ctx context.Context, in *GetAuthenticatorRequest, opts ...grpc.CallOption) (*GetAuthenticatorResponse, error) + // Queries all authenticators for a given account. + GetAuthenticators(ctx context.Context, in *GetAuthenticatorsRequest, opts ...grpc.CallOption) (*GetAuthenticatorsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.accountplus.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetAuthenticator(ctx context.Context, in *GetAuthenticatorRequest, opts ...grpc.CallOption) (*GetAuthenticatorResponse, error) { + out := new(GetAuthenticatorResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.accountplus.Query/GetAuthenticator", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetAuthenticators(ctx context.Context, in *GetAuthenticatorsRequest, opts ...grpc.CallOption) (*GetAuthenticatorsResponse, error) { + out := new(GetAuthenticatorsResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.accountplus.Query/GetAuthenticators", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Queries a single authenticator by account and authenticator ID. + GetAuthenticator(context.Context, *GetAuthenticatorRequest) (*GetAuthenticatorResponse, error) + // Queries all authenticators for a given account. + GetAuthenticators(context.Context, *GetAuthenticatorsRequest) (*GetAuthenticatorsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) GetAuthenticator(ctx context.Context, req *GetAuthenticatorRequest) (*GetAuthenticatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAuthenticator not implemented") +} +func (*UnimplementedQueryServer) GetAuthenticators(ctx context.Context, req *GetAuthenticatorsRequest) (*GetAuthenticatorsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAuthenticators not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.accountplus.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetAuthenticator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAuthenticatorRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetAuthenticator(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.accountplus.Query/GetAuthenticator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetAuthenticator(ctx, req.(*GetAuthenticatorRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetAuthenticators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAuthenticatorsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetAuthenticators(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.accountplus.Query/GetAuthenticators", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetAuthenticators(ctx, req.(*GetAuthenticatorsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "dydxprotocol.accountplus.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "GetAuthenticator", + Handler: _Query_GetAuthenticator_Handler, + }, + { + MethodName: "GetAuthenticators", + Handler: _Query_GetAuthenticators_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "dydxprotocol/accountplus/query.proto", +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *GetAuthenticatorsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetAuthenticatorsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetAuthenticatorsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Account) > 0 { + i -= len(m.Account) + copy(dAtA[i:], m.Account) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Account))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetAuthenticatorsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetAuthenticatorsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetAuthenticatorsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AccountAuthenticators) > 0 { + for iNdEx := len(m.AccountAuthenticators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AccountAuthenticators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *GetAuthenticatorRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetAuthenticatorRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetAuthenticatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AuthenticatorId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.AuthenticatorId)) + i-- + dAtA[i] = 0x10 + } + if len(m.Account) > 0 { + i -= len(m.Account) + copy(dAtA[i:], m.Account) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Account))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetAuthenticatorResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetAuthenticatorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetAuthenticatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AccountAuthenticator != nil { + { + size, err := m.AccountAuthenticator.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *GetAuthenticatorsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Account) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *GetAuthenticatorsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.AccountAuthenticators) > 0 { + for _, e := range m.AccountAuthenticators { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *GetAuthenticatorRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Account) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.AuthenticatorId != 0 { + n += 1 + sovQuery(uint64(m.AuthenticatorId)) + } + return n +} + +func (m *GetAuthenticatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AccountAuthenticator != nil { + l = m.AccountAuthenticator.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetAuthenticatorsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetAuthenticatorsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetAuthenticatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Account = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetAuthenticatorsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetAuthenticatorsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetAuthenticatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AccountAuthenticators", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AccountAuthenticators = append(m.AccountAuthenticators, &AccountAuthenticator{}) + if err := m.AccountAuthenticators[len(m.AccountAuthenticators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetAuthenticatorRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetAuthenticatorRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetAuthenticatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Account = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthenticatorId", wireType) + } + m.AuthenticatorId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AuthenticatorId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetAuthenticatorResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetAuthenticatorResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetAuthenticatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AccountAuthenticator", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AccountAuthenticator == nil { + m.AccountAuthenticator = &AccountAuthenticator{} + } + if err := m.AccountAuthenticator.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/protocol/x/accountplus/types/query.pb.gw.go b/protocol/x/accountplus/types/query.pb.gw.go new file mode 100644 index 0000000000..490d4e2343 --- /dev/null +++ b/protocol/x/accountplus/types/query.pb.gw.go @@ -0,0 +1,377 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: dydxprotocol/accountplus/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GetAuthenticator_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetAuthenticatorRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["account"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "account") + } + + protoReq.Account, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "account", err) + } + + val, ok = pathParams["authenticator_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "authenticator_id") + } + + protoReq.AuthenticatorId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "authenticator_id", err) + } + + msg, err := client.GetAuthenticator(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetAuthenticator_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetAuthenticatorRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["account"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "account") + } + + protoReq.Account, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "account", err) + } + + val, ok = pathParams["authenticator_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "authenticator_id") + } + + protoReq.AuthenticatorId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "authenticator_id", err) + } + + msg, err := server.GetAuthenticator(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GetAuthenticators_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetAuthenticatorsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["account"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "account") + } + + protoReq.Account, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "account", err) + } + + msg, err := client.GetAuthenticators(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetAuthenticators_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetAuthenticatorsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["account"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "account") + } + + protoReq.Account, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "account", err) + } + + msg, err := server.GetAuthenticators(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetAuthenticator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetAuthenticator_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetAuthenticator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetAuthenticators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GetAuthenticators_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetAuthenticators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetAuthenticator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_GetAuthenticator_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetAuthenticator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetAuthenticators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_GetAuthenticators_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GetAuthenticators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"dydxprotocol", "accountplus", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GetAuthenticator_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"dydxprotocol", "accountplus", "authenticator", "account", "authenticator_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GetAuthenticators_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"dydxprotocol", "accountplus", "authenticators", "account"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_GetAuthenticator_0 = runtime.ForwardResponseMessage + + forward_Query_GetAuthenticators_0 = runtime.ForwardResponseMessage +) diff --git a/protocol/x/accountplus/types/tx.pb.go b/protocol/x/accountplus/types/tx.pb.go new file mode 100644 index 0000000000..7f908acf0f --- /dev/null +++ b/protocol/x/accountplus/types/tx.pb.go @@ -0,0 +1,1702 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dydxprotocol/accountplus/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgAddAuthenticatorRequest defines the Msg/AddAuthenticator request type. +type MsgAddAuthenticator struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + AuthenticatorType string `protobuf:"bytes,2,opt,name=authenticator_type,json=authenticatorType,proto3" json:"authenticator_type,omitempty"` + Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` +} + +func (m *MsgAddAuthenticator) Reset() { *m = MsgAddAuthenticator{} } +func (m *MsgAddAuthenticator) String() string { return proto.CompactTextString(m) } +func (*MsgAddAuthenticator) ProtoMessage() {} +func (*MsgAddAuthenticator) Descriptor() ([]byte, []int) { + return fileDescriptor_2d1c240983fd17d6, []int{0} +} +func (m *MsgAddAuthenticator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddAuthenticator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddAuthenticator.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgAddAuthenticator) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddAuthenticator.Merge(m, src) +} +func (m *MsgAddAuthenticator) XXX_Size() int { + return m.Size() +} +func (m *MsgAddAuthenticator) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddAuthenticator.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddAuthenticator proto.InternalMessageInfo + +func (m *MsgAddAuthenticator) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgAddAuthenticator) GetAuthenticatorType() string { + if m != nil { + return m.AuthenticatorType + } + return "" +} + +func (m *MsgAddAuthenticator) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +// MsgAddAuthenticatorResponse defines the Msg/AddAuthenticator response type. +type MsgAddAuthenticatorResponse struct { + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` +} + +func (m *MsgAddAuthenticatorResponse) Reset() { *m = MsgAddAuthenticatorResponse{} } +func (m *MsgAddAuthenticatorResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAddAuthenticatorResponse) ProtoMessage() {} +func (*MsgAddAuthenticatorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2d1c240983fd17d6, []int{1} +} +func (m *MsgAddAuthenticatorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddAuthenticatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddAuthenticatorResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgAddAuthenticatorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddAuthenticatorResponse.Merge(m, src) +} +func (m *MsgAddAuthenticatorResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgAddAuthenticatorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddAuthenticatorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddAuthenticatorResponse proto.InternalMessageInfo + +func (m *MsgAddAuthenticatorResponse) GetSuccess() bool { + if m != nil { + return m.Success + } + return false +} + +// MsgRemoveAuthenticatorRequest defines the Msg/RemoveAuthenticator request +// type. +type MsgRemoveAuthenticator struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + Id uint64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` +} + +func (m *MsgRemoveAuthenticator) Reset() { *m = MsgRemoveAuthenticator{} } +func (m *MsgRemoveAuthenticator) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveAuthenticator) ProtoMessage() {} +func (*MsgRemoveAuthenticator) Descriptor() ([]byte, []int) { + return fileDescriptor_2d1c240983fd17d6, []int{2} +} +func (m *MsgRemoveAuthenticator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveAuthenticator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveAuthenticator.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRemoveAuthenticator) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveAuthenticator.Merge(m, src) +} +func (m *MsgRemoveAuthenticator) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveAuthenticator) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveAuthenticator.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveAuthenticator proto.InternalMessageInfo + +func (m *MsgRemoveAuthenticator) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgRemoveAuthenticator) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +// MsgRemoveAuthenticatorResponse defines the Msg/RemoveAuthenticator response +// type. +type MsgRemoveAuthenticatorResponse struct { + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` +} + +func (m *MsgRemoveAuthenticatorResponse) Reset() { *m = MsgRemoveAuthenticatorResponse{} } +func (m *MsgRemoveAuthenticatorResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveAuthenticatorResponse) ProtoMessage() {} +func (*MsgRemoveAuthenticatorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2d1c240983fd17d6, []int{3} +} +func (m *MsgRemoveAuthenticatorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveAuthenticatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveAuthenticatorResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRemoveAuthenticatorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveAuthenticatorResponse.Merge(m, src) +} +func (m *MsgRemoveAuthenticatorResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveAuthenticatorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveAuthenticatorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveAuthenticatorResponse proto.InternalMessageInfo + +func (m *MsgRemoveAuthenticatorResponse) GetSuccess() bool { + if m != nil { + return m.Success + } + return false +} + +// MsgSetActiveState sets the active state of the module. +type MsgSetActiveState struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + Active bool `protobuf:"varint,2,opt,name=active,proto3" json:"active,omitempty"` +} + +func (m *MsgSetActiveState) Reset() { *m = MsgSetActiveState{} } +func (m *MsgSetActiveState) String() string { return proto.CompactTextString(m) } +func (*MsgSetActiveState) ProtoMessage() {} +func (*MsgSetActiveState) Descriptor() ([]byte, []int) { + return fileDescriptor_2d1c240983fd17d6, []int{4} +} +func (m *MsgSetActiveState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetActiveState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetActiveState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSetActiveState) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetActiveState.Merge(m, src) +} +func (m *MsgSetActiveState) XXX_Size() int { + return m.Size() +} +func (m *MsgSetActiveState) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetActiveState.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetActiveState proto.InternalMessageInfo + +func (m *MsgSetActiveState) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgSetActiveState) GetActive() bool { + if m != nil { + return m.Active + } + return false +} + +// MsgSetActiveStateResponse defines the Msg/SetActiveState response type. +type MsgSetActiveStateResponse struct { +} + +func (m *MsgSetActiveStateResponse) Reset() { *m = MsgSetActiveStateResponse{} } +func (m *MsgSetActiveStateResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSetActiveStateResponse) ProtoMessage() {} +func (*MsgSetActiveStateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2d1c240983fd17d6, []int{5} +} +func (m *MsgSetActiveStateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetActiveStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetActiveStateResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSetActiveStateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetActiveStateResponse.Merge(m, src) +} +func (m *MsgSetActiveStateResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSetActiveStateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetActiveStateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetActiveStateResponse proto.InternalMessageInfo + +// TxExtension allows for additional authenticator-specific data in +// transactions. +type TxExtension struct { + // selected_authenticators holds the authenticator_id for the chosen + // authenticator per message. + SelectedAuthenticators []uint64 `protobuf:"varint,1,rep,packed,name=selected_authenticators,json=selectedAuthenticators,proto3" json:"selected_authenticators,omitempty"` +} + +func (m *TxExtension) Reset() { *m = TxExtension{} } +func (m *TxExtension) String() string { return proto.CompactTextString(m) } +func (*TxExtension) ProtoMessage() {} +func (*TxExtension) Descriptor() ([]byte, []int) { + return fileDescriptor_2d1c240983fd17d6, []int{6} +} +func (m *TxExtension) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TxExtension) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TxExtension.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TxExtension) XXX_Merge(src proto.Message) { + xxx_messageInfo_TxExtension.Merge(m, src) +} +func (m *TxExtension) XXX_Size() int { + return m.Size() +} +func (m *TxExtension) XXX_DiscardUnknown() { + xxx_messageInfo_TxExtension.DiscardUnknown(m) +} + +var xxx_messageInfo_TxExtension proto.InternalMessageInfo + +func (m *TxExtension) GetSelectedAuthenticators() []uint64 { + if m != nil { + return m.SelectedAuthenticators + } + return nil +} + +func init() { + proto.RegisterType((*MsgAddAuthenticator)(nil), "dydxprotocol.accountplus.MsgAddAuthenticator") + proto.RegisterType((*MsgAddAuthenticatorResponse)(nil), "dydxprotocol.accountplus.MsgAddAuthenticatorResponse") + proto.RegisterType((*MsgRemoveAuthenticator)(nil), "dydxprotocol.accountplus.MsgRemoveAuthenticator") + proto.RegisterType((*MsgRemoveAuthenticatorResponse)(nil), "dydxprotocol.accountplus.MsgRemoveAuthenticatorResponse") + proto.RegisterType((*MsgSetActiveState)(nil), "dydxprotocol.accountplus.MsgSetActiveState") + proto.RegisterType((*MsgSetActiveStateResponse)(nil), "dydxprotocol.accountplus.MsgSetActiveStateResponse") + proto.RegisterType((*TxExtension)(nil), "dydxprotocol.accountplus.TxExtension") +} + +func init() { proto.RegisterFile("dydxprotocol/accountplus/tx.proto", fileDescriptor_2d1c240983fd17d6) } + +var fileDescriptor_2d1c240983fd17d6 = []byte{ + // 511 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcf, 0x6a, 0xdb, 0x40, + 0x10, 0xc6, 0x2d, 0xdb, 0xb8, 0xe9, 0xb6, 0x84, 0x5a, 0x01, 0xc7, 0x75, 0x40, 0xa4, 0x82, 0x82, + 0x71, 0x91, 0xd4, 0x36, 0x0d, 0x29, 0x82, 0x1c, 0x5c, 0x68, 0x6f, 0xbe, 0x28, 0x81, 0x42, 0x2f, + 0x61, 0xb3, 0x3b, 0xc8, 0x02, 0x4b, 0x2b, 0x34, 0x2b, 0x23, 0xf7, 0x52, 0xda, 0x63, 0x4f, 0x7d, + 0x90, 0x1e, 0xf2, 0x18, 0x3d, 0xe6, 0xd8, 0x63, 0xb1, 0x0f, 0x79, 0x84, 0x5e, 0x83, 0xd7, 0x7f, + 0xb0, 0x1c, 0x39, 0xc4, 0x17, 0x5b, 0x3b, 0xf3, 0xcd, 0xcc, 0x6f, 0x56, 0x1f, 0x22, 0x2f, 0xf8, + 0x88, 0x67, 0x71, 0x22, 0xa4, 0x60, 0x62, 0xe0, 0x50, 0xc6, 0x44, 0x1a, 0xc9, 0x78, 0x90, 0xa2, + 0x23, 0x33, 0x5b, 0xc5, 0xf5, 0xe6, 0xaa, 0xc4, 0x5e, 0x91, 0xb4, 0xf6, 0x99, 0xc0, 0x50, 0xa0, + 0x13, 0xa2, 0xef, 0x0c, 0xdf, 0x4c, 0xff, 0x66, 0x25, 0xad, 0x3a, 0x0d, 0x83, 0x48, 0x38, 0xea, + 0x77, 0x16, 0x32, 0x7f, 0x6b, 0x64, 0xaf, 0x87, 0x7e, 0x97, 0xf3, 0x6e, 0x2a, 0xfb, 0x10, 0xc9, + 0x80, 0x51, 0x29, 0x12, 0xbd, 0x41, 0x6a, 0x08, 0x11, 0x87, 0xa4, 0xa9, 0x1d, 0x6a, 0xed, 0xc7, + 0xde, 0xfc, 0xa4, 0x5b, 0x44, 0xa7, 0xab, 0xc2, 0x0b, 0x39, 0x8a, 0xa1, 0x59, 0x56, 0x9a, 0x7a, + 0x2e, 0x73, 0x3e, 0x8a, 0x41, 0xd7, 0x49, 0x95, 0x53, 0x49, 0x9b, 0x95, 0x43, 0xad, 0xfd, 0xd4, + 0x53, 0xcf, 0xae, 0xfb, 0xe3, 0xe6, 0xaa, 0x33, 0xef, 0xf7, 0xf3, 0xe6, 0xaa, 0xd3, 0xd9, 0xb8, + 0x2b, 0xe5, 0xdc, 0xca, 0xf5, 0x34, 0x4f, 0xc8, 0x41, 0x01, 0xad, 0x07, 0x18, 0x8b, 0x08, 0x41, + 0x6f, 0x92, 0x47, 0x98, 0x32, 0x06, 0x88, 0x0a, 0x7b, 0xc7, 0x5b, 0x1c, 0xcd, 0x6f, 0xa4, 0xd1, + 0x43, 0xdf, 0x83, 0x50, 0x0c, 0xe1, 0x61, 0x9b, 0xee, 0x92, 0x72, 0xc0, 0xd5, 0x66, 0x55, 0xaf, + 0x1c, 0x70, 0xf7, 0x74, 0x0d, 0xdb, 0xda, 0x88, 0x9d, 0xa8, 0x29, 0x6b, 0xe4, 0x2e, 0x31, 0x8a, + 0x01, 0x1e, 0x00, 0xff, 0x95, 0xd4, 0x7b, 0xe8, 0x9f, 0x81, 0xec, 0x32, 0x19, 0x0c, 0xe1, 0x4c, + 0x52, 0x09, 0x1b, 0xb9, 0x1b, 0xa4, 0x46, 0x95, 0x4c, 0xb1, 0xef, 0x78, 0xf3, 0x93, 0x7b, 0xbc, + 0xc6, 0xff, 0x52, 0x99, 0x24, 0x40, 0x07, 0x43, 0x9a, 0xc8, 0x39, 0xbf, 0x83, 0x20, 0xad, 0x59, + 0x81, 0x85, 0xd3, 0x31, 0xe6, 0x01, 0x79, 0x7e, 0x67, 0xf6, 0x02, 0xd9, 0xfc, 0x44, 0x9e, 0x9c, + 0x67, 0x1f, 0x33, 0x09, 0x11, 0x06, 0x22, 0xd2, 0x4f, 0xc8, 0x3e, 0xc2, 0x00, 0x98, 0x04, 0x7e, + 0x91, 0xdb, 0x7e, 0xba, 0x51, 0xa5, 0x5d, 0xf5, 0x1a, 0x8b, 0x74, 0xee, 0x06, 0xf0, 0xed, 0xff, + 0x32, 0xa9, 0xf4, 0xd0, 0xd7, 0x33, 0xf2, 0xec, 0x8e, 0x13, 0x2d, 0x7b, 0x93, 0xd1, 0xed, 0x02, + 0x2b, 0xb4, 0x8e, 0xb7, 0x92, 0x2f, 0x2f, 0xff, 0xbb, 0x46, 0xf6, 0x8a, 0xdc, 0xf1, 0xfa, 0xde, + 0x76, 0x05, 0x15, 0xad, 0xf7, 0xdb, 0x56, 0x2c, 0x19, 0x12, 0xb2, 0xbb, 0xf6, 0x8e, 0x5f, 0xdd, + 0xdb, 0x2b, 0x2f, 0x6e, 0x1d, 0x6d, 0x21, 0x5e, 0xcc, 0xfc, 0xf0, 0xf9, 0xcf, 0xd8, 0xd0, 0xae, + 0xc7, 0x86, 0xf6, 0x6f, 0x6c, 0x68, 0xbf, 0x26, 0x46, 0xe9, 0x7a, 0x62, 0x94, 0xfe, 0x4e, 0x8c, + 0xd2, 0x97, 0x53, 0x3f, 0x90, 0xfd, 0xf4, 0xd2, 0x66, 0x22, 0x74, 0x72, 0x56, 0x1f, 0xbe, 0xb3, + 0x58, 0x9f, 0x06, 0x91, 0xb3, 0x8c, 0x64, 0xf9, 0x2f, 0xd4, 0x28, 0x06, 0xbc, 0xac, 0xa9, 0xec, + 0xd1, 0x6d, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6f, 0xd1, 0xf0, 0xf4, 0xca, 0x04, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // AddAuthenticator adds an authenticator to an account. + AddAuthenticator(ctx context.Context, in *MsgAddAuthenticator, opts ...grpc.CallOption) (*MsgAddAuthenticatorResponse, error) + // RemoveAuthenticator removes an authenticator from an account. + RemoveAuthenticator(ctx context.Context, in *MsgRemoveAuthenticator, opts ...grpc.CallOption) (*MsgRemoveAuthenticatorResponse, error) + // SetActiveState sets the active state of the authenticator. + // Primarily used for circuit breaking. + SetActiveState(ctx context.Context, in *MsgSetActiveState, opts ...grpc.CallOption) (*MsgSetActiveStateResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) AddAuthenticator(ctx context.Context, in *MsgAddAuthenticator, opts ...grpc.CallOption) (*MsgAddAuthenticatorResponse, error) { + out := new(MsgAddAuthenticatorResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.accountplus.Msg/AddAuthenticator", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RemoveAuthenticator(ctx context.Context, in *MsgRemoveAuthenticator, opts ...grpc.CallOption) (*MsgRemoveAuthenticatorResponse, error) { + out := new(MsgRemoveAuthenticatorResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.accountplus.Msg/RemoveAuthenticator", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SetActiveState(ctx context.Context, in *MsgSetActiveState, opts ...grpc.CallOption) (*MsgSetActiveStateResponse, error) { + out := new(MsgSetActiveStateResponse) + err := c.cc.Invoke(ctx, "/dydxprotocol.accountplus.Msg/SetActiveState", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // AddAuthenticator adds an authenticator to an account. + AddAuthenticator(context.Context, *MsgAddAuthenticator) (*MsgAddAuthenticatorResponse, error) + // RemoveAuthenticator removes an authenticator from an account. + RemoveAuthenticator(context.Context, *MsgRemoveAuthenticator) (*MsgRemoveAuthenticatorResponse, error) + // SetActiveState sets the active state of the authenticator. + // Primarily used for circuit breaking. + SetActiveState(context.Context, *MsgSetActiveState) (*MsgSetActiveStateResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) AddAuthenticator(ctx context.Context, req *MsgAddAuthenticator) (*MsgAddAuthenticatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddAuthenticator not implemented") +} +func (*UnimplementedMsgServer) RemoveAuthenticator(ctx context.Context, req *MsgRemoveAuthenticator) (*MsgRemoveAuthenticatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveAuthenticator not implemented") +} +func (*UnimplementedMsgServer) SetActiveState(ctx context.Context, req *MsgSetActiveState) (*MsgSetActiveStateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetActiveState not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_AddAuthenticator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAddAuthenticator) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).AddAuthenticator(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.accountplus.Msg/AddAuthenticator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).AddAuthenticator(ctx, req.(*MsgAddAuthenticator)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RemoveAuthenticator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveAuthenticator) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RemoveAuthenticator(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.accountplus.Msg/RemoveAuthenticator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RemoveAuthenticator(ctx, req.(*MsgRemoveAuthenticator)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_SetActiveState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetActiveState) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SetActiveState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dydxprotocol.accountplus.Msg/SetActiveState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetActiveState(ctx, req.(*MsgSetActiveState)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "dydxprotocol.accountplus.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "AddAuthenticator", + Handler: _Msg_AddAuthenticator_Handler, + }, + { + MethodName: "RemoveAuthenticator", + Handler: _Msg_RemoveAuthenticator_Handler, + }, + { + MethodName: "SetActiveState", + Handler: _Msg_SetActiveState_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "dydxprotocol/accountplus/tx.proto", +} + +func (m *MsgAddAuthenticator) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgAddAuthenticator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddAuthenticator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x1a + } + if len(m.AuthenticatorType) > 0 { + i -= len(m.AuthenticatorType) + copy(dAtA[i:], m.AuthenticatorType) + i = encodeVarintTx(dAtA, i, uint64(len(m.AuthenticatorType))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgAddAuthenticatorResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgAddAuthenticatorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddAuthenticatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Success { + i-- + if m.Success { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgRemoveAuthenticator) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRemoveAuthenticator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveAuthenticator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Id != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x10 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRemoveAuthenticatorResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRemoveAuthenticatorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveAuthenticatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Success { + i-- + if m.Success { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgSetActiveState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSetActiveState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetActiveState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Active { + i-- + if m.Active { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSetActiveStateResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSetActiveStateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetActiveStateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *TxExtension) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TxExtension) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TxExtension) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SelectedAuthenticators) > 0 { + dAtA2 := make([]byte, len(m.SelectedAuthenticators)*10) + var j1 int + for _, num := range m.SelectedAuthenticators { + for num >= 1<<7 { + dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j1++ + } + dAtA2[j1] = uint8(num) + j1++ + } + i -= j1 + copy(dAtA[i:], dAtA2[:j1]) + i = encodeVarintTx(dAtA, i, uint64(j1)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgAddAuthenticator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.AuthenticatorType) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgAddAuthenticatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Success { + n += 2 + } + return n +} + +func (m *MsgRemoveAuthenticator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Id != 0 { + n += 1 + sovTx(uint64(m.Id)) + } + return n +} + +func (m *MsgRemoveAuthenticatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Success { + n += 2 + } + return n +} + +func (m *MsgSetActiveState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Active { + n += 2 + } + return n +} + +func (m *MsgSetActiveStateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *TxExtension) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.SelectedAuthenticators) > 0 { + l = 0 + for _, e := range m.SelectedAuthenticators { + l += sovTx(uint64(e)) + } + n += 1 + sovTx(uint64(l)) + l + } + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgAddAuthenticator) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAddAuthenticator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddAuthenticator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthenticatorType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuthenticatorType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgAddAuthenticatorResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAddAuthenticatorResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddAuthenticatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Success = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRemoveAuthenticator) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRemoveAuthenticator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveAuthenticator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRemoveAuthenticatorResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRemoveAuthenticatorResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveAuthenticatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Success = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSetActiveState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSetActiveState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetActiveState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Active", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Active = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSetActiveStateResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSetActiveStateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetActiveStateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TxExtension) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TxExtension: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TxExtension: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.SelectedAuthenticators = append(m.SelectedAuthenticators, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.SelectedAuthenticators) == 0 { + m.SelectedAuthenticators = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.SelectedAuthenticators = append(m.SelectedAuthenticators, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field SelectedAuthenticators", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +)