btc-wallet 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts", "../src/connector/base.ts", "../src/connector/injected.ts", "../src/connector/bitget.ts", "../src/connector/bybit.ts", "../src/connector/okx.ts", "../src/connector/tokenPocket.ts", "../src/connector/unisat.ts", "../src/connector/wizz.ts", "../src/connector/xverse.ts", "../src/context/index.tsx", "../src/components/connectModal/index.tsx", "../src/hooks/useAccountContract.ts", "../src/hooks/useAccounts.ts", "../src/hooks/useBTCProvider.ts", "../src/hooks/useConnectModal.ts", "../src/hooks/useConnector.ts", "../src/hooks/useETHProvider.ts", "../src/evmSigner/provider.ts", "../src/utils/eventUtils.ts", "../src/utils/txConfirmUtils.ts", "../src/evmSigner/walletClientProvider.ts", "esbuild-scss-modules-plugin:./spinner.module.scss", "../src/components/spinner/index.tsx", "esbuild-scss-modules-plugin:./button.module.scss", "../src/components/button/index.tsx", "../src/components/modal/index.tsx", "esbuild-scss-modules-plugin:./modal.module.scss", "esbuild-scss-modules-plugin:./connect.module.scss", "../src/components/signModal/index.tsx", "../src/utils/index.ts", "../src/utils/ethereumUtils.ts", "../src/components/copyText/index.tsx", "esbuild-scss-modules-plugin:./copyText.module.scss", "../src/components/transactionDetails/index.tsx", "esbuild-scss-modules-plugin:./tooltip.module.scss", "../src/components/tooltip/index.tsx", "esbuild-scss-modules-plugin:./transactionDetails.module.scss", "esbuild-scss-modules-plugin:./sign.module.scss", "../src/evmSigner/index.ts", "../src/hooks/useModalStateValue.ts", "../src/components/btcWalletSelectorContext.tsx", "../src/components/confirmBox/Modal.tsx", "../src/components/confirmBox/index.tsx", "../src/components/hook.tsx", "../src/utils/setupBTCWallet.ts", "../src/utils/initWalletButton.ts"],
4
- "sourcesContent": ["export * from './connector';\nexport { ConnectProvider } from './context';\nexport * from './hooks';\nexport * from './components/btcWalletSelectorContext'\nexport * from './utils/setupBTCWallet'\nexport * from './components/hook'\nexport const getVersion = () => {\n return '0.1.9';\n};\n\nif (typeof window !== 'undefined') {\n (window as any).__PARTICLE_BTC_CONNECT_VERSION = getVersion();\n}\n", "export interface WalletMetadata {\n id: string;\n name: string;\n icon: string;\n downloadUrl: string;\n}\n\nexport abstract class BaseConnector {\n abstract readonly metadata: WalletMetadata;\n abstract isReady(): boolean;\n abstract requestAccounts(): Promise<string[]>;\n abstract getAccounts(): Promise<string[]>;\n abstract getPublicKey(): Promise<string>;\n abstract signMessage(signStr: string, type?: 'ecdsa' | 'bip322-simple'): Promise<string>;\n abstract on(event: string, handler: (data?: unknown) => void): void;\n abstract removeListener(event: string, handler: (data?: unknown) => void): void;\n [key: string]: any;\n abstract getProvider(): any;\n abstract getNetwork(): Promise<'livenet' | 'testnet'>;\n abstract switchNetwork(network: 'livenet' | 'testnet'): Promise<void>;\n abstract sendBitcoin(toAddress: string, satoshis: number, options?: { feeRate: number }): Promise<string>;\n abstract sendInscription(\n address: string,\n inscriptionId: string,\n options?: { feeRate: number }\n ): Promise<{ txid: string }>;\n abstract disconnect(): void;\n}\n", "import { BaseConnector } from './base';\n\nexport abstract class InjectedConnector extends BaseConnector {\n constructor(private propertity: string) {\n super();\n const props = this.propertity?.split('.');\n if (!this.propertity || props.length > 2) {\n throw new Error('please input valid propertity');\n }\n }\n isReady(): boolean {\n if (typeof window !== 'undefined') {\n const props = this.propertity.split('.');\n if (props.length === 1) {\n return typeof (window as any)[props[0]] !== 'undefined';\n } else {\n return (\n typeof (window as any)[props[0]] !== 'undefined' && typeof (window as any)[props[0]][props[1]] !== 'undefined'\n );\n }\n }\n return false;\n }\n\n async requestAccounts(): Promise<string[]> {\n const accounts = await this.getProviderOrThrow().requestAccounts();\n console.log('\uD83D\uDE80 ~ InjectedConnector ~ requestAccounts ~ accounts:', accounts);\n return accounts;\n }\n\n async getAccounts(): Promise<string[]> {\n const accounts = await this.getProviderOrThrow().getAccounts();\n return accounts;\n }\n async getPublicKey(): Promise<string> {\n return this.getProviderOrThrow().getPublicKey();\n }\n async signMessage(signStr: string, type?: 'ecdsa' | 'bip322-simple'): Promise<string> {\n const addresses = await this.getAccounts();\n if (addresses.length === 0) {\n throw new Error(`${this.metadata.name} not connected!`);\n }\n return this.getProviderOrThrow().signMessage(signStr, type);\n }\n on(event: string, handler: (data?: unknown) => void) {\n const provider = this.getProvider();\n return provider?.on?.(event, handler);\n }\n removeListener(event: string, handler: (data?: unknown) => void) {\n const provider = this.getProvider();\n return provider?.removeListener?.(event, handler);\n }\n\n getProvider() {\n if (this.isReady()) {\n const props = this.propertity.split('.');\n if (props.length === 1) {\n return (window as any)[props[0]];\n } else {\n return (window as any)[props[0]][props[1]];\n }\n }\n }\n\n getProviderOrThrow() {\n const provider = this.getProvider();\n if (!provider) {\n throw new Error(`${this.metadata.name} is not install or not create Bitcoin wallet!`);\n }\n return provider;\n }\n\n async getNetwork(): Promise<'livenet' | 'testnet'> {\n return this.getProviderOrThrow().getNetwork();\n }\n async switchNetwork(network: 'livenet' | 'testnet'): Promise<void> {\n return this.getProviderOrThrow().switchNetwork(network);\n }\n\n async sendBitcoin(toAddress: string, satoshis: number, options?: { feeRate: number }): Promise<string> {\n return this.getProviderOrThrow().sendBitcoin(toAddress, satoshis, options);\n }\n\n async sendInscription(\n address: string,\n inscriptionId: string,\n options?: { feeRate: number }\n ): Promise<{ txid: string }> {\n const result = await this.getProviderOrThrow().sendInscription(address, inscriptionId, options);\n if (typeof result === 'string') {\n return {\n txid: result,\n };\n }\n\n return result;\n }\n\n disconnect() {}\n}\n", "import icon from '../icons/bitget.png';\nimport { type WalletMetadata } from './base';\nimport { InjectedConnector } from './injected';\n\nexport class BitgetConnector extends InjectedConnector {\n readonly metadata: WalletMetadata = {\n id: 'bitget',\n name: 'Bitget Wallet',\n icon,\n downloadUrl: 'https://web3.bitget.com/en/wallet-download',\n };\n\n constructor() {\n super('bitkeep.unisat');\n }\n}\n", "import icon from '../icons/bybit.png';\nimport { type WalletMetadata } from './base';\nimport { InjectedConnector } from './injected';\n\nexport class BybitConnector extends InjectedConnector {\n readonly metadata: WalletMetadata = {\n id: 'bybit',\n name: 'Bybit Wallet',\n icon,\n downloadUrl: 'https://www.bybit.com/download/',\n };\n\n constructor() {\n super('bybitWallet.bitcoin');\n }\n}\n", "import icon from '../icons/okx.svg';\nimport { type WalletMetadata } from './base';\nimport { InjectedConnector } from './injected';\n\nexport class OKXConnector extends InjectedConnector {\n readonly metadata: WalletMetadata = {\n id: 'okx',\n name: 'OKX Wallet',\n icon,\n downloadUrl: 'https://www.okx.com/download',\n };\n constructor() {\n super('okxwallet.bitcoin');\n }\n}\n", "import icon from '../icons/tokenpocket.png';\nimport { type WalletMetadata } from './base';\nimport { InjectedConnector } from './injected';\n\nexport class TokenPocketConnector extends InjectedConnector {\n readonly metadata: WalletMetadata = {\n id: 'tokenpocket',\n name: 'TokenPocket',\n icon,\n downloadUrl: 'https://www.tokenpocket.pro/en/download/app',\n };\n\n constructor() {\n super('tokenpocket.bitcoin');\n }\n}\n", "import icon from '../icons/unisat.svg';\nimport { type WalletMetadata } from './base';\nimport { InjectedConnector } from './injected';\n\nexport class UnisatConnector extends InjectedConnector {\n readonly metadata: WalletMetadata = {\n id: 'unisat',\n name: 'Unisat Wallet',\n icon,\n downloadUrl: 'https://unisat.io',\n };\n\n constructor() {\n super('unisat');\n }\n}\n", "import icon from '../icons/wizz.svg';\nimport { type WalletMetadata } from './base';\nimport { InjectedConnector } from './injected';\n\nexport class WizzConnector extends InjectedConnector {\n readonly metadata: WalletMetadata = {\n id: 'wizz',\n name: 'Wizz Wallet',\n icon,\n downloadUrl: 'https://wizzwallet.io',\n };\n\n constructor() {\n super('wizz');\n }\n}\n", "import EventEmitter from 'events';\nimport type { Address, GetAddressOptions, SendBtcTransactionOptions, SignMessageOptions } from 'sats-connect';\nimport icon from '../icons/xverse.png';\nimport { BaseConnector, type WalletMetadata } from './base';\nexport class XverseConnector extends BaseConnector {\n #network = 'Mainnet'; // Testnet\n #event = new EventEmitter();\n constructor() {\n super();\n this.#event.setMaxListeners(100);\n }\n readonly metadata: WalletMetadata = {\n id: 'xverse',\n name: 'Xverse Wallet',\n icon,\n downloadUrl: 'https://www.xverse.app',\n };\n isReady(): boolean {\n return typeof window !== 'undefined' && typeof window.BitcoinProvider !== 'undefined';\n }\n private loadAccounts = async (network: 'Mainnet' | 'Testnet') => {\n const { getAddress, AddressPurpose } = await import('sats-connect');\n const addresses = await new Promise<Address[]>((resolve, reject) => {\n const getAddressOptions: GetAddressOptions = {\n payload: {\n purposes: [AddressPurpose.Payment, AddressPurpose.Ordinals],\n message: 'Address for receiving Ordinals and payments',\n network: {\n type: network as any,\n },\n },\n onFinish: (response) => {\n resolve(response.addresses);\n },\n onCancel: () =>\n reject({\n code: 4001,\n message: 'User rejected the request.',\n }),\n };\n getAddress(getAddressOptions).catch((error) => reject(error));\n });\n localStorage.setItem('btc-connect-xverse-addresses-' + network, JSON.stringify(addresses));\n return addresses;\n };\n async sendInscription(): Promise<{ txid: string }> {\n throw new Error('Unsupported');\n }\n async requestAccounts(): Promise<string[]> {\n if (!this.isReady()) {\n throw new Error(`${this.metadata.name} is not install!`);\n }\n const addresses = await this.loadAccounts(this.#network as any);\n return addresses.map((item) => item.address);\n }\n async getAccounts(): Promise<string[]> {\n if (!this.isReady()) {\n throw new Error(`${this.metadata.name} is not install!`);\n }\n const data = localStorage.getItem('btc-connect-xverse-addresses-' + this.#network);\n if (data) {\n const addresses: Address[] = JSON.parse(data);\n return addresses.map((item) => item.address);\n } else {\n return [];\n }\n }\n async getPublicKey(): Promise<string> {\n if (!this.isReady()) {\n throw new Error(`${this.metadata.name} is not install!`);\n }\n const data = localStorage.getItem('btc-connect-xverse-addresses-' + this.#network);\n if (data) {\n const addresses: Address[] = JSON.parse(data);\n return addresses[0].publicKey;\n } else {\n return '';\n }\n }\n async signMessage(signStr: string): Promise<string> {\n if (!this.isReady()) {\n throw new Error(`${this.metadata.name} is not install!`);\n }\n const addresses = await this.getAccounts();\n if (addresses.length === 0) {\n throw new Error(`${this.metadata.name} not connected!`);\n }\n const { signMessage } = await import('sats-connect');\n\n const sig = await new Promise<string>((resolve, reject) => {\n const signMessageOptions: SignMessageOptions = {\n payload: {\n network: {\n type: this.#network as any,\n },\n address: addresses[0],\n message: signStr,\n },\n onFinish: (response) => {\n resolve(response);\n },\n onCancel: () => {\n reject({\n code: 4001,\n message: 'User rejected the request.',\n });\n },\n };\n signMessage(signMessageOptions).catch((e) => {\n reject(e);\n });\n });\n\n const modifiedSig = Buffer.from(sig, 'base64');\n modifiedSig[0] = 31 + ((modifiedSig[0] - 31) % 4);\n return modifiedSig.toString('base64');\n }\n on(event: string, handler: (data?: unknown) => void) {\n return this.#event.on(event, handler);\n }\n removeListener(event: string, handler: (data?: unknown) => void) {\n return this.#event.removeListener(event, handler);\n }\n getProvider() {\n if (this.isReady()) {\n return window.BitcoinProvider;\n }\n }\n async getNetwork(): Promise<'livenet' | 'testnet'> {\n if (!this.isReady()) {\n throw new Error(`${this.metadata.name} is not install!`);\n }\n return this.#network === 'Mainnet' ? 'livenet' : 'testnet';\n }\n async switchNetwork(): Promise<void> {\n throw new Error('Unsupported');\n }\n async sendBitcoin(toAddress: string, satoshis: number): Promise<string> {\n const provider = this.getProvider();\n if (!provider) {\n throw new Error(`${this.metadata.name} is not install!`);\n }\n const { sendBtcTransaction } = await import('sats-connect');\n\n const addresses = await this.getAccounts();\n if (addresses.length === 0) {\n throw new Error(`${this.metadata.name} not connected!`);\n }\n const result = await new Promise<string>((resolve, reject) => {\n const sendBtcOptions: SendBtcTransactionOptions = {\n payload: {\n network: {\n type: this.#network as any,\n },\n recipients: [\n {\n address: toAddress,\n amountSats: BigInt(satoshis),\n },\n ],\n senderAddress: addresses[0],\n },\n onFinish: (response) => {\n resolve(response);\n },\n onCancel: () => {\n reject({\n code: 4001,\n message: 'User rejected the request.',\n });\n },\n };\n sendBtcTransaction(sendBtcOptions).catch((e) => reject(e));\n });\n return result;\n }\n disconnect(): void {\n localStorage.removeItem('btc-connect-xverse-addresses-Mainnet');\n localStorage.removeItem('btc-connect-xverse-addresses-Testnet');\n }\n}\n", "import { SmartAccount, type AAOptions, type AccountContract } from '@particle-network/aa';\nimport { chains } from '@particle-network/chains';\nimport { walletEntryPlugin, type WalletOption } from '@particle-network/wallet';\nimport { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';\nimport ConnectModal from '../components/connectModal';\nimport SignModal from '../components/signModal';\nimport { type BaseConnector } from '../connector/base';\nimport { AASignerProvider } from '../evmSigner';\nimport useModalStateValue from '../hooks/useModalStateValue';\nimport type { AccountInfo } from '../types/accountInfo';\nimport { EventName } from '../types/eventName';\nimport { checkBTCVersion } from '../utils';\nimport { getBTCAAAddress, getBTCAccountInfo } from '../utils/ethereumUtils';\nimport events from '../utils/eventUtils';\nimport txConfirm from '../utils/txConfirmUtils';\n\ninterface GlobalState {\n connectorId?: string;\n setConnectorId: (connectorId?: string) => void;\n connector?: BaseConnector;\n connectors: BaseConnector[];\n openConnectModal: () => void;\n closeConnectModal: () => void;\n accounts: string[];\n provider: any;\n disconnect: () => void;\n requestDirectAccount: (connector: BaseConnector) => any;\n getPublicKey: () => Promise<string>;\n signMessage: (message: string) => Promise<string>;\n evmAccount?: string;\n smartAccount?: SmartAccount;\n switchNetwork: (network: 'livenet' | 'testnet') => Promise<void>;\n getNetwork: () => Promise<'livenet' | 'testnet'>;\n sendBitcoin: (toAddress: string, satoshis: number, options?: { feeRate: number }) => Promise<string>;\n accountContract: AccountContract;\n setAccountContract: (accountContract: AccountContract) => void;\n getSmartAccountInfo: () => Promise<AccountInfo | undefined>;\n}\n\nconst ConnectContext = createContext<GlobalState>({} as any);\n\ninterface ConnectOptions {\n projectId: string;\n clientKey: string;\n appId: string;\n aaOptions: AAOptions;\n rpcUrls?: Record<number, string>;\n walletOptions?: Omit<WalletOption, 'erc4337' | 'customStyle'> & {\n customStyle?: Omit<WalletOption['customStyle'], 'supportChains'>;\n };\n}\n\nconst SAContractKey = 'particle-sa-config';\n\nexport const ConnectProvider = ({\n children,\n options,\n connectors,\n autoConnect = true,\n}: {\n children: React.ReactNode;\n options: ConnectOptions;\n connectors: BaseConnector[];\n autoConnect?: boolean;\n}) => {\n const {\n closeModal: closeConnectModal,\n isModalOpen: connectModalOpen,\n openModal: openConnectModal,\n } = useModalStateValue();\n\n const { closeModal: closeSignModal, isModalOpen: signModalOpen, openModal: openSignModal } = useModalStateValue();\n\n const [connectorId, setConnectorId] = useState<string>();\n const [accounts, setAccounts] = useState<string[]>([]);\n const [evmAccount, setEVMAccount] = useState<string>();\n const [accountContract, _setAccountContract] = useState<AccountContract>({\n name: Object.keys(options.aaOptions.accountContracts)?.[0] || 'BTC',\n version:\n options.aaOptions.accountContracts[Object.keys(options.aaOptions.accountContracts)?.[0] || 'BTC']?.[0].version ||\n '1.0.0',\n });\n\n const setAccountContract = useCallback(\n (config: AccountContract) => {\n if (!checkBTCVersion(options.aaOptions.accountContracts, config.name, config.version)) {\n throw new Error('Invalid Account Contract');\n }\n localStorage.setItem(SAContractKey, JSON.stringify(config));\n _setAccountContract(config);\n },\n [options.aaOptions.accountContracts, _setAccountContract]\n );\n\n useEffect(() => {\n const id = localStorage.getItem('current-connector-id');\n if (id) {\n setConnectorId(id);\n }\n }, [autoConnect]);\n\n const evmSupportChainIds = useMemo(() => {\n let chainIds = options.aaOptions.accountContracts[accountContract.name]\n ?.filter((item) => item.version === accountContract.version)\n .map((item) => item.chainIds)\n .reduce((a, b) => {\n a.push(...b);\n return a;\n }, []);\n chainIds = Array.from(new Set(chainIds || []));\n return chainIds;\n }, [options.aaOptions.accountContracts, accountContract]);\n\n const connector = useMemo(() => {\n return connectors.find((item) => item.metadata.id === connectorId);\n }, [connectorId, connectors]);\n\n const getPublicKey = useCallback(async () => {\n if (!connector) {\n throw new Error('Wallet not connected!');\n }\n const pubKey = await connector.getPublicKey();\n return pubKey;\n }, [connector]);\n\n const signMessage = useCallback(\n async (message: string) => {\n if (!connector) {\n throw new Error('Wallet not connected!');\n }\n const signature = await connector.signMessage(message);\n return signature;\n },\n [connector]\n );\n\n const sendBitcoin = useCallback(\n async (toAddress: string, satoshis: number, options?: { feeRate: number }) => {\n if (!connector) {\n throw new Error('Wallet not connected!');\n }\n\n const signature = await connector.sendBitcoin(toAddress, satoshis, options);\n return signature;\n },\n [connector]\n );\n\n const getNetwork = useCallback(async () => {\n if (!connector) {\n throw new Error('Wallet not connected!');\n }\n const network = await connector.getNetwork();\n return network;\n }, [connector]);\n\n const switchNetwork = useCallback(\n async (network: 'livenet' | 'testnet') => {\n if (!connector) {\n throw new Error('Wallet not connected!');\n }\n await connector.switchNetwork(network);\n },\n [connector]\n );\n\n const smartAccount = useMemo(() => {\n if (typeof window === 'undefined') {\n return undefined;\n }\n\n if (\n !(window as any).__bitcoinSmartAccount ||\n ((window as any)?.__bitcoinSmartAccount &&\n ((window as any)?.__bitcoinSmartAccount.smartAccountContract.version !== accountContract.version ||\n (window as any)?.__bitcoinSmartAccount.smartAccountContract.name !== accountContract.name))\n ) {\n const smartAccount = new SmartAccount(\n new AASignerProvider(evmSupportChainIds, options.projectId, options.clientKey, options.rpcUrls) as any,\n options\n );\n smartAccount.setSmartAccountContract(accountContract);\n (window as any).__bitcoinSmartAccount = smartAccount;\n }\n (window as any).__bitcoinSmartAccount.provider.getPublicKey = getPublicKey;\n (window as any).__bitcoinSmartAccount.provider.personalSign = signMessage;\n return (window as any).__bitcoinSmartAccount as SmartAccount;\n }, [options, evmSupportChainIds, getPublicKey, signMessage, accountContract]);\n\n useEffect(() => {\n if (accounts.length > 0 && smartAccount) {\n getBTCAAAddress(smartAccount, accounts[0], accountContract.name, accountContract.version)\n .then((res) => {\n setEVMAccount(res);\n })\n .catch((e) => {\n setEVMAccount(undefined);\n console.error('smartAccount getAddress error', e);\n // ignore\n });\n } else {\n setEVMAccount(undefined);\n }\n }, [accountContract, accounts, smartAccount]);\n\n const getSmartAccountInfo = useCallback(async () => {\n if (accounts.length > 0 && smartAccount) {\n const accountInfo = await getBTCAccountInfo(\n smartAccount,\n accounts[0],\n accountContract.name,\n accountContract.version\n );\n setEVMAccount(accountInfo.smartAccountAddress);\n return accountInfo;\n }\n return undefined;\n }, [accounts, smartAccount, accountContract, setEVMAccount]);\n\n const requestAccount = useCallback(\n async (connector: BaseConnector) => {\n let accounts = await connector.getAccounts();\n console.log('requestAccount start, autoConnect', accounts, autoConnect);\n if (accounts.length === 0 && autoConnect) {\n accounts = await connector.requestAccounts();\n }\n setAccounts(accounts);\n },\n [autoConnect]\n );\n\n const requestDirectAccount = useCallback(\n async (connector: BaseConnector) => {\n console.log(111)\n let accounts = await connector.getAccounts();\n console.log('requestAccount start, autoConnect', accounts, autoConnect);\n if (accounts.length === 0) {\n accounts = await connector.requestAccounts();\n }\n setAccounts(accounts);\n\n return accounts\n },\n []\n );\n\n useEffect(() => {\n if (connector) {\n requestAccount(connector).catch((e: any) => {\n console.log('get account error', e);\n\n setAccounts([]);\n });\n } else {\n setAccounts([]);\n }\n }, [connector, requestAccount]);\n\n useEffect(() => {\n const onAccountChange = (accounts: string[]) => {\n setAccounts(accounts);\n };\n connector?.on('accountsChanged', onAccountChange as any);\n return () => {\n connector?.removeListener('accountsChanged', onAccountChange as any);\n };\n }, [connector]);\n\n const provider = useMemo(() => {\n if (connectorId) {\n return connectors.find((item) => item.metadata.id === connectorId)?.getProvider();\n }\n }, [connectorId, connectors]);\n\n const disconnect = useCallback(() => {\n localStorage.removeItem('current-connector-id');\n txConfirm.reset();\n if (connector) {\n connector.disconnect();\n }\n setConnectorId(undefined);\n }, [connector]);\n\n useEffect(() => {\n const config = JSON.parse(localStorage.getItem(SAContractKey) || '{}');\n if (\n config.name &&\n config.version &&\n checkBTCVersion(options.aaOptions.accountContracts, config.name, config.version)\n ) {\n _setAccountContract(config);\n }\n }, [options.aaOptions.accountContracts, _setAccountContract]);\n\n useEffect(() => {\n if (options.walletOptions?.visible !== false) {\n const supportChains = evmSupportChainIds.map((id) => chains.getEVMChainInfoById(id));\n if (supportChains.some((chain) => !chain)) {\n throw new Error(`Please config valid chain ids, ${JSON.stringify(evmSupportChainIds)}`);\n }\n walletEntryPlugin.init(\n {\n projectId: options.projectId,\n clientKey: options.clientKey,\n appId: options.appId,\n },\n {\n ...options.walletOptions,\n erc4337: accountContract,\n customStyle: {\n ...options.walletOptions?.customStyle,\n supportChains: supportChains as any,\n },\n }\n );\n console.log('walletEntryPlugin init');\n }\n }, [options, evmSupportChainIds, accountContract]);\n\n useEffect(() => {\n if (smartAccount && options.walletOptions?.visible !== false) {\n walletEntryPlugin.setWalletCore({\n ethereum: smartAccount.provider,\n });\n console.log('walletEntryPlugin setWalletCore');\n }\n }, [smartAccount, options]);\n\n useEffect(() => {\n if (options.walletOptions?.visible !== false) {\n if (evmAccount) {\n walletEntryPlugin.walletEntryCreate();\n console.log('walletEntryPlugin walletEntryCreate');\n } else {\n walletEntryPlugin.walletEntryDestroy();\n console.log('walletEntryPlugin walletEntryDestroy');\n }\n }\n }, [evmAccount, smartAccount, options]);\n\n useEffect(() => {\n if (accounts.length === 0) {\n closeConnectModal();\n closeSignModal();\n if (events.listenerCount(EventName.sendUserOpResult) > 0) {\n events.emit(EventName.sendUserOpResult, {\n error: {\n code: -32600,\n message: 'Wallet disconnected',\n },\n });\n } else if (events.listenerCount(EventName.personalSignResult) > 0) {\n events.emit(EventName.personalSignResult, {\n error: {\n code: -32600,\n message: 'Wallet disconnected',\n },\n });\n } else if (events.listenerCount(EventName.signTypedDataResult) > 0) {\n events.emit(EventName.signTypedDataResult, {\n error: {\n code: -32600,\n message: 'Wallet disconnected',\n },\n });\n }\n }\n }, [accounts, closeConnectModal, closeSignModal]);\n\n return (\n <ConnectContext.Provider\n value={{\n connectorId,\n setConnectorId,\n connector,\n connectors,\n openConnectModal,\n closeConnectModal,\n accounts,\n provider,\n disconnect,\n requestDirectAccount,\n getPublicKey,\n signMessage,\n evmAccount,\n smartAccount,\n getNetwork,\n switchNetwork,\n sendBitcoin,\n accountContract: accountContract,\n setAccountContract: setAccountContract,\n getSmartAccountInfo,\n }}\n >\n {children}\n <ConnectModal open={connectModalOpen} onClose={closeConnectModal} />\n <SignModal open={signModalOpen} onClose={closeSignModal} onOpen={openSignModal} />\n </ConnectContext.Provider>\n );\n};\n\nexport const useConnectProvider = () => {\n const context = useContext(ConnectContext);\n return context;\n};\n", "import { useEffect, useState } from 'react';\nimport { type BaseConnector } from '../../connector/base';\nimport { useConnectProvider } from '../../context';\nimport { useConnector } from '../../hooks';\nimport back from '../../icons/back.svg';\nimport close from '../../icons/close.svg';\nimport retryIcon from '../../icons/retry.svg';\nimport Button from '../button';\nimport Modal from '../modal';\nimport styles from './connect.module.scss';\n\nconst ConnectModal = ({ open, onClose }: { open: boolean; onClose: () => void }) => {\n const [backVisible, setBackVisible] = useState(false);\n const [retryVisible, setRetryVisible] = useState(false);\n const [walletReady, setWalletReady] = useState(true);\n const [selectConnector, setSelectConnector] = useState<BaseConnector>();\n const { closeConnectModal } = useConnectProvider();\n const { connect, connectors } = useConnector();\n\n useEffect(() => {\n if (!open) {\n setBackVisible(false);\n setRetryVisible(false);\n setWalletReady(true);\n setSelectConnector(undefined);\n }\n }, [open]);\n\n const onConnect = async (connector: BaseConnector) => {\n setBackVisible(true);\n setSelectConnector(connector);\n if (connector.isReady()) {\n try {\n await connect(connector.metadata.id);\n closeConnectModal();\n } catch (error: any) {\n console.error('onConnect error', error);\n if (error.code === 4001) {\n setRetryVisible(true);\n }\n }\n } else {\n setWalletReady(false);\n }\n };\n\n const onBack = () => {\n setBackVisible(false);\n setRetryVisible(false);\n setWalletReady(true);\n setSelectConnector(undefined);\n };\n\n const onRetry = () => {\n setRetryVisible(false);\n if (selectConnector) {\n onConnect(selectConnector);\n }\n };\n\n return (\n <Modal open={open} onClose={onClose} isDismissable={false} contentClassName={styles.connectModal}>\n <div className={styles.title}>{selectConnector?.metadata.name || 'Choose Wallet'}</div>\n <img className={styles.closeBtn} src={close} onClick={onClose}></img>\n {backVisible && <img className={styles.backBtn} src={back} onClick={onBack}></img>}\n\n {!backVisible &&\n connectors.map((connector) => {\n return (\n <div className={styles.walletItem} key={connector.metadata.id} onClick={() => onConnect(connector)}>\n <img className={styles.walletIcon} src={connector.metadata.icon}></img>\n <div className={styles.walletName}>{connector.metadata.name}</div>\n </div>\n );\n })}\n\n {backVisible && selectConnector && (\n <div className={styles.connecting}>\n <div className={styles.connectingIconContainer}>\n <img className={styles.connectingIcon} src={selectConnector.metadata.icon}></img>\n {retryVisible && (\n <div className={styles.retryContainer} onClick={onRetry}>\n <img className={styles.retryIcon} src={retryIcon}></img>\n </div>\n )}\n </div>\n\n {walletReady ? (\n <>\n <div className={styles.connection}>{retryVisible ? 'Request Cancelled' : 'Requesting Connection'}</div>\n <div className={styles.acceptRequest}>\n {retryVisible\n ? 'You cancelled the request.\\nClick above to try again.'\n : 'Accept the request through your wallet to connect to this app.'}\n </div>\n </>\n ) : (\n <>\n <div className={styles.connection}>Wallet Not Installed.</div>\n <Button\n className={styles.btnDownload}\n onClick={() => {\n window.open(selectConnector?.metadata.downloadUrl, '_blank');\n }}\n >\n Get\n </Button>\n </>\n )}\n </div>\n )}\n </Modal>\n );\n};\n\nexport default ConnectModal;\n", "import { useConnectProvider } from '../context';\n\nexport const useAccountContract = () => {\n const { accountContract, setAccountContract } = useConnectProvider();\n return {\n accountContract,\n setAccountContract,\n };\n};\n", "import { useConnectProvider } from '../context';\n\nexport const useAccounts = () => {\n const { accounts } = useConnectProvider();\n return { accounts };\n};\n", "import { useCallback } from 'react';\nimport { useConnectProvider } from '../context';\n\nexport const useBTCProvider = () => {\n const { connector, provider, accounts, getPublicKey, signMessage, getNetwork, switchNetwork, sendBitcoin } =\n useConnectProvider();\n\n const sendInscription = useCallback(\n async (address: string, inscriptionId: string, options?: { feeRate: number }) => {\n if (!connector) {\n throw new Error('Wallet not connected!');\n }\n const result = await connector.sendInscription(address, inscriptionId, options);\n return result;\n },\n [connector]\n );\n\n return { provider, accounts, getPublicKey, signMessage, getNetwork, switchNetwork, sendBitcoin, sendInscription, connector };\n};\n", "import { useConnectProvider } from '../context';\n\nexport const useConnectModal = () => {\n const { openConnectModal, disconnect, requestDirectAccount } = useConnectProvider();\n return { openConnectModal, disconnect, requestDirectAccount };\n};\n", "import { useCallback } from 'react';\nimport { useConnectProvider } from '../context';\n\nexport const useConnector = () => {\n const { connectors, setConnectorId } = useConnectProvider();\n\n const connect = useCallback(\n async (connectorId: string) => {\n const connector = connectors.find((item) => item.metadata.id === connectorId);\n if (!connector) {\n throw new Error(`connector id ${connectorId} not found`);\n }\n const accounts = await connector.requestAccounts();\n if (accounts.length > 0) {\n localStorage.setItem('current-connector-id', connector.metadata.id);\n setConnectorId(connector.metadata.id);\n }\n },\n [connectors, setConnectorId]\n );\n\n return { connectors, connect };\n};\n", "import { intToHex } from '@ethereumjs/util';\nimport type { SendTransactionParams, Transaction, UserOpBundle, UserOpParams } from '@particle-network/aa';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport { createWalletClient, custom, type PublicClient } from 'viem';\nimport { useConnectProvider } from '../context';\nimport { EthereumProvider } from '../evmSigner/provider';\nimport { WalletClientProvider } from '../evmSigner/walletClientProvider';\nimport { EventName } from '../types/eventName';\nimport events, { getPendingSignEventAccount } from '../utils/eventUtils';\nimport txConfirm from '../utils/txConfirmUtils';\n\n\nexport const useETHProvider: any = () => {\n const { evmAccount, smartAccount, getSmartAccountInfo } = useConnectProvider();\n const [chainId, setChainId] = useState<number>();\n\n useEffect(() => {\n if (smartAccount) {\n const chainId = (smartAccount.provider as any).chainId as number;\n setChainId(chainId);\n\n const onChangeChange = (id: string) => {\n setChainId(Number(id));\n };\n smartAccount.provider.on('chainChanged', onChangeChange);\n return () => {\n smartAccount.provider.removeListener('chainChanged', onChangeChange);\n };\n }\n }, [smartAccount]);\n\n const switchChain = useCallback(\n async (chainId: number) => {\n if (smartAccount?.provider) {\n await smartAccount.provider.request({\n method: 'wallet_switchEthereumChain',\n params: [\n {\n chainId: intToHex(chainId),\n },\n ],\n });\n }\n },\n [smartAccount?.provider]\n );\n\n const getFeeQuotes = useCallback(\n async (tx: Transaction | Transaction[]) => {\n if (!smartAccount) {\n throw new Error('The smart account is not initialized.');\n }\n return smartAccount.getFeeQuotes(tx);\n },\n [smartAccount]\n );\n\n const buildUserOp = useCallback(\n async ({ tx, feeQuote, tokenPaymasterAddress }: UserOpParams) => {\n if (!smartAccount) {\n throw new Error('The smart account is not initialized.');\n }\n const result = await smartAccount.buildUserOperation({ tx, feeQuote, tokenPaymasterAddress });\n return result;\n },\n [smartAccount]\n );\n\n const sendUserOp = useCallback(\n async (params: SendTransactionParams, forceHideConfirmModal?: boolean) => {\n if (!smartAccount) {\n throw new Error('The smart account is not initialized.');\n }\n\n const showConfirmModal = !forceHideConfirmModal && !txConfirm.isNotRemind();\n\n if (showConfirmModal) {\n if (getPendingSignEventAccount() > 0) {\n throw new Error('Operation failed, there is a transaction being processed');\n }\n }\n\n let userOpBundle: UserOpBundle | undefined;\n if (\n Object.prototype.hasOwnProperty.call(params, 'userOpHash') &&\n Object.prototype.hasOwnProperty.call(params, 'userOp')\n ) {\n const { userOpHash, userOp } = params as UserOpBundle;\n if (userOpHash && userOp) {\n userOpBundle = { userOpHash, userOp };\n }\n }\n\n if (!userOpBundle) {\n const { tx, feeQuote, tokenPaymasterAddress } = params as UserOpParams;\n userOpBundle = await buildUserOp({ tx, feeQuote, tokenPaymasterAddress });\n }\n\n if (!showConfirmModal) {\n return smartAccount.sendUserOperation(userOpBundle);\n }\n\n return new Promise<string>((resolve, reject) => {\n events.emit(EventName.sendUserOp, userOpBundle);\n events.once(EventName.sendUserOpResult, ({ result, error }) => {\n if (result) {\n resolve(result);\n } else {\n reject(error);\n }\n });\n });\n },\n [smartAccount, buildUserOp]\n );\n\n const publicClient = useMemo(() => {\n if (!smartAccount || !chainId) {\n return undefined;\n }\n return (smartAccount?.provider as any).publicClient as PublicClient;\n }, [smartAccount, chainId]);\n\n const provider = useMemo(() => {\n const ethereumProvider = new EthereumProvider(sendUserOp, smartAccount?.provider as any, evmAccount);\n return ethereumProvider;\n }, [evmAccount, sendUserOp, smartAccount?.provider]);\n\n const walletClient = useMemo(() => {\n return createWalletClient({\n transport: custom(new WalletClientProvider(provider)),\n });\n }, [provider]);\n\n return {\n provider,\n /** @deprecated please use account */\n evmAccount,\n account: evmAccount,\n getSmartAccountInfo,\n switchChain,\n chainId,\n getFeeQuotes,\n buildUserOp,\n sendUserOp,\n publicClient,\n walletClient,\n };\n};\n", "import type { IEthereumProvider, JsonRpcRequest, SendTransactionParams } from '@particle-network/aa';\nimport { type AASignerProvider } from '.';\n\nexport class EthereumProvider implements IEthereumProvider {\n constructor(\n public sendUserOp: (params: SendTransactionParams, forceHideConfirmModal?: boolean) => Promise<string>,\n public signer?: AASignerProvider,\n public account?: string\n ) {}\n\n on(event: string, listener: any): this {\n this.signer?.on(event, listener);\n return this;\n }\n\n once(event: string, listener: any): this {\n this.signer?.once(event, listener);\n return this;\n }\n\n off(event: string, listener: any): this {\n this.signer?.off(event, listener);\n return this;\n }\n\n removeListener(event: string, listener: any): this {\n this.signer?.removeListener(event, listener);\n return this;\n }\n\n async request(arg: Partial<JsonRpcRequest>): Promise<any> {\n const method = arg.method;\n if (!method) {\n throw new Error('Method not found.');\n }\n\n if (method === 'eth_accounts' || method === 'eth_requestAccounts') {\n return this.account ? [this.account] : [];\n } else if (method === 'eth_sendTransaction') {\n const txData = arg.params?.[0];\n const result = await this.sendUserOp({ tx: txData });\n return result;\n }\n\n return this.signer?.request(arg as any);\n }\n}\n", "import { EventEmitter } from 'events';\nimport { EventName } from '../types/eventName';\n\nconst events = new EventEmitter();\nevents.setMaxListeners(100);\n\nexport const getPendingSignEventAccount = () => {\n return (\n events.listenerCount(EventName.sendUserOpResult) +\n events.listenerCount(EventName.personalSignResult) +\n events.listenerCount(EventName.signTypedDataResult)\n );\n};\n\nexport default events;\n", "const txConfirm = {\n isNotRemind: () => {\n if (typeof window === 'undefined') return false;\n const value = localStorage.getItem('tx-confirm-modal-remind');\n return value === '0';\n },\n setNotRemind: (notRemind: boolean) => {\n if (typeof window === 'undefined') return;\n if (notRemind) {\n localStorage.setItem('tx-confirm-modal-remind', '0');\n } else {\n localStorage.removeItem('tx-confirm-modal-remind');\n }\n },\n reset: () => {\n if (typeof window === 'undefined') return;\n localStorage.removeItem('tx-confirm-modal-remind');\n },\n};\n\nexport default txConfirm;\n", "import type { IEthereumProvider, JsonRpcRequest } from '@particle-network/aa';\nimport { EventName } from '../types/eventName';\nimport { EVMMethod } from '../types/evmMethod';\nimport events, { getPendingSignEventAccount } from '../utils/eventUtils';\nimport txConfirm from '../utils/txConfirmUtils';\n\nexport class WalletClientProvider implements IEthereumProvider {\n constructor(private provider: IEthereumProvider) {}\n\n on(event: string, listener: any): this {\n this.provider.on(event, listener);\n return this;\n }\n\n once(event: string, listener: any): this {\n this.provider.once(event, listener);\n return this;\n }\n\n off(event: string, listener: any): this {\n this.provider.off(event, listener);\n return this;\n }\n\n removeListener(event: string, listener: any): this {\n this.provider.removeListener(event, listener);\n return this;\n }\n\n async request(arg: Partial<JsonRpcRequest>): Promise<any> {\n const method = arg.method;\n if (!method) {\n throw new Error('Method not found.');\n }\n\n if (method === EVMMethod.personalSign || method.startsWith(EVMMethod.signTypedData)) {\n const showConfirmModal = !txConfirm.isNotRemind();\n if (showConfirmModal) {\n if (getPendingSignEventAccount() > 0) {\n throw new Error('Operation failed, there is a transaction being processed');\n }\n }\n if (!showConfirmModal) {\n return this.provider.request(arg as any);\n }\n }\n\n if (method === EVMMethod.personalSign) {\n console.log('personal_sign ---- ', arg);\n return new Promise<string>((resolve, reject) => {\n events.emit(EventName.personalSign, arg);\n events.once(EventName.personalSignResult, ({ result, error }) => {\n if (result) {\n resolve(result);\n } else {\n reject(error);\n }\n });\n });\n } else if (method.startsWith(EVMMethod.signTypedData)) {\n return new Promise<string>((resolve, reject) => {\n events.emit(EventName.signTypedData, arg);\n events.once(EventName.signTypedDataResult, ({ result, error }) => {\n if (result) {\n resolve(result);\n } else {\n reject(error);\n }\n });\n });\n }\n\n return this.provider.request(arg as any);\n }\n}\n", "\nconst digest = '906d42389ecad5c2ab92642c8e0775ea667c413b069684ce9d01199562f2d0be';\nconst classes = {\"loader\":\"_loader_g0am3_1\",\"rotate\":\"_rotate_g0am3_1\",\"prixClipFix\":\"_prixClipFix_g0am3_1\"};\nconst css = `._loader_g0am3_1{animation:_rotate_g0am3_1 1s linear infinite;border-radius:50%;height:20px;position:relative;width:20px}._loader_g0am3_1:before{animation:_prixClipFix_g0am3_1 2s linear infinite;border:2px solid #000;border-radius:50%;box-sizing:border-box;content:\"\";inset:0;position:absolute}@keyframes _rotate_g0am3_1{to{transform:rotate(1turn)}}@keyframes _prixClipFix_g0am3_1{0%{clip-path:polygon(50% 50%,0 0,0 0,0 0,0 0,0 0)}25%{clip-path:polygon(50% 50%,0 0,100% 0,100% 0,100% 0,100% 0)}50%{clip-path:polygon(50% 50%,0 0,100% 0,100% 100%,100% 100%,100% 100%)}75%{clip-path:polygon(50% 50%,0 0,100% 0,100% 100%,0 100%,0 100%)}to{clip-path:polygon(50% 50%,0 0,100% 0,100% 100%,0 100%,0 0)}}`;\n\n(function() {\n if (typeof document !== \"undefined\" && !document.getElementById(digest)) {\n var ele = document.createElement('style');\n ele.id = digest;\n ele.textContent = css;\n document.head.appendChild(ele);\n }\n})();\n\nexport default classes;\nexport { css, digest, classes };\n ", "import { type CSSProperties } from 'react';\nimport styles from './spinner.module.scss';\n\nconst Spinner = ({ className, style }: { className?: string; style?: CSSProperties | undefined }) => {\n return <span className={styles.loader + (className ? ` ${className}` : '')} style={style}></span>;\n};\n\nexport default Spinner;\n", "\nconst digest = '424d614dbc2763d7cad7ca35c00bd255c6ed55da308a1f3018594201a47127bf';\nconst classes = {\"btn\":\"_btn_ofd87_1\"};\nconst css = `._btn_ofd87_1{align-items:center;background:#fff;border-radius:8px;color:#000;display:flex;flex-direction:row;font-size:16px;gap:16px;justify-content:center;padding:6px 24px;position:relative}._btn_ofd87_1:hover{opacity:.85}._btn_ofd87_1:disabled{background:hsla(0,0%,100%,.2);color:hsla(0,0%,100%,.639);cursor:not-allowed;opacity:1}`;\n\n(function() {\n if (typeof document !== \"undefined\" && !document.getElementById(digest)) {\n var ele = document.createElement('style');\n ele.id = digest;\n ele.textContent = css;\n document.head.appendChild(ele);\n }\n})();\n\nexport default classes;\nexport { css, digest, classes };\n ", "import { type CSSProperties, type ReactNode } from 'react';\nimport Spinner from '../spinner';\nimport styles from './button.module.scss';\n\nconst Button = ({\n children,\n isLoading,\n isDisabled,\n onClick,\n className,\n style,\n}: {\n children: ReactNode;\n isLoading?: boolean;\n isDisabled?: boolean;\n onClick?: () => void;\n className?: string;\n style?: CSSProperties | undefined;\n}) => {\n return (\n <button\n className={styles.btn + (className ? ` ${className}` : '')}\n onClick={isLoading || isDisabled ? undefined : onClick}\n disabled={isDisabled}\n style={style}\n >\n {isLoading && !isDisabled && <Spinner />}\n {children}\n </button>\n );\n};\n\nexport default Button;\n", "import { useEffect, useMemo, useState, type CSSProperties, type MouseEventHandler, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\nimport { RemoveScroll } from 'react-remove-scroll';\nimport styles from './modal.module.scss';\n\ninterface ModalProp {\n open: boolean;\n onClose: () => void;\n children: ReactNode;\n isDismissable?: boolean;\n contentStyle?: CSSProperties | undefined;\n contentClassName?: string;\n}\n\nconst stopPropagation: MouseEventHandler<unknown> = (event) => event.stopPropagation();\n\nconst Modal = ({ open, onClose, children, isDismissable = true, contentStyle, contentClassName }: ModalProp) => {\n const handleBackdropClick = useMemo(() => (isDismissable ? onClose : undefined), [onClose, isDismissable]);\n\n useEffect(() => {\n if (isDismissable) {\n const handleEscape = (event: KeyboardEvent) => open && event.key === 'Escape' && onClose();\n\n document.addEventListener('keydown', handleEscape);\n\n return () => document.removeEventListener('keydown', handleEscape);\n }\n }, [open, onClose, isDismissable]);\n\n const [bodyScrollable, setBodyScrollable] = useState(true);\n useEffect(() => {\n setBodyScrollable(getComputedStyle(window.document.body).overflow !== 'hidden');\n }, []);\n\n return (\n <>\n {open\n ? createPortal(\n <RemoveScroll enabled={bodyScrollable}>\n <div className={styles.container} onClick={handleBackdropClick}>\n <div\n className={styles.modal + (contentClassName ? ` ${contentClassName}` : '')}\n style={contentStyle}\n onClick={stopPropagation}\n >\n {children}\n </div>\n </div>\n </RemoveScroll>,\n document.body\n )\n : null}\n </>\n );\n};\n\nexport default Modal;\n", "\nconst digest = '65eada90924218eba4e72a5f00291c3cb69387ecce1351e454cdefd066d4bcff';\nconst classes = {\"container\":\"_container_smzpm_1\",\"modal\":\"_modal_smzpm_18\"};\nconst css = `._container_smzpm_1{align-items:center;backdrop-filter:blur(12px);background:rgba(0,0,0,.502);bottom:0;color:#fff;display:flex;height:100%;justify-content:center;left:0;overflow:hidden;position:fixed;right:0;top:0;width:100%;z-index:100000}._container_smzpm_1 ._modal_smzpm_18{align-items:center;background-color:#171a1f;border-radius:16px;display:flex;flex-direction:column;font-size:14px;height:auto;margin:16px;max-height:80%;max-width:100%;overflow:auto;padding:24px;position:relative;width:380px}`;\n\n(function() {\n if (typeof document !== \"undefined\" && !document.getElementById(digest)) {\n var ele = document.createElement('style');\n ele.id = digest;\n ele.textContent = css;\n document.head.appendChild(ele);\n }\n})();\n\nexport default classes;\nexport { css, digest, classes };\n ", "\nconst digest = 'c7bbc091f1227154742a5bd0d55a3df29eb913eb0ad4cafc7ab236b574002f65';\nconst classes = {\"connectModal\":\"_connectModal_1kqtj_1\",\"title\":\"_title_1kqtj_4\",\"closeBtn\":\"_closeBtn_1kqtj_9\",\"backBtn\":\"_backBtn_1kqtj_15\",\"walletItem\":\"_walletItem_1kqtj_21\",\"walletIcon\":\"_walletIcon_1kqtj_33\",\"walletName\":\"_walletName_1kqtj_38\",\"connecting\":\"_connecting_1kqtj_43\",\"connectingIconContainer\":\"_connectingIconContainer_1kqtj_51\",\"retryContainer\":\"_retryContainer_1kqtj_54\",\"retryIcon\":\"_retryIcon_1kqtj_63\",\"connectingIcon\":\"_connectingIcon_1kqtj_51\",\"connection\":\"_connection_1kqtj_72\",\"acceptRequest\":\"_acceptRequest_1kqtj_76\",\"btnDownload\":\"_btnDownload_1kqtj_83\"};\nconst css = `._connectModal_1kqtj_1{gap:12px}._connectModal_1kqtj_1 ._title_1kqtj_4{font-size:18px;font-weight:700;margin-bottom:4px}._connectModal_1kqtj_1 ._closeBtn_1kqtj_9{cursor:pointer;position:absolute;right:16px;top:16px}._connectModal_1kqtj_1 ._backBtn_1kqtj_15{cursor:pointer;left:16px;position:absolute;top:16px}._connectModal_1kqtj_1 ._walletItem_1kqtj_21{border:1px solid #3a3a3a;border-radius:8px;box-sizing:border-box;cursor:pointer;display:flex;padding:8px;width:100%}._connectModal_1kqtj_1 ._walletItem_1kqtj_21:hover{background:hsla(0,0%,100%,.05)}._connectModal_1kqtj_1 ._walletItem_1kqtj_21 ._walletIcon_1kqtj_33{border-radius:4px;height:42px;width:42px}._connectModal_1kqtj_1 ._walletItem_1kqtj_21 ._walletName_1kqtj_38{flex-grow:1;line-height:42px;text-align:center}._connectModal_1kqtj_1 ._connecting_1kqtj_43{align-items:center;display:flex;flex-direction:column;height:204px;justify-content:center;width:100%}._connectModal_1kqtj_1 ._connecting_1kqtj_43 ._connectingIconContainer_1kqtj_51{position:relative}._connectModal_1kqtj_1 ._connecting_1kqtj_43 ._connectingIconContainer_1kqtj_51 ._retryContainer_1kqtj_54{background:#4b5563;border-radius:50%;bottom:-12px;cursor:pointer;padding:4px;position:absolute;right:-12px}._connectModal_1kqtj_1 ._connecting_1kqtj_43 ._connectingIconContainer_1kqtj_51 ._retryContainer_1kqtj_54 ._retryIcon_1kqtj_63{height:24px;width:24px}._connectModal_1kqtj_1 ._connecting_1kqtj_43 ._connectingIcon_1kqtj_51{border-radius:4px;height:60px;width:60px}._connectModal_1kqtj_1 ._connecting_1kqtj_43 ._connection_1kqtj_72{font-size:18px;margin-top:20px}._connectModal_1kqtj_1 ._connecting_1kqtj_43 ._acceptRequest_1kqtj_76{color:hsla(0,0%,100%,.4);font-size:14px;margin-top:6px;text-align:center;white-space:pre-wrap}._connectModal_1kqtj_1 ._connecting_1kqtj_43 ._btnDownload_1kqtj_83{margin-top:20px}`;\n\n(function() {\n if (typeof document !== \"undefined\" && !document.getElementById(digest)) {\n var ele = document.createElement('style');\n ele.id = digest;\n ele.textContent = css;\n document.head.appendChild(ele);\n }\n})();\n\nexport default classes;\nexport { css, digest, classes };\n ", "import type { RequestArguments, UserOpBundle } from '@particle-network/aa';\nimport { chains } from '@particle-network/chains';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport { formatEther, hexToString, type Hex } from 'viem';\nimport { useConnectProvider } from '../../context';\nimport { useETHProvider } from '../../hooks';\nimport { useAccountContract } from '../../hooks/useAccountContract';\nimport checkBox from '../../icons/check_box.svg';\nimport checkBoxBlank from '../../icons/check_box_blank.svg';\nimport close from '../../icons/close.svg';\nimport copy from '../../icons/copy.svg';\nimport { type EVMDeserializeTransactionResult } from '../../types/deserializeTx';\nimport { EventName } from '../../types/eventName';\nimport { EVMMethod } from '../../types/evmMethod';\nimport { shortString } from '../../utils';\nimport { caculateNativeFee } from '../../utils/ethereumUtils';\nimport events from '../../utils/eventUtils';\nimport txConfirm from '../../utils/txConfirmUtils';\nimport Button from '../button';\nimport CopyText from '../copyText';\nimport Modal from '../modal';\nimport TransactionDetails from '../transactionDetails';\nimport styles from './sign.module.scss';\n\nconst SignModal = ({ open, onClose, onOpen }: { open: boolean; onClose: () => void; onOpen: () => void }) => {\n const [userOpBundle, setUserOpBundle] = useState<UserOpBundle>();\n const [notRemindChecked, setNotRemindChecked] = useState<boolean>(false);\n const [loading, setLoading] = useState<boolean>(false);\n const [deserializeLoading, setDeserializeLoading] = useState<boolean>(false);\n const [deserializeResult, setDeserializeResult] = useState<EVMDeserializeTransactionResult[] | undefined>();\n const [disabled, setDisabled] = useState<boolean>(false);\n const [showNotRemind, setShowNotRemind] = useState<boolean>(true);\n const [nativeBalance, setNativeBalance] = useState<bigint>();\n const { accountContract } = useAccountContract();\n\n // personal_sign or eth_signTypedData\n const [requestArguments, setRequestArguments] = useState<RequestArguments>();\n\n const { chainId, publicClient, evmAccount, provider } = useETHProvider();\n const { smartAccount } = useConnectProvider();\n\n useEffect(() => {\n if (!open) {\n setDeserializeResult(undefined);\n setUserOpBundle(undefined);\n setRequestArguments(undefined);\n setLoading(false);\n setDisabled(false);\n setDeserializeLoading(false);\n setNativeBalance(undefined);\n }\n }, [open]);\n\n useEffect(() => {\n if (open) {\n const notRemind = txConfirm.isNotRemind();\n setShowNotRemind(!notRemind);\n if (!notRemind) {\n setNotRemindChecked(false);\n }\n }\n }, [open]);\n\n const chainInfo = useMemo(() => {\n if (chainId) {\n return chains.getEVMChainInfoById(chainId);\n }\n }, [chainId]);\n\n useEffect(() => {\n const onSendUserOp = (opBundle: UserOpBundle) => {\n setUserOpBundle(opBundle);\n onOpen();\n };\n const onPersonalSign = (arg: RequestArguments) => {\n setRequestArguments(arg);\n onOpen();\n };\n const onSignTypedData = (arg: RequestArguments) => {\n setRequestArguments(arg);\n onOpen();\n };\n events.on(EventName.sendUserOp, onSendUserOp);\n events.on(EventName.personalSign, onPersonalSign);\n events.on(EventName.signTypedData, onSignTypedData);\n return () => {\n events.off(EventName.sendUserOp, onSendUserOp);\n events.off(EventName.personalSign, onPersonalSign);\n events.off(EventName.signTypedData, onSignTypedData);\n };\n }, [onOpen, setUserOpBundle]);\n\n const deserializeUserOp = useCallback(async () => {\n if (userOpBundle && smartAccount) {\n const addresses = await smartAccount.provider.request({ method: 'eth_accounts' });\n const owner = addresses[0];\n const result = await smartAccount.sendRpc({\n method: 'particle_aa_deserializeUserOp',\n params: [\n {\n name: accountContract.name,\n version: accountContract.version,\n ownerAddress: owner,\n },\n userOpBundle.userOp,\n ],\n });\n return result;\n }\n }, [userOpBundle, smartAccount, accountContract]);\n\n useEffect(() => {\n if (userOpBundle && open) {\n console.log('deserializeUserOp start');\n setDeserializeLoading(true);\n deserializeUserOp()\n .then((result) => {\n console.log('\uD83D\uDE80 ~ deserializeUserOp ~ result:', result);\n setDeserializeResult(result as any);\n })\n .catch((error) => {\n console.log('\uD83D\uDE80 ~ deserializeUserOp ~ error:', error);\n events.emit(EventName.sendUserOpResult, {\n error,\n });\n onClose();\n });\n }\n }, [deserializeUserOp, userOpBundle, open, onClose]);\n\n useEffect(() => {\n if (open && publicClient && evmAccount && userOpBundle) {\n publicClient\n .getBalance({ address: evmAccount as Hex })\n .then((result: any) => setNativeBalance(result))\n .catch((error: any) => {\n console.log('\uD83D\uDE80 ~ getBalance ~ error:', error);\n events.emit(EventName.sendUserOpResult, {\n error,\n });\n onClose();\n });\n }\n }, [open, publicClient, evmAccount, userOpBundle, onClose]);\n\n useEffect(() => {\n if (nativeBalance != null && deserializeResult != null) {\n setDeserializeLoading(false);\n }\n }, [nativeBalance, deserializeResult]);\n\n const toggleNotRemind = () => {\n setNotRemindChecked(!notRemindChecked);\n txConfirm.setNotRemind(!notRemindChecked);\n };\n\n const gasFee = useMemo(() => {\n if (userOpBundle?.userOp) {\n return caculateNativeFee(userOpBundle?.userOp);\n }\n return BigInt(0);\n }, [userOpBundle]);\n\n const closeModal = () => {\n let event;\n if (userOpBundle) {\n event = EventName.sendUserOpResult;\n } else if (requestArguments?.method === EVMMethod.personalSign) {\n event = EventName.personalSignResult;\n } else if (requestArguments?.method?.startsWith(EVMMethod.signTypedData)) {\n event = EventName.signTypedDataResult;\n }\n\n if (event) {\n events.emit(event, {\n error: {\n code: 4001,\n message: 'The user rejected the request.',\n },\n });\n }\n\n onClose();\n };\n\n const confirmTx = useCallback(async () => {\n if (smartAccount && provider) {\n setLoading(true);\n if (userOpBundle) {\n try {\n const hash = await smartAccount.sendUserOperation(userOpBundle);\n events.emit(EventName.sendUserOpResult, { result: hash });\n } catch (error) {\n events.emit(EventName.sendUserOpResult, {\n error,\n });\n } finally {\n setLoading(false);\n }\n } else if (requestArguments) {\n try {\n const hash = await provider.request(requestArguments);\n events.emit(\n requestArguments.method == EVMMethod.personalSign\n ? EventName.personalSignResult\n : EventName.signTypedDataResult,\n { result: hash }\n );\n } catch (error) {\n events.emit(\n requestArguments.method == EVMMethod.personalSign\n ? EventName.personalSignResult\n : EventName.signTypedDataResult,\n {\n error,\n }\n );\n } finally {\n setLoading(false);\n }\n }\n\n onClose();\n }\n }, [smartAccount, provider, requestArguments, userOpBundle, onClose]);\n\n useEffect(() => {\n if (userOpBundle && nativeBalance != null && deserializeResult) {\n const nativeChange = deserializeResult\n .filter(\n (item) =>\n item.estimatedChanges.natives?.[0]?.nativeChange &&\n item.estimatedChanges.natives[0].nativeChange.startsWith('-')\n )\n .map((item) => BigInt(item.estimatedChanges?.natives?.[0]?.nativeChange?.replace('-', '') || 0))\n .reduce((accumulator, currentValue) => accumulator + currentValue, BigInt(0));\n if (userOpBundle.userOp.paymasterAndData.length > 2) {\n // \u8BA1\u7B97\u4F59\u989D\uFF0C\u9700\u5927\u4E8E\u7B49\u4E8EnativeChange\n setDisabled(nativeBalance < nativeChange);\n } else {\n // \u8BA1\u7B97\u4F59\u989D\uFF0C\u9700\u5927\u4E8E\u7B49\u4E8EgasFee+nativeChange\n setDisabled(nativeBalance < gasFee + nativeChange);\n }\n }\n }, [userOpBundle, gasFee, nativeBalance, deserializeResult]);\n\n const unsignedMessage = useMemo(() => {\n if (!requestArguments) {\n return undefined;\n }\n\n if (requestArguments.method === EVMMethod.personalSign) {\n const message = requestArguments.params?.[0] || '0x';\n return hexToString(message);\n } else {\n const typedData = requestArguments.params?.[1];\n const obj = typeof typedData === 'string' ? JSON.parse(typedData) : typedData;\n return JSON.stringify(obj, null, 2);\n }\n }, [requestArguments]);\n\n return (\n <Modal open={open} onClose={onClose} isDismissable={false} contentClassName={styles.modalContent}>\n <>\n <img className={styles.closeBtn} src={close} onClick={closeModal}></img>\n\n {requestArguments && (\n <div className={styles.signTitle}>\n {requestArguments.method == EVMMethod.personalSign ? 'Sign Message' : 'Sign Typed Data'}\n </div>\n )}\n\n <div className={styles.chainInfo}>\n <img src={chainInfo?.icon}></img>\n {chainInfo?.fullname.replace('Mainnet', '')}\n </div>\n\n <div className={styles.addressContainer}>\n <CopyText value={evmAccount} style={{ textDecorationLine: 'none' }}>\n <div className={styles.addressInfo}>\n {shortString(evmAccount)}\n <img src={copy}></img>\n </div>\n </CopyText>\n </div>\n\n <div className={styles.detailsContent + (deserializeResult || requestArguments ? ` ${styles.fill}` : '')}>\n {deserializeResult &&\n deserializeResult.map((details, index) => (\n <TransactionDetails key={`${details.type}-${index}`} details={details} />\n ))}\n\n {unsignedMessage && <div className={styles.unsignedMessage}>{unsignedMessage}</div>}\n </div>\n\n {gasFee && (\n <div className={styles.estimatedGas}>{`Estimated gas fee: ${formatEther(gasFee)} ${chainInfo?.nativeCurrency\n .symbol}`}</div>\n )}\n\n <Button\n onClick={confirmTx}\n className={styles.signBtn}\n isLoading={loading || deserializeLoading}\n isDisabled={disabled}\n >\n {deserializeLoading ? 'LOADING' : disabled ? 'INSUFFICIENT FEE' : 'CONFIRM'}\n </Button>\n\n {showNotRemind && (\n <div className={styles.notRemind} onClick={toggleNotRemind}>\n <img src={notRemindChecked ? checkBox : checkBoxBlank}></img>\n Do not remind me again\n </div>\n )}\n </>\n </Modal>\n );\n};\n\nexport default SignModal;\n", "import type { AAOptions } from '@particle-network/aa';\n\nexport function shortString(str: any): string {\n if (Array.isArray(str)) {\n str = '[' + str.toString() + ']';\n }\n if (str) {\n if (typeof str.toString === 'function') {\n str = str.toString();\n }\n if (str.length <= 10) {\n return str;\n }\n return `${str.slice(0, 5)}...${str.slice(str.length - 5, str.length)}`;\n }\n return '';\n}\n\n/**\n * \u590D\u5236\u5230\u526A\u8D34\u677F\n * @param {string} text\n * @returns {Promise<void>}\n */\nexport async function copyToClipboard(text: string) {\n const clipboardCopy = async () => {\n if (navigator.clipboard) {\n return navigator.clipboard.writeText(text);\n } else {\n const textarea = document.createElement('textarea');\n textarea.value = text;\n textarea.setAttribute('readonly', '');\n textarea.style.position = 'absolute';\n textarea.style.left = '-9999px';\n document.body.appendChild(textarea);\n\n textarea.select();\n const result = document.execCommand('copy');\n\n document.body.removeChild(textarea);\n\n if (!result) {\n throw new Error('Copy to clipboard failed');\n }\n }\n };\n\n return new Promise((resolve, reject) => {\n clipboardCopy().then(resolve).catch(reject);\n });\n}\n\nexport const defaultTokenIcon =\n 'https://static.particle.network/token-list/defaultToken/default.png';\n\nexport const ipfsToSrc = (ipfs: string) => {\n if (!ipfs || !ipfs.startsWith('ipfs://')) {\n return ipfs || '';\n }\n\n return `https://ipfs.particle.network/${encodeURI(ipfs.slice(7))}`;\n};\n\nexport const checkBTCVersion = (\n accountContracts: AAOptions['accountContracts'],\n accountContractKey: string,\n version: string,\n) => {\n if (!accountContracts[accountContractKey]) {\n return false;\n }\n return accountContracts[accountContractKey].some((item) => item.version === version);\n};\n\nexport const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));\n", "import { bytesToHex, publicToAddress, toBytes, toChecksumAddress, toRpcSig } from '@ethereumjs/util';\nimport type { SmartAccount, UserOp } from '@particle-network/aa';\nimport bitcore from 'bitcore-lib';\nimport type { AccountInfo } from '../types/accountInfo';\n\nexport const pubKeyToEVMAddress = (pubKey: string) => {\n const address = toChecksumAddress(bytesToHex(publicToAddress(toBytes(`0x${pubKey}`), true)));\n return address;\n};\n\nexport const convertSignature = (signature: string) => {\n const sig = (bitcore.crypto.Signature as any).fromCompact(Buffer.from(signature, 'base64'));\n const v = BigInt(sig.i + 27);\n const evmSig = toRpcSig(v, sig.r.toBuffer(), sig.s.toBuffer());\n return evmSig;\n};\n\nexport function caculateNativeFee(userOp: UserOp): bigint {\n return (\n (BigInt(userOp.callGasLimit) + BigInt(userOp.verificationGasLimit) + BigInt(userOp.preVerificationGas)) *\n BigInt(userOp.maxFeePerGas)\n );\n}\n\nexport const getBTCAAAddress = async (\n smartAccount: SmartAccount,\n btcAddress: string,\n name: string,\n version: string\n): Promise<string> => {\n const addresses = await smartAccount.provider.request({ method: 'eth_accounts' });\n const owner = addresses[0];\n const localKey = `particle_${name}_${version}_${owner}`;\n if (typeof window !== 'undefined' && localStorage) {\n const localAA = localStorage.getItem(localKey);\n if (localAA) {\n return localAA;\n }\n }\n\n const btcPublicKey = await (smartAccount.provider as any).getPublicKey();\n const accountInfo = await smartAccount.sendRpc({\n method: 'particle_aa_getBTCAccount',\n params: [\n {\n name: name,\n version: version,\n btcPublicKey,\n btcAddress,\n },\n ],\n });\n const address = (accountInfo as any)?.[0]?.smartAccountAddress;\n\n if (typeof window !== 'undefined' && localStorage && address) {\n localStorage.setItem(localKey, address);\n }\n return address;\n};\n\nexport const getBTCAccountInfo = async (\n smartAccount: SmartAccount,\n btcAddress: string,\n name: string,\n version: string\n) => {\n const btcPublicKey = await (smartAccount.provider as any).getPublicKey();\n const [accountInfo] = await smartAccount.sendRpc<AccountInfo[]>({\n method: 'particle_aa_getBTCAccount',\n params: [\n {\n name: name,\n version: version,\n btcPublicKey,\n btcAddress,\n },\n ],\n });\n\n const address = accountInfo.smartAccountAddress;\n const addresses = await smartAccount.provider.request({ method: 'eth_accounts' });\n const owner = addresses[0];\n const localKey = `particle_${name}_${version}_${owner}`;\n if (typeof window !== 'undefined' && localStorage && address) {\n localStorage.setItem(localKey, address);\n }\n\n return accountInfo;\n};\n", "import { useState, type CSSProperties } from 'react';\nimport { copyToClipboard } from '../../utils';\nimport styles from './copyText.module.scss';\n\nexport interface CopyTextProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n value?: string;\n className?: string;\n style?: CSSProperties | undefined;\n}\n\nexport default function CopyText({ children, value, className, style }: CopyTextProps) {\n const [copied, setCopied] = useState<boolean>();\n\n const handleClick = async () => {\n if (copied) {\n return;\n }\n\n try {\n if (value) {\n await copyToClipboard(value);\n } else if (typeof children === 'string' || typeof children === 'number' || typeof children === 'boolean') {\n await copyToClipboard(children.toString());\n } else {\n throw new Error('please set copy value');\n }\n setCopied(true);\n setTimeout(() => setCopied(false), 1000);\n } catch (error) {\n //ignore\n }\n };\n\n return (\n <div\n className={styles.copyText + (className ? ` ${className}` : '') + (copied ? ` ${styles.copied}` : '')}\n onClick={handleClick}\n style={style}\n >\n {copied ? 'Copied' : children}\n </div>\n );\n}\n", "\nconst digest = 'd6fbb5df7ed6ec51d41f665ca768306181bb1e7d7c1cef8eed9bd4230368d7bb';\nconst classes = {\"copyText\":\"_copyText_smolu_1\",\"copied\":\"_copied_smolu_9\"};\nconst css = `._copyText_smolu_1{cursor:pointer;text-decoration-line:underline}._copyText_smolu_1:hover{opacity:.75}._copied_smolu_9{color:#a855f7;cursor:none;text-decoration-line:none}._copied_smolu_9:hover{opacity:1}`;\n\n(function() {\n if (typeof document !== \"undefined\" && !document.getElementById(digest)) {\n var ele = document.createElement('style');\n ele.id = digest;\n ele.textContent = css;\n document.head.appendChild(ele);\n }\n})();\n\nexport default classes;\nexport { css, digest, classes };\n ", "import { chains } from '@particle-network/chains';\nimport { useCallback, useMemo } from 'react';\nimport { formatUnits } from 'viem';\nimport { useETHProvider } from '../../hooks';\nimport unverified from '../../icons/unverified.svg';\nimport verified from '../../icons/verified.svg';\nimport {\n TransactionSmartType,\n type EVMDeserializeTransactionResult,\n type EVMTokenChange,\n} from '../../types/deserializeTx';\nimport { defaultTokenIcon, ipfsToSrc, shortString } from '../../utils';\nimport CopyText from '../copyText';\nimport Tooltip from '../tooltip';\nimport styles from './transactionDetails.module.scss';\n\nconst TransactionDetails = ({ details }: { details: EVMDeserializeTransactionResult }) => {\n const { chainId } = useETHProvider();\n\n const chainInfo = useMemo(() => {\n if (chainId) {\n return chains.getEVMChainInfoById(chainId);\n }\n }, [chainId]);\n\n const titleContent = useMemo(() => {\n switch (details.type) {\n case TransactionSmartType.NATIVE_TRANSFER:\n return `Send ${chainInfo?.nativeCurrency.symbol}`;\n case TransactionSmartType.ERC20_TRANSFER:\n return `Send ${details.estimatedChanges.tokens[0]?.symbol}`;\n case TransactionSmartType.ERC20_APPROVE:\n return 'Approve Spending';\n case TransactionSmartType.ERC721_TRANFER:\n return 'Send NFT';\n case TransactionSmartType.ERC1155_TRANFER:\n return 'Send NFT';\n default:\n return 'Transaction Details';\n }\n }, [details, chainInfo]);\n\n const nftContractType = useMemo(() => {\n if (details.type === TransactionSmartType.ERC721_TRANFER) {\n return 'ERC721';\n } else if (details.type === TransactionSmartType.ERC1155_TRANFER) {\n return 'ERC1155';\n }\n }, [details]);\n\n const nativeIcon = useMemo(() => {\n if (chainInfo) {\n if (chainInfo.nativeCurrency.symbol === 'ETH') {\n return 'https://static.particle.network/token-list/ethereum/native.png';\n } else {\n return chainInfo.nativeIcon || chainInfo.icon;\n }\n }\n return defaultTokenIcon;\n }, [chainInfo]);\n\n // to address\n const to = useMemo(() => {\n const params = details.data?.function?.params;\n if (details.type == TransactionSmartType.ERC20_TRANSFER) {\n return params ? (params[params.length === 3 ? 1 : 0].value as string) : '';\n } else if (details.type == TransactionSmartType.ERC20_APPROVE) {\n return params ? (params[0].value as string) : '';\n } else if (details.type == TransactionSmartType.NATIVE_TRANSFER) {\n return details.data.to;\n } else if (\n details.type == TransactionSmartType.ERC721_TRANFER ||\n details.type == TransactionSmartType.ERC1155_TRANFER\n ) {\n return params ? (params[1].value as string) : '';\n } else {\n return details.data.to;\n }\n }, [details]);\n\n const balanceChangeTextColor = useCallback((value: string | number) => {\n if (BigInt(value) > 0) {\n return '#4ade80';\n } else if (BigInt(value) < 0) {\n return '#ef4444';\n } else {\n return 'white';\n }\n }, []);\n\n const functionContent = useMemo(() => {\n if (details.type !== TransactionSmartType.NATIVE_TRANSFER && details.data.function) {\n const params = details.data.function.params.map((item) => item.name);\n return `${details.data.function.name}(${params.join(', ')})`;\n }\n }, [details]);\n\n const approveTokenAmount = useMemo(() => {\n if (details.type === TransactionSmartType.ERC20_APPROVE) {\n const amount = details.data?.function?.params?.[1]?.value as string;\n return BigInt(amount || 0);\n }\n return BigInt(0);\n }, [details]);\n\n const tokenAmountChange = useCallback(\n (tokenItem: EVMTokenChange) => {\n const result = formatUnits(\n details.type === TransactionSmartType.ERC20_APPROVE ? approveTokenAmount : BigInt(tokenItem.amountChange),\n tokenItem.decimals\n );\n\n if (details.type !== TransactionSmartType.ERC20_APPROVE && BigInt(tokenItem.amountChange) > BigInt(0)) {\n return `+${result}`;\n }\n\n return result;\n },\n [approveTokenAmount, details]\n );\n\n const showContactAddress = useMemo(() => {\n return (\n details.type === TransactionSmartType.ERC20_TRANSFER ||\n details.type === TransactionSmartType.ERC20_APPROVE ||\n details.type === TransactionSmartType.ERC721_TRANFER ||\n details.type === TransactionSmartType.ERC1155_TRANFER\n );\n }, [details]);\n\n return (\n <div className={styles.detailsCard}>\n <div className={styles.title}>{titleContent}</div>\n {nftContractType && <div className={styles.nftContract}>{nftContractType}</div>}\n\n {details.estimatedChanges.natives.map((nativeItem) => {\n return (\n <div key={nativeItem.address} className={styles.row}>\n <img className={styles.tokenIcon} src={nativeIcon}></img>\n <div className={styles.balanceChange} style={{ color: balanceChangeTextColor(nativeItem.nativeChange) }}>\n {BigInt(nativeItem.nativeChange) > 0 ? '+' : undefined}\n {formatUnits(BigInt(nativeItem.nativeChange), chainInfo?.nativeCurrency.decimals || 18)}\n </div>\n <div className={styles.tokenSymbol}>{chainInfo?.nativeCurrency.symbol}</div>\n </div>\n );\n })}\n\n {details.estimatedChanges.tokens.map((tokenItem) => {\n return (\n <div key={tokenItem.address} className={styles.row}>\n <img className={styles.tokenIcon} src={tokenItem.image || defaultTokenIcon}></img>\n <div className={styles.balanceChange}>\n <span style={{ color: balanceChangeTextColor(tokenItem.amountChange) }}>\n {tokenAmountChange(tokenItem)}\n </span>\n {` ${tokenItem.symbol}`}\n </div>\n </div>\n );\n })}\n\n {details.estimatedChanges.nfts.map((nftItem) => {\n return (\n <div key={nftItem.address} className={styles.row}>\n <div style={{ fontSize: 16 }}>\n <img className={styles.nftIcon} src={ipfsToSrc(nftItem.image || defaultTokenIcon)}></img>\n {nftItem.name || `NFT#${nftItem.tokenId}`}\n </div>\n <div className={styles.balanceChange} style={{ color: balanceChangeTextColor(nftItem.amountChange) }}>\n {nftItem.amountChange}\n </div>\n </div>\n );\n })}\n\n {to && (\n <div className={styles.row}>\n <div>To</div>\n <div className={styles.toContract}>\n {details.toVerified != null && !showContactAddress && (\n <Tooltip content={details.toVerified ? 'Verified Contract' : 'Unverified Contract'}>\n <img src={details.toVerified ? verified : unverified}></img>\n </Tooltip>\n )}\n <CopyText value={to}>{shortString(to)}</CopyText>\n </div>\n </div>\n )}\n\n {showContactAddress && (\n <div className={styles.row}>\n <div>Contract</div>\n <div className={styles.toContract}>\n {details.toVerified != null && (\n <Tooltip content={details.toVerified ? 'Verified Contract' : 'Unverified Contract'}>\n <img src={details.toVerified ? verified : unverified}></img>\n </Tooltip>\n )}\n <CopyText value={details.data.to}>{shortString(details.data.to)}</CopyText>\n </div>\n </div>\n )}\n\n <div className={styles.row}>\n <div>Hex Data</div>\n <CopyText value={details.data.data}>{shortString(details.data.data)}</CopyText>\n </div>\n\n {functionContent && (\n <div className={styles.row}>\n <div>Function</div>\n <div className={styles.right}>{functionContent}</div>\n </div>\n )}\n </div>\n );\n};\n\nexport default TransactionDetails;\n", "\nconst digest = 'ee15dc27fcfd209601159e7f0e0063ff4e7a886b7b892c1600a911372b82a0b1';\nconst classes = {\"tipContainer\":\"_tipContainer_ufud7_1\",\"tipContent\":\"_tipContent_ufud7_5\"};\nconst css = `._tipContainer_ufud7_1{overflow:visible;position:relative}._tipContainer_ufud7_1 ._tipContent_ufud7_5{background:#3f3f46;border-radius:8px;bottom:100%;color:#fff;font-size:11px;left:-100%;opacity:0;padding:3px 6px;position:absolute;transition:opacity .5s;visibility:hidden;white-space:nowrap;z-index:1}._tipContainer_ufud7_1:hover ._tipContent_ufud7_5{opacity:1;visibility:visible}`;\n\n(function() {\n if (typeof document !== \"undefined\" && !document.getElementById(digest)) {\n var ele = document.createElement('style');\n ele.id = digest;\n ele.textContent = css;\n document.head.appendChild(ele);\n }\n})();\n\nexport default classes;\nexport { css, digest, classes };\n ", "import { type ReactNode } from 'react';\nimport styles from './tooltip.module.scss';\n\nconst Tooltip = ({ children, content, className }: { children: ReactNode; content: string; className?: string }) => {\n return (\n <div className={styles.tipContainer}>\n {children}\n <div className={styles.tipContent + (className ? ` ${className}` : '')}>{content}</div>\n </div>\n );\n};\n\nexport default Tooltip;\n", "\nconst digest = 'a81c744751497ed4b401c08b9e5aeef1991aeb86f2cbba3ee57c1926c0502f1a';\nconst classes = {\"detailsCard\":\"_detailsCard_ml2p9_1\",\"title\":\"_title_ml2p9_13\",\"nftContract\":\"_nftContract_ml2p9_19\",\"row\":\"_row_ml2p9_26\",\"tokenIcon\":\"_tokenIcon_ml2p9_35\",\"nftIcon\":\"_nftIcon_ml2p9_41\",\"balanceChange\":\"_balanceChange_ml2p9_49\",\"tokenSymbol\":\"_tokenSymbol_ml2p9_56\",\"toContract\":\"_toContract_ml2p9_61\",\"right\":\"_right_ml2p9_71\"};\nconst css = `._detailsCard_ml2p9_1{background:#232529;border:1px solid #252525;border-radius:8px;color:#fff;margin-top:16px;overflow-x:hidden;padding:10px;position:relative;width:100%}._detailsCard_ml2p9_1 ._title_ml2p9_13{font-size:16px;font-weight:600;margin-bottom:12px;text-align:left}._detailsCard_ml2p9_1 ._nftContract_ml2p9_19{color:#a855f7;font-size:16px;position:absolute;right:8px;top:8px}._detailsCard_ml2p9_1 ._row_ml2p9_26{align-items:center;display:flex;flex-direction:row;font-size:14px;gap:8px;justify-content:space-between;margin-top:6px}._detailsCard_ml2p9_1 ._row_ml2p9_26 ._tokenIcon_ml2p9_35{border-radius:50%;height:32px;margin:10px 0;width:32px}._detailsCard_ml2p9_1 ._row_ml2p9_26 ._nftIcon_ml2p9_41{border-radius:2px;display:inline;height:32px;margin:10px 8px 10px 0;width:32px}._detailsCard_ml2p9_1 ._row_ml2p9_26 ._balanceChange_ml2p9_49{flex-grow:2;font-size:16px;font-weight:500;text-align:end;word-break:break-word}._detailsCard_ml2p9_1 ._row_ml2p9_26 ._tokenSymbol_ml2p9_56{font-size:16px;font-weight:500;text-align:end}._detailsCard_ml2p9_1 ._row_ml2p9_26 ._toContract_ml2p9_61{align-items:center;display:flex;gap:8px}._detailsCard_ml2p9_1 ._row_ml2p9_26 ._toContract_ml2p9_61 img{display:inline;height:18px;width:18px}._detailsCard_ml2p9_1 ._row_ml2p9_26 ._right_ml2p9_71{text-align:end}`;\n\n(function() {\n if (typeof document !== \"undefined\" && !document.getElementById(digest)) {\n var ele = document.createElement('style');\n ele.id = digest;\n ele.textContent = css;\n document.head.appendChild(ele);\n }\n})();\n\nexport default classes;\nexport { css, digest, classes };\n ", "\nconst digest = '3ab1a455562ae7e24c2ac49572897e615b9e9275066fd0d64f0cf24844521bab';\nconst classes = {\"modalContent\":\"_modalContent_aoysu_1\",\"closeBtn\":\"_closeBtn_aoysu_5\",\"signTitle\":\"_signTitle_aoysu_11\",\"chainInfo\":\"_chainInfo_aoysu_16\",\"addressContainer\":\"_addressContainer_aoysu_29\",\"addressInfo\":\"_addressInfo_aoysu_34\",\"detailsContent\":\"_detailsContent_aoysu_49\",\"fill\":\"_fill_aoysu_58\",\"unsignedMessage\":\"_unsignedMessage_aoysu_61\",\"estimatedGas\":\"_estimatedGas_aoysu_76\",\"signBtn\":\"_signBtn_aoysu_81\",\"notRemind\":\"_notRemind_aoysu_85\"};\nconst css = `._modalContent_aoysu_1{color:#fff;text-align:center}._modalContent_aoysu_1 ._closeBtn_aoysu_5{cursor:pointer;position:absolute;right:16px;top:16px}._modalContent_aoysu_1 ._signTitle_aoysu_11{font-size:20px;font-weight:600;margin-bottom:10px}._modalContent_aoysu_1 ._chainInfo_aoysu_16{align-items:center;display:flex;flex-direction:row;font-size:12px;gap:8px;justify-content:center;margin-bottom:8px}._modalContent_aoysu_1 ._chainInfo_aoysu_16 img{height:18px;width:18px}._modalContent_aoysu_1 ._addressContainer_aoysu_29{height:28px;margin-bottom:16px;margin-top:8px}._modalContent_aoysu_1 ._addressContainer_aoysu_29 ._addressInfo_aoysu_34{align-items:center;background:rgba(58,58,58,.635);border-radius:20px;display:flex;flex-direction:row;font-size:12px;gap:4px;justify-content:center;padding:4px 8px}._modalContent_aoysu_1 ._addressContainer_aoysu_29 ._addressInfo_aoysu_34 img{height:18px;width:18px}._modalContent_aoysu_1 ._detailsContent_aoysu_49{max-height:0;overflow-y:auto;transition:max-height .3s linear;width:100%}._modalContent_aoysu_1 ._detailsContent_aoysu_49::-webkit-scrollbar{display:none}._modalContent_aoysu_1 ._detailsContent_aoysu_49._fill_aoysu_58{max-height:500px}._modalContent_aoysu_1 ._detailsContent_aoysu_49 ._unsignedMessage_aoysu_61{background:#232529;border:1px solid #252525;border-radius:8px;box-sizing:border-box;color:#fff;font-size:14px;padding:8px;width:100%;word-wrap:break-word;color:hsla(0,0%,100%,.631);text-align:left;white-space:pre-wrap}._modalContent_aoysu_1 ._estimatedGas_aoysu_76{color:hsla(0,0%,100%,.631);font-size:12px;margin-top:24px}._modalContent_aoysu_1 ._signBtn_aoysu_81{margin-top:24px;min-width:200px}._modalContent_aoysu_1 ._notRemind_aoysu_85{align-items:center;color:hsla(0,0%,100%,.631);cursor:pointer;display:inline-flex;font-size:12px;gap:4px;margin-top:16px}._modalContent_aoysu_1 ._notRemind_aoysu_85:hover{opacity:.85}`;\n\n(function() {\n if (typeof document !== \"undefined\" && !document.getElementById(digest)) {\n var ele = document.createElement('style');\n ele.id = digest;\n ele.textContent = css;\n document.head.appendChild(ele);\n }\n})();\n\nexport default classes;\nexport { css, digest, classes };\n ", "import { intToHex } from '@ethereumjs/util';\nimport type { RequestArguments } from '@particle-network/aa';\nimport { chains } from '@particle-network/chains';\nimport { EventEmitter } from 'events';\nimport {\n InvalidParamsRpcError,\n SwitchChainError,\n UnsupportedProviderMethodError,\n createPublicClient,\n hashMessage,\n hashTypedData,\n http,\n type PublicClient,\n} from 'viem';\nimport { EVMMethod } from '../types/evmMethod';\nimport { convertSignature, pubKeyToEVMAddress } from '../utils/ethereumUtils';\n\nexport class AASignerProvider {\n private events: EventEmitter;\n chainId = 1;\n publicClient: PublicClient;\n constructor(\n public supportChainIds: number[],\n public projectId: string,\n public clientKey: string,\n public rpcUrls: Record<number, string> | undefined\n ) {\n this.events = new EventEmitter();\n this.events.setMaxListeners(100);\n\n if (typeof window !== 'undefined') {\n const localChainId = localStorage.getItem('connect-evm-chain-id');\n if (localChainId && supportChainIds.includes(Number(localChainId))) {\n this.chainId = Number(localChainId);\n } else {\n const chainId = supportChainIds[0];\n if (chainId) {\n localStorage.setItem('connect-evm-chain-id', chainId.toString());\n this.chainId = chainId;\n }\n }\n }\n\n this.publicClient = this.getPublicClient();\n }\n\n async request(arg: RequestArguments) {\n if (\n arg.method === 'eth_sendTransaction' ||\n arg.method === 'wallet_addEthereumChain' ||\n arg.method === 'wallet_watchAsset' ||\n arg.method === 'eth_sign'\n ) {\n throw new UnsupportedProviderMethodError(new Error('The Provider does not support the requested method.'));\n }\n\n if (arg.method === 'eth_accounts' || arg.method === 'eth_requestAccounts') {\n const pubKey = await this.getPublicKey();\n const address = pubKeyToEVMAddress(pubKey);\n return [address];\n } else if (arg.method === 'eth_chainId') {\n return `0x${this.chainId.toString(16)}`;\n } else if (arg.method === EVMMethod.personalSign) {\n let message = arg.params?.[0];\n console.log('personal_sign message:', message);\n if (message.length !== 66) {\n const hash = hashMessage({ raw: message });\n console.log('personal_sign hash:', hash);\n message = hash;\n }\n const result = await this.personalSign(message || '');\n const convertResult = convertSignature(result);\n if (!convertResult) {\n throw new Error('sign error');\n }\n console.log(`personal_sign result(${convertResult.length}): `, convertResult);\n return convertResult;\n } else if (arg.method === 'eth_signTypedData' || arg.method === 'eth_signTypedData_v4') {\n const typedData = arg.params?.[1];\n console.log('signTypedData typedData', typedData);\n const hash = hashTypedData(typeof typedData === 'string' ? JSON.parse(typedData) : typedData);\n console.log('signTypedData hash', hash);\n const result = await this.personalSign(hash || '');\n const convertResult = convertSignature(result);\n if (!convertResult) {\n throw new Error('sign error');\n }\n console.log(`eth_signTypedData result(${convertResult.length}): `, convertResult);\n return convertResult;\n } else if (arg.method === 'wallet_switchEthereumChain') {\n if (arg.params && arg.params instanceof Array && arg.params[0] && arg.params[0].chainId) {\n const chainId = Number(arg.params[0].chainId);\n if (this.supportChainIds.includes(this.chainId)) {\n this.chainId = chainId;\n localStorage.setItem('connect-evm-chain-id', this.chainId.toString());\n this.publicClient = this.getPublicClient();\n setTimeout(() => this.events.emit('chainChanged', intToHex(this.chainId)), 0);\n return Promise.resolve(null);\n }\n throw new SwitchChainError(new Error(`The chain: ${chainId} is not supported`));\n } else {\n throw new InvalidParamsRpcError(new Error('Invalid Params'));\n }\n } else {\n const result = await this.publicClient.request(arg as any);\n return result;\n }\n }\n\n personalSign = async (message: string): Promise<string> => {\n throw new Error('Wallet not connected!');\n };\n\n getPublicKey = async (): Promise<string> => {\n throw new Error('Wallet not connected!');\n };\n\n removeListener(event: string, listener: (...args: any[]) => void) {\n this.events.removeListener(event, listener);\n return this;\n }\n\n on(event: string, listener: (...args: any[]) => void) {\n this.events.on(event, listener);\n return this;\n }\n\n once(event: string, listener: any) {\n this.events.once(event, listener);\n return this;\n }\n\n off(event: string, listener: any) {\n this.events.off(event, listener);\n return this;\n }\n\n emit(event: string, ...args: any[]) {\n this.events.emit(event, args);\n }\n\n getPublicClient = () => {\n const rpcUrl = this?.rpcUrls?.[this.chainId] || chains.getEVMChainInfoById(this.chainId || 1)?.rpcUrl;\n console.log('rpcUrl', rpcUrl);\n\n return createPublicClient({\n transport: http(rpcUrl),\n });\n };\n}\n", "import { useCallback, useState } from 'react';\n\nconst useModalStateValue = () => {\n const [isModalOpen, setModalOpen] = useState(false);\n\n return {\n closeModal: useCallback(() => setModalOpen(false), []),\n isModalOpen,\n openModal: useCallback(() => setModalOpen(true), []),\n };\n};\n\nexport default useModalStateValue;\n", "import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { ConnectProvider as BTCConnectProvider } from '../context';\nimport { UnisatConnector, OKXConnector } from '../connector'\nimport { useBTCProvider, useConnectModal } from '../hooks'\n\nimport ComfirmBox from './confirmBox';\nimport { InitContextHook } from './hook';\n\nconst WalletSelectorContext =\n React.createContext<any>(null);\n\nexport function BtcWalletSelectorContextProvider({ children, autoConnect = false }: { children: React.ReactNode, autoConnect?: boolean }) {\n const [isProcessing, setIsProcessing] = useState(false)\n\n const walletSelectorContextValue = useMemo(() => {\n const simpleFn: any = {}\n\n return {\n setIsProcessing,\n emit: (eventName: string, e: any) => {\n if (simpleFn[eventName] && simpleFn[eventName].length) {\n simpleFn[eventName].forEach((fn: (e: any) => void) => {\n fn(e)\n })\n }\n },\n on: (eventName: string, fn: (e: any) => void) => {\n simpleFn[eventName] = simpleFn[eventName] || []\n simpleFn[eventName].push(fn)\n },\n }\n }, [])\n\n return <WalletSelectorContext.Provider value={walletSelectorContextValue}><BTCConnectProvider\n options={{\n projectId: 'btc',\n clientKey: 'btc',\n appId: 'btc',\n aaOptions: {\n accountContracts: {\n BTC: [\n {\n chainIds: [686868],\n version: '1.0.0',\n },\n ],\n },\n },\n walletOptions: {\n visible: true,\n },\n \n }}\n autoConnect={false}\n connectors={[new UnisatConnector()]}\n >\n {children}\n {\n isProcessing && <ComfirmBox hash={''} status={0} onClose={() => {\n setIsProcessing(false)\n }}/>\n }\n <InitContextHook />\n </BTCConnectProvider>\n </WalletSelectorContext.Provider>\n}\n\nexport function useBtcWalletSelector() {\n // @ts-ignore\n const { openConnectModal, openConnectModalAsync, disconnect, requestDirectAccount } = useConnectModal();\n const { accounts, sendBitcoin, getPublicKey, provider, signMessage, connector } = useBTCProvider();\n const publicKey = useRef<any>(null)\n const signMessageFn = useRef<any>(null)\n const connectorRef = useRef<any>(null)\n const providerRef = useRef<any>(null)\n const [updater, setUpdater] = useState<any>(1)\n const context = useContext(WalletSelectorContext);\n \n useEffect(() => {\n if (provider) {\n getPublicKey().then((res) => {\n publicKey.current = res\n })\n providerRef.current = provider\n }\n }, [provider, updater])\n\n useEffect(() => {\n signMessageFn.current = signMessage\n }, [signMessage])\n\n useEffect(() => {\n const fn = (account: any) => {\n if (account) {\n getPublicKey().then((res) => {\n publicKey.current = res\n context.emit('updatePublicKey', res)\n })\n }\n }\n\n if (connector) {\n connector.on('accountsChanged', fn)\n }\n connectorRef.current = connector\n\n return () => {\n if (connector) {\n connector.removeListener('accountsChanged', fn)\n }\n }\n }, [connector])\n\n return {\n login: async () => {\n setUpdater(updater + 1)\n if (openConnectModal) {\n await openConnectModal()\n }\n\n return null\n },\n autoConnect: async () => {\n let times = 0\n while (!connectorRef.current) {\n await sleep(500)\n if (times++ > 10) {\n return null\n }\n }\n requestDirectAccount(connectorRef.current).catch((e: any) => {\n context.emit('btcLoginError')\n });\n \n },\n logout: () => {\n disconnect && disconnect()\n },\n account: accounts && accounts.length ? accounts[0] : null,\n getPublicKey: async () => {\n let times = 0\n while (!publicKey.current) {\n await sleep(1000)\n if (times++ > 10) {\n return null\n }\n }\n\n return publicKey.current\n },\n signMessage: (msg: string) => {\n return signMessageFn.current(msg)\n },\n getContext: () => {\n return context\n },\n getBalance: async () => {\n let times = 0\n while (!providerRef.current) {\n await sleep(500)\n if (times++ > 10) {\n return null\n }\n }\n\n const { total } = await providerRef.current.getBalance()\n return total\n }\n }\n}\n\nfunction sleep(time: number) {\n return new Promise(function (resolve) {\n setTimeout(resolve, time);\n });\n}\n\n", "import React from 'react';\n// import './modal.css'\n\ninterface Props {\n children?: any;\n onClose?: () => void;\n style?: any\n}\n\nconst styles: any = {}\n\nexport default function Modal({ children, onClose, style = {} }: Props) {\n return <div>\n <div className=\"layer\"></div>\n <div className=\"modal\" style={style}>\n <div className=\"close\" onClick={() => { onClose && onClose() }}>\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M7.73284 5.99997L11.7359 1.99698C12.0368 1.69598 12.0882 1.25928 11.8507 1.02188L10.9779 0.149088C10.7404 -0.0884114 10.3043 -0.0363117 10.0028 0.264487L6.00013 4.26737L1.99719 0.264587C1.69619 -0.0367116 1.25948 -0.0884115 1.02198 0.149388L0.149174 1.02228C-0.0882276 1.25938 -0.0368271 1.69608 0.264576 1.99708L4.26761 5.99997L0.264576 10.0032C-0.0363271 10.304 -0.0884276 10.7404 0.149174 10.9779L1.02198 11.8507C1.25948 12.0882 1.69619 12.0367 1.99719 11.7358L6.00033 7.73266L10.0029 11.7352C10.3044 12.0368 10.7405 12.0882 10.978 11.8507L11.8508 10.9779C12.0882 10.7404 12.0368 10.304 11.736 10.0028L7.73284 5.99997Z\" fill=\"#808095\" />\n </svg>\n </div>\n {children}\n </div>\n </div>\n}", "import React from \"react\";\nimport Modal from \"./Modal\";\n\n// import './confirmBox.css'\n\ninterface Props {\n onClose: () => void;\n fromChain?: any;\n toChain?: any;\n status: number;\n hash: string;\n}\n\n\n\nexport default function ComfirmBox({ onClose, status = 1, fromChain = {\n name: 'NEAR',\n}, toChain = {\n name: 'BTC',\n}, hash }: Props) {\n return <Modal onClose={onClose}>\n <div className=\"title\">Transaction Detail</div>\n <div className=\"chians\">\n {/* <img style={{ width: 26, height: 26 }} src={fromChain?.icon} /> */}\n {/* <svg width=\"31\" height=\"2\" viewBox=\"0 0 31 2\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <line opacity=\"0.5\" x1=\"8.74228e-08\" y1=\"1\" x2=\"31\" y2=\"1\" stroke=\"#727272\" stroke-width=\"2\" stroke-dasharray=\"2 5\" />\n </svg> */}\n\n {\n status === 0 ? <svg className=\"loading\" width=\"54\" height=\"54\" viewBox=\"0 0 54 54\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M52.0766 10.7867C53.0482 11.0471 53.6273 12.0399 53.3741 13.0134C53.1219 13.977 52.1361 14.5546 51.1725 14.3024L47.6172 13.3498L46.3268 18.1657C44.8261 23.7665 40.0219 27.6146 34.2721 28.6546C38.7381 32.4056 40.9681 38.1648 39.4673 43.7656L38.1769 48.5815L41.6972 49.5248C42.6655 49.7843 43.2401 50.7794 42.9806 51.7477C42.7212 52.7159 41.726 53.2905 40.7578 53.031L2.02593 42.6529L1.71657 42.5396C0.800668 42.1375 0.383843 41.0689 0.785965 40.153C1.15472 39.3126 2.09436 38.8809 2.97262 39.1481L6.52126 40.0989L7.81144 35.2839C9.31216 29.6832 14.1131 25.8341 19.8661 24.795C15.3968 21.0432 13.1702 15.2848 14.6709 9.68407L15.9615 4.86764L12.4128 3.91679C11.4445 3.65734 10.87 2.66223 11.1295 1.69395C11.3889 0.725662 12.384 0.151138 13.3523 0.410589L52.0766 10.7867ZM44.0959 12.4063L19.471 5.80801L18.1871 10.5994C17.0693 14.7711 18.671 19.3131 22.2022 22.3268C23.2549 23.2994 23.6544 24.61 23.3544 25.7297C23.0485 27.0126 21.9665 27.9627 20.6551 28.1007C16.1146 28.9516 12.432 32.0776 11.3175 36.2502L10.0214 41.0874L11.982 41.6127L12.5291 39.571C13.5385 35.8039 16.032 32.0464 21.0065 30.689L21.8135 30.4937C23.6047 30.2306 25.3145 29.1151 26.9388 27.1507C27.1931 29.441 28.1726 31.2771 29.8857 32.6567C34.4351 36.8 34.1706 41.1245 33.1094 45.0849L32.5623 47.1267L34.6428 47.6841L35.9323 42.8715C37.0501 38.6998 35.4522 34.1588 31.9215 31.1412C30.8693 30.1687 30.4684 28.8613 30.7693 27.7383C31.1136 26.4535 32.114 25.5215 33.4676 25.3711C38.0072 24.5235 41.6865 21.3966 42.8052 17.2216L44.0959 12.4063ZM40.7578 15.6185C40.1797 19.9295 35.6431 22.9023 32.7256 23.2863C30.9809 23.5169 29.1741 24.3456 27.3087 25.7742C26.4809 23.6244 25.3731 22.0143 23.9948 20.9474C21.5041 19.0198 20.6551 17.2216 20.3797 15.1185L40.7578 15.6185Z\" fill=\"white\" fill-opacity=\"0.21\" />\n </svg> : <svg width=\"54\" height=\"54\" viewBox=\"0 0 54 54\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"27\" cy=\"27\" r=\"21\" fill=\"#33FFDA\" />\n <circle cx=\"27\" cy=\"27\" r=\"24\" stroke=\"#33FFDA\" stroke-opacity=\"0.3\" stroke-width=\"6\" />\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M37.342 19.6604C38.2111 20.5494 38.2205 22.0006 37.363 22.9016L24.8987 36L17.651 28.5196C16.7858 27.6266 16.7826 26.1754 17.6439 25.2783C18.5052 24.3813 19.9048 24.378 20.77 25.271L24.8705 29.5031L34.2159 19.6822C35.0733 18.7812 36.4729 18.7714 37.342 19.6604Z\" fill=\"black\" />\n </svg>\n }\n\n {/* <svg width=\"31\" height=\"2\" viewBox=\"0 0 31 2\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <line opacity=\"0.5\" x1=\"8.74228e-08\" y1=\"1\" x2=\"31\" y2=\"1\" stroke=\"#727272\" stroke-width=\"2\" stroke-dasharray=\"2 5\" />\n </svg> */}\n {/* <img style={{ width: 26, height: 26 }} src={toChain?.icon} /> */}\n </div>\n\n {\n status === 0 && <>\n <div className=\"time\">\n Est Time: 5 mins\n </div>\n <div className=\"processing\">\n Transaction is processing. \n </div>\n </>\n }\n\n {\n status === 1 && <>\n <div className=\"time\">\n Bridge Completed\n </div>\n <div className=\"processing\">\n You can view your transaction on the <a href=\"/history\">bridge transaction history.</a>\n </div>\n </>\n }\n\n {\n !!hash && <><div className=\"srcBtn\" onClick={() => {\n if (fromChain.name === 'BTC') {\n window.open(`https://mempool.space/testnet/tx/${hash}`)\n } else if (fromChain.name === 'NEAR') {\n window.open(`https://testnet.nearblocks.io/txns/${hash}`)\n }\n\n }}>\n SRC TX <svg width=\"8\" height=\"8\" viewBox=\"0 0 8 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M5.97871 8H2.02129C0.907217 8 0 7.09294 0 5.97905V2.02095C0 0.907063 0.907217 0 2.02129 0H3.73973C3.98175 0 4.17779 0.196012 4.17779 0.437986C4.17779 0.679959 3.98175 0.875972 3.73973 0.875972H2.02129C1.71573 0.875972 1.42775 0.994931 1.21142 1.21122C0.995099 1.42751 0.87612 1.71544 0.87612 2.02095V5.97769C0.87612 6.2832 0.995099 6.57114 1.21142 6.78743C1.42775 7.00372 1.71573 7.12268 2.02129 7.12268H5.97871C6.61011 7.12268 7.12388 6.60899 7.12388 5.97769V4.12977C7.12388 3.97432 7.20771 3.82832 7.34291 3.74992C7.40916 3.71206 7.48487 3.69179 7.56194 3.69179C7.63901 3.69179 7.71472 3.71206 7.78097 3.74992C7.91617 3.82832 8 3.97296 8 4.12977V5.97769C8 7.09294 7.09414 8 5.97871 8ZM7.35223 2.78066C7.41578 2.81715 7.48879 2.83608 7.56179 2.83608C7.6348 2.83608 7.70781 2.8158 7.77271 2.7793C7.90251 2.70496 7.98228 2.56572 7.98228 2.41702V0.438001C7.98228 0.206844 7.79434 0.0189453 7.56315 0.0189453H5.58378C5.35258 0.0189453 5.16465 0.206844 5.16465 0.438001C5.16465 0.669157 5.35258 0.857056 5.58378 0.857056H6.55077L3.70328 3.70405L3.70058 3.70676C3.62658 3.7861 3.58634 3.89111 3.58835 3.99958C3.59037 4.10806 3.6345 4.21149 3.7114 4.28803C3.79117 4.36779 3.89527 4.41105 4.00749 4.41105C4.1143 4.41105 4.2157 4.37049 4.29277 4.29885L4.29412 4.2975L7.14267 1.44944V2.41838C7.14267 2.56707 7.22379 2.70631 7.35223 2.78066Z\" fill=\"#FF7A00\" />\n </svg>\n </div>\n </>\n }\n\n {/* {\n status === 1 &&\n <button onClick={() => {\n onClose && onClose()\n }} className={styles.btn}>+ New Transfer</button>\n } */}\n\n </Modal>\n}", "import { useEffect } from 'react'\nimport { useBtcWalletSelector } from './btcWalletSelectorContext'\n\nexport function InitContextHook() {\n const btcContext = useBtcWalletSelector()\n\n useEffect(() => {\n // @ts-ignore\n window.btcContext = btcContext\n }, [btcContext])\n\n return null\n}", "import type {\n Transaction,\n InjectedWallet,\n WalletModuleFactory,\n WalletBehaviourFactory,\n} from '@near-wallet-selector/core';\nimport { providers, transactions } from 'near-api-js';\nimport type { AccessKeyViewRaw } from 'near-api-js/lib/providers/provider';\nimport { actionCreators } from '@near-js/transactions';\n\nimport { PublicKey } from 'near-api-js/lib/utils/key_pair';\nimport { encodeTransaction } from 'near-api-js/lib/transaction';\nimport { baseDecode } from '@near-js/utils';\nimport bs58 from 'bs58';\nimport { sha256 } from 'js-sha256';\nimport { setupWalletButton, removeWalletButton } from './initWalletButton';\n\n// export * from './btcWalletSelectorContext'\nimport type { useBtcWalletSelector } from './../components/btcWalletSelectorContext';\nimport { delay } from '.';\n\nconst { transfer, functionCall } = actionCreators;\n\ndeclare global {\n interface Window {\n btcContext: ReturnType<typeof useBtcWalletSelector>;\n }\n}\n\ninterface BTCWalletParams {\n iconUrl?: string;\n deprecated?: boolean;\n autoConnect?: boolean;\n}\n\nconst config: Record<\n string,\n {\n base_url: string;\n token: string;\n contractId: string;\n }\n> = {\n testnet: {\n base_url: 'https://api.testnet.satoshibridge.top/v1',\n token: 'nbtc2-nsp.testnet',\n contractId: 'dev2-nsp.testnet',\n },\n mainnet: {\n base_url: 'https://api.mainnet.satoshibridge.top/v1',\n token: '',\n contractId: '',\n },\n};\n\nconst state: any = {\n saveAccount(account: string) {\n window.localStorage.setItem('btc-wallet-account', account);\n },\n removeAccount() {\n window.localStorage.removeItem('btc-wallet-account');\n },\n savePublicKey(publicKey: string) {\n window.localStorage.setItem('btc-wallet-publickey', publicKey);\n },\n removePublicKey() {\n window.localStorage.removeItem('btc-wallet-publickey');\n },\n saveBtcPublicKey(publicKey: string) {\n window.localStorage.setItem('btc-wallet-btc-publickey', publicKey);\n },\n removeBtcPublicKey() {\n window.localStorage.removeItem('btc-wallet-btc-publickey');\n },\n clear() {\n this.removeAccount();\n this.removePublicKey();\n this.removeBtcPublicKey();\n },\n save(account: string, publicKey: string) {\n this.saveAccount(account);\n this.savePublicKey(publicKey);\n },\n getAccount() {\n return window.localStorage.getItem('btc-wallet-account');\n },\n getPublicKey() {\n return window.localStorage.getItem('btc-wallet-publickey');\n },\n getBtcPublicKey() {\n return window.localStorage.getItem('btc-wallet-btc-publickey');\n },\n};\n\nlet inter: any = null;\n\nconst BTCWallet: WalletBehaviourFactory<InjectedWallet> = async ({\n metadata,\n options,\n store,\n emitter,\n logger,\n id,\n provider,\n}) => {\n const wallet = {\n signIn,\n signOut,\n getAccounts,\n verifyOwner,\n signMessage,\n signAndSendTransaction,\n signAndSendTransactions,\n };\n\n initWalletButton(options.network.networkId, wallet);\n\n if (!inter) {\n inter = setInterval(async () => {\n // @ts-ignore\n const btcContext = window.btcContext;\n\n console.log('inter btcContext:', btcContext);\n\n if (btcContext) {\n clearInterval(inter);\n const context = btcContext.getContext();\n\n context.on('updatePublicKey', async (btcPublicKey: string) => {\n const { nearTempAddress } = await getNearAccountByBtcPublicKey(btcPublicKey);\n\n initWalletButton(options.network.networkId, wallet);\n\n emitter.emit('accountsChanged', {\n accounts: [\n {\n accountId: nearTempAddress,\n // active: true\n },\n ],\n });\n });\n\n context.on('btcLoginError', async (e: any) => {\n emitter.emit('accountsChanged', {\n accounts: [],\n });\n });\n\n console.log('metadata.autoConnect:', metadata);\n\n if (\n 'autoConnect' in metadata &&\n metadata.autoConnect &&\n localStorage.getItem('near-wallet-selector:selectedWalletId') === '\"btc-wallet\"'\n ) {\n await btcContext.autoConnect();\n }\n\n clearInterval(inter);\n }\n }, 500);\n }\n\n async function viewMethod({ method, args = {} }: { method: string; args: any }) {\n const res: any = await provider.query({\n request_type: 'call_function',\n account_id: config[options.network.networkId].contractId,\n method_name: method,\n args_base64: Buffer.from(JSON.stringify(args)).toString('base64'),\n finality: 'optimistic',\n });\n\n return JSON.parse(Buffer.from(res.result).toString());\n }\n\n async function getNearAccountByBtcPublicKey(btcPublicKey: string) {\n const nearTempAddress = await viewMethod({\n method: 'get_chain_signature_near_account',\n args: { btc_public_key: btcPublicKey },\n });\n\n const nearTempPublicKey = await viewMethod({\n method: 'get_chain_signature_near_account_public_key',\n args: { btc_public_key: btcPublicKey },\n });\n\n state.saveAccount(nearTempAddress);\n state.savePublicKey(nearTempPublicKey);\n state.saveBtcPublicKey(btcPublicKey);\n\n return {\n nearTempAddress,\n nearTempPublicKey,\n };\n }\n\n async function signIn({ contractId, methodNames }: any) {\n console.log(provider);\n const accountId = state.getAccount();\n const publicKey = state.getPublicKey();\n\n const btcContext = window.btcContext;\n\n initWalletButton(options.network.networkId, wallet);\n\n if (accountId && publicKey) {\n return [\n {\n accountId,\n publicKey,\n },\n ];\n }\n\n const btcAccount = await btcContext.login();\n const btcPublicKey = await btcContext.getPublicKey();\n\n const { nearTempAddress, nearTempPublicKey } = await getNearAccountByBtcPublicKey(btcPublicKey);\n\n return [\n {\n accountId: nearTempAddress,\n publicKey: nearTempPublicKey,\n },\n ];\n }\n\n async function signOut() {\n const btcContext = window.btcContext;\n btcContext.logout();\n state.clear();\n window.localStorage.removeItem('near-wallet-selector:selectedWalletId');\n removeWalletButton();\n // clearInterval(inter)\n }\n\n async function getAccounts() {\n return [{ accountId: state.getAccount() }];\n }\n\n async function verifyOwner() {\n throw new Error(`Method not supported by ${metadata.name}`);\n }\n\n async function signMessage() {\n throw new Error(`Method not supported by ${metadata.name}`);\n }\n\n async function signAndSendTransaction(params: Transaction) {\n const transactions = [params];\n const result = await signAndSendTransactions({ transactions });\n if (Array.isArray(result)) {\n return result[0];\n } else {\n throw new Error(`Transaction failed: ${result}`);\n }\n }\n\n async function signAndSendTransactions(params: { transactions: Transaction[] }) {\n const btcContext = window.btcContext;\n const accountId = state.getAccount();\n const publicKey = state.getPublicKey();\n\n const { header } = await provider.block({ finality: 'final' });\n\n const rawAccessKey = await provider.query<AccessKeyViewRaw>({\n request_type: 'view_access_key',\n account_id: accountId,\n public_key: publicKey,\n finality: 'final',\n });\n\n const accessKey = {\n ...rawAccessKey,\n nonce: BigInt(rawAccessKey.nonce || 0),\n };\n\n const publicKeyFormat = PublicKey.from(publicKey);\n\n const nearNonceApi = await getNearNonceFromApi(options.network.networkId, accountId);\n\n const newTransactions = params.transactions.map((transaction, index) => {\n let nearNonceNumber = accessKey.nonce + BigInt(1);\n if (nearNonceApi) {\n nearNonceNumber =\n BigInt(nearNonceApi.result_data) > nearNonceNumber\n ? BigInt(nearNonceApi.result_data)\n : nearNonceNumber;\n }\n const newActions = transaction.actions\n .map((action) => {\n switch (action.type) {\n case 'FunctionCall':\n return functionCall(\n action.params.methodName,\n action.params.args,\n BigInt(action.params.gas),\n BigInt(action.params.deposit),\n );\n case 'Transfer':\n return transfer(BigInt(action.params.deposit));\n }\n })\n .filter(Boolean) as transactions.Action[];\n const _transaction = transactions.createTransaction(\n accountId,\n publicKeyFormat,\n transaction.receiverId,\n BigInt(nearNonceNumber) + BigInt(index),\n newActions,\n baseDecode(header.hash),\n );\n const txBytes = encodeTransaction(_transaction);\n const txHex = Array.from(txBytes, (byte) =>\n ('0' + (byte & 0xff).toString(16)).slice(-2),\n ).join('');\n console.log('txHex:', txHex);\n\n const hash = bs58.encode(new Uint8Array(sha256.array(txBytes)));\n return { txBytes, txHex, hash };\n });\n\n const accountInfo = await viewMethod({\n method: 'get_account',\n args: { account_id: accountId },\n });\n\n const nonceApi = await getNonceFromApi(options.network.networkId, accountId as string);\n\n const nonce =\n Number(nonceApi?.result_data) > Number(accountInfo.nonce)\n ? String(nonceApi?.result_data)\n : String(accountInfo.nonce);\n\n const intention = {\n chain_id: '397',\n csna: accountId,\n near_transactions: newTransactions.map((t) => t.txHex),\n gas_token: config[options.network.networkId].token,\n gas_limit: '3000',\n nonce,\n };\n\n const strIntention = JSON.stringify(intention);\n\n const signature = await btcContext.signMessage(strIntention);\n\n const result = await uploadBTCTx(options.network.networkId, {\n sig: signature,\n btcPubKey: state.getBtcPublicKey(),\n data: toHex(strIntention),\n });\n\n console.log('result:', result);\n\n if (result.result_code === 0) {\n const hash = newTransactions.map((t) => t.hash);\n console.log('txHash:', hash);\n const result = await pollTransactionStatuses(options.network.networkId, hash);\n return result;\n } else {\n return null;\n }\n }\n\n async function initWalletButton(network: string, wallet: any) {\n console.log('initWalletButton:', network, wallet);\n const checkAndSetupWalletButton = () => {\n const accountId = state.getAccount();\n const btcContext = window.btcContext;\n console.log('checkAndSetupWalletButton:', accountId, btcContext.account);\n if (accountId && btcContext.account) {\n setupWalletButton(network, wallet, btcContext);\n } else {\n removeWalletButton();\n setTimeout(() => {\n checkAndSetupWalletButton();\n }, 5000);\n }\n };\n await delay(1000);\n checkAndSetupWalletButton();\n }\n\n return wallet as any;\n};\n\nfunction getNonceFromApi(network: string, accountId: string) {\n return fetch(`${config[network].base_url}/nonce?csna=${accountId}`, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n }).then((res) => res.json());\n}\n\nfunction getNearNonceFromApi(network: string, accountId: string) {\n return fetch(`${config[network].base_url}/nonceNear?csna=${accountId}`, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n }).then((res) => res.json());\n}\n\nfunction uploadBTCTx(network: string, data: any) {\n return fetch(`${config[network].base_url}/receiveTransaction`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(data),\n }).then((res) => res.json());\n}\n\nexport function setupBTCWallet({\n iconUrl = 'https://assets.deltatrade.ai/assets/chain/btc.svg',\n deprecated = false,\n autoConnect = true,\n}: BTCWalletParams | undefined = {}): WalletModuleFactory<InjectedWallet> {\n const btcWallet: any = async () => {\n return {\n id: 'btc-wallet',\n type: 'injected',\n metadata: {\n name: 'BTC Wallet',\n description: 'BTC Wallet',\n iconUrl,\n downloadUrl: iconUrl,\n deprecated,\n available: true,\n autoConnect,\n },\n init: BTCWallet,\n };\n };\n\n return btcWallet;\n}\n\nfunction toHex(originalString: string) {\n const charArray = originalString.split('');\n const asciiArray = charArray.map((char) => char.charCodeAt(0));\n const hexArray = asciiArray.map((code) => code.toString(16));\n let hexString = hexArray.join('');\n hexString = hexString.replace(/(^0+)/g, '');\n return hexString;\n}\n\nconst rcpUrls = {\n mainnet: [\n 'https://near.lava.build',\n 'https://rpc.mainnet.near.org',\n 'https://free.rpc.fastnear.com',\n 'https://near.drpc.org',\n ],\n testnet: [\n 'https://near-testnet.lava.build',\n 'https://rpc.testnet.near.org',\n 'https://near-testnet.drpc.org',\n ],\n};\n\nasync function pollTransactionStatuses(network: string, hashes: string[]) {\n const provider = new providers.FailoverRpcProvider(\n Object.values(rcpUrls[network as keyof typeof rcpUrls]).map(\n (url) => new providers.JsonRpcProvider({ url }),\n ),\n );\n\n const maxAttempts = 3;\n\n // Helper function to poll status for a single transaction hash\n const pollStatus = async (hash: string) => {\n let attempt = 0;\n\n while (attempt < maxAttempts) {\n attempt++;\n\n try {\n const result = await provider.txStatus(hash, 'unused', 'FINAL');\n\n if (result && result.status) {\n console.log(`Transaction ${hash} result:`, result);\n return result;\n }\n } catch (error: any) {\n console.error(`Failed to fetch transaction status for ${hash}: ${error.message}`);\n }\n\n if (attempt === maxAttempts) {\n throw new Error(`Transaction not found after max attempts: ${hash}`);\n }\n\n // Delay before next attempt\n await delay(10000);\n console.log(`RPC request failed for ${hash}, retrying ${maxAttempts - attempt} more times`);\n }\n };\n\n // Poll all transaction statuses in parallel\n const results = await Promise.all(hashes.map((hash) => pollStatus(hash)));\n\n return results;\n}\n\nexport default {\n // useBtcWalletSelector,\n // BtcWalletSelectorContextProvider,\n setupBTCWallet,\n};\n", "import type { Wallet } from '@near-wallet-selector/core';\n\ninterface OriginalWallet {\n account: string | null;\n getPublicKey: () => Promise<string>;\n}\n\nexport function setupWalletButton(network: string, wallet: Wallet, originalWallet: OriginalWallet) {\n console.log('setupWalletButton');\n if (document.getElementById('satoshi-wallet-button')) {\n return;\n }\n\n const iframe = createIframe({\n iframeUrl:\n network === 'testnet'\n ? 'https://wallet-dev.satoshibridge.top'\n : 'https://wallet.satoshibridge.top',\n iframeStyle: { width: '400px', height: '650px' },\n });\n\n iframe.addEventListener('mouseenter', () => {\n if (document.activeElement !== iframe) {\n document.activeElement?.setAttribute('tabindex', 'null');\n setTimeout(() => {\n iframe.focus();\n }, 0);\n }\n });\n\n const button = createFloatingButtonWithIframe({\n openImageUrl: 'https://assets.deltatrade.ai/wallet-assets/wallet-btn.png',\n closeImageUrl: 'https://assets.deltatrade.ai/wallet-assets/wallet-btn-active.png',\n iframe,\n });\n\n setupButtonClickHandler(button, iframe, wallet, originalWallet);\n}\n\nfunction createFloatingButtonWithIframe({\n openImageUrl,\n closeImageUrl,\n iframe,\n}: {\n openImageUrl: string;\n closeImageUrl: string;\n iframe: HTMLIFrameElement;\n}): HTMLImageElement {\n const button = document.createElement('img');\n button.id = 'satoshi-wallet-button';\n button.src = openImageUrl;\n\n Object.assign(button.style, {\n position: 'fixed',\n bottom: '20px',\n right: '20px',\n zIndex: '100000',\n width: '60px',\n height: '60px',\n borderRadius: '50%',\n cursor: 'pointer',\n transition: 'transform 0.15s ease',\n });\n\n document.body.appendChild(button);\n\n const iframeVisible =\n localStorage.getItem('iframeVisible') === 'true' ||\n localStorage.getItem('iframeVisible') === null;\n button.src = iframeVisible ? closeImageUrl : openImageUrl;\n iframe.style.display = iframeVisible ? 'block' : 'none';\n\n button.onclick = function () {\n const isCurrentlyVisible = iframe.style.display === 'block';\n button.style.transform = 'scale(0.8)';\n setTimeout(() => {\n button.style.transform = 'scale(1)';\n }, 150);\n\n iframe.style.display = isCurrentlyVisible ? 'none' : 'block';\n button.src = isCurrentlyVisible ? openImageUrl : closeImageUrl;\n\n localStorage.setItem('iframeVisible', String(!isCurrentlyVisible));\n\n setTimeout(() => {\n iframe.focus();\n }, 0);\n };\n\n return button;\n}\n\nfunction createIframe({\n iframeUrl,\n iframeStyle = {},\n}: {\n iframeUrl: string;\n iframeStyle?: { [key: string]: string };\n}): HTMLIFrameElement {\n const iframe = document.createElement('iframe');\n iframe.id = 'satoshi-wallet-iframe';\n iframe.allow = 'clipboard-read; clipboard-write';\n iframe.src = iframeUrl;\n\n Object.assign(iframe.style, {\n position: 'fixed',\n bottom: '90px',\n right: '20px',\n zIndex: '100000',\n boxShadow: '0 0 10px rgba(0, 0, 0, 0.1)',\n borderRadius: '10px',\n display: 'block',\n ...iframeStyle,\n });\n\n document.body.appendChild(iframe);\n\n return iframe;\n}\n\nasync function setupButtonClickHandler(\n button: HTMLImageElement,\n iframe: HTMLIFrameElement,\n wallet: Wallet,\n originalWallet: OriginalWallet,\n) {\n const accountId = (await wallet?.getAccounts())?.[0].accountId;\n const originalAccountId = originalWallet.account;\n const originalPublicKey = await originalWallet.getPublicKey();\n console.log({ accountId, originalAccountId, originalPublicKey });\n const iframeSrc = new URL(iframe.src);\n iframeSrc.searchParams.set('origin', window.location.origin);\n accountId && iframeSrc.searchParams.set('accountId', accountId);\n originalAccountId && iframeSrc.searchParams.set('originalAccountId', originalAccountId);\n originalPublicKey && iframeSrc.searchParams.set('originalPublicKey', originalPublicKey);\n\n iframe.src = iframeSrc.toString();\n console.log('iframe src', iframe.src);\n\n window.addEventListener('message', async (event) => {\n if (event.origin !== iframeSrc.origin) return;\n const { action, requestId, data } = event.data;\n\n if (action === 'signAndSendTransaction') {\n console.log('signAndSendTransaction message', event.data);\n try {\n const result = await wallet.signAndSendTransaction(data);\n console.log('signAndSendTransaction result', result);\n event.source?.postMessage(\n {\n requestId,\n data,\n success: true,\n },\n { targetOrigin: event.origin },\n );\n } catch (error: any) {\n console.error('signAndSendTransaction error', error);\n event.source?.postMessage(\n {\n requestId,\n error: error.message,\n success: false,\n },\n { targetOrigin: event.origin },\n );\n }\n }\n });\n}\n\nexport function removeWalletButton() {\n const button = document.getElementById('satoshi-wallet-button');\n button?.remove();\n const iframe = document.getElementById('satoshi-wallet-iframe');\n iframe?.remove();\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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Content": ["export * from './connector';\nexport { ConnectProvider } from './context';\nexport * from './hooks';\nexport * from './components/btcWalletSelectorContext'\nexport * from './utils/setupBTCWallet'\nexport * from './components/hook'\nexport const getVersion = () => {\n return '0.2.0';\n};\n\nif (typeof window !== 'undefined') {\n (window as any).__PARTICLE_BTC_CONNECT_VERSION = getVersion();\n}\n", "export interface WalletMetadata {\n id: string;\n name: string;\n icon: string;\n downloadUrl: string;\n}\n\nexport abstract class BaseConnector {\n abstract readonly metadata: WalletMetadata;\n abstract isReady(): boolean;\n abstract requestAccounts(): Promise<string[]>;\n abstract getAccounts(): Promise<string[]>;\n abstract getPublicKey(): Promise<string>;\n abstract signMessage(signStr: string, type?: 'ecdsa' | 'bip322-simple'): Promise<string>;\n abstract on(event: string, handler: (data?: unknown) => void): void;\n abstract removeListener(event: string, handler: (data?: unknown) => void): void;\n [key: string]: any;\n abstract getProvider(): any;\n abstract getNetwork(): Promise<'livenet' | 'testnet'>;\n abstract switchNetwork(network: 'livenet' | 'testnet'): Promise<void>;\n abstract sendBitcoin(toAddress: string, satoshis: number, options?: { feeRate: number }): Promise<string>;\n abstract sendInscription(\n address: string,\n inscriptionId: string,\n options?: { feeRate: number }\n ): Promise<{ txid: string }>;\n abstract disconnect(): void;\n}\n", "import { BaseConnector } from './base';\n\nexport abstract class InjectedConnector extends BaseConnector {\n constructor(private propertity: string) {\n super();\n const props = this.propertity?.split('.');\n if (!this.propertity || props.length > 2) {\n throw new Error('please input valid propertity');\n }\n }\n isReady(): boolean {\n if (typeof window !== 'undefined') {\n const props = this.propertity.split('.');\n if (props.length === 1) {\n return typeof (window as any)[props[0]] !== 'undefined';\n } else {\n return (\n typeof (window as any)[props[0]] !== 'undefined' && typeof (window as any)[props[0]][props[1]] !== 'undefined'\n );\n }\n }\n return false;\n }\n\n async requestAccounts(): Promise<string[]> {\n const accounts = await this.getProviderOrThrow().requestAccounts();\n console.log('\uD83D\uDE80 ~ InjectedConnector ~ requestAccounts ~ accounts:', accounts);\n return accounts;\n }\n\n async getAccounts(): Promise<string[]> {\n const accounts = await this.getProviderOrThrow().getAccounts();\n return accounts;\n }\n async getPublicKey(): Promise<string> {\n return this.getProviderOrThrow().getPublicKey();\n }\n async signMessage(signStr: string, type?: 'ecdsa' | 'bip322-simple'): Promise<string> {\n const addresses = await this.getAccounts();\n if (addresses.length === 0) {\n throw new Error(`${this.metadata.name} not connected!`);\n }\n return this.getProviderOrThrow().signMessage(signStr, type);\n }\n on(event: string, handler: (data?: unknown) => void) {\n const provider = this.getProvider();\n return provider?.on?.(event, handler);\n }\n removeListener(event: string, handler: (data?: unknown) => void) {\n const provider = this.getProvider();\n return provider?.removeListener?.(event, handler);\n }\n\n getProvider() {\n if (this.isReady()) {\n const props = this.propertity.split('.');\n if (props.length === 1) {\n return (window as any)[props[0]];\n } else {\n return (window as any)[props[0]][props[1]];\n }\n }\n }\n\n getProviderOrThrow() {\n const provider = this.getProvider();\n if (!provider) {\n throw new Error(`${this.metadata.name} is not install or not create Bitcoin wallet!`);\n }\n return provider;\n }\n\n async getNetwork(): Promise<'livenet' | 'testnet'> {\n return this.getProviderOrThrow().getNetwork();\n }\n async switchNetwork(network: 'livenet' | 'testnet'): Promise<void> {\n return this.getProviderOrThrow().switchNetwork(network);\n }\n\n async sendBitcoin(toAddress: string, satoshis: number, options?: { feeRate: number }): Promise<string> {\n return this.getProviderOrThrow().sendBitcoin(toAddress, satoshis, options);\n }\n\n async sendInscription(\n address: string,\n inscriptionId: string,\n options?: { feeRate: number }\n ): Promise<{ txid: string }> {\n const result = await this.getProviderOrThrow().sendInscription(address, inscriptionId, options);\n if (typeof result === 'string') {\n return {\n txid: result,\n };\n }\n\n return result;\n }\n\n disconnect() {}\n}\n", "import icon from '../icons/bitget.png';\nimport { type WalletMetadata } from './base';\nimport { InjectedConnector } from './injected';\n\nexport class BitgetConnector extends InjectedConnector {\n readonly metadata: WalletMetadata = {\n id: 'bitget',\n name: 'Bitget Wallet',\n icon,\n downloadUrl: 'https://web3.bitget.com/en/wallet-download',\n };\n\n constructor() {\n super('bitkeep.unisat');\n }\n}\n", "import icon from '../icons/bybit.png';\nimport { type WalletMetadata } from './base';\nimport { InjectedConnector } from './injected';\n\nexport class BybitConnector extends InjectedConnector {\n readonly metadata: WalletMetadata = {\n id: 'bybit',\n name: 'Bybit Wallet',\n icon,\n downloadUrl: 'https://www.bybit.com/download/',\n };\n\n constructor() {\n super('bybitWallet.bitcoin');\n }\n}\n", "import icon from '../icons/okx.svg';\nimport { type WalletMetadata } from './base';\nimport { InjectedConnector } from './injected';\n\nexport class OKXConnector extends InjectedConnector {\n readonly metadata: WalletMetadata = {\n id: 'okx',\n name: 'OKX Wallet',\n icon,\n downloadUrl: 'https://www.okx.com/download',\n };\n constructor() {\n super('okxwallet.bitcoin');\n }\n}\n", "import icon from '../icons/tokenpocket.png';\nimport { type WalletMetadata } from './base';\nimport { InjectedConnector } from './injected';\n\nexport class TokenPocketConnector extends InjectedConnector {\n readonly metadata: WalletMetadata = {\n id: 'tokenpocket',\n name: 'TokenPocket',\n icon,\n downloadUrl: 'https://www.tokenpocket.pro/en/download/app',\n };\n\n constructor() {\n super('tokenpocket.bitcoin');\n }\n}\n", "import icon from '../icons/unisat.svg';\nimport { type WalletMetadata } from './base';\nimport { InjectedConnector } from './injected';\n\nexport class UnisatConnector extends InjectedConnector {\n readonly metadata: WalletMetadata = {\n id: 'unisat',\n name: 'Unisat Wallet',\n icon,\n downloadUrl: 'https://unisat.io',\n };\n\n constructor() {\n super('unisat');\n }\n}\n", "import icon from '../icons/wizz.svg';\nimport { type WalletMetadata } from './base';\nimport { InjectedConnector } from './injected';\n\nexport class WizzConnector extends InjectedConnector {\n readonly metadata: WalletMetadata = {\n id: 'wizz',\n name: 'Wizz Wallet',\n icon,\n downloadUrl: 'https://wizzwallet.io',\n };\n\n constructor() {\n super('wizz');\n }\n}\n", "import EventEmitter from 'events';\nimport type { Address, GetAddressOptions, SendBtcTransactionOptions, SignMessageOptions } from 'sats-connect';\nimport icon from '../icons/xverse.png';\nimport { BaseConnector, type WalletMetadata } from './base';\nexport class XverseConnector extends BaseConnector {\n #network = 'Mainnet'; // Testnet\n #event = new EventEmitter();\n constructor() {\n super();\n this.#event.setMaxListeners(100);\n }\n readonly metadata: WalletMetadata = {\n id: 'xverse',\n name: 'Xverse Wallet',\n icon,\n downloadUrl: 'https://www.xverse.app',\n };\n isReady(): boolean {\n return typeof window !== 'undefined' && typeof window.BitcoinProvider !== 'undefined';\n }\n private loadAccounts = async (network: 'Mainnet' | 'Testnet') => {\n const { getAddress, AddressPurpose } = await import('sats-connect');\n const addresses = await new Promise<Address[]>((resolve, reject) => {\n const getAddressOptions: GetAddressOptions = {\n payload: {\n purposes: [AddressPurpose.Payment, AddressPurpose.Ordinals],\n message: 'Address for receiving Ordinals and payments',\n network: {\n type: network as any,\n },\n },\n onFinish: (response) => {\n resolve(response.addresses);\n },\n onCancel: () =>\n reject({\n code: 4001,\n message: 'User rejected the request.',\n }),\n };\n getAddress(getAddressOptions).catch((error) => reject(error));\n });\n localStorage.setItem('btc-connect-xverse-addresses-' + network, JSON.stringify(addresses));\n return addresses;\n };\n async sendInscription(): Promise<{ txid: string }> {\n throw new Error('Unsupported');\n }\n async requestAccounts(): Promise<string[]> {\n if (!this.isReady()) {\n throw new Error(`${this.metadata.name} is not install!`);\n }\n const addresses = await this.loadAccounts(this.#network as any);\n return addresses.map((item) => item.address);\n }\n async getAccounts(): Promise<string[]> {\n if (!this.isReady()) {\n throw new Error(`${this.metadata.name} is not install!`);\n }\n const data = localStorage.getItem('btc-connect-xverse-addresses-' + this.#network);\n if (data) {\n const addresses: Address[] = JSON.parse(data);\n return addresses.map((item) => item.address);\n } else {\n return [];\n }\n }\n async getPublicKey(): Promise<string> {\n if (!this.isReady()) {\n throw new Error(`${this.metadata.name} is not install!`);\n }\n const data = localStorage.getItem('btc-connect-xverse-addresses-' + this.#network);\n if (data) {\n const addresses: Address[] = JSON.parse(data);\n return addresses[0].publicKey;\n } else {\n return '';\n }\n }\n async signMessage(signStr: string): Promise<string> {\n if (!this.isReady()) {\n throw new Error(`${this.metadata.name} is not install!`);\n }\n const addresses = await this.getAccounts();\n if (addresses.length === 0) {\n throw new Error(`${this.metadata.name} not connected!`);\n }\n const { signMessage } = await import('sats-connect');\n\n const sig = await new Promise<string>((resolve, reject) => {\n const signMessageOptions: SignMessageOptions = {\n payload: {\n network: {\n type: this.#network as any,\n },\n address: addresses[0],\n message: signStr,\n },\n onFinish: (response) => {\n resolve(response);\n },\n onCancel: () => {\n reject({\n code: 4001,\n message: 'User rejected the request.',\n });\n },\n };\n signMessage(signMessageOptions).catch((e) => {\n reject(e);\n });\n });\n\n const modifiedSig = Buffer.from(sig, 'base64');\n modifiedSig[0] = 31 + ((modifiedSig[0] - 31) % 4);\n return modifiedSig.toString('base64');\n }\n on(event: string, handler: (data?: unknown) => void) {\n return this.#event.on(event, handler);\n }\n removeListener(event: string, handler: (data?: unknown) => void) {\n return this.#event.removeListener(event, handler);\n }\n getProvider() {\n if (this.isReady()) {\n return window.BitcoinProvider;\n }\n }\n async getNetwork(): Promise<'livenet' | 'testnet'> {\n if (!this.isReady()) {\n throw new Error(`${this.metadata.name} is not install!`);\n }\n return this.#network === 'Mainnet' ? 'livenet' : 'testnet';\n }\n async switchNetwork(): Promise<void> {\n throw new Error('Unsupported');\n }\n async sendBitcoin(toAddress: string, satoshis: number): Promise<string> {\n const provider = this.getProvider();\n if (!provider) {\n throw new Error(`${this.metadata.name} is not install!`);\n }\n const { sendBtcTransaction } = await import('sats-connect');\n\n const addresses = await this.getAccounts();\n if (addresses.length === 0) {\n throw new Error(`${this.metadata.name} not connected!`);\n }\n const result = await new Promise<string>((resolve, reject) => {\n const sendBtcOptions: SendBtcTransactionOptions = {\n payload: {\n network: {\n type: this.#network as any,\n },\n recipients: [\n {\n address: toAddress,\n amountSats: BigInt(satoshis),\n },\n ],\n senderAddress: addresses[0],\n },\n onFinish: (response) => {\n resolve(response);\n },\n onCancel: () => {\n reject({\n code: 4001,\n message: 'User rejected the request.',\n });\n },\n };\n sendBtcTransaction(sendBtcOptions).catch((e) => reject(e));\n });\n return result;\n }\n disconnect(): void {\n localStorage.removeItem('btc-connect-xverse-addresses-Mainnet');\n localStorage.removeItem('btc-connect-xverse-addresses-Testnet');\n }\n}\n", "import { SmartAccount, type AAOptions, type AccountContract } from '@particle-network/aa';\nimport { chains } from '@particle-network/chains';\nimport { walletEntryPlugin, type WalletOption } from '@particle-network/wallet';\nimport { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';\nimport ConnectModal from '../components/connectModal';\nimport SignModal from '../components/signModal';\nimport { type BaseConnector } from '../connector/base';\nimport { AASignerProvider } from '../evmSigner';\nimport useModalStateValue from '../hooks/useModalStateValue';\nimport type { AccountInfo } from '../types/accountInfo';\nimport { EventName } from '../types/eventName';\nimport { checkBTCVersion } from '../utils';\nimport { getBTCAAAddress, getBTCAccountInfo } from '../utils/ethereumUtils';\nimport events from '../utils/eventUtils';\nimport txConfirm from '../utils/txConfirmUtils';\n\ninterface GlobalState {\n connectorId?: string;\n setConnectorId: (connectorId?: string) => void;\n connector?: BaseConnector;\n connectors: BaseConnector[];\n openConnectModal: () => void;\n closeConnectModal: () => void;\n accounts: string[];\n provider: any;\n disconnect: () => void;\n requestDirectAccount: (connector: BaseConnector) => any;\n getPublicKey: () => Promise<string>;\n signMessage: (message: string) => Promise<string>;\n evmAccount?: string;\n smartAccount?: SmartAccount;\n switchNetwork: (network: 'livenet' | 'testnet') => Promise<void>;\n getNetwork: () => Promise<'livenet' | 'testnet'>;\n sendBitcoin: (toAddress: string, satoshis: number, options?: { feeRate: number }) => Promise<string>;\n accountContract: AccountContract;\n setAccountContract: (accountContract: AccountContract) => void;\n getSmartAccountInfo: () => Promise<AccountInfo | undefined>;\n}\n\nconst ConnectContext = createContext<GlobalState>({} as any);\n\ninterface ConnectOptions {\n projectId: string;\n clientKey: string;\n appId: string;\n aaOptions: AAOptions;\n rpcUrls?: Record<number, string>;\n walletOptions?: Omit<WalletOption, 'erc4337' | 'customStyle'> & {\n customStyle?: Omit<WalletOption['customStyle'], 'supportChains'>;\n };\n}\n\nconst SAContractKey = 'particle-sa-config';\n\nexport const ConnectProvider = ({\n children,\n options,\n connectors,\n autoConnect = true,\n}: {\n children: React.ReactNode;\n options: ConnectOptions;\n connectors: BaseConnector[];\n autoConnect?: boolean;\n}) => {\n const {\n closeModal: closeConnectModal,\n isModalOpen: connectModalOpen,\n openModal: openConnectModal,\n } = useModalStateValue();\n\n const { closeModal: closeSignModal, isModalOpen: signModalOpen, openModal: openSignModal } = useModalStateValue();\n\n const [connectorId, setConnectorId] = useState<string>();\n const [accounts, setAccounts] = useState<string[]>([]);\n const [evmAccount, setEVMAccount] = useState<string>();\n const [accountContract, _setAccountContract] = useState<AccountContract>({\n name: Object.keys(options.aaOptions.accountContracts)?.[0] || 'BTC',\n version:\n options.aaOptions.accountContracts[Object.keys(options.aaOptions.accountContracts)?.[0] || 'BTC']?.[0].version ||\n '1.0.0',\n });\n\n const setAccountContract = useCallback(\n (config: AccountContract) => {\n if (!checkBTCVersion(options.aaOptions.accountContracts, config.name, config.version)) {\n throw new Error('Invalid Account Contract');\n }\n localStorage.setItem(SAContractKey, JSON.stringify(config));\n _setAccountContract(config);\n },\n [options.aaOptions.accountContracts, _setAccountContract]\n );\n\n useEffect(() => {\n const id = localStorage.getItem('current-connector-id');\n if (id) {\n setConnectorId(id);\n }\n }, [autoConnect]);\n\n const evmSupportChainIds = useMemo(() => {\n let chainIds = options.aaOptions.accountContracts[accountContract.name]\n ?.filter((item) => item.version === accountContract.version)\n .map((item) => item.chainIds)\n .reduce((a, b) => {\n a.push(...b);\n return a;\n }, []);\n chainIds = Array.from(new Set(chainIds || []));\n return chainIds;\n }, [options.aaOptions.accountContracts, accountContract]);\n\n const connector = useMemo(() => {\n return connectors.find((item) => item.metadata.id === connectorId);\n }, [connectorId, connectors]);\n\n const getPublicKey = useCallback(async () => {\n if (!connector) {\n throw new Error('Wallet not connected!');\n }\n const pubKey = await connector.getPublicKey();\n return pubKey;\n }, [connector]);\n\n const signMessage = useCallback(\n async (message: string) => {\n if (!connector) {\n throw new Error('Wallet not connected!');\n }\n const signature = await connector.signMessage(message);\n return signature;\n },\n [connector]\n );\n\n const sendBitcoin = useCallback(\n async (toAddress: string, satoshis: number, options?: { feeRate: number }) => {\n if (!connector) {\n throw new Error('Wallet not connected!');\n }\n\n const signature = await connector.sendBitcoin(toAddress, satoshis, options);\n return signature;\n },\n [connector]\n );\n\n const getNetwork = useCallback(async () => {\n if (!connector) {\n throw new Error('Wallet not connected!');\n }\n const network = await connector.getNetwork();\n return network;\n }, [connector]);\n\n const switchNetwork = useCallback(\n async (network: 'livenet' | 'testnet') => {\n if (!connector) {\n throw new Error('Wallet not connected!');\n }\n await connector.switchNetwork(network);\n },\n [connector]\n );\n\n const smartAccount = useMemo(() => {\n if (typeof window === 'undefined') {\n return undefined;\n }\n\n if (\n !(window as any).__bitcoinSmartAccount ||\n ((window as any)?.__bitcoinSmartAccount &&\n ((window as any)?.__bitcoinSmartAccount.smartAccountContract.version !== accountContract.version ||\n (window as any)?.__bitcoinSmartAccount.smartAccountContract.name !== accountContract.name))\n ) {\n const smartAccount = new SmartAccount(\n new AASignerProvider(evmSupportChainIds, options.projectId, options.clientKey, options.rpcUrls) as any,\n options\n );\n smartAccount.setSmartAccountContract(accountContract);\n (window as any).__bitcoinSmartAccount = smartAccount;\n }\n (window as any).__bitcoinSmartAccount.provider.getPublicKey = getPublicKey;\n (window as any).__bitcoinSmartAccount.provider.personalSign = signMessage;\n return (window as any).__bitcoinSmartAccount as SmartAccount;\n }, [options, evmSupportChainIds, getPublicKey, signMessage, accountContract]);\n\n useEffect(() => {\n if (accounts.length > 0 && smartAccount) {\n getBTCAAAddress(smartAccount, accounts[0], accountContract.name, accountContract.version)\n .then((res) => {\n setEVMAccount(res);\n })\n .catch((e) => {\n setEVMAccount(undefined);\n console.error('smartAccount getAddress error', e);\n // ignore\n });\n } else {\n setEVMAccount(undefined);\n }\n }, [accountContract, accounts, smartAccount]);\n\n const getSmartAccountInfo = useCallback(async () => {\n if (accounts.length > 0 && smartAccount) {\n const accountInfo = await getBTCAccountInfo(\n smartAccount,\n accounts[0],\n accountContract.name,\n accountContract.version\n );\n setEVMAccount(accountInfo.smartAccountAddress);\n return accountInfo;\n }\n return undefined;\n }, [accounts, smartAccount, accountContract, setEVMAccount]);\n\n const requestAccount = useCallback(\n async (connector: BaseConnector) => {\n let accounts = await connector.getAccounts();\n console.log('requestAccount start, autoConnect', accounts, autoConnect);\n if (accounts.length === 0 && autoConnect) {\n accounts = await connector.requestAccounts();\n }\n setAccounts(accounts);\n },\n [autoConnect]\n );\n\n const requestDirectAccount = useCallback(\n async (connector: BaseConnector) => {\n console.log(111)\n let accounts = await connector.getAccounts();\n console.log('requestAccount start, autoConnect', accounts, autoConnect);\n if (accounts.length === 0) {\n accounts = await connector.requestAccounts();\n }\n setAccounts(accounts);\n\n return accounts\n },\n []\n );\n\n useEffect(() => {\n if (connector) {\n requestAccount(connector).catch((e: any) => {\n console.log('get account error', e);\n\n setAccounts([]);\n });\n } else {\n setAccounts([]);\n }\n }, [connector, requestAccount]);\n\n useEffect(() => {\n const onAccountChange = (accounts: string[]) => {\n setAccounts(accounts);\n };\n connector?.on('accountsChanged', onAccountChange as any);\n return () => {\n connector?.removeListener('accountsChanged', onAccountChange as any);\n };\n }, [connector]);\n\n const provider = useMemo(() => {\n if (connectorId) {\n return connectors.find((item) => item.metadata.id === connectorId)?.getProvider();\n }\n }, [connectorId, connectors]);\n\n const disconnect = useCallback(() => {\n localStorage.removeItem('current-connector-id');\n txConfirm.reset();\n if (connector) {\n connector.disconnect();\n }\n setConnectorId(undefined);\n }, [connector]);\n\n useEffect(() => {\n const config = JSON.parse(localStorage.getItem(SAContractKey) || '{}');\n if (\n config.name &&\n config.version &&\n checkBTCVersion(options.aaOptions.accountContracts, config.name, config.version)\n ) {\n _setAccountContract(config);\n }\n }, [options.aaOptions.accountContracts, _setAccountContract]);\n\n useEffect(() => {\n if (options.walletOptions?.visible !== false) {\n const supportChains = evmSupportChainIds.map((id) => chains.getEVMChainInfoById(id));\n if (supportChains.some((chain) => !chain)) {\n throw new Error(`Please config valid chain ids, ${JSON.stringify(evmSupportChainIds)}`);\n }\n walletEntryPlugin.init(\n {\n projectId: options.projectId,\n clientKey: options.clientKey,\n appId: options.appId,\n },\n {\n ...options.walletOptions,\n erc4337: accountContract,\n customStyle: {\n ...options.walletOptions?.customStyle,\n supportChains: supportChains as any,\n },\n }\n );\n console.log('walletEntryPlugin init');\n }\n }, [options, evmSupportChainIds, accountContract]);\n\n useEffect(() => {\n if (smartAccount && options.walletOptions?.visible !== false) {\n walletEntryPlugin.setWalletCore({\n ethereum: smartAccount.provider,\n });\n console.log('walletEntryPlugin setWalletCore');\n }\n }, [smartAccount, options]);\n\n useEffect(() => {\n if (options.walletOptions?.visible !== false) {\n if (evmAccount) {\n walletEntryPlugin.walletEntryCreate();\n console.log('walletEntryPlugin walletEntryCreate');\n } else {\n walletEntryPlugin.walletEntryDestroy();\n console.log('walletEntryPlugin walletEntryDestroy');\n }\n }\n }, [evmAccount, smartAccount, options]);\n\n useEffect(() => {\n if (accounts.length === 0) {\n closeConnectModal();\n closeSignModal();\n if (events.listenerCount(EventName.sendUserOpResult) > 0) {\n events.emit(EventName.sendUserOpResult, {\n error: {\n code: -32600,\n message: 'Wallet disconnected',\n },\n });\n } else if (events.listenerCount(EventName.personalSignResult) > 0) {\n events.emit(EventName.personalSignResult, {\n error: {\n code: -32600,\n message: 'Wallet disconnected',\n },\n });\n } else if (events.listenerCount(EventName.signTypedDataResult) > 0) {\n events.emit(EventName.signTypedDataResult, {\n error: {\n code: -32600,\n message: 'Wallet disconnected',\n },\n });\n }\n }\n }, [accounts, closeConnectModal, closeSignModal]);\n\n return (\n <ConnectContext.Provider\n value={{\n connectorId,\n setConnectorId,\n connector,\n connectors,\n openConnectModal,\n closeConnectModal,\n accounts,\n provider,\n disconnect,\n requestDirectAccount,\n getPublicKey,\n signMessage,\n evmAccount,\n smartAccount,\n getNetwork,\n switchNetwork,\n sendBitcoin,\n accountContract: accountContract,\n setAccountContract: setAccountContract,\n getSmartAccountInfo,\n }}\n >\n {children}\n <ConnectModal open={connectModalOpen} onClose={closeConnectModal} />\n <SignModal open={signModalOpen} onClose={closeSignModal} onOpen={openSignModal} />\n </ConnectContext.Provider>\n );\n};\n\nexport const useConnectProvider = () => {\n const context = useContext(ConnectContext);\n return context;\n};\n", "import { useEffect, useState } from 'react';\nimport { type BaseConnector } from '../../connector/base';\nimport { useConnectProvider } from '../../context';\nimport { useConnector } from '../../hooks';\nimport back from '../../icons/back.svg';\nimport close from '../../icons/close.svg';\nimport retryIcon from '../../icons/retry.svg';\nimport Button from '../button';\nimport Modal from '../modal';\nimport styles from './connect.module.scss';\n\nconst ConnectModal = ({ open, onClose }: { open: boolean; onClose: () => void }) => {\n const [backVisible, setBackVisible] = useState(false);\n const [retryVisible, setRetryVisible] = useState(false);\n const [walletReady, setWalletReady] = useState(true);\n const [selectConnector, setSelectConnector] = useState<BaseConnector>();\n const { closeConnectModal } = useConnectProvider();\n const { connect, connectors } = useConnector();\n\n useEffect(() => {\n if (!open) {\n setBackVisible(false);\n setRetryVisible(false);\n setWalletReady(true);\n setSelectConnector(undefined);\n }\n }, [open]);\n\n const onConnect = async (connector: BaseConnector) => {\n setBackVisible(true);\n setSelectConnector(connector);\n if (connector.isReady()) {\n try {\n await connect(connector.metadata.id);\n closeConnectModal();\n } catch (error: any) {\n console.error('onConnect error', error);\n if (error.code === 4001) {\n setRetryVisible(true);\n }\n }\n } else {\n setWalletReady(false);\n }\n };\n\n const onBack = () => {\n setBackVisible(false);\n setRetryVisible(false);\n setWalletReady(true);\n setSelectConnector(undefined);\n };\n\n const onRetry = () => {\n setRetryVisible(false);\n if (selectConnector) {\n onConnect(selectConnector);\n }\n };\n\n return (\n <Modal open={open} onClose={onClose} isDismissable={false} contentClassName={styles.connectModal}>\n <div className={styles.title}>{selectConnector?.metadata.name || 'Choose Wallet'}</div>\n <img className={styles.closeBtn} src={close} onClick={onClose}></img>\n {backVisible && <img className={styles.backBtn} src={back} onClick={onBack}></img>}\n\n {!backVisible &&\n connectors.map((connector) => {\n return (\n <div className={styles.walletItem} key={connector.metadata.id} onClick={() => onConnect(connector)}>\n <img className={styles.walletIcon} src={connector.metadata.icon}></img>\n <div className={styles.walletName}>{connector.metadata.name}</div>\n </div>\n );\n })}\n\n {backVisible && selectConnector && (\n <div className={styles.connecting}>\n <div className={styles.connectingIconContainer}>\n <img className={styles.connectingIcon} src={selectConnector.metadata.icon}></img>\n {retryVisible && (\n <div className={styles.retryContainer} onClick={onRetry}>\n <img className={styles.retryIcon} src={retryIcon}></img>\n </div>\n )}\n </div>\n\n {walletReady ? (\n <>\n <div className={styles.connection}>{retryVisible ? 'Request Cancelled' : 'Requesting Connection'}</div>\n <div className={styles.acceptRequest}>\n {retryVisible\n ? 'You cancelled the request.\\nClick above to try again.'\n : 'Accept the request through your wallet to connect to this app.'}\n </div>\n </>\n ) : (\n <>\n <div className={styles.connection}>Wallet Not Installed.</div>\n <Button\n className={styles.btnDownload}\n onClick={() => {\n window.open(selectConnector?.metadata.downloadUrl, '_blank');\n }}\n >\n Get\n </Button>\n </>\n )}\n </div>\n )}\n </Modal>\n );\n};\n\nexport default ConnectModal;\n", "import { useConnectProvider } from '../context';\n\nexport const useAccountContract = () => {\n const { accountContract, setAccountContract } = useConnectProvider();\n return {\n accountContract,\n setAccountContract,\n };\n};\n", "import { useConnectProvider } from '../context';\n\nexport const useAccounts = () => {\n const { accounts } = useConnectProvider();\n return { accounts };\n};\n", "import { useCallback } from 'react';\nimport { useConnectProvider } from '../context';\n\nexport const useBTCProvider = () => {\n const { connector, provider, accounts, getPublicKey, signMessage, getNetwork, switchNetwork, sendBitcoin } =\n useConnectProvider();\n\n const sendInscription = useCallback(\n async (address: string, inscriptionId: string, options?: { feeRate: number }) => {\n if (!connector) {\n throw new Error('Wallet not connected!');\n }\n const result = await connector.sendInscription(address, inscriptionId, options);\n return result;\n },\n [connector]\n );\n\n return { provider, accounts, getPublicKey, signMessage, getNetwork, switchNetwork, sendBitcoin, sendInscription, connector };\n};\n", "import { useConnectProvider } from '../context';\n\nexport const useConnectModal = () => {\n const { openConnectModal, disconnect, requestDirectAccount } = useConnectProvider();\n return { openConnectModal, disconnect, requestDirectAccount };\n};\n", "import { useCallback } from 'react';\nimport { useConnectProvider } from '../context';\n\nexport const useConnector = () => {\n const { connectors, setConnectorId } = useConnectProvider();\n\n const connect = useCallback(\n async (connectorId: string) => {\n const connector = connectors.find((item) => item.metadata.id === connectorId);\n if (!connector) {\n throw new Error(`connector id ${connectorId} not found`);\n }\n const accounts = await connector.requestAccounts();\n if (accounts.length > 0) {\n localStorage.setItem('current-connector-id', connector.metadata.id);\n setConnectorId(connector.metadata.id);\n }\n },\n [connectors, setConnectorId]\n );\n\n return { connectors, connect };\n};\n", "import { intToHex } from '@ethereumjs/util';\nimport type { SendTransactionParams, Transaction, UserOpBundle, UserOpParams } from '@particle-network/aa';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport { createWalletClient, custom, type PublicClient } from 'viem';\nimport { useConnectProvider } from '../context';\nimport { EthereumProvider } from '../evmSigner/provider';\nimport { WalletClientProvider } from '../evmSigner/walletClientProvider';\nimport { EventName } from '../types/eventName';\nimport events, { getPendingSignEventAccount } from '../utils/eventUtils';\nimport txConfirm from '../utils/txConfirmUtils';\n\n\nexport const useETHProvider: any = () => {\n const { evmAccount, smartAccount, getSmartAccountInfo } = useConnectProvider();\n const [chainId, setChainId] = useState<number>();\n\n useEffect(() => {\n if (smartAccount) {\n const chainId = (smartAccount.provider as any).chainId as number;\n setChainId(chainId);\n\n const onChangeChange = (id: string) => {\n setChainId(Number(id));\n };\n smartAccount.provider.on('chainChanged', onChangeChange);\n return () => {\n smartAccount.provider.removeListener('chainChanged', onChangeChange);\n };\n }\n }, [smartAccount]);\n\n const switchChain = useCallback(\n async (chainId: number) => {\n if (smartAccount?.provider) {\n await smartAccount.provider.request({\n method: 'wallet_switchEthereumChain',\n params: [\n {\n chainId: intToHex(chainId),\n },\n ],\n });\n }\n },\n [smartAccount?.provider]\n );\n\n const getFeeQuotes = useCallback(\n async (tx: Transaction | Transaction[]) => {\n if (!smartAccount) {\n throw new Error('The smart account is not initialized.');\n }\n return smartAccount.getFeeQuotes(tx);\n },\n [smartAccount]\n );\n\n const buildUserOp = useCallback(\n async ({ tx, feeQuote, tokenPaymasterAddress }: UserOpParams) => {\n if (!smartAccount) {\n throw new Error('The smart account is not initialized.');\n }\n const result = await smartAccount.buildUserOperation({ tx, feeQuote, tokenPaymasterAddress });\n return result;\n },\n [smartAccount]\n );\n\n const sendUserOp = useCallback(\n async (params: SendTransactionParams, forceHideConfirmModal?: boolean) => {\n if (!smartAccount) {\n throw new Error('The smart account is not initialized.');\n }\n\n const showConfirmModal = !forceHideConfirmModal && !txConfirm.isNotRemind();\n\n if (showConfirmModal) {\n if (getPendingSignEventAccount() > 0) {\n throw new Error('Operation failed, there is a transaction being processed');\n }\n }\n\n let userOpBundle: UserOpBundle | undefined;\n if (\n Object.prototype.hasOwnProperty.call(params, 'userOpHash') &&\n Object.prototype.hasOwnProperty.call(params, 'userOp')\n ) {\n const { userOpHash, userOp } = params as UserOpBundle;\n if (userOpHash && userOp) {\n userOpBundle = { userOpHash, userOp };\n }\n }\n\n if (!userOpBundle) {\n const { tx, feeQuote, tokenPaymasterAddress } = params as UserOpParams;\n userOpBundle = await buildUserOp({ tx, feeQuote, tokenPaymasterAddress });\n }\n\n if (!showConfirmModal) {\n return smartAccount.sendUserOperation(userOpBundle);\n }\n\n return new Promise<string>((resolve, reject) => {\n events.emit(EventName.sendUserOp, userOpBundle);\n events.once(EventName.sendUserOpResult, ({ result, error }) => {\n if (result) {\n resolve(result);\n } else {\n reject(error);\n }\n });\n });\n },\n [smartAccount, buildUserOp]\n );\n\n const publicClient = useMemo(() => {\n if (!smartAccount || !chainId) {\n return undefined;\n }\n return (smartAccount?.provider as any).publicClient as PublicClient;\n }, [smartAccount, chainId]);\n\n const provider = useMemo(() => {\n const ethereumProvider = new EthereumProvider(sendUserOp, smartAccount?.provider as any, evmAccount);\n return ethereumProvider;\n }, [evmAccount, sendUserOp, smartAccount?.provider]);\n\n const walletClient = useMemo(() => {\n return createWalletClient({\n transport: custom(new WalletClientProvider(provider)),\n });\n }, [provider]);\n\n return {\n provider,\n /** @deprecated please use account */\n evmAccount,\n account: evmAccount,\n getSmartAccountInfo,\n switchChain,\n chainId,\n getFeeQuotes,\n buildUserOp,\n sendUserOp,\n publicClient,\n walletClient,\n };\n};\n", "import type { IEthereumProvider, JsonRpcRequest, SendTransactionParams } from '@particle-network/aa';\nimport { type AASignerProvider } from '.';\n\nexport class EthereumProvider implements IEthereumProvider {\n constructor(\n public sendUserOp: (params: SendTransactionParams, forceHideConfirmModal?: boolean) => Promise<string>,\n public signer?: AASignerProvider,\n public account?: string\n ) {}\n\n on(event: string, listener: any): this {\n this.signer?.on(event, listener);\n return this;\n }\n\n once(event: string, listener: any): this {\n this.signer?.once(event, listener);\n return this;\n }\n\n off(event: string, listener: any): this {\n this.signer?.off(event, listener);\n return this;\n }\n\n removeListener(event: string, listener: any): this {\n this.signer?.removeListener(event, listener);\n return this;\n }\n\n async request(arg: Partial<JsonRpcRequest>): Promise<any> {\n const method = arg.method;\n if (!method) {\n throw new Error('Method not found.');\n }\n\n if (method === 'eth_accounts' || method === 'eth_requestAccounts') {\n return this.account ? [this.account] : [];\n } else if (method === 'eth_sendTransaction') {\n const txData = arg.params?.[0];\n const result = await this.sendUserOp({ tx: txData });\n return result;\n }\n\n return this.signer?.request(arg as any);\n }\n}\n", "import { EventEmitter } from 'events';\nimport { EventName } from '../types/eventName';\n\nconst events = new EventEmitter();\nevents.setMaxListeners(100);\n\nexport const getPendingSignEventAccount = () => {\n return (\n events.listenerCount(EventName.sendUserOpResult) +\n events.listenerCount(EventName.personalSignResult) +\n events.listenerCount(EventName.signTypedDataResult)\n );\n};\n\nexport default events;\n", "const txConfirm = {\n isNotRemind: () => {\n if (typeof window === 'undefined') return false;\n const value = localStorage.getItem('tx-confirm-modal-remind');\n return value === '0';\n },\n setNotRemind: (notRemind: boolean) => {\n if (typeof window === 'undefined') return;\n if (notRemind) {\n localStorage.setItem('tx-confirm-modal-remind', '0');\n } else {\n localStorage.removeItem('tx-confirm-modal-remind');\n }\n },\n reset: () => {\n if (typeof window === 'undefined') return;\n localStorage.removeItem('tx-confirm-modal-remind');\n },\n};\n\nexport default txConfirm;\n", "import type { IEthereumProvider, JsonRpcRequest } from '@particle-network/aa';\nimport { EventName } from '../types/eventName';\nimport { EVMMethod } from '../types/evmMethod';\nimport events, { getPendingSignEventAccount } from '../utils/eventUtils';\nimport txConfirm from '../utils/txConfirmUtils';\n\nexport class WalletClientProvider implements IEthereumProvider {\n constructor(private provider: IEthereumProvider) {}\n\n on(event: string, listener: any): this {\n this.provider.on(event, listener);\n return this;\n }\n\n once(event: string, listener: any): this {\n this.provider.once(event, listener);\n return this;\n }\n\n off(event: string, listener: any): this {\n this.provider.off(event, listener);\n return this;\n }\n\n removeListener(event: string, listener: any): this {\n this.provider.removeListener(event, listener);\n return this;\n }\n\n async request(arg: Partial<JsonRpcRequest>): Promise<any> {\n const method = arg.method;\n if (!method) {\n throw new Error('Method not found.');\n }\n\n if (method === EVMMethod.personalSign || method.startsWith(EVMMethod.signTypedData)) {\n const showConfirmModal = !txConfirm.isNotRemind();\n if (showConfirmModal) {\n if (getPendingSignEventAccount() > 0) {\n throw new Error('Operation failed, there is a transaction being processed');\n }\n }\n if (!showConfirmModal) {\n return this.provider.request(arg as any);\n }\n }\n\n if (method === EVMMethod.personalSign) {\n console.log('personal_sign ---- ', arg);\n return new Promise<string>((resolve, reject) => {\n events.emit(EventName.personalSign, arg);\n events.once(EventName.personalSignResult, ({ result, error }) => {\n if (result) {\n resolve(result);\n } else {\n reject(error);\n }\n });\n });\n } else if (method.startsWith(EVMMethod.signTypedData)) {\n return new Promise<string>((resolve, reject) => {\n events.emit(EventName.signTypedData, arg);\n events.once(EventName.signTypedDataResult, ({ result, error }) => {\n if (result) {\n resolve(result);\n } else {\n reject(error);\n }\n });\n });\n }\n\n return this.provider.request(arg as any);\n }\n}\n", "\nconst digest = '906d42389ecad5c2ab92642c8e0775ea667c413b069684ce9d01199562f2d0be';\nconst classes = {\"loader\":\"_loader_g0am3_1\",\"rotate\":\"_rotate_g0am3_1\",\"prixClipFix\":\"_prixClipFix_g0am3_1\"};\nconst css = `._loader_g0am3_1{animation:_rotate_g0am3_1 1s linear infinite;border-radius:50%;height:20px;position:relative;width:20px}._loader_g0am3_1:before{animation:_prixClipFix_g0am3_1 2s linear infinite;border:2px solid #000;border-radius:50%;box-sizing:border-box;content:\"\";inset:0;position:absolute}@keyframes _rotate_g0am3_1{to{transform:rotate(1turn)}}@keyframes _prixClipFix_g0am3_1{0%{clip-path:polygon(50% 50%,0 0,0 0,0 0,0 0,0 0)}25%{clip-path:polygon(50% 50%,0 0,100% 0,100% 0,100% 0,100% 0)}50%{clip-path:polygon(50% 50%,0 0,100% 0,100% 100%,100% 100%,100% 100%)}75%{clip-path:polygon(50% 50%,0 0,100% 0,100% 100%,0 100%,0 100%)}to{clip-path:polygon(50% 50%,0 0,100% 0,100% 100%,0 100%,0 0)}}`;\n\n(function() {\n if (typeof document !== \"undefined\" && !document.getElementById(digest)) {\n var ele = document.createElement('style');\n ele.id = digest;\n ele.textContent = css;\n document.head.appendChild(ele);\n }\n})();\n\nexport default classes;\nexport { css, digest, classes };\n ", "import { type CSSProperties } from 'react';\nimport styles from './spinner.module.scss';\n\nconst Spinner = ({ className, style }: { className?: string; style?: CSSProperties | undefined }) => {\n return <span className={styles.loader + (className ? ` ${className}` : '')} style={style}></span>;\n};\n\nexport default Spinner;\n", "\nconst digest = '424d614dbc2763d7cad7ca35c00bd255c6ed55da308a1f3018594201a47127bf';\nconst classes = {\"btn\":\"_btn_ofd87_1\"};\nconst css = `._btn_ofd87_1{align-items:center;background:#fff;border-radius:8px;color:#000;display:flex;flex-direction:row;font-size:16px;gap:16px;justify-content:center;padding:6px 24px;position:relative}._btn_ofd87_1:hover{opacity:.85}._btn_ofd87_1:disabled{background:hsla(0,0%,100%,.2);color:hsla(0,0%,100%,.639);cursor:not-allowed;opacity:1}`;\n\n(function() {\n if (typeof document !== \"undefined\" && !document.getElementById(digest)) {\n var ele = document.createElement('style');\n ele.id = digest;\n ele.textContent = css;\n document.head.appendChild(ele);\n }\n})();\n\nexport default classes;\nexport { css, digest, classes };\n ", "import { type CSSProperties, type ReactNode } from 'react';\nimport Spinner from '../spinner';\nimport styles from './button.module.scss';\n\nconst Button = ({\n children,\n isLoading,\n isDisabled,\n onClick,\n className,\n style,\n}: {\n children: ReactNode;\n isLoading?: boolean;\n isDisabled?: boolean;\n onClick?: () => void;\n className?: string;\n style?: CSSProperties | undefined;\n}) => {\n return (\n <button\n className={styles.btn + (className ? ` ${className}` : '')}\n onClick={isLoading || isDisabled ? undefined : onClick}\n disabled={isDisabled}\n style={style}\n >\n {isLoading && !isDisabled && <Spinner />}\n {children}\n </button>\n );\n};\n\nexport default Button;\n", "import { useEffect, useMemo, useState, type CSSProperties, type MouseEventHandler, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\nimport { RemoveScroll } from 'react-remove-scroll';\nimport styles from './modal.module.scss';\n\ninterface ModalProp {\n open: boolean;\n onClose: () => void;\n children: ReactNode;\n isDismissable?: boolean;\n contentStyle?: CSSProperties | undefined;\n contentClassName?: string;\n}\n\nconst stopPropagation: MouseEventHandler<unknown> = (event) => event.stopPropagation();\n\nconst Modal = ({ open, onClose, children, isDismissable = true, contentStyle, contentClassName }: ModalProp) => {\n const handleBackdropClick = useMemo(() => (isDismissable ? onClose : undefined), [onClose, isDismissable]);\n\n useEffect(() => {\n if (isDismissable) {\n const handleEscape = (event: KeyboardEvent) => open && event.key === 'Escape' && onClose();\n\n document.addEventListener('keydown', handleEscape);\n\n return () => document.removeEventListener('keydown', handleEscape);\n }\n }, [open, onClose, isDismissable]);\n\n const [bodyScrollable, setBodyScrollable] = useState(true);\n useEffect(() => {\n setBodyScrollable(getComputedStyle(window.document.body).overflow !== 'hidden');\n }, []);\n\n return (\n <>\n {open\n ? createPortal(\n <RemoveScroll enabled={bodyScrollable}>\n <div className={styles.container} onClick={handleBackdropClick}>\n <div\n className={styles.modal + (contentClassName ? ` ${contentClassName}` : '')}\n style={contentStyle}\n onClick={stopPropagation}\n >\n {children}\n </div>\n </div>\n </RemoveScroll>,\n document.body\n )\n : null}\n </>\n );\n};\n\nexport default Modal;\n", "\nconst digest = '65eada90924218eba4e72a5f00291c3cb69387ecce1351e454cdefd066d4bcff';\nconst classes = {\"container\":\"_container_smzpm_1\",\"modal\":\"_modal_smzpm_18\"};\nconst css = `._container_smzpm_1{align-items:center;backdrop-filter:blur(12px);background:rgba(0,0,0,.502);bottom:0;color:#fff;display:flex;height:100%;justify-content:center;left:0;overflow:hidden;position:fixed;right:0;top:0;width:100%;z-index:100000}._container_smzpm_1 ._modal_smzpm_18{align-items:center;background-color:#171a1f;border-radius:16px;display:flex;flex-direction:column;font-size:14px;height:auto;margin:16px;max-height:80%;max-width:100%;overflow:auto;padding:24px;position:relative;width:380px}`;\n\n(function() {\n if (typeof document !== \"undefined\" && !document.getElementById(digest)) {\n var ele = document.createElement('style');\n ele.id = digest;\n ele.textContent = css;\n document.head.appendChild(ele);\n }\n})();\n\nexport default classes;\nexport { css, digest, classes };\n ", "\nconst digest = 'c7bbc091f1227154742a5bd0d55a3df29eb913eb0ad4cafc7ab236b574002f65';\nconst classes = {\"connectModal\":\"_connectModal_1kqtj_1\",\"title\":\"_title_1kqtj_4\",\"closeBtn\":\"_closeBtn_1kqtj_9\",\"backBtn\":\"_backBtn_1kqtj_15\",\"walletItem\":\"_walletItem_1kqtj_21\",\"walletIcon\":\"_walletIcon_1kqtj_33\",\"walletName\":\"_walletName_1kqtj_38\",\"connecting\":\"_connecting_1kqtj_43\",\"connectingIconContainer\":\"_connectingIconContainer_1kqtj_51\",\"retryContainer\":\"_retryContainer_1kqtj_54\",\"retryIcon\":\"_retryIcon_1kqtj_63\",\"connectingIcon\":\"_connectingIcon_1kqtj_51\",\"connection\":\"_connection_1kqtj_72\",\"acceptRequest\":\"_acceptRequest_1kqtj_76\",\"btnDownload\":\"_btnDownload_1kqtj_83\"};\nconst css = `._connectModal_1kqtj_1{gap:12px}._connectModal_1kqtj_1 ._title_1kqtj_4{font-size:18px;font-weight:700;margin-bottom:4px}._connectModal_1kqtj_1 ._closeBtn_1kqtj_9{cursor:pointer;position:absolute;right:16px;top:16px}._connectModal_1kqtj_1 ._backBtn_1kqtj_15{cursor:pointer;left:16px;position:absolute;top:16px}._connectModal_1kqtj_1 ._walletItem_1kqtj_21{border:1px solid #3a3a3a;border-radius:8px;box-sizing:border-box;cursor:pointer;display:flex;padding:8px;width:100%}._connectModal_1kqtj_1 ._walletItem_1kqtj_21:hover{background:hsla(0,0%,100%,.05)}._connectModal_1kqtj_1 ._walletItem_1kqtj_21 ._walletIcon_1kqtj_33{border-radius:4px;height:42px;width:42px}._connectModal_1kqtj_1 ._walletItem_1kqtj_21 ._walletName_1kqtj_38{flex-grow:1;line-height:42px;text-align:center}._connectModal_1kqtj_1 ._connecting_1kqtj_43{align-items:center;display:flex;flex-direction:column;height:204px;justify-content:center;width:100%}._connectModal_1kqtj_1 ._connecting_1kqtj_43 ._connectingIconContainer_1kqtj_51{position:relative}._connectModal_1kqtj_1 ._connecting_1kqtj_43 ._connectingIconContainer_1kqtj_51 ._retryContainer_1kqtj_54{background:#4b5563;border-radius:50%;bottom:-12px;cursor:pointer;padding:4px;position:absolute;right:-12px}._connectModal_1kqtj_1 ._connecting_1kqtj_43 ._connectingIconContainer_1kqtj_51 ._retryContainer_1kqtj_54 ._retryIcon_1kqtj_63{height:24px;width:24px}._connectModal_1kqtj_1 ._connecting_1kqtj_43 ._connectingIcon_1kqtj_51{border-radius:4px;height:60px;width:60px}._connectModal_1kqtj_1 ._connecting_1kqtj_43 ._connection_1kqtj_72{font-size:18px;margin-top:20px}._connectModal_1kqtj_1 ._connecting_1kqtj_43 ._acceptRequest_1kqtj_76{color:hsla(0,0%,100%,.4);font-size:14px;margin-top:6px;text-align:center;white-space:pre-wrap}._connectModal_1kqtj_1 ._connecting_1kqtj_43 ._btnDownload_1kqtj_83{margin-top:20px}`;\n\n(function() {\n if (typeof document !== \"undefined\" && !document.getElementById(digest)) {\n var ele = document.createElement('style');\n ele.id = digest;\n ele.textContent = css;\n document.head.appendChild(ele);\n }\n})();\n\nexport default classes;\nexport { css, digest, classes };\n ", "import type { RequestArguments, UserOpBundle } from '@particle-network/aa';\nimport { chains } from '@particle-network/chains';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport { formatEther, hexToString, type Hex } from 'viem';\nimport { useConnectProvider } from '../../context';\nimport { useETHProvider } from '../../hooks';\nimport { useAccountContract } from '../../hooks/useAccountContract';\nimport checkBox from '../../icons/check_box.svg';\nimport checkBoxBlank from '../../icons/check_box_blank.svg';\nimport close from '../../icons/close.svg';\nimport copy from '../../icons/copy.svg';\nimport { type EVMDeserializeTransactionResult } from '../../types/deserializeTx';\nimport { EventName } from '../../types/eventName';\nimport { EVMMethod } from '../../types/evmMethod';\nimport { shortString } from '../../utils';\nimport { caculateNativeFee } from '../../utils/ethereumUtils';\nimport events from '../../utils/eventUtils';\nimport txConfirm from '../../utils/txConfirmUtils';\nimport Button from '../button';\nimport CopyText from '../copyText';\nimport Modal from '../modal';\nimport TransactionDetails from '../transactionDetails';\nimport styles from './sign.module.scss';\n\nconst SignModal = ({ open, onClose, onOpen }: { open: boolean; onClose: () => void; onOpen: () => void }) => {\n const [userOpBundle, setUserOpBundle] = useState<UserOpBundle>();\n const [notRemindChecked, setNotRemindChecked] = useState<boolean>(false);\n const [loading, setLoading] = useState<boolean>(false);\n const [deserializeLoading, setDeserializeLoading] = useState<boolean>(false);\n const [deserializeResult, setDeserializeResult] = useState<EVMDeserializeTransactionResult[] | undefined>();\n const [disabled, setDisabled] = useState<boolean>(false);\n const [showNotRemind, setShowNotRemind] = useState<boolean>(true);\n const [nativeBalance, setNativeBalance] = useState<bigint>();\n const { accountContract } = useAccountContract();\n\n // personal_sign or eth_signTypedData\n const [requestArguments, setRequestArguments] = useState<RequestArguments>();\n\n const { chainId, publicClient, evmAccount, provider } = useETHProvider();\n const { smartAccount } = useConnectProvider();\n\n useEffect(() => {\n if (!open) {\n setDeserializeResult(undefined);\n setUserOpBundle(undefined);\n setRequestArguments(undefined);\n setLoading(false);\n setDisabled(false);\n setDeserializeLoading(false);\n setNativeBalance(undefined);\n }\n }, [open]);\n\n useEffect(() => {\n if (open) {\n const notRemind = txConfirm.isNotRemind();\n setShowNotRemind(!notRemind);\n if (!notRemind) {\n setNotRemindChecked(false);\n }\n }\n }, [open]);\n\n const chainInfo = useMemo(() => {\n if (chainId) {\n return chains.getEVMChainInfoById(chainId);\n }\n }, [chainId]);\n\n useEffect(() => {\n const onSendUserOp = (opBundle: UserOpBundle) => {\n setUserOpBundle(opBundle);\n onOpen();\n };\n const onPersonalSign = (arg: RequestArguments) => {\n setRequestArguments(arg);\n onOpen();\n };\n const onSignTypedData = (arg: RequestArguments) => {\n setRequestArguments(arg);\n onOpen();\n };\n events.on(EventName.sendUserOp, onSendUserOp);\n events.on(EventName.personalSign, onPersonalSign);\n events.on(EventName.signTypedData, onSignTypedData);\n return () => {\n events.off(EventName.sendUserOp, onSendUserOp);\n events.off(EventName.personalSign, onPersonalSign);\n events.off(EventName.signTypedData, onSignTypedData);\n };\n }, [onOpen, setUserOpBundle]);\n\n const deserializeUserOp = useCallback(async () => {\n if (userOpBundle && smartAccount) {\n const addresses = await smartAccount.provider.request({ method: 'eth_accounts' });\n const owner = addresses[0];\n const result = await smartAccount.sendRpc({\n method: 'particle_aa_deserializeUserOp',\n params: [\n {\n name: accountContract.name,\n version: accountContract.version,\n ownerAddress: owner,\n },\n userOpBundle.userOp,\n ],\n });\n return result;\n }\n }, [userOpBundle, smartAccount, accountContract]);\n\n useEffect(() => {\n if (userOpBundle && open) {\n console.log('deserializeUserOp start');\n setDeserializeLoading(true);\n deserializeUserOp()\n .then((result) => {\n console.log('\uD83D\uDE80 ~ deserializeUserOp ~ result:', result);\n setDeserializeResult(result as any);\n })\n .catch((error) => {\n console.log('\uD83D\uDE80 ~ deserializeUserOp ~ error:', error);\n events.emit(EventName.sendUserOpResult, {\n error,\n });\n onClose();\n });\n }\n }, [deserializeUserOp, userOpBundle, open, onClose]);\n\n useEffect(() => {\n if (open && publicClient && evmAccount && userOpBundle) {\n publicClient\n .getBalance({ address: evmAccount as Hex })\n .then((result: any) => setNativeBalance(result))\n .catch((error: any) => {\n console.log('\uD83D\uDE80 ~ getBalance ~ error:', error);\n events.emit(EventName.sendUserOpResult, {\n error,\n });\n onClose();\n });\n }\n }, [open, publicClient, evmAccount, userOpBundle, onClose]);\n\n useEffect(() => {\n if (nativeBalance != null && deserializeResult != null) {\n setDeserializeLoading(false);\n }\n }, [nativeBalance, deserializeResult]);\n\n const toggleNotRemind = () => {\n setNotRemindChecked(!notRemindChecked);\n txConfirm.setNotRemind(!notRemindChecked);\n };\n\n const gasFee = useMemo(() => {\n if (userOpBundle?.userOp) {\n return caculateNativeFee(userOpBundle?.userOp);\n }\n return BigInt(0);\n }, [userOpBundle]);\n\n const closeModal = () => {\n let event;\n if (userOpBundle) {\n event = EventName.sendUserOpResult;\n } else if (requestArguments?.method === EVMMethod.personalSign) {\n event = EventName.personalSignResult;\n } else if (requestArguments?.method?.startsWith(EVMMethod.signTypedData)) {\n event = EventName.signTypedDataResult;\n }\n\n if (event) {\n events.emit(event, {\n error: {\n code: 4001,\n message: 'The user rejected the request.',\n },\n });\n }\n\n onClose();\n };\n\n const confirmTx = useCallback(async () => {\n if (smartAccount && provider) {\n setLoading(true);\n if (userOpBundle) {\n try {\n const hash = await smartAccount.sendUserOperation(userOpBundle);\n events.emit(EventName.sendUserOpResult, { result: hash });\n } catch (error) {\n events.emit(EventName.sendUserOpResult, {\n error,\n });\n } finally {\n setLoading(false);\n }\n } else if (requestArguments) {\n try {\n const hash = await provider.request(requestArguments);\n events.emit(\n requestArguments.method == EVMMethod.personalSign\n ? EventName.personalSignResult\n : EventName.signTypedDataResult,\n { result: hash }\n );\n } catch (error) {\n events.emit(\n requestArguments.method == EVMMethod.personalSign\n ? EventName.personalSignResult\n : EventName.signTypedDataResult,\n {\n error,\n }\n );\n } finally {\n setLoading(false);\n }\n }\n\n onClose();\n }\n }, [smartAccount, provider, requestArguments, userOpBundle, onClose]);\n\n useEffect(() => {\n if (userOpBundle && nativeBalance != null && deserializeResult) {\n const nativeChange = deserializeResult\n .filter(\n (item) =>\n item.estimatedChanges.natives?.[0]?.nativeChange &&\n item.estimatedChanges.natives[0].nativeChange.startsWith('-')\n )\n .map((item) => BigInt(item.estimatedChanges?.natives?.[0]?.nativeChange?.replace('-', '') || 0))\n .reduce((accumulator, currentValue) => accumulator + currentValue, BigInt(0));\n if (userOpBundle.userOp.paymasterAndData.length > 2) {\n // \u8BA1\u7B97\u4F59\u989D\uFF0C\u9700\u5927\u4E8E\u7B49\u4E8EnativeChange\n setDisabled(nativeBalance < nativeChange);\n } else {\n // \u8BA1\u7B97\u4F59\u989D\uFF0C\u9700\u5927\u4E8E\u7B49\u4E8EgasFee+nativeChange\n setDisabled(nativeBalance < gasFee + nativeChange);\n }\n }\n }, [userOpBundle, gasFee, nativeBalance, deserializeResult]);\n\n const unsignedMessage = useMemo(() => {\n if (!requestArguments) {\n return undefined;\n }\n\n if (requestArguments.method === EVMMethod.personalSign) {\n const message = requestArguments.params?.[0] || '0x';\n return hexToString(message);\n } else {\n const typedData = requestArguments.params?.[1];\n const obj = typeof typedData === 'string' ? JSON.parse(typedData) : typedData;\n return JSON.stringify(obj, null, 2);\n }\n }, [requestArguments]);\n\n return (\n <Modal open={open} onClose={onClose} isDismissable={false} contentClassName={styles.modalContent}>\n <>\n <img className={styles.closeBtn} src={close} onClick={closeModal}></img>\n\n {requestArguments && (\n <div className={styles.signTitle}>\n {requestArguments.method == EVMMethod.personalSign ? 'Sign Message' : 'Sign Typed Data'}\n </div>\n )}\n\n <div className={styles.chainInfo}>\n <img src={chainInfo?.icon}></img>\n {chainInfo?.fullname.replace('Mainnet', '')}\n </div>\n\n <div className={styles.addressContainer}>\n <CopyText value={evmAccount} style={{ textDecorationLine: 'none' }}>\n <div className={styles.addressInfo}>\n {shortString(evmAccount)}\n <img src={copy}></img>\n </div>\n </CopyText>\n </div>\n\n <div className={styles.detailsContent + (deserializeResult || requestArguments ? ` ${styles.fill}` : '')}>\n {deserializeResult &&\n deserializeResult.map((details, index) => (\n <TransactionDetails key={`${details.type}-${index}`} details={details} />\n ))}\n\n {unsignedMessage && <div className={styles.unsignedMessage}>{unsignedMessage}</div>}\n </div>\n\n {gasFee && (\n <div className={styles.estimatedGas}>{`Estimated gas fee: ${formatEther(gasFee)} ${chainInfo?.nativeCurrency\n .symbol}`}</div>\n )}\n\n <Button\n onClick={confirmTx}\n className={styles.signBtn}\n isLoading={loading || deserializeLoading}\n isDisabled={disabled}\n >\n {deserializeLoading ? 'LOADING' : disabled ? 'INSUFFICIENT FEE' : 'CONFIRM'}\n </Button>\n\n {showNotRemind && (\n <div className={styles.notRemind} onClick={toggleNotRemind}>\n <img src={notRemindChecked ? checkBox : checkBoxBlank}></img>\n Do not remind me again\n </div>\n )}\n </>\n </Modal>\n );\n};\n\nexport default SignModal;\n", "import type { AAOptions } from '@particle-network/aa';\n\nexport function shortString(str: any): string {\n if (Array.isArray(str)) {\n str = '[' + str.toString() + ']';\n }\n if (str) {\n if (typeof str.toString === 'function') {\n str = str.toString();\n }\n if (str.length <= 10) {\n return str;\n }\n return `${str.slice(0, 5)}...${str.slice(str.length - 5, str.length)}`;\n }\n return '';\n}\n\n/**\n * \u590D\u5236\u5230\u526A\u8D34\u677F\n * @param {string} text\n * @returns {Promise<void>}\n */\nexport async function copyToClipboard(text: string) {\n const clipboardCopy = async () => {\n if (navigator.clipboard) {\n return navigator.clipboard.writeText(text);\n } else {\n const textarea = document.createElement('textarea');\n textarea.value = text;\n textarea.setAttribute('readonly', '');\n textarea.style.position = 'absolute';\n textarea.style.left = '-9999px';\n document.body.appendChild(textarea);\n\n textarea.select();\n const result = document.execCommand('copy');\n\n document.body.removeChild(textarea);\n\n if (!result) {\n throw new Error('Copy to clipboard failed');\n }\n }\n };\n\n return new Promise((resolve, reject) => {\n clipboardCopy().then(resolve).catch(reject);\n });\n}\n\nexport const defaultTokenIcon =\n 'https://static.particle.network/token-list/defaultToken/default.png';\n\nexport const ipfsToSrc = (ipfs: string) => {\n if (!ipfs || !ipfs.startsWith('ipfs://')) {\n return ipfs || '';\n }\n\n return `https://ipfs.particle.network/${encodeURI(ipfs.slice(7))}`;\n};\n\nexport const checkBTCVersion = (\n accountContracts: AAOptions['accountContracts'],\n accountContractKey: string,\n version: string,\n) => {\n if (!accountContracts[accountContractKey]) {\n return false;\n }\n return accountContracts[accountContractKey].some((item) => item.version === version);\n};\n\nexport const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));\n", "import { bytesToHex, publicToAddress, toBytes, toChecksumAddress, toRpcSig } from '@ethereumjs/util';\nimport type { SmartAccount, UserOp } from '@particle-network/aa';\nimport bitcore from 'bitcore-lib';\nimport type { AccountInfo } from '../types/accountInfo';\n\nexport const pubKeyToEVMAddress = (pubKey: string) => {\n const address = toChecksumAddress(bytesToHex(publicToAddress(toBytes(`0x${pubKey}`), true)));\n return address;\n};\n\nexport const convertSignature = (signature: string) => {\n const sig = (bitcore.crypto.Signature as any).fromCompact(Buffer.from(signature, 'base64'));\n const v = BigInt(sig.i + 27);\n const evmSig = toRpcSig(v, sig.r.toBuffer(), sig.s.toBuffer());\n return evmSig;\n};\n\nexport function caculateNativeFee(userOp: UserOp): bigint {\n return (\n (BigInt(userOp.callGasLimit) + BigInt(userOp.verificationGasLimit) + BigInt(userOp.preVerificationGas)) *\n BigInt(userOp.maxFeePerGas)\n );\n}\n\nexport const getBTCAAAddress = async (\n smartAccount: SmartAccount,\n btcAddress: string,\n name: string,\n version: string\n): Promise<string> => {\n const addresses = await smartAccount.provider.request({ method: 'eth_accounts' });\n const owner = addresses[0];\n const localKey = `particle_${name}_${version}_${owner}`;\n if (typeof window !== 'undefined' && localStorage) {\n const localAA = localStorage.getItem(localKey);\n if (localAA) {\n return localAA;\n }\n }\n\n const btcPublicKey = await (smartAccount.provider as any).getPublicKey();\n const accountInfo = await smartAccount.sendRpc({\n method: 'particle_aa_getBTCAccount',\n params: [\n {\n name: name,\n version: version,\n btcPublicKey,\n btcAddress,\n },\n ],\n });\n const address = (accountInfo as any)?.[0]?.smartAccountAddress;\n\n if (typeof window !== 'undefined' && localStorage && address) {\n localStorage.setItem(localKey, address);\n }\n return address;\n};\n\nexport const getBTCAccountInfo = async (\n smartAccount: SmartAccount,\n btcAddress: string,\n name: string,\n version: string\n) => {\n const btcPublicKey = await (smartAccount.provider as any).getPublicKey();\n const [accountInfo] = await smartAccount.sendRpc<AccountInfo[]>({\n method: 'particle_aa_getBTCAccount',\n params: [\n {\n name: name,\n version: version,\n btcPublicKey,\n btcAddress,\n },\n ],\n });\n\n const address = accountInfo.smartAccountAddress;\n const addresses = await smartAccount.provider.request({ method: 'eth_accounts' });\n const owner = addresses[0];\n const localKey = `particle_${name}_${version}_${owner}`;\n if (typeof window !== 'undefined' && localStorage && address) {\n localStorage.setItem(localKey, address);\n }\n\n return accountInfo;\n};\n", "import { useState, type CSSProperties } from 'react';\nimport { copyToClipboard } from '../../utils';\nimport styles from './copyText.module.scss';\n\nexport interface CopyTextProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n value?: string;\n className?: string;\n style?: CSSProperties | undefined;\n}\n\nexport default function CopyText({ children, value, className, style }: CopyTextProps) {\n const [copied, setCopied] = useState<boolean>();\n\n const handleClick = async () => {\n if (copied) {\n return;\n }\n\n try {\n if (value) {\n await copyToClipboard(value);\n } else if (typeof children === 'string' || typeof children === 'number' || typeof children === 'boolean') {\n await copyToClipboard(children.toString());\n } else {\n throw new Error('please set copy value');\n }\n setCopied(true);\n setTimeout(() => setCopied(false), 1000);\n } catch (error) {\n //ignore\n }\n };\n\n return (\n <div\n className={styles.copyText + (className ? ` ${className}` : '') + (copied ? ` ${styles.copied}` : '')}\n onClick={handleClick}\n style={style}\n >\n {copied ? 'Copied' : children}\n </div>\n );\n}\n", "\nconst digest = 'd6fbb5df7ed6ec51d41f665ca768306181bb1e7d7c1cef8eed9bd4230368d7bb';\nconst classes = {\"copyText\":\"_copyText_smolu_1\",\"copied\":\"_copied_smolu_9\"};\nconst css = `._copyText_smolu_1{cursor:pointer;text-decoration-line:underline}._copyText_smolu_1:hover{opacity:.75}._copied_smolu_9{color:#a855f7;cursor:none;text-decoration-line:none}._copied_smolu_9:hover{opacity:1}`;\n\n(function() {\n if (typeof document !== \"undefined\" && !document.getElementById(digest)) {\n var ele = document.createElement('style');\n ele.id = digest;\n ele.textContent = css;\n document.head.appendChild(ele);\n }\n})();\n\nexport default classes;\nexport { css, digest, classes };\n ", "import { chains } from '@particle-network/chains';\nimport { useCallback, useMemo } from 'react';\nimport { formatUnits } from 'viem';\nimport { useETHProvider } from '../../hooks';\nimport unverified from '../../icons/unverified.svg';\nimport verified from '../../icons/verified.svg';\nimport {\n TransactionSmartType,\n type EVMDeserializeTransactionResult,\n type EVMTokenChange,\n} from '../../types/deserializeTx';\nimport { defaultTokenIcon, ipfsToSrc, shortString } from '../../utils';\nimport CopyText from '../copyText';\nimport Tooltip from '../tooltip';\nimport styles from './transactionDetails.module.scss';\n\nconst TransactionDetails = ({ details }: { details: EVMDeserializeTransactionResult }) => {\n const { chainId } = useETHProvider();\n\n const chainInfo = useMemo(() => {\n if (chainId) {\n return chains.getEVMChainInfoById(chainId);\n }\n }, [chainId]);\n\n const titleContent = useMemo(() => {\n switch (details.type) {\n case TransactionSmartType.NATIVE_TRANSFER:\n return `Send ${chainInfo?.nativeCurrency.symbol}`;\n case TransactionSmartType.ERC20_TRANSFER:\n return `Send ${details.estimatedChanges.tokens[0]?.symbol}`;\n case TransactionSmartType.ERC20_APPROVE:\n return 'Approve Spending';\n case TransactionSmartType.ERC721_TRANFER:\n return 'Send NFT';\n case TransactionSmartType.ERC1155_TRANFER:\n return 'Send NFT';\n default:\n return 'Transaction Details';\n }\n }, [details, chainInfo]);\n\n const nftContractType = useMemo(() => {\n if (details.type === TransactionSmartType.ERC721_TRANFER) {\n return 'ERC721';\n } else if (details.type === TransactionSmartType.ERC1155_TRANFER) {\n return 'ERC1155';\n }\n }, [details]);\n\n const nativeIcon = useMemo(() => {\n if (chainInfo) {\n if (chainInfo.nativeCurrency.symbol === 'ETH') {\n return 'https://static.particle.network/token-list/ethereum/native.png';\n } else {\n return chainInfo.nativeIcon || chainInfo.icon;\n }\n }\n return defaultTokenIcon;\n }, [chainInfo]);\n\n // to address\n const to = useMemo(() => {\n const params = details.data?.function?.params;\n if (details.type == TransactionSmartType.ERC20_TRANSFER) {\n return params ? (params[params.length === 3 ? 1 : 0].value as string) : '';\n } else if (details.type == TransactionSmartType.ERC20_APPROVE) {\n return params ? (params[0].value as string) : '';\n } else if (details.type == TransactionSmartType.NATIVE_TRANSFER) {\n return details.data.to;\n } else if (\n details.type == TransactionSmartType.ERC721_TRANFER ||\n details.type == TransactionSmartType.ERC1155_TRANFER\n ) {\n return params ? (params[1].value as string) : '';\n } else {\n return details.data.to;\n }\n }, [details]);\n\n const balanceChangeTextColor = useCallback((value: string | number) => {\n if (BigInt(value) > 0) {\n return '#4ade80';\n } else if (BigInt(value) < 0) {\n return '#ef4444';\n } else {\n return 'white';\n }\n }, []);\n\n const functionContent = useMemo(() => {\n if (details.type !== TransactionSmartType.NATIVE_TRANSFER && details.data.function) {\n const params = details.data.function.params.map((item) => item.name);\n return `${details.data.function.name}(${params.join(', ')})`;\n }\n }, [details]);\n\n const approveTokenAmount = useMemo(() => {\n if (details.type === TransactionSmartType.ERC20_APPROVE) {\n const amount = details.data?.function?.params?.[1]?.value as string;\n return BigInt(amount || 0);\n }\n return BigInt(0);\n }, [details]);\n\n const tokenAmountChange = useCallback(\n (tokenItem: EVMTokenChange) => {\n const result = formatUnits(\n details.type === TransactionSmartType.ERC20_APPROVE ? approveTokenAmount : BigInt(tokenItem.amountChange),\n tokenItem.decimals\n );\n\n if (details.type !== TransactionSmartType.ERC20_APPROVE && BigInt(tokenItem.amountChange) > BigInt(0)) {\n return `+${result}`;\n }\n\n return result;\n },\n [approveTokenAmount, details]\n );\n\n const showContactAddress = useMemo(() => {\n return (\n details.type === TransactionSmartType.ERC20_TRANSFER ||\n details.type === TransactionSmartType.ERC20_APPROVE ||\n details.type === TransactionSmartType.ERC721_TRANFER ||\n details.type === TransactionSmartType.ERC1155_TRANFER\n );\n }, [details]);\n\n return (\n <div className={styles.detailsCard}>\n <div className={styles.title}>{titleContent}</div>\n {nftContractType && <div className={styles.nftContract}>{nftContractType}</div>}\n\n {details.estimatedChanges.natives.map((nativeItem) => {\n return (\n <div key={nativeItem.address} className={styles.row}>\n <img className={styles.tokenIcon} src={nativeIcon}></img>\n <div className={styles.balanceChange} style={{ color: balanceChangeTextColor(nativeItem.nativeChange) }}>\n {BigInt(nativeItem.nativeChange) > 0 ? '+' : undefined}\n {formatUnits(BigInt(nativeItem.nativeChange), chainInfo?.nativeCurrency.decimals || 18)}\n </div>\n <div className={styles.tokenSymbol}>{chainInfo?.nativeCurrency.symbol}</div>\n </div>\n );\n })}\n\n {details.estimatedChanges.tokens.map((tokenItem) => {\n return (\n <div key={tokenItem.address} className={styles.row}>\n <img className={styles.tokenIcon} src={tokenItem.image || defaultTokenIcon}></img>\n <div className={styles.balanceChange}>\n <span style={{ color: balanceChangeTextColor(tokenItem.amountChange) }}>\n {tokenAmountChange(tokenItem)}\n </span>\n {` ${tokenItem.symbol}`}\n </div>\n </div>\n );\n })}\n\n {details.estimatedChanges.nfts.map((nftItem) => {\n return (\n <div key={nftItem.address} className={styles.row}>\n <div style={{ fontSize: 16 }}>\n <img className={styles.nftIcon} src={ipfsToSrc(nftItem.image || defaultTokenIcon)}></img>\n {nftItem.name || `NFT#${nftItem.tokenId}`}\n </div>\n <div className={styles.balanceChange} style={{ color: balanceChangeTextColor(nftItem.amountChange) }}>\n {nftItem.amountChange}\n </div>\n </div>\n );\n })}\n\n {to && (\n <div className={styles.row}>\n <div>To</div>\n <div className={styles.toContract}>\n {details.toVerified != null && !showContactAddress && (\n <Tooltip content={details.toVerified ? 'Verified Contract' : 'Unverified Contract'}>\n <img src={details.toVerified ? verified : unverified}></img>\n </Tooltip>\n )}\n <CopyText value={to}>{shortString(to)}</CopyText>\n </div>\n </div>\n )}\n\n {showContactAddress && (\n <div className={styles.row}>\n <div>Contract</div>\n <div className={styles.toContract}>\n {details.toVerified != null && (\n <Tooltip content={details.toVerified ? 'Verified Contract' : 'Unverified Contract'}>\n <img src={details.toVerified ? verified : unverified}></img>\n </Tooltip>\n )}\n <CopyText value={details.data.to}>{shortString(details.data.to)}</CopyText>\n </div>\n </div>\n )}\n\n <div className={styles.row}>\n <div>Hex Data</div>\n <CopyText value={details.data.data}>{shortString(details.data.data)}</CopyText>\n </div>\n\n {functionContent && (\n <div className={styles.row}>\n <div>Function</div>\n <div className={styles.right}>{functionContent}</div>\n </div>\n )}\n </div>\n );\n};\n\nexport default TransactionDetails;\n", "\nconst digest = 'ee15dc27fcfd209601159e7f0e0063ff4e7a886b7b892c1600a911372b82a0b1';\nconst classes = {\"tipContainer\":\"_tipContainer_ufud7_1\",\"tipContent\":\"_tipContent_ufud7_5\"};\nconst css = `._tipContainer_ufud7_1{overflow:visible;position:relative}._tipContainer_ufud7_1 ._tipContent_ufud7_5{background:#3f3f46;border-radius:8px;bottom:100%;color:#fff;font-size:11px;left:-100%;opacity:0;padding:3px 6px;position:absolute;transition:opacity .5s;visibility:hidden;white-space:nowrap;z-index:1}._tipContainer_ufud7_1:hover ._tipContent_ufud7_5{opacity:1;visibility:visible}`;\n\n(function() {\n if (typeof document !== \"undefined\" && !document.getElementById(digest)) {\n var ele = document.createElement('style');\n ele.id = digest;\n ele.textContent = css;\n document.head.appendChild(ele);\n }\n})();\n\nexport default classes;\nexport { css, digest, classes };\n ", "import { type ReactNode } from 'react';\nimport styles from './tooltip.module.scss';\n\nconst Tooltip = ({ children, content, className }: { children: ReactNode; content: string; className?: string }) => {\n return (\n <div className={styles.tipContainer}>\n {children}\n <div className={styles.tipContent + (className ? ` ${className}` : '')}>{content}</div>\n </div>\n );\n};\n\nexport default Tooltip;\n", "\nconst digest = 'a81c744751497ed4b401c08b9e5aeef1991aeb86f2cbba3ee57c1926c0502f1a';\nconst classes = {\"detailsCard\":\"_detailsCard_ml2p9_1\",\"title\":\"_title_ml2p9_13\",\"nftContract\":\"_nftContract_ml2p9_19\",\"row\":\"_row_ml2p9_26\",\"tokenIcon\":\"_tokenIcon_ml2p9_35\",\"nftIcon\":\"_nftIcon_ml2p9_41\",\"balanceChange\":\"_balanceChange_ml2p9_49\",\"tokenSymbol\":\"_tokenSymbol_ml2p9_56\",\"toContract\":\"_toContract_ml2p9_61\",\"right\":\"_right_ml2p9_71\"};\nconst css = `._detailsCard_ml2p9_1{background:#232529;border:1px solid #252525;border-radius:8px;color:#fff;margin-top:16px;overflow-x:hidden;padding:10px;position:relative;width:100%}._detailsCard_ml2p9_1 ._title_ml2p9_13{font-size:16px;font-weight:600;margin-bottom:12px;text-align:left}._detailsCard_ml2p9_1 ._nftContract_ml2p9_19{color:#a855f7;font-size:16px;position:absolute;right:8px;top:8px}._detailsCard_ml2p9_1 ._row_ml2p9_26{align-items:center;display:flex;flex-direction:row;font-size:14px;gap:8px;justify-content:space-between;margin-top:6px}._detailsCard_ml2p9_1 ._row_ml2p9_26 ._tokenIcon_ml2p9_35{border-radius:50%;height:32px;margin:10px 0;width:32px}._detailsCard_ml2p9_1 ._row_ml2p9_26 ._nftIcon_ml2p9_41{border-radius:2px;display:inline;height:32px;margin:10px 8px 10px 0;width:32px}._detailsCard_ml2p9_1 ._row_ml2p9_26 ._balanceChange_ml2p9_49{flex-grow:2;font-size:16px;font-weight:500;text-align:end;word-break:break-word}._detailsCard_ml2p9_1 ._row_ml2p9_26 ._tokenSymbol_ml2p9_56{font-size:16px;font-weight:500;text-align:end}._detailsCard_ml2p9_1 ._row_ml2p9_26 ._toContract_ml2p9_61{align-items:center;display:flex;gap:8px}._detailsCard_ml2p9_1 ._row_ml2p9_26 ._toContract_ml2p9_61 img{display:inline;height:18px;width:18px}._detailsCard_ml2p9_1 ._row_ml2p9_26 ._right_ml2p9_71{text-align:end}`;\n\n(function() {\n if (typeof document !== \"undefined\" && !document.getElementById(digest)) {\n var ele = document.createElement('style');\n ele.id = digest;\n ele.textContent = css;\n document.head.appendChild(ele);\n }\n})();\n\nexport default classes;\nexport { css, digest, classes };\n ", "\nconst digest = '3ab1a455562ae7e24c2ac49572897e615b9e9275066fd0d64f0cf24844521bab';\nconst classes = {\"modalContent\":\"_modalContent_aoysu_1\",\"closeBtn\":\"_closeBtn_aoysu_5\",\"signTitle\":\"_signTitle_aoysu_11\",\"chainInfo\":\"_chainInfo_aoysu_16\",\"addressContainer\":\"_addressContainer_aoysu_29\",\"addressInfo\":\"_addressInfo_aoysu_34\",\"detailsContent\":\"_detailsContent_aoysu_49\",\"fill\":\"_fill_aoysu_58\",\"unsignedMessage\":\"_unsignedMessage_aoysu_61\",\"estimatedGas\":\"_estimatedGas_aoysu_76\",\"signBtn\":\"_signBtn_aoysu_81\",\"notRemind\":\"_notRemind_aoysu_85\"};\nconst css = `._modalContent_aoysu_1{color:#fff;text-align:center}._modalContent_aoysu_1 ._closeBtn_aoysu_5{cursor:pointer;position:absolute;right:16px;top:16px}._modalContent_aoysu_1 ._signTitle_aoysu_11{font-size:20px;font-weight:600;margin-bottom:10px}._modalContent_aoysu_1 ._chainInfo_aoysu_16{align-items:center;display:flex;flex-direction:row;font-size:12px;gap:8px;justify-content:center;margin-bottom:8px}._modalContent_aoysu_1 ._chainInfo_aoysu_16 img{height:18px;width:18px}._modalContent_aoysu_1 ._addressContainer_aoysu_29{height:28px;margin-bottom:16px;margin-top:8px}._modalContent_aoysu_1 ._addressContainer_aoysu_29 ._addressInfo_aoysu_34{align-items:center;background:rgba(58,58,58,.635);border-radius:20px;display:flex;flex-direction:row;font-size:12px;gap:4px;justify-content:center;padding:4px 8px}._modalContent_aoysu_1 ._addressContainer_aoysu_29 ._addressInfo_aoysu_34 img{height:18px;width:18px}._modalContent_aoysu_1 ._detailsContent_aoysu_49{max-height:0;overflow-y:auto;transition:max-height .3s linear;width:100%}._modalContent_aoysu_1 ._detailsContent_aoysu_49::-webkit-scrollbar{display:none}._modalContent_aoysu_1 ._detailsContent_aoysu_49._fill_aoysu_58{max-height:500px}._modalContent_aoysu_1 ._detailsContent_aoysu_49 ._unsignedMessage_aoysu_61{background:#232529;border:1px solid #252525;border-radius:8px;box-sizing:border-box;color:#fff;font-size:14px;padding:8px;width:100%;word-wrap:break-word;color:hsla(0,0%,100%,.631);text-align:left;white-space:pre-wrap}._modalContent_aoysu_1 ._estimatedGas_aoysu_76{color:hsla(0,0%,100%,.631);font-size:12px;margin-top:24px}._modalContent_aoysu_1 ._signBtn_aoysu_81{margin-top:24px;min-width:200px}._modalContent_aoysu_1 ._notRemind_aoysu_85{align-items:center;color:hsla(0,0%,100%,.631);cursor:pointer;display:inline-flex;font-size:12px;gap:4px;margin-top:16px}._modalContent_aoysu_1 ._notRemind_aoysu_85:hover{opacity:.85}`;\n\n(function() {\n if (typeof document !== \"undefined\" && !document.getElementById(digest)) {\n var ele = document.createElement('style');\n ele.id = digest;\n ele.textContent = css;\n document.head.appendChild(ele);\n }\n})();\n\nexport default classes;\nexport { css, digest, classes };\n ", "import { intToHex } from '@ethereumjs/util';\nimport type { RequestArguments } from '@particle-network/aa';\nimport { chains } from '@particle-network/chains';\nimport { EventEmitter } from 'events';\nimport {\n InvalidParamsRpcError,\n SwitchChainError,\n UnsupportedProviderMethodError,\n createPublicClient,\n hashMessage,\n hashTypedData,\n http,\n type PublicClient,\n} from 'viem';\nimport { EVMMethod } from '../types/evmMethod';\nimport { convertSignature, pubKeyToEVMAddress } from '../utils/ethereumUtils';\n\nexport class AASignerProvider {\n private events: EventEmitter;\n chainId = 1;\n publicClient: PublicClient;\n constructor(\n public supportChainIds: number[],\n public projectId: string,\n public clientKey: string,\n public rpcUrls: Record<number, string> | undefined\n ) {\n this.events = new EventEmitter();\n this.events.setMaxListeners(100);\n\n if (typeof window !== 'undefined') {\n const localChainId = localStorage.getItem('connect-evm-chain-id');\n if (localChainId && supportChainIds.includes(Number(localChainId))) {\n this.chainId = Number(localChainId);\n } else {\n const chainId = supportChainIds[0];\n if (chainId) {\n localStorage.setItem('connect-evm-chain-id', chainId.toString());\n this.chainId = chainId;\n }\n }\n }\n\n this.publicClient = this.getPublicClient();\n }\n\n async request(arg: RequestArguments) {\n if (\n arg.method === 'eth_sendTransaction' ||\n arg.method === 'wallet_addEthereumChain' ||\n arg.method === 'wallet_watchAsset' ||\n arg.method === 'eth_sign'\n ) {\n throw new UnsupportedProviderMethodError(new Error('The Provider does not support the requested method.'));\n }\n\n if (arg.method === 'eth_accounts' || arg.method === 'eth_requestAccounts') {\n const pubKey = await this.getPublicKey();\n const address = pubKeyToEVMAddress(pubKey);\n return [address];\n } else if (arg.method === 'eth_chainId') {\n return `0x${this.chainId.toString(16)}`;\n } else if (arg.method === EVMMethod.personalSign) {\n let message = arg.params?.[0];\n console.log('personal_sign message:', message);\n if (message.length !== 66) {\n const hash = hashMessage({ raw: message });\n console.log('personal_sign hash:', hash);\n message = hash;\n }\n const result = await this.personalSign(message || '');\n const convertResult = convertSignature(result);\n if (!convertResult) {\n throw new Error('sign error');\n }\n console.log(`personal_sign result(${convertResult.length}): `, convertResult);\n return convertResult;\n } else if (arg.method === 'eth_signTypedData' || arg.method === 'eth_signTypedData_v4') {\n const typedData = arg.params?.[1];\n console.log('signTypedData typedData', typedData);\n const hash = hashTypedData(typeof typedData === 'string' ? JSON.parse(typedData) : typedData);\n console.log('signTypedData hash', hash);\n const result = await this.personalSign(hash || '');\n const convertResult = convertSignature(result);\n if (!convertResult) {\n throw new Error('sign error');\n }\n console.log(`eth_signTypedData result(${convertResult.length}): `, convertResult);\n return convertResult;\n } else if (arg.method === 'wallet_switchEthereumChain') {\n if (arg.params && arg.params instanceof Array && arg.params[0] && arg.params[0].chainId) {\n const chainId = Number(arg.params[0].chainId);\n if (this.supportChainIds.includes(this.chainId)) {\n this.chainId = chainId;\n localStorage.setItem('connect-evm-chain-id', this.chainId.toString());\n this.publicClient = this.getPublicClient();\n setTimeout(() => this.events.emit('chainChanged', intToHex(this.chainId)), 0);\n return Promise.resolve(null);\n }\n throw new SwitchChainError(new Error(`The chain: ${chainId} is not supported`));\n } else {\n throw new InvalidParamsRpcError(new Error('Invalid Params'));\n }\n } else {\n const result = await this.publicClient.request(arg as any);\n return result;\n }\n }\n\n personalSign = async (message: string): Promise<string> => {\n throw new Error('Wallet not connected!');\n };\n\n getPublicKey = async (): Promise<string> => {\n throw new Error('Wallet not connected!');\n };\n\n removeListener(event: string, listener: (...args: any[]) => void) {\n this.events.removeListener(event, listener);\n return this;\n }\n\n on(event: string, listener: (...args: any[]) => void) {\n this.events.on(event, listener);\n return this;\n }\n\n once(event: string, listener: any) {\n this.events.once(event, listener);\n return this;\n }\n\n off(event: string, listener: any) {\n this.events.off(event, listener);\n return this;\n }\n\n emit(event: string, ...args: any[]) {\n this.events.emit(event, args);\n }\n\n getPublicClient = () => {\n const rpcUrl = this?.rpcUrls?.[this.chainId] || chains.getEVMChainInfoById(this.chainId || 1)?.rpcUrl;\n console.log('rpcUrl', rpcUrl);\n\n return createPublicClient({\n transport: http(rpcUrl),\n });\n };\n}\n", "import { useCallback, useState } from 'react';\n\nconst useModalStateValue = () => {\n const [isModalOpen, setModalOpen] = useState(false);\n\n return {\n closeModal: useCallback(() => setModalOpen(false), []),\n isModalOpen,\n openModal: useCallback(() => setModalOpen(true), []),\n };\n};\n\nexport default useModalStateValue;\n", "import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { ConnectProvider as BTCConnectProvider } from '../context';\nimport { UnisatConnector, OKXConnector } from '../connector'\nimport { useBTCProvider, useConnectModal } from '../hooks'\n\nimport ComfirmBox from './confirmBox';\nimport { InitContextHook } from './hook';\n\nconst WalletSelectorContext =\n React.createContext<any>(null);\n\nexport function BtcWalletSelectorContextProvider({ children, autoConnect = false }: { children: React.ReactNode, autoConnect?: boolean }) {\n const [isProcessing, setIsProcessing] = useState(false)\n\n const walletSelectorContextValue = useMemo(() => {\n const simpleFn: any = {}\n\n return {\n setIsProcessing,\n emit: (eventName: string, e: any) => {\n if (simpleFn[eventName] && simpleFn[eventName].length) {\n simpleFn[eventName].forEach((fn: (e: any) => void) => {\n fn(e)\n })\n }\n },\n on: (eventName: string, fn: (e: any) => void) => {\n simpleFn[eventName] = simpleFn[eventName] || []\n simpleFn[eventName].push(fn)\n },\n }\n }, [])\n\n return <WalletSelectorContext.Provider value={walletSelectorContextValue}><BTCConnectProvider\n options={{\n projectId: 'btc',\n clientKey: 'btc',\n appId: 'btc',\n aaOptions: {\n accountContracts: {\n BTC: [\n {\n chainIds: [686868],\n version: '1.0.0',\n },\n ],\n },\n },\n walletOptions: {\n visible: true,\n },\n \n }}\n autoConnect={false}\n connectors={[new UnisatConnector()]}\n >\n {children}\n {\n isProcessing && <ComfirmBox hash={''} status={0} onClose={() => {\n setIsProcessing(false)\n }}/>\n }\n <InitContextHook />\n </BTCConnectProvider>\n </WalletSelectorContext.Provider>\n}\n\nexport function useBtcWalletSelector() {\n // @ts-ignore\n const { openConnectModal, openConnectModalAsync, disconnect, requestDirectAccount } = useConnectModal();\n const { accounts, sendBitcoin, getPublicKey, provider, signMessage, connector } = useBTCProvider();\n const publicKey = useRef<any>(null)\n const signMessageFn = useRef<any>(null)\n const connectorRef = useRef<any>(null)\n const providerRef = useRef<any>(null)\n const [updater, setUpdater] = useState<any>(1)\n const context = useContext(WalletSelectorContext);\n \n useEffect(() => {\n if (provider) {\n getPublicKey().then((res) => {\n publicKey.current = res\n })\n providerRef.current = provider\n }\n }, [provider, updater])\n\n useEffect(() => {\n signMessageFn.current = signMessage\n }, [signMessage])\n\n useEffect(() => {\n const fn = (account: any) => {\n if (account) {\n getPublicKey().then((res) => {\n publicKey.current = res\n context.emit('updatePublicKey', res)\n })\n }\n }\n\n if (connector) {\n connector.on('accountsChanged', fn)\n }\n connectorRef.current = connector\n\n return () => {\n if (connector) {\n connector.removeListener('accountsChanged', fn)\n }\n }\n }, [connector])\n\n return {\n login: async () => {\n setUpdater(updater + 1)\n if (openConnectModal) {\n await openConnectModal()\n }\n\n return null\n },\n autoConnect: async () => {\n let times = 0\n while (!connectorRef.current) {\n await sleep(500)\n if (times++ > 10) {\n return null\n }\n }\n requestDirectAccount(connectorRef.current).catch((e: any) => {\n context.emit('btcLoginError')\n });\n \n },\n logout: () => {\n disconnect && disconnect()\n },\n account: accounts && accounts.length ? accounts[0] : null,\n getPublicKey: async () => {\n let times = 0\n while (!publicKey.current) {\n await sleep(1000)\n if (times++ > 10) {\n return null\n }\n }\n\n return publicKey.current\n },\n signMessage: (msg: string) => {\n return signMessageFn.current(msg)\n },\n getContext: () => {\n return context\n },\n getBalance: async () => {\n let times = 0\n while (!providerRef.current) {\n await sleep(500)\n if (times++ > 10) {\n return null\n }\n }\n\n const { total } = await providerRef.current.getBalance()\n return total\n }\n }\n}\n\nfunction sleep(time: number) {\n return new Promise(function (resolve) {\n setTimeout(resolve, time);\n });\n}\n\n", "import React from 'react';\n// import './modal.css'\n\ninterface Props {\n children?: any;\n onClose?: () => void;\n style?: any\n}\n\nconst styles: any = {}\n\nexport default function Modal({ children, onClose, style = {} }: Props) {\n return <div>\n <div className=\"layer\"></div>\n <div className=\"modal\" style={style}>\n <div className=\"close\" onClick={() => { onClose && onClose() }}>\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M7.73284 5.99997L11.7359 1.99698C12.0368 1.69598 12.0882 1.25928 11.8507 1.02188L10.9779 0.149088C10.7404 -0.0884114 10.3043 -0.0363117 10.0028 0.264487L6.00013 4.26737L1.99719 0.264587C1.69619 -0.0367116 1.25948 -0.0884115 1.02198 0.149388L0.149174 1.02228C-0.0882276 1.25938 -0.0368271 1.69608 0.264576 1.99708L4.26761 5.99997L0.264576 10.0032C-0.0363271 10.304 -0.0884276 10.7404 0.149174 10.9779L1.02198 11.8507C1.25948 12.0882 1.69619 12.0367 1.99719 11.7358L6.00033 7.73266L10.0029 11.7352C10.3044 12.0368 10.7405 12.0882 10.978 11.8507L11.8508 10.9779C12.0882 10.7404 12.0368 10.304 11.736 10.0028L7.73284 5.99997Z\" fill=\"#808095\" />\n </svg>\n </div>\n {children}\n </div>\n </div>\n}", "import React from \"react\";\nimport Modal from \"./Modal\";\n\n// import './confirmBox.css'\n\ninterface Props {\n onClose: () => void;\n fromChain?: any;\n toChain?: any;\n status: number;\n hash: string;\n}\n\n\n\nexport default function ComfirmBox({ onClose, status = 1, fromChain = {\n name: 'NEAR',\n}, toChain = {\n name: 'BTC',\n}, hash }: Props) {\n return <Modal onClose={onClose}>\n <div className=\"title\">Transaction Detail</div>\n <div className=\"chians\">\n {/* <img style={{ width: 26, height: 26 }} src={fromChain?.icon} /> */}\n {/* <svg width=\"31\" height=\"2\" viewBox=\"0 0 31 2\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <line opacity=\"0.5\" x1=\"8.74228e-08\" y1=\"1\" x2=\"31\" y2=\"1\" stroke=\"#727272\" stroke-width=\"2\" stroke-dasharray=\"2 5\" />\n </svg> */}\n\n {\n status === 0 ? <svg className=\"loading\" width=\"54\" height=\"54\" viewBox=\"0 0 54 54\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M52.0766 10.7867C53.0482 11.0471 53.6273 12.0399 53.3741 13.0134C53.1219 13.977 52.1361 14.5546 51.1725 14.3024L47.6172 13.3498L46.3268 18.1657C44.8261 23.7665 40.0219 27.6146 34.2721 28.6546C38.7381 32.4056 40.9681 38.1648 39.4673 43.7656L38.1769 48.5815L41.6972 49.5248C42.6655 49.7843 43.2401 50.7794 42.9806 51.7477C42.7212 52.7159 41.726 53.2905 40.7578 53.031L2.02593 42.6529L1.71657 42.5396C0.800668 42.1375 0.383843 41.0689 0.785965 40.153C1.15472 39.3126 2.09436 38.8809 2.97262 39.1481L6.52126 40.0989L7.81144 35.2839C9.31216 29.6832 14.1131 25.8341 19.8661 24.795C15.3968 21.0432 13.1702 15.2848 14.6709 9.68407L15.9615 4.86764L12.4128 3.91679C11.4445 3.65734 10.87 2.66223 11.1295 1.69395C11.3889 0.725662 12.384 0.151138 13.3523 0.410589L52.0766 10.7867ZM44.0959 12.4063L19.471 5.80801L18.1871 10.5994C17.0693 14.7711 18.671 19.3131 22.2022 22.3268C23.2549 23.2994 23.6544 24.61 23.3544 25.7297C23.0485 27.0126 21.9665 27.9627 20.6551 28.1007C16.1146 28.9516 12.432 32.0776 11.3175 36.2502L10.0214 41.0874L11.982 41.6127L12.5291 39.571C13.5385 35.8039 16.032 32.0464 21.0065 30.689L21.8135 30.4937C23.6047 30.2306 25.3145 29.1151 26.9388 27.1507C27.1931 29.441 28.1726 31.2771 29.8857 32.6567C34.4351 36.8 34.1706 41.1245 33.1094 45.0849L32.5623 47.1267L34.6428 47.6841L35.9323 42.8715C37.0501 38.6998 35.4522 34.1588 31.9215 31.1412C30.8693 30.1687 30.4684 28.8613 30.7693 27.7383C31.1136 26.4535 32.114 25.5215 33.4676 25.3711C38.0072 24.5235 41.6865 21.3966 42.8052 17.2216L44.0959 12.4063ZM40.7578 15.6185C40.1797 19.9295 35.6431 22.9023 32.7256 23.2863C30.9809 23.5169 29.1741 24.3456 27.3087 25.7742C26.4809 23.6244 25.3731 22.0143 23.9948 20.9474C21.5041 19.0198 20.6551 17.2216 20.3797 15.1185L40.7578 15.6185Z\" fill=\"white\" fill-opacity=\"0.21\" />\n </svg> : <svg width=\"54\" height=\"54\" viewBox=\"0 0 54 54\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"27\" cy=\"27\" r=\"21\" fill=\"#33FFDA\" />\n <circle cx=\"27\" cy=\"27\" r=\"24\" stroke=\"#33FFDA\" stroke-opacity=\"0.3\" stroke-width=\"6\" />\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M37.342 19.6604C38.2111 20.5494 38.2205 22.0006 37.363 22.9016L24.8987 36L17.651 28.5196C16.7858 27.6266 16.7826 26.1754 17.6439 25.2783C18.5052 24.3813 19.9048 24.378 20.77 25.271L24.8705 29.5031L34.2159 19.6822C35.0733 18.7812 36.4729 18.7714 37.342 19.6604Z\" fill=\"black\" />\n </svg>\n }\n\n {/* <svg width=\"31\" height=\"2\" viewBox=\"0 0 31 2\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <line opacity=\"0.5\" x1=\"8.74228e-08\" y1=\"1\" x2=\"31\" y2=\"1\" stroke=\"#727272\" stroke-width=\"2\" stroke-dasharray=\"2 5\" />\n </svg> */}\n {/* <img style={{ width: 26, height: 26 }} src={toChain?.icon} /> */}\n </div>\n\n {\n status === 0 && <>\n <div className=\"time\">\n Est Time: 5 mins\n </div>\n <div className=\"processing\">\n Transaction is processing. \n </div>\n </>\n }\n\n {\n status === 1 && <>\n <div className=\"time\">\n Bridge Completed\n </div>\n <div className=\"processing\">\n You can view your transaction on the <a href=\"/history\">bridge transaction history.</a>\n </div>\n </>\n }\n\n {\n !!hash && <><div className=\"srcBtn\" onClick={() => {\n if (fromChain.name === 'BTC') {\n window.open(`https://mempool.space/testnet/tx/${hash}`)\n } else if (fromChain.name === 'NEAR') {\n window.open(`https://testnet.nearblocks.io/txns/${hash}`)\n }\n\n }}>\n SRC TX <svg width=\"8\" height=\"8\" viewBox=\"0 0 8 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M5.97871 8H2.02129C0.907217 8 0 7.09294 0 5.97905V2.02095C0 0.907063 0.907217 0 2.02129 0H3.73973C3.98175 0 4.17779 0.196012 4.17779 0.437986C4.17779 0.679959 3.98175 0.875972 3.73973 0.875972H2.02129C1.71573 0.875972 1.42775 0.994931 1.21142 1.21122C0.995099 1.42751 0.87612 1.71544 0.87612 2.02095V5.97769C0.87612 6.2832 0.995099 6.57114 1.21142 6.78743C1.42775 7.00372 1.71573 7.12268 2.02129 7.12268H5.97871C6.61011 7.12268 7.12388 6.60899 7.12388 5.97769V4.12977C7.12388 3.97432 7.20771 3.82832 7.34291 3.74992C7.40916 3.71206 7.48487 3.69179 7.56194 3.69179C7.63901 3.69179 7.71472 3.71206 7.78097 3.74992C7.91617 3.82832 8 3.97296 8 4.12977V5.97769C8 7.09294 7.09414 8 5.97871 8ZM7.35223 2.78066C7.41578 2.81715 7.48879 2.83608 7.56179 2.83608C7.6348 2.83608 7.70781 2.8158 7.77271 2.7793C7.90251 2.70496 7.98228 2.56572 7.98228 2.41702V0.438001C7.98228 0.206844 7.79434 0.0189453 7.56315 0.0189453H5.58378C5.35258 0.0189453 5.16465 0.206844 5.16465 0.438001C5.16465 0.669157 5.35258 0.857056 5.58378 0.857056H6.55077L3.70328 3.70405L3.70058 3.70676C3.62658 3.7861 3.58634 3.89111 3.58835 3.99958C3.59037 4.10806 3.6345 4.21149 3.7114 4.28803C3.79117 4.36779 3.89527 4.41105 4.00749 4.41105C4.1143 4.41105 4.2157 4.37049 4.29277 4.29885L4.29412 4.2975L7.14267 1.44944V2.41838C7.14267 2.56707 7.22379 2.70631 7.35223 2.78066Z\" fill=\"#FF7A00\" />\n </svg>\n </div>\n </>\n }\n\n {/* {\n status === 1 &&\n <button onClick={() => {\n onClose && onClose()\n }} className={styles.btn}>+ New Transfer</button>\n } */}\n\n </Modal>\n}", "import { useEffect } from 'react'\nimport { useBtcWalletSelector } from './btcWalletSelectorContext'\n\nexport function InitContextHook() {\n const btcContext = useBtcWalletSelector()\n\n useEffect(() => {\n // @ts-ignore\n window.btcContext = btcContext\n }, [btcContext])\n\n return null\n}", "import type {\n Transaction,\n InjectedWallet,\n WalletModuleFactory,\n WalletBehaviourFactory,\n} from '@near-wallet-selector/core';\nimport { providers, transactions } from 'near-api-js';\nimport type { AccessKeyViewRaw } from 'near-api-js/lib/providers/provider';\nimport { actionCreators } from '@near-js/transactions';\n\nimport { PublicKey } from 'near-api-js/lib/utils/key_pair';\nimport { encodeTransaction } from 'near-api-js/lib/transaction';\nimport { baseDecode } from '@near-js/utils';\nimport bs58 from 'bs58';\nimport { sha256 } from 'js-sha256';\nimport { setupWalletButton, removeWalletButton } from './initWalletButton';\n\n// export * from './btcWalletSelectorContext'\nimport type { useBtcWalletSelector } from './../components/btcWalletSelectorContext';\nimport { delay } from '.';\n\nconst { transfer, functionCall } = actionCreators;\n\ndeclare global {\n interface Window {\n btcContext: ReturnType<typeof useBtcWalletSelector>;\n }\n}\n\ninterface BTCWalletParams {\n iconUrl?: string;\n deprecated?: boolean;\n autoConnect?: boolean;\n}\n\nconst config: Record<\n string,\n {\n base_url: string;\n token: string;\n contractId: string;\n }\n> = {\n testnet: {\n base_url: 'https://api.testnet.satoshibridge.top/v1',\n token: 'nbtc2-nsp.testnet',\n contractId: 'dev2-nsp.testnet',\n },\n mainnet: {\n base_url: 'https://api.mainnet.satoshibridge.top/v1',\n token: '',\n contractId: '',\n },\n};\n\nconst state: any = {\n saveAccount(account: string) {\n window.localStorage.setItem('btc-wallet-account', account);\n },\n removeAccount() {\n window.localStorage.removeItem('btc-wallet-account');\n },\n savePublicKey(publicKey: string) {\n window.localStorage.setItem('btc-wallet-publickey', publicKey);\n },\n removePublicKey() {\n window.localStorage.removeItem('btc-wallet-publickey');\n },\n saveBtcPublicKey(publicKey: string) {\n window.localStorage.setItem('btc-wallet-btc-publickey', publicKey);\n },\n removeBtcPublicKey() {\n window.localStorage.removeItem('btc-wallet-btc-publickey');\n },\n clear() {\n this.removeAccount();\n this.removePublicKey();\n this.removeBtcPublicKey();\n },\n save(account: string, publicKey: string) {\n this.saveAccount(account);\n this.savePublicKey(publicKey);\n },\n getAccount() {\n return window.localStorage.getItem('btc-wallet-account');\n },\n getPublicKey() {\n return window.localStorage.getItem('btc-wallet-publickey');\n },\n getBtcPublicKey() {\n return window.localStorage.getItem('btc-wallet-btc-publickey');\n },\n};\n\nlet inter: any = null;\n\nconst BTCWallet: WalletBehaviourFactory<InjectedWallet> = async ({\n metadata,\n options,\n store,\n emitter,\n logger,\n id,\n provider,\n}) => {\n const wallet = {\n signIn,\n signOut,\n getAccounts,\n verifyOwner,\n signMessage,\n signAndSendTransaction,\n signAndSendTransactions,\n };\n\n initWalletButton(options.network.networkId, wallet);\n\n if (!inter) {\n inter = setInterval(async () => {\n // @ts-ignore\n const btcContext = window.btcContext;\n\n console.log('inter btcContext:', btcContext);\n\n if (btcContext) {\n clearInterval(inter);\n const context = btcContext.getContext();\n\n context.on('updatePublicKey', async (btcPublicKey: string) => {\n const { nearTempAddress } = await getNearAccountByBtcPublicKey(btcPublicKey);\n\n removeWalletButton();\n initWalletButton(options.network.networkId, wallet);\n\n emitter.emit('accountsChanged', {\n accounts: [\n {\n accountId: nearTempAddress,\n // active: true\n },\n ],\n });\n });\n\n context.on('btcLoginError', async (e: any) => {\n emitter.emit('accountsChanged', {\n accounts: [],\n });\n });\n\n console.log('metadata.autoConnect:', metadata);\n\n if (\n 'autoConnect' in metadata &&\n metadata.autoConnect &&\n localStorage.getItem('near-wallet-selector:selectedWalletId') === '\"btc-wallet\"'\n ) {\n await btcContext.autoConnect();\n }\n\n clearInterval(inter);\n }\n }, 500);\n }\n\n async function viewMethod({ method, args = {} }: { method: string; args: any }) {\n const res: any = await provider.query({\n request_type: 'call_function',\n account_id: config[options.network.networkId].contractId,\n method_name: method,\n args_base64: Buffer.from(JSON.stringify(args)).toString('base64'),\n finality: 'optimistic',\n });\n\n return JSON.parse(Buffer.from(res.result).toString());\n }\n\n async function getNearAccountByBtcPublicKey(btcPublicKey: string) {\n const nearTempAddress = await viewMethod({\n method: 'get_chain_signature_near_account',\n args: { btc_public_key: btcPublicKey },\n });\n\n const nearTempPublicKey = await viewMethod({\n method: 'get_chain_signature_near_account_public_key',\n args: { btc_public_key: btcPublicKey },\n });\n\n state.saveAccount(nearTempAddress);\n state.savePublicKey(nearTempPublicKey);\n state.saveBtcPublicKey(btcPublicKey);\n\n return {\n nearTempAddress,\n nearTempPublicKey,\n };\n }\n\n async function signIn({ contractId, methodNames }: any) {\n console.log(provider);\n const accountId = state.getAccount();\n const publicKey = state.getPublicKey();\n\n const btcContext = window.btcContext;\n\n initWalletButton(options.network.networkId, wallet);\n\n if (accountId && publicKey) {\n return [\n {\n accountId,\n publicKey,\n },\n ];\n }\n\n const btcAccount = await btcContext.login();\n const btcPublicKey = await btcContext.getPublicKey();\n\n const { nearTempAddress, nearTempPublicKey } = await getNearAccountByBtcPublicKey(btcPublicKey);\n\n return [\n {\n accountId: nearTempAddress,\n publicKey: nearTempPublicKey,\n },\n ];\n }\n\n async function signOut() {\n const btcContext = window.btcContext;\n btcContext.logout();\n state.clear();\n window.localStorage.removeItem('near-wallet-selector:selectedWalletId');\n removeWalletButton();\n // clearInterval(inter)\n }\n\n async function getAccounts() {\n return [{ accountId: state.getAccount() }];\n }\n\n async function verifyOwner() {\n throw new Error(`Method not supported by ${metadata.name}`);\n }\n\n async function signMessage() {\n throw new Error(`Method not supported by ${metadata.name}`);\n }\n\n async function signAndSendTransaction(params: Transaction) {\n const transactions = [params];\n const result = await signAndSendTransactions({ transactions });\n if (Array.isArray(result)) {\n return result[0];\n } else {\n throw new Error(`Transaction failed: ${result}`);\n }\n }\n\n async function signAndSendTransactions(params: { transactions: Transaction[] }) {\n const btcContext = window.btcContext;\n const accountId = state.getAccount();\n const publicKey = state.getPublicKey();\n\n const { header } = await provider.block({ finality: 'final' });\n\n const rawAccessKey = await provider.query<AccessKeyViewRaw>({\n request_type: 'view_access_key',\n account_id: accountId,\n public_key: publicKey,\n finality: 'final',\n });\n\n const accessKey = {\n ...rawAccessKey,\n nonce: BigInt(rawAccessKey.nonce || 0),\n };\n\n const publicKeyFormat = PublicKey.from(publicKey);\n\n const nearNonceApi = await getNearNonceFromApi(options.network.networkId, accountId);\n\n const newTransactions = params.transactions.map((transaction, index) => {\n let nearNonceNumber = accessKey.nonce + BigInt(1);\n if (nearNonceApi) {\n nearNonceNumber =\n BigInt(nearNonceApi.result_data) > nearNonceNumber\n ? BigInt(nearNonceApi.result_data)\n : nearNonceNumber;\n }\n const newActions = transaction.actions\n .map((action) => {\n switch (action.type) {\n case 'FunctionCall':\n return functionCall(\n action.params.methodName,\n action.params.args,\n BigInt(action.params.gas),\n BigInt(action.params.deposit),\n );\n case 'Transfer':\n return transfer(BigInt(action.params.deposit));\n }\n })\n .filter(Boolean) as transactions.Action[];\n const _transaction = transactions.createTransaction(\n accountId,\n publicKeyFormat,\n transaction.receiverId,\n BigInt(nearNonceNumber) + BigInt(index),\n newActions,\n baseDecode(header.hash),\n );\n const txBytes = encodeTransaction(_transaction);\n const txHex = Array.from(txBytes, (byte) =>\n ('0' + (byte & 0xff).toString(16)).slice(-2),\n ).join('');\n console.log('txHex:', txHex);\n\n const hash = bs58.encode(new Uint8Array(sha256.array(txBytes)));\n return { txBytes, txHex, hash };\n });\n\n const accountInfo = await viewMethod({\n method: 'get_account',\n args: { account_id: accountId },\n });\n\n const nonceApi = await getNonceFromApi(options.network.networkId, accountId as string);\n\n const nonce =\n Number(nonceApi?.result_data) > Number(accountInfo.nonce)\n ? String(nonceApi?.result_data)\n : String(accountInfo.nonce);\n\n const intention = {\n chain_id: '397',\n csna: accountId,\n near_transactions: newTransactions.map((t) => t.txHex),\n gas_token: config[options.network.networkId].token,\n gas_limit: '3000',\n nonce,\n };\n\n const strIntention = JSON.stringify(intention);\n\n const signature = await btcContext.signMessage(strIntention);\n\n const result = await uploadBTCTx(options.network.networkId, {\n sig: signature,\n btcPubKey: state.getBtcPublicKey(),\n data: toHex(strIntention),\n });\n\n console.log('result:', result);\n\n if (result.result_code === 0) {\n const hash = newTransactions.map((t) => t.hash);\n console.log('txHash:', hash);\n const result = await pollTransactionStatuses(options.network.networkId, hash);\n return result;\n } else {\n return null;\n }\n }\n\n async function initWalletButton(network: string, wallet: any) {\n const checkAndSetupWalletButton = () => {\n const accountId = state.getAccount();\n const btcContext = window.btcContext;\n console.log('checkAndSetupWalletButton:', accountId, btcContext.account);\n if (accountId && btcContext.account) {\n setupWalletButton(network, wallet, btcContext);\n } else {\n removeWalletButton();\n setTimeout(() => {\n checkAndSetupWalletButton();\n }, 5000);\n }\n };\n await delay(1000);\n checkAndSetupWalletButton();\n }\n\n return wallet as any;\n};\n\nfunction getNonceFromApi(network: string, accountId: string) {\n return fetch(`${config[network].base_url}/nonce?csna=${accountId}`, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n }).then((res) => res.json());\n}\n\nfunction getNearNonceFromApi(network: string, accountId: string) {\n return fetch(`${config[network].base_url}/nonceNear?csna=${accountId}`, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n }).then((res) => res.json());\n}\n\nfunction uploadBTCTx(network: string, data: any) {\n return fetch(`${config[network].base_url}/receiveTransaction`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(data),\n }).then((res) => res.json());\n}\n\nexport function setupBTCWallet({\n iconUrl = 'https://assets.deltatrade.ai/assets/chain/btc.svg',\n deprecated = false,\n autoConnect = true,\n}: BTCWalletParams | undefined = {}): WalletModuleFactory<InjectedWallet> {\n const btcWallet: any = async () => {\n return {\n id: 'btc-wallet',\n type: 'injected',\n metadata: {\n name: 'BTC Wallet',\n description: 'BTC Wallet',\n iconUrl,\n downloadUrl: iconUrl,\n deprecated,\n available: true,\n autoConnect,\n },\n init: BTCWallet,\n };\n };\n\n return btcWallet;\n}\n\nfunction toHex(originalString: string) {\n const charArray = originalString.split('');\n const asciiArray = charArray.map((char) => char.charCodeAt(0));\n const hexArray = asciiArray.map((code) => code.toString(16));\n let hexString = hexArray.join('');\n hexString = hexString.replace(/(^0+)/g, '');\n return hexString;\n}\n\nconst rcpUrls = {\n mainnet: [\n 'https://near.lava.build',\n 'https://rpc.mainnet.near.org',\n 'https://free.rpc.fastnear.com',\n 'https://near.drpc.org',\n ],\n testnet: [\n 'https://near-testnet.lava.build',\n 'https://rpc.testnet.near.org',\n 'https://near-testnet.drpc.org',\n ],\n};\n\nasync function pollTransactionStatuses(network: string, hashes: string[]) {\n const provider = new providers.FailoverRpcProvider(\n Object.values(rcpUrls[network as keyof typeof rcpUrls]).map(\n (url) => new providers.JsonRpcProvider({ url }),\n ),\n );\n\n const maxAttempts = 3;\n\n // Helper function to poll status for a single transaction hash\n const pollStatus = async (hash: string) => {\n let attempt = 0;\n\n while (attempt < maxAttempts) {\n attempt++;\n\n try {\n const result = await provider.txStatus(hash, 'unused', 'FINAL');\n\n if (result && result.status) {\n console.log(`Transaction ${hash} result:`, result);\n return result;\n }\n } catch (error: any) {\n console.error(`Failed to fetch transaction status for ${hash}: ${error.message}`);\n }\n\n if (attempt === maxAttempts) {\n throw new Error(`Transaction not found after max attempts: ${hash}`);\n }\n\n // Delay before next attempt\n await delay(10000);\n console.log(`RPC request failed for ${hash}, retrying ${maxAttempts - attempt} more times`);\n }\n };\n\n // Poll all transaction statuses in parallel\n const results = await Promise.all(hashes.map((hash) => pollStatus(hash)));\n\n return results;\n}\n\nexport default {\n // useBtcWalletSelector,\n // BtcWalletSelectorContextProvider,\n setupBTCWallet,\n};\n", "import type { Wallet } from '@near-wallet-selector/core';\n\ninterface OriginalWallet {\n account: string | null;\n getPublicKey: () => Promise<string>;\n}\n\nexport function setupWalletButton(network: string, wallet: Wallet, originalWallet: OriginalWallet) {\n console.log('setupWalletButton');\n if (document.getElementById('satoshi-wallet-button')) {\n return;\n }\n\n const iframe = createIframe({\n iframeUrl:\n network === 'testnet'\n ? 'https://wallet-dev.satoshibridge.top'\n : 'https://wallet.satoshibridge.top',\n iframeStyle: { width: '400px', height: '650px' },\n });\n\n iframe.addEventListener('mouseenter', () => {\n if (document.activeElement !== iframe) {\n document.activeElement?.setAttribute('tabindex', 'null');\n setTimeout(() => {\n iframe.focus();\n }, 0);\n }\n });\n\n const button = createFloatingButtonWithIframe({\n openImageUrl: 'https://assets.deltatrade.ai/wallet-assets/wallet-btn.png',\n closeImageUrl: 'https://assets.deltatrade.ai/wallet-assets/wallet-btn-active.png',\n iframe,\n });\n\n setupButtonClickHandler(button, iframe, wallet, originalWallet);\n}\n\nfunction createFloatingButtonWithIframe({\n openImageUrl,\n closeImageUrl,\n iframe,\n}: {\n openImageUrl: string;\n closeImageUrl: string;\n iframe: HTMLIFrameElement;\n}): HTMLImageElement {\n const button = document.createElement('img');\n button.id = 'satoshi-wallet-button';\n button.src = openImageUrl;\n\n Object.assign(button.style, {\n position: 'fixed',\n bottom: '20px',\n right: '20px',\n zIndex: '100000',\n width: '60px',\n height: '60px',\n borderRadius: '50%',\n cursor: 'pointer',\n transition: 'transform 0.15s ease',\n });\n\n document.body.appendChild(button);\n\n const iframeVisible =\n localStorage.getItem('iframeVisible') === 'true' ||\n localStorage.getItem('iframeVisible') === null;\n button.src = iframeVisible ? closeImageUrl : openImageUrl;\n iframe.style.display = iframeVisible ? 'block' : 'none';\n\n button.onclick = function () {\n const isCurrentlyVisible = iframe.style.display === 'block';\n button.style.transform = 'scale(0.8)';\n setTimeout(() => {\n button.style.transform = 'scale(1)';\n }, 150);\n\n iframe.style.display = isCurrentlyVisible ? 'none' : 'block';\n button.src = isCurrentlyVisible ? openImageUrl : closeImageUrl;\n\n localStorage.setItem('iframeVisible', String(!isCurrentlyVisible));\n\n setTimeout(() => {\n iframe.focus();\n }, 0);\n };\n\n return button;\n}\n\nfunction createIframe({\n iframeUrl,\n iframeStyle = {},\n}: {\n iframeUrl: string;\n iframeStyle?: { [key: string]: string };\n}): HTMLIFrameElement {\n const iframe = document.createElement('iframe');\n iframe.id = 'satoshi-wallet-iframe';\n iframe.allow = 'clipboard-read; clipboard-write';\n iframe.src = iframeUrl;\n\n Object.assign(iframe.style, {\n position: 'fixed',\n bottom: '90px',\n right: '20px',\n zIndex: '100000',\n boxShadow: '0 0 10px rgba(0, 0, 0, 0.1)',\n borderRadius: '10px',\n display: 'block',\n ...iframeStyle,\n });\n\n document.body.appendChild(iframe);\n\n return iframe;\n}\n\nasync function setupButtonClickHandler(\n button: HTMLImageElement,\n iframe: HTMLIFrameElement,\n wallet: Wallet,\n originalWallet: OriginalWallet,\n) {\n const accountId = (await wallet?.getAccounts())?.[0].accountId;\n const originalAccountId = originalWallet.account;\n const originalPublicKey = await originalWallet.getPublicKey();\n console.log({ accountId, originalAccountId, originalPublicKey });\n const iframeSrc = new URL(iframe.src);\n iframeSrc.searchParams.set('origin', window.location.origin);\n accountId && iframeSrc.searchParams.set('accountId', accountId);\n originalAccountId && iframeSrc.searchParams.set('originalAccountId', originalAccountId);\n originalPublicKey && iframeSrc.searchParams.set('originalPublicKey', originalPublicKey);\n\n iframe.src = iframeSrc.toString();\n console.log('iframe src', iframe.src);\n\n window.addEventListener('message', async (event) => {\n if (event.origin !== iframeSrc.origin) return;\n const { action, requestId, data } = event.data;\n\n if (action === 'signAndSendTransaction') {\n console.log('signAndSendTransaction message', event.data);\n try {\n const result = await wallet.signAndSendTransaction(data);\n console.log('signAndSendTransaction result', result);\n event.source?.postMessage(\n {\n requestId,\n data,\n success: true,\n },\n { targetOrigin: event.origin },\n );\n } catch (error: any) {\n console.error('signAndSendTransaction error', error);\n event.source?.postMessage(\n {\n requestId,\n error: error.message,\n success: false,\n },\n { targetOrigin: event.origin },\n );\n }\n }\n });\n}\n\nexport function removeWalletButton() {\n const button = document.getElementById('satoshi-wallet-button');\n button?.remove();\n const iframe = document.getElementById('satoshi-wallet-iframe');\n iframe?.remove();\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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SAAO;AACT;AAEA,IAAI,OAAO,WAAW,aAAa;AACjC,EAAC,OAAe,iCAAiC,WAAW;AAC9D;",
6
6
  "names": ["EventEmitter", "import_chains", "import_react", "import_react", "import_react", "import_react", "import_events", "chainId", "digest", "classes", "css", "import_jsx_runtime", "import_react", "digest", "classes", "css", "import_jsx_runtime", "digest", "classes", "css", "import_jsx_runtime", "import_chains", "import_react", "import_viem", "import_util", "bitcore", "import_react", "digest", "classes", "css", "import_jsx_runtime", "import_react", "import_viem", "digest", "classes", "css", "import_jsx_runtime", "digest", "classes", "css", "import_jsx_runtime", "digest", "classes", "css", "import_jsx_runtime", "import_util", "import_chains", "import_events", "import_viem", "import_react", "import_jsx_runtime", "config", "_a", "options", "smartAccount", "connector", "accounts", "_b", "import_react", "import_jsx_runtime", "Modal", "import_jsx_runtime", "Modal", "import_react", "import_jsx_runtime", "React", "import_utils", "_a", "_0", "transactions", "bs58", "result", "wallet"]
7
7
  }