/** * @param EcAdapterInterface $ecAdapter * @param KeyInterface $masterKey */ public function __construct(EcAdapterInterface $ecAdapter, KeyInterface $masterKey) { if ($masterKey->isCompressed()) { throw new \RuntimeException('Electrum keys are not compressed'); } $this->ecAdapter = $ecAdapter; if ($masterKey instanceof PrivateKeyInterface) { $this->masterKey = $masterKey; $masterKey = $this->masterKey->getPublicKey(); } $this->publicKey = $masterKey; }
/** * Return whether this is a private key * * @return bool */ public function isPrivate() { return $this->key->isPrivate(); }
/** * @param KeyInterface $key * @return PayToPubKeyHashAddress */ public static function fromKey(KeyInterface $key) { $address = new PayToPubKeyHashAddress($key->getPubKeyHash()); return $address; }