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!

Reply To: wallets_api_transactions filter returns empty result

dashed-slug.net Forums TurtleCoin Adapter extension support wallets_api_transactions filter returns empty result Reply To: wallets_api_transactions filter returns empty result

#10065
alexg
Keymaster

Hello,

I’m not sure why you get back an empty array.

I tried to recreate your example and it works fine.

I first placed an internal transfer:

do_action('wallets_api_move', array(
	'symbol' => 'ARMS',
	'amount' => 5,
	'from_user_id' => 1,
	'to_user_id' => 2,
	'fee' => 0,
	'comment' => 'Cash out of ARMS Rewards to 2ACoin (ARMS)!',
	'skip_confirm' => true,
	'tags' => 'acr_burn acr_burn_128',
));

Then I tried to retrieve it in a similar way to yours:

$args = array(
	'symbol' => 'ARMS',
	'categories' => array('move'),
	'tags' => array('acr_burn'),
);

apply_filters('wallets_api_transactions', array(), $args);

The result contains the transfer, as you can see in the attached screenshots.

The PHP API by default retrieves transactions owned by the current user. This is why in my test I get the send part of the transaction (credit) but not the receive part (debit). If you were calling the PHP code from another user account, you would have to specify a user_id argument to wallets_api_transactions. This will get you the transactions belonging to a specific user. See the docs for this.

Can you try the exact code I pasted above, to see what happens? I ran both snippets from the same account, (user_id 1), with an ARMS balance.

Let me know what you found.

with regards

P.S. As a sidenote, you don’t need to dump debug data to the frontend, because your debug output can break your HTML. A cleaner way to inspect your debug prints is to write to the debug logs using error_log(). Or simply use WP-Console, I find it very useful for these types of tests.

Attachments:
You must be logged in to view attached files.