Skip to content

Commit

Permalink
refactor: stop multiplying options in getUtxos
Browse files Browse the repository at this point in the history
  • Loading branch information
andreabadesso committed Feb 25, 2025
1 parent b9fceef commit ecf6825
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/hathor-rpc-handler/src/rpcMethods/createToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const createTokenSchema = z.object({
allow_external_mint_authority_address: z.boolean().default(false),
create_melt: z.boolean().default(true),
melt_authority_address: z.string().nullish().default(null),
allow_external_melt_authority_address: z.boolean().optional().default(false),
allow_external_melt_authority_address: z.boolean().default(false),
data: z.string().array().nullish().default(null),
}).transform(data => ({
name: data.name,
Expand Down
14 changes: 1 addition & 13 deletions packages/hathor-rpc-handler/src/rpcMethods/getUtxos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,11 @@ export async function getUtxos(

validateNetwork(wallet, params.network);

const options = {
'token': params.token,
// Defaults to 0 otherwise the lib fails
'authorities': params.authorities,
'max_utxos': params.max_utxos,
'filter_address': params.filter_address,
'amount_smaller_than': params.amount_smaller_than,
'amount_bigger_than': params.amount_bigger_than,
'max_amount': params.max_amount,
'only_available_utxos': params.only_available_utxos,
};

// We have the same issues here that we do have in the headless wallet:
// TODO: Memory usage enhancements are required here as wallet.getUtxos can cause issues on
// wallets with a huge amount of utxos.
// TODO: This needs to be paginated.
const utxoDetails: UtxoDetails[] = await wallet.getUtxos(options);
const utxoDetails: UtxoDetails[] = await wallet.getUtxos(params);

const confirmed = await promptHandler({
type: TriggerTypes.GetUtxosConfirmationPrompt,
Expand Down

0 comments on commit ecf6825

Please sign in to comment.