github.com/InjectiveLabs/sdk-go@v1.53.0/client/chain/chain_test_support.go (about) 1 package chain 2 3 import ( 4 "context" 5 "errors" 6 "time" 7 8 permissionstypes "github.com/InjectiveLabs/sdk-go/chain/permissions/types" 9 10 sdkmath "cosmossdk.io/math" 11 12 "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" 13 "google.golang.org/grpc" 14 15 wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" 16 exchangetypes "github.com/InjectiveLabs/sdk-go/chain/exchange/types" 17 chainstreamtypes "github.com/InjectiveLabs/sdk-go/chain/stream/types" 18 tokenfactorytypes "github.com/InjectiveLabs/sdk-go/chain/tokenfactory/types" 19 "github.com/InjectiveLabs/sdk-go/client/common" 20 rpchttp "github.com/cometbft/cometbft/rpc/client/http" 21 "github.com/cosmos/cosmos-sdk/client" 22 sdk "github.com/cosmos/cosmos-sdk/types" 23 "github.com/cosmos/cosmos-sdk/types/query" 24 txtypes "github.com/cosmos/cosmos-sdk/types/tx" 25 authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" 26 authztypes "github.com/cosmos/cosmos-sdk/x/authz" 27 banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" 28 distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" 29 ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" 30 ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" 31 ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" 32 ibcchanneltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" 33 eth "github.com/ethereum/go-ethereum/common" 34 ) 35 36 type MockChainClient struct { 37 DenomsMetadataResponses []*banktypes.QueryDenomsMetadataResponse 38 } 39 40 func (c *MockChainClient) CanSignTransactions() bool { 41 return true 42 } 43 44 func (c *MockChainClient) FromAddress() sdk.AccAddress { 45 return sdk.AccAddress{} 46 } 47 48 func (c *MockChainClient) QueryClient() *grpc.ClientConn { 49 return &grpc.ClientConn{} 50 } 51 52 func (c *MockChainClient) ClientContext() client.Context { 53 return client.Context{} 54 } 55 56 func (c *MockChainClient) GetAccNonce() (accNum, accSeq uint64) { 57 return 1, 2 58 } 59 60 func (c *MockChainClient) SimulateMsg(clientCtx client.Context, msgs ...sdk.Msg) (*txtypes.SimulateResponse, error) { 61 return &txtypes.SimulateResponse{}, nil 62 } 63 64 func (c *MockChainClient) AsyncBroadcastMsg(msgs ...sdk.Msg) (*txtypes.BroadcastTxResponse, error) { 65 return &txtypes.BroadcastTxResponse{}, nil 66 } 67 68 func (c *MockChainClient) SyncBroadcastMsg(msgs ...sdk.Msg) (*txtypes.BroadcastTxResponse, error) { 69 return &txtypes.BroadcastTxResponse{}, nil 70 } 71 72 func (c *MockChainClient) BuildSignedTx(clientCtx client.Context, accNum, accSeq, initialGas uint64, msg ...sdk.Msg) ([]byte, error) { 73 return []byte(nil), nil 74 } 75 76 func (c *MockChainClient) SyncBroadcastSignedTx(tyBytes []byte) (*txtypes.BroadcastTxResponse, error) { 77 return &txtypes.BroadcastTxResponse{}, nil 78 } 79 80 func (c *MockChainClient) AsyncBroadcastSignedTx(txBytes []byte) (*txtypes.BroadcastTxResponse, error) { 81 return &txtypes.BroadcastTxResponse{}, nil 82 } 83 84 func (c *MockChainClient) QueueBroadcastMsg(msgs ...sdk.Msg) error { 85 return nil 86 } 87 88 func (c *MockChainClient) GetBankBalances(ctx context.Context, address string) (*banktypes.QueryAllBalancesResponse, error) { 89 return &banktypes.QueryAllBalancesResponse{}, nil 90 } 91 92 func (c *MockChainClient) GetBankBalance(ctx context.Context, address, denom string) (*banktypes.QueryBalanceResponse, error) { 93 return &banktypes.QueryBalanceResponse{}, nil 94 } 95 96 func (c *MockChainClient) GetBankSpendableBalances(ctx context.Context, address string, pagination *query.PageRequest) (*banktypes.QuerySpendableBalancesResponse, error) { 97 return &banktypes.QuerySpendableBalancesResponse{}, nil 98 } 99 100 func (c *MockChainClient) GetBankSpendableBalancesByDenom(ctx context.Context, address, denom string) (*banktypes.QuerySpendableBalanceByDenomResponse, error) { 101 return &banktypes.QuerySpendableBalanceByDenomResponse{}, nil 102 } 103 104 func (c *MockChainClient) GetBankTotalSupply(ctx context.Context, pagination *query.PageRequest) (*banktypes.QueryTotalSupplyResponse, error) { 105 return &banktypes.QueryTotalSupplyResponse{}, nil 106 } 107 108 func (c *MockChainClient) GetBankSupplyOf(ctx context.Context, denom string) (*banktypes.QuerySupplyOfResponse, error) { 109 return &banktypes.QuerySupplyOfResponse{}, nil 110 } 111 112 func (c *MockChainClient) GetDenomMetadata(ctx context.Context, denom string) (*banktypes.QueryDenomMetadataResponse, error) { 113 return &banktypes.QueryDenomMetadataResponse{}, nil 114 } 115 116 func (c *MockChainClient) GetDenomsMetadata(ctx context.Context, pagination *query.PageRequest) (*banktypes.QueryDenomsMetadataResponse, error) { 117 var response *banktypes.QueryDenomsMetadataResponse 118 var localError error 119 if len(c.DenomsMetadataResponses) > 0 { 120 response = c.DenomsMetadataResponses[0] 121 c.DenomsMetadataResponses = c.DenomsMetadataResponses[1:] 122 localError = nil 123 } else { 124 response = &banktypes.QueryDenomsMetadataResponse{} 125 localError = errors.New("there are no responses configured") 126 } 127 128 return response, localError 129 } 130 131 func (c *MockChainClient) GetDenomOwners(ctx context.Context, denom string, pagination *query.PageRequest) (*banktypes.QueryDenomOwnersResponse, error) { 132 return &banktypes.QueryDenomOwnersResponse{}, nil 133 } 134 135 func (c *MockChainClient) GetBankSendEnabled(ctx context.Context, denoms []string, pagination *query.PageRequest) (*banktypes.QuerySendEnabledResponse, error) { 136 return &banktypes.QuerySendEnabledResponse{}, nil 137 } 138 139 func (c *MockChainClient) GetAuthzGrants(ctx context.Context, req authztypes.QueryGrantsRequest) (*authztypes.QueryGrantsResponse, error) { 140 return &authztypes.QueryGrantsResponse{}, nil 141 } 142 143 func (c *MockChainClient) GetAccount(ctx context.Context, address string) (*authtypes.QueryAccountResponse, error) { 144 return &authtypes.QueryAccountResponse{}, nil 145 } 146 147 func (c *MockChainClient) BuildGenericAuthz(granter, grantee, msgtype string, expireIn time.Time) *authztypes.MsgGrant { 148 return &authztypes.MsgGrant{} 149 } 150 151 func (c *MockChainClient) BuildExchangeAuthz(granter, grantee string, authzType ExchangeAuthz, subaccountId string, markets []string, expireIn time.Time) *authztypes.MsgGrant { 152 return &authztypes.MsgGrant{} 153 } 154 155 func (c *MockChainClient) BuildExchangeBatchUpdateOrdersAuthz( 156 granter string, 157 grantee string, 158 subaccountId string, 159 spotMarkets []string, 160 derivativeMarkets []string, 161 expireIn time.Time, 162 ) *authztypes.MsgGrant { 163 return &authztypes.MsgGrant{} 164 } 165 166 func (c *MockChainClient) DefaultSubaccount(acc sdk.AccAddress) eth.Hash { 167 return eth.HexToHash("") 168 } 169 170 func (c *MockChainClient) Subaccount(account sdk.AccAddress, index int) eth.Hash { 171 return eth.HexToHash("") 172 } 173 174 func (c *MockChainClient) GetSubAccountNonce(ctx context.Context, subaccountId eth.Hash) (*exchangetypes.QuerySubaccountTradeNonceResponse, error) { 175 return &exchangetypes.QuerySubaccountTradeNonceResponse{}, nil 176 } 177 178 func (c *MockChainClient) GetFeeDiscountInfo(ctx context.Context, account string) (*exchangetypes.QueryFeeDiscountAccountInfoResponse, error) { 179 return &exchangetypes.QueryFeeDiscountAccountInfoResponse{}, nil 180 } 181 182 func (c *MockChainClient) UpdateSubaccountNonceFromChain() error { 183 return nil 184 } 185 186 func (c *MockChainClient) SynchronizeSubaccountNonce(subaccountId eth.Hash) error { 187 return nil 188 } 189 190 func (c *MockChainClient) ComputeOrderHashes(spotOrders []exchangetypes.SpotOrder, derivativeOrders []exchangetypes.DerivativeOrder, subaccountId eth.Hash) (OrderHashes, error) { 191 return OrderHashes{}, nil 192 } 193 194 func (c *MockChainClient) SpotOrder(defaultSubaccountID eth.Hash, network common.Network, d *SpotOrderData) *exchangetypes.SpotOrder { 195 return c.CreateSpotOrder(defaultSubaccountID, d, MarketsAssistant{}) 196 } 197 198 func (c *MockChainClient) CreateSpotOrder(defaultSubaccountID eth.Hash, d *SpotOrderData, marketsAssistant MarketsAssistant) *exchangetypes.SpotOrder { 199 return &exchangetypes.SpotOrder{} 200 } 201 202 func (c *MockChainClient) DerivativeOrder(defaultSubaccountID eth.Hash, network common.Network, d *DerivativeOrderData) *exchangetypes.DerivativeOrder { 203 return c.CreateDerivativeOrder(defaultSubaccountID, d, MarketsAssistant{}) 204 } 205 206 func (c *MockChainClient) CreateDerivativeOrder(defaultSubaccountID eth.Hash, d *DerivativeOrderData, marketAssistant MarketsAssistant) *exchangetypes.DerivativeOrder { 207 return &exchangetypes.DerivativeOrder{} 208 } 209 210 func (c *MockChainClient) OrderCancel(defaultSubaccountID eth.Hash, d *OrderCancelData) *exchangetypes.OrderData { 211 return &exchangetypes.OrderData{} 212 } 213 214 func (c *MockChainClient) StreamEventOrderFail(sender string, failEventCh chan map[string]uint) {} 215 216 func (c *MockChainClient) StreamEventOrderFailWithWebsocket(sender string, websocket *rpchttp.HTTP, failEventCh chan map[string]uint) { 217 } 218 219 func (c *MockChainClient) StreamOrderbookUpdateEvents(orderbookType OrderbookType, marketIDs []string, orderbookCh chan exchangetypes.Orderbook) { 220 } 221 222 func (c *MockChainClient) StreamOrderbookUpdateEventsWithWebsocket(orderbookType OrderbookType, marketIDs []string, websocket *rpchttp.HTTP, orderbookCh chan exchangetypes.Orderbook) { 223 } 224 225 func (c *MockChainClient) ChainStream(ctx context.Context, req chainstreamtypes.StreamRequest) (chainstreamtypes.Stream_StreamClient, error) { 226 return nil, nil 227 } 228 229 func (c *MockChainClient) GetTx(ctx context.Context, txHash string) (*txtypes.GetTxResponse, error) { 230 return &txtypes.GetTxResponse{}, nil 231 } 232 233 func (c *MockChainClient) Close() {} 234 235 func (c *MockChainClient) GetGasFee() (string, error) { 236 return "", nil 237 } 238 239 func (c *MockChainClient) FetchContractInfo(ctx context.Context, address string) (*wasmtypes.QueryContractInfoResponse, error) { 240 return &wasmtypes.QueryContractInfoResponse{}, nil 241 } 242 243 func (c *MockChainClient) FetchContractHistory(ctx context.Context, address string, pagination *query.PageRequest) (*wasmtypes.QueryContractHistoryResponse, error) { 244 return &wasmtypes.QueryContractHistoryResponse{}, nil 245 } 246 247 func (c *MockChainClient) FetchContractsByCode(ctx context.Context, codeId uint64, pagination *query.PageRequest) (*wasmtypes.QueryContractsByCodeResponse, error) { 248 return &wasmtypes.QueryContractsByCodeResponse{}, nil 249 } 250 251 func (c *MockChainClient) FetchAllContractsState(ctx context.Context, address string, pagination *query.PageRequest) (*wasmtypes.QueryAllContractStateResponse, error) { 252 return &wasmtypes.QueryAllContractStateResponse{}, nil 253 } 254 255 func (c *MockChainClient) SmartContractState( 256 ctx context.Context, 257 contractAddress string, 258 queryData []byte, 259 ) (*wasmtypes.QuerySmartContractStateResponse, error) { 260 return &wasmtypes.QuerySmartContractStateResponse{}, nil 261 } 262 263 func (c *MockChainClient) RawContractState( 264 ctx context.Context, 265 contractAddress string, 266 queryData []byte, 267 ) (*wasmtypes.QueryRawContractStateResponse, error) { 268 return &wasmtypes.QueryRawContractStateResponse{}, nil 269 } 270 271 func (c *MockChainClient) FetchCode(ctx context.Context, codeId uint64) (*wasmtypes.QueryCodeResponse, error) { 272 return &wasmtypes.QueryCodeResponse{}, nil 273 } 274 275 func (c *MockChainClient) FetchCodes(ctx context.Context, pagination *query.PageRequest) (*wasmtypes.QueryCodesResponse, error) { 276 return &wasmtypes.QueryCodesResponse{}, nil 277 } 278 279 func (c *MockChainClient) FetchPinnedCodes(ctx context.Context, pagination *query.PageRequest) (*wasmtypes.QueryPinnedCodesResponse, error) { 280 return &wasmtypes.QueryPinnedCodesResponse{}, nil 281 } 282 283 func (c *MockChainClient) FetchContractsByCreator(ctx context.Context, creator string, pagination *query.PageRequest) (*wasmtypes.QueryContractsByCreatorResponse, error) { 284 return &wasmtypes.QueryContractsByCreatorResponse{}, nil 285 } 286 287 func (c *MockChainClient) FetchDenomAuthorityMetadata(ctx context.Context, creator, subDenom string) (*tokenfactorytypes.QueryDenomAuthorityMetadataResponse, error) { 288 return &tokenfactorytypes.QueryDenomAuthorityMetadataResponse{}, nil 289 } 290 291 func (c *MockChainClient) FetchDenomsFromCreator(ctx context.Context, creator string) (*tokenfactorytypes.QueryDenomsFromCreatorResponse, error) { 292 return &tokenfactorytypes.QueryDenomsFromCreatorResponse{}, nil 293 } 294 295 func (c *MockChainClient) FetchTokenfactoryModuleState(ctx context.Context) (*tokenfactorytypes.QueryModuleStateResponse, error) { 296 return &tokenfactorytypes.QueryModuleStateResponse{}, nil 297 } 298 299 // Distribution module 300 func (c *MockChainClient) FetchValidatorDistributionInfo(ctx context.Context, validatorAddress string) (*distributiontypes.QueryValidatorDistributionInfoResponse, error) { 301 return &distributiontypes.QueryValidatorDistributionInfoResponse{}, nil 302 } 303 304 func (c *MockChainClient) FetchValidatorOutstandingRewards(ctx context.Context, validatorAddress string) (*distributiontypes.QueryValidatorOutstandingRewardsResponse, error) { 305 return &distributiontypes.QueryValidatorOutstandingRewardsResponse{}, nil 306 } 307 308 func (c *MockChainClient) FetchValidatorCommission(ctx context.Context, validatorAddress string) (*distributiontypes.QueryValidatorCommissionResponse, error) { 309 return &distributiontypes.QueryValidatorCommissionResponse{}, nil 310 } 311 312 func (c *MockChainClient) FetchValidatorSlashes(ctx context.Context, validatorAddress string, startingHeight, endingHeight uint64, pagination *query.PageRequest) (*distributiontypes.QueryValidatorSlashesResponse, error) { 313 return &distributiontypes.QueryValidatorSlashesResponse{}, nil 314 } 315 316 func (c *MockChainClient) FetchDelegationRewards(ctx context.Context, delegatorAddress, validatorAddress string) (*distributiontypes.QueryDelegationRewardsResponse, error) { 317 return &distributiontypes.QueryDelegationRewardsResponse{}, nil 318 } 319 320 func (c *MockChainClient) FetchDelegationTotalRewards(ctx context.Context, delegatorAddress string) (*distributiontypes.QueryDelegationTotalRewardsResponse, error) { 321 return &distributiontypes.QueryDelegationTotalRewardsResponse{}, nil 322 } 323 324 func (c *MockChainClient) FetchDelegatorValidators(ctx context.Context, delegatorAddress string) (*distributiontypes.QueryDelegatorValidatorsResponse, error) { 325 return &distributiontypes.QueryDelegatorValidatorsResponse{}, nil 326 } 327 328 func (c *MockChainClient) FetchDelegatorWithdrawAddress(ctx context.Context, delegatorAddress string) (*distributiontypes.QueryDelegatorWithdrawAddressResponse, error) { 329 return &distributiontypes.QueryDelegatorWithdrawAddressResponse{}, nil 330 } 331 332 func (c *MockChainClient) FetchCommunityPool(ctx context.Context) (*distributiontypes.QueryCommunityPoolResponse, error) { 333 return &distributiontypes.QueryCommunityPoolResponse{}, nil 334 } 335 336 // Chain exchange module 337 func (c *MockChainClient) FetchSubaccountDeposits(ctx context.Context, subaccountId string) (*exchangetypes.QuerySubaccountDepositsResponse, error) { 338 return &exchangetypes.QuerySubaccountDepositsResponse{}, nil 339 } 340 341 func (c *MockChainClient) FetchSubaccountDeposit(ctx context.Context, subaccountId, denom string) (*exchangetypes.QuerySubaccountDepositResponse, error) { 342 return &exchangetypes.QuerySubaccountDepositResponse{}, nil 343 } 344 345 func (c *MockChainClient) FetchExchangeBalances(ctx context.Context) (*exchangetypes.QueryExchangeBalancesResponse, error) { 346 return &exchangetypes.QueryExchangeBalancesResponse{}, nil 347 } 348 349 func (c *MockChainClient) FetchAggregateVolume(ctx context.Context, account string) (*exchangetypes.QueryAggregateVolumeResponse, error) { 350 return &exchangetypes.QueryAggregateVolumeResponse{}, nil 351 } 352 353 func (c *MockChainClient) FetchAggregateVolumes(ctx context.Context, accounts, marketIDs []string) (*exchangetypes.QueryAggregateVolumesResponse, error) { 354 return &exchangetypes.QueryAggregateVolumesResponse{}, nil 355 } 356 357 func (c *MockChainClient) FetchAggregateMarketVolume(ctx context.Context, marketId string) (*exchangetypes.QueryAggregateMarketVolumeResponse, error) { 358 return &exchangetypes.QueryAggregateMarketVolumeResponse{}, nil 359 } 360 361 func (c *MockChainClient) FetchAggregateMarketVolumes(ctx context.Context, marketIDs []string) (*exchangetypes.QueryAggregateMarketVolumesResponse, error) { 362 return &exchangetypes.QueryAggregateMarketVolumesResponse{}, nil 363 } 364 365 func (c *MockChainClient) FetchDenomDecimal(ctx context.Context, denom string) (*exchangetypes.QueryDenomDecimalResponse, error) { 366 return &exchangetypes.QueryDenomDecimalResponse{}, nil 367 } 368 369 func (c *MockChainClient) FetchDenomDecimals(ctx context.Context, denoms []string) (*exchangetypes.QueryDenomDecimalsResponse, error) { 370 return &exchangetypes.QueryDenomDecimalsResponse{}, nil 371 } 372 373 func (c *MockChainClient) FetchChainSpotMarkets(ctx context.Context, status string, marketIDs []string) (*exchangetypes.QuerySpotMarketsResponse, error) { 374 return &exchangetypes.QuerySpotMarketsResponse{}, nil 375 } 376 377 func (c *MockChainClient) FetchChainSpotMarket(ctx context.Context, marketId string) (*exchangetypes.QuerySpotMarketResponse, error) { 378 return &exchangetypes.QuerySpotMarketResponse{}, nil 379 } 380 381 func (c *MockChainClient) FetchChainFullSpotMarkets(ctx context.Context, status string, marketIDs []string, withMidPriceAndTob bool) (*exchangetypes.QueryFullSpotMarketsResponse, error) { 382 return &exchangetypes.QueryFullSpotMarketsResponse{}, nil 383 } 384 385 func (c *MockChainClient) FetchChainFullSpotMarket(ctx context.Context, marketId string, withMidPriceAndTob bool) (*exchangetypes.QueryFullSpotMarketResponse, error) { 386 return &exchangetypes.QueryFullSpotMarketResponse{}, nil 387 } 388 389 func (c *MockChainClient) FetchChainSpotOrderbook(ctx context.Context, marketId string, limit uint64, orderSide exchangetypes.OrderSide, limitCumulativeNotional, limitCumulativeQuantity sdkmath.LegacyDec) (*exchangetypes.QuerySpotOrderbookResponse, error) { 390 return &exchangetypes.QuerySpotOrderbookResponse{}, nil 391 } 392 393 func (c *MockChainClient) FetchChainTraderSpotOrders(ctx context.Context, marketId, subaccountId string) (*exchangetypes.QueryTraderSpotOrdersResponse, error) { 394 return &exchangetypes.QueryTraderSpotOrdersResponse{}, nil 395 } 396 397 func (c *MockChainClient) FetchChainAccountAddressSpotOrders(ctx context.Context, marketId, address string) (*exchangetypes.QueryAccountAddressSpotOrdersResponse, error) { 398 return &exchangetypes.QueryAccountAddressSpotOrdersResponse{}, nil 399 } 400 401 func (c *MockChainClient) FetchChainSpotOrdersByHashes(ctx context.Context, marketId, subaccountId string, orderHashes []string) (*exchangetypes.QuerySpotOrdersByHashesResponse, error) { 402 return &exchangetypes.QuerySpotOrdersByHashesResponse{}, nil 403 } 404 405 func (c *MockChainClient) FetchChainSubaccountOrders(ctx context.Context, subaccountId, marketId string) (*exchangetypes.QuerySubaccountOrdersResponse, error) { 406 return &exchangetypes.QuerySubaccountOrdersResponse{}, nil 407 } 408 409 func (c *MockChainClient) FetchChainTraderSpotTransientOrders(ctx context.Context, marketId, subaccountId string) (*exchangetypes.QueryTraderSpotOrdersResponse, error) { 410 return &exchangetypes.QueryTraderSpotOrdersResponse{}, nil 411 } 412 413 func (c *MockChainClient) FetchSpotMidPriceAndTOB(ctx context.Context, marketId string) (*exchangetypes.QuerySpotMidPriceAndTOBResponse, error) { 414 return &exchangetypes.QuerySpotMidPriceAndTOBResponse{}, nil 415 } 416 417 func (c *MockChainClient) FetchDerivativeMidPriceAndTOB(ctx context.Context, marketId string) (*exchangetypes.QueryDerivativeMidPriceAndTOBResponse, error) { 418 return &exchangetypes.QueryDerivativeMidPriceAndTOBResponse{}, nil 419 } 420 421 func (c *MockChainClient) FetchChainDerivativeOrderbook(ctx context.Context, marketId string, limit uint64, limitCumulativeNotional sdkmath.LegacyDec) (*exchangetypes.QueryDerivativeOrderbookResponse, error) { 422 return &exchangetypes.QueryDerivativeOrderbookResponse{}, nil 423 } 424 425 func (c *MockChainClient) FetchChainTraderDerivativeOrders(ctx context.Context, marketId, subaccountId string) (*exchangetypes.QueryTraderDerivativeOrdersResponse, error) { 426 return &exchangetypes.QueryTraderDerivativeOrdersResponse{}, nil 427 } 428 429 func (c *MockChainClient) FetchChainAccountAddressDerivativeOrders(ctx context.Context, marketId, address string) (*exchangetypes.QueryAccountAddressDerivativeOrdersResponse, error) { 430 return &exchangetypes.QueryAccountAddressDerivativeOrdersResponse{}, nil 431 } 432 433 func (c *MockChainClient) FetchChainDerivativeOrdersByHashes(ctx context.Context, marketId, subaccountId string, orderHashes []string) (*exchangetypes.QueryDerivativeOrdersByHashesResponse, error) { 434 return &exchangetypes.QueryDerivativeOrdersByHashesResponse{}, nil 435 } 436 437 func (c *MockChainClient) FetchChainTraderDerivativeTransientOrders(ctx context.Context, marketId, subaccountId string) (*exchangetypes.QueryTraderDerivativeOrdersResponse, error) { 438 return &exchangetypes.QueryTraderDerivativeOrdersResponse{}, nil 439 } 440 441 func (c *MockChainClient) FetchChainDerivativeMarkets(ctx context.Context, status string, marketIDs []string, withMidPriceAndTob bool) (*exchangetypes.QueryDerivativeMarketsResponse, error) { 442 return &exchangetypes.QueryDerivativeMarketsResponse{}, nil 443 } 444 445 func (c *MockChainClient) FetchChainDerivativeMarket(ctx context.Context, marketId string) (*exchangetypes.QueryDerivativeMarketResponse, error) { 446 return &exchangetypes.QueryDerivativeMarketResponse{}, nil 447 } 448 449 func (c *MockChainClient) FetchDerivativeMarketAddress(ctx context.Context, marketId string) (*exchangetypes.QueryDerivativeMarketAddressResponse, error) { 450 return &exchangetypes.QueryDerivativeMarketAddressResponse{}, nil 451 } 452 453 func (c *MockChainClient) FetchSubaccountTradeNonce(ctx context.Context, subaccountId string) (*exchangetypes.QuerySubaccountTradeNonceResponse, error) { 454 return &exchangetypes.QuerySubaccountTradeNonceResponse{}, nil 455 } 456 457 func (c *MockChainClient) FetchChainPositions(ctx context.Context) (*exchangetypes.QueryPositionsResponse, error) { 458 return &exchangetypes.QueryPositionsResponse{}, nil 459 } 460 461 func (c *MockChainClient) FetchChainSubaccountPositions(ctx context.Context, subaccountId string) (*exchangetypes.QuerySubaccountPositionsResponse, error) { 462 return &exchangetypes.QuerySubaccountPositionsResponse{}, nil 463 } 464 465 func (c *MockChainClient) FetchChainSubaccountPositionInMarket(ctx context.Context, subaccountId, marketId string) (*exchangetypes.QuerySubaccountPositionInMarketResponse, error) { 466 return &exchangetypes.QuerySubaccountPositionInMarketResponse{}, nil 467 } 468 469 func (c *MockChainClient) FetchChainSubaccountEffectivePositionInMarket(ctx context.Context, subaccountId, marketId string) (*exchangetypes.QuerySubaccountEffectivePositionInMarketResponse, error) { 470 return &exchangetypes.QuerySubaccountEffectivePositionInMarketResponse{}, nil 471 } 472 473 func (c *MockChainClient) FetchChainPerpetualMarketInfo(ctx context.Context, marketId string) (*exchangetypes.QueryPerpetualMarketInfoResponse, error) { 474 return &exchangetypes.QueryPerpetualMarketInfoResponse{}, nil 475 } 476 477 func (c *MockChainClient) FetchChainExpiryFuturesMarketInfo(ctx context.Context, marketId string) (*exchangetypes.QueryExpiryFuturesMarketInfoResponse, error) { 478 return &exchangetypes.QueryExpiryFuturesMarketInfoResponse{}, nil 479 } 480 481 func (c *MockChainClient) FetchChainPerpetualMarketFunding(ctx context.Context, marketId string) (*exchangetypes.QueryPerpetualMarketFundingResponse, error) { 482 return &exchangetypes.QueryPerpetualMarketFundingResponse{}, nil 483 } 484 485 func (c *MockChainClient) FetchSubaccountOrderMetadata(ctx context.Context, subaccountId string) (*exchangetypes.QuerySubaccountOrderMetadataResponse, error) { 486 return &exchangetypes.QuerySubaccountOrderMetadataResponse{}, nil 487 } 488 489 func (c *MockChainClient) FetchTradeRewardPoints(ctx context.Context, accounts []string) (*exchangetypes.QueryTradeRewardPointsResponse, error) { 490 return &exchangetypes.QueryTradeRewardPointsResponse{}, nil 491 } 492 493 func (c *MockChainClient) FetchPendingTradeRewardPoints(ctx context.Context, accounts []string) (*exchangetypes.QueryTradeRewardPointsResponse, error) { 494 return &exchangetypes.QueryTradeRewardPointsResponse{}, nil 495 } 496 497 func (c *MockChainClient) FetchTradeRewardCampaign(ctx context.Context) (*exchangetypes.QueryTradeRewardCampaignResponse, error) { 498 return &exchangetypes.QueryTradeRewardCampaignResponse{}, nil 499 } 500 501 func (c *MockChainClient) FetchFeeDiscountAccountInfo(ctx context.Context, account string) (*exchangetypes.QueryFeeDiscountAccountInfoResponse, error) { 502 return &exchangetypes.QueryFeeDiscountAccountInfoResponse{}, nil 503 } 504 505 func (c *MockChainClient) FetchFeeDiscountSchedule(ctx context.Context) (*exchangetypes.QueryFeeDiscountScheduleResponse, error) { 506 return &exchangetypes.QueryFeeDiscountScheduleResponse{}, nil 507 } 508 509 func (c *MockChainClient) FetchBalanceMismatches(ctx context.Context, dustFactor int64) (*exchangetypes.QueryBalanceMismatchesResponse, error) { 510 return &exchangetypes.QueryBalanceMismatchesResponse{}, nil 511 } 512 513 func (c *MockChainClient) FetchBalanceWithBalanceHolds(ctx context.Context) (*exchangetypes.QueryBalanceWithBalanceHoldsResponse, error) { 514 return &exchangetypes.QueryBalanceWithBalanceHoldsResponse{}, nil 515 } 516 517 func (c *MockChainClient) FetchFeeDiscountTierStatistics(ctx context.Context) (*exchangetypes.QueryFeeDiscountTierStatisticsResponse, error) { 518 return &exchangetypes.QueryFeeDiscountTierStatisticsResponse{}, nil 519 } 520 521 func (c *MockChainClient) FetchMitoVaultInfos(ctx context.Context) (*exchangetypes.MitoVaultInfosResponse, error) { 522 return &exchangetypes.MitoVaultInfosResponse{}, nil 523 } 524 525 func (c *MockChainClient) FetchMarketIDFromVault(ctx context.Context, vaultAddress string) (*exchangetypes.QueryMarketIDFromVaultResponse, error) { 526 return &exchangetypes.QueryMarketIDFromVaultResponse{}, nil 527 } 528 529 func (c *MockChainClient) FetchHistoricalTradeRecords(ctx context.Context, marketId string) (*exchangetypes.QueryHistoricalTradeRecordsResponse, error) { 530 return &exchangetypes.QueryHistoricalTradeRecordsResponse{}, nil 531 } 532 533 func (c *MockChainClient) FetchIsOptedOutOfRewards(ctx context.Context, account string) (*exchangetypes.QueryIsOptedOutOfRewardsResponse, error) { 534 return &exchangetypes.QueryIsOptedOutOfRewardsResponse{}, nil 535 } 536 537 func (c *MockChainClient) FetchOptedOutOfRewardsAccounts(ctx context.Context) (*exchangetypes.QueryOptedOutOfRewardsAccountsResponse, error) { 538 return &exchangetypes.QueryOptedOutOfRewardsAccountsResponse{}, nil 539 } 540 541 func (c *MockChainClient) FetchMarketVolatility(ctx context.Context, marketId string, tradeHistoryOptions *exchangetypes.TradeHistoryOptions) (*exchangetypes.QueryMarketVolatilityResponse, error) { 542 return &exchangetypes.QueryMarketVolatilityResponse{}, nil 543 } 544 545 func (c *MockChainClient) FetchChainBinaryOptionsMarkets(ctx context.Context, status string) (*exchangetypes.QueryBinaryMarketsResponse, error) { 546 return &exchangetypes.QueryBinaryMarketsResponse{}, nil 547 } 548 549 func (c *MockChainClient) FetchTraderDerivativeConditionalOrders(ctx context.Context, subaccountId, marketId string) (*exchangetypes.QueryTraderDerivativeConditionalOrdersResponse, error) { 550 return &exchangetypes.QueryTraderDerivativeConditionalOrdersResponse{}, nil 551 } 552 553 func (c *MockChainClient) FetchMarketAtomicExecutionFeeMultiplier(ctx context.Context, marketId string) (*exchangetypes.QueryMarketAtomicExecutionFeeMultiplierResponse, error) { 554 return &exchangetypes.QueryMarketAtomicExecutionFeeMultiplierResponse{}, nil 555 } 556 557 // Tendermint module 558 559 func (c *MockChainClient) FetchNodeInfo(ctx context.Context) (*cmtservice.GetNodeInfoResponse, error) { 560 return &cmtservice.GetNodeInfoResponse{}, nil 561 } 562 563 func (c *MockChainClient) FetchSyncing(ctx context.Context) (*cmtservice.GetSyncingResponse, error) { 564 return &cmtservice.GetSyncingResponse{}, nil 565 } 566 567 func (c *MockChainClient) FetchLatestBlock(ctx context.Context) (*cmtservice.GetLatestBlockResponse, error) { 568 return &cmtservice.GetLatestBlockResponse{}, nil 569 } 570 571 func (c *MockChainClient) FetchBlockByHeight(ctx context.Context, height int64) (*cmtservice.GetBlockByHeightResponse, error) { 572 return &cmtservice.GetBlockByHeightResponse{}, nil 573 } 574 575 func (c *MockChainClient) FetchLatestValidatorSet(ctx context.Context) (*cmtservice.GetLatestValidatorSetResponse, error) { 576 return &cmtservice.GetLatestValidatorSetResponse{}, nil 577 } 578 579 func (c *MockChainClient) FetchValidatorSetByHeight(ctx context.Context, height int64, pagination *query.PageRequest) (*cmtservice.GetValidatorSetByHeightResponse, error) { 580 return &cmtservice.GetValidatorSetByHeightResponse{}, nil 581 } 582 583 func (c *MockChainClient) ABCIQuery(ctx context.Context, path string, data []byte, height int64, prove bool) (*cmtservice.ABCIQueryResponse, error) { 584 return &cmtservice.ABCIQueryResponse{}, nil 585 } 586 587 // IBC Transfer module 588 func (c *MockChainClient) FetchDenomTrace(ctx context.Context, hash string) (*ibctransfertypes.QueryDenomTraceResponse, error) { 589 return &ibctransfertypes.QueryDenomTraceResponse{}, nil 590 } 591 592 func (c *MockChainClient) FetchDenomTraces(ctx context.Context, pagination *query.PageRequest) (*ibctransfertypes.QueryDenomTracesResponse, error) { 593 return &ibctransfertypes.QueryDenomTracesResponse{}, nil 594 } 595 596 func (c *MockChainClient) FetchDenomHash(ctx context.Context, trace string) (*ibctransfertypes.QueryDenomHashResponse, error) { 597 return &ibctransfertypes.QueryDenomHashResponse{}, nil 598 } 599 600 func (c *MockChainClient) FetchEscrowAddress(ctx context.Context, portId, channelId string) (*ibctransfertypes.QueryEscrowAddressResponse, error) { 601 return &ibctransfertypes.QueryEscrowAddressResponse{}, nil 602 } 603 604 func (c *MockChainClient) FetchTotalEscrowForDenom(ctx context.Context, denom string) (*ibctransfertypes.QueryTotalEscrowForDenomResponse, error) { 605 return &ibctransfertypes.QueryTotalEscrowForDenomResponse{}, nil 606 } 607 608 // IBC Core Channel module 609 func (c *MockChainClient) FetchIBCChannel(ctx context.Context, portId, channelId string) (*ibcchanneltypes.QueryChannelResponse, error) { 610 return &ibcchanneltypes.QueryChannelResponse{}, nil 611 } 612 613 func (c *MockChainClient) FetchIBCChannels(ctx context.Context, pagination *query.PageRequest) (*ibcchanneltypes.QueryChannelsResponse, error) { 614 return &ibcchanneltypes.QueryChannelsResponse{}, nil 615 } 616 617 func (c *MockChainClient) FetchIBCConnectionChannels(ctx context.Context, connection string, pagination *query.PageRequest) (*ibcchanneltypes.QueryConnectionChannelsResponse, error) { 618 return &ibcchanneltypes.QueryConnectionChannelsResponse{}, nil 619 } 620 621 func (c *MockChainClient) FetchIBCChannelClientState(ctx context.Context, portId, channelId string) (*ibcchanneltypes.QueryChannelClientStateResponse, error) { 622 return &ibcchanneltypes.QueryChannelClientStateResponse{}, nil 623 } 624 625 func (c *MockChainClient) FetchIBCChannelConsensusState(ctx context.Context, portId, channelId string, revisionNumber, revisionHeight uint64) (*ibcchanneltypes.QueryChannelConsensusStateResponse, error) { 626 return &ibcchanneltypes.QueryChannelConsensusStateResponse{}, nil 627 } 628 629 func (c *MockChainClient) FetchIBCPacketCommitment(ctx context.Context, portId, channelId string, sequence uint64) (*ibcchanneltypes.QueryPacketCommitmentResponse, error) { 630 return &ibcchanneltypes.QueryPacketCommitmentResponse{}, nil 631 } 632 633 func (c *MockChainClient) FetchIBCPacketCommitments(ctx context.Context, portId, channelId string, pagination *query.PageRequest) (*ibcchanneltypes.QueryPacketCommitmentsResponse, error) { 634 return &ibcchanneltypes.QueryPacketCommitmentsResponse{}, nil 635 } 636 637 func (c *MockChainClient) FetchIBCPacketReceipt(ctx context.Context, portId, channelId string, sequence uint64) (*ibcchanneltypes.QueryPacketReceiptResponse, error) { 638 return &ibcchanneltypes.QueryPacketReceiptResponse{}, nil 639 } 640 641 func (c *MockChainClient) FetchIBCPacketAcknowledgement(ctx context.Context, portId, channelId string, sequence uint64) (*ibcchanneltypes.QueryPacketAcknowledgementResponse, error) { 642 return &ibcchanneltypes.QueryPacketAcknowledgementResponse{}, nil 643 } 644 645 func (c *MockChainClient) FetchIBCPacketAcknowledgements(ctx context.Context, portId, channelId string, packetCommitmentSequences []uint64, pagination *query.PageRequest) (*ibcchanneltypes.QueryPacketAcknowledgementsResponse, error) { 646 return &ibcchanneltypes.QueryPacketAcknowledgementsResponse{}, nil 647 } 648 649 func (c *MockChainClient) FetchIBCUnreceivedPackets(ctx context.Context, portId, channelId string, packetCommitmentSequences []uint64) (*ibcchanneltypes.QueryUnreceivedPacketsResponse, error) { 650 return &ibcchanneltypes.QueryUnreceivedPacketsResponse{}, nil 651 } 652 653 func (c *MockChainClient) FetchIBCUnreceivedAcks(ctx context.Context, portId, channelId string, packetAckSequences []uint64) (*ibcchanneltypes.QueryUnreceivedAcksResponse, error) { 654 return &ibcchanneltypes.QueryUnreceivedAcksResponse{}, nil 655 } 656 657 func (c *MockChainClient) FetchIBCNextSequenceReceive(ctx context.Context, portId, channelId string) (*ibcchanneltypes.QueryNextSequenceReceiveResponse, error) { 658 return &ibcchanneltypes.QueryNextSequenceReceiveResponse{}, nil 659 } 660 661 // IBC Core Chain module 662 func (c *MockChainClient) FetchIBCClientState(ctx context.Context, clientId string) (*ibcclienttypes.QueryClientStateResponse, error) { 663 return &ibcclienttypes.QueryClientStateResponse{}, nil 664 } 665 666 func (c *MockChainClient) FetchIBCClientStates(ctx context.Context, pagination *query.PageRequest) (*ibcclienttypes.QueryClientStatesResponse, error) { 667 return &ibcclienttypes.QueryClientStatesResponse{}, nil 668 } 669 670 func (c *MockChainClient) FetchIBCConsensusState(ctx context.Context, clientId string, revisionNumber, revisionHeight uint64, latestHeight bool) (*ibcclienttypes.QueryConsensusStateResponse, error) { 671 return &ibcclienttypes.QueryConsensusStateResponse{}, nil 672 } 673 674 func (c *MockChainClient) FetchIBCConsensusStates(ctx context.Context, clientId string, pagination *query.PageRequest) (*ibcclienttypes.QueryConsensusStatesResponse, error) { 675 return &ibcclienttypes.QueryConsensusStatesResponse{}, nil 676 } 677 678 func (c *MockChainClient) FetchIBCConsensusStateHeights(ctx context.Context, clientId string, pagination *query.PageRequest) (*ibcclienttypes.QueryConsensusStateHeightsResponse, error) { 679 return &ibcclienttypes.QueryConsensusStateHeightsResponse{}, nil 680 } 681 682 func (c *MockChainClient) FetchIBCClientStatus(ctx context.Context, clientId string) (*ibcclienttypes.QueryClientStatusResponse, error) { 683 return &ibcclienttypes.QueryClientStatusResponse{}, nil 684 } 685 686 func (c *MockChainClient) FetchIBCClientParams(ctx context.Context) (*ibcclienttypes.QueryClientParamsResponse, error) { 687 return &ibcclienttypes.QueryClientParamsResponse{}, nil 688 } 689 690 func (c *MockChainClient) FetchIBCUpgradedClientState(ctx context.Context) (*ibcclienttypes.QueryUpgradedClientStateResponse, error) { 691 return &ibcclienttypes.QueryUpgradedClientStateResponse{}, nil 692 } 693 694 func (c *MockChainClient) FetchIBCUpgradedConsensusState(ctx context.Context) (*ibcclienttypes.QueryUpgradedConsensusStateResponse, error) { 695 return &ibcclienttypes.QueryUpgradedConsensusStateResponse{}, nil 696 } 697 698 // IBC Core Connection module 699 func (c *MockChainClient) FetchIBCConnection(ctx context.Context, connectionId string) (*ibcconnectiontypes.QueryConnectionResponse, error) { 700 return &ibcconnectiontypes.QueryConnectionResponse{}, nil 701 } 702 703 func (c *MockChainClient) FetchIBCConnections(ctx context.Context, pagination *query.PageRequest) (*ibcconnectiontypes.QueryConnectionsResponse, error) { 704 return &ibcconnectiontypes.QueryConnectionsResponse{}, nil 705 } 706 707 func (c *MockChainClient) FetchIBCClientConnections(ctx context.Context, clientId string) (*ibcconnectiontypes.QueryClientConnectionsResponse, error) { 708 return &ibcconnectiontypes.QueryClientConnectionsResponse{}, nil 709 } 710 711 func (c *MockChainClient) FetchIBCConnectionClientState(ctx context.Context, connectionId string) (*ibcconnectiontypes.QueryConnectionClientStateResponse, error) { 712 return &ibcconnectiontypes.QueryConnectionClientStateResponse{}, nil 713 } 714 715 func (c *MockChainClient) FetchIBCConnectionConsensusState(ctx context.Context, connectionId string, revisionNumber, revisionHeight uint64) (*ibcconnectiontypes.QueryConnectionConsensusStateResponse, error) { 716 return &ibcconnectiontypes.QueryConnectionConsensusStateResponse{}, nil 717 } 718 719 func (c *MockChainClient) FetchIBCConnectionParams(ctx context.Context) (*ibcconnectiontypes.QueryConnectionParamsResponse, error) { 720 return &ibcconnectiontypes.QueryConnectionParamsResponse{}, nil 721 } 722 723 // Permissions module 724 725 func (c *MockChainClient) FetchAllNamespaces(ctx context.Context) (*permissionstypes.QueryAllNamespacesResponse, error) { 726 return &permissionstypes.QueryAllNamespacesResponse{}, nil 727 } 728 729 func (c *MockChainClient) FetchNamespaceByDenom(ctx context.Context, denom string, includeRoles bool) (*permissionstypes.QueryNamespaceByDenomResponse, error) { 730 return &permissionstypes.QueryNamespaceByDenomResponse{}, nil 731 } 732 733 func (c *MockChainClient) FetchAddressRoles(ctx context.Context, denom, address string) (*permissionstypes.QueryAddressRolesResponse, error) { 734 return &permissionstypes.QueryAddressRolesResponse{}, nil 735 } 736 737 func (c *MockChainClient) FetchAddressesByRole(ctx context.Context, denom, role string) (*permissionstypes.QueryAddressesByRoleResponse, error) { 738 return &permissionstypes.QueryAddressesByRoleResponse{}, nil 739 } 740 741 func (c *MockChainClient) FetchVouchersForAddress(ctx context.Context, address string) (*permissionstypes.QueryVouchersForAddressResponse, error) { 742 return &permissionstypes.QueryVouchersForAddressResponse{}, nil 743 }