diff --git a/apps/browser-extension-wallet/src/views/browser-view/features/activity/components/SharedWalletTransactionDetailsWrapper.tsx b/apps/browser-extension-wallet/src/views/browser-view/features/activity/components/SharedWalletTransactionDetailsWrapper.tsx index 3c3a5af67..d928a7e9a 100644 --- a/apps/browser-extension-wallet/src/views/browser-view/features/activity/components/SharedWalletTransactionDetailsWrapper.tsx +++ b/apps/browser-extension-wallet/src/views/browser-view/features/activity/components/SharedWalletTransactionDetailsWrapper.tsx @@ -1,6 +1,7 @@ import { ActivityStatus, CoSignersListItem, + exportMultisigTransaction, hasSigned, SharedWalletTransactionDetails, SignPolicy, @@ -49,7 +50,8 @@ export const SharedWalletTransactionDetailsWrapper = withAddressBookContext( const { walletUI: { cardanoCoin }, walletInfo, - activityDetail + activityDetail, + currentChain } = useWalletStore(); const { sharedWalletKey, getSignPolicy, coSigners } = useSharedWalletData(); const [signPolicy, setSignPolicy] = useState(); @@ -58,6 +60,9 @@ export const SharedWalletTransactionDetailsWrapper = withAddressBookContext( useEffect(() => { (async () => { + if (!coSigners) { + return; + } const policy = await getSignPolicy('payment'); setSignPolicy(policy); @@ -100,6 +105,11 @@ export const SharedWalletTransactionDetailsWrapper = withAddressBookContext( [addressToNameMap, amountTransformer, cardanoCoin, txSummary] ); + const onExportTransaction = async () => { + const cbor = Serialization.Transaction.fromCore(activityDetail.activity as Wallet.Cardano.Tx).toCbor(); + await exportMultisigTransaction(cbor, sharedWalletKey, currentChain); + }; + return ( ); } diff --git a/packages/core/src/shared-wallets/transaction/SharedWalletTransactionDetails.tsx b/packages/core/src/shared-wallets/transaction/SharedWalletTransactionDetails.tsx index 916c28135..9f9ba2b62 100644 --- a/packages/core/src/shared-wallets/transaction/SharedWalletTransactionDetails.tsx +++ b/packages/core/src/shared-wallets/transaction/SharedWalletTransactionDetails.tsx @@ -1,5 +1,5 @@ /* eslint-disable complexity */ -import { Box, SummaryExpander, Text, TransactionSummary } from '@input-output-hk/lace-ui-toolkit'; +import { Box, Button, Flex, SummaryExpander, Text, TransactionSummary } from '@input-output-hk/lace-ui-toolkit'; import { Wallet } from '@lace/cardano'; import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; @@ -17,6 +17,7 @@ export interface SharedWalletTransactionDetailsProps { coinSymbol: string; cosigners: CoSignersListItem[]; fee: string; + onExportTransaction?: () => void; ownSharedKey: Wallet.Crypto.Bip32PublicKeyHex; rows: OutputSummaryProps[]; signPolicy: SignPolicy; @@ -34,6 +35,7 @@ export const SharedWalletTransactionDetails = ({ txInitiator, ownSharedKey, rows, + onExportTransaction, }: SharedWalletTransactionDetailsProps): React.ReactElement => { const { t } = useTranslation(); const [isSummaryOpen, setIsSummaryOpen] = useState(true); @@ -125,6 +127,19 @@ export const SharedWalletTransactionDetails = ({ + {signed.length > 0 && ( + + + + {t('sharedWallets.transaction.summary.forwardTransaction')} + + + )} ); }; diff --git a/packages/translation/src/lib/translations/shared-wallets/en.json b/packages/translation/src/lib/translations/shared-wallets/en.json index fc1bb1b82..ed4ab9f64 100644 --- a/packages/translation/src/lib/translations/shared-wallets/en.json +++ b/packages/translation/src/lib/translations/shared-wallets/en.json @@ -97,7 +97,9 @@ "sharedWallets.transaction.summary.validityPeriod.title": "Transaction validity period", "sharedWallets.transaction.summary.validityPeriod.value": "{{hours}} Hours", "sharedWallets.transaction.summary.validityPeriod.tooltip": "The maximum duration a transaction remains valid before it is automatically canceled if not completed with all the required signatures.", + "sharedWallets.transaction.summary.forwardTransaction": "Forward the transaction JSON to your chosen cosigner.", "sharedWallets.transaction.cosigners.title": "Co-signers", + "sharedWallets.transaction.download.button": "Download transaction JSON", "sharedWallets.transaction.cosigners.quorum.reached": "Quorum reached. Transaction ready for network submission.", "sharedWallets.transaction.cosigners.quorum.required": "Additional co-signatures are required before transaction can be submitted.", "sharedWallets.transaction.cosigners.quorum.current": "{{quorum}} of {{participants}}required",