@@ -42,14 +42,36 @@ def test_stake_delegation(self):
4242 )
4343 stake_registration = StakeRegistration (stake_credential )
4444 pool_hash = PoolKeyHash (bytes .fromhex (os .environ .get ("POOL_ID" ).strip ()))
45- stake_delegation = StakeDelegation (stake_credential , pool_keyhash = pool_hash )
45+ # stake_delegation = StakeDelegation(stake_credential, pool_keyhash=pool_hash)
46+
47+ drep = DRep (
48+ DRepKind .VERIFICATION_KEY_HASH ,
49+ self .stake_key_pair .verification_key .hash (),
50+ )
51+
52+ drep_credential = DRepCredential (
53+ self .stake_key_pair .verification_key .hash ()
54+ )
55+
56+ anchor = Anchor (
57+ url = "https://drep.com" ,
58+ data_hash = AnchorDataHash (bytes .fromhex ("0" * 64 )),
59+ )
60+
61+ drep_registration = RegDRepCert (
62+ drep_credential = drep_credential , coin = 500000000 , anchor = anchor
63+ )
64+
65+ all_in_one_cert = StakeRegistrationAndDelegationAndVoteDelegation (
66+ stake_credential , pool_hash , drep , 1000000
67+ )
4668
4769 builder = TransactionBuilder (self .chain_context )
4870
4971 builder .add_input_address (address )
5072 builder .add_output (TransactionOutput (address , 35000000 ))
5173
52- builder .certificates = [stake_registration , stake_delegation ]
74+ builder .certificates = [drep_registration , all_in_one_cert ]
5375
5476 signed_tx = builder .build_and_sign (
5577 [self .stake_key_pair .signing_key , self .payment_key_pair .signing_key ],
@@ -73,9 +95,13 @@ def test_stake_delegation(self):
7395 network = self .NETWORK ,
7496 )
7597
76- rewards = self .chain_context .query_account_reward_summaries (keys = [stake_address .encode ()])
98+ rewards = self .chain_context .query_account_reward_summaries (
99+ keys = [stake_address .encode ()]
100+ )
77101
78- stake_address_reward = rewards [stake_address .staking_part .payload .hex ()]["rewards" ]["ada" ]["lovelace" ]
102+ stake_address_reward = rewards [stake_address .staking_part .payload .hex ()][
103+ "rewards"
104+ ]["ada" ]["lovelace" ]
79105
80106 builder .withdrawals = Withdrawals ({bytes (stake_address ): stake_address_reward })
81107
0 commit comments