js-stellar-sdk icon indicating copy to clipboard operation
js-stellar-sdk copied to clipboard

Add helpers to obtain Claimable Balance IDs

Open 2opremio opened this issue 5 years ago • 2 comments
trafficstars

CAP 23 (as part of Stellar Protocol 14 and released with Horizon 1.9.0) allows creating and claiming Claimable Balances.

Those balances are queried and claimed using their ID which can be obtained:

  1. Before submitting the transaction creating the claim. The Claim ID is internally just a Hash which can be inferred even before Core accepts the transaction. A helper function would be useful in order to obtain this. :heavy_check_mark: stellar/js-stellar-base#482
  2. After the transaction creating the claim is submitted (i.e. in the transaction result). However, the claimable ID is pretty buried withing the result XDR, making it hard to obtain through the raw API result. A helper would come in handy.

(2) still needs to be implemented

2opremio avatar Oct 13 '20 23:10 2opremio

Hi @Shaptic!!

I recently made a dumb little side quest challenging folks to both create and claim a CB in a single transaction. I leaned heavily on the equivalent helper function from the python sdk, and just now thought to look if this was available in the js sdk.

Since it's already an issue, and is labeled good first issue, I think I'd like to take a stab at implementing it. What do you think?

ElliotFriend avatar May 06 '22 03:05 ElliotFriend

Hi @ElliotFriend! Yeah, this is definitely a good first issue. Do note that the helper for (1) was added in stellar/js-stellar-base#482, but (2) would still be useful to anyone working with claimable balances. The PR will belong in the js-stellar-base repo, though, as that's where XDR-related goodies are handled :+1:

Shaptic avatar May 06 '22 18:05 Shaptic