@@ -42,14 +42,36 @@ def test_stake_delegation(self):
42
42
)
43
43
stake_registration = StakeRegistration (stake_credential )
44
44
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
+ )
46
68
47
69
builder = TransactionBuilder (self .chain_context )
48
70
49
71
builder .add_input_address (address )
50
72
builder .add_output (TransactionOutput (address , 35000000 ))
51
73
52
- builder .certificates = [stake_registration , stake_delegation ]
74
+ builder .certificates = [drep_registration , all_in_one_cert ]
53
75
54
76
signed_tx = builder .build_and_sign (
55
77
[self .stake_key_pair .signing_key , self .payment_key_pair .signing_key ],
@@ -73,9 +95,13 @@ def test_stake_delegation(self):
73
95
network = self .NETWORK ,
74
96
)
75
97
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
+ )
77
101
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" ]
79
105
80
106
builder .withdrawals = Withdrawals ({bytes (stake_address ): stake_address_reward })
81
107
0 commit comments