Skip to content

Commit

Permalink
Fix Transaction.getClaimableBalanceId() to get correct claimable ba…
Browse files Browse the repository at this point in the history
…lance ID. (#530)
  • Loading branch information
overcat authored May 17, 2022
1 parent 98feac6 commit b6e84fd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
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

0 comments on commit b6e84fd

Please sign in to comment.