From d0453a76b1a429580adafed5e6289bda10c49f8d Mon Sep 17 00:00:00 2001 From: Eugene Chybisov <18644653+chybisov@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:37:35 +0200 Subject: [PATCH] feat: add voluntary contribution component (#301) --- packages/wallet-management/package.json | 2 +- packages/widget-playground-next/package.json | 6 +- packages/widget-playground-vite/package.json | 2 +- packages/widget/package.json | 2 +- .../src/components/TransactionDetails.tsx | 5 +- .../TransactionPage/StatusBottomSheet.tsx | 5 + packages/widget/src/types/widget.ts | 6 + yarn.lock | 302 +++++++++--------- 8 files changed, 176 insertions(+), 154 deletions(-) diff --git a/packages/wallet-management/package.json b/packages/wallet-management/package.json index b765118bf..12da05ffd 100644 --- a/packages/wallet-management/package.json +++ b/packages/wallet-management/package.json @@ -49,7 +49,7 @@ "@lifi/sdk": "^3.2.3", "@solana/wallet-adapter-base": "^0.9.23", "react": "^18.3.1", - "viem": "^2.21.8", + "viem": "^2.21.9", "wagmi": "^2.12.12" }, "devDependencies": { diff --git a/packages/widget-playground-next/package.json b/packages/widget-playground-next/package.json index 7bc69c136..acdd1e09c 100644 --- a/packages/widget-playground-next/package.json +++ b/packages/widget-playground-next/package.json @@ -31,10 +31,10 @@ "core-js": "^3.38.1", "lodash.isequal": "^4.5.0", "microdiff": "^1.4.0", - "next": "14.2.11", + "next": "14.2.12", "react": "^18.3.1", "react-dom": "^18.3.1", - "viem": "^2.21.8", + "viem": "^2.21.9", "wagmi": "^2.12.12", "zustand": "^4.5.5" }, @@ -43,7 +43,7 @@ "@types/react": "^18.3.7", "@types/react-dom": "^18.3.0", "eslint": "^8.57.1", - "eslint-config-next": "14.2.11", + "eslint-config-next": "14.2.12", "typescript": "^5.6.2" }, "private": true diff --git a/packages/widget-playground-vite/package.json b/packages/widget-playground-vite/package.json index 7d89a2a78..f4bfed77f 100644 --- a/packages/widget-playground-vite/package.json +++ b/packages/widget-playground-vite/package.json @@ -34,7 +34,7 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^6.26.2", - "viem": "^2.21.8", + "viem": "^2.21.9", "wagmi": "^2.12.12", "zustand": "^4.5.5" }, diff --git a/packages/widget/package.json b/packages/widget/package.json index 442e2eb3f..aab08525a 100644 --- a/packages/widget/package.json +++ b/packages/widget/package.json @@ -69,7 +69,7 @@ "react-intersection-observer": "^9.13.1", "react-router-dom": "^6.26.2", "uuid": "^10.0.0", - "viem": "^2.21.8", + "viem": "^2.21.9", "wagmi": "^2.12.12", "zustand": "^4.5.5" }, diff --git a/packages/widget/src/components/TransactionDetails.tsx b/packages/widget/src/components/TransactionDetails.tsx index a39b1da59..38d5ec837 100644 --- a/packages/widget/src/components/TransactionDetails.tsx +++ b/packages/widget/src/components/TransactionDetails.tsx @@ -75,6 +75,9 @@ export const TransactionDetails: React.FC = ({ parseFloat(feeCollectionStep.action.fromToken.priceUSD); } + const showIntegratorFeeCollectionDetails = + feeAmountUSD || Number.isFinite(feeConfig?.fee); + return ( @@ -138,7 +141,7 @@ export const TransactionDetails: React.FC = ({ ) : null} - {feeAmountUSD ? ( + {showIntegratorFeeCollectionDetails ? ( {feeConfig?.name diff --git a/packages/widget/src/pages/TransactionPage/StatusBottomSheet.tsx b/packages/widget/src/pages/TransactionPage/StatusBottomSheet.tsx index f6c3d7707..023ce76ad 100644 --- a/packages/widget/src/pages/TransactionPage/StatusBottomSheet.tsx +++ b/packages/widget/src/pages/TransactionPage/StatusBottomSheet.tsx @@ -85,6 +85,7 @@ export const StatusBottomSheetContent: React.FC< subvariantOptions, contractSecondaryComponent, contractCompactComponent, + feeConfig, } = useWidgetConfig(); const { getChainById } = useAvailableChains(); @@ -251,6 +252,9 @@ export const StatusBottomSheetContent: React.FC< hasEnumFlag(status, RouteExecutionStatus.Done) && (contractCompactComponent || contractSecondaryComponent); + const VcComponent = + status === RouteExecutionStatus.Done ? feeConfig?._vcComponent : undefined; + return ( {!showContractComponent ? ( @@ -296,6 +300,7 @@ export const StatusBottomSheetContent: React.FC< {secondaryMessage ? ( {secondaryMessage} ) : null} + {VcComponent ? : null}