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

fix: fix Transaction.getClaimableBalanceId() to get correct claimable balance id. #530

Merged
merged 1 commit into from
May 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ export class Transaction extends TransactionBase {
const operationId = xdr.HashIdPreimage.envelopeTypeOpId(
new xdr.HashIdPreimageOperationId({
sourceAccount: xdr.AccountId.publicKeyTypeEd25519(account),
seqNum: new xdr.SequenceNumber(this.sequence),
seqNum: xdr.SequenceNumber.fromString(this.sequence),
opNum: opIndex
})
);
Expand Down
13 changes: 13 additions & 0 deletions test/unit/transaction_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,19 @@ describe('Transaction', function() {
);
});

// See https://github.com/stellar/js-stellar-base/issues/529
it('calculates from transaction src (big number sequence)', function() {
let gSource = new StellarBase.Account(address, '114272277834498050');

let tx = makeBuilder(gSource)
.addOperation(makeClaimableBalance())
.build();
const balanceId = tx.getClaimableBalanceId(0);
expect(balanceId).to.be.equal(
'000000001cd1e39f422a864b4efca661e11ffaa1c54e69b23aaf096e0cfd361bb4a275bf'
);
});

it('calculates from muxed transaction src as if unmuxed', function() {
let gSource = new StellarBase.Account(address, '1234');
let mSource = new StellarBase.MuxedAccount(gSource, '5678');
Expand Down