Skip to content

Commit

Permalink
refactor: move detect ordinal if found logic to core
Browse files Browse the repository at this point in the history
  • Loading branch information
teebszet committed Dec 11, 2023
1 parent 13712b4 commit 8338ee2
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/app/hooks/useDetectOrdinalInSignPsbt.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import {
Bundle,
getUtxoOrdinalBundle,
getUtxoOrdinalBundleIfFound,

Check failure on line 3 in src/app/hooks/useDetectOrdinalInSignPsbt.ts

View workflow job for this annotation

GitHub Actions / build

'"@secretkeylabs/xverse-core"' has no exported member named 'getUtxoOrdinalBundleIfFound'. Did you mean 'getUtxoOrdinalBundle'?
mapRareSatsAPIResponseToBundle,
ParsedPSBT,
} from '@secretkeylabs/xverse-core';
import { isAxiosError } from 'axios';
import useWalletSelector from './useWalletSelector';

export type InputsBundle = (Pick<Bundle, 'satRanges' | 'totalExoticSats'> & {
Expand All @@ -22,15 +21,7 @@ const useDetectOrdinalInSignPsbt = () => {

if (parsedPsbt) {
const inputsRequest = parsedPsbt.inputs.map((input) =>
getUtxoOrdinalBundle(network.type, input.txid, input.index).catch((e) => {
// we don't reject on 404s because if the UTXO is not found,
// it is likely this is a UTXO from an unpublished txn.
// this is required for gamma.io purchase flow
if (!isAxiosError(e) || e.response?.status !== 404) {
// rethrow error if response was not 404
throw e;
}
}),
getUtxoOrdinalBundleIfFound(network.type, input.txid, input.index),
);
const inputsResponse = await Promise.all(inputsRequest);
inputsResponse.forEach((inputResponse, index) => {
Expand Down

0 comments on commit 8338ee2

Please sign in to comment.