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.

155 lines (151 loc) 6.99 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/desigWallet/desigWallet.svg var require_desigWallet = __commonJS({ "src/wallets/walletConnectors/desigWallet/desigWallet.svg"(exports, module) { module.exports = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" fill="none"><g clip-path="url(%23a)"><path fill="%23F8F8F8" d="M0 0h28v28H0z"/><path fill="%23F8F8F8" d="M0 0h28v28H0z"/><path fill="%235746DB" d="M12.045 8.814A1.959 1.959 0 0 1 14 6.846H8.805a1.962 1.962 0 0 0-1.958 1.967 1.962 1.962 0 0 0 1.958 1.968H14a1.962 1.962 0 0 1-1.955-1.967Z"/><path fill="%237767F6" d="M19.15 6.847h-5.196a1.959 1.959 0 0 0-1.907 1.532 1.964 1.964 0 0 0 1.907 2.402h5.193a1.96 1.96 0 0 0 1.96-1.967 1.963 1.963 0 0 0-1.957-1.967Z"/><path fill="%235746DB" d="M13.68 14a1.963 1.963 0 0 1 1.96-1.967H8.784a1.941 1.941 0 0 0-1.937 1.945v.074a1.932 1.932 0 0 0 1.937 1.915h6.856A1.964 1.964 0 0 1 13.68 14Z"/><path fill="%237767F6" d="M19.216 12.033H15.64A1.963 1.963 0 0 0 13.68 14a1.962 1.962 0 0 0 1.96 1.967h3.576a1.932 1.932 0 0 0 1.937-1.914v-.075a1.941 1.941 0 0 0-1.937-1.945ZM19.306 17.219h-5.292a1.963 1.963 0 0 0-1.958 1.968V19.295a1.974 1.974 0 0 0 1.197 1.706c.24.1.497.153.756.152 2.517 0 4.614-1.323 5.74-2.852l.124-.173a.635.635 0 0 0-.567-.909Z"/><path fill="%235746DB" d="M13.03 20.886a1.828 1.828 0 0 1-.261-.183 1.975 1.975 0 0 1-.708-1.408V19.187a1.963 1.963 0 0 1 1.958-1.968l-5.24-.022h-.073a.633.633 0 0 0-.513.955l.072.095A7.09 7.09 0 0 0 14 21.153h.01a1.94 1.94 0 0 1-.98-.267Z"/></g><defs><clipPath id="a"><path fill="%23fff" d="M0 0h28v28H0z"/></clipPath></defs></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/desigWallet/desigWallet.ts var desigWallet = () => { return { id: "desig", name: "Desig Wallet", iconUrl: async () => (await Promise.resolve().then(() => __toESM(require_desigWallet(), 1))).default, iconBackground: "#ffffff", installed: hasInjectedProvider({ namespace: "desig.ethereum" }), downloadUrls: { android: "https://play.google.com/store/apps/details?id=io.desig.app", ios: "https://apps.apple.com/app/desig-wallet/id6450106028", qrCode: "https://desig.io", mobile: "https://desig.io", browserExtension: "https://chrome.google.com/webstore/detail/desig-wallet/panpgppehdchfphcigocleabcmcgfoca" }, extension: { instructions: { steps: [ { description: "wallet_connectors.desig.extension.step1.description", step: "install", title: "wallet_connectors.desig.extension.step1.title" }, { description: "wallet_connectors.desig.extension.step2.description", step: "create", title: "wallet_connectors.desig.extension.step2.title" }, { description: "wallet_connectors.desig.extension.step3.description", step: "refresh", title: "wallet_connectors.desig.extension.step3.title" } ], learnMoreUrl: "https://desig.io" } }, createConnector: getInjectedConnector({ namespace: "desig.ethereum" }) }; }; export { desigWallet };