tiwiflix-wallet-connector 1.6.0 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +22 -11
- package/dist/index.js +22 -11
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -3529,9 +3529,13 @@ class MetamaskAdapter extends EVMBaseAdapter {
|
|
|
3529
3529
|
// Debug mode - safe environment check for browser
|
|
3530
3530
|
this.debugMode = isDevelopmentMode();
|
|
3531
3531
|
}
|
|
3532
|
-
//
|
|
3532
|
+
// Only show MetaMask as available if detected
|
|
3533
3533
|
isAvailable() {
|
|
3534
|
-
|
|
3534
|
+
if (typeof window === 'undefined')
|
|
3535
|
+
return false;
|
|
3536
|
+
// Check for injected MetaMask provider
|
|
3537
|
+
const provider = this.getInjectedProvider();
|
|
3538
|
+
return !!provider;
|
|
3535
3539
|
}
|
|
3536
3540
|
/**
|
|
3537
3541
|
* Debug logging utility
|
|
@@ -5077,13 +5081,10 @@ class TONBaseAdapter extends BaseWalletAdapter {
|
|
|
5077
5081
|
return 'https://app.tiwiflix.xyz/manifest.json';
|
|
5078
5082
|
}
|
|
5079
5083
|
isAvailable() {
|
|
5080
|
-
//
|
|
5084
|
+
// Only show TON wallet as available if a TON wallet is detected (extension or injected)
|
|
5081
5085
|
if (typeof window === 'undefined')
|
|
5082
5086
|
return false;
|
|
5083
|
-
|
|
5084
|
-
// So we should always return true in browser environment
|
|
5085
|
-
// The SDK will be loaded dynamically during connect()
|
|
5086
|
-
return true;
|
|
5087
|
+
return this.checkForTonWalletExtensions();
|
|
5087
5088
|
}
|
|
5088
5089
|
/**
|
|
5089
5090
|
* @deprecated No longer used - TonConnect UI is loaded dynamically
|
|
@@ -7366,7 +7367,9 @@ const WalletSelectModal = ({ isOpen, onClose, onSelectWallet, availableWallets,
|
|
|
7366
7367
|
flexShrink: 0,
|
|
7367
7368
|
fontFamily: 'Lexend, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
7368
7369
|
pointerEvents: 'none',
|
|
7369
|
-
}, children: "Connected" })) :
|
|
7370
|
+
}, children: "Connected" })) : (
|
|
7371
|
+
// For TON wallets on mobile, do not show Detected/Install button
|
|
7372
|
+
!(isMobile && wallet.chainType === 'ton') ? (isInstalled ? (jsx("button", { style: {
|
|
7370
7373
|
fontSize: '11px',
|
|
7371
7374
|
fontWeight: '600',
|
|
7372
7375
|
color: '#2BEE6C',
|
|
@@ -7390,7 +7393,7 @@ const WalletSelectModal = ({ isOpen, onClose, onSelectWallet, availableWallets,
|
|
|
7390
7393
|
flexShrink: 0,
|
|
7391
7394
|
fontFamily: 'Lexend, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
7392
7395
|
pointerEvents: 'none',
|
|
7393
|
-
}, children: "Install" }))] }, wallet.type));
|
|
7396
|
+
}, children: "Install" }))) : null)] }, wallet.type));
|
|
7394
7397
|
})] }, chain))) }), jsx("div", { style: {
|
|
7395
7398
|
padding: '16px 20px',
|
|
7396
7399
|
borderTop: `1px solid ${colors.border}`,
|
|
@@ -7516,7 +7519,7 @@ const TWCBalanceModal = ({ isOpen, onClose, twcBalance, usdValue, colors, isDark
|
|
|
7516
7519
|
|
|
7517
7520
|
const tonApiCache = new Map();
|
|
7518
7521
|
const CACHE_DURATION = 30000; // 30 seconds
|
|
7519
|
-
const ConnectButton = ({ connector, onConnect, onDisconnect, onError, className, style, showBalance = false, modalPosition = 'center', theme = 'auto', buttonText = 'Connect Wallet
|
|
7522
|
+
const ConnectButton = ({ connector, onConnect, onDisconnect, onError, className, style, showBalance = false, modalPosition = 'center', theme = 'auto', buttonText = 'Connect Wallet', getExplorerUrl, }) => {
|
|
7520
7523
|
// Always fetch balance automatically when wallet is connected
|
|
7521
7524
|
// Balance is always fetched automatically from the chain
|
|
7522
7525
|
// Detect dark mode
|
|
@@ -7821,7 +7824,15 @@ const ConnectButton = ({ connector, onConnect, onDisconnect, onError, className,
|
|
|
7821
7824
|
try {
|
|
7822
7825
|
const chainId = await connector.getCurrentChain();
|
|
7823
7826
|
setCurrentChainId(chainId);
|
|
7824
|
-
|
|
7827
|
+
if (chainId !== 56) {
|
|
7828
|
+
// Automatically switch to BSC
|
|
7829
|
+
try {
|
|
7830
|
+
await connector.switchChain(56);
|
|
7831
|
+
}
|
|
7832
|
+
catch (err) {
|
|
7833
|
+
// Optionally handle error (user rejected, etc.)
|
|
7834
|
+
}
|
|
7835
|
+
}
|
|
7825
7836
|
setIsWrongNetwork(false);
|
|
7826
7837
|
}
|
|
7827
7838
|
catch (err) {
|
package/dist/index.js
CHANGED
|
@@ -3531,9 +3531,13 @@ class MetamaskAdapter extends EVMBaseAdapter {
|
|
|
3531
3531
|
// Debug mode - safe environment check for browser
|
|
3532
3532
|
this.debugMode = isDevelopmentMode();
|
|
3533
3533
|
}
|
|
3534
|
-
//
|
|
3534
|
+
// Only show MetaMask as available if detected
|
|
3535
3535
|
isAvailable() {
|
|
3536
|
-
|
|
3536
|
+
if (typeof window === 'undefined')
|
|
3537
|
+
return false;
|
|
3538
|
+
// Check for injected MetaMask provider
|
|
3539
|
+
const provider = this.getInjectedProvider();
|
|
3540
|
+
return !!provider;
|
|
3537
3541
|
}
|
|
3538
3542
|
/**
|
|
3539
3543
|
* Debug logging utility
|
|
@@ -5079,13 +5083,10 @@ class TONBaseAdapter extends BaseWalletAdapter {
|
|
|
5079
5083
|
return 'https://app.tiwiflix.xyz/manifest.json';
|
|
5080
5084
|
}
|
|
5081
5085
|
isAvailable() {
|
|
5082
|
-
//
|
|
5086
|
+
// Only show TON wallet as available if a TON wallet is detected (extension or injected)
|
|
5083
5087
|
if (typeof window === 'undefined')
|
|
5084
5088
|
return false;
|
|
5085
|
-
|
|
5086
|
-
// So we should always return true in browser environment
|
|
5087
|
-
// The SDK will be loaded dynamically during connect()
|
|
5088
|
-
return true;
|
|
5089
|
+
return this.checkForTonWalletExtensions();
|
|
5089
5090
|
}
|
|
5090
5091
|
/**
|
|
5091
5092
|
* @deprecated No longer used - TonConnect UI is loaded dynamically
|
|
@@ -7368,7 +7369,9 @@ const WalletSelectModal = ({ isOpen, onClose, onSelectWallet, availableWallets,
|
|
|
7368
7369
|
flexShrink: 0,
|
|
7369
7370
|
fontFamily: 'Lexend, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
7370
7371
|
pointerEvents: 'none',
|
|
7371
|
-
}, children: "Connected" })) :
|
|
7372
|
+
}, children: "Connected" })) : (
|
|
7373
|
+
// For TON wallets on mobile, do not show Detected/Install button
|
|
7374
|
+
!(isMobile && wallet.chainType === 'ton') ? (isInstalled ? (jsxRuntime.jsx("button", { style: {
|
|
7372
7375
|
fontSize: '11px',
|
|
7373
7376
|
fontWeight: '600',
|
|
7374
7377
|
color: '#2BEE6C',
|
|
@@ -7392,7 +7395,7 @@ const WalletSelectModal = ({ isOpen, onClose, onSelectWallet, availableWallets,
|
|
|
7392
7395
|
flexShrink: 0,
|
|
7393
7396
|
fontFamily: 'Lexend, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
7394
7397
|
pointerEvents: 'none',
|
|
7395
|
-
}, children: "Install" }))] }, wallet.type));
|
|
7398
|
+
}, children: "Install" }))) : null)] }, wallet.type));
|
|
7396
7399
|
})] }, chain))) }), jsxRuntime.jsx("div", { style: {
|
|
7397
7400
|
padding: '16px 20px',
|
|
7398
7401
|
borderTop: `1px solid ${colors.border}`,
|
|
@@ -7518,7 +7521,7 @@ const TWCBalanceModal = ({ isOpen, onClose, twcBalance, usdValue, colors, isDark
|
|
|
7518
7521
|
|
|
7519
7522
|
const tonApiCache = new Map();
|
|
7520
7523
|
const CACHE_DURATION = 30000; // 30 seconds
|
|
7521
|
-
const ConnectButton = ({ connector, onConnect, onDisconnect, onError, className, style, showBalance = false, modalPosition = 'center', theme = 'auto', buttonText = 'Connect Wallet
|
|
7524
|
+
const ConnectButton = ({ connector, onConnect, onDisconnect, onError, className, style, showBalance = false, modalPosition = 'center', theme = 'auto', buttonText = 'Connect Wallet', getExplorerUrl, }) => {
|
|
7522
7525
|
// Always fetch balance automatically when wallet is connected
|
|
7523
7526
|
// Balance is always fetched automatically from the chain
|
|
7524
7527
|
// Detect dark mode
|
|
@@ -7823,7 +7826,15 @@ const ConnectButton = ({ connector, onConnect, onDisconnect, onError, className,
|
|
|
7823
7826
|
try {
|
|
7824
7827
|
const chainId = await connector.getCurrentChain();
|
|
7825
7828
|
setCurrentChainId(chainId);
|
|
7826
|
-
|
|
7829
|
+
if (chainId !== 56) {
|
|
7830
|
+
// Automatically switch to BSC
|
|
7831
|
+
try {
|
|
7832
|
+
await connector.switchChain(56);
|
|
7833
|
+
}
|
|
7834
|
+
catch (err) {
|
|
7835
|
+
// Optionally handle error (user rejected, etc.)
|
|
7836
|
+
}
|
|
7837
|
+
}
|
|
7827
7838
|
setIsWrongNetwork(false);
|
|
7828
7839
|
}
|
|
7829
7840
|
catch (err) {
|
package/package.json
CHANGED