File tree Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 44
44
"tsup" : " ^8.3.0"
45
45
},
46
46
"peerDependencies" : {
47
- "@ton/ton" : " ^15.0.0" ,
48
47
"typescript" : " ^5.0.0"
49
48
},
50
49
"dependencies" : {
51
50
"@lifeomic/attempt" : " ^3.1.0" ,
52
51
"axios" : " ^1.7.7" ,
53
- "lodash" : " ^4.17.21"
52
+ "lodash" : " ^4.17.21" ,
53
+ "@ton/ton" : " ^15.0.0"
54
54
}
55
55
}
Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ export class TonApi extends Services {
150
150
while ( retries <= maxRetry ) {
151
151
try {
152
152
let result = await this . client . tonapi . getTransactionEvent ( hash ) ;
153
- while ( ! this . allTransactionComplete ( result ) ) {
153
+ while ( this . allTransactionComplete ( result ) === 'inprogress' ) {
154
154
await new Promise ( ( resolve ) => setTimeout ( resolve , period_ms ) ) ;
155
155
result = await this . client . tonapi . getTransactionEvent ( hash ) ;
156
156
retries ++ ;
@@ -188,13 +188,12 @@ export class TonApi extends Services {
188
188
* Checks if all transactions in the given event are complete.
189
189
*
190
190
* @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 `.
192
192
* @throws {Error } - Throws an error if any transaction action has a status other than 'ok'.
193
193
*/
194
194
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' ;
199
198
}
200
199
}
You can’t perform that action at this time.
0 commit comments