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.

141 lines (137 loc) 6.03 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/imTokenWallet/imTokenWallet.svg var require_imTokenWallet = __commonJS({ "src/wallets/walletConnectors/imTokenWallet/imTokenWallet.svg"(exports, module) { module.exports = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 28 28">%0A <path fill="url(%23a)" d="M0 0h28v28H0z" />%0A <path fill="%23fff" d="M14.193 20.693c-4.435.374-8.547-2.224-8.87-6.26-.298-3.326 1.825-4.758 3.504-4.885a2.908 2.908 0 0 1 3.282 2.376c.12 1.325-.742 1.952-1.343 1.996a1.007 1.007 0 0 1-1.128-.83c-.044-.513.165-.583.101-1.121a1.172 1.172 0 0 0-1.432-1.033c-.57.044-1.622.703-1.489 2.332.134 1.628 1.774 2.94 3.903 2.743a4.346 4.346 0 0 0 4.03-4.372c0-.128.03-.254.088-.367.027-.044.057-.087.09-.127.056-.089.122-.172.196-.247l.209-.21c1-.911 4.637-3.104 8.052-2.42a.14.14 0 0 1 .076 0c.133 0 .21.09.222.222.539 7.996-4.745 11.785-9.49 12.203Z" />%0A <defs>%0A <linearGradient id="a" x1="27.236" x2=".05" y1=".889" y2="27.978" gradientUnits="userSpaceOnUse">%0A <stop stop-color="%2311C4D1" />%0A <stop offset="1" stop-color="%230062AD" />%0A </linearGradient>%0A </defs>%0A</svg>'; } }); // src/wallets/getWalletConnectConnector.ts import { createConnector } from "wagmi"; import { walletConnect } from "wagmi/connectors"; var walletConnectInstances = /* @__PURE__ */ new Map(); var getOrCreateWalletConnectInstance = ({ projectId, walletConnectParameters, rkDetailsShowQrModal }) => { let config = { ...walletConnectParameters ? walletConnectParameters : {}, projectId, showQrModal: false // Required. Otherwise WalletConnect modal (Web3Modal) will popup during time of connection for a wallet }; if (rkDetailsShowQrModal) { config = { ...config, showQrModal: true }; } const serializedConfig = JSON.stringify(config); const sharedWalletConnector = walletConnectInstances.get(serializedConfig); if (sharedWalletConnector) { return sharedWalletConnector; } const newWalletConnectInstance = walletConnect(config); walletConnectInstances.set(serializedConfig, newWalletConnectInstance); return newWalletConnectInstance; }; function createWalletConnectConnector({ projectId, walletDetails, walletConnectParameters }) { return createConnector((config) => ({ ...getOrCreateWalletConnectInstance({ projectId, walletConnectParameters, // Used in `connectorsForWallets` to add another // walletConnect wallet into kryptogokit with modal popup option rkDetailsShowQrModal: walletDetails.rkDetails.showQrModal })(config), ...walletDetails })); } function getWalletConnectConnector({ projectId, walletConnectParameters }) { const exampleProjectId = "04b90987df7d8e1e08a7d7ce0df821a6"; if (!projectId || projectId === "" || projectId === "YOUR_PROJECT_ID") { projectId = exampleProjectId; } return (walletDetails) => createWalletConnectConnector({ projectId, walletDetails, walletConnectParameters }); } // src/wallets/walletConnectors/imTokenWallet/imTokenWallet.ts var imTokenWallet = ({ projectId, walletConnectParameters }) => ({ id: "imToken", name: "imToken", iconUrl: async () => (await Promise.resolve().then(() => __toESM(require_imTokenWallet(), 1))).default, iconBackground: "#098de6", downloadUrls: { android: "https://play.google.com/store/apps/details?id=im.token.app", ios: "https://itunes.apple.com/us/app/imtoken2/id1384798940", mobile: "https://token.im/download", qrCode: "https://token.im/download" }, mobile: { getUri: (uri) => { return `imtokenv2://wc?uri=${encodeURIComponent(uri)}`; } }, qrCode: { getUri: (uri) => uri, instructions: { learnMoreUrl: typeof window !== "undefined" && window.navigator.language.includes("zh") ? "https://support.token.im/hc/zh-cn/categories/360000925393" : "https://support.token.im/hc/en-us/categories/360000925393", steps: [ { description: "wallet_connectors.im_token.qr_code.step1.description", step: "install", title: "wallet_connectors.im_token.qr_code.step1.title" }, { description: "wallet_connectors.im_token.qr_code.step2.description", step: "create", title: "wallet_connectors.im_token.qr_code.step2.title" }, { description: "wallet_connectors.im_token.qr_code.step3.description", step: "scan", title: "wallet_connectors.im_token.qr_code.step3.title" } ] } }, createConnector: getWalletConnectConnector({ projectId, walletConnectParameters }) }); export { imTokenWallet };