I reply to all queries on the forums and via email, once per day, Monday to Friday (not weekends).

If you are new here, please see some information on how to ask for support. Thank you!

alexg

Forum Replies Created

Viewing 15 posts - 166 through 180 (of 2,207 total)
  • Author
    Posts
  • in reply to: Orderbook issues #11483
    alexg
    Keymaster

    Hello @LeinAd,

    I have replied to your email.

    For the benefit of others reading this thread:

    The __wallets_exchange_action=get_market_orderbook endpoint does not retrieve orders. Instead it retrieves the orderbook’s depth summary, where the market’s liquidity is shown in aggregate form. Limit orders with the same price are added into one row. Hence you wouldn’t expect Order IDs in the output.

    To retrieve individual orders, use the endpoint: __wallets_exchange_action=get_user_orders. The API is explained in the documentation.

    with regards

    in reply to: Hot wallet balance not updating #11471
    alexg
    Keymaster

    Hello,

    Normally the hot wallet balance should be updated after 30 seconds at most. The same hot wallet balance should be shown in the Cold Storage screens and in the Adapters list screen.

    For coin with ticker symbol XYZ, the hot wallet balance is cached for 30 seconds in the transient wallets_get_balance_XYZ. So, for bitcoin, the hot wallet balance will be cached in wallets_get_balance_BTC.

    After 30 seconds the transient will expire, and the new value will be read from the wallet and shown again.

    Unfortunately some server cache plugins, when not correctly configured, fail to expire transients as specified by the WordPress API. To verify that this is the problem with your setup, go enable the checkbox at WalletsFrontend SettingsDisable transients (debug) and hit “Save Changes”. This issue will cause problems with other plugins as well.

    Do this only to verify that this is the problem. Your site will become slow if you leave this setting on.

    After you verify that the problem is related to your caching plugin, check its settings again. For example, if you’ve enabled memcached support but you don’t have a memcached server, this could happen. I’m sorry but I don’t know under which specific conditions caching plugins do this. I only know that, when you delegate transients to caching plugins, then WordPress is no longer responsible for expiring transients, but delegates this to whatever mechanism you’re using.

    I’ve tried to address this issue better in the upcoming wallets6 plugin.

    with regards

    in reply to: Site Hangs #11470
    alexg
    Keymaster

    Hello Sage,

    Yes, you should check any relevant firewalls, including software firewalls on your server.

    If you have shell access on your WordPress machine, you can also use nc to check if the RPC port on the wallet server is reachable.

    If the wallet server is down, then attempts to communicate with its RPC port will likely fail immediately, rather than timeout. The plugin can handle this without crashing. Only the coin on that wallet should become unavailable in the frontend UIs. If you plan to keep the server down for a while, you can deactivate the coin adapter just to be sure.

    If you have any more questions please open a new thread.

    with regards

    P.S. In the upcoming wallets6 release, this behavior will change. Wallets will be decoupled from currencies, and therefore a currency will still be usable if the wallet is offline. Only deposits/withdrawals will obviously stop for as long as the wallet is offline.

    in reply to: Site Hangs #11466
    alexg
    Keymaster

    Hello,

    When you visit your wordpress site, does the request complete or does it keep loading in the browser?

    If it completes quickly, you should enable and check the WordPress debug log.

    If it hangs and keeps loading, or times out after a round multiple of 10 or 15 seconds (e.g. 10,15,20,30,40,45,60 seconds), then this is typically an indication that the plugin tries to communicate to your wallet server, but encounters a firewall. This is typically your hosting provider’s firewall disallowing outgoing communication.

    Talk to your WordPress host and explain to them that you need outgoing TCP connections to the port you’re using and to your wallet server’s IP. They will be able to add an exception rule to their firewall.

    Let me know if after this you are not able to resolve the issue.

    with regards

    in reply to: Adding a knockout.js data binding on the balance template #11457
    alexg
    Keymaster

    If you want to hook into an event, you could subscribe to the observable for the selected currency:

    wp.wallets.viewModels.wallets.selectedCoin.subscribe(
      function() {
        let coin = wp.wallets.viewModels.wallets.coins()[ wp.wallets.viewModels.wallets.selectedCoin() ];
        let html = '<span class="button" href="?symbol=' + coin.symbol + '&balance=' + coin.balance + '">' + coin.name + '</span>';
        console.log( html);
      }
    );

    Not sure if this is what you are looking for. Again sorry, I know all of this is confusing, which is why I am currently improving it.

    in reply to: Adding a knockout.js data binding on the balance template #11453
    alexg
    Keymaster

    Hello,

    This would be so much easier if you were working on wallets6, but unfortunately it’s not ready for release just yet.

    Oh well, I guess you could do this:

    <a class="button" data-bind="attr: { href: '?symbol=' + selectedCoin() + '&balance=' + currentCoinBalance() }">Button!</a>

    The mistake I did in the past is that in wallets 5.x the UI JavaScript is a big bunch of spaghetti code (wallets-ko.js). I have since changed the templates to make everything clear and self-contained and extendable. You’ll see 🙂

    In any case, make sure you make your changes in a theme or child theme. The documentation explains how in: Frontend -> Template Modifications -> Modifying markup. TL;DR, you should copy balances.php to wp-content/themes/YOURTHEMEORCHILDTHEME/templates/wallets/balances.php and do your changes there…

    And if you do need to run any javascript on the UIs, you should run it after the data loads, on the wallets_ready bubbling event. So, to hook to that event, you would do:

    	jQuery( 'body' ).on( 'wallets_coins_ready', function( event, coins ) {
    		// TODO do your thing here!
    	} );

    Hope this helps.

    in reply to: Wallet 6 #11449
    alexg
    Keymaster

    Thank you so much @megeanwasson! Your donation will go towards buying the coffee that is so necessary for development.

    By LN I mean Lightning of course!

    in reply to: Problem connecting to full node wallet: Connection refused #11448
    alexg
    Keymaster

    Hello,

    What have you tried?

    P.S. I have moved your issue to a new thread because it was not related to the other thread.

    in reply to: deposit UI help #11446
    alexg
    Keymaster

    Hello,

    It looks like you are trying to create a whole plugin from scratch to process invoices. This is not something that the plugin does. I can’t guide your entire development effort for a new plugin. For that you probably need to create a different plugin. That includes doing the analysis and design, and choosing the appropriate technologies and architecture.

    I can try to give you some pointers:

    The code you posted is kinda wrong because it tries to read data from the wallets plugin via the browser’s DOM. You will likely encounter race conditions, where the data is not there at the time you are reading it. IF you wanted to read the user data, you should be using the get_coins_info call from JSON-API. BUT you probably don’t want to do this. You are trying to read addresses that YOUR code has generated, not the addresses that the wallets plugin has assigned to the users. So you must pass the data to the frontend in some other way.

    To do deposits to CoinPayments independently from the plugin, you must do a call to GetDepositAddress. This will give you back an address that belongs to your CP wallet and that will notify you whenever there is a deposit via IPN.

    You must keep track of these addresses that you generate. This will probably be in the DB. It’s up to you how to store it, but don’t use the plugin’s tables. You can create your own custom SQL tables or use Custom Post Types, or even store the addresses in options, user meta, etc depending on your design.

    Once you know which addresses you have generated, you can hook into an action such as init or parse_request to listen for incoming IPNs. Since you will only be processing addresses that you know are generated with your plugin, these will not interfere with the existing IPN handler of the wallets plugin. You can then detect invoice payments and notify your users via email or any other way you see fit.

    The wallets plugin uses the JSON-API (and the upcoming WP-REST API) for communication between frontend and backend. It then uses frontend javascript to create the qr code. Whether your plugin renders your address as a qrcode in the frontend or backend is up to you.

    In summary: If you are trying to create invoices, this is a different plugin. The wallets plugin as it is now, cannot be extended to accept invoices. You must create a different plugin from scratch. Think about your requirements, do an analysis, and you will see that it is not appropriate to extend this plugin for your use case.

    I’m really sorry for being so negative, but it doesn’t look like I can help you more with this. It really sounds like someone who studied business, not engineering, gave you the task of adapting the plugin for a totally different technical requirement. You should get back to them and tell them that the decision of which software to use to achieve a business requirement, is a technical decision, and must be done by an engineer.

    Best of luck with your project.

    with regards

    in reply to: How to deposit to the hot wallet directly #11445
    alexg
    Keymaster

    Hello @dynamitemedia,

    Any address that is not a registered deposit address can be used to increase the hot wallet balance.

    The plugin checks all incoming transactions to the wallet. If a deposit address is associated with a user, the transaction debits the user balance. If not, the plugin ignores the transaction, and therefore it only increases the hot wallet balance.

    To get the plugin’s cold storage deposit address, you can read it from an option. For example, to get the plugin’s Bitcoin cold storage deposit address: get_option('wallets_cs_address_BTC');

    To create a new wallet address communicate with the coin adapter directly. Example:

    // get a hold of the coin adapters
    try {
    	$adapters = apply_filters( 'wallets_api_adapters', array(), array(
    		'check_capabilities' => true,
    		'online_only' => true,
    	) );
    } catch ( Exception $e ) {
    	error_log( 'you do not have access to wallets' );
    }
    
    // iterate over all the adapters and get a new address from each wallet
    foreach ( $adapters as $symbol => $adapter ) {
    	try {
    		$address = $adapter->get_new_address();
    	} catch ( Exception $e ) {
    		error_log( "Could not get a new address for $symbol, because: " . $e->getMessage() );
    		continue;
    	}
    
    	error_log( "The new deposit address for $symbol is $address" );
    	
    	// TODO you must somehow save the addresses somewhere if you want to use them
    }

    Hope this helps.

    with regards

    in reply to: Getting withdrawal settings for a CoinPayments coin in PHP #11435
    alexg
    Keymaster

    Hello,

    Yes, wallets 5.x will work forever exactly as it works now, but it will not be updated any more and will gradually become obsolete.

    And it will be up to you to update to wallets6 when you choose to do so.

    Since you will have to make some small changes in your code: You can install wallets6 on a dev/integration machine and modify your code there, then deploy to live when you decide to upgrade to wallets6.

    with regards

    in reply to: IPN questions #11428
    alexg
    Keymaster

    Hello,

    I am not sure I understood your question. There are multiple points I do not understand.

    1. What do you mean by “using the ipn handler page from coinpayments”? What page is that?

    2. “But we need to have balances etc that your plugin uses to show up.”: Which balances are you referring to? Hot wallet balances or user balances? You don’t need communication with CoinPayments or any wallet to display user balances.

    3. “i thought we could do almost a file gets to ping your ipn”: What do you mean by “ping the ipn”? The IPN is an incoming message, you cannot do polling on it. That’s the whole point of IPN (Incoming Payment Notification). You need to listen for the incoming message which arrives when the CP platform requests it.

    Can you please be more clear? What are you trying to achieve? Are you trying to detect when a user performs a deposit to a user deposit address (or to another address)? Please describe what your objective is and I’ll try to help.

    with regards

    in reply to: Getting withdrawal settings for a CoinPayments coin in PHP #11426
    alexg
    Keymaster

    Hello,

    I can help you find the data in the DB (but this will change in the upcoming wallets6 release).

    In the current CoinPayments adapter, every coin has its slug prefix. In wallets-cp.php, notice the code:

    foreach ( $this->coins as $symbol => &$coin ):
    
    	$coin_option_slug = preg_replace( '/\W/', '-', 'wallets-cp-' . strtolower( $symbol ) . '-settings' );
    	$enabled = Dashed_Slug_Wallets::get_option( "{$coin_option_slug}-general-enabled" );

    So, a coin with ticker symbol XYZ will typically have a prefix of: wallets-cp-xyz-settings. If the ticker symbol contains characters that are not letters, then these characters are replaced with a dash (-).

    The withdraw fee is in the option: wallets-cp-xyz-settings-fees-withdraw

    And the minimum withdrawal amount is in the option: wallets-cp-xyz-settings-general-minwithdraw

    You can get these values with get_option.

    It was necessary to change this in wallets6 for a few reasons:

    – Currencies and wallets will now be stored as posts.
    – The currency settings are decoupled from the wallet settings for clarity.
    – All amounts are now stored as integers to avoid floating point errors.

    So, in the upcoming release, these will be stored as meta values on the currency post. It will be very easy to retrieve a currency and check its fields. When the time comes, ask me again, if you want to adapt your UI code to wallets6. I promise it will not be hard to make the change.

    with regards

    in reply to: Wallets menu not showing in WordPress 5.9 #11425
    alexg
    Keymaster

    Well, not sure if the plugin saw our discussion, it’s always a possibility!

    But there is some code in there that heals the capabilities if they are not correct:

    https://github.com/dashed-slug/wallets/blob/5.0.16/includes/caps.php#L252-L283

    with regards

    in reply to: Wallet 6 #11424
    alexg
    Keymaster

    Well, the people who build the Bitcoin wallet, the modern blockchains and smart contracts, are indeed heroes!

    I on the other hand have decided to create the PHP glue code that will connect WordPress to these modern miracles. Less glamorous work, but I’m having fun with it nonetheless! I’m looking forward to finishing this release so I can move on to integrating Bitcoin LN and ERC-20.

Viewing 15 posts - 166 through 180 (of 2,207 total)