-
Notifications
You must be signed in to change notification settings - Fork 159
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
fix the decoding of balanceId
in org.stellar.sdk.ClaimClaimableBalanceOperation
.
#310
fix the decoding of balanceId
in org.stellar.sdk.ClaimClaimableBalanceOperation
.
#310
Conversation
63408f8
to
5068b0f
Compare
@@ -22,14 +25,16 @@ public String getBalanceId() { | |||
org.stellar.sdk.xdr.Operation.OperationBody toOperationBody() { | |||
ClaimClaimableBalanceOp op = new ClaimClaimableBalanceOp(); | |||
|
|||
ClaimableBalanceID id = new ClaimableBalanceID(); | |||
id.setDiscriminant(ClaimableBalanceIDType.CLAIMABLE_BALANCE_ID_TYPE_V0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CLAIMABLE_BALANCE_ID_TYPE is already included in the banlanceId
.
5068b0f
to
7faa588
Compare
@overcat can you add a test? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No tests change as part of this that indicates we have no tests that cover this code and therefore this issue. Can you add a test that fails without this change and passes with the change?
caf48f8
to
32331b3
Compare
Hi @leighmcculloch @tamirms, just added some tests. |
ClaimClaimableBalanceOperation parsedOperation = (ClaimClaimableBalanceOperation) Operation.fromXdr(xdr); | ||
assertEquals(accountId, parsedOperation.getSourceAccount()); | ||
assertEquals(balanceId, parsedOperation.getBalanceId()); | ||
// Generated by js-stellar-base. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const stellarBase = require("stellar-base")
const op = stellarBase.Operation.claimClaimableBalance({
balanceId: "000000006d6a0c142516a9cc7885a85c5aba3a1f4af5181cf9e7a809ac7ae5e4a58c825f",
source: "GABTTS6N4CT7AUN4LD7IFIUMRD5PSMCW6QTLIQNEFZDEI6ZQVUCQMCLN"
})
console.log(op.toXDR().toString("base64"))
> AAAAAQAAAAADOcvN4KfwUbxY/oKijIj6+TBW9Ca0QaQuRkR7MK0FBgAAAA8AAAAAbWoMFCUWqcx4hahcWro6H0r1GBz556gJrHrl5KWMgl8=
fix #309