File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -251,8 +251,8 @@ func (a *Address) MarshalCBOR() ([]byte, error) {
251251}
252252
253253// StakeAddress returns a new Address with only the stake key portion. This will return nil if the address is not a payment/staking key pair
254- func (a * Address ) StakeAddress () * Address {
255- if a .addressType != addressTypeKeyKey {
254+ func (a Address ) StakeAddress () * Address {
255+ if a .addressType != addressTypeKeyKey && a . addressType != addressTypeScriptKey {
256256 return nil
257257 }
258258 newAddr := & Address {
Original file line number Diff line number Diff line change @@ -152,6 +152,11 @@ func TestAddressStakeAddress(t *testing.T) {
152152 address : "addr1q9h4f2vhh5vnqgnsejan3psw6mj3a504fxlqm2eh3262qufesdvfs83ulr22vprsv9mwnt0vgkfwxlflxkns32twqzdqjpq2na" ,
153153 expectedStakeAddress : "stake1uyucxkycrc70349xq3cxzahf4hkytyhr05lntfcg49hqpxsqlrayk" ,
154154 },
155+ // Script address
156+ {
157+ address : "addr1z8snz7c4974vzdpxu65ruphl3zjdvtxw8strf2c2tmqnxz2j2c79gy9l76sdg0xwhd7r0c0kna0tycz4y5s6mlenh8pq0xmsha" ,
158+ expectedStakeAddress : "stake1u9f9v0z5zzlldgx58n8tklphu8mf7h4jvp2j2gddluemnssjfnkzz" ,
159+ },
155160 }
156161 for _ , testDef := range testDefs {
157162 addr , err := NewAddress (testDef .address )
You can’t perform that action at this time.
0 commit comments