UNPKG

@kryptogo/kryptogokit-sdk-react

Version:

KryptogoKit offers a comprehensive web3 wallet solution with seamless KryptoGO Auth integration and multi-wallet connection support. Designed for users. Built for developers.

156 lines (152 loc) 7.38 kB
"use client"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); // src/wallets/walletConnectors/talismanWallet/talismanWallet.svg var require_talismanWallet = __commonJS({ "src/wallets/walletConnectors/talismanWallet/talismanWallet.svg"(exports, module) { module.exports = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" fill="none"><path fill="%23D5FF5C" d="M0 0h28v28H0z"/><path fill="%23FD4848" fill-rule="evenodd" d="M20.186 15.25c.208.453.82.613 1.17.261l.646-.645a1.708 1.708 0 0 1 2.415 2.414l-5.215 5.215a6.816 6.816 0 0 1-5.225 2.432A6.817 6.817 0 0 1 8.594 22.3l-5.02-5.02a1.707 1.707 0 0 1 2.414-2.415l.635.635c.344.345.942.19 1.145-.253a.663.663 0 0 0 .062-.277v-7.8a1.707 1.707 0 0 1 3.415 0v3.946c0 .34.348.57.671.468a.497.497 0 0 0 .354-.467V4.78a1.707 1.707 0 1 1 3.414 0v6.338c0 .216.148.402.353.466.323.103.671-.128.671-.467V7.17a1.707 1.707 0 0 1 3.415 0v7.797c0 .098.022.194.063.283Z" clip-rule="evenodd"/><path fill="%23D5FF5C" d="M19.44 18.78s-2.446 3.415-5.463 3.415-5.463-3.415-5.463-3.415 2.446-3.414 5.463-3.414 5.463 3.415 5.463 3.415Z"/><path stroke="%23FD4848" stroke-width="1.003" d="M16.537 18.78a2.561 2.561 0 1 1-5.12 0 2.56 2.56 0 0 1 5.12 0Z"/><path stroke="%23FD4848" stroke-width="1.003" d="M15.513 18.78a1.538 1.538 0 0 1-2.63 1.102 1.537 1.537 0 0 1-.442-1.102 1.536 1.536 0 0 1 3.072 0Z"/><path stroke="%23FD4848" stroke-width="1.003" d="M17.562 18.78a3.585 3.585 0 1 1-7.17 0 3.585 3.585 0 0 1 7.17 0Z"/><path stroke="%23FD4848" stroke-width="1.003" d="M18.586 18.78a4.609 4.609 0 1 1-9.218 0 4.609 4.609 0 0 1 9.218 0Z"/><path fill="%23FD4848" stroke="%23FD4848" stroke-width="1.003" d="M14.489 18.78a.51.51 0 0 1-.512.526.511.511 0 1 1 .512-.526Z"/><path stroke="%23D5FF5C" stroke-width="1.003" d="M8.76 18.822a7.77 7.77 0 0 1-.032-.041l.032-.042c.44-.557.93-1.071 1.466-1.536.978-.845 2.305-1.666 3.751-1.666 1.447 0 2.773.821 3.752 1.666.535.465 1.026.98 1.466 1.536l.032.041a11.328 11.328 0 0 1-1.498 1.578c-.979.845-2.305 1.666-3.752 1.666-1.446 0-2.773-.821-3.75-1.666a11.333 11.333 0 0 1-1.467-1.536Z"/></svg>'; } }); // src/wallets/getInjectedConnector.ts import { createConnector } from "wagmi"; import { injected } from "wagmi/connectors"; function getExplicitInjectedProvider(flag) { const _window = typeof window !== "undefined" ? window : void 0; if (typeof _window === "undefined" || typeof _window.ethereum === "undefined") return; const providers = _window.ethereum.providers; return providers ? providers.find((provider) => provider[flag]) : _window.ethereum[flag] ? _window.ethereum : void 0; } function getWindowProviderNamespace(namespace) { const providerSearch = (provider, namespace2) => { const [property, ...path] = namespace2.split("."); const _provider = provider[property]; if (_provider) { if (path.length === 0) return _provider; return providerSearch(_provider, path.join(".")); } }; if (typeof window !== "undefined") return providerSearch(window, namespace); } function hasInjectedProvider({ flag, namespace }) { if (namespace && typeof getWindowProviderNamespace(namespace) !== "undefined") return true; if (flag && typeof getExplicitInjectedProvider(flag) !== "undefined") return true; return false; } function getInjectedProvider({ flag, namespace }) { const _window = typeof window !== "undefined" ? window : void 0; if (typeof _window === "undefined") return; if (namespace) { const windowProvider = getWindowProviderNamespace(namespace); if (windowProvider) return windowProvider; } const providers = _window.ethereum?.providers; if (flag) { const provider = getExplicitInjectedProvider(flag); if (provider) return provider; } if (typeof providers !== "undefined" && providers.length > 0) return providers[0]; return _window.ethereum; } function createInjectedConnector(provider) { return (walletDetails) => { const injectedConfig = provider ? { shimDisconnect: false, target: () => ({ id: walletDetails.rkDetails.id, name: walletDetails.rkDetails.name, provider }) } : { shimDisconnect: false }; return createConnector((config) => ({ // Spread the injectedConfig object, which may be empty or contain the target function ...injected(injectedConfig)(config), ...walletDetails })); }; } function getInjectedConnector({ flag, namespace, target }) { const provider = target ? target : getInjectedProvider({ flag, namespace }); return createInjectedConnector(provider); } // src/wallets/walletConnectors/talismanWallet/talismanWallet.ts var talismanWallet = () => ({ id: "talisman", name: "Talisman", rdns: "xyz.talisman", iconUrl: async () => (await Promise.resolve().then(() => __toESM(require_talismanWallet(), 1))).default, iconBackground: "#fff", installed: hasInjectedProvider({ namespace: "talismanEth", flag: "isTalisman" }), downloadUrls: { chrome: "https://chrome.google.com/webstore/detail/talisman-polkadot-wallet/fijngjgcjhjmmpcmkeiomlglpeiijkld", firefox: "https://addons.mozilla.org/en-US/firefox/addon/talisman-wallet-extension/", browserExtension: "https://talisman.xyz/download" }, extension: { instructions: { learnMoreUrl: "https://talisman.xyz/", steps: [ { description: "wallet_connectors.talisman.extension.step1.description", step: "install", title: "wallet_connectors.talisman.extension.step1.title" }, { description: "wallet_connectors.talisman.extension.step2.description", step: "create", title: "wallet_connectors.talisman.extension.step2.title" }, { description: "wallet_connectors.talisman.extension.step3.description", step: "refresh", title: "wallet_connectors.talisman.extension.step3.title" } ] } }, createConnector: getInjectedConnector({ namespace: "talismanEth", flag: "isTalisman" }) }); export { talismanWallet };