Forum Replies Created
-
AuthorPosts
-
April 12, 2024 at 6:42 am in reply to: Use of the plugin’s front end without the need for JavaScript #13612alexgKeymaster
Hello,
The error you mentioned is unavoidable. It’s simply the plugin checking whether there needs to be a migration from the old custom SQL tables that existed in versions before
6.0.0
. Nothing to worry about.If you enable verbose logging in the settings, you will get more detail in the wordpress debug log on how the transactions are executed.
The available balance does not count pending transactions, while the normal user balance does.
Transactions, including deposits and withdrawals should be initiated in a
pending
state by your code, then they should either transition into adone
or to afail
state by the wallet adapter. Does your transaction remain in a pending state?I am not sure what the problem you describe is. Can you please provide screenshots of the currency page and of the transaction page screens? You can either post them here or email me, whichever you prefer.
Looking forward to your reply.
with regards
April 11, 2024 at 4:36 am in reply to: Use of the plugin’s front end without the need for JavaScript #13608alexgKeymasterHello,
The code you provided does not work because you are creating a class
Wallets
that does not exist. There is aDSWallets\Wallet
class that contains an adapter object ofDSWallets\Wallet_Adapter
class. The wallet adapter is an object that holds the connection information to the wallet as well as the code to communicate with the wallet. You can call get_new_address on the wallet adapter to get a new address.Once you have a
$currency
object, here’s how to generate a new address:$new_address = $currency->wallet->adapter->get_new_address( $currency );
(It’s necessary to pass the currency into the method because there are wallets with multiple currencies e.g. CoinPayments wallet)
It’s best to wrap this in a try..catch, because if there is any problem with communication with the wallet, this can throw.
So, to put it all together:
try {
$new_address = $currency->wallet->adapter->get_new_address( $currency );
} catch ( \Exception $e ) {
error_log( “Could not generate a new address for $currency because: ” . $e.getMessage() );
}In general, the UIs that require JavaScript, communicate with the plugin via its RESTful API, which is here and documented here.
If you check out the code for the various API endpoints, you can see example code for the basic operations.
Hope this helps.
Please let me know if you have any more questions. I want to answer all of them and help you with your project.
with regards
April 10, 2024 at 6:33 am in reply to: Use of the plugin’s front end without the need for JavaScript #13605alexgKeymasterHello,
You can use the functions in helpers/balances.php to get the balances.
PHPdocumentor page:
https://wallets-phpdoc.dashed-slug.net/wallets/files/build-helpers-balances.html
Note that these functions are all under the
DSWallets
namespace. So you either need to be in that namespace, or prefix the functions with the namespace. e.g.$balances = DSWallets\get_all_balances_assoc_for_user( $user_id );
You can see this particular function in action at the plugin’s user profile page code:
https://github.com/dashed-slug/wallets/blob/6.2.4/admin/profile.php#L97-L216
To be clear, this is the code that displays user balances in the user profile admin screen.
Note the difference between balances and available_balances. The links point to the glossary.
Please let me know if you have any more questions about anything.
with regards
April 9, 2024 at 7:16 am in reply to: Use of the plugin’s front end without the need for JavaScript #13599alexgKeymasterHello,
Unfortunately there are no UIs currently that do not require JavaScript.
I understand the need to avoid JavaScript in cases where tor must be used.
If you can create your own forms and PHP handlers, then it’s very straightforward to interact with the plugin from PHP using the PHP API. Please see the following link for details and sample code on how to create transactions:
https://wallets-phpdoc.dashed-slug.net/wallets/classes/DSWallets-Transaction.html
For example, initiating a withdrawal would require you to create a new withdrawal transaction, and save it on the DB.
There are also other ways to communicate with the plugin, but I think this is the one that’s relevant to your use case.
I remain available to answer any questions you may have about this.
Hope this helps.
with regards
alexgKeymasterOops! My apologies! Download is now fixed.
If you encounter any difficulties using the adapter, please let me know in a new thread or by email.
with regards
alexgKeymasterHello,
While this is a good idea, I have not developed any BTCPay wallet adapter, and it’s not possible for me to develop one at this time.
If you are interested in developing a wallet adapter yourself, or if you plan to hire a developer, I have provided information here:
Sample code (stubs) are here: https://github.com/dashed-slug/my-wallet-adapter
I am always available to answer any questions about this.
with regards
February 19, 2024 at 6:08 am in reply to: I’m able to proceed through checkout with no funds in my wallet. #13523alexgKeymasterHello,
This is certainly not normal behavior. I am attaching a screenshot of what you should be seeing in this case.
Before completing your order, you get a dropdown, showing you how much you would pay in each available cryptocurrency. This is calculated using the exchange rates on the system.
Can you please email me a screenshot of that dropdown?
Also, can you please check if the exchange rates on the currencies that you made available are set correctly? You can do this in the admin screen for each currency.
Normally the exchange rates are kept up to date with data from CoinGecko. This is only done if you have set correctly the CoinGecko ID on each currency, and if the cron jobs are running.
Looking forward to your reply.
with regards,
AlexAttachments:
You must be logged in to view attached files.alexgKeymasterFor the record, this has now been implemented in version
2.3.1
. Sorry for the long delay. 😊alexgKeymasterFor the record, this has now been implemented in version
2.3.1
. Sorry for the long delay. 😊alexgKeymasterEven if you have disabled your firewall, the hosting provider has their own firewall to protect their systems. You must contact them and ask them to add a specific exception for incoming TCP ports to your RPC port on your host’s IP.
Bottom line, the plugin must be able to contact the wallet. No other way around it.
alexgKeymasterHello,
1. Ensure that rpcallowip is set to the IP of your WordPress installation in CIDR notation.
2. Ensure that rpcbind is set to the public-facing IP of your wallet node. This tells the wallet to listen on the correct NIC.
3. If your wallet node is on a hosting provider, contact your hosting provider, and ask them to open their firewall for your server and for incoming TCP connections to your RCP port.Hope this helps. Please let me know if you continue to face problems.
with regards
alexgKeymasterIf you are using a strong password with
rpcpassword
, does it contain the equals (=) character?If so, you would be getting this problem. The equals character is used to assign values in the config file, and it can’t be used as part of the password.
alexgKeymasterHello,
HTTP_UNAUTHORIZED
simply means that you have not entered the username/password correctly.Make sure that you understand the difference between using
rpcuser
/rpcpassword
andrpcauth
.You should use either user/pass or auth.
(The values
foo
andbar
I gave above are examples, you should replace them with the credentials you are planning to use.)Hope this helps. Please let me know if you have any more questions.
with regards
alexgKeymasterHello! Try a simple config at first (the following is only for connecting from localhost, if your WordPress is elsewhere, change the IP):
server=1 rpcallowip=127.0.0.1/8 rpcbind=127.0.0.1 rpcport=8332 rpcuser=foo rpcpassword=bar
If this works, then you can expand on it.
If you tell me what error you are encountering, perhaps I can help. You can also get general help on bitcoin core installation at: bitcoin.stackexchange.com
Hope you have a happy new year 2024!
with regards
alexgKeymasterIn the latest version
6.2.0
of the plugin, it is now possible to set a block height to your wallet and the wallet will restart scanning for transactions from that height.For more information, please see the documentation at:
-
AuthorPosts