Merge pull request #14767 from brave/brave_24824

Warmup Filecoin Ledger account before transaction
This commit is contained in:
cypt4
2022-08-24 05:16:33 -07:00
committed by GitHub
2 changed files with 16 additions and 1 deletions
@@ -122,6 +122,10 @@ export default class FilecoinLedgerKeyring implements LedgerFilecoinKeyring {
Method: parsed.Method,
Params: parsed.Params
}
// Accounts must be warmed up before signing.
await this.provider?.getAccounts()
const signed: SignedLotusMessage = await this.provider?.sign(parsed.From, lotusMessage)
return { success: true, payload: signed }
} catch (e) {
@@ -40,6 +40,17 @@ export interface Props {
onClickInstructions: () => void
}
function getAppName (coinType: BraveWallet.CoinType): string {
switch (coinType) {
case BraveWallet.CoinType.SOL:
return 'Solana'
case BraveWallet.CoinType.FIL:
return 'Filecoin'
default:
return 'Ethereum'
}
}
export const ConnectHardwareWalletPanel = ({
onCancel,
walletName,
@@ -60,7 +71,7 @@ export const ConnectHardwareWalletPanel = ({
}
if (hardwareWalletCode === 'openLedgerApp') {
let network = (coinType === BraveWallet.CoinType.SOL) ? 'Solana' : 'Ethereum'
let network = getAppName(coinType)
return getLocale('braveWalletConnectHardwarePanelOpenApp')
.replace('$1', network)
.replace('$2', walletName)