-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add reuasable hook to use stake flow actions directly in any nav…
…igator; use directly in earn nav
- Loading branch information
1 parent
541447c
commit c4c16e6
Showing
6 changed files
with
106 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"live-mobile": patch | ||
--- | ||
|
||
Re-use account-specific stake flow actions directly in the Earn Navigator to avoid empty stake flow navigation that was causing empty modals to appear. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
apps/ledger-live-mobile/src/components/Stake/useStakingDrawer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { StackNavigationProp } from "@react-navigation/stack"; | ||
import { ParamListBase, RouteProp } from "@react-navigation/native"; | ||
import { Account } from "@ledgerhq/types-live"; | ||
import { NavigatorName, ScreenName } from "../../const"; | ||
import perFamilyAccountActions from "../../generated/accountActions"; | ||
|
||
/** Open the stake flow for a given account from any navigator. Returns to parent route on completion. */ | ||
export function useStakingDrawer({ | ||
navigation, | ||
parentRoute, | ||
alwaysShowNoFunds, | ||
}: { | ||
navigation: StackNavigationProp<{ [key: string]: object | undefined }>; | ||
parentRoute: RouteProp<ParamListBase> | undefined; | ||
alwaysShowNoFunds?: boolean | undefined; | ||
}) { | ||
return (account: Account, parentAccount?: Account) => { | ||
if (alwaysShowNoFunds) { | ||
// get funds to stake with | ||
navigation.navigate(NavigatorName.Base, { | ||
screen: NavigatorName.NoFundsFlow, | ||
drawer: undefined, | ||
params: { | ||
screen: ScreenName.NoFunds, | ||
params: { | ||
account, | ||
parentAccount, | ||
}, | ||
}, | ||
}); | ||
return; | ||
} | ||
|
||
// @ts-expect-error issue in typing | ||
const decorators = perFamilyAccountActions[account?.currency?.family]; | ||
// get the stake flow for the specific currency | ||
const familySpecificMainActions = | ||
(decorators && | ||
decorators.getMainActions && | ||
decorators.getMainActions({ | ||
account, | ||
parentAccount, | ||
colors: {}, | ||
parentRoute, | ||
})) || | ||
[]; | ||
const stakeFlow = familySpecificMainActions.find( | ||
(action: { id: string }) => action.id === "stake", | ||
)?.navigationParams; | ||
if (!stakeFlow) return null; | ||
|
||
const [name, options] = stakeFlow; | ||
|
||
// open staking drawer (or stake flow screens) for the specific currency, inside the current navigator | ||
navigation.navigate(NavigatorName.Base, { | ||
screen: name, | ||
drawer: options?.drawer, | ||
params: { | ||
screen: options.screen, | ||
params: { | ||
...(options?.params || {}), | ||
account, | ||
parentAccount, | ||
}, | ||
}, | ||
}); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c4c16e6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
live-common-tools – ./
ledger-live-tools.vercel.app
live-common-tools-git-develop-ledgerhq.vercel.app
ledger-live.vercel.app
live-common-tools-ledgerhq.vercel.app
live.ledger.tools
c4c16e6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bot "super report" on 7 last days
7 last days: 7 runs, 655 success txs.⚠️ 76% success rate. ⚠️ 46% coverage rate.
Details case by case
Spec
Bitcoin Testnet
Spec
Bitcoin Cash
Detail of errors (3)
TEST during broadcast LedgerAPI4xx: -25: Missing inputs
Spec
Bitcoin Gold
Spec
Dash
Spec
Digibyte
Spec
DogeCoin
Spec
Komodo
Spec
Litecoin
Spec
Peercoin
Spec
PivX
Detail of errors (4)
LedgerAPI4xx: Error when executing RPC call
Spec
Vertcoin
Spec
Viacoin
Spec
ZCash
Spec
Horizen
Detail of errors (6)
TEST during broadcast LedgerAPI4xx: -26: 68: op-checkblockatheight-needed
Spec
Celo
Detail of errors (6)
TEST mutation must not have tx status errors NotEnoughBalance: NotEnoughBalance
Spec
osmosis
Detail of errors (21)
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:osmo:osmo1v283e7h2plllyjwgqrexv2ge5e4z252u26g0q
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:osmo:osmo1n6vccpa77x7xyhnk98jy6gg3rmgjkazxuyk2n
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:osmo:osmo1vc7s929uh2yxyhau4wsg5th9jzedvkurt8rqd
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:osmo:osmo1vvzwc6l3wfdaqa9rncex8k2uwtpwztswsm7kk
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:osmo:osmo1qgrd8srhvald995uvpeyncvwg7afgkmr88sps
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:osmo:osmo1rs97j43nfyvc689y5rjvnnhrq3tes6ghn8m44
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:osmo:osmo1hgyf054qztvmty3cayuw9nedftlhejv5r6kn0
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:osmo:osmo1qvtnzptp30maznnhdg30xl2jtdq2shpn08kxa
Spec
desmos
Detail of errors (9)
Error: could not find optimisticOperation
Spec
umee
Detail of errors (9)
Error: could not find optimisticOperation
Spec
persistence
❌ Fatal cases (4)
Error: "Error during cosmos synchronization: "API HTTP 503
Detail of errors (5)
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:persistence:persistence1hgyf054qztvmty3cayuw9ne
Error: "Error during cosmos synchronization: "API HTTP 503
Spec
quicksilver
Spec
onomy
Detail of errors (15)
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:onomy:onomy1v283e7h2plllyjwgqrexv2ge5e4z252ucq0
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:onomy:onomy1qvtnzptp30maznnhdg30xl2jtdq2shpnaa3
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:onomy:onomy1vc7s929uh2yxyhau4wsg5th9jzedvkureay
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:onomy:onomy1rs97j43nfyvc689y5rjvnnhrq3tes6ghpau
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:onomy:onomy1n6vccpa77x7xyhnk98jy6gg3rmgjkazxw73
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:onomy:onomy1hgyf054qztvmty3cayuw9nedftlhejv53q3
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:onomy:onomy1jgk668h53gd9wn09mndq7uzgk80nr5d8c3y
Spec
stargaze
Detail of errors (21)
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:stargaze:stars1qgrd8srhvald995uvpeyncvwg7afgkmr
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:stargaze:stars1jgk668h53gd9wn09mndq7uzgk80nr5d8
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:stargaze:stars1g9t7sv8y0mvu2qd0xguc40xujnu94rh5
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:stargaze:stars1qvtnzptp30maznnhdg30xl2jtdq2shpn
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:stargaze:stars1v283e7h2plllyjwgqrexv2ge5e4z252u
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:stargaze:stars1n6vccpa77x7xyhnk98jy6gg3rmgjkazx
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:stargaze:stars1hgyf054qztvmty3cayuw9nedftlhejv5
Spec
coreum
Spec
Crypto org
Detail of errors (6)
Error: could not find optimisticOperation
TEST deviceAction confirm step 'To' Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 1 Object { - "To": "cro1h95uwv25le8rd0fl80qyp0438kn57xl4cp64dl", + "To": "cro1
Spec
Elrond
Detail of errors (16)
TEST raw optimistic operation matches Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:elrond:erd143yn6uvrfzjptq5g7wvzntl3fcthsxtxrp9
TEST raw optimistic operation matches Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:elrond:erd1ql9pxrhe29cjr8qgxx3rtmh9lyax5x9dkvu
TEST raw optimistic operation matches Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:elrond:erd149kzxgtymzzaddanlj02zhyhwves9wspvk8
TEST raw optimistic operation matches Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:elrond:erd172muqtk2ka5ath64284fm0av4tarkg6l040
TEST raw optimistic operation matches Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:elrond:erd1nhe920dlsx8u0lg46grd82dc8vqj8wejh8u
Spec
Polygon
Detail of errors (9)
TypeError: Cannot add property nonce, object is not extensible
Spec
Ethereum Classic
Detail of errors (9)
TypeError: Cannot add property nonce, object is not extensible
Spec
Ethereum Goerli
Detail of errors (9)
TypeError: Cannot add property nonce, object is not extensible
Spec
Hedera
❌ Fatal cases (1)
LedgerAPI5xx: API HTTP 503
Spec
InternetComputer
Spec
NEAR
Detail of errors (2)
TEST mutation must not have tx status errors NearStakingThresholdNotMet: NearStakingThresholdNotMet
Spec
XRP
Spec
Solana
Detail of errors (17)
TEST destination > account balance increased with transaction amount Error: expect(received).toBe(expected) // Object.is equality Expected: "63482229" Received: "61094349"
TEST destination > account balance increased with transaction amount Error: expect(received).toBe(expected) // Object.is equality Expected: "188226169" Received: "188221169"
TEST account balance should be zero Error: expect(received).toBe(expected) // Object.is equality Expected: 0 Received: 890880
TEST during broadcast NetworkDown: failed to send transaction: Transaction simulation failed: Transaction results in an account (0) without insufficient funds for rent
NetworkDown: failed to get Stake Activation 2WsrYgbAt1UoHUDgiYMRzwxRtJam5PrFTiKS6NVdkMJr: Invalid param: account not found
Spec
Stacks
Detail of errors (6)
Error: could not find optimisticOperation
Spec
Stellar
Spec
Tezos
Detail of errors (12)
TEST deviceAction confirm step 'Fee' Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 1 Object { - "Fee": "0.000749", + "Fee": "0.000666", }
TEST deviceAction confirm step 'Fee' Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 1 Object { - "Fee": "0.000949", + "Fee": "0.000866", }
TEST deviceAction confirm step 'Fee' Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 1 Object { - "Fee": "0.000744", + "Fee": "0.000661", }
Error: could not find optimisticOperation
Spec
Algorand
Detail of errors (2)
TEST deviceAction confirm step 'Amount' Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 1 Object { - "Amount": "USDT 0.0", + "Amount": "USDt 0.0", }
Spec
Ethereum EVM (TEST ONLY DO NOT USE)
Spec
Polygon EVM (TEST ONLY DO NOT USE)
❌ Fatal cases (6)
DisconnectedDevice: tcp closed
Error: speculos process failure. readall: connection closed
Spec
Arbitrum Goerli
Spec
Flare
Spec
Songbird
Spec
Moonbeam
Detail of errors (8)
TEST account balance moved with operation value Error: expect(received).toBe(expected) // Object.is equality Expected: "30169979564346872127" Received: "30169977150480977127"
TEST account balance moved with operation value Error: expect(received).toBe(expected) // Object.is equality Expected: "2924487598776226962" Received: "2924486804445997962"
TEST account balance moved with operation value Error: expect(received).toBe(expected) // Object.is equality Expected: "18505578530540096927" Received: "18505581335373659927"
TEST account balance moved with operation value Error: expect(received).toBe(expected) // Object.is equality Expected: "19324405146672834278" Received: "19324411623193647278"
TEST account balance moved with operation value Error: expect(received).toBe(expected) // Object.is equality Expected: "2622031009794000" Received: "2623254429264000"
TEST account balance moved with operation value Error: expect(received).toBe(expected) // Object.is equality Expected: "2925870319596000" Received: "2923371893274000"
TEST account balance moved with operation value Error: expect(received).toBe(expected) // Object.is equality Expected: "2919660193758000" Received: "2917528946535000"
Spec
RSK
Spec
Bittorent Chain
Spec
Kava EVM
Spec
Evmos EVM
❌ Fatal cases (3)
Error: scan accounts timeout for currency Evmos EVM
Detail of errors (10)
Error: could not find optimisticOperation
Error: invalid arrayify value (argument="value", value="-0x6ccc2fc4", code=INVALID_ARGUMENT, version=bytes/5.7.0)
Error: invalid arrayify value (argument="value", value="-0x2a872272", code=INVALID_ARGUMENT, version=bytes/5.7.0)
Error: invalid arrayify value (argument="value", value="-0x8ed12778", code=INVALID_ARGUMENT, version=bytes/5.7.0)
Error: invalid arrayify value (argument="value", value="-0x2a666aaa", code=INVALID_ARGUMENT, version=bytes/5.7.0)
Spec
OP Mainnet
Spec
Optimism Goerli
Spec
Energy Web
Spec
Astar
Spec
Metis
Spec
Moonriver
Detail of errors (2)
TEST account balance moved with operation value Error: expect(received).toBe(expected) // Object.is equality Expected: "142153005689357812" Received: "142153010786246812"
Spec
Velas EVM
Spec
Syscoin
Detail of errors (3)
Error: could not find optimisticOperation
Spec
Polygon zkEVM Testnet
Detail of errors (9)
Error: could not find optimisticOperation
Spec
Base
Spec
Base Goerli
Spec
Klaytn
❌ Fatal cases (6)
LedgerAPI4xx: API HTTP 404
Spec
Qtum
Spec
Decred
Spec
cardano
Spec
axelar
Detail of errors (3)
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:axelar:axelar1u63uctcult0t7wsscxxsmv2r2lgl25f4r
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:axelar:axelar123r3dwfylykx0fugawn6mu2h2smq3047p
Spec
cosmos
Detail of errors (4)
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:cosmos:cosmos17s09a0jyp24hl7w3vcn8padz6efwmrpjw
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:cosmos:cosmos1u63uctcult0t7wsscxxsmv2r2lgl25f48
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:cosmos:cosmos1k2d965a5clx7327n9zx30ewz39ms7kyj9
Spec
secret_network
Detail of errors (4)
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:secret_network:secret123r3dwfylykx0fugawn6mu2h2
TEST optimistic operation matches op Error: expect(received).toMatchObject(expected) - Expected - 1 + Received + 0 Object { "accountId": "js:2:secret_network:secret1k2d965a5clx7327n9zx30ewz3
Spec
Avalanche C-Chain
Detail of errors (2)
TypeError: Cannot add property nonce, object is not extensible
Spec
BSC
Detail of errors (5)
TypeError: Cannot add property nonce, object is not extensible
Spec
Filecoin
Detail of errors (2)
TEST destination > account balance increased with transaction amount Error: expect(received).toBe(expected) // Object.is equality Expected: "854325448313177252" Received: "854325448313177247"
Spec
Tron
Detail of errors (3)
Error: class org.tron.core.exception.ContractValidateException : freeze v2 is open, old freeze is closed
Spec
Cronos
Spec
Fantom
Spec
Boba
Spec
Telos
Spec
Polygon zkEVM
Spec
Polkadot
❌ Fatal cases (3)
Invariant Violation: Polkadot: no app found. Are you sure your COINAPPS is up to date?
Spec
Bitcoin
Spec
Ethereum