From cad5bf57fef66915a11d43dc14f69f35d881f7a5 Mon Sep 17 00:00:00 2001 From: Abel Armoa <30988000+aarmoa@users.noreply.github.com> Date: Wed, 28 May 2025 16:42:39 -0300 Subject: [PATCH 1/3] cp-396: Added support and examples for ERC20 and EVM modules' queries and messages --- CHANGELOG.md | 4 + Makefile | 2 +- buf.gen.yaml | 4 +- .../chain_client/erc20/1_CreateTokenPair.py | 64 ++++ .../chain_client/erc20/2_DeleteTokenPair.py | 62 ++++ .../erc20/query/1_AllTokenPairs.py | 33 ++ .../erc20/query/2_TokenPairByDenom.py | 33 ++ .../erc20/query/3_TokenPairByERC20Address.py | 34 ++ examples/chain_client/evm/query/1_Account.py | 34 ++ .../chain_client/evm/query/2_CosmosAccount.py | 34 ++ .../evm/query/3_ValidatorAccount.py | 34 ++ examples/chain_client/evm/query/4_Balance.py | 34 ++ examples/chain_client/evm/query/5_Storage.py | 35 +++ examples/chain_client/evm/query/6_Code.py | 34 ++ examples/chain_client/evm/query/7_BaseFee.py | 33 ++ .../exchange/28_MsgCreateGTBSpotLimitOrder.py | 2 +- .../29_MsgCreateGTBDerivativeLimitOrder.py | 2 +- pyinjective/async_client.py | 48 +++ .../client/chain/grpc/chain_grpc_erc20_api.py | 40 +++ .../client/chain/grpc/chain_grpc_evm_api.py | 64 ++++ pyinjective/composer.py | 22 ++ .../injective_derivative_exchange_rpc_pb2.py | 296 +++++++++--------- pyproject.toml | 2 +- .../grpc/configurable_erc20_query_servicer.py | 26 ++ .../grpc/configurable_evm_query_servicer.py | 40 +++ .../chain/grpc/test_chain_grpc_erc20_api.py | 116 +++++++ .../chain/grpc/test_chain_grpc_evm_api.py | 250 +++++++++++++++ .../grpc/test_indexer_grpc_derivative_api.py | 8 + .../test_indexer_grpc_derivative_stream.py | 4 + tests/test_composer.py | 38 +++ 30 files changed, 1278 insertions(+), 154 deletions(-) create mode 100644 examples/chain_client/erc20/1_CreateTokenPair.py create mode 100644 examples/chain_client/erc20/2_DeleteTokenPair.py create mode 100644 examples/chain_client/erc20/query/1_AllTokenPairs.py create mode 100644 examples/chain_client/erc20/query/2_TokenPairByDenom.py create mode 100644 examples/chain_client/erc20/query/3_TokenPairByERC20Address.py create mode 100644 examples/chain_client/evm/query/1_Account.py create mode 100644 examples/chain_client/evm/query/2_CosmosAccount.py create mode 100644 examples/chain_client/evm/query/3_ValidatorAccount.py create mode 100644 examples/chain_client/evm/query/4_Balance.py create mode 100644 examples/chain_client/evm/query/5_Storage.py create mode 100644 examples/chain_client/evm/query/6_Code.py create mode 100644 examples/chain_client/evm/query/7_BaseFee.py create mode 100644 pyinjective/client/chain/grpc/chain_grpc_erc20_api.py create mode 100644 pyinjective/client/chain/grpc/chain_grpc_evm_api.py create mode 100644 tests/client/chain/grpc/configurable_erc20_query_servicer.py create mode 100644 tests/client/chain/grpc/configurable_evm_query_servicer.py create mode 100644 tests/client/chain/grpc/test_chain_grpc_erc20_api.py create mode 100644 tests/client/chain/grpc/test_chain_grpc_evm_api.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 76827022..bc5d1cad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file. ## [Unreleased] - 9999-99-99 ### Added - Added support for Exchange V2 proto queries and types +- Added support for ERC20 proto queries and types +- Added support for EVM proto queries and types - Updated all chain exchange module examples to use the new Exchange V2 proto queries and types +- Added examples for ERC20 queries and messages +- Added examples for EVM queries ### Removed - Removed all methods marked as deprecated in AsyncClient and Composer diff --git a/Makefile b/Makefile index 0d132f07..e9662922 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ clean-all: $(call clean_repos) clone-injective-indexer: - git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.16.0-rc2 --depth 1 --single-branch + git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.16.3 --depth 1 --single-branch clone-all: clone-injective-indexer diff --git a/buf.gen.yaml b/buf.gen.yaml index 9cac4537..23479b6c 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -16,9 +16,9 @@ inputs: - git_repo: https://github.com/InjectiveLabs/wasmd tag: v0.53.2-evm-comet1-inj - git_repo: https://github.com/InjectiveLabs/cometbft - tag: v1.0.1-inj + tag: v1.0.1-inj.2 - git_repo: https://github.com/InjectiveLabs/cosmos-sdk - tag: v0.50.13-evm-comet1-inj.2 + tag: v0.50.13-evm-comet1-inj.3 # - git_repo: https://github.com/InjectiveLabs/wasmd # branch: v0.51.x-inj # subdir: proto diff --git a/examples/chain_client/erc20/1_CreateTokenPair.py b/examples/chain_client/erc20/1_CreateTokenPair.py new file mode 100644 index 00000000..f08ca792 --- /dev/null +++ b/examples/chain_client/erc20/1_CreateTokenPair.py @@ -0,0 +1,64 @@ +import asyncio +import json +import os + +import dotenv + +from pyinjective.async_client import AsyncClient +from pyinjective.core.broadcaster import MsgBroadcasterWithPk +from pyinjective.core.network import Network +from pyinjective.wallet import PrivateKey + + +async def main() -> None: + dotenv.load_dotenv() + configured_private_key = os.getenv("INJECTIVE_PRIVATE_KEY") + + # select network: local, testnet, mainnet + network = Network.testnet() + + # initialize grpc client + client = AsyncClient(network) + composer = await client.composer() + + gas_price = await client.current_chain_gas_price() + # adjust gas price to make it valid even if it changes between the time it is requested and the TX is broadcasted + gas_price = int(gas_price * 1.1) + + message_broadcaster = MsgBroadcasterWithPk.new_using_gas_heuristics( + network=network, + private_key=configured_private_key, + gas_price=gas_price, + client=client, + composer=composer, + ) + + # load account + priv_key = PrivateKey.from_hex(configured_private_key) + pub_key = priv_key.to_public_key() + address = pub_key.to_address() + await client.fetch_account(address.to_acc_bech32()) + + usdt_denom = "factory/inj10vkkttgxdeqcgeppu20x9qtyvuaxxev8qh0awq/usdt" + usdt_erc20 = "0xdAC17F958D2ee523a2206206994597C13D831ec7" + + # prepare tx msg + msg = composer.msg_create_token_pair( + sender=address.to_acc_bech32(), + bank_denom=usdt_denom, + erc20_address=usdt_erc20, + ) + + # broadcast the transaction + result = await message_broadcaster.broadcast([msg]) + print("---Transaction Response---") + print(json.dumps(result, indent=2)) + + gas_price = await client.current_chain_gas_price() + # adjust gas price to make it valid even if it changes between the time it is requested and the TX is broadcasted + gas_price = int(gas_price * 1.1) + message_broadcaster.update_gas_price(gas_price=gas_price) + + +if __name__ == "__main__": + asyncio.get_event_loop().run_until_complete(main()) diff --git a/examples/chain_client/erc20/2_DeleteTokenPair.py b/examples/chain_client/erc20/2_DeleteTokenPair.py new file mode 100644 index 00000000..4cb508e4 --- /dev/null +++ b/examples/chain_client/erc20/2_DeleteTokenPair.py @@ -0,0 +1,62 @@ +import asyncio +import json +import os + +import dotenv + +from pyinjective.async_client import AsyncClient +from pyinjective.core.broadcaster import MsgBroadcasterWithPk +from pyinjective.core.network import Network +from pyinjective.wallet import PrivateKey + + +async def main() -> None: + dotenv.load_dotenv() + configured_private_key = os.getenv("INJECTIVE_PRIVATE_KEY") + + # select network: local, testnet, mainnet + network = Network.testnet() + + # initialize grpc client + client = AsyncClient(network) + composer = await client.composer() + + gas_price = await client.current_chain_gas_price() + # adjust gas price to make it valid even if it changes between the time it is requested and the TX is broadcasted + gas_price = int(gas_price * 1.1) + + message_broadcaster = MsgBroadcasterWithPk.new_using_gas_heuristics( + network=network, + private_key=configured_private_key, + gas_price=gas_price, + client=client, + composer=composer, + ) + + # load account + priv_key = PrivateKey.from_hex(configured_private_key) + pub_key = priv_key.to_public_key() + address = pub_key.to_address() + await client.fetch_account(address.to_acc_bech32()) + + usdt_denom = "factory/inj10vkkttgxdeqcgeppu20x9qtyvuaxxev8qh0awq/usdt" + + # prepare tx msg + msg = composer.msg_delete_token_pair( + sender=address.to_acc_bech32(), + bank_denom=usdt_denom, + ) + + # broadcast the transaction + result = await message_broadcaster.broadcast([msg]) + print("---Transaction Response---") + print(json.dumps(result, indent=2)) + + gas_price = await client.current_chain_gas_price() + # adjust gas price to make it valid even if it changes between the time it is requested and the TX is broadcasted + gas_price = int(gas_price * 1.1) + message_broadcaster.update_gas_price(gas_price=gas_price) + + +if __name__ == "__main__": + asyncio.get_event_loop().run_until_complete(main()) diff --git a/examples/chain_client/erc20/query/1_AllTokenPairs.py b/examples/chain_client/erc20/query/1_AllTokenPairs.py new file mode 100644 index 00000000..07c7a359 --- /dev/null +++ b/examples/chain_client/erc20/query/1_AllTokenPairs.py @@ -0,0 +1,33 @@ +import asyncio +import json +import os + +import dotenv + +from pyinjective import PrivateKey +from pyinjective.async_client import AsyncClient +from pyinjective.core.network import Network + + +async def main() -> None: + dotenv.load_dotenv() + configured_private_key = os.getenv("INJECTIVE_PRIVATE_KEY") + + # select network: local, testnet, mainnet + network = Network.testnet() + + # initialize grpc client + client = AsyncClient(network) + + # load account + priv_key = PrivateKey.from_hex(configured_private_key) + pub_key = priv_key.to_public_key() + address = pub_key.to_address() + await client.fetch_account(address.to_acc_bech32()) + + pairs = await client.fetch_erc20_all_token_pairs() + print(json.dumps(pairs, indent=2)) + + +if __name__ == "__main__": + asyncio.get_event_loop().run_until_complete(main()) diff --git a/examples/chain_client/erc20/query/2_TokenPairByDenom.py b/examples/chain_client/erc20/query/2_TokenPairByDenom.py new file mode 100644 index 00000000..cc748c51 --- /dev/null +++ b/examples/chain_client/erc20/query/2_TokenPairByDenom.py @@ -0,0 +1,33 @@ +import asyncio +import json +import os + +import dotenv + +from pyinjective import PrivateKey +from pyinjective.async_client import AsyncClient +from pyinjective.core.network import Network + + +async def main() -> None: + dotenv.load_dotenv() + configured_private_key = os.getenv("INJECTIVE_PRIVATE_KEY") + + # select network: local, testnet, mainnet + network = Network.testnet() + + # initialize grpc client + client = AsyncClient(network) + + # load account + priv_key = PrivateKey.from_hex(configured_private_key) + pub_key = priv_key.to_public_key() + address = pub_key.to_address() + await client.fetch_account(address.to_acc_bech32()) + + result = await client.fetch_erc20_token_pair_by_denom(bank_denom="usdt") + print(json.dumps(result, indent=2)) + + +if __name__ == "__main__": + asyncio.get_event_loop().run_until_complete(main()) diff --git a/examples/chain_client/erc20/query/3_TokenPairByERC20Address.py b/examples/chain_client/erc20/query/3_TokenPairByERC20Address.py new file mode 100644 index 00000000..15f40394 --- /dev/null +++ b/examples/chain_client/erc20/query/3_TokenPairByERC20Address.py @@ -0,0 +1,34 @@ +import asyncio +import json +import os + +import dotenv + +from pyinjective import PrivateKey +from pyinjective.async_client import AsyncClient +from pyinjective.core.network import Network + + +async def main() -> None: + dotenv.load_dotenv() + configured_private_key = os.getenv("INJECTIVE_PRIVATE_KEY") + + # select network: local, testnet, mainnet + network = Network.testnet() + + # initialize grpc client + client = AsyncClient(network) + + # load account + priv_key = PrivateKey.from_hex(configured_private_key) + pub_key = priv_key.to_public_key() + address = pub_key.to_address() + await client.fetch_account(address.to_acc_bech32()) + + erc20_address = "0xdAC17F958D2ee523a2206206994597C13D831ec7" + result = await client.fetch_erc20_token_pair_by_erc20_address(erc20_address=erc20_address) + print(json.dumps(result, indent=2)) + + +if __name__ == "__main__": + asyncio.get_event_loop().run_until_complete(main()) diff --git a/examples/chain_client/evm/query/1_Account.py b/examples/chain_client/evm/query/1_Account.py new file mode 100644 index 00000000..1932b003 --- /dev/null +++ b/examples/chain_client/evm/query/1_Account.py @@ -0,0 +1,34 @@ +import asyncio +import json +import os + +import dotenv + +from pyinjective import PrivateKey +from pyinjective.async_client import AsyncClient +from pyinjective.core.network import Network + + +async def main() -> None: + dotenv.load_dotenv() + configured_private_key = os.getenv("INJECTIVE_PRIVATE_KEY") + + # select network: local, testnet, mainnet + network = Network.testnet() + + # initialize grpc client + client = AsyncClient(network) + + # load account + priv_key = PrivateKey.from_hex(configured_private_key) + pub_key = priv_key.to_public_key() + address = pub_key.to_address() + await client.fetch_account(address.to_acc_bech32()) + + erc20_address = "0xDFd5293D8e347dFe59E90eFd55b2956a1343963d" + result = await client.fetch_evm_account(address=erc20_address) + print(json.dumps(result, indent=2)) + + +if __name__ == "__main__": + asyncio.get_event_loop().run_until_complete(main()) diff --git a/examples/chain_client/evm/query/2_CosmosAccount.py b/examples/chain_client/evm/query/2_CosmosAccount.py new file mode 100644 index 00000000..767dce73 --- /dev/null +++ b/examples/chain_client/evm/query/2_CosmosAccount.py @@ -0,0 +1,34 @@ +import asyncio +import json +import os + +import dotenv + +from pyinjective import PrivateKey +from pyinjective.async_client import AsyncClient +from pyinjective.core.network import Network + + +async def main() -> None: + dotenv.load_dotenv() + configured_private_key = os.getenv("INJECTIVE_PRIVATE_KEY") + + # select network: local, testnet, mainnet + network = Network.testnet() + + # initialize grpc client + client = AsyncClient(network) + + # load account + priv_key = PrivateKey.from_hex(configured_private_key) + pub_key = priv_key.to_public_key() + address = pub_key.to_address() + await client.fetch_account(address.to_acc_bech32()) + + erc20_address = "0xDFd5293D8e347dFe59E90eFd55b2956a1343963d" + result = await client.fetch_evm_cosmos_account(address=erc20_address) + print(json.dumps(result, indent=2)) + + +if __name__ == "__main__": + asyncio.get_event_loop().run_until_complete(main()) diff --git a/examples/chain_client/evm/query/3_ValidatorAccount.py b/examples/chain_client/evm/query/3_ValidatorAccount.py new file mode 100644 index 00000000..f89f2c20 --- /dev/null +++ b/examples/chain_client/evm/query/3_ValidatorAccount.py @@ -0,0 +1,34 @@ +import asyncio +import json +import os + +import dotenv + +from pyinjective import PrivateKey +from pyinjective.async_client import AsyncClient +from pyinjective.core.network import Network + + +async def main() -> None: + dotenv.load_dotenv() + configured_private_key = os.getenv("INJECTIVE_PRIVATE_KEY") + + # select network: local, testnet, mainnet + network = Network.testnet() + + # initialize grpc client + client = AsyncClient(network) + + # load account + priv_key = PrivateKey.from_hex(configured_private_key) + pub_key = priv_key.to_public_key() + address = pub_key.to_address() + await client.fetch_account(address.to_acc_bech32()) + + cons_address = "injvalcons1h5u937etuat5hnr2s34yaaalfpkkscl5ndadqm" + result = await client.fetch_evm_validator_account(cons_address=cons_address) + print(json.dumps(result, indent=2)) + + +if __name__ == "__main__": + asyncio.get_event_loop().run_until_complete(main()) diff --git a/examples/chain_client/evm/query/4_Balance.py b/examples/chain_client/evm/query/4_Balance.py new file mode 100644 index 00000000..f26131e2 --- /dev/null +++ b/examples/chain_client/evm/query/4_Balance.py @@ -0,0 +1,34 @@ +import asyncio +import json +import os + +import dotenv + +from pyinjective import PrivateKey +from pyinjective.async_client import AsyncClient +from pyinjective.core.network import Network + + +async def main() -> None: + dotenv.load_dotenv() + configured_private_key = os.getenv("INJECTIVE_PRIVATE_KEY") + + # select network: local, testnet, mainnet + network = Network.testnet() + + # initialize grpc client + client = AsyncClient(network) + + # load account + priv_key = PrivateKey.from_hex(configured_private_key) + pub_key = priv_key.to_public_key() + address = pub_key.to_address() + await client.fetch_account(address.to_acc_bech32()) + + erc20_address = "0xDFd5293D8e347dFe59E90eFd55b2956a1343963d" + result = await client.fetch_evm_balance(address=erc20_address) + print(json.dumps(result, indent=2)) + + +if __name__ == "__main__": + asyncio.get_event_loop().run_until_complete(main()) diff --git a/examples/chain_client/evm/query/5_Storage.py b/examples/chain_client/evm/query/5_Storage.py new file mode 100644 index 00000000..b4d54e4d --- /dev/null +++ b/examples/chain_client/evm/query/5_Storage.py @@ -0,0 +1,35 @@ +import asyncio +import json +import os + +import dotenv + +from pyinjective import PrivateKey +from pyinjective.async_client import AsyncClient +from pyinjective.core.network import Network + + +async def main() -> None: + dotenv.load_dotenv() + configured_private_key = os.getenv("INJECTIVE_PRIVATE_KEY") + + # select network: local, testnet, mainnet + network = Network.testnet() + + # initialize grpc client + client = AsyncClient(network) + + # load account + priv_key = PrivateKey.from_hex(configured_private_key) + pub_key = priv_key.to_public_key() + address = pub_key.to_address() + await client.fetch_account(address.to_acc_bech32()) + + erc20_address = "0xDFd5293D8e347dFe59E90eFd55b2956a1343963d" + key = "key" + result = await client.fetch_evm_storage(address=erc20_address, key=key) + print(json.dumps(result, indent=2)) + + +if __name__ == "__main__": + asyncio.get_event_loop().run_until_complete(main()) diff --git a/examples/chain_client/evm/query/6_Code.py b/examples/chain_client/evm/query/6_Code.py new file mode 100644 index 00000000..5b79d873 --- /dev/null +++ b/examples/chain_client/evm/query/6_Code.py @@ -0,0 +1,34 @@ +import asyncio +import json +import os + +import dotenv + +from pyinjective import PrivateKey +from pyinjective.async_client import AsyncClient +from pyinjective.core.network import Network + + +async def main() -> None: + dotenv.load_dotenv() + configured_private_key = os.getenv("INJECTIVE_PRIVATE_KEY") + + # select network: local, testnet, mainnet + network = Network.testnet() + + # initialize grpc client + client = AsyncClient(network) + + # load account + priv_key = PrivateKey.from_hex(configured_private_key) + pub_key = priv_key.to_public_key() + address = pub_key.to_address() + await client.fetch_account(address.to_acc_bech32()) + + evm_address = "0xDFd5293D8e347dFe59E90eFd55b2956a1343963d" + result = await client.fetch_evm_code(address=evm_address) + print(json.dumps(result, indent=2)) + + +if __name__ == "__main__": + asyncio.get_event_loop().run_until_complete(main()) diff --git a/examples/chain_client/evm/query/7_BaseFee.py b/examples/chain_client/evm/query/7_BaseFee.py new file mode 100644 index 00000000..339251c9 --- /dev/null +++ b/examples/chain_client/evm/query/7_BaseFee.py @@ -0,0 +1,33 @@ +import asyncio +import json +import os + +import dotenv + +from pyinjective import PrivateKey +from pyinjective.async_client import AsyncClient +from pyinjective.core.network import Network + + +async def main() -> None: + dotenv.load_dotenv() + configured_private_key = os.getenv("INJECTIVE_PRIVATE_KEY") + + # select network: local, testnet, mainnet + network = Network.testnet() + + # initialize grpc client + client = AsyncClient(network) + + # load account + priv_key = PrivateKey.from_hex(configured_private_key) + pub_key = priv_key.to_public_key() + address = pub_key.to_address() + await client.fetch_account(address.to_acc_bech32()) + + result = await client.fetch_evm_base_fee() + print(json.dumps(result, indent=2)) + + +if __name__ == "__main__": + asyncio.get_event_loop().run_until_complete(main()) diff --git a/examples/chain_client/exchange/28_MsgCreateGTBSpotLimitOrder.py b/examples/chain_client/exchange/28_MsgCreateGTBSpotLimitOrder.py index a35a10d9..bfb6507b 100644 --- a/examples/chain_client/exchange/28_MsgCreateGTBSpotLimitOrder.py +++ b/examples/chain_client/exchange/28_MsgCreateGTBSpotLimitOrder.py @@ -27,7 +27,7 @@ async def main() -> None: # adjust gas price to make it valid even if it changes between the time it is requested and the TX is broadcasted gas_price = int(gas_price * 1.1) - message_broadcaster = MsgBroadcasterWithPk.new_using_simulation( + message_broadcaster = MsgBroadcasterWithPk.new_using_gas_heuristics( network=network, private_key=configured_private_key, gas_price=gas_price, diff --git a/examples/chain_client/exchange/29_MsgCreateGTBDerivativeLimitOrder.py b/examples/chain_client/exchange/29_MsgCreateGTBDerivativeLimitOrder.py index 05e54ecb..03b14924 100644 --- a/examples/chain_client/exchange/29_MsgCreateGTBDerivativeLimitOrder.py +++ b/examples/chain_client/exchange/29_MsgCreateGTBDerivativeLimitOrder.py @@ -27,7 +27,7 @@ async def main() -> None: # adjust gas price to make it valid even if it changes between the time it is requested and the TX is broadcasted gas_price = int(gas_price * 1.1) - message_broadcaster = MsgBroadcasterWithPk.new_using_simulation( + message_broadcaster = MsgBroadcasterWithPk.new_using_gas_heuristics( network=network, private_key=configured_private_key, gas_price=gas_price, diff --git a/pyinjective/async_client.py b/pyinjective/async_client.py index 566bd069..b9136886 100644 --- a/pyinjective/async_client.py +++ b/pyinjective/async_client.py @@ -10,6 +10,8 @@ from pyinjective.client.chain.grpc.chain_grpc_authz_api import ChainGrpcAuthZApi from pyinjective.client.chain.grpc.chain_grpc_bank_api import ChainGrpcBankApi from pyinjective.client.chain.grpc.chain_grpc_distribution_api import ChainGrpcDistributionApi +from pyinjective.client.chain.grpc.chain_grpc_erc20_api import ChainGrpcERC20Api +from pyinjective.client.chain.grpc.chain_grpc_evm_api import ChainGrpcEVMApi from pyinjective.client.chain.grpc.chain_grpc_exchange_api import ChainGrpcExchangeApi from pyinjective.client.chain.grpc.chain_grpc_exchange_v2_api import ChainGrpcExchangeV2Api from pyinjective.client.chain.grpc.chain_grpc_permissions_api import ChainGrpcPermissionsApi @@ -124,6 +126,14 @@ def __init__( channel=self.chain_channel, cookie_assistant=network.chain_cookie_assistant, ) + self.chain_erc20_api = ChainGrpcERC20Api( + channel=self.chain_channel, + cookie_assistant=network.chain_cookie_assistant, + ) + self.chain_evm_api = ChainGrpcEVMApi( + channel=self.chain_channel, + cookie_assistant=network.chain_cookie_assistant, + ) self.chain_exchange_api = ChainGrpcExchangeApi( channel=self.chain_channel, cookie_assistant=network.chain_cookie_assistant, @@ -2994,6 +3004,44 @@ async def fetch_eip_base_fee(self) -> Dict[str, Any]: # endregion + # ------------------------- + # region Chain ERC20 module + async def fetch_erc20_all_token_pairs(self) -> Dict[str, Any]: + return await self.chain_erc20_api.fetch_all_token_pairs() + + async def fetch_erc20_token_pair_by_denom(self, bank_denom: str) -> Dict[str, Any]: + return await self.chain_erc20_api.fetch_token_pair_by_denom(bank_denom=bank_denom) + + async def fetch_erc20_token_pair_by_erc20_address(self, erc20_address: str) -> Dict[str, Any]: + return await self.chain_erc20_api.fetch_token_pair_by_erc20_address(erc20_address=erc20_address) + + # endregion + + # ------------------------- + # region Chain EVM module + async def fetch_evm_account(self, address: str) -> Dict[str, Any]: + return await self.chain_evm_api.fetch_account(address=address) + + async def fetch_evm_cosmos_account(self, address: str) -> Dict[str, Any]: + return await self.chain_evm_api.fetch_cosmos_account(address=address) + + async def fetch_evm_validator_account(self, cons_address: str) -> Dict[str, Any]: + return await self.chain_evm_api.fetch_validator_account(cons_address=cons_address) + + async def fetch_evm_balance(self, address: str) -> Dict[str, Any]: + return await self.chain_evm_api.fetch_balance(address=address) + + async def fetch_evm_storage(self, address: str, key: Optional[str] = None) -> Dict[str, Any]: + return await self.chain_evm_api.fetch_storage(address=address, key=key) + + async def fetch_evm_code(self, address: str) -> Dict[str, Any]: + return await self.chain_evm_api.fetch_code(address=address) + + async def fetch_evm_base_fee(self) -> Dict[str, Any]: + return await self.chain_evm_api.fetch_base_fee() + + # endregion + async def composer(self): return Composer( network=self.network.string(), diff --git a/pyinjective/client/chain/grpc/chain_grpc_erc20_api.py b/pyinjective/client/chain/grpc/chain_grpc_erc20_api.py new file mode 100644 index 00000000..f4254bab --- /dev/null +++ b/pyinjective/client/chain/grpc/chain_grpc_erc20_api.py @@ -0,0 +1,40 @@ +from typing import Any, Callable, Dict + +from grpc.aio import Channel + +from pyinjective.core.network import CookieAssistant +from pyinjective.proto.injective.erc20.v1beta1 import query_pb2 as erc20_query_pb, query_pb2_grpc as erc20_query_grpc +from pyinjective.utils.grpc_api_request_assistant import GrpcApiRequestAssistant + + +class ChainGrpcERC20Api: + def __init__(self, channel: Channel, cookie_assistant: CookieAssistant): + self._stub = erc20_query_grpc.QueryStub(channel) + self._assistant = GrpcApiRequestAssistant(cookie_assistant=cookie_assistant) + + async def fetch_erc20_params(self) -> Dict[str, Any]: + request = erc20_query_pb.QueryParamsRequest() + response = await self._execute_call(call=self._stub.Params, request=request) + + return response + + async def fetch_all_token_pairs(self) -> Dict[str, Any]: + request = erc20_query_pb.QueryAllTokenPairsRequest() + response = await self._execute_call(call=self._stub.AllTokenPairs, request=request) + + return response + + async def fetch_token_pair_by_denom(self, bank_denom: str) -> Dict[str, Any]: + request = erc20_query_pb.QueryTokenPairByDenomRequest(bank_denom=bank_denom) + response = await self._execute_call(call=self._stub.TokenPairByDenom, request=request) + + return response + + async def fetch_token_pair_by_erc20_address(self, erc20_address: str) -> Dict[str, Any]: + request = erc20_query_pb.QueryTokenPairByERC20AddressRequest(erc20_address=erc20_address) + response = await self._execute_call(call=self._stub.TokenPairByERC20Address, request=request) + + return response + + async def _execute_call(self, call: Callable, request) -> Dict[str, Any]: + return await self._assistant.execute_call(call=call, request=request) diff --git a/pyinjective/client/chain/grpc/chain_grpc_evm_api.py b/pyinjective/client/chain/grpc/chain_grpc_evm_api.py new file mode 100644 index 00000000..2eba4bc6 --- /dev/null +++ b/pyinjective/client/chain/grpc/chain_grpc_evm_api.py @@ -0,0 +1,64 @@ +from typing import Any, Callable, Dict, Optional + +from grpc.aio import Channel + +from pyinjective.core.network import CookieAssistant +from pyinjective.proto.injective.evm.v1 import query_pb2 as evm_query_pb, query_pb2_grpc as evm_query_grpc +from pyinjective.utils.grpc_api_request_assistant import GrpcApiRequestAssistant + + +class ChainGrpcEVMApi: + def __init__(self, channel: Channel, cookie_assistant: CookieAssistant): + self._stub = evm_query_grpc.QueryStub(channel) + self._assistant = GrpcApiRequestAssistant(cookie_assistant=cookie_assistant) + + async def fetch_params(self) -> Dict[str, Any]: + request = evm_query_pb.QueryParamsRequest() + response = await self._execute_call(call=self._stub.Params, request=request) + + return response + + async def fetch_account(self, address: str) -> Dict[str, Any]: + request = evm_query_pb.QueryAccountRequest(address=address) + response = await self._execute_call(call=self._stub.Account, request=request) + + return response + + async def fetch_cosmos_account(self, address: str) -> Dict[str, Any]: + request = evm_query_pb.QueryCosmosAccountRequest(address=address) + response = await self._execute_call(call=self._stub.CosmosAccount, request=request) + + return response + + async def fetch_validator_account(self, cons_address: str) -> Dict[str, Any]: + request = evm_query_pb.QueryValidatorAccountRequest(cons_address=cons_address) + response = await self._execute_call(call=self._stub.ValidatorAccount, request=request) + + return response + + async def fetch_balance(self, address: str) -> Dict[str, Any]: + request = evm_query_pb.QueryBalanceRequest(address=address) + response = await self._execute_call(call=self._stub.Balance, request=request) + + return response + + async def fetch_storage(self, address: str, key: Optional[str] = None) -> Dict[str, Any]: + request = evm_query_pb.QueryStorageRequest(address=address, key=key) + response = await self._execute_call(call=self._stub.Storage, request=request) + + return response + + async def fetch_code(self, address: str) -> Dict[str, Any]: + request = evm_query_pb.QueryCodeRequest(address=address) + response = await self._execute_call(call=self._stub.Code, request=request) + + return response + + async def fetch_base_fee(self) -> Dict[str, Any]: + request = evm_query_pb.QueryBaseFeeRequest() + response = await self._execute_call(call=self._stub.BaseFee, request=request) + + return response + + async def _execute_call(self, call: Callable, request) -> Dict[str, Any]: + return await self._assistant.execute_call(call=call, request=request) diff --git a/pyinjective/composer.py b/pyinjective/composer.py index ee45155b..360ceb46 100644 --- a/pyinjective/composer.py +++ b/pyinjective/composer.py @@ -25,6 +25,7 @@ from pyinjective.proto.ibc.applications.transfer.v1 import tx_pb2 as ibc_transfer_tx_pb from pyinjective.proto.ibc.core.client.v1 import client_pb2 as ibc_core_client_pb from pyinjective.proto.injective.auction.v1beta1 import tx_pb2 as injective_auction_tx_pb +from pyinjective.proto.injective.erc20.v1beta1 import erc20_pb2 as injective_erc20_pb2, tx_pb2 as injective_erc20_tx_pb from pyinjective.proto.injective.exchange.v1beta1 import ( authz_pb2 as injective_authz_pb, exchange_pb2 as injective_exchange_pb, @@ -2930,6 +2931,27 @@ def msg_claim_voucher( # endregion + # region ERC20 module + def msg_create_token_pair( + self, sender: str, bank_denom: str, erc20_address: str + ) -> injective_erc20_tx_pb.MsgCreateTokenPair: + token_pair = injective_erc20_pb2.TokenPair( + bank_denom=bank_denom, + erc20_address=erc20_address, + ) + return injective_erc20_tx_pb.MsgCreateTokenPair( + sender=sender, + token_pair=token_pair, + ) + + def msg_delete_token_pair(self, sender: str, bank_denom: str) -> injective_erc20_tx_pb.MsgDeleteTokenPair: + return injective_erc20_tx_pb.MsgDeleteTokenPair( + sender=sender, + bank_denom=bank_denom, + ) + + # endregion + # data field format: [request-msg-header][raw-byte-msg-response] # you need to figure out this magic prefix number to trim request-msg-header off the data # this method handles only exchange responses diff --git a/pyinjective/proto/exchange/injective_derivative_exchange_rpc_pb2.py b/pyinjective/proto/exchange/injective_derivative_exchange_rpc_pb2.py index 5ef32625..62508ffc 100644 --- a/pyinjective/proto/exchange/injective_derivative_exchange_rpc_pb2.py +++ b/pyinjective/proto/exchange/injective_derivative_exchange_rpc_pb2.py @@ -14,7 +14,7 @@ -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n0exchange/injective_derivative_exchange_rpc.proto\x12!injective_derivative_exchange_rpc\"\x7f\n\x0eMarketsRequest\x12#\n\rmarket_status\x18\x01 \x01(\tR\x0cmarketStatus\x12\x1f\n\x0bquote_denom\x18\x02 \x01(\tR\nquoteDenom\x12\'\n\x0fmarket_statuses\x18\x03 \x03(\tR\x0emarketStatuses\"d\n\x0fMarketsResponse\x12Q\n\x07markets\x18\x01 \x03(\x0b\x32\x37.injective_derivative_exchange_rpc.DerivativeMarketInfoR\x07markets\"\xec\x08\n\x14\x44\x65rivativeMarketInfo\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12#\n\rmarket_status\x18\x02 \x01(\tR\x0cmarketStatus\x12\x16\n\x06ticker\x18\x03 \x01(\tR\x06ticker\x12\x1f\n\x0boracle_base\x18\x04 \x01(\tR\noracleBase\x12!\n\x0coracle_quote\x18\x05 \x01(\tR\x0boracleQuote\x12\x1f\n\x0boracle_type\x18\x06 \x01(\tR\noracleType\x12.\n\x13oracle_scale_factor\x18\x07 \x01(\rR\x11oracleScaleFactor\x12\x30\n\x14initial_margin_ratio\x18\x08 \x01(\tR\x12initialMarginRatio\x12\x38\n\x18maintenance_margin_ratio\x18\t \x01(\tR\x16maintenanceMarginRatio\x12\x1f\n\x0bquote_denom\x18\n \x01(\tR\nquoteDenom\x12V\n\x10quote_token_meta\x18\x0b \x01(\x0b\x32,.injective_derivative_exchange_rpc.TokenMetaR\x0equoteTokenMeta\x12$\n\x0emaker_fee_rate\x18\x0c \x01(\tR\x0cmakerFeeRate\x12$\n\x0etaker_fee_rate\x18\r \x01(\tR\x0ctakerFeeRate\x12\x30\n\x14service_provider_fee\x18\x0e \x01(\tR\x12serviceProviderFee\x12!\n\x0cis_perpetual\x18\x0f \x01(\x08R\x0bisPerpetual\x12-\n\x13min_price_tick_size\x18\x10 \x01(\tR\x10minPriceTickSize\x12\x33\n\x16min_quantity_tick_size\x18\x11 \x01(\tR\x13minQuantityTickSize\x12j\n\x15perpetual_market_info\x18\x12 \x01(\x0b\x32\x36.injective_derivative_exchange_rpc.PerpetualMarketInfoR\x13perpetualMarketInfo\x12s\n\x18perpetual_market_funding\x18\x13 \x01(\x0b\x32\x39.injective_derivative_exchange_rpc.PerpetualMarketFundingR\x16perpetualMarketFunding\x12w\n\x1a\x65xpiry_futures_market_info\x18\x14 \x01(\x0b\x32:.injective_derivative_exchange_rpc.ExpiryFuturesMarketInfoR\x17\x65xpiryFuturesMarketInfo\x12!\n\x0cmin_notional\x18\x15 \x01(\tR\x0bminNotional\"\xa0\x01\n\tTokenMeta\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x18\n\x07\x61\x64\x64ress\x18\x02 \x01(\tR\x07\x61\x64\x64ress\x12\x16\n\x06symbol\x18\x03 \x01(\tR\x06symbol\x12\x12\n\x04logo\x18\x04 \x01(\tR\x04logo\x12\x1a\n\x08\x64\x65\x63imals\x18\x05 \x01(\x11R\x08\x64\x65\x63imals\x12\x1d\n\nupdated_at\x18\x06 \x01(\x12R\tupdatedAt\"\xdf\x01\n\x13PerpetualMarketInfo\x12\x35\n\x17hourly_funding_rate_cap\x18\x01 \x01(\tR\x14hourlyFundingRateCap\x12\x30\n\x14hourly_interest_rate\x18\x02 \x01(\tR\x12hourlyInterestRate\x12\x34\n\x16next_funding_timestamp\x18\x03 \x01(\x12R\x14nextFundingTimestamp\x12)\n\x10\x66unding_interval\x18\x04 \x01(\x12R\x0f\x66undingInterval\"\x99\x01\n\x16PerpetualMarketFunding\x12-\n\x12\x63umulative_funding\x18\x01 \x01(\tR\x11\x63umulativeFunding\x12)\n\x10\x63umulative_price\x18\x02 \x01(\tR\x0f\x63umulativePrice\x12%\n\x0elast_timestamp\x18\x03 \x01(\x12R\rlastTimestamp\"w\n\x17\x45xpiryFuturesMarketInfo\x12\x31\n\x14\x65xpiration_timestamp\x18\x01 \x01(\x12R\x13\x65xpirationTimestamp\x12)\n\x10settlement_price\x18\x02 \x01(\tR\x0fsettlementPrice\",\n\rMarketRequest\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\"a\n\x0eMarketResponse\x12O\n\x06market\x18\x01 \x01(\x0b\x32\x37.injective_derivative_exchange_rpc.DerivativeMarketInfoR\x06market\"4\n\x13StreamMarketRequest\x12\x1d\n\nmarket_ids\x18\x01 \x03(\tR\tmarketIds\"\xac\x01\n\x14StreamMarketResponse\x12O\n\x06market\x18\x01 \x01(\x0b\x32\x37.injective_derivative_exchange_rpc.DerivativeMarketInfoR\x06market\x12%\n\x0eoperation_type\x18\x02 \x01(\tR\roperationType\x12\x1c\n\ttimestamp\x18\x03 \x01(\x12R\ttimestamp\"\x8d\x01\n\x1b\x42inaryOptionsMarketsRequest\x12#\n\rmarket_status\x18\x01 \x01(\tR\x0cmarketStatus\x12\x1f\n\x0bquote_denom\x18\x02 \x01(\tR\nquoteDenom\x12\x12\n\x04skip\x18\x03 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x04 \x01(\x11R\x05limit\"\xb7\x01\n\x1c\x42inaryOptionsMarketsResponse\x12T\n\x07markets\x18\x01 \x03(\x0b\x32:.injective_derivative_exchange_rpc.BinaryOptionsMarketInfoR\x07markets\x12\x41\n\x06paging\x18\x02 \x01(\x0b\x32).injective_derivative_exchange_rpc.PagingR\x06paging\"\xa1\x06\n\x17\x42inaryOptionsMarketInfo\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12#\n\rmarket_status\x18\x02 \x01(\tR\x0cmarketStatus\x12\x16\n\x06ticker\x18\x03 \x01(\tR\x06ticker\x12#\n\roracle_symbol\x18\x04 \x01(\tR\x0coracleSymbol\x12\'\n\x0foracle_provider\x18\x05 \x01(\tR\x0eoracleProvider\x12\x1f\n\x0boracle_type\x18\x06 \x01(\tR\noracleType\x12.\n\x13oracle_scale_factor\x18\x07 \x01(\rR\x11oracleScaleFactor\x12\x31\n\x14\x65xpiration_timestamp\x18\x08 \x01(\x12R\x13\x65xpirationTimestamp\x12\x31\n\x14settlement_timestamp\x18\t \x01(\x12R\x13settlementTimestamp\x12\x1f\n\x0bquote_denom\x18\n \x01(\tR\nquoteDenom\x12V\n\x10quote_token_meta\x18\x0b \x01(\x0b\x32,.injective_derivative_exchange_rpc.TokenMetaR\x0equoteTokenMeta\x12$\n\x0emaker_fee_rate\x18\x0c \x01(\tR\x0cmakerFeeRate\x12$\n\x0etaker_fee_rate\x18\r \x01(\tR\x0ctakerFeeRate\x12\x30\n\x14service_provider_fee\x18\x0e \x01(\tR\x12serviceProviderFee\x12-\n\x13min_price_tick_size\x18\x0f \x01(\tR\x10minPriceTickSize\x12\x33\n\x16min_quantity_tick_size\x18\x10 \x01(\tR\x13minQuantityTickSize\x12)\n\x10settlement_price\x18\x11 \x01(\tR\x0fsettlementPrice\x12!\n\x0cmin_notional\x18\x12 \x01(\tR\x0bminNotional\"\x86\x01\n\x06Paging\x12\x14\n\x05total\x18\x01 \x01(\x12R\x05total\x12\x12\n\x04\x66rom\x18\x02 \x01(\x11R\x04\x66rom\x12\x0e\n\x02to\x18\x03 \x01(\x11R\x02to\x12.\n\x13\x63ount_by_subaccount\x18\x04 \x01(\x12R\x11\x63ountBySubaccount\x12\x12\n\x04next\x18\x05 \x03(\tR\x04next\"9\n\x1a\x42inaryOptionsMarketRequest\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\"q\n\x1b\x42inaryOptionsMarketResponse\x12R\n\x06market\x18\x01 \x01(\x0b\x32:.injective_derivative_exchange_rpc.BinaryOptionsMarketInfoR\x06market\"G\n\x12OrderbookV2Request\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12\x14\n\x05\x64\x65pth\x18\x02 \x01(\x11R\x05\x64\x65pth\"r\n\x13OrderbookV2Response\x12[\n\torderbook\x18\x01 \x01(\x0b\x32=.injective_derivative_exchange_rpc.DerivativeLimitOrderbookV2R\torderbook\"\xde\x01\n\x1a\x44\x65rivativeLimitOrderbookV2\x12\x41\n\x04\x62uys\x18\x01 \x03(\x0b\x32-.injective_derivative_exchange_rpc.PriceLevelR\x04\x62uys\x12\x43\n\x05sells\x18\x02 \x03(\x0b\x32-.injective_derivative_exchange_rpc.PriceLevelR\x05sells\x12\x1a\n\x08sequence\x18\x03 \x01(\x04R\x08sequence\x12\x1c\n\ttimestamp\x18\x04 \x01(\x12R\ttimestamp\"\\\n\nPriceLevel\x12\x14\n\x05price\x18\x01 \x01(\tR\x05price\x12\x1a\n\x08quantity\x18\x02 \x01(\tR\x08quantity\x12\x1c\n\ttimestamp\x18\x03 \x01(\x12R\ttimestamp\"J\n\x13OrderbooksV2Request\x12\x1d\n\nmarket_ids\x18\x01 \x03(\tR\tmarketIds\x12\x14\n\x05\x64\x65pth\x18\x02 \x01(\x11R\x05\x64\x65pth\"{\n\x14OrderbooksV2Response\x12\x63\n\norderbooks\x18\x01 \x03(\x0b\x32\x43.injective_derivative_exchange_rpc.SingleDerivativeLimitOrderbookV2R\norderbooks\"\x9c\x01\n SingleDerivativeLimitOrderbookV2\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12[\n\torderbook\x18\x02 \x01(\x0b\x32=.injective_derivative_exchange_rpc.DerivativeLimitOrderbookV2R\torderbook\"9\n\x18StreamOrderbookV2Request\x12\x1d\n\nmarket_ids\x18\x01 \x03(\tR\tmarketIds\"\xda\x01\n\x19StreamOrderbookV2Response\x12[\n\torderbook\x18\x01 \x01(\x0b\x32=.injective_derivative_exchange_rpc.DerivativeLimitOrderbookV2R\torderbook\x12%\n\x0eoperation_type\x18\x02 \x01(\tR\roperationType\x12\x1c\n\ttimestamp\x18\x03 \x01(\x12R\ttimestamp\x12\x1b\n\tmarket_id\x18\x04 \x01(\tR\x08marketId\"=\n\x1cStreamOrderbookUpdateRequest\x12\x1d\n\nmarket_ids\x18\x01 \x03(\tR\tmarketIds\"\xf3\x01\n\x1dStreamOrderbookUpdateResponse\x12p\n\x17orderbook_level_updates\x18\x01 \x01(\x0b\x32\x38.injective_derivative_exchange_rpc.OrderbookLevelUpdatesR\x15orderbookLevelUpdates\x12%\n\x0eoperation_type\x18\x02 \x01(\tR\roperationType\x12\x1c\n\ttimestamp\x18\x03 \x01(\x12R\ttimestamp\x12\x1b\n\tmarket_id\x18\x04 \x01(\tR\x08marketId\"\x83\x02\n\x15OrderbookLevelUpdates\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12\x1a\n\x08sequence\x18\x02 \x01(\x04R\x08sequence\x12G\n\x04\x62uys\x18\x03 \x03(\x0b\x32\x33.injective_derivative_exchange_rpc.PriceLevelUpdateR\x04\x62uys\x12I\n\x05sells\x18\x04 \x03(\x0b\x32\x33.injective_derivative_exchange_rpc.PriceLevelUpdateR\x05sells\x12\x1d\n\nupdated_at\x18\x05 \x01(\x12R\tupdatedAt\"\x7f\n\x10PriceLevelUpdate\x12\x14\n\x05price\x18\x01 \x01(\tR\x05price\x12\x1a\n\x08quantity\x18\x02 \x01(\tR\x08quantity\x12\x1b\n\tis_active\x18\x03 \x01(\x08R\x08isActive\x12\x1c\n\ttimestamp\x18\x04 \x01(\x12R\ttimestamp\"\xc9\x03\n\rOrdersRequest\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12\x1d\n\norder_side\x18\x02 \x01(\tR\torderSide\x12#\n\rsubaccount_id\x18\x03 \x01(\tR\x0csubaccountId\x12\x12\n\x04skip\x18\x04 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x05 \x01(\x11R\x05limit\x12\x1d\n\nstart_time\x18\x06 \x01(\x12R\tstartTime\x12\x19\n\x08\x65nd_time\x18\x07 \x01(\x12R\x07\x65ndTime\x12\x1d\n\nmarket_ids\x18\x08 \x03(\tR\tmarketIds\x12%\n\x0eis_conditional\x18\t \x01(\tR\risConditional\x12\x1d\n\norder_type\x18\n \x01(\tR\torderType\x12)\n\x10include_inactive\x18\x0b \x01(\x08R\x0fincludeInactive\x12\x36\n\x17subaccount_total_orders\x18\x0c \x01(\x08R\x15subaccountTotalOrders\x12\x19\n\x08trade_id\x18\r \x01(\tR\x07tradeId\x12\x10\n\x03\x63id\x18\x0e \x01(\tR\x03\x63id\"\xa4\x01\n\x0eOrdersResponse\x12O\n\x06orders\x18\x01 \x03(\x0b\x32\x37.injective_derivative_exchange_rpc.DerivativeLimitOrderR\x06orders\x12\x41\n\x06paging\x18\x02 \x01(\x0b\x32).injective_derivative_exchange_rpc.PagingR\x06paging\"\xd7\x05\n\x14\x44\x65rivativeLimitOrder\x12\x1d\n\norder_hash\x18\x01 \x01(\tR\torderHash\x12\x1d\n\norder_side\x18\x02 \x01(\tR\torderSide\x12\x1b\n\tmarket_id\x18\x03 \x01(\tR\x08marketId\x12#\n\rsubaccount_id\x18\x04 \x01(\tR\x0csubaccountId\x12$\n\x0eis_reduce_only\x18\x05 \x01(\x08R\x0cisReduceOnly\x12\x16\n\x06margin\x18\x06 \x01(\tR\x06margin\x12\x14\n\x05price\x18\x07 \x01(\tR\x05price\x12\x1a\n\x08quantity\x18\x08 \x01(\tR\x08quantity\x12+\n\x11unfilled_quantity\x18\t \x01(\tR\x10unfilledQuantity\x12#\n\rtrigger_price\x18\n \x01(\tR\x0ctriggerPrice\x12#\n\rfee_recipient\x18\x0b \x01(\tR\x0c\x66\x65\x65Recipient\x12\x14\n\x05state\x18\x0c \x01(\tR\x05state\x12\x1d\n\ncreated_at\x18\r \x01(\x12R\tcreatedAt\x12\x1d\n\nupdated_at\x18\x0e \x01(\x12R\tupdatedAt\x12!\n\x0corder_number\x18\x0f \x01(\x12R\x0borderNumber\x12\x1d\n\norder_type\x18\x10 \x01(\tR\torderType\x12%\n\x0eis_conditional\x18\x11 \x01(\x08R\risConditional\x12\x1d\n\ntrigger_at\x18\x12 \x01(\x04R\ttriggerAt\x12*\n\x11placed_order_hash\x18\x13 \x01(\tR\x0fplacedOrderHash\x12%\n\x0e\x65xecution_type\x18\x14 \x01(\tR\rexecutionType\x12\x17\n\x07tx_hash\x18\x15 \x01(\tR\x06txHash\x12\x10\n\x03\x63id\x18\x16 \x01(\tR\x03\x63id\"\xdc\x02\n\x10PositionsRequest\x12#\n\rsubaccount_id\x18\x01 \x01(\tR\x0csubaccountId\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12\x12\n\x04skip\x18\x03 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x04 \x01(\x11R\x05limit\x12\x1d\n\nstart_time\x18\x05 \x01(\x12R\tstartTime\x12\x19\n\x08\x65nd_time\x18\x06 \x01(\x12R\x07\x65ndTime\x12\x1d\n\nmarket_ids\x18\x07 \x03(\tR\tmarketIds\x12\x1c\n\tdirection\x18\x08 \x01(\tR\tdirection\x12<\n\x1asubaccount_total_positions\x18\t \x01(\x08R\x18subaccountTotalPositions\x12\'\n\x0f\x61\x63\x63ount_address\x18\n \x01(\tR\x0e\x61\x63\x63ountAddress\"\xab\x01\n\x11PositionsResponse\x12S\n\tpositions\x18\x01 \x03(\x0b\x32\x35.injective_derivative_exchange_rpc.DerivativePositionR\tpositions\x12\x41\n\x06paging\x18\x02 \x01(\x0b\x32).injective_derivative_exchange_rpc.PagingR\x06paging\"\xb0\x03\n\x12\x44\x65rivativePosition\x12\x16\n\x06ticker\x18\x01 \x01(\tR\x06ticker\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12#\n\rsubaccount_id\x18\x03 \x01(\tR\x0csubaccountId\x12\x1c\n\tdirection\x18\x04 \x01(\tR\tdirection\x12\x1a\n\x08quantity\x18\x05 \x01(\tR\x08quantity\x12\x1f\n\x0b\x65ntry_price\x18\x06 \x01(\tR\nentryPrice\x12\x16\n\x06margin\x18\x07 \x01(\tR\x06margin\x12+\n\x11liquidation_price\x18\x08 \x01(\tR\x10liquidationPrice\x12\x1d\n\nmark_price\x18\t \x01(\tR\tmarkPrice\x12\x43\n\x1e\x61ggregate_reduce_only_quantity\x18\x0b \x01(\tR\x1b\x61ggregateReduceOnlyQuantity\x12\x1d\n\nupdated_at\x18\x0c \x01(\x12R\tupdatedAt\x12\x1d\n\ncreated_at\x18\r \x01(\x12R\tcreatedAt\"\xde\x02\n\x12PositionsV2Request\x12#\n\rsubaccount_id\x18\x01 \x01(\tR\x0csubaccountId\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12\x12\n\x04skip\x18\x03 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x04 \x01(\x11R\x05limit\x12\x1d\n\nstart_time\x18\x05 \x01(\x12R\tstartTime\x12\x19\n\x08\x65nd_time\x18\x06 \x01(\x12R\x07\x65ndTime\x12\x1d\n\nmarket_ids\x18\x07 \x03(\tR\tmarketIds\x12\x1c\n\tdirection\x18\x08 \x01(\tR\tdirection\x12<\n\x1asubaccount_total_positions\x18\t \x01(\x08R\x18subaccountTotalPositions\x12\'\n\x0f\x61\x63\x63ount_address\x18\n \x01(\tR\x0e\x61\x63\x63ountAddress\"\xaf\x01\n\x13PositionsV2Response\x12U\n\tpositions\x18\x01 \x03(\x0b\x32\x37.injective_derivative_exchange_rpc.DerivativePositionV2R\tpositions\x12\x41\n\x06paging\x18\x02 \x01(\x0b\x32).injective_derivative_exchange_rpc.PagingR\x06paging\"\xe4\x02\n\x14\x44\x65rivativePositionV2\x12\x16\n\x06ticker\x18\x01 \x01(\tR\x06ticker\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12#\n\rsubaccount_id\x18\x03 \x01(\tR\x0csubaccountId\x12\x1c\n\tdirection\x18\x04 \x01(\tR\tdirection\x12\x1a\n\x08quantity\x18\x05 \x01(\tR\x08quantity\x12\x1f\n\x0b\x65ntry_price\x18\x06 \x01(\tR\nentryPrice\x12\x16\n\x06margin\x18\x07 \x01(\tR\x06margin\x12+\n\x11liquidation_price\x18\x08 \x01(\tR\x10liquidationPrice\x12\x1d\n\nmark_price\x18\t \x01(\tR\tmarkPrice\x12\x1d\n\nupdated_at\x18\x0b \x01(\x12R\tupdatedAt\x12\x14\n\x05\x64\x65nom\x18\x0c \x01(\tR\x05\x64\x65nom\"c\n\x1aLiquidablePositionsRequest\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12\x12\n\x04skip\x18\x02 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x03 \x01(\x11R\x05limit\"r\n\x1bLiquidablePositionsResponse\x12S\n\tpositions\x18\x01 \x03(\x0b\x32\x35.injective_derivative_exchange_rpc.DerivativePositionR\tpositions\"\xbe\x01\n\x16\x46undingPaymentsRequest\x12#\n\rsubaccount_id\x18\x01 \x01(\tR\x0csubaccountId\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12\x12\n\x04skip\x18\x03 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x04 \x01(\x11R\x05limit\x12\x19\n\x08\x65nd_time\x18\x05 \x01(\x12R\x07\x65ndTime\x12\x1d\n\nmarket_ids\x18\x06 \x03(\tR\tmarketIds\"\xab\x01\n\x17\x46undingPaymentsResponse\x12M\n\x08payments\x18\x01 \x03(\x0b\x32\x31.injective_derivative_exchange_rpc.FundingPaymentR\x08payments\x12\x41\n\x06paging\x18\x02 \x01(\x0b\x32).injective_derivative_exchange_rpc.PagingR\x06paging\"\x88\x01\n\x0e\x46undingPayment\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12#\n\rsubaccount_id\x18\x02 \x01(\tR\x0csubaccountId\x12\x16\n\x06\x61mount\x18\x03 \x01(\tR\x06\x61mount\x12\x1c\n\ttimestamp\x18\x04 \x01(\x12R\ttimestamp\"w\n\x13\x46undingRatesRequest\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12\x12\n\x04skip\x18\x02 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x03 \x01(\x11R\x05limit\x12\x19\n\x08\x65nd_time\x18\x04 \x01(\x12R\x07\x65ndTime\"\xae\x01\n\x14\x46undingRatesResponse\x12S\n\rfunding_rates\x18\x01 \x03(\x0b\x32..injective_derivative_exchange_rpc.FundingRateR\x0c\x66undingRates\x12\x41\n\x06paging\x18\x02 \x01(\x0b\x32).injective_derivative_exchange_rpc.PagingR\x06paging\"\\\n\x0b\x46undingRate\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12\x12\n\x04rate\x18\x02 \x01(\tR\x04rate\x12\x1c\n\ttimestamp\x18\x03 \x01(\x12R\ttimestamp\"\xc9\x01\n\x16StreamPositionsRequest\x12#\n\rsubaccount_id\x18\x01 \x01(\tR\x0csubaccountId\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12\x1d\n\nmarket_ids\x18\x03 \x03(\tR\tmarketIds\x12%\n\x0esubaccount_ids\x18\x04 \x03(\tR\rsubaccountIds\x12\'\n\x0f\x61\x63\x63ount_address\x18\x05 \x01(\tR\x0e\x61\x63\x63ountAddress\"\x8a\x01\n\x17StreamPositionsResponse\x12Q\n\x08position\x18\x01 \x01(\x0b\x32\x35.injective_derivative_exchange_rpc.DerivativePositionR\x08position\x12\x1c\n\ttimestamp\x18\x02 \x01(\x12R\ttimestamp\"\xcb\x01\n\x18StreamPositionsV2Request\x12#\n\rsubaccount_id\x18\x01 \x01(\tR\x0csubaccountId\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12\x1d\n\nmarket_ids\x18\x03 \x03(\tR\tmarketIds\x12%\n\x0esubaccount_ids\x18\x04 \x03(\tR\rsubaccountIds\x12\'\n\x0f\x61\x63\x63ount_address\x18\x05 \x01(\tR\x0e\x61\x63\x63ountAddress\"\x8e\x01\n\x19StreamPositionsV2Response\x12S\n\x08position\x18\x01 \x01(\x0b\x32\x37.injective_derivative_exchange_rpc.DerivativePositionV2R\x08position\x12\x1c\n\ttimestamp\x18\x02 \x01(\x12R\ttimestamp\"\xcf\x03\n\x13StreamOrdersRequest\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12\x1d\n\norder_side\x18\x02 \x01(\tR\torderSide\x12#\n\rsubaccount_id\x18\x03 \x01(\tR\x0csubaccountId\x12\x12\n\x04skip\x18\x04 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x05 \x01(\x11R\x05limit\x12\x1d\n\nstart_time\x18\x06 \x01(\x12R\tstartTime\x12\x19\n\x08\x65nd_time\x18\x07 \x01(\x12R\x07\x65ndTime\x12\x1d\n\nmarket_ids\x18\x08 \x03(\tR\tmarketIds\x12%\n\x0eis_conditional\x18\t \x01(\tR\risConditional\x12\x1d\n\norder_type\x18\n \x01(\tR\torderType\x12)\n\x10include_inactive\x18\x0b \x01(\x08R\x0fincludeInactive\x12\x36\n\x17subaccount_total_orders\x18\x0c \x01(\x08R\x15subaccountTotalOrders\x12\x19\n\x08trade_id\x18\r \x01(\tR\x07tradeId\x12\x10\n\x03\x63id\x18\x0e \x01(\tR\x03\x63id\"\xaa\x01\n\x14StreamOrdersResponse\x12M\n\x05order\x18\x01 \x01(\x0b\x32\x37.injective_derivative_exchange_rpc.DerivativeLimitOrderR\x05order\x12%\n\x0eoperation_type\x18\x02 \x01(\tR\roperationType\x12\x1c\n\ttimestamp\x18\x03 \x01(\x12R\ttimestamp\"\xe4\x03\n\rTradesRequest\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12%\n\x0e\x65xecution_side\x18\x02 \x01(\tR\rexecutionSide\x12\x1c\n\tdirection\x18\x03 \x01(\tR\tdirection\x12#\n\rsubaccount_id\x18\x04 \x01(\tR\x0csubaccountId\x12\x12\n\x04skip\x18\x05 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x06 \x01(\x11R\x05limit\x12\x1d\n\nstart_time\x18\x07 \x01(\x12R\tstartTime\x12\x19\n\x08\x65nd_time\x18\x08 \x01(\x12R\x07\x65ndTime\x12\x1d\n\nmarket_ids\x18\t \x03(\tR\tmarketIds\x12%\n\x0esubaccount_ids\x18\n \x03(\tR\rsubaccountIds\x12\'\n\x0f\x65xecution_types\x18\x0b \x03(\tR\x0e\x65xecutionTypes\x12\x19\n\x08trade_id\x18\x0c \x01(\tR\x07tradeId\x12\'\n\x0f\x61\x63\x63ount_address\x18\r \x01(\tR\x0e\x61\x63\x63ountAddress\x12\x10\n\x03\x63id\x18\x0e \x01(\tR\x03\x63id\x12#\n\rfee_recipient\x18\x0f \x01(\tR\x0c\x66\x65\x65Recipient\"\x9f\x01\n\x0eTradesResponse\x12J\n\x06trades\x18\x01 \x03(\x0b\x32\x32.injective_derivative_exchange_rpc.DerivativeTradeR\x06trades\x12\x41\n\x06paging\x18\x02 \x01(\x0b\x32).injective_derivative_exchange_rpc.PagingR\x06paging\"\xe8\x03\n\x0f\x44\x65rivativeTrade\x12\x1d\n\norder_hash\x18\x01 \x01(\tR\torderHash\x12#\n\rsubaccount_id\x18\x02 \x01(\tR\x0csubaccountId\x12\x1b\n\tmarket_id\x18\x03 \x01(\tR\x08marketId\x12\x30\n\x14trade_execution_type\x18\x04 \x01(\tR\x12tradeExecutionType\x12%\n\x0eis_liquidation\x18\x05 \x01(\x08R\risLiquidation\x12W\n\x0eposition_delta\x18\x06 \x01(\x0b\x32\x30.injective_derivative_exchange_rpc.PositionDeltaR\rpositionDelta\x12\x16\n\x06payout\x18\x07 \x01(\tR\x06payout\x12\x10\n\x03\x66\x65\x65\x18\x08 \x01(\tR\x03\x66\x65\x65\x12\x1f\n\x0b\x65xecuted_at\x18\t \x01(\x12R\nexecutedAt\x12#\n\rfee_recipient\x18\n \x01(\tR\x0c\x66\x65\x65Recipient\x12\x19\n\x08trade_id\x18\x0b \x01(\tR\x07tradeId\x12%\n\x0e\x65xecution_side\x18\x0c \x01(\tR\rexecutionSide\x12\x10\n\x03\x63id\x18\r \x01(\tR\x03\x63id\"\xbb\x01\n\rPositionDelta\x12\'\n\x0ftrade_direction\x18\x01 \x01(\tR\x0etradeDirection\x12\'\n\x0f\x65xecution_price\x18\x02 \x01(\tR\x0e\x65xecutionPrice\x12-\n\x12\x65xecution_quantity\x18\x03 \x01(\tR\x11\x65xecutionQuantity\x12)\n\x10\x65xecution_margin\x18\x04 \x01(\tR\x0f\x65xecutionMargin\"\xe6\x03\n\x0fTradesV2Request\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12%\n\x0e\x65xecution_side\x18\x02 \x01(\tR\rexecutionSide\x12\x1c\n\tdirection\x18\x03 \x01(\tR\tdirection\x12#\n\rsubaccount_id\x18\x04 \x01(\tR\x0csubaccountId\x12\x12\n\x04skip\x18\x05 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x06 \x01(\x11R\x05limit\x12\x1d\n\nstart_time\x18\x07 \x01(\x12R\tstartTime\x12\x19\n\x08\x65nd_time\x18\x08 \x01(\x12R\x07\x65ndTime\x12\x1d\n\nmarket_ids\x18\t \x03(\tR\tmarketIds\x12%\n\x0esubaccount_ids\x18\n \x03(\tR\rsubaccountIds\x12\'\n\x0f\x65xecution_types\x18\x0b \x03(\tR\x0e\x65xecutionTypes\x12\x19\n\x08trade_id\x18\x0c \x01(\tR\x07tradeId\x12\'\n\x0f\x61\x63\x63ount_address\x18\r \x01(\tR\x0e\x61\x63\x63ountAddress\x12\x10\n\x03\x63id\x18\x0e \x01(\tR\x03\x63id\x12#\n\rfee_recipient\x18\x0f \x01(\tR\x0c\x66\x65\x65Recipient\"\xa1\x01\n\x10TradesV2Response\x12J\n\x06trades\x18\x01 \x03(\x0b\x32\x32.injective_derivative_exchange_rpc.DerivativeTradeR\x06trades\x12\x41\n\x06paging\x18\x02 \x01(\x0b\x32).injective_derivative_exchange_rpc.PagingR\x06paging\"\xea\x03\n\x13StreamTradesRequest\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12%\n\x0e\x65xecution_side\x18\x02 \x01(\tR\rexecutionSide\x12\x1c\n\tdirection\x18\x03 \x01(\tR\tdirection\x12#\n\rsubaccount_id\x18\x04 \x01(\tR\x0csubaccountId\x12\x12\n\x04skip\x18\x05 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x06 \x01(\x11R\x05limit\x12\x1d\n\nstart_time\x18\x07 \x01(\x12R\tstartTime\x12\x19\n\x08\x65nd_time\x18\x08 \x01(\x12R\x07\x65ndTime\x12\x1d\n\nmarket_ids\x18\t \x03(\tR\tmarketIds\x12%\n\x0esubaccount_ids\x18\n \x03(\tR\rsubaccountIds\x12\'\n\x0f\x65xecution_types\x18\x0b \x03(\tR\x0e\x65xecutionTypes\x12\x19\n\x08trade_id\x18\x0c \x01(\tR\x07tradeId\x12\'\n\x0f\x61\x63\x63ount_address\x18\r \x01(\tR\x0e\x61\x63\x63ountAddress\x12\x10\n\x03\x63id\x18\x0e \x01(\tR\x03\x63id\x12#\n\rfee_recipient\x18\x0f \x01(\tR\x0c\x66\x65\x65Recipient\"\xa5\x01\n\x14StreamTradesResponse\x12H\n\x05trade\x18\x01 \x01(\x0b\x32\x32.injective_derivative_exchange_rpc.DerivativeTradeR\x05trade\x12%\n\x0eoperation_type\x18\x02 \x01(\tR\roperationType\x12\x1c\n\ttimestamp\x18\x03 \x01(\x12R\ttimestamp\"\xec\x03\n\x15StreamTradesV2Request\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12%\n\x0e\x65xecution_side\x18\x02 \x01(\tR\rexecutionSide\x12\x1c\n\tdirection\x18\x03 \x01(\tR\tdirection\x12#\n\rsubaccount_id\x18\x04 \x01(\tR\x0csubaccountId\x12\x12\n\x04skip\x18\x05 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x06 \x01(\x11R\x05limit\x12\x1d\n\nstart_time\x18\x07 \x01(\x12R\tstartTime\x12\x19\n\x08\x65nd_time\x18\x08 \x01(\x12R\x07\x65ndTime\x12\x1d\n\nmarket_ids\x18\t \x03(\tR\tmarketIds\x12%\n\x0esubaccount_ids\x18\n \x03(\tR\rsubaccountIds\x12\'\n\x0f\x65xecution_types\x18\x0b \x03(\tR\x0e\x65xecutionTypes\x12\x19\n\x08trade_id\x18\x0c \x01(\tR\x07tradeId\x12\'\n\x0f\x61\x63\x63ount_address\x18\r \x01(\tR\x0e\x61\x63\x63ountAddress\x12\x10\n\x03\x63id\x18\x0e \x01(\tR\x03\x63id\x12#\n\rfee_recipient\x18\x0f \x01(\tR\x0c\x66\x65\x65Recipient\"\xa7\x01\n\x16StreamTradesV2Response\x12H\n\x05trade\x18\x01 \x01(\x0b\x32\x32.injective_derivative_exchange_rpc.DerivativeTradeR\x05trade\x12%\n\x0eoperation_type\x18\x02 \x01(\tR\roperationType\x12\x1c\n\ttimestamp\x18\x03 \x01(\x12R\ttimestamp\"\x89\x01\n\x1bSubaccountOrdersListRequest\x12#\n\rsubaccount_id\x18\x01 \x01(\tR\x0csubaccountId\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12\x12\n\x04skip\x18\x03 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x04 \x01(\x11R\x05limit\"\xb2\x01\n\x1cSubaccountOrdersListResponse\x12O\n\x06orders\x18\x01 \x03(\x0b\x32\x37.injective_derivative_exchange_rpc.DerivativeLimitOrderR\x06orders\x12\x41\n\x06paging\x18\x02 \x01(\x0b\x32).injective_derivative_exchange_rpc.PagingR\x06paging\"\xce\x01\n\x1bSubaccountTradesListRequest\x12#\n\rsubaccount_id\x18\x01 \x01(\tR\x0csubaccountId\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12%\n\x0e\x65xecution_type\x18\x03 \x01(\tR\rexecutionType\x12\x1c\n\tdirection\x18\x04 \x01(\tR\tdirection\x12\x12\n\x04skip\x18\x05 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x06 \x01(\x11R\x05limit\"j\n\x1cSubaccountTradesListResponse\x12J\n\x06trades\x18\x01 \x03(\x0b\x32\x32.injective_derivative_exchange_rpc.DerivativeTradeR\x06trades\"\xfc\x03\n\x14OrdersHistoryRequest\x12#\n\rsubaccount_id\x18\x01 \x01(\tR\x0csubaccountId\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12\x12\n\x04skip\x18\x03 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x04 \x01(\x11R\x05limit\x12\x1f\n\x0border_types\x18\x05 \x03(\tR\norderTypes\x12\x1c\n\tdirection\x18\x06 \x01(\tR\tdirection\x12\x1d\n\nstart_time\x18\x07 \x01(\x12R\tstartTime\x12\x19\n\x08\x65nd_time\x18\x08 \x01(\x12R\x07\x65ndTime\x12%\n\x0eis_conditional\x18\t \x01(\tR\risConditional\x12\x1d\n\norder_type\x18\n \x01(\tR\torderType\x12\x14\n\x05state\x18\x0b \x01(\tR\x05state\x12\'\n\x0f\x65xecution_types\x18\x0c \x03(\tR\x0e\x65xecutionTypes\x12\x1d\n\nmarket_ids\x18\r \x03(\tR\tmarketIds\x12\x19\n\x08trade_id\x18\x0e \x01(\tR\x07tradeId\x12.\n\x13\x61\x63tive_markets_only\x18\x0f \x01(\x08R\x11\x61\x63tiveMarketsOnly\x12\x10\n\x03\x63id\x18\x10 \x01(\tR\x03\x63id\"\xad\x01\n\x15OrdersHistoryResponse\x12Q\n\x06orders\x18\x01 \x03(\x0b\x32\x39.injective_derivative_exchange_rpc.DerivativeOrderHistoryR\x06orders\x12\x41\n\x06paging\x18\x02 \x01(\x0b\x32).injective_derivative_exchange_rpc.PagingR\x06paging\"\xa9\x05\n\x16\x44\x65rivativeOrderHistory\x12\x1d\n\norder_hash\x18\x01 \x01(\tR\torderHash\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12\x1b\n\tis_active\x18\x03 \x01(\x08R\x08isActive\x12#\n\rsubaccount_id\x18\x04 \x01(\tR\x0csubaccountId\x12%\n\x0e\x65xecution_type\x18\x05 \x01(\tR\rexecutionType\x12\x1d\n\norder_type\x18\x06 \x01(\tR\torderType\x12\x14\n\x05price\x18\x07 \x01(\tR\x05price\x12#\n\rtrigger_price\x18\x08 \x01(\tR\x0ctriggerPrice\x12\x1a\n\x08quantity\x18\t \x01(\tR\x08quantity\x12\'\n\x0f\x66illed_quantity\x18\n \x01(\tR\x0e\x66illedQuantity\x12\x14\n\x05state\x18\x0b \x01(\tR\x05state\x12\x1d\n\ncreated_at\x18\x0c \x01(\x12R\tcreatedAt\x12\x1d\n\nupdated_at\x18\r \x01(\x12R\tupdatedAt\x12$\n\x0eis_reduce_only\x18\x0e \x01(\x08R\x0cisReduceOnly\x12\x1c\n\tdirection\x18\x0f \x01(\tR\tdirection\x12%\n\x0eis_conditional\x18\x10 \x01(\x08R\risConditional\x12\x1d\n\ntrigger_at\x18\x11 \x01(\x04R\ttriggerAt\x12*\n\x11placed_order_hash\x18\x12 \x01(\tR\x0fplacedOrderHash\x12\x16\n\x06margin\x18\x13 \x01(\tR\x06margin\x12\x17\n\x07tx_hash\x18\x14 \x01(\tR\x06txHash\x12\x10\n\x03\x63id\x18\x15 \x01(\tR\x03\x63id\"\xdc\x01\n\x1aStreamOrdersHistoryRequest\x12#\n\rsubaccount_id\x18\x01 \x01(\tR\x0csubaccountId\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12\x1f\n\x0border_types\x18\x03 \x03(\tR\norderTypes\x12\x1c\n\tdirection\x18\x04 \x01(\tR\tdirection\x12\x14\n\x05state\x18\x05 \x01(\tR\x05state\x12\'\n\x0f\x65xecution_types\x18\x06 \x03(\tR\x0e\x65xecutionTypes\"\xb3\x01\n\x1bStreamOrdersHistoryResponse\x12O\n\x05order\x18\x01 \x01(\x0b\x32\x39.injective_derivative_exchange_rpc.DerivativeOrderHistoryR\x05order\x12%\n\x0eoperation_type\x18\x02 \x01(\tR\roperationType\x12\x1c\n\ttimestamp\x18\x03 \x01(\x12R\ttimestamp\"5\n\x13OpenInterestRequest\x12\x1e\n\x0bmarket_i_ds\x18\x01 \x03(\tR\tmarketIDs\"t\n\x14OpenInterestResponse\x12\\\n\x0eopen_interests\x18\x01 \x03(\x0b\x32\x35.injective_derivative_exchange_rpc.MarketOpenInterestR\ropenInterests\"V\n\x12MarketOpenInterest\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12#\n\ropen_interest\x18\x02 \x01(\tR\x0copenInterest2\xd8\x1c\n\x1eInjectiveDerivativeExchangeRPC\x12p\n\x07Markets\x12\x31.injective_derivative_exchange_rpc.MarketsRequest\x1a\x32.injective_derivative_exchange_rpc.MarketsResponse\x12m\n\x06Market\x12\x30.injective_derivative_exchange_rpc.MarketRequest\x1a\x31.injective_derivative_exchange_rpc.MarketResponse\x12\x81\x01\n\x0cStreamMarket\x12\x36.injective_derivative_exchange_rpc.StreamMarketRequest\x1a\x37.injective_derivative_exchange_rpc.StreamMarketResponse0\x01\x12\x97\x01\n\x14\x42inaryOptionsMarkets\x12>.injective_derivative_exchange_rpc.BinaryOptionsMarketsRequest\x1a?.injective_derivative_exchange_rpc.BinaryOptionsMarketsResponse\x12\x94\x01\n\x13\x42inaryOptionsMarket\x12=.injective_derivative_exchange_rpc.BinaryOptionsMarketRequest\x1a>.injective_derivative_exchange_rpc.BinaryOptionsMarketResponse\x12|\n\x0bOrderbookV2\x12\x35.injective_derivative_exchange_rpc.OrderbookV2Request\x1a\x36.injective_derivative_exchange_rpc.OrderbookV2Response\x12\x7f\n\x0cOrderbooksV2\x12\x36.injective_derivative_exchange_rpc.OrderbooksV2Request\x1a\x37.injective_derivative_exchange_rpc.OrderbooksV2Response\x12\x90\x01\n\x11StreamOrderbookV2\x12;.injective_derivative_exchange_rpc.StreamOrderbookV2Request\x1a<.injective_derivative_exchange_rpc.StreamOrderbookV2Response0\x01\x12\x9c\x01\n\x15StreamOrderbookUpdate\x12?.injective_derivative_exchange_rpc.StreamOrderbookUpdateRequest\x1a@.injective_derivative_exchange_rpc.StreamOrderbookUpdateResponse0\x01\x12m\n\x06Orders\x12\x30.injective_derivative_exchange_rpc.OrdersRequest\x1a\x31.injective_derivative_exchange_rpc.OrdersResponse\x12v\n\tPositions\x12\x33.injective_derivative_exchange_rpc.PositionsRequest\x1a\x34.injective_derivative_exchange_rpc.PositionsResponse\x12|\n\x0bPositionsV2\x12\x35.injective_derivative_exchange_rpc.PositionsV2Request\x1a\x36.injective_derivative_exchange_rpc.PositionsV2Response\x12\x94\x01\n\x13LiquidablePositions\x12=.injective_derivative_exchange_rpc.LiquidablePositionsRequest\x1a>.injective_derivative_exchange_rpc.LiquidablePositionsResponse\x12\x88\x01\n\x0f\x46undingPayments\x12\x39.injective_derivative_exchange_rpc.FundingPaymentsRequest\x1a:.injective_derivative_exchange_rpc.FundingPaymentsResponse\x12\x7f\n\x0c\x46undingRates\x12\x36.injective_derivative_exchange_rpc.FundingRatesRequest\x1a\x37.injective_derivative_exchange_rpc.FundingRatesResponse\x12\x8a\x01\n\x0fStreamPositions\x12\x39.injective_derivative_exchange_rpc.StreamPositionsRequest\x1a:.injective_derivative_exchange_rpc.StreamPositionsResponse0\x01\x12\x90\x01\n\x11StreamPositionsV2\x12;.injective_derivative_exchange_rpc.StreamPositionsV2Request\x1a<.injective_derivative_exchange_rpc.StreamPositionsV2Response0\x01\x12\x81\x01\n\x0cStreamOrders\x12\x36.injective_derivative_exchange_rpc.StreamOrdersRequest\x1a\x37.injective_derivative_exchange_rpc.StreamOrdersResponse0\x01\x12m\n\x06Trades\x12\x30.injective_derivative_exchange_rpc.TradesRequest\x1a\x31.injective_derivative_exchange_rpc.TradesResponse\x12s\n\x08TradesV2\x12\x32.injective_derivative_exchange_rpc.TradesV2Request\x1a\x33.injective_derivative_exchange_rpc.TradesV2Response\x12\x81\x01\n\x0cStreamTrades\x12\x36.injective_derivative_exchange_rpc.StreamTradesRequest\x1a\x37.injective_derivative_exchange_rpc.StreamTradesResponse0\x01\x12\x87\x01\n\x0eStreamTradesV2\x12\x38.injective_derivative_exchange_rpc.StreamTradesV2Request\x1a\x39.injective_derivative_exchange_rpc.StreamTradesV2Response0\x01\x12\x97\x01\n\x14SubaccountOrdersList\x12>.injective_derivative_exchange_rpc.SubaccountOrdersListRequest\x1a?.injective_derivative_exchange_rpc.SubaccountOrdersListResponse\x12\x97\x01\n\x14SubaccountTradesList\x12>.injective_derivative_exchange_rpc.SubaccountTradesListRequest\x1a?.injective_derivative_exchange_rpc.SubaccountTradesListResponse\x12\x82\x01\n\rOrdersHistory\x12\x37.injective_derivative_exchange_rpc.OrdersHistoryRequest\x1a\x38.injective_derivative_exchange_rpc.OrdersHistoryResponse\x12\x96\x01\n\x13StreamOrdersHistory\x12=.injective_derivative_exchange_rpc.StreamOrdersHistoryRequest\x1a>.injective_derivative_exchange_rpc.StreamOrdersHistoryResponse0\x01\x12\x7f\n\x0cOpenInterest\x12\x36.injective_derivative_exchange_rpc.OpenInterestRequest\x1a\x37.injective_derivative_exchange_rpc.OpenInterestResponseB\x8a\x02\n%com.injective_derivative_exchange_rpcB#InjectiveDerivativeExchangeRpcProtoP\x01Z$/injective_derivative_exchange_rpcpb\xa2\x02\x03IXX\xaa\x02\x1eInjectiveDerivativeExchangeRpc\xca\x02\x1eInjectiveDerivativeExchangeRpc\xe2\x02*InjectiveDerivativeExchangeRpc\\GPBMetadata\xea\x02\x1eInjectiveDerivativeExchangeRpcb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n0exchange/injective_derivative_exchange_rpc.proto\x12!injective_derivative_exchange_rpc\"\x7f\n\x0eMarketsRequest\x12#\n\rmarket_status\x18\x01 \x01(\tR\x0cmarketStatus\x12\x1f\n\x0bquote_denom\x18\x02 \x01(\tR\nquoteDenom\x12\'\n\x0fmarket_statuses\x18\x03 \x03(\tR\x0emarketStatuses\"d\n\x0fMarketsResponse\x12Q\n\x07markets\x18\x01 \x03(\x0b\x32\x37.injective_derivative_exchange_rpc.DerivativeMarketInfoR\x07markets\"\x9c\t\n\x14\x44\x65rivativeMarketInfo\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12#\n\rmarket_status\x18\x02 \x01(\tR\x0cmarketStatus\x12\x16\n\x06ticker\x18\x03 \x01(\tR\x06ticker\x12\x1f\n\x0boracle_base\x18\x04 \x01(\tR\noracleBase\x12!\n\x0coracle_quote\x18\x05 \x01(\tR\x0boracleQuote\x12\x1f\n\x0boracle_type\x18\x06 \x01(\tR\noracleType\x12.\n\x13oracle_scale_factor\x18\x07 \x01(\rR\x11oracleScaleFactor\x12\x30\n\x14initial_margin_ratio\x18\x08 \x01(\tR\x12initialMarginRatio\x12\x38\n\x18maintenance_margin_ratio\x18\t \x01(\tR\x16maintenanceMarginRatio\x12\x1f\n\x0bquote_denom\x18\n \x01(\tR\nquoteDenom\x12V\n\x10quote_token_meta\x18\x0b \x01(\x0b\x32,.injective_derivative_exchange_rpc.TokenMetaR\x0equoteTokenMeta\x12$\n\x0emaker_fee_rate\x18\x0c \x01(\tR\x0cmakerFeeRate\x12$\n\x0etaker_fee_rate\x18\r \x01(\tR\x0ctakerFeeRate\x12\x30\n\x14service_provider_fee\x18\x0e \x01(\tR\x12serviceProviderFee\x12!\n\x0cis_perpetual\x18\x0f \x01(\x08R\x0bisPerpetual\x12-\n\x13min_price_tick_size\x18\x10 \x01(\tR\x10minPriceTickSize\x12\x33\n\x16min_quantity_tick_size\x18\x11 \x01(\tR\x13minQuantityTickSize\x12j\n\x15perpetual_market_info\x18\x12 \x01(\x0b\x32\x36.injective_derivative_exchange_rpc.PerpetualMarketInfoR\x13perpetualMarketInfo\x12s\n\x18perpetual_market_funding\x18\x13 \x01(\x0b\x32\x39.injective_derivative_exchange_rpc.PerpetualMarketFundingR\x16perpetualMarketFunding\x12w\n\x1a\x65xpiry_futures_market_info\x18\x14 \x01(\x0b\x32:.injective_derivative_exchange_rpc.ExpiryFuturesMarketInfoR\x17\x65xpiryFuturesMarketInfo\x12!\n\x0cmin_notional\x18\x15 \x01(\tR\x0bminNotional\x12.\n\x13reduce_margin_ratio\x18\x16 \x01(\tR\x11reduceMarginRatio\"\xa0\x01\n\tTokenMeta\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x18\n\x07\x61\x64\x64ress\x18\x02 \x01(\tR\x07\x61\x64\x64ress\x12\x16\n\x06symbol\x18\x03 \x01(\tR\x06symbol\x12\x12\n\x04logo\x18\x04 \x01(\tR\x04logo\x12\x1a\n\x08\x64\x65\x63imals\x18\x05 \x01(\x11R\x08\x64\x65\x63imals\x12\x1d\n\nupdated_at\x18\x06 \x01(\x12R\tupdatedAt\"\xdf\x01\n\x13PerpetualMarketInfo\x12\x35\n\x17hourly_funding_rate_cap\x18\x01 \x01(\tR\x14hourlyFundingRateCap\x12\x30\n\x14hourly_interest_rate\x18\x02 \x01(\tR\x12hourlyInterestRate\x12\x34\n\x16next_funding_timestamp\x18\x03 \x01(\x12R\x14nextFundingTimestamp\x12)\n\x10\x66unding_interval\x18\x04 \x01(\x12R\x0f\x66undingInterval\"\xc5\x01\n\x16PerpetualMarketFunding\x12-\n\x12\x63umulative_funding\x18\x01 \x01(\tR\x11\x63umulativeFunding\x12)\n\x10\x63umulative_price\x18\x02 \x01(\tR\x0f\x63umulativePrice\x12%\n\x0elast_timestamp\x18\x03 \x01(\x12R\rlastTimestamp\x12*\n\x11last_funding_rate\x18\x04 \x01(\tR\x0flastFundingRate\"w\n\x17\x45xpiryFuturesMarketInfo\x12\x31\n\x14\x65xpiration_timestamp\x18\x01 \x01(\x12R\x13\x65xpirationTimestamp\x12)\n\x10settlement_price\x18\x02 \x01(\tR\x0fsettlementPrice\",\n\rMarketRequest\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\"a\n\x0eMarketResponse\x12O\n\x06market\x18\x01 \x01(\x0b\x32\x37.injective_derivative_exchange_rpc.DerivativeMarketInfoR\x06market\"4\n\x13StreamMarketRequest\x12\x1d\n\nmarket_ids\x18\x01 \x03(\tR\tmarketIds\"\xac\x01\n\x14StreamMarketResponse\x12O\n\x06market\x18\x01 \x01(\x0b\x32\x37.injective_derivative_exchange_rpc.DerivativeMarketInfoR\x06market\x12%\n\x0eoperation_type\x18\x02 \x01(\tR\roperationType\x12\x1c\n\ttimestamp\x18\x03 \x01(\x12R\ttimestamp\"\x8d\x01\n\x1b\x42inaryOptionsMarketsRequest\x12#\n\rmarket_status\x18\x01 \x01(\tR\x0cmarketStatus\x12\x1f\n\x0bquote_denom\x18\x02 \x01(\tR\nquoteDenom\x12\x12\n\x04skip\x18\x03 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x04 \x01(\x11R\x05limit\"\xb7\x01\n\x1c\x42inaryOptionsMarketsResponse\x12T\n\x07markets\x18\x01 \x03(\x0b\x32:.injective_derivative_exchange_rpc.BinaryOptionsMarketInfoR\x07markets\x12\x41\n\x06paging\x18\x02 \x01(\x0b\x32).injective_derivative_exchange_rpc.PagingR\x06paging\"\xa1\x06\n\x17\x42inaryOptionsMarketInfo\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12#\n\rmarket_status\x18\x02 \x01(\tR\x0cmarketStatus\x12\x16\n\x06ticker\x18\x03 \x01(\tR\x06ticker\x12#\n\roracle_symbol\x18\x04 \x01(\tR\x0coracleSymbol\x12\'\n\x0foracle_provider\x18\x05 \x01(\tR\x0eoracleProvider\x12\x1f\n\x0boracle_type\x18\x06 \x01(\tR\noracleType\x12.\n\x13oracle_scale_factor\x18\x07 \x01(\rR\x11oracleScaleFactor\x12\x31\n\x14\x65xpiration_timestamp\x18\x08 \x01(\x12R\x13\x65xpirationTimestamp\x12\x31\n\x14settlement_timestamp\x18\t \x01(\x12R\x13settlementTimestamp\x12\x1f\n\x0bquote_denom\x18\n \x01(\tR\nquoteDenom\x12V\n\x10quote_token_meta\x18\x0b \x01(\x0b\x32,.injective_derivative_exchange_rpc.TokenMetaR\x0equoteTokenMeta\x12$\n\x0emaker_fee_rate\x18\x0c \x01(\tR\x0cmakerFeeRate\x12$\n\x0etaker_fee_rate\x18\r \x01(\tR\x0ctakerFeeRate\x12\x30\n\x14service_provider_fee\x18\x0e \x01(\tR\x12serviceProviderFee\x12-\n\x13min_price_tick_size\x18\x0f \x01(\tR\x10minPriceTickSize\x12\x33\n\x16min_quantity_tick_size\x18\x10 \x01(\tR\x13minQuantityTickSize\x12)\n\x10settlement_price\x18\x11 \x01(\tR\x0fsettlementPrice\x12!\n\x0cmin_notional\x18\x12 \x01(\tR\x0bminNotional\"\x86\x01\n\x06Paging\x12\x14\n\x05total\x18\x01 \x01(\x12R\x05total\x12\x12\n\x04\x66rom\x18\x02 \x01(\x11R\x04\x66rom\x12\x0e\n\x02to\x18\x03 \x01(\x11R\x02to\x12.\n\x13\x63ount_by_subaccount\x18\x04 \x01(\x12R\x11\x63ountBySubaccount\x12\x12\n\x04next\x18\x05 \x03(\tR\x04next\"9\n\x1a\x42inaryOptionsMarketRequest\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\"q\n\x1b\x42inaryOptionsMarketResponse\x12R\n\x06market\x18\x01 \x01(\x0b\x32:.injective_derivative_exchange_rpc.BinaryOptionsMarketInfoR\x06market\"G\n\x12OrderbookV2Request\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12\x14\n\x05\x64\x65pth\x18\x02 \x01(\x11R\x05\x64\x65pth\"r\n\x13OrderbookV2Response\x12[\n\torderbook\x18\x01 \x01(\x0b\x32=.injective_derivative_exchange_rpc.DerivativeLimitOrderbookV2R\torderbook\"\xde\x01\n\x1a\x44\x65rivativeLimitOrderbookV2\x12\x41\n\x04\x62uys\x18\x01 \x03(\x0b\x32-.injective_derivative_exchange_rpc.PriceLevelR\x04\x62uys\x12\x43\n\x05sells\x18\x02 \x03(\x0b\x32-.injective_derivative_exchange_rpc.PriceLevelR\x05sells\x12\x1a\n\x08sequence\x18\x03 \x01(\x04R\x08sequence\x12\x1c\n\ttimestamp\x18\x04 \x01(\x12R\ttimestamp\"\\\n\nPriceLevel\x12\x14\n\x05price\x18\x01 \x01(\tR\x05price\x12\x1a\n\x08quantity\x18\x02 \x01(\tR\x08quantity\x12\x1c\n\ttimestamp\x18\x03 \x01(\x12R\ttimestamp\"J\n\x13OrderbooksV2Request\x12\x1d\n\nmarket_ids\x18\x01 \x03(\tR\tmarketIds\x12\x14\n\x05\x64\x65pth\x18\x02 \x01(\x11R\x05\x64\x65pth\"{\n\x14OrderbooksV2Response\x12\x63\n\norderbooks\x18\x01 \x03(\x0b\x32\x43.injective_derivative_exchange_rpc.SingleDerivativeLimitOrderbookV2R\norderbooks\"\x9c\x01\n SingleDerivativeLimitOrderbookV2\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12[\n\torderbook\x18\x02 \x01(\x0b\x32=.injective_derivative_exchange_rpc.DerivativeLimitOrderbookV2R\torderbook\"9\n\x18StreamOrderbookV2Request\x12\x1d\n\nmarket_ids\x18\x01 \x03(\tR\tmarketIds\"\xda\x01\n\x19StreamOrderbookV2Response\x12[\n\torderbook\x18\x01 \x01(\x0b\x32=.injective_derivative_exchange_rpc.DerivativeLimitOrderbookV2R\torderbook\x12%\n\x0eoperation_type\x18\x02 \x01(\tR\roperationType\x12\x1c\n\ttimestamp\x18\x03 \x01(\x12R\ttimestamp\x12\x1b\n\tmarket_id\x18\x04 \x01(\tR\x08marketId\"=\n\x1cStreamOrderbookUpdateRequest\x12\x1d\n\nmarket_ids\x18\x01 \x03(\tR\tmarketIds\"\xf3\x01\n\x1dStreamOrderbookUpdateResponse\x12p\n\x17orderbook_level_updates\x18\x01 \x01(\x0b\x32\x38.injective_derivative_exchange_rpc.OrderbookLevelUpdatesR\x15orderbookLevelUpdates\x12%\n\x0eoperation_type\x18\x02 \x01(\tR\roperationType\x12\x1c\n\ttimestamp\x18\x03 \x01(\x12R\ttimestamp\x12\x1b\n\tmarket_id\x18\x04 \x01(\tR\x08marketId\"\x83\x02\n\x15OrderbookLevelUpdates\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12\x1a\n\x08sequence\x18\x02 \x01(\x04R\x08sequence\x12G\n\x04\x62uys\x18\x03 \x03(\x0b\x32\x33.injective_derivative_exchange_rpc.PriceLevelUpdateR\x04\x62uys\x12I\n\x05sells\x18\x04 \x03(\x0b\x32\x33.injective_derivative_exchange_rpc.PriceLevelUpdateR\x05sells\x12\x1d\n\nupdated_at\x18\x05 \x01(\x12R\tupdatedAt\"\x7f\n\x10PriceLevelUpdate\x12\x14\n\x05price\x18\x01 \x01(\tR\x05price\x12\x1a\n\x08quantity\x18\x02 \x01(\tR\x08quantity\x12\x1b\n\tis_active\x18\x03 \x01(\x08R\x08isActive\x12\x1c\n\ttimestamp\x18\x04 \x01(\x12R\ttimestamp\"\xc9\x03\n\rOrdersRequest\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12\x1d\n\norder_side\x18\x02 \x01(\tR\torderSide\x12#\n\rsubaccount_id\x18\x03 \x01(\tR\x0csubaccountId\x12\x12\n\x04skip\x18\x04 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x05 \x01(\x11R\x05limit\x12\x1d\n\nstart_time\x18\x06 \x01(\x12R\tstartTime\x12\x19\n\x08\x65nd_time\x18\x07 \x01(\x12R\x07\x65ndTime\x12\x1d\n\nmarket_ids\x18\x08 \x03(\tR\tmarketIds\x12%\n\x0eis_conditional\x18\t \x01(\tR\risConditional\x12\x1d\n\norder_type\x18\n \x01(\tR\torderType\x12)\n\x10include_inactive\x18\x0b \x01(\x08R\x0fincludeInactive\x12\x36\n\x17subaccount_total_orders\x18\x0c \x01(\x08R\x15subaccountTotalOrders\x12\x19\n\x08trade_id\x18\r \x01(\tR\x07tradeId\x12\x10\n\x03\x63id\x18\x0e \x01(\tR\x03\x63id\"\xa4\x01\n\x0eOrdersResponse\x12O\n\x06orders\x18\x01 \x03(\x0b\x32\x37.injective_derivative_exchange_rpc.DerivativeLimitOrderR\x06orders\x12\x41\n\x06paging\x18\x02 \x01(\x0b\x32).injective_derivative_exchange_rpc.PagingR\x06paging\"\xd7\x05\n\x14\x44\x65rivativeLimitOrder\x12\x1d\n\norder_hash\x18\x01 \x01(\tR\torderHash\x12\x1d\n\norder_side\x18\x02 \x01(\tR\torderSide\x12\x1b\n\tmarket_id\x18\x03 \x01(\tR\x08marketId\x12#\n\rsubaccount_id\x18\x04 \x01(\tR\x0csubaccountId\x12$\n\x0eis_reduce_only\x18\x05 \x01(\x08R\x0cisReduceOnly\x12\x16\n\x06margin\x18\x06 \x01(\tR\x06margin\x12\x14\n\x05price\x18\x07 \x01(\tR\x05price\x12\x1a\n\x08quantity\x18\x08 \x01(\tR\x08quantity\x12+\n\x11unfilled_quantity\x18\t \x01(\tR\x10unfilledQuantity\x12#\n\rtrigger_price\x18\n \x01(\tR\x0ctriggerPrice\x12#\n\rfee_recipient\x18\x0b \x01(\tR\x0c\x66\x65\x65Recipient\x12\x14\n\x05state\x18\x0c \x01(\tR\x05state\x12\x1d\n\ncreated_at\x18\r \x01(\x12R\tcreatedAt\x12\x1d\n\nupdated_at\x18\x0e \x01(\x12R\tupdatedAt\x12!\n\x0corder_number\x18\x0f \x01(\x12R\x0borderNumber\x12\x1d\n\norder_type\x18\x10 \x01(\tR\torderType\x12%\n\x0eis_conditional\x18\x11 \x01(\x08R\risConditional\x12\x1d\n\ntrigger_at\x18\x12 \x01(\x04R\ttriggerAt\x12*\n\x11placed_order_hash\x18\x13 \x01(\tR\x0fplacedOrderHash\x12%\n\x0e\x65xecution_type\x18\x14 \x01(\tR\rexecutionType\x12\x17\n\x07tx_hash\x18\x15 \x01(\tR\x06txHash\x12\x10\n\x03\x63id\x18\x16 \x01(\tR\x03\x63id\"\xdc\x02\n\x10PositionsRequest\x12#\n\rsubaccount_id\x18\x01 \x01(\tR\x0csubaccountId\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12\x12\n\x04skip\x18\x03 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x04 \x01(\x11R\x05limit\x12\x1d\n\nstart_time\x18\x05 \x01(\x12R\tstartTime\x12\x19\n\x08\x65nd_time\x18\x06 \x01(\x12R\x07\x65ndTime\x12\x1d\n\nmarket_ids\x18\x07 \x03(\tR\tmarketIds\x12\x1c\n\tdirection\x18\x08 \x01(\tR\tdirection\x12<\n\x1asubaccount_total_positions\x18\t \x01(\x08R\x18subaccountTotalPositions\x12\'\n\x0f\x61\x63\x63ount_address\x18\n \x01(\tR\x0e\x61\x63\x63ountAddress\"\xab\x01\n\x11PositionsResponse\x12S\n\tpositions\x18\x01 \x03(\x0b\x32\x35.injective_derivative_exchange_rpc.DerivativePositionR\tpositions\x12\x41\n\x06paging\x18\x02 \x01(\x0b\x32).injective_derivative_exchange_rpc.PagingR\x06paging\"\xb0\x03\n\x12\x44\x65rivativePosition\x12\x16\n\x06ticker\x18\x01 \x01(\tR\x06ticker\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12#\n\rsubaccount_id\x18\x03 \x01(\tR\x0csubaccountId\x12\x1c\n\tdirection\x18\x04 \x01(\tR\tdirection\x12\x1a\n\x08quantity\x18\x05 \x01(\tR\x08quantity\x12\x1f\n\x0b\x65ntry_price\x18\x06 \x01(\tR\nentryPrice\x12\x16\n\x06margin\x18\x07 \x01(\tR\x06margin\x12+\n\x11liquidation_price\x18\x08 \x01(\tR\x10liquidationPrice\x12\x1d\n\nmark_price\x18\t \x01(\tR\tmarkPrice\x12\x43\n\x1e\x61ggregate_reduce_only_quantity\x18\x0b \x01(\tR\x1b\x61ggregateReduceOnlyQuantity\x12\x1d\n\nupdated_at\x18\x0c \x01(\x12R\tupdatedAt\x12\x1d\n\ncreated_at\x18\r \x01(\x12R\tcreatedAt\"\xde\x02\n\x12PositionsV2Request\x12#\n\rsubaccount_id\x18\x01 \x01(\tR\x0csubaccountId\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12\x12\n\x04skip\x18\x03 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x04 \x01(\x11R\x05limit\x12\x1d\n\nstart_time\x18\x05 \x01(\x12R\tstartTime\x12\x19\n\x08\x65nd_time\x18\x06 \x01(\x12R\x07\x65ndTime\x12\x1d\n\nmarket_ids\x18\x07 \x03(\tR\tmarketIds\x12\x1c\n\tdirection\x18\x08 \x01(\tR\tdirection\x12<\n\x1asubaccount_total_positions\x18\t \x01(\x08R\x18subaccountTotalPositions\x12\'\n\x0f\x61\x63\x63ount_address\x18\n \x01(\tR\x0e\x61\x63\x63ountAddress\"\xaf\x01\n\x13PositionsV2Response\x12U\n\tpositions\x18\x01 \x03(\x0b\x32\x37.injective_derivative_exchange_rpc.DerivativePositionV2R\tpositions\x12\x41\n\x06paging\x18\x02 \x01(\x0b\x32).injective_derivative_exchange_rpc.PagingR\x06paging\"\xe4\x02\n\x14\x44\x65rivativePositionV2\x12\x16\n\x06ticker\x18\x01 \x01(\tR\x06ticker\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12#\n\rsubaccount_id\x18\x03 \x01(\tR\x0csubaccountId\x12\x1c\n\tdirection\x18\x04 \x01(\tR\tdirection\x12\x1a\n\x08quantity\x18\x05 \x01(\tR\x08quantity\x12\x1f\n\x0b\x65ntry_price\x18\x06 \x01(\tR\nentryPrice\x12\x16\n\x06margin\x18\x07 \x01(\tR\x06margin\x12+\n\x11liquidation_price\x18\x08 \x01(\tR\x10liquidationPrice\x12\x1d\n\nmark_price\x18\t \x01(\tR\tmarkPrice\x12\x1d\n\nupdated_at\x18\x0b \x01(\x12R\tupdatedAt\x12\x14\n\x05\x64\x65nom\x18\x0c \x01(\tR\x05\x64\x65nom\"c\n\x1aLiquidablePositionsRequest\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12\x12\n\x04skip\x18\x02 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x03 \x01(\x11R\x05limit\"r\n\x1bLiquidablePositionsResponse\x12S\n\tpositions\x18\x01 \x03(\x0b\x32\x35.injective_derivative_exchange_rpc.DerivativePositionR\tpositions\"\xbe\x01\n\x16\x46undingPaymentsRequest\x12#\n\rsubaccount_id\x18\x01 \x01(\tR\x0csubaccountId\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12\x12\n\x04skip\x18\x03 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x04 \x01(\x11R\x05limit\x12\x19\n\x08\x65nd_time\x18\x05 \x01(\x12R\x07\x65ndTime\x12\x1d\n\nmarket_ids\x18\x06 \x03(\tR\tmarketIds\"\xab\x01\n\x17\x46undingPaymentsResponse\x12M\n\x08payments\x18\x01 \x03(\x0b\x32\x31.injective_derivative_exchange_rpc.FundingPaymentR\x08payments\x12\x41\n\x06paging\x18\x02 \x01(\x0b\x32).injective_derivative_exchange_rpc.PagingR\x06paging\"\x88\x01\n\x0e\x46undingPayment\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12#\n\rsubaccount_id\x18\x02 \x01(\tR\x0csubaccountId\x12\x16\n\x06\x61mount\x18\x03 \x01(\tR\x06\x61mount\x12\x1c\n\ttimestamp\x18\x04 \x01(\x12R\ttimestamp\"w\n\x13\x46undingRatesRequest\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12\x12\n\x04skip\x18\x02 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x03 \x01(\x11R\x05limit\x12\x19\n\x08\x65nd_time\x18\x04 \x01(\x12R\x07\x65ndTime\"\xae\x01\n\x14\x46undingRatesResponse\x12S\n\rfunding_rates\x18\x01 \x03(\x0b\x32..injective_derivative_exchange_rpc.FundingRateR\x0c\x66undingRates\x12\x41\n\x06paging\x18\x02 \x01(\x0b\x32).injective_derivative_exchange_rpc.PagingR\x06paging\"\\\n\x0b\x46undingRate\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12\x12\n\x04rate\x18\x02 \x01(\tR\x04rate\x12\x1c\n\ttimestamp\x18\x03 \x01(\x12R\ttimestamp\"\xc9\x01\n\x16StreamPositionsRequest\x12#\n\rsubaccount_id\x18\x01 \x01(\tR\x0csubaccountId\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12\x1d\n\nmarket_ids\x18\x03 \x03(\tR\tmarketIds\x12%\n\x0esubaccount_ids\x18\x04 \x03(\tR\rsubaccountIds\x12\'\n\x0f\x61\x63\x63ount_address\x18\x05 \x01(\tR\x0e\x61\x63\x63ountAddress\"\x8a\x01\n\x17StreamPositionsResponse\x12Q\n\x08position\x18\x01 \x01(\x0b\x32\x35.injective_derivative_exchange_rpc.DerivativePositionR\x08position\x12\x1c\n\ttimestamp\x18\x02 \x01(\x12R\ttimestamp\"\xcb\x01\n\x18StreamPositionsV2Request\x12#\n\rsubaccount_id\x18\x01 \x01(\tR\x0csubaccountId\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12\x1d\n\nmarket_ids\x18\x03 \x03(\tR\tmarketIds\x12%\n\x0esubaccount_ids\x18\x04 \x03(\tR\rsubaccountIds\x12\'\n\x0f\x61\x63\x63ount_address\x18\x05 \x01(\tR\x0e\x61\x63\x63ountAddress\"\x8e\x01\n\x19StreamPositionsV2Response\x12S\n\x08position\x18\x01 \x01(\x0b\x32\x37.injective_derivative_exchange_rpc.DerivativePositionV2R\x08position\x12\x1c\n\ttimestamp\x18\x02 \x01(\x12R\ttimestamp\"\xcf\x03\n\x13StreamOrdersRequest\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12\x1d\n\norder_side\x18\x02 \x01(\tR\torderSide\x12#\n\rsubaccount_id\x18\x03 \x01(\tR\x0csubaccountId\x12\x12\n\x04skip\x18\x04 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x05 \x01(\x11R\x05limit\x12\x1d\n\nstart_time\x18\x06 \x01(\x12R\tstartTime\x12\x19\n\x08\x65nd_time\x18\x07 \x01(\x12R\x07\x65ndTime\x12\x1d\n\nmarket_ids\x18\x08 \x03(\tR\tmarketIds\x12%\n\x0eis_conditional\x18\t \x01(\tR\risConditional\x12\x1d\n\norder_type\x18\n \x01(\tR\torderType\x12)\n\x10include_inactive\x18\x0b \x01(\x08R\x0fincludeInactive\x12\x36\n\x17subaccount_total_orders\x18\x0c \x01(\x08R\x15subaccountTotalOrders\x12\x19\n\x08trade_id\x18\r \x01(\tR\x07tradeId\x12\x10\n\x03\x63id\x18\x0e \x01(\tR\x03\x63id\"\xaa\x01\n\x14StreamOrdersResponse\x12M\n\x05order\x18\x01 \x01(\x0b\x32\x37.injective_derivative_exchange_rpc.DerivativeLimitOrderR\x05order\x12%\n\x0eoperation_type\x18\x02 \x01(\tR\roperationType\x12\x1c\n\ttimestamp\x18\x03 \x01(\x12R\ttimestamp\"\xe4\x03\n\rTradesRequest\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12%\n\x0e\x65xecution_side\x18\x02 \x01(\tR\rexecutionSide\x12\x1c\n\tdirection\x18\x03 \x01(\tR\tdirection\x12#\n\rsubaccount_id\x18\x04 \x01(\tR\x0csubaccountId\x12\x12\n\x04skip\x18\x05 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x06 \x01(\x11R\x05limit\x12\x1d\n\nstart_time\x18\x07 \x01(\x12R\tstartTime\x12\x19\n\x08\x65nd_time\x18\x08 \x01(\x12R\x07\x65ndTime\x12\x1d\n\nmarket_ids\x18\t \x03(\tR\tmarketIds\x12%\n\x0esubaccount_ids\x18\n \x03(\tR\rsubaccountIds\x12\'\n\x0f\x65xecution_types\x18\x0b \x03(\tR\x0e\x65xecutionTypes\x12\x19\n\x08trade_id\x18\x0c \x01(\tR\x07tradeId\x12\'\n\x0f\x61\x63\x63ount_address\x18\r \x01(\tR\x0e\x61\x63\x63ountAddress\x12\x10\n\x03\x63id\x18\x0e \x01(\tR\x03\x63id\x12#\n\rfee_recipient\x18\x0f \x01(\tR\x0c\x66\x65\x65Recipient\"\x9f\x01\n\x0eTradesResponse\x12J\n\x06trades\x18\x01 \x03(\x0b\x32\x32.injective_derivative_exchange_rpc.DerivativeTradeR\x06trades\x12\x41\n\x06paging\x18\x02 \x01(\x0b\x32).injective_derivative_exchange_rpc.PagingR\x06paging\"\xe8\x03\n\x0f\x44\x65rivativeTrade\x12\x1d\n\norder_hash\x18\x01 \x01(\tR\torderHash\x12#\n\rsubaccount_id\x18\x02 \x01(\tR\x0csubaccountId\x12\x1b\n\tmarket_id\x18\x03 \x01(\tR\x08marketId\x12\x30\n\x14trade_execution_type\x18\x04 \x01(\tR\x12tradeExecutionType\x12%\n\x0eis_liquidation\x18\x05 \x01(\x08R\risLiquidation\x12W\n\x0eposition_delta\x18\x06 \x01(\x0b\x32\x30.injective_derivative_exchange_rpc.PositionDeltaR\rpositionDelta\x12\x16\n\x06payout\x18\x07 \x01(\tR\x06payout\x12\x10\n\x03\x66\x65\x65\x18\x08 \x01(\tR\x03\x66\x65\x65\x12\x1f\n\x0b\x65xecuted_at\x18\t \x01(\x12R\nexecutedAt\x12#\n\rfee_recipient\x18\n \x01(\tR\x0c\x66\x65\x65Recipient\x12\x19\n\x08trade_id\x18\x0b \x01(\tR\x07tradeId\x12%\n\x0e\x65xecution_side\x18\x0c \x01(\tR\rexecutionSide\x12\x10\n\x03\x63id\x18\r \x01(\tR\x03\x63id\"\xbb\x01\n\rPositionDelta\x12\'\n\x0ftrade_direction\x18\x01 \x01(\tR\x0etradeDirection\x12\'\n\x0f\x65xecution_price\x18\x02 \x01(\tR\x0e\x65xecutionPrice\x12-\n\x12\x65xecution_quantity\x18\x03 \x01(\tR\x11\x65xecutionQuantity\x12)\n\x10\x65xecution_margin\x18\x04 \x01(\tR\x0f\x65xecutionMargin\"\xe6\x03\n\x0fTradesV2Request\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12%\n\x0e\x65xecution_side\x18\x02 \x01(\tR\rexecutionSide\x12\x1c\n\tdirection\x18\x03 \x01(\tR\tdirection\x12#\n\rsubaccount_id\x18\x04 \x01(\tR\x0csubaccountId\x12\x12\n\x04skip\x18\x05 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x06 \x01(\x11R\x05limit\x12\x1d\n\nstart_time\x18\x07 \x01(\x12R\tstartTime\x12\x19\n\x08\x65nd_time\x18\x08 \x01(\x12R\x07\x65ndTime\x12\x1d\n\nmarket_ids\x18\t \x03(\tR\tmarketIds\x12%\n\x0esubaccount_ids\x18\n \x03(\tR\rsubaccountIds\x12\'\n\x0f\x65xecution_types\x18\x0b \x03(\tR\x0e\x65xecutionTypes\x12\x19\n\x08trade_id\x18\x0c \x01(\tR\x07tradeId\x12\'\n\x0f\x61\x63\x63ount_address\x18\r \x01(\tR\x0e\x61\x63\x63ountAddress\x12\x10\n\x03\x63id\x18\x0e \x01(\tR\x03\x63id\x12#\n\rfee_recipient\x18\x0f \x01(\tR\x0c\x66\x65\x65Recipient\"\xa1\x01\n\x10TradesV2Response\x12J\n\x06trades\x18\x01 \x03(\x0b\x32\x32.injective_derivative_exchange_rpc.DerivativeTradeR\x06trades\x12\x41\n\x06paging\x18\x02 \x01(\x0b\x32).injective_derivative_exchange_rpc.PagingR\x06paging\"\xea\x03\n\x13StreamTradesRequest\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12%\n\x0e\x65xecution_side\x18\x02 \x01(\tR\rexecutionSide\x12\x1c\n\tdirection\x18\x03 \x01(\tR\tdirection\x12#\n\rsubaccount_id\x18\x04 \x01(\tR\x0csubaccountId\x12\x12\n\x04skip\x18\x05 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x06 \x01(\x11R\x05limit\x12\x1d\n\nstart_time\x18\x07 \x01(\x12R\tstartTime\x12\x19\n\x08\x65nd_time\x18\x08 \x01(\x12R\x07\x65ndTime\x12\x1d\n\nmarket_ids\x18\t \x03(\tR\tmarketIds\x12%\n\x0esubaccount_ids\x18\n \x03(\tR\rsubaccountIds\x12\'\n\x0f\x65xecution_types\x18\x0b \x03(\tR\x0e\x65xecutionTypes\x12\x19\n\x08trade_id\x18\x0c \x01(\tR\x07tradeId\x12\'\n\x0f\x61\x63\x63ount_address\x18\r \x01(\tR\x0e\x61\x63\x63ountAddress\x12\x10\n\x03\x63id\x18\x0e \x01(\tR\x03\x63id\x12#\n\rfee_recipient\x18\x0f \x01(\tR\x0c\x66\x65\x65Recipient\"\xa5\x01\n\x14StreamTradesResponse\x12H\n\x05trade\x18\x01 \x01(\x0b\x32\x32.injective_derivative_exchange_rpc.DerivativeTradeR\x05trade\x12%\n\x0eoperation_type\x18\x02 \x01(\tR\roperationType\x12\x1c\n\ttimestamp\x18\x03 \x01(\x12R\ttimestamp\"\xec\x03\n\x15StreamTradesV2Request\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12%\n\x0e\x65xecution_side\x18\x02 \x01(\tR\rexecutionSide\x12\x1c\n\tdirection\x18\x03 \x01(\tR\tdirection\x12#\n\rsubaccount_id\x18\x04 \x01(\tR\x0csubaccountId\x12\x12\n\x04skip\x18\x05 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x06 \x01(\x11R\x05limit\x12\x1d\n\nstart_time\x18\x07 \x01(\x12R\tstartTime\x12\x19\n\x08\x65nd_time\x18\x08 \x01(\x12R\x07\x65ndTime\x12\x1d\n\nmarket_ids\x18\t \x03(\tR\tmarketIds\x12%\n\x0esubaccount_ids\x18\n \x03(\tR\rsubaccountIds\x12\'\n\x0f\x65xecution_types\x18\x0b \x03(\tR\x0e\x65xecutionTypes\x12\x19\n\x08trade_id\x18\x0c \x01(\tR\x07tradeId\x12\'\n\x0f\x61\x63\x63ount_address\x18\r \x01(\tR\x0e\x61\x63\x63ountAddress\x12\x10\n\x03\x63id\x18\x0e \x01(\tR\x03\x63id\x12#\n\rfee_recipient\x18\x0f \x01(\tR\x0c\x66\x65\x65Recipient\"\xa7\x01\n\x16StreamTradesV2Response\x12H\n\x05trade\x18\x01 \x01(\x0b\x32\x32.injective_derivative_exchange_rpc.DerivativeTradeR\x05trade\x12%\n\x0eoperation_type\x18\x02 \x01(\tR\roperationType\x12\x1c\n\ttimestamp\x18\x03 \x01(\x12R\ttimestamp\"\x89\x01\n\x1bSubaccountOrdersListRequest\x12#\n\rsubaccount_id\x18\x01 \x01(\tR\x0csubaccountId\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12\x12\n\x04skip\x18\x03 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x04 \x01(\x11R\x05limit\"\xb2\x01\n\x1cSubaccountOrdersListResponse\x12O\n\x06orders\x18\x01 \x03(\x0b\x32\x37.injective_derivative_exchange_rpc.DerivativeLimitOrderR\x06orders\x12\x41\n\x06paging\x18\x02 \x01(\x0b\x32).injective_derivative_exchange_rpc.PagingR\x06paging\"\xce\x01\n\x1bSubaccountTradesListRequest\x12#\n\rsubaccount_id\x18\x01 \x01(\tR\x0csubaccountId\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12%\n\x0e\x65xecution_type\x18\x03 \x01(\tR\rexecutionType\x12\x1c\n\tdirection\x18\x04 \x01(\tR\tdirection\x12\x12\n\x04skip\x18\x05 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x06 \x01(\x11R\x05limit\"j\n\x1cSubaccountTradesListResponse\x12J\n\x06trades\x18\x01 \x03(\x0b\x32\x32.injective_derivative_exchange_rpc.DerivativeTradeR\x06trades\"\xfc\x03\n\x14OrdersHistoryRequest\x12#\n\rsubaccount_id\x18\x01 \x01(\tR\x0csubaccountId\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12\x12\n\x04skip\x18\x03 \x01(\x04R\x04skip\x12\x14\n\x05limit\x18\x04 \x01(\x11R\x05limit\x12\x1f\n\x0border_types\x18\x05 \x03(\tR\norderTypes\x12\x1c\n\tdirection\x18\x06 \x01(\tR\tdirection\x12\x1d\n\nstart_time\x18\x07 \x01(\x12R\tstartTime\x12\x19\n\x08\x65nd_time\x18\x08 \x01(\x12R\x07\x65ndTime\x12%\n\x0eis_conditional\x18\t \x01(\tR\risConditional\x12\x1d\n\norder_type\x18\n \x01(\tR\torderType\x12\x14\n\x05state\x18\x0b \x01(\tR\x05state\x12\'\n\x0f\x65xecution_types\x18\x0c \x03(\tR\x0e\x65xecutionTypes\x12\x1d\n\nmarket_ids\x18\r \x03(\tR\tmarketIds\x12\x19\n\x08trade_id\x18\x0e \x01(\tR\x07tradeId\x12.\n\x13\x61\x63tive_markets_only\x18\x0f \x01(\x08R\x11\x61\x63tiveMarketsOnly\x12\x10\n\x03\x63id\x18\x10 \x01(\tR\x03\x63id\"\xad\x01\n\x15OrdersHistoryResponse\x12Q\n\x06orders\x18\x01 \x03(\x0b\x32\x39.injective_derivative_exchange_rpc.DerivativeOrderHistoryR\x06orders\x12\x41\n\x06paging\x18\x02 \x01(\x0b\x32).injective_derivative_exchange_rpc.PagingR\x06paging\"\xa9\x05\n\x16\x44\x65rivativeOrderHistory\x12\x1d\n\norder_hash\x18\x01 \x01(\tR\torderHash\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12\x1b\n\tis_active\x18\x03 \x01(\x08R\x08isActive\x12#\n\rsubaccount_id\x18\x04 \x01(\tR\x0csubaccountId\x12%\n\x0e\x65xecution_type\x18\x05 \x01(\tR\rexecutionType\x12\x1d\n\norder_type\x18\x06 \x01(\tR\torderType\x12\x14\n\x05price\x18\x07 \x01(\tR\x05price\x12#\n\rtrigger_price\x18\x08 \x01(\tR\x0ctriggerPrice\x12\x1a\n\x08quantity\x18\t \x01(\tR\x08quantity\x12\'\n\x0f\x66illed_quantity\x18\n \x01(\tR\x0e\x66illedQuantity\x12\x14\n\x05state\x18\x0b \x01(\tR\x05state\x12\x1d\n\ncreated_at\x18\x0c \x01(\x12R\tcreatedAt\x12\x1d\n\nupdated_at\x18\r \x01(\x12R\tupdatedAt\x12$\n\x0eis_reduce_only\x18\x0e \x01(\x08R\x0cisReduceOnly\x12\x1c\n\tdirection\x18\x0f \x01(\tR\tdirection\x12%\n\x0eis_conditional\x18\x10 \x01(\x08R\risConditional\x12\x1d\n\ntrigger_at\x18\x11 \x01(\x04R\ttriggerAt\x12*\n\x11placed_order_hash\x18\x12 \x01(\tR\x0fplacedOrderHash\x12\x16\n\x06margin\x18\x13 \x01(\tR\x06margin\x12\x17\n\x07tx_hash\x18\x14 \x01(\tR\x06txHash\x12\x10\n\x03\x63id\x18\x15 \x01(\tR\x03\x63id\"\xdc\x01\n\x1aStreamOrdersHistoryRequest\x12#\n\rsubaccount_id\x18\x01 \x01(\tR\x0csubaccountId\x12\x1b\n\tmarket_id\x18\x02 \x01(\tR\x08marketId\x12\x1f\n\x0border_types\x18\x03 \x03(\tR\norderTypes\x12\x1c\n\tdirection\x18\x04 \x01(\tR\tdirection\x12\x14\n\x05state\x18\x05 \x01(\tR\x05state\x12\'\n\x0f\x65xecution_types\x18\x06 \x03(\tR\x0e\x65xecutionTypes\"\xb3\x01\n\x1bStreamOrdersHistoryResponse\x12O\n\x05order\x18\x01 \x01(\x0b\x32\x39.injective_derivative_exchange_rpc.DerivativeOrderHistoryR\x05order\x12%\n\x0eoperation_type\x18\x02 \x01(\tR\roperationType\x12\x1c\n\ttimestamp\x18\x03 \x01(\x12R\ttimestamp\"5\n\x13OpenInterestRequest\x12\x1e\n\x0bmarket_i_ds\x18\x01 \x03(\tR\tmarketIDs\"t\n\x14OpenInterestResponse\x12\\\n\x0eopen_interests\x18\x01 \x03(\x0b\x32\x35.injective_derivative_exchange_rpc.MarketOpenInterestR\ropenInterests\"V\n\x12MarketOpenInterest\x12\x1b\n\tmarket_id\x18\x01 \x01(\tR\x08marketId\x12#\n\ropen_interest\x18\x02 \x01(\tR\x0copenInterest2\xd8\x1c\n\x1eInjectiveDerivativeExchangeRPC\x12p\n\x07Markets\x12\x31.injective_derivative_exchange_rpc.MarketsRequest\x1a\x32.injective_derivative_exchange_rpc.MarketsResponse\x12m\n\x06Market\x12\x30.injective_derivative_exchange_rpc.MarketRequest\x1a\x31.injective_derivative_exchange_rpc.MarketResponse\x12\x81\x01\n\x0cStreamMarket\x12\x36.injective_derivative_exchange_rpc.StreamMarketRequest\x1a\x37.injective_derivative_exchange_rpc.StreamMarketResponse0\x01\x12\x97\x01\n\x14\x42inaryOptionsMarkets\x12>.injective_derivative_exchange_rpc.BinaryOptionsMarketsRequest\x1a?.injective_derivative_exchange_rpc.BinaryOptionsMarketsResponse\x12\x94\x01\n\x13\x42inaryOptionsMarket\x12=.injective_derivative_exchange_rpc.BinaryOptionsMarketRequest\x1a>.injective_derivative_exchange_rpc.BinaryOptionsMarketResponse\x12|\n\x0bOrderbookV2\x12\x35.injective_derivative_exchange_rpc.OrderbookV2Request\x1a\x36.injective_derivative_exchange_rpc.OrderbookV2Response\x12\x7f\n\x0cOrderbooksV2\x12\x36.injective_derivative_exchange_rpc.OrderbooksV2Request\x1a\x37.injective_derivative_exchange_rpc.OrderbooksV2Response\x12\x90\x01\n\x11StreamOrderbookV2\x12;.injective_derivative_exchange_rpc.StreamOrderbookV2Request\x1a<.injective_derivative_exchange_rpc.StreamOrderbookV2Response0\x01\x12\x9c\x01\n\x15StreamOrderbookUpdate\x12?.injective_derivative_exchange_rpc.StreamOrderbookUpdateRequest\x1a@.injective_derivative_exchange_rpc.StreamOrderbookUpdateResponse0\x01\x12m\n\x06Orders\x12\x30.injective_derivative_exchange_rpc.OrdersRequest\x1a\x31.injective_derivative_exchange_rpc.OrdersResponse\x12v\n\tPositions\x12\x33.injective_derivative_exchange_rpc.PositionsRequest\x1a\x34.injective_derivative_exchange_rpc.PositionsResponse\x12|\n\x0bPositionsV2\x12\x35.injective_derivative_exchange_rpc.PositionsV2Request\x1a\x36.injective_derivative_exchange_rpc.PositionsV2Response\x12\x94\x01\n\x13LiquidablePositions\x12=.injective_derivative_exchange_rpc.LiquidablePositionsRequest\x1a>.injective_derivative_exchange_rpc.LiquidablePositionsResponse\x12\x88\x01\n\x0f\x46undingPayments\x12\x39.injective_derivative_exchange_rpc.FundingPaymentsRequest\x1a:.injective_derivative_exchange_rpc.FundingPaymentsResponse\x12\x7f\n\x0c\x46undingRates\x12\x36.injective_derivative_exchange_rpc.FundingRatesRequest\x1a\x37.injective_derivative_exchange_rpc.FundingRatesResponse\x12\x8a\x01\n\x0fStreamPositions\x12\x39.injective_derivative_exchange_rpc.StreamPositionsRequest\x1a:.injective_derivative_exchange_rpc.StreamPositionsResponse0\x01\x12\x90\x01\n\x11StreamPositionsV2\x12;.injective_derivative_exchange_rpc.StreamPositionsV2Request\x1a<.injective_derivative_exchange_rpc.StreamPositionsV2Response0\x01\x12\x81\x01\n\x0cStreamOrders\x12\x36.injective_derivative_exchange_rpc.StreamOrdersRequest\x1a\x37.injective_derivative_exchange_rpc.StreamOrdersResponse0\x01\x12m\n\x06Trades\x12\x30.injective_derivative_exchange_rpc.TradesRequest\x1a\x31.injective_derivative_exchange_rpc.TradesResponse\x12s\n\x08TradesV2\x12\x32.injective_derivative_exchange_rpc.TradesV2Request\x1a\x33.injective_derivative_exchange_rpc.TradesV2Response\x12\x81\x01\n\x0cStreamTrades\x12\x36.injective_derivative_exchange_rpc.StreamTradesRequest\x1a\x37.injective_derivative_exchange_rpc.StreamTradesResponse0\x01\x12\x87\x01\n\x0eStreamTradesV2\x12\x38.injective_derivative_exchange_rpc.StreamTradesV2Request\x1a\x39.injective_derivative_exchange_rpc.StreamTradesV2Response0\x01\x12\x97\x01\n\x14SubaccountOrdersList\x12>.injective_derivative_exchange_rpc.SubaccountOrdersListRequest\x1a?.injective_derivative_exchange_rpc.SubaccountOrdersListResponse\x12\x97\x01\n\x14SubaccountTradesList\x12>.injective_derivative_exchange_rpc.SubaccountTradesListRequest\x1a?.injective_derivative_exchange_rpc.SubaccountTradesListResponse\x12\x82\x01\n\rOrdersHistory\x12\x37.injective_derivative_exchange_rpc.OrdersHistoryRequest\x1a\x38.injective_derivative_exchange_rpc.OrdersHistoryResponse\x12\x96\x01\n\x13StreamOrdersHistory\x12=.injective_derivative_exchange_rpc.StreamOrdersHistoryRequest\x1a>.injective_derivative_exchange_rpc.StreamOrdersHistoryResponse0\x01\x12\x7f\n\x0cOpenInterest\x12\x36.injective_derivative_exchange_rpc.OpenInterestRequest\x1a\x37.injective_derivative_exchange_rpc.OpenInterestResponseB\x8a\x02\n%com.injective_derivative_exchange_rpcB#InjectiveDerivativeExchangeRpcProtoP\x01Z$/injective_derivative_exchange_rpcpb\xa2\x02\x03IXX\xaa\x02\x1eInjectiveDerivativeExchangeRpc\xca\x02\x1eInjectiveDerivativeExchangeRpc\xe2\x02*InjectiveDerivativeExchangeRpc\\GPBMetadata\xea\x02\x1eInjectiveDerivativeExchangeRpcb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -27,151 +27,151 @@ _globals['_MARKETSRESPONSE']._serialized_start=216 _globals['_MARKETSRESPONSE']._serialized_end=316 _globals['_DERIVATIVEMARKETINFO']._serialized_start=319 - _globals['_DERIVATIVEMARKETINFO']._serialized_end=1451 - _globals['_TOKENMETA']._serialized_start=1454 - _globals['_TOKENMETA']._serialized_end=1614 - _globals['_PERPETUALMARKETINFO']._serialized_start=1617 - _globals['_PERPETUALMARKETINFO']._serialized_end=1840 - _globals['_PERPETUALMARKETFUNDING']._serialized_start=1843 - _globals['_PERPETUALMARKETFUNDING']._serialized_end=1996 - _globals['_EXPIRYFUTURESMARKETINFO']._serialized_start=1998 - _globals['_EXPIRYFUTURESMARKETINFO']._serialized_end=2117 - _globals['_MARKETREQUEST']._serialized_start=2119 - _globals['_MARKETREQUEST']._serialized_end=2163 - _globals['_MARKETRESPONSE']._serialized_start=2165 - _globals['_MARKETRESPONSE']._serialized_end=2262 - _globals['_STREAMMARKETREQUEST']._serialized_start=2264 - _globals['_STREAMMARKETREQUEST']._serialized_end=2316 - _globals['_STREAMMARKETRESPONSE']._serialized_start=2319 - _globals['_STREAMMARKETRESPONSE']._serialized_end=2491 - _globals['_BINARYOPTIONSMARKETSREQUEST']._serialized_start=2494 - _globals['_BINARYOPTIONSMARKETSREQUEST']._serialized_end=2635 - _globals['_BINARYOPTIONSMARKETSRESPONSE']._serialized_start=2638 - _globals['_BINARYOPTIONSMARKETSRESPONSE']._serialized_end=2821 - _globals['_BINARYOPTIONSMARKETINFO']._serialized_start=2824 - _globals['_BINARYOPTIONSMARKETINFO']._serialized_end=3625 - _globals['_PAGING']._serialized_start=3628 - _globals['_PAGING']._serialized_end=3762 - _globals['_BINARYOPTIONSMARKETREQUEST']._serialized_start=3764 - _globals['_BINARYOPTIONSMARKETREQUEST']._serialized_end=3821 - _globals['_BINARYOPTIONSMARKETRESPONSE']._serialized_start=3823 - _globals['_BINARYOPTIONSMARKETRESPONSE']._serialized_end=3936 - _globals['_ORDERBOOKV2REQUEST']._serialized_start=3938 - _globals['_ORDERBOOKV2REQUEST']._serialized_end=4009 - _globals['_ORDERBOOKV2RESPONSE']._serialized_start=4011 - _globals['_ORDERBOOKV2RESPONSE']._serialized_end=4125 - _globals['_DERIVATIVELIMITORDERBOOKV2']._serialized_start=4128 - _globals['_DERIVATIVELIMITORDERBOOKV2']._serialized_end=4350 - _globals['_PRICELEVEL']._serialized_start=4352 - _globals['_PRICELEVEL']._serialized_end=4444 - _globals['_ORDERBOOKSV2REQUEST']._serialized_start=4446 - _globals['_ORDERBOOKSV2REQUEST']._serialized_end=4520 - _globals['_ORDERBOOKSV2RESPONSE']._serialized_start=4522 - _globals['_ORDERBOOKSV2RESPONSE']._serialized_end=4645 - _globals['_SINGLEDERIVATIVELIMITORDERBOOKV2']._serialized_start=4648 - _globals['_SINGLEDERIVATIVELIMITORDERBOOKV2']._serialized_end=4804 - _globals['_STREAMORDERBOOKV2REQUEST']._serialized_start=4806 - _globals['_STREAMORDERBOOKV2REQUEST']._serialized_end=4863 - _globals['_STREAMORDERBOOKV2RESPONSE']._serialized_start=4866 - _globals['_STREAMORDERBOOKV2RESPONSE']._serialized_end=5084 - _globals['_STREAMORDERBOOKUPDATEREQUEST']._serialized_start=5086 - _globals['_STREAMORDERBOOKUPDATEREQUEST']._serialized_end=5147 - _globals['_STREAMORDERBOOKUPDATERESPONSE']._serialized_start=5150 - _globals['_STREAMORDERBOOKUPDATERESPONSE']._serialized_end=5393 - _globals['_ORDERBOOKLEVELUPDATES']._serialized_start=5396 - _globals['_ORDERBOOKLEVELUPDATES']._serialized_end=5655 - _globals['_PRICELEVELUPDATE']._serialized_start=5657 - _globals['_PRICELEVELUPDATE']._serialized_end=5784 - _globals['_ORDERSREQUEST']._serialized_start=5787 - _globals['_ORDERSREQUEST']._serialized_end=6244 - _globals['_ORDERSRESPONSE']._serialized_start=6247 - _globals['_ORDERSRESPONSE']._serialized_end=6411 - _globals['_DERIVATIVELIMITORDER']._serialized_start=6414 - _globals['_DERIVATIVELIMITORDER']._serialized_end=7141 - _globals['_POSITIONSREQUEST']._serialized_start=7144 - _globals['_POSITIONSREQUEST']._serialized_end=7492 - _globals['_POSITIONSRESPONSE']._serialized_start=7495 - _globals['_POSITIONSRESPONSE']._serialized_end=7666 - _globals['_DERIVATIVEPOSITION']._serialized_start=7669 - _globals['_DERIVATIVEPOSITION']._serialized_end=8101 - _globals['_POSITIONSV2REQUEST']._serialized_start=8104 - _globals['_POSITIONSV2REQUEST']._serialized_end=8454 - _globals['_POSITIONSV2RESPONSE']._serialized_start=8457 - _globals['_POSITIONSV2RESPONSE']._serialized_end=8632 - _globals['_DERIVATIVEPOSITIONV2']._serialized_start=8635 - _globals['_DERIVATIVEPOSITIONV2']._serialized_end=8991 - _globals['_LIQUIDABLEPOSITIONSREQUEST']._serialized_start=8993 - _globals['_LIQUIDABLEPOSITIONSREQUEST']._serialized_end=9092 - _globals['_LIQUIDABLEPOSITIONSRESPONSE']._serialized_start=9094 - _globals['_LIQUIDABLEPOSITIONSRESPONSE']._serialized_end=9208 - _globals['_FUNDINGPAYMENTSREQUEST']._serialized_start=9211 - _globals['_FUNDINGPAYMENTSREQUEST']._serialized_end=9401 - _globals['_FUNDINGPAYMENTSRESPONSE']._serialized_start=9404 - _globals['_FUNDINGPAYMENTSRESPONSE']._serialized_end=9575 - _globals['_FUNDINGPAYMENT']._serialized_start=9578 - _globals['_FUNDINGPAYMENT']._serialized_end=9714 - _globals['_FUNDINGRATESREQUEST']._serialized_start=9716 - _globals['_FUNDINGRATESREQUEST']._serialized_end=9835 - _globals['_FUNDINGRATESRESPONSE']._serialized_start=9838 - _globals['_FUNDINGRATESRESPONSE']._serialized_end=10012 - _globals['_FUNDINGRATE']._serialized_start=10014 - _globals['_FUNDINGRATE']._serialized_end=10106 - _globals['_STREAMPOSITIONSREQUEST']._serialized_start=10109 - _globals['_STREAMPOSITIONSREQUEST']._serialized_end=10310 - _globals['_STREAMPOSITIONSRESPONSE']._serialized_start=10313 - _globals['_STREAMPOSITIONSRESPONSE']._serialized_end=10451 - _globals['_STREAMPOSITIONSV2REQUEST']._serialized_start=10454 - _globals['_STREAMPOSITIONSV2REQUEST']._serialized_end=10657 - _globals['_STREAMPOSITIONSV2RESPONSE']._serialized_start=10660 - _globals['_STREAMPOSITIONSV2RESPONSE']._serialized_end=10802 - _globals['_STREAMORDERSREQUEST']._serialized_start=10805 - _globals['_STREAMORDERSREQUEST']._serialized_end=11268 - _globals['_STREAMORDERSRESPONSE']._serialized_start=11271 - _globals['_STREAMORDERSRESPONSE']._serialized_end=11441 - _globals['_TRADESREQUEST']._serialized_start=11444 - _globals['_TRADESREQUEST']._serialized_end=11928 - _globals['_TRADESRESPONSE']._serialized_start=11931 - _globals['_TRADESRESPONSE']._serialized_end=12090 - _globals['_DERIVATIVETRADE']._serialized_start=12093 - _globals['_DERIVATIVETRADE']._serialized_end=12581 - _globals['_POSITIONDELTA']._serialized_start=12584 - _globals['_POSITIONDELTA']._serialized_end=12771 - _globals['_TRADESV2REQUEST']._serialized_start=12774 - _globals['_TRADESV2REQUEST']._serialized_end=13260 - _globals['_TRADESV2RESPONSE']._serialized_start=13263 - _globals['_TRADESV2RESPONSE']._serialized_end=13424 - _globals['_STREAMTRADESREQUEST']._serialized_start=13427 - _globals['_STREAMTRADESREQUEST']._serialized_end=13917 - _globals['_STREAMTRADESRESPONSE']._serialized_start=13920 - _globals['_STREAMTRADESRESPONSE']._serialized_end=14085 - _globals['_STREAMTRADESV2REQUEST']._serialized_start=14088 - _globals['_STREAMTRADESV2REQUEST']._serialized_end=14580 - _globals['_STREAMTRADESV2RESPONSE']._serialized_start=14583 - _globals['_STREAMTRADESV2RESPONSE']._serialized_end=14750 - _globals['_SUBACCOUNTORDERSLISTREQUEST']._serialized_start=14753 - _globals['_SUBACCOUNTORDERSLISTREQUEST']._serialized_end=14890 - _globals['_SUBACCOUNTORDERSLISTRESPONSE']._serialized_start=14893 - _globals['_SUBACCOUNTORDERSLISTRESPONSE']._serialized_end=15071 - _globals['_SUBACCOUNTTRADESLISTREQUEST']._serialized_start=15074 - _globals['_SUBACCOUNTTRADESLISTREQUEST']._serialized_end=15280 - _globals['_SUBACCOUNTTRADESLISTRESPONSE']._serialized_start=15282 - _globals['_SUBACCOUNTTRADESLISTRESPONSE']._serialized_end=15388 - _globals['_ORDERSHISTORYREQUEST']._serialized_start=15391 - _globals['_ORDERSHISTORYREQUEST']._serialized_end=15899 - _globals['_ORDERSHISTORYRESPONSE']._serialized_start=15902 - _globals['_ORDERSHISTORYRESPONSE']._serialized_end=16075 - _globals['_DERIVATIVEORDERHISTORY']._serialized_start=16078 - _globals['_DERIVATIVEORDERHISTORY']._serialized_end=16759 - _globals['_STREAMORDERSHISTORYREQUEST']._serialized_start=16762 - _globals['_STREAMORDERSHISTORYREQUEST']._serialized_end=16982 - _globals['_STREAMORDERSHISTORYRESPONSE']._serialized_start=16985 - _globals['_STREAMORDERSHISTORYRESPONSE']._serialized_end=17164 - _globals['_OPENINTERESTREQUEST']._serialized_start=17166 - _globals['_OPENINTERESTREQUEST']._serialized_end=17219 - _globals['_OPENINTERESTRESPONSE']._serialized_start=17221 - _globals['_OPENINTERESTRESPONSE']._serialized_end=17337 - _globals['_MARKETOPENINTEREST']._serialized_start=17339 - _globals['_MARKETOPENINTEREST']._serialized_end=17425 - _globals['_INJECTIVEDERIVATIVEEXCHANGERPC']._serialized_start=17428 - _globals['_INJECTIVEDERIVATIVEEXCHANGERPC']._serialized_end=21100 + _globals['_DERIVATIVEMARKETINFO']._serialized_end=1499 + _globals['_TOKENMETA']._serialized_start=1502 + _globals['_TOKENMETA']._serialized_end=1662 + _globals['_PERPETUALMARKETINFO']._serialized_start=1665 + _globals['_PERPETUALMARKETINFO']._serialized_end=1888 + _globals['_PERPETUALMARKETFUNDING']._serialized_start=1891 + _globals['_PERPETUALMARKETFUNDING']._serialized_end=2088 + _globals['_EXPIRYFUTURESMARKETINFO']._serialized_start=2090 + _globals['_EXPIRYFUTURESMARKETINFO']._serialized_end=2209 + _globals['_MARKETREQUEST']._serialized_start=2211 + _globals['_MARKETREQUEST']._serialized_end=2255 + _globals['_MARKETRESPONSE']._serialized_start=2257 + _globals['_MARKETRESPONSE']._serialized_end=2354 + _globals['_STREAMMARKETREQUEST']._serialized_start=2356 + _globals['_STREAMMARKETREQUEST']._serialized_end=2408 + _globals['_STREAMMARKETRESPONSE']._serialized_start=2411 + _globals['_STREAMMARKETRESPONSE']._serialized_end=2583 + _globals['_BINARYOPTIONSMARKETSREQUEST']._serialized_start=2586 + _globals['_BINARYOPTIONSMARKETSREQUEST']._serialized_end=2727 + _globals['_BINARYOPTIONSMARKETSRESPONSE']._serialized_start=2730 + _globals['_BINARYOPTIONSMARKETSRESPONSE']._serialized_end=2913 + _globals['_BINARYOPTIONSMARKETINFO']._serialized_start=2916 + _globals['_BINARYOPTIONSMARKETINFO']._serialized_end=3717 + _globals['_PAGING']._serialized_start=3720 + _globals['_PAGING']._serialized_end=3854 + _globals['_BINARYOPTIONSMARKETREQUEST']._serialized_start=3856 + _globals['_BINARYOPTIONSMARKETREQUEST']._serialized_end=3913 + _globals['_BINARYOPTIONSMARKETRESPONSE']._serialized_start=3915 + _globals['_BINARYOPTIONSMARKETRESPONSE']._serialized_end=4028 + _globals['_ORDERBOOKV2REQUEST']._serialized_start=4030 + _globals['_ORDERBOOKV2REQUEST']._serialized_end=4101 + _globals['_ORDERBOOKV2RESPONSE']._serialized_start=4103 + _globals['_ORDERBOOKV2RESPONSE']._serialized_end=4217 + _globals['_DERIVATIVELIMITORDERBOOKV2']._serialized_start=4220 + _globals['_DERIVATIVELIMITORDERBOOKV2']._serialized_end=4442 + _globals['_PRICELEVEL']._serialized_start=4444 + _globals['_PRICELEVEL']._serialized_end=4536 + _globals['_ORDERBOOKSV2REQUEST']._serialized_start=4538 + _globals['_ORDERBOOKSV2REQUEST']._serialized_end=4612 + _globals['_ORDERBOOKSV2RESPONSE']._serialized_start=4614 + _globals['_ORDERBOOKSV2RESPONSE']._serialized_end=4737 + _globals['_SINGLEDERIVATIVELIMITORDERBOOKV2']._serialized_start=4740 + _globals['_SINGLEDERIVATIVELIMITORDERBOOKV2']._serialized_end=4896 + _globals['_STREAMORDERBOOKV2REQUEST']._serialized_start=4898 + _globals['_STREAMORDERBOOKV2REQUEST']._serialized_end=4955 + _globals['_STREAMORDERBOOKV2RESPONSE']._serialized_start=4958 + _globals['_STREAMORDERBOOKV2RESPONSE']._serialized_end=5176 + _globals['_STREAMORDERBOOKUPDATEREQUEST']._serialized_start=5178 + _globals['_STREAMORDERBOOKUPDATEREQUEST']._serialized_end=5239 + _globals['_STREAMORDERBOOKUPDATERESPONSE']._serialized_start=5242 + _globals['_STREAMORDERBOOKUPDATERESPONSE']._serialized_end=5485 + _globals['_ORDERBOOKLEVELUPDATES']._serialized_start=5488 + _globals['_ORDERBOOKLEVELUPDATES']._serialized_end=5747 + _globals['_PRICELEVELUPDATE']._serialized_start=5749 + _globals['_PRICELEVELUPDATE']._serialized_end=5876 + _globals['_ORDERSREQUEST']._serialized_start=5879 + _globals['_ORDERSREQUEST']._serialized_end=6336 + _globals['_ORDERSRESPONSE']._serialized_start=6339 + _globals['_ORDERSRESPONSE']._serialized_end=6503 + _globals['_DERIVATIVELIMITORDER']._serialized_start=6506 + _globals['_DERIVATIVELIMITORDER']._serialized_end=7233 + _globals['_POSITIONSREQUEST']._serialized_start=7236 + _globals['_POSITIONSREQUEST']._serialized_end=7584 + _globals['_POSITIONSRESPONSE']._serialized_start=7587 + _globals['_POSITIONSRESPONSE']._serialized_end=7758 + _globals['_DERIVATIVEPOSITION']._serialized_start=7761 + _globals['_DERIVATIVEPOSITION']._serialized_end=8193 + _globals['_POSITIONSV2REQUEST']._serialized_start=8196 + _globals['_POSITIONSV2REQUEST']._serialized_end=8546 + _globals['_POSITIONSV2RESPONSE']._serialized_start=8549 + _globals['_POSITIONSV2RESPONSE']._serialized_end=8724 + _globals['_DERIVATIVEPOSITIONV2']._serialized_start=8727 + _globals['_DERIVATIVEPOSITIONV2']._serialized_end=9083 + _globals['_LIQUIDABLEPOSITIONSREQUEST']._serialized_start=9085 + _globals['_LIQUIDABLEPOSITIONSREQUEST']._serialized_end=9184 + _globals['_LIQUIDABLEPOSITIONSRESPONSE']._serialized_start=9186 + _globals['_LIQUIDABLEPOSITIONSRESPONSE']._serialized_end=9300 + _globals['_FUNDINGPAYMENTSREQUEST']._serialized_start=9303 + _globals['_FUNDINGPAYMENTSREQUEST']._serialized_end=9493 + _globals['_FUNDINGPAYMENTSRESPONSE']._serialized_start=9496 + _globals['_FUNDINGPAYMENTSRESPONSE']._serialized_end=9667 + _globals['_FUNDINGPAYMENT']._serialized_start=9670 + _globals['_FUNDINGPAYMENT']._serialized_end=9806 + _globals['_FUNDINGRATESREQUEST']._serialized_start=9808 + _globals['_FUNDINGRATESREQUEST']._serialized_end=9927 + _globals['_FUNDINGRATESRESPONSE']._serialized_start=9930 + _globals['_FUNDINGRATESRESPONSE']._serialized_end=10104 + _globals['_FUNDINGRATE']._serialized_start=10106 + _globals['_FUNDINGRATE']._serialized_end=10198 + _globals['_STREAMPOSITIONSREQUEST']._serialized_start=10201 + _globals['_STREAMPOSITIONSREQUEST']._serialized_end=10402 + _globals['_STREAMPOSITIONSRESPONSE']._serialized_start=10405 + _globals['_STREAMPOSITIONSRESPONSE']._serialized_end=10543 + _globals['_STREAMPOSITIONSV2REQUEST']._serialized_start=10546 + _globals['_STREAMPOSITIONSV2REQUEST']._serialized_end=10749 + _globals['_STREAMPOSITIONSV2RESPONSE']._serialized_start=10752 + _globals['_STREAMPOSITIONSV2RESPONSE']._serialized_end=10894 + _globals['_STREAMORDERSREQUEST']._serialized_start=10897 + _globals['_STREAMORDERSREQUEST']._serialized_end=11360 + _globals['_STREAMORDERSRESPONSE']._serialized_start=11363 + _globals['_STREAMORDERSRESPONSE']._serialized_end=11533 + _globals['_TRADESREQUEST']._serialized_start=11536 + _globals['_TRADESREQUEST']._serialized_end=12020 + _globals['_TRADESRESPONSE']._serialized_start=12023 + _globals['_TRADESRESPONSE']._serialized_end=12182 + _globals['_DERIVATIVETRADE']._serialized_start=12185 + _globals['_DERIVATIVETRADE']._serialized_end=12673 + _globals['_POSITIONDELTA']._serialized_start=12676 + _globals['_POSITIONDELTA']._serialized_end=12863 + _globals['_TRADESV2REQUEST']._serialized_start=12866 + _globals['_TRADESV2REQUEST']._serialized_end=13352 + _globals['_TRADESV2RESPONSE']._serialized_start=13355 + _globals['_TRADESV2RESPONSE']._serialized_end=13516 + _globals['_STREAMTRADESREQUEST']._serialized_start=13519 + _globals['_STREAMTRADESREQUEST']._serialized_end=14009 + _globals['_STREAMTRADESRESPONSE']._serialized_start=14012 + _globals['_STREAMTRADESRESPONSE']._serialized_end=14177 + _globals['_STREAMTRADESV2REQUEST']._serialized_start=14180 + _globals['_STREAMTRADESV2REQUEST']._serialized_end=14672 + _globals['_STREAMTRADESV2RESPONSE']._serialized_start=14675 + _globals['_STREAMTRADESV2RESPONSE']._serialized_end=14842 + _globals['_SUBACCOUNTORDERSLISTREQUEST']._serialized_start=14845 + _globals['_SUBACCOUNTORDERSLISTREQUEST']._serialized_end=14982 + _globals['_SUBACCOUNTORDERSLISTRESPONSE']._serialized_start=14985 + _globals['_SUBACCOUNTORDERSLISTRESPONSE']._serialized_end=15163 + _globals['_SUBACCOUNTTRADESLISTREQUEST']._serialized_start=15166 + _globals['_SUBACCOUNTTRADESLISTREQUEST']._serialized_end=15372 + _globals['_SUBACCOUNTTRADESLISTRESPONSE']._serialized_start=15374 + _globals['_SUBACCOUNTTRADESLISTRESPONSE']._serialized_end=15480 + _globals['_ORDERSHISTORYREQUEST']._serialized_start=15483 + _globals['_ORDERSHISTORYREQUEST']._serialized_end=15991 + _globals['_ORDERSHISTORYRESPONSE']._serialized_start=15994 + _globals['_ORDERSHISTORYRESPONSE']._serialized_end=16167 + _globals['_DERIVATIVEORDERHISTORY']._serialized_start=16170 + _globals['_DERIVATIVEORDERHISTORY']._serialized_end=16851 + _globals['_STREAMORDERSHISTORYREQUEST']._serialized_start=16854 + _globals['_STREAMORDERSHISTORYREQUEST']._serialized_end=17074 + _globals['_STREAMORDERSHISTORYRESPONSE']._serialized_start=17077 + _globals['_STREAMORDERSHISTORYRESPONSE']._serialized_end=17256 + _globals['_OPENINTERESTREQUEST']._serialized_start=17258 + _globals['_OPENINTERESTREQUEST']._serialized_end=17311 + _globals['_OPENINTERESTRESPONSE']._serialized_start=17313 + _globals['_OPENINTERESTRESPONSE']._serialized_end=17429 + _globals['_MARKETOPENINTEREST']._serialized_start=17431 + _globals['_MARKETOPENINTEREST']._serialized_end=17517 + _globals['_INJECTIVEDERIVATIVEEXCHANGERPC']._serialized_start=17520 + _globals['_INJECTIVEDERIVATIVEEXCHANGERPC']._serialized_end=21192 # @@protoc_insertion_point(module_scope) diff --git a/pyproject.toml b/pyproject.toml index 7dd8e6fd..fca45f29 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "injective-py" -version = "1.11.0-rc1" +version = "1.11.0-rc2" description = "Injective Python SDK, with Exchange API Client" authors = ["Injective Labs "] license = "Apache-2.0" diff --git a/tests/client/chain/grpc/configurable_erc20_query_servicer.py b/tests/client/chain/grpc/configurable_erc20_query_servicer.py new file mode 100644 index 00000000..1452e1af --- /dev/null +++ b/tests/client/chain/grpc/configurable_erc20_query_servicer.py @@ -0,0 +1,26 @@ +from collections import deque + +from pyinjective.proto.injective.erc20.v1beta1 import query_pb2 as erc20_query_pb, query_pb2_grpc as erc20_query_grpc + + +class ConfigurableERC20QueryServicer(erc20_query_grpc.QueryServicer): + def __init__(self): + super().__init__() + self.erc20_params_responses = deque() + self.all_token_pairs_responses = deque() + self.token_pair_by_denom_responses = deque() + self.token_pair_by_erc20_address_responses = deque() + + async def Params(self, request: erc20_query_pb.QueryParamsRequest, context=None, metadata=None): + return self.erc20_params_responses.pop() + + async def AllTokenPairs(self, request: erc20_query_pb.QueryAllTokenPairsRequest, context=None, metadata=None): + return self.all_token_pairs_responses.pop() + + async def TokenPairByDenom(self, request: erc20_query_pb.QueryTokenPairByDenomRequest, context=None, metadata=None): + return self.token_pair_by_denom_responses.pop() + + async def TokenPairByERC20Address( + self, request: erc20_query_pb.QueryTokenPairByERC20AddressRequest, context=None, metadata=None + ): + return self.token_pair_by_erc20_address_responses.pop() diff --git a/tests/client/chain/grpc/configurable_evm_query_servicer.py b/tests/client/chain/grpc/configurable_evm_query_servicer.py new file mode 100644 index 00000000..ee3e9b25 --- /dev/null +++ b/tests/client/chain/grpc/configurable_evm_query_servicer.py @@ -0,0 +1,40 @@ +from collections import deque + +from pyinjective.proto.injective.evm.v1 import query_pb2 as evm_query_pb, query_pb2_grpc as evm_query_grpc + + +class ConfigurableEVMQueryServicer(evm_query_grpc.QueryServicer): + def __init__(self): + super().__init__() + self.params_responses = deque() + self.account_responses = deque() + self.cosmos_account_responses = deque() + self.validator_account_responses = deque() + self.balance_responses = deque() + self.storage_responses = deque() + self.code_responses = deque() + self.base_fee_responses = deque() + + async def Params(self, request: evm_query_pb.QueryParamsRequest, context=None, metadata=None): + return self.params_responses.pop() + + async def Account(self, request: evm_query_pb.QueryAccountRequest, context=None, metadata=None): + return self.account_responses.pop() + + async def CosmosAccount(self, request: evm_query_pb.QueryCosmosAccountRequest, context=None, metadata=None): + return self.cosmos_account_responses.pop() + + async def ValidatorAccount(self, request: evm_query_pb.QueryValidatorAccountRequest, context=None, metadata=None): + return self.validator_account_responses.pop() + + async def Balance(self, request: evm_query_pb.QueryBalanceRequest, context=None, metadata=None): + return self.balance_responses.pop() + + async def Storage(self, request: evm_query_pb.QueryStorageRequest, context=None, metadata=None): + return self.storage_responses.pop() + + async def Code(self, request: evm_query_pb.QueryCodeRequest, context=None, metadata=None): + return self.code_responses.pop() + + async def BaseFee(self, request: evm_query_pb.QueryBaseFeeRequest, context=None, metadata=None): + return self.base_fee_responses.pop() diff --git a/tests/client/chain/grpc/test_chain_grpc_erc20_api.py b/tests/client/chain/grpc/test_chain_grpc_erc20_api.py new file mode 100644 index 00000000..d2d24087 --- /dev/null +++ b/tests/client/chain/grpc/test_chain_grpc_erc20_api.py @@ -0,0 +1,116 @@ +import grpc +import pytest + +from pyinjective.client.chain.grpc.chain_grpc_erc20_api import ChainGrpcERC20Api +from pyinjective.core.network import DisabledCookieAssistant, Network +from pyinjective.proto.injective.erc20.v1beta1 import ( + erc20_pb2 as erc20_pb, + params_pb2 as erc20_params_pb, + query_pb2 as erc20_query_pb, +) +from tests.client.chain.grpc.configurable_erc20_query_servicer import ConfigurableERC20QueryServicer + + +@pytest.fixture +def erc20_servicer(): + return ConfigurableERC20QueryServicer() + + +class TestChainGrpcBankApi: + @pytest.mark.asyncio + async def test_fetch_erc20_params( + self, + erc20_servicer, + ): + params = erc20_params_pb.Params() + + erc20_servicer.erc20_params_responses.append( + erc20_query_pb.QueryParamsResponse( + params=params, + ) + ) + + api = self._api_instance(erc20_servicer) + response = await api.fetch_erc20_params() + + expected_params = {"params": {}} + + assert response == expected_params + + @pytest.mark.asyncio + async def test_fetch_all_token_pairs(self, erc20_servicer): + token_pair = erc20_pb.TokenPair( + bank_denom="denom", + erc20_address="0xd2C6753F6B1783EF0a3857275e16e79D91b539a3", + ) + erc20_servicer.all_token_pairs_responses.append( + erc20_query_pb.QueryAllTokenPairsResponse(token_pairs=[token_pair]) + ) + + api = self._api_instance(erc20_servicer) + response = await api.fetch_all_token_pairs() + + expected_token_pairs = { + "tokenPairs": [ + { + "bankDenom": token_pair.bank_denom, + "erc20Address": token_pair.erc20_address, + } + ] + } + + assert response == expected_token_pairs + + @pytest.mark.asyncio + async def test_fetch_token_pair_by_denom(self, erc20_servicer): + token_pair = erc20_pb.TokenPair( + bank_denom="denom", + erc20_address="0xd2C6753F6B1783EF0a3857275e16e79D91b539a3", + ) + erc20_servicer.token_pair_by_denom_responses.append( + erc20_query_pb.QueryTokenPairByDenomResponse(token_pair=token_pair) + ) + + api = self._api_instance(erc20_servicer) + response = await api.fetch_token_pair_by_denom(bank_denom=token_pair.bank_denom) + + expected_token_pair = { + "tokenPair": { + "bankDenom": token_pair.bank_denom, + "erc20Address": token_pair.erc20_address, + } + } + + assert response == expected_token_pair + + @pytest.mark.asyncio + async def test_fetch_token_pair_by_erc20_address(self, erc20_servicer): + token_pair = erc20_pb.TokenPair( + bank_denom="denom", + erc20_address="0xd2C6753F6B1783EF0a3857275e16e79D91b539a3", + ) + erc20_servicer.token_pair_by_erc20_address_responses.append( + erc20_query_pb.QueryTokenPairByERC20AddressResponse(token_pair=token_pair) + ) + + api = self._api_instance(erc20_servicer) + response = await api.fetch_token_pair_by_erc20_address(erc20_address=token_pair.erc20_address) + + expected_token_pair = { + "tokenPair": { + "bankDenom": token_pair.bank_denom, + "erc20Address": token_pair.erc20_address, + } + } + + assert response == expected_token_pair + + def _api_instance(self, servicer): + network = Network.devnet() + channel = grpc.aio.insecure_channel(network.grpc_endpoint) + cookie_assistant = DisabledCookieAssistant() + + api = ChainGrpcERC20Api(channel=channel, cookie_assistant=cookie_assistant) + api._stub = servicer + + return api diff --git a/tests/client/chain/grpc/test_chain_grpc_evm_api.py b/tests/client/chain/grpc/test_chain_grpc_evm_api.py new file mode 100644 index 00000000..f6378033 --- /dev/null +++ b/tests/client/chain/grpc/test_chain_grpc_evm_api.py @@ -0,0 +1,250 @@ +import base64 + +import grpc +import pytest + +from pyinjective.client.chain.grpc.chain_grpc_evm_api import ChainGrpcEVMApi +from pyinjective.core.network import DisabledCookieAssistant, Network +from pyinjective.proto.injective.evm.v1 import ( + chain_config_pb2 as evm_chain_config_pb, + params_pb2 as evm_params_pb, + query_pb2 as evm_query_pb, +) +from tests.client.chain.grpc.configurable_evm_query_servicer import ConfigurableEVMQueryServicer + + +@pytest.fixture +def evm_servicer(): + return ConfigurableEVMQueryServicer() + + +class TestChainGrpcBankApi: + @pytest.mark.asyncio + async def test_fetch_evm_params( + self, + evm_servicer, + ): + # Create a chain_config with different values for each variable + chain_config = evm_chain_config_pb.ChainConfig( + homestead_block="1000000", + dao_fork_block="1500000", + dao_fork_support=True, + eip150_block="2000000", + eip150_hash="0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0", + eip155_block="2500000", + eip158_block="3000000", + byzantium_block="4000000", + constantinople_block="5000000", + petersburg_block="6000000", + istanbul_block="7000000", + muir_glacier_block="8000000", + berlin_block="9000000", + london_block="10000000", + arrow_glacier_block="11000000", + gray_glacier_block="12000000", + merge_netsplit_block="13000000", + shanghai_time="14000000", + cancun_time="15000000", + prague_time="16000000", + eip155_chain_id="1337", # Common test chain ID + ) + + params = evm_params_pb.Params( + evm_denom="inj", + enable_create=True, + enable_call=False, + extra_eips=[11, 12], + chain_config=chain_config, + allow_unprotected_txs=True, + authorized_deployers=["inj1ady3s7whq30l4fx8sj3x6muv5mx4dfdlcpv8n7"], + permissioned=False, + ) + + evm_servicer.params_responses.append( + evm_query_pb.QueryParamsResponse( + params=params, + ) + ) + + api = self._api_instance(evm_servicer) + response = await api.fetch_params() + + expected_params = { + "params": { + "evmDenom": "inj", + "enableCreate": True, + "enableCall": False, + "extraEips": ["11", "12"], + "chainConfig": { + "homesteadBlock": "1000000", + "daoForkBlock": "1500000", + "daoForkSupport": True, + "eip150Block": "2000000", + "eip150Hash": "0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0", + "eip155Block": "2500000", + "eip158Block": "3000000", + "byzantiumBlock": "4000000", + "constantinopleBlock": "5000000", + "petersburgBlock": "6000000", + "istanbulBlock": "7000000", + "muirGlacierBlock": "8000000", + "berlinBlock": "9000000", + "londonBlock": "10000000", + "arrowGlacierBlock": "11000000", + "grayGlacierBlock": "12000000", + "mergeNetsplitBlock": "13000000", + "shanghaiTime": "14000000", + "cancunTime": "15000000", + "pragueTime": "16000000", + "eip155ChainId": "1337", + }, + "allowUnprotectedTxs": True, + "authorizedDeployers": ["inj1ady3s7whq30l4fx8sj3x6muv5mx4dfdlcpv8n7"], + "permissioned": False, + } + } + + assert response == expected_params + + @pytest.mark.asyncio + async def test_fetch_account(self, evm_servicer): + evm_servicer.account_responses.append( + evm_query_pb.QueryAccountResponse( + balance="1500.123", + code_hash="0x0000000000000000000000000000000000000000000000000000000000000000", + nonce=1234567890, + ) + ) + + api = self._api_instance(evm_servicer) + response = await api.fetch_account(address="0xe28b3B32B6c345A34Ff64674606124Dd5Aceca30") + + expected_response = { + "balance": "1500.123", + "codeHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "1234567890", + } + + assert response == expected_response + + @pytest.mark.asyncio + async def test_fetch_cosmos_account(self, evm_servicer): + evm_servicer.cosmos_account_responses.append( + evm_query_pb.QueryCosmosAccountResponse( + cosmos_address="inj1234567890abcdefghijklmnopqrstuvwxyz", + sequence=1234567890, + account_number=12344321, + ) + ) + + api = self._api_instance(evm_servicer) + response = await api.fetch_cosmos_account(address="0xe28b3B32B6c345A34Ff64674606124Dd5Aceca30") + + expected_response = { + "cosmosAddress": "inj1234567890abcdefghijklmnopqrstuvwxyz", + "sequence": "1234567890", + "accountNumber": "12344321", + } + + assert response == expected_response + + @pytest.mark.asyncio + async def test_fetch_validator_account(self, evm_servicer): + evm_servicer.validator_account_responses.append( + evm_query_pb.QueryValidatorAccountResponse( + account_address="inj1234567890abcdefghijklmnopqrstuvwxyz", + sequence=1234567890, + account_number=12344321, + ) + ) + + api = self._api_instance(evm_servicer) + response = await api.fetch_validator_account(cons_address="injvalcons1h5u937etuat5hnr2s34yaaalfpkkscl5ndadqm") + + expected_response = { + "accountAddress": "inj1234567890abcdefghijklmnopqrstuvwxyz", + "sequence": "1234567890", + "accountNumber": "12344321", + } + + assert response == expected_response + + @pytest.mark.asyncio + async def test_fetch_balance(self, evm_servicer): + evm_servicer.balance_responses.append( + evm_query_pb.QueryBalanceResponse( + balance="1500.123", + ) + ) + + api = self._api_instance(evm_servicer) + response = await api.fetch_balance(address="0xe28b3B32B6c345A34Ff64674606124Dd5Aceca30") + + expected_response = { + "balance": "1500.123", + } + + assert response == expected_response + + @pytest.mark.asyncio + async def test_fetch_storage(self, evm_servicer): + evm_servicer.storage_responses.append( + evm_query_pb.QueryStorageResponse( + value="0x0000000000000000000000000000000000000000000000000000000000000000", + ) + ) + + api = self._api_instance(evm_servicer) + response = await api.fetch_storage( + address="0xe28b3B32B6c345A34Ff64674606124Dd5Aceca30", + key="0x0000000000000000000000000000000000000000000000000000000000000000", + ) + + expected_response = { + "value": "0x0000000000000000000000000000000000000000000000000000000000000000", + } + + assert response == expected_response + + @pytest.mark.asyncio + async def test_fetch_code(self, evm_servicer): + code_response = evm_query_pb.QueryCodeResponse( + code=b"\305\322F\001\206\367#<\222~}\262\334\307\003\300\345\000\266S\312\202';{\372\330\004]\205\244p", + ) + evm_servicer.code_responses.append(code_response) + + api = self._api_instance(evm_servicer) + response = await api.fetch_code(address="0xe28b3B32B6c345A34Ff64674606124Dd5Aceca30") + + expected_response = { + "code": base64.b64encode(code_response.code).decode(), + } + + assert response == expected_response + + @pytest.mark.asyncio + async def test_fetch_base_fee(self, evm_servicer): + evm_servicer.base_fee_responses.append( + evm_query_pb.QueryBaseFeeResponse( + base_fee="160000000", + ) + ) + + api = self._api_instance(evm_servicer) + resposne = await api.fetch_base_fee() + + expected_response = { + "baseFee": "160000000", + } + + assert resposne["baseFee"] == expected_response["baseFee"] + + def _api_instance(self, servicer): + network = Network.devnet() + channel = grpc.aio.insecure_channel(network.grpc_endpoint) + cookie_assistant = DisabledCookieAssistant() + + api = ChainGrpcEVMApi(channel=channel, cookie_assistant=cookie_assistant) + api._stub = servicer + + return api diff --git a/tests/client/indexer/grpc/test_indexer_grpc_derivative_api.py b/tests/client/indexer/grpc/test_indexer_grpc_derivative_api.py index 50d0c210..8a09c5e6 100644 --- a/tests/client/indexer/grpc/test_indexer_grpc_derivative_api.py +++ b/tests/client/indexer/grpc/test_indexer_grpc_derivative_api.py @@ -37,6 +37,7 @@ async def test_fetch_markets( cumulative_funding="-82680.076492986572881307", cumulative_price="-78.41752505919454668", last_timestamp=1700004260, + last_funding_rate="0.12345", ) market = exchange_derivative_pb.DerivativeMarketInfo( @@ -49,6 +50,7 @@ async def test_fetch_markets( oracle_scale_factor=6, initial_margin_ratio="0.05", maintenance_margin_ratio="0.02", + reduce_margin_ratio="0.3", quote_denom="peggy0x87aB3B4C8661e07D6372361211B96ed4Dc36B1B5", quote_token_meta=quote_token_meta, maker_fee_rate="-0.0001", @@ -86,6 +88,7 @@ async def test_fetch_markets( "oracleScaleFactor": market.oracle_scale_factor, "initialMarginRatio": market.initial_margin_ratio, "maintenanceMarginRatio": market.maintenance_margin_ratio, + "reduceMarginRatio": market.reduce_margin_ratio, "quoteDenom": market.quote_denom, "quoteTokenMeta": { "name": market.quote_token_meta.name, @@ -112,6 +115,7 @@ async def test_fetch_markets( "cumulativeFunding": perpetual_market_funding.cumulative_funding, "cumulativePrice": perpetual_market_funding.cumulative_price, "lastTimestamp": str(perpetual_market_funding.last_timestamp), + "lastFundingRate": perpetual_market_funding.last_funding_rate, }, } ] @@ -142,6 +146,7 @@ async def test_fetch_market( cumulative_funding="-82680.076492986572881307", cumulative_price="-78.41752505919454668", last_timestamp=1700004260, + last_funding_rate="0.12345", ) market = exchange_derivative_pb.DerivativeMarketInfo( @@ -154,6 +159,7 @@ async def test_fetch_market( oracle_scale_factor=6, initial_margin_ratio="0.05", maintenance_margin_ratio="0.02", + reduce_margin_ratio="0.3", quote_denom="peggy0x87aB3B4C8661e07D6372361211B96ed4Dc36B1B5", quote_token_meta=quote_token_meta, maker_fee_rate="-0.0001", @@ -187,6 +193,7 @@ async def test_fetch_market( "oracleScaleFactor": market.oracle_scale_factor, "initialMarginRatio": market.initial_margin_ratio, "maintenanceMarginRatio": market.maintenance_margin_ratio, + "reduceMarginRatio": market.reduce_margin_ratio, "quoteDenom": market.quote_denom, "quoteTokenMeta": { "name": market.quote_token_meta.name, @@ -213,6 +220,7 @@ async def test_fetch_market( "cumulativeFunding": perpetual_market_funding.cumulative_funding, "cumulativePrice": perpetual_market_funding.cumulative_price, "lastTimestamp": str(perpetual_market_funding.last_timestamp), + "lastFundingRate": perpetual_market_funding.last_funding_rate, }, } } diff --git a/tests/client/indexer/stream_grpc/test_indexer_grpc_derivative_stream.py b/tests/client/indexer/stream_grpc/test_indexer_grpc_derivative_stream.py index 80637cc6..f8e33847 100644 --- a/tests/client/indexer/stream_grpc/test_indexer_grpc_derivative_stream.py +++ b/tests/client/indexer/stream_grpc/test_indexer_grpc_derivative_stream.py @@ -42,6 +42,7 @@ async def test_stream_market( cumulative_funding="-82680.076492986572881307", cumulative_price="-78.41752505919454668", last_timestamp=1700004260, + last_funding_rate="0.12345", ) market = exchange_derivative_pb.DerivativeMarketInfo( @@ -54,6 +55,7 @@ async def test_stream_market( oracle_scale_factor=6, initial_margin_ratio="0.05", maintenance_margin_ratio="0.02", + reduce_margin_ratio="0.3", quote_denom="peggy0x87aB3B4C8661e07D6372361211B96ed4Dc36B1B5", quote_token_meta=quote_token_meta, maker_fee_rate="-0.0001", @@ -103,6 +105,7 @@ async def test_stream_market( "oracleScaleFactor": market.oracle_scale_factor, "initialMarginRatio": market.initial_margin_ratio, "maintenanceMarginRatio": market.maintenance_margin_ratio, + "reduceMarginRatio": market.reduce_margin_ratio, "quoteDenom": market.quote_denom, "quoteTokenMeta": { "name": market.quote_token_meta.name, @@ -129,6 +132,7 @@ async def test_stream_market( "cumulativeFunding": perpetual_market_funding.cumulative_funding, "cumulativePrice": perpetual_market_funding.cumulative_price, "lastTimestamp": str(perpetual_market_funding.last_timestamp), + "lastFundingRate": perpetual_market_funding.last_funding_rate, }, }, "operationType": operation_type, diff --git a/tests/test_composer.py b/tests/test_composer.py index 3e77e45c..130b55d8 100644 --- a/tests/test_composer.py +++ b/tests/test_composer.py @@ -2173,3 +2173,41 @@ def test_msg_send(self, basic_composer): always_print_fields_with_no_presence=True, ) assert dict_message == expected_message + + def test_msg_create_token_pair(self, basic_composer): + message = basic_composer.msg_create_token_pair( + sender="sender", + bank_denom="denom", + erc20_address="erc20_address", + ) + + expected_message = { + "sender": "sender", + "tokenPair": { + "bankDenom": "denom", + "erc20Address": "erc20_address", + }, + } + + dict_message = json_format.MessageToDict( + message=message, + always_print_fields_with_no_presence=True, + ) + assert dict_message == expected_message + + def test_msg_delete_token_pair(self, basic_composer): + message = basic_composer.msg_delete_token_pair( + sender="sender", + bank_denom="denom", + ) + + expected_message = { + "sender": "sender", + "bankDenom": "denom", + } + + dict_message = json_format.MessageToDict( + message=message, + always_print_fields_with_no_presence=True, + ) + assert dict_message == expected_message From 9ef69b152763554a29c5ef88b6e12c3d67692918 Mon Sep 17 00:00:00 2001 From: Abel Armoa <30988000+aarmoa@users.noreply.github.com> Date: Wed, 28 May 2025 17:45:37 -0300 Subject: [PATCH 2/3] cp-396: fixed typos --- tests/client/chain/grpc/test_chain_grpc_erc20_api.py | 2 +- tests/client/chain/grpc/test_chain_grpc_evm_api.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/client/chain/grpc/test_chain_grpc_erc20_api.py b/tests/client/chain/grpc/test_chain_grpc_erc20_api.py index d2d24087..a9f08941 100644 --- a/tests/client/chain/grpc/test_chain_grpc_erc20_api.py +++ b/tests/client/chain/grpc/test_chain_grpc_erc20_api.py @@ -16,7 +16,7 @@ def erc20_servicer(): return ConfigurableERC20QueryServicer() -class TestChainGrpcBankApi: +class TestChainGrpcERC20Api: @pytest.mark.asyncio async def test_fetch_erc20_params( self, diff --git a/tests/client/chain/grpc/test_chain_grpc_evm_api.py b/tests/client/chain/grpc/test_chain_grpc_evm_api.py index f6378033..551953ca 100644 --- a/tests/client/chain/grpc/test_chain_grpc_evm_api.py +++ b/tests/client/chain/grpc/test_chain_grpc_evm_api.py @@ -18,7 +18,7 @@ def evm_servicer(): return ConfigurableEVMQueryServicer() -class TestChainGrpcBankApi: +class TestChainGrpcEVMApi: @pytest.mark.asyncio async def test_fetch_evm_params( self, @@ -231,13 +231,13 @@ async def test_fetch_base_fee(self, evm_servicer): ) api = self._api_instance(evm_servicer) - resposne = await api.fetch_base_fee() + response = await api.fetch_base_fee() expected_response = { "baseFee": "160000000", } - assert resposne["baseFee"] == expected_response["baseFee"] + assert response == expected_response def _api_instance(self, servicer): network = Network.devnet() From d8112fb0ff34faaf201e8b1303caedb15c7393a3 Mon Sep 17 00:00:00 2001 From: Abel Armoa <30988000+aarmoa@users.noreply.github.com> Date: Wed, 28 May 2025 23:43:22 -0300 Subject: [PATCH 3/3] fix: updated AsyncClient tests to try to avoid tests hanging when executed in Windows machines --- tests/test_async_client.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tests/test_async_client.py b/tests/test_async_client.py index 46e30d4b..6b11ab6b 100644 --- a/tests/test_async_client.py +++ b/tests/test_async_client.py @@ -9,6 +9,7 @@ from pyinjective.proto.injective.exchange.v2 import query_pb2 as exchange_query_pb from tests.client.chain.grpc.configurable_bank_query_servicer import ConfigurableBankQueryServicer from tests.client.chain.grpc.configurable_exchange_v2_query_servicer import ConfigurableExchangeV2QueryServicer +from tests.core.tendermint.grpc.configurable_tendermint_query_servicer import ConfigurableTendermintQueryServicer from tests.rpc_fixtures.markets_fixtures import ( # noqa: F401 ape_token_meta, ape_usdt_spot_market_meta, @@ -33,13 +34,20 @@ def exchange_servicer(): return ConfigurableExchangeV2QueryServicer() +@pytest.fixture +def tendermint_servicer(): + return ConfigurableTendermintQueryServicer() + + class TestAsyncClient: @pytest.mark.asyncio - async def test_sync_timeout_height_logs_exception(self, caplog): + async def test_sync_timeout_height_logs_exception(self, caplog, tendermint_servicer): client = AsyncClient( network=Network.local(), ) + client.tendermint_api._stub = tendermint_servicer + with caplog.at_level(logging.DEBUG): await client.sync_timeout_height() @@ -53,11 +61,13 @@ async def test_sync_timeout_height_logs_exception(self, caplog): assert found_log[1] == logging.DEBUG @pytest.mark.asyncio - async def test_get_account_logs_exception(self, caplog): + async def test_get_account_logs_exception(self, caplog, tendermint_servicer): client = AsyncClient( network=Network.local(), ) + client.tendermint_api._stub = tendermint_servicer + with caplog.at_level(logging.DEBUG): await client.fetch_account(address="") @@ -74,6 +84,7 @@ async def test_get_account_logs_exception(self, caplog): async def test_initialize_tokens_and_markets( self, exchange_servicer, + tendermint_servicer, inj_usdt_spot_market_meta, ape_usdt_spot_market_meta, btc_usdt_perp_market_meta, @@ -163,6 +174,7 @@ async def test_initialize_tokens_and_markets( ) client.chain_exchange_v2_api._stub = exchange_servicer + client.tendermint_api._stub = tendermint_servicer await client._initialize_tokens_and_markets() @@ -199,6 +211,7 @@ async def test_initialize_tokens_and_markets( async def test_tokens_and_markets_initialization_read_tokens_from_official_list( self, exchange_servicer, + tendermint_servicer, inj_usdt_spot_market_meta, ape_usdt_spot_market_meta, btc_usdt_perp_market_meta, @@ -255,6 +268,7 @@ async def test_tokens_and_markets_initialization_read_tokens_from_official_list( ) client.chain_exchange_v2_api._stub = exchange_servicer + client.tendermint_api._stub = tendermint_servicer await client._initialize_tokens_and_markets() @@ -267,6 +281,7 @@ async def test_initialize_tokens_from_chain_denoms( self, bank_servicer, exchange_servicer, + tendermint_servicer, smart_denom_metadata, aioresponses, ): @@ -296,8 +311,9 @@ async def test_initialize_tokens_from_chain_denoms( network=test_network, ) - client.chain_exchange_v2_api._stub = exchange_servicer client.bank_api._stub = bank_servicer + client.chain_exchange_v2_api._stub = exchange_servicer + client.tendermint_api._stub = tendermint_servicer await client._initialize_tokens_and_markets() await client.initialize_tokens_from_chain_denoms()