Skip to content

Commit

Permalink
chore & fix: update code for shimmer app (#7495)
Browse files Browse the repository at this point in the history
* chore & fix: update code for shimmer app

Co-authored-by: cpl121 <[email protected]>
Co-authored-by: Marc Espín <[email protected]>

* fix: cache invalidation mask

---------

Co-authored-by: cpl121 <[email protected]>
Co-authored-by: Marc Espín <[email protected]>
  • Loading branch information
3 people authored Sep 29, 2023
1 parent c05d3f9 commit 96dffdf
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 65 deletions.
25 changes: 13 additions & 12 deletions .github/workflows/build-and-release-desktop.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Build and Release Desktop

env:
NETWORK: IOTA
NETWORK_CODE: iota
NETWORK: Shimmer
NETWORK_CODE: shimmer

on:
push:
tags:
- desktop-iota-*
- desktop-shimmer-*
workflow_dispatch:
inputs:
debugElectronBuilder:
Expand Down Expand Up @@ -39,7 +39,7 @@ jobs:
- id: set_outputs
name: Set outputs for version, release name, and stage
run: |
VERSION=${GITHUB_REF#refs/*/desktop-iota-}
VERSION=${GITHUB_REF#refs/*/desktop-shimmer-}
RELEASE_NAME=$(echo $VERSION | perl -0777 -pe 's/^([0-9]\d*\.[0-9]\d*\.[0-9]\d*)(?:-([a-z]*)-(\d*))?$/$1 \u$2 $3/')
STAGE=$(echo $VERSION | perl -0777 -pe 's/^([0-9]\d*\.[0-9]\d*\.[0-9]\d*)(?:-([a-z]*)-([0-9]\d*(\.[0-9]\d*)*))?$/$2/')
Expand Down Expand Up @@ -198,7 +198,7 @@ jobs:
name: firefly-desktop-${{ matrix.os }}
path: |
packages/desktop/out/firefly-*
packages/desktop/out/latest*
packages/desktop/out/shimmer*
release:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -307,15 +307,16 @@ jobs:

- name: Upload to S3
run: |
aws s3 cp assets/ s3://firefly-private/firefly/releases/ --recursive --include "*" --exclude "*.sha256" --exclude "*.blockmap" --exclude "*.asc" --acl public-read
aws s3 cp assets/ s3://iotaledger-files/4a1ddea1-10c1-4f1d-83f0-e14903931a46/releases/ --recursive --include "*" --exclude "*.sha256" --exclude "*.blockmap" --exclude "*.asc" --acl public-read
aws s3 cp assets/ s3://iotaledger-files/firefly/releases/ --recursive --include "*" --exclude "*.sha256" --exclude "*.blockmap" --exclude "*.asc" --acl public-read
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: eu-central-1

#- name: Invalidate CloudFront cache for auto-update files
#run: aws cloudfront create-invalidation --distribution-id E32G4HRED4PO65 --paths "/latest*"
#env:
#AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
#AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
#AWS_DEFAULT_REGION: eu-central-1
- name: Invalidate CloudFront cache for auto-update files
run: aws cloudfront create-invalidation --distribution-id E32G4HRED4PO65 --paths "/shimmer*"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: eu-central-1
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<a href=""><img src="header.png"></a>
</h1>

<h2 align="center">Firefly</h2>
<h2 align="center">Firefly Shimmer</h2>

<p align="center">
<a href="https://discord.iota.org/" style="text-decoration:none;"><img src="https://img.shields.io/badge/Discord-9cf.svg?logo=discord" alt="Discord"></a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { UnlockCondition, UnlockConditionType, OutputType, CommonOutput } from '@iota/sdk/out/types'
import { BalanceSummarySection, Button, FontWeight, Text, TextType } from 'shared/components'
import { TextHintVariant } from 'shared/components/enums'
import features from '@features/features'
interface BalanceBreakdown {
amount: number
Expand Down Expand Up @@ -38,7 +39,7 @@
pending: pendingBreakdown,
locked: lockedBreakdown,
storageDeposit: storageDepositBreakdown,
vesting: vestingBreakdown,
...(features.vesting.enabled && { vesting: vestingBreakdown }),
}
}
Expand Down
75 changes: 36 additions & 39 deletions packages/desktop/features/onboarding.features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@ import type { IOnboardingFeaturesForNetwork } from '@lib/features/interfaces'
import type { OnboardingFeatures } from '@lib/features/types'

const onboardingFeaturesForIota: IOnboardingFeaturesForNetwork = {
enabled: true,
hidden: false,
enabled: false,
hidden: true,
newProfile: {
enabled: true,
enabled: false,
softwareProfile: {
enabled: true,
enabled: false,
},
ledgerProfile: {
enabled: true,
enabled: false,
},
},
restoreProfile: {
enabled: true,
enabled: false,
recoveryPhrase: {
enabled: true,
enabled: false,
},
strongholdBackup: {
enabled: true,
enabled: false,
},
ledgerBackup: {
enabled: true,
enabled: false,
},
},
claimRewards: {
enabled: false,
hidden: true,
hidden: false,
recoveryPhrase: {
enabled: false,
},
Expand All @@ -40,10 +40,9 @@ const onboardingFeaturesForIota: IOnboardingFeaturesForNetwork = {
},
}

const IS_ALPHANET_ENABLED = process.env.STAGE !== 'prod'
const onboardingFeaturesForIotaAlphanet: IOnboardingFeaturesForNetwork = {
enabled: IS_ALPHANET_ENABLED,
hidden: !IS_ALPHANET_ENABLED,
enabled: false,
hidden: true,
newProfile: {
enabled: true,
softwareProfile: {
Expand Down Expand Up @@ -81,79 +80,77 @@ const onboardingFeaturesForIotaAlphanet: IOnboardingFeaturesForNetwork = {
}

const onboardingFeaturesForShimmer: IOnboardingFeaturesForNetwork = {
enabled: false,
hidden: true,
enabled: true,
newProfile: {
enabled: false,
enabled: true,
softwareProfile: {
enabled: false,
enabled: true,
},
ledgerProfile: {
enabled: false,
enabled: true,
},
},
restoreProfile: {
enabled: false,
enabled: true,
recoveryPhrase: {
enabled: false,
enabled: true,
},
strongholdBackup: {
enabled: false,
enabled: true,
},
ledgerBackup: {
enabled: false,
enabled: true,
},
},
claimRewards: {
enabled: false,
enabled: true,
hidden: false,
recoveryPhrase: {
enabled: false,
enabled: true,
},
strongholdBackup: {
enabled: false,
enabled: true,
},
ledgerBackup: {
enabled: false,
enabled: true,
},
},
}

const onboardingFeaturesForTestnet: IOnboardingFeaturesForNetwork = {
enabled: false,
hidden: true,
enabled: true,
newProfile: {
enabled: false,
enabled: true,
softwareProfile: {
enabled: false,
enabled: true,
},
ledgerProfile: {
enabled: false,
enabled: true,
},
},
restoreProfile: {
enabled: false,
enabled: true,
recoveryPhrase: {
enabled: false,
enabled: true,
},
strongholdBackup: {
enabled: false,
enabled: true,
},
ledgerBackup: {
enabled: false,
enabled: true,
},
},
claimRewards: {
enabled: false,
enabled: true,
hidden: false,
recoveryPhrase: {
enabled: false,
enabled: true,
},
strongholdBackup: {
enabled: false,
enabled: true,
},
ledgerBackup: {
enabled: false,
enabled: true,
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop/features/vesting.features.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IVestingFeatures } from '@lib/features/interfaces'

const vestingFeatures: IVestingFeatures = {
enabled: true,
enabled: false,
}

export default vestingFeatures
28 changes: 19 additions & 9 deletions packages/desktop/product.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/* eslint-disable */
const PRODUCT_NAME = 'Firefly'
const NETWORK = 'iota'
const PRODUCT_NAME = 'Firefly Shimmer'
const NETWORK = 'shimmer'

const STAGE = process.env.STAGE || 'alpha'
const APP_ID = getAppId()
const APP_PROTOCOL = getAppProtocol()
const CHANNEL_NAME = getChannelName()
const APP_ARTIFACT = getAppArtifact()
const appNameBase = STAGE === 'prod' ? PRODUCT_NAME : `${PRODUCT_NAME} ${STAGE.replace(/^\w/, (c) => c.toUpperCase())}`
const appNameBase =
STAGE === 'prod' ? PRODUCT_NAME : `${PRODUCT_NAME} - ${STAGE.replace(/^\w/, (c) => c.toUpperCase())}`

function getAppArtifact() {
return `firefly-${NETWORK}-desktop-\${version}.\${ext}`
Expand All @@ -22,7 +23,7 @@ function getKeychainServiceName(isPackaged) {
if (isPackaged) {
return appNameBase
} else {
return `${PRODUCT_NAME} — Dev`
return `Firefly — Dev`
}
}

Expand All @@ -42,25 +43,34 @@ function getAppName(isPackaged = true) {
/**
* If stage = 'prod' -> 'iota'
* If stage = 'alpha' -> 'iota-alpha'
* If network = 'iota' -> 'iota',
* If network = 'shimmer' -> 'firefly'
*/
function getAppProtocol() {
return STAGE === 'prod' ? 'iota' : `iota-${STAGE.toLowerCase()}`
return STAGE === 'prod' ? 'firefly' : `firefly-${STAGE.toLowerCase()}`
}

/**
* If stage = 'prod' -> 'org.iota.firefly'
* If stage = 'alpha' -> 'org.iota.firefly.alpha'
* If stage = 'prod' -> 'org.iota.firefly-shimmer'
* If stage = 'alpha' -> 'org.iota.firefly-shimmer.alpha'
*/
function getAppId() {
const defaultAppId = 'org.iota.firefly'
const defaultAppId = 'org.iota.firefly-shimmer'
if (STAGE === 'prod') {
return defaultAppId
}
return `${defaultAppId}.${STAGE}`
}

function getChannelName() {
return 'latest'
switch (STAGE) {
case 'alpha':
return 'shimmer-alpha'
case 'beta':
return 'shimmer-beta'
default:
return 'shimmer'
}
}

module.exports = {
Expand Down
4 changes: 2 additions & 2 deletions packages/desktop/views/dashboard/Dashboard.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { handleDeepLink } from '@auxiliary/deep-link'
import { localize } from '@core/i18n'
import { nodeInfo } from '@core/network'
import { nodeInfo, NetworkId } from '@core/network'
import {
activeProfile,
hasStrongholdLocked,
Expand Down Expand Up @@ -108,7 +108,7 @@
})
}
if (!$isAwareOfMetricSystemDrop) {
if (!$isAwareOfMetricSystemDrop && $activeProfile?.network?.id === NetworkId.Iota) {
openPopup({
id: PopupId.MetricSystemInfo,
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,25 @@ export const DEFAULT_NETWORK_METADATA: Readonly<{ [key in NetworkId]?: NetworkMe
},
baseToken: DEFAULT_BASE_TOKEN[NetworkId.Shimmer],
},
[NetworkId.Testnet]: <IStardustNetworkMetadata>{
id: NetworkId.Testnet,
name: 'Testnet',
coinType: COIN_TYPE[NetworkId.Testnet],
protocol: {
version: 2,
networkName: 'testnet',
bech32Hrp: 'rms',
minPowScore: 1500,
belowMaxDepth: 15,
rentStructure: {
vByteCost: 100,
vByteFactorData: 1,
vByteFactorKey: 10,
},
tokenSupply: TokenSupply.Testnet,
},
baseToken: DEFAULT_BASE_TOKEN[NetworkId.Testnet],
},
[NetworkId.Iota]: <IStardustNetworkMetadata>{
id: NetworkId.Iota,
name: 'IOTA',
Expand Down
4 changes: 4 additions & 0 deletions packages/shared/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
"title": "Shimmer",
"body": "Staging network for IOTA"
},
"testnet": {
"title": "Testnet",
"body": "Public beta network for Shimmer"
},
"iota": {
"title": "IOTA",
"body": "IOTA Mainnet"
Expand Down

0 comments on commit 96dffdf

Please sign in to comment.