Convert a scriptPubKey to a CBech32BitcoinAddress Returns a CBech32BitcoinAddress subclass, either P2WSHBitcoinAddress or P2WPKHBitcoinAddress. If the scriptPubKey is not recognized CBitcoinAddressError will be raised.
(cls, scriptPubKey)
| 82 | |
| 83 | @classmethod |
| 84 | def from_scriptPubKey(cls, scriptPubKey): |
| 85 | """Convert a scriptPubKey to a CBech32BitcoinAddress |
| 86 | |
| 87 | Returns a CBech32BitcoinAddress subclass, either P2WSHBitcoinAddress or |
| 88 | P2WPKHBitcoinAddress. If the scriptPubKey is not recognized |
| 89 | CBitcoinAddressError will be raised. |
| 90 | """ |
| 91 | try: |
| 92 | return P2WSHBitcoinAddress.from_scriptPubKey(scriptPubKey) |
| 93 | except CBitcoinAddressError: |
| 94 | pass |
| 95 | |
| 96 | try: |
| 97 | return P2WPKHBitcoinAddress.from_scriptPubKey(scriptPubKey) |
| 98 | except CBitcoinAddressError: |
| 99 | pass |
| 100 | |
| 101 | raise CBitcoinAddressError('scriptPubKey not a valid bech32-encoded address') |
| 102 | |
| 103 | |
| 104 | class CBase58BitcoinAddress(bitcoin.base58.CBase58Data, CBitcoinAddress): |
nothing calls this directly
no test coverage detected