-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6da1a3a
commit 48ab741
Showing
19 changed files
with
162 additions
and
51 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
import { HexString } from '@common/types'; | ||
import { Address, HexString } from '@common/types'; | ||
|
||
export type Wallet = { | ||
publicKey: HexString; | ||
}; | ||
|
||
export type GiftWallet = { | ||
address: Address; | ||
mnemonic: string | null; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
'use client'; | ||
import { ReactElement, useEffect } from 'react'; | ||
import { useRouter } from 'next/router'; | ||
import { CircularProgress } from '@nextui-org/react'; | ||
|
||
import { useTelegram } from '@common/providers/telegramProvider'; | ||
import { useGlobalContext } from '@/common/providers/contextProvider'; | ||
import { Paths } from '@/common/routing'; | ||
import { HeadlineText, Layout } from '@/components'; | ||
import { useExtrinsicProvider } from '@/common/extrinsicService/ExtrinsicProvider'; | ||
import { handleSend } from '@/common/utils/balance'; | ||
import { TrasferAsset } from '@/common/types'; | ||
import { createGiftWallet } from '@/common/wallet'; | ||
|
||
export default function CreateGiftPage() { | ||
const router = useRouter(); | ||
const { submitExtrinsic } = useExtrinsicProvider(); | ||
const { BackButton, MainButton } = useTelegram(); | ||
const { selectedAsset, setSelectedAsset } = useGlobalContext(); | ||
|
||
useEffect(() => { | ||
BackButton?.hide(); | ||
MainButton?.hide(); | ||
MainButton?.setText('Gift created'); | ||
|
||
if (!selectedAsset) return; | ||
const wallet = createGiftWallet(selectedAsset.addressPrefix as number); | ||
(async function () { | ||
await handleSend(submitExtrinsic, selectedAsset as TrasferAsset, wallet.address).then(() => { | ||
//TODO: create tg link | ||
MainButton?.show(); | ||
}); | ||
})(); | ||
|
||
const mainCallback = async () => { | ||
router.push(Paths.TRANSFER_RESULT); | ||
}; | ||
MainButton?.onClick(mainCallback); | ||
|
||
return () => { | ||
setSelectedAsset(null); | ||
MainButton?.hide(); | ||
MainButton?.offClick(mainCallback); | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<> | ||
<CircularProgress size="lg" className="m-auto my-10" /> | ||
<HeadlineText className="text-text-hint" align="center"> | ||
Creating your gift.. | ||
</HeadlineText> | ||
</> | ||
); | ||
} | ||
|
||
CreateGiftPage.getLayout = function getLayout(page: ReactElement) { | ||
return <Layout>{page}</Layout>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.