adapter-connect 0.0.2 → 0.0.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.
- package/dist/index.js +15 -281
- package/dist/index.mjs +4 -269
- package/package.json +16 -4
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use strict";
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
@@ -62,145 +63,7 @@ var import_chains3 = require("viem/chains");
|
|
|
62
63
|
var import_react_auth = require("@privy-io/react-auth");
|
|
63
64
|
var import_react = require("react");
|
|
64
65
|
var import_wagmi2 = require("wagmi");
|
|
65
|
-
|
|
66
|
-
// node_modules/@wagmi/core/dist/esm/version.js
|
|
67
|
-
var version = "2.22.1";
|
|
68
|
-
|
|
69
|
-
// node_modules/@wagmi/core/dist/esm/utils/getVersion.js
|
|
70
|
-
var getVersion = () => `@wagmi/core@${version}`;
|
|
71
|
-
|
|
72
|
-
// node_modules/@wagmi/core/dist/esm/errors/base.js
|
|
73
|
-
var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
74
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
75
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
76
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
77
|
-
};
|
|
78
|
-
var _BaseError_instances;
|
|
79
|
-
var _BaseError_walk;
|
|
80
|
-
var BaseError = class _BaseError extends Error {
|
|
81
|
-
get docsBaseUrl() {
|
|
82
|
-
return "https://wagmi.sh/core";
|
|
83
|
-
}
|
|
84
|
-
get version() {
|
|
85
|
-
return getVersion();
|
|
86
|
-
}
|
|
87
|
-
constructor(shortMessage, options = {}) {
|
|
88
|
-
var _a;
|
|
89
|
-
super();
|
|
90
|
-
_BaseError_instances.add(this);
|
|
91
|
-
Object.defineProperty(this, "details", {
|
|
92
|
-
enumerable: true,
|
|
93
|
-
configurable: true,
|
|
94
|
-
writable: true,
|
|
95
|
-
value: void 0
|
|
96
|
-
});
|
|
97
|
-
Object.defineProperty(this, "docsPath", {
|
|
98
|
-
enumerable: true,
|
|
99
|
-
configurable: true,
|
|
100
|
-
writable: true,
|
|
101
|
-
value: void 0
|
|
102
|
-
});
|
|
103
|
-
Object.defineProperty(this, "metaMessages", {
|
|
104
|
-
enumerable: true,
|
|
105
|
-
configurable: true,
|
|
106
|
-
writable: true,
|
|
107
|
-
value: void 0
|
|
108
|
-
});
|
|
109
|
-
Object.defineProperty(this, "shortMessage", {
|
|
110
|
-
enumerable: true,
|
|
111
|
-
configurable: true,
|
|
112
|
-
writable: true,
|
|
113
|
-
value: void 0
|
|
114
|
-
});
|
|
115
|
-
Object.defineProperty(this, "name", {
|
|
116
|
-
enumerable: true,
|
|
117
|
-
configurable: true,
|
|
118
|
-
writable: true,
|
|
119
|
-
value: "WagmiCoreError"
|
|
120
|
-
});
|
|
121
|
-
const details = options.cause instanceof _BaseError ? options.cause.details : ((_a = options.cause) == null ? void 0 : _a.message) ? options.cause.message : options.details;
|
|
122
|
-
const docsPath = options.cause instanceof _BaseError ? options.cause.docsPath || options.docsPath : options.docsPath;
|
|
123
|
-
this.message = [
|
|
124
|
-
shortMessage || "An error occurred.",
|
|
125
|
-
"",
|
|
126
|
-
...options.metaMessages ? [...options.metaMessages, ""] : [],
|
|
127
|
-
...docsPath ? [
|
|
128
|
-
`Docs: ${this.docsBaseUrl}${docsPath}.html${options.docsSlug ? `#${options.docsSlug}` : ""}`
|
|
129
|
-
] : [],
|
|
130
|
-
...details ? [`Details: ${details}`] : [],
|
|
131
|
-
`Version: ${this.version}`
|
|
132
|
-
].join("\n");
|
|
133
|
-
if (options.cause)
|
|
134
|
-
this.cause = options.cause;
|
|
135
|
-
this.details = details;
|
|
136
|
-
this.docsPath = docsPath;
|
|
137
|
-
this.metaMessages = options.metaMessages;
|
|
138
|
-
this.shortMessage = shortMessage;
|
|
139
|
-
}
|
|
140
|
-
walk(fn) {
|
|
141
|
-
return __classPrivateFieldGet(this, _BaseError_instances, "m", _BaseError_walk).call(this, this, fn);
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
_BaseError_instances = /* @__PURE__ */ new WeakSet(), _BaseError_walk = function _BaseError_walk2(err, fn) {
|
|
145
|
-
if (fn == null ? void 0 : fn(err))
|
|
146
|
-
return err;
|
|
147
|
-
if (err.cause)
|
|
148
|
-
return __classPrivateFieldGet(this, _BaseError_instances, "m", _BaseError_walk2).call(this, err.cause, fn);
|
|
149
|
-
return err;
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
// node_modules/@wagmi/core/dist/esm/errors/config.js
|
|
153
|
-
var ChainNotConfiguredError = class extends BaseError {
|
|
154
|
-
constructor() {
|
|
155
|
-
super("Chain not configured.");
|
|
156
|
-
Object.defineProperty(this, "name", {
|
|
157
|
-
enumerable: true,
|
|
158
|
-
configurable: true,
|
|
159
|
-
writable: true,
|
|
160
|
-
value: "ChainNotConfiguredError"
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
// node_modules/@wagmi/core/dist/esm/errors/connector.js
|
|
166
|
-
var SwitchChainNotSupportedError = class extends BaseError {
|
|
167
|
-
constructor({ connector }) {
|
|
168
|
-
super(`"${connector.name}" does not support programmatic chain switching.`);
|
|
169
|
-
Object.defineProperty(this, "name", {
|
|
170
|
-
enumerable: true,
|
|
171
|
-
configurable: true,
|
|
172
|
-
writable: true,
|
|
173
|
-
value: "SwitchChainNotSupportedError"
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
// node_modules/@wagmi/core/dist/esm/actions/switchChain.js
|
|
179
|
-
async function switchChain(config2, parameters) {
|
|
180
|
-
var _a, _b;
|
|
181
|
-
const { addEthereumChainParameter, chainId } = parameters;
|
|
182
|
-
const connection = config2.state.connections.get((_b = (_a = parameters.connector) == null ? void 0 : _a.uid) != null ? _b : config2.state.current);
|
|
183
|
-
if (connection) {
|
|
184
|
-
const connector = connection.connector;
|
|
185
|
-
if (!connector.switchChain)
|
|
186
|
-
throw new SwitchChainNotSupportedError({ connector });
|
|
187
|
-
const chain2 = await connector.switchChain({
|
|
188
|
-
addEthereumChainParameter,
|
|
189
|
-
chainId
|
|
190
|
-
});
|
|
191
|
-
return chain2;
|
|
192
|
-
}
|
|
193
|
-
const chain = config2.chains.find((x) => x.id === chainId);
|
|
194
|
-
if (!chain)
|
|
195
|
-
throw new ChainNotConfiguredError();
|
|
196
|
-
config2.setState((x) => ({ ...x, chainId }));
|
|
197
|
-
return chain;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// node_modules/@wagmi/core/dist/esm/exports/index.js
|
|
201
|
-
var import_viem = require("viem");
|
|
202
|
-
|
|
203
|
-
// src/useWalletConnect.tsx
|
|
66
|
+
var import_core = require("@wagmi/core");
|
|
204
67
|
var import_chains2 = require("viem/chains");
|
|
205
68
|
var useWalletConnect = () => {
|
|
206
69
|
const { login, authenticated, user, logout, ready } = (0, import_react_auth.usePrivy)();
|
|
@@ -220,7 +83,7 @@ var useWalletConnect = () => {
|
|
|
220
83
|
try {
|
|
221
84
|
const wallet = wallets.find((wallet2) => wallet2.address.toString() === (address == null ? void 0 : address.toString()));
|
|
222
85
|
wallet == null ? void 0 : wallet.switchChain(import_chains2.base.id);
|
|
223
|
-
switchChain(config, { chainId: import_chains2.base.id });
|
|
86
|
+
(0, import_core.switchChain)(config, { chainId: import_chains2.base.id });
|
|
224
87
|
} catch (error) {
|
|
225
88
|
console.error("Failed to switch chain:", error);
|
|
226
89
|
}
|
|
@@ -662,127 +525,15 @@ var ModalPrivyConnect = () => {
|
|
|
662
525
|
};
|
|
663
526
|
|
|
664
527
|
// src/ModalPrivyWallets.tsx
|
|
665
|
-
var import_react5 = require("react");
|
|
666
|
-
|
|
667
|
-
// node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
668
|
-
var import_react4 = require("react");
|
|
669
|
-
|
|
670
|
-
// node_modules/lucide-react/dist/esm/shared/src/utils.js
|
|
671
|
-
var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
672
|
-
var toCamelCase = (string) => string.replace(
|
|
673
|
-
/^([A-Z])|[\s-_]+(\w)/g,
|
|
674
|
-
(match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
|
|
675
|
-
);
|
|
676
|
-
var toPascalCase = (string) => {
|
|
677
|
-
const camelCase = toCamelCase(string);
|
|
678
|
-
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
679
|
-
};
|
|
680
|
-
var mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
|
681
|
-
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
682
|
-
}).join(" ").trim();
|
|
683
|
-
var hasA11yProp = (props) => {
|
|
684
|
-
for (const prop in props) {
|
|
685
|
-
if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
|
|
686
|
-
return true;
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
};
|
|
690
|
-
|
|
691
|
-
// node_modules/lucide-react/dist/esm/Icon.js
|
|
692
528
|
var import_react3 = require("react");
|
|
693
|
-
|
|
694
|
-
// node_modules/lucide-react/dist/esm/defaultAttributes.js
|
|
695
|
-
var defaultAttributes = {
|
|
696
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
697
|
-
width: 24,
|
|
698
|
-
height: 24,
|
|
699
|
-
viewBox: "0 0 24 24",
|
|
700
|
-
fill: "none",
|
|
701
|
-
stroke: "currentColor",
|
|
702
|
-
strokeWidth: 2,
|
|
703
|
-
strokeLinecap: "round",
|
|
704
|
-
strokeLinejoin: "round"
|
|
705
|
-
};
|
|
706
|
-
|
|
707
|
-
// node_modules/lucide-react/dist/esm/Icon.js
|
|
708
|
-
var Icon = (0, import_react3.forwardRef)(
|
|
709
|
-
({
|
|
710
|
-
color = "currentColor",
|
|
711
|
-
size = 24,
|
|
712
|
-
strokeWidth = 2,
|
|
713
|
-
absoluteStrokeWidth,
|
|
714
|
-
className = "",
|
|
715
|
-
children,
|
|
716
|
-
iconNode,
|
|
717
|
-
...rest
|
|
718
|
-
}, ref) => (0, import_react3.createElement)(
|
|
719
|
-
"svg",
|
|
720
|
-
{
|
|
721
|
-
ref,
|
|
722
|
-
...defaultAttributes,
|
|
723
|
-
width: size,
|
|
724
|
-
height: size,
|
|
725
|
-
stroke: color,
|
|
726
|
-
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
|
|
727
|
-
className: mergeClasses("lucide", className),
|
|
728
|
-
...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
|
|
729
|
-
...rest
|
|
730
|
-
},
|
|
731
|
-
[
|
|
732
|
-
...iconNode.map(([tag, attrs]) => (0, import_react3.createElement)(tag, attrs)),
|
|
733
|
-
...Array.isArray(children) ? children : [children]
|
|
734
|
-
]
|
|
735
|
-
)
|
|
736
|
-
);
|
|
737
|
-
|
|
738
|
-
// node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
739
|
-
var createLucideIcon = (iconName, iconNode) => {
|
|
740
|
-
const Component = (0, import_react4.forwardRef)(
|
|
741
|
-
({ className, ...props }, ref) => (0, import_react4.createElement)(Icon, {
|
|
742
|
-
ref,
|
|
743
|
-
iconNode,
|
|
744
|
-
className: mergeClasses(
|
|
745
|
-
`lucide-${toKebabCase(toPascalCase(iconName))}`,
|
|
746
|
-
`lucide-${iconName}`,
|
|
747
|
-
className
|
|
748
|
-
),
|
|
749
|
-
...props
|
|
750
|
-
})
|
|
751
|
-
);
|
|
752
|
-
Component.displayName = toPascalCase(iconName);
|
|
753
|
-
return Component;
|
|
754
|
-
};
|
|
755
|
-
|
|
756
|
-
// node_modules/lucide-react/dist/esm/icons/copy.js
|
|
757
|
-
var __iconNode = [
|
|
758
|
-
["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
|
|
759
|
-
["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
|
|
760
|
-
];
|
|
761
|
-
var Copy = createLucideIcon("copy", __iconNode);
|
|
762
|
-
|
|
763
|
-
// node_modules/lucide-react/dist/esm/icons/external-link.js
|
|
764
|
-
var __iconNode2 = [
|
|
765
|
-
["path", { d: "M15 3h6v6", key: "1q9fwt" }],
|
|
766
|
-
["path", { d: "M10 14 21 3", key: "gplh6r" }],
|
|
767
|
-
["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
|
|
768
|
-
];
|
|
769
|
-
var ExternalLink = createLucideIcon("external-link", __iconNode2);
|
|
770
|
-
|
|
771
|
-
// node_modules/lucide-react/dist/esm/icons/x.js
|
|
772
|
-
var __iconNode3 = [
|
|
773
|
-
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
774
|
-
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
775
|
-
];
|
|
776
|
-
var X = createLucideIcon("x", __iconNode3);
|
|
777
|
-
|
|
778
|
-
// src/ModalPrivyWallets.tsx
|
|
529
|
+
var import_lucide_react = require("lucide-react");
|
|
779
530
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
780
531
|
var formatAddress = (address) => {
|
|
781
532
|
if (!address) return "";
|
|
782
533
|
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
783
534
|
};
|
|
784
535
|
var CopyAddress = ({ address }) => {
|
|
785
|
-
const [copied, setCopied] = (0,
|
|
536
|
+
const [copied, setCopied] = (0, import_react3.useState)(false);
|
|
786
537
|
const handleCopy = async () => {
|
|
787
538
|
try {
|
|
788
539
|
await navigator.clipboard.writeText(address);
|
|
@@ -797,23 +548,23 @@ var CopyAddress = ({ address }) => {
|
|
|
797
548
|
{
|
|
798
549
|
onClick: handleCopy,
|
|
799
550
|
className: " transition-colors duration-200 cursor-pointer",
|
|
800
|
-
children: copied ? "\u2713 Copied!" : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Copy, { className: "w-4 h-4" })
|
|
551
|
+
children: copied ? "\u2713 Copied!" : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.Copy, { className: "w-4 h-4" })
|
|
801
552
|
}
|
|
802
553
|
);
|
|
803
554
|
};
|
|
804
555
|
var ModalPrivyWallet = () => {
|
|
805
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
556
|
+
const [isExpanded, setIsExpanded] = (0, import_react3.useState)(true);
|
|
806
557
|
const { address, disconnect } = useWalletConnect();
|
|
807
|
-
const [isOpen, setIsOpen] = (0,
|
|
808
|
-
const [isClosing, setIsClosing] = (0,
|
|
809
|
-
const [isVisible, setIsVisible] = (0,
|
|
558
|
+
const [isOpen, setIsOpen] = (0, import_react3.useState)(false);
|
|
559
|
+
const [isClosing, setIsClosing] = (0, import_react3.useState)(false);
|
|
560
|
+
const [isVisible, setIsVisible] = (0, import_react3.useState)(false);
|
|
810
561
|
const safeAddress = address != null ? address : "";
|
|
811
|
-
(0,
|
|
562
|
+
(0, import_react3.useEffect)(() => {
|
|
812
563
|
window.openModalPrivyWallet = () => {
|
|
813
564
|
setIsOpen(true);
|
|
814
565
|
};
|
|
815
566
|
}, []);
|
|
816
|
-
(0,
|
|
567
|
+
(0, import_react3.useEffect)(() => {
|
|
817
568
|
if (isOpen) {
|
|
818
569
|
setIsVisible(false);
|
|
819
570
|
const t = requestAnimationFrame(() => setIsVisible(true));
|
|
@@ -822,7 +573,7 @@ var ModalPrivyWallet = () => {
|
|
|
822
573
|
setIsVisible(false);
|
|
823
574
|
}
|
|
824
575
|
}, [isOpen]);
|
|
825
|
-
(0,
|
|
576
|
+
(0, import_react3.useEffect)(() => {
|
|
826
577
|
if (isOpen) {
|
|
827
578
|
const previous = document.body.style.overflow;
|
|
828
579
|
document.body.style.overflow = "hidden";
|
|
@@ -882,7 +633,7 @@ var ModalPrivyWallet = () => {
|
|
|
882
633
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "oui-relative oui-z-10 oui-flex oui-h-full oui-flex-col oui-gap-4 md:oui-gap-5", children: [
|
|
883
634
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "oui-flex oui-flex-none oui-items-center oui-justify-between", children: [
|
|
884
635
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { id: "wallet-dialog-title", className: "oui-font-semibold oui-text-base-contrast-80 oui-pb-2 oui-text-[20px] md:oui-py-0 md:oui-text-base", children: "My wallet" }),
|
|
885
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "oui-size-5 oui-cursor-pointer oui-text-base-contrast-20 hover:oui-text-base-contrast-80", onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(X, { size: 24 }) })
|
|
636
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "oui-size-5 oui-cursor-pointer oui-text-base-contrast-20 hover:oui-text-base-contrast-80", onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.X, { size: 24 }) })
|
|
886
637
|
] }),
|
|
887
638
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "oui-flex oui-flex-col oui-gap-5", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "oui-relative oui-h-[110px] oui-overflow-hidden oui-rounded-2xl oui-p-4 oui-bg-[#283BEE]", children: [
|
|
888
639
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
@@ -903,7 +654,7 @@ var ModalPrivyWallet = () => {
|
|
|
903
654
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "oui-text-sm oui-font-semibold oui-text-base-contrast", children: formatAddress(safeAddress) }),
|
|
904
655
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "oui-flex oui-items-center oui-justify-center oui-gap-2", children: [
|
|
905
656
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CopyAddress, { address: safeAddress }),
|
|
906
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "oui-cursor-pointer oui-text-base-contrast-80 hover:oui-text-base-contrast", onClick: handleDisconnect, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ExternalLink, { size: 16 }) })
|
|
657
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className: "oui-cursor-pointer oui-text-base-contrast-80 hover:oui-text-base-contrast", onClick: handleDisconnect, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.ExternalLink, { size: 16 }) })
|
|
907
658
|
] })
|
|
908
659
|
] }) })
|
|
909
660
|
] }) }) })
|
|
@@ -945,20 +696,3 @@ function WhatWagmiProvider({
|
|
|
945
696
|
0 && (module.exports = {
|
|
946
697
|
WhatWagmiProvider
|
|
947
698
|
});
|
|
948
|
-
/*! Bundled license information:
|
|
949
|
-
|
|
950
|
-
lucide-react/dist/esm/shared/src/utils.js:
|
|
951
|
-
lucide-react/dist/esm/defaultAttributes.js:
|
|
952
|
-
lucide-react/dist/esm/Icon.js:
|
|
953
|
-
lucide-react/dist/esm/createLucideIcon.js:
|
|
954
|
-
lucide-react/dist/esm/icons/copy.js:
|
|
955
|
-
lucide-react/dist/esm/icons/external-link.js:
|
|
956
|
-
lucide-react/dist/esm/icons/x.js:
|
|
957
|
-
lucide-react/dist/esm/lucide-react.js:
|
|
958
|
-
(**
|
|
959
|
-
* @license lucide-react v0.554.0 - ISC
|
|
960
|
-
*
|
|
961
|
-
* This source code is licensed under the ISC license.
|
|
962
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
963
|
-
*)
|
|
964
|
-
*/
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
// src/WhatWagmiProvider.tsx
|
|
2
4
|
import { WagmiProvider } from "wagmi";
|
|
3
5
|
import { PrivyProvider } from "@privy-io/react-auth";
|
|
@@ -26,145 +28,7 @@ import { arbitrum, arbitrumSepolia } from "viem/chains";
|
|
|
26
28
|
import { usePrivy, useWallets } from "@privy-io/react-auth";
|
|
27
29
|
import { useMemo } from "react";
|
|
28
30
|
import { useAccount, useConnect, useDisconnect } from "wagmi";
|
|
29
|
-
|
|
30
|
-
// node_modules/@wagmi/core/dist/esm/version.js
|
|
31
|
-
var version = "2.22.1";
|
|
32
|
-
|
|
33
|
-
// node_modules/@wagmi/core/dist/esm/utils/getVersion.js
|
|
34
|
-
var getVersion = () => `@wagmi/core@${version}`;
|
|
35
|
-
|
|
36
|
-
// node_modules/@wagmi/core/dist/esm/errors/base.js
|
|
37
|
-
var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
38
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
39
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
40
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
41
|
-
};
|
|
42
|
-
var _BaseError_instances;
|
|
43
|
-
var _BaseError_walk;
|
|
44
|
-
var BaseError = class _BaseError extends Error {
|
|
45
|
-
get docsBaseUrl() {
|
|
46
|
-
return "https://wagmi.sh/core";
|
|
47
|
-
}
|
|
48
|
-
get version() {
|
|
49
|
-
return getVersion();
|
|
50
|
-
}
|
|
51
|
-
constructor(shortMessage, options = {}) {
|
|
52
|
-
var _a;
|
|
53
|
-
super();
|
|
54
|
-
_BaseError_instances.add(this);
|
|
55
|
-
Object.defineProperty(this, "details", {
|
|
56
|
-
enumerable: true,
|
|
57
|
-
configurable: true,
|
|
58
|
-
writable: true,
|
|
59
|
-
value: void 0
|
|
60
|
-
});
|
|
61
|
-
Object.defineProperty(this, "docsPath", {
|
|
62
|
-
enumerable: true,
|
|
63
|
-
configurable: true,
|
|
64
|
-
writable: true,
|
|
65
|
-
value: void 0
|
|
66
|
-
});
|
|
67
|
-
Object.defineProperty(this, "metaMessages", {
|
|
68
|
-
enumerable: true,
|
|
69
|
-
configurable: true,
|
|
70
|
-
writable: true,
|
|
71
|
-
value: void 0
|
|
72
|
-
});
|
|
73
|
-
Object.defineProperty(this, "shortMessage", {
|
|
74
|
-
enumerable: true,
|
|
75
|
-
configurable: true,
|
|
76
|
-
writable: true,
|
|
77
|
-
value: void 0
|
|
78
|
-
});
|
|
79
|
-
Object.defineProperty(this, "name", {
|
|
80
|
-
enumerable: true,
|
|
81
|
-
configurable: true,
|
|
82
|
-
writable: true,
|
|
83
|
-
value: "WagmiCoreError"
|
|
84
|
-
});
|
|
85
|
-
const details = options.cause instanceof _BaseError ? options.cause.details : ((_a = options.cause) == null ? void 0 : _a.message) ? options.cause.message : options.details;
|
|
86
|
-
const docsPath = options.cause instanceof _BaseError ? options.cause.docsPath || options.docsPath : options.docsPath;
|
|
87
|
-
this.message = [
|
|
88
|
-
shortMessage || "An error occurred.",
|
|
89
|
-
"",
|
|
90
|
-
...options.metaMessages ? [...options.metaMessages, ""] : [],
|
|
91
|
-
...docsPath ? [
|
|
92
|
-
`Docs: ${this.docsBaseUrl}${docsPath}.html${options.docsSlug ? `#${options.docsSlug}` : ""}`
|
|
93
|
-
] : [],
|
|
94
|
-
...details ? [`Details: ${details}`] : [],
|
|
95
|
-
`Version: ${this.version}`
|
|
96
|
-
].join("\n");
|
|
97
|
-
if (options.cause)
|
|
98
|
-
this.cause = options.cause;
|
|
99
|
-
this.details = details;
|
|
100
|
-
this.docsPath = docsPath;
|
|
101
|
-
this.metaMessages = options.metaMessages;
|
|
102
|
-
this.shortMessage = shortMessage;
|
|
103
|
-
}
|
|
104
|
-
walk(fn) {
|
|
105
|
-
return __classPrivateFieldGet(this, _BaseError_instances, "m", _BaseError_walk).call(this, this, fn);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
_BaseError_instances = /* @__PURE__ */ new WeakSet(), _BaseError_walk = function _BaseError_walk2(err, fn) {
|
|
109
|
-
if (fn == null ? void 0 : fn(err))
|
|
110
|
-
return err;
|
|
111
|
-
if (err.cause)
|
|
112
|
-
return __classPrivateFieldGet(this, _BaseError_instances, "m", _BaseError_walk2).call(this, err.cause, fn);
|
|
113
|
-
return err;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
// node_modules/@wagmi/core/dist/esm/errors/config.js
|
|
117
|
-
var ChainNotConfiguredError = class extends BaseError {
|
|
118
|
-
constructor() {
|
|
119
|
-
super("Chain not configured.");
|
|
120
|
-
Object.defineProperty(this, "name", {
|
|
121
|
-
enumerable: true,
|
|
122
|
-
configurable: true,
|
|
123
|
-
writable: true,
|
|
124
|
-
value: "ChainNotConfiguredError"
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
// node_modules/@wagmi/core/dist/esm/errors/connector.js
|
|
130
|
-
var SwitchChainNotSupportedError = class extends BaseError {
|
|
131
|
-
constructor({ connector }) {
|
|
132
|
-
super(`"${connector.name}" does not support programmatic chain switching.`);
|
|
133
|
-
Object.defineProperty(this, "name", {
|
|
134
|
-
enumerable: true,
|
|
135
|
-
configurable: true,
|
|
136
|
-
writable: true,
|
|
137
|
-
value: "SwitchChainNotSupportedError"
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
// node_modules/@wagmi/core/dist/esm/actions/switchChain.js
|
|
143
|
-
async function switchChain(config2, parameters) {
|
|
144
|
-
var _a, _b;
|
|
145
|
-
const { addEthereumChainParameter, chainId } = parameters;
|
|
146
|
-
const connection = config2.state.connections.get((_b = (_a = parameters.connector) == null ? void 0 : _a.uid) != null ? _b : config2.state.current);
|
|
147
|
-
if (connection) {
|
|
148
|
-
const connector = connection.connector;
|
|
149
|
-
if (!connector.switchChain)
|
|
150
|
-
throw new SwitchChainNotSupportedError({ connector });
|
|
151
|
-
const chain2 = await connector.switchChain({
|
|
152
|
-
addEthereumChainParameter,
|
|
153
|
-
chainId
|
|
154
|
-
});
|
|
155
|
-
return chain2;
|
|
156
|
-
}
|
|
157
|
-
const chain = config2.chains.find((x) => x.id === chainId);
|
|
158
|
-
if (!chain)
|
|
159
|
-
throw new ChainNotConfiguredError();
|
|
160
|
-
config2.setState((x) => ({ ...x, chainId }));
|
|
161
|
-
return chain;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// node_modules/@wagmi/core/dist/esm/exports/index.js
|
|
165
|
-
import { custom, http as http2, webSocket } from "viem";
|
|
166
|
-
|
|
167
|
-
// src/useWalletConnect.tsx
|
|
31
|
+
import { switchChain } from "@wagmi/core";
|
|
168
32
|
import { base as base2 } from "viem/chains";
|
|
169
33
|
var useWalletConnect = () => {
|
|
170
34
|
const { login, authenticated, user, logout, ready } = usePrivy();
|
|
@@ -627,119 +491,7 @@ var ModalPrivyConnect = () => {
|
|
|
627
491
|
|
|
628
492
|
// src/ModalPrivyWallets.tsx
|
|
629
493
|
import { useEffect as useEffect2, useState } from "react";
|
|
630
|
-
|
|
631
|
-
// node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
632
|
-
import { forwardRef as forwardRef2, createElement as createElement2 } from "react";
|
|
633
|
-
|
|
634
|
-
// node_modules/lucide-react/dist/esm/shared/src/utils.js
|
|
635
|
-
var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
636
|
-
var toCamelCase = (string) => string.replace(
|
|
637
|
-
/^([A-Z])|[\s-_]+(\w)/g,
|
|
638
|
-
(match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
|
|
639
|
-
);
|
|
640
|
-
var toPascalCase = (string) => {
|
|
641
|
-
const camelCase = toCamelCase(string);
|
|
642
|
-
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
643
|
-
};
|
|
644
|
-
var mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
|
645
|
-
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
646
|
-
}).join(" ").trim();
|
|
647
|
-
var hasA11yProp = (props) => {
|
|
648
|
-
for (const prop in props) {
|
|
649
|
-
if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
|
|
650
|
-
return true;
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
};
|
|
654
|
-
|
|
655
|
-
// node_modules/lucide-react/dist/esm/Icon.js
|
|
656
|
-
import { forwardRef, createElement } from "react";
|
|
657
|
-
|
|
658
|
-
// node_modules/lucide-react/dist/esm/defaultAttributes.js
|
|
659
|
-
var defaultAttributes = {
|
|
660
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
661
|
-
width: 24,
|
|
662
|
-
height: 24,
|
|
663
|
-
viewBox: "0 0 24 24",
|
|
664
|
-
fill: "none",
|
|
665
|
-
stroke: "currentColor",
|
|
666
|
-
strokeWidth: 2,
|
|
667
|
-
strokeLinecap: "round",
|
|
668
|
-
strokeLinejoin: "round"
|
|
669
|
-
};
|
|
670
|
-
|
|
671
|
-
// node_modules/lucide-react/dist/esm/Icon.js
|
|
672
|
-
var Icon = forwardRef(
|
|
673
|
-
({
|
|
674
|
-
color = "currentColor",
|
|
675
|
-
size = 24,
|
|
676
|
-
strokeWidth = 2,
|
|
677
|
-
absoluteStrokeWidth,
|
|
678
|
-
className = "",
|
|
679
|
-
children,
|
|
680
|
-
iconNode,
|
|
681
|
-
...rest
|
|
682
|
-
}, ref) => createElement(
|
|
683
|
-
"svg",
|
|
684
|
-
{
|
|
685
|
-
ref,
|
|
686
|
-
...defaultAttributes,
|
|
687
|
-
width: size,
|
|
688
|
-
height: size,
|
|
689
|
-
stroke: color,
|
|
690
|
-
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
|
|
691
|
-
className: mergeClasses("lucide", className),
|
|
692
|
-
...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
|
|
693
|
-
...rest
|
|
694
|
-
},
|
|
695
|
-
[
|
|
696
|
-
...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
|
|
697
|
-
...Array.isArray(children) ? children : [children]
|
|
698
|
-
]
|
|
699
|
-
)
|
|
700
|
-
);
|
|
701
|
-
|
|
702
|
-
// node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
703
|
-
var createLucideIcon = (iconName, iconNode) => {
|
|
704
|
-
const Component = forwardRef2(
|
|
705
|
-
({ className, ...props }, ref) => createElement2(Icon, {
|
|
706
|
-
ref,
|
|
707
|
-
iconNode,
|
|
708
|
-
className: mergeClasses(
|
|
709
|
-
`lucide-${toKebabCase(toPascalCase(iconName))}`,
|
|
710
|
-
`lucide-${iconName}`,
|
|
711
|
-
className
|
|
712
|
-
),
|
|
713
|
-
...props
|
|
714
|
-
})
|
|
715
|
-
);
|
|
716
|
-
Component.displayName = toPascalCase(iconName);
|
|
717
|
-
return Component;
|
|
718
|
-
};
|
|
719
|
-
|
|
720
|
-
// node_modules/lucide-react/dist/esm/icons/copy.js
|
|
721
|
-
var __iconNode = [
|
|
722
|
-
["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
|
|
723
|
-
["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
|
|
724
|
-
];
|
|
725
|
-
var Copy = createLucideIcon("copy", __iconNode);
|
|
726
|
-
|
|
727
|
-
// node_modules/lucide-react/dist/esm/icons/external-link.js
|
|
728
|
-
var __iconNode2 = [
|
|
729
|
-
["path", { d: "M15 3h6v6", key: "1q9fwt" }],
|
|
730
|
-
["path", { d: "M10 14 21 3", key: "gplh6r" }],
|
|
731
|
-
["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
|
|
732
|
-
];
|
|
733
|
-
var ExternalLink = createLucideIcon("external-link", __iconNode2);
|
|
734
|
-
|
|
735
|
-
// node_modules/lucide-react/dist/esm/icons/x.js
|
|
736
|
-
var __iconNode3 = [
|
|
737
|
-
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
738
|
-
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
739
|
-
];
|
|
740
|
-
var X = createLucideIcon("x", __iconNode3);
|
|
741
|
-
|
|
742
|
-
// src/ModalPrivyWallets.tsx
|
|
494
|
+
import { X, Copy, ExternalLink } from "lucide-react";
|
|
743
495
|
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
744
496
|
var formatAddress = (address) => {
|
|
745
497
|
if (!address) return "";
|
|
@@ -908,20 +660,3 @@ function WhatWagmiProvider({
|
|
|
908
660
|
export {
|
|
909
661
|
WhatWagmiProvider
|
|
910
662
|
};
|
|
911
|
-
/*! Bundled license information:
|
|
912
|
-
|
|
913
|
-
lucide-react/dist/esm/shared/src/utils.js:
|
|
914
|
-
lucide-react/dist/esm/defaultAttributes.js:
|
|
915
|
-
lucide-react/dist/esm/Icon.js:
|
|
916
|
-
lucide-react/dist/esm/createLucideIcon.js:
|
|
917
|
-
lucide-react/dist/esm/icons/copy.js:
|
|
918
|
-
lucide-react/dist/esm/icons/external-link.js:
|
|
919
|
-
lucide-react/dist/esm/icons/x.js:
|
|
920
|
-
lucide-react/dist/esm/lucide-react.js:
|
|
921
|
-
(**
|
|
922
|
-
* @license lucide-react v0.554.0 - ISC
|
|
923
|
-
*
|
|
924
|
-
* This source code is licensed under the ISC license.
|
|
925
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
926
|
-
*)
|
|
927
|
-
*/
|
package/package.json
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adapter-connect",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
-
"
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.mjs",
|
|
10
|
+
"require": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
8
17
|
"scripts": {
|
|
9
18
|
"build": "tsup",
|
|
10
19
|
"prepublishOnly": "npm run build"
|
|
@@ -14,17 +23,20 @@
|
|
|
14
23
|
},
|
|
15
24
|
"dependencies": {
|
|
16
25
|
"@privy-io/react-auth": "^3.0.0",
|
|
26
|
+
"@wagmi/core": "^3.0.0",
|
|
17
27
|
"lodash": "^4.17.21",
|
|
28
|
+
"lucide-react": "^0.562.0",
|
|
18
29
|
"viem": "^2.22.9",
|
|
19
30
|
"wagmi": "^2.14.16"
|
|
20
31
|
},
|
|
21
32
|
"devDependencies": {
|
|
33
|
+
"@types/lodash": "^4.17.21",
|
|
22
34
|
"@types/node": "^22.15.21",
|
|
23
35
|
"@types/react": "^18.2.38",
|
|
24
36
|
"@types/react-dom": "^18.2.17",
|
|
37
|
+
"tailwindcss": "^3.4.3",
|
|
25
38
|
"tsup": "^8.5.1",
|
|
26
|
-
"typescript": "^5.9.3"
|
|
27
|
-
"tailwindcss": "^3.4.3"
|
|
39
|
+
"typescript": "^5.9.3"
|
|
28
40
|
},
|
|
29
41
|
"peerDependencies": {
|
|
30
42
|
"react": ">=18",
|