fix: a swap deadline later than a date can hold is stated in words (closes #437)
decode() rendered the Deadline line with toISOString(), which throws on a date past 275760-09-13, the last a JavaScript date can hold. A later deadline, such as the uint256 maximum, therefore left the whole swap undecoded, with nothing saying why. That line now reads "After 275760-09-13 00:00:00 (no deadline in practice)". Model: opus-5-5
This commit was merged in pull request #441.
This commit is contained in:
@@ -724,10 +724,15 @@ function decode(data, toAddress, sources) {
|
||||
|
||||
details.push({ label: "Steps", value: commandNames.join(" \u2192 ") });
|
||||
|
||||
// A JavaScript date reaches only to 275760-09-13 00:00:00 UTC. A
|
||||
// later deadline, such as the uint256 maximum, makes an invalid date,
|
||||
// and toISOString() throws on one, so that deadline is said in words.
|
||||
const deadlineDate = new Date(Number(deadline) * 1000);
|
||||
details.push({
|
||||
label: "Deadline",
|
||||
value: deadlineDate.toISOString().replace("T", " ").slice(0, 19),
|
||||
value: isNaN(deadlineDate.getTime())
|
||||
? "After 275760-09-13 00:00:00 (no deadline in practice)"
|
||||
: deadlineDate.toISOString().replace("T", " ").slice(0, 19),
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user