Skip to content

Commit

Permalink
chore: replace post with get request
Browse files Browse the repository at this point in the history
  • Loading branch information
slavastartsev committed Jan 9, 2025
1 parent 4ed5059 commit f64df26
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
22 changes: 11 additions & 11 deletions sdk/src/wallet/utxo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ const createUtxoNodes = async (
cardinalOutputsSet: Set<string>,
ordinalsClient: OrdinalsClient
): Promise<(null | TreeNode<OutputNodeData>)[]> => {
const outputs = await ordinalsClient.getOutputsFromOutPoints(utxos.map(OutPoint.toString));

return utxos.map<TreeNode<OutputNodeData> | null>((utxo, index) => {
if (cardinalOutputsSet.has(OutPoint.toString(utxo))) return null;
return Promise.all(
utxos.map<Promise<TreeNode<OutputNodeData> | null>>(async (utxo) => {
if (cardinalOutputsSet.has(OutPoint.toString(utxo))) return null;

const output = outputs[index];
const output = await ordinalsClient.getInscriptionsFromOutPoint(utxo);

return new TreeNode<OutputNodeData>({
...utxo,
cardinal: isCardinal(output),
indexed: output.indexed,
});
});
return new TreeNode<OutputNodeData>({
...utxo,
cardinal: isCardinal(output),
indexed: output.indexed,
});
})
);
};

const processNodes = async (
Expand Down
4 changes: 2 additions & 2 deletions sdk/test/utxo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -554,10 +554,10 @@ describe('UTXO Tests', () => {
})
);
// mark every requested output as not indexed and not containing inscriptions or runes
vi.spyOn(OrdinalsClient.prototype, 'getOutputsFromOutPoints').mockResolvedValue(
vi.spyOn(OrdinalsClient.prototype, 'getInscriptionsFromOutPoint').mockResolvedValue(
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
Array.from(outputs, () => ({ indexed: false, inscriptions: [], runes: {} }))
{ indexed: false, inscriptions: [], runes: {} }
);

// no inputs otherwise will loop infinitely
Expand Down

0 comments on commit f64df26

Please sign in to comment.