Skip to content

Commit 46260a1

Browse files
arhtudormorarrazvantomegeaDanutIlieMiroMargineanumgavrila
authored
Upgrade to 📦 sdk-dapp v.5 (#343)
* Sdk-dapp-core migration (#264) * Migrate * Login and sign message * Ping transactions * Removed ping pong abi and service * Batch transactions * Transactons * Added transaction interpretation helpers * Added transaction interpretation UI and helpers * Added transaction interpretation UI and helpers * fix build * Fix build * Refactor * Added reactive store subscription * Fix * Update versions * Improve useStore * Local working * Work on reactivity * Removed logs * Track transactions * Use selector from sdk-dapp-core * Remove unused * Fix rerenders * Remove unused * Remove dependecy * Added formatAmount * Integrate hooks * Upgrade sdk-dapp-core * remove selector * Remove unused * Bring back useSendBatchTransaction * Restore features * Added FormatAmount.tsx * Added FormatAmount.tsx * Remove unused hooks * Custom provider implementation (#272) * Create inmemoryprovider * Improve-in-memory-provider (#274) * Refactor model * Remove unnecessary persistence * Update packages * add toast lifetime (#275) * Added transactions table from sdk-dapp-core/ui (#273) * Added transactions table * Added transactions table * use react output (#279) * Transactions table (#278) * Added transactions table * Added transactions table * Updated TransactionsTable.tsx * Removed unused components * Log * Fixed build and added missing UI elements (#280) * Fixed build and lint issues * Fix * Fixed lint and build * Merged development * Fixed build * Added sdk-core back * Fixed import * Remove unnecessary refresh account (#283) * Refactor * Renamed props type * Refactor * Refactor and comments (#284) * Refactor and comments * Revert * Added back batch transactions functions (#286) * Fix import * Added back batch transactions functions * Fix * Fix * Refactor imports * Conflicts * Revert * Refactor explorerlink * Fixed build and added AuthenticatedRoutesWrapper * Revert AuthenticatedRouteWrapper * Fixed build * Tm/feature/sdk-dapp-core/merge-1 (#291) * Updated Button prop (#289) * Remove AuthenticatedRoutesWrapper dependency (#290) * Fix header imports * Minor change * Minor change * FIx imports * Upgrade imports * Major refactor lib * Fix changes * Fix types * Refactor lib (#292) Refactor imports * Unite imports --------- Co-authored-by: Razvan Tomegea <razvantomegea@users.noreply.github.com> * Fix sort imports * Fixed sort exports * Revert import type * Move components * lint * Added PageNotFound * Move components (#298) * Move components * lint * Updates * Updated SignSuccess * Minor refactor * Minor changes * Tm/feature/sdk dapp core/refactor 2 (#309) * Minor refactor * Minor changes * Minor refactor * Refactor * Fix errors * Revert * Revert * Some updates * Some updates (#313) * Implement changes * Added missing code * Remove immer (#316) * Latest versions * added sdk-dapp-core-ui to optimizeDeps * Added axios interceptors (#318) * Work on migration guide * Added unlock panel (#321) * Added unlock panel * resolve comments * close panel after login * Migration guide * Refactor * extract connect logic (#322) * extract connect logic * fix imports * remove sdk from name * Hide UnlockButton * resolve comments * fix login --------- Co-authored-by: Tudor Morar <tudor.morar@multiversx.com> * Fix login modal * Added wallet connect config * Update ui * Added notifications feed side panel (#327) * Added notifications feed button * Refactor * Increase versions * Migrated to sdk-core 14 * fix sdk-dapp-core-ui bundle config (#328) * Fixed build * Resolve conflict with core-ui tailwind v4 (#330) * Fixed build * Updated core ui components prefix * Sdk core v14 (#333) * Upgrade sdk-core to v.14 and sdk-dapp to v.4 * Revert * Revert * Use parseAmount * Remove unused formatAmount * Sign message error * Fied sign success * Fixed sign transactions via URL * Fixed start --------- Co-authored-by: Tudor Morar <tudor.morar@multiversx.com> * Update sdk-core-ui to LTS * Move unlock logic to manager (#335) * move unlock panel logic to manager * clean up connect button * change naming * update login * fix custom provider * change in memory provider iconUrl * Added sidepanel login for inMemoryProvider (#336) * Added sidepanel login for inMemoryProvider * Remove log * Upgrade sdk-dapp-core * Update versions * Upgrade packages * Change to EGLD tx instead of WEGLD * Add multi transfer tx * update sdk-dapp-packages (#338) * Update transactions (#339) * Update transactions * Updates * Remove from ignore * Update transaction for service * Upgrade sdk-core to v.14 and sdk-dapp to v.4 (#331) * Upgrade sdk-core to v.14 and sdk-dapp to v.4 * Revert * Update sdk to 5x * Add sdk-ui 0x * Update pingPong * Update time to pong * Update transactions * Remove duplicate file * Fix time * Remove log * Fix type --------- Co-authored-by: Tudor Morar <tudor.morar@multiversx.com> Co-authored-by: DanutIlie <42973343+DanutIlie@users.noreply.github.com> Co-authored-by: Danut <daniel.ilie1997@gmail.com> Co-authored-by: Miro <miro.margineanu@multiversx.com> Co-authored-by: Gavrila Andrei <andrei.gavrila@multiversx.com> * Update imports (#341) * Update imports * Update yarn.lock * Add unlock and logout route (#340) * Add unlock and logout route * Update Home.tsx * Update routes.ts * Remove token from requests (#346) * Remove token from requests * Remove log * Remove log * Merge changes * Updates and renamings * Remove unused exports * Cleanup exports * Remove unused --------- Co-authored-by: Tudor Morar <tudor.morar@multiversx.com> * Update routeNames.enums.ts * Minor renamings (#347) * Migration guide update (#349) * Remove unlock from routes * Update Migration guide * Update Migration guide * Update MIGRATION_GUIDE.md * Update packages * Fixed types (#350) * Minor updates * Refactor types * Remove log * Update packages * Update useGetTimeToPong.ts * Fix inMemoryProvider signature (#351) * Test callbacks * Simplify initApp * Upgrade sdk-dapp * Remove unused * Remove unused * Upgraded packages. (#354) Updated packages to the last version: sdk-core: 14.2.3, sdk-dapp: 5.0.0-alpha.14, sdk-dapp-ui: 0.0.8, sdk-dapp-utils: 2.0.2 * Upgrade migration guide * Remove unused * Upgrade packages * Updates on components (#356) * Updates on components * Updated to use getExplorerLink * Updated package * Moved getExplorerLink import to lib * Update yarn lock --------- Co-authored-by: Razvan Tomegea <razvantomegea@users.noreply.github.com> Co-authored-by: DanutIlie <42973343+DanutIlie@users.noreply.github.com> Co-authored-by: Danut <daniel.ilie1997@gmail.com> Co-authored-by: Miro <miro.margineanu@multiversx.com> Co-authored-by: Gavrila Andrei <andrei.gavrila@multiversx.com> Co-authored-by: Iulia Cimpeanu <72752718+iuliacimpeanu@users.noreply.github.com>
1 parent 8d8c487 commit 46260a1

File tree

98 files changed

+2361
-1974
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+2361
-1974
lines changed

MIGRATION_GUIDE.md

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
# @multiversx/template-dapp
2+
3+
Migrating your application to `sdk-dapp@5.x` will probably require more code removal than insertion. Of course, each application is different, so this guide will have a generic character, pointing out the main areas where you might need to change your code.
4+
The main areas that might need code restructuring are:
5+
6+
- package.json library dependencies
7+
- index.tsx file where the app bootstraps
8+
- App.tsx, the main file of your application
9+
- logging in and out
10+
- sending and signing transactions
11+
- component imports related to displaying data
12+
- types
13+
14+
A typical migration can be seen in this [pull request](https://github.com/multiversx/mx-template-dapp/pull/343).
15+
16+
Next, we will make a brief overview of the main changes required.
17+
18+
## 1. Changes in [`package.json`](https://github.com/multiversx/mx-template-dapp/pull/343/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519)
19+
20+
#### Dependencies
21+
22+
23+
- Updated:
24+
- `@multiversx/sdk-dapp` (version `^5.x`)
25+
- `@multiversx/sdk-dapp-utils` (version `2.0.0`)
26+
- Added:
27+
- `@multiversx/sdk-dapp-ui` (version `^0.x`)
28+
29+
## 2. Changes in [`index.tsx`](https://github.com/multiversx/mx-template-dapp/blob/a98cadfc291321e9874acd7e53632a6b43ca8c59/src/index.tsx)
30+
31+
You will need to wrap your application in a call to `initApp`:
32+
33+
```tsx
34+
initApp(config).then(() => {
35+
ReactDOM.createRoot(document.getElementById('root')!).render(
36+
<React.StrictMode>
37+
<App />
38+
</React.StrictMode>
39+
);
40+
});
41+
```
42+
43+
## 2. Summary of Changes in [`App.tsx`](https://github.com/multiversx/mx-template-dapp/blob/a98cadfc291321e9874acd7e53632a6b43ca8c59/src/App.tsx)
44+
45+
- AxiosInterceptorContext is now created as a local component
46+
- DappProvider was removed ❌ and initialization is now made in initApp
47+
- NotificationModal, SignTransactionsModals and TransactionsToastList are removed ❌ and functionality is handled under the hood
48+
- Unlock page is a child route since it only diplays a side panel over an existing route (in our case Home `/`)
49+
50+
## 3. Logging in and out
51+
52+
### 3.1 [Logging in](https://github.com/multiversx/mx-template-dapp/blob/a98cadfc291321e9874acd7e53632a6b43ca8c59/src/pages/Unlock/Unlock.tsx)
53+
54+
Login buttons have been removed ❌ and there is a universal Unlock side panel, which can be inserted in the DOM at a desired location.
55+
56+
> NOTE: Web-wallet URL login is no longer supported
57+
58+
Example of how to use the `UnlockPanelManager` in the `unlock` route is shown below. Of course the `openUnlockPanel()` method can also be linked to a button.
59+
60+
```tsx
61+
import { useEffect } from 'react';
62+
import { useNavigate } from 'react-router-dom';
63+
import { UnlockPanelManager, useGetLoginInfo } from 'lib';
64+
import { RouteNamesEnum } from 'localConstants';
65+
66+
export const Unlock = () => {
67+
const navigate = useNavigate();
68+
const { isLoggedIn } = useGetLoginInfo();
69+
70+
const unlockPanelManager = UnlockPanelManager.init({
71+
loginHandler: () => {
72+
navigate(RouteNamesEnum.dashboard);
73+
},
74+
onClose: () => {
75+
navigate(RouteNamesEnum.home);
76+
}
77+
});
78+
79+
const handleOpenUnlockPanel = () => {
80+
unlockPanelManager.openUnlockPanel();
81+
};
82+
83+
useEffect(() => {
84+
if (isLoggedIn) {
85+
navigate(RouteNamesEnum.dashboard);
86+
return;
87+
}
88+
89+
handleOpenUnlockPanel();
90+
}, [isLoggedIn]);
91+
92+
return null;
93+
};
94+
```
95+
96+
- isAccountLoading has been deprecated
97+
- `import { getIsProviderEqualTo } from “@multiversx/sdk-dapp/utils/account/getIsProviderEqualTo”` --> removed ❌
98+
99+
### 3.2 [Logging out](https://github.com/multiversx/mx-template-dapp/blob/a98cadfc291321e9874acd7e53632a6b43ca8c59/src/components/Layout/Header/Header.tsx#L14)
100+
101+
In order to perform a logut action you simply need to get the current signing provider and call the `logout()` method:
102+
103+
```typescript
104+
import { getAccountProvider } from '@multiversx/sdk-dapp/out/providers/helpers/accountProvider';
105+
const provider = getAccountProvider();
106+
await provider.logout();
107+
```
108+
109+
## 4. [Sending transactions](https://github.com/multiversx/mx-template-dapp/blob/a98cadfc291321e9874acd7e53632a6b43ca8c59/src/helpers/signAndSendTransactions.ts)
110+
111+
- `sendTransactions` and `useSendBatchTransactions` have been replaced by `provider.signTransactions`, `txManager.send` and `txManager.track`
112+
- `newTransaction` function has been removed ❌ and you need to create `Transaction` objects directly
113+
114+
## 5. [Tracking transactions](https://github.com/multiversx/mx-template-dapp/blob/423e782fec5e04b6a35b6297eaf253eb8d7ca1ba/src/helpers/signAndSendTransactions.ts#L22)
115+
116+
Tracking transactions is now handled using the `txManager.track` method. You should use this method to monitor the status and outcome of your transactions after sending them. Refer to the linked file for implementation details and examples.
117+
118+
```typescript
119+
const txManager = TransactionManager.getInstance();
120+
121+
const sentTransactions = await txManager.send(signedTransactions);
122+
const sessionId = await txManager.track(sentTransactions, {
123+
transactionsDisplayInfo
124+
});
125+
```
126+
127+
- [onFail](https://github.com/multiversx/mx-sdk-dapp/blob/0d7d9627ceccda56982a73c8ac00ed0558f0e2ec/src/hooks/transactions/useTrackTransactionStatus.ts#L34) and [onSuccess](https://github.com/multiversx/mx-sdk-dapp/blob/0d7d9627ceccda56982a73c8ac00ed0558f0e2ec/src/hooks/transactions/batch/tracker/useVerifyBatchStatus.ts#L11) callbacks can now be configured in [initApp config](https://github.com/multiversx/mx-sdk-dapp/blob/1518a070f10ef0dc133e756c07b6fc0f2165bddb/src/methods/initApp/initApp.types.ts#L42) or with [TransactionManager.setCallbacks](https://github.com/multiversx/mx-sdk-dapp/blob/1518a070f10ef0dc133e756c07b6fc0f2165bddb/src/managers/TransactionManager/TransactionManager.ts#L45)
128+
129+
## 6. [UI components are now imported from sdk-dapp-core-ui](https://github.com/multiversx/mx-template-dapp/blob/a98cadfc291321e9874acd7e53632a6b43ca8c59/src/lib/sdkDappUI/sdkDappUI.components.ts)
130+
131+
- [CopyButton.tsx](https://github.com/multiversx/mx-template-dapp/blob/a98cadfc291321e9874acd7e53632a6b43ca8c59/src/lib/sdkDapp/components/CopyButton/CopyButton.tsx)
132+
- [ExplorerLink.tsx](https://github.com/multiversx/mx-template-dapp/blob/a98cadfc291321e9874acd7e53632a6b43ca8c59/src/lib/sdkDapp/components/ExplorerLink/ExplorerLink.tsx)
133+
- [FormatAmount.tsx](https://github.com/multiversx/mx-template-dapp/blob/a98cadfc291321e9874acd7e53632a6b43ca8c59/src/lib/sdkDapp/components/FormatAmount/FormatAmount.tsx)
134+
135+
Some UI components were removed:
136+
137+
- [AxiosInteceptor](https://github.com/multiversx/mx-sdk-dapp/blob/old-main/src/wrappers/AxiosInterceptorContext/AxiosInterceptorContext.tsx) ❌ no longer needed because signed token can be accessed via store directly
138+
- [IdleTimer](https://github.com/multiversx/mx-sdk-dapp/blob/old-main/src/web/hooks/useIdleTimer.tsx) ❌ must be implemented locally if needed
139+
- [TransactionsToastList](https://github.com/multiversx/mx-sdk-dapp/blob/old-main/src/UI/TransactionsToastList/TransactionsToastList.tsx) - removed ❌
140+
- [SignTransactionsModals](https://github.com/multiversx/mx-sdk-dapp/blob/old-main/src/UI/SignTransactionsModals/SignTransactionsModals.tsx) - removed ❌
141+
- [NotificationModal](https://github.com/multiversx/mx-sdk-dapp/blob/old-main/src/UI/NotificationModal/NotificationModal.tsx) - removed ❌
142+
143+
Some new UI elements have been added:
144+
145+
- [UnlockPanel](https://github.com/multiversx/mx-template-dapp/blob/a98cadfc291321e9874acd7e53632a6b43ca8c59/src/pages/Unlock/Unlock.tsx#L10) replaces [login buttons](https://github.com/multiversx/mx-sdk-dapp/blob/old-main/src/UI/walletConnect/WalletConnectLoginButton/WalletConnectLoginButton.tsx)
146+
- [NotificationsFeed](https://github.com/multiversx/mx-template-dapp/blob/a98cadfc291321e9874acd7e53632a6b43ca8c59/src/components/Layout/Header/components/NotificationsButton.tsx)
147+
148+
## 7. Methods
149+
150+
- `import { deleteCustomToast } from “@multiversx/sdk-dapp/utils/toasts/customToastsActions”` --> `import { removeCustomToast } from “@multiversx/sdk-dapp/out/store/actions/toasts/toastsActions”`
151+
- `export { setNonce } from “@multiversx/sdk-dapp/out/utils/account”;` --> `export { setAccountNonce as setNonce } from “@multiversx/sdk-dapp/out/store/actions”`
152+
- `export { getAccount } from “@multiversx/sdk-dapp/out/utils/account”;` --> `export { getAccountFromApi as getAccount } from “@multiversx/sdk-dapp/out/apiCalls/account/getAccountFromApi”;`
153+
- `export {
154+
setTransactionsToSignedState,
155+
setTransactionsDisplayInfoState,
156+
} from “@multiversx/sdk-dapp/services/transactions/updateSignedTransactions”;` have been removed ❌
157+
- `export { deleteTransactionToast } from “@multiversx/sdk-dapp/services/transactions/clearTransactions”;` --> `export { removeTransactionToast as deleteTransactionToast } from “@multiversx/sdk-dapp/out/store/actions/toasts/toastsActions”;`
158+
- `export {
159+
addressIsValid,
160+
} from “@multiversx/sdk-dapp/out/utils/account”;` --> `export { addressIsValid } from “@multiversx/sdk-dapp/out/utils/validation/addressIsValid”;`
161+
- `export { getShardOfAddress } from “@multiversx/sdk-dapp/out/utils/account”;` -->
162+
`import { AddressComputer } from “@multiversx/sdk-core/out”;
163+
const addressComputer = new AddressComputer();
164+
const getShardOfAddress = addressComputer.getShardOfAddress;
165+
export { getShardOfAddress };`
166+
- `walletConnectDeepLink` isn now set in [initApp](https://github.com/multiversx/mx-sdk-dapp/blob/1518a070f10ef0dc133e756c07b6fc0f2165bddb/src/methods/initApp/initApp.types.ts#L23C21-L23C40)
167+
168+
169+
## 7. [Types](https://github.com/multiversx/mx-template-dapp/blob/a98cadfc291321e9874acd7e53632a6b43ca8c59/src/lib/sdkDapp/sdkDapp.types.ts)
170+
171+
- `LoginMethodsEnum` is replaced by `ProviderTypeEnum`
172+
- `RawTransactionType` was removed ❌
173+
- some new types were added, related to UI elements, like [MvxCopyButtonPropsType](https://github.com/multiversx/mx-template-dapp/blob/a98cadfc291321e9874acd7e53632a6b43ca8c59/src/lib/sdkDapp/components/CopyButton/CopyButton.tsx#L2)

package.json

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
"@fortawesome/fontawesome-svg-core": "6.5.1",
1010
"@fortawesome/free-solid-svg-icons": "6.5.1",
1111
"@fortawesome/react-fontawesome": "0.2.0",
12-
"@multiversx/sdk-core": "^14.x",
13-
"@multiversx/sdk-dapp": "^4.x",
14-
"axios": "1.7.4",
12+
"@multiversx/sdk-core": "14.2.6",
13+
"@multiversx/sdk-dapp": "^5.x",
14+
"@multiversx/sdk-dapp-ui": "^0.x",
15+
"@multiversx/sdk-dapp-utils": "2.0.2",
16+
"axios": "1.10.0",
1517
"classnames": "2.3.2",
1618
"moment": "2.29.4",
1719
"react": "18.2.0",
@@ -21,12 +23,12 @@
2123
"scripts": {
2224
"lint": "eslint --ext js,ts,tsx src --fix",
2325
"run-cypress": "npx cypress run",
24-
"start:devnet": "yarn run copy:devnet-config & vite dev",
25-
"start:testnet": "yarn run copy:testnet-config & vite dev",
26-
"start:mainnet": "yarn run copy:mainnet-config & vite dev",
27-
"build:devnet": "yarn run copy:devnet-config & vite build",
28-
"build:testnet": "yarn run copy:testnet-config & vite build",
29-
"build:mainnet": "yarn run copy:mainnet-config & vite build",
26+
"start:devnet": "yarn run copy:devnet-config && vite dev",
27+
"start:testnet": "yarn run copy:testnet-config && vite dev",
28+
"start:mainnet": "yarn run copy:mainnet-config && vite dev",
29+
"build:devnet": "tsc & yarn run copy:devnet-config && vite build",
30+
"build:testnet": "tsc & yarn run copy:testnet-config && vite build",
31+
"build:mainnet": "tsc & yarn run copy:mainnet-config && vite build",
3032
"copy:devnet-config": "cp ./src/config/config.devnet.ts ./src/config/index.ts",
3133
"copy:testnet-config": "cp ./src/config/config.testnet.ts ./src/config/index.ts",
3234
"copy:mainnet-config": "cp ./src/config/config.mainnet.ts ./src/config/index.ts",
@@ -49,13 +51,12 @@
4951
"@types/jest": "29.5.5",
5052
"@types/node": "20.7.1",
5153
"@types/react": "18.2.23",
52-
"@types/react-dom": "18.2.8",
5354
"@types/react-router-dom": "5.3.3",
5455
"@typescript-eslint/eslint-plugin": "6.7.0",
5556
"@typescript-eslint/parser": "6.7.0",
56-
"@vitejs/plugin-basic-ssl": "^1.0.1",
57+
"@vitejs/plugin-basic-ssl": "1.0.1",
5758
"@vitejs/plugin-react": "4.1.0",
58-
"@wdio/cli": "^8.33.1",
59+
"@wdio/cli": "8.33.1",
5960
"@wdio/concise-reporter": "8.32.4",
6061
"@wdio/local-runner": "8.32.4",
6162
"@wdio/mocha-framework": "8.32.4",
@@ -68,7 +69,7 @@
6869
"eslint-plugin-prettier": "5.0.0",
6970
"eslint-plugin-react": "7.33.2",
7071
"eslint-plugin-react-hooks": "4.6.0",
71-
"eslint-plugin-sort-exports": "^0.9.1",
72+
"eslint-plugin-sort-exports": "0.9.1",
7273
"jest": "29.7.0",
7374
"jest-environment-jsdom": "29.7.0",
7475
"jest-watch-typeahead": "2.2.2",

src/App.tsx

Lines changed: 29 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,36 @@
11
import { Route, BrowserRouter as Router, Routes } from 'react-router-dom';
2-
import { Layout } from 'components';
3-
import {
4-
apiTimeout,
5-
environment,
6-
sampleAuthenticatedDomains,
7-
walletConnectV2ProjectId
8-
} from 'config';
9-
import {
10-
AxiosInterceptorContext, // using this is optional
11-
DappProvider,
12-
NotificationModal,
13-
SignTransactionsModals,
14-
TransactionsToastList
15-
// uncomment this to use the custom transaction tracker
16-
// TransactionsTracker
17-
} from 'lib';
18-
import { RouteNamesEnum } from 'localConstants';
19-
import { PageNotFound } from 'pages';
2+
import { PageNotFound } from 'pages/PageNotFound/PageNotFound';
203
import { routes } from 'routes';
21-
import { BatchTransactionsContextProvider } from 'wrappers';
22-
23-
const AppContent = () => {
24-
return (
25-
<DappProvider
26-
environment={environment}
27-
customNetworkConfig={{
28-
name: 'customConfig',
29-
apiTimeout,
30-
walletConnectV2ProjectId
31-
}}
32-
dappConfig={{
33-
shouldUseWebViewProvider: true,
34-
logoutRoute: RouteNamesEnum.unlock
35-
}}
36-
customComponents={{
37-
transactionTracker: {
38-
// uncomment this to use the custom transaction tracker
39-
// component: TransactionsTracker,
40-
props: {
41-
onSuccess: (sessionId: string) => {
42-
console.log(`Session ${sessionId} successfully completed`);
43-
},
44-
onFail: (sessionId: string, errorMessage: string) => {
45-
console.log(`Session ${sessionId} failed. ${errorMessage ?? ''}`);
46-
}
47-
}
48-
}
49-
}}
50-
>
51-
<AxiosInterceptorContext.Listener>
52-
<Layout>
53-
<TransactionsToastList />
54-
<NotificationModal />
55-
<SignTransactionsModals />
56-
<Routes>
57-
{routes.map((route) => (
58-
<Route
59-
path={route.path}
60-
key={`route-key-'${route.path}`}
61-
element={<route.component />}
62-
/>
63-
))}
64-
<Route path='*' element={<PageNotFound />} />
65-
</Routes>
66-
</Layout>
67-
</AxiosInterceptorContext.Listener>
68-
</DappProvider>
69-
);
70-
};
4+
import { AxiosInterceptors, BatchTransactionsContextProvider } from 'wrappers';
5+
import { Layout } from './components';
716

727
export const App = () => {
738
return (
74-
<AxiosInterceptorContext.Provider>
75-
<AxiosInterceptorContext.Interceptor
76-
authenticatedDomains={sampleAuthenticatedDomains}
77-
>
78-
<Router>
79-
<BatchTransactionsContextProvider>
80-
<AppContent />
81-
</BatchTransactionsContextProvider>
82-
</Router>
83-
</AxiosInterceptorContext.Interceptor>
84-
</AxiosInterceptorContext.Provider>
9+
<Router>
10+
<AxiosInterceptors>
11+
<BatchTransactionsContextProvider>
12+
<Layout>
13+
<Routes>
14+
{routes.map((route) => (
15+
<Route
16+
key={`route-key-${route.path}`}
17+
path={route.path}
18+
element={<route.component />}
19+
>
20+
{route.children?.map((child) => (
21+
<Route
22+
key={`route-key-${route.path}-${child.path}`}
23+
path={child.path}
24+
element={<child.component />}
25+
/>
26+
))}
27+
</Route>
28+
))}
29+
<Route path='*' element={<PageNotFound />} />
30+
</Routes>
31+
</Layout>
32+
</BatchTransactionsContextProvider>
33+
</AxiosInterceptors>
34+
</Router>
8535
);
8636
};
Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
import { Label } from 'components';
22
import { contractAddress } from 'config';
3-
import { ACCOUNTS_ENDPOINT, ExplorerLink } from 'lib';
3+
import {
4+
ACCOUNTS_ENDPOINT,
5+
getExplorerLink,
6+
MvxExplorerLink,
7+
useGetNetworkConfig
8+
} from 'lib';
49

510
export const ContractAddress = () => {
11+
const { network } = useGetNetworkConfig();
12+
const explorerAddress = network.explorerAddress;
13+
const explorerLink = getExplorerLink({
14+
to: `/${ACCOUNTS_ENDPOINT}/${contractAddress}`,
15+
explorerAddress
16+
});
617
return (
718
<p>
819
<Label>Contract: </Label>
9-
<ExplorerLink
10-
page={`/${ACCOUNTS_ENDPOINT}/${contractAddress}`}
20+
<MvxExplorerLink
21+
link={explorerLink}
1122
className='border-b border-dotted border-gray-500 hover:border-solid hover:border-gray-800'
1223
>
1324
{contractAddress}
14-
</ExplorerLink>
25+
</MvxExplorerLink>
1526
</p>
1627
);
1728
};

0 commit comments

Comments
 (0)