Skip to content

Commit

Permalink
Warmup Filecoin Ledger account before transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
cypt4 committed Aug 24, 2022
1 parent ba9ce25 commit 2e49069
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,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'
}
}

function ConnectHardwareWalletPanel (props: Props) {
const {
onCancel,
Expand All @@ -48,7 +59,7 @@ function ConnectHardwareWalletPanel (props: Props) {
}

if (hardwareWalletCode === 'openLedgerApp') {
let network = (coinType === BraveWallet.CoinType.SOL) ? 'Solana' : 'Ethereum'
let network = getAppName(coinType)
return getLocale('braveWalletConnectHardwarePanelOpenApp')
.replace('$1', network)
.replace('$2', walletName)
Expand Down

0 comments on commit 2e49069

Please sign in to comment.