Skip to content

Commit

Permalink
fix params to import wallet (#3271)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlinton authored Mar 10, 2023
1 parent 1262caa commit a8c3555
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
23 changes: 13 additions & 10 deletions packages/background/src/backend/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ import type { EthereumConnectionBackend } from "./ethereum-connection";
import { KeyringStore } from "./keyring";
import type { SolanaConnectionBackend } from "./solana-connection";
import type { Nav, User } from "./store";
import { getNav , getWalletDataForUser, setUser, setWalletDataForUser } from "./store";
import {
getNav,
getWalletDataForUser,
setUser,
setWalletDataForUser,
} from "./store";
import * as store from "./store";

const { base58: bs58 } = ethers.utils;
Expand Down Expand Up @@ -206,11 +211,11 @@ export class Backend {
const signersOrConf =
"message" in tx
? ({
accounts: {
encoding: "base64",
addresses,
},
} as SimulateTransactionConfig)
accounts: {
encoding: "base64",
addresses,
},
} as SimulateTransactionConfig)
: undefined;
return await this.solanaConnectionBackend.simulateTransaction(
tx,
Expand Down Expand Up @@ -462,7 +467,7 @@ export class Backend {
return data.ethereum && data.ethereum.chainId
? data.ethereum.chainId
: // Default to mainnet
"0x1";
"0x1";
}

async ethereumChainIdUpdate(chainId: string): Promise<string> {
Expand Down Expand Up @@ -866,9 +871,9 @@ export class Backend {
* @param blockchain - Blockchain to add the wallet for
*/
async keyringImportWallet(
blockchain: Blockchain,
signedWalletDescriptor: SignedWalletDescriptor
): Promise<string> {
const { blockchain } = signedWalletDescriptor;
const { publicKey, name } = await this.keyringStore.addDerivationPath(
blockchain,
signedWalletDescriptor.derivationPath
Expand Down Expand Up @@ -1291,8 +1296,6 @@ export class Backend {
this.events.emit(BACKEND_EVENT, {
name: NOTIFICATION_KEYRING_SET_MNEMONIC,
});


}

async previewPubkeys(
Expand Down
7 changes: 5 additions & 2 deletions packages/background/src/frontend/server-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ import {
UI_RPC_METHOD_KEYRING_EXPORT_MNEMONIC,
UI_RPC_METHOD_KEYRING_EXPORT_SECRET_KEY,
UI_RPC_METHOD_KEYRING_HAS_MNEMONIC,
UI_RPC_METHOD_KEYRING_SET_MNEMONIC,
UI_RPC_METHOD_KEYRING_IMPORT_SECRET_KEY,
UI_RPC_METHOD_KEYRING_IMPORT_WALLET,
UI_RPC_METHOD_KEYRING_KEY_DELETE,
UI_RPC_METHOD_KEYRING_READ_NEXT_DERIVATION_PATH,
UI_RPC_METHOD_KEYRING_RESET,
UI_RPC_METHOD_KEYRING_SET_MNEMONIC,
UI_RPC_METHOD_KEYRING_STORE_CHECK_PASSWORD,
UI_RPC_METHOD_KEYRING_STORE_CREATE,
UI_RPC_METHOD_KEYRING_STORE_KEEP_ALIVE,
Expand Down Expand Up @@ -718,7 +718,10 @@ function handleKeyringHasMnemonic(ctx: Context<Backend>): RpcResponse<string> {
return [resp];
}

function handleKeyringSetMnemonic(ctx: Context<Backend>, mnemonic: string): RpcResponse<string> {
function handleKeyringSetMnemonic(
ctx: Context<Backend>,
mnemonic: string
): RpcResponse<string> {
const resp = ctx.backend.keyringSetMnemonic(mnemonic);
return [resp];
}
Expand Down

1 comment on commit a8c3555

@vercel
Copy link

@vercel vercel bot commented on a8c3555 Mar 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.