Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix params to import wallet #3271

Merged
merged 1 commit into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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