Skip to content

Commit

Permalink
fix: query api issues
Browse files Browse the repository at this point in the history
  • Loading branch information
AricRedemption committed Sep 6, 2024
1 parent 6edbfc3 commit 13ff149
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 0 additions & 4 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ browser.runtime.onMessage.addListener(async (msg, sender) => {

// authorize actions
if (msg.action?.startsWith('authorize')) {
console.log('authorize', msg)

const icon = sender.tab?.favIconUrl || msg.icon || ''
const rawUrl = 'popup.html#authorize'
// 拼接授权页的参数
Expand Down Expand Up @@ -196,8 +194,6 @@ browser.runtime.onMessage.addListener(async (msg, sender) => {
// call corresponding process function
const action = actions[actionName]
if (action) {
console.log('password', password.value, hash(password.value))

const processed = await action.process(msg.params, {
host: msg.host,
password: hash(password.value),
Expand Down
5 changes: 3 additions & 2 deletions src/lib/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,9 @@ export async function getXPublicKey(password?: string) {
password = password ?? (await getPassword())
const activeWallet = await getActiveWalletOnlyAccount()
const network = await getNetwork()
const mneObj = mvc.Mnemonic.fromString(decrypt(activeWallet.mnemonic, password))
const mvcWallet = await getCurrentWallet(UtxoChain.MVC)
const mnemonic = decrypt(activeWallet.mnemonic, password)
const mneObj = mvc.Mnemonic.fromString(mnemonic)
const mvcWallet = await getCurrentWallet(UtxoChain.MVC, { mnemonic })
const rootPath = mvcWallet.getPath()
const xPublicKey = mneObj
.toHDPrivateKey('', network)
Expand Down
3 changes: 1 addition & 2 deletions src/lib/actions/is-connected.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import connector from '../connector'
import { getCurrentAccountId } from '../account'

export async function process(_: unknown, host: string) {
export async function process(_: unknown, { host }: { host: string }) {
const currentAccountId = await getCurrentAccountId()

if (!currentAccountId) return false

return connector.isConnected(currentAccountId, host)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ connector.connect = async function (accountId, host, logo?: string) {
}

connector.isConnected = async function (accountId, host) {
const connections = await getConnections()
const connections = await getConnections()
const accountConnections = connections[accountId] || {}
return !!accountConnections[host]
}
Expand Down
8 changes: 6 additions & 2 deletions src/lib/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,18 @@ interface WalletMap {
export async function getCurrentWallet<T extends Chain>(
chain: T,
options?: {
mnemonic?: string
password?: string
addressIndex?: number
}
): Promise<WalletMap[T]> {
const network = getNet()
const activeWallet = await getActiveWalletOnlyAccount()
const password = options?.password || (await getPassword())
const mnemonic = decrypt(activeWallet.mnemonic, password)
let mnemonic = options?.mnemonic
if (!mnemonic) {
const password = options?.password || (await getPassword())
mnemonic = decrypt(activeWallet.mnemonic, password)
}
const addressIndex = options?.addressIndex ?? activeWallet.accounts[0].addressIndex
const addressType = await getV3AddressTypeStorage(chain)
if (chain === Chain.BTC) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/wallet/components/TickerList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Ticker from './Ticker.vue'
import { ref, computed } from 'vue'
import EmptyIcon from '@/assets/icons-v3/empty.svg'
import { type TokenTransfer } from '@/queries/brc20'
import { LoadingText, Divider, FlexBox } from '@/components'
import ArrowDownIcon from '@/assets/icons-v3/arrow_down.svg'
import { LoadingText, Divider, FlexBox } from '@/components'
const props = defineProps<{
loading: boolean
Expand Down

0 comments on commit 13ff149

Please sign in to comment.