@dj-test/payment-sdk 1.0.7 → 1.0.8

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/README.md CHANGED
@@ -222,13 +222,73 @@ function AutoDetectPayment({ depositAddress }: { depositAddress: string }) {
222
222
 
223
223
  ### EVM Wallets
224
224
  - **Injected Wallets**: MetaMask, Trust Wallet, Brave Wallet
225
- - **WalletConnect**: 200+ 모바일 지갑
226
- - **Coinbase Wallet**: Coinbase 공식 지갑
225
+ - **Desktop**: Browser extensions (MetaMask, etc.)
226
+ - **Mobile Web**: In-app browsers + deep links (MetaMask app)
227
227
 
228
228
  ### Tron Wallets
229
229
  - **TronLink**: Official Tron wallet extension
230
230
  - **TronLink Pro**: Mobile wallet with WalletConnect support
231
231
 
232
+ ## Mobile Web Support
233
+
234
+ SDK follows **Daimo Pay approach** for mobile web:
235
+ - ✅ **In-app browser detection**: Auto-detects MetaMask in-app browser
236
+ - ✅ **Deep link support**: Opens MetaMask app from regular mobile browsers
237
+ - ✅ **No WalletConnect needed**: Lightweight solution without WC dependency
238
+
239
+ ### Mobile Web Flow
240
+
241
+ **Option 1: MetaMask In-App Browser** (Recommended)
242
+ ```
243
+ User opens your site in MetaMask app browser
244
+ → SDK detects window.ethereum
245
+ → Direct wallet connection works
246
+ ```
247
+
248
+ **Option 2: Regular Mobile Browser**
249
+ ```tsx
250
+ import { getConnectionStrategy, openMetaMaskDeepLink } from 'payment-sdk';
251
+
252
+ function ConnectButton() {
253
+ const strategy = getConnectionStrategy();
254
+
255
+ const handleConnect = () => {
256
+ if (strategy.type === 'deeplink') {
257
+ // Opens MetaMask app
258
+ openMetaMaskDeepLink();
259
+ } else if (strategy.type === 'injected') {
260
+ // Use wagmi connect
261
+ connect();
262
+ }
263
+ };
264
+
265
+ return <button onClick={handleConnect}>{strategy.message}</button>;
266
+ }
267
+ ```
268
+
269
+ ### Mobile Utilities
270
+
271
+ ```tsx
272
+ import {
273
+ isMobile,
274
+ isMetaMaskBrowser,
275
+ isMetaMaskAvailable,
276
+ shouldUseDeepLink,
277
+ } from 'payment-sdk';
278
+
279
+ // Check if on mobile device
280
+ const mobile = isMobile();
281
+
282
+ // Check if in MetaMask in-app browser
283
+ const inMetaMask = isMetaMaskBrowser();
284
+
285
+ // Check if MetaMask is available (extension or in-app)
286
+ const hasMetaMask = isMetaMaskAvailable();
287
+
288
+ // Determine if should use deep link
289
+ const useDeepLink = shouldUseDeepLink();
290
+ ```
291
+
232
292
  ## API Reference
233
293
 
234
294
  ### PaymentProvider Props
package/dist/index.d.mts CHANGED
@@ -1640,7 +1640,16 @@ declare const supportedChains: ({
1640
1640
  })[];
1641
1641
  /**
1642
1642
  * Create wagmi config following Daimo Pay approach
1643
- * Uses injected connectors + deep links, no WalletConnect dependency
1643
+ * Uses injected connector + deep links, no WalletConnect dependency
1644
+ *
1645
+ * Mobile web flow:
1646
+ * 1. User clicks "Connect Wallet" in mobile browser
1647
+ * 2. If in MetaMask in-app browser -> injected connector detects window.ethereum
1648
+ * 3. If in regular browser -> Use deep link to open MetaMask app (handled by UI layer)
1649
+ *
1650
+ * Desktop flow:
1651
+ * 1. MetaMask extension -> injected connector detects window.ethereum
1652
+ * 2. Other wallets -> injected connector detects their providers
1644
1653
  */
1645
1654
  declare const createWagmiConfig: () => Config$1;
1646
1655
  declare const getEvmChainById: (chainId: number) => {
@@ -3904,4 +3913,41 @@ declare function generatePaymentQRUrl(publicOrderId: string): string;
3904
3913
  */
3905
3914
  declare function getPaymentDomain(): string;
3906
3915
 
3907
- export { APIError, API_ENDPOINTS, ChainType, ChainType as ChainTypes, type CoinChain, type CoinChainResponse, type ConnectorInfo, type CreateOrderParams, DEFAULT_TIMEOUT, ENVIRONMENT_URLS, ERROR_CODES, EvmWalletAdapter, type IWalletAdapter, MIN_WITHDRAWAL_AMOUNT, ORDER_EXPIRY_MINUTES, type Order, type OrderCreateRequest, type OrderDetailResponse, OrderPayment, type OrderResponse, OrderStatus, PAYMENT_DOMAINS, PayWithAddress, type PayWithAddressParams, PayWithWallet, type PayWithWalletParams, PaymentButton, PaymentContext, PaymentFlow, type PaymentMethod$1 as PaymentMethod, type PaymentMethodType, PaymentModal, type PaymentMode, PaymentProvider, PaymentQRCode, type PaymentQRCodeProps, PaymentQRModal, type PaymentQRModalProps, type PaymentSession, type PaymentStatus, type PaymentTransaction, type PaymentTransactionParams, type SDKConfig, type SDKContext, SDKError, SDK_VERSION, SUPPORTED_CHAINS, type SupportedChain, TRON_NETWORKS, type TransactionResult, type TransactionResultInfo, TronWalletAdapter, type UseWalletAdapterOptions, ValidationError, type ValidationResult, WalletAdapterFactory, type WalletBalance, type WalletConnectionInfo, type WalletInfo, WalletProvider, WalletType, WalletType as WalletTypes, type WebhookPayload, type WithdrawalParams, coins as coinsAPI, config, createWagmiConfig, detectChainType, generatePaymentQRUrl, getChainById, getErrorMessage, getEvmChainById, getPaymentDomain, handleAPIError, isEvmAddress, isTronAddress, isValidAddress, orders as ordersAPI, supportedChains, supportedEvmChains, useOrder, usePayment, useWallet, useWalletAdapter, useWalletContext, validation };
3916
+ /**
3917
+ * Mobile wallet utilities for deep links and mobile detection
3918
+ * Following Daimo Pay approach for mobile web wallet connections
3919
+ */
3920
+ /**
3921
+ * Detect if user is on mobile device
3922
+ */
3923
+ declare const isMobile: () => boolean;
3924
+ /**
3925
+ * Detect if user is in MetaMask in-app browser
3926
+ */
3927
+ declare const isMetaMaskBrowser: () => boolean;
3928
+ /**
3929
+ * Detect if MetaMask is available (extension or in-app browser)
3930
+ */
3931
+ declare const isMetaMaskAvailable: () => boolean;
3932
+ /**
3933
+ * Open MetaMask mobile app via deep link
3934
+ * Used when user is on mobile browser but not in MetaMask in-app browser
3935
+ *
3936
+ * @param returnUrl - The URL to return to after wallet connection (optional)
3937
+ */
3938
+ declare const openMetaMaskDeepLink: (returnUrl?: string) => void;
3939
+ /**
3940
+ * Get connection strategy based on environment
3941
+ * Returns the recommended action for connecting wallet
3942
+ */
3943
+ declare const getConnectionStrategy: () => {
3944
+ type: "injected" | "deeplink" | "unavailable";
3945
+ message: string;
3946
+ action?: () => void;
3947
+ };
3948
+ /**
3949
+ * Check if we should use deep link for wallet connection
3950
+ */
3951
+ declare const shouldUseDeepLink: () => boolean;
3952
+
3953
+ export { APIError, API_ENDPOINTS, ChainType, ChainType as ChainTypes, type CoinChain, type CoinChainResponse, type ConnectorInfo, type CreateOrderParams, DEFAULT_TIMEOUT, ENVIRONMENT_URLS, ERROR_CODES, EvmWalletAdapter, type IWalletAdapter, MIN_WITHDRAWAL_AMOUNT, ORDER_EXPIRY_MINUTES, type Order, type OrderCreateRequest, type OrderDetailResponse, OrderPayment, type OrderResponse, OrderStatus, PAYMENT_DOMAINS, PayWithAddress, type PayWithAddressParams, PayWithWallet, type PayWithWalletParams, PaymentButton, PaymentContext, PaymentFlow, type PaymentMethod$1 as PaymentMethod, type PaymentMethodType, PaymentModal, type PaymentMode, PaymentProvider, PaymentQRCode, type PaymentQRCodeProps, PaymentQRModal, type PaymentQRModalProps, type PaymentSession, type PaymentStatus, type PaymentTransaction, type PaymentTransactionParams, type SDKConfig, type SDKContext, SDKError, SDK_VERSION, SUPPORTED_CHAINS, type SupportedChain, TRON_NETWORKS, type TransactionResult, type TransactionResultInfo, TronWalletAdapter, type UseWalletAdapterOptions, ValidationError, type ValidationResult, WalletAdapterFactory, type WalletBalance, type WalletConnectionInfo, type WalletInfo, WalletProvider, WalletType, WalletType as WalletTypes, type WebhookPayload, type WithdrawalParams, coins as coinsAPI, config, createWagmiConfig, detectChainType, generatePaymentQRUrl, getChainById, getConnectionStrategy, getErrorMessage, getEvmChainById, getPaymentDomain, handleAPIError, isEvmAddress, isMetaMaskAvailable, isMetaMaskBrowser, isMobile, isTronAddress, isValidAddress, openMetaMaskDeepLink, orders as ordersAPI, shouldUseDeepLink, supportedChains, supportedEvmChains, useOrder, usePayment, useWallet, useWalletAdapter, useWalletContext, validation };
package/dist/index.d.ts CHANGED
@@ -1640,7 +1640,16 @@ declare const supportedChains: ({
1640
1640
  })[];
1641
1641
  /**
1642
1642
  * Create wagmi config following Daimo Pay approach
1643
- * Uses injected connectors + deep links, no WalletConnect dependency
1643
+ * Uses injected connector + deep links, no WalletConnect dependency
1644
+ *
1645
+ * Mobile web flow:
1646
+ * 1. User clicks "Connect Wallet" in mobile browser
1647
+ * 2. If in MetaMask in-app browser -> injected connector detects window.ethereum
1648
+ * 3. If in regular browser -> Use deep link to open MetaMask app (handled by UI layer)
1649
+ *
1650
+ * Desktop flow:
1651
+ * 1. MetaMask extension -> injected connector detects window.ethereum
1652
+ * 2. Other wallets -> injected connector detects their providers
1644
1653
  */
1645
1654
  declare const createWagmiConfig: () => Config$1;
1646
1655
  declare const getEvmChainById: (chainId: number) => {
@@ -3904,4 +3913,41 @@ declare function generatePaymentQRUrl(publicOrderId: string): string;
3904
3913
  */
3905
3914
  declare function getPaymentDomain(): string;
3906
3915
 
3907
- export { APIError, API_ENDPOINTS, ChainType, ChainType as ChainTypes, type CoinChain, type CoinChainResponse, type ConnectorInfo, type CreateOrderParams, DEFAULT_TIMEOUT, ENVIRONMENT_URLS, ERROR_CODES, EvmWalletAdapter, type IWalletAdapter, MIN_WITHDRAWAL_AMOUNT, ORDER_EXPIRY_MINUTES, type Order, type OrderCreateRequest, type OrderDetailResponse, OrderPayment, type OrderResponse, OrderStatus, PAYMENT_DOMAINS, PayWithAddress, type PayWithAddressParams, PayWithWallet, type PayWithWalletParams, PaymentButton, PaymentContext, PaymentFlow, type PaymentMethod$1 as PaymentMethod, type PaymentMethodType, PaymentModal, type PaymentMode, PaymentProvider, PaymentQRCode, type PaymentQRCodeProps, PaymentQRModal, type PaymentQRModalProps, type PaymentSession, type PaymentStatus, type PaymentTransaction, type PaymentTransactionParams, type SDKConfig, type SDKContext, SDKError, SDK_VERSION, SUPPORTED_CHAINS, type SupportedChain, TRON_NETWORKS, type TransactionResult, type TransactionResultInfo, TronWalletAdapter, type UseWalletAdapterOptions, ValidationError, type ValidationResult, WalletAdapterFactory, type WalletBalance, type WalletConnectionInfo, type WalletInfo, WalletProvider, WalletType, WalletType as WalletTypes, type WebhookPayload, type WithdrawalParams, coins as coinsAPI, config, createWagmiConfig, detectChainType, generatePaymentQRUrl, getChainById, getErrorMessage, getEvmChainById, getPaymentDomain, handleAPIError, isEvmAddress, isTronAddress, isValidAddress, orders as ordersAPI, supportedChains, supportedEvmChains, useOrder, usePayment, useWallet, useWalletAdapter, useWalletContext, validation };
3916
+ /**
3917
+ * Mobile wallet utilities for deep links and mobile detection
3918
+ * Following Daimo Pay approach for mobile web wallet connections
3919
+ */
3920
+ /**
3921
+ * Detect if user is on mobile device
3922
+ */
3923
+ declare const isMobile: () => boolean;
3924
+ /**
3925
+ * Detect if user is in MetaMask in-app browser
3926
+ */
3927
+ declare const isMetaMaskBrowser: () => boolean;
3928
+ /**
3929
+ * Detect if MetaMask is available (extension or in-app browser)
3930
+ */
3931
+ declare const isMetaMaskAvailable: () => boolean;
3932
+ /**
3933
+ * Open MetaMask mobile app via deep link
3934
+ * Used when user is on mobile browser but not in MetaMask in-app browser
3935
+ *
3936
+ * @param returnUrl - The URL to return to after wallet connection (optional)
3937
+ */
3938
+ declare const openMetaMaskDeepLink: (returnUrl?: string) => void;
3939
+ /**
3940
+ * Get connection strategy based on environment
3941
+ * Returns the recommended action for connecting wallet
3942
+ */
3943
+ declare const getConnectionStrategy: () => {
3944
+ type: "injected" | "deeplink" | "unavailable";
3945
+ message: string;
3946
+ action?: () => void;
3947
+ };
3948
+ /**
3949
+ * Check if we should use deep link for wallet connection
3950
+ */
3951
+ declare const shouldUseDeepLink: () => boolean;
3952
+
3953
+ export { APIError, API_ENDPOINTS, ChainType, ChainType as ChainTypes, type CoinChain, type CoinChainResponse, type ConnectorInfo, type CreateOrderParams, DEFAULT_TIMEOUT, ENVIRONMENT_URLS, ERROR_CODES, EvmWalletAdapter, type IWalletAdapter, MIN_WITHDRAWAL_AMOUNT, ORDER_EXPIRY_MINUTES, type Order, type OrderCreateRequest, type OrderDetailResponse, OrderPayment, type OrderResponse, OrderStatus, PAYMENT_DOMAINS, PayWithAddress, type PayWithAddressParams, PayWithWallet, type PayWithWalletParams, PaymentButton, PaymentContext, PaymentFlow, type PaymentMethod$1 as PaymentMethod, type PaymentMethodType, PaymentModal, type PaymentMode, PaymentProvider, PaymentQRCode, type PaymentQRCodeProps, PaymentQRModal, type PaymentQRModalProps, type PaymentSession, type PaymentStatus, type PaymentTransaction, type PaymentTransactionParams, type SDKConfig, type SDKContext, SDKError, SDK_VERSION, SUPPORTED_CHAINS, type SupportedChain, TRON_NETWORKS, type TransactionResult, type TransactionResultInfo, TronWalletAdapter, type UseWalletAdapterOptions, ValidationError, type ValidationResult, WalletAdapterFactory, type WalletBalance, type WalletConnectionInfo, type WalletInfo, WalletProvider, WalletType, WalletType as WalletTypes, type WebhookPayload, type WithdrawalParams, coins as coinsAPI, config, createWagmiConfig, detectChainType, generatePaymentQRUrl, getChainById, getConnectionStrategy, getErrorMessage, getEvmChainById, getPaymentDomain, handleAPIError, isEvmAddress, isMetaMaskAvailable, isMetaMaskBrowser, isMobile, isTronAddress, isValidAddress, openMetaMaskDeepLink, orders as ordersAPI, shouldUseDeepLink, supportedChains, supportedEvmChains, useOrder, usePayment, useWallet, useWalletAdapter, useWalletContext, validation };
package/dist/index.js CHANGED
@@ -62,14 +62,20 @@ __export(index_exports, {
62
62
  detectChainType: () => detectChainType,
63
63
  generatePaymentQRUrl: () => generatePaymentQRUrl,
64
64
  getChainById: () => getChainById,
65
+ getConnectionStrategy: () => getConnectionStrategy,
65
66
  getErrorMessage: () => getErrorMessage,
66
67
  getEvmChainById: () => getEvmChainById,
67
68
  getPaymentDomain: () => getPaymentDomain,
68
69
  handleAPIError: () => handleAPIError,
69
70
  isEvmAddress: () => isEvmAddress,
71
+ isMetaMaskAvailable: () => isMetaMaskAvailable,
72
+ isMetaMaskBrowser: () => isMetaMaskBrowser,
73
+ isMobile: () => isMobile,
70
74
  isTronAddress: () => isTronAddress,
71
75
  isValidAddress: () => isValidAddress,
76
+ openMetaMaskDeepLink: () => openMetaMaskDeepLink,
72
77
  ordersAPI: () => orders_exports,
78
+ shouldUseDeepLink: () => shouldUseDeepLink,
73
79
  supportedChains: () => supportedChains,
74
80
  supportedEvmChains: () => supportedEvmChains,
75
81
  useOrder: () => useOrder,
@@ -170,7 +176,9 @@ var createWagmiConfig = () => {
170
176
  return (0, import_wagmi.createConfig)({
171
177
  chains: [import_chains.mainnet, import_chains.sepolia, import_chains.polygon, import_chains.polygonAmoy, import_chains.base, import_chains.baseSepolia],
172
178
  connectors: [
173
- // Injected connector - primary method for both web and mobile in-app browsers
179
+ // Injected connector - works for all wallets (MetaMask, Trust Wallet, etc.)
180
+ // Mobile: detects in-app browser's window.ethereum
181
+ // Desktop: detects browser extension's window.ethereum
174
182
  (0, import_connectors.injected)({
175
183
  target() {
176
184
  return {
@@ -179,17 +187,6 @@ var createWagmiConfig = () => {
179
187
  provider: typeof window !== "undefined" ? window.ethereum : void 0
180
188
  };
181
189
  }
182
- }),
183
- // MetaMask specific connector
184
- (0, import_connectors.metaMask)({
185
- dappMetadata: {
186
- name: "Payment SDK",
187
- url: typeof window !== "undefined" ? window.location.origin : ""
188
- }
189
- }),
190
- // Coinbase Wallet
191
- (0, import_connectors.coinbaseWallet)({
192
- appName: "Payment SDK"
193
190
  })
194
191
  ],
195
192
  transports: {
@@ -3840,6 +3837,52 @@ var useWallet = () => {
3840
3837
  // EVM만 체크
3841
3838
  };
3842
3839
  };
3840
+
3841
+ // src/utils/mobile.ts
3842
+ var isMobile = () => {
3843
+ if (typeof window === "undefined") return false;
3844
+ return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
3845
+ navigator.userAgent
3846
+ );
3847
+ };
3848
+ var isMetaMaskBrowser = () => {
3849
+ if (typeof window === "undefined") return false;
3850
+ const { ethereum } = window;
3851
+ return Boolean(ethereum && ethereum.isMetaMask);
3852
+ };
3853
+ var isMetaMaskAvailable = () => {
3854
+ if (typeof window === "undefined") return false;
3855
+ const { ethereum } = window;
3856
+ return Boolean(ethereum && ethereum.isMetaMask);
3857
+ };
3858
+ var openMetaMaskDeepLink = (returnUrl) => {
3859
+ if (typeof window === "undefined") return;
3860
+ const url = returnUrl || window.location.href;
3861
+ const deepLink = `https://metamask.app.link/dapp/${url.replace(/^https?:\/\//, "")}`;
3862
+ window.location.href = deepLink;
3863
+ };
3864
+ var getConnectionStrategy = () => {
3865
+ if (!isMobile() || isMetaMaskBrowser()) {
3866
+ if (isMetaMaskAvailable()) {
3867
+ return {
3868
+ type: "injected",
3869
+ message: "Connect with browser wallet"
3870
+ };
3871
+ }
3872
+ return {
3873
+ type: "unavailable",
3874
+ message: "Please install MetaMask extension"
3875
+ };
3876
+ }
3877
+ return {
3878
+ type: "deeplink",
3879
+ message: "Open in MetaMask app",
3880
+ action: () => openMetaMaskDeepLink()
3881
+ };
3882
+ };
3883
+ var shouldUseDeepLink = () => {
3884
+ return isMobile() && !isMetaMaskBrowser();
3885
+ };
3843
3886
  // Annotate the CommonJS export names for ESM import in node:
3844
3887
  0 && (module.exports = {
3845
3888
  API_ENDPOINTS,
@@ -3874,14 +3917,20 @@ var useWallet = () => {
3874
3917
  detectChainType,
3875
3918
  generatePaymentQRUrl,
3876
3919
  getChainById,
3920
+ getConnectionStrategy,
3877
3921
  getErrorMessage,
3878
3922
  getEvmChainById,
3879
3923
  getPaymentDomain,
3880
3924
  handleAPIError,
3881
3925
  isEvmAddress,
3926
+ isMetaMaskAvailable,
3927
+ isMetaMaskBrowser,
3928
+ isMobile,
3882
3929
  isTronAddress,
3883
3930
  isValidAddress,
3931
+ openMetaMaskDeepLink,
3884
3932
  ordersAPI,
3933
+ shouldUseDeepLink,
3885
3934
  supportedChains,
3886
3935
  supportedEvmChains,
3887
3936
  useOrder,
package/dist/index.mjs CHANGED
@@ -86,7 +86,7 @@ import {
86
86
  base,
87
87
  baseSepolia
88
88
  } from "wagmi/chains";
89
- import { injected, coinbaseWallet, metaMask } from "@wagmi/connectors";
89
+ import { injected } from "@wagmi/connectors";
90
90
  var supportedEvmChains = [
91
91
  mainnet,
92
92
  sepolia,
@@ -100,7 +100,9 @@ var createWagmiConfig = () => {
100
100
  return createConfig({
101
101
  chains: [mainnet, sepolia, polygon, polygonAmoy, base, baseSepolia],
102
102
  connectors: [
103
- // Injected connector - primary method for both web and mobile in-app browsers
103
+ // Injected connector - works for all wallets (MetaMask, Trust Wallet, etc.)
104
+ // Mobile: detects in-app browser's window.ethereum
105
+ // Desktop: detects browser extension's window.ethereum
104
106
  injected({
105
107
  target() {
106
108
  return {
@@ -109,17 +111,6 @@ var createWagmiConfig = () => {
109
111
  provider: typeof window !== "undefined" ? window.ethereum : void 0
110
112
  };
111
113
  }
112
- }),
113
- // MetaMask specific connector
114
- metaMask({
115
- dappMetadata: {
116
- name: "Payment SDK",
117
- url: typeof window !== "undefined" ? window.location.origin : ""
118
- }
119
- }),
120
- // Coinbase Wallet
121
- coinbaseWallet({
122
- appName: "Payment SDK"
123
114
  })
124
115
  ],
125
116
  transports: {
@@ -3781,6 +3772,52 @@ var useWallet = () => {
3781
3772
  // EVM만 체크
3782
3773
  };
3783
3774
  };
3775
+
3776
+ // src/utils/mobile.ts
3777
+ var isMobile = () => {
3778
+ if (typeof window === "undefined") return false;
3779
+ return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
3780
+ navigator.userAgent
3781
+ );
3782
+ };
3783
+ var isMetaMaskBrowser = () => {
3784
+ if (typeof window === "undefined") return false;
3785
+ const { ethereum } = window;
3786
+ return Boolean(ethereum && ethereum.isMetaMask);
3787
+ };
3788
+ var isMetaMaskAvailable = () => {
3789
+ if (typeof window === "undefined") return false;
3790
+ const { ethereum } = window;
3791
+ return Boolean(ethereum && ethereum.isMetaMask);
3792
+ };
3793
+ var openMetaMaskDeepLink = (returnUrl) => {
3794
+ if (typeof window === "undefined") return;
3795
+ const url = returnUrl || window.location.href;
3796
+ const deepLink = `https://metamask.app.link/dapp/${url.replace(/^https?:\/\//, "")}`;
3797
+ window.location.href = deepLink;
3798
+ };
3799
+ var getConnectionStrategy = () => {
3800
+ if (!isMobile() || isMetaMaskBrowser()) {
3801
+ if (isMetaMaskAvailable()) {
3802
+ return {
3803
+ type: "injected",
3804
+ message: "Connect with browser wallet"
3805
+ };
3806
+ }
3807
+ return {
3808
+ type: "unavailable",
3809
+ message: "Please install MetaMask extension"
3810
+ };
3811
+ }
3812
+ return {
3813
+ type: "deeplink",
3814
+ message: "Open in MetaMask app",
3815
+ action: () => openMetaMaskDeepLink()
3816
+ };
3817
+ };
3818
+ var shouldUseDeepLink = () => {
3819
+ return isMobile() && !isMetaMaskBrowser();
3820
+ };
3784
3821
  export {
3785
3822
  API_ENDPOINTS,
3786
3823
  ChainType as ChainTypes,
@@ -3814,14 +3851,20 @@ export {
3814
3851
  detectChainType,
3815
3852
  generatePaymentQRUrl,
3816
3853
  getChainById,
3854
+ getConnectionStrategy,
3817
3855
  getErrorMessage,
3818
3856
  getEvmChainById,
3819
3857
  getPaymentDomain,
3820
3858
  handleAPIError,
3821
3859
  isEvmAddress,
3860
+ isMetaMaskAvailable,
3861
+ isMetaMaskBrowser,
3862
+ isMobile,
3822
3863
  isTronAddress,
3823
3864
  isValidAddress,
3865
+ openMetaMaskDeepLink,
3824
3866
  orders_exports as ordersAPI,
3867
+ shouldUseDeepLink,
3825
3868
  supportedChains,
3826
3869
  supportedEvmChains,
3827
3870
  useOrder,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dj-test/payment-sdk",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Payment SDK for blockchain-based payment system",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",