Skip to content

Commit a5f6dac

Browse files
committed
fix: brc-20 pending transactions
1 parent 3230c49 commit a5f6dac

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/app/query/bitcoin/ordinals/brc20/use-check-order-status.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ export function useCheckOrderStatuses(ids: string[]) {
2222
queryKey: ['check-order-status', id],
2323
queryFn: async () => ordinalsbotClient.orderStatus(id),
2424
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+
}
2531
const entry = transferMap[data.charge.id];
2632

2733
if (!entry) return;

src/app/query/bitcoin/ordinalsbot-client.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ interface InscriptionOrderArgs {
6565
}
6666

6767
interface OrderStatusSuccessResponse {
68-
status: string;
68+
status: 'success';
6969
paid: boolean;
7070
underpaid: boolean;
7171
expired: boolean;
@@ -115,6 +115,11 @@ interface OrderStatusSuccessResponse {
115115
sent: string;
116116
}
117117

118+
interface OrderStatusErrorResponse {
119+
status: 'error';
120+
error: string;
121+
}
122+
118123
class OrdinalsbotClient {
119124
constructor(readonly baseUrl: string) {}
120125

@@ -132,9 +137,12 @@ class OrdinalsbotClient {
132137
}
133138

134139
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+
);
138146
}
139147
}
140148

0 commit comments

Comments
 (0)