/** * Create new default ApiContext. * * @param string $chain * @param string $coin * @param string $version * @param TokenCredential $credential * @param array|null $config * @param string $blockCypherPartnerAttributionId * @return ApiContext * @throws BlockCypherConfigurationException */ public static function create($chain = 'main', $coin = 'btc', $version = 'v1', $credential = null, $config = null, $blockCypherPartnerAttributionId = null) { // ### Api context // Use an ApiContext object to authenticate // API calls. The Token for the // SimpleTokenCredential class can be retrieved from // https://accounts.blockcypher.com/ $apiContext = new ApiContext($credential, $chain, $coin, $version); if (is_array($config)) { $apiContext->setConfig($config); } else { // BC_CONFIG_PATH should be defined if (!defined("BC_CONFIG_PATH")) { throw new BlockCypherConfigurationException('BC_CONFIG_PATH should be defined with the path of sdk_config.ini file if no config array is given'); } } // Partner Attribution Id. For the time being it is not used. if ($blockCypherPartnerAttributionId !== null) { $apiContext->addRequestHeader('BlockCypher-Partner-Attribution-Id', $blockCypherPartnerAttributionId); } return $apiContext; }