dashed-slug.net › Forums › Monero Wallet Adapter extension support › Hot wallet remains empty when new deposits are made.
Tagged: cryptonote, get_balance, network active
- This topic has 9 replies, 3 voices, and was last updated 4 years, 7 months ago by alexg.
-
AuthorPosts
-
April 11, 2020 at 7:32 am #8057d3vnu77Participant
Everything seems to be fine with my BTC and LTC Adapters.
However, I slightly hacked up the monero adapter to make it work with a different cryptonight coin and the new deposits don’t recognize that they belong in the hot wallet.
Everything worked in v4, deposits, withdrawals, transfers, etc, however I notice that the hot/cold wallet stuff did not display correct.
However on v5 I cannot withdrawal anything because it thinks there is 0 coins in the hot wallet.
I’ve attached some images to explain the point. Not sure where to start looking. Does this on the production server and a brand new development box running the same code.
Any help would be appreciated.
Attachments:
You must be logged in to view attached files.April 11, 2020 at 9:10 am #8060d3vnu77ParticipantThe problems seems to be with the get_balance method in the cryptonote adapter…
It seems to do a “network active” check which fails and then returns a balance of false.
public function get_balance() { static $balance = false; if ( false === $balance ) { var_dump($this); die('check network'); if ( $this->network_active ) { //if(1==1){ $result = $this->do_rpc_command('getBalance'); var_dump($result); die('got the balance'); $balance += round( $result->availableBalance * 1e-8, 8 ); } } return $balance; }
If I don’t check that the network is active everything works.
April 11, 2020 at 4:59 pm #8064d3vnu77ParticipantThis is the var_dump of the $this object inside of the adapter, when executing the above code, mind you I have cron turned off while I attempt to manually isolate the issue.
object(Dashed_Slug_Wallets_Coin_Adapter_Cryptonote_2ACoin)#2159 (4) { [“network_active”:”Dashed_Slug_Wallets_Coin_Adapter_Cryptonote”:private]=> bool(false) [“menu_slug”:protected]=> string(40) “wallets-menu-2acoin-cryptonote-full-node” [“option_slug”:protected]=> string(44) “wallets-2acoin-cryptonote-full-node-settings” [“_notices”:protected]=> object(Dashed_Slug_Wallets_Admin_Notices)#1033 (1) { [“admin_notices”:”Dashed_Slug_Wallets_Admin_Notices”:private]=> object(stdClass)#1032 (4) { [“error”]=> array(1) { [0]=> object(stdClass)#993 (2) { [“message”]=> string(149) “The wp_cron tasks have not run in the past 4 hours.You must either enable auto-triggering or trigger cron manually via curl/system-cron.” [“dismiss_option”]=> string(24) “wallets-cron-not-running” } } [“warning”]=> array(0) { } [“info”]=> array(0) { } [“success”]=> array(0) { } } } } check network
notice how the network_active property is false.Trying to understand the dynamic of this.
April 13, 2020 at 7:58 am #8069alexgKeymasterHello,
I’ve moved your posts to the support forum for the Monero adapter.
If you’ve put the code under some kind of version control before making changes, you can easily diff your changes with the original code. The
get_balance()
method has an if..then…else construct. In the code you posted above you seem to have deleted the else branch.The adapter maintains an association of WordPress blog_urls to wallet accounts. If your installation is single-site, there will be only one blog url. If you are on multisite, there will be many. But if you are on a multisite installation AND the plugin is network-activated, this means that user balances are shared across all sites, and therefore the coin adapter must sum over all the sites. Hence the if/else construct.
When the plugin is network-activated, users may potentially be holding balances on various sub-sites, therefore there is a need to store balances on different wallet accounts. But if the plugin is not network activated (which is the usual for most installations), then the else branch is executed.
I would recommend that you restore the code and try your changes again. What you’re interested in is probably the else branch, which calls RPC get_balance once for the account corresponding to the one blog that your site has.
Additionally, if you are encountering issues with a cryptonote wallet, you can open a new thread on this support forum, and I can investigate to see what’s going on.
with regards
April 13, 2020 at 5:57 pm #8083d3vnu77ParticipantI think the main reason I had to start hacking up the monero plugin is that the cryptonote coin I am making work with your plugin is a coin called 2ACoin.
This coin which is based off TurtleCoin does not seem to have a get_accounts RPC Call. Therefore I removed most of the accounts functionality from the plugin inorder to make it work. Also had to change all of your calls to camel case as the 2ACoin Wallet RPC API is formated in camelcase: as seen here:
April 14, 2020 at 7:13 am #8085alexgKeymasterThank you. It does look like this wallet has a completely different API.
I could possibly create an adapter, but I don’t know when I can look at this, as it will require some analysis. Too many people at this time stay at home and play with the plugin due to the current situation. There is a high demand for a grin-like adapter, so this might need to take precedence.
If you are going to attempt creating a turtlecoin/2acoin adapter, focus on providing an implementation of
Dashed_Slug_Wallets_Coin_Adapter
that implements all methods. A somewhat dated article on this: https://www.dashed-slug.net/developers-coin-adapters-api/Also, when a new deposit is discovered, the adapter should trigger the
wallets_transaction
action. More on this here: https://www.dashed-slug.net/howto-create-update-transactions-from-php/I’ll try to give you more info as soon as I perform an initial analysis on the API spec you gave me.
with regards
April 16, 2020 at 1:59 pm #8119alexgKeymasterHello,
I have done some preliminary work yesterday on TurtleCoin.
I was not aware of this family of coins and I am pleasantly surprised by how easy they are to setup compared to Cryptonote, and the wallet API doc is very helpful.
I believe that I should be able to create a TurtleCoin adapter soon (perhaps in a few weeks time, if all goes well). It would be a nice addition to the collection of available coin adapters.
My goal is to provide support for TurtleCoin and all its forks. I will let you know again here, once I have any more news.
with regards
May 8, 2020 at 6:53 am #8283alexgKeymasterHello,
Just keeping you updated, I have been developing a solution for turtlecoin and clones. Dev is about 60% done and I hope to finish the remaining dev and testing over the next week if no issues crop up during the weekend.
with regards
May 9, 2020 at 4:00 am #8289AnonymousInactiveGlad to hear it!! Working on a site with a turtlecoin fork as well. Looking forward to your solution!!
May 20, 2020 at 11:12 am #8406alexgKeymasterHello,
TurtleCoin adapter is now released: https://www.dashed-slug.net/turtlecoin-on-wordpress/
with regards
-
AuthorPosts
- You must be logged in to reply to this topic.