Fix wallet deduping and refresh account state after binding
This commit is contained in:
@@ -382,9 +382,10 @@ function getInjectedProviderStableId(
|
|||||||
index: number,
|
index: number,
|
||||||
detail?: Eip6963ProviderDetail,
|
detail?: Eip6963ProviderDetail,
|
||||||
): string {
|
): string {
|
||||||
const uuid = String(detail?.info?.uuid || "").trim();
|
|
||||||
const rdns = String(detail?.info?.rdns || "").toLowerCase();
|
const rdns = String(detail?.info?.rdns || "").toLowerCase();
|
||||||
if (uuid) return `eip6963:${uuid}`;
|
const announcedName = String(detail?.info?.name || "").toLowerCase().trim();
|
||||||
|
if (rdns) return `rdns:${rdns}`;
|
||||||
|
if (announcedName) return `name:${announcedName}`;
|
||||||
if (provider.isOkxWallet || rdns.includes("okx")) return `okx:${index}`;
|
if (provider.isOkxWallet || rdns.includes("okx")) return `okx:${index}`;
|
||||||
if (provider.isMetaMask || rdns.includes("metamask")) return `metamask:${index}`;
|
if (provider.isMetaMask || rdns.includes("metamask")) return `metamask:${index}`;
|
||||||
if (provider.isRabby || rdns.includes("rabby")) return `rabby:${index}`;
|
if (provider.isRabby || rdns.includes("rabby")) return `rabby:${index}`;
|
||||||
@@ -1644,6 +1645,7 @@ export function AccountCenter() {
|
|||||||
setPaymentInfo(
|
setPaymentInfo(
|
||||||
`${walletLabel} 已绑定: ${shortAddress(address)}。现在可点击“立即订阅并激活服务”。`,
|
`${walletLabel} 已绑定: ${shortAddress(address)}。现在可点击“立即订阅并激活服务”。`,
|
||||||
);
|
);
|
||||||
|
await Promise.all([loadSnapshot(), loadPaymentSnapshot()]);
|
||||||
if (options.openOverlayAfterBind) setShowOverlay(true);
|
if (options.openOverlayAfterBind) setShowOverlay(true);
|
||||||
setPaymentBusy(false);
|
setPaymentBusy(false);
|
||||||
return true;
|
return true;
|
||||||
@@ -1684,7 +1686,7 @@ export function AccountCenter() {
|
|||||||
);
|
);
|
||||||
setProviderMode(providerSelection.mode);
|
setProviderMode(providerSelection.mode);
|
||||||
if (options.openOverlayAfterBind) setShowOverlay(true);
|
if (options.openOverlayAfterBind) setShowOverlay(true);
|
||||||
await loadPaymentSnapshot();
|
await Promise.all([loadSnapshot(), loadPaymentSnapshot()]);
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setPaymentInfo("");
|
setPaymentInfo("");
|
||||||
|
|||||||
Reference in New Issue
Block a user