cryptapi / php-cryptapi Goto Github PK
View Code? Open in Web Editor NEWCryptAPI's PHP library
License: MIT License
CryptAPI's PHP library
License: MIT License
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;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.