From e1ad9d7bb31531f6c358b96eb220d7bc6327919d Mon Sep 17 00:00:00 2001 From: chrisx9z <287960381+chrisx9z@users.noreply.github.com> Date: Wed, 27 May 2026 15:47:27 +0700 Subject: [PATCH] Mention max int64 in amount errors Comment: Makes path payment amount validation failures call out the maximum 64-bit signed integer limit. --- src/operation.js | 2 +- test/unit/operations/classic_ops_test.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/operation.js b/src/operation.js index fd0a0dde..0cf43bff 100644 --- a/src/operation.js +++ b/src/operation.js @@ -449,7 +449,7 @@ export class Operation { } static constructAmountRequirementsError(arg) { - return `${arg} argument must be of type String, represent a positive number and have at most 7 digits after the decimal`; + return `${arg} argument must be of type String, represent a positive number, have at most 7 digits after the decimal, and not exceed the maximum 64-bit signed integer value`; } /** diff --git a/test/unit/operations/classic_ops_test.js b/test/unit/operations/classic_ops_test.js index c1fbc995..86f65762 100644 --- a/test/unit/operations/classic_ops_test.js +++ b/test/unit/operations/classic_ops_test.js @@ -438,6 +438,22 @@ describe('Operation', function () { /destMin argument must be of type String/ ); }); + + it('fails to create path payment operation when destMin exceeds MAX_INT64', function () { + const opts = { + destination: 'GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ', + sendAmount: '20', + destMin: '922337203685.4775808', + sendAsset: StellarBase.Asset.native(), + destAsset: new StellarBase.Asset( + 'USD', + 'GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7' + ) + }; + expect(() => StellarBase.Operation.pathPaymentStrictSend(opts)).to.throw( + /destMin argument.*maximum 64-bit signed integer value/ + ); + }); }); describe('.changeTrust()', function () {