From 16e5a0f64482d92d969015087c6b8e987e904cbc Mon Sep 17 00:00:00 2001 From: Pavlos Chrysochoidis <10210143+pchrysochoidis@users.noreply.github.com> Date: Tue, 28 Jun 2022 16:58:35 +0100 Subject: [PATCH] wallet-ext: revert some of the changes of 2605 pr * fixes missing files * reverted some renaming changes back to coin since wallet does only coin transfers for now --- wallet/src/ui/app/index.tsx | 4 ++-- .../ui/app/pages/transfer-coin/TransferCoinForm.tsx | 10 +++++----- wallet/src/ui/app/pages/transfer-coin/index.tsx | 8 ++++---- wallet/src/ui/app/redux/slices/sui-objects/Coin.ts | 2 +- wallet/src/ui/app/redux/slices/transactions/index.ts | 2 +- wallet/src/ui/app/redux/slices/txresults/index.ts | 4 +++- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/wallet/src/ui/app/index.tsx b/wallet/src/ui/app/index.tsx index 22524d3d1d448..81620376c94a7 100644 --- a/wallet/src/ui/app/index.tsx +++ b/wallet/src/ui/app/index.tsx @@ -16,7 +16,7 @@ import ImportPage from './pages/initialize/import'; import SelectPage from './pages/initialize/select'; import SiteConnectPage from './pages/site-connect'; import TransactionDetailsPage from './pages/transaction-details'; -import PublicTransferObjectPage from './pages/transfer-coin'; +import TransferCoinPage from './pages/transfer-coin'; import WelcomePage from './pages/welcome'; import { AppType } from './redux/slices/app/AppType'; import { useAppDispatch, useAppSelector } from '_hooks'; @@ -44,7 +44,7 @@ const App = () => { <Route path="nfts" element={<NftsPage />} /> <Route path="transactions" element={<TransactionsPage />} /> <Route path="settings" element={<SettingsPage />} /> - <Route path="send" element={<PublicTransferObjectPage />} /> + <Route path="send" element={<TransferCoinPage />} /> <Route path="tx/:txDigest" element={<TransactionDetailsPage />} diff --git a/wallet/src/ui/app/pages/transfer-coin/TransferCoinForm.tsx b/wallet/src/ui/app/pages/transfer-coin/TransferCoinForm.tsx index c95d2c9bfefbb..4b4347f68d349 100644 --- a/wallet/src/ui/app/pages/transfer-coin/TransferCoinForm.tsx +++ b/wallet/src/ui/app/pages/transfer-coin/TransferCoinForm.tsx @@ -17,21 +17,21 @@ import { balanceFormatOptions } from '_shared/formatting'; import type { FormValues } from './'; -import st from './PublicTransferObjectForm.module.scss'; +import st from './TransferCoinForm.module.scss'; -export type PublicTransferObjectFormProps = { +export type TransferCoinFormProps = { submitError: string | null; coinBalance: string; coinSymbol: string; onClearSubmitError: () => void; }; -function PublicTransferObjectForm({ +function TransferCoinForm({ submitError, coinBalance, coinSymbol, onClearSubmitError, -}: PublicTransferObjectFormProps) { +}: TransferCoinFormProps) { const { isSubmitting, isValid, @@ -103,4 +103,4 @@ function PublicTransferObjectForm({ ); } -export default memo(PublicTransferObjectForm); +export default memo(TransferCoinForm); diff --git a/wallet/src/ui/app/pages/transfer-coin/index.tsx b/wallet/src/ui/app/pages/transfer-coin/index.tsx index f22a86a1665ad..54ef52353e274 100644 --- a/wallet/src/ui/app/pages/transfer-coin/index.tsx +++ b/wallet/src/ui/app/pages/transfer-coin/index.tsx @@ -6,7 +6,7 @@ import { useCallback, useMemo, useState } from 'react'; import { useIntl } from 'react-intl'; import { Navigate, useNavigate, useSearchParams } from 'react-router-dom'; -import PublicTransferObjectForm from './PublicTransferObjectForm'; +import TransferCoinForm from './TransferCoinForm'; import { createValidationSchema } from './validation'; import Loading from '_components/loading'; import { useAppSelector, useAppDispatch } from '_hooks'; @@ -29,7 +29,7 @@ const initialValues = { export type FormValues = typeof initialValues; // TODO: show out of sync when sui objects locally might be outdated -function PublicTransferObjectPage() { +function TransferCoinPage() { const [searchParams] = useSearchParams(); const coinType = useMemo(() => searchParams.get('type'), [searchParams]); const balances = useAppSelector(accountItemizedBalancesSelector); @@ -120,7 +120,7 @@ function PublicTransferObjectPage() { validationSchema={validationSchema} onSubmit={onHandleSubmit} > - <PublicTransferObjectForm + <TransferCoinForm submitError={sendError} coinBalance={coinBalance.toString()} coinSymbol={coinSymbol} @@ -132,4 +132,4 @@ function PublicTransferObjectPage() { ); } -export default PublicTransferObjectPage; +export default TransferCoinPage; diff --git a/wallet/src/ui/app/redux/slices/sui-objects/Coin.ts b/wallet/src/ui/app/redux/slices/sui-objects/Coin.ts index f70536dc5eeb9..7e67e70a5283b 100644 --- a/wallet/src/ui/app/redux/slices/sui-objects/Coin.ts +++ b/wallet/src/ui/app/redux/slices/sui-objects/Coin.ts @@ -64,7 +64,7 @@ export class Coin { * @param amount The amount to be transfer * @param recipient The sui address of the recipient */ - public static async publicTransferObject( + public static async transferCoin( signer: RawSigner, coins: SuiMoveObject[], amount: bigint, diff --git a/wallet/src/ui/app/redux/slices/transactions/index.ts b/wallet/src/ui/app/redux/slices/transactions/index.ts index c641afa894fde..dc687e160fede 100644 --- a/wallet/src/ui/app/redux/slices/transactions/index.ts +++ b/wallet/src/ui/app/redux/slices/transactions/index.ts @@ -48,7 +48,7 @@ export const sendTokens = createAsyncThunk< isSuiMoveObject(anObj.data) && anObj.data.type === coinType ) .map(({ data }) => data as SuiMoveObject); - const response = await Coin.publicTransferObject( + const response = await Coin.transferCoin( api.getSignerInstance(keypairVault.getKeyPair()), coins, amount, diff --git a/wallet/src/ui/app/redux/slices/txresults/index.ts b/wallet/src/ui/app/redux/slices/txresults/index.ts index 475995bb1dc80..737e514c2150b 100644 --- a/wallet/src/ui/app/redux/slices/txresults/index.ts +++ b/wallet/src/ui/app/redux/slices/txresults/index.ts @@ -92,7 +92,9 @@ export const getTransactionsByAddress = createAsyncThunk< const txn = txns[0]; const txKind = getTransactionKindName(txn); const recipient = - getPublicTransferObjectTransaction(txn)?.recipient; + getPublicTransferObjectTransaction( + txn + )?.recipient; return { seq,