Skip to content

Commit

Permalink
fix: type address follow bittest-84 standard
Browse files Browse the repository at this point in the history
  • Loading branch information
Thiendekaco committed Jun 27, 2024

Verified

This commit was signed with the committer’s verified signature.
psafont Pau Ruiz Safont
1 parent f92c3a4 commit 48a6d6f
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -113,7 +113,7 @@ const getAuthAddresses = (addresses: string[]) => {
}

if (['bitcoin-84', 'bittest-84'].includes(keypairType)) {
return 'p2sh';
return 'p2wpkh';
}

return 'unknown';
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@ import { AuthUrls } from '@subwallet/extension-base/services/request-service/typ
import AuthorizeStore from '@subwallet/extension-base/stores/Authorize';
import { createPromiseHandler, getDomainFromUrl, PromiseHandler, stripUrl } from '@subwallet/extension-base/utils';
import { getId } from '@subwallet/extension-base/utils/getId';
import { isBitcoinAddress } from '@subwallet/keyring';
import { BehaviorSubject } from 'rxjs';

import { isEthereumAddress } from '@polkadot/util-crypto';
@@ -299,13 +300,13 @@ export default class AuthRequestHandler {
.map(([address, allowed]) => (allowed ? address : ''))
.filter((item) => (item !== ''));

const allowedListByRequestType = [...request.allowedAccounts];
let allowedListByRequestType = [...request.allowedAccounts];

// if (accountAuthType === 'evm') {
// allowedListByRequestType = allowedListByRequestType.filter((a) => isEthereumAddress(a));
// } else if (accountAuthType === 'substrate') {
// allowedListByRequestType = allowedListByRequestType.filter((a) => !isEthereumAddress(a));
// }
if (accountAuthType === 'evm') {
allowedListByRequestType = allowedListByRequestType.filter((a) => isEthereumAddress(a));
} else if (accountAuthType === 'bitcoin') {
allowedListByRequestType = allowedListByRequestType.filter((a) => isBitcoinAddress(a));
}

if (!confirmAnotherType && !request.reConfirm && allowedListByRequestType.length !== 0) {
// Prevent appear confirmation popup

0 comments on commit 48a6d6f

Please sign in to comment.