diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b1da137b7..4ca3cf2cb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,30 @@ ### Fixes +- Ensured non-recommended decimal place setting alert is correctly shown ([PR 3007](https://github.com/input-output-hk/daedalus/pull/3007)) +- Disabled the possibility to choose a syncing wallet for ITN rewards and delegation ([PR 3015](https://github.com/input-output-hk/daedalus/pull/3015)) + +### Chores + +- Updated cardano-node to 1.35.2 ([PR 3021](https://github.com/input-output-hk/daedalus/pull/3021)) +- Fix `darwin-launcher.go` to replace its process image with `cardano-launcher` (binary), and not swallow `stdout` ([PR 3023](https://github.com/input-output-hk/daedalus/pull/3023)) +- Updated cardano-node to 1.35.1 ([PR 3012](https://github.com/input-output-hk/daedalus/pull/3012)) + +### Features + +- Updated Terms of Service ([PR 3009](https://github.com/input-output-hk/daedalus/pull/3009)) + +## 4.12.0 + +### Fixes + - Fixed downloaded installer being left in Downloads after latest update installs ([PR 2941](https://github.com/input-output-hk/daedalus/pull/2941)) - Fixed incorrect amount of token sent ([PR 2962](https://github.com/input-output-hk/daedalus/pull/2962)) ### Chores +- Made Windows installer more resilient w.r.t. auto-updates ([PR 3017](https://github.com/input-output-hk/daedalus/pull/3017)) +- Added OS-architecture tuple to installer file names to help with releases ([PR 3016](https://github.com/input-output-hk/daedalus/pull/3016)) - Added Vasil-supported cardano-wallet ([PR 3001](https://github.com/input-output-hk/daedalus/pull/3001)) - Upgraded webpack to version 5 ([PR 2772](https://github.com/input-output-hk/daedalus/pull/2772)) diff --git a/default.nix b/default.nix index 3185155066..5db33408d8 100644 --- a/default.nix +++ b/default.nix @@ -72,7 +72,20 @@ let cardanoLib = localLib.iohkNix.cardanoLib; daedalus-bridge = self.bridgeTable.${nodeImplementation}; - nodejs = pkgs.nodejs-16_x; + nodejs = let + njPath = pkgs.path + "/pkgs/development/web/nodejs"; + buildNodeJs = pkgs.callPackage (import (njPath + "/nodejs.nix")) { + python = pkgs.python3; + icu = pkgs.icu68; # can’t build against ICU 69: + }; + in + buildNodeJs { + enableNpm = true; + version = "14.17.0"; + sha256 = "1vf989canwcx0wdpngvkbz2x232yccp7fzs1vcbr60rijgzmpq2n"; + patches = pkgs.lib.optional pkgs.stdenv.isDarwin (njPath + "/bypass-xcodebuild.diff"); + }; + nodePackages = pkgs.nodePackages.override { nodejs = self.nodejs; }; yarnInfo = { version = "1.22.4"; @@ -302,7 +315,7 @@ let signed-windows-installer = let backend_version = self.daedalus-bridge.wallet-version; frontend_version = (builtins.fromJSON (builtins.readFile ./package.json)).version; - fullName = "daedalus-${frontend_version}-${cluster}${buildNumSuffix}.exe"; # must match to packageFileName in make-installer + fullName = "daedalus-${frontend_version}-${cluster}${buildNumSuffix}-x86_64-windows.exe"; # must match to packageFileName in make-installer in pkgs.runCommand "signed-windows-installer-${cluster}" {} '' mkdir $out cp -v ${self.signFile "${self.unsigned-windows-installer}/${fullName}"} $out/${fullName} @@ -419,7 +432,7 @@ let version = (builtins.fromJSON (builtins.readFile ./package.json)).version; backend = "cardano-wallet-${nodeImplementation}"; suffix = if buildNum == null then "" else "-${toString buildNum}"; - fn = "daedalus-${version}-${self.linuxClusterBinName}${suffix}.bin"; + fn = "daedalus-${version}-${self.linuxClusterBinName}${suffix}-x86_64-linux.bin"; in pkgs.runCommand fn {} '' mkdir -p $out cp ${self.newBundle} $out/${fn} diff --git a/installers/common/Types.hs b/installers/common/Types.hs index 1f7283569f..e1a8921ee4 100644 --- a/installers/common/Types.hs +++ b/installers/common/Types.hs @@ -42,6 +42,7 @@ import Turtle (pwd, cd) import Turtle.Format (format, fp) import Data.Aeson (FromJSON(..), withObject, eitherDecode, (.:), genericParseJSON, defaultOptions) import qualified Data.ByteString.Lazy.Char8 as L8 +import qualified System.Info data OS = Linux64 @@ -113,7 +114,7 @@ packageFileName :: OS -> Cluster -> Version -> Backend -> Text -> Maybe BuildJob packageFileName _os cluster ver backend _backendVer build = fromText name <.> ext where name = T.intercalate "-" parts - parts = ["daedalus", fromVer ver, lshowText cluster] ++ build' + parts = ["daedalus", fromVer ver, lshowText cluster] ++ build' ++ [archOS] _backend' = case backend of Cardano _ -> "cardano-wallet" ext = case _os of @@ -124,6 +125,13 @@ packageFileName _os cluster ver backend _backendVer build = fromText name <.> ex Win64 -> "windows" Macos64 -> "macos" Linux64 -> "linux" + archOS = case _os of + Win64 -> "x86_64-windows" + Macos64 -> + if System.Info.arch == "aarch64" + then "aarch64-darwin" + else "x86_64-darwin" + Linux64 -> "x86_64-linux" build' = maybe [] (\b -> [fromBuildJob b]) build instance FromJSON Version where diff --git a/installers/common/WindowsInstaller.hs b/installers/common/WindowsInstaller.hs index acf605fda2..c59a2a1706 100644 --- a/installers/common/WindowsInstaller.hs +++ b/installers/common/WindowsInstaller.hs @@ -20,7 +20,8 @@ import Development.NSIS (Attrib (IconFile, IconIndex, RebootOK, Recurs name, nsis, onPagePre, onError, outFile, page, readRegStr, requestExecutionLevel, rmdir, section, setOutPath, str, strLength, uninstall, unsafeInject, unsafeInjectGlobal, - loadLanguage, + loadLanguage, sleep, (@=), detailPrint, (%<), (%&&), + not_, mutableInt_, mutable_, while, false, true, strShow, (&), writeRegDWORD, writeRegStr, (%/=), fileExists) import Prelude ((!!)) import qualified System.IO as IO @@ -185,9 +186,30 @@ writeInstallerNSIS outName (Version fullVersion') InstallerConfig{installDirecto createDirectory "$APPDATA\\$InstallDir\\Secrets-1.0" createDirectory "$APPDATA\\$InstallDir\\Logs" createDirectory "$APPDATA\\$InstallDir\\Logs\\pub" - onError (delete [] "$APPDATA\\$InstallDir\\daedalus_lockfile") $ - --abort "$SpacedName $(AlreadyRunning)" - unsafeInject $ T.unpack $ "Abort \" " <> installDirectory <> "$(AlreadyRunning)\"" + + -- XXX: sometimes during auto-update, it takes longer for Daedalus to exit, + -- and cardano-launcher.exe’s lockfile to be unlocked (deletable), so + -- let’s loop waiting for this to happen: + let waitSeconds = 30 + lockfileCounter <- mutableInt_ 0 + lockfileDeleted <- mutable_ false + while ((lockfileCounter %< waitSeconds) %&& (not_ lockfileDeleted)) $ do + detailPrint ( + "Checking if Daedalus is not running (" + Development.NSIS.& strShow (lockfileCounter + 1) + Development.NSIS.& "/" + Development.NSIS.& strShow waitSeconds + Development.NSIS.& ")..." + ) + lockfileDeleted @= true + onError (delete [] "$APPDATA\\$InstallDir\\daedalus_lockfile") $ do + lockfileDeleted @= false + iff_ (not_ lockfileDeleted) $ do + sleep 1000 -- milliseconds + lockfileCounter @= lockfileCounter + 1 + iff_ (not_ (lockfileDeleted)) $ do + unsafeInject $ T.unpack $ "Abort \"" <> installDirectory <> " $(AlreadyRunning)\"" + iff_ (fileExists "$APPDATA\\$InstallDir\\Wallet-1.0\\open\\*.*") $ rmdir [] "$APPDATA\\$InstallDir\\Wallet-1.0\\open" case oBackend of diff --git a/installers/nix/electron.nix b/installers/nix/electron.nix index f2850de6c5..26b5ee8b8e 100644 --- a/installers/nix/electron.nix +++ b/installers/nix/electron.nix @@ -1,8 +1,8 @@ { stdenv, lib, makeWrapper, fetchurl, unzip, atomEnv, libuuid, at-spi2-atk, at_spi2_core, libxshmfence, - libxkbcommon }: + libxkbcommon, runCommand, binutils-unwrapped }: let - version = "13.6.3"; + version = (builtins.fromJSON (builtins.readFile ../../package.json)).dependencies.electron; name = "electron-${version}"; throwSystem = throw "Unsupported system: ${stdenv.hostPlatform.system}"; diff --git a/nix/darwin-launcher.go b/nix/darwin-launcher.go index 1fb0ec7642..82fb29f3c8 100644 --- a/nix/darwin-launcher.go +++ b/nix/darwin-launcher.go @@ -5,9 +5,12 @@ import ( "os" "os/exec" "path/filepath" + "syscall" ) func main() { + fmt.Fprintf(os.Stderr, "darwin-launcher: PID = %d\n", os.Getpid()) + ex, err := os.Executable() if err != nil { panic(err) @@ -17,14 +20,23 @@ func main() { os.Setenv("PATH", fmt.Sprintf("%s:%s", installDir, os.Getenv("PATH"))) - launcherConfig := filepath.Join(installDir, "../Resources/launcher-config.yaml") - helper := filepath.Join(installDir, "../Resources/helper") - + launcherConfigPath := filepath.Join(installDir, "../Resources/launcher-config.yaml") + helperPath := filepath.Join(installDir, "../Resources/helper") - if err = exec.Command(helper).Run(); err != nil { + helperCmd := exec.Command(helperPath) + helperCmd.Stdout = os.Stdout + helperCmd.Stderr = os.Stderr + if err := helperCmd.Run(); err != nil { panic(err) } - if err = exec.Command("cardano-launcher", "--config", launcherConfig).Run(); err != nil { - panic(err) + + // Replace the current process (otherwise WDIO complains in end-to-end tests): + img := filepath.Join(installDir, "cardano-launcher") + argv := []string{"cardano-launcher", "--config", launcherConfigPath} + env := os.Environ() + if err := syscall.Exec(img, argv, env); err != nil { + fmt.Println(err) } + + fmt.Fprintf(os.Stderr, "this won’t happen\n") } diff --git a/nix/sources.json b/nix/sources.json index 4880b080af..550be4bff2 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -1,14 +1,14 @@ { "cardano-node": { - "branch": "tags/1.35.0", + "branch": "tags/1.35.2", "description": null, "homepage": null, "owner": "input-output-hk", "repo": "cardano-node", - "rev": "9f1d7dc163ee66410d912e48509d6a2300cfa68a", - "sha256": "06arx9hv7dn3qxfy83f0b6018rxbsvh841nvfyg5w6qclm1hddj7", + "rev": "7612a245a6e2c51d0f1c3e0d65d7fe9363850043", + "sha256": "01a5qdrmsag18s2mlf8axfbrag59j2fp6xyc89pwmzgs7x77ldsr", "type": "tarball", - "url": "https://github.com/input-output-hk/cardano-node/archive/9f1d7dc163ee66410d912e48509d6a2300cfa68a.tar.gz", + "url": "https://github.com/input-output-hk/cardano-node/archive/7612a245a6e2c51d0f1c3e0d65d7fe9363850043.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "cardano-shell": { @@ -24,15 +24,15 @@ "url_template": "https://github.com///archive/.tar.gz" }, "cardano-wallet": { - "branch": "v2022-07-01", + "branch": "master", "description": "Official Wallet Backend & API for Cardano decentralized", "homepage": null, "owner": "input-output-hk", "repo": "cardano-wallet", - "rev": "211c357a91d48b30fdf77a3a169499b38822f9cd", - "sha256": "0ii631ak757kjzs7jm625zfv2g28ffjrfkmgslxbbgvwpqxkdbaj", + "rev": "7ed8f067dd6d5dc78e7353bf65ea5e3423cdfca8", + "sha256": "1f9lwqi4qghaqi3754732h0cz98f7qbjhcx416jliqy6nibly6lp", "type": "tarball", - "url": "https://github.com/input-output-hk/cardano-wallet/archive/211c357a91d48b30fdf77a3a169499b38822f9cd.tar.gz", + "url": "https://github.com/input-output-hk/cardano-wallet/archive/7ed8f067dd6d5dc78e7353bf65ea5e3423cdfca8.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "flake-compat": { diff --git a/nix/yarn-nix-shell.sh b/nix/yarn-nix-shell.sh index bccb6bf67e..7f0d1b70b5 100755 --- a/nix/yarn-nix-shell.sh +++ b/nix/yarn-nix-shell.sh @@ -29,5 +29,9 @@ if [ -z "$command" ] ; then fi export NETWORK + +# Prevent segfaults on Darwin in `GC_*` code: +export GC_DONT_GC=1 + # `return` will make the user stay in `nix-shell` after the initial command finishes: exec nix-shell --argstr nodeImplementation cardano --argstr cluster "$cluster" --command "$command ; return" diff --git a/package.json b/package.json index a73d5e9b6d..dd2d2a7dcc 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "daedalus", "productName": "Daedalus", - "version": "4.11.0", + "version": "4.12.0", "description": "Cryptocurrency Wallet", "main": "./dist/main/index.js", "scripts": { @@ -13,7 +13,7 @@ "build:main": "yarn webpack -c source/main/webpack.config.js --progress", "build:renderer": "yarn webpack -c source/renderer/webpack.config.js --progress", "build:cleanup": "rimraf ./dist", - "build:electron": "electron-rebuild -w usb --useCache -s --debug", + "build:electron": "electron-rebuild --useCache && electron-rebuild -w usb --useCache -s --debug", "check:all": "yarn prettier:check && yarn lint && yarn compile && yarn stylelint && yarn lockfile:check && yarn i18n:manage && yarn storybook:build", "start": "yarn electron ./", "start:dev": "nodemon --watch 'dist/main' --exec 'NODE_ENV=development yarn start'", diff --git a/release.nix b/release.nix index db66536d79..5ff3f8589e 100644 --- a/release.nix +++ b/release.nix @@ -69,8 +69,11 @@ in { in { daedalus-installer = allArchesNoWindows; yaml2json = allArchesNoWindows; + nodejs = allArchesNoWindows; bridgeTable = { cardano = allArches; }; cardano-node = allArches; -})) +})) // { + recurseForDerivations = {}; +} diff --git a/scripts/postinstall.sh b/scripts/postinstall.sh index b361f58733..8cca006fed 100755 --- a/scripts/postinstall.sh +++ b/scripts/postinstall.sh @@ -2,4 +2,9 @@ if [[ "$CI" != "true" ]]; then yarn lockfile:fix + + # Let’s patch electron-rebuild to force correct Node.js headers to + # build native modules against even in `nix-shell`, otherwise, it + # doesn’t work reliably. + eval "$(nix-build -A rawapp.patchElectronRebuild)" fi diff --git a/shell.nix b/shell.nix index 5ca4b7df42..0861398bfc 100644 --- a/shell.nix +++ b/shell.nix @@ -111,16 +111,6 @@ let ln -svf $(type -P cardano-node) ln -svf $(type -P cardano-wallet) ln -svf $(type -P cardano-cli) - mkdir -p ${BUILDTYPE}/ - ${let - # (TODO: investigate why – @michalrus) - sourceBUILDTYPE = "Release"; - in '' - ln -svf $PWD/node_modules/usb/build/${sourceBUILDTYPE}/usb_bindings.node ${BUILDTYPE}/ - ln -svf $PWD/node_modules/node-hid/build/${sourceBUILDTYPE}/HID.node ${BUILDTYPE}/ - ln -svf $PWD/node_modules/node-hid/build/${sourceBUILDTYPE}/HID_hidraw.node ${BUILDTYPE}/ - ln -svf $PWD/node_modules/usb-detection/build/${sourceBUILDTYPE}/detection.node ${BUILDTYPE}/ - ''} ${pkgs.lib.optionalString (nodeImplementation == "cardano") '' source <(cardano-node --bash-completion-script `type -p cardano-node`) @@ -135,14 +125,51 @@ let '' } yarn install --frozen-lockfile + + # Rebuild native modules for : + find Debug/ Release/ -name '*.node' | xargs rm -v || true yarn build:electron + + ${let + # Several native modules have to be linked in ${BUILDTYPE}/ in + # root directory, for `yarn dev` to work correctly. If a Debug + # version of such extension exists, we use it, otherwise, we + # use Release: + tryLink = dependency: fileName: '' + symlinkTarget=$(ls 2>/dev/null -d \ + "$PWD/node_modules/${dependency}/build/Debug/${fileName}" \ + "$PWD/node_modules/${dependency}/build/Release/${fileName}" \ + | head -1 + ) + + if [ -z "$symlinkTarget" ] ; then + echo >&2 "error: symlink target not found: ‘${fileName}’ in ‘${dependency}’" + # ~exit 1~ — do not exit, let the person fix from inside `nix-shell` + fi + + ${localLib.optionalString pkgs.stdenv.isLinux '' + ${pkgs.patchelf}/bin/patchelf --set-rpath ${pkgs.lib.makeLibraryPath [ + pkgs.stdenv.cc.cc pkgs.udev + ]} "$symlinkTarget" + ''} + + mkdir -p ${BUILDTYPE}/ + ln -svf "$symlinkTarget" ${BUILDTYPE}/ + unset symlinkTarget + ''; + in '' + ${tryLink "usb" "usb_bindings.node"} + ${tryLink "usb-detection" "detection.node"} + ${tryLink "node-hid" "HID.node"} + ${localLib.optionalString pkgs.stdenv.isLinux '' + ${tryLink "node-hid" "HID_hidraw.node"} + ''} + ''} + ${localLib.optionalString pkgs.stdenv.isLinux '' - ${pkgs.patchelf}/bin/patchelf --set-rpath ${pkgs.lib.makeLibraryPath [ pkgs.stdenv.cc.cc pkgs.udev ]} ${BUILDTYPE}/usb_bindings.node - ${pkgs.patchelf}/bin/patchelf --set-rpath ${pkgs.lib.makeLibraryPath [ pkgs.stdenv.cc.cc pkgs.udev ]} ${BUILDTYPE}/HID.node - # TODO: is this needed for `detection.node`? - ${pkgs.patchelf}/bin/patchelf --set-rpath ${pkgs.lib.makeLibraryPath [ pkgs.stdenv.cc.cc pkgs.udev ]} ${BUILDTYPE}/detection.node ln -svf ${daedalusPkgs.electron}/bin/electron ./node_modules/electron/dist/electron ''} + echo 'jq < $LAUNCHER_CONFIG' echo debug the node by running debug-node ''; diff --git a/source/common/types/logging.types.ts b/source/common/types/logging.types.ts index e8d93af11e..eaf3c2930e 100644 --- a/source/common/types/logging.types.ts +++ b/source/common/types/logging.types.ts @@ -14,8 +14,8 @@ import type { } from '../../renderer/app/api/wallets/types'; import type { Address } from '../../renderer/app/api/addresses/types'; import type { GetTransactionsRequest } from '../../renderer/app/api/transactions/types'; -import type { HardwareWalletLocalData } from '../../renderer/app/api/utils/localStorage'; import type { AdaApiStakePool } from '../../renderer/app/api/staking/types'; +import { HardwareWalletLocalData } from '../../renderer/app/types/localDataTypes'; export type LoggingLevel = 'debug' | 'info' | 'error' | 'warn'; export type Logger = { diff --git a/source/main/environment.ts b/source/main/environment.ts index 01f7cc882f..2f7f1f7ac6 100644 --- a/source/main/environment.ts +++ b/source/main/environment.ts @@ -47,7 +47,7 @@ const isDevelopment = checkIsDevelopment(NETWORK); const analyticsFeatureEnabled = isMainnet || isStaging || isTestnet; const keepLocalClusterRunning = process.env.KEEP_LOCAL_CLUSTER_RUNNING; const API_VERSION = process.env.API_VERSION || 'dev'; -const NODE_VERSION = '1.35.0'; // TODO: pick up this value from process.env +const NODE_VERSION = '1.35.2'; // TODO: pick up this value from process.env const mainProcessID = get(process, 'ppid', '-'); const rendererProcessID = process.pid; diff --git a/source/main/trezor/connection.ts b/source/main/trezor/connection.ts index ac5bc8d1b3..49fcda15ef 100644 --- a/source/main/trezor/connection.ts +++ b/source/main/trezor/connection.ts @@ -14,7 +14,6 @@ export const initTrezorConnect = async () => { logger.info('[TREZOR-CONNECT] Called TrezorConnect.init()'); } catch (error) { logger.info('[TREZOR-CONNECT] Failed to call TrezorConnect.init()'); - throw error; } }; diff --git a/source/renderer/app/api/api.ts b/source/renderer/app/api/api.ts index 340dabc1fa..3e72d66127 100644 --- a/source/renderer/app/api/api.ts +++ b/source/renderer/app/api/api.ts @@ -223,11 +223,12 @@ import type { ApiAsset, StoredAssetMetadata, } from './assets/types'; -import type { AssetLocalData } from './utils/localStorage'; import Asset from '../domains/Asset'; import { getAssets } from './assets/requests/getAssets'; import { getAccountPublicKey } from './wallets/requests/getAccountPublicKey'; import { doesWalletRequireAdaToRemainToSupportTokens } from './utils/apiHelpers'; +import { AssetLocalData } from '../types/localDataTypes'; +import { handleNotEnoughMoneyError } from './errors'; export default class AdaApi { config: RequestConfig; @@ -663,14 +664,14 @@ export default class AdaApi { logger.debug('AdaApi::getAssets success', { assets: response, }); - const assetsLocaldata = await global.daedalus.api.localStorage.getAssetsLocalData(); + const assetsLocalData = await global.daedalus.api.localStorage.getAssetsLocalData(); logger.debug('AdaApi::getAssetsLocalData success', { - assetsLocaldata, + assetsLocalData, }); const assets = response.map((asset) => _createAssetFromServerData( asset, - assetsLocaldata[asset.policy_id + asset.asset_name] || {}, + assetsLocalData[asset.policy_id + asset.asset_name] || {}, this.storedAssetMetadata ) ); @@ -1061,51 +1062,14 @@ export default class AdaApi { minimumAda, }; } catch (error) { - let notEnoughMoneyError; - - if (walletBalance.gt(availableBalance)) { - // 1. Amount exceeds availableBalance due to pending transactions: - // - walletBalance > availableBalance - // = show "Cannot calculate fees while there are pending transactions." - notEnoughMoneyError = 'canNotCalculateTransactionFees'; - } else if ( - !walletBalance.isZero() && - walletBalance.isEqualTo(rewardsBalance) - ) { - // 2. Wallet contains only rewards: - // - walletBalance === rewardsBalance - // = show "Cannot send from a wallet that contains only rewards balances." - notEnoughMoneyError = 'inputsDepleted'; - } else { - // 3. Amount exceeds walletBalance: - // - walletBalance === availableBalance - // = show "Not enough Ada. Try sending a smaller amount." - notEnoughMoneyError = 'notEnoughFundsForTransaction'; - } - - // ApiError with logging showcase - throw new ApiError(error, { - // @ts-ignore ts-migrate(2322) FIXME: Type 'boolean' is not assignable to type 'Record availableBalance - // = show "Cannot calculate fees while there are pending transactions." - notEnoughMoneyError = 'canNotCalculateTransactionFees'; - } else if ( - !walletBalance.isZero() && - walletBalance.isEqualTo(rewardsBalance) - ) { - // 2. Wallet contains only rewards: - // - walletBalance === rewardsBalance - // = show "Cannot send from a wallet that contains only rewards balances." - notEnoughMoneyError = 'inputsDepleted'; - } else { - // 3. Amount exceeds walletBalance: - // - walletBalance === availableBalance - // = show "Not enough Ada. Try sending a smaller amount." - notEnoughMoneyError = 'notEnoughFundsForTransaction'; - } - - // ApiError with logging showcase - throw new ApiError(error, { - // @ts-ignore ts-migrate(2322) FIXME: Type 'boolean' is not assignable to type 'Record { + let notEnoughMoneyError; + + const { walletBalance, availableBalance, rewardsBalance } = balance; + + if (walletBalance.gt(availableBalance)) { + // 1. Amount exceeds availableBalance due to pending transactions: + // - walletBalance > availableBalance + // = show "Cannot calculate fees while there are pending transactions." + notEnoughMoneyError = 'canNotCalculateTransactionFees'; + } else if ( + !walletBalance.isZero() && + walletBalance.isEqualTo(rewardsBalance) + ) { + // 2. Wallet contains only rewards: + // - walletBalance === rewardsBalance + // = show "Cannot send from a wallet that contains only rewards balances." + notEnoughMoneyError = 'inputsDepleted'; + } else { + // 3. Amount exceeds walletBalance: + // - walletBalance === availableBalance + // = show "Not enough Ada. Try sending a smaller amount." + notEnoughMoneyError = 'notEnoughFundsForTransaction'; + } + + // ApiError with logging showcase + throw new ApiError(error, { + // @ts-ignore ts-migrate(2322) FIXME: Type 'boolean' is not assignable to type 'Record; export type SetHardwareWalletLocalDataRequestType = { walletId: string; data: { @@ -44,27 +44,6 @@ export type SetHardwareWalletDeviceRequestType = { data: UnpairedHardwareWalletData; }; -export type UnpairedHardwareWalletData = { - deviceType?: DeviceType; - deviceModel?: string; - deviceName?: string; - path?: string | null | undefined; - paired?: string | null | undefined; - disconnected?: boolean; -}; - -export type HardwareWalletLocalData = { - id: string; - deviceType: DeviceType; - device: TransportDevice; - extendedPublicKey: HardwareWalletExtendedPublicKeyResponse; - disconnected: boolean; -}; -export type HardwareWalletsLocalData = Record; -export type HardwareWalletDevicesType = Record; -export type AssetLocalData = { - decimals: number; -}; /** * This api layer provides access to the electron local storage * for user settings that are not synced with any coin backend. diff --git a/source/renderer/app/components/assets/AssetSettingsDialog.tsx b/source/renderer/app/components/assets/AssetSettingsDialog.tsx index 00e56c4a3e..eb61232d62 100644 --- a/source/renderer/app/components/assets/AssetSettingsDialog.tsx +++ b/source/renderer/app/components/assets/AssetSettingsDialog.tsx @@ -17,7 +17,7 @@ import { MAX_DECIMAL_PRECISION, } from '../../config/assetsConfig'; import { DiscreetTokenWalletAmount } from '../../features/discreet-mode'; -import { isRecommendedDecimal } from '../wallet/tokens/wallet-token/helpers'; +import { isNonRecommendedDecimalSettingUsed } from '../wallet/tokens/wallet-token/helpers'; const messages = defineMessages({ title: { @@ -154,7 +154,7 @@ class AssetSettingsDialog extends Component { }, ]; - const hasWarning = isRecommendedDecimal({ + const hasWarning = isNonRecommendedDecimalSettingUsed({ recommendedDecimals, decimals: savedDecimals, }); diff --git a/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsChooseWalletDialog.tsx b/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsChooseWalletDialog.tsx index 35790418a4..b046e558e2 100644 --- a/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsChooseWalletDialog.tsx +++ b/source/renderer/app/components/staking/delegation-setup-wizard/DelegationStepsChooseWalletDialog.tsx @@ -16,6 +16,7 @@ import DialogBackButton from '../../widgets/DialogBackButton'; import Dialog from '../../widgets/Dialog'; import WalletsDropdown from '../../widgets/forms/WalletsDropdown'; import Wallet from '../../../domains/Wallet'; +import LocalizableError from '../../../i18n/LocalizableError'; const messages = defineMessages({ title: { @@ -116,6 +117,30 @@ export default class DelegationStepsChooseWalletDialog extends Component< this.props.onSelectWallet(selectedWalletId); }; + getErrorMessage = (wallet?: Wallet): LocalizableError | null => { + if (!wallet) { + return null; + } + + const { amount, reward, isRestoring } = wallet; + + if (isRestoring) { + return messages.errorRestoringWallet; + } + + if (!this.props.isWalletAcceptable(amount, reward)) { + // Wallet only has Reward balance + if (!amount.isZero() && amount.isEqualTo(reward)) { + return messages.errorMinDelegationFundsRewardsOnly; + } + + // Wallet balance < min delegation funds + return messages.errorMinDelegationFunds; + } + + return null; + }; + render() { const { intl } = this.context; const { selectedWalletId } = this.state; @@ -125,25 +150,13 @@ export default class DelegationStepsChooseWalletDialog extends Component< minDelegationFunds, onClose, onBack, - isWalletAcceptable, numberOfStakePools, getStakePoolById, } = this.props; const selectedWallet: Wallet | null | undefined = wallets.find( (wallet: Wallet) => wallet && wallet.id === selectedWalletId ); - const { amount, reward, isRestoring } = selectedWallet || {}; - let errorMessage; - - if (selectedWallet && !isWalletAcceptable(amount, reward)) { - // Wallet is restoring - if (isRestoring) errorMessage = messages.errorRestoringWallet; - // Wallet only has Reward balance - else if (!amount.isZero() && amount.isEqualTo(reward)) - errorMessage = messages.errorMinDelegationFundsRewardsOnly; - // Wallet balance < min delegation funds - else errorMessage = messages.errorMinDelegationFunds; - } + const errorMessage = this.getErrorMessage(selectedWallet); const error = errorMessage && (

diff --git a/source/renderer/app/components/wallet/tokens/wallet-token/WalletToken.tsx b/source/renderer/app/components/wallet/tokens/wallet-token/WalletToken.tsx index 5b75b82848..d4450d07c9 100644 --- a/source/renderer/app/components/wallet/tokens/wallet-token/WalletToken.tsx +++ b/source/renderer/app/components/wallet/tokens/wallet-token/WalletToken.tsx @@ -6,7 +6,7 @@ import AssetContent from '../../../assets/AssetContent'; import type { AssetToken } from '../../../../api/assets/types'; import WalletTokenFooter from './WalletTokenFooter'; import WalletTokenHeader from './WalletTokenHeader'; -import { isRecommendedDecimal } from './helpers'; +import { isNonRecommendedDecimalSettingUsed } from './helpers'; type Props = { anyAssetWasHovered: boolean; @@ -49,7 +49,7 @@ const WalletToken = observer((props: Props) => { setIsExpanded(!isExpanded); }, [setIsExpanded, isExpanded]); - const hasWarning = isRecommendedDecimal({ + const hasWarning = isNonRecommendedDecimalSettingUsed({ decimals: asset.decimals, recommendedDecimals: asset.recommendedDecimals, }); diff --git a/source/renderer/app/components/wallet/tokens/wallet-token/helpers.spec.ts b/source/renderer/app/components/wallet/tokens/wallet-token/helpers.spec.ts new file mode 100644 index 0000000000..9ba67f6f45 --- /dev/null +++ b/source/renderer/app/components/wallet/tokens/wallet-token/helpers.spec.ts @@ -0,0 +1,69 @@ +import { isNonRecommendedDecimalSettingUsed } from './helpers'; + +describe('isNonRecommendedDecimalSettingUsed', () => { + it('returns false if asset does not have recommended decimals', async () => { + expect( + isNonRecommendedDecimalSettingUsed({ + decimals: 0, + recommendedDecimals: undefined, + }) + ).toEqual(false); + + expect( + isNonRecommendedDecimalSettingUsed({ + decimals: 5, + recommendedDecimals: undefined, + }) + ).toEqual(false); + }); + + it('returns false if recommended decimal settings are applied by user', async () => { + expect( + isNonRecommendedDecimalSettingUsed({ + decimals: 0, + recommendedDecimals: 0, + }) + ).toEqual(false); + + expect( + isNonRecommendedDecimalSettingUsed({ + decimals: 5, + recommendedDecimals: 5, + }) + ).toEqual(false); + }); + + it('returns false if 0 (default value) is recommended and user never changed settings', async () => { + expect( + isNonRecommendedDecimalSettingUsed({ + decimals: undefined, + recommendedDecimals: 0, + }) + ).toEqual(false); + }); + + it('returns true if non-zero decimals are recommended but user never changed settings', async () => { + expect( + isNonRecommendedDecimalSettingUsed({ + decimals: undefined, + recommendedDecimals: 3, + }) + ).toEqual(true); + }); + + it('returns true if user applied non-recommended decimal settings', async () => { + expect( + isNonRecommendedDecimalSettingUsed({ + decimals: 3, + recommendedDecimals: 0, + }) + ).toEqual(true); + + expect( + isNonRecommendedDecimalSettingUsed({ + decimals: 0, + recommendedDecimals: 3, + }) + ).toEqual(true); + }); +}); diff --git a/source/renderer/app/components/wallet/tokens/wallet-token/helpers.ts b/source/renderer/app/components/wallet/tokens/wallet-token/helpers.ts index 1a93bd77fc..f8cf633d76 100644 --- a/source/renderer/app/components/wallet/tokens/wallet-token/helpers.ts +++ b/source/renderer/app/components/wallet/tokens/wallet-token/helpers.ts @@ -1,15 +1,24 @@ -type IsRecommendedDecimal = { +type IsNonRecommendedDecimalSettingUsedArgs = { decimals: number | null | undefined; recommendedDecimals: number | null | undefined; }; -export const isRecommendedDecimal = ({ +export const isNonRecommendedDecimalSettingUsed = ({ recommendedDecimals, decimals, -}: IsRecommendedDecimal) => { - return ( - typeof recommendedDecimals === 'number' && - typeof decimals === 'number' && - decimals !== recommendedDecimals - ); +}: IsNonRecommendedDecimalSettingUsedArgs) => { + const hasRecommendedDecimals = typeof recommendedDecimals === 'number'; + const hasConfiguredDecimals = typeof decimals === 'number'; + + if (!hasRecommendedDecimals) { + return false; + } + if (hasConfiguredDecimals) { + return decimals !== recommendedDecimals; + } + if (!hasConfiguredDecimals && recommendedDecimals === 0) { + return false; + } + + return true; }; diff --git a/source/renderer/app/containers/staking/dialogs/redeem-itn-rewards/Step1ConfigurationContainer.tsx b/source/renderer/app/containers/staking/dialogs/redeem-itn-rewards/Step1ConfigurationContainer.tsx index 3a41d7f117..9dd4faa992 100644 --- a/source/renderer/app/containers/staking/dialogs/redeem-itn-rewards/Step1ConfigurationContainer.tsx +++ b/source/renderer/app/containers/staking/dialogs/redeem-itn-rewards/Step1ConfigurationContainer.tsx @@ -10,6 +10,7 @@ import validWords from '../../../../../../common/config/crypto/valid-words.en'; import { isValidMnemonic } from '../../../../../../common/config/crypto/decrypt'; import { MIN_REWARDS_REDEMPTION_RECEIVER_BALANCE } from '../../../../config/stakingConfig'; import Wallet from '../../../../domains/Wallet'; +import LocalizableError from '../../../../i18n/LocalizableError'; type Props = InjectedDialogContainerStepProps; const DefaultProps = InjectedDialogContainerStepDefaultProps; @@ -34,15 +35,32 @@ const messages = defineMessages({ @observer class Step1ConfigurationContainer extends Component { static defaultProps = DefaultProps; - onWalletAcceptable = (walletAmount?: BigNumber) => { + hasEnoughAdaToCoverFees = (walletAmount?: BigNumber) => { const minRewardsFunds = new BigNumber( MIN_REWARDS_REDEMPTION_RECEIVER_BALANCE ); return walletAmount && walletAmount.gte(minRewardsFunds); }; + getErrorMessage = (wallet?: Wallet): LocalizableError | null => { + if (!wallet) { + return null; + } + + const { amount, isRestoring } = wallet; + + if (isRestoring) { + return messages.errorRestoringWallet; + } + if (!this.hasEnoughAdaToCoverFees(amount)) { + return messages.errorMinRewardFunds; + } + + return null; + }; + render() { - const { actions, stores, onBack, onClose } = this.props; + const { actions, stores, onClose } = this.props; const { app, staking, wallets } = stores; const { allWallets } = wallets; const { @@ -59,23 +77,13 @@ class Step1ConfigurationContainer extends Component { const selectedWallet: Wallet | null | undefined = allWallets.find( (current: Wallet) => current && current.id === selectedWalletId ); - const { amount, isRestoring } = selectedWallet || {}; - let errorMessage = null; - - if (selectedWallet && !this.onWalletAcceptable(amount)) { - // Wallet is restoring - if (isRestoring) errorMessage = messages.errorRestoringWallet; - // Wallet balance < min rewards redemption funds - else errorMessage = messages.errorMinRewardFunds; - } + const errorMessage = this.getErrorMessage(selectedWallet); return ( diff --git a/source/renderer/app/containers/wallet/WalletReceivePage.tsx b/source/renderer/app/containers/wallet/WalletReceivePage.tsx index 7726961231..b518de6a21 100755 --- a/source/renderer/app/containers/wallet/WalletReceivePage.tsx +++ b/source/renderer/app/containers/wallet/WalletReceivePage.tsx @@ -12,7 +12,7 @@ import WalletAddress from '../../domains/WalletAddress'; import { generateFileNameWithTimestamp } from '../../../../common/utils/files'; import { ellipsis } from '../../utils/strings'; import { generateSupportRequestLink } from '../../../../common/utils/reporting'; -import type { WalletLocalData } from '../../api/utils/localStorage'; +import { WalletLocalData } from '../../types/localDataTypes'; const messages = defineMessages({ address: { diff --git a/source/renderer/app/i18n/locales/terms-of-use/en-US.md b/source/renderer/app/i18n/locales/terms-of-use/en-US.md index 8e1f73b0d9..0b2cc990fa 100644 --- a/source/renderer/app/i18n/locales/terms-of-use/en-US.md +++ b/source/renderer/app/i18n/locales/terms-of-use/en-US.md @@ -1,6 +1,6 @@ # IOHK Terms of Service Agreement -THIS TERMS OF SERVICE AGREEMENT ("Agreement") is made between Input Output HK Limited ("Company") and any person ("User") who completes the process to download, utilize, or operate any software or application created or offered by Company, including, but not limited to, the Daedalus Wallet application and the IOHK Incentivised Testnet ("Product"). You agree that this Agreement is a separate and independent agreement for each such Product. +THIS TERMS OF SERVICE AGREEMENT ("Agreement") is made between IOG Singapore Pte. Ltd. ("Company") and any person ("User") who completes the process to download, utilize, or operate any software or application created or offered by Company, including, but not limited to, the Daedalus Wallet application and the Incentivised Testnet (collectively, the "Product"). You agree that this Agreement is a separate and independent agreement for each such Product. **By confirming your acceptance of this Agreement, you agree to be bound by these terms on your own behalf. If you are duly authorized by a corporate entity, you agree on behalf of your corporate entity that it will be bound by the Agreement.** @@ -12,19 +12,19 @@ Company and User are collectively referred to as the "parties." **1.2 User Representations.** User represents and warrants to Company that: (a) User is over the age of eighteen (18) and has the power and authority to enter into and perform User's obligations under this Agreement; (b) all information provided by User to Company is truthful, accurate and complete; (c) User will comply with all laws and regulations of any applicable jurisdiction with regard to the User's access, use or installation of the Product; (d) User shall comply with all terms and conditions of this Agreement, including, without limitation, the provisions set forth at Section 1.7 (Prohibited Uses); and (e) User has provided and will provide accurate and complete information as required for access, use or installation of the Product. -**1.3 Reservation of Rights.** The Company retains all intellectual property rights, title, and interest in and to all of the Company's work, the Product, brands, logos, and trademarks, including but not limited to, Input Output HK Limited, IOHK, Daedalus, Daedalus Cryptocurrency Wallet, Daedalus Wallet, Daedalus App, and variations of the wording of the aforementioned brands, logos, and trademarks. User acknowledges and agrees that this Agreement conveys no title or ownership rights and User does not acquire any rights over the Company’s intellectual property law, express or implied, other than those expressly granted in this Agreement. All rights not expressly granted to User are reserved by the Company. +**1.3 Reservation of Rights.** The Company retains all intellectual property rights, title, and interest in and to all of the Company's work, the Product, brands, logos, and trademarks, including but not limited to, IOG Singapore Pte. Ltd., Input Output HK Limited, IOG, IOHK, Daedalus, Daedalus Cryptocurrency Wallet, Daedalus Wallet, Daedalus App, and variations of the wording of the aforementioned brands, logos, and trademarks. User acknowledges and agrees that this Agreement conveys no title or ownership rights and User does not acquire any rights over the Company's intellectual property law, express or implied, other than those expressly granted in this Agreement. All rights not expressly granted to User are reserved by the Company. **1.4 Grant of a License.** The Product is licensed to User under the terms of the Apache License, Version 2.0 (the "License"). The Product may not be used except in compliance with the License. User may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0). User acknowledges and agrees that the Company shall not be responsible for any aspect of the information, content, or services contained in any third-party materials or on any third party sites accessible or linked to the Product and/or the Company. **1.5 User Obligations.** User is solely responsible for (a) providing, maintaining and ensuring compatibility with the Product, all hardware, software, electrical and other physical requirements for User's use of the Product, including, without limitation, telecommunications and internet access connections and links, web browsers or other equipment, programs and services required to access and use the Product; (b) the security, confidentiality and integrity of all information and content that User receives, transmits through or stores on the Product; and (c) any authorized or unauthorized access to any account of User by any person. -**1.6 Privacy.** When reasonably practicable, Company will endeavor to respect User's privacy. Company will not monitor, edit, or disclose any personal information about User or User's account, including its contents or User's use of the Product, without User's prior consent unless Company has a good faith belief that such action is necessary to: (i) comply with legal process or other legal requirements of any governmental authority; (ii) protect and defend the rights or property of Company; (iii) enforce this Agreement; (iv) protect the interests of users of the Product other than User or any other person; or (v) operate or conduct maintenance and repair of Company's services or equipment, including the Product as authorized by law. User has no expectation of privacy with respect to the Internet generally. User acknowledges that IP addresses are transmitted and recorded with each message or other information User sends from the Product. +**1.6 Privacy.** By accepting the terms of this Agreement, User also agrees to the terms of Company's [Privacy Policy](https://static.iohk.io/terms/iog-privacy-policy.pdf), attached and incorporated herein. Upon User's consent, which may be retracted at any time by the User by modifying User's settings within the Daedalus software, Company may also track certain aspects of User's behavior and device information for product development and improvement purposes. Such User behavior and device information includes the following: clicks, page visits, page scrolling, number of wallets, number of native assets, session duration, type of wallets (soft vs hardware wallets), geolocation (country of location), page performance, operating system, RAM and disk space. **1.7 Prohibited Uses.** User is solely responsible for any and all acts and omissions that occur under User's account, security information, keys or password, and User agrees not to engage in unacceptable use of the Product, which includes, without limitation, use of the Product to: (a) disseminate, store or transmit unsolicited messages, chain letters or unsolicited commercial email; (b) disseminate or transmit material that, to a reasonable person may be abusive, obscene, pornographic, defamatory, harassing, grossly offensive, vulgar, threatening or malicious; (c) disseminate, store or transmit files, graphics, software or other material that actually or potentially infringes the copyright, trademark, patent, trade secret or other intellectual property right of any person; (d) create a false identity or to otherwise attempt to mislead any person as to the identity or origin of any communication; (e) export, re-export or permit downloading of any message or content in violation of any export or import law, regulation or restriction of any applicable jurisdiction, or without all required approvals, licenses or exemptions; (f) interfere, disrupt or attempt to gain unauthorized access to other accounts on the Product or any other computer network; or (g) disseminate, store or transmit viruses, trojan horses or any other malicious code or program. **1.8 Warranties.** While the Product has undergone beta testing and continues to be improved by feedback from the developers community, open-source contributors and beta-testers, the Company cannot guarantee there will not be bugs in the Product. Unless required by applicable law or agreed to in writing, the Product is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. User agrees that from time to time the Product may be inaccessible or inoperable for any reason, including, without limitation: (i) equipment malfunctions; (ii) periodic maintenance procedures or repairs which Company may undertake from time to time; or (iii) causes beyond the control of Company or which are not reasonably foreseeable by Company. User acknowledges that User's use of this Product is at User's risk and discretion. -**1.9 Liability.** IN NO EVENT WILL IOHK OR ITS SHAREHOLDERS, DIRECTORS, OFFICERS, EMPLOYEES, CONTRACTORS OR SERVICE PROVIDERS, BE LIABLE TO USER OR ANY THIRD PARTY FOR ANY USE, INTERRUPTION, DELAY OR INABILITY TO USE THE SOFTWARE, LOST REVENUE OR PROFITS, LOST REWARDS, DELAYS, INTERRUPTION OR LOSS OF SERVICE, BUSINESS OR GOODWILL, LOSS OR CORRUPTION OF DATA, LOSS OF CRYPTOCURRENCY LOSS RESULTING FROM SYSTEM OR SYSTEM SERVICE FAILURE, MALFUNCTION OR SHUTDOWN, FAILURE TO ACCURATELY TRANSFER, READ OR TRANSMIT INFORMATION, FAILURE TO UPDATE OR PROVIDE CORRECT INFORMATION, SYSTEM INCOMPATIBILITY OR PROVISION OF INCORRECT COMPATIBILITY INFORMATION OR BREACHES IN SYSTEM SECURITY, OR FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, INCIDENTAL, EXEMPLARY, SPECIAL OR PUNITIVE DAMAGES, WHETHER ARISING OUT OF OR IN CONNECTION WITH THIS AGREEMENT, BREACH OF CONTRACT, TORT (INCLUDING NEGLIGENCE) OR OTHERWISE, AND REGARDLESS OF WHETHER SUCH DAMAGES WERE FORESEEABLE AND WHETHER OR NOT COMPANY WAS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO EVENT SHALL THE COMPANY OR ITS SHAREHOLDERS, DIRECTORS, OFFICERS, EMPLOYEES, AFFILIATES OR AGENTS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM OR IN ANY WAY RELATED TO USER'S ACCESS, USE OR INSTALLATION OF THE SOFTWARE. SOME JURISDICTIONS PROHIBIT THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, THUS THIS LIMITATION OF LIABILITY MAY NOT APPLY TO USER. IF USER IS DISSATISFIED WITH THE SOFTWARE, USER'S SOLE AND EXCLUSIVE REMEDY SHALL BE FOR USER TO DISCONTINUE USE OF THE SOFTWARE. +**1.9 Liability.** IN NO EVENT WILL COMPANY OR ITS SHAREHOLDERS, AFFILIATES, DIRECTORS, OFFICERS, EMPLOYEES, CONTRACTORS OR SERVICE PROVIDERS, BE LIABLE TO USER OR ANY THIRD PARTY FOR ANY USE, INTERRUPTION, DELAY OR INABILITY TO USE THE SOFTWARE, LOST REVENUE OR PROFITS, LOST REWARDS, DELAYS, INTERRUPTION OR LOSS OF SERVICE, BUSINESS OR GOODWILL, LOSS OR CORRUPTION OF DATA, LOSS OF CRYPTOCURRENCY LOSS RESULTING FROM SYSTEM OR SYSTEM SERVICE FAILURE, MALFUNCTION OR SHUTDOWN, FAILURE TO ACCURATELY TRANSFER, READ OR TRANSMIT INFORMATION, FAILURE TO UPDATE OR PROVIDE CORRECT INFORMATION, SYSTEM INCOMPATIBILITY OR PROVISION OF INCORRECT COMPATIBILITY INFORMATION OR BREACHES IN SYSTEM SECURITY, OR FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, INCIDENTAL, EXEMPLARY, SPECIAL OR PUNITIVE DAMAGES, WHETHER ARISING OUT OF OR IN CONNECTION WITH THIS AGREEMENT, BREACH OF CONTRACT, TORT (INCLUDING NEGLIGENCE) OR OTHERWISE, AND REGARDLESS OF WHETHER SUCH DAMAGES WERE FORESEEABLE AND WHETHER OR NOT COMPANY WAS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO EVENT SHALL THE COMPANY OR ITS SHAREHOLDERS, DIRECTORS, OFFICERS, EMPLOYEES, AFFILIATES OR AGENTS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM OR IN ANY WAY RELATED TO USER'S ACCESS, USE OR INSTALLATION OF THE SOFTWARE. SOME JURISDICTIONS PROHIBIT THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, THUS THIS LIMITATION OF LIABILITY MAY NOT APPLY TO USER. IF USER IS DISSATISFIED WITH THE SOFTWARE, USER'S SOLE AND EXCLUSIVE REMEDY SHALL BE FOR USER TO DISCONTINUE USE OF THE SOFTWARE. **1.10 Indemnification.** User agrees to indemnify, hold harmless and defend Company, its shareholders, directors, officers, employees, affiliates and agents ("Indemnified Parties") from and against any action, cause, claim, damage, debt, demand or liability, including reasonable costs and attorney's fees, asserted by any person, arising out of or relating to: (a) this Agreement; (b) User's access, use or installation of the Product, including any data or work transmitted or received by User; and (c) any unacceptable use of the Product by any person, including, without limitation, any statement, data or content made, transmitted or republished by User or any person which is prohibited as unacceptable under Section 1.7. THIS INDEMNIFICATION INCLUDES THE EXPRESS INDEMNIFICATION OF COMPANY AND ALL INDEMNIFIED PARTIES FOR ANY ALLEGED NEGLIGENCE, ALLEGED GROSS NEGLIGENCE, OR OTHER ALLEGED MISCONDUCT OF COMPANY OR ANY INDEMNIFIED PARTIES. @@ -58,21 +58,21 @@ Company and User are collectively referred to as the "parties." **3.1 Incentivised Testnet.** Company is testing and making available to Users a test rewards and incentivization mechanism which is intended to mimic the rewards and incentivization mechanism in the upcoming Shelley release (the "Incentivized Testnet"). Users may participate in the Incentivized Testnet by delegating their ada stake to their own stake pool or to a third party stake pool in exchange for a reward equivalent to a percentage of the proceeds generated by the stake pool ("Reward"). -**3.2 Rewards.** The amount of Rewards a User may earn from delegation depends on various factors including, but not limited to, user participation, stakepool profit margins and the volume of ada being delegated. It is possible that delegation generates no Reward for a User due to the above-mentioned factors. Rewards are earned as of the start of the 3rd epoch on the Cardano blockchain. When the Incentivized Testnet is discontinued, any Rewards earned can be transferred back to the User’s Daedalus or Yoroi wallet. +**3.2 Rewards.** The amount of Rewards a User may earn from delegation depends on various factors including, but not limited to, user participation, stakepool profit margins and the volume of ada being delegated. It is possible that delegation generates no Reward for a User due to the above-mentioned factors. Rewards are earned as of the start of the 3rd epoch on the Cardano blockchain. When the Incentivized Testnet is discontinued, any Rewards earned can be transferred back to the User's Daedalus or Yoroi wallet. **3.3 Delegation.** Users may delegate their stake to one of the various stake pools of the Company or to a third party stake pool. User will have the sole right to determine the volume to be delegated to a stake pool and may increase or decrease its level of participation at any time. Any information Company shares regarding stakepools, including performance metrics and Rewards, will be for indicative purposes only and may not be accurate. Users may only delegate their stake to a stake pool if their ada is in an updated Daedalus or an updated Yoroi wallet at the time of the setup process. User does not acquire any automatic right to Rewards as a result of delegating its stake. -**3.4 Company Stake-Pools.** The Company will operate various stake pools which will be visible in Daedalus or the explorer tool. The cost and network and server requirements to reliably operate such stake pools shall be determined by the Company in its sole discretion. Company will communicate the percentage amount of Reward to be shared with Users through the User’s Testnet Daedalus wallet. Rewards will accrue at the end of each epoch and will automatically appear in the User’s Testnet Deadalus wallet. Company will provide a dashboard detailing the Company’s staking performance to User. +**3.4 Company Stake-Pools.** The Company will operate various stake pools which will be visible in Daedalus or the explorer tool. The cost and network and server requirements to reliably operate such stake pools shall be determined by the Company in its sole discretion. Company will communicate the percentage amount of Reward to be shared with Users through the User's Testnet Daedalus wallet. Rewards will accrue at the end of each epoch and will automatically appear in the User's Testnet Deadalus wallet. Company will provide a dashboard detailing the Company's staking performance to User. **3.5 Redeeming Rewards.** User acknowledges and agrees that by redeeming Rewards in the Incentivised Testnet, User redeems TEST-ADA only, and that in order to redeem actual ada, User must repeat the procedure in the mainnet, once released. User shall be responsible for payment of all applicable taxes, if any, to which the Rewards might be subject and any and all other taxes which may apply to User once Rewards are redeemed. **3.6 Tools.** Company will provide Users and stake pool operators certain tools designed to estimate the amount of Rewards a User may earn on the Incentivized Testnet ("Rewards Calculator"). User understands that the Rewards Calculator is provided for illustrative purposes only and may not be accurate. Company does not promise that the Reward received will correspond to the amount indicated by the Rewards Calculator or by the stake pools. -**3.7 Prohibited Use.** User will not, and will not permit any other third party to use any device, software or routine to interfere with the proper function of the Incentivised Testnet. If there is a complaint or notice of violation, a User’s participation may be suspended without notice until resolved, and terminated if not resolved promptly. +**3.7 Prohibited Use.** User will not, and will not permit any other third party to use any device, software or routine to interfere with the proper function of the Incentivised Testnet. If there is a complaint or notice of violation, a User's participation may be suspended without notice until resolved, and terminated if not resolved promptly. -**3.8 Warranty.** The Service are provided to User on an "as is" and "as available" basis and all warranties, express, implied, statutory or otherwise, with respect to the Service are hereby excluded. User acknowledges that the Incentivized Testnet may not operate properly and that it may contain errors, design flaws or other issues. User’s use of the Incentivized Testnet remains at User’s risk and discretion. IOHK reserves the right to restart the Incentivised Testnet and reverse all or some Rewards in the case of errors and/or malicious behaviour in the system. +**3.8 Warranty.** The Product are provided to User on an "as is" and "as available" basis and all warranties, express, implied, statutory or otherwise, with respect to the Service are hereby excluded. User acknowledges that the Incentivized Testnet may not operate properly and that it may contain errors, design flaws or other issues. User's use of the Incentivized Testnet remains at User's risk and discretion. Company reserves the right to restart the Incentivised Testnet and reverse all or some Rewards in the case of errors and/or malicious behavior in the system. -**3.9 Termination of the Incentivised Testnet.** User understands and agrees that Company may change, withdraw, terminate access to and/or discontinue the Incentivized Testnet (or any portion thereof) at any time and in its sole discretion. User may end participation in the Incentivized Testnet at any time and any Rewards gained up to that time will still be transferred to User’s Daedalus or Yoroi mainnet wallet once the Incentivized Testnet is discontinued. +**3.9 Termination of the Incentivised Testnet.** User understands and agrees that Company may change, withdraw, terminate access to and/or discontinue the Incentivized Testnet (or any portion thereof) at any time and in its sole discretion. User may end participation in the Incentivized Testnet at any time and any Rewards gained up to that time will still be transferred to User's Daedalus or Yoroi mainnet wallet once the Incentivized Testnet is discontinued. **3.10 Feedback.** Users may provide suggestions, comments or ideas and report issues or problems related to their use of the Incentivized Testnet at any time by using any of the official feedback channels. diff --git a/source/renderer/app/i18n/locales/terms-of-use/ja-JP.md b/source/renderer/app/i18n/locales/terms-of-use/ja-JP.md index b2df0a4872..fc63c37bc9 100644 --- a/source/renderer/app/i18n/locales/terms-of-use/ja-JP.md +++ b/source/renderer/app/i18n/locales/terms-of-use/ja-JP.md @@ -1,6 +1,6 @@ # IOHKサービス利用規約 -本サービス利用規約(「規約」)は、Input Output HK Limited(「当社」)が作成または提供するDaedalusウォレットアプリケーションおよびIOHKインセンティブ付きテストネットなどのソフトウェアまたはアプリケーション(「製品」)のダウンロード、利用または操作するための処理を完了したあらゆる人物(「ユーザー」)に適用されます。ユーザーは、本規約がかかる製品の各規約とは個別の独立したものであることに同意します。 +本サービス利用規約(「規約」)は、IOG Singapore Pte. Ltd.(「当社」)が作成または提供するDaedalusウォレットアプリケーションおよびインセンティブ付きテストネットなどのソフトウェアまたはアプリケーション(総称として「製品」)のダウンロード、利用または操作するための処理を完了したあらゆる人物(「ユーザー」)に適用されます。ユーザーは、本規約がかかる製品の各規約とは個別の独立したものであることに同意します。 **本規約の承諾を確認することにより、ユーザーは自己の利益のためにかかる条件に拘束されることに同意するものとします。法人から正当に権限を与えられたユーザーは、その法人を代表して本規約に拘束されることに同意するものとします。** @@ -12,19 +12,19 @@ **1.2 ユーザーの表明:** ユーザーは、当社に対し(a)ユーザーが十八(18)歳以上であり、本規約に合意し、本規約におけるユーザーの義務を履行するための権能、および権限を有していること、(b)当社に提供したユーザーのすべての情報が真実、正確、かつ完全であること、(c) ユーザーが、それによる本製品へのアクセス、その使用もしくはインストールにつき、該当する管轄区域におけるすべての法律、および規則に準拠すること、(d)ユーザーが、第1.7項に記載の条項など本規約のすべての条件に準拠すること、ならびに(e)ユーザーが、本製品へのアクセス、その使用またはインストールに必要な正確かつ完全な情報を提供していることもしくはこれから提供することを表明し、保証します。 -**1.3 権利の留保:** 当社は、その作品、本製品、ブランド、ロゴ、および商標に関するすべての知的財産権、権原、および権益を留保します。当該ブランド、ロゴ、および商標は、Input Output HK Limited、IOHK、Daedalus、Daedalus暗号通貨ウォレット、Daedalusウォレット、Daedalusアプリケーション、および前述のブランド、ロゴ、および商標の多様な表現などを含みます。ユーザーは、本規約が権原および所有権を付与するものではなく、ユーザーはサービスにおいて明示、黙示を問わず、本規約で明示的に供与されたものを除く当社の知的財産法に関するいかなる権利も獲得しないことを確認し、これに合意します。ユーザーに明示的に供与されないすべての権利は、当社が留保します。 +**1.3 権利の留保:** 当社は、その作品、本製品、ブランド、ロゴ、および商標に関するすべての知的財産権、権原、および権益を留保します。当該ブランド、ロゴ、および商標は、IOG Singapore Pte. Ltd.、Input Output HK Limited、IOG、IOHK、Daedalus、Daedalus暗号通貨ウォレット、Daedalusウォレット、Daedalusアプリケーション、および前述のブランド、ロゴ、および商標の多様な表現などを含みます。ユーザーは、本規約が権原および所有権を付与するものではなく、ユーザーはサービスにおいて明示、黙示を問わず、本規約で明示的に供与されたものを除く当社の知的財産法に関するいかなる権利も獲得しないことを確認し、これに合意します。ユーザーに明示的に供与されないすべての権利は、当社が留保します。 **1.4 ライセンスの供与:** ユーザーには、Apacheライセンス、バージョン2.0(「ライセンス」)の条件に基づく本製品使用許諾ライセンスが供与されます。本製品は、本ライセンスに準拠する以外の使用はできません。ユーザーは、[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)でライセンスの複製を得ることができます。ユーザーは、当社が第三者の資料または製品もしくは当社にアクセス可能なもしくはこれにリンクされた第三者のサイトに含まれる情報、コンテンツまたはサービスのあらゆる側面について責任を負わないことを認めこれに合意します。 **1.5 ユーザーの義務:** ユーザーは、(a)ユーザーが本製品を使用するにあたり必要となる本製品との互換性、すべてのハードウェア、ソフトウェア、電力、ならびに本製品へアクセスし使用するための電気通信およびインターネットアクセス用回線およびリンク、ウェブブラウザもしくはその他の機器、プログラムおよびサービスといった物理的要件を提供、管理、ならびに確保すること、(b)ユーザーが受信する、本製品を介して送信する、または本製品に保管するすべての情報およびコンテンツの安全性、機密性、および整合性、ならびに(c)いかなる人物によるユーザーアカウントへのアクセスについて、それが正当であるか不正であるかを問わず、すべてに単独で責任を負います。 -**1.6 プライバシー:** 合理的に実行可能な場合、当社は、ユーザーのプライバシーを尊重するよう努めます。当社は、ユーザーからの事前の合意なくして、ユーザーまたはユーザーのアカウントに関する個人情報(アカウントの内容またはユーザーによる本製品の使用など)を監視、編集または開示しません。ただし、(i)政府当局による法的手続きまたはその他の法的要件への準拠、(ii)当社の権利または財産の保護および擁護、(iii)本規約の条項の履行、(iv)ユーザーもしくはその他の人物以外の本製品のユーザーの権益の保護、または(v)法律で許可される、当社のサービスもしくは機器(本製品を含む)の運用またはメンテナンスおよび修理を行う上で当社が当該行為の必要性を確信する場合を除きます。ユーザーは、一般的にインターネットに関してプライバシーを期待しないものとします。ユーザーは、ユーザーが本製品から送信する各メッセージその他の情報と共にIPアドレスが伝送、記録されることを認めるものとします。 +**1.6 プライバシー:** 本規約を承諾することにより、ユーザーは、本規約に添付および組み込まれた当社の[プライバシーポリシー](https://static.iohk.io/terms/iog-privacy-policy.pdf)にも同意するものとします。Daedalusソフトウェア内のユーザー設定を変更することにより適宜撤回可能であるユーザーの同意に基づき、当社はユーザーの行動およびデバイス情報の一部を製品の開発および改良目的で追跡することができます。かかるユーザーの行動およびデバイス情報は、以下を含みます。クリック数、ページへのアクセス、ページのスクロール、ウォレットの数、ネイティブ資産の数、セッションの期間、ウォレットの種類(ソフトウォレット、ハードウェアウォレット)、位置情報(国)、ページのパフォーマンス、オペレーティングシステム、RAM、ディスクの空き容量。 **1.7 禁止事項:** ユーザーは、そのアカウント、セキュリティ情報、鍵またははパスワードに生じる作為および不作為の一切につき全責任を負い、以下のような許可されていない目的に本製品を使用しないことに合意します。(a)一方的なメッセージ、チェーンレターまたは一方的な商用電子メールを広める、保管する、または送信すること、(b)虐待的な、卑猥な、猥褻な、中傷的な、迷惑な、極めて攻撃的な、下品な、脅迫的な、または悪質な資料を広めるか、それを合理的な人物に対し送信すること、(c)いずれかの人物の著作権、商標、特許、企業秘密またはその他の知的財産権を実際に侵害する、または侵害する可能性があるファイル、図形、ソフトウェアその他の資料を広める、保管する、または送信すること、(d)虚偽のアイデンティティを作成すること、またはいずれかの情報の同一性もしくは起源に関し、いずれかの人物に誤解を与えようとすること、(e)該当する管轄区域におけるエクスポートまたはインポートに関する法律、規則または制限に違反するか、必要な承認、ライセンスもしくは免責のないメッセージまたはコンテンツをエクスポート、再エクスポートすることまたはそれらのダウンロードを許可すること、(f)本製品のその他のアカウントもしくはその他のコンピューターネットワークを妨害する、混乱させる、またはそれらへの不正アクセスを試みること、または(g) ウィルス、トロイの木馬その他の悪質なコードもしくはプログラムを広める、保管する、または送信することなど。 **1.8 保証:** 本製品は、ベータテストを受け、開発コミュニティ、オープンソースコミュニティにおけるコントリビューター、およびベータテスターからのフィードバックによって継続的に改良されていますが、当社は、本製品にバグがないことを保証しません。適用法により必要とされるまたは書面で合意した場合を除き、明示的、黙示的を問わず本製品はいかなる保証も条件もなくして「現状有姿」ベースで配信されます。本ライセンスに基づく特定の言語による許可および制限はライセンスを参照してください。ユーザーは、本製品が以下の理由などによりアクセス不能または作動不能になる場合があることに合意します。(i)機器の不具合、(ii)会社が随時行う定期的なメンテナンスまたは修理、または(iii)会社が制御できない、もしくは合理的に予測できない要因。ユーザーは、その責任または自由裁量により本製品を使用することに合意します。 -**1.9 責任:** いかなる場合も、IOHKまたはその株主、取締役、役員、従業員、契約社員またはサービスプロバイダーは、ユーザーまたは第三者に対し、本ソフトウェアの使用、動作の中断、遅延、使用不能、収益もしくは利益の損失、報酬の損失、サービス、ビジネスもしくは営業権の遅延、中断もしくは損失、データの損失もしくは破損、暗号通貨の損失、システムもしくはシステムサービスの不具合、故障もしくは停止から生じる損失、情報の的確な転送、通読もしくは送信の失敗、情報の更新もしくは正確な情報の提供の失敗、システムの非互換性もしくは不正確な互換性情報の提供、システムセキュリティに対する違反、または直接的、間接的、派生的、付随的、懲罰的もしくは特別な損害について、これらが本規約、規約の違反、不法行為(過失を含む)その他の事象から生じるか、もしくはそれらに関連するかを問わず、当該損害が予見可能であった場合でも、当該損害が生じる可能性を事前に通知されていた場合でも責任を負いません。いかなる場合も、当社またはその株主、取締役、役員、従業員、関連会社もしくは代理人は、法的主張、損害賠償またはその他の法的責任につき、それらが契約上の行為であるか、不法行為であるか、ユーザーによる本ソフトウェアへのアクセス、その使用もしくはインストールに起因する、またはいずれかの方法でそれに関連するその他の事象によるかを問わず、責任を負いません。付随的または派生的損害の免責または制限を禁止する管轄区域があるため、この責任制限をユーザーに適用することはできません。ユーザーが本ソフトウェアに満足しない場合、ユーザーの唯一かつ排他的な救済方法は、ユーザーが本ソフトウェアの使用を中止することです。 +**1.9 責任:** いかなる場合も、当社またはその株主、関連会社、取締役、役員、従業員、契約社員またはサービスプロバイダーは、ユーザーまたは第三者に対し、本ソフトウェアの使用、動作の中断、遅延、使用不能、収益もしくは利益の損失、報酬の損失、サービス、ビジネスもしくは営業権の遅延、中断もしくは損失、データの損失もしくは破損、暗号通貨の損失、システムもしくはシステムサービスの不具合、故障もしくは停止から生じる損失、情報の的確な転送、通読もしくは送信の失敗、情報の更新もしくは正確な情報の提供の失敗、システムの非互換性もしくは不正確な互換性情報の提供、システムセキュリティに対する違反、または直接的、間接的、派生的、付随的、懲罰的もしくは特別な損害について、これらが本規約、規約の違反、不法行為(過失を含む)その他の事象から生じるか、もしくはそれらに関連するかを問わず、当該損害が予見可能であった場合でも、当該損害が生じる可能性を事前に通知されていた場合でも責任を負いません。いかなる場合も、当社またはその株主、取締役、役員、従業員、関連会社もしくは代理人は、法的主張、損害賠償またはその他の法的責任につき、それらが契約上の行為であるか、不法行為であるか、ユーザーによる本ソフトウェアへのアクセス、その使用もしくはインストールに起因する、またはいずれかの方法でそれに関連するその他の事象によるかを問わず、責任を負いません。付随的または派生的損害の免責または制限を禁止する管轄区域があるため、この責任制限をユーザーに適用することはできません。ユーザーが本ソフトウェアに満足しない場合、ユーザーの唯一かつ排他的な救済方法は、ユーザーが本ソフトウェアの使用を中止することです。 **1.10 補償:** ユーザーは、(a)本契約、(b)ユーザーによる本製品へのアクセス、その使用またはインストール(ユーザーが伝送または受信したデータまたは作業を含む)、および(c)ユーザーまたはいずれかの人物が作成、送信または再発行する、声明、データまたはコンテンツ(第1.7項で未承認として禁止される)など、いずれかの人物による本製品の未承認の使用に起因するか、これらに関連する、いかなる行為、原因、法的主張、損害、負債、要求またはいかなる人物によって主張された合理的な費用、および弁護士費用を含む法的責任からも、当社、その株主、取締役、役員、従業員、関連会社および代理人(「被免責当事者」)を免責、無害に保ち、これらを保護します。この免責には、過失の疑い、重大な過失の疑いまたは当社もしくは被免責当事者の不正行為の疑いに対する当社およびすべての被免責当事者の明示的な免責が含まれます。 @@ -38,7 +38,7 @@ **1.15 完全条項 – 依存の否定:** 本規約は、すべてのユーザーに適用される一般条件、および当社が作成または提供する特定の製品またはサービスをダウンロード、利用、操作するユーザーに適用される特別条件で構成されます。本規約は、その主題事項に関する両当事者の完全な合意を構成し、従前のすべての合意または了解事項に優先します。各当事者は、本規約に明示的に記載されるもの以外の声明、了解事項、表明、期待または合意に依存していないことを明示的に保証し、表明します。 -**1.16 紛争の解決:** 本規約は拘束力のある仲裁が適用されます。ユーザーは、本契約またはユーザーもしくはその他の人物による本製品へのアクセス、その使用もしくはインストールに起因する、またはいずれかの方法でこれらに関連する、いずれかの人物に対する紛争または法的主張の一切は、国際商業会議所の仲裁規則による拘束力のある仲裁に基づいて、当該規則に従って指名された1名以上の仲裁人によって解決されることに合意します。仲裁地は香港とし、仲裁手続きの使用言語は英語とします。 +**1.16 紛争の解決:** 本規約は拘束力のある仲裁が適用されます。ユーザーは、本契約またはユーザーもしくはその他の人物による本製品へのアクセス、その使用もしくはインストールに起因する、またはいずれかの方法でこれらに関連する、いずれかの人物に対する紛争または法的主張の一切は、国際商業会議所の仲裁規則による拘束力のある仲裁に基づいて、当該規則に従って指名された1名以上の仲裁人によって解決されることに合意します。仲裁地は香港とし、仲裁手続きの使用言語は英語とする。 **1.17 言語:** 本規約は英語で作成されています。英語版と多言語版で矛盾がある場合は、英語版が優先されます。 @@ -70,7 +70,7 @@ **3.7 禁止事項:** ユーザーは、いかなるデバイス、ソフトウェア、またはルーティンをインセンティブ付きテストネットの正常な機能に干渉するために使用する、および第三者にその使用を許可することはありません。違反行為の告発または通告があった場合、ユーザーの参加は通知なしに解決まで一時中断され、速やかに解決しない場合は終了されます。 -**3.8 保証:** サービスは、ユーザーに「現状有姿」および「利用可能な範囲」ベースで提供され、サービスに関するすべての保証は明示、黙示、法律上の如何を問わず本規約により免責となります。ユーザーは、インセンティブ付きテストネットが正常に動作しない場合があり、エラー、設計上の欠陥その他の不具合が発生し得ることを認識するものとします。ユーザーによるインセンティブ付きテストネットの使用は、ユーザーの責任および裁量で行うものとします。IOHKは、システムにエラーや悪意のある行為が生じた場合、インセンティブ付きテストネットを再起動する、または報酬の全部もしくは一部を取り消す権利を留保します。 +**3.8 保証:** 製品は、ユーザーに「現状有姿」および「利用可能な範囲」ベースで提供され、製品に関するすべての保証は明示、黙示、法律上の如何を問わず本規約により免責となります。ユーザーは、インセンティブ付きテストネットが正常に動作しない場合があり、エラー、設計上の欠陥その他の不具合が発生し得ることを認識するものとします。ユーザーによるインセンティブ付きテストネットの使用は、ユーザーの責任および裁量で行うものとします。当社は、システムにエラーや悪意のある行為が生じた場合、インセンティブ付きテストネットを再起動する、または報酬の全部もしくは一部を取り消す権利を留保します。 **3.9 インセンティブ付きテストネットの終了:** ユーザーは、当社がいつでもその単独の裁量でインセンティブ付きテストネット(またはそのいずれの部分)を変更、撤回、もしくは終了する、またはこれへのアクセスを終了することができることを理解し、これに合意します。ユーザーは、インセンティブ付きテストネットへの参加をいつでも終了することがき、その時点までに得た報酬はインセンティブ付きテストネットが終了するとユーザーのDaedalusまたはYoroiメインネットウォレットに移されます。 diff --git a/source/renderer/app/stores/HardwareWalletsStore.ts b/source/renderer/app/stores/HardwareWalletsStore.ts index 3243ac43e7..56d9985649 100644 --- a/source/renderer/app/stores/HardwareWalletsStore.ts +++ b/source/renderer/app/stores/HardwareWalletsStore.ts @@ -84,12 +84,8 @@ import type { VotingDataType, } from '../api/transactions/types'; import type { - HardwareWalletLocalData, - HardwareWalletsLocalData, - HardwareWalletDevicesType, SetHardwareWalletLocalDataRequestType, SetHardwareWalletDeviceRequestType, - UnpairedHardwareWalletData, } from '../api/utils/localStorage'; import type { TransportDevice, @@ -101,6 +97,12 @@ import type { TrezorWitness, } from '../../../common/types/hardware-wallets.types'; import { logger } from '../utils/logging'; +import { + HardwareWalletDevicesType, + HardwareWalletLocalData, + HardwareWalletsLocalData, + UnpairedHardwareWalletData, +} from '../types/localDataTypes'; export type TxSignRequestTypes = { coinSelection: CoinSelectionsResponse; diff --git a/source/renderer/app/stores/WalletSettingsStore.ts b/source/renderer/app/stores/WalletSettingsStore.ts index 7a0c407278..10ab29743b 100644 --- a/source/renderer/app/stores/WalletSettingsStore.ts +++ b/source/renderer/app/stores/WalletSettingsStore.ts @@ -9,8 +9,8 @@ import { getStatusFromWalletData } from '../utils/walletRecoveryPhraseVerificati import { getRawWalletId } from '../api/utils'; import type { WalletExportToFileParams } from '../actions/wallet-settings-actions'; import type { WalletUtxos } from '../api/wallets/types'; -import type { WalletLocalData } from '../api/utils/localStorage'; import { RECOVERY_PHRASE_VERIFICATION_STATUSES } from '../config/walletRecoveryPhraseVerificationConfig'; +import { WalletLocalData } from '../types/localDataTypes'; export default class WalletSettingsStore extends Store { @observable diff --git a/source/renderer/app/stores/WalletsLocalStore.ts b/source/renderer/app/stores/WalletsLocalStore.ts index 09cc77495a..dc6ea6df2f 100644 --- a/source/renderer/app/stores/WalletsLocalStore.ts +++ b/source/renderer/app/stores/WalletsLocalStore.ts @@ -2,7 +2,7 @@ import { observable, computed } from 'mobx'; import Store from './lib/Store'; import Request from './lib/LocalizedRequest'; import { asyncForEach } from '../utils/asyncForEach'; -import type { WalletsLocalData } from '../api/utils/localStorage'; +import { WalletsLocalData } from '../types/localDataTypes'; export default class WalletsLocalStore extends Store { @observable diff --git a/source/renderer/app/types/localDataTypes.ts b/source/renderer/app/types/localDataTypes.ts new file mode 100644 index 0000000000..63a9e5906a --- /dev/null +++ b/source/renderer/app/types/localDataTypes.ts @@ -0,0 +1,39 @@ +import { StorageKey } from '../../../common/types/electron-store.types'; +import { + DeviceType, + HardwareWalletExtendedPublicKeyResponse, + TransportDevice, +} from '../../../common/types/hardware-wallets.types'; + +export type WalletLocalData = { + id: string; + recoveryPhraseVerificationDate?: Date | null | undefined; + creationDate: Date; + showUsedAddresses: boolean; +}; + +export type WalletsLocalData = Record; + +export type UnpairedHardwareWalletData = { + deviceType?: DeviceType; + deviceModel?: string; + deviceName?: string; + path?: string | null | undefined; + paired?: string | null | undefined; + disconnected?: boolean; +}; + +export type HardwareWalletLocalData = { + id: string; + deviceType: DeviceType; + device: TransportDevice; + extendedPublicKey: HardwareWalletExtendedPublicKeyResponse; + disconnected: boolean; +}; + +export type HardwareWalletsLocalData = Record; +export type HardwareWalletDevicesType = Record; + +export type AssetLocalData = { + decimals?: number; +}; diff --git a/yarn2nix.nix b/yarn2nix.nix index c50af66947..20bac58265 100644 --- a/yarn2nix.nix +++ b/yarn2nix.nix @@ -10,7 +10,7 @@ , lz4 , pkgconfig , systemd -, writeShellScriptBin +, writeShellScript , xz , nodePackages , zlib @@ -35,24 +35,29 @@ let main = "main/index.js"; }; newPackagePath = builtins.toFile "package.json" (builtins.toJSON newPackage); - windowsElectronVersion = "13.6.3"; - electronPath = "https://github.com/electron/electron/releases/download/v${windowsElectronVersion}"; + electronVersion = origPackage.dependencies.electron; + electronPath = "https://github.com/electron/electron/releases/download/v${electronVersion}"; windowsElectron = fetchurl { - url = "${electronPath}/electron-v${windowsElectronVersion}-win32-x64.zip"; + url = "${electronPath}/electron-v${electronVersion}-win32-x64.zip"; sha256 = "18085a2509447fef8896daeee96a12f48f8e60a4d5ec4cfab44d8d59b9d89a72"; }; electronPathHash = builtins.hashString "sha256" electronPath; electron-cache = runCommand "electron-cache" {} '' # newer style mkdir -p $out/${electronPathHash}/ - ln -sv ${windowsElectron} $out/${electronPathHash}/electron-v${windowsElectronVersion}-win32-x64.zip - mkdir $out/httpsgithub.comelectronelectronreleasesdownloadv${windowsElectronVersion}electron-v${windowsElectronVersion}-win32-x64.zip - ln -s ${windowsElectron} $out/httpsgithub.comelectronelectronreleasesdownloadv${windowsElectronVersion}electron-v${windowsElectronVersion}-win32-x64.zip/electron-v${windowsElectronVersion}-win32-x64.zip + ln -sv ${windowsElectron} $out/${electronPathHash}/electron-v${electronVersion}-win32-x64.zip + mkdir $out/httpsgithub.comelectronelectronreleasesdownloadv${electronVersion}electron-v${electronVersion}-win32-x64.zip + ln -s ${windowsElectron} $out/httpsgithub.comelectronelectronreleasesdownloadv${electronVersion}electron-v${electronVersion}-win32-x64.zip/electron-v${electronVersion}-win32-x64.zip ''; - electron-gyp = fetchurl { - url = "https://www.electronjs.org/headers/v${windowsElectronVersion}/node-v${windowsElectronVersion}-headers.tar.gz"; + electron-node-headers = fetchurl { + url = "https://www.electronjs.org/headers/v${electronVersion}/node-v${electronVersion}-headers.tar.gz"; sha256 = "f8567511857ab62659505ba5158b6ad69afceb512105a3251d180fe47f44366c"; }; + electron-node-headers-unpacked = runCommand "electron-node-headers-${electronVersion}-unpacked" {} '' + tar -xf ${electron-node-headers} + mkdir -p $out + mv node_headers/* $out/ + ''; filter = name: type: let baseName = baseNameOf (toString name); sansPrefix = lib.removePrefix (toString ./.) name; @@ -74,6 +79,38 @@ let pkgconfig libusb ]; + + # We patch `node_modules/electron-rebuild` to force specific Node.js + # headers to be used when building native extensions for + # Electron. Electron’s Node.js ABI differs from the same version of + # Node.js, because different libraries are used in Electon, + # e.g. BoringSSL instead of OpenSSL, + # cf. + # + # We also use this same code in `shell.nix`, since for some reason + # `electron-rebuild` there determines incorrect headers to use + # automatically, and we keep getting ABI errors. TODO: investigate + # why… + # + # TODO: That `sed` is rather awful… Can it be done better? – @michalrus + patchElectronRebuild = writeShellScript "patch-electron-rebuild" '' + echo 'Patching electron-rebuild to force our Node.js headers…' + + nodeGypJs=lib/src/module-type/node-gyp.js + if [ ! -e $nodeGypJs ] ; then + # makes it work both here, and in shell.nix: + nodeGypJs="node_modules/electron-rebuild/$nodeGypJs" + fi + if [ ! -e $nodeGypJs ] ; then + echo >&2 'fatal: shouldn’t happen unless electron-rebuild changes' + exit 1 + fi + + # Patch idempotently (matters in repetitive shell.nix): + if ! grep -qF ${electron-node-headers} $nodeGypJs ; then + sed -r 's|const extraNodeGypArgs.*|\0 extraNodeGypArgs.push("--tarball", "${electron-node-headers}", "--nodedir", "${electron-node-headers-unpacked}");|' -i $nodeGypJs + fi + ''; in yarn2nix.mkYarnPackage { name = "daedalus-js"; @@ -141,12 +178,6 @@ yarn2nix.mkYarnPackage { export HOME=$(realpath home) yarn --offline run build - mkdir -pv $HOME/.electron-gyp/ - tar -xvf ${electron-gyp} -C $HOME/.electron-gyp - mv -vi $HOME/.electron-gyp/node_headers $HOME/.electron-gyp/${windowsElectronVersion}/ - - ln -sv $HOME/.electron-gyp $HOME/.node-gyp - #export DEBUG=electron-rebuild ls -ltrha $NIX_BUILD_TOP/daedalus/node_modules/ @@ -206,25 +237,24 @@ yarn2nix.mkYarnPackage { # libunistring # libusb1 #] ++ stdenv.cc.libc.buildInputs; + + # `yarnPreBuild` is only used in `yarn2nix.mkYarnModules`, not `yarn2nix.mkYarnPackage`: yarnPreBuild = '' mkdir -p $HOME/.node-gyp/${nodejs.version} echo 9 > $HOME/.node-gyp/${nodejs.version}/installVersion ln -sfv ${nodejs}/include $HOME/.node-gyp/${nodejs.version} ''; + + inherit patchElectronRebuild; # for use in shell.nix + pkgConfig = { electron-rebuild = { - # TODO: That is rather awful… Can it be done better? – @michalrus postInstall = '' - nodeGypJs=lib/src/module-type/node-gyp.js - if [ ! -e $nodeGypJs ] ; then - echo >&2 'shouldn’t happen unless electron-rebuild changes' - exit 1 - fi - - sed -r 's|const extraNodeGypArgs.*|\0 extraNodeGypArgs.push("--tarball", "${electron-gyp}", "--nodedir", process.env["HOME"] + "/.node-gyp/${windowsElectronVersion}");|' -i $nodeGypJs + ${patchElectronRebuild} ''; }; }; + # work around some purity problems in nix yarnLock = ./yarn.lock; packageJSON = ./package.json;