/** * @param string $walletName * @param string $coinSymbol * @param string $token * @param string $payToAddress * @param int $amount * @return TXSkeleton */ public function create($walletName, $coinSymbol, $token, $payToAddress, $amount) { $apiContext = $this->apiContextFactory->getApiContext($coinSymbol, $token); $txClient = new TXClient($apiContext); // DEBUG //var_dump($amount); //die(); $tx = new TX(); // Tx inputs $input = new TXInput(); $input->setWalletName($walletName); $input->setWalletToken($token); $tx->addInput($input); // Tx outputs $output = new TXOutput(); $output->addAddress($payToAddress); $tx->addOutput($output); // Tx amount $output->setValue($amount); // Satoshis try { $txSkeleton = $txClient->create($tx); } catch (BlockCypherConnectionException $e) { $data = $e->getData(); //DEBUG //var_export($data); //die(); $txSkeleton = new TXSkeleton($data); //DEBUG //var_dump($txSkeleton); //die(); throw new InvalidTransaction($txSkeleton->getAllErrorMessages()); } return $txSkeleton; }