From fc690946786c8893b16f993f26441d027324af5e Mon Sep 17 00:00:00 2001 From: alter-eggo Date: Sat, 16 Mar 2024 13:38:16 +0400 Subject: [PATCH] fix: brc20 send status update, closes #4939 --- src/app/query/bitcoin/ordinals/brc20/use-brc-20.ts | 2 +- .../bitcoin/ordinals/brc20/use-check-order-status.ts | 10 +++++----- .../query/bitcoin/ordinals/inscription-by-id.query.ts | 2 +- src/app/query/bitcoin/ordinalsbot-client.ts | 3 +++ 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/app/query/bitcoin/ordinals/brc20/use-brc-20.ts b/src/app/query/bitcoin/ordinals/brc20/use-brc-20.ts index a2bb1553589..eca1e985e3a 100644 --- a/src/app/query/bitcoin/ordinals/brc20/use-brc-20.ts +++ b/src/app/query/bitcoin/ordinals/brc20/use-brc-20.ts @@ -50,7 +50,7 @@ export function useBrc20Transfers(holderAddress: string) { if (order.data.status !== 'ok') throw new Error('Failed to initiate transfer'); - return { id: order.data.charge.id, order }; + return { id: order.data.id, order }; }, inscriptionPaymentTransactionComplete( diff --git a/src/app/query/bitcoin/ordinals/brc20/use-check-order-status.ts b/src/app/query/bitcoin/ordinals/brc20/use-check-order-status.ts index 682ff4e76c2..42fcf1d3d18 100644 --- a/src/app/query/bitcoin/ordinals/brc20/use-check-order-status.ts +++ b/src/app/query/bitcoin/ordinals/brc20/use-check-order-status.ts @@ -30,13 +30,13 @@ export function useCheckOrderStatuses(ids: string[]) { return; } - const entry = transferMap[data.charge.id]; + const entry = transferMap[data.id]; if (!entry) return; const file = data.files[0]; - // inscrption reported by service + // inscription reported by service if ('tx' in file) { // see if its on hiro indexer try { @@ -45,7 +45,7 @@ export function useCheckOrderStatuses(ids: string[]) { if (inscription.number) { dispatch( brc20TransferReady({ - id: data.charge.id, + id: data.id, inscriptionId: file.tx?.inscription ?? '', }) ); @@ -54,12 +54,12 @@ export function useCheckOrderStatuses(ids: string[]) { } catch (error) {} // or say awaiting indexer - dispatch(brc20TransferAwaitingIndexer({ id: data.charge.id })); + dispatch(brc20TransferAwaitingIndexer({ id: data.id })); return; } if (data.paid && entry.status !== 'paid') { - dispatch(brc20TransferPaid({ id: data.charge.id })); + dispatch(brc20TransferPaid({ id: data.id })); return; } }, diff --git a/src/app/query/bitcoin/ordinals/inscription-by-id.query.ts b/src/app/query/bitcoin/ordinals/inscription-by-id.query.ts index 6a609fe22b7..da73c8d918b 100644 --- a/src/app/query/bitcoin/ordinals/inscription-by-id.query.ts +++ b/src/app/query/bitcoin/ordinals/inscription-by-id.query.ts @@ -4,5 +4,5 @@ import { HIRO_INSCRIPTIONS_API_URL } from '@shared/constants'; import { InscriptionResponseItem } from '@shared/models/inscription.model'; export async function fetchInscripionById(id: string) { - return axios.get(`${HIRO_INSCRIPTIONS_API_URL}}/${id}`); + return axios.get(`${HIRO_INSCRIPTIONS_API_URL}/${id}`); } diff --git a/src/app/query/bitcoin/ordinalsbot-client.ts b/src/app/query/bitcoin/ordinalsbot-client.ts index 015ebd56915..b72b219d502 100644 --- a/src/app/query/bitcoin/ordinalsbot-client.ts +++ b/src/app/query/bitcoin/ordinalsbot-client.ts @@ -45,6 +45,7 @@ interface InscriptionOrderSuccessResponse { payreq: string; }; }; + id: string; chainFee: number; serviceFee: number; baseFee: number; @@ -69,6 +70,8 @@ interface OrderStatusSuccessResponse { paid: boolean; underpaid: boolean; expired: boolean; + id: string; + state: string; charge: { id: string; description: string;