Hello,
You are very close. A little background: The get_instance()
static method returns the singleton object that has the PHP API. This was done so as not to pollute the global namespace with functions. Polluting the global namespace is against the www.remarpro.com guidelines, and for good reason. Using PHP namespaces on the other hand is not compatible with some older version of PHP.
So, what you need to do is hold the object into a variable, and then call the methods on that object, like so:
$dsw = Dashed_Slug_Wallets::get_instance();
$dsw->get_balance( ‘BTC’, null, false, $user_id );
I have since realized that this is not ideal. I am currently moving towards a new implementation of the API which will be based on WordPress actions and filters, so as to not need to call static methods. This will also mean that calling an action or filter from an extension while the main plugin is not installed will not cause an error, thus eliminating the need for guard clauses of the form if ( class_exists( 'Dashed_Slug_Wallets' ) ) { ...
.
The new API will make heavy use of wp_parse_args(), so that it will be easier to pass any number of arguments without worrying about the position of those arguments or providing defaults when not needed. Therefore, the new call will be something like:
$balance = apply_filters( ‘wallets_api_balance’, 0, array( ‘symbol’ => ‘BTC’ ) );
This change is scheduled for version 3.0.0. The old calls will continue to work as before but will be marked deprecated and there will be a deprecation warning printed in the logs. The deprecated calls will delegate to the new actions and filters. This will all be documented with examples in the documentation.