miniwallet 0.1.3 → 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.
@@ -79,11 +79,11 @@ function m({ children: e, chains: n = [] }) {
79
79
  alert("请安装钱包");
80
80
  return;
81
81
  }
82
- h(t), x(e), console.log("provider: ", n);
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;
@@ -222,7 +220,7 @@ var g = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOC
222
220
  //#endregion
223
221
  //#region src/MiniWalletButton.tsx
224
222
  function _({ label: e = "Connect Wallet" }) {
225
- let { account: n, balance: c, isConnected: l, connectingWallet: u, selectedChain: f, wallet: p, switchChain: m, chains: _, connect: v, disconnect: y } = h(), [b, x] = a(!1), [S, C] = a(!1), [w, T] = a(!1), [E, D] = a("复制地址"), O = i(() => `${n.slice(0, 6)}...${n.slice(-4)}`, [n]), k = t(() => {
223
+ let { account: n, balance: c, isConnected: l, connectingWallet: u, selectedChain: f, wallet: p, switchChain: m, chains: _, connect: v, disconnect: y } = h(), [b, x] = a(!1), [S, C] = a(!1), [w, T] = a(!1), [E, D] = a("复制地址"), O = i(() => n ? `${n.slice(0, 6)}...${n.slice(-4)}` : "", [n]), k = t(() => {
226
224
  x(!0);
227
225
  }, []), A = t(() => {
228
226
  x(!1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miniwallet",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "React wallet connect button with multi-wallet support via EIP-6963",
5
5
  "type": "module",
6
6
  "main": "./dist/miniwallet.js",