Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get unconfirmed balance given an address #3325

Closed
roccomuso opened this issue Dec 4, 2019 · 4 comments
Closed

Get unconfirmed balance given an address #3325

roccomuso opened this issue Dec 4, 2019 · 4 comments
Assignees

Comments

@roccomuso
Copy link

Question

Is there an API to get unconfirmed balance or txs, given a wallet address?

@ghost
Copy link

ghost commented Dec 4, 2019

Thanks for opening this issue! A maintainer will review this in the next few days and explicitly select labels so you know what's going on.

If no reviewer appears after a week, a reminder will be sent out.

@kristjank
Copy link
Contributor

kristjank commented Dec 4, 2019

Think not. It would be possible to add this, as unconfirmed balance, but it is not a network wide thing, for example like there is no assurance for the unconfirmed balances to be the same, as transaction pools differ across the network and unconfirmed balance is the transaction pool balance of the wallet.

It would make sense, if you had your own node/pool to talk to.

@faustbrian faustbrian assigned faustbrian and vasild and unassigned faustbrian Dec 5, 2019
@vasild
Copy link
Contributor

vasild commented Dec 6, 2019

The unconfirmed balance can be retrieved relatively easily using the current API. For example, to retrieve total received, unconfirmed (pagination not handled):

curl -H "API-Version: 2" -d recipientId=AbbN4RiMezriNuQUuts87KSks4nVChdjvW https://ark.exodus-prod.io/api/transactions/search \
  |node -e 'console.log(JSON.parse(fs.readFileSync(0)).data.reduce((sum, tx) => tx.confirmations === 0 ? sum + Number(tx.amount) : sum, 0));'

and similarly to retrieve total sent (replacing recipientId with senderId in the above). Then subtracting the two numbers would give the unconfirmed balance (assuming no transactions get confirmed in the meantime and no new ones arrive).

I do not think it is justified to add such a functionality in the API, given that it can be coded easily at the application level.

@vasild vasild closed this as completed Dec 6, 2019
@ghost
Copy link

ghost commented Dec 6, 2019

This issue has been closed. If you wish to re-open it please provide additional information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants