Skip to content

Commit

Permalink
Correctly set minAccountSequence in TransactionBuilder for large …
Browse files Browse the repository at this point in the history
…values (#539)
  • Loading branch information
overcat authored Aug 16, 2022
1 parent 9fba305 commit 4bfe156
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/transaction_builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ export class TransactionBuilder {
}

let minSeqNum = this.minAccountSequence || '0';
minSeqNum = new xdr.SequenceNumber(UnsignedHyper.fromString(minSeqNum));
minSeqNum = xdr.SequenceNumber.fromString(minSeqNum);

const minSeqAge = UnsignedHyper.fromString(
this.minAccountSequenceAge !== null
Expand Down
17 changes: 17 additions & 0 deletions test/unit/transaction_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,23 @@ describe('Transaction', function() {
expect(val.toString()).to.equal('5');
});

it('minAccountSequence (big number)', function() {
let tx = makeBuilder()
.setTimeout(5)
.setMinAccountSequence('103420918407103888')
.build();
expect(tx.minAccountSequence).to.eql('103420918407103888');

const val = tx
.toEnvelope()
.v1()
.tx()
.cond()
.v2()
.minSeqNum();
expect(val.toString()).to.equal('103420918407103888');
});

it('minAccountSequenceAge', function() {
let tx = makeBuilder()
.setTimeout(5)
Expand Down

0 comments on commit 4bfe156

Please sign in to comment.