@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.
137 lines (132 loc) • 5.95 kB
JavaScript
"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/coinbaseWallet/coinbaseWallet.svg
var require_coinbaseWallet = __commonJS({
"src/wallets/walletConnectors/coinbaseWallet/coinbaseWallet.svg"(exports, module) {
module.exports = 'data:image/svg+xml,<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">%0A<rect width="28" height="28" fill="%232C5FF6"/>%0A<path fill-rule="evenodd" clip-rule="evenodd" d="M14 23.8C19.4124 23.8 23.8 19.4124 23.8 14C23.8 8.58761 19.4124 4.2 14 4.2C8.58761 4.2 4.2 8.58761 4.2 14C4.2 19.4124 8.58761 23.8 14 23.8ZM11.55 10.8C11.1358 10.8 10.8 11.1358 10.8 11.55V16.45C10.8 16.8642 11.1358 17.2 11.55 17.2H16.45C16.8642 17.2 17.2 16.8642 17.2 16.45V11.55C17.2 11.1358 16.8642 10.8 16.45 10.8H11.55Z" fill="white"/>%0A</svg>%0A';
}
});
// src/wallets/walletConnectors/coinbaseWallet/coinbaseWallet.ts
import { createConnector } from "wagmi";
import { coinbaseWallet as coinbaseConnector } from "wagmi/connectors";
// src/utils/isMobile.ts
function isSmallIOS() {
return typeof navigator !== "undefined" && /iPhone|iPod/.test(navigator.userAgent);
}
function isLargeIOS() {
return typeof navigator !== "undefined" && (/iPad/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1);
}
function isIOS() {
return isSmallIOS() || isLargeIOS();
}
// src/wallets/walletConnectors/coinbaseWallet/coinbaseWallet.ts
var coinbaseWallet = ({ appName, appIcon }) => {
const getUri = (uri) => uri;
const ios = isIOS();
return {
id: "coinbase",
name: "Coinbase Wallet",
shortName: "Coinbase",
rdns: "com.coinbase.wallet",
iconUrl: async () => (await Promise.resolve().then(() => __toESM(require_coinbaseWallet(), 1))).default,
iconAccent: "#2c5ff6",
iconBackground: "#2c5ff6",
// If the coinbase wallet browser extension is not installed, a popup will appear
// prompting the user to connect or create a wallet via passkey. This means if you either have
// or don't have the coinbase wallet browser extension installed it'll do some action anyways
installed: true,
downloadUrls: {
android: "https://play.google.com/store/apps/details?id=org.toshi",
ios: "https://apps.apple.com/us/app/coinbase-wallet-store-crypto/id1278383455",
mobile: "https://coinbase.com/wallet/downloads",
qrCode: "https://coinbase-wallet.onelink.me/q5Sx/fdb9b250",
chrome: "https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad",
browserExtension: "https://coinbase.com/wallet"
},
...ios ? {} : {
qrCode: {
getUri,
instructions: {
learnMoreUrl: "https://coinbase.com/wallet/articles/getting-started-mobile",
steps: [
{
description: "wallet_connectors.coinbase.qr_code.step1.description",
step: "install",
title: "wallet_connectors.coinbase.qr_code.step1.title"
},
{
description: "wallet_connectors.coinbase.qr_code.step2.description",
step: "create",
title: "wallet_connectors.coinbase.qr_code.step2.title"
},
{
description: "wallet_connectors.coinbase.qr_code.step3.description",
step: "scan",
title: "wallet_connectors.coinbase.qr_code.step3.title"
}
]
}
},
extension: {
instructions: {
learnMoreUrl: "https://coinbase.com/wallet/articles/getting-started-extension",
steps: [
{
description: "wallet_connectors.coinbase.extension.step1.description",
step: "install",
title: "wallet_connectors.coinbase.extension.step1.title"
},
{
description: "wallet_connectors.coinbase.extension.step2.description",
step: "create",
title: "wallet_connectors.coinbase.extension.step2.title"
},
{
description: "wallet_connectors.coinbase.extension.step3.description",
step: "refresh",
title: "wallet_connectors.coinbase.extension.step3.title"
}
]
}
}
},
createConnector: (walletDetails) => {
const connector = coinbaseConnector({
appName,
appLogoUrl: appIcon,
preference: coinbaseWallet.preference
});
return createConnector((config) => ({
...connector(config),
...walletDetails
}));
}
};
};
export {
coinbaseWallet
};