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.

138 lines (134 loc) 7.41 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/kresusWallet/kresusWallet.svg var require_kresusWallet = __commonJS({ "src/wallets/walletConnectors/kresusWallet/kresusWallet.svg"(exports, module) { module.exports = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 28 28"><g clip-path="url(%23a)"><path fill="%23fff" d="M0 0h28v28H0z"/><path fill="%23030A74" d="M-4 14v18h36V-4H-4v18Zm20-9.904c0 1.056-.768 1.824-1.824 1.824h-.736v-.816c0-.688.08-.88.464-1.28.4-.384.592-.464 1.28-.464H16v.736Zm5.888.08c-.112 1.152-.608 1.616-1.824 1.712l-.912.08.08-.864c.08-.688.176-.928.592-1.296s.656-.448 1.312-.448h.832l-.08.816Zm-9.472 1.936c-.064.384-.224.864-.352 1.056-.288.448-1.136.832-1.824.832-.464 0-.48-.016-.48-.816 0-.688.08-.88.464-1.28.416-.4.592-.464 1.392-.464h.912l-.112.672Zm-3.648 1.6c.032.144-.032.56-.128.928-.224.816-.896 1.28-1.872 1.28H6.08v-.688c.016-1.264.672-1.904 1.92-1.824.528.016.736.096.768.304Zm11.936.704c.144.128.256.48.256.784 0 .56-.208.72-.912.72-.224 0-.592.208-.864.464-.656.656-.624 1.424.096 2.784.304.576.56 1.088.56 1.12 0 .032-.496.112-1.12.144-.88.064-1.264.176-1.792.544l-.688.448.768.224c.704.192.752.24.752.752 0 .656-.224.752-1.536.624-1.264-.128-1.872.096-2.208.816-.208.416-.256 1.104-.256 3.264 0 1.504-.048 2.736-.112 2.736-.08-.016-.336-.176-.576-.384l-.464-.368.064-3.104c.048-2.848.08-3.168.416-3.792.432-.816.208-.88-.528-.144-.72.72-.88 1.424-.88 4.08v2.288l-.576-.432-.576-.448.048-2.976c.064-2.8.08-3.008.48-3.808.224-.448.384-.832.352-.832-.352 0-1.072.624-1.36 1.168-.304.592-.352.992-.416 3.184L9.568 20.8l-.48-.336-.464-.336.048-3.232c.048-2.976.08-3.264.4-3.824.384-.64.224-.784-.416-.336-.768.544-.976 1.36-.976 4.016 0 1.344-.048 2.448-.096 2.448s-.304-.16-.576-.336l-.48-.352.064-2.416c.08-3.456.304-3.824 3.632-5.696 3.056-1.712 4.832-2.16 8.688-2.224 1.216-.016 1.6.032 1.792.24Zm.256 4.944c0 .48-.032.88-.08.88-.08 0-.88-1.52-.88-1.68 0-.048.224-.08.48-.08.48 0 .48.016.48.88Zm-.016 3.792v1.808l-.272-.72c-.176-.448-.464-.832-.784-1.04-.4-.24-.512-.432-.528-.832 0-.448.064-.528.688-.736.368-.144.72-.256.8-.256.064-.016.112.8.096 1.776Zm-3.04.832c1.232.048 1.552.128 1.728.352.16.224.208.992.176 3.264l-.048 2.96-.512.048-.528.048-.032-2.768-.048-2.768-1.2-.048-1.2-.048.768.768.752.784v4.064h-.96v-1.728c0-1.712 0-1.744-.48-2.192l-.48-.464v4.384h-1.12V21.6c0-3.056 0-3.056.4-3.456.304-.304.512-.384.848-.32.24.048 1.12.128 1.936.16Z"/><path fill="%23030A74" d="M13.76 9.872c-.464.176-.96.752-.96 1.12 0 .336.08.368.72.368h.72v.72c0 .64.032.72.368.72.704-.016 1.632-.592 2.416-1.536.432-.512.896-1.072 1.024-1.232.224-.256.128-.272-1.904-.256-1.184 0-2.256.048-2.384.096Z"/></g><defs><clipPath id="a"><path fill="%23fff" d="M0 0h28v28H0z"/></clipPath></defs></svg>%0A'; } }); // 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/kresusWallet/kresusWallet.ts var kresusWallet = ({ projectId, walletConnectParameters }) => ({ id: "kresus-wallet", name: "Kresus Wallet", iconUrl: async () => (await Promise.resolve().then(() => __toESM(require_kresusWallet(), 1))).default, iconBackground: "#fff", downloadUrls: { android: "https://play.google.com/store/apps/details?id=com.kresus.superapp", ios: "https://apps.apple.com/us/app/kresus-crypto-nft-superapp/id6444355152", qrCode: "https://kresusconnect.kresus.com/download" }, mobile: { getUri: (uri) => `com.kresus.superapp://wc?uri=${encodeURIComponent(uri)}` }, qrCode: { getUri: (uri) => uri, instructions: { learnMoreUrl: "https://kresus.com/", steps: [ { description: "wallet_connectors.kresus.qr_code.step1.description", step: "install", title: "wallet_connectors.kresus.qr_code.step1.title" }, { description: "wallet_connectors.kresus.qr_code.step2.description", step: "create", title: "wallet_connectors.kresus.qr_code.step2.title" }, { description: "wallet_connectors.kresus.qr_code.step3.description", step: "scan", title: "wallet_connectors.kresus.qr_code.step3.title" } ] } }, createConnector: getWalletConnectConnector({ projectId, walletConnectParameters }) }); export { kresusWallet };