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.

144 lines (139 loc) 5.64 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/valoraWallet/valoraWallet.svg var require_valoraWallet = __commonJS({ "src/wallets/walletConnectors/valoraWallet/valoraWallet.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="url(%23a)" d="M0 0h28v28H0z"/><g clip-path="url(%23b)"><path d="M15.613 21c.724-5.46 3.377-8.569 7.387-11.386L20.95 7c-2.623 1.946-5.488 4.705-6.814 8.51C13.05 12.403 10.789 9.672 7.14 7L5 9.672C9.553 12.81 11.844 16.324 12.477 21h3.136Z" fill="%23fff"/></g><defs><linearGradient id="a" x1="0" y1="28" x2="25.5" y2="4" gradientUnits="userSpaceOnUse"><stop offset=".17" stop-color="%23FFD52C"/><stop offset="1" stop-color="%2326D98A"/></linearGradient><clipPath id="b"><path fill="%23fff" transform="translate(5 7)" d="M0 0h18v14H0z"/></clipPath></defs></svg>'; } }); // src/utils/isMobile.ts function isAndroid() { return typeof navigator !== "undefined" && /android/i.test(navigator.userAgent); } // 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/valoraWallet/valoraWallet.ts var valoraWallet = ({ projectId, walletConnectParameters }) => ({ id: "valora", name: "Valora", iconUrl: async () => (await Promise.resolve().then(() => __toESM(require_valoraWallet(), 1))).default, iconBackground: "#FFFFFF", downloadUrls: { ios: "https://apps.apple.com/app/id1520414263?mt=8", android: "https://play.google.com/store/apps/details?id=co.clabs.valora", mobile: "https://valora.xyz", qrCode: "https://valora.xyz" }, mobile: { getUri: (uri) => isAndroid() ? uri : `celo://wallet/wc?uri=${encodeURIComponent(uri)}` }, qrCode: { getUri: (uri) => uri, instructions: { learnMoreUrl: "https://valora.xyz/", steps: [ { description: "wallet_connectors.valora.qr_code.step1.description", step: "install", title: "wallet_connectors.valora.qr_code.step1.title" }, { description: "wallet_connectors.valora.qr_code.step2.description", step: "create", title: "wallet_connectors.valora.qr_code.step2.title" }, { description: "wallet_connectors.valora.qr_code.step3.description", step: "scan", title: "wallet_connectors.valora.qr_code.step3.title" } ] } }, createConnector: getWalletConnectConnector({ projectId, walletConnectParameters }) }); export { valoraWallet };