miniwallet 0.1.1 → 0.1.3

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[];
@@ -70,28 +70,38 @@ var d = [
70
70
  //#endregion
71
71
  //#region src/MiniWalletProvider.tsx
72
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) {
76
- alert("请安装钱包");
77
- return;
78
- }
73
+ let [s, l] = a(""), [m, h] = a(""), [g, _] = a(0), [v, y] = a(""), [b, x] = a(null), [S, C] = a({}), w = i(() => n.length > 0 ? n : p, [n]), T = i(() => S[m] ?? null, [S, m]), E = i(() => d.find((e) => e.id === m), [m]), D = i(() => !!s, [s]), O = i(() => w.find((e) => e.id === g) || null, [w, g]), k = i(() => !O || !v || !O?.decimals ? "0" : Number(u(v, O.decimals)).toFixed(3), [v, O]), A = t(async (e) => {
74
+ let { id: t } = e;
79
75
  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);
76
+ console.log("eip6963Providers: ", S);
77
+ let n = S[t];
78
+ if (!n) {
79
+ alert("请安装钱包");
80
+ return;
81
+ }
82
+ h(t), x(e), console.log("provider: ", n);
83
+ let r = await n.request({ method: "eth_requestAccounts" });
84
+ console.log("accounts: ", r), console.log("provider.chainId: ", n.chainId);
85
+ let i = parseInt(n.chainId, 16);
86
+ l(r[0]), _(i), localStorage.setItem("miniwallet:lastWalletId", t), x(null);
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}`}`);
95
+ } finally {
96
+ x(null);
87
97
  }
88
- }, [b]), k = t(async () => {
98
+ }, [S]), j = t(async () => {
89
99
  try {
90
- if (!C) {
100
+ if (!T) {
91
101
  alert("请安装钱包");
92
102
  return;
93
103
  }
94
- await C.request({
104
+ await T.request({
95
105
  method: "wallet_revokePermissions",
96
106
  params: [{ eth_accounts: {} }]
97
107
  });
@@ -100,23 +110,25 @@ function m({ children: e, chains: n = [] }) {
100
110
  } finally {
101
111
  l(""), h(""), _(0), localStorage.removeItem("miniwallet:lastWalletId");
102
112
  }
103
- }, [C]), A = t(async (e) => {
104
- if (!C) {
113
+ }, [T]), M = t(async (e) => {
114
+ if (!T) {
105
115
  alert("钱包不存在");
106
116
  return;
107
117
  }
108
118
  try {
109
- await C.request({
119
+ await T.request({
110
120
  method: "wallet_switchEthereumChain",
111
121
  params: [{ chainId: `0x${e.id.toString(16)}` }]
112
122
  }), _(e.id);
113
123
  } catch (e) {
114
- console.error("切换失败:", e), alert("切换失败");
124
+ console.log("switchError: ", e);
125
+ let t = e, n = t?.code ?? "", r = t?.message ?? "";
126
+ alert(`Switch failed${n && `\n${n}`}${r && `\n${r}`}`);
115
127
  }
116
- }, [C]), j = t(async () => {
128
+ }, [T]), N = t(async () => {
117
129
  try {
118
- if (!s || !C) return;
119
- let e = await C.request({
130
+ if (!s || !T) return;
131
+ let e = await T.request({
120
132
  method: "eth_getBalance",
121
133
  params: [s, "latest"]
122
134
  });
@@ -124,58 +136,60 @@ function m({ children: e, chains: n = [] }) {
124
136
  } catch (e) {
125
137
  console.error("getBalance error: ", e);
126
138
  }
127
- }, [s, C]), M = i(() => ({
139
+ }, [s, T]), P = i(() => ({
128
140
  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
141
+ balance: k,
142
+ isConnected: D,
143
+ connectingWallet: b,
144
+ selectedChain: O,
145
+ wallet: E,
146
+ chains: w,
147
+ connect: A,
148
+ switchChain: M,
149
+ disconnect: j
137
150
  }), [
138
151
  s,
152
+ k,
139
153
  D,
140
- T,
154
+ b,
155
+ O,
141
156
  E,
142
157
  w,
143
- S,
144
- O,
145
158
  A,
146
- k
159
+ M,
160
+ j
147
161
  ]);
148
162
  return r(() => {
149
163
  let e = ((e) => {
150
164
  let { info: t, provider: n } = e.detail ?? {}, r = f[t?.rdns];
151
- !r || !n?.request || x((e) => e[r] === n ? e : {
165
+ !r || !n?.request || C((e) => e[r] === n ? e : {
152
166
  ...e,
153
167
  [r]: n
154
168
  });
155
169
  });
156
170
  return window.addEventListener("eip6963:announceProvider", e), window.dispatchEvent(new Event("eip6963:requestProvider")), () => {
157
- window.removeEventListener("eip6963:announceProvider", e), x({});
171
+ window.removeEventListener("eip6963:announceProvider", e), C({});
158
172
  };
159
173
  }, []), r(() => {
160
- g && j();
161
- }, [j, g]), r(() => {
162
- if (!T || !C?.on) return;
174
+ g && N();
175
+ }, [N, g]), r(() => {
176
+ if (!T?.on) return;
163
177
  let e = (e) => {
164
178
  console.log("ChainChanged chainId: ", e), _(parseInt(e, 16));
165
179
  }, t = (e) => {
166
180
  console.log("AccountsChanged accounts: ", e), l(e[0]);
167
181
  };
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);
182
+ return console.log("Listen chainChanged and accountsChanged"), T.on("chainChanged", e), T.on("accountsChanged", t), () => {
183
+ console.log("RemoveListener chainChanged and accountsChanged"), T.removeListener("chainChanged", e), T.removeListener("accountsChanged", t);
170
184
  };
171
- }, [T, C]), r(() => {
185
+ }, [T]), r(() => {
172
186
  if (!s) return;
173
- let e = setInterval(j, 1e4);
187
+ let e = setInterval(N, 1e4);
174
188
  return () => clearInterval(e);
175
- }, [s, j]), r(() => {
189
+ }, [s, N]), r(() => {
176
190
  let e = localStorage.getItem("miniwallet:lastWalletId");
177
191
  if (!e) return;
178
- let t = b[e];
192
+ let t = S[e];
179
193
  if (!t) return;
180
194
  let n = !1;
181
195
  return (async () => {
@@ -190,8 +204,8 @@ function m({ children: e, chains: n = [] }) {
190
204
  })(), () => {
191
205
  n = !0;
192
206
  };
193
- }, [b]), /* @__PURE__ */ o(c.Provider, {
194
- value: M,
207
+ }, [S]), /* @__PURE__ */ o(c.Provider, {
208
+ value: P,
195
209
  children: e
196
210
  });
197
211
  }
@@ -208,67 +222,126 @@ var g = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOC
208
222
  //#endregion
209
223
  //#region src/MiniWalletButton.tsx
210
224
  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", {
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(() => {
226
+ x(!0);
227
+ }, []), A = t(() => {
228
+ x(!1);
229
+ }, []), j = t(async () => {
230
+ try {
231
+ await navigator.clipboard.writeText(n), D("已复制!"), setTimeout(() => {
232
+ D("复制地址");
233
+ }, 1e3);
234
+ } catch (e) {
235
+ console.error("copy", e);
236
+ }
237
+ }, [n]);
238
+ return r(() => {
239
+ u || (x(!1), T(!1));
240
+ }, [u]), l ? /* @__PURE__ */ s("section", {
217
241
  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",
236
- children: [
237
- n.slice(0, 6),
238
- "...",
239
- n.slice(-4)
240
- ]
241
- }),
242
- /* @__PURE__ */ s("span", {
243
- className: "text-sm text-gray-400",
242
+ children: [
243
+ /* @__PURE__ */ o("select", {
244
+ value: f?.id,
245
+ onChange: (e) => m(_.find((t) => t.id === Number(e.target.value))),
246
+ className: "bg-transparent1 mr-4 cursor-pointer rounded-sm border-none p-1 text-gray-600 outline-none hover:bg-gray-100",
247
+ children: _.map((e) => /* @__PURE__ */ o("option", {
248
+ value: e.id,
249
+ children: e.name
250
+ }, e.id))
251
+ }),
252
+ /* @__PURE__ */ s("div", {
253
+ className: "flex items-center justify-center rounded-2xl bg-white pr-3 shadow-lg inset-ring-1 shadow-gray-200 inset-ring-gray-100",
254
+ children: [/* @__PURE__ */ s("div", {
255
+ onClick: () => {
256
+ T(!0);
257
+ },
258
+ 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",
244
259
  children: [
245
- "(",
246
- r,
247
- " ",
248
- c?.symbol ?? "",
249
- ")"
260
+ p && /* @__PURE__ */ o("img", {
261
+ src: p.icon,
262
+ alt: p.name,
263
+ className: "h-6 w-6"
264
+ }),
265
+ /* @__PURE__ */ o("div", {
266
+ className: "mr-1",
267
+ children: O
268
+ }),
269
+ /* @__PURE__ */ s("span", {
270
+ className: "text-sm text-gray-400",
271
+ children: [
272
+ "(",
273
+ c,
274
+ " ",
275
+ f?.symbol ?? "",
276
+ ")"
277
+ ]
278
+ })
250
279
  ]
251
- }),
252
- /* @__PURE__ */ o("button", {
253
- className: "h-6 w-6 cursor-pointer rounded-full",
254
- onClick: m,
280
+ }), /* @__PURE__ */ o("button", {
281
+ className: "ml-1 h-6 w-6 cursor-pointer rounded-full",
282
+ onClick: y,
255
283
  children: /* @__PURE__ */ o("img", {
256
284
  src: g,
257
285
  alt: "disconnect",
258
286
  className: "h-[22px] w-6"
259
287
  })
288
+ })]
289
+ }),
290
+ w && /* @__PURE__ */ o("div", {
291
+ className: "z-index-10 fixed top-0 right-0 bottom-0 left-0 bg-[rgba(0,0,0,0.5)]",
292
+ children: /* @__PURE__ */ s("div", {
293
+ 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",
294
+ children: [
295
+ /* @__PURE__ */ o("div", {
296
+ className: "mb-[-12px] w-full text-right",
297
+ children: /* @__PURE__ */ o("button", {
298
+ className: "mr-[-20px] cursor-pointer rounded-full p-1 hover:bg-gray-100",
299
+ onClick: () => {
300
+ T(!1);
301
+ },
302
+ children: /* @__PURE__ */ s("svg", {
303
+ xmlns: "http://www.w3.org/2000/svg",
304
+ viewBox: "0 0 24 24",
305
+ fill: "none",
306
+ stroke: "currentColor",
307
+ strokeWidth: "2",
308
+ className: "h-8 w-8",
309
+ children: [/* @__PURE__ */ o("path", { d: "M18 6 6 18" }), /* @__PURE__ */ o("path", { d: "m6 6 12 12" })]
310
+ })
311
+ })
312
+ }),
313
+ p && /* @__PURE__ */ o("img", {
314
+ src: p.icon,
315
+ alt: p.name,
316
+ className: "h-16 w-16"
317
+ }),
318
+ /* @__PURE__ */ o("p", { children: O }),
319
+ /* @__PURE__ */ s("div", {
320
+ className: "mt-2 w-full space-x-10",
321
+ children: [/* @__PURE__ */ o("button", {
322
+ onClick: j,
323
+ className: "w-[112px] cursor-pointer rounded-xl bg-gray-700 py-2 text-white shadow-md shadow-gray-500/50 outline-none",
324
+ children: E
325
+ }), /* @__PURE__ */ o("button", {
326
+ type: "button",
327
+ onClick: y,
328
+ className: "w-[112px] cursor-pointer rounded-xl bg-red-400 py-2 text-white shadow-md shadow-red-500/50 outline-none",
329
+ children: "断开连接"
330
+ })]
331
+ })
332
+ ]
260
333
  })
261
- ]
262
- })]
334
+ })
335
+ ]
263
336
  }) : /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("button", {
264
337
  type: "button",
265
- onClick: y,
338
+ onClick: k,
266
339
  className: "cursor-pointer rounded-xl bg-blue-500 px-4 py-2 text-white shadow-lg shadow-blue-500/50",
267
340
  children: e
268
- }), _ && /* @__PURE__ */ o("div", {
341
+ }), b && /* @__PURE__ */ o("div", {
269
342
  className: "z-index-10 fixed top-0 right-0 bottom-0 left-0 bg-[rgba(0,0,0,0.5)]",
270
343
  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",
344
+ 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",
272
345
  children: [/* @__PURE__ */ s("div", {
273
346
  className: "mb-2 flex items-center justify-between",
274
347
  children: [/* @__PURE__ */ o("span", {
@@ -278,39 +351,62 @@ function _({ label: e = "Connect Wallet" }) {
278
351
  type: "button",
279
352
  "aria-label": "Close",
280
353
  className: "cursor-pointer rounded-full p-1 hover:bg-gray-100",
281
- onClick: b,
354
+ onClick: () => {
355
+ C(!1), A();
356
+ },
282
357
  children: /* @__PURE__ */ s("svg", {
283
358
  xmlns: "http://www.w3.org/2000/svg",
284
359
  viewBox: "0 0 24 24",
285
360
  fill: "none",
286
361
  stroke: "currentColor",
287
362
  strokeWidth: "2",
288
- className: "h-5 w-5",
363
+ className: "h-8 w-8",
289
364
  children: [/* @__PURE__ */ o("path", { d: "M18 6 6 18" }), /* @__PURE__ */ o("path", { d: "m6 6 12 12" })]
290
365
  })
291
366
  })]
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
- ]
367
+ }), /* @__PURE__ */ s("div", {
368
+ className: "relative w-full space-y-4",
369
+ children: [S && u && /* @__PURE__ */ s("div", {
370
+ className: "absolute inset-0 mb-0 flex flex-col items-center justify-center rounded-xl bg-[rgba(255,255,255,0.9)] text-black",
371
+ children: [
372
+ /* @__PURE__ */ s("div", { children: [
373
+ "正在连接",
374
+ u.name,
375
+ "..."
376
+ ] }),
377
+ /* @__PURE__ */ o("div", {
378
+ className: "my-1.5 text-xs",
379
+ children: "请在扩展中确认连接"
380
+ }),
381
+ /* @__PURE__ */ o("img", {
382
+ 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",
383
+ alt: "spin",
384
+ className: "h-8 w-8 animate-[spin_2s_linear_infinite]"
385
+ })
386
+ ]
387
+ }), d.map((e) => /* @__PURE__ */ s("button", {
388
+ type: "button",
389
+ onClick: () => {
390
+ C(!0), v(e);
391
+ },
392
+ className: "flex w-full cursor-pointer items-center gap-2 rounded-xl border border-gray-300 px-4 py-2 hover:bg-gray-100",
393
+ children: [/* @__PURE__ */ o("img", {
394
+ src: e.icon,
395
+ alt: e.name,
396
+ className: "h-8 w-8"
397
+ }), /* @__PURE__ */ s("div", {
398
+ className: "flex flex-col justify-between text-left",
399
+ children: [/* @__PURE__ */ o("p", { children: e.name }), /* @__PURE__ */ s("span", {
400
+ className: "text-xs text-gray-500",
401
+ children: [
402
+ "Connect your ",
403
+ e.name,
404
+ " wallet"
405
+ ]
406
+ })]
311
407
  })]
312
- })]
313
- }, e.id))]
408
+ }, e.id))]
409
+ })]
314
410
  })
315
411
  })] });
316
412
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miniwallet",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
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": {