/** * @param EcAdapterInterface $ecAdapter * @param integer|string $depth * @param integer|string $parentFingerprint * @param integer|string $sequence * @param integer|string $chainCode * @param KeyInterface $key * @throws \Exception */ public function __construct(EcAdapterInterface $ecAdapter, $depth, $parentFingerprint, $sequence, $chainCode, KeyInterface $key) { if (!$key->isCompressed()) { throw new \Exception('A HierarchicalKey must always be compressed'); } $this->ecAdapter = $ecAdapter; $this->depth = $depth; $this->sequence = $sequence; $this->parentFingerprint = $parentFingerprint; $this->chainCode = $chainCode; $this->key = $key; }
/** * @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; }