From 01f2f97cf5a40998604854b774129a0235f35b76 Mon Sep 17 00:00:00 2001 From: Teddy Ding Date: Tue, 5 Nov 2024 17:21:51 -0500 Subject: [PATCH] Add gRPC gateway routing for affiliate queries (#2554) (cherry picked from commit 9d3e3cb5ac05429e9dd3d9093a0262416f1a146c) --- .../dydxprotocol/affiliates/query.lcd.ts | 46 ++ .../src/codegen/dydxprotocol/bundle.ts | 238 +++++----- .../v4-protos/src/codegen/dydxprotocol/lcd.ts | 3 + proto/dydxprotocol/affiliates/query.proto | 21 +- protocol/x/affiliates/module.go | 7 +- protocol/x/affiliates/types/query.pb.go | 82 ++-- protocol/x/affiliates/types/query.pb.gw.go | 420 ++++++++++++++++++ 7 files changed, 656 insertions(+), 161 deletions(-) create mode 100644 indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.lcd.ts create mode 100644 protocol/x/affiliates/types/query.pb.gw.go diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.lcd.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.lcd.ts new file mode 100644 index 0000000000..4abc5b7a4a --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.lcd.ts @@ -0,0 +1,46 @@ +import { LCDClient } from "@osmonauts/lcd"; +import { AffiliateInfoRequest, AffiliateInfoResponseSDKType, ReferredByRequest, ReferredByResponseSDKType, AllAffiliateTiersRequest, AllAffiliateTiersResponseSDKType, AffiliateWhitelistRequest, AffiliateWhitelistResponseSDKType } from "./query"; +export class LCDQueryClient { + req: LCDClient; + + constructor({ + requestClient + }: { + requestClient: LCDClient; + }) { + this.req = requestClient; + this.affiliateInfo = this.affiliateInfo.bind(this); + this.referredBy = this.referredBy.bind(this); + this.allAffiliateTiers = this.allAffiliateTiers.bind(this); + this.affiliateWhitelist = this.affiliateWhitelist.bind(this); + } + /* Query AffiliateInfo returns the affiliate info for a given address. */ + + + async affiliateInfo(params: AffiliateInfoRequest): Promise { + const endpoint = `dydxprotocol/affiliates/affiliate_info/${params.address}`; + return await this.req.get(endpoint); + } + /* Query ReferredBy returns the affiliate that referred a given address. */ + + + async referredBy(params: ReferredByRequest): Promise { + const endpoint = `dydxprotocol/affiliates/referred_by/${params.address}`; + return await this.req.get(endpoint); + } + /* Query AllAffiliateTiers returns all affiliate tiers. */ + + + async allAffiliateTiers(_params: AllAffiliateTiersRequest = {}): Promise { + const endpoint = `dydxprotocol/affiliates/all_affiliate_tiers`; + return await this.req.get(endpoint); + } + /* Query AffiliateWhitelist returns the affiliate whitelist. */ + + + async affiliateWhitelist(_params: AffiliateWhitelistRequest = {}): Promise { + const endpoint = `dydxprotocol/affiliates/affiliate_whitelist`; + return await this.req.get(endpoint); + } + +} \ 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 3550eca53c..42aaa1e67a 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts @@ -123,65 +123,66 @@ import * as _126 from "./vest/query"; import * as _127 from "./vest/tx"; import * as _128 from "./vest/vest_entry"; import * as _136 from "./accountplus/query.lcd"; -import * as _137 from "./assets/query.lcd"; -import * as _138 from "./blocktime/query.lcd"; -import * as _139 from "./bridge/query.lcd"; -import * as _140 from "./clob/query.lcd"; -import * as _141 from "./delaymsg/query.lcd"; -import * as _142 from "./epochs/query.lcd"; -import * as _143 from "./feetiers/query.lcd"; -import * as _144 from "./listing/query.lcd"; -import * as _145 from "./perpetuals/query.lcd"; -import * as _146 from "./prices/query.lcd"; -import * as _147 from "./ratelimit/query.lcd"; -import * as _148 from "./revshare/query.lcd"; -import * as _149 from "./rewards/query.lcd"; -import * as _150 from "./stats/query.lcd"; -import * as _151 from "./subaccounts/query.lcd"; -import * as _152 from "./vault/query.lcd"; -import * as _153 from "./vest/query.lcd"; -import * as _154 from "./accountplus/query.rpc.Query"; -import * as _155 from "./affiliates/query.rpc.Query"; -import * as _156 from "./assets/query.rpc.Query"; -import * as _157 from "./blocktime/query.rpc.Query"; -import * as _158 from "./bridge/query.rpc.Query"; -import * as _159 from "./clob/query.rpc.Query"; -import * as _160 from "./delaymsg/query.rpc.Query"; -import * as _161 from "./epochs/query.rpc.Query"; -import * as _162 from "./feetiers/query.rpc.Query"; -import * as _163 from "./govplus/query.rpc.Query"; -import * as _164 from "./listing/query.rpc.Query"; -import * as _165 from "./perpetuals/query.rpc.Query"; -import * as _166 from "./prices/query.rpc.Query"; -import * as _167 from "./ratelimit/query.rpc.Query"; -import * as _168 from "./revshare/query.rpc.Query"; -import * as _169 from "./rewards/query.rpc.Query"; -import * as _170 from "./sending/query.rpc.Query"; -import * as _171 from "./stats/query.rpc.Query"; -import * as _172 from "./subaccounts/query.rpc.Query"; -import * as _173 from "./vault/query.rpc.Query"; -import * as _174 from "./vest/query.rpc.Query"; -import * as _175 from "./accountplus/tx.rpc.msg"; -import * as _176 from "./affiliates/tx.rpc.msg"; -import * as _177 from "./blocktime/tx.rpc.msg"; -import * as _178 from "./bridge/tx.rpc.msg"; -import * as _179 from "./clob/tx.rpc.msg"; -import * as _180 from "./delaymsg/tx.rpc.msg"; -import * as _181 from "./feetiers/tx.rpc.msg"; -import * as _182 from "./govplus/tx.rpc.msg"; -import * as _183 from "./listing/tx.rpc.msg"; -import * as _184 from "./perpetuals/tx.rpc.msg"; -import * as _185 from "./prices/tx.rpc.msg"; -import * as _186 from "./ratelimit/tx.rpc.msg"; -import * as _187 from "./revshare/tx.rpc.msg"; -import * as _188 from "./rewards/tx.rpc.msg"; -import * as _189 from "./sending/tx.rpc.msg"; -import * as _190 from "./stats/tx.rpc.msg"; -import * as _191 from "./vault/tx.rpc.msg"; -import * as _192 from "./vest/tx.rpc.msg"; -import * as _193 from "./lcd"; -import * as _194 from "./rpc.query"; -import * as _195 from "./rpc.tx"; +import * as _137 from "./affiliates/query.lcd"; +import * as _138 from "./assets/query.lcd"; +import * as _139 from "./blocktime/query.lcd"; +import * as _140 from "./bridge/query.lcd"; +import * as _141 from "./clob/query.lcd"; +import * as _142 from "./delaymsg/query.lcd"; +import * as _143 from "./epochs/query.lcd"; +import * as _144 from "./feetiers/query.lcd"; +import * as _145 from "./listing/query.lcd"; +import * as _146 from "./perpetuals/query.lcd"; +import * as _147 from "./prices/query.lcd"; +import * as _148 from "./ratelimit/query.lcd"; +import * as _149 from "./revshare/query.lcd"; +import * as _150 from "./rewards/query.lcd"; +import * as _151 from "./stats/query.lcd"; +import * as _152 from "./subaccounts/query.lcd"; +import * as _153 from "./vault/query.lcd"; +import * as _154 from "./vest/query.lcd"; +import * as _155 from "./accountplus/query.rpc.Query"; +import * as _156 from "./affiliates/query.rpc.Query"; +import * as _157 from "./assets/query.rpc.Query"; +import * as _158 from "./blocktime/query.rpc.Query"; +import * as _159 from "./bridge/query.rpc.Query"; +import * as _160 from "./clob/query.rpc.Query"; +import * as _161 from "./delaymsg/query.rpc.Query"; +import * as _162 from "./epochs/query.rpc.Query"; +import * as _163 from "./feetiers/query.rpc.Query"; +import * as _164 from "./govplus/query.rpc.Query"; +import * as _165 from "./listing/query.rpc.Query"; +import * as _166 from "./perpetuals/query.rpc.Query"; +import * as _167 from "./prices/query.rpc.Query"; +import * as _168 from "./ratelimit/query.rpc.Query"; +import * as _169 from "./revshare/query.rpc.Query"; +import * as _170 from "./rewards/query.rpc.Query"; +import * as _171 from "./sending/query.rpc.Query"; +import * as _172 from "./stats/query.rpc.Query"; +import * as _173 from "./subaccounts/query.rpc.Query"; +import * as _174 from "./vault/query.rpc.Query"; +import * as _175 from "./vest/query.rpc.Query"; +import * as _176 from "./accountplus/tx.rpc.msg"; +import * as _177 from "./affiliates/tx.rpc.msg"; +import * as _178 from "./blocktime/tx.rpc.msg"; +import * as _179 from "./bridge/tx.rpc.msg"; +import * as _180 from "./clob/tx.rpc.msg"; +import * as _181 from "./delaymsg/tx.rpc.msg"; +import * as _182 from "./feetiers/tx.rpc.msg"; +import * as _183 from "./govplus/tx.rpc.msg"; +import * as _184 from "./listing/tx.rpc.msg"; +import * as _185 from "./perpetuals/tx.rpc.msg"; +import * as _186 from "./prices/tx.rpc.msg"; +import * as _187 from "./ratelimit/tx.rpc.msg"; +import * as _188 from "./revshare/tx.rpc.msg"; +import * as _189 from "./rewards/tx.rpc.msg"; +import * as _190 from "./sending/tx.rpc.msg"; +import * as _191 from "./stats/tx.rpc.msg"; +import * as _192 from "./vault/tx.rpc.msg"; +import * as _193 from "./vest/tx.rpc.msg"; +import * as _194 from "./lcd"; +import * as _195 from "./rpc.query"; +import * as _196 from "./rpc.tx"; export namespace dydxprotocol { export const accountplus = { ..._5, ..._6, @@ -190,31 +191,32 @@ export namespace dydxprotocol { ..._9, ..._10, ..._136, - ..._154, - ..._175 + ..._155, + ..._176 }; export const affiliates = { ..._11, ..._12, ..._13, ..._14, - ..._155, - ..._176 + ..._137, + ..._156, + ..._177 }; export const assets = { ..._15, ..._16, ..._17, ..._18, - ..._137, - ..._156 + ..._138, + ..._157 }; export const blocktime = { ..._19, ..._20, ..._21, ..._22, ..._23, - ..._138, - ..._157, - ..._177 + ..._139, + ..._158, + ..._178 }; export const bridge = { ..._24, ..._25, @@ -222,9 +224,9 @@ export namespace dydxprotocol { ..._27, ..._28, ..._29, - ..._139, - ..._158, - ..._178 + ..._140, + ..._159, + ..._179 }; export const clob = { ..._30, ..._31, @@ -242,9 +244,9 @@ export namespace dydxprotocol { ..._43, ..._44, ..._45, - ..._140, - ..._159, - ..._179 + ..._141, + ..._160, + ..._180 }; export namespace daemons { export const bridge = { ..._46 @@ -259,29 +261,29 @@ export namespace dydxprotocol { ..._51, ..._52, ..._53, - ..._141, - ..._160, - ..._180 + ..._142, + ..._161, + ..._181 }; export const epochs = { ..._54, ..._55, ..._56, - ..._142, - ..._161 + ..._143, + ..._162 }; export const feetiers = { ..._57, ..._58, ..._59, ..._60, - ..._143, - ..._162, - ..._181 + ..._144, + ..._163, + ..._182 }; export const govplus = { ..._61, ..._62, ..._63, - ..._163, - ..._182 + ..._164, + ..._183 }; export namespace indexer { export const events = { ..._64 @@ -308,27 +310,27 @@ export namespace dydxprotocol { ..._75, ..._76, ..._77, - ..._144, - ..._164, - ..._183 + ..._145, + ..._165, + ..._184 }; export const perpetuals = { ..._78, ..._79, ..._80, ..._81, ..._82, - ..._145, - ..._165, - ..._184 + ..._146, + ..._166, + ..._185 }; export const prices = { ..._83, ..._84, ..._85, ..._86, ..._87, - ..._146, - ..._166, - ..._185 + ..._147, + ..._167, + ..._186 }; export const ratelimit = { ..._88, ..._89, @@ -336,43 +338,43 @@ export namespace dydxprotocol { ..._91, ..._92, ..._93, - ..._147, - ..._167, - ..._186 + ..._148, + ..._168, + ..._187 }; export const revshare = { ..._94, ..._95, ..._96, ..._97, ..._98, - ..._148, - ..._168, - ..._187 + ..._149, + ..._169, + ..._188 }; export const rewards = { ..._99, ..._100, ..._101, ..._102, ..._103, - ..._149, - ..._169, - ..._188 + ..._150, + ..._170, + ..._189 }; export const sending = { ..._104, ..._105, ..._106, ..._107, - ..._170, - ..._189 + ..._171, + ..._190 }; export const stats = { ..._108, ..._109, ..._110, ..._111, ..._112, - ..._150, - ..._171, - ..._190 + ..._151, + ..._172, + ..._191 }; export const subaccounts = { ..._113, ..._114, @@ -380,8 +382,8 @@ export namespace dydxprotocol { ..._116, ..._117, ..._118, - ..._151, - ..._172 + ..._152, + ..._173 }; export const vault = { ..._119, ..._120, @@ -389,20 +391,20 @@ export namespace dydxprotocol { ..._122, ..._123, ..._124, - ..._152, - ..._173, - ..._191 + ..._153, + ..._174, + ..._192 }; export const vest = { ..._125, ..._126, ..._127, ..._128, - ..._153, - ..._174, - ..._192 + ..._154, + ..._175, + ..._193 }; - export const ClientFactory = { ..._193, - ..._194, - ..._195 + export const ClientFactory = { ..._194, + ..._195, + ..._196 }; } \ 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 dd77cee074..7a332c4c8e 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/lcd.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/lcd.ts @@ -12,6 +12,9 @@ export const createLCDClient = async ({ accountplus: new (await import("./accountplus/query.lcd")).LCDQueryClient({ requestClient }), + affiliates: new (await import("./affiliates/query.lcd")).LCDQueryClient({ + requestClient + }), assets: new (await import("./assets/query.lcd")).LCDQueryClient({ requestClient }), diff --git a/proto/dydxprotocol/affiliates/query.proto b/proto/dydxprotocol/affiliates/query.proto index 16fdb2f242..9e2c612e70 100644 --- a/proto/dydxprotocol/affiliates/query.proto +++ b/proto/dydxprotocol/affiliates/query.proto @@ -4,21 +4,34 @@ package dydxprotocol.affiliates; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "dydxprotocol/affiliates/affiliates.proto"; +import "google/api/annotations.proto"; option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/affiliates/types"; // Query defines the gRPC querier service. service Query { // Query AffiliateInfo returns the affiliate info for a given address. - rpc AffiliateInfo(AffiliateInfoRequest) returns (AffiliateInfoResponse); + rpc AffiliateInfo(AffiliateInfoRequest) returns (AffiliateInfoResponse) { + option (google.api.http).get = + "/dydxprotocol/affiliates/affiliate_info/{address}"; + }; // Query ReferredBy returns the affiliate that referred a given address. - rpc ReferredBy(ReferredByRequest) returns (ReferredByResponse); + rpc ReferredBy(ReferredByRequest) returns (ReferredByResponse) { + option (google.api.http).get = + "/dydxprotocol/affiliates/referred_by/{address}"; + }; // Query AllAffiliateTiers returns all affiliate tiers. rpc AllAffiliateTiers(AllAffiliateTiersRequest) - returns (AllAffiliateTiersResponse); + returns (AllAffiliateTiersResponse) { + option (google.api.http).get = + "/dydxprotocol/affiliates/all_affiliate_tiers"; + }; // Query AffiliateWhitelist returns the affiliate whitelist. rpc AffiliateWhitelist(AffiliateWhitelistRequest) - returns (AffiliateWhitelistResponse); + returns (AffiliateWhitelistResponse) { + option (google.api.http).get = + "/dydxprotocol/affiliates/affiliate_whitelist"; + }; } // AffiliateInfoRequest is the request type for the Query/AffiliateInfo RPC diff --git a/protocol/x/affiliates/module.go b/protocol/x/affiliates/module.go index db70ee60a0..d2cbb7502e 100644 --- a/protocol/x/affiliates/module.go +++ b/protocol/x/affiliates/module.go @@ -78,7 +78,12 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {} +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) + if err != nil { + panic(err) + } +} // GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to // generate new transactions containing messages defined in the module. diff --git a/protocol/x/affiliates/types/query.pb.go b/protocol/x/affiliates/types/query.pb.go index dccbda4dc8..5ba1fd76db 100644 --- a/protocol/x/affiliates/types/query.pb.go +++ b/protocol/x/affiliates/types/query.pb.go @@ -11,6 +11,7 @@ import ( grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" github_com_dydxprotocol_v4_chain_protocol_dtypes "github.com/dydxprotocol/v4-chain/protocol/dtypes" + _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -424,44 +425,49 @@ func init() { } var fileDescriptor_2edc1b3ea39b05a9 = []byte{ - // 583 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0x8e, 0xfb, 0x03, 0x74, 0xda, 0x14, 0xba, 0x2a, 0xc2, 0x35, 0x92, 0x5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 0x23, 0xef, 0x2c, 0x06, 0x00, 0x00, + // 672 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcb, 0x6e, 0xd3, 0x40, + 0x14, 0x8d, 0x4b, 0x03, 0x74, 0xda, 0x14, 0x3a, 0x2a, 0xc2, 0x35, 0x28, 0xad, 0x8c, 0x10, 0x11, + 0xa5, 0x36, 0x4d, 0x2b, 0x24, 0x24, 0x16, 0x24, 0x08, 0x41, 0xd9, 0x00, 0x2e, 0x2a, 0x12, 0x2c, + 0x8c, 0x13, 0x5f, 0x27, 0x23, 0x6c, 0x8f, 0xeb, 0x99, 0x94, 0x06, 0xc4, 0x86, 0x2f, 0x40, 0x62, + 0xcd, 0x07, 0xb0, 0x43, 0x82, 0x25, 0x1f, 0xd0, 0x65, 0x05, 0x9b, 0x8a, 0x45, 0x85, 0x5a, 0x3e, + 0x04, 0x65, 0x3c, 0x71, 0x52, 0x5a, 0xab, 0x89, 0x60, 0x37, 0xbe, 0x8f, 0x73, 0x8e, 0xef, 0x9c, + 0x3b, 0xe8, 0x92, 0xdb, 0x76, 0x37, 0xa3, 0x98, 0x72, 0x5a, 0xa7, 0xbe, 0xe9, 0x78, 0x1e, 0xf1, + 0x89, 0xc3, 0x81, 0x99, 0xeb, 0x2d, 0x88, 0xdb, 0x86, 0xc8, 0xe0, 0xf3, 0xfd, 0x45, 0x46, 0xaf, + 0x48, 0x9b, 0xa9, 0x53, 0x16, 0x50, 0x66, 0x8b, 0x9c, 0x99, 0x7c, 0x24, 0x3d, 0xda, 0x74, 0x83, + 0x36, 0x68, 0x12, 0xef, 0x9c, 0x64, 0xb4, 0x94, 0x45, 0xd7, 0x3b, 0xca, 0xca, 0x8b, 0x0d, 0x4a, + 0x1b, 0x3e, 0x98, 0x4e, 0x44, 0x4c, 0x27, 0x0c, 0x29, 0x77, 0x38, 0xa1, 0xa1, 0xcc, 0xea, 0x0f, + 0xd0, 0x74, 0xa5, 0xdb, 0xb1, 0x12, 0x7a, 0xd4, 0x82, 0xf5, 0x16, 0x30, 0x8e, 0xcb, 0xe8, 0x94, + 0xe3, 0xba, 0x31, 0x30, 0xa6, 0x2a, 0x73, 0x4a, 0x69, 0xac, 0xaa, 0x7e, 0xff, 0xba, 0x30, 0x2d, + 0x85, 0x55, 0x92, 0xcc, 0x2a, 0x8f, 0x49, 0xd8, 0xb0, 0xba, 0x85, 0xfa, 0xce, 0x08, 0x3a, 0xf7, + 0x17, 0x18, 0x8b, 0x68, 0xc8, 0x00, 0x5f, 0x46, 0x93, 0x84, 0xd9, 0xaf, 0x9a, 0x84, 0x83, 0x4f, + 0x18, 0x07, 0x57, 0x80, 0x9e, 0xb6, 0x0a, 0x84, 0x3d, 0xed, 0x05, 0x31, 0x46, 0xa3, 0x9c, 0x40, + 0xac, 0x8e, 0xcc, 0x29, 0xa5, 0x82, 0x25, 0xce, 0x58, 0x47, 0x05, 0x0f, 0xc0, 0x66, 0x4d, 0x27, + 0x06, 0x3b, 0x8a, 0x02, 0xf5, 0x84, 0x48, 0x8e, 0x7b, 0x00, 0xab, 0x9d, 0xd8, 0xa3, 0x28, 0xc0, + 0xeb, 0xe8, 0x4c, 0x0c, 0x1e, 0xc4, 0x31, 0xb8, 0xf6, 0x06, 0xf5, 0x5b, 0x01, 0xa8, 0xa3, 0x73, + 0x4a, 0x69, 0xa2, 0x7a, 0x7f, 0x6b, 0x77, 0x36, 0xf7, 0x73, 0x77, 0xf6, 0x76, 0x83, 0xf0, 0x66, + 0xab, 0x66, 0xd4, 0x69, 0x60, 0x1e, 0x18, 0xdc, 0xc6, 0xf2, 0x42, 0xbd, 0xe9, 0x90, 0xd0, 0x4c, + 0x23, 0x2e, 0x6f, 0x47, 0xc0, 0x8c, 0x55, 0x88, 0x89, 0xe3, 0x93, 0xd7, 0x4e, 0xcd, 0x87, 0x95, + 0x90, 0x5b, 0x93, 0x5d, 0x82, 0x35, 0x81, 0x8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x26, 0xf3, 0x21, + 0x2f, 0x6a, 0xf3, 0x03, 0xd5, 0x4a, 0x89, 0x37, 0x84, 0xc4, 0xeb, 0xd8, 0xc8, 0x94, 0x98, 0xae, + 0x73, 0xad, 0xdd, 0xa7, 0xef, 0xb3, 0x82, 0xa6, 0x0e, 0x99, 0x08, 0x2f, 0x66, 0x0f, 0x28, 0xc3, + 0x8c, 0x5a, 0x79, 0x98, 0x16, 0x29, 0x7a, 0x59, 0x88, 0x36, 0xf0, 0xb5, 0xec, 0xb9, 0xfa, 0xbe, + 0xdd, 0x9b, 0xad, 0x30, 0x25, 0xfe, 0xa2, 0x20, 0x7c, 0xd8, 0x30, 0xb8, 0x3c, 0x84, 0xbb, 0xba, + 0xa2, 0x97, 0x86, 0xea, 0x19, 0x5c, 0x75, 0xaa, 0x38, 0xb5, 0x6f, 0x75, 0x6d, 0x6b, 0xaf, 0xa8, + 0x6c, 0xef, 0x15, 0x95, 0x5f, 0x7b, 0x45, 0xe5, 0xfd, 0x7e, 0x31, 0xb7, 0xbd, 0x5f, 0xcc, 0xed, + 0xec, 0x17, 0x73, 0xcf, 0x6e, 0x0d, 0xfe, 0xb0, 0x6d, 0xf6, 0xb3, 0x88, 0x47, 0xae, 0x76, 0x52, + 0x24, 0x97, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0x9e, 0x0e, 0x60, 0x8f, 0x2d, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/protocol/x/affiliates/types/query.pb.gw.go b/protocol/x/affiliates/types/query.pb.gw.go new file mode 100644 index 0000000000..dfd8a2f41c --- /dev/null +++ b/protocol/x/affiliates/types/query.pb.gw.go @@ -0,0 +1,420 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: dydxprotocol/affiliates/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_AffiliateInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AffiliateInfoRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + msg, err := client.AffiliateInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AffiliateInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AffiliateInfoRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + msg, err := server.AffiliateInfo(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_ReferredBy_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ReferredByRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + msg, err := client.ReferredBy(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ReferredBy_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ReferredByRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + msg, err := server.ReferredBy(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_AllAffiliateTiers_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AllAffiliateTiersRequest + var metadata runtime.ServerMetadata + + msg, err := client.AllAffiliateTiers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AllAffiliateTiers_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AllAffiliateTiersRequest + var metadata runtime.ServerMetadata + + msg, err := server.AllAffiliateTiers(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_AffiliateWhitelist_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AffiliateWhitelistRequest + var metadata runtime.ServerMetadata + + msg, err := client.AffiliateWhitelist(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AffiliateWhitelist_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AffiliateWhitelistRequest + var metadata runtime.ServerMetadata + + msg, err := server.AffiliateWhitelist(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_AffiliateInfo_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_AffiliateInfo_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_AffiliateInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ReferredBy_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_ReferredBy_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_ReferredBy_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AllAffiliateTiers_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_AllAffiliateTiers_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_AllAffiliateTiers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AffiliateWhitelist_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_AffiliateWhitelist_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_AffiliateWhitelist_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_AffiliateInfo_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_AffiliateInfo_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_AffiliateInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ReferredBy_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_ReferredBy_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_ReferredBy_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AllAffiliateTiers_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_AllAffiliateTiers_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_AllAffiliateTiers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AffiliateWhitelist_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_AffiliateWhitelist_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_AffiliateWhitelist_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_AffiliateInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"dydxprotocol", "affiliates", "affiliate_info", "address"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_ReferredBy_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"dydxprotocol", "affiliates", "referred_by", "address"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_AllAffiliateTiers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"dydxprotocol", "affiliates", "all_affiliate_tiers"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_AffiliateWhitelist_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"dydxprotocol", "affiliates", "affiliate_whitelist"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_AffiliateInfo_0 = runtime.ForwardResponseMessage + + forward_Query_ReferredBy_0 = runtime.ForwardResponseMessage + + forward_Query_AllAffiliateTiers_0 = runtime.ForwardResponseMessage + + forward_Query_AffiliateWhitelist_0 = runtime.ForwardResponseMessage +)