Skip to content

Commit

Permalink
Build: (4b94056) Refactor connector enabling/disabling options (#159)
Browse files Browse the repository at this point in the history
* Refactor connector enabling/disabling options

* Updating README and examples for new connector config
  • Loading branch information
corbanbrook committed Oct 3, 2024
1 parent 6fd739a commit 736c252
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 64 deletions.
2 changes: 1 addition & 1 deletion assets/ccip-XgLXf-gm.js → assets/ccip-CxL6bFVJ.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { f as BaseError, h as getUrl, s as stringify, i as decodeErrorResult, j as isAddressEqual, k as call, l as concat, m as encodeAbiParameters, H as HttpRequestError, n as isHex } from "./index-CWBAsnr3.js";
import { f as BaseError, h as getUrl, s as stringify, i as decodeErrorResult, j as isAddressEqual, k as call, l as concat, m as encodeAbiParameters, H as HttpRequestError, n as isHex } from "./index-BhMw1gK2.js";
class OffchainLookupError extends BaseError {
constructor({ callbackSelector, cause, data, extraData, sender, urls }) {
var _a;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { p as process$1, c as commonjsGlobal, B as Buffer$7, a as getAugmentedNamespace } from "./index-CWBAsnr3.js";
import { e as eventsExports, r as require$$0$1, a as require$$0$2, i as inherits_browserExports } from "./inherits_browser-DgGu3QDl.js";
import { p as process$1, c as commonjsGlobal, B as Buffer$7, a as getAugmentedNamespace } from "./index-BhMw1gK2.js";
import { e as eventsExports, r as require$$0$1, a as require$$0$2, i as inherits_browserExports } from "./inherits_browser-DTGd2Otu.js";
var readableBrowser = { exports: {} };
var streamBrowser = eventsExports.EventEmitter;
var buffer_list;
Expand Down
121 changes: 76 additions & 45 deletions assets/index-CWBAsnr3.js → assets/index-BhMw1gK2.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-D2U_GLHi.js","./hooks.module-DwKr4YEl.js","./inherits_browser-DgGu3QDl.js","./index-CGSWxPxs.js","./index.es-_Rk8O_FW.js"])))=>i.map(i=>d[i]);
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-w36ed5XJ.js","./hooks.module-BrgRyP7Z.js","./inherits_browser-DTGd2Otu.js","./index-DU4nszWG.js","./index.es-DUtzAiMf.js"])))=>i.map(i=>d[i]);
var __defProp = Object.defineProperty;
var __typeError = (msg) => {
throw TypeError(msg);
Expand Down Expand Up @@ -32993,7 +32993,7 @@ async function call(client2, args) {
} catch (err) {
const data2 = getRevertErrorData(err);
const { offchainLookup, offchainLookupSignature } = await __vitePreload(async () => {
const { offchainLookup: offchainLookup2, offchainLookupSignature: offchainLookupSignature2 } = await import("./ccip-XgLXf-gm.js");
const { offchainLookup: offchainLookup2, offchainLookupSignature: offchainLookupSignature2 } = await import("./ccip-CxL6bFVJ.js");
return { offchainLookup: offchainLookup2, offchainLookupSignature: offchainLookupSignature2 };
}, true ? [] : void 0, import.meta.url);
if (client2.ccipRead !== false && (data2 == null ? void 0 : data2.slice(0, 10)) === offchainLookupSignature && to)
Expand Down Expand Up @@ -98461,7 +98461,7 @@ function version4(parameters) {
if (!walletProvider) {
const CoinbaseWalletSDK = await (async () => {
const { default: SDK } = await __vitePreload(async () => {
const { default: SDK2 } = await import("./index-D2U_GLHi.js").then((n2) => n2.i);
const { default: SDK2 } = await import("./index-w36ed5XJ.js").then((n2) => n2.i);
return { default: SDK2 };
}, true ? __vite__mapDeps([0,1,2]) : void 0, import.meta.url);
if (typeof SDK !== "function" && typeof SDK.default === "function")
Expand Down Expand Up @@ -98643,7 +98643,7 @@ function version3(parameters) {
if (!walletProvider) {
const CoinbaseWalletSDK = await (async () => {
const { default: SDK } = await __vitePreload(async () => {
const { default: SDK2 } = await import("./index-CGSWxPxs.js").then((n2) => n2.i);
const { default: SDK2 } = await import("./index-DU4nszWG.js").then((n2) => n2.i);
return { default: SDK2 };
}, true ? __vite__mapDeps([3,2,1]) : void 0, import.meta.url);
if (typeof SDK !== "function" && typeof SDK.default === "function")
Expand Down Expand Up @@ -98879,7 +98879,7 @@ function walletConnect$1(parameters) {
if (!optionalChains.length)
return;
const { EthereumProvider } = await __vitePreload(async () => {
const { EthereumProvider: EthereumProvider2 } = await import("./index.es-_Rk8O_FW.js");
const { EthereumProvider: EthereumProvider2 } = await import("./index.es-DUtzAiMf.js");
return { EthereumProvider: EthereumProvider2 };
}, true ? __vite__mapDeps([4,2]) : void 0, import.meta.url);
return await EthereumProvider.init({
Expand Down Expand Up @@ -99327,90 +99327,113 @@ const getDefaultConnectors = (walletType2, options) => {
return getDefaultUniversalConnectors(options);
}
};
const getDefaultWaasConnectors = ({ appName, projectAccessKey: projectAccessKey2, defaultChainId, walletConnectProjectId: walletConnectProjectId2, waasConfigKey, googleClientId, appleClientId, appleRedirectURI, enableConfirmationModal, legacyEmailAuth = false, isDev = false }) => {
const wallets = [
emailWaas({
const getDefaultWaasConnectors = (options) => {
var _a2;
const { projectAccessKey: projectAccessKey2, waasConfigKey, appName, enableConfirmationModal, defaultChainId, isDev } = options;
const wallets = [];
if (options.email !== false) {
wallets.push(emailWaas({
projectAccessKey: projectAccessKey2,
waasConfigKey,
enableConfirmationModal,
network: defaultChainId,
legacyEmailAuth,
legacyEmailAuth: typeof options.email === "object" && options.email.legacyEmailAuth || options.legacyEmailAuth,
isDev
}),
coinbaseWallet({
appName
})
];
if (walletConnectProjectId2) {
wallets.push(walletConnect({
projectId: walletConnectProjectId2
}));
}
if (googleClientId) {
if (options.google || options.googleClientId) {
const googleClientId = options.google && options.google.clientId || options.googleClientId;
wallets.push(googleWaas({
projectAccessKey: projectAccessKey2,
googleClientId,
waasConfigKey,
googleClientId,
enableConfirmationModal,
network: defaultChainId,
isDev
}));
}
if (appleClientId && appleRedirectURI) {
if (options.apple || options.appleClientId && options.appleRedirectURI) {
const appleClientId = options.apple && options.apple.clientId || options.appleClientId;
const appleRedirectURI = options.apple && options.apple.redirectURI || options.appleRedirectURI;
wallets.push(appleWaas({
projectAccessKey: projectAccessKey2,
waasConfigKey,
appleClientId,
appleRedirectURI,
waasConfigKey,
enableConfirmationModal,
network: defaultChainId,
isDev
}));
}
if (options.coinbase !== false) {
wallets.push(coinbaseWallet({
appName
}));
}
if (options.walletConnect || options.walletConnectProjectId) {
const projectId = options.walletConnect && ((_a2 = options.walletConnect) == null ? void 0 : _a2.projectId) || options.walletConnectProjectId;
wallets.push(walletConnect({
projectId
}));
}
return getKitConnectWallets(projectAccessKey2, wallets);
};
const getDefaultUniversalConnectors = ({ appName, projectAccessKey: projectAccessKey2, defaultChainId, walletConnectProjectId: walletConnectProjectId2 }) => {
const wallets = [
email({
const getDefaultUniversalConnectors = (options) => {
var _a2;
const { projectAccessKey: projectAccessKey2, appName, defaultChainId } = options;
const wallets = [];
if (options.email !== false) {
wallets.push(email({
defaultNetwork: defaultChainId,
connect: {
app: appName
}
}),
google({
}));
}
if (options.google !== false) {
wallets.push(google({
defaultNetwork: defaultChainId,
connect: {
app: appName
}
}),
facebook({
}));
}
if (options.facebook !== false) {
wallets.push(facebook({
defaultNetwork: defaultChainId,
connect: {
app: appName
}
}),
twitch({
}));
}
if (options.twitch !== false) {
wallets.push(twitch({
defaultNetwork: defaultChainId,
connect: {
app: appName
}
}),
apple({
}));
}
if (options.apple !== false) {
wallets.push(apple({
defaultNetwork: defaultChainId,
connect: {
app: appName
}
}),
sequence({
}));
}
if (options.sequence !== false) {
wallets.push(sequence({
defaultNetwork: defaultChainId,
connect: {
app: appName
}
})
];
if (walletConnectProjectId2) {
}));
}
if (options.walletConnect || options.walletConnectProjectId) {
const projectId = options.walletConnect && ((_a2 = options.walletConnect) == null ? void 0 : _a2.projectId) || options.walletConnectProjectId;
wallets.push(walletConnect({
projectId: walletConnectProjectId2
projectId
}));
}
return getKitConnectWallets(projectAccessKey2, wallets);
Expand Down Expand Up @@ -110973,20 +110996,28 @@ const kitConfig = {
const config = walletType === "waas" ? createConfig("waas", {
...kitConfig,
appName: "Kit Demo",
walletConnectProjectId,
chainIds: [ChainId.ARBITRUM_NOVA, ChainId.ARBITRUM_SEPOLIA, ChainId.POLYGON],
defaultChainId: ChainId.ARBITRUM_NOVA,
waasConfigKey: isDebugMode ? "eyJwcm9qZWN0SWQiOjY5NCwicnBjU2VydmVyIjoiaHR0cHM6Ly9kZXYtd2Fhcy5zZXF1ZW5jZS5hcHAiLCJlbWFpbFJlZ2lvbiI6ImNhLWNlbnRyYWwtMSIsImVtYWlsQ2xpZW50SWQiOiI1NGF0bjV1cGk2M3FjNTlhMWVtM3ZiaHJzbiJ9" : "eyJwcm9qZWN0SWQiOjE2ODE1LCJlbWFpbFJlZ2lvbiI6ImNhLWNlbnRyYWwtMSIsImVtYWlsQ2xpZW50SWQiOiI2N2V2NXVvc3ZxMzVmcGI2OXI3NnJoYnVoIiwicnBjU2VydmVyIjoiaHR0cHM6Ly93YWFzLnNlcXVlbmNlLmFwcCJ9",
googleClientId: isDebugMode ? "603294233249-6h5saeg2uiu8akpcbar3r2aqjp6j7oem.apps.googleusercontent.com" : "970987756660-35a6tc48hvi8cev9cnknp0iugv9poa23.apps.googleusercontent.com",
appleClientId: "com.horizon.sequence.waas",
appleRedirectURI: window.location.origin + window.location.pathname,
enableConfirmationModal: localStorage.getItem("confirmationEnabled") === "true"
enableConfirmationModal: localStorage.getItem("confirmationEnabled") === "true",
google: {
clientId: isDebugMode ? "603294233249-6h5saeg2uiu8akpcbar3r2aqjp6j7oem.apps.googleusercontent.com" : "970987756660-35a6tc48hvi8cev9cnknp0iugv9poa23.apps.googleusercontent.com"
},
apple: {
clientId: "com.horizon.sequence.waas",
redirectURI: window.location.origin + window.location.pathname
},
walletConnect: {
projectId: walletConnectProjectId
}
}) : createConfig("universal", {
...kitConfig,
appName: "Kit Demo",
walletConnectProjectId,
chainIds: [ChainId.ARBITRUM_NOVA, ChainId.ARBITRUM_SEPOLIA, ChainId.POLYGON],
defaultChainId: ChainId.ARBITRUM_NOVA
defaultChainId: ChainId.ARBITRUM_NOVA,
walletConnect: {
projectId: walletConnectProjectId
}
});
const App = () => {
return /* @__PURE__ */ jsxRuntimeExports$1.jsx(ThemeProvider, { theme: "dark", children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(SequenceKit, { config, children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(KitWalletProvider, { children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(KitCheckoutProvider, { children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(Homepage, {}) }) }) }) });
Expand Down
4 changes: 2 additions & 2 deletions assets/index-Ct_CIen2.js → assets/index-CQhjFZlr.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { n as ne$1, s as se$1, T as T$2, t as te$1, a as a$2, o as oe$1, R as R$1, p as p$1, y as y$1 } from "./index-Mv20QOIl.js";
import "./index-CWBAsnr3.js";
import { n as ne$1, s as se$1, T as T$2, t as te$1, a as a$2, o as oe$1, R as R$1, p as p$1, y as y$1 } from "./index-DjDbmvaZ.js";
import "./index-BhMw1gK2.js";
function addUniqueItem(array, item) {
array.indexOf(item) === -1 && array.push(item);
}
Expand Down
6 changes: 3 additions & 3 deletions assets/index-CGSWxPxs.js → assets/index-DU4nszWG.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { c as commonjsGlobal, B as Buffer, a as getAugmentedNamespace, p as process$1, t as tslib_es6, e as eventemitter3Exports, g as getDefaultExportFromCjs } from "./index-CWBAsnr3.js";
import { r as require$$0$1, e as eventsExports } from "./inherits_browser-DgGu3QDl.js";
import { s as sha_jsExports, a as require$$1$1, b as require$$2, r as require$$0$2, j as js } from "./hooks.module-DwKr4YEl.js";
import { c as commonjsGlobal, B as Buffer, a as getAugmentedNamespace, p as process$1, t as tslib_es6, e as eventemitter3Exports, g as getDefaultExportFromCjs } from "./index-BhMw1gK2.js";
import { r as require$$0$1, e as eventsExports } from "./inherits_browser-DTGd2Otu.js";
import { s as sha_jsExports, a as require$$1$1, b as require$$2, r as require$$0$2, j as js } from "./hooks.module-BrgRyP7Z.js";
var dist$5 = {};
var CoinbaseWalletSDK$1 = {};
var walletLogo$1 = {};
Expand Down
6 changes: 3 additions & 3 deletions assets/index-Mv20QOIl.js → assets/index-DjDbmvaZ.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-Ct_CIen2.js","./index-CWBAsnr3.js","./index-g_cLYwVj.css"])))=>i.map(i=>d[i]);
import { _ as __vitePreload } from "./index-CWBAsnr3.js";
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-CQhjFZlr.js","./index-BhMw1gK2.js","./index-g_cLYwVj.css"])))=>i.map(i=>d[i]);
import { _ as __vitePreload } from "./index-BhMw1gK2.js";
const t = Symbol();
const s = Object.getPrototypeOf, c$1 = /* @__PURE__ */ new WeakMap(), l = (e) => e && (c$1.has(e) ? c$1.get(e) : s(e) === Object.prototype || s(e) === Array.prototype), y$1 = (e) => l(e) && e[t] || null, h = (e, t2 = true) => {
c$1.set(e, t2);
Expand Down Expand Up @@ -472,7 +472,7 @@ class d {
}
async initUi() {
if (typeof window < "u") {
await __vitePreload(() => import("./index-Ct_CIen2.js"), true ? __vite__mapDeps([0,1,2]) : void 0, import.meta.url);
await __vitePreload(() => import("./index-CQhjFZlr.js"), true ? __vite__mapDeps([0,1,2]) : void 0, import.meta.url);
const e = document.createElement("wcm-modal");
document.body.insertAdjacentElement("beforeend", e), p.setIsUiLoaded(true);
}
Expand Down
4 changes: 2 additions & 2 deletions assets/index-D2U_GLHi.js → assets/index-w36ed5XJ.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { B as Buffer, c as commonjsGlobal, e as eventemitter3Exports, g as getDefaultExportFromCjs } from "./index-CWBAsnr3.js";
import { j as js, s as sha_jsExports, r as require$$0, a as require$$1, b as require$$2 } from "./hooks.module-DwKr4YEl.js";
import { B as Buffer, c as commonjsGlobal, e as eventemitter3Exports, g as getDefaultExportFromCjs } from "./index-BhMw1gK2.js";
import { j as js, s as sha_jsExports, r as require$$0, a as require$$1, b as require$$2 } from "./hooks.module-BrgRyP7Z.js";
var dist = {};
var CoinbaseWalletSDK$1 = {};
var walletLogo$1 = {};
Expand Down
8 changes: 4 additions & 4 deletions assets/index.es-_Rk8O_FW.js → assets/index.es-DUtzAiMf.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-Mv20QOIl.js","./index-CWBAsnr3.js","./index-g_cLYwVj.css"])))=>i.map(i=>d[i]);
import { p as process$1, a as getAugmentedNamespace, c as commonjsGlobal, b as global, B as Buffer, g as getDefaultExportFromCjs, _ as __vitePreload } from "./index-CWBAsnr3.js";
import { a as require$$0$2, r as require$$0$3, i as inherits_browserExports, e as eventsExports, G as Gg } from "./inherits_browser-DgGu3QDl.js";
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-DjDbmvaZ.js","./index-BhMw1gK2.js","./index-g_cLYwVj.css"])))=>i.map(i=>d[i]);
import { p as process$1, a as getAugmentedNamespace, c as commonjsGlobal, b as global, B as Buffer, g as getDefaultExportFromCjs, _ as __vitePreload } from "./index-BhMw1gK2.js";
import { a as require$$0$2, r as require$$0$3, i as inherits_browserExports, e as eventsExports, G as Gg } from "./inherits_browser-DTGd2Otu.js";
var __spreadArray = function(to2, from2, pack) {
if (pack || arguments.length === 2) for (var i3 = 0, l2 = from2.length, ar2; i3 < l2; i3++) {
if (ar2 || !(i3 in from2)) {
Expand Down Expand Up @@ -27392,7 +27392,7 @@ class C2 {
if (this.rpc = this.getRpcConfig(t), this.chainId = this.rpc.chains.length ? m2(this.rpc.chains) : m2(this.rpc.optionalChains), this.signer = await Iv.init({ projectId: this.rpc.projectId, metadata: this.rpc.metadata, disableProviderPing: t.disableProviderPing, relayUrl: t.relayUrl, storageOptions: t.storageOptions, customStoragePrefix: t.customStoragePrefix, telemetryEnabled: t.telemetryEnabled }), this.registerEventListeners(), await this.loadPersistedSession(), this.rpc.showQrModal) {
let s2;
try {
const { WalletConnectModal: i3 } = await __vitePreload(() => import("./index-Mv20QOIl.js").then((n4) => n4.i), true ? __vite__mapDeps([0,1,2]) : void 0, import.meta.url);
const { WalletConnectModal: i3 } = await __vitePreload(() => import("./index-DjDbmvaZ.js").then((n4) => n4.i), true ? __vite__mapDeps([0,1,2]) : void 0, import.meta.url);
s2 = i3;
} catch {
throw new Error("To use QR modal, please install @walletconnect/modal package");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { g as getDefaultExportFromCjs, a as getAugmentedNamespace, d as dist } from "./index-CWBAsnr3.js";
import { g as getDefaultExportFromCjs, a as getAugmentedNamespace, d as dist } from "./index-BhMw1gK2.js";
var events = { exports: {} };
var R = typeof Reflect === "object" ? Reflect : null;
var ReflectApply = R && typeof R.apply === "function" ? R.apply : function ReflectApply2(target, receiver, args) {
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Sequence Kit Demo</title>
<script type="module" crossorigin src="./assets/index-CWBAsnr3.js"></script>
<script type="module" crossorigin src="./assets/index-BhMw1gK2.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-g_cLYwVj.css">
</head>
<body>
Expand Down

0 comments on commit 736c252

Please sign in to comment.