@coti-io/coti-wallet-plugin 0.2.1 → 0.2.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.d.mts CHANGED
@@ -234,11 +234,12 @@ interface CotiPluginConfig {
234
234
  */
235
235
  snapVersion?: string;
236
236
  /**
237
- * When false, the plugin will not call `wallet_requestSnaps` to install or
238
- * reconnect the Snap. An already-installed Snap can still be used for AES
239
- * key retrieval. Default: true.
237
+ * When false, Snap is fully disabled for this app: no install/connect,
238
+ * no AES key probe/retrieval, and strategy routing ignores an already-installed
239
+ * Snap. Unlock continues via encrypted backup restore and/or contract
240
+ * onboarding. Default: true.
240
241
  */
241
- snapInstallEnabled?: boolean;
242
+ snapEnabled?: boolean;
242
243
  /** If set, enforces a specific network chain ID (decimal string or hex). */
243
244
  defaultNetworkId?: string;
244
245
  /** Sepolia RPC URL for PoD portal operations. */
@@ -302,8 +303,8 @@ declare function getSnapRequestParams(snapId?: string, snapVersion?: string): Re
302
303
  * Returns the current plugin configuration.
303
304
  */
304
305
  declare function getPluginConfig(): Readonly<CotiPluginConfig>;
305
- /** Whether `wallet_requestSnaps` install/connect is allowed for this app. */
306
- declare function isSnapInstallEnabled(): boolean;
306
+ /** Whether Snap usage (install, probe, AES key retrieve/save) is allowed for this app. */
307
+ declare function isSnapEnabled(): boolean;
307
308
 
308
309
  /**
309
310
  * Internal logger for the COTI Wallet Plugin.
@@ -3707,6 +3708,12 @@ interface AesKeyProviderOptions {
3707
3708
  forceContractOnboarding?: boolean;
3708
3709
  /** Whether contract-onboarding should save a client-encrypted AES backup. */
3709
3710
  saveBackup?: boolean;
3711
+ /**
3712
+ * Persist the onboarded AES key to Snap after contract onboarding.
3713
+ * Used when the unlock UI just connected Snap (`wallet_requestSnaps`) but
3714
+ * `isMetaMaskWithSnap` may still be stale.
3715
+ */
3716
+ persistToSnap?: boolean;
3710
3717
  /** Only restore via Snap-side decrypt / backup; never export raw key or run contract onboarding. */
3711
3718
  restoreOnly?: boolean;
3712
3719
  /** Unlock via Snap typed decrypt RPC (no raw AES export). Used when AES is already stored in Snap. */
@@ -4752,4 +4759,4 @@ declare function muteChainUpdates(): void;
4752
4759
  declare function unmuteChainUpdates(): void;
4753
4760
  declare function isChainUpdatesMuted(): boolean;
4754
4761
 
4755
- export { type AesKeyChainId, type AesKeyProviderOptions, BRIDGE_ABI, BRIDGE_ERC20_ABI, type BridgeData, type BridgeFees, type BridgeStatus, CHAIN_CONFIGS, CONTRACT_ADDRESSES, COTI_MAINNET_CHAIN_ID, COTI_MAINNET_RPC, COTI_PRICE_CONSUMER_ABI, COTI_TESTNET_CHAIN_ID$1 as COTI_TESTNET_CHAIN_ID, COTI_TESTNET_POD_INBOX, COTI_TESTNET_RPC, type ChainIndexPageUi, type ConnectorProviderSource, type CotiBridgeFeeQuote, CotiErrorCode, type CotiPluginConfig, CotiPluginError, DEFAULT_CHAIN_ID, DEFAULT_POD_BALANCE_STATE, DEFAULT_POD_EXPLORER_BASE_URL, type EIP1193Provider, ERC20_ABI, ETHEREUM_MAINNET_CHAIN_ID, ETHEREUM_MAINNET_RPC, type EncryptedAesBackup, type FeeEstimate, type GrantResult, LIMITS, type Logger, MINIMUM_PORTAL_IN_AMOUNTS, MULTIPLE_WALLETS_ERROR_SUBSTRING, type NetworkEnforcerResult, NetworkGuard, type NetworkGuardProps, ONBOARDING_STEPS, ONBOARD_MODAL_STYLE_KEYS, OnboardModal, type OnboardModalPage, type OnboardModalProps, type OnboardModalTheme, type OnboardModalWarnings, type OnboardingProgressCallback, type OnboardingServiceRequest, type OnboardingServices, type OnboardingStep, type OnboardingStepInfo, COTI_TESTNET_CHAIN_ID as POD_COTI_TESTNET_CHAIN_ID, POD_INBOX_ADDRESS, POD_PORTAL_ADMIN_ABI, POD_PRICE_ORACLE_ABI, POD_PTOKEN_ABI, SEPOLIA_CHAIN_ID as POD_SEPOLIA_CHAIN_ID, PRIVACY_PORTAL_ABI, PRIVATE_ERC20_TRANSFER_256_SIG, type PodBalanceState, type PodBalanceTrustState, type PodPortalFeeQuote, type PodPortalRequest, type PodPortalRequestStatus, type PodWithdrawPermit, type ChainConfig as PortalChainConfig, type PortalStrategy, type PrivacyBridgeContextType, type PrivacyBridgeModalsContextValue, type PrivacyBridgeNetworkContextValue, type PrivacyBridgePodContextValue, PrivacyBridgeProvider, type PrivacyBridgeProviderProps, type PrivacyBridgeSwapContextValue, type PrivacyBridgeTokensContextValue, type PrivacyBridgeUnlockContextValue, type PrivacyBridgeWalletContextValue, type PrivateUnlockControllerValue, PrivateUnlockProvider, type PrivateUnlockProviderOptions, type PrivateUnlockProviderProps, type RefreshPrivateBalancesOptions, type ResolvedIndexPageUi, SEPOLIA_CHAIN_ID$1 as SEPOLIA_CHAIN_ID, SEPOLIA_RPC, SEPOLIA_RPC_FALLBACK, SUPPORTED_TOKENS, type SaveEncryptedAesBackupRequest, type SimulationResult, TOKEN_ABI, type TokenConfig, type UnlockStrategy, WALLET_CONNECT_FAILURE_EVENT, type WagmiConfigOptions, WagmiRainbowKitProvider, type WalletConnectFailureDetail, type WalletNetworkConfig, type WalletType, type WalletTypeInfo, addThousandsSeparators, buildPodExplorerRequestUrl, computeCotiFee, computeErc20Fee, configureCotiPlugin, cotiMainnet, cotiTestnet, estimateBridgeFee, estimateCotiBridgeGasFeeDisplay, estimatePodPortalFees, ethereumMainnet, executePodPortalTransaction, fetchBridgeFees, fetchPodBridgeData, fetchPodOracleTokenUsdPrice, fetchTokenUsdPrice, formatBalanceWithNotation, formatPodFeeDisplay, formatPortalFeeDisplay, formatTokenBalanceDisplay, getChainConfig, getChainIdConstants, getContractAddresses, getEip6963MetaMaskProvider, getEip6963RabbyProvider, getEthereumProvider, getExplorerBaseUrlForChain, getNetworkNameForChain, getPluginConfig, getPodGasPrice, getPodInboxAddress, getPodSdkConfig, getPrivateTokensForChain, getPublicTokensForChain, getRpcUrlForChain, getRpcUrlForChainId, getRpcUrlsForChain, getSepoliaGasPrice, getSnapRequestParams, getTokenSimulationMeta, getTokensForChain, getUnlockStrategyForChain, getWagmiConfig, getWalletNetworkConfigs, getWalletNetworkOptions, hasCotiErrorCode, isChainUpdatesMuted, isCotiPluginError, isMultipleWalletsError, isSnapInstallEnabled, loadPodRequests, logger, mobileZerionWallet, muteChainUpdates, defaultStyles as onboardModalDefaultStyles, podRequestsStorageKey, quoteCotiBridgeFees, quotePodPortalTransactionFees, quotePortalFeeOnly, requireChainConfig, resolveConnectedProvider, resolveIndexPageUi, resolveMetaMaskInjectedTarget, resolvePodRequestStatus, resolvePodTxGasPrice, resolvePrivateTokenContractAddress, resolvePrivateTokenTransferTarget, resolveRabbyInjectedTarget, savePodRequests, sepolia, setDebugLogging, signPodWithdrawPermit, simulateFeeOnChain, simulatePodPortalFee, truncateDecimalValue, unmuteChainUpdates, useBalanceUpdater, useBridgeData, useBridgeStatus, useMetamask, useNetworkEnforcer, usePrivacyBridgeContext, usePrivacyBridgeModals, usePrivacyBridgeNetwork, usePrivacyBridgePod, usePrivacyBridgeSwap, usePrivacyBridgeTokens, usePrivacyBridgeUnlock, usePrivacyBridgeWallet, usePrivateTokenBalance, usePrivateUnlock, useWalletType, wagmiConfig };
4762
+ export { type AesKeyChainId, type AesKeyProviderOptions, BRIDGE_ABI, BRIDGE_ERC20_ABI, type BridgeData, type BridgeFees, type BridgeStatus, CHAIN_CONFIGS, CONTRACT_ADDRESSES, COTI_MAINNET_CHAIN_ID, COTI_MAINNET_RPC, COTI_PRICE_CONSUMER_ABI, COTI_TESTNET_CHAIN_ID$1 as COTI_TESTNET_CHAIN_ID, COTI_TESTNET_POD_INBOX, COTI_TESTNET_RPC, type ChainIndexPageUi, type ConnectorProviderSource, type CotiBridgeFeeQuote, CotiErrorCode, type CotiPluginConfig, CotiPluginError, DEFAULT_CHAIN_ID, DEFAULT_POD_BALANCE_STATE, DEFAULT_POD_EXPLORER_BASE_URL, type EIP1193Provider, ERC20_ABI, ETHEREUM_MAINNET_CHAIN_ID, ETHEREUM_MAINNET_RPC, type EncryptedAesBackup, type FeeEstimate, type GrantResult, LIMITS, type Logger, MINIMUM_PORTAL_IN_AMOUNTS, MULTIPLE_WALLETS_ERROR_SUBSTRING, type NetworkEnforcerResult, NetworkGuard, type NetworkGuardProps, ONBOARDING_STEPS, ONBOARD_MODAL_STYLE_KEYS, OnboardModal, type OnboardModalPage, type OnboardModalProps, type OnboardModalTheme, type OnboardModalWarnings, type OnboardingProgressCallback, type OnboardingServiceRequest, type OnboardingServices, type OnboardingStep, type OnboardingStepInfo, COTI_TESTNET_CHAIN_ID as POD_COTI_TESTNET_CHAIN_ID, POD_INBOX_ADDRESS, POD_PORTAL_ADMIN_ABI, POD_PRICE_ORACLE_ABI, POD_PTOKEN_ABI, SEPOLIA_CHAIN_ID as POD_SEPOLIA_CHAIN_ID, PRIVACY_PORTAL_ABI, PRIVATE_ERC20_TRANSFER_256_SIG, type PodBalanceState, type PodBalanceTrustState, type PodPortalFeeQuote, type PodPortalRequest, type PodPortalRequestStatus, type PodWithdrawPermit, type ChainConfig as PortalChainConfig, type PortalStrategy, type PrivacyBridgeContextType, type PrivacyBridgeModalsContextValue, type PrivacyBridgeNetworkContextValue, type PrivacyBridgePodContextValue, PrivacyBridgeProvider, type PrivacyBridgeProviderProps, type PrivacyBridgeSwapContextValue, type PrivacyBridgeTokensContextValue, type PrivacyBridgeUnlockContextValue, type PrivacyBridgeWalletContextValue, type PrivateUnlockControllerValue, PrivateUnlockProvider, type PrivateUnlockProviderOptions, type PrivateUnlockProviderProps, type RefreshPrivateBalancesOptions, type ResolvedIndexPageUi, SEPOLIA_CHAIN_ID$1 as SEPOLIA_CHAIN_ID, SEPOLIA_RPC, SEPOLIA_RPC_FALLBACK, SUPPORTED_TOKENS, type SaveEncryptedAesBackupRequest, type SimulationResult, TOKEN_ABI, type TokenConfig, type UnlockStrategy, WALLET_CONNECT_FAILURE_EVENT, type WagmiConfigOptions, WagmiRainbowKitProvider, type WalletConnectFailureDetail, type WalletNetworkConfig, type WalletType, type WalletTypeInfo, addThousandsSeparators, buildPodExplorerRequestUrl, computeCotiFee, computeErc20Fee, configureCotiPlugin, cotiMainnet, cotiTestnet, estimateBridgeFee, estimateCotiBridgeGasFeeDisplay, estimatePodPortalFees, ethereumMainnet, executePodPortalTransaction, fetchBridgeFees, fetchPodBridgeData, fetchPodOracleTokenUsdPrice, fetchTokenUsdPrice, formatBalanceWithNotation, formatPodFeeDisplay, formatPortalFeeDisplay, formatTokenBalanceDisplay, getChainConfig, getChainIdConstants, getContractAddresses, getEip6963MetaMaskProvider, getEip6963RabbyProvider, getEthereumProvider, getExplorerBaseUrlForChain, getNetworkNameForChain, getPluginConfig, getPodGasPrice, getPodInboxAddress, getPodSdkConfig, getPrivateTokensForChain, getPublicTokensForChain, getRpcUrlForChain, getRpcUrlForChainId, getRpcUrlsForChain, getSepoliaGasPrice, getSnapRequestParams, getTokenSimulationMeta, getTokensForChain, getUnlockStrategyForChain, getWagmiConfig, getWalletNetworkConfigs, getWalletNetworkOptions, hasCotiErrorCode, isChainUpdatesMuted, isCotiPluginError, isMultipleWalletsError, isSnapEnabled, loadPodRequests, logger, mobileZerionWallet, muteChainUpdates, defaultStyles as onboardModalDefaultStyles, podRequestsStorageKey, quoteCotiBridgeFees, quotePodPortalTransactionFees, quotePortalFeeOnly, requireChainConfig, resolveConnectedProvider, resolveIndexPageUi, resolveMetaMaskInjectedTarget, resolvePodRequestStatus, resolvePodTxGasPrice, resolvePrivateTokenContractAddress, resolvePrivateTokenTransferTarget, resolveRabbyInjectedTarget, savePodRequests, sepolia, setDebugLogging, signPodWithdrawPermit, simulateFeeOnChain, simulatePodPortalFee, truncateDecimalValue, unmuteChainUpdates, useBalanceUpdater, useBridgeData, useBridgeStatus, useMetamask, useNetworkEnforcer, usePrivacyBridgeContext, usePrivacyBridgeModals, usePrivacyBridgeNetwork, usePrivacyBridgePod, usePrivacyBridgeSwap, usePrivacyBridgeTokens, usePrivacyBridgeUnlock, usePrivacyBridgeWallet, usePrivateTokenBalance, usePrivateUnlock, useWalletType, wagmiConfig };
package/dist/index.d.ts CHANGED
@@ -234,11 +234,12 @@ interface CotiPluginConfig {
234
234
  */
235
235
  snapVersion?: string;
236
236
  /**
237
- * When false, the plugin will not call `wallet_requestSnaps` to install or
238
- * reconnect the Snap. An already-installed Snap can still be used for AES
239
- * key retrieval. Default: true.
237
+ * When false, Snap is fully disabled for this app: no install/connect,
238
+ * no AES key probe/retrieval, and strategy routing ignores an already-installed
239
+ * Snap. Unlock continues via encrypted backup restore and/or contract
240
+ * onboarding. Default: true.
240
241
  */
241
- snapInstallEnabled?: boolean;
242
+ snapEnabled?: boolean;
242
243
  /** If set, enforces a specific network chain ID (decimal string or hex). */
243
244
  defaultNetworkId?: string;
244
245
  /** Sepolia RPC URL for PoD portal operations. */
@@ -302,8 +303,8 @@ declare function getSnapRequestParams(snapId?: string, snapVersion?: string): Re
302
303
  * Returns the current plugin configuration.
303
304
  */
304
305
  declare function getPluginConfig(): Readonly<CotiPluginConfig>;
305
- /** Whether `wallet_requestSnaps` install/connect is allowed for this app. */
306
- declare function isSnapInstallEnabled(): boolean;
306
+ /** Whether Snap usage (install, probe, AES key retrieve/save) is allowed for this app. */
307
+ declare function isSnapEnabled(): boolean;
307
308
 
308
309
  /**
309
310
  * Internal logger for the COTI Wallet Plugin.
@@ -3707,6 +3708,12 @@ interface AesKeyProviderOptions {
3707
3708
  forceContractOnboarding?: boolean;
3708
3709
  /** Whether contract-onboarding should save a client-encrypted AES backup. */
3709
3710
  saveBackup?: boolean;
3711
+ /**
3712
+ * Persist the onboarded AES key to Snap after contract onboarding.
3713
+ * Used when the unlock UI just connected Snap (`wallet_requestSnaps`) but
3714
+ * `isMetaMaskWithSnap` may still be stale.
3715
+ */
3716
+ persistToSnap?: boolean;
3710
3717
  /** Only restore via Snap-side decrypt / backup; never export raw key or run contract onboarding. */
3711
3718
  restoreOnly?: boolean;
3712
3719
  /** Unlock via Snap typed decrypt RPC (no raw AES export). Used when AES is already stored in Snap. */
@@ -4752,4 +4759,4 @@ declare function muteChainUpdates(): void;
4752
4759
  declare function unmuteChainUpdates(): void;
4753
4760
  declare function isChainUpdatesMuted(): boolean;
4754
4761
 
4755
- export { type AesKeyChainId, type AesKeyProviderOptions, BRIDGE_ABI, BRIDGE_ERC20_ABI, type BridgeData, type BridgeFees, type BridgeStatus, CHAIN_CONFIGS, CONTRACT_ADDRESSES, COTI_MAINNET_CHAIN_ID, COTI_MAINNET_RPC, COTI_PRICE_CONSUMER_ABI, COTI_TESTNET_CHAIN_ID$1 as COTI_TESTNET_CHAIN_ID, COTI_TESTNET_POD_INBOX, COTI_TESTNET_RPC, type ChainIndexPageUi, type ConnectorProviderSource, type CotiBridgeFeeQuote, CotiErrorCode, type CotiPluginConfig, CotiPluginError, DEFAULT_CHAIN_ID, DEFAULT_POD_BALANCE_STATE, DEFAULT_POD_EXPLORER_BASE_URL, type EIP1193Provider, ERC20_ABI, ETHEREUM_MAINNET_CHAIN_ID, ETHEREUM_MAINNET_RPC, type EncryptedAesBackup, type FeeEstimate, type GrantResult, LIMITS, type Logger, MINIMUM_PORTAL_IN_AMOUNTS, MULTIPLE_WALLETS_ERROR_SUBSTRING, type NetworkEnforcerResult, NetworkGuard, type NetworkGuardProps, ONBOARDING_STEPS, ONBOARD_MODAL_STYLE_KEYS, OnboardModal, type OnboardModalPage, type OnboardModalProps, type OnboardModalTheme, type OnboardModalWarnings, type OnboardingProgressCallback, type OnboardingServiceRequest, type OnboardingServices, type OnboardingStep, type OnboardingStepInfo, COTI_TESTNET_CHAIN_ID as POD_COTI_TESTNET_CHAIN_ID, POD_INBOX_ADDRESS, POD_PORTAL_ADMIN_ABI, POD_PRICE_ORACLE_ABI, POD_PTOKEN_ABI, SEPOLIA_CHAIN_ID as POD_SEPOLIA_CHAIN_ID, PRIVACY_PORTAL_ABI, PRIVATE_ERC20_TRANSFER_256_SIG, type PodBalanceState, type PodBalanceTrustState, type PodPortalFeeQuote, type PodPortalRequest, type PodPortalRequestStatus, type PodWithdrawPermit, type ChainConfig as PortalChainConfig, type PortalStrategy, type PrivacyBridgeContextType, type PrivacyBridgeModalsContextValue, type PrivacyBridgeNetworkContextValue, type PrivacyBridgePodContextValue, PrivacyBridgeProvider, type PrivacyBridgeProviderProps, type PrivacyBridgeSwapContextValue, type PrivacyBridgeTokensContextValue, type PrivacyBridgeUnlockContextValue, type PrivacyBridgeWalletContextValue, type PrivateUnlockControllerValue, PrivateUnlockProvider, type PrivateUnlockProviderOptions, type PrivateUnlockProviderProps, type RefreshPrivateBalancesOptions, type ResolvedIndexPageUi, SEPOLIA_CHAIN_ID$1 as SEPOLIA_CHAIN_ID, SEPOLIA_RPC, SEPOLIA_RPC_FALLBACK, SUPPORTED_TOKENS, type SaveEncryptedAesBackupRequest, type SimulationResult, TOKEN_ABI, type TokenConfig, type UnlockStrategy, WALLET_CONNECT_FAILURE_EVENT, type WagmiConfigOptions, WagmiRainbowKitProvider, type WalletConnectFailureDetail, type WalletNetworkConfig, type WalletType, type WalletTypeInfo, addThousandsSeparators, buildPodExplorerRequestUrl, computeCotiFee, computeErc20Fee, configureCotiPlugin, cotiMainnet, cotiTestnet, estimateBridgeFee, estimateCotiBridgeGasFeeDisplay, estimatePodPortalFees, ethereumMainnet, executePodPortalTransaction, fetchBridgeFees, fetchPodBridgeData, fetchPodOracleTokenUsdPrice, fetchTokenUsdPrice, formatBalanceWithNotation, formatPodFeeDisplay, formatPortalFeeDisplay, formatTokenBalanceDisplay, getChainConfig, getChainIdConstants, getContractAddresses, getEip6963MetaMaskProvider, getEip6963RabbyProvider, getEthereumProvider, getExplorerBaseUrlForChain, getNetworkNameForChain, getPluginConfig, getPodGasPrice, getPodInboxAddress, getPodSdkConfig, getPrivateTokensForChain, getPublicTokensForChain, getRpcUrlForChain, getRpcUrlForChainId, getRpcUrlsForChain, getSepoliaGasPrice, getSnapRequestParams, getTokenSimulationMeta, getTokensForChain, getUnlockStrategyForChain, getWagmiConfig, getWalletNetworkConfigs, getWalletNetworkOptions, hasCotiErrorCode, isChainUpdatesMuted, isCotiPluginError, isMultipleWalletsError, isSnapInstallEnabled, loadPodRequests, logger, mobileZerionWallet, muteChainUpdates, defaultStyles as onboardModalDefaultStyles, podRequestsStorageKey, quoteCotiBridgeFees, quotePodPortalTransactionFees, quotePortalFeeOnly, requireChainConfig, resolveConnectedProvider, resolveIndexPageUi, resolveMetaMaskInjectedTarget, resolvePodRequestStatus, resolvePodTxGasPrice, resolvePrivateTokenContractAddress, resolvePrivateTokenTransferTarget, resolveRabbyInjectedTarget, savePodRequests, sepolia, setDebugLogging, signPodWithdrawPermit, simulateFeeOnChain, simulatePodPortalFee, truncateDecimalValue, unmuteChainUpdates, useBalanceUpdater, useBridgeData, useBridgeStatus, useMetamask, useNetworkEnforcer, usePrivacyBridgeContext, usePrivacyBridgeModals, usePrivacyBridgeNetwork, usePrivacyBridgePod, usePrivacyBridgeSwap, usePrivacyBridgeTokens, usePrivacyBridgeUnlock, usePrivacyBridgeWallet, usePrivateTokenBalance, usePrivateUnlock, useWalletType, wagmiConfig };
4762
+ export { type AesKeyChainId, type AesKeyProviderOptions, BRIDGE_ABI, BRIDGE_ERC20_ABI, type BridgeData, type BridgeFees, type BridgeStatus, CHAIN_CONFIGS, CONTRACT_ADDRESSES, COTI_MAINNET_CHAIN_ID, COTI_MAINNET_RPC, COTI_PRICE_CONSUMER_ABI, COTI_TESTNET_CHAIN_ID$1 as COTI_TESTNET_CHAIN_ID, COTI_TESTNET_POD_INBOX, COTI_TESTNET_RPC, type ChainIndexPageUi, type ConnectorProviderSource, type CotiBridgeFeeQuote, CotiErrorCode, type CotiPluginConfig, CotiPluginError, DEFAULT_CHAIN_ID, DEFAULT_POD_BALANCE_STATE, DEFAULT_POD_EXPLORER_BASE_URL, type EIP1193Provider, ERC20_ABI, ETHEREUM_MAINNET_CHAIN_ID, ETHEREUM_MAINNET_RPC, type EncryptedAesBackup, type FeeEstimate, type GrantResult, LIMITS, type Logger, MINIMUM_PORTAL_IN_AMOUNTS, MULTIPLE_WALLETS_ERROR_SUBSTRING, type NetworkEnforcerResult, NetworkGuard, type NetworkGuardProps, ONBOARDING_STEPS, ONBOARD_MODAL_STYLE_KEYS, OnboardModal, type OnboardModalPage, type OnboardModalProps, type OnboardModalTheme, type OnboardModalWarnings, type OnboardingProgressCallback, type OnboardingServiceRequest, type OnboardingServices, type OnboardingStep, type OnboardingStepInfo, COTI_TESTNET_CHAIN_ID as POD_COTI_TESTNET_CHAIN_ID, POD_INBOX_ADDRESS, POD_PORTAL_ADMIN_ABI, POD_PRICE_ORACLE_ABI, POD_PTOKEN_ABI, SEPOLIA_CHAIN_ID as POD_SEPOLIA_CHAIN_ID, PRIVACY_PORTAL_ABI, PRIVATE_ERC20_TRANSFER_256_SIG, type PodBalanceState, type PodBalanceTrustState, type PodPortalFeeQuote, type PodPortalRequest, type PodPortalRequestStatus, type PodWithdrawPermit, type ChainConfig as PortalChainConfig, type PortalStrategy, type PrivacyBridgeContextType, type PrivacyBridgeModalsContextValue, type PrivacyBridgeNetworkContextValue, type PrivacyBridgePodContextValue, PrivacyBridgeProvider, type PrivacyBridgeProviderProps, type PrivacyBridgeSwapContextValue, type PrivacyBridgeTokensContextValue, type PrivacyBridgeUnlockContextValue, type PrivacyBridgeWalletContextValue, type PrivateUnlockControllerValue, PrivateUnlockProvider, type PrivateUnlockProviderOptions, type PrivateUnlockProviderProps, type RefreshPrivateBalancesOptions, type ResolvedIndexPageUi, SEPOLIA_CHAIN_ID$1 as SEPOLIA_CHAIN_ID, SEPOLIA_RPC, SEPOLIA_RPC_FALLBACK, SUPPORTED_TOKENS, type SaveEncryptedAesBackupRequest, type SimulationResult, TOKEN_ABI, type TokenConfig, type UnlockStrategy, WALLET_CONNECT_FAILURE_EVENT, type WagmiConfigOptions, WagmiRainbowKitProvider, type WalletConnectFailureDetail, type WalletNetworkConfig, type WalletType, type WalletTypeInfo, addThousandsSeparators, buildPodExplorerRequestUrl, computeCotiFee, computeErc20Fee, configureCotiPlugin, cotiMainnet, cotiTestnet, estimateBridgeFee, estimateCotiBridgeGasFeeDisplay, estimatePodPortalFees, ethereumMainnet, executePodPortalTransaction, fetchBridgeFees, fetchPodBridgeData, fetchPodOracleTokenUsdPrice, fetchTokenUsdPrice, formatBalanceWithNotation, formatPodFeeDisplay, formatPortalFeeDisplay, formatTokenBalanceDisplay, getChainConfig, getChainIdConstants, getContractAddresses, getEip6963MetaMaskProvider, getEip6963RabbyProvider, getEthereumProvider, getExplorerBaseUrlForChain, getNetworkNameForChain, getPluginConfig, getPodGasPrice, getPodInboxAddress, getPodSdkConfig, getPrivateTokensForChain, getPublicTokensForChain, getRpcUrlForChain, getRpcUrlForChainId, getRpcUrlsForChain, getSepoliaGasPrice, getSnapRequestParams, getTokenSimulationMeta, getTokensForChain, getUnlockStrategyForChain, getWagmiConfig, getWalletNetworkConfigs, getWalletNetworkOptions, hasCotiErrorCode, isChainUpdatesMuted, isCotiPluginError, isMultipleWalletsError, isSnapEnabled, loadPodRequests, logger, mobileZerionWallet, muteChainUpdates, defaultStyles as onboardModalDefaultStyles, podRequestsStorageKey, quoteCotiBridgeFees, quotePodPortalTransactionFees, quotePortalFeeOnly, requireChainConfig, resolveConnectedProvider, resolveIndexPageUi, resolveMetaMaskInjectedTarget, resolvePodRequestStatus, resolvePodTxGasPrice, resolvePrivateTokenContractAddress, resolvePrivateTokenTransferTarget, resolveRabbyInjectedTarget, savePodRequests, sepolia, setDebugLogging, signPodWithdrawPermit, simulateFeeOnChain, simulatePodPortalFee, truncateDecimalValue, unmuteChainUpdates, useBalanceUpdater, useBridgeData, useBridgeStatus, useMetamask, useNetworkEnforcer, usePrivacyBridgeContext, usePrivacyBridgeModals, usePrivacyBridgeNetwork, usePrivacyBridgePod, usePrivacyBridgeSwap, usePrivacyBridgeTokens, usePrivacyBridgeUnlock, usePrivacyBridgeWallet, usePrivateTokenBalance, usePrivateUnlock, useWalletType, wagmiConfig };
package/dist/index.js CHANGED
@@ -568,10 +568,10 @@ function configureCotiPlugin(config) {
568
568
  ...config.onboardingServices
569
569
  }
570
570
  };
571
- if ("snapInstallEnabled" in config && _config.debug) {
572
- console.log("[CotiPlugin] snapInstallEnabled:", {
573
- snapInstallEnabled: config.snapInstallEnabled,
574
- effective: isSnapInstallEnabled()
571
+ if ("snapEnabled" in config && _config.debug) {
572
+ console.log("[CotiPlugin] snapEnabled:", {
573
+ snapEnabled: config.snapEnabled,
574
+ effective: isSnapEnabled()
575
575
  });
576
576
  }
577
577
  }
@@ -582,8 +582,8 @@ function getSnapRequestParams(snapId = _config.snapId, snapVersion) {
582
582
  function getPluginConfig() {
583
583
  return _config;
584
584
  }
585
- function isSnapInstallEnabled() {
586
- return getPluginConfig().snapInstallEnabled !== false;
585
+ function isSnapEnabled() {
586
+ return getPluginConfig().snapEnabled !== false;
587
587
  }
588
588
  var _config;
589
589
  var init_plugin = __esm({
@@ -592,7 +592,7 @@ var init_plugin = __esm({
592
592
  init_chains();
593
593
  _config = {
594
594
  snapId: "npm:@coti-io/coti-snap",
595
- snapInstallEnabled: true,
595
+ snapEnabled: true,
596
596
  defaultNetworkId: void 0,
597
597
  debug: false,
598
598
  clearSessionKeyOnWagmiDisconnect: false,
@@ -1205,7 +1205,7 @@ __export(index_exports, {
1205
1205
  isChainUpdatesMuted: () => isChainUpdatesMuted,
1206
1206
  isCotiPluginError: () => isCotiPluginError,
1207
1207
  isMultipleWalletsError: () => isMultipleWalletsError,
1208
- isSnapInstallEnabled: () => isSnapInstallEnabled,
1208
+ isSnapEnabled: () => isSnapEnabled,
1209
1209
  loadPodRequests: () => loadPodRequests,
1210
1210
  logger: () => logger,
1211
1211
  mobileZerionWallet: () => mobileZerionWallet,
@@ -1558,6 +1558,7 @@ var resolveBridgeAddress = (chainId, symbol, pubTok) => {
1558
1558
  if (symbol === "USDC.e") return addresses.PrivacyBridgeUSDCe;
1559
1559
  if (symbol === "WADA") return addresses.PrivacyBridgeWADA;
1560
1560
  if (symbol === "gCOTI") return addresses.PrivacyBridgegCOTI;
1561
+ if (symbol === "NIGHT") return addresses.PrivacyBridgeNight;
1561
1562
  return addresses.PrivacyBridgeCotiNative;
1562
1563
  };
1563
1564
  var quoteCotiBridgeFees = async (params) => {
@@ -1589,7 +1590,7 @@ var quoteCotiBridgeFees = async (params) => {
1589
1590
  if (isWbtc) {
1590
1591
  publicDecimals = 8;
1591
1592
  privateDecimals = 8;
1592
- } else if (isUsdt || isUsdcE || isWada) {
1593
+ } else if (isUsdt || isUsdcE || isWada || isNight) {
1593
1594
  publicDecimals = 6;
1594
1595
  privateDecimals = 6;
1595
1596
  }
@@ -4323,8 +4324,10 @@ var SYMBOL_TO_ORACLE_BASE = {
4323
4324
  USDT: "USDT",
4324
4325
  USDC: "USDC",
4325
4326
  "USDC.e": "USDC",
4326
- WADA: "ADA"
4327
- // gCOTI is not in the on-chain price consumer
4327
+ WADA: "ADA",
4328
+ // Consumer base is uppercase GCOTI (lowercase gCOTI reverts).
4329
+ gCOTI: "GCOTI",
4330
+ NIGHT: "NIGHT"
4328
4331
  };
4329
4332
  function getPriceConsumerAddress(chainId = 7082400) {
4330
4333
  const addresses = CONTRACT_ADDRESSES[chainId];
@@ -4432,7 +4435,8 @@ var TOKEN_TO_ORACLE_SYMBOL = {
4432
4435
  USDT: "USDT",
4433
4436
  "USDC.e": "USDC",
4434
4437
  WADA: "ADA",
4435
- gCOTI: "GCOTI"
4438
+ gCOTI: "GCOTI",
4439
+ NIGHT: "NIGHT"
4436
4440
  };
4437
4441
  var TOKEN_DECIMALS = {
4438
4442
  COTI: 18,
@@ -4441,7 +4445,8 @@ var TOKEN_DECIMALS = {
4441
4445
  USDT: 6,
4442
4446
  "USDC.e": 6,
4443
4447
  WADA: 6,
4444
- gCOTI: 18
4448
+ gCOTI: 18,
4449
+ NIGHT: 6
4445
4450
  };
4446
4451
  async function simulateFeeOnChain(bridgeAddress, amount, fixedFee, percentageBps, maxFee, oracleSymbol, tokenDecimals, provider) {
4447
4452
  try {
@@ -4954,6 +4959,10 @@ var useSnap = (setSnapError) => {
4954
4959
  }
4955
4960
  }, [resolveProvider]);
4956
4961
  const isSnapInstalled = (0, import_react6.useCallback)(async () => {
4962
+ if (!isSnapEnabled()) {
4963
+ logger.log("\u2139\uFE0F Snap disabled via plugin config \u2014 treating as not installed");
4964
+ return false;
4965
+ }
4957
4966
  const provider = await resolveProvider();
4958
4967
  if (!provider) {
4959
4968
  logger.log("\u274C isSnapInstalled: No MetaMask provider");
@@ -4983,8 +4992,8 @@ var useSnap = (setSnapError) => {
4983
4992
  }
4984
4993
  }, [detectFlask, resolveProvider]);
4985
4994
  const connectToSnap = (0, import_react6.useCallback)(async () => {
4986
- if (!isSnapInstallEnabled()) {
4987
- logger.log("\u2139\uFE0F Snap install disabled via plugin config");
4995
+ if (!isSnapEnabled()) {
4996
+ logger.log("\u2139\uFE0F Snap disabled via plugin config");
4988
4997
  return false;
4989
4998
  }
4990
4999
  const provider = await resolveProvider();
@@ -5131,6 +5140,13 @@ var useSnap = (setSnapError) => {
5131
5140
  return parseSnapItUint256(result?.value);
5132
5141
  }, [connectedAddress, invokeSnapOperation]);
5133
5142
  const getAESKeyFromSnap = (0, import_react6.useCallback)(async (accountAddress, options) => {
5143
+ if (!isSnapEnabled()) {
5144
+ logger.log("\u2139\uFE0F Snap disabled via plugin config \u2014 treating as unavailable");
5145
+ throw new CotiPluginError(
5146
+ "SNAP_CONNECT_FAILED" /* SNAP_CONNECT_FAILED */,
5147
+ "COTI Snap is disabled for this app"
5148
+ );
5149
+ }
5134
5150
  if (setSnapError) setSnapError(null);
5135
5151
  const skipCache = options?.skipCache === true;
5136
5152
  if (isSnapRequestPending.current) {
@@ -5267,6 +5283,7 @@ var useSnap = (setSnapError) => {
5267
5283
  }
5268
5284
  }, [isSnapInstalled, setSnapError, resolveProvider, syncEnvironment]);
5269
5285
  const hasAesKeyInSnap = (0, import_react6.useCallback)(async (accountAddress) => {
5286
+ if (!isSnapEnabled()) return null;
5270
5287
  const provider = await resolveProvider();
5271
5288
  if (!provider) return null;
5272
5289
  const installed = await isSnapInstalled();
@@ -5299,6 +5316,10 @@ var useSnap = (setSnapError) => {
5299
5316
  }
5300
5317
  }, [isSnapInstalled, resolveProvider, syncEnvironment]);
5301
5318
  const saveAESKeyToSnap = (0, import_react6.useCallback)(async (key, accountAddress = "") => {
5319
+ if (!isSnapEnabled()) {
5320
+ logger.log("\u2139\uFE0F Snap disabled via plugin config \u2014 skipping AES key save");
5321
+ return false;
5322
+ }
5302
5323
  const provider = await resolveProvider();
5303
5324
  if (!provider) return false;
5304
5325
  try {
@@ -6737,7 +6758,7 @@ function useWalletType() {
6737
6758
  const walletType = mapConnectorIdToWalletType(connectorId);
6738
6759
  (0, import_react12.useEffect)(() => {
6739
6760
  let cancelled = false;
6740
- if (walletType !== "metamask" || !connector) {
6761
+ if (walletType !== "metamask" || !connector || !isSnapEnabled()) {
6741
6762
  setIsMetaMaskWithSnap(false);
6742
6763
  return;
6743
6764
  }
@@ -7826,7 +7847,8 @@ function useAesKeyProvider(walletTypeInfo) {
7826
7847
  }
7827
7848
  }
7828
7849
  let savedToSnap = false;
7829
- const canSaveToConnectedSnap = aesKey && walletTypeInfo.walletType === "metamask" && walletTypeInfo.isMetaMaskWithSnap && canPersistAesKeyToSnap();
7850
+ const shouldPersistToSnap = walletTypeInfo.isMetaMaskWithSnap || options.persistToSnap === true;
7851
+ const canSaveToConnectedSnap = !!aesKey && walletTypeInfo.walletType === "metamask" && shouldPersistToSnap && canPersistAesKeyToSnap();
7830
7852
  const canSaveEncryptedBackup = aesKey && isValidAesKey(aesKey) && options.saveBackup && servicesEnabled && (services?.saveEncryptedAesBackup || services?.replaceEncryptedAesBackup);
7831
7853
  if (canSaveToConnectedSnap) {
7832
7854
  emitStep("persisting-key");
@@ -7838,7 +7860,7 @@ function useAesKeyProvider(walletTypeInfo) {
7838
7860
  success: "Onboarding succeeded, but the AES key could not be saved to MetaMask Snap. You can retry by unlocking again."
7839
7861
  });
7840
7862
  }
7841
- } else if (aesKey && walletTypeInfo.walletType === "metamask" && canPersistAesKeyToSnap() && !walletTypeInfo.isMetaMaskWithSnap) {
7863
+ } else if (aesKey && walletTypeInfo.walletType === "metamask" && canPersistAesKeyToSnap() && !shouldPersistToSnap) {
7842
7864
  logger.log(
7843
7865
  "\u2139\uFE0F Skipping Snap AES persist \u2014 Snap is not connected to this origin"
7844
7866
  );
@@ -7923,7 +7945,17 @@ function useAesKeyProvider(walletTypeInfo) {
7923
7945
  }
7924
7946
  }
7925
7947
  },
7926
- [walletTypeInfo.walletType, getAESKeyFromSnap, saveAESKeyToSnap, clearSnapCache, connector, connectedChainId, emitStep, reportOnboardingFailure]
7948
+ [
7949
+ walletTypeInfo.walletType,
7950
+ walletTypeInfo.isMetaMaskWithSnap,
7951
+ getAESKeyFromSnap,
7952
+ saveAESKeyToSnap,
7953
+ clearSnapCache,
7954
+ connector,
7955
+ connectedChainId,
7956
+ emitStep,
7957
+ reportOnboardingFailure
7958
+ ]
7927
7959
  );
7928
7960
  return {
7929
7961
  getAesKey,
@@ -8308,6 +8340,7 @@ var usePrivacyBridgeNetworkSession = ({
8308
8340
  // src/context/privacyBridge/usePrivacyBridgeAccountSync.ts
8309
8341
  var import_react20 = require("react");
8310
8342
  var import_wagmi9 = require("wagmi");
8343
+ init_plugin();
8311
8344
  init_logger();
8312
8345
  var usePrivacyBridgeAccountSync = ({
8313
8346
  core,
@@ -8354,13 +8387,13 @@ var usePrivacyBridgeAccountSync = ({
8354
8387
  );
8355
8388
  const getAESKeyForCurrentNetwork = (0, import_react20.useCallback)(
8356
8389
  async (accountAddress, options) => {
8357
- if (options?.skipCache && walletTypeInfo.walletType === "metamask" && !options.forceContractOnboarding && !options.restoreOnly) {
8390
+ if (options?.skipCache && walletTypeInfo.walletType === "metamask" && isSnapEnabled() && !options.forceContractOnboarding && !options.restoreOnly) {
8358
8391
  return getAESKeyFromSnap(accountAddress, { skipCache: true });
8359
8392
  }
8360
8393
  if (sessionAesKey && !options?.forceContractOnboarding) return sessionAesKey;
8361
8394
  return options === void 0 ? getAesKeyFromProvider(accountAddress) : getAesKeyFromProvider(accountAddress, options.onProgress, options);
8362
8395
  },
8363
- [sessionAesKey, getAesKeyFromProvider, getAESKeyFromSnap]
8396
+ [sessionAesKey, getAesKeyFromProvider, getAESKeyFromSnap, walletTypeInfo.walletType]
8364
8397
  );
8365
8398
  const { updateAccountState } = useBalanceUpdater({
8366
8399
  setWalletAddress,
@@ -11173,8 +11206,8 @@ function usePrivateUnlockController(options = {}) {
11173
11206
  isPrivateUnlockedRef.current = unlock.isPrivateUnlocked;
11174
11207
  const connectedAddress = wallet.walletAddress || "";
11175
11208
  const isMetaMaskWallet = walletTypeInfo.walletType === "metamask";
11176
- const canAttemptSnapInstall = isMetaMaskWallet && !isMetaMaskMobileBrowser() && isSnapInstallEnabled();
11177
- const usesSnapStorage = canAttemptSnapInstall && (walletTypeInfo.isMetaMaskWithSnap || snapConnectedInModal);
11209
+ const canUseSnap = isMetaMaskWallet && !isMetaMaskMobileBrowser() && isSnapEnabled();
11210
+ const usesSnapStorage = canUseSnap && (walletTypeInfo.isMetaMaskWithSnap || snapConnectedInModal);
11178
11211
  const isActiveUnlockRequest = (0, import_react28.useCallback)(
11179
11212
  (requestId) => requestId === unlockRequestIdRef.current,
11180
11213
  []
@@ -11272,7 +11305,7 @@ function usePrivateUnlockController(options = {}) {
11272
11305
  dismissOnboardModal();
11273
11306
  }, [dismissOnboardModal, wallet.walletAddress]);
11274
11307
  const connectSnap = (0, import_react28.useCallback)(async () => {
11275
- if (!canAttemptSnapInstall) return false;
11308
+ if (!canUseSnap) return false;
11276
11309
  setModalError(null);
11277
11310
  try {
11278
11311
  const connected = await unlock.requestSnapConnection();
@@ -11291,7 +11324,7 @@ function usePrivateUnlockController(options = {}) {
11291
11324
  });
11292
11325
  return false;
11293
11326
  }
11294
- }, [canAttemptSnapInstall, unlock]);
11327
+ }, [canUseSnap, unlock]);
11295
11328
  const handleRestoreUnlockProgress = (0, import_react28.useCallback)((step) => {
11296
11329
  if (step === "signing-backup") {
11297
11330
  setCurrentStep(step);
@@ -11476,7 +11509,7 @@ function usePrivateUnlockController(options = {}) {
11476
11509
  contractOnboardingFailureRef.current = null;
11477
11510
  try {
11478
11511
  let useSnapStorageForOnboarding = usesSnapStorage || snapConnectedInModalRef.current;
11479
- if (!useSnapStorageForOnboarding && canAttemptSnapInstall) {
11512
+ if (!useSnapStorageForOnboarding && canUseSnap) {
11480
11513
  useSnapStorageForOnboarding = await connectSnap();
11481
11514
  }
11482
11515
  if (!isActiveUnlockRequest(requestId)) {
@@ -11485,6 +11518,8 @@ function usePrivateUnlockController(options = {}) {
11485
11518
  const ok = await unlock.refreshPrivateBalances({
11486
11519
  forceContractOnboarding: true,
11487
11520
  saveBackup: useSnapStorageForOnboarding ? false : saveBackup,
11521
+ // Explicit: don't rely on isMetaMaskWithSnap which can lag after connectSnap.
11522
+ persistToSnap: useSnapStorageForOnboarding,
11488
11523
  onProgress: (step, details) => {
11489
11524
  if (isActiveUnlockRequest(requestId)) {
11490
11525
  handleContractOnboardingProgress(step, details);
@@ -11540,7 +11575,7 @@ function usePrivateUnlockController(options = {}) {
11540
11575
  setIsUnlocking(false);
11541
11576
  }
11542
11577
  }
11543
- }, [canAttemptSnapInstall, connectSnap, connectedAddress, currentStep, dismissOnboardModal, handleContractOnboardingProgress, handleOnboardingIncomplete, isActiveUnlockRequest, onOnboardingCancelled, saveBackup, showOnboardingComplete, unlock, usesSnapStorage]);
11578
+ }, [canUseSnap, connectSnap, connectedAddress, currentStep, dismissOnboardModal, handleContractOnboardingProgress, handleOnboardingIncomplete, isActiveUnlockRequest, onOnboardingCancelled, saveBackup, showOnboardingComplete, unlock, usesSnapStorage]);
11544
11579
  const handleOnboardModalClose = (0, import_react28.useCallback)(() => {
11545
11580
  if (currentStep === "complete" || currentStep === "validating-key" && pendingCompleteRequestIdRef.current !== null) {
11546
11581
  void finishSuccessfulOnboarding();
@@ -12731,7 +12766,7 @@ var import_rainbowkit3 = require("@rainbow-me/rainbowkit");
12731
12766
  isChainUpdatesMuted,
12732
12767
  isCotiPluginError,
12733
12768
  isMultipleWalletsError,
12734
- isSnapInstallEnabled,
12769
+ isSnapEnabled,
12735
12770
  loadPodRequests,
12736
12771
  logger,
12737
12772
  mobileZerionWallet,