GithubHelp home page GithubHelp logo

php-cryptapi's People

Contributors

arianoangelo avatar backendrulz avatar benphelps avatar cryptapi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

php-cryptapi's Issues

Log Function need Fix and address function needs to return receiver's address for security and safety reasons

Here is my fix for Log

    public function check_logs() {
    if (empty($this->coin) || empty($this->callback_url)) return null;
    
    $callback_url = $this->callback_url;
    if (!empty($this->parameters)) {
        $req_parameters = http_build_query($this->parameters);
        $callback_url = "{$this->callback_url}?{$req_parameters}";
    }

    $params = [
        'callback' => $callback_url,
    ];

    $response = CryptAPI::_request($this->coin, 'logs', $params);

    if ($response->status == 'success') {
        return $response;
    }

    return null;
}

I made a mistake and transferred to wrong address while testing because first request address is unique to $ca_params
So here is my proposal:

    public function get_address() {
    if (empty($this->own_address) || empty($this->coin) || empty($this->callback_url)) return null;

    $callback_url = $this->callback_url;
    if (!empty($this->parameters)) {
        $req_parameters = http_build_query($this->parameters);
        $callback_url = "{$this->callback_url}?{$req_parameters}";
    }

    $ca_params = array_merge([
        'callback' => $callback_url,
        'address' => $this->own_address,
    ], $this->ca_params);

    $response = CryptAPI::_request($this->coin, 'create', $ca_params);
  
    if ($response->status == 'success') {
        $this->payment_address = $response->address_in;
        $address['address_in'] = $response->address_in; //my addition
        $address['address_out'] = $response->address_out; //my addition

        return $address; 
       //address is an array of address_in and address_out so one can confirm that address_out corresponds to the correct wallet to 
        prevent loss of funds
    }

    return null;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.