|
2 | 2 |
|
3 | 3 | from pycardano.address import Address, PointerAddress
|
4 | 4 | from pycardano.crypto.bip32 import HDWallet
|
5 |
| -from pycardano.key import PaymentVerificationKey |
| 5 | +from pycardano.key import ExtendedSigningKey, PaymentVerificationKey |
6 | 6 | from pycardano.network import Network
|
7 | 7 |
|
8 | 8 | # Tests copied from: https://github.com/Emurgo/cardano-serialization-lib/blob/master/rust/src/address.rs
|
@@ -284,6 +284,31 @@ def test_payment_address_24_base():
|
284 | 284 | )
|
285 | 285 |
|
286 | 286 |
|
| 287 | +def test_payment_address_24_base_2(): |
| 288 | + hdwallet = HDWallet.from_mnemonic(MNEMONIC_24) |
| 289 | + hdwallet_spend = hdwallet.derive_from_path("m/1852'/1815'/0'/0/0") |
| 290 | + spend_extended_sk = ExtendedSigningKey.from_hdwallet(hdwallet_spend) |
| 291 | + spend_extended_vk = spend_extended_sk.to_verification_key() |
| 292 | + |
| 293 | + hdwallet_stake = hdwallet.derive_from_path("m/1852'/1815'/0'/2/0") |
| 294 | + stake_extended_sk = ExtendedSigningKey.from_hdwallet(hdwallet_stake) |
| 295 | + stake_extended_vk = stake_extended_sk.to_verification_key() |
| 296 | + |
| 297 | + assert ( |
| 298 | + Address( |
| 299 | + spend_extended_vk.hash(), stake_extended_vk.hash(), network=Network.TESTNET |
| 300 | + ).encode() |
| 301 | + == "addr_test1qqy6nhfyks7wdu3dudslys37v252w2nwhv0fw2nfawemmn8k8ttq8f3gag0h89aepvx3xf69g0l9pf80tqv7cve0l33sw96paj" |
| 302 | + ) |
| 303 | + |
| 304 | + assert ( |
| 305 | + Address( |
| 306 | + spend_extended_vk.hash(), stake_extended_vk.hash(), network=Network.MAINNET |
| 307 | + ).encode() |
| 308 | + == "addr1qyy6nhfyks7wdu3dudslys37v252w2nwhv0fw2nfawemmn8k8ttq8f3gag0h89aepvx3xf69g0l9pf80tqv7cve0l33sdn8p3d" |
| 309 | + ) |
| 310 | + |
| 311 | + |
287 | 312 | def test_payment_address_24_enterprise():
|
288 | 313 | hdwallet = HDWallet.from_mnemonic(MNEMONIC_24)
|
289 | 314 | hdwallet_spend = hdwallet.derive_from_path("m/1852'/1815'/0'/0/0")
|
|
0 commit comments