Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/iotaledger/firefly into …
Browse files Browse the repository at this point in the history
…develop
  • Loading branch information
cvarley100 committed Apr 21, 2021
2 parents edaa355 + e582719 commit 484832b
Show file tree
Hide file tree
Showing 59 changed files with 3,698 additions and 2,705 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Firefly Desktop Alpha ${{ env.RELEASE_VERSION }}
release_name: Firefly Desktop ${{ env.RELEASE_VERSION }}
body_path: packages/desktop/CHANGELOG.md
draft: true
prerelease: true
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/bindings/node/native/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions packages/desktop/electron/lib/keychain.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ const Keychain = {
/**
* Service name — Key under which credentials will be stored.
*/
// TODO: Remove `Firefly Migration`
SERVICE_NAME: app.isPackaged ? 'Firefly Migration' : 'Firefly — Dev',
SERVICE_NAME: app.isPackaged ? 'Firefly' : 'Firefly — Dev',
/**
* Gets all credentials from keychain
*
Expand Down
32 changes: 20 additions & 12 deletions packages/desktop/electron/lib/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,30 @@ const buildTemplate = () => {
label: state.strings.diagnostics,
click: () => getOrInitWindow('main').webContents.send('menu-diagnostics'),
},
{
// TODO: Remove before stable release
label: "Developer Tools",
role: 'toggleDevTools'
},
{
label: state.strings.errorLog,
click: () => getOrInitWindow('main').webContents.send('menu-error-log')
},
{
type: 'separator',
},
]
}
]

if (!app.isPackaged) {
template[0].submenu.push(
{
label: "Developer Tools",
role: 'toggleDevTools'
}
)
}

template[0].submenu = template[0].submenu.concat([
{
label: state.strings.errorLog,
click: () => getOrInitWindow('main').webContents.send('menu-error-log')
},
{
type: 'separator',
},
]
)

if (process.platform === 'darwin') {
template[0].submenu = template[0].submenu.concat([
{
Expand Down
12 changes: 2 additions & 10 deletions packages/desktop/electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ const windows = {
about: null,
}

/**
* Set environment mode
*/
const devMode = process.env.NODE_ENV === 'development'

let paths = {
preload: '',
html: '',
Expand All @@ -61,8 +56,7 @@ const defaultWebPreferences = {
disableBlinkFeatures: 'Auxclick',
webviewTag: false,
enableWebSQL: false,
// TODO: Remove before stable
devTools: true,
devTools: !app.isPackaged,
}

if (app.isPackaged) {
Expand Down Expand Up @@ -155,12 +149,10 @@ function createWindow() {

mainWindowState.track(windows.main);

if (devMode) {
if (!app.isPackaged) {
// Enable dev tools only in developer mode
windows.main.webContents.openDevTools()
}

if (devMode) {
windows.main.loadURL('http://localhost:8080')
} else {
initAutoUpdate(windows.main)
Expand Down
6 changes: 3 additions & 3 deletions packages/desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "desktop",
"productName": "Firefly Migration",
"version": "0.4.0",
"productName": "Firefly",
"version": "1.0.0",
"description": "IOTA wallet desktop",
"main": "public/build/main.js",
"repository": "[email protected]:iotaledger/new-wallet.git",
Expand Down Expand Up @@ -47,7 +47,7 @@
"webpack-dev-server": "^3.11.2"
},
"build": {
"productName": "Firefly Migration",
"productName": "Firefly",
"artifactName": "firefly-desktop-${version}.${ext}",
"copyright": "IOTA Foundation",
"directories": {
Expand Down
3 changes: 1 addition & 2 deletions packages/desktop/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
http-equiv="Content-Security-Policy"
content="
default-src 'self';
connect-src 'self' https://*.iota.org https://*.iota.works https://*.iotatestmigration4.net https://*.iotatestmigration.net https://*.chrysalis2.com https://raw.githubusercontent.com/iotaledger/firefly/develop/packages/shared/lib/chrysalis.json;
connect-src 'self' https://*.iota.org https://*.iota.works https://*.iota.cafe https://raw.githubusercontent.com/iotaledger/firefly/develop/packages/shared/lib/chrysalis.json;
object-src 'none';
style-src 'self' 'unsafe-inline';"
/>
<!-- TODO: Remove iotatestmigration and chrysalis2-->
<title>Firefly</title>

<link rel="icon" type="image/png" href="/favicon.png" />
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop/scripts/notarize.macos.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ exports.default = async () => {

await notarize({
appBundleId: 'org.iota.firefly',
appPath: path.resolve(__dirname, '../out/mac/Firefly Migration.app'),
appPath: path.resolve(__dirname, '../out/mac/Firefly.app'),
appleId: APPLE_ID,
appleIdPassword: APPLE_ID_PASSWORD,
ascProvider: 'UG77RJKZHH',
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

18 changes: 8 additions & 10 deletions packages/shared/lib/migration.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { getOfficialNetwork } from 'shared/lib/network'
import { closePopup, openPopup } from 'shared/lib/popup'
import { activeProfile, updateProfile } from 'shared/lib/profile'
import { appRoute } from 'shared/lib/router'
Expand All @@ -10,9 +11,8 @@ import { derived, get, writable, Writable } from 'svelte/store'

export const LOG_FILE_NAME = 'migration.log'

export const MIGRATION_NODE = 'https://nodes-migration4-legacy.iota.cafe/'

export const PERMANODE = 'http://permanode-migration4.iota.cafe/api'
export const MIGRATION_NODES = ['https://nodes.iota.org', 'https://nodes.iota.cafe']
export const PERMANODE = 'https://chronicle.iota.org/api'

export const ADDRESS_SECURITY_LEVEL = 2

Expand Down Expand Up @@ -87,7 +87,7 @@ export const getMigrationData = (migrationSeed: string, initialAddressIndex = 0)
else {
api.getMigrationData(
migrationSeed,
[MIGRATION_NODE],
MIGRATION_NODES,
ADDRESS_SECURITY_LEVEL,
initialAddressIndex,
PERMANODE, {
Expand Down Expand Up @@ -163,7 +163,7 @@ export const sendMigrationBundle = (bundleHash: string, mwm = MINIMUM_WEIGHT_MAG
openSnapshotPopup()
}
else {
api.sendMigrationBundle([MIGRATION_NODE], bundleHash, mwm, {
api.sendMigrationBundle(MIGRATION_NODES, bundleHash, mwm, {
onSuccess(response) {
const { bundles } = get(migration);

Expand Down Expand Up @@ -588,8 +588,8 @@ export const confirmedBundles = derived(get(migration).bundles, (_bundles) => _b
/**
* List of chrysalis node endpoints to detect when is live
*/
// TODO: Update to mainnet chrysalis endpoint
export const CHRYSALIS_NODE_ENDPOINTS = ['https://api.lb-0.migration4.iotatestmigration4.net/api/v1/info']
export const CHRYSALIS_NODE_ENDPOINTS = ['https://chrysalis-nodes.iota.org/api/v1/info', 'https://chrysalis-nodes.iota.cafe/api/v1/info']

/**
* Default timeout for a request made to an endpoint
*/
Expand All @@ -603,7 +603,7 @@ const DEFAULT_CHRYSALIS_NODE_POLL_INTERVAL = 300000 // 5 minutes
* Mainnet ID used in a chrysalis node
*/
// TODO: Update to 'mainnet'
const MAINNET_ID = 'migration4'
const MAINNET_ID = getOfficialNetwork()

type ChrysalisNode = {
data: ChrysalisNodeData
Expand Down Expand Up @@ -715,8 +715,6 @@ export async function checkChrysalisSnapshot(): Promise<void> {
const requestOptions: RequestInit = {
headers: {
Accept: 'application/json',
pragma: 'no-cache',
'cache-control': 'no-cache',
}
}
const endpoint = CHRYSALIS_VARIABLES_ENDPOINT
Expand Down
22 changes: 14 additions & 8 deletions packages/shared/lib/network.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { writable } from 'svelte/store'
import type { Node } from './typings/client'
import { Network } from './typings/client'
import { isValidHttpsUrl, isValidUrl } from './utils'

const DEFAULT_NETWORK = 'chrysalis-mainnet'

// TODO: Update default nodes
const DEFAULT_NODES: Node[] = [
'https://api.lb-0.migration4.iotatestmigration4.net'
'https://chrysalis-nodes.iota.org',
'https://chrysalis-nodes.iota.cafe'
].map((url) => ({
url,
auth: {
Expand All @@ -13,11 +15,6 @@ const DEFAULT_NODES: Node[] = [
}
}))

/**
* Selected network during profile creation
*/
export const network = writable<Network>(Network.Testnet)

/**
* Check if a node url is valid
* @param {Node[]} nodesList: list of current nodes
Expand Down Expand Up @@ -55,4 +52,13 @@ export const isNodeUrlValid = (nodesList: Node[], newUrl: string): string | unde
*/
export const getOfficialNodes = () => {
return DEFAULT_NODES
}


/**
* Get the official network
* @returns The official network
*/
export const getOfficialNetwork = () => {
return DEFAULT_NETWORK
}
4 changes: 4 additions & 0 deletions packages/shared/lib/shell/walletApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ const storeCallbacks = (__id: string, type: ResponseTypes, callbacks?: Callbacks
*/
const handleError = (type: ErrorType | ValidatorErrorTypes, error: string): { type: ErrorType | ValidatorErrorTypes, error: string } => {
const newError = { type, message: error, time: Date.now() };

logError(newError)

// TODO: Add full type list to remove this temporary fix
Expand All @@ -236,6 +237,9 @@ const handleError = (type: ErrorType | ValidatorErrorTypes, error: string): { ty
if (error.includes('No synced node')) {
return ('error.node.noSynced')
}
if (error.includes('dns error')) {
return ('error.node.chrysalisNodeInactive')
}

return getErrorMessage(type)
}
Expand Down
9 changes: 1 addition & 8 deletions packages/shared/lib/typings/client.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
export enum Network {
Mainnet = 'mainnet',
Testnet = 'testnet',
Devnet = 'devnet',
Comnet = 'comnet',
}

export interface Node {
url: string
auth?: {
Expand All @@ -17,7 +10,7 @@ export interface Node {
export interface ClientOptions {
nodes?: Node[]
node?: Node
network?: Network
network?: string
localPow?: boolean
nodeSyncEnabled?: boolean
nodePoolUrls?: string[]
Expand Down
41 changes: 24 additions & 17 deletions packages/shared/lib/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { stripTrailingSlash } from 'shared/lib/helpers'
import { localize } from 'shared/lib/i18n'
import type { PriceData } from 'shared/lib/marketData'
import { HistoryDataProps } from 'shared/lib/marketData'
import { getOfficialNodes, network } from 'shared/lib/network'
import { getOfficialNetwork, getOfficialNodes } from 'shared/lib/network'
import { showAppNotification, showSystemNotification } from 'shared/lib/notifications'
import { activeProfile, isStrongholdLocked, updateProfile } from 'shared/lib/profile'
import type { Account, Account as BaseAccount, AccountToCreate, Balance, SyncedAccount } from 'shared/lib/typings/account'
Expand Down Expand Up @@ -409,13 +409,14 @@ export const asyncRestoreBackup = (importFilePath, password) => {
export const asyncCreateAccount = () => {
return new Promise<void>((resolve, reject) => {
const officialNodes = getOfficialNodes()
const officialNetwork = getOfficialNetwork()
api.createAccount(
{
signerType: { type: 'Stronghold' },
clientOptions: {
nodes: officialNodes,
node: officialNodes[Math.floor(Math.random() * officialNodes.length)],
network: get(network),
network: officialNetwork
},
alias: `${localize('general.account')} 1`
},
Expand Down Expand Up @@ -1460,10 +1461,16 @@ export const updateAccountNetworkSettings = async (automaticNodeSelection, inclu
)
},
onError(err) {
showAppNotification({
type: 'error',
message: localize(err.error),
})
const shouldHideErrorNotification =
err && err.type === 'ClientError' && err.error === 'error.node.chrysalisNodeInactive'

if (!shouldHideErrorNotification) {
showAppNotification({
type: 'error',
message: localize(err.error),
})
}

},
}
)
Expand Down Expand Up @@ -1561,9 +1568,9 @@ export const getMilestoneMessageValue = (payload: Payload, accounts) => {
* Get incoming flag from message
* @returns
*/
export const getIncomingFlag = (payload: Payload) => {
export const getIncomingFlag = (payload: Payload) => {
if (payload?.type === "Transaction") {
return payload.data.essence.data.incoming
return payload.data.essence.data.incoming
}

return undefined
Expand All @@ -1573,19 +1580,19 @@ export const getMilestoneMessageValue = (payload: Payload, accounts) => {
* Set incoming flag on the message
* @returns
*/
export const setIncomingFlag = (payload: Payload, incoming: boolean) => {
export const setIncomingFlag = (payload: Payload, incoming: boolean) => {
if (payload?.type === "Transaction") {
payload.data.essence.data.incoming = incoming
payload.data.essence.data.incoming = incoming
}
}
}

/**
* Get internal flag from message
* @returns
*/
export const getInternalFlag = (payload: Payload) => {
/**
* Get internal flag from message
* @returns
*/
export const getInternalFlag = (payload: Payload) => {
if (payload?.type === "Transaction") {
return payload.data.essence.data.internal
return payload.data.essence.data.internal
}

return undefined
Expand Down
Loading

0 comments on commit 484832b

Please sign in to comment.