diff --git a/stake-pool/py/stake/state.py b/stake-pool/py/stake/state.py index 1d6d573dab5..8d8ac81f128 100644 --- a/stake-pool/py/stake/state.py +++ b/stake-pool/py/stake/state.py @@ -48,7 +48,7 @@ class StakeAuthorize(IntEnum): WITHDRAWER = 1 -class StakeStateV2Type(IntEnum): +class StakeStakeType(IntEnum): """Stake State Types.""" UNINITIALIZED = 0 INITIALIZED = 1 @@ -56,8 +56,8 @@ class StakeStateV2Type(IntEnum): REWARDS_POOL = 3 -class StakeStateV2(NamedTuple): - state_type: StakeStateV2Type +class StakeStake(NamedTuple): + state_type: StakeStakeType state: Container """Stake state.""" @@ -65,7 +65,7 @@ class StakeStateV2(NamedTuple): def decode(cls, data: str, encoding: str): data_bytes = decode_byte_string(data, encoding) parsed = STAKE_STATE_LAYOUT.parse(data_bytes) - return StakeStateV2( + return StakeStake( state_type=parsed['state_type'], state=parsed['state'], ) @@ -122,9 +122,9 @@ def decode(cls, data: str, encoding: str): # Switch( # lambda this: this.state, # { - # StakeStateV2Type.UNINITIALIZED: Pass, - # StakeStateV2Type.INITIALIZED: META_LAYOUT, - # StakeStateV2Type.STAKE: STAKE_AND_META_LAYOUT, + # StakeStakeType.UNINITIALIZED: Pass, + # StakeStakeType.INITIALIZED: META_LAYOUT, + # StakeStakeType.STAKE: STAKE_AND_META_LAYOUT, # } # ), # diff --git a/stake-pool/py/tests/test_deposit_withdraw_stake.py b/stake-pool/py/tests/test_deposit_withdraw_stake.py index e67adeadd52..890fb9d1f4d 100644 --- a/stake-pool/py/tests/test_deposit_withdraw_stake.py +++ b/stake-pool/py/tests/test_deposit_withdraw_stake.py @@ -5,7 +5,7 @@ from stake.actions import create_stake, delegate_stake from stake.constants import STAKE_LEN -from stake.state import StakeStateV2 +from stake.state import StakeStake from stake_pool.actions import deposit_stake, withdraw_stake, update_stake_pool from stake_pool.constants import MINIMUM_ACTIVE_STAKE from stake_pool.state import StakePool @@ -25,7 +25,7 @@ async def test_deposit_withdraw_stake(async_client, validators, payer, stake_poo await delegate_stake(async_client, payer, payer, stake, validator) resp = await async_client.get_account_info(stake, commitment=Confirmed) data = resp['result']['value']['data'] - stake_state = StakeStateV2.decode(data[0], data[1]) + stake_state = StakeStake.decode(data[0], data[1]) token_account = get_associated_token_address(payer.public_key, stake_pool.pool_mint) pre_pool_token_balance = await async_client.get_token_account_balance(token_account, Confirmed) pre_pool_token_balance = int(pre_pool_token_balance['result']['value']['amount'])