Skip to content

Commit

Permalink
Merge pull request #72 from novasamatech/fix/gift-claim
Browse files Browse the repository at this point in the history
Fix: gift claim
  • Loading branch information
sokolova-an authored Feb 13, 2024
2 parents 4422081 + a66fe8f commit 2056628
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/common/chainRegistry/ConnectionProvider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useRef, useState } from 'react';
import { ApiPromise, WsProvider } from '@polkadot/api';
import { ProviderInterface } from '@polkadot/rpc-provider/types';
import { useRef, useState } from 'react';

import {
ConnectionRequest,
Expand Down
1 change: 0 additions & 1 deletion src/common/providers/telegramProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export const TelegramProvider = ({ children }: PropsWithChildren) => {
app.ready();
setWebApp(app);
app.setHeaderColor('#f2f2f7');
app.enableClosingConfirmation();
app.expand();
}
}, []);
Expand Down
2 changes: 2 additions & 0 deletions src/common/telegram/useMainButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const useMainButton = () => {
const addMainButton = useCallback(
(event: VoidFunction, text: string = 'Continue') => {
reset();
window?.Telegram?.WebApp?.enableClosingConfirmation();

mainButton.setText(text);
mainButton.show();
Expand All @@ -36,6 +37,7 @@ export const useMainButton = () => {

const hideMainButton = useCallback(() => {
mainButton.hide();
window?.Telegram?.WebApp?.disableClosingConfirmation();
reset();
}, []);

Expand Down
1 change: 1 addition & 0 deletions src/common/utils/gift.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const getGiftInfo = async (
getAssetBySymbol: (symbol: string) => Promise<ChainAsset>,
): Promise<{ chainAddress: string; chain: ChainAsset; giftAddress: string; keyring: KeyringPair }> => {
const [seed, symbol] = (startParam as string).split('_');

const chain = await getAssetBySymbol(symbol);
const chainAddress = encodeAddress(publicKey as string, chain.chain.addressPrefix);
const keyring = getKeyringPairFromSeed(seed);
Expand Down
5 changes: 4 additions & 1 deletion src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { NextPage } from 'next';
import Head from 'next/head';
import { ReactElement, ReactNode, useEffect, useState } from 'react';
import { BrowserRouter as Router } from 'react-router-dom';
import { cryptoWaitReady } from '@polkadot/util-crypto';
import { NextUIProvider } from '@nextui-org/react';
import { Manrope } from 'next/font/google';

Expand All @@ -25,7 +26,9 @@ type AppPropsWithLayout = AppProps & {

const App = ({ Component, pageProps }: AppPropsWithLayout) => {
const [render, setRender] = useState(false);
useEffect(() => setRender(true), []);
useEffect(() => {
cryptoWaitReady().then(() => setRender(true));
}, []);
const getLayout = Component.getLayout || ((page) => page);

return (
Expand Down
2 changes: 1 addition & 1 deletion src/screens/gifts/GiftPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function GiftPage() {
BackButton?.show();
hideMainButton();

const callback = async () => {
const callback = () => {
navigate(Paths.DASHBOARD);
};
BackButton?.onClick(callback);
Expand Down

0 comments on commit 2056628

Please sign in to comment.