miniwallet 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/miniwallet.js +6 -8
- package/package.json +1 -1
package/dist/miniwallet.js
CHANGED
|
@@ -79,11 +79,11 @@ function m({ children: e, chains: n = [] }) {
|
|
|
79
79
|
alert("请安装钱包");
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
x(e), console.log("provider: ", n);
|
|
83
83
|
let r = await n.request({ method: "eth_requestAccounts" });
|
|
84
84
|
console.log("accounts: ", r), console.log("provider.chainId: ", n.chainId);
|
|
85
85
|
let i = parseInt(n.chainId, 16);
|
|
86
|
-
l(r[0]), _(i), localStorage.setItem("miniwallet:lastWalletId", t), x(null);
|
|
86
|
+
l(r[0]), h(t), _(i), localStorage.setItem("miniwallet:lastWalletId", t), x(null);
|
|
87
87
|
} catch (e) {
|
|
88
88
|
console.log("error: ", e);
|
|
89
89
|
let t = e, n = t?.code ?? "", r = t?.message ?? "";
|
|
@@ -91,17 +91,15 @@ function m({ children: e, chains: n = [] }) {
|
|
|
91
91
|
alert("连接已发起,请在扩展中确认连接");
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
|
-
alert(`Connect failed${n && `\n${n}`}${r && `\n${r}`}`);
|
|
95
|
-
} finally {
|
|
96
|
-
x(null);
|
|
94
|
+
alert(`Connect failed${n && `\n${n}`}${r && `\n${r}`}`), x(null);
|
|
97
95
|
}
|
|
98
96
|
}, [S]), j = t(async () => {
|
|
99
97
|
try {
|
|
100
|
-
if (!T) {
|
|
98
|
+
if (!T || !m) {
|
|
101
99
|
alert("请安装钱包");
|
|
102
100
|
return;
|
|
103
101
|
}
|
|
104
|
-
await T.request({
|
|
102
|
+
m !== "okx" && await T.request({
|
|
105
103
|
method: "wallet_revokePermissions",
|
|
106
104
|
params: [{ eth_accounts: {} }]
|
|
107
105
|
});
|
|
@@ -110,7 +108,7 @@ function m({ children: e, chains: n = [] }) {
|
|
|
110
108
|
} finally {
|
|
111
109
|
l(""), h(""), _(0), localStorage.removeItem("miniwallet:lastWalletId");
|
|
112
110
|
}
|
|
113
|
-
}, [T]), M = t(async (e) => {
|
|
111
|
+
}, [T, m]), M = t(async (e) => {
|
|
114
112
|
if (!T) {
|
|
115
113
|
alert("钱包不存在");
|
|
116
114
|
return;
|