Skip to content

Commit

Permalink
Add support for fixed fees in Hardhat
Browse files Browse the repository at this point in the history
Signed-off-by: Luis Mastrangelo <[email protected]>
  • Loading branch information
acuarica committed Dec 3, 2024
1 parent 7708178 commit ff8b0e4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions @hts-forking/src/slotmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,16 @@ function slotMapOf(token) {
return { key_type, ed25519: key.key, _e_c_d_s_a_secp256k1: '' };
return { key_type, ed25519: '', _e_c_d_s_a_secp256k1: key.key };
});
const customFees = /**@type {Record<string, unknown>}*/ (token['custom_fees']);
token['fixed_fees'] = customFees['fixed_fees'] ?? [];
const customFees = /**@type {Record<string, Record<string, unknown>[]>}*/ (
token['custom_fees']
);
token['fixed_fees'] = (customFees['fixed_fees'] ?? []).map(fee => ({
fee_collector: fee['collector_account_id'],
amount: fee['amount'],
token_id: fee['denominating_token_id'],
use_hbars_for_payment: !!fee['denominating_token_id'],
use_current_token_for_payment: fee['denominating_token_id'] === token['token_id'],
}));
token['fractional_fees'] = customFees['fractional_fees'] ?? [];
token['royalty_fees'] = customFees['royalty_fees'] ?? [];

Expand Down

0 comments on commit ff8b0e4

Please sign in to comment.