miniwallet 0.1.10 → 0.1.12

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.
@@ -1,3 +1,3 @@
1
1
  /*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */
2
- @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-x-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--color-blue-500:oklch(62.3% .214 259.815);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-bold:700;--radius-sm:.25rem;--radius-md:.375rem;--radius-xl:.75rem}}@layer base,components;@layer utilities{.absolute{position:absolute}.fixed{position:fixed}.top-0{top:0}.top-1\/2{top:50%}.right-0{right:0}.bottom-0{bottom:0}.left-0{left:0}.left-1\/2{left:50%}.mr-1{margin-right:var(--spacing)}.mr-4{margin-right:calc(var(--spacing) * 4)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.flex{display:flex}.inline-flex{display:inline-flex}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-\[22px\]{height:22px}.h-auto{height:auto}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-8{width:calc(var(--spacing) * 8)}.w-\[460px\]{width:460px}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-2{gap:calc(var(--spacing) * 2)}:where(.space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 2) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-x-reverse)))}.rounded-full{border-radius:3.40282e38px}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-none{--tw-border-style:none;border-style:none}.border-gray-300{border-color:var(--color-gray-300)}.bg-\[rgba\(0\,0\,0\,0\.5\)\]{background-color:#00000080}.bg-blue-500{background-color:var(--color-blue-500)}.bg-white{background-color:var(--color-white)}.p-1{padding:var(--spacing)}.p-6{padding:calc(var(--spacing) * 6)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.text-center{text-align:center}.text-left{text-align:left}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-white{color:var(--color-white)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.inset-ring-1{--tw-inset-ring-shadow:inset 0 0 0 1px var(--tw-inset-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-blue-500\/50{--tw-shadow-color:#3080ff80}@supports (color:color-mix(in lab, red, red)){.shadow-blue-500\/50{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-blue-500) 50%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-gray-200{--tw-shadow-color:oklch(92.8% .006 264.531)}@supports (color:color-mix(in lab, red, red)){.shadow-gray-200{--tw-shadow-color:color-mix(in oklab, var(--color-gray-200) var(--tw-shadow-alpha), transparent)}}.inset-ring-gray-100{--tw-inset-ring-color:var(--color-gray-100)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.outline-none{--tw-outline-style:none;outline-style:none}@media (hover:hover){.hover\:bg-gray-100:hover{background-color:var(--color-gray-100)}}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}
2
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-blue-500:oklch(62.3% .214 259.815);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-black:#000;--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-bold:700;--radius-sm:.25rem;--radius-xl:.75rem;--radius-2xl:1rem;--radius-3xl:1.5rem}}@layer base,components;@layer utilities{.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:0}.top-0{top:0}.top-1\/2{top:50%}.right-0{right:0}.bottom-0{bottom:0}.left-0{left:0}.left-1\/2{left:50%}.my-1\.5{margin-block:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mr-1{margin-right:var(--spacing)}.mr-4{margin-right:calc(var(--spacing) * 4)}.mr-\[-20px\]{margin-right:-20px}.mb-0{margin-bottom:0}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-\[-12px\]{margin-bottom:-12px}.ml-1{margin-left:var(--spacing)}.flex{display:flex}.inline-flex{display:inline-flex}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-16{height:calc(var(--spacing) * 16)}.h-\[22px\]{height:22px}.h-auto{height:auto}.w-6{width:calc(var(--spacing) * 6)}.w-8{width:calc(var(--spacing) * 8)}.w-16{width:calc(var(--spacing) * 16)}.w-\[112px\]{width:112px}.w-\[380px\]{width:380px}.w-full{width:100%}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-\[spin_2s_linear_infinite\]{animation:2s linear infinite spin}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 2) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-10>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 10) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 10) * calc(1 - var(--tw-space-x-reverse)))}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-3xl{border-radius:var(--radius-3xl)}.rounded-full{border-radius:3.40282e38px}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-l-2xl{border-top-left-radius:var(--radius-2xl);border-bottom-left-radius:var(--radius-2xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-none{--tw-border-style:none;border-style:none}.border-gray-300{border-color:var(--color-gray-300)}.bg-\[rgba\(0\,0\,0\,0\.5\)\]{background-color:#00000080}.bg-\[rgba\(255\,255\,255\,0\.9\)\]{background-color:#ffffffe6}.bg-blue-500{background-color:var(--color-blue-500)}.bg-gray-700{background-color:var(--color-gray-700)}.bg-red-400{background-color:var(--color-red-400)}.bg-white{background-color:var(--color-white)}.p-1{padding:var(--spacing)}.p-6{padding:calc(var(--spacing) * 6)}.p-10{padding:calc(var(--spacing) * 10)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.pt-5{padding-top:calc(var(--spacing) * 5)}.pt-36{padding-top:calc(var(--spacing) * 36)}.pr-1{padding-right:var(--spacing)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pl-3{padding-left:calc(var(--spacing) * 3)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.text-black{color:var(--color-black)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-white{color:var(--color-white)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.inset-ring-1{--tw-inset-ring-shadow:inset 0 0 0 1px var(--tw-inset-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-blue-500\/50{--tw-shadow-color:#3080ff80}@supports (color:color-mix(in lab, red, red)){.shadow-blue-500\/50{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-blue-500) 50%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-gray-200{--tw-shadow-color:oklch(92.8% .006 264.531)}@supports (color:color-mix(in lab, red, red)){.shadow-gray-200{--tw-shadow-color:color-mix(in oklab, var(--color-gray-200) var(--tw-shadow-alpha), transparent)}}.shadow-gray-500\/50{--tw-shadow-color:#6a728280}@supports (color:color-mix(in lab, red, red)){.shadow-gray-500\/50{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-gray-500) 50%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-red-500\/50{--tw-shadow-color:#fb2c3680}@supports (color:color-mix(in lab, red, red)){.shadow-red-500\/50{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-red-500) 50%, transparent) var(--tw-shadow-alpha), transparent)}}.inset-ring-gray-100{--tw-inset-ring-color:var(--color-gray-100)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.outline-none{--tw-outline-style:none;outline-style:none}@media (hover:hover){.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:bg-gray-100:hover{background-color:var(--color-gray-100)}}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}
3
3
  /*$vite$:1*/
@@ -31,6 +31,7 @@ export declare type WalletSate = {
31
31
  account: string;
32
32
  balance: string;
33
33
  isConnected: boolean;
34
+ connectingWallet: WalletProvider | null;
34
35
  selectedChain: ChainConfig | null;
35
36
  wallet: WalletProvider | undefined;
36
37
  chains: ChainConfig[];
@@ -1,26 +1,26 @@
1
1
  import "./miniwallet.css";
2
- import { createContext as e, useCallback as t, useContext as n, useEffect as r, useMemo as i, useState as a } from "react";
3
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
2
+ import { createContext as e, useCallback as t, useContext as n, useEffect as r, useMemo as i, useRef as a, useState as o } from "react";
3
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
4
4
  //#region src/MiniWalletContext.tsx
5
- var c = e(null);
5
+ var l = e(null);
6
6
  //#endregion
7
7
  //#region src/utils/formatUnits.ts
8
- function l(e) {
8
+ function u(e) {
9
9
  if (typeof e == "bigint") return e;
10
10
  let t = e.trim();
11
11
  if (!t) throw Error("value must not be empty");
12
12
  return BigInt(t);
13
13
  }
14
- function u(e, t) {
14
+ function d(e, t) {
15
15
  if (!Number.isInteger(t) || t < 0) throw Error("decimals must be a non-negative integer");
16
- let n = l(e);
16
+ let n = u(e);
17
17
  if (t === 0) return n.toString();
18
18
  let r = 10n ** BigInt(t), i = n / r, a = n % r;
19
19
  return a === 0n ? i.toString() : `${i}.${a.toString().padStart(t, "0").replace(/0+$/, "")}`;
20
20
  }
21
21
  //#endregion
22
22
  //#region src/constants.ts
23
- var d = [
23
+ var f = [
24
24
  {
25
25
  id: "metamask",
26
26
  name: "MetaMask",
@@ -41,13 +41,13 @@ var d = [
41
41
  name: "Coinbase",
42
42
  icon: "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='1783439807758'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='13209'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='32'%20height='32'%3e%3cpath%20d='M1024%20186.181818a186.181818%20186.181818%200%200%200-186.181818-186.181818H186.181818a186.181818%20186.181818%200%200%200-186.181818%20186.181818v651.636364a186.181818%20186.181818%200%200%200%20186.181818%20186.181818h651.636364a186.181818%20186.181818%200%200%200%20186.181818-186.181818V186.181818z'%20fill='%232C5FF6'%20p-id='13210'%3e%3c/path%3e%3cpath%20d='M512%20870.4a358.4%20358.4%200%201%200%200-716.8%20358.4%20358.4%200%200%200%200%20716.8zM422.4%20394.984727h179.2a27.461818%2027.461818%200%200%201%2027.461818%2027.415273v179.2a27.461818%2027.461818%200%200%201-27.461818%2027.461818h-179.2a27.461818%2027.461818%200%200%201-27.461818-27.461818v-179.2a27.461818%2027.461818%200%200%201%2027.461818-27.461818z'%20fill='%23FFFFFF'%20p-id='13211'%3e%3c/path%3e%3c/svg%3e"
43
43
  }
44
- ], f = {
44
+ ], p = {
45
45
  "io.metamask": "metamask",
46
46
  "com.okex.wallet": "okx",
47
47
  "com.okx.wallet": "okx",
48
48
  "app.phantom": "phantom",
49
49
  "com.coinbase.wallet": "coinbase"
50
- }, p = [
50
+ }, m = [
51
51
  {
52
52
  id: 1,
53
53
  name: "Ethereum",
@@ -69,113 +69,125 @@ var d = [
69
69
  ];
70
70
  //#endregion
71
71
  //#region src/MiniWalletProvider.tsx
72
- function m({ children: e, chains: n = [] }) {
73
- let [s, l] = a(""), [m, h] = a(""), [g, _] = a(0), [v, y] = a(""), [b, x] = a({}), S = i(() => n.length > 0 ? n : p, [n]), C = i(() => b[m] ?? null, [b, m]), w = i(() => d.find((e) => e.id === m), [m]), T = i(() => !!s, [s]), E = i(() => S.find((e) => e.id === g) || null, [S, g]), D = i(() => !E || !v || !E?.decimals ? "0" : Number(u(v, E.decimals)).toFixed(3), [v, E]), O = t(async ({ id: e }) => {
74
- let t = b[e];
75
- if (!t) {
72
+ function h({ children: e, chains: n = [] }) {
73
+ let [c, u] = o(""), [h, g] = o(""), [_, v] = o(0), [y, b] = o(""), [x] = o(null), S = a({}), [C, w] = o(0), T = i(() => n.length > 0 ? n : m, [n]), E = i(() => S.current[h] ?? null, [C, h]), D = i(() => f.find((e) => e.id === h), [h]), O = i(() => !!c, [c]), k = i(() => T.find((e) => e.id === _) || null, [T, _]), A = i(() => !k || !y || !k?.decimals ? "0" : Number(d(y, k.decimals)).toFixed(3), [y, k]), j = t(async (e) => {
74
+ let { id: t } = e;
75
+ console.log("eip6963Providers: ", S.current);
76
+ let n = S.current[t];
77
+ if (!n || typeof n.request != "function") {
76
78
  alert("请安装钱包");
77
79
  return;
78
80
  }
79
81
  try {
80
- console.log("provider: ", t);
81
- let n = await t.request({ method: "eth_requestAccounts" });
82
- console.log("accounts: ", n), console.log("provider.chainId: ", t.chainId);
83
- let r = parseInt(t.chainId, 16);
84
- l(n[0]), h(e), _(r), localStorage.setItem("miniwallet:lastWalletId", e);
82
+ console.log("provider: ", n);
83
+ let e = await n.request({ method: "eth_requestAccounts" });
84
+ console.log("accounts: ", e), console.log("provider.chainId: ", n.chainId);
85
+ let r = parseInt(String(n.chainId ?? "0x0"), 16);
86
+ u(e[0]), g(t), v(r), localStorage.setItem("miniwallet:lastWalletId", t);
85
87
  } catch (e) {
86
- console.error("连接失败:", e), alert("连接失败");
88
+ console.log("error: ", e);
89
+ let t = e, n = t?.code ?? "", r = t?.message ?? "";
90
+ if (n === -32002) {
91
+ alert("连接已发起,请在扩展中确认连接");
92
+ return;
93
+ }
94
+ alert(`Connect failed${n && `\n${n}`}${r && `\n${r}`}`);
87
95
  }
88
- }, [b]), k = t(async () => {
96
+ }, []), M = t(async () => {
89
97
  try {
90
- if (!C) {
98
+ if (!E || !h) {
91
99
  alert("请安装钱包");
92
100
  return;
93
101
  }
94
- await C.request({
102
+ h !== "okx" && await E.request({
95
103
  method: "wallet_revokePermissions",
96
104
  params: [{ eth_accounts: {} }]
97
105
  });
98
106
  } catch (e) {
99
- console.error(e);
107
+ console.error("disconnect error: ", e);
100
108
  } finally {
101
- l(""), h(""), _(0), localStorage.removeItem("miniwallet:lastWalletId");
109
+ u(""), g(""), v(0), localStorage.removeItem("miniwallet:lastWalletId");
102
110
  }
103
- }, [C]), A = t(async (e) => {
104
- if (!C) {
111
+ }, [E, h]), N = t(async (e) => {
112
+ if (!E) {
105
113
  alert("钱包不存在");
106
114
  return;
107
115
  }
108
116
  try {
109
- await C.request({
117
+ await E.request({
110
118
  method: "wallet_switchEthereumChain",
111
119
  params: [{ chainId: `0x${e.id.toString(16)}` }]
112
- }), _(e.id);
120
+ }), v(e.id);
113
121
  } catch (e) {
114
- console.error("切换失败:", e), alert("切换失败");
122
+ console.log("switchError: ", e);
123
+ let t = e, n = t?.code ?? "", r = t?.message ?? "";
124
+ alert(`Switch failed${n && `\n${n}`}${r && `\n${r}`}`);
115
125
  }
116
- }, [C]), j = t(async () => {
126
+ }, [E]), P = t(async () => {
117
127
  try {
118
- if (!s || !C) return;
119
- let e = await C.request({
128
+ if (!c || !E) return;
129
+ let e = await E.request({
120
130
  method: "eth_getBalance",
121
- params: [s, "latest"]
131
+ params: [c, "latest"]
122
132
  });
123
- y(BigInt(e).toString());
133
+ b(BigInt(e).toString());
124
134
  } catch (e) {
125
- console.error(e);
135
+ console.error("getBalance error: ", e);
126
136
  }
127
- }, [s, C]), M = i(() => ({
128
- account: s,
129
- balance: D,
130
- isConnected: T,
131
- selectedChain: E,
132
- wallet: w,
133
- chains: S,
134
- connect: O,
135
- switchChain: A,
136
- disconnect: k
137
+ }, [c, E]), F = i(() => ({
138
+ account: c,
139
+ balance: A,
140
+ isConnected: O,
141
+ connectingWallet: x,
142
+ selectedChain: k,
143
+ wallet: D,
144
+ chains: T,
145
+ connect: j,
146
+ switchChain: N,
147
+ disconnect: M
137
148
  }), [
138
- s,
149
+ c,
150
+ A,
151
+ O,
152
+ x,
153
+ k,
139
154
  D,
140
155
  T,
141
- E,
142
- w,
143
- S,
144
- O,
145
- A,
146
- k
156
+ j,
157
+ N,
158
+ M
147
159
  ]);
148
160
  return r(() => {
149
161
  let e = ((e) => {
150
- let { info: t, provider: n } = e.detail ?? {}, r = f[t?.rdns];
151
- !r || !n?.request || x((e) => e[r] === n ? e : {
152
- ...e,
162
+ let { info: t, provider: n } = e.detail ?? {}, r = p[t?.rdns];
163
+ !r || typeof n?.request != "function" || S.current[r] !== n && (S.current = {
164
+ ...S.current,
153
165
  [r]: n
154
- });
166
+ }, w((e) => e + 1));
155
167
  });
156
168
  return window.addEventListener("eip6963:announceProvider", e), window.dispatchEvent(new Event("eip6963:requestProvider")), () => {
157
- window.removeEventListener("eip6963:announceProvider", e), x({});
169
+ window.removeEventListener("eip6963:announceProvider", e);
158
170
  };
159
171
  }, []), r(() => {
160
- g && j();
161
- }, [j, g]), r(() => {
162
- if (!T || !C?.on) return;
172
+ _ && P();
173
+ }, [P, _]), r(() => {
174
+ if (!O || !E?.on) return;
163
175
  let e = (e) => {
164
- console.log("ChainChanged chainId: ", e), _(parseInt(e, 16));
176
+ console.log("ChainChanged chainId: ", e), v(parseInt(e, 16));
165
177
  }, t = (e) => {
166
- console.log("AccountsChanged accounts: ", e), l(e[0]);
178
+ console.log("AccountsChanged accounts: ", e), u(e[0] ?? "");
167
179
  };
168
- return console.log("Listen chainChanged and accountsChanged"), C.on("chainChanged", e), C.on("accountsChanged", t), () => {
169
- console.log("RemoveListener chainChanged and accountsChanged"), C.removeListener("chainChanged", e), C.removeListener("accountsChanged", t);
180
+ return console.log("Listen chainChanged and accountsChanged"), E.on("chainChanged", e), E.on("accountsChanged", t), () => {
181
+ console.log("RemoveListener chainChanged and accountsChanged"), E.removeListener?.("chainChanged", e), E.removeListener?.("accountsChanged", t);
170
182
  };
171
- }, [T, C]), r(() => {
172
- if (!s) return;
173
- let e = setInterval(j, 1e4);
183
+ }, [E, O]), r(() => {
184
+ if (!c) return;
185
+ let e = setInterval(P, 1e4);
174
186
  return () => clearInterval(e);
175
- }, [s, j]), r(() => {
187
+ }, [c, P]), r(() => {
176
188
  let e = localStorage.getItem("miniwallet:lastWalletId");
177
189
  if (!e) return;
178
- let t = b[e];
190
+ let t = S.current[e];
179
191
  if (!t) return;
180
192
  let n = !1;
181
193
  return (async () => {
@@ -185,134 +197,194 @@ function m({ children: e, chains: n = [] }) {
185
197
  localStorage.removeItem("miniwallet:lastWalletId");
186
198
  return;
187
199
  }
188
- l(r[0]), h(e), _(parseInt(t.chainId, 16));
200
+ u(r[0]), g(e), v(parseInt(String(t.chainId ?? "0x0"), 16));
189
201
  }
190
202
  })(), () => {
191
203
  n = !0;
192
204
  };
193
- }, [b]), /* @__PURE__ */ o(c.Provider, {
194
- value: M,
205
+ }, [C]), /* @__PURE__ */ s(l.Provider, {
206
+ value: F,
195
207
  children: e
196
208
  });
197
209
  }
198
210
  //#endregion
199
211
  //#region src/useMiniWallet.ts
200
- function h() {
201
- let e = n(c);
212
+ function g() {
213
+ let e = n(l);
202
214
  if (!e) throw Error("useMiniWallet 必须在 MiniWalletProvider 内使用");
203
215
  return e;
204
216
  }
205
217
  //#endregion
206
218
  //#region src/icons/disconnect.svg
207
- var g = "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='1783575961451'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='5071'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='32'%20height='32'%3e%3cpath%20d='M512.922%2063.583c248.335%200%20449.712%20201.384%20449.712%20449.71%200%20248.333-201.377%20449.702-449.712%20449.702-248.333%200-449.71-201.369-449.71-449.702%200-248.326%20201.377-449.71%20449.71-449.71z%20m148.683%20213.634l-35.351%2061.247a206.8%20206.8%200%200%201%2034.37%2027.739c37.359%2037.351%2060.475%2088.96%2060.475%20145.955%200%2057.004-23.117%20108.607-60.475%20145.965-37.344%2037.352-88.945%2060.469-145.949%2060.469-56.987%200-108.606-23.117-145.965-60.469-37.359-37.359-60.461-88.962-60.461-145.965%200-56.995%2023.117-108.605%2060.461-145.955a209.04%20209.04%200%200%201%2027.762-23.286l-35.43-61.359a278.69%20278.69%200%200%200-42.279%2034.69c-50.156%2050.148-81.18%20119.417-81.18%20195.91%200%2076.504%2031.041%20145.773%2081.18%20195.929%2050.139%2050.139%20119.408%2081.166%20195.912%2081.166%2076.502%200%20145.771-31.026%20195.91-81.166%2050.156-50.156%2081.182-119.425%2081.182-195.929%200-76.494-31.026-145.763-81.182-195.91a277.704%20277.704%200%200%200-48.98-39.031zM473.618%20128.865v337.849h75.458V128.865h-75.458z'%20fill='%23e6523f'%20p-id='5072'%3e%3c/path%3e%3c/svg%3e";
219
+ var _ = "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='1783575961451'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='5071'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='32'%20height='32'%3e%3cpath%20d='M512.922%2063.583c248.335%200%20449.712%20201.384%20449.712%20449.71%200%20248.333-201.377%20449.702-449.712%20449.702-248.333%200-449.71-201.369-449.71-449.702%200-248.326%20201.377-449.71%20449.71-449.71z%20m148.683%20213.634l-35.351%2061.247a206.8%20206.8%200%200%201%2034.37%2027.739c37.359%2037.351%2060.475%2088.96%2060.475%20145.955%200%2057.004-23.117%20108.607-60.475%20145.965-37.344%2037.352-88.945%2060.469-145.949%2060.469-56.987%200-108.606-23.117-145.965-60.469-37.359-37.359-60.461-88.962-60.461-145.965%200-56.995%2023.117-108.605%2060.461-145.955a209.04%20209.04%200%200%201%2027.762-23.286l-35.43-61.359a278.69%20278.69%200%200%200-42.279%2034.69c-50.156%2050.148-81.18%20119.417-81.18%20195.91%200%2076.504%2031.041%20145.773%2081.18%20195.929%2050.139%2050.139%20119.408%2081.166%20195.912%2081.166%2076.502%200%20145.771-31.026%20195.91-81.166%2050.156-50.156%2081.182-119.425%2081.182-195.929%200-76.494-31.026-145.763-81.182-195.91a277.704%20277.704%200%200%200-48.98-39.031zM473.618%20128.865v337.849h75.458V128.865h-75.458z'%20fill='%23e6523f'%20p-id='5072'%3e%3c/path%3e%3c/svg%3e";
208
220
  //#endregion
209
221
  //#region src/MiniWalletButton.tsx
210
- function _({ label: e = "Connect Wallet" }) {
211
- let { account: n, balance: r, isConnected: i, selectedChain: c, wallet: l, switchChain: u, chains: f, connect: p, disconnect: m } = h(), [_, v] = a(!1), y = t(() => {
212
- v(!0);
213
- }, []), b = t(() => {
214
- v(!1);
215
- }, []);
216
- return i ? /* @__PURE__ */ s("section", {
222
+ function v({ label: e = "Connect Wallet" }) {
223
+ let { account: n, balance: a, isConnected: l, selectedChain: u, wallet: d, switchChain: p, chains: m, connect: h, disconnect: v } = g(), [y, b] = o(!1), [x, S] = o(!1), [C, w] = o("复制地址"), T = i(() => n ? `${n.slice(0, 6)}...${n.slice(-4)}` : "", [n]), E = t(() => {
224
+ b(!0);
225
+ }, []), D = t(() => {
226
+ b(!1);
227
+ }, []), O = t(async () => {
228
+ try {
229
+ await navigator.clipboard.writeText(n), w("已复制!"), setTimeout(() => {
230
+ w("复制地址");
231
+ }, 1e3);
232
+ } catch (e) {
233
+ console.error("copy", e);
234
+ }
235
+ }, [n]);
236
+ return r(() => {
237
+ l && b(!1);
238
+ }, [l]), l ? /* @__PURE__ */ c("section", {
217
239
  className: "inline-flex items-center justify-center text-center",
218
- children: [/* @__PURE__ */ o("select", {
219
- value: c?.id,
220
- onChange: (e) => u(f.find((t) => t.id === Number(e.target.value))),
221
- className: "bg-transparent1 mr-4 cursor-pointer rounded-sm border-none p-1 text-gray-600 outline-none hover:bg-gray-100",
222
- children: f.map((e) => /* @__PURE__ */ o("option", {
223
- value: e.id,
224
- children: e.name
225
- }, e.id))
226
- }), /* @__PURE__ */ s("div", {
227
- className: "flex items-center justify-center space-x-2 rounded-md bg-white px-2 py-2.5 shadow-lg inset-ring-1 shadow-gray-200 inset-ring-gray-100",
228
- children: [
229
- l && /* @__PURE__ */ o("img", {
230
- src: l.icon,
231
- alt: l.name,
232
- className: "h-6 w-6"
233
- }),
234
- /* @__PURE__ */ s("div", {
235
- className: "mr-1",
240
+ children: [
241
+ /* @__PURE__ */ s("select", {
242
+ value: u?.id,
243
+ onChange: (e) => p(m.find((t) => t.id === Number(e.target.value))),
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: m.map((e) => /* @__PURE__ */ s("option", {
246
+ value: e.id,
247
+ children: e.name
248
+ }, e.id))
249
+ }),
250
+ /* @__PURE__ */ c("div", {
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
+ children: [/* @__PURE__ */ c("div", {
253
+ onClick: () => {
254
+ S(!0);
255
+ },
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",
236
257
  children: [
237
- n.slice(0, 6),
238
- "...",
239
- n.slice(-4)
258
+ d && /* @__PURE__ */ s("img", {
259
+ src: d.icon,
260
+ alt: d.name,
261
+ className: "h-6 w-6"
262
+ }),
263
+ /* @__PURE__ */ s("div", {
264
+ className: "mr-1",
265
+ children: T
266
+ }),
267
+ /* @__PURE__ */ c("span", {
268
+ className: "text-sm text-gray-400",
269
+ children: [
270
+ "(",
271
+ a,
272
+ " ",
273
+ u?.symbol ?? "",
274
+ ")"
275
+ ]
276
+ })
240
277
  ]
241
- }),
242
- /* @__PURE__ */ s("span", {
243
- className: "text-sm text-gray-400",
244
- children: [
245
- "(",
246
- r,
247
- " ",
248
- c?.symbol ?? "",
249
- ")"
250
- ]
251
- }),
252
- /* @__PURE__ */ o("button", {
253
- className: "h-6 w-6 cursor-pointer rounded-full",
254
- onClick: m,
255
- children: /* @__PURE__ */ o("img", {
256
- src: g,
278
+ }), /* @__PURE__ */ s("button", {
279
+ className: "ml-1 h-6 w-6 cursor-pointer rounded-full",
280
+ onClick: v,
281
+ children: /* @__PURE__ */ s("img", {
282
+ src: _,
257
283
  alt: "disconnect",
258
284
  className: "h-[22px] w-6"
259
285
  })
286
+ })]
287
+ }),
288
+ x && /* @__PURE__ */ s("div", {
289
+ className: "z-index-10 fixed top-0 right-0 bottom-0 left-0 bg-[rgba(0,0,0,0.5)]",
290
+ children: /* @__PURE__ */ c("div", {
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",
292
+ children: [
293
+ /* @__PURE__ */ s("div", {
294
+ className: "mb-[-12px] w-full text-right",
295
+ children: /* @__PURE__ */ s("button", {
296
+ className: "mr-[-20px] cursor-pointer rounded-full p-1 hover:bg-gray-100",
297
+ onClick: () => {
298
+ S(!1);
299
+ },
300
+ children: /* @__PURE__ */ c("svg", {
301
+ xmlns: "http://www.w3.org/2000/svg",
302
+ viewBox: "0 0 24 24",
303
+ fill: "none",
304
+ stroke: "currentColor",
305
+ strokeWidth: "2",
306
+ className: "h-8 w-8",
307
+ children: [/* @__PURE__ */ s("path", { d: "M18 6 6 18" }), /* @__PURE__ */ s("path", { d: "m6 6 12 12" })]
308
+ })
309
+ })
310
+ }),
311
+ d && /* @__PURE__ */ s("img", {
312
+ src: d.icon,
313
+ alt: d.name,
314
+ className: "h-16 w-16"
315
+ }),
316
+ /* @__PURE__ */ s("p", { children: T }),
317
+ /* @__PURE__ */ c("div", {
318
+ className: "mt-2 w-full space-x-10",
319
+ children: [/* @__PURE__ */ s("button", {
320
+ onClick: O,
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: C
323
+ }), /* @__PURE__ */ s("button", {
324
+ type: "button",
325
+ onClick: v,
326
+ className: "w-[112px] cursor-pointer rounded-xl bg-red-400 py-2 text-white shadow-md shadow-red-500/50 outline-none",
327
+ children: "断开连接"
328
+ })]
329
+ })
330
+ ]
260
331
  })
261
- ]
262
- })]
263
- }) : /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("button", {
332
+ })
333
+ ]
334
+ }) : /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("button", {
264
335
  type: "button",
265
- onClick: y,
336
+ onClick: E,
266
337
  className: "cursor-pointer rounded-xl bg-blue-500 px-4 py-2 text-white shadow-lg shadow-blue-500/50",
267
338
  children: e
268
- }), _ && /* @__PURE__ */ o("div", {
339
+ }), y && /* @__PURE__ */ s("div", {
269
340
  className: "z-index-10 fixed top-0 right-0 bottom-0 left-0 bg-[rgba(0,0,0,0.5)]",
270
- children: /* @__PURE__ */ s("div", {
271
- className: "absolute top-1/2 left-1/2 flex h-auto w-[460px] -translate-x-1/2 -translate-y-1/2 flex-col gap-2 rounded-md bg-white p-6",
272
- children: [/* @__PURE__ */ s("div", {
341
+ children: /* @__PURE__ */ c("div", {
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",
343
+ children: [/* @__PURE__ */ c("div", {
273
344
  className: "mb-2 flex items-center justify-between",
274
- children: [/* @__PURE__ */ o("span", {
345
+ children: [/* @__PURE__ */ s("span", {
275
346
  className: "text-2xl font-bold",
276
347
  children: "Connect Wallet"
277
- }), /* @__PURE__ */ o("button", {
348
+ }), /* @__PURE__ */ s("button", {
278
349
  type: "button",
279
350
  "aria-label": "Close",
280
351
  className: "cursor-pointer rounded-full p-1 hover:bg-gray-100",
281
- onClick: b,
282
- children: /* @__PURE__ */ s("svg", {
352
+ onClick: D,
353
+ children: /* @__PURE__ */ c("svg", {
283
354
  xmlns: "http://www.w3.org/2000/svg",
284
355
  viewBox: "0 0 24 24",
285
356
  fill: "none",
286
357
  stroke: "currentColor",
287
358
  strokeWidth: "2",
288
- className: "h-5 w-5",
289
- children: [/* @__PURE__ */ o("path", { d: "M18 6 6 18" }), /* @__PURE__ */ o("path", { d: "m6 6 12 12" })]
359
+ className: "h-8 w-8",
360
+ children: [/* @__PURE__ */ s("path", { d: "M18 6 6 18" }), /* @__PURE__ */ s("path", { d: "m6 6 12 12" })]
290
361
  })
291
362
  })]
292
- }), d.map((e) => /* @__PURE__ */ s("button", {
293
- type: "button",
294
- onClick: () => {
295
- v(!1), p(e);
296
- },
297
- className: "flex cursor-pointer items-center gap-2 rounded-md border border-gray-300 px-4 py-2",
298
- children: [/* @__PURE__ */ o("img", {
299
- src: e.icon,
300
- alt: e.name,
301
- className: "h-8 w-8"
302
- }), /* @__PURE__ */ s("div", {
303
- className: "flex flex-col justify-between text-left",
304
- children: [/* @__PURE__ */ o("p", { children: e.name }), /* @__PURE__ */ s("span", {
305
- className: "text-xs text-gray-500",
306
- children: [
307
- "Connect your ",
308
- e.name,
309
- " wallet"
310
- ]
363
+ }), /* @__PURE__ */ s("div", {
364
+ className: "relative w-full space-y-4",
365
+ children: f.map((e) => /* @__PURE__ */ c("button", {
366
+ type: "button",
367
+ onClick: () => h(e),
368
+ 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
+ children: [/* @__PURE__ */ s("img", {
370
+ src: e.icon,
371
+ alt: e.name,
372
+ className: "h-8 w-8"
373
+ }), /* @__PURE__ */ c("div", {
374
+ className: "flex flex-col justify-between text-left",
375
+ children: [/* @__PURE__ */ s("p", { children: e.name }), /* @__PURE__ */ c("span", {
376
+ className: "text-xs text-gray-500",
377
+ children: [
378
+ "Connect your ",
379
+ e.name,
380
+ " wallet"
381
+ ]
382
+ })]
311
383
  })]
312
- })]
313
- }, e.id))]
384
+ }, e.id))
385
+ })]
314
386
  })
315
387
  })] });
316
388
  }
317
389
  //#endregion
318
- export { _ as MiniWalletButton, m as MiniWalletProvider, h as useMiniWallet };
390
+ export { v as MiniWalletButton, h as MiniWalletProvider, g as useMiniWallet };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miniwallet",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "React wallet connect button with multi-wallet support via EIP-6963",
5
5
  "type": "module",
6
6
  "main": "./dist/miniwallet.js",
@@ -22,8 +22,10 @@
22
22
  "scripts": {
23
23
  "dev": "vite",
24
24
  "build": "tsc -b && vite build",
25
+ "build:demo": "tsc -b && vite build --mode demo",
25
26
  "lint": "eslint .",
26
27
  "preview": "vite preview",
28
+ "preview:demo": "vite preview --outDir dist-demo",
27
29
  "prepublishOnly": "pnpm build"
28
30
  },
29
31
  "peerDependencies": {