|
@@ -12,6 +12,7 @@ let address = null;
|
|
|
let privateKey = null;
|
|
|
let isNew = false;
|
|
|
export const getWalletInfo = async () => {
|
|
|
+
|
|
|
// ✅ 新版逻辑:从 URL 参数中解密获取
|
|
|
if (!address) {
|
|
|
let queryString = window.location.search;
|
|
@@ -42,17 +43,16 @@ export const getWalletInfo = async () => {
|
|
|
}
|
|
|
|
|
|
// 2. 兼容旧版本 App 原生注入逻辑
|
|
|
- // #ifdef APP-PLUS
|
|
|
- if (!address && window.android) {
|
|
|
- await syncWait(() => {
|
|
|
+ if ((!address || !privateKey) && window.android) {
|
|
|
+ if (!address) {
|
|
|
address = window.android.getGlobalParam('wallet');
|
|
|
+ }
|
|
|
+ if (!privateKey) {
|
|
|
privateKey = window.android.getPrivateKey();
|
|
|
- }, 500)
|
|
|
-
|
|
|
+ }
|
|
|
if (address) uni.setStorageSync('address', address);
|
|
|
if (privateKey) uni.setStorageSync('K', cryptoEncode(privateKey));
|
|
|
}
|
|
|
- // #endif
|
|
|
|
|
|
// 3. H5 环境逻辑(MetaMask、微信)
|
|
|
// #ifdef H5
|