Skip to content

Commit

Permalink
Gloria/composable/add x tokens response check (#3493)
Browse files Browse the repository at this point in the history
Fixed it again.
  • Loading branch information
bengalmozzi committed Apr 27, 2023
1 parent 75df059 commit 337a7c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions frontend/apps/picasso/defi/polkadot/hooks/useTransfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useStore } from "@/stores/root";
import { SnackbarKey, useSnackbar } from "notistack";
import { useExecutor, useSigner } from "substrate-react";
import BigNumber from "bignumber.js";
import { xcmPalletEventParser } from "@/defi/polkadot/pallets/XCM/utils";
import { xcmEventParser } from "@/defi/polkadot/pallets/XCM/utils";
import { subscanExtrinsicLink } from "shared";
import { useRef } from "react";

Expand Down Expand Up @@ -77,8 +77,8 @@ export const useTransfer = () => {
);
},
(txHash, records) => {
if (api.events.xcmPallet || api.events.polkadotXcm) {
xcmPalletEventParser(
if (api.events.xcmPallet || api.events.polkadotXcm || api.events.xTokens) {
xcmEventParser(
records,
api,
closeSnackbar,
Expand Down
7 changes: 5 additions & 2 deletions frontend/apps/picasso/defi/polkadot/pallets/XCM/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { findFirst } from "fp-ts/Array";
import { boolean, option } from "fp-ts";
import { subscanExtrinsicLink, SubstrateNetworkId } from "shared";

export function xcmPalletEventParser(
export function xcmEventParser(
records: EventRecord[],
api: ApiPromise,
closeSnackbar: (key?: SnackbarKey) => void,
Expand All @@ -21,10 +21,13 @@ export function xcmPalletEventParser(
(e) =>
api.events?.xcmPallet?.Attempted?.is?.(e.event) ||
api.events?.polkadotXcm?.Attempted?.is?.(e.event) ||
api.events?.xTokens?.Attempted?.is?.(e.event)
api.events?.xTokens?.TransferredMultiAssets?.is?.(e.event)
),
option.map((e) => e.event),
option.map((event) => {
if (api.events?.xTokens?.TransferredMultiAssets?.is?.(event)) {
return true;
}
// @ts-ignore
if (event.data.find((x: XcmV2TraitsOutcome) => x.isComplete)) return true;
return false;
Expand Down

0 comments on commit 337a7c1

Please sign in to comment.