Пример #1
0
 private function consistentCurrencies(Coin $coin)
 {
     $currencies = array_unique(array_map(function (Base $base) {
         return $base->getCurrency();
     }, $coin->getBases()));
     if (count($currencies) > 1) {
         $this->errors[] = 'Inconsistent currencies: [' . implode('], [', $currencies) . ']';
     }
 }
Пример #2
0
 private function CoinToArray(Coin $coin, Transcoder $transcoder)
 {
     return ['v' => $coin->version(), 'coin' => $this->InputToArray($coin->getInput(), $transcoder)];
 }
Пример #3
0
 /**
  * Creates a new coin with a value proportional to the bases of the backer.
  *
  * @param Binary $backerKey
  * @param Coin $coin
  * @return Coin
  * @throws \Exception
  */
 public function confirmCoin(Binary $backerKey, Coin $coin)
 {
     $backer = $this->key->getAddress($backerKey);
     $confirmed = $coin->confirm($backer, new Signer($this->key, $backerKey));
     (new Verification($this->key))->verify($confirmed)->mustBeOk();
     return $confirmed;
 }