@see https://info.shapeshift.io/api#api-103

@param string $coin1
@param string $coin2
@return stdClass

@throws RequestFailedException
@throws ApiErrorException
337280
public function getMarketInfo(string $coin1, string $coin2): stdClass
    {
        return $this->get(sprintf('%s/%s', Resources::MARKET_INFO, Tools::buildPair($coin1, $coin2)));
    }
97231
public function load($sourceCurrencyCode, $destinationCurrencyCode)
    {
        $rate = null;

        $exchangeRates = $this->loadAll();

        if (isset($exchangeRates[$sourceCurrencyCode][$destinationCurrencyCode])) {
            $rate = $exchangeRates[$sourceCurrencyCode][$destinationCurrencyCode];
        } // Conversion rates are two-way. If a reverse rate is unavailable, set it.
        elseif (isset($exchangeRates[$destinationCurrencyCode][$sourceCurrencyCode])) {
            $rate = bcdiv(1,
              $exchangeRates[$destinationCurrencyCode][$sourceCurrencyCode],
              6);
        }

        if ($rate) {
            return new ExchangeRate($sourceCurrencyCode,
              $destinationCurrencyCode, $rate);
        }

        return null;
    }
308677
public function validateAddress(string $address, string $coin): stdClass
    {
        $result = $this->get(sprintf('%s/%s/%s', Resources::VALIDATE_ADDRESS, $address, $coin));

        if (!isset($result->isValid) && isset($result->isvalid)) {
            $result->isValid = $result->isvalid;
            unset ($result->isvalid);
        }

        return $result;
    }
835492
public static function matchHeaders(Request $first, Request $second)
    {
        // Use array_filter to ignore headers which are null.

        return array_filter($first->getHeaders()) === array_filter($second->getHeaders());
    }
880310
public static function mul($num1, $num2)
    {
        if (!static::is($num1) || !static::is($num2)) {
            throw new \InvalidArgumentException("The \$num1 and \$num2 parameters must be numeric.");
        }

        return ($num1 * $num2);
    }
1215068
public function reverseTransform($value): ?APISection
    {
        if (empty($value)) {
            return null;
        }

        try {
            return $this->sectionService->loadSection($value);
        } catch (NotFoundException $e) {
            throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e);
        }
    }
1141325
public static function compareAmounts($price1, $price2)
    {
        //====================================================================//
        // Compare Price
        if ($price1["base"]) {
            if (abs($price1["ttc"] - $price2["ttc"]) > 1E-6) {
                return false;
            }
        } else {
            if (abs($price1["ht"] - $price2["ht"]) > 1E-6) {
                return false;
            }
        }
        //====================================================================//
        // Compare VAT
        if (abs($price1["vat"] - $price2["vat"]) > 1E-6) {
            return false;
        }
        //====================================================================//
        // Compare Currency If Set on Both Sides
        if (empty($price1["code"]) || empty($price2["code"])) {
            return true;
        }
        if ($price1["code"] !== $price2["code"]) {
            return false;
        }
        //====================================================================//
        // Prices Are Identical
        return true;
    }
687919
async def get(self, public_key):
		
		# Sign-verifying functional
		if settings.SIGNATURE_VERIFICATION:
			super().verify()

		page = self.get_query_argument("page", 1)

		cids = await self.account.getuserscontent(public_key=public_key)

		logging.debug("\n\n Users cids")
		logging.debug(cids)
		
		if isinstance(cids, dict):
			if "error" in cids.keys():
				self.set_status(cids["error"])
				self.write(cids)
				raise tornado.web.Finish

		container = []

		for coinid in cids:

			logging.debug("\n [] -- coinid")
			logging.debug(coinid)

			#if list(cids.keys()).index(coinid) == len(cids) - 1:
			#	paginator = Paginator(coinid=coinid, page=page, 
			#		limit=(settings.LIMIT//len(cids))+(settings.LIMIT%len(cids)), cids=cids)
			#else:
			#paginator = Paginator(coinid=coinid, page=page, 
			#						limit=settings.LIMIT // len(cids), cids=cids)

			if coinid in settings.bridges.keys():
				logging.debug(" -- Coinid in ")
				logging.debug(settings.bridges.keys())
				self.account.blockchain.setendpoint(settings.bridges[coinid])

				contents = await self.account.blockchain.getuserscontent(
												cids=json.dumps(cids[coinid]))
				logging.debug("\n\n -- Contents")
				logging.debug(contents)
				if isinstance(contents, dict):
					if "error" in contents.keys():
						continue
				container.extend(contents)

				logging.debug("\n\n -- Container 1")


				logging.debug("\n\n -- Container 2")
				logging.debug(container)

		response = {
			"profiles":json.dumps(container),
			}
		try:
			response.update(paginator.get_pages())
		except:
			pass
	
		self.write(json.dumps(response))
612990
protected function merge(\stdClass $object1, \stdClass $object2)
    {
        return array_to_object(
            array_replace_recursive(object_to_array($object1), object_to_array($object2))
        );
    }
944064
function BitcoinAddresses (coinjar) {
  var self = this;
  self.coinjar = coinjar;

  var result = function() {
    if(util.isFunction(arguments[0])) {
      list.apply(self, arguments); // callback, limit, offset
    }
    else {
      get.apply(self, arguments); // id, callback
    }
  };

  result.create = function(callback, label) {
    create.call(self, callback, label);
  };

  return result;
}
980162
public function add(Money $money)
  {
    if($this->isSameCurrency($money))
    {
      return Money::init($this->cents + $money->cents, $this->currency->getIsoCode());
    }

    throw new InvalidCurrencyException("You can't add two Money objects with different currencies");
  }
753952
public function send(RequestDescriptor $requestDescriptor, $flags = 1)
    {
        $request = new Request();
        $request->setMethod($requestDescriptor->getMethod())
            ->setUri($requestDescriptor->getUrl())
            ->setAllHeaders($requestDescriptor->getHeaders())
            ->setBody($this->handleBody($requestDescriptor->getBodyParams()))
        ;

        $promise = $this->getClient()->request($request);

        $responseDescriptor = new ResponseDescriptor();

        if ($flags & ApiRequestOption::NO_RESPONSE) {
            $this->promises[] = $promise;
            return null;
        }

        /** @var Response $response */
        try {
            $response = \Amp\wait($promise);
        } catch (\Exception $e) {
            die($request->getBody());
        }

        $responseDescriptor->setBody($response->getBody());
        $responseDescriptor->setCode($response->getStatus());
        $responseDescriptor->setHeaders($response->getAllHeaders());

        return $responseDescriptor;
    }
454361
public function compare($object1, $object2)
    {
        if (! is_scalar($object1) && ! is_null($object1)) {
            throw new ComparatorException('$object1 (type: ' . gettype($object1) . ') is not a primitive numeric type.');
        }
        if (! is_scalar($object2) && ! is_null($object2)) {
            throw new ComparatorException('$object2 (type: ' . gettype($object2) . ') is not a primitive numeric type.');
        }
        if (1 * $object1 < 1 * $object2) {
            return - 1;
        } elseif (1 * $object1 > 1 * $object2) {
            return 1;
        } else {
            return 0;
        }
    }
1251751
public static String convertToBitcoinURI(Address address, Coin amount,
                                             String label, String message) {
        return convertToBitcoinURI(address.getParameters(), address.toString(), amount, label, message);
    }
527749
public function send(RequestDescriptor $requestDescriptor, $flags = 0)
    {
        try {
            $request = $this->getRequestFactory()->create($requestDescriptor);
            $response = $this->getClient()->send($request);
        } catch (\Exception $exception) {
            throw new ApiClientException('An error occurred while transporting a request', $exception->getCode(), $exception);
        }

        $responseDescriptor = new ResponseDescriptor();
        $responseDescriptor->setBody($response->getBody());
        $responseDescriptor->setCode($response->getStatusCode());
        $responseDescriptor->setHeaders($response->getHeaders());

        return $responseDescriptor;
    }
86562
public function coinSelectionForTxBuilder(TransactionBuilder $txBuilder, $lockUTXOs = true, $allowZeroConf = false, $forceFee = null) {

        // get the data we should use for this transaction
        $coinSelection = $this->coinSelection($txBuilder->getOutputs(/* $json = */true), $lockUTXOs, $allowZeroConf, $txBuilder->getFeeStrategy(), $forceFee);
        
        $utxos = $coinSelection['utxos'];
        $fee = $coinSelection['fee'];
        $change = $coinSelection['change'];

        if ($forceFee !== null) {
            $txBuilder->setFee($forceFee);
        } else {
            $txBuilder->validateFee($fee);
        }

        foreach ($utxos as $utxo) {
            $signMode = SignInfo::MODE_SIGN;
            if (isset($utxo['sign_mode'])) {
                $signMode = $utxo['sign_mode'];
                if (!in_array($signMode, $this->allowedSignModes)) {
                    throw new \Exception("Sign mode disallowed by wallet");
                }
            }

            $txBuilder->spendOutput($utxo['hash'], $utxo['idx'], $utxo['value'], $utxo['address'], $utxo['scriptpubkey_hex'], $utxo['path'], $utxo['redeem_script'], $utxo['witness_script'], $signMode);
        }

        return $txBuilder;
    }
658039
def send_faucet_coins(address_to_fund, satoshis, api_key, coin_symbol='bcy'):
    '''
    
    '''
    assert coin_symbol in ('bcy', 'btc-testnet')
    assert is_valid_address_for_coinsymbol(b58_address=address_to_fund, coin_symbol=coin_symbol)
    assert satoshis > 0
    assert api_key, 'api_key required'

    url = make_url(coin_symbol, 'faucet')

    data = {
            'address': address_to_fund,
            'amount': satoshis,
            }
    params = {'token': api_key}

    r = requests.post(url, json=data, params=params, verify=True, timeout=TIMEOUT_IN_SECONDS)
    return get_valid_json(r)