Skip to content
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
5 changes: 2 additions & 3 deletions src/components/ContractAddress/ContractAddress.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Label } from 'components/Label';
import { ExplorerLink, Label } from 'components';
import { contractAddress } from 'config';
import { ACCOUNTS_ENDPOINT } from 'utils/sdkDappCore';
import { ExplorerLink } from '../ExplorerLink';
import { ACCOUNTS_ENDPOINT } from 'lib';

export const ContractAddress = () => {
return (
Expand Down
3 changes: 1 addition & 2 deletions src/components/CopyButton/CopyButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { CopyButtonSDK } from 'components/sdkDappCoreUI';
import { CopyButtonSDKPropsType } from 'types/sdkDappCoreUI.types';
import { CopyButtonSDKPropsType, CopyButtonSDK } from 'lib';

export const CopyButton = (props: Partial<CopyButtonSDKPropsType>) => {
return <CopyButtonSDK {...props} />;
Expand Down
8 changes: 5 additions & 3 deletions src/components/ExplorerLink/ExplorerLink.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { PropsWithChildren } from 'react';
import { ExplorerLinkSDK } from 'components/sdkDappCoreUI';
import {
ExplorerLinkSDK,
useGetNetworkConfig,
ExplorerLinkSDKPropsType
} from 'lib';
import { WithClassnameType } from 'types';
import { ExplorerLinkSDKPropsType } from 'types/sdkDappCoreUI.types';
import { useGetNetworkConfig } from 'utils/sdkDappCore';

export interface ExplorerLinkPropsType
extends Partial<ExplorerLinkSDKPropsType>,
Expand Down
10 changes: 7 additions & 3 deletions src/components/FormatAmount/FormatAmount.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { FormatAmountSDK } from 'components/sdkDappCoreUI';
import { WithClassnameType } from 'types';
import { FormatAmountController, useGetNetworkConfig } from 'utils/sdkDappCore';
import { DECIMALS, DIGITS } from 'utils/sdkDappUtils';
import {
FormatAmountController,
useGetNetworkConfig,
FormatAmountSDK,
DECIMALS,
DIGITS
} from 'lib';

interface FormatAmountPropsType extends WithClassnameType {
egldLabel?: string;
Expand Down
5 changes: 2 additions & 3 deletions src/components/Layout/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { useMatch, useNavigate } from 'react-router-dom';
import { Button } from 'components/Button';
import { MxLink } from 'components/MxLink';
import { Button, MxLink } from 'components';
import { environment } from 'config';
import { getAccountProvider, useGetIsLoggedIn } from 'lib';
import { RouteNamesEnum } from 'localConstants';
import { getAccountProvider, useGetIsLoggedIn } from 'utils/sdkDappCore';
import MultiversXLogo from '../../../assets/img/multiversx-logo.svg?react';

export const Header = () => {
Expand Down
9 changes: 6 additions & 3 deletions src/components/Layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import type { PropsWithChildren } from 'react';
import { AuthRedirectWrapper } from 'wrappers';
import { Footer } from './Footer';
import { Header } from './Header';

export const Layout = ({ children }: PropsWithChildren) => {
return (
<div className='flex min-h-screen flex-col bg-slate-200'>
<Header />
<main className='flex flex-grow items-stretch justify-center p-6'>
{children}
</main>
<AuthRedirectWrapper>
<main className='flex flex-grow items-stretch justify-center p-6'>
{children}
</main>
</AuthRedirectWrapper>
<Footer />
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/OutputContainer/OutputContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { PropsWithChildren } from 'react';
import classNames from 'classnames';
import { Loader } from 'components/Loader';
import { Loader } from 'components';
import { WithClassnameType } from 'types';

interface OutputContainerPropsType
Expand Down
5 changes: 2 additions & 3 deletions src/components/OutputContainer/components/PingPongOutput.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ContractAddress } from 'components/ContractAddress';
import { Label } from 'components/Label';
import { SignedTransactionType } from 'types/sdkDappCore.types';
import { ContractAddress, Label } from 'components';
import { SignedTransactionType } from 'lib';
import { TransactionsOutput } from './TransactionsOutput';

type PingPongOutputType = {
Expand Down
15 changes: 6 additions & 9 deletions src/components/OutputContainer/components/TransactionOutput.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import React from 'react';
import { Label } from 'components/Label';
import { DataTestIdsEnum } from 'localConstants';
import { SignedTransactionType } from 'types/sdkDappCore.types';
import { Label, ExplorerLink, FormatAmount } from 'components';
import {
ACCOUNTS_ENDPOINT,
TRANSACTIONS_ENDPOINT,
useGetNetworkConfig
} from 'utils/sdkDappCore';
import { ExplorerLink } from '../../ExplorerLink';
import { FormatAmount } from '../../FormatAmount';
useGetNetworkConfig,
ACCOUNTS_ENDPOINT,
SignedTransactionType
} from 'lib';
import { DataTestIdsEnum } from 'localConstants';

export const TransactionOutput = ({
transaction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SignedTransactionType } from 'types/sdkDappCore.types';
import { SignedTransactionType } from 'lib';
import { TransactionOutput } from './TransactionOutput';

export const TransactionsOutput = ({
Expand Down
8 changes: 4 additions & 4 deletions src/components/TransactionsTable/TransactionsTable.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { useState, useEffect } from 'react';
import { TransactionsTableSDK } from 'components/sdkDappCoreUI';
import { ServerTransactionType } from 'types/sdkDappCore.types';
import { ITransactionsTableRow } from 'types/sdkDappCoreUI.types';
import {
TransactionsTableSDK,
ServerTransactionType,
ITransactionsTableRow,
useGetAccount,
useGetNetworkConfig,
TransactionsTableController
} from 'utils/sdkDappCore';
} from 'lib';

interface TransactionsTablePropsType {
transactions?: ServerTransactionType[];
Expand Down
5 changes: 5 additions & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
export * from './Layout';
export * from './Card';
export * from './MxLink';
export * from './Button';
export * from './Card';
export * from './ContractAddress';
export * from './ExplorerLink';
export * from './CopyButton';
export * from './FormatAmount';
export * from './Label';
export * from './Loader';
export * from './Layout';
export * from './MissingNativeAuthError';
export * from './MxLink';
Expand Down
2 changes: 1 addition & 1 deletion src/config/config.devnet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EnvironmentsEnum } from 'types/sdkDappCore.types';
import { EnvironmentsEnum } from 'lib';

export * from './sharedConfig';

Expand Down
2 changes: 1 addition & 1 deletion src/config/config.mainnet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EnvironmentsEnum } from 'types/sdkDappCore.types';
import { EnvironmentsEnum } from 'lib';

export * from './sharedConfig';

Expand Down
2 changes: 1 addition & 1 deletion src/config/config.testnet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EnvironmentsEnum } from 'types/sdkDappCore.types';
import { EnvironmentsEnum } from 'lib';

export * from './sharedConfig';

Expand Down
9 changes: 6 additions & 3 deletions src/helpers/signAndSendTransactions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { Transaction } from 'types/sdkCore.types';
import { TransactionsDisplayInfoType } from 'types/sdkDappCore.types';
import { getAccountProvider, TransactionManager } from 'utils/sdkDappCore';
import {
getAccountProvider,
Transaction,
TransactionManager,
TransactionsDisplayInfoType
} from 'lib';

type SignAndSendTransactionsProps = {
transactions: Transaction[];
Expand Down
12 changes: 7 additions & 5 deletions src/hooks/transactions/useSendPingPongTransaction.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { contractAddress } from 'config';
import { signAndSendTransactions } from 'helpers';
import { Address, Transaction, TransactionPayload } from 'utils/sdkCore';
import {
Address,
Transaction,
TransactionPayload,
GAS_LIMIT,
GAS_PRICE,
useGetAccount,
useGetNetworkConfig
} from 'utils/sdkDappCore';
import { smartContract } from 'utils/smartContract';
useGetNetworkConfig,
useGetAccount
} from 'lib';
import { smartContract } from 'utils';

const PING_TRANSACTION_INFO = {
processingMessage: 'Processing Ping transaction',
Expand Down
3 changes: 1 addition & 2 deletions src/hooks/useIsWebProvider.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ProviderTypeEnum } from 'types/sdkDappCore.types';
import { getAccountProvider } from 'utils/sdkDappCore';
import { getAccountProvider, ProviderTypeEnum } from 'lib';

export const useIsWebProvider = () => {
const provider = getAccountProvider();
Expand Down
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import './styles/globals.css';

import React from 'react';
import ReactDOM from 'react-dom/client';
import { initApp } from 'utils/sdkDappCore';
import { initApp } from 'lib';
import { App } from './App';
import { config } from './initConfig';

Expand Down
2 changes: 1 addition & 1 deletion src/initConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
ICustomProvider,
InitAppType,
ProviderTypeEnum
} from './types/sdkDappCore.types';
} from './lib';

const ADDITIONAL_PROVIDERS = {
inMemoryProvider: 'inMemoryProvider'
Expand Down
4 changes: 4 additions & 0 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './sdkDapp';
export * from './sdkCore';
export * from './sdkDappUtils';
export * from './sdkDappCoreUI';
2 changes: 2 additions & 0 deletions src/lib/sdkCore/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './sdkCore.members';
export * from './sdkCore.types';
File renamed without changes.
1 change: 1 addition & 0 deletions src/lib/sdkCore/sdkCore.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type { IPlainTransactionObject } from '@multiversx/sdk-core';
2 changes: 2 additions & 0 deletions src/lib/sdkDapp/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './sdkDappCore';
export * from './sdkDappCore.types';
8 changes: 8 additions & 0 deletions src/lib/sdkDapp/sdkDapp.constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export { TRANSACTIONS_ENDPOINT } from '@multiversx/sdk-dapp/apiCalls/endpoints';
export {
DECIMALS,
GAS_PRICE,
GAS_LIMIT,
EXTRA_GAS_LIMIT_GUARDED_TX,
VERSION
} from '@multiversx/sdk-dapp/constants';
22 changes: 22 additions & 0 deletions src/lib/sdkDapp/sdkDapp.helpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export { addressIsValid } from '@multiversx/sdk-dapp/utils/account/addressIsValid';
export { getInterpretedTransaction } from '@multiversx/sdk-dapp/utils/transactions/getInterpretedTransaction';
export { formatAmount } from '@multiversx/sdk-dapp/utils/operations/formatAmount';
export { getIsProviderEqualTo } from '@multiversx/sdk-dapp/utils/account/getIsProviderEqualTo';
export { refreshAccount } from '@multiversx/sdk-dapp/utils/account/refreshAccount';
export {
deleteTransactionToast,
removeAllSignedTransactions,
removeAllTransactionsToSign
} from '@multiversx/sdk-dapp/services/transactions/clearTransactions';
export {
setTransactionsDisplayInfoState,
setTransactionsToSignedState
} from '@multiversx/sdk-dapp/services/transactions/updateSignedTransactions';
export { verifyMessage } from '@multiversx/sdk-dapp/hooks/signMessage/verifyMessage';
export { sendBatchTransactions } from '@multiversx/sdk-dapp/services/transactions/sendBatchTransactions';
export { getTransactions } from '@multiversx/sdk-dapp/apiCalls/transactions/getTransactions';
export { sendTransactions } from '@multiversx/sdk-dapp/services/transactions/sendTransactions';
export { logout } from '@multiversx/sdk-dapp/utils/logout';
export { signTransactions } from '@multiversx/sdk-dapp/services/transactions/signTransactions';
export { trimUsernameDomain } from '@multiversx/sdk-dapp/hooks/account/helpers';
export { newTransaction } from '@multiversx/sdk-dapp/models';
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions src/lib/sdkDappCoreUI/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './sdkDappCoreUI.types';
export * from './sdkDappCoreUI.components';
2 changes: 2 additions & 0 deletions src/lib/sdkDappUtils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './sdkDappUtils';
export * from './sdkDappUtils.types';
File renamed without changes.
13 changes: 5 additions & 8 deletions src/pages/Dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { contractAddress } from 'config';
import { useScrollToElement } from 'hooks';
import { WidgetType } from 'types/widget.types';
import { AuthRedirectWrapper } from 'wrappers';
import { Widget } from './components';
import {
Account,
Expand Down Expand Up @@ -78,12 +77,10 @@ export const Dashboard = () => {
useScrollToElement();

return (
<AuthRedirectWrapper>
<div className='flex flex-col gap-6 max-w-3xl w-full'>
{WIDGETS.map((element) => (
<Widget key={element.title} {...element} />
))}
</div>
</AuthRedirectWrapper>
<div className='flex flex-col gap-6 max-w-3xl w-full'>
{WIDGETS.map((element) => (
<Widget key={element.title} {...element} />
))}
</div>
);
};
2 changes: 1 addition & 1 deletion src/pages/Dashboard/components/Widget.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Card } from 'components/Card';
import { Card } from 'components';
import { useIsWebProvider } from 'hooks';
import { WidgetType } from 'types/widget.types';
import { getCallbackRoute } from 'utils/getCallbackRoute';
Expand Down
5 changes: 2 additions & 3 deletions src/pages/Dashboard/widgets/Account/Account.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { OutputContainer, FormatAmount } from 'components';
import { Label } from 'components/Label';
import { OutputContainer, FormatAmount, Label } from 'components';
import { useGetAccount, useGetNetworkConfig } from 'lib';
import { DataTestIdsEnum } from 'localConstants';
import { useGetAccount, useGetNetworkConfig } from 'utils/sdkDappCore';
import { Username } from './components';

export const Account = () => {
Expand Down
5 changes: 2 additions & 3 deletions src/pages/Dashboard/widgets/Account/components/Username.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Label } from 'components/Label';
import { Label } from 'components';
import { trimUsernameDomain, AccountType } from 'lib';
import { DataTestIdsEnum } from 'localConstants';
import { ProfileType } from 'types';
import { AccountType } from 'types/sdkDappCore.types';
import { trimUsernameDomain } from 'utils/sdkDappCore';

export const Username = (props: {
account: AccountType | ProfileType | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import {
faArrowsRotate
} from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Button } from 'components/Button';
import { TransactionsOutput } from 'components/OutputContainer/components';
import { OutputContainer } from 'components/OutputContainer/OutputContainer';
import { OutputContainer, TransactionsOutput, Button } from 'components';
import {
useGetAccount,
useGetNetworkConfig,
useGetPendingTransactions
} from 'utils/sdkDappCore';
useGetPendingTransactions,
useGetAccount
} from 'lib';

import {
signAndAutoSendBatchTransactions,
sendBatchTransactions,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { TransactionProps } from 'types/transaction.types';
import { Transaction, TransactionPayload, TokenTransfer } from 'utils/sdkCore';
import {
GAS_LIMIT,
GAS_PRICE,
EXTRA_GAS_LIMIT_GUARDED_TX
} from 'utils/sdkDappCore';
import { DECIMALS } from 'utils/sdkDappUtils';
DECIMALS,
EXTRA_GAS_LIMIT_GUARDED_TX,
Transaction,
TransactionPayload,
TokenTransfer
} from 'lib';
import { TransactionProps } from 'types';
const NUMBER_OF_TRANSACTIONS = 5;

export const getBatchTransactions = ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { BATCH_TRANSACTIONS_SC } from 'config';
import { Transaction, TransactionPayload } from 'types/sdkCore.types';
import { Transaction, TransactionPayload, GAS_PRICE, VERSION } from 'lib';
import { TransactionProps } from 'types/transaction.types';
import { GAS_PRICE, VERSION } from 'utils/sdkDappCore';

export const getSwapAndLockTransactions = ({
address,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TransactionProps } from 'types/transaction.types';
import { getAccountProvider, TransactionManager } from 'utils/sdkDappCore';
import { getAccountProvider, TransactionManager } from 'lib';
import { TransactionProps } from 'types';
import { getBatchTransactions } from './getBatchTransactions';

export const sendBatchTransactions = async ({
Expand Down
Loading