/** * Obtain the Wallet resource for the given identifier. * * @deprecated since version 1.2. Use HDWalletClient. * @param string $walletName * @param array $params Parameters. * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param BlockCypherRestCall $restCall is the Rest Call Service that is used to make rest calls * @return HDWallet */ public static function get($walletName, $params = array(), $apiContext = null, $restCall = null) { ArgumentValidator::validate($walletName, 'walletName'); ArgumentGetParamsValidator::validate($params, 'params'); $allowedParams = array(); $params = ArgumentGetParamsValidator::sanitize($params, $allowedParams); $payLoad = ""; $chainUrlPrefix = self::getChainUrlPrefix($apiContext); $json = self::executeCall("{$chainUrlPrefix}/wallets/hd/{$walletName}?" . http_build_query($params), "GET", $payLoad, null, $apiContext, $restCall); $ret = new HDWallet(); $ret->fromJson($json); return $ret; }
/** * This endpoint allows you to derive a new address (or multiple addresses) associated with the $NAME HD Wallet. * If successful, it will return an HDWallet but only with the newly derived address(es) represented in * its chains field to limit the data transmitted; for the full address list after derivation, * you can follow up this API call with the Get Wallet Addresses Endpoint. * * @param string $walletName * @param array $params Parameters * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param BlockCypherRestCall $restCall is the Rest Call Service that is used to make rest calls * @return HDWallet Partial */ public function deriveAddress($walletName, $params = array(), $apiContext = null, $restCall = null) { ArgumentGetParamsValidator::validate($params, 'params'); $allowedParams = array('count' => 1, 'subchain_index' => 1); $params = ArgumentGetParamsValidator::sanitize($params, $allowedParams); $payLoad = ""; $chainUrlPrefix = $this->getChainUrlPrefix($apiContext); $json = $this->executeCall("{$chainUrlPrefix}/wallets/hd/{$walletName}/addresses/derive?" . http_build_query($params), "POST", $payLoad, null, $apiContext, $restCall); $ret = new HDWallet(); $ret->fromJson($json); return $ret; }
/** * Create a new HDWallet. * * @param HDWallet $hdWallet * @param array $params Parameters * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param BlockCypherRestCall $restCall is the Rest Call Service that is used to make rest calls * @return HDWallet */ public function create(HDWallet $hdWallet, $params = array(), $apiContext = null, $restCall = null) { ArgumentGetParamsValidator::validate($params, 'params'); $allowedParams = array(); $params = ArgumentGetParamsValidator::sanitize($params, $allowedParams); $payLoad = $hdWallet->toJSON(); $chainUrlPrefix = $this->getChainUrlPrefix($apiContext); $json = $this->executeCall("{$chainUrlPrefix}/wallets/hd?" . http_build_query($params), "POST", $payLoad, null, $apiContext, $restCall); $returnedHDWallet = new HDWallet(); $returnedHDWallet->fromJson($json); return $returnedHDWallet; }