From e79a8d586d172bb9b3217c4977adac1ceaa714d8 Mon Sep 17 00:00:00 2001 From: JunichiSugiura Date: Tue, 11 Jan 2022 15:09:02 +0100 Subject: [PATCH 01/13] handle exchange action --- src/components/DeviceAction/index.js | 14 ++++++++++++++ src/components/DeviceAction/rendering.js | 16 ++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/components/DeviceAction/index.js b/src/components/DeviceAction/index.js index 083a1431a7..8ed0cdda60 100644 --- a/src/components/DeviceAction/index.js +++ b/src/components/DeviceAction/index.js @@ -4,6 +4,7 @@ import type { Action, Device, } from "@ledgerhq/live-common/lib/hw/actions/types"; +import { TRANSACTION_TYPES } from "@ledgerhq/live-common/lib/exchange/hw-app-exchange/Exchange"; import { useTranslation } from "react-i18next"; import { useNavigation, useTheme } from "@react-navigation/native"; import ValidateOnDevice from "../ValidateOnDevice"; @@ -19,6 +20,7 @@ import { renderInWrongAppForAccount, renderError, renderBootloaderStep, + renderExchange, renderConfirmSwap, renderConfirmSell, } from "./rendering"; @@ -71,6 +73,9 @@ export default function DeviceAction({ initSwapResult, signMessageRequested, allowOpeningGranted, + completeExchangeStarted, + completeExchangeResult, + completeExchangeError, initSellRequested, initSellResult, initSellError, @@ -145,6 +150,15 @@ export default function DeviceAction({ }); } + if ( + completeExchangeStarted && + !completeExchangeResult && + !completeExchangeError + ) { + // $FlowFixMe + return renderExchange({ exchangeType: request?.exchangeType }); + } + if (initSwapRequested && !initSwapResult && !initSwapError) { return renderConfirmSwap({ t, device: selectedDevice, colors, theme }); } diff --git a/src/components/DeviceAction/rendering.js b/src/components/DeviceAction/rendering.js index ff079d4e6c..c10f95a555 100644 --- a/src/components/DeviceAction/rendering.js +++ b/src/components/DeviceAction/rendering.js @@ -5,6 +5,7 @@ import Icon from "react-native-vector-icons/dist/Feather"; import { WrongDeviceForAccount, UnexpectedBootloader } from "@ledgerhq/errors"; import type { TokenCurrency } from "@ledgerhq/live-common/lib/types"; import type { Device } from "@ledgerhq/live-common/lib/hw/actions/types"; +import { TRANSACTION_TYPES } from "@ledgerhq/live-common/lib/exchange/hw-app-exchange/Exchange"; import { urls } from "../../config/urls"; import LText from "../LText"; import Alert from "../Alert"; @@ -424,6 +425,21 @@ export function renderLoading({ ); } +export function renderExchange({ + transactionType, +}: { + transactionType: string, +}) { + switch (transactionType) { + case TRANSACTION_TYPES.SWAP: + return {"Confirm swap on your device"}; + case TRANSACTION_TYPES.SELL: + return {"Confirm swap on your device"}; + default: + return {"Confirm exchange on your device"}; + } +} + type WarningOutdatedProps = { ...RawProps, colors: *, From 2f19877f590b9c8fad616370eeff911de78b7fb0 Mon Sep 17 00:00:00 2001 From: JunichiSugiura Date: Tue, 11 Jan 2022 15:12:54 +0100 Subject: [PATCH 02/13] add new tracking events --- src/components/WebPlatformPlayer/tracking.js | 29 ++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/components/WebPlatformPlayer/tracking.js b/src/components/WebPlatformPlayer/tracking.js index aa2b968926..25fcb08d29 100644 --- a/src/components/WebPlatformPlayer/tracking.js +++ b/src/components/WebPlatformPlayer/tracking.js @@ -92,3 +92,32 @@ export function platformBroadcastSuccess(manifest: AppManifest) { export function platformBroadcastOperationDetailsClick(manifest: AppManifest) { track("Platform Broadcast OpD Clicked", getEventData(manifest)); } + +// Generate Exchange nonce modal open +export function platformStartExchangeRequested(manifest: AppManifest) { + track("Platform start Exchange Nonce request", getEventData(manifest)); +} + +// Successfully generated an Exchange app nonce +export function platformStartExchangeSuccess(manifest: AppManifest) { + track("Platform start Exchange Nonce success", getEventData(manifest)); +} + +// Failed to generate an Exchange app nonce +export function platformStartExchangeFail(manifest: AppManifest) { + track("Platform start Exchange Nonce fail", getEventData(manifest)); +} + +export function platformCompleteExchangeRequested(manifest: AppManifest) { + track("Platform complete Exchange requested", getEventData(manifest)); +} + +// Successfully completed an Exchange +export function platformCompleteExchangeSuccess(manifest: AppManifest) { + track("Platform complete Exchange success", getEventData(manifest)); +} + +// Failed to complete an Exchange +export function platformCompleteExchangeFail(manifest: AppManifest) { + track("Platform complete Exchange Nonce fail", getEventData(manifest)); +} From 22b2eb1554d9244125164782fe547540b25e7412 Mon Sep 17 00:00:00 2001 From: JunichiSugiura Date: Wed, 26 Jan 2022 16:37:24 +0100 Subject: [PATCH 03/13] implement startExchange --- package.json | 2 +- src/components/DeviceAction/rendering.js | 7 +- src/components/RootNavigator/BaseNavigator.js | 6 + .../PlatformExchangeNavigator.js | 35 ++ src/components/WebPlatformPlayer/index.js | 123 ++++- src/const/navigation.js | 2 + src/screens/Platform/exchange/Connect.js | 51 ++ yarn.lock | 442 +++++------------- 8 files changed, 343 insertions(+), 325 deletions(-) create mode 100644 src/components/RootNavigator/PlatformExchangeNavigator.js create mode 100644 src/screens/Platform/exchange/Connect.js diff --git a/package.json b/package.json index 839fc6785f..9c100eb933 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "@ledgerhq/errors": "6.10.0", "@ledgerhq/hw-transport": "6.20.0", "@ledgerhq/hw-transport-http": "6.20.0", - "@ledgerhq/live-common": "^21.26.0", + "@ledgerhq/live-common": "21.27.0", "@ledgerhq/logs": "6.10.0", "@ledgerhq/react-native-hid": "6.21.0", "@ledgerhq/react-native-hw-transport-ble": "6.20.0", diff --git a/src/components/DeviceAction/rendering.js b/src/components/DeviceAction/rendering.js index c10f95a555..2bd4ecd7f3 100644 --- a/src/components/DeviceAction/rendering.js +++ b/src/components/DeviceAction/rendering.js @@ -5,7 +5,6 @@ import Icon from "react-native-vector-icons/dist/Feather"; import { WrongDeviceForAccount, UnexpectedBootloader } from "@ledgerhq/errors"; import type { TokenCurrency } from "@ledgerhq/live-common/lib/types"; import type { Device } from "@ledgerhq/live-common/lib/hw/actions/types"; -import { TRANSACTION_TYPES } from "@ledgerhq/live-common/lib/exchange/hw-app-exchange/Exchange"; import { urls } from "../../config/urls"; import LText from "../LText"; import Alert from "../Alert"; @@ -428,12 +427,12 @@ export function renderLoading({ export function renderExchange({ transactionType, }: { - transactionType: string, + transactionType: number, }) { switch (transactionType) { - case TRANSACTION_TYPES.SWAP: + case 0x00: return {"Confirm swap on your device"}; - case TRANSACTION_TYPES.SELL: + case 0x01: return {"Confirm swap on your device"}; default: return {"Confirm exchange on your device"}; diff --git a/src/components/RootNavigator/BaseNavigator.js b/src/components/RootNavigator/BaseNavigator.js index 3f41daf154..7d586fcbf2 100644 --- a/src/components/RootNavigator/BaseNavigator.js +++ b/src/components/RootNavigator/BaseNavigator.js @@ -36,6 +36,7 @@ import AddAccountsNavigator from "./AddAccountsNavigator"; import ExchangeBuyFlowNavigator from "./ExchangeBuyFlowNavigator"; import ExchangeSellFlowNavigator from "./ExchangeSellFlowNavigator"; import ExchangeNavigator from "./ExchangeNavigator"; +import PlatformExchangeNavigator from "./PlatformExchangeNavigator"; import FirmwareUpdateNavigator from "./FirmwareUpdateNavigator"; import AccountSettingsNavigator from "./AccountSettingsNavigator"; import ImportAccountsNavigator from "./ImportAccountsNavigator"; @@ -286,6 +287,11 @@ export default function BaseNavigator() { component={ExchangeSellFlowNavigator} options={{ headerShown: false }} /> + getStackNavigatorConfig(colors, true), + [colors], + ); + + return ( + + + + ); +} + +const Stack = createStackNavigator(); diff --git a/src/components/WebPlatformPlayer/index.js b/src/components/WebPlatformPlayer/index.js index b2ce0335d0..59bbde4342 100644 --- a/src/components/WebPlatformPlayer/index.js +++ b/src/components/WebPlatformPlayer/index.js @@ -24,10 +24,11 @@ import { JSONRPCRequest } from "json-rpc-2.0"; import type { SignedOperation } from "@ledgerhq/live-common/lib/types"; import { getEnv } from "@ledgerhq/live-common/lib/env"; import { getAccountBridge } from "@ledgerhq/live-common/lib/bridge"; +import { getMainAccount } from "@ledgerhq/live-common/lib/account"; import { listCryptoCurrencies, findCryptoCurrencyById, -} from "@ledgerhq/live-common/lib/currencies/index"; +} from "@ledgerhq/live-common/lib/currencies"; import type { AppManifest } from "@ledgerhq/live-common/lib/platform/types"; import type { RawPlatformTransaction } from "@ledgerhq/live-common/lib/platform/rawTypes"; @@ -389,6 +390,122 @@ const WebPlatformPlayer = ({ manifest, inputs }: Props) => { [manifest, accounts], ); + const startExchange = useCallback( + ({ exchangeType }: { exchangeType: number }) => { + tracking.platformStartExchangeRequested(manifest); + + return new Promise((resolve, reject) => { + navigation.navigate(NavigatorName.PlatformExchange, { + screen: ScreenName.PlatformExchangeConnect, + params: { + exchangeType, + onSuccess: nonce => { + tracking.platformStartExchangeSuccess(manifest); + resolve(nonce); + }, + onError: error => { + tracking.platformStartExchangeFail(manifest); + reject(error); + }, + }, + }); + }); + }, + [manifest, navigation], + ); + + const completeExchange = useCallback( + ({ + provider, + fromAccountId, + toAccountId, + transaction, + binaryPayload, + signature, + feesStrategy, + exchangeType, + }: { + provider: string, + fromAccountId: string, + toAccountId: string, + transaction: RawPlatformTransaction, + binaryPayload: string, + signature: string, + feesStrategy: string, + exchangeType: number, + }) => { + // Nb get a hold of the actual accounts, and parent accounts + const fromAccount = accounts.find(a => a.id === fromAccountId); + let fromParentAccount; + + const toAccount = accounts.find(a => a.id === toAccountId); + let toParentAccount; + + if (!fromAccount) { + return null; + } + + if (exchangeType === 0x00 && !toAccount) { + // if we do a swap, a destination account must be provided + return null; + } + + if (fromAccount.type === "TokenAccount") { + fromParentAccount = accounts.find(a => a.id === fromAccount.parentId); + } + if (toAccount && toAccount.type === "TokenAccount") { + toParentAccount = accounts.find(a => a.id === toAccount.parentId); + } + + const accountBridge = getAccountBridge(fromAccount, fromParentAccount); + const mainFromAccount = getMainAccount(fromAccount, fromParentAccount); + + // eslint-disable-next-line no-param-reassign + transaction.family = mainFromAccount.currency.family; + + const platformTransaction = deserializePlatformTransaction(transaction); + + platformTransaction.feesStrategy = feesStrategy; + + let processedTransaction = accountBridge.createTransaction( + mainFromAccount, + ); + processedTransaction = processedTransaction.updateTransaction( + processedTransaction, + platformTransaction, + ); + + tracking.platformCompleteExchangeRequested(manifest); + return new Promise((resolve, reject) => { + // dispatch( + // openModal("MODAL_PLATFORM_EXCHANGE_COMPLETE", { + // provider, + // exchange: { + // fromAccount, + // fromParentAccount, + // toAccount, + // toParentAccount, + // }, + // transaction: processedTransaction, + // binaryPayload, + // signature, + // feesStrategy, + // exchangeType, + // onResult: operation => { + // tracking.platformCompleteExchangeSuccess(manifest); + // resolve(operation); + // }, + // onCancel: error => { + // tracking.platformCompleteExchangeFail(manifest); + // reject(error); + // }, + // }), + // ), + }); + }, + [accounts, manifest], + ); + const handlers = useMemo( () => ({ "account.list": listAccounts, @@ -397,6 +514,8 @@ const WebPlatformPlayer = ({ manifest, inputs }: Props) => { "account.receive": receiveOnAccount, "transaction.sign": signTransaction, "transaction.broadcast": broadcastTransaction, + "exchange.start": startExchange, + "exchange.complete": completeExchange, }), [ listAccounts, @@ -405,6 +524,8 @@ const WebPlatformPlayer = ({ manifest, inputs }: Props) => { receiveOnAccount, signTransaction, broadcastTransaction, + startExchange, + completeExchange, ], ); diff --git a/src/const/navigation.js b/src/const/navigation.js index 9b9f358472..d23c025b6b 100644 --- a/src/const/navigation.js +++ b/src/const/navigation.js @@ -295,6 +295,7 @@ export const ScreenName = { PlatformCatalog: "PlatformCatalog", PlatformApp: "PlatformApp", + PlatformExchangeConnect: "PlatformExchangeConnect", WalletConnectScan: "WalletConnectScan", WalletConnectConnect: "WalletConnectConnect", @@ -348,6 +349,7 @@ export const NavigatorName = { PasswordAddFlow: "PasswordAddFlow", PasswordModifyFlow: "PasswordModifyFlow", Platform: "Platform", + PlatformExchange: "PlatformExchange", ReceiveFunds: "ReceiveFunds", SendFunds: "SendFunds", Settings: "Settings", diff --git a/src/screens/Platform/exchange/Connect.js b/src/screens/Platform/exchange/Connect.js new file mode 100644 index 0000000000..ca9f6bbb6c --- /dev/null +++ b/src/screens/Platform/exchange/Connect.js @@ -0,0 +1,51 @@ +// @flow +import React, { useState, useCallback } from "react"; +import { StyleSheet } from "react-native"; +import SafeAreaView from "react-native-safe-area-view"; +import connectApp from "@ledgerhq/live-common/lib/hw/connectApp"; +import { createAction } from "@ledgerhq/live-common/lib/hw/actions/startExchange"; +import startExchange from "@ledgerhq/live-common/lib/exchange/platform/startExchange"; +import DeviceActionModal from "../../../components/DeviceActionModal"; +import SelectDevice from "../../../components/SelectDevice"; + +export default function PlatformExchangeConnect({ + navigation, + route, +}: { + navigation: any, + route: { + params: { exchangeType: number, onSuccess: (nounce: number) => void }, + }, +}) { + const [device, setDevice] = useState(null); + + const onResult = useCallback( + (data: { startExchangeResult: number }) => { + route.params.onSuccess(data.startExchangeResult); + navigation.goBack(); + }, + [route, navigation], + ); + + return ( + + + + + ); +} + +const action = createAction(connectApp, startExchange); + +const styles = StyleSheet.create({ + root: { + flex: 1, + padding: 32, + }, +}); diff --git a/yarn.lock b/yarn.lock index 97f38926c7..b0cd25c76a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1384,7 +1384,7 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" -"@ethersproject/abi@5.5.0", "@ethersproject/abi@^5.5.0": +"@ethersproject/abi@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.5.0.tgz#fb52820e22e50b854ff15ce1647cc508d6660613" integrity sha512-loW7I4AohP5KycATvc0MgujU6JyCHPqHdeoo9z3Nr9xEiNioxa65ccdm1+fsoJhkuhdRtfcL8cfyGamz2AxZ5w== @@ -1399,7 +1399,7 @@ "@ethersproject/properties" "^5.5.0" "@ethersproject/strings" "^5.5.0" -"@ethersproject/abstract-provider@5.5.1", "@ethersproject/abstract-provider@^5.5.0": +"@ethersproject/abstract-provider@^5.5.0": version "5.5.1" resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.5.1.tgz#2f1f6e8a3ab7d378d8ad0b5718460f85649710c5" integrity sha512-m+MA/ful6eKbxpr99xUYeRvLkfnlqzrF8SZ46d/xFB1A7ZVknYc/sXJG0RcufF52Qn2jeFj1hhcoQ7IXjNKUqg== @@ -1412,7 +1412,7 @@ "@ethersproject/transactions" "^5.5.0" "@ethersproject/web" "^5.5.0" -"@ethersproject/abstract-signer@5.5.0", "@ethersproject/abstract-signer@^5.5.0": +"@ethersproject/abstract-signer@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.5.0.tgz#590ff6693370c60ae376bf1c7ada59eb2a8dd08d" integrity sha512-lj//7r250MXVLKI7sVarXAbZXbv9P50lgmJQGr2/is82EwEb8r7HrxsmMqAjTsztMYy7ohrIhGMIml+Gx4D3mA== @@ -1423,7 +1423,7 @@ "@ethersproject/logger" "^5.5.0" "@ethersproject/properties" "^5.5.0" -"@ethersproject/address@5.5.0", "@ethersproject/address@^5.5.0": +"@ethersproject/address@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.5.0.tgz#bcc6f576a553f21f3dd7ba17248f81b473c9c78f" integrity sha512-l4Nj0eWlTUh6ro5IbPTgbpT4wRbdH5l8CQf7icF7sb/SI3Nhd9Y9HzhonTSTi6CefI0necIw7LJqQPopPLZyWw== @@ -1434,22 +1434,14 @@ "@ethersproject/logger" "^5.5.0" "@ethersproject/rlp" "^5.5.0" -"@ethersproject/base64@5.5.0", "@ethersproject/base64@^5.5.0": +"@ethersproject/base64@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.5.0.tgz#881e8544e47ed976930836986e5eb8fab259c090" integrity sha512-tdayUKhU1ljrlHzEWbStXazDpsx4eg1dBXUSI6+mHlYklOXoXF6lZvw8tnD6oVaWfnMxAgRSKROg3cVKtCcppA== dependencies: "@ethersproject/bytes" "^5.5.0" -"@ethersproject/basex@5.5.0", "@ethersproject/basex@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.5.0.tgz#e40a53ae6d6b09ab4d977bd037010d4bed21b4d3" - integrity sha512-ZIodwhHpVJ0Y3hUCfUucmxKsWQA5TMnavp5j/UOuDdzZWzJlRmuOjcTMIGgHCYuZmHt36BfiSyQPSRskPxbfaQ== - dependencies: - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - -"@ethersproject/bignumber@5.5.0", "@ethersproject/bignumber@^5.5.0": +"@ethersproject/bignumber@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.5.0.tgz#875b143f04a216f4f8b96245bde942d42d279527" integrity sha512-6Xytlwvy6Rn3U3gKEc1vP7nR92frHkv6wtVr95LFR3jREXiCPzdWxKQ1cx4JGQBXxcguAwjA8murlYN2TSiEbg== @@ -1458,37 +1450,21 @@ "@ethersproject/logger" "^5.5.0" bn.js "^4.11.9" -"@ethersproject/bytes@5.5.0", "@ethersproject/bytes@^5.5.0": +"@ethersproject/bytes@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.5.0.tgz#cb11c526de657e7b45d2e0f0246fb3b9d29a601c" integrity sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog== dependencies: "@ethersproject/logger" "^5.5.0" -"@ethersproject/constants@5.5.0", "@ethersproject/constants@^5.5.0": +"@ethersproject/constants@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.5.0.tgz#d2a2cd7d94bd1d58377d1d66c4f53c9be4d0a45e" integrity sha512-2MsRRVChkvMWR+GyMGY4N1sAX9Mt3J9KykCsgUFd/1mwS0UH1qw+Bv9k1UJb3X3YJYFco9H20pjSlOIfCG5HYQ== dependencies: "@ethersproject/bignumber" "^5.5.0" -"@ethersproject/contracts@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.5.0.tgz#b735260d4bd61283a670a82d5275e2a38892c197" - integrity sha512-2viY7NzyvJkh+Ug17v7g3/IJC8HqZBDcOjYARZLdzRxrfGlRgmYgl6xPRKVbEzy1dWKw/iv7chDcS83pg6cLxg== - dependencies: - "@ethersproject/abi" "^5.5.0" - "@ethersproject/abstract-provider" "^5.5.0" - "@ethersproject/abstract-signer" "^5.5.0" - "@ethersproject/address" "^5.5.0" - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/constants" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/transactions" "^5.5.0" - -"@ethersproject/hash@5.5.0", "@ethersproject/hash@^5.5.0": +"@ethersproject/hash@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.5.0.tgz#7cee76d08f88d1873574c849e0207dcb32380cc9" integrity sha512-dnGVpK1WtBjmnp3mUT0PlU2MpapnwWI0PibldQEq1408tQBAbZpPidkWoVVuNMOl/lISO3+4hXZWCL3YV7qzfg== @@ -1502,44 +1478,7 @@ "@ethersproject/properties" "^5.5.0" "@ethersproject/strings" "^5.5.0" -"@ethersproject/hdnode@5.5.0", "@ethersproject/hdnode@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.5.0.tgz#4a04e28f41c546f7c978528ea1575206a200ddf6" - integrity sha512-mcSOo9zeUg1L0CoJH7zmxwUG5ggQHU1UrRf8jyTYy6HxdZV+r0PBoL1bxr+JHIPXRzS6u/UW4mEn43y0tmyF8Q== - dependencies: - "@ethersproject/abstract-signer" "^5.5.0" - "@ethersproject/basex" "^5.5.0" - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/pbkdf2" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/sha2" "^5.5.0" - "@ethersproject/signing-key" "^5.5.0" - "@ethersproject/strings" "^5.5.0" - "@ethersproject/transactions" "^5.5.0" - "@ethersproject/wordlists" "^5.5.0" - -"@ethersproject/json-wallets@5.5.0", "@ethersproject/json-wallets@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.5.0.tgz#dd522d4297e15bccc8e1427d247ec8376b60e325" - integrity sha512-9lA21XQnCdcS72xlBn1jfQdj2A1VUxZzOzi9UkNdnokNKke/9Ya2xA9aIK1SC3PQyBDLt4C+dfps7ULpkvKikQ== - dependencies: - "@ethersproject/abstract-signer" "^5.5.0" - "@ethersproject/address" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/hdnode" "^5.5.0" - "@ethersproject/keccak256" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/pbkdf2" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/random" "^5.5.0" - "@ethersproject/strings" "^5.5.0" - "@ethersproject/transactions" "^5.5.0" - aes-js "3.0.0" - scrypt-js "3.0.1" - -"@ethersproject/keccak256@5.5.0", "@ethersproject/keccak256@^5.5.0": +"@ethersproject/keccak256@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.5.0.tgz#e4b1f9d7701da87c564ffe336f86dcee82983492" integrity sha512-5VoFCTjo2rYbBe1l2f4mccaRFN/4VQEYFwwn04aJV2h7qf4ZvI2wFxUE1XOX+snbwCLRzIeikOqtAoPwMza9kg== @@ -1547,18 +1486,11 @@ "@ethersproject/bytes" "^5.5.0" js-sha3 "0.8.0" -"@ethersproject/logger@5.5.0", "@ethersproject/logger@^5.5.0": +"@ethersproject/logger@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.5.0.tgz#0c2caebeff98e10aefa5aef27d7441c7fd18cf5d" integrity sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg== -"@ethersproject/networks@5.5.1": - version "5.5.1" - resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.5.1.tgz#b7f7b9fb88dec1ea48f739b7fb9621311aa8ce6c" - integrity sha512-tYRDM4zZtSUcKnD4UMuAlj7SeXH/k5WC4SP2u1Pn57++JdXHkRu2zwNkgNogZoxHzhm9Q6qqurDBVptHOsW49Q== - dependencies: - "@ethersproject/logger" "^5.5.0" - "@ethersproject/networks@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.5.0.tgz#babec47cab892c51f8dd652ce7f2e3e14283981a" @@ -1566,55 +1498,14 @@ dependencies: "@ethersproject/logger" "^5.5.0" -"@ethersproject/pbkdf2@5.5.0", "@ethersproject/pbkdf2@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.5.0.tgz#e25032cdf02f31505d47afbf9c3e000d95c4a050" - integrity sha512-SaDvQFvXPnz1QGpzr6/HToLifftSXGoXrbpZ6BvoZhmx4bNLHrxDe8MZisuecyOziP1aVEwzC2Hasj+86TgWVg== - dependencies: - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/sha2" "^5.5.0" - -"@ethersproject/properties@5.5.0", "@ethersproject/properties@^5.5.0": +"@ethersproject/properties@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.5.0.tgz#61f00f2bb83376d2071baab02245f92070c59995" integrity sha512-l3zRQg3JkD8EL3CPjNK5g7kMx4qSwiR60/uk5IVjd3oq1MZR5qUg40CNOoEJoX5wc3DyY5bt9EbMk86C7x0DNA== dependencies: "@ethersproject/logger" "^5.5.0" -"@ethersproject/providers@5.5.1": - version "5.5.1" - resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.5.1.tgz#ba87e3c93219bbd2e2edf8b369873aee774abf04" - integrity sha512-2zdD5sltACDWhjUE12Kucg2PcgM6V2q9JMyVvObtVGnzJu+QSmibbP+BHQyLWZUBfLApx2942+7DC5D+n4wBQQ== - dependencies: - "@ethersproject/abstract-provider" "^5.5.0" - "@ethersproject/abstract-signer" "^5.5.0" - "@ethersproject/address" "^5.5.0" - "@ethersproject/basex" "^5.5.0" - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/constants" "^5.5.0" - "@ethersproject/hash" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/networks" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/random" "^5.5.0" - "@ethersproject/rlp" "^5.5.0" - "@ethersproject/sha2" "^5.5.0" - "@ethersproject/strings" "^5.5.0" - "@ethersproject/transactions" "^5.5.0" - "@ethersproject/web" "^5.5.0" - bech32 "1.1.4" - ws "7.4.6" - -"@ethersproject/random@5.5.0", "@ethersproject/random@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.5.0.tgz#305ed9e033ca537735365ac12eed88580b0f81f9" - integrity sha512-egGYZwZ/YIFKMHcoBUo8t3a8Hb/TKYX8BCBoLjudVCZh892welR3jOxgOmb48xznc9bTcMm7Tpwc1gHC1PFNFQ== - dependencies: - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - -"@ethersproject/rlp@5.5.0", "@ethersproject/rlp@^5.5.0": +"@ethersproject/rlp@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.5.0.tgz#530f4f608f9ca9d4f89c24ab95db58ab56ab99a0" integrity sha512-hLv8XaQ8PTI9g2RHoQGf/WSxBfTB/NudRacbzdxmst5VHAqd1sMibWG7SENzT5Dj3yZ3kJYx+WiRYEcQTAkcYA== @@ -1622,7 +1513,7 @@ "@ethersproject/bytes" "^5.5.0" "@ethersproject/logger" "^5.5.0" -"@ethersproject/sha2@5.5.0", "@ethersproject/sha2@^5.5.0": +"@ethersproject/sha2@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.5.0.tgz#a40a054c61f98fd9eee99af2c3cc6ff57ec24db7" integrity sha512-B5UBoglbCiHamRVPLA110J+2uqsifpZaTmid2/7W5rbtYVz6gus6/hSDieIU/6gaKIDcOj12WnOdiymEUHIAOA== @@ -1631,7 +1522,7 @@ "@ethersproject/logger" "^5.5.0" hash.js "1.1.7" -"@ethersproject/signing-key@5.5.0", "@ethersproject/signing-key@^5.5.0": +"@ethersproject/signing-key@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.5.0.tgz#2aa37169ce7e01e3e80f2c14325f624c29cedbe0" integrity sha512-5VmseH7qjtNmDdZBswavhotYbWB0bOwKIlOTSlX14rKn5c11QmJwGt4GHeo7NrL/Ycl7uo9AHvEqs5xZgFBTng== @@ -1643,19 +1534,7 @@ elliptic "6.5.4" hash.js "1.1.7" -"@ethersproject/solidity@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.5.0.tgz#2662eb3e5da471b85a20531e420054278362f93f" - integrity sha512-9NgZs9LhGMj6aCtHXhtmFQ4AN4sth5HuFXVvAQtzmm0jpSCNOTGtrHZJAeYTh7MBjRR8brylWZxBZR9zDStXbw== - dependencies: - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/keccak256" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/sha2" "^5.5.0" - "@ethersproject/strings" "^5.5.0" - -"@ethersproject/strings@5.5.0", "@ethersproject/strings@^5.5.0": +"@ethersproject/strings@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.5.0.tgz#e6784d00ec6c57710755699003bc747e98c5d549" integrity sha512-9fy3TtF5LrX/wTrBaT8FGE6TDJyVjOvXynXJz5MT5azq+E6D92zuKNx7i29sWW2FjVOaWjAsiZ1ZWznuduTIIQ== @@ -1664,7 +1543,7 @@ "@ethersproject/constants" "^5.5.0" "@ethersproject/logger" "^5.5.0" -"@ethersproject/transactions@5.5.0", "@ethersproject/transactions@^5.5.0": +"@ethersproject/transactions@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.5.0.tgz#7e9bf72e97bcdf69db34fe0d59e2f4203c7a2908" integrity sha512-9RZYSKX26KfzEd/1eqvv8pLauCKzDTub0Ko4LfIgaERvRuwyaNV78mJs7cpIgZaDl6RJui4o49lHwwCM0526zA== @@ -1679,47 +1558,6 @@ "@ethersproject/rlp" "^5.5.0" "@ethersproject/signing-key" "^5.5.0" -"@ethersproject/units@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.5.0.tgz#104d02db5b5dc42cc672cc4587bafb87a95ee45e" - integrity sha512-7+DpjiZk4v6wrikj+TCyWWa9dXLNU73tSTa7n0TSJDxkYbV3Yf1eRh9ToMLlZtuctNYu9RDNNy2USq3AdqSbag== - dependencies: - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/constants" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - -"@ethersproject/wallet@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.5.0.tgz#322a10527a440ece593980dca6182f17d54eae75" - integrity sha512-Mlu13hIctSYaZmUOo7r2PhNSd8eaMPVXe1wxrz4w4FCE4tDYBywDH+bAR1Xz2ADyXGwqYMwstzTrtUVIsKDO0Q== - dependencies: - "@ethersproject/abstract-provider" "^5.5.0" - "@ethersproject/abstract-signer" "^5.5.0" - "@ethersproject/address" "^5.5.0" - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/hash" "^5.5.0" - "@ethersproject/hdnode" "^5.5.0" - "@ethersproject/json-wallets" "^5.5.0" - "@ethersproject/keccak256" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/random" "^5.5.0" - "@ethersproject/signing-key" "^5.5.0" - "@ethersproject/transactions" "^5.5.0" - "@ethersproject/wordlists" "^5.5.0" - -"@ethersproject/web@5.5.1": - version "5.5.1" - resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.5.1.tgz#cfcc4a074a6936c657878ac58917a61341681316" - integrity sha512-olvLvc1CB12sREc1ROPSHTdFCdvMh0J5GSJYiQg2D0hdD4QmJDy8QYDb1CvoqD/bF1c++aeKv2sR5uduuG9dQg== - dependencies: - "@ethersproject/base64" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/strings" "^5.5.0" - "@ethersproject/web@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.5.0.tgz#0e5bb21a2b58fb4960a705bfc6522a6acf461e28" @@ -1731,17 +1569,6 @@ "@ethersproject/properties" "^5.5.0" "@ethersproject/strings" "^5.5.0" -"@ethersproject/wordlists@5.5.0", "@ethersproject/wordlists@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.5.0.tgz#aac74963aa43e643638e5172353d931b347d584f" - integrity sha512-bL0UTReWDiaQJJYOC9sh/XcRu/9i2jMrzf8VLRmPKx58ckSlOJiohODkECCO50dtLZHcGU6MLXQ4OOrgBwP77Q== - dependencies: - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/hash" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/strings" "^5.5.0" - "@expo/config-plugins@3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@expo/config-plugins/-/config-plugins-3.1.0.tgz#0752ff33c5eab21cf42034a44e79df97f0f867f8" @@ -2122,10 +1949,17 @@ dependencies: commander "^2.20.0" -"@ledgerhq/cryptoassets@6.22.3", "@ledgerhq/cryptoassets@^6.22.3": - version "6.22.3" - resolved "https://registry.yarnpkg.com/@ledgerhq/cryptoassets/-/cryptoassets-6.22.3.tgz#22b9b92acd381f9b297196fdd72fdee6f8fd72f0" - integrity sha512-WNStZt2WVQapZorakOg9dbBqsXnDhjis+HtXKRHOkRCDS3ca0NBgbet1WmoSmZmWXlx727bY/xWNyJcUrRau6w== +"@ledgerhq/cryptoassets@6.23.0": + version "6.23.0" + resolved "https://registry.yarnpkg.com/@ledgerhq/cryptoassets/-/cryptoassets-6.23.0.tgz#e179c8253fb55c3b7847d367ec75c734d447ed00" + integrity sha512-ndZq6arggyspUbgqqHvihvnwyR9woafW1ikIsFZt6yDZrzp/aNjdovkFlLbYdJ1z7K9asMXyURBITA1xoQyBtg== + dependencies: + invariant "2" + +"@ledgerhq/cryptoassets@^6.23.0": + version "6.23.1" + resolved "https://registry.yarnpkg.com/@ledgerhq/cryptoassets/-/cryptoassets-6.23.1.tgz#23d6343b73a738ac775693af0fb5308eb42a6dbb" + integrity sha512-SNtu7nuXVRH1um3gvYWFCBMfYKhT8qJBNdsYjRWEDhLdWB4atMLiUoBxE/uo+/+0QLGzaJ79hbfOfOH6f12Lyw== dependencies: invariant "2" @@ -2197,18 +2031,19 @@ "@ledgerhq/hw-transport" "^6.20.0" bip32-path "^0.4.2" -"@ledgerhq/hw-app-eth@6.22.3": - version "6.22.3" - resolved "https://registry.yarnpkg.com/@ledgerhq/hw-app-eth/-/hw-app-eth-6.22.3.tgz#82f1e99f98c11881cfbf9c182826dba9aea03dc9" - integrity sha512-3sJkU3PdUUhlrz509QBrpDHA3/szcTsk5RJyQLZCB+ssnw+zi9EpQbD6ICmR2Zp16zAl2q85lWTmmbyc8NGwCA== +"@ledgerhq/hw-app-eth@6.23.0": + version "6.23.0" + resolved "https://registry.yarnpkg.com/@ledgerhq/hw-app-eth/-/hw-app-eth-6.23.0.tgz#b48a539aca11f8dabc5f06906da2d2a1f04cb3e5" + integrity sha512-wWNDoHFloyMx1Vpy1rovvT2Ikac+jhxrgG5xMwv/ZKMPbj0a8LIVHaWIFWhCx3bZzyXTG42AGjCnX7JUsh2YzQ== dependencies: - "@ledgerhq/cryptoassets" "^6.22.3" + "@ethersproject/abi" "^5.5.0" + "@ethersproject/rlp" "^5.5.0" + "@ledgerhq/cryptoassets" "^6.23.0" "@ledgerhq/errors" "^6.10.0" "@ledgerhq/hw-transport" "^6.20.0" "@ledgerhq/logs" "^6.10.0" axios "^0.24.0" bignumber.js "^9.0.2" - ethers "^5.5.2" "@ledgerhq/hw-app-polkadot@6.20.0": version "6.20.0" @@ -2327,20 +2162,20 @@ bignumber.js "^9.0.1" json-rpc-2.0 "^0.2.16" -"@ledgerhq/live-common@^21.26.0": - version "21.26.0" - resolved "https://registry.yarnpkg.com/@ledgerhq/live-common/-/live-common-21.26.0.tgz#15f80f7f47f158dbae7d7a809cdadbebcb1a2d93" - integrity sha512-P/Np4DDT4lXzMNP4x6LyeIMj/DJvA3L4dGscbj5n5HLQRGxBVRKWgXalEZ5ARIj4NMx/P6fo4qYU2yF1izsEgA== +"@ledgerhq/live-common@21.27.0": + version "21.27.0" + resolved "https://registry.yarnpkg.com/@ledgerhq/live-common/-/live-common-21.27.0.tgz#76b3700345d98eecc85c87e6cb2ba64b751cbfa9" + integrity sha512-JXUmjeic0YejNSUVSkuftxl/M3Gd5oNUP0E97dQMm8kWGU48SNTIHXvQeya3pgeN+JcvLCGHuErbHKEztX9W7w== dependencies: "@crypto-com/chain-jslib" "0.0.19" "@ledgerhq/compressjs" "1.3.2" - "@ledgerhq/cryptoassets" "6.22.3" + "@ledgerhq/cryptoassets" "6.23.0" "@ledgerhq/devices" "6.20.0" "@ledgerhq/errors" "6.10.0" "@ledgerhq/hw-app-algorand" "6.20.0" "@ledgerhq/hw-app-btc" "6.21.0" "@ledgerhq/hw-app-cosmos" "6.20.0" - "@ledgerhq/hw-app-eth" "6.22.3" + "@ledgerhq/hw-app-eth" "6.23.0" "@ledgerhq/hw-app-polkadot" "6.20.0" "@ledgerhq/hw-app-solana" "^6.20.0" "@ledgerhq/hw-app-str" "6.20.0" @@ -2361,11 +2196,11 @@ "@taquito/taquito" "11.1.0" "@types/bchaddrjs" "^0.4.0" "@types/bs58check" "^2.1.0" - "@walletconnect/client" "1.7.0" + "@walletconnect/client" "1.7.1" "@xstate/react" "^1.6.3" "@zondax/ledger-filecoin" "^0.11.2" algosdk "1.12.0" - async "^3.2.2" + async "^3.2.3" axios "0.24.0" axios-retry "^3.2.4" base32-decode "^1.0.0" @@ -2411,12 +2246,12 @@ ripple-lib "1.10.0" rxjs "6" rxjs-compat "^6.6.7" - secp256k1 "^4.0.2" + secp256k1 "^4.0.3" semver "^7.3.5" sha.js "^2.4.11" stellar-sdk "^9.1.0" triple-beam "^1.3.0" - winston "^3.3.3" + winston "^3.4.0" xstate "^4.27.0" zcash-bitcore-lib "^0.13.20-rc3" @@ -3764,35 +3599,35 @@ dependencies: eslint-visitor-keys "^1.1.0" -"@walletconnect/browser-utils@^1.7.0": - version "1.7.0" - resolved "https://registry.yarnpkg.com/@walletconnect/browser-utils/-/browser-utils-1.7.0.tgz#b420eb110d5ea4d7fe00084537fd720a72b68d56" - integrity sha512-bQsbCIDTT1OB4v8VF5bzg3byp03qTst9kLmjQj68ElecIUcdS6nZvEDhZdQK/r63WMVnA2KrTb5AEN6hPRGgIw== +"@walletconnect/browser-utils@^1.7.1": + version "1.7.1" + resolved "https://registry.yarnpkg.com/@walletconnect/browser-utils/-/browser-utils-1.7.1.tgz#2a28846cd4d73166debbbf7d470e78ba25616f5e" + integrity sha512-y6KvxPhi52sWzS0/HtA3EhdgmtG8mXcxdc26YURDOVC/BJh3MxV8E16JFrT4InylOqYJs6dcSLWVfcnJaiPtZw== dependencies: "@walletconnect/safe-json" "1.0.0" - "@walletconnect/types" "^1.7.0" + "@walletconnect/types" "^1.7.1" "@walletconnect/window-getters" "1.0.0" "@walletconnect/window-metadata" "1.0.0" detect-browser "5.2.0" -"@walletconnect/client@1.7.0": - version "1.7.0" - resolved "https://registry.yarnpkg.com/@walletconnect/client/-/client-1.7.0.tgz#f656952a23367cc4890ca16cc3f10ee7dabb2f03" - integrity sha512-56aXK9Rb30cHhl4DMaUakz/3KG3Mr+/9h2iCvKDqAxmIeD931ahMZlBu86T7hGf4vboisZZEhj8/ZwiAM4Ukvg== +"@walletconnect/client@1.7.1": + version "1.7.1" + resolved "https://registry.yarnpkg.com/@walletconnect/client/-/client-1.7.1.tgz#aaa74199bdc0605db9ac2ecdf8a463b271586d3b" + integrity sha512-xD8B8s1hL7Z5vJwb3L0u1bCVAk6cRQfIY9ycymf7KkmIhkAONQJNf2Y0C0xIpbPp2fdn9VwnSfLm5Ed/Ht/1IA== dependencies: - "@walletconnect/core" "^1.7.0" - "@walletconnect/iso-crypto" "^1.7.0" - "@walletconnect/types" "^1.7.0" - "@walletconnect/utils" "^1.7.0" + "@walletconnect/core" "^1.7.1" + "@walletconnect/iso-crypto" "^1.7.1" + "@walletconnect/types" "^1.7.1" + "@walletconnect/utils" "^1.7.1" -"@walletconnect/core@^1.7.0": - version "1.7.0" - resolved "https://registry.yarnpkg.com/@walletconnect/core/-/core-1.7.0.tgz#eb318bfce80a5454e12f1d7811a583e2d1adcb42" - integrity sha512-0YX9Y/CVYctKPcSgSyp2wLrk4OgSenmyzWj6Z3C93Hb7PG+tJ+dKCeNFeEIYA03QQRxHew5uMLPbVgmdtmB/0w== +"@walletconnect/core@^1.7.1": + version "1.7.1" + resolved "https://registry.yarnpkg.com/@walletconnect/core/-/core-1.7.1.tgz#321c14d63af81241658b028022e0e5fa6dc7f374" + integrity sha512-qO+4wykyRNiq3HEuaAA2pW2PDnMM4y7pyPAgiCwfHiqF4PpWvtcdB301hI0K5am9ghuqKZMy1HlE9LWNOEBvcw== dependencies: - "@walletconnect/socket-transport" "^1.7.0" - "@walletconnect/types" "^1.7.0" - "@walletconnect/utils" "^1.7.0" + "@walletconnect/socket-transport" "^1.7.1" + "@walletconnect/types" "^1.7.1" + "@walletconnect/utils" "^1.7.1" "@walletconnect/crypto@^1.0.1": version "1.0.1" @@ -3818,14 +3653,14 @@ resolved "https://registry.yarnpkg.com/@walletconnect/environment/-/environment-1.0.0.tgz#c4545869fa9c389ec88c364e1a5f8178e8ab5034" integrity sha512-4BwqyWy6KpSvkocSaV7WR3BlZfrxLbJSLkg+j7Gl6pTDE+U55lLhJvQaMuDVazXYxcjBsG09k7UlH7cGiUI5vQ== -"@walletconnect/iso-crypto@^1.7.0": - version "1.7.0" - resolved "https://registry.yarnpkg.com/@walletconnect/iso-crypto/-/iso-crypto-1.7.0.tgz#ccb968504ee5925ae75c64efe610631470072982" - integrity sha512-ZUQ/MAM9TXtneIaRjxW/PuFF+es4I9OrCGFgVTCYAaa7p2zdy7BgHmVOnxxOpUh9VYwLXoiA/FU234NwS0ulYw== +"@walletconnect/iso-crypto@^1.7.1": + version "1.7.1" + resolved "https://registry.yarnpkg.com/@walletconnect/iso-crypto/-/iso-crypto-1.7.1.tgz#c463bb5874686c2f21344e2c7f3cf4d71c34ca70" + integrity sha512-qMiW0kLN6KCjnLMD50ijIj1lQqjNjGszGUwrSVUiS2/Dp4Ecx+4QEtHbmVwGEkfx4kelYPFpDJV3ZJpQ4Kqg/g== dependencies: "@walletconnect/crypto" "^1.0.1" - "@walletconnect/types" "^1.7.0" - "@walletconnect/utils" "^1.7.0" + "@walletconnect/types" "^1.7.1" + "@walletconnect/utils" "^1.7.1" "@walletconnect/jsonrpc-types@^1.0.0": version "1.0.0" @@ -3856,29 +3691,29 @@ resolved "https://registry.yarnpkg.com/@walletconnect/safe-json/-/safe-json-1.0.0.tgz#12eeb11d43795199c045fafde97e3c91646683b2" integrity sha512-QJzp/S/86sUAgWY6eh5MKYmSfZaRpIlmCJdi5uG4DJlKkZrHEF7ye7gA+VtbVzvTtpM/gRwO2plQuiooIeXjfg== -"@walletconnect/socket-transport@^1.7.0": - version "1.7.0" - resolved "https://registry.yarnpkg.com/@walletconnect/socket-transport/-/socket-transport-1.7.0.tgz#713a162d577fdda0b44753227b699b6f93927b97" - integrity sha512-HSWGZxdxDtf8K1Kd1eD1QuObpoNxHui+A/+inuC8i8fcifDjZu85AeJIfCKQijlmgjLR/25Ry3eJFbYpRXxUjQ== +"@walletconnect/socket-transport@^1.7.1": + version "1.7.1" + resolved "https://registry.yarnpkg.com/@walletconnect/socket-transport/-/socket-transport-1.7.1.tgz#cc4c8dcf21c40b805812ecb066b2abb156fdb146" + integrity sha512-Gu1RPro0eLe+HHtLhq/1T5TNFfO/HW2z3BnWuUYuJ/F8w1U9iK7+4LMHe+LTgwgWy9Ybcb2k0tiO5e3LgjHBHQ== dependencies: - "@walletconnect/types" "^1.7.0" - "@walletconnect/utils" "^1.7.0" + "@walletconnect/types" "^1.7.1" + "@walletconnect/utils" "^1.7.1" ws "7.5.3" -"@walletconnect/types@^1.7.0": - version "1.7.0" - resolved "https://registry.yarnpkg.com/@walletconnect/types/-/types-1.7.0.tgz#e6d0f7e41e5d22303b57be0739716a8dd8c968b4" - integrity sha512-eoqnF+U04IuMfGIBsqYhAR6SIM2kzcrZM/RCVcomT/lIcsRoBwNxR+86+3Vn12/iaGnuAKn8xDZhZ47SLFmanQ== +"@walletconnect/types@^1.7.1": + version "1.7.1" + resolved "https://registry.yarnpkg.com/@walletconnect/types/-/types-1.7.1.tgz#86cc3832e02415dc9f518f3dcb5366722afbfc03" + integrity sha512-X0NunEUgq46ExDcKo7BnnFpFhuZ89bZ04/1FtohNziBWcP2Mblp2yf+FN7iwmZiuZ3bRTb8J1O4oJH2JGP9I7A== -"@walletconnect/utils@^1.7.0": - version "1.7.0" - resolved "https://registry.yarnpkg.com/@walletconnect/utils/-/utils-1.7.0.tgz#1dbb1268c1ee245df378957945bf036a3d9fdbf5" - integrity sha512-DnYyKNMkpPUkbu6YwHfycvzlpx7Ro/qDPIDAuaNYT4FFWFyYxfx2ZY66kU3XklQivAc8dK7TyvYPJ08LWd8w4Q== +"@walletconnect/utils@^1.7.1": + version "1.7.1" + resolved "https://registry.yarnpkg.com/@walletconnect/utils/-/utils-1.7.1.tgz#f858d5f22425a4c2da2a28ae493bde7f2eecf815" + integrity sha512-7Lig9rruqTMaFuwEhBrArq1QgzIf2NuzO6J3sCUYCZh60EQ7uIZjekaDonQjiQJAbfYcgWUBm8qa0PG1TzYN3Q== dependencies: - "@walletconnect/browser-utils" "^1.7.0" + "@walletconnect/browser-utils" "^1.7.1" "@walletconnect/encoding" "^1.0.0" "@walletconnect/jsonrpc-utils" "^1.0.0" - "@walletconnect/types" "^1.7.0" + "@walletconnect/types" "^1.7.1" bn.js "4.11.8" js-sha3 "0.8.0" query-string "6.13.5" @@ -4006,11 +3841,6 @@ acorn@^8.2.4: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.5.0.tgz#4512ccb99b3698c752591e9bb4472e38ad43cee2" integrity sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q== -aes-js@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" - integrity sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0= - aes-js@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.1.2.tgz#db9aabde85d5caabbfc0d4f2a4446960f627146a" @@ -4351,11 +4181,16 @@ async@^2.4.0: dependencies: lodash "^4.17.14" -async@^3.1.0, async@^3.2.1, async@^3.2.2: +async@^3.2.1: version "3.2.2" resolved "https://registry.yarnpkg.com/async/-/async-3.2.2.tgz#2eb7671034bb2194d45d30e31e24ec7e7f9670cd" integrity sha512-H0E+qZaDEfx/FY4t7iLRv1W2fFI6+pyCeTw1uN20AQPiwqwM6ojPxHxdLv4z8hi2DtnW9BOckSspLucW7pIE5g== +async@^3.2.3: + version "3.2.3" + resolved "https://registry.yarnpkg.com/async/-/async-3.2.3.tgz#ac53dafd3f4720ee9e8a160628f18ea91df196c9" + integrity sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g== + asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" @@ -5645,7 +5480,7 @@ colorette@^1.0.7: resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.4.0.tgz#5190fbb87276259a86ad700bff2c6d6faa3fca40" integrity sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g== -colors@^1.0.3, colors@^1.1.2, colors@^1.2.1, colors@^1.3.2: +colors@1.4.0, colors@^1.0.3, colors@^1.1.2, colors@^1.3.2: version "1.4.0" resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== @@ -7132,42 +6967,6 @@ ethereumjs-util@^7.1.3: ethereum-cryptography "^0.1.3" rlp "^2.2.4" -ethers@^5.5.2: - version "5.5.2" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.5.2.tgz#cd2e508c7342c44fa70392f722e8de8f2416489f" - integrity sha512-EF5W+6Wwcu6BqVwpgmyR5U2+L4c1FQzlM/02dkZOugN3KF0cG9bzHZP+TDJglmPm2/IzCEJDT7KBxzayk7SAHw== - dependencies: - "@ethersproject/abi" "5.5.0" - "@ethersproject/abstract-provider" "5.5.1" - "@ethersproject/abstract-signer" "5.5.0" - "@ethersproject/address" "5.5.0" - "@ethersproject/base64" "5.5.0" - "@ethersproject/basex" "5.5.0" - "@ethersproject/bignumber" "5.5.0" - "@ethersproject/bytes" "5.5.0" - "@ethersproject/constants" "5.5.0" - "@ethersproject/contracts" "5.5.0" - "@ethersproject/hash" "5.5.0" - "@ethersproject/hdnode" "5.5.0" - "@ethersproject/json-wallets" "5.5.0" - "@ethersproject/keccak256" "5.5.0" - "@ethersproject/logger" "5.5.0" - "@ethersproject/networks" "5.5.1" - "@ethersproject/pbkdf2" "5.5.0" - "@ethersproject/properties" "5.5.0" - "@ethersproject/providers" "5.5.1" - "@ethersproject/random" "5.5.0" - "@ethersproject/rlp" "5.5.0" - "@ethersproject/sha2" "5.5.0" - "@ethersproject/signing-key" "5.5.0" - "@ethersproject/solidity" "5.5.0" - "@ethersproject/strings" "5.5.0" - "@ethersproject/transactions" "5.5.0" - "@ethersproject/units" "5.5.0" - "@ethersproject/wallet" "5.5.0" - "@ethersproject/web" "5.5.1" - "@ethersproject/wordlists" "5.5.0" - ethjs-util@0.1.6, ethjs-util@^0.1.3: version "0.1.6" resolved "https://registry.yarnpkg.com/ethjs-util/-/ethjs-util-0.1.6.tgz#f308b62f185f9fe6237132fb2a9818866a5cd536" @@ -10244,12 +10043,12 @@ log-symbols@^2.2.0: dependencies: chalk "^2.0.1" -logform@^2.2.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/logform/-/logform-2.3.0.tgz#a3997a05985de2ebd325ae0d166dffc9c6fe6b57" - integrity sha512-graeoWUH2knKbGthMtuG1EfaSPMZFZBIrhuJHhkS5ZseFBrc7DupCzihOQAzsK/qIKPQaPJ/lFQFctILUY5ARQ== +logform@^2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/logform/-/logform-2.3.2.tgz#68babe6a74ab09a1fd15a9b1e6cbc7713d41cb5b" + integrity sha512-V6JiPThZzTsbVRspNO6TmHkR99oqYTs8fivMBYQkjZj6rxW92KxtDCPE6IkAk1DNBnYKNkjm4jYBm6JDUcyhOA== dependencies: - colors "^1.2.1" + colors "1.4.0" fecha "^4.2.0" ms "^2.1.1" safe-stable-stringify "^1.1.0" @@ -12818,7 +12617,7 @@ read-pkg@^5.2.0: parse-json "^5.0.0" type-fest "^0.6.0" -readable-stream@2, readable-stream@^2.0.0, readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.2.2, readable-stream@^2.3.7, readable-stream@~2.3.6: +readable-stream@2, readable-stream@^2.0.0, readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.2.2, readable-stream@~2.3.6: version "2.3.7" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== @@ -13419,7 +13218,7 @@ scheduler@^0.20.2: loose-envify "^1.1.0" object-assign "^4.1.1" -scrypt-js@3.0.1, scrypt-js@^3.0.0: +scrypt-js@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== @@ -13433,6 +13232,15 @@ secp256k1@4.0.2, secp256k1@^4.0.1, secp256k1@^4.0.2: node-addon-api "^2.0.0" node-gyp-build "^4.2.0" +secp256k1@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-4.0.3.tgz#c4559ecd1b8d3c1827ed2d1b94190d69ce267303" + integrity sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA== + dependencies: + elliptic "^6.5.4" + node-addon-api "^2.0.0" + node-gyp-build "^4.2.0" + "semver@2 || 3 || 4 || 5", semver@^5.0.1, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" @@ -15166,28 +14974,29 @@ windows-release@^3.1.0: dependencies: execa "^1.0.0" -winston-transport@^4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/winston-transport/-/winston-transport-4.4.0.tgz#17af518daa690d5b2ecccaa7acf7b20ca7925e59" - integrity sha512-Lc7/p3GtqtqPBYYtS6KCN3c77/2QCev51DvcJKbkFPQNoj1sinkGwLGFDxkXY9J6p9+EPnYs+D90uwbnaiURTw== +winston-transport@^4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/winston-transport/-/winston-transport-4.4.2.tgz#554efe3fce229d046df006e0e3c411d240652e51" + integrity sha512-9jmhltAr5ygt5usgUTQbEiw/7RYXpyUbEAFRCSicIacpUzPkrnQsQZSPGEI12aLK9Jth4zNcYJx3Cvznwrl8pw== dependencies: - readable-stream "^2.3.7" + logform "^2.3.2" + readable-stream "^3.4.0" triple-beam "^1.2.0" -winston@^3.3.3: - version "3.3.3" - resolved "https://registry.yarnpkg.com/winston/-/winston-3.3.3.tgz#ae6172042cafb29786afa3d09c8ff833ab7c9170" - integrity sha512-oEXTISQnC8VlSAKf1KYSSd7J6IWuRPQqDdo8eoRNaYKLvwSb5+79Z3Yi1lrl6KDpU6/VWaxpakDAtb1oQ4n9aw== +winston@^3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/winston/-/winston-3.4.0.tgz#7080f24b02a0684f8a37f9d5c6afb1ac23e95b84" + integrity sha512-FqilVj+5HKwCfIHQzMxrrd5tBIH10JTS3koFGbLVWBODjiIYq7zir08rFyBT4rrTYG/eaTqDcfSIbcjSM78YSw== dependencies: "@dabh/diagnostics" "^2.0.2" - async "^3.1.0" + async "^3.2.3" is-stream "^2.0.0" - logform "^2.2.0" + logform "^2.3.2" one-time "^1.0.0" readable-stream "^3.4.0" stack-trace "0.0.x" triple-beam "^1.3.0" - winston-transport "^4.4.0" + winston-transport "^4.4.2" word-wrap@^1.2.3, word-wrap@~1.2.3: version "1.2.3" @@ -15266,11 +15075,6 @@ ws@7, ws@^7, ws@^7.0.0, ws@^7.2.0, ws@^7.4.5, ws@^7.4.6, ws@^7.5.2: resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.6.tgz#e59fc509fb15ddfb65487ee9765c5a51dec5fe7b" integrity sha512-6GLgCqo2cy2A2rjCNFlxQS6ZljG/coZfZXclldI8FB/1G3CCI36Zd8xy2HrFVACi8tfk5XrgLQEk+P0Tnz9UcA== -ws@7.4.6: - version "7.4.6" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" - integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== - ws@7.5.3: version "7.5.3" resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.3.tgz#160835b63c7d97bfab418fc1b8a9fced2ac01a74" From 8ddc2ec794ddc73af0444dd7a4ef8b600e4ba93f Mon Sep 17 00:00:00 2001 From: JunichiSugiura Date: Fri, 28 Jan 2022 15:33:43 +0100 Subject: [PATCH 04/13] [WIP] fix completeExchange error --- .../PlatformExchangeNavigator.js | 15 +- src/components/WebPlatformPlayer/index.js | 94 ++++++++----- src/const/navigation.js | 3 +- .../Platform/exchange/CompleteExchange.js | 133 ++++++++++++++++++ .../exchange/{Connect.js => StartExchange.js} | 29 ++-- 5 files changed, 219 insertions(+), 55 deletions(-) create mode 100644 src/screens/Platform/exchange/CompleteExchange.js rename src/screens/Platform/exchange/{Connect.js => StartExchange.js} (63%) diff --git a/src/components/RootNavigator/PlatformExchangeNavigator.js b/src/components/RootNavigator/PlatformExchangeNavigator.js index 613cf6ac26..37f56ae872 100644 --- a/src/components/RootNavigator/PlatformExchangeNavigator.js +++ b/src/components/RootNavigator/PlatformExchangeNavigator.js @@ -6,7 +6,8 @@ import { useTranslation } from "react-i18next"; import { getStackNavigatorConfig } from "../../navigation/navigatorConfig"; import styles from "../../navigation/styles"; import { ScreenName } from "../../const"; -import PlatformExchangeConnect from "../../screens/Platform/exchange/Connect"; +import PlatformStartExchange from "../../screens/Platform/exchange/StartExchange"; +import PlatformCompleteExchange from "../../screens/Platform/exchange/CompleteExchange"; export default function PlatformExchangeNavigator() { const { t } = useTranslation(); @@ -21,8 +22,16 @@ export default function PlatformExchangeNavigator() { screenOptions={{ ...stackNavigationConfig, headerShown: false }} > + { return new Promise((resolve, reject) => { navigation.navigate(NavigatorName.PlatformExchange, { - screen: ScreenName.PlatformExchangeConnect, + screen: ScreenName.PlatformStartExchange, params: { - exchangeType, - onSuccess: nonce => { - tracking.platformStartExchangeSuccess(manifest); - resolve(nonce); + request: { + exchangeType, }, - onError: error => { - tracking.platformStartExchangeFail(manifest); - reject(error); + onResult: (result: { + startExchangeResult?: number, + startExchangeError?: Error, + }) => { + console.log("startExchange result", result); + if (result.startExchangeError) { + tracking.platformStartExchangeFail(manifest); + reject(result.startExchangeError); + } + + if (result.startExchangeResult) { + tracking.platformStartExchangeSuccess(manifest); + resolve(result.startExchangeResult); + } + + const n = navigation.getParent() || navigation; + n.pop(); }, }, }); @@ -470,40 +485,49 @@ const WebPlatformPlayer = ({ manifest, inputs }: Props) => { let processedTransaction = accountBridge.createTransaction( mainFromAccount, ); - processedTransaction = processedTransaction.updateTransaction( + processedTransaction = accountBridge.updateTransaction( processedTransaction, platformTransaction, ); tracking.platformCompleteExchangeRequested(manifest); return new Promise((resolve, reject) => { - // dispatch( - // openModal("MODAL_PLATFORM_EXCHANGE_COMPLETE", { - // provider, - // exchange: { - // fromAccount, - // fromParentAccount, - // toAccount, - // toParentAccount, - // }, - // transaction: processedTransaction, - // binaryPayload, - // signature, - // feesStrategy, - // exchangeType, - // onResult: operation => { - // tracking.platformCompleteExchangeSuccess(manifest); - // resolve(operation); - // }, - // onCancel: error => { - // tracking.platformCompleteExchangeFail(manifest); - // reject(error); - // }, - // }), - // ), + navigation.navigate(NavigatorName.PlatformExchange, { + screen: ScreenName.PlatformCompleteExchange, + params: { + request: { + exchangeType, + provider, + exchange: { + fromAccount, + fromParentAccount, + toAccount, + toParentAccount, + }, + transaction: processedTransaction, + binaryPayload, + signature, + feesStrategy, + }, + onResult: (result: { operation?: Operation, error?: Error }) => { + if (result.error) { + tracking.platformStartExchangeFail(manifest); + reject(result.error); + } + + if (result.operation) { + tracking.platformStartExchangeSuccess(manifest); + resolve(result.operation); + } + + const n = navigation.getParent() || navigation; + n.pop(); + }, + }, + }); }); }, - [accounts, manifest], + [accounts, manifest, navigation], ); const handlers = useMemo( diff --git a/src/const/navigation.js b/src/const/navigation.js index d23c025b6b..8616102285 100644 --- a/src/const/navigation.js +++ b/src/const/navigation.js @@ -295,7 +295,8 @@ export const ScreenName = { PlatformCatalog: "PlatformCatalog", PlatformApp: "PlatformApp", - PlatformExchangeConnect: "PlatformExchangeConnect", + PlatformStartExchange: "PlatformStartExchange", + PlatformCompleteExchange: "PlatformCompleteExchange", WalletConnectScan: "WalletConnectScan", WalletConnectConnect: "WalletConnectConnect", diff --git a/src/screens/Platform/exchange/CompleteExchange.js b/src/screens/Platform/exchange/CompleteExchange.js new file mode 100644 index 0000000000..2c3be85aa9 --- /dev/null +++ b/src/screens/Platform/exchange/CompleteExchange.js @@ -0,0 +1,133 @@ +// @flow +import React, { useState, useEffect } from "react"; +import { StyleSheet } from "react-native"; +import SafeAreaView from "react-native-safe-area-view"; +import connectApp from "@ledgerhq/live-common/lib/hw/connectApp"; +import { createAction } from "@ledgerhq/live-common/lib/hw/actions/completeExchange"; +import { createAction as txCreateAction } from "@ledgerhq/live-common/lib/hw/actions/transaction"; +import { toExchangeRaw } from "@ledgerhq/live-common/lib/exchange/platform/serialization"; +import completeExchange from "@ledgerhq/live-common/lib/exchange/platform/completeExchange"; +import { toTransactionRaw } from "@ledgerhq/live-common/lib/transaction"; +import type { + Account, + Transaction, + Operation, +} from "@ledgerhq/live-common/lib/types"; +import { useBroadcast } from "../../../components/useBroadcast"; +import DeviceActionModal from "../../../components/DeviceActionModal"; +import SelectDevice from "../../../components/SelectDevice"; + +type Result = { + operation?: Operation, + error?: Error, +}; + +export default function PlatformCompleteExchange({ + route: { + params: { request: data, onResult }, + }, +}: { + route: { + params: { + request: { + exchangeType: number, + provider: string, + exchange: { + fromAccount: Account, + fromParentAccount: Account, + toAccount: Account, + toParentAccount: Account, + }, + transaction: Transaction, + binaryPayload: string, + signature: string, + feesStrategy: string, + }, + onResult: (result: Result) => void, + }, + }, +}) { + const [device, setDevice] = useState(null); + + const { + fromAccount: account, + fromParentAccount: parentAccount, + } = data.exchange; + let tokenCurrency; + if (account.type === "TokenAccount") tokenCurrency = account.token; + const request = { + ...data, + exchange: toExchangeRaw(data.exchange), + transaction: toTransactionRaw(data.transaction), + }; + + const broadcast = useBroadcast({ account, parentAccount }); + const [transaction, setTransaction] = useState(); + const [signedOperation, setSignedOperation] = useState(); + const [error, setError] = useState(); + + useEffect(() => { + if (signedOperation) { + broadcast(signedOperation).then(operation => { + onResult({ operation }); + }, setError); + } + }, [broadcast, onResult, signedOperation]); + + useEffect(() => { + if (error) { + onResult({ error }); + } + }, [onResult, error]); + + return ( + + + {!transaction ? ( + { + if (completeExchangeError) { + setError(completeExchangeError); + } else { + setTransaction(completeExchangeResult); + } + }} + request={request} + /> + ) : ( + { + if (transactionSignError) { + setError(transactionSignError); + } else { + setSignedOperation(signedOperation); + } + }} + request={{ + tokenCurrency, + parentAccount, + account, + transaction, + appName: "Exchange", + }} + /> + )} + + ); +} + +const exchangeAction = createAction(connectApp, completeExchange); +const sendAction = txCreateAction(connectApp); + +const styles = StyleSheet.create({ + root: { + flex: 1, + padding: 32, + }, +}); diff --git a/src/screens/Platform/exchange/Connect.js b/src/screens/Platform/exchange/StartExchange.js similarity index 63% rename from src/screens/Platform/exchange/Connect.js rename to src/screens/Platform/exchange/StartExchange.js index ca9f6bbb6c..f11b21c051 100644 --- a/src/screens/Platform/exchange/Connect.js +++ b/src/screens/Platform/exchange/StartExchange.js @@ -1,5 +1,5 @@ // @flow -import React, { useState, useCallback } from "react"; +import React, { useState } from "react"; import { StyleSheet } from "react-native"; import SafeAreaView from "react-native-safe-area-view"; import connectApp from "@ledgerhq/live-common/lib/hw/connectApp"; @@ -8,34 +8,31 @@ import startExchange from "@ledgerhq/live-common/lib/exchange/platform/startExch import DeviceActionModal from "../../../components/DeviceActionModal"; import SelectDevice from "../../../components/SelectDevice"; -export default function PlatformExchangeConnect({ - navigation, +type Result = { + startExchangeResult?: number, + startExchangeError?: Error, +}; + +export default function PlatformStartExchange({ route, }: { - navigation: any, route: { - params: { exchangeType: number, onSuccess: (nounce: number) => void }, + params: { + request: { exchangeType: number }, + onResult: (result: Result) => void, + }, }, }) { const [device, setDevice] = useState(null); - const onResult = useCallback( - (data: { startExchangeResult: number }) => { - route.params.onSuccess(data.startExchangeResult); - navigation.goBack(); - }, - [route, navigation], - ); - return ( ); From 51541f62bcb131c8db158577f8c25c1ff83d74f7 Mon Sep 17 00:00:00 2001 From: JunichiSugiura Date: Thu, 17 Feb 2022 12:59:22 +0100 Subject: [PATCH 05/13] fix crash on completeExchange --- .../Platform/exchange/CompleteExchange.js | 2 +- yarn.lock | 50 +++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/src/screens/Platform/exchange/CompleteExchange.js b/src/screens/Platform/exchange/CompleteExchange.js index 2c3be85aa9..06d0946f19 100644 --- a/src/screens/Platform/exchange/CompleteExchange.js +++ b/src/screens/Platform/exchange/CompleteExchange.js @@ -122,7 +122,7 @@ export default function PlatformCompleteExchange({ ); } -const exchangeAction = createAction(connectApp, completeExchange); +const exchangeAction = createAction(completeExchange); const sendAction = txCreateAction(connectApp); const styles = StyleSheet.create({ diff --git a/yarn.lock b/yarn.lock index ce8ff7b663..68573d5dda 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5840,6 +5840,11 @@ bytes@3.0.0: resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" integrity sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg= +bytes@3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6" + integrity sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg== + bytes@3.1.1, bytes@^3.0.0: version "3.1.1" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.1.tgz#3f018291cb4cbad9accb6e6970bca9c8889e879a" @@ -9412,6 +9417,17 @@ http-cache-semantics@^4.0.0: resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz#49e91c5cbf36c9b94bcfcd71c23d5249ec74e390" integrity sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ== +http-errors@1.7.3, http-errors@~1.7.2: + version "1.7.3" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.7.3.tgz#6c619e4f9c60308c38519498c14fbb10aacebb06" + integrity sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw== + dependencies: + depd "~1.1.2" + inherits "2.0.4" + setprototypeof "1.1.1" + statuses ">= 1.5.0 < 2" + toidentifier "1.0.0" + http-errors@1.8.1: version "1.8.1" resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.8.1.tgz#7c3f28577cbc8a207388455dbd62295ed07bd68c" @@ -12271,6 +12287,11 @@ miller-rabin@^4.0.0: bn.js "^4.0.0" brorand "^1.0.1" +mime-db@1.50.0: + version "1.50.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.50.0.tgz#abd4ac94e98d3c0e185016c67ab45d5fde40c11f" + integrity sha512-9tMZCDlYHqeERXEHO9f/hKfNXhre5dK2eE/krIvUjZbS2KPcqGDfNShIWS1uW9XOTKQKqK6qbeOci18rbfW77A== + mime-db@1.51.0, "mime-db@>= 1.43.0 < 2": version "1.51.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.51.0.tgz#d9ff62451859b18342d960850dc3cfb77e63fb0c" @@ -15026,6 +15047,25 @@ semver@~2.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-2.3.2.tgz#b9848f25d6cf36333073ec9ef8856d42f1233e52" integrity sha1-uYSPJdbPNjMwc+ye+IVtQvEjPlI= +send@0.17.1: + version "0.17.1" + resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8" + integrity sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg== + dependencies: + debug "2.6.9" + depd "~1.1.2" + destroy "~1.0.4" + encodeurl "~1.0.2" + escape-html "~1.0.3" + etag "~1.8.1" + fresh "0.5.2" + http-errors "~1.7.2" + mime "1.6.0" + ms "2.1.1" + on-finished "~2.3.0" + range-parser "~1.2.1" + statuses "~1.5.0" + send@0.17.2: version "0.17.2" resolved "https://registry.yarnpkg.com/send/-/send-0.17.2.tgz#926622f76601c41808012c8bf1688fe3906f7820" @@ -15126,6 +15166,11 @@ setprototypeof@1.1.0: resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656" integrity sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ== +setprototypeof@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683" + integrity sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw== + setprototypeof@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" @@ -16165,6 +16210,11 @@ to-space-case@^1.0.0: dependencies: to-no-case "^1.0.0" +toidentifier@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553" + integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw== + toidentifier@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" From 9a9fe68392d988bb340242ccc949bf61cb2c46ac Mon Sep 17 00:00:00 2001 From: JunichiSugiura Date: Tue, 22 Feb 2022 15:53:39 +0100 Subject: [PATCH 06/13] fix crash on completeExchange --- src/components/WebPlatformPlayer/index.js | 1 - src/screens/Platform/exchange/CompleteExchange.js | 9 ++------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/components/WebPlatformPlayer/index.js b/src/components/WebPlatformPlayer/index.js index de8be1c14c..e0e1e1b987 100644 --- a/src/components/WebPlatformPlayer/index.js +++ b/src/components/WebPlatformPlayer/index.js @@ -416,7 +416,6 @@ const WebPlatformPlayer = ({ manifest, inputs }: Props) => { startExchangeResult?: number, startExchangeError?: Error, }) => { - console.log("startExchange result", result); if (result.startExchangeError) { tracking.platformStartExchangeFail(manifest); reject(result.startExchangeError); diff --git a/src/screens/Platform/exchange/CompleteExchange.js b/src/screens/Platform/exchange/CompleteExchange.js index 06d0946f19..46714df943 100644 --- a/src/screens/Platform/exchange/CompleteExchange.js +++ b/src/screens/Platform/exchange/CompleteExchange.js @@ -24,7 +24,7 @@ type Result = { export default function PlatformCompleteExchange({ route: { - params: { request: data, onResult }, + params: { request, onResult }, }, }: { route: { @@ -52,14 +52,9 @@ export default function PlatformCompleteExchange({ const { fromAccount: account, fromParentAccount: parentAccount, - } = data.exchange; + } = request.exchange; let tokenCurrency; if (account.type === "TokenAccount") tokenCurrency = account.token; - const request = { - ...data, - exchange: toExchangeRaw(data.exchange), - transaction: toTransactionRaw(data.transaction), - }; const broadcast = useBroadcast({ account, parentAccount }); const [transaction, setTransaction] = useState(); From bd84d6ef0943ded1ae908d91a847ef951277959b Mon Sep 17 00:00:00 2001 From: JunichiSugiura Date: Tue, 22 Feb 2022 16:19:31 +0100 Subject: [PATCH 07/13] use same device for start and complete exchange action --- src/components/WebPlatformPlayer/index.js | 9 ++++++++- src/screens/Platform/exchange/CompleteExchange.js | 9 ++++----- src/screens/Platform/exchange/StartExchange.js | 6 +++++- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/components/WebPlatformPlayer/index.js b/src/components/WebPlatformPlayer/index.js index e0e1e1b987..a556ff43de 100644 --- a/src/components/WebPlatformPlayer/index.js +++ b/src/components/WebPlatformPlayer/index.js @@ -31,6 +31,7 @@ import type { import { getEnv } from "@ledgerhq/live-common/lib/env"; import { getAccountBridge } from "@ledgerhq/live-common/lib/bridge"; import { getMainAccount } from "@ledgerhq/live-common/lib/account"; +import type { Device } from "@ledgerhq/live-common/lib/hw/actions/types"; import { listCryptoCurrencies, findCryptoCurrencyById, @@ -116,6 +117,8 @@ const WebPlatformPlayer = ({ manifest, inputs }: Props) => { const [widgetLoaded, setWidgetLoaded] = useState(false); const [isInfoPanelOpened, setIsInfoPanelOpened] = useState(false); + const [device, setDevice] = useState(); + const uri = useMemo(() => { const url = new URL(manifest.url); @@ -415,6 +418,7 @@ const WebPlatformPlayer = ({ manifest, inputs }: Props) => { onResult: (result: { startExchangeResult?: number, startExchangeError?: Error, + device: Device, }) => { if (result.startExchangeError) { tracking.platformStartExchangeFail(manifest); @@ -423,6 +427,7 @@ const WebPlatformPlayer = ({ manifest, inputs }: Props) => { if (result.startExchangeResult) { tracking.platformStartExchangeSuccess(manifest); + setDevice(result.device); resolve(result.startExchangeResult); } @@ -516,6 +521,7 @@ const WebPlatformPlayer = ({ manifest, inputs }: Props) => { signature, feesStrategy, }, + device, onResult: (result: { operation?: Operation, error?: Error }) => { if (result.error) { tracking.platformStartExchangeFail(manifest); @@ -527,6 +533,7 @@ const WebPlatformPlayer = ({ manifest, inputs }: Props) => { resolve(result.operation); } + setDevice(); const n = navigation.getParent() || navigation; n.pop(); }, @@ -534,7 +541,7 @@ const WebPlatformPlayer = ({ manifest, inputs }: Props) => { }); }); }, - [accounts, manifest, navigation], + [accounts, manifest, navigation, device], ); const handlers = useMemo( diff --git a/src/screens/Platform/exchange/CompleteExchange.js b/src/screens/Platform/exchange/CompleteExchange.js index 46714df943..695f812e93 100644 --- a/src/screens/Platform/exchange/CompleteExchange.js +++ b/src/screens/Platform/exchange/CompleteExchange.js @@ -13,18 +13,19 @@ import type { Transaction, Operation, } from "@ledgerhq/live-common/lib/types"; +import type { Device } from "@ledgerhq/live-common/lib/hw/actions/types"; import { useBroadcast } from "../../../components/useBroadcast"; import DeviceActionModal from "../../../components/DeviceActionModal"; -import SelectDevice from "../../../components/SelectDevice"; type Result = { operation?: Operation, error?: Error, + device: Device, }; export default function PlatformCompleteExchange({ route: { - params: { request, onResult }, + params: { request, onResult, device }, }, }: { route: { @@ -43,12 +44,11 @@ export default function PlatformCompleteExchange({ signature: string, feesStrategy: string, }, + device: Device, onResult: (result: Result) => void, }, }, }) { - const [device, setDevice] = useState(null); - const { fromAccount: account, fromParentAccount: parentAccount, @@ -77,7 +77,6 @@ export default function PlatformCompleteExchange({ return ( - {!transaction ? ( { + route.params.onResult({ ...result, device }); + }} request={route.params.request} /> From 0610c45832bb4e4d60135f7dc0b299d9c73ef5a8 Mon Sep 17 00:00:00 2001 From: JunichiSugiura Date: Wed, 23 Feb 2022 14:33:03 +0100 Subject: [PATCH 08/13] cleanup --- src/components/DeviceAction/index.js | 1 - src/screens/Platform/exchange/CompleteExchange.js | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/components/DeviceAction/index.js b/src/components/DeviceAction/index.js index 06c2d0c622..3f20c00e0a 100644 --- a/src/components/DeviceAction/index.js +++ b/src/components/DeviceAction/index.js @@ -5,7 +5,6 @@ import type { Action, Device, } from "@ledgerhq/live-common/lib/hw/actions/types"; -import { TRANSACTION_TYPES } from "@ledgerhq/live-common/lib/exchange/hw-app-exchange/Exchange"; import { useTranslation } from "react-i18next"; import { useNavigation, useTheme } from "@react-navigation/native"; import { setLastSeenDeviceInfo } from "../../actions/settings"; diff --git a/src/screens/Platform/exchange/CompleteExchange.js b/src/screens/Platform/exchange/CompleteExchange.js index 695f812e93..9c5eaf5d0b 100644 --- a/src/screens/Platform/exchange/CompleteExchange.js +++ b/src/screens/Platform/exchange/CompleteExchange.js @@ -5,9 +5,7 @@ import SafeAreaView from "react-native-safe-area-view"; import connectApp from "@ledgerhq/live-common/lib/hw/connectApp"; import { createAction } from "@ledgerhq/live-common/lib/hw/actions/completeExchange"; import { createAction as txCreateAction } from "@ledgerhq/live-common/lib/hw/actions/transaction"; -import { toExchangeRaw } from "@ledgerhq/live-common/lib/exchange/platform/serialization"; import completeExchange from "@ledgerhq/live-common/lib/exchange/platform/completeExchange"; -import { toTransactionRaw } from "@ledgerhq/live-common/lib/transaction"; import type { Account, Transaction, From 55a365efe58190910a5b401f94b34eff2bf434b0 Mon Sep 17 00:00:00 2001 From: JunichiSugiura Date: Wed, 23 Feb 2022 15:20:37 +0100 Subject: [PATCH 09/13] show device animation on exchange flow --- src/components/DeviceAction/index.js | 9 +++- src/components/DeviceAction/rendering.js | 43 ++++++++++++++++--- src/locales/en/common.json | 4 ++ .../Platform/exchange/CompleteExchange.js | 1 - 4 files changed, 48 insertions(+), 9 deletions(-) diff --git a/src/components/DeviceAction/index.js b/src/components/DeviceAction/index.js index 3f20c00e0a..1e614fd747 100644 --- a/src/components/DeviceAction/index.js +++ b/src/components/DeviceAction/index.js @@ -177,8 +177,13 @@ export default function DeviceAction({ !completeExchangeResult && !completeExchangeError ) { - // $FlowFixMe - return renderExchange({ exchangeType: request?.exchangeType }); + return renderExchange({ + // $FlowFixMe + exchangeType: request?.exchangeType, + t, + device, + theme, + }); } if (initSwapRequested && !initSwapResult && !initSwapError) { diff --git a/src/components/DeviceAction/rendering.js b/src/components/DeviceAction/rendering.js index 1cc199d016..f126e808d2 100644 --- a/src/components/DeviceAction/rendering.js +++ b/src/components/DeviceAction/rendering.js @@ -445,20 +445,51 @@ export function renderLoading({ } export function renderExchange({ - transactionType, -}: { - transactionType: number, + exchangeType, + t, + device, + theme, +}: RawProps & { + exchangeType: number, + device: Device, }) { - switch (transactionType) { + switch (exchangeType) { case 0x00: - return {"Confirm swap on your device"}; case 0x01: - return {"Confirm swap on your device"}; + return renderSecureTransferDeviceConfirmation({ + exchangeTypeName: exchangeType === 0x00 ? "confirmSell" : "confirmFund", + t, + device, + theme, + }); default: return {"Confirm exchange on your device"}; } } +export function renderSecureTransferDeviceConfirmation({ + t, + exchangeTypeName, + device, +}: RawProps & { + exchangeTypeName: string, + device: Device, +}) { + return ( + + + {t(`DeviceAction.${exchangeTypeName}.alert`)} + + + + + + {t(`DeviceAction.${exchangeTypeName}.title`)} + + + ); +} + export function LoadingAppInstall({ analyticsPropertyFlow = "unknown", request, diff --git a/src/locales/en/common.json b/src/locales/en/common.json index 054e70b22a..ab807a2244 100644 --- a/src/locales/en/common.json +++ b/src/locales/en/common.json @@ -2609,6 +2609,10 @@ "title": "Confirm sell operation on device", "alert": "Verify the Sell details on your device before sending it. The addresses are exchanged securely so you don’t have to verify them." }, + "confirmFund": { + "title": "Confirm Fund transaction", + "alert": "Verify the Fund details on your device before sending it. The addresses are exchanged securely so you don't have to verify them." + }, "button": { "openManager": "Open Manager" }, diff --git a/src/screens/Platform/exchange/CompleteExchange.js b/src/screens/Platform/exchange/CompleteExchange.js index 9c5eaf5d0b..97787c8cbd 100644 --- a/src/screens/Platform/exchange/CompleteExchange.js +++ b/src/screens/Platform/exchange/CompleteExchange.js @@ -18,7 +18,6 @@ import DeviceActionModal from "../../../components/DeviceActionModal"; type Result = { operation?: Operation, error?: Error, - device: Device, }; export default function PlatformCompleteExchange({ From 0a179d4adef650aab42a4831e676ec1ef8ac6134 Mon Sep 17 00:00:00 2001 From: JunichiSugiura Date: Wed, 2 Mar 2022 16:18:58 +0100 Subject: [PATCH 10/13] fix fund device action modal --- src/components/DeviceAction/rendering.js | 14 ++++++++------ src/screens/Platform/exchange/CompleteExchange.js | 4 ++++ src/screens/Platform/exchange/StartExchange.js | 3 +++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/components/DeviceAction/rendering.js b/src/components/DeviceAction/rendering.js index f126e808d2..aa56e374f8 100644 --- a/src/components/DeviceAction/rendering.js +++ b/src/components/DeviceAction/rendering.js @@ -455,9 +455,11 @@ export function renderExchange({ }) { switch (exchangeType) { case 0x00: + return
{"Confirm swap on your device"}
; case 0x01: + case 0x02: return renderSecureTransferDeviceConfirmation({ - exchangeTypeName: exchangeType === 0x00 ? "confirmSell" : "confirmFund", + exchangeTypeName: exchangeType === 0x00 ? "confirmFund" : "confirmSell", t, device, theme, @@ -477,15 +479,15 @@ export function renderSecureTransferDeviceConfirmation({ }) { return ( - - {t(`DeviceAction.${exchangeTypeName}.alert`)} - - + - + {t(`DeviceAction.${exchangeTypeName}.title`)} + + {t(`DeviceAction.${exchangeTypeName}.alert`)} + ); } diff --git a/src/screens/Platform/exchange/CompleteExchange.js b/src/screens/Platform/exchange/CompleteExchange.js index 97787c8cbd..85af625b93 100644 --- a/src/screens/Platform/exchange/CompleteExchange.js +++ b/src/screens/Platform/exchange/CompleteExchange.js @@ -24,7 +24,9 @@ export default function PlatformCompleteExchange({ route: { params: { request, onResult, device }, }, + navigation, }: { + navigation: *, route: { params: { request: { @@ -79,6 +81,7 @@ export default function PlatformCompleteExchange({ key="completeExchange" device={device} action={exchangeAction} + onClose={() => navigation.pop()} onResult={({ completeExchangeResult, completeExchangeError }) => { if (completeExchangeError) { setError(completeExchangeError); @@ -93,6 +96,7 @@ export default function PlatformCompleteExchange({ key="sign" device={device} action={sendAction} + onClose={() => navigation.pop()} onResult={({ signedOperation, transactionSignError }) => { if (transactionSignError) { setError(transactionSignError); diff --git a/src/screens/Platform/exchange/StartExchange.js b/src/screens/Platform/exchange/StartExchange.js index fe427d25cf..bdf37b1077 100644 --- a/src/screens/Platform/exchange/StartExchange.js +++ b/src/screens/Platform/exchange/StartExchange.js @@ -16,8 +16,10 @@ type Result = { }; export default function PlatformStartExchange({ + navigation, route, }: { + navigation: *, route: { params: { request: { exchangeType: number }, @@ -33,6 +35,7 @@ export default function PlatformStartExchange({ navigation.pop()} onResult={result => { route.params.onResult({ ...result, device }); }} From 091f4ff9031bb98659c1783b26e653ea3a5e6cba Mon Sep 17 00:00:00 2001 From: JunichiSugiura Date: Wed, 2 Mar 2022 17:12:38 +0100 Subject: [PATCH 11/13] fix fund action message --- src/components/DeviceAction/rendering.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/DeviceAction/rendering.js b/src/components/DeviceAction/rendering.js index aa56e374f8..86ac939db1 100644 --- a/src/components/DeviceAction/rendering.js +++ b/src/components/DeviceAction/rendering.js @@ -459,7 +459,7 @@ export function renderExchange({ case 0x01: case 0x02: return renderSecureTransferDeviceConfirmation({ - exchangeTypeName: exchangeType === 0x00 ? "confirmFund" : "confirmSell", + exchangeTypeName: exchangeType === 0x01 ? "confirmSell" : "confirmFund", t, device, theme, From 1ae4460e6c710cae455714023c66744258a80da1 Mon Sep 17 00:00:00 2001 From: JunichiSugiura Date: Tue, 8 Mar 2022 10:23:28 +0100 Subject: [PATCH 12/13] remove unnecessary changes --- ios/ledgerlivemobile.xcodeproj/project.pbxproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ios/ledgerlivemobile.xcodeproj/project.pbxproj b/ios/ledgerlivemobile.xcodeproj/project.pbxproj index 967b0d68dd..57e29a4137 100644 --- a/ios/ledgerlivemobile.xcodeproj/project.pbxproj +++ b/ios/ledgerlivemobile.xcodeproj/project.pbxproj @@ -896,7 +896,7 @@ DEVELOPMENT_TEAM = 5HK2Q4J4X4; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = ""; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 "; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -1041,7 +1041,7 @@ DEVELOPMENT_TEAM = 5HK2Q4J4X4; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; - "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = ""; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 "; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -1108,7 +1108,7 @@ DEVELOPMENT_TEAM = 5HK2Q4J4X4; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = ""; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 "; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; From 6687e67193a9124bdd159f355e8b2546528a509f Mon Sep 17 00:00:00 2001 From: JunichiSugiura Date: Tue, 8 Mar 2022 11:02:36 +0100 Subject: [PATCH 13/13] add comments for exchangeType --- src/components/DeviceAction/rendering.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/DeviceAction/rendering.js b/src/components/DeviceAction/rendering.js index 86ac939db1..12b6988e6e 100644 --- a/src/components/DeviceAction/rendering.js +++ b/src/components/DeviceAction/rendering.js @@ -454,10 +454,10 @@ export function renderExchange({ device: Device, }) { switch (exchangeType) { - case 0x00: + case 0x00: // swap return
{"Confirm swap on your device"}
; - case 0x01: - case 0x02: + case 0x01: // sell + case 0x02: // fund return renderSecureTransferDeviceConfirmation({ exchangeTypeName: exchangeType === 0x01 ? "confirmSell" : "confirmFund", t,