File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,12 @@ export function useCheckOrderStatuses(ids: string[]) {
22
22
queryKey : [ 'check-order-status' , id ] ,
23
23
queryFn : async ( ) => ordinalsbotClient . orderStatus ( id ) ,
24
24
async onSuccess ( { data } : Awaited < ReturnType < typeof ordinalsbotClient . orderStatus > > ) {
25
+ if ( data . status === 'error' ) {
26
+ if ( data . error . includes ( 'no such order' ) ) {
27
+ // TODO: error processing, remove tx from state?
28
+ }
29
+ return ;
30
+ }
25
31
const entry = transferMap [ data . charge . id ] ;
26
32
27
33
if ( ! entry ) return ;
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ interface InscriptionOrderArgs {
65
65
}
66
66
67
67
interface OrderStatusSuccessResponse {
68
- status : string ;
68
+ status : 'success' ;
69
69
paid : boolean ;
70
70
underpaid : boolean ;
71
71
expired : boolean ;
@@ -115,6 +115,11 @@ interface OrderStatusSuccessResponse {
115
115
sent : string ;
116
116
}
117
117
118
+ interface OrderStatusErrorResponse {
119
+ status : 'error' ;
120
+ error : string ;
121
+ }
122
+
118
123
class OrdinalsbotClient {
119
124
constructor ( readonly baseUrl : string ) { }
120
125
@@ -132,9 +137,12 @@ class OrdinalsbotClient {
132
137
}
133
138
134
139
async orderStatus ( id : string ) {
135
- return axios . get < OrderStatusSuccessResponse > ( urlJoin ( this . baseUrl , 'order' ) , {
136
- params : { id } ,
137
- } ) ;
140
+ return axios . get < OrderStatusSuccessResponse | OrderStatusErrorResponse > (
141
+ urlJoin ( this . baseUrl , 'order' ) ,
142
+ {
143
+ params : { id } ,
144
+ }
145
+ ) ;
138
146
}
139
147
}
140
148
You can’t perform that action at this time.
0 commit comments