@funkit/connect
Version:
Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.
104 lines (101 loc) • 3.43 kB
JavaScript
"use client";
import {
getWalletConnectConnector
} from "./chunk-23WIEY36.js";
import {
getInjectedConnector,
hasInjectedProvider
} from "./chunk-DNSG5Q7V.js";
// src/wallets/walletConnectors/subWallet/subWallet.ts
var subWallet = ({
projectId,
walletConnectParameters
}) => {
const isSubWalletInjected = hasInjectedProvider({ namespace: "SubWallet" });
const shouldUseWalletConnect = !isSubWalletInjected;
const getUriMobile = (uri) => {
return `subwallet://wc?uri=${encodeURIComponent(uri)}`;
};
const getUriQR = (uri) => {
return uri;
};
const mobileConnector = {
getUri: shouldUseWalletConnect ? getUriMobile : void 0
};
let qrConnector = void 0;
if (shouldUseWalletConnect) {
qrConnector = {
getUri: getUriQR,
instructions: {
learnMoreUrl: "https://www.subwallet.app/",
steps: [
{
description: "wallet_connectors.subwallet.qr_code.step1.description",
step: "install",
title: "wallet_connectors.subwallet.qr_code.step1.title"
},
{
description: "wallet_connectors.subwallet.qr_code.step2.description",
step: "create",
title: "wallet_connectors.subwallet.qr_code.step2.title"
},
{
description: "wallet_connectors.subwallet.qr_code.step3.description",
step: "scan",
title: "wallet_connectors.subwallet.qr_code.step3.title"
}
]
}
};
}
const extensionConnector = {
instructions: {
learnMoreUrl: "https://www.subwallet.app/",
steps: [
{
description: "wallet_connectors.subwallet.extension.step1.description",
step: "install",
title: "wallet_connectors.subwallet.extension.step1.title"
},
{
description: "wallet_connectors.subwallet.extension.step2.description",
step: "create",
title: "wallet_connectors.subwallet.extension.step2.title"
},
{
description: "wallet_connectors.subwallet.extension.step3.description",
step: "refresh",
title: "wallet_connectors.subwallet.extension.step3.title"
}
]
}
};
return {
id: "subwallet",
name: "SubWallet",
rdns: "app.subwallet",
iconUrl: async () => (await import("./subWallet-5WUZ4IIO.js")).default,
iconBackground: "#fff",
installed: isSubWalletInjected || void 0,
downloadUrls: {
browserExtension: "https://www.subwallet.app/download",
chrome: "https://chrome.google.com/webstore/detail/subwallet-polkadot-wallet/onhogfjeacnfoofkfgppdlbmlmnplgbn",
firefox: "https://addons.mozilla.org/en-US/firefox/addon/subwallet/",
edge: "https://chrome.google.com/webstore/detail/subwallet-polkadot-wallet/onhogfjeacnfoofkfgppdlbmlmnplgbn",
mobile: "https://www.subwallet.app/download",
android: "https://play.google.com/store/apps/details?id=app.subwallet.mobile",
ios: "https://apps.apple.com/us/app/subwallet-polkadot-wallet/id1633050285",
qrCode: "https://www.subwallet.app/download"
},
mobile: mobileConnector,
qrCode: qrConnector,
extension: extensionConnector,
createConnector: shouldUseWalletConnect ? getWalletConnectConnector({
projectId,
walletConnectParameters
}) : getInjectedConnector({ namespace: "SubWallet" })
};
};
export {
subWallet
};