Skip to content

Commit

Permalink
fix: aptos pubkey lose (#6260)
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteZhang1024 authored Nov 22, 2024
1 parent d3905a0 commit bb7a4e7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions packages/kit-bg/src/vaults/impls/aptos/KeyringHardware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export class KeyringHardware extends KeyringHardwareBase {
buildResultAccount: ({ account }) => ({
path: account.path,
address: account.payload?.address || '',
pub: account.payload?.pub || '',
}),
hwSdkNetwork: this.hwSdkNetwork,
});
Expand Down Expand Up @@ -106,15 +107,14 @@ export class KeyringHardware extends KeyringHardwareBase {
const ret: ICoreApiGetAddressItem[] = [];
for (let i = 0; i < list.length; i += 1) {
const item = list[i];
const { path, address } = item;
const { path, address, pub } = item;
const { normalizedAddress } = await this.vault.validateAddress(
address || '',
);
const addressInfo: ICoreApiGetAddressItem = {
address: normalizedAddress || address || '',
path,
publicKey: '',
// publicKey: publicKey || '',
publicKey: pub || '',
};
ret.push(addressInfo);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/kit-bg/src/vaults/impls/cosmos/KeyringHardware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type {
import { convertDeviceResponse } from '@onekeyhq/shared/src/errors/utils/deviceErrorUtils';
import accountUtils from '@onekeyhq/shared/src/utils/accountUtils';
import { checkIsDefined } from '@onekeyhq/shared/src/utils/assertUtils';
import hexUtils from '@onekeyhq/shared/src/utils/hexUtils';

import { KeyringHardwareBase } from '../../base/KeyringHardwareBase';

Expand All @@ -30,7 +31,6 @@ import type {
ISignTransactionParams,
} from '../../types';
import type { AllNetworkAddressParams } from '@onekeyfe/hd-core';
import type { HDNodeType } from '@onekeyfe/hd-transport';

export class KeyringHardware extends KeyringHardwareBase {
override coreApi = coreChainApi.cosmos.hd;
Expand Down Expand Up @@ -112,7 +112,7 @@ export class KeyringHardware extends KeyringHardwareBase {
for (let i = 0; i < publicKeys.length; i += 1) {
const item = publicKeys[i];
const { path, publicKey } = item;
const pubkey = hexToBytes(`0x${publicKey}`);
const pubkey = hexToBytes(hexUtils.addHexPrefix(publicKey));
const addressInfo: ICoreApiGetAddressItem = {
address: '',
path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ import {
XStack,
useSafeAreaInsets,
} from '@onekeyhq/components';
import type { IAllNetworksDBStruct } from '@onekeyhq/kit-bg/src/dbs/simple/entity/SimpleDbEntityAllNetworks';
import type { IAllNetworkAccountInfo } from '@onekeyhq/kit-bg/src/services/ServiceAllNetwork/ServiceAllNetwork';
import type { IAccountDeriveTypes } from '@onekeyhq/kit-bg/src/vaults/types';
import backgroundApiProxy from '@onekeyhq/kit/src/background/instance/backgroundApiProxy';
import { AccountSelectorProviderMirror } from '@onekeyhq/kit/src/components/AccountSelector';
import { useAccountSelectorCreateAddress } from '@onekeyhq/kit/src/components/AccountSelector/hooks/useAccountSelectorCreateAddress';
Expand All @@ -41,6 +38,9 @@ import useAppNavigation from '@onekeyhq/kit/src/hooks/useAppNavigation';
import { useCopyAccountAddress } from '@onekeyhq/kit/src/hooks/useCopyAccountAddress';
import { usePromiseResult } from '@onekeyhq/kit/src/hooks/usePromiseResult';
import { useFuseSearch } from '@onekeyhq/kit/src/views/ChainSelector/hooks/useFuseSearch';
import type { IAllNetworksDBStruct } from '@onekeyhq/kit-bg/src/dbs/simple/entity/SimpleDbEntityAllNetworks';
import type { IAllNetworkAccountInfo } from '@onekeyhq/kit-bg/src/services/ServiceAllNetwork/ServiceAllNetwork';
import type { IAccountDeriveTypes } from '@onekeyhq/kit-bg/src/vaults/types';
import { getNetworkIdsMap } from '@onekeyhq/shared/src/config/networkIds';
import {
EAppEventBusNames,
Expand Down

0 comments on commit bb7a4e7

Please sign in to comment.