GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: fix cases · InjectiveLabs/sdk-python@f7e355c

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • examples/chain_client/exchange/query
    • 47_MitoVaultInfos.py
  • pyinjective
    • async_client_v2.py
    • client/chain/grpc
      • chain_grpc_exchange_v2_api.py
    • proto/injective/exchange/v2
      • query_pb2.py
  • tests
    • client
      • chain/grpc
        • configurable_exchange_v2_query_servicer.py
        • test_chain_grpc_exchange_v2_api.py
        • test_chain_grpc_insurance_api.py
        • test_chain_grpc_permissions_api.py
      • indexer
        • grpc
          • test_indexer_grpc_derivative_api.py
        • stream_grpc
          • test_indexer_grpc_derivative_stream.py
    • test_composer_v2.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎examples/chain_client/exchange/query/47_MitoVaultInfos.py‎

Copy file name to clipboardExpand all lines: examples/chain_client/exchange/query/47_MitoVaultInfos.py
-19Lines changed: 0 additions & 19 deletions
This file was deleted.
Collapse file

‎pyinjective/async_client_v2.py‎

Copy file name to clipboardExpand all lines: pyinjective/async_client_v2.py
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -473,9 +473,6 @@ async def fetch_balance_with_balance_holds(self) -> Dict[str, Any]:
473473
async def fetch_fee_discount_tier_statistics(self) -> Dict[str, Any]:
474474
return await self.chain_exchange_v2_api.fetch_fee_discount_tier_statistics()
475475

476-
async def fetch_mito_vault_infos(self) -> Dict[str, Any]:
477-
return await self.chain_exchange_v2_api.fetch_mito_vault_infos()
478-
479476
async def fetch_market_id_from_vault(self, vault_address: str) -> Dict[str, Any]:
480477
return await self.chain_exchange_v2_api.fetch_market_id_from_vault(vault_address=vault_address)
481478

Collapse file

‎pyinjective/client/chain/grpc/chain_grpc_exchange_v2_api.py‎

Copy file name to clipboardExpand all lines: pyinjective/client/chain/grpc/chain_grpc_exchange_v2_api.py
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -499,12 +499,6 @@ async def fetch_fee_discount_tier_statistics(self) -> Dict[str, Any]:
499499

500500
return response
501501

502-
async def fetch_mito_vault_infos(self) -> Dict[str, Any]:
503-
request = exchange_query_pb.MitoVaultInfosRequest()
504-
response = await self._execute_call(call=self._stub.MitoVaultInfos, request=request)
505-
506-
return response
507-
508502
async def fetch_market_id_from_vault(self, vault_address: str) -> Dict[str, Any]:
509503
request = exchange_query_pb.QueryMarketIDFromVaultRequest(vault_address=vault_address)
510504
response = await self._execute_call(call=self._stub.QueryMarketIDFromVault, request=request)
Collapse file

‎pyinjective/proto/injective/exchange/v2/query_pb2.py‎

Copy file name to clipboardExpand all lines: pyinjective/proto/injective/exchange/v2/query_pb2.py
+11-7Lines changed: 11 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎tests/client/chain/grpc/configurable_exchange_v2_query_servicer.py‎

Copy file name to clipboardExpand all lines: tests/client/chain/grpc/configurable_exchange_v2_query_servicer.py
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ def __init__(self):
5757
self.balance_mismatches_responses = deque()
5858
self.balance_with_balance_holds_responses = deque()
5959
self.fee_discount_tier_statistics_responses = deque()
60-
self.mito_vault_infos_responses = deque()
6160
self.market_id_from_vault_responses = deque()
6261
self.historical_trade_records_responses = deque()
6362
self.is_opted_out_of_rewards_responses = deque()
@@ -307,9 +306,6 @@ async def FeeDiscountTierStatistics(
307306
):
308307
return self.fee_discount_tier_statistics_responses.pop()
309308

310-
async def MitoVaultInfos(self, request: exchange_query_pb.MitoVaultInfosRequest, context=None, metadata=None):
311-
return self.mito_vault_infos_responses.pop()
312-
313309
async def QueryMarketIDFromVault(
314310
self, request: exchange_query_pb.QueryMarketIDFromVaultRequest, context=None, metadata=None
315311
):
Collapse file

‎tests/client/chain/grpc/test_chain_grpc_exchange_v2_api.py‎

Copy file name to clipboardExpand all lines: tests/client/chain/grpc/test_chain_grpc_exchange_v2_api.py
+48-25Lines changed: 48 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import grpc
44
import pytest
55

6+
from pyinjective.async_client_v2 import AsyncClient
67
from pyinjective.client.chain.grpc.chain_grpc_exchange_v2_api import ChainGrpcExchangeV2Api
78
from pyinjective.client.model.pagination import PaginationOption
89
from pyinjective.core.network import DisabledCookieAssistant, Network
@@ -72,6 +73,7 @@ async def test_fetch_exchange_params(
7273
deprecated_enforced_restrictions_contracts=[],
7374
white_knight_liquidators=white_knight_liquidators,
7475
white_knight_liquidator_reward_share_rate="0.050000000000000000",
76+
min_expiry_futures_market_duration_seconds=3600,
7577
)
7678
exchange_servicer.exchange_params.append(exchange_query_pb.QueryExchangeParamsResponse(params=params))
7779

@@ -130,6 +132,7 @@ async def test_fetch_exchange_params(
130132
"deprecatedEnforcedRestrictionsContracts": params.deprecated_enforced_restrictions_contracts,
131133
"whiteKnightLiquidators": params.white_knight_liquidators,
132134
"whiteKnightLiquidatorRewardShareRate": params.white_knight_liquidator_reward_share_rate,
135+
"minExpiryFuturesMarketDurationSeconds": str(params.min_expiry_futures_market_duration_seconds),
133136
}
134137
}
135138

@@ -1290,18 +1293,23 @@ async def test_fetch_derivative_markets(
12901293
open_notional_cap=open_notional_cap,
12911294
has_disabled_minimal_protocol_fee=False,
12921295
cross_margin_eligible=False,
1296+
synthetic_trade_fee_rate="1000000000000000",
12931297
)
12941298
market_info = market_pb.PerpetualMarketInfo(
12951299
market_id="0x17ef48032cb24375ba7c2e39f384e56433bcab20cbee9a7357e4cba2eb00abe6",
12961300
hourly_funding_rate_cap="625000000000000",
12971301
hourly_interest_rate="4166660000000",
12981302
next_funding_timestamp=1708099200,
12991303
funding_interval=3600,
1304+
funding_impact_notional="1000000000000000000000",
13001305
)
13011306
funding_info = market_pb.PerpetualMarketFunding(
13021307
cumulative_funding="-107853477278881692857461",
13031308
cumulative_price="0",
13041309
last_timestamp=1708099200,
1310+
period_start=1708095600,
1311+
last_premium="100000000000000",
1312+
last_sample_timestamp=1708099140,
13051313
)
13061314
perpetual_info = exchange_query_pb.PerpetualMarketState(
13071315
market_info=market_info,
@@ -1361,6 +1369,7 @@ async def test_fetch_derivative_markets(
13611369
},
13621370
"hasDisabledMinimalProtocolFee": market.has_disabled_minimal_protocol_fee,
13631371
"crossMarginEligible": market.cross_margin_eligible,
1372+
"syntheticTradeFeeRate": market.synthetic_trade_fee_rate,
13641373
},
13651374
"perpetualInfo": {
13661375
"marketInfo": {
@@ -1369,11 +1378,15 @@ async def test_fetch_derivative_markets(
13691378
"hourlyInterestRate": market_info.hourly_interest_rate,
13701379
"nextFundingTimestamp": str(market_info.next_funding_timestamp),
13711380
"fundingInterval": str(market_info.funding_interval),
1381+
"fundingImpactNotional": market_info.funding_impact_notional,
13721382
},
13731383
"fundingInfo": {
13741384
"cumulativeFunding": funding_info.cumulative_funding,
13751385
"cumulativePrice": funding_info.cumulative_price,
13761386
"lastTimestamp": str(funding_info.last_timestamp),
1387+
"periodStart": str(funding_info.period_start),
1388+
"lastPremium": funding_info.last_premium,
1389+
"lastSampleTimestamp": str(funding_info.last_sample_timestamp),
13771390
},
13781391
},
13791392
"markPrice": full_market.mark_price,
@@ -1417,18 +1430,23 @@ async def test_fetch_derivative_market(
14171430
quote_decimals=6,
14181431
has_disabled_minimal_protocol_fee=False,
14191432
cross_margin_eligible=False,
1433+
synthetic_trade_fee_rate="1000000000000000",
14201434
)
14211435
market_info = market_pb.PerpetualMarketInfo(
14221436
market_id="0x17ef48032cb24375ba7c2e39f384e56433bcab20cbee9a7357e4cba2eb00abe6",
14231437
hourly_funding_rate_cap="625000000000000",
14241438
hourly_interest_rate="4166660000000",
14251439
next_funding_timestamp=1708099200,
14261440
funding_interval=3600,
1441+
funding_impact_notional="1000000000000000000000",
14271442
)
14281443
funding_info = market_pb.PerpetualMarketFunding(
14291444
cumulative_funding="-107853477278881692857461",
14301445
cumulative_price="0",
14311446
last_timestamp=1708099200,
1447+
period_start=1708095600,
1448+
last_premium="100000000000000",
1449+
last_sample_timestamp=1708099140,
14321450
)
14331451
perpetual_info = exchange_query_pb.PerpetualMarketState(
14341452
market_info=market_info,
@@ -1483,6 +1501,7 @@ async def test_fetch_derivative_market(
14831501
"quoteDecimals": market.quote_decimals,
14841502
"hasDisabledMinimalProtocolFee": market.has_disabled_minimal_protocol_fee,
14851503
"crossMarginEligible": market.cross_margin_eligible,
1504+
"syntheticTradeFeeRate": market.synthetic_trade_fee_rate,
14861505
},
14871506
"perpetualInfo": {
14881507
"marketInfo": {
@@ -1491,11 +1510,15 @@ async def test_fetch_derivative_market(
14911510
"hourlyInterestRate": market_info.hourly_interest_rate,
14921511
"nextFundingTimestamp": str(market_info.next_funding_timestamp),
14931512
"fundingInterval": str(market_info.funding_interval),
1513+
"fundingImpactNotional": market_info.funding_impact_notional,
14941514
},
14951515
"fundingInfo": {
14961516
"cumulativeFunding": funding_info.cumulative_funding,
14971517
"cumulativePrice": funding_info.cumulative_price,
14981518
"lastTimestamp": str(funding_info.last_timestamp),
1519+
"periodStart": str(funding_info.period_start),
1520+
"lastPremium": funding_info.last_premium,
1521+
"lastSampleTimestamp": str(funding_info.last_sample_timestamp),
14991522
},
15001523
},
15011524
"markPrice": full_market.mark_price,
@@ -1769,6 +1792,7 @@ async def test_fetch_perpetual_market_info(
17691792
hourly_interest_rate="4166660000000",
17701793
next_funding_timestamp=1708099200,
17711794
funding_interval=3600,
1795+
funding_impact_notional="1000000000000000000000",
17721796
)
17731797
exchange_servicer.perpetual_market_info_responses.append(
17741798
exchange_query_pb.QueryPerpetualMarketInfoResponse(info=perpetual_market_info)
@@ -1784,6 +1808,7 @@ async def test_fetch_perpetual_market_info(
17841808
"hourlyInterestRate": perpetual_market_info.hourly_interest_rate,
17851809
"nextFundingTimestamp": str(perpetual_market_info.next_funding_timestamp),
17861810
"fundingInterval": str(perpetual_market_info.funding_interval),
1811+
"fundingImpactNotional": perpetual_market_info.funding_impact_notional,
17871812
}
17881813
}
17891814

@@ -1837,6 +1862,9 @@ async def test_fetch_perpetual_market_funding(
18371862
cumulative_funding="-107853477278881692857461",
18381863
cumulative_price="0",
18391864
last_timestamp=1708099200,
1865+
period_start=1708095600,
1866+
last_premium="100000000000000",
1867+
last_sample_timestamp=1708099140,
18401868
)
18411869
exchange_servicer.perpetual_market_funding_responses.append(
18421870
exchange_query_pb.QueryPerpetualMarketFundingResponse(state=perpetual_market_funding)
@@ -1852,6 +1880,9 @@ async def test_fetch_perpetual_market_funding(
18521880
"cumulativeFunding": perpetual_market_funding.cumulative_funding,
18531881
"cumulativePrice": perpetual_market_funding.cumulative_price,
18541882
"lastTimestamp": str(perpetual_market_funding.last_timestamp),
1883+
"periodStart": str(perpetual_market_funding.period_start),
1884+
"lastPremium": perpetual_market_funding.last_premium,
1885+
"lastSampleTimestamp": str(perpetual_market_funding.last_sample_timestamp),
18551886
}
18561887
}
18571888

@@ -2240,34 +2271,26 @@ async def test_fetch_fee_discount_tier_statistics(
22402271

22412272
assert statistics == expected_statistics
22422273

2243-
@pytest.mark.asyncio
2244-
async def test_fetch_mito_vault_infos(
2245-
self,
2246-
exchange_servicer,
2247-
):
2248-
master_address = "inj1zlh5sqevkfphtwnu9cul8p89vseme2eqt0snn9"
2249-
derivative_address = "inj1zlh5"
2250-
spot_address = "inj1zlh6"
2251-
cw20_address = "inj1zlh7"
2252-
response = exchange_query_pb.MitoVaultInfosResponse(
2253-
master_addresses=[master_address],
2254-
derivative_addresses=[derivative_address],
2255-
spot_addresses=[spot_address],
2256-
cw20_addresses=[cw20_address],
2257-
)
2258-
exchange_servicer.mito_vault_infos_responses.append(response)
2274+
def test_mito_vault_info_types_remain_serializable(self):
2275+
request = exchange_query_pb.MitoVaultInfosRequest.FromString(b"")
2276+
assert request.SerializeToString() == b""
22592277

2260-
api = self._api_instance(servicer=exchange_servicer)
2278+
payload = b"\n\x06master\x12\x0aderivative\x1a\x04spot\x22\x04cw20"
2279+
response = exchange_query_pb.MitoVaultInfosResponse.FromString(payload)
2280+
assert response == exchange_query_pb.MitoVaultInfosResponse(
2281+
master_addresses=["master"],
2282+
derivative_addresses=["derivative"],
2283+
spot_addresses=["spot"],
2284+
cw20_addresses=["cw20"],
2285+
)
2286+
assert response.SerializeToString() == payload
22612287

2262-
mito_vaults = await api.fetch_mito_vault_infos()
2263-
expected_mito_vaults = {
2264-
"masterAddresses": [master_address],
2265-
"derivativeAddresses": [derivative_address],
2266-
"spotAddresses": [spot_address],
2267-
"cw20Addresses": [cw20_address],
2268-
}
2288+
@pytest.mark.parametrize("client_type", [ChainGrpcExchangeV2Api, AsyncClient])
2289+
def test_fetch_mito_vault_infos_is_unavailable(self, client_type):
2290+
with pytest.raises(AttributeError, match="fetch_mito_vault_infos"):
2291+
getattr(client_type, "fetch_mito_vault_infos")
22692292

2270-
assert mito_vaults == expected_mito_vaults
2293+
assert "MitoVaultInfos" not in exchange_query_pb.DESCRIPTOR.services_by_name["Query"].methods_by_name
22712294

22722295
@pytest.mark.asyncio
22732296
async def test_fetch_market_id_from_vault(
Collapse file

‎tests/client/chain/grpc/test_chain_grpc_insurance_api.py‎

Copy file name to clipboardExpand all lines: tests/client/chain/grpc/test_chain_grpc_insurance_api.py
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ async def test_fetch_module_state(self, insurance_servicer):
167167
"failedRedemptionSchedules": [],
168168
"nextFailedRedemptionScheduleId": "0",
169169
"vouchers": [],
170+
"consolidatedInsurancePools": [],
171+
"consolidatedInsurancePolicies": [],
172+
"consolidatedRedemptionSchedules": [],
173+
"nextConsolidatedRedemptionScheduleId": "0",
174+
"consolidatedReservationCursor": "",
170175
}
171176
}
172177

Collapse file

‎tests/client/chain/grpc/test_chain_grpc_permissions_api.py‎

Copy file name to clipboardExpand all lines: tests/client/chain/grpc/test_chain_grpc_permissions_api.py
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ async def test_fetch_module_params(
3636
contract_hook_max_gas=1000000,
3737
deprecated_enforced_restrictions_contracts=["inj1knhahceyp57j5x7xh69p7utegnnnfgxavmahjr"],
3838
enforced_restrictions_evm_contracts=[enforced_restrictions_evm_contract],
39+
owner_blacklist_query_max_gas=500000,
3940
)
4041
permissions_servicer.permissions_params.append(permissions_query_pb.QueryParamsResponse(params=params))
4142

@@ -45,6 +46,7 @@ async def test_fetch_module_params(
4546
expected_params = {
4647
"params": {
4748
"contractHookMaxGas": str(params.contract_hook_max_gas),
49+
"ownerBlacklistQueryMaxGas": str(params.owner_blacklist_query_max_gas),
4850
"deprecatedEnforcedRestrictionsContracts": params.deprecated_enforced_restrictions_contracts,
4951
"enforcedRestrictionsEvmContracts": [
5052
{
@@ -496,6 +498,7 @@ async def test_fetch_permissions_module_state(
496498
contract_hook_max_gas=1000000,
497499
deprecated_enforced_restrictions_contracts=["inj1knhahceyp57j5x7xh69p7utegnnnfgxavmahjr"],
498500
enforced_restrictions_evm_contracts=[enforced_restrictions_evm_contract],
501+
owner_blacklist_query_max_gas=500000,
499502
)
500503
role_permission = permissions_pb.Role(
501504
name="role1",
@@ -553,6 +556,7 @@ async def test_fetch_permissions_module_state(
553556
"state": {
554557
"params": {
555558
"contractHookMaxGas": str(params.contract_hook_max_gas),
559+
"ownerBlacklistQueryMaxGas": str(params.owner_blacklist_query_max_gas),
556560
"deprecatedEnforcedRestrictionsContracts": params.deprecated_enforced_restrictions_contracts,
557561
"enforcedRestrictionsEvmContracts": [
558562
{
Collapse file

‎tests/client/indexer/grpc/test_indexer_grpc_derivative_api.py‎

Copy file name to clipboardExpand all lines: tests/client/indexer/grpc/test_indexer_grpc_derivative_api.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,7 @@ async def test_fetch_positions_v2(
720720
cumulative_funding_entry="20000.123456789",
721721
effective_cumulative_funding_entry="30000.123456789",
722722
upnl="10.123456789",
723+
cumulative_margin="561065.540974",
723724
)
724725

725726
paging = exchange_derivative_pb.Paging(total=5, to=5, count_by_subaccount=10, next=["next1", "next2"])
@@ -769,6 +770,7 @@ async def test_fetch_positions_v2(
769770
"initialMargin": position.initial_margin,
770771
"initialEntryPrice": position.initial_entry_price,
771772
"initialQuantity": position.initial_quantity,
773+
"cumulativeMargin": position.cumulative_margin,
772774
},
773775
],
774776
"paging": {
Collapse file

‎tests/client/indexer/stream_grpc/test_indexer_grpc_derivative_stream.py‎

Copy file name to clipboardExpand all lines: tests/client/indexer/stream_grpc/test_indexer_grpc_derivative_stream.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,7 @@ async def test_stream_positions_v2(
825825
cumulative_funding_entry="20000.123456789",
826826
effective_cumulative_funding_entry="30000.123456789",
827827
upnl="10.123456789",
828+
cumulative_margin="561065.540974",
828829
)
829830

830831
derivative_servicer.stream_positions_v2_responses.append(
@@ -877,6 +878,7 @@ async def test_stream_positions_v2(
877878
"initialMargin": position.initial_margin,
878879
"initialEntryPrice": position.initial_entry_price,
879880
"initialQuantity": position.initial_quantity,
881+
"cumulativeMargin": position.cumulative_margin,
880882
},
881883
"timestamp": str(timestamp),
882884
"operationType": "",

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.