miniwallet 0.1.15 → 0.1.16
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 +56 -34
- package/package.json +1 -1
package/dist/miniwallet.js
CHANGED
|
@@ -220,29 +220,29 @@ var g = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOC
|
|
|
220
220
|
//#endregion
|
|
221
221
|
//#region src/MiniWalletButton.tsx
|
|
222
222
|
function _({ label: e = "Connect Wallet" }) {
|
|
223
|
-
let { account: n, balance: c, isConnected: l,
|
|
224
|
-
|
|
225
|
-
}, []),
|
|
226
|
-
|
|
227
|
-
}, []),
|
|
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(() => {
|
|
224
|
+
x(!0);
|
|
225
|
+
}, []), A = t(() => {
|
|
226
|
+
x(!1);
|
|
227
|
+
}, []), j = t(async () => {
|
|
228
228
|
try {
|
|
229
|
-
await navigator.clipboard.writeText(n),
|
|
230
|
-
|
|
229
|
+
await navigator.clipboard.writeText(n), D("已复制!"), setTimeout(() => {
|
|
230
|
+
D("复制地址");
|
|
231
231
|
}, 1e3);
|
|
232
232
|
} catch (e) {
|
|
233
233
|
console.error("copy", e);
|
|
234
234
|
}
|
|
235
235
|
}, [n]);
|
|
236
236
|
return r(() => {
|
|
237
|
-
l &&
|
|
237
|
+
l && x(!1);
|
|
238
238
|
}, [l]), l ? /* @__PURE__ */ s("section", {
|
|
239
239
|
className: "inline-flex items-center justify-center text-center",
|
|
240
240
|
children: [
|
|
241
241
|
/* @__PURE__ */ o("select", {
|
|
242
|
-
value:
|
|
243
|
-
onChange: (e) =>
|
|
242
|
+
value: f?.id,
|
|
243
|
+
onChange: (e) => m(_.find((t) => t.id === Number(e.target.value))),
|
|
244
244
|
className: "bg-transparent1 mr-4 cursor-pointer rounded-sm border-none p-1 text-gray-600 outline-none hover:bg-gray-100",
|
|
245
|
-
children:
|
|
245
|
+
children: _.map((e) => /* @__PURE__ */ o("option", {
|
|
246
246
|
value: e.id,
|
|
247
247
|
children: e.name
|
|
248
248
|
}, e.id))
|
|
@@ -251,18 +251,18 @@ function _({ label: e = "Connect Wallet" }) {
|
|
|
251
251
|
className: "flex items-center justify-center rounded-2xl bg-white pr-3 shadow-lg inset-ring-1 shadow-gray-200 inset-ring-gray-100",
|
|
252
252
|
children: [/* @__PURE__ */ s("div", {
|
|
253
253
|
onClick: () => {
|
|
254
|
-
|
|
254
|
+
T(!0);
|
|
255
255
|
},
|
|
256
256
|
className: "flex cursor-pointer items-center justify-center space-x-2 rounded-l-2xl py-2.5 pr-1 pl-3 hover:bg-gray-50",
|
|
257
257
|
children: [
|
|
258
|
-
|
|
259
|
-
src:
|
|
260
|
-
alt:
|
|
258
|
+
p && /* @__PURE__ */ o("img", {
|
|
259
|
+
src: p.icon,
|
|
260
|
+
alt: p.name,
|
|
261
261
|
className: "h-6 w-6"
|
|
262
262
|
}),
|
|
263
263
|
/* @__PURE__ */ o("div", {
|
|
264
264
|
className: "mr-1",
|
|
265
|
-
children:
|
|
265
|
+
children: O
|
|
266
266
|
}),
|
|
267
267
|
/* @__PURE__ */ s("span", {
|
|
268
268
|
className: "text-sm text-gray-400",
|
|
@@ -270,14 +270,14 @@ function _({ label: e = "Connect Wallet" }) {
|
|
|
270
270
|
"(",
|
|
271
271
|
c,
|
|
272
272
|
" ",
|
|
273
|
-
|
|
273
|
+
f?.symbol ?? "",
|
|
274
274
|
")"
|
|
275
275
|
]
|
|
276
276
|
})
|
|
277
277
|
]
|
|
278
278
|
}), /* @__PURE__ */ o("button", {
|
|
279
279
|
className: "ml-1 h-6 w-6 cursor-pointer rounded-full",
|
|
280
|
-
onClick:
|
|
280
|
+
onClick: y,
|
|
281
281
|
children: /* @__PURE__ */ o("img", {
|
|
282
282
|
src: g,
|
|
283
283
|
alt: "disconnect",
|
|
@@ -285,7 +285,7 @@ function _({ label: e = "Connect Wallet" }) {
|
|
|
285
285
|
})
|
|
286
286
|
})]
|
|
287
287
|
}),
|
|
288
|
-
|
|
288
|
+
w && /* @__PURE__ */ o("div", {
|
|
289
289
|
className: "z-index-10 fixed top-0 right-0 bottom-0 left-0 bg-[rgba(0,0,0,0.5)]",
|
|
290
290
|
children: /* @__PURE__ */ s("div", {
|
|
291
291
|
className: "absolute top-1/2 left-1/2 flex h-auto w-[380px] -translate-x-1/2 -translate-y-1/2 flex-col items-center gap-3 rounded-3xl bg-white p-10 pt-5 text-center",
|
|
@@ -295,7 +295,7 @@ function _({ label: e = "Connect Wallet" }) {
|
|
|
295
295
|
children: /* @__PURE__ */ o("button", {
|
|
296
296
|
className: "mr-[-20px] cursor-pointer rounded-full p-1 hover:bg-gray-100",
|
|
297
297
|
onClick: () => {
|
|
298
|
-
|
|
298
|
+
T(!1);
|
|
299
299
|
},
|
|
300
300
|
children: /* @__PURE__ */ s("svg", {
|
|
301
301
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -308,21 +308,21 @@ function _({ label: e = "Connect Wallet" }) {
|
|
|
308
308
|
})
|
|
309
309
|
})
|
|
310
310
|
}),
|
|
311
|
-
|
|
312
|
-
src:
|
|
313
|
-
alt:
|
|
311
|
+
p && /* @__PURE__ */ o("img", {
|
|
312
|
+
src: p.icon,
|
|
313
|
+
alt: p.name,
|
|
314
314
|
className: "h-16 w-16"
|
|
315
315
|
}),
|
|
316
|
-
/* @__PURE__ */ o("p", { children:
|
|
316
|
+
/* @__PURE__ */ o("p", { children: O }),
|
|
317
317
|
/* @__PURE__ */ s("div", {
|
|
318
318
|
className: "mt-2 w-full space-x-10",
|
|
319
319
|
children: [/* @__PURE__ */ o("button", {
|
|
320
|
-
onClick:
|
|
320
|
+
onClick: j,
|
|
321
321
|
className: "w-[112px] cursor-pointer rounded-xl bg-gray-700 py-2 text-white shadow-md shadow-gray-500/50 outline-none",
|
|
322
|
-
children:
|
|
322
|
+
children: E
|
|
323
323
|
}), /* @__PURE__ */ o("button", {
|
|
324
324
|
type: "button",
|
|
325
|
-
onClick:
|
|
325
|
+
onClick: y,
|
|
326
326
|
className: "w-[112px] cursor-pointer rounded-xl bg-red-400 py-2 text-white shadow-md shadow-red-500/50 outline-none",
|
|
327
327
|
children: "断开连接"
|
|
328
328
|
})]
|
|
@@ -333,10 +333,10 @@ function _({ label: e = "Connect Wallet" }) {
|
|
|
333
333
|
]
|
|
334
334
|
}) : /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("button", {
|
|
335
335
|
type: "button",
|
|
336
|
-
onClick:
|
|
336
|
+
onClick: k,
|
|
337
337
|
className: "cursor-pointer rounded-xl bg-blue-500 px-4 py-2 text-white shadow-lg shadow-blue-500/50",
|
|
338
338
|
children: e
|
|
339
|
-
}),
|
|
339
|
+
}), b && /* @__PURE__ */ o("div", {
|
|
340
340
|
className: "z-index-10 fixed top-0 right-0 bottom-0 left-0 bg-[rgba(0,0,0,0.5)]",
|
|
341
341
|
children: /* @__PURE__ */ s("div", {
|
|
342
342
|
className: "absolute top-1/2 left-1/2 flex h-auto w-[380px] -translate-x-1/2 -translate-y-1/2 flex-col gap-3 rounded-3xl bg-white p-6",
|
|
@@ -349,7 +349,9 @@ function _({ label: e = "Connect Wallet" }) {
|
|
|
349
349
|
type: "button",
|
|
350
350
|
"aria-label": "Close",
|
|
351
351
|
className: "cursor-pointer rounded-full p-1 hover:bg-gray-100",
|
|
352
|
-
onClick:
|
|
352
|
+
onClick: () => {
|
|
353
|
+
C(!1), A();
|
|
354
|
+
},
|
|
353
355
|
children: /* @__PURE__ */ s("svg", {
|
|
354
356
|
xmlns: "http://www.w3.org/2000/svg",
|
|
355
357
|
viewBox: "0 0 24 24",
|
|
@@ -360,11 +362,31 @@ function _({ label: e = "Connect Wallet" }) {
|
|
|
360
362
|
children: [/* @__PURE__ */ o("path", { d: "M18 6 6 18" }), /* @__PURE__ */ o("path", { d: "m6 6 12 12" })]
|
|
361
363
|
})
|
|
362
364
|
})]
|
|
363
|
-
}), /* @__PURE__ */
|
|
365
|
+
}), /* @__PURE__ */ s("div", {
|
|
364
366
|
className: "relative w-full space-y-4",
|
|
365
|
-
children:
|
|
367
|
+
children: [S && u && /* @__PURE__ */ s("div", {
|
|
368
|
+
className: "absolute inset-0 mb-0 flex flex-col items-center justify-center rounded-xl bg-[rgba(255,255,255,0.9)] text-black",
|
|
369
|
+
children: [
|
|
370
|
+
/* @__PURE__ */ s("div", { children: [
|
|
371
|
+
"正在连接",
|
|
372
|
+
u.name,
|
|
373
|
+
"..."
|
|
374
|
+
] }),
|
|
375
|
+
/* @__PURE__ */ o("div", {
|
|
376
|
+
className: "my-1.5 text-xs",
|
|
377
|
+
children: "请在扩展中确认连接"
|
|
378
|
+
}),
|
|
379
|
+
/* @__PURE__ */ o("img", {
|
|
380
|
+
src: "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1783646544006'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='78324'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='32'%20height='32'%3e%3cpath%20d='M512%20907c-24.852%200-45-20.148-45-45s20.148-45%2045-45c168.446%200%20305-136.554%20305-305S680.446%20207%20512%20207%20207%20343.554%20207%20512c0%2024.852-20.148%2045-45%2045S117%20536.852%20117%20512c0-218.152%20176.848-395%20395-395S907%20293.848%20907%20512%20730.152%20907%20512%20907z'%20fill='%23444444'%20p-id='78325'%3e%3c/path%3e%3c/svg%3e",
|
|
381
|
+
alt: "spin",
|
|
382
|
+
className: "h-8 w-8 animate-[spin_2s_linear_infinite]"
|
|
383
|
+
})
|
|
384
|
+
]
|
|
385
|
+
}), d.map((e) => /* @__PURE__ */ s("button", {
|
|
366
386
|
type: "button",
|
|
367
|
-
onClick: () =>
|
|
387
|
+
onClick: () => {
|
|
388
|
+
C(!0), v(e);
|
|
389
|
+
},
|
|
368
390
|
className: "flex w-full cursor-pointer items-center gap-2 rounded-xl border border-gray-300 px-4 py-2 hover:bg-gray-100",
|
|
369
391
|
children: [/* @__PURE__ */ o("img", {
|
|
370
392
|
src: e.icon,
|
|
@@ -381,7 +403,7 @@ function _({ label: e = "Connect Wallet" }) {
|
|
|
381
403
|
]
|
|
382
404
|
})]
|
|
383
405
|
})]
|
|
384
|
-
}, e.id))
|
|
406
|
+
}, e.id))]
|
|
385
407
|
})]
|
|
386
408
|
})
|
|
387
409
|
})] });
|