From 132f7c0f4da5d4331e19cf0a576c9395ae337248 Mon Sep 17 00:00:00 2001 From: Tuditi <45079109+Tuditi@users.noreply.github.com> Date: Thu, 15 Feb 2024 11:02:52 +0100 Subject: [PATCH 01/15] Chore: rebrand nodeauthrequired popop (#1942) * chore: type fix * chore: rebrand NodeAuthRequiredPopup * chore: extract NodeAuthTab for reus * feat: use Node Authentication tab if required * chore: show default network --- .../popup/popups/AddNodePopup.svelte | 10 +++- .../popup/popups/NodeAuthRequiredPopup.svelte | 58 ++++++++++--------- .../views/CustomNetworkView.svelte | 18 +++--- .../src/components/helpers/getTabItems.ts | 4 +- .../components/molecules/NodeAuthTab.svelte | 46 +++++++++++++++ .../shared/src/components/molecules/index.ts | 1 + .../organisms/NodeConfigurationForm.svelte | 38 ++++-------- .../organisms/{index.js => index.ts} | 0 packages/shared/src/locales/en.json | 9 +-- 9 files changed, 112 insertions(+), 72 deletions(-) create mode 100644 packages/shared/src/components/molecules/NodeAuthTab.svelte rename packages/shared/src/components/organisms/{index.js => index.ts} (100%) diff --git a/packages/desktop/components/popup/popups/AddNodePopup.svelte b/packages/desktop/components/popup/popups/AddNodePopup.svelte index 9073688844..c356e86360 100644 --- a/packages/desktop/components/popup/popups/AddNodePopup.svelte +++ b/packages/desktop/components/popup/popups/AddNodePopup.svelte @@ -18,6 +18,9 @@ let nodeConfigurationForm: NodeConfigurationForm let isBusy = false + let requiresAuth = false + + $: disabled = !node?.url || (requiresAuth && !node?.auth) async function onSubmit(): Promise { try { @@ -40,7 +43,9 @@ onSuccess() } catch (err) { - if (err.type !== 'validationError') { + if (err?.error?.match(/(username)|(password)|(jwt)/g)) { + requiresAuth = true + } else if (err.type !== 'validationError') { showNotification({ variant: 'error', text: localize(err?.error ?? 'error.global.generic'), @@ -63,12 +68,13 @@ type: 'submit', form: 'node-configuration-form', text: localize(`actions.${isEditingNode ? 'updateNode' : 'addNode'}`), - disabled: !node.url, + disabled, }} > - import { Text, TextInput, TextType } from '@ui' + import { NodeAuthTab } from '@ui' import type { IAuth } from '@iota/sdk' import { handleError } from '@core/error/handlers' import { localize } from '@core/i18n' import { closePopup } from '@desktop/auxiliary/popup' - import { Button } from '@bloomwalletio/ui' + import PopupTemplate from '../PopupTemplate.svelte' + import { IError } from '@core/error' export let onSubmit: (auth: IAuth) => unknown = () => {} let isBusy = false + let auth: IAuth + let jwtError: string | undefined - let jwt: string - let jwtError: string + $: disabled = isBusy || !auth - $: disabled = !jwt || isBusy - - async function handleSubmit(): Promise { + async function onConfirmClick(): Promise { try { isBusy = true - const auth = { jwt } await onSubmit(auth) isBusy = false } catch (err) { + const error = err as IError isBusy = false - const authenticationError = err?.error?.match(/(jwt)/g)?.[0] + const authenticationError = error?.error?.match(/(jwt)/g)?.[0] switch (authenticationError) { case 'jwt': - jwtError = err.error + jwtError = error?.error break default: - handleError(err) + handleError(error) break } } } + + function onCancelClick(): void { + closePopup() + } -
- {localize('popups.nodeAuthRequired.title')} - {localize('popups.nodeAuthRequired.body')} -
- -
-
-
-
+ + + diff --git a/packages/desktop/views/onboarding/views/network-setup/views/CustomNetworkView.svelte b/packages/desktop/views/onboarding/views/network-setup/views/CustomNetworkView.svelte index c4b7a54ed9..05289826f8 100644 --- a/packages/desktop/views/onboarding/views/network-setup/views/CustomNetworkView.svelte +++ b/packages/desktop/views/onboarding/views/network-setup/views/CustomNetworkView.svelte @@ -9,7 +9,6 @@ getNetworkIdFromOnboardingNetworkType, getNodeInfoWhileLoggedOut, } from '@core/network' - import features from '@features/features' import { NodeConfigurationForm } from '@ui' import { OnboardingLayout } from '@views/components' import { onMount } from 'svelte' @@ -20,15 +19,10 @@ let node: INode let busy = false let formError = '' - let networkType: OnboardingNetworkType = getInitialSelectedNetworkType() + let requiresAuth = false + let networkType: OnboardingNetworkType - function getInitialSelectedNetworkType(): OnboardingNetworkType { - return features?.onboarding?.shimmer?.enabled - ? OnboardingNetworkType.Shimmer - : features?.onboarding?.testnet?.enabled - ? OnboardingNetworkType.Testnet - : OnboardingNetworkType.Custom - } + $: disableContinue = !node?.url || !networkType || (requiresAuth && !node?.auth) function onBackClick(): void { $networkSetupRouter.previous() @@ -61,7 +55,9 @@ } catch (err) { console.error(err) updateOnboardingProfile({ clientOptions: undefined, network: undefined }) - if (err?.error?.includes('error sending request for url')) { + if (err?.error?.match(/(username)|(password)|(jwt)/g)) { + requiresAuth = true + } else if (err?.error?.includes('error sending request for url')) { formError = localize('error.node.unabledToConnect') } else if (err?.message === 'error.node.differentNetwork') { formError = localize('error.node.differentNetwork') @@ -86,6 +82,7 @@ title={localize('views.onboarding.networkSetup.setupCustomNetwork.title')} continueButton={{ onClick: onContinueClick, + disabled: disableContinue, }} backButton={{ onClick: onBackClick, @@ -100,6 +97,7 @@ bind:coinType bind:node bind:formError + {requiresAuth} isBusy={busy} isDeveloperProfile networkEditable diff --git a/packages/shared/src/components/helpers/getTabItems.ts b/packages/shared/src/components/helpers/getTabItems.ts index 69efb2ee91..ce782c1dd5 100644 --- a/packages/shared/src/components/helpers/getTabItems.ts +++ b/packages/shared/src/components/helpers/getTabItems.ts @@ -1,7 +1,7 @@ import { localize } from '@core/i18n' import { KeyValue } from '../types' -import { Tab } from '@ui/enums' +import { PopupTab } from '@ui/enums' -export function getTabItems(items: Tab[]): KeyValue[] { +export function getTabItems(items: PopupTab[]): KeyValue[] { return items.map((item) => ({ key: item, value: localize(`general.${item}`) })) } diff --git a/packages/shared/src/components/molecules/NodeAuthTab.svelte b/packages/shared/src/components/molecules/NodeAuthTab.svelte new file mode 100644 index 0000000000..fbf22a8c90 --- /dev/null +++ b/packages/shared/src/components/molecules/NodeAuthTab.svelte @@ -0,0 +1,46 @@ + + +
+ + {#if isJwtAuthentication} + + {:else} + + + {/if} +
diff --git a/packages/shared/src/components/molecules/index.ts b/packages/shared/src/components/molecules/index.ts index 7f4c9a7b22..b879334b2f 100644 --- a/packages/shared/src/components/molecules/index.ts +++ b/packages/shared/src/components/molecules/index.ts @@ -8,6 +8,7 @@ export { default as NetworkRecipientSelector } from './NetworkRecipientSelector. export { default as NftGallery } from './NftGallery.svelte' export { default as NftGalleryItem } from './NftGalleryItem.svelte' export { default as NftMedia } from './NftMedia.svelte' +export { default as NodeAuthTab } from './NodeAuthTab.svelte' export { default as SelectorInput } from './SelectorInput.svelte' export { default as ShimmerClaimingAccountList } from './ShimmerClaimingAccountList.svelte' export { default as TransactionAssetSection } from './TransactionAssetSection.svelte' diff --git a/packages/shared/src/components/organisms/NodeConfigurationForm.svelte b/packages/shared/src/components/organisms/NodeConfigurationForm.svelte index d5e795008b..dbae6a9a94 100644 --- a/packages/shared/src/components/organisms/NodeConfigurationForm.svelte +++ b/packages/shared/src/components/organisms/NodeConfigurationForm.svelte @@ -1,7 +1,7 @@ - -
- {#if title} - - {title} - - {/if} - {#if body} - - {body} - - {/if} -
-
+ + {#if title} + + {title} + + {/if} + {#if body} + + {body} + + {/if} + diff --git a/packages/shared/src/components/atoms/MenuItem.svelte b/packages/shared/src/components/atoms/MenuItem.svelte index f2b3be945d..3031a9faf3 100644 --- a/packages/shared/src/components/atoms/MenuItem.svelte +++ b/packages/shared/src/components/atoms/MenuItem.svelte @@ -1,5 +1,5 @@ + +{#if status} + +
+ {#if error} + + {/if} + {localize(`pills.governance.proposalStatus.${error ? error : status}`)} +
+
+{/if} diff --git a/packages/desktop/views/governance/components/index.ts b/packages/desktop/views/governance/components/index.ts index c53c34d4af..ccdd82e90c 100644 --- a/packages/desktop/views/governance/components/index.ts +++ b/packages/desktop/views/governance/components/index.ts @@ -1 +1,2 @@ +export { default as ProposalStatusPill } from './ProposalStatusPill.svelte' export { default as ProposalStatusInfo } from './ProposalStatusInfo.svelte' diff --git a/packages/shared/src/components/pills/ProposalStatusPill.svelte b/packages/shared/src/components/pills/ProposalStatusPill.svelte deleted file mode 100644 index 2ef371b362..0000000000 --- a/packages/shared/src/components/pills/ProposalStatusPill.svelte +++ /dev/null @@ -1,34 +0,0 @@ - - -{#if status} - -
- {#if error} - - {/if} -
- {localize(`pills.governance.proposalStatus.${error ? error : status}`)} -
-
-
-{/if} diff --git a/packages/shared/src/components/pills/index.js b/packages/shared/src/components/pills/index.js index b51489207f..70ea9a11e0 100644 --- a/packages/shared/src/components/pills/index.js +++ b/packages/shared/src/components/pills/index.js @@ -3,4 +3,3 @@ export { default as TimelockActivityPill } from './TimelockActivityPill.svelte' export { default as UnclaimedActivityPill } from './UnclaimedActivityPill.svelte' export { default as ActivityAsyncStatusPill } from './ActivityAsyncStatusPill.svelte' export { default as NetworkStatusPill } from './NetworkStatusPill.svelte' -export { default as ProposalStatusPill } from './ProposalStatusPill.svelte' From 3a251347d3c7fea6a079d5fa1a3127f61ac5c8c4 Mon Sep 17 00:00:00 2001 From: Jean Ribeiro Date: Thu, 15 Feb 2024 11:20:00 -0300 Subject: [PATCH 06/15] chore: rebrand stop voting pop-up (#1951) Co-authored-by: Tuditi --- .../popup/popups/StopVotingPopup.svelte | 43 +++++++------------ 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/packages/desktop/components/popup/popups/StopVotingPopup.svelte b/packages/desktop/components/popup/popups/StopVotingPopup.svelte index d5a674e54d..872f986897 100644 --- a/packages/desktop/components/popup/popups/StopVotingPopup.svelte +++ b/packages/desktop/components/popup/popups/StopVotingPopup.svelte @@ -6,8 +6,7 @@ import { localize } from '@core/i18n' import { checkActiveProfileAuth } from '@core/profile/actions' import { closePopup } from '@desktop/auxiliary/popup' - import { Text, TextType } from '@ui' - import { Button } from '@bloomwalletio/ui' + import PopupTemplate from '../PopupTemplate.svelte' $: hasGovernanceTransactionInProgress = $selectedAccount?.hasVotingPowerTransactionInProgress || $selectedAccount?.hasVotingTransactionInProgress @@ -24,28 +23,18 @@ } - - {localize('popups.stopVoting.title')} -
- {localize('popups.stopVoting.body', { values: { proposalName: $selectedProposal?.title } })} - -
-
-
-
+ + + From 5f797e962381723cc3ac745dc5dd8e8d227b920c Mon Sep 17 00:00:00 2001 From: Tuditi <45079109+Tuditi@users.noreply.github.com> Date: Thu, 15 Feb 2024 15:22:09 +0100 Subject: [PATCH 07/15] chore: rebrand vote for proposal pop-up (#1950) --- .../popup/popups/VoteForProposalPopup.svelte | 84 +++++++++---------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/packages/desktop/components/popup/popups/VoteForProposalPopup.svelte b/packages/desktop/components/popup/popups/VoteForProposalPopup.svelte index 7959baf8a7..b5e141ceb3 100644 --- a/packages/desktop/components/popup/popups/VoteForProposalPopup.svelte +++ b/packages/desktop/components/popup/popups/VoteForProposalPopup.svelte @@ -1,19 +1,19 @@ -
- - {localize('popups.voteForProposal.title')} - - - {localize('popups.voteForProposal.body', { - values: { - proposal: $selectedProposal?.title, - }, - })} - -
+ {#if !hasVotingPower} @@ -60,21 +76,5 @@ })} /> {/if} - - -
+ {#if dapp} + + {:else} + + {/if} + + diff --git a/packages/desktop/lib/auxiliary/popup/enums/popup-id.enum.ts b/packages/desktop/lib/auxiliary/popup/enums/popup-id.enum.ts index ead3d2bf7e..4ca6056575 100644 --- a/packages/desktop/lib/auxiliary/popup/enums/popup-id.enum.ts +++ b/packages/desktop/lib/auxiliary/popup/enums/popup-id.enum.ts @@ -36,6 +36,7 @@ export enum PopupId { SendFlow = 'sendFlow', SignTypedData = 'signTypedData', SignMessage = 'signMessage', + Siwe = 'siwe', StopVoting = 'stopVoting', SuccessfulDappInteraction = 'successfulDappInteraction', SyncAccounts = 'syncAccounts', diff --git a/packages/shared/src/lib/auxiliary/wallet-connect/handlers/onSessionRequest.handler.ts b/packages/shared/src/lib/auxiliary/wallet-connect/handlers/onSessionRequest.handler.ts index ffde81dc5a..202bb4d6ed 100644 --- a/packages/shared/src/lib/auxiliary/wallet-connect/handlers/onSessionRequest.handler.ts +++ b/packages/shared/src/lib/auxiliary/wallet-connect/handlers/onSessionRequest.handler.ts @@ -43,6 +43,11 @@ export function onSessionRequest(event: Web3WalletTypes.SessionRequest): void { } } + if (!dapp) { + returnResponse({ error: getSdkError('SESSION_SETTLEMENT_FAILED') }) + return + } + const chain = getNetwork()?.getChain(chainId as NetworkId) if (!chain) { returnResponse({ error: getSdkError('UNSUPPORTED_CHAINS') }) diff --git a/packages/shared/src/lib/auxiliary/wallet-connect/handlers/sign_message.handler.ts b/packages/shared/src/lib/auxiliary/wallet-connect/handlers/sign_message.handler.ts index 1999974e22..0d79d5bbdc 100644 --- a/packages/shared/src/lib/auxiliary/wallet-connect/handlers/sign_message.handler.ts +++ b/packages/shared/src/lib/auxiliary/wallet-connect/handlers/sign_message.handler.ts @@ -6,10 +6,13 @@ import { CallbackParameters } from '../types' import { switchToRequiredAccount } from '../utils' import { getSdkError } from '@walletconnect/utils' import { Platform } from '@core/app' +import { parseSiweMessage, validateSiwe } from '@core/layer-2' +import { showNotification } from '@auxiliary/notification' +import { localize } from '@core/i18n' export async function handleSignMessage( params: unknown, - dapp: IConnectedDapp | undefined, + dapp: IConnectedDapp, method: 'personal_sign' | 'eth_sign', chain: IChain, responseCallback: (params: CallbackParameters) => void @@ -33,17 +36,43 @@ export async function handleSignMessage( try { const account = await switchToRequiredAccount(accountAddress, chain) - openPopup({ - id: PopupId.SignMessage, - props: { - message, - dapp, - account, - chain, - callback: responseCallback, - onCancel: () => responseCallback({ error: getSdkError('USER_REJECTED') }), - }, - }) + + const siweObject = parseSiweMessage(message) + if (siweObject) { + const isValidSiwe = validateSiwe(siweObject, dapp.metadata?.url) + if (isValidSiwe) { + openPopup({ + id: PopupId.Siwe, + props: { + siweObject, + rawMessage: message, + dapp, + account, + chain, + callback: responseCallback, + onCancel: () => responseCallback({ error: getSdkError('USER_REJECTED') }), + }, + }) + } else { + showNotification({ + variant: 'error', + text: localize('notifications.siwe.rejected'), + }) + responseCallback({ error: getSdkError('INVALID_METHOD') }) + } + } else { + openPopup({ + id: PopupId.SignMessage, + props: { + message, + dapp, + account, + chain, + callback: responseCallback, + onCancel: () => responseCallback({ error: getSdkError('USER_REJECTED') }), + }, + }) + } } catch (err) { responseCallback({ error: getSdkError(err) }) } diff --git a/packages/shared/src/lib/core/layer-2/utils/index.ts b/packages/shared/src/lib/core/layer-2/utils/index.ts index 2fc3dd4b72..0b5670fe07 100644 --- a/packages/shared/src/lib/core/layer-2/utils/index.ts +++ b/packages/shared/src/lib/core/layer-2/utils/index.ts @@ -14,3 +14,4 @@ export * from './parseLayer2Metadata' export * from './parseLayer2MetadataForTransfer' export * from './parseSiweMessage' export * from './prepareEvmTransaction' +export * from './validateSiwe' diff --git a/packages/shared/src/lib/core/layer-2/utils/validateSiwe.ts b/packages/shared/src/lib/core/layer-2/utils/validateSiwe.ts new file mode 100644 index 0000000000..015af9f806 --- /dev/null +++ b/packages/shared/src/lib/core/layer-2/utils/validateSiwe.ts @@ -0,0 +1,9 @@ +import { ParsedMessage } from '@spruceid/siwe-parser' + +export function validateSiwe(siweObject: ParsedMessage, origin: string | undefined): boolean { + if (siweObject.domain !== origin && `https://${siweObject.domain}` !== origin) { + return false + } + + return true +} diff --git a/packages/shared/src/locales/en.json b/packages/shared/src/locales/en.json index 6624b4b644..c793ec1965 100644 --- a/packages/shared/src/locales/en.json +++ b/packages/shared/src/locales/en.json @@ -958,7 +958,11 @@ "success": "Signed message" }, "siwe": { - "title": "Sign-In with Ethereum" + "title": "Sign-In with Ethereum", + "domain": "Domain", + "statement": "Statement", + "resources": "Resources", + "action": "Sign in" }, "signTransaction": { "title": "Sign transaction", @@ -1773,6 +1777,9 @@ "updateNetworkAddresses": { "success": "Contact addresses successfully updated" }, + "siwe": { + "rejected": "Invalid SIWE request" + }, "syncTokens": { "success": "Tokens successfully synced" } From 0a34f700d462f23bbfa4a9be0f0558c1b15c7ad5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 16 Feb 2024 16:05:40 +0100 Subject: [PATCH 11/15] Generated diff for 2024-02-16 (#1957) Co-authored-by: GitHub Actions --- firefly.diff | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/firefly.diff b/firefly.diff index a874838d7b..9323833ac4 100644 --- a/firefly.diff +++ b/firefly.diff @@ -58,8 +58,10 @@ delete mode 100644 packages/desktop/components/AccountActivity.svelte delete mode 100644 packages/desktop/components/AccountSummary.svelte delete mode 100644 packages/desktop/components/OnboardingLayout.svelte + delete mode 100644 packages/desktop/components/ProposalStatusInfo.svelte delete mode 100644 packages/desktop/components/Scroller.svelte delete mode 100644 packages/desktop/components/SendButton.svelte + delete mode 100644 packages/desktop/components/VotingPower.svelte delete mode 100644 packages/desktop/components/buttons/NetworkDrawerButton.svelte delete mode 100644 packages/desktop/components/buttons/index.js delete mode 100644 packages/desktop/components/buttons/menu-buttons/AccountActionsButton.svelte @@ -72,7 +74,7 @@ delete mode 100644 packages/desktop/components/drawers/network-config/drawers/DrawerTemplate.svelte delete mode 100644 packages/desktop/components/drawers/network-config/drawers/components/IscpChainInformation.svelte rename packages/desktop/components/filter/{index.js => index.ts} (100%) - rename packages/desktop/components/{index.js => index.ts} (50%) + delete mode 100644 packages/desktop/components/index.js delete mode 100644 packages/desktop/components/menu-buttons/index.js rename packages/{shared/components/modals => desktop/components/menus}/NodeActionsMenu.svelte (52%) rename packages/desktop/components/{menu-buttons/ProposalDetailsButton.svelte => menus/ProposalDetailsMenu.svelte} (55%) @@ -80,17 +82,11 @@ delete mode 100644 packages/desktop/components/modals/AccountSwitcherModal.svelte delete mode 100644 packages/desktop/components/modals/index.js rename packages/desktop/components/panes/{index.js => index.ts} (100%) - rename packages/desktop/components/{ => popup}/popups/AddNodePopup.svelte (58%) + rename packages/desktop/components/{ => popup}/popups/AddNodePopup.svelte (56%) rename packages/desktop/components/{ => popup}/popups/AddProposalPopup.svelte (77%) - rename packages/desktop/components/{ => popup}/popups/ManageVotingPowerPopup.svelte (67%) rename packages/desktop/components/{ => popup}/popups/MintNativeTokenFormPopup.svelte (69%) rename packages/desktop/components/{ => popup}/popups/MintNftFormPopup.svelte (84%) - rename packages/desktop/components/{ => popup}/popups/NodeAuthRequiredPopup.svelte (73%) - rename packages/desktop/components/{ => popup}/popups/RemoveProposalPopup.svelte (64%) - rename packages/desktop/components/{ => popup}/popups/RevotePopup.svelte (70%) - rename packages/desktop/components/{ => popup}/popups/StopVotingPopup.svelte (64%) - rename packages/desktop/components/{ => popup}/popups/VoteForProposalPopup.svelte (69%) - rename packages/desktop/components/{ => popup}/popups/VotingPowerToZeroPopup.svelte (67%) + rename packages/desktop/components/{ => popup}/popups/RemoveProposalPopup.svelte (52%) delete mode 100644 packages/desktop/components/popups/AccountSwitcherPopup.svelte delete mode 100644 packages/desktop/components/popups/ActivityDetailsPopup.svelte delete mode 100644 packages/desktop/components/popups/AliasConfirmationPopup.svelte @@ -114,17 +110,23 @@ delete mode 100644 packages/desktop/components/popups/LedgerConnectionGuidePopup.svelte delete mode 100644 packages/desktop/components/popups/LegalUpdatePopup.svelte delete mode 100644 packages/desktop/components/popups/ManageAccountPopup.svelte + delete mode 100644 packages/desktop/components/popups/ManageVotingPowerPopup.svelte delete mode 100644 packages/desktop/components/popups/MintNativeTokenConfirmationPopup.svelte delete mode 100644 packages/desktop/components/popups/MintNftConfirmationPopup.svelte + delete mode 100644 packages/desktop/components/popups/NodeAuthRequiredPopup.svelte delete mode 100644 packages/desktop/components/popups/NodeInfoPopup.svelte delete mode 100644 packages/desktop/components/popups/Popup.svelte delete mode 100644 packages/desktop/components/popups/ReceiveAddressPopup.svelte delete mode 100644 packages/desktop/components/popups/RemoveNode.svelte + delete mode 100644 packages/desktop/components/popups/RevotePopup.svelte delete mode 100644 packages/desktop/components/popups/SendFlowPopup.svelte + delete mode 100644 packages/desktop/components/popups/StopVotingPopup.svelte delete mode 100644 packages/desktop/components/popups/TestDeepLinkFormPopup.svelte delete mode 100644 packages/desktop/components/popups/TokenInformationPopup.svelte delete mode 100644 packages/desktop/components/popups/UnlockStrongholdPopup.svelte delete mode 100644 packages/desktop/components/popups/VerifyLedgerTransactionPopup.svelte + delete mode 100644 packages/desktop/components/popups/VoteForProposalPopup.svelte + delete mode 100644 packages/desktop/components/popups/VotingPowerToZeroPopup.svelte delete mode 100644 packages/desktop/components/popups/WalletFinderPopup.svelte delete mode 100644 packages/desktop/components/popups/index.js delete mode 100644 packages/desktop/components/popups/send/SendConfirmationPopup.svelte @@ -154,7 +156,7 @@ delete mode 100644 packages/desktop/lib/auxiliary/popup/helpers/index.ts rename packages/desktop/lib/{electron.ts => electron/index.ts} (54%) rename packages/desktop/{electron/lib/menuState.js => lib/electron/menus/menu-state.constant.ts} (86%) - rename packages/desktop/{electron/main.js => lib/electron/processes/main.process.ts} (61%) + rename packages/desktop/{electron/main.js => lib/electron/processes/main.process.ts} (60%) rename packages/desktop/{electron/lib/analytics.js => lib/electron/utils/analytics.utils.ts} (82%) rename packages/desktop/{electron/lib/errorHandling.js => lib/electron/utils/error.utils.ts} (69%) delete mode 100644 packages/desktop/lib/routers/actions/openSettings.ts @@ -676,6 +678,8 @@ delete mode 100644 packages/shared/assets/illustrations/onboarding/ledger-live-updated-desktop-darkmode.svg delete mode 100644 packages/shared/assets/illustrations/onboarding/ledger-live-updated-desktop.svg delete mode 100644 packages/shared/assets/illustrations/onboarding/ledger-search-apps-desktop.svg + delete mode 100644 packages/shared/assets/illustrations/wallet/empty-collectibles-darkmode.svg + delete mode 100644 packages/shared/assets/illustrations/wallet/empty-collectibles.svg delete mode 100644 packages/shared/components/Alert.svelte delete mode 100644 packages/shared/components/Animation.svelte delete mode 100644 packages/shared/components/Button.svelte @@ -683,6 +687,7 @@ delete mode 100644 packages/shared/components/ColorPicker.svelte delete mode 100644 packages/shared/components/Error.svelte delete mode 100644 packages/shared/components/HR.svelte + delete mode 100644 packages/shared/components/Illustration.svelte delete mode 100644 packages/shared/components/LoadingScreen.svelte delete mode 100644 packages/shared/components/Logo.svelte delete mode 100644 packages/shared/components/OutdatedNodeTooltip.svelte @@ -714,7 +719,9 @@ delete mode 100644 packages/shared/components/atoms/badges/VerificationBadge.svelte delete mode 100644 packages/shared/components/atoms/badges/index.js delete mode 100644 packages/shared/components/atoms/boxes/AddressBox.svelte + delete mode 100644 packages/shared/components/atoms/boxes/CopyableBox.svelte delete mode 100644 packages/shared/components/atoms/boxes/KeyValueBox.svelte + delete mode 100644 packages/shared/components/atoms/boxes/index.js delete mode 100644 packages/shared/components/atoms/buttons/AddInputButton.svelte delete mode 100644 packages/shared/components/atoms/buttons/AssetActionsButton.svelte delete mode 100644 packages/shared/components/atoms/buttons/ExportStrongholdButton.svelte @@ -1081,9 +1088,11 @@ delete mode 100644 packages/shared/lib/core/utils/constants/iota-unit-map.constant.ts delete mode 100644 packages/shared/lib/core/utils/crypto/utils/validateAssetId.ts delete mode 100644 packages/shared/lib/core/utils/crypto/utils/validateEthereumAddress.ts + delete mode 100644 packages/shared/lib/core/utils/function.ts delete mode 100644 packages/shared/lib/core/utils/interfaces/format-iota-unit-options.interface.ts delete mode 100644 packages/shared/lib/core/utils/interfaces/index.ts delete mode 100644 packages/shared/lib/core/utils/interfaces/key-value-box-list.interface.ts + delete mode 100644 packages/shared/lib/core/utils/tests/function.test.ts delete mode 100644 packages/shared/lib/core/utils/tests/ui.test.ts delete mode 100644 packages/shared/lib/core/utils/tests/unit.test.ts delete mode 100644 packages/shared/lib/core/utils/time.ts @@ -1210,17 +1219,14 @@ delete mode 100644 packages/shared/locales/sv.json delete mode 100644 packages/shared/locales/tr.json rename packages/shared/{ => src}/components/Idle.svelte (93%) - rename packages/shared/{ => src}/components/Illustration.svelte (53%) rename packages/shared/{ => src}/components/Link.svelte (90%) rename packages/shared/{ => src}/components/QR.svelte (66%) rename packages/shared/{ => src}/components/Spinner.svelte (79%) rename packages/shared/{ => src}/components/Text.svelte (98%) rename packages/shared/{ => src}/components/Tooltip.svelte (97%) rename packages/shared/{ => src}/components/Transition.svelte (75%) - rename packages/shared/{ => src}/components/atoms/Icon.svelte (94%) + rename packages/shared/{ => src}/components/atoms/Icon.svelte (90%) rename packages/shared/{components/atoms => src/components}/boxes/Box.svelte (85%) - rename packages/shared/{components/atoms => src/components}/boxes/CopyableBox.svelte (81%) - rename packages/shared/{components/atoms/boxes/index.js => src/components/boxes/index.ts} (73%) rename packages/shared/{components/atoms => src/components}/buttons/ReceiveButton.svelte (81%) rename packages/shared/{ => src}/components/enums/font-weight.enum.ts (100%) rename packages/shared/{ => src}/components/enums/index.ts (50%) @@ -1232,9 +1238,9 @@ rename packages/shared/{components/index.js => src/components/index.ts} (53%) rename packages/shared/{ => src}/components/inputs/AliasInput.svelte (51%) rename packages/shared/{ => src}/components/inputs/Checkbox.svelte (98%) - rename packages/shared/{components/inputs/Dropdown2.svelte => src/components/inputs/Dropdown.svelte} (98%) + rename packages/shared/{components/inputs/Dropdown2.svelte => src/components/inputs/Dropdown.svelte} (96%) rename packages/shared/{ => src}/components/inputs/Input.svelte (93%) - rename packages/shared/{ => src}/components/inputs/InputContainer.svelte (75%) + rename packages/shared/{ => src}/components/inputs/InputContainer.svelte (69%) rename packages/shared/{ => src}/components/inputs/NodeInput.svelte (95%) rename packages/shared/{ => src}/components/inputs/OptionalInput.svelte (55%) rename packages/shared/{ => src}/components/inputs/Radio.svelte (94%) @@ -1617,7 +1623,7 @@ rename packages/shared/{ => src}/lib/core/account/utils/sumBalanceForAccounts.ts (100%) rename packages/shared/{lib/core/wallet/actions/activities => src/lib/core/activity/actions}/generateAndStoreActivitiesForAccount.ts (54%) rename packages/shared/{lib/core/wallet/actions/activities => src/lib/core/activity/actions}/hideActivitiesForFoundries.ts (77%) - rename packages/shared/{lib/core/wallet/actions/activities => src/lib/core/activity/actions}/linkTransactionsWithClaimingTransactions.ts (88%) + rename packages/shared/{lib/core/wallet/actions/activities => src/lib/core/activity/actions}/linkTransactionsWithClaimingTransactions.ts (92%) rename packages/shared/{lib/core/wallet/actions/activities => src/lib/core/activity/actions}/preprocessOutputsForAccount.ts (68%) rename packages/shared/{lib/core/wallet/actions/activities => src/lib/core/activity/actions}/preprocessTransactionsForAccount.ts (80%) rename packages/shared/{lib/core/wallet/actions/activities => src/lib/core/activity/actions}/setAsyncStatusOfAccountActivities.ts (79%) @@ -1637,7 +1643,7 @@ rename packages/shared/{lib/core/wallet => src/lib/core/activity}/stores/all-account-activities.store.ts (83%) rename packages/shared/{lib/core/wallet => src/lib/core/activity}/stores/claimed-activities.store.ts (78%) rename packages/shared/{lib/core/wallet => src/lib/core/activity}/stores/hidden-activities.store.ts (74%) - rename packages/shared/{lib/core/wallet => src/lib/core/activity}/stores/selected-account-activities.store.ts (56%) + rename packages/shared/{lib/core/wallet => src/lib/core/activity}/stores/selected-account-activities.store.ts (59%) rename packages/shared/{lib/core/wallet/interfaces => src/lib/core/activity/types}/activity-filter.interface.ts (90%) rename packages/shared/{lib/core/wallet/interfaces => src/lib/core/activity/types}/activity-generation-parameters.interface.ts (82%) rename packages/shared/{lib/core/wallet => src/lib/core/activity}/types/activity.type.ts (81%) @@ -1690,7 +1696,7 @@ rename packages/shared/{ => src}/lib/core/app/interfaces/managers/notification-manager.interface.ts (100%) rename packages/shared/{ => src}/lib/core/app/interfaces/managers/pincode-manager.interface.ts (77%) rename packages/shared/{ => src}/lib/core/app/interfaces/nft-download-state.interface.ts (74%) - rename packages/shared/{ => src}/lib/core/app/interfaces/platform-event-map.interface.ts (54%) + rename packages/shared/{ => src}/lib/core/app/interfaces/platform-event-map.interface.ts (53%) rename packages/shared/{ => src}/lib/core/app/interfaces/platform.interface.ts (81%) rename packages/shared/{ => src}/lib/core/app/stores/app-settings.store.ts (55%) rename packages/shared/{ => src}/lib/core/app/stores/app-version-details.store.ts (100%) @@ -1707,7 +1713,7 @@ rename specs/images/.gitkeep => packages/shared/src/lib/core/contact/helpers/index.ts (100%) rename packages/shared/{lib/core/app => src/lib/core/contact}/index.ts (72%) rename packages/shared/{ => src}/lib/core/error/actions/index.ts (100%) - rename packages/shared/{ => src}/lib/core/error/actions/logAndNotifyError.ts (79%) + rename packages/shared/{ => src}/lib/core/error/actions/logAndNotifyError.ts (70%) rename packages/shared/{ => src}/lib/core/error/classes/base-error.class.ts (81%) rename packages/shared/{ => src}/lib/core/error/classes/index.ts (100%) rename packages/shared/{ => src}/lib/core/error/constants/default-app-error-parameters.constant.ts (100%) @@ -2148,7 +2154,6 @@ rename packages/shared/{ => src}/lib/core/utils/enums/time-period.enum.ts (100%) rename packages/shared/{ => src}/lib/core/utils/filter.ts (63%) rename packages/shared/{ => src}/lib/core/utils/format.ts (77%) - rename packages/shared/{ => src}/lib/core/utils/function.ts (100%) rename packages/shared/{ => src}/lib/core/utils/index.ts (86%) rename packages/shared/{ => src}/lib/core/utils/interfaces/date-difference.interface.ts (100%) rename packages/shared/{ => src}/lib/core/utils/interfaces/dropdown-item.interface.ts (100%) @@ -2172,7 +2177,6 @@ rename packages/shared/{ => src}/lib/core/utils/tests/crypto.test.ts (100%) rename packages/shared/{ => src}/lib/core/utils/tests/date.test.ts (100%) rename packages/shared/{ => src}/lib/core/utils/tests/format.test.ts (100%) - rename packages/shared/{ => src}/lib/core/utils/tests/function.test.ts (100%) rename packages/shared/{ => src}/lib/core/utils/tests/math.test.ts (100%) rename packages/shared/{ => src}/lib/core/utils/tests/number.test.ts (100%) rename packages/shared/{ => src}/lib/core/utils/tests/object.test.ts (95%) From c2f9cd1f532a970c7a1bc0c9a11d17519ca0fcdf Mon Sep 17 00:00:00 2001 From: Jean Ribeiro Date: Fri, 16 Feb 2024 13:35:37 -0300 Subject: [PATCH 12/15] enhancement: polish Transak payment provider flows (#1925) * wip * wip: compare domains for google pay Co-authored-by: Jean Ribeiro * fix: google pay flow * refactor: transakManager getUrl function * disable feature flag * remove unnecessary roundedCorners change * remove unnecessary component change * Update buy-sell.features.ts * fix: polish transak * fix: name of tab --------- Co-authored-by: Nicole O'Brien --- .../desktop/features/buy-sell.features.ts | 2 +- .../lib/electron/managers/transak.manager.ts | 37 +++++++++++++++++-- .../components/DashboardSidebar.svelte | 2 +- packages/shared/src/locales/en.json | 2 +- 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/packages/desktop/features/buy-sell.features.ts b/packages/desktop/features/buy-sell.features.ts index 826f1fa5f7..07735ed62c 100644 --- a/packages/desktop/features/buy-sell.features.ts +++ b/packages/desktop/features/buy-sell.features.ts @@ -1,7 +1,7 @@ import { IFeatureFlag } from '@lib/features/interfaces' const buySellFeatures: IFeatureFlag = { - enabled: false, + enabled: true, } export default buySellFeatures diff --git a/packages/desktop/lib/electron/managers/transak.manager.ts b/packages/desktop/lib/electron/managers/transak.manager.ts index 1a370cbf71..121500f845 100644 --- a/packages/desktop/lib/electron/managers/transak.manager.ts +++ b/packages/desktop/lib/electron/managers/transak.manager.ts @@ -3,7 +3,8 @@ import { windows } from '../constants/windows.constant' import features from '@features/features' import { ITransakManager, ITransakWindowData } from '@core/app' import path from 'path' -import { TRANSAK_WIDGET_URL } from '@auxiliary/transak' +import { TRANSAK_WIDGET_URL } from '@auxiliary/transak/constants' +import { buildQueryParametersFromObject } from '@core/utils/url' export default class TransakManager implements ITransakManager { private rect: Electron.Rectangle @@ -82,8 +83,8 @@ export default class TransakManager implements ITransakManager { } }) - const url = this.getUrl(data) - void windows.transak.loadURL(url) + const initialUrl = this.getUrl(data) + void windows.transak.loadURL(initialUrl) windows.transak.webContents.setWindowOpenHandler(({ url }) => { void shell.openExternal(url) @@ -97,6 +98,19 @@ export default class TransakManager implements ITransakManager { windows.main.webContents.send('transak-url', _url.origin) }) + windows.transak.webContents.addListener('did-navigate-in-page', (_, url) => { + const urlToBeMatched = TRANSAK_WIDGET_URL + '/googlepay' + if (url.startsWith(urlToBeMatched)) { + void shell.openExternal(url) + void windows.transak.loadURL(initialUrl) + } + }) + + windows.transak.webContents.addListener('will-navigate', (event) => { + event.preventDefault() + void shell.openExternal(event.url) + }) + return windows.transak } @@ -151,6 +165,21 @@ export default class TransakManager implements ITransakManager { const { address, currency, service } = data const apiKey = process.env.TRANSAK_API_KEY - return `${TRANSAK_WIDGET_URL}/?apiKey=${apiKey}&defaultFiatCurrency=${currency}&walletAddress=${address}&productsAvailed=${service}&cryptoCurrencyCode=IOTA&network=miota&themeColor=7C41C9&hideMenu=true` + const queryParams = buildQueryParametersFromObject({ + apiKey, + defaultFiatCurrency: currency, + defaultFiatAmount: 100, + walletAddress: address, + productsAvailed: service, + cryptoCurrencyCode: 'IOTA', + network: 'miota', + themeColor: '7C41C9', + hideMenu: true, + disableWalletAddressForm: true, + isFeeCalculationHidden: true, + disablePaymentMethods: ['apple_pay', 'google_pay'], + }) + + return `${TRANSAK_WIDGET_URL}/?${queryParams}` } } diff --git a/packages/desktop/views/dashboard/components/DashboardSidebar.svelte b/packages/desktop/views/dashboard/components/DashboardSidebar.svelte index 5f54f18f47..a52489314a 100644 --- a/packages/desktop/views/dashboard/components/DashboardSidebar.svelte +++ b/packages/desktop/views/dashboard/components/DashboardSidebar.svelte @@ -65,7 +65,7 @@ ...(features?.buySell?.enabled && $activeProfile?.network?.id === StardustNetworkId.Iota ? [ { - icon: IconName.CoinSwap, + icon: IconName.ArrowDownUp, label: localize('tabs.buySell'), route: DashboardRoute.BuySell, onClick: openBuySell, diff --git a/packages/shared/src/locales/en.json b/packages/shared/src/locales/en.json index c793ec1965..1fcf8df979 100644 --- a/packages/shared/src/locales/en.json +++ b/packages/shared/src/locales/en.json @@ -2079,7 +2079,7 @@ "collectibles": "Collectibles", "governance": "Governance", "campaigns": "Campaigns", - "buySell": "Buy & Sell", + "buySell": "Buy IOTA", "developer": "Developer", "tokens": "Tokens", "settings": "Settings" From 5ce5aff85005460f27e037a370823ec354dbb403 Mon Sep 17 00:00:00 2001 From: Tuditi <45079109+Tuditi@users.noreply.github.com> Date: Mon, 19 Feb 2024 11:51:50 +0100 Subject: [PATCH 13/15] chore: cleanup unused drawer (#1955) Co-authored-by: Mark Nardi --- .../NetworkConfigRouterView.svelte | 3 - .../network-config-route.enum.ts | 1 - .../network-config/network-config.router.ts | 9 +-- .../views/ConnectLedgerDeviceDrawer.svelte | 62 ------------------- .../drawers/network-config/views/index.ts | 1 - 5 files changed, 1 insertion(+), 75 deletions(-) delete mode 100644 packages/desktop/views/dashboard/drawers/network-config/views/ConnectLedgerDeviceDrawer.svelte diff --git a/packages/desktop/views/dashboard/drawers/network-config/NetworkConfigRouterView.svelte b/packages/desktop/views/dashboard/drawers/network-config/NetworkConfigRouterView.svelte index 0a83f314eb..fb2e3ed6d3 100644 --- a/packages/desktop/views/dashboard/drawers/network-config/NetworkConfigRouterView.svelte +++ b/packages/desktop/views/dashboard/drawers/network-config/NetworkConfigRouterView.svelte @@ -8,7 +8,6 @@ ChainInformationDrawer, ConfirmLedgerEvmAddressDrawer, ConnectedChainsDrawer, - ConnectLedgerDeviceDrawer, EditChainDrawer, NetworkSettingsDrawer, RemoveChainDrawer, @@ -48,8 +47,6 @@ {:else if $networkConfigRoute === NetworkConfigRoute.ChainDepositAddress} -{:else if $networkConfigRoute === NetworkConfigRoute.ConnectLedgerDevice} - {:else if $networkConfigRoute === NetworkConfigRoute.ConfirmLedgerEvmAddress} {:else if $networkConfigRoute === NetworkConfigRoute.AddChain} diff --git a/packages/desktop/views/dashboard/drawers/network-config/network-config-route.enum.ts b/packages/desktop/views/dashboard/drawers/network-config/network-config-route.enum.ts index 79a8426e15..31d9fcf02c 100644 --- a/packages/desktop/views/dashboard/drawers/network-config/network-config-route.enum.ts +++ b/packages/desktop/views/dashboard/drawers/network-config/network-config-route.enum.ts @@ -5,7 +5,6 @@ export enum NetworkConfigRoute { NetworkSettings = 'networkSettings', ConfirmLedgerEvmAddress = 'confirmLedgerEvmAddress', ConnectedChains = 'connectedChains', - ConnectLedgerDevice = 'connectLedgerDevice', EditChain = 'editChain', RemoveChain = 'removeChain', } diff --git a/packages/desktop/views/dashboard/drawers/network-config/network-config.router.ts b/packages/desktop/views/dashboard/drawers/network-config/network-config.router.ts index f643bfe9d9..83d1d0de88 100644 --- a/packages/desktop/views/dashboard/drawers/network-config/network-config.router.ts +++ b/packages/desktop/views/dashboard/drawers/network-config/network-config.router.ts @@ -1,4 +1,4 @@ -import { get, writable } from 'svelte/store' +import { writable } from 'svelte/store' import { Router } from '@core/router' import { NetworkConfigRoute } from './network-config-route.enum' @@ -9,11 +9,4 @@ export class NetworkConfigRouter extends Router { constructor(initialRoute = NetworkConfigRoute.ConnectedChains) { super(initialRoute, networkConfigRoute) } - - previous(): void { - if (get(this.routeStore) === NetworkConfigRoute.ConfirmLedgerEvmAddress) { - this.filterHistory(NetworkConfigRoute.ConnectLedgerDevice) - } - super.previous() - } } diff --git a/packages/desktop/views/dashboard/drawers/network-config/views/ConnectLedgerDeviceDrawer.svelte b/packages/desktop/views/dashboard/drawers/network-config/views/ConnectLedgerDeviceDrawer.svelte deleted file mode 100644 index 9a891528ee..0000000000 --- a/packages/desktop/views/dashboard/drawers/network-config/views/ConnectLedgerDeviceDrawer.svelte +++ /dev/null @@ -1,62 +0,0 @@ - - - - -
- - {localize(`${LOCALE_BASE_PATH}.header`)} - {localize(`${LOCALE_BASE_PATH}.body`)} - - {#each requirements as [bool, locale], idx} -
- - {localize(`${LOCALE_BASE_PATH}.requirements.${locale}`)} -
- {#if idx < requirements.length - 1} -
- {/if} - {/each} -
-
-
- - - -{#if showTooltip} - -{/if} - - diff --git a/packages/shared/src/components/atoms/index.ts b/packages/shared/src/components/atoms/index.ts index a3b5486bd9..f45e6c81cc 100644 --- a/packages/shared/src/components/atoms/index.ts +++ b/packages/shared/src/components/atoms/index.ts @@ -3,6 +3,5 @@ export { default as BalanceSummarySection } from './BalanceSummarySection.svelte export { default as Icon } from './Icon.svelte' export { default as LedgerIllustration } from './LedgerIllustration.svelte' export { default as MediaDisplay } from './MediaDisplay.svelte' -export { default as MenuItem } from './MenuItem.svelte' export { default as Pane } from './Pane.svelte' export { default as Tabs } from './Tabs.svelte' diff --git a/packages/shared/src/components/molecules/MarkdownBlock.svelte b/packages/shared/src/components/molecules/MarkdownBlock.svelte index 6ae14944cf..7959dba48a 100644 --- a/packages/shared/src/components/molecules/MarkdownBlock.svelte +++ b/packages/shared/src/components/molecules/MarkdownBlock.svelte @@ -34,16 +34,9 @@ - From 5eab4c2ce1be2b8023ff32151185cc63b59f54db Mon Sep 17 00:00:00 2001 From: Tuditi <45079109+Tuditi@users.noreply.github.com> Date: Mon, 19 Feb 2024 11:57:08 +0100 Subject: [PATCH 15/15] Fix: outdated node on build (#1961) * chore: update @types/node * fix: update node version * feat: enable manual testing of build * Revert "chore: update @types/node" This reverts commit 44ed7796e163cafa8eb08e7a90e0f7776e3c928a. --------- Co-authored-by: Nicole O'Brien --- .github/workflows/build-test.yml | 1 + .github/workflows/reusable_build.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 327b077f6f..223e3a3708 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -4,6 +4,7 @@ on: schedule: # 12:00AM (UTC) Sunday - cron: '0 0 * * SUN' + workflow_dispatch: jobs: trigger-build: diff --git a/.github/workflows/reusable_build.yml b/.github/workflows/reusable_build.yml index bbe171b6e7..d6b1f4bb98 100644 --- a/.github/workflows/reusable_build.yml +++ b/.github/workflows/reusable_build.yml @@ -35,7 +35,7 @@ jobs: - name: Setup NodeJS uses: actions/setup-node@v1 with: - node-version: 18.15.0 + node-version: 18.19.1 # Used to read the `binding.gyp` file from `@iota/sdk` - name: Set up Python 3.10