Skip to content

Commit 3f1a9c6

Browse files
address nits
1 parent c0045d0 commit 3f1a9c6

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

sdk/src/network-client.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,8 +1210,7 @@ class AleoNetworkClient {
12101210

12111211
if (elapsed > timeout) {
12121212
clearInterval(interval);
1213-
return reject(new Error("Transaction confirmation timed out"));
1214-
}
1213+
return reject(new Error(`Transaction ${transactionId} did not appear after the timeout period of ${interval}ms - consider resubmitting the transaction`)); }
12151214

12161215
try {
12171216
const res = await fetch(`${this.host}/transaction/confirmed/${transactionId}`, {
@@ -1226,6 +1225,8 @@ class AleoNetworkClient {
12261225
console.warn("Failed to read response text:", err);
12271226
}
12281227

1228+
// If the transaction ID is malformed (e.g. invalid checksum, wrong length),
1229+
// the API returns a 4XX with "Invalid URL" — we treat this as a fatal error and stop polling.
12291230
if (res.status >= 400 && res.status < 500 && text.includes("Invalid URL")) {
12301231
clearInterval(interval);
12311232
return reject(new Error(`Malformed transaction ID: ${text}`));
@@ -1245,10 +1246,10 @@ class AleoNetworkClient {
12451246

12461247
if (data?.status === "rejected") {
12471248
clearInterval(interval);
1248-
return reject(new Error(`Transaction ${transactionId} was rejected by the network`));
1249-
}
1250-
1251-
// no status? keep polling
1249+
return reject(new Error(
1250+
`Transaction ${transactionId} was rejected by the network. Ensure that the account paying the fee has enough credits and that the inputs to the on-chain function are valid.`));
1251+
}
1252+
// No status? keep polling
12521253
} catch (err) {
12531254
console.error("Polling error:", err);
12541255
}

0 commit comments

Comments
 (0)