@funkit/connect 12.6.0 → 12.7.0
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/CHANGELOG.md +28 -0
- package/dist/clients/{chunk-F36IJA7V.js → chunk-4OOCXIMA.js} +1 -1
- package/dist/clients/chunk-I5GSXPFE.js +182 -0
- package/dist/clients/{chunk-IAIRECDV.js → chunk-R6E3NH5A.js} +1 -1
- package/dist/clients/{chunk-VE6QD5IM.js → chunk-RAJJSGNT.js} +1 -1
- package/dist/clients/internal/nado/withdrawalCallback.js +2 -2
- package/dist/clients/internal/nado/withdrawalForm.js +3 -2
- package/dist/clients/lighter.js +1 -1
- package/dist/clients/nado.js +2 -2
- package/dist/clients/polymarket/createPolymarketDepositConfig.js +3 -3
- package/dist/clients/polymarket/index.js +3 -3
- package/dist/clients/polymarket/polymarket.js +2 -2
- package/dist/consts/bluvo.d.ts +7 -19
- package/dist/consts/centralExchange.d.ts +2 -0
- package/dist/hooks/useExchangeOptions.d.ts +9 -4
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2991 -2904
- package/dist/interfaces/solanaWallet.d.ts +5 -0
- package/dist/modals/WithdrawalModal/ErrorMessage.d.ts +2 -2
- package/dist/modals/WithdrawalModal/RecipientAddress.d.ts +4 -2
- package/dist/modals/WithdrawalModal/withdrawalHooks.d.ts +3 -1
- package/dist/providers/FunkitQuoteContext.d.ts +7 -4
- package/dist/utils/solanaRelayWallet.d.ts +13 -5
- package/dist/wallets/Wallet.d.ts +9 -0
- package/dist/wallets/solanaWithdrawal.d.ts +17 -0
- package/dist/wallets/walletConnectors/chunk-53MYTA42.js +94 -0
- package/dist/wallets/walletConnectors/chunk-65ULY6OC.js +70 -0
- package/dist/wallets/walletConnectors/chunk-A5POD5SV.js +103 -0
- package/dist/wallets/walletConnectors/chunk-ANODOMIN.js +218 -0
- package/dist/wallets/walletConnectors/chunk-ASTCNVJC.js +96 -0
- package/dist/wallets/walletConnectors/chunk-F45CUFRR.js +66 -0
- package/dist/wallets/walletConnectors/chunk-FYPQ3HP4.js +92 -0
- package/dist/wallets/walletConnectors/chunk-IWPW26AL.js +98 -0
- package/dist/wallets/walletConnectors/chunk-JJBLW4IU.js +87 -0
- package/dist/wallets/walletConnectors/chunk-KE4CWI3A.js +93 -0
- package/dist/wallets/walletConnectors/chunk-MWB6LFSG.js +110 -0
- package/dist/wallets/walletConnectors/chunk-OVDCDVFX.js +100 -0
- package/dist/wallets/walletConnectors/chunk-PPQ6L4K2.js +106 -0
- package/dist/wallets/walletConnectors/chunk-RJF2YEZ5.js +92 -0
- package/dist/wallets/walletConnectors/chunk-RQYEGJKL.js +96 -0
- package/dist/wallets/walletConnectors/chunk-TIHTQ3OB.js +95 -0
- package/dist/wallets/walletConnectors/chunk-TM7UBV3Q.js +69 -0
- package/dist/wallets/walletConnectors/chunk-USLZMUJ3.js +99 -0
- package/dist/wallets/walletConnectors/index.js +52 -52
- package/package.json +10 -4
- package/dist/clients/chunk-PENJ5JGH.js +0 -331
- package/dist/components/FunPayments/icons/gemini.d.ts +0 -5
- package/dist/components/Icons/GeminiIcon.d.ts +0 -4
|
@@ -33,4 +33,9 @@ interface SolanaWalletBase {
|
|
|
33
33
|
* At least one signing method is required.
|
|
34
34
|
*/
|
|
35
35
|
export type SolanaWalletConnection = SolanaWalletBase & SolanaSigner;
|
|
36
|
+
/**
|
|
37
|
+
* The subset a signing-only flow needs: where to submit and how to sign. A
|
|
38
|
+
* full {@link SolanaWalletConnection} satisfies it.
|
|
39
|
+
*/
|
|
40
|
+
export type SolanaWalletSigner = Pick<SolanaWalletBase, 'address' | 'connection'> & SolanaSigner;
|
|
36
41
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { TFunction } from 'i18next';
|
|
2
2
|
import type { ErrorNotification } from '../../components/FunNotification/FunNotification';
|
|
3
3
|
import type { CheckoutConfirmationError } from '../../domains/checkoutErrors';
|
|
4
|
-
export declare function getErrorNotification({ quoteErrorObject, withdrawalError,
|
|
4
|
+
export declare function getErrorNotification({ quoteErrorObject, withdrawalError, assetPriceFetchError, riskCheckError, t, }: {
|
|
5
5
|
quoteErrorObject: Error | null;
|
|
6
6
|
withdrawalError: CheckoutConfirmationError | null;
|
|
7
|
-
|
|
7
|
+
assetPriceFetchError: Error | null;
|
|
8
8
|
riskCheckError: Error | null;
|
|
9
9
|
t: TFunction;
|
|
10
10
|
}): ErrorNotification | null;
|
|
@@ -6,11 +6,13 @@ import type { FunkitWithdrawalConfig } from '../../providers/FunkitCheckoutConte
|
|
|
6
6
|
* Independent of the withdrawal source address — for connected-wallet
|
|
7
7
|
* withdrawals (e.g. Mallard) the source IS the connected wallet, and
|
|
8
8
|
* withdrawing to it on the destination chain is valid.
|
|
9
|
+
*
|
|
10
|
+
* Hidden with both an EVM and a Solana wallet connected.
|
|
9
11
|
*/
|
|
10
|
-
export declare function shouldShowUseConnectedWallet({ disableConnectedWallet, isConnected,
|
|
12
|
+
export declare function shouldShowUseConnectedWallet({ disableConnectedWallet, isConnected, hasMultipleWalletsConnected, }: {
|
|
11
13
|
disableConnectedWallet: boolean | undefined;
|
|
12
14
|
isConnected: boolean;
|
|
13
|
-
|
|
15
|
+
hasMultipleWalletsConnected: boolean;
|
|
14
16
|
}): boolean;
|
|
15
17
|
export declare function WithdrawRecipientAddress({ config, recipientAddress, setRecipientAddress: setRecipientAddressProp, selectedChainId, selectedToken, isValidAddress, isRiskyAddress, onAddressAutofilled, onAddressChanged, }: {
|
|
16
18
|
config: FunkitWithdrawalConfig;
|
|
@@ -25,8 +25,10 @@ export declare const useFrozenSourceTokenBalance: ({ isWithdrawing, sourceTokenB
|
|
|
25
25
|
* The withdrawal form's warning logs. Effect bodies and dependency arrays are
|
|
26
26
|
* unchanged from WithdrawalContent; the refs that dedupe them move along too.
|
|
27
27
|
*/
|
|
28
|
-
export declare function useWithdrawalLogging({ targetAssetFetchError, quoteErrorObject, isRisky, isRecipientBlacklisted, selectedChainId, selectedToken, recipientAddress, debouncedInputAmount, debouncedInputAmountUsd, }: {
|
|
28
|
+
export declare function useWithdrawalLogging({ targetAssetFetchError, sourceAssetFetchError, selectedSourceToken, quoteErrorObject, isRisky, isRecipientBlacklisted, selectedChainId, selectedToken, recipientAddress, debouncedInputAmount, debouncedInputAmountUsd, }: {
|
|
29
29
|
targetAssetFetchError: unknown;
|
|
30
|
+
sourceAssetFetchError: unknown;
|
|
31
|
+
selectedSourceToken: string | undefined;
|
|
30
32
|
quoteErrorObject: unknown;
|
|
31
33
|
isRisky: boolean | undefined;
|
|
32
34
|
isRecipientBlacklisted: boolean;
|
|
@@ -65,16 +65,19 @@ interface FunkitQuoteContextInterface extends CheckoutQuoteState {
|
|
|
65
65
|
setTargetAssetPoolAllowance: (value: bigint | undefined) => void;
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
68
|
+
* Account-balance payments only, then a per-flow gate. Those payments are
|
|
69
|
+
* always direct-executed — `useRelayBypass` whitelists ACCOUNT_BALANCE both
|
|
70
|
+
* with and without additional actions — which is why no separate
|
|
71
|
+
* direct-execution precondition is needed here.
|
|
72
|
+
*
|
|
73
|
+
* Aave native supply is capability-gated: EIP-2612 support
|
|
70
74
|
* (`undefined` = still loading → show optimistically, `false` = hide) and no
|
|
71
75
|
* covering Pool allowance — never the feature flag (ENG-4070). The Relay
|
|
72
76
|
* flow's source-side Permit2-vs-approve choice stays behind the
|
|
73
77
|
* `enable-permit-toggle` Statsig rollout gate.
|
|
74
78
|
*/
|
|
75
|
-
export declare function shouldShowApprovalMethodToggle({ isPermitToggleGateOn,
|
|
79
|
+
export declare function shouldShowApprovalMethodToggle({ isPermitToggleGateOn, isAccountBalancePayment, isAaveNativeSupplyFlow, targetAssetSupportsPermit, targetAssetAllowanceCoversAmount, }: {
|
|
76
80
|
isPermitToggleGateOn: boolean;
|
|
77
|
-
isDirectExecution: boolean;
|
|
78
81
|
isAccountBalancePayment: boolean;
|
|
79
82
|
isAaveNativeSupplyFlow: boolean;
|
|
80
83
|
targetAssetSupportsPermit: boolean | undefined;
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import { type SolanaSigner, type SolanaWallet } from '@funkit/fun-relay';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SolanaAddress } from '@funkit/api-base';
|
|
3
|
+
import type { SolanaWalletSigner } from '../interfaces/solanaWallet';
|
|
3
4
|
import type { ValidatedSolanaWallet } from '../providers/SolanaWalletProvider';
|
|
4
|
-
|
|
5
|
+
import { type WithdrawalClient } from '../wallets/Wallet';
|
|
6
|
+
export declare function resolveSigner(wallet: SolanaWalletSigner): SolanaSigner;
|
|
5
7
|
/**
|
|
6
8
|
* Takes a wallet that cleared `SolanaWalletProvider`'s validation: relay's
|
|
7
9
|
* adapter types the payer as a base58 address, not the host's bare string.
|
|
8
10
|
*/
|
|
9
|
-
export declare function createSolanaRelayWallet(wallet:
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
export declare function createSolanaRelayWallet(wallet: SolanaWalletSigner & {
|
|
12
|
+
address: SolanaAddress;
|
|
13
|
+
}): SolanaWallet;
|
|
14
|
+
/**
|
|
15
|
+
* The relay wallet for a Solana source, or undefined for an EVM one. A
|
|
16
|
+
* withdrawal config's own wallet wins over the provider's.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveSolanaRelayWallet({ sourceChainId, solanaWallet, withdrawalClient, logPrefix, }: {
|
|
12
19
|
sourceChainId: string;
|
|
13
20
|
solanaWallet: ValidatedSolanaWallet | undefined;
|
|
21
|
+
withdrawalClient?: WithdrawalClient;
|
|
14
22
|
logPrefix: string;
|
|
15
23
|
}): SolanaWallet | undefined;
|
package/dist/wallets/Wallet.d.ts
CHANGED
|
@@ -153,5 +153,14 @@ export interface LighterWithdrawalClient extends WithdrawalClient {
|
|
|
153
153
|
readonly _type: 'lighter';
|
|
154
154
|
readonly adaptedWallet: import('@funkit/fun-relay').LighterWallet;
|
|
155
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Solana-source variant. Carries the relay adapted wallet (Lighter pattern) so
|
|
158
|
+
* execution skips the EVM shim; the EVM-shaped members only satisfy the contract.
|
|
159
|
+
*/
|
|
160
|
+
export interface SolanaWithdrawalClient extends WithdrawalClient {
|
|
161
|
+
readonly _type: 'solana';
|
|
162
|
+
readonly adaptedWallet: import('@funkit/fun-relay').SolanaWallet;
|
|
163
|
+
}
|
|
164
|
+
export declare function isSolanaWithdrawalClient(client: WithdrawalClient): client is SolanaWithdrawalClient;
|
|
156
165
|
export declare function isLighterWithdrawalClient(client: WithdrawalClient): client is LighterWithdrawalClient;
|
|
157
166
|
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SolanaAddress } from '@funkit/api-base';
|
|
2
|
+
import type { NATIVE_TOKEN } from '../consts/funkit';
|
|
3
|
+
import type { SolanaWalletSigner } from '../interfaces/solanaWallet';
|
|
4
|
+
import type { WalletWithdrawalConfig, WithdrawalConfigBase } from '../providers/FunkitCheckoutContext/types';
|
|
5
|
+
export interface SolanaWithdrawalConfig extends Omit<WithdrawalConfigBase, 'sourceChainId' | 'sourceTokenAddress'> {
|
|
6
|
+
/** Signs the withdrawal; never disconnected by funkit. */
|
|
7
|
+
signer: SolanaWalletSigner;
|
|
8
|
+
/** Base58 mint of the SPL token to withdraw, or `NATIVE_TOKEN` for SOL. */
|
|
9
|
+
sourceTokenAddress: SolanaAddress | typeof NATIVE_TOKEN;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* `null` when the signer is absent or its address isn't base58, so a bad host
|
|
13
|
+
* value disables the flow instead of throwing in render.
|
|
14
|
+
*
|
|
15
|
+
* `params` is compared by identity, so pass a stable object.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useSolanaWithdrawalConfig(params: SolanaWithdrawalConfig | null): WalletWithdrawalConfig | null;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
getInjectedConnector,
|
|
4
|
+
hasInjectedProvider
|
|
5
|
+
} from "./chunk-EYWGX5LT.js";
|
|
6
|
+
import {
|
|
7
|
+
getWalletConnectConnector
|
|
8
|
+
} from "./chunk-AALSJCUR.js";
|
|
9
|
+
|
|
10
|
+
// src/wallets/walletConnectors/okxWallet/okxWallet.ts
|
|
11
|
+
import { isAndroid } from "@funkit/utils";
|
|
12
|
+
var okxWallet = ({
|
|
13
|
+
projectId,
|
|
14
|
+
walletConnectParameters
|
|
15
|
+
}) => {
|
|
16
|
+
const isOKXInjected = hasInjectedProvider({ namespace: "okxwallet" });
|
|
17
|
+
const shouldUseWalletConnect = !isOKXInjected;
|
|
18
|
+
return {
|
|
19
|
+
id: "okx",
|
|
20
|
+
name: "OKX Wallet",
|
|
21
|
+
rdns: "com.okex.wallet",
|
|
22
|
+
iconUrl: async () => (await import("./okxWallet-GJMKZIND.js")).default,
|
|
23
|
+
iconAccent: "#000",
|
|
24
|
+
iconBackground: "#000",
|
|
25
|
+
downloadUrls: {
|
|
26
|
+
android: "https://play.google.com/store/apps/details?id=com.okinc.okex.gp",
|
|
27
|
+
ios: "https://itunes.apple.com/app/id1327268470?mt=8",
|
|
28
|
+
mobile: "https://okx.com/download",
|
|
29
|
+
qrCode: "https://okx.com/download",
|
|
30
|
+
chrome: "https://chrome.google.com/webstore/detail/okx-wallet/mcohilncbfahbmgdjkbpemcciiolgcge",
|
|
31
|
+
edge: "https://microsoftedge.microsoft.com/addons/detail/okx-wallet/pbpjkcldjiffchgbbndmhojiacbgflha",
|
|
32
|
+
firefox: "https://addons.mozilla.org/firefox/addon/okexwallet/",
|
|
33
|
+
browserExtension: "https://okx.com/download"
|
|
34
|
+
},
|
|
35
|
+
mobile: {
|
|
36
|
+
getUri: shouldUseWalletConnect ? (uri) => {
|
|
37
|
+
return isAndroid() ? uri : `okex://main/wc?uri=${encodeURIComponent(uri)}`;
|
|
38
|
+
} : void 0
|
|
39
|
+
},
|
|
40
|
+
qrCode: shouldUseWalletConnect ? {
|
|
41
|
+
getUri: (uri) => uri,
|
|
42
|
+
instructions: {
|
|
43
|
+
learnMoreUrl: "https://okx.com/web3/",
|
|
44
|
+
steps: [
|
|
45
|
+
{
|
|
46
|
+
description: "wallet_connectors.okx.qr_code.step1.description",
|
|
47
|
+
step: "install",
|
|
48
|
+
title: "wallet_connectors.okx.qr_code.step1.title"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
description: "wallet_connectors.okx.qr_code.step2.description",
|
|
52
|
+
step: "create",
|
|
53
|
+
title: "wallet_connectors.okx.qr_code.step2.title"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
description: "wallet_connectors.okx.qr_code.step3.description",
|
|
57
|
+
step: "scan",
|
|
58
|
+
title: "wallet_connectors.okx.qr_code.step3.title"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
} : void 0,
|
|
63
|
+
extension: {
|
|
64
|
+
instructions: {
|
|
65
|
+
learnMoreUrl: "https://okx.com/web3/",
|
|
66
|
+
steps: [
|
|
67
|
+
{
|
|
68
|
+
description: "wallet_connectors.okx.extension.step1.description",
|
|
69
|
+
step: "install",
|
|
70
|
+
title: "wallet_connectors.okx.extension.step1.title"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
description: "wallet_connectors.okx.extension.step2.description",
|
|
74
|
+
step: "create",
|
|
75
|
+
title: "wallet_connectors.okx.extension.step2.title"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
description: "wallet_connectors.okx.extension.step3.description",
|
|
79
|
+
step: "refresh",
|
|
80
|
+
title: "wallet_connectors.okx.extension.step3.title"
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
createConnector: shouldUseWalletConnect ? getWalletConnectConnector({
|
|
86
|
+
projectId,
|
|
87
|
+
walletConnectParameters
|
|
88
|
+
}) : getInjectedConnector({ namespace: "okxwallet" })
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export {
|
|
93
|
+
okxWallet
|
|
94
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
getInjectedConnector,
|
|
4
|
+
hasInjectedProvider
|
|
5
|
+
} from "./chunk-EYWGX5LT.js";
|
|
6
|
+
import {
|
|
7
|
+
getWalletConnectConnector
|
|
8
|
+
} from "./chunk-AALSJCUR.js";
|
|
9
|
+
|
|
10
|
+
// src/wallets/walletConnectors/rainbowWallet/rainbowWallet.ts
|
|
11
|
+
import { isAndroid, isIOS } from "@funkit/utils";
|
|
12
|
+
var rainbowWallet = ({
|
|
13
|
+
projectId,
|
|
14
|
+
walletConnectParameters
|
|
15
|
+
}) => {
|
|
16
|
+
const isRainbowInjected = hasInjectedProvider({ flag: "isRainbow" });
|
|
17
|
+
const shouldUseWalletConnect = !isRainbowInjected;
|
|
18
|
+
const getUri = (uri) => {
|
|
19
|
+
return isAndroid() ? uri : isIOS() ? `rainbow://wc?uri=${encodeURIComponent(uri)}&connector=rainbowkit` : `https://rnbwapp.com/wc?uri=${encodeURIComponent(
|
|
20
|
+
uri
|
|
21
|
+
)}&connector=rainbowkit`;
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
id: "rainbow",
|
|
25
|
+
name: "Rainbow",
|
|
26
|
+
rdns: "me.rainbow",
|
|
27
|
+
iconUrl: async () => (await import("./rainbowWallet-MFJQCICF.js")).default,
|
|
28
|
+
iconBackground: "#0c2f78",
|
|
29
|
+
installed: !shouldUseWalletConnect ? isRainbowInjected : void 0,
|
|
30
|
+
downloadUrls: {
|
|
31
|
+
android: "https://play.google.com/store/apps/details?id=me.rainbow&referrer=utm_source%3Drainbowkit&utm_source=rainbowkit",
|
|
32
|
+
ios: "https://apps.apple.com/app/apple-store/id1457119021?pt=119997837&ct=rainbowkit&mt=8",
|
|
33
|
+
mobile: "https://rainbow.download?utm_source=rainbowkit",
|
|
34
|
+
qrCode: "https://rainbow.download?utm_source=rainbowkit&utm_medium=qrcode",
|
|
35
|
+
browserExtension: "https://rainbow.me/extension?utm_source=rainbowkit"
|
|
36
|
+
},
|
|
37
|
+
mobile: { getUri: shouldUseWalletConnect ? getUri : void 0 },
|
|
38
|
+
qrCode: shouldUseWalletConnect ? {
|
|
39
|
+
getUri,
|
|
40
|
+
instructions: {
|
|
41
|
+
learnMoreUrl: "https://learn.rainbow.me/connect-to-a-website-or-app?utm_source=rainbowkit&utm_medium=connector&utm_campaign=learnmore",
|
|
42
|
+
steps: [
|
|
43
|
+
{
|
|
44
|
+
description: "wallet_connectors.rainbow.qr_code.step1.description",
|
|
45
|
+
step: "install",
|
|
46
|
+
title: "wallet_connectors.rainbow.qr_code.step1.title"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
description: "wallet_connectors.rainbow.qr_code.step2.description",
|
|
50
|
+
step: "create",
|
|
51
|
+
title: "wallet_connectors.rainbow.qr_code.step2.title"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
description: "wallet_connectors.rainbow.qr_code.step3.description",
|
|
55
|
+
step: "scan",
|
|
56
|
+
title: "wallet_connectors.rainbow.qr_code.step3.title"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
} : void 0,
|
|
61
|
+
createConnector: shouldUseWalletConnect ? getWalletConnectConnector({
|
|
62
|
+
projectId,
|
|
63
|
+
walletConnectParameters
|
|
64
|
+
}) : getInjectedConnector({ flag: "isRainbow" })
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export {
|
|
69
|
+
rainbowWallet
|
|
70
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
getInjectedConnector,
|
|
4
|
+
hasInjectedProvider
|
|
5
|
+
} from "./chunk-EYWGX5LT.js";
|
|
6
|
+
import {
|
|
7
|
+
getWalletConnectConnector
|
|
8
|
+
} from "./chunk-AALSJCUR.js";
|
|
9
|
+
|
|
10
|
+
// src/wallets/walletConnectors/subWallet/subWallet.ts
|
|
11
|
+
var subWallet = ({
|
|
12
|
+
projectId,
|
|
13
|
+
walletConnectParameters
|
|
14
|
+
}) => {
|
|
15
|
+
const isSubWalletInjected = hasInjectedProvider({ namespace: "SubWallet" });
|
|
16
|
+
const shouldUseWalletConnect = !isSubWalletInjected;
|
|
17
|
+
const getUriMobile = (uri) => {
|
|
18
|
+
return `subwallet://wc?uri=${encodeURIComponent(uri)}`;
|
|
19
|
+
};
|
|
20
|
+
const getUriQR = (uri) => {
|
|
21
|
+
return uri;
|
|
22
|
+
};
|
|
23
|
+
const mobileConnector = {
|
|
24
|
+
getUri: shouldUseWalletConnect ? getUriMobile : void 0
|
|
25
|
+
};
|
|
26
|
+
let qrConnector = void 0;
|
|
27
|
+
if (shouldUseWalletConnect) {
|
|
28
|
+
qrConnector = {
|
|
29
|
+
getUri: getUriQR,
|
|
30
|
+
instructions: {
|
|
31
|
+
learnMoreUrl: "https://www.subwallet.app/",
|
|
32
|
+
steps: [
|
|
33
|
+
{
|
|
34
|
+
description: "wallet_connectors.subwallet.qr_code.step1.description",
|
|
35
|
+
step: "install",
|
|
36
|
+
title: "wallet_connectors.subwallet.qr_code.step1.title"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
description: "wallet_connectors.subwallet.qr_code.step2.description",
|
|
40
|
+
step: "create",
|
|
41
|
+
title: "wallet_connectors.subwallet.qr_code.step2.title"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
description: "wallet_connectors.subwallet.qr_code.step3.description",
|
|
45
|
+
step: "scan",
|
|
46
|
+
title: "wallet_connectors.subwallet.qr_code.step3.title"
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const extensionConnector = {
|
|
53
|
+
instructions: {
|
|
54
|
+
learnMoreUrl: "https://www.subwallet.app/",
|
|
55
|
+
steps: [
|
|
56
|
+
{
|
|
57
|
+
description: "wallet_connectors.subwallet.extension.step1.description",
|
|
58
|
+
step: "install",
|
|
59
|
+
title: "wallet_connectors.subwallet.extension.step1.title"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
description: "wallet_connectors.subwallet.extension.step2.description",
|
|
63
|
+
step: "create",
|
|
64
|
+
title: "wallet_connectors.subwallet.extension.step2.title"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
description: "wallet_connectors.subwallet.extension.step3.description",
|
|
68
|
+
step: "refresh",
|
|
69
|
+
title: "wallet_connectors.subwallet.extension.step3.title"
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
id: "subwallet",
|
|
76
|
+
name: "SubWallet",
|
|
77
|
+
rdns: "app.subwallet",
|
|
78
|
+
iconUrl: async () => (await import("./subWallet-5WUZ4IIO.js")).default,
|
|
79
|
+
iconBackground: "#fff",
|
|
80
|
+
installed: isSubWalletInjected || void 0,
|
|
81
|
+
downloadUrls: {
|
|
82
|
+
browserExtension: "https://www.subwallet.app/download",
|
|
83
|
+
chrome: "https://chrome.google.com/webstore/detail/subwallet-polkadot-wallet/onhogfjeacnfoofkfgppdlbmlmnplgbn",
|
|
84
|
+
firefox: "https://addons.mozilla.org/en-US/firefox/addon/subwallet/",
|
|
85
|
+
edge: "https://chrome.google.com/webstore/detail/subwallet-polkadot-wallet/onhogfjeacnfoofkfgppdlbmlmnplgbn",
|
|
86
|
+
mobile: "https://www.subwallet.app/download",
|
|
87
|
+
android: "https://play.google.com/store/apps/details?id=app.subwallet.mobile",
|
|
88
|
+
ios: "https://apps.apple.com/us/app/subwallet-polkadot-wallet/id1633050285",
|
|
89
|
+
qrCode: "https://www.subwallet.app/download"
|
|
90
|
+
},
|
|
91
|
+
mobile: mobileConnector,
|
|
92
|
+
qrCode: qrConnector,
|
|
93
|
+
extension: extensionConnector,
|
|
94
|
+
createConnector: shouldUseWalletConnect ? getWalletConnectConnector({
|
|
95
|
+
projectId,
|
|
96
|
+
walletConnectParameters
|
|
97
|
+
}) : getInjectedConnector({ namespace: "SubWallet" })
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export {
|
|
102
|
+
subWallet
|
|
103
|
+
};
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
getInjectedConnector,
|
|
4
|
+
hasInjectedProvider
|
|
5
|
+
} from "./chunk-EYWGX5LT.js";
|
|
6
|
+
import {
|
|
7
|
+
getWalletConnectConnector
|
|
8
|
+
} from "./chunk-AALSJCUR.js";
|
|
9
|
+
|
|
10
|
+
// src/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.ts
|
|
11
|
+
import { isAndroid, isIOS } from "@funkit/utils";
|
|
12
|
+
function isMetaMask(ethereum) {
|
|
13
|
+
if (!ethereum?.isMetaMask) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
if (ethereum.isBraveWallet && !ethereum._events && !ethereum._state) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
if (ethereum.isApexWallet) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
if (ethereum.isAvalanche) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
if (ethereum.isBackpack) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
if (ethereum.isBifrost) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
if (ethereum.isBitKeep) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
if (ethereum.isBitski) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
if (ethereum.isBlockWallet) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (ethereum.isCoinbaseWallet) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
if (ethereum.isDawn) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
if (ethereum.isEnkrypt) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
if (ethereum.isExodus) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
if (ethereum.isFrame) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
if (ethereum.isFrontier) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
if (ethereum.isGamestop) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
if (ethereum.isHyperPay) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
if (ethereum.isImToken) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
if (ethereum.isKuCoinWallet) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
if (ethereum.isMathWallet) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if (ethereum.isNestWallet) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
if (ethereum.isOkxWallet || ethereum.isOKExWallet) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
if (ethereum.isOneInchIOSWallet || ethereum.isOneInchAndroidWallet) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
if (ethereum.isOpera) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
if (ethereum.isPhantom) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
if (ethereum.isPortal) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
if (ethereum.isRabby) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
if (ethereum.isRainbow) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
if (ethereum.isStatus) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
if (ethereum.isTalisman) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
if (ethereum.isTally) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
if (ethereum.isTokenPocket) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
if (ethereum.isTokenary) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
if (ethereum.isTrust || ethereum.isTrustWallet) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
if (ethereum.isXDEFI) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
if (ethereum.isZeal) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
if (ethereum.isZerion) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
var metaMaskWallet = ({
|
|
127
|
+
projectId,
|
|
128
|
+
walletConnectParameters
|
|
129
|
+
}) => {
|
|
130
|
+
const isMetaMaskInjected = hasInjectedProvider({ flag: "isMetaMask" });
|
|
131
|
+
const shouldUseWalletConnect = !isMetaMaskInjected;
|
|
132
|
+
const getUri = (uri) => {
|
|
133
|
+
return isAndroid() ? uri : isIOS() ? (
|
|
134
|
+
// currently broken in MetaMask v6.5.0 https://github.com/MetaMask/metamask-mobile/issues/6457
|
|
135
|
+
`metamask://wc?uri=${encodeURIComponent(uri)}`
|
|
136
|
+
) : `https://metamask.app.link/wc?uri=${encodeURIComponent(uri)}`;
|
|
137
|
+
};
|
|
138
|
+
return {
|
|
139
|
+
id: "metaMask",
|
|
140
|
+
name: "MetaMask",
|
|
141
|
+
rdns: "io.metamask",
|
|
142
|
+
iconUrl: async () => (await import("./metaMaskWallet-RMHEKBDR.js")).default,
|
|
143
|
+
iconAccent: "#f6851a",
|
|
144
|
+
iconBackground: "#fff",
|
|
145
|
+
installed: !shouldUseWalletConnect ? isMetaMaskInjected : void 0,
|
|
146
|
+
downloadUrls: {
|
|
147
|
+
android: "https://play.google.com/store/apps/details?id=io.metamask",
|
|
148
|
+
ios: "https://apps.apple.com/us/app/metamask/id1438144202",
|
|
149
|
+
mobile: "https://metamask.io/download",
|
|
150
|
+
qrCode: "https://metamask.io/download",
|
|
151
|
+
chrome: "https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",
|
|
152
|
+
edge: "https://microsoftedge.microsoft.com/addons/detail/metamask/ejbalbakoplchlghecdalmeeeajnimhm",
|
|
153
|
+
firefox: "https://addons.mozilla.org/firefox/addon/ether-metamask",
|
|
154
|
+
opera: "https://addons.opera.com/extensions/details/metamask-10",
|
|
155
|
+
browserExtension: "https://metamask.io/download"
|
|
156
|
+
},
|
|
157
|
+
mobile: {
|
|
158
|
+
getUri: shouldUseWalletConnect ? getUri : void 0
|
|
159
|
+
},
|
|
160
|
+
qrCode: shouldUseWalletConnect ? {
|
|
161
|
+
getUri,
|
|
162
|
+
instructions: {
|
|
163
|
+
learnMoreUrl: "https://metamask.io/faqs/",
|
|
164
|
+
steps: [
|
|
165
|
+
{
|
|
166
|
+
description: "wallet_connectors.metamask.qr_code.step1.description",
|
|
167
|
+
step: "install",
|
|
168
|
+
title: "wallet_connectors.metamask.qr_code.step1.title"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
description: "wallet_connectors.metamask.qr_code.step2.description",
|
|
172
|
+
step: "create",
|
|
173
|
+
title: "wallet_connectors.metamask.qr_code.step2.title"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
description: "wallet_connectors.metamask.qr_code.step3.description",
|
|
177
|
+
step: "refresh",
|
|
178
|
+
title: "wallet_connectors.metamask.qr_code.step3.title"
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
} : void 0,
|
|
183
|
+
extension: {
|
|
184
|
+
instructions: {
|
|
185
|
+
learnMoreUrl: "https://metamask.io/faqs/",
|
|
186
|
+
steps: [
|
|
187
|
+
{
|
|
188
|
+
description: "wallet_connectors.metamask.extension.step1.description",
|
|
189
|
+
step: "install",
|
|
190
|
+
title: "wallet_connectors.metamask.extension.step1.title"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
description: "wallet_connectors.metamask.extension.step2.description",
|
|
194
|
+
step: "create",
|
|
195
|
+
title: "wallet_connectors.metamask.extension.step2.title"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
description: "wallet_connectors.metamask.extension.step3.description",
|
|
199
|
+
step: "refresh",
|
|
200
|
+
title: "wallet_connectors.metamask.extension.step3.title"
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
createConnector: shouldUseWalletConnect ? getWalletConnectConnector({
|
|
206
|
+
projectId,
|
|
207
|
+
walletConnectParameters
|
|
208
|
+
}) : getInjectedConnector({
|
|
209
|
+
target: typeof window !== "undefined" ? window.ethereum?.providers?.find(
|
|
210
|
+
isMetaMask
|
|
211
|
+
) ?? window.ethereum : void 0
|
|
212
|
+
})
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export {
|
|
217
|
+
metaMaskWallet
|
|
218
|
+
};
|