Skip to content

Commit c714a39

Browse files
committed
Merge branch 'feature/fix-failed-transaction' into develop
2 parents 6b2f1f8 + 9c8138f commit c714a39

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

bun.lockb

-9.37 KB
Binary file not shown.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@
4444
"tsup": "^8.3.0"
4545
},
4646
"peerDependencies": {
47-
"@ton/ton": "^15.0.0",
4847
"typescript": "^5.0.0"
4948
},
5049
"dependencies": {
5150
"@lifeomic/attempt": "^3.1.0",
5251
"axios": "^1.7.7",
53-
"lodash": "^4.17.21"
52+
"lodash": "^4.17.21",
53+
"@ton/ton": "^15.0.0"
5454
}
5555
}

src/services/tonapi/tonapi.service.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export class TonApi extends Services {
150150
while (retries <= maxRetry) {
151151
try {
152152
let result = await this.client.tonapi.getTransactionEvent(hash);
153-
while (!this.allTransactionComplete(result)) {
153+
while (this.allTransactionComplete(result) === 'inprogress') {
154154
await new Promise((resolve) => setTimeout(resolve, period_ms));
155155
result = await this.client.tonapi.getTransactionEvent(hash);
156156
retries++;
@@ -188,13 +188,12 @@ export class TonApi extends Services {
188188
* Checks if all transactions in the given event are complete.
189189
*
190190
* @param {TransactionEvent} event - The transaction event to check.
191-
* @returns {boolean} - Returns `true` if all transactions are complete and successful, otherwise `false`.
191+
* @returns {string} - Returns `ok` if all transactions are complete and successful, otherwise `failed` or `inprogress`.
192192
* @throws {Error} - Throws an error if any transaction action has a status other than 'ok'.
193193
*/
194194
public allTransactionComplete(event: TransactionEvent) {
195-
if (event.in_progress) return false;
196-
if (event.actions.some((item) => item.status !== 'ok'))
197-
throw new Error('Transaction failed');
198-
return true;
195+
if (event.in_progress) return 'inprogress';
196+
if (event.actions.some((item) => item.status !== 'ok')) return 'failed';
197+
return 'ok';
199198
}
200199
}

0 commit comments

Comments
 (0)