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

feat(rgbpp): calculate the pending rgbpp balance #155

Merged
merged 11 commits into from
Jun 3, 2024

Conversation

ahonn
Copy link
Collaborator

@ahonn ahonn commented May 28, 2024

Calculate the pending RGB++ balance by using unconfirmed UTXOs, and return in the corresponding xUDT balance as the pending_amount field

In the previous PR, #146, we collected bound RGB++ cells and calculated balances (xUDT by default; we support xUDT only for now). In this PR, We calculate the pending RGB++ balances by using unconfirmed UTXOs, and follow the following logic to implement:

  • Get unconfirmed UTXOs by the btc_address
  • Retrieve uncompleted jobs through unconfirmed UTXO txid
  • Get output cells from ckbVirtualResult.ckbRawTx in job data
  • Filter output cells by type script to make sure they are xUDT
  • Calculate the pending amount and put them in the balances response

Tasks

References

Copy link

vercel bot commented May 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
btc-assets-api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 3, 2024 6:51am

@ahonn ahonn marked this pull request as draft May 28, 2024 07:12
@ahonn ahonn changed the title feat: calculate the unconfirmed balance using the rgbpp bounded cells feat(rgbpp): calculate the unconfirmed balance using the rgbpp bounded cells May 28, 2024
@Flouse Flouse linked an issue May 28, 2024 that may be closed by this pull request
@ahonn ahonn force-pushed the 133-get-bound-xudt-balance-by-btc-address-unconfirmed branch from 969b07e to eb9f6c1 Compare May 29, 2024 09:29
@ahonn ahonn force-pushed the 133-get-bound-xudt-balance-by-btc-address-unconfirmed branch from ea51817 to eb9f6c1 Compare May 29, 2024 09:40
@ahonn ahonn changed the title feat(rgbpp): calculate the unconfirmed balance using the rgbpp bounded cells feat(rgbpp): calculate the unconfirmed rgbpp balance May 31, 2024
@ahonn ahonn changed the title feat(rgbpp): calculate the unconfirmed rgbpp balance feat(rgbpp): calculate the pending rgbpp balance May 31, 2024
@ahonn ahonn marked this pull request as ready for review June 3, 2024 04:01
src/routes/rgbpp/address.ts Outdated Show resolved Hide resolved
src/services/rgbpp.ts Outdated Show resolved Hide resolved
src/routes/rgbpp/address.ts Show resolved Hide resolved
src/services/rgbpp.ts Outdated Show resolved Hide resolved
src/services/transaction.ts Outdated Show resolved Hide resolved
@Flouse Flouse merged commit 36a9f24 into develop Jun 3, 2024
4 checks passed
@Flouse Flouse deleted the 133-get-bound-xudt-balance-by-btc-address-unconfirmed branch June 3, 2024 14:01
@Flouse
Copy link
Contributor

Flouse commented Jun 3, 2024

Let's merge this PR into the testing workflow, and check #155 (comment) later.

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

Successfully merging this pull request may close these issues.

Get bound xUDT balance by btc address
3 participants