Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hydration fee #304

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ipfs-cids/.hydra-cid
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Qmc9NHGCfZmCq1NUyq3JgyEasSKj484zfwJU2qc2T99QuR
QmZ5D1vd2n2aP6L4AAustB4pSznvGSgtsYrvJgd62tzbfu
10 changes: 4 additions & 6 deletions src/mappings/swaps/HydraDx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,11 @@ export type Fee = {
amount: string;
};

export function findHydraDxFeeTyped(
events: TypedEventRecord<Codec[]>[],
): Fee | undefined {
export function findHydraDxFeeTyped(events: TypedEventRecord<Codec[]>[]): Fee {
return findHydraDxFee(events as EventRecord[]);
}

export function findHydraDxFee(events: EventRecord[]): Fee | undefined {
export function findHydraDxFee(events: EventRecord[]): Fee {
const lastCurrenciesDepositEvent = findLastEvent(events, (event) =>
isCurrencyDepositedEvent(eventRecordToSubstrateEvent(event)),
);
Expand Down Expand Up @@ -159,9 +157,9 @@ function isPartOfRouterSwap(events: TypedEventRecord<Codec[]>[]): boolean {
return false;
}

function findNativeFee(events: EventRecord[]): Fee | undefined {
function findNativeFee(events: EventRecord[]): Fee {
let foundAssetTxFeePaid = extractTransactionPaidFee(events);
if (foundAssetTxFeePaid == undefined) return undefined;
if (foundAssetTxFeePaid == undefined) foundAssetTxFeePaid = "0";

return {
tokenId: "native",
Expand Down