adapter-connect 0.0.2 → 1.0.0
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 +14 -281
- package/dist/index.mjs +2 -269
- package/package.json +8 -4
package/dist/index.js
CHANGED
|
@@ -62,145 +62,7 @@ var import_chains3 = require("viem/chains");
|
|
|
62
62
|
var import_react_auth = require("@privy-io/react-auth");
|
|
63
63
|
var import_react = require("react");
|
|
64
64
|
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
|
|
65
|
+
var import_core = require("@wagmi/core");
|
|
204
66
|
var import_chains2 = require("viem/chains");
|
|
205
67
|
var useWalletConnect = () => {
|
|
206
68
|
const { login, authenticated, user, logout, ready } = (0, import_react_auth.usePrivy)();
|
|
@@ -220,7 +82,7 @@ var useWalletConnect = () => {
|
|
|
220
82
|
try {
|
|
221
83
|
const wallet = wallets.find((wallet2) => wallet2.address.toString() === (address == null ? void 0 : address.toString()));
|
|
222
84
|
wallet == null ? void 0 : wallet.switchChain(import_chains2.base.id);
|
|
223
|
-
switchChain(config, { chainId: import_chains2.base.id });
|
|
85
|
+
(0, import_core.switchChain)(config, { chainId: import_chains2.base.id });
|
|
224
86
|
} catch (error) {
|
|
225
87
|
console.error("Failed to switch chain:", error);
|
|
226
88
|
}
|
|
@@ -662,127 +524,15 @@ var ModalPrivyConnect = () => {
|
|
|
662
524
|
};
|
|
663
525
|
|
|
664
526
|
// 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
527
|
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
|
|
528
|
+
var import_lucide_react = require("lucide-react");
|
|
779
529
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
780
530
|
var formatAddress = (address) => {
|
|
781
531
|
if (!address) return "";
|
|
782
532
|
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
783
533
|
};
|
|
784
534
|
var CopyAddress = ({ address }) => {
|
|
785
|
-
const [copied, setCopied] = (0,
|
|
535
|
+
const [copied, setCopied] = (0, import_react3.useState)(false);
|
|
786
536
|
const handleCopy = async () => {
|
|
787
537
|
try {
|
|
788
538
|
await navigator.clipboard.writeText(address);
|
|
@@ -797,23 +547,23 @@ var CopyAddress = ({ address }) => {
|
|
|
797
547
|
{
|
|
798
548
|
onClick: handleCopy,
|
|
799
549
|
className: " transition-colors duration-200 cursor-pointer",
|
|
800
|
-
children: copied ? "\u2713 Copied!" : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Copy, { className: "w-4 h-4" })
|
|
550
|
+
children: copied ? "\u2713 Copied!" : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.Copy, { className: "w-4 h-4" })
|
|
801
551
|
}
|
|
802
552
|
);
|
|
803
553
|
};
|
|
804
554
|
var ModalPrivyWallet = () => {
|
|
805
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
555
|
+
const [isExpanded, setIsExpanded] = (0, import_react3.useState)(true);
|
|
806
556
|
const { address, disconnect } = useWalletConnect();
|
|
807
|
-
const [isOpen, setIsOpen] = (0,
|
|
808
|
-
const [isClosing, setIsClosing] = (0,
|
|
809
|
-
const [isVisible, setIsVisible] = (0,
|
|
557
|
+
const [isOpen, setIsOpen] = (0, import_react3.useState)(false);
|
|
558
|
+
const [isClosing, setIsClosing] = (0, import_react3.useState)(false);
|
|
559
|
+
const [isVisible, setIsVisible] = (0, import_react3.useState)(false);
|
|
810
560
|
const safeAddress = address != null ? address : "";
|
|
811
|
-
(0,
|
|
561
|
+
(0, import_react3.useEffect)(() => {
|
|
812
562
|
window.openModalPrivyWallet = () => {
|
|
813
563
|
setIsOpen(true);
|
|
814
564
|
};
|
|
815
565
|
}, []);
|
|
816
|
-
(0,
|
|
566
|
+
(0, import_react3.useEffect)(() => {
|
|
817
567
|
if (isOpen) {
|
|
818
568
|
setIsVisible(false);
|
|
819
569
|
const t = requestAnimationFrame(() => setIsVisible(true));
|
|
@@ -822,7 +572,7 @@ var ModalPrivyWallet = () => {
|
|
|
822
572
|
setIsVisible(false);
|
|
823
573
|
}
|
|
824
574
|
}, [isOpen]);
|
|
825
|
-
(0,
|
|
575
|
+
(0, import_react3.useEffect)(() => {
|
|
826
576
|
if (isOpen) {
|
|
827
577
|
const previous = document.body.style.overflow;
|
|
828
578
|
document.body.style.overflow = "hidden";
|
|
@@ -882,7 +632,7 @@ var ModalPrivyWallet = () => {
|
|
|
882
632
|
/* @__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
633
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "oui-flex oui-flex-none oui-items-center oui-justify-between", children: [
|
|
884
634
|
/* @__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 }) })
|
|
635
|
+
/* @__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
636
|
] }),
|
|
887
637
|
/* @__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
638
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
@@ -903,7 +653,7 @@ var ModalPrivyWallet = () => {
|
|
|
903
653
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "oui-text-sm oui-font-semibold oui-text-base-contrast", children: formatAddress(safeAddress) }),
|
|
904
654
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "oui-flex oui-items-center oui-justify-center oui-gap-2", children: [
|
|
905
655
|
/* @__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 }) })
|
|
656
|
+
/* @__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
657
|
] })
|
|
908
658
|
] }) })
|
|
909
659
|
] }) }) })
|
|
@@ -945,20 +695,3 @@ function WhatWagmiProvider({
|
|
|
945
695
|
0 && (module.exports = {
|
|
946
696
|
WhatWagmiProvider
|
|
947
697
|
});
|
|
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
|
@@ -26,145 +26,7 @@ import { arbitrum, arbitrumSepolia } from "viem/chains";
|
|
|
26
26
|
import { usePrivy, useWallets } from "@privy-io/react-auth";
|
|
27
27
|
import { useMemo } from "react";
|
|
28
28
|
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
|
|
29
|
+
import { switchChain } from "@wagmi/core";
|
|
168
30
|
import { base as base2 } from "viem/chains";
|
|
169
31
|
var useWalletConnect = () => {
|
|
170
32
|
const { login, authenticated, user, logout, ready } = usePrivy();
|
|
@@ -627,119 +489,7 @@ var ModalPrivyConnect = () => {
|
|
|
627
489
|
|
|
628
490
|
// src/ModalPrivyWallets.tsx
|
|
629
491
|
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
|
|
492
|
+
import { X, Copy, ExternalLink } from "lucide-react";
|
|
743
493
|
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
744
494
|
var formatAddress = (address) => {
|
|
745
495
|
if (!address) return "";
|
|
@@ -908,20 +658,3 @@ function WhatWagmiProvider({
|
|
|
908
658
|
export {
|
|
909
659
|
WhatWagmiProvider
|
|
910
660
|
};
|
|
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,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adapter-connect",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
-
"files": [
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
8
10
|
"scripts": {
|
|
9
11
|
"build": "tsup",
|
|
10
12
|
"prepublishOnly": "npm run build"
|
|
@@ -14,7 +16,9 @@
|
|
|
14
16
|
},
|
|
15
17
|
"dependencies": {
|
|
16
18
|
"@privy-io/react-auth": "^3.0.0",
|
|
19
|
+
"@wagmi/core": "^3.0.0",
|
|
17
20
|
"lodash": "^4.17.21",
|
|
21
|
+
"lucide-react": "^0.562.0",
|
|
18
22
|
"viem": "^2.22.9",
|
|
19
23
|
"wagmi": "^2.14.16"
|
|
20
24
|
},
|
|
@@ -22,9 +26,9 @@
|
|
|
22
26
|
"@types/node": "^22.15.21",
|
|
23
27
|
"@types/react": "^18.2.38",
|
|
24
28
|
"@types/react-dom": "^18.2.17",
|
|
29
|
+
"tailwindcss": "^3.4.3",
|
|
25
30
|
"tsup": "^8.5.1",
|
|
26
|
-
"typescript": "^5.9.3"
|
|
27
|
-
"tailwindcss": "^3.4.3"
|
|
31
|
+
"typescript": "^5.9.3"
|
|
28
32
|
},
|
|
29
33
|
"peerDependencies": {
|
|
30
34
|
"react": ">=18",
|