btc-wallet 0.2.6 → 0.2.7

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
- "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", "../src/config.ts", "../src/utils/request.ts", "../src/utils/bridgeSupplyUtils.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 * from './utils/bridgeSupplyUtils';\nexport const getVersion = () => {\n return '0.2.6';\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 = React.createContext<any>(null);\n\nexport function BtcWalletSelectorContextProvider({\n children,\n autoConnect = false,\n}: {\n children: React.ReactNode;\n autoConnect?: boolean;\n}) {\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 (\n <WalletSelectorContext.Provider value={walletSelectorContextValue}>\n <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 autoConnect={false}\n connectors={[new UnisatConnector()]}\n >\n {children}\n {isProcessing && (\n <ComfirmBox\n hash={''}\n status={0}\n onClose={() => {\n setIsProcessing(false);\n }}\n />\n )}\n <InitContextHook />\n </BTCConnectProvider>\n </WalletSelectorContext.Provider>\n );\n}\n\nexport function useBtcWalletSelector() {\n // @ts-ignore\n const { openConnectModal, openConnectModalAsync, disconnect, requestDirectAccount } =\n useConnectModal();\n const { accounts, sendBitcoin, getPublicKey, provider, signMessage, connector } =\n 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 const account = accounts && accounts.length ? accounts[0] : null;\n if (account) {\n return account;\n }\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 logout: () => {\n disconnect && disconnect();\n context.emit('btcLogOut');\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 sendBitcoin,\n };\n}\n\nfunction sleep(time: number) {\n return new Promise(function (resolve) {\n setTimeout(resolve, time);\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 '.';\nimport { walletConfig, nearRpcUrls } from '../config';\nimport request from './request';\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 syncLogOut?: boolean;\n isDev?: boolean;\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 const currentConfig =\n 'isDev' in metadata && metadata.isDev\n ? walletConfig.dev\n : walletConfig[options.network.networkId];\n const walletNetwork = 'isDev' in metadata && metadata.isDev ? 'dev' : options.network.networkId;\n\n initWalletButton(walletNetwork, 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(walletNetwork, 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 context.on('btcLogOut', async (e: any) => {\n console.log(3333);\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 = await provider.query<any>({\n request_type: 'call_function',\n account_id: currentConfig.contractId,\n method_name: method,\n args_base64: Buffer.from(JSON.stringify(args)).toString('base64'),\n finality: 'optimistic',\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 const accountId = state.getAccount();\n const publicKey = state.getPublicKey();\n\n const btcContext = window.btcContext;\n\n initWalletButton(walletNetwork, 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 // @ts-ignore\n if (metadata.syncLogOut) {\n btcContext.logout();\n }\n\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(currentConfig.base_url, 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(currentConfig.base_url, 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: currentConfig.token,\n gas_limit: '3000',\n use_near_pay_gas: false,\n nonce,\n };\n\n const nearAccount = await provider.query<any>({\n request_type: 'view_account',\n account_id: accountId,\n finality: 'final',\n });\n const availableBalance = parseFloat(nearAccount.amount) / 10 ** 24;\n if (availableBalance > 0.2) {\n intention.use_near_pay_gas = true;\n }\n\n const strIntention = JSON.stringify(intention);\n\n const signature = await btcContext.signMessage(strIntention);\n\n const result = await uploadBTCTx(currentConfig.base_url, {\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(url: string, accountId: string) {\n return request<any>(`${url}/v1/nonce?csna=${accountId}`);\n}\n\nfunction getNearNonceFromApi(url: string, accountId: string) {\n return request<any>(`${url}/v1/nonceNear?csna=${accountId}`);\n}\n\nfunction uploadBTCTx(url: string, data: any) {\n return request<any>(`${url}/v1/receiveTransaction`, {\n method: 'POST',\n body: data,\n });\n}\n\nexport function setupBTCWallet({\n iconUrl = 'https://assets.deltatrade.ai/assets/chain/btc.svg',\n deprecated = false,\n autoConnect = true,\n syncLogOut = true,\n isDev = false,\n}: BTCWalletParams | undefined = {}): WalletModuleFactory<InjectedWallet> {\n const btcWallet = 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 syncLogOut,\n isDev,\n },\n init: BTCWallet,\n } as any;\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\nasync function pollTransactionStatuses(network: string, hashes: string[]) {\n const provider = new providers.FailoverRpcProvider(\n Object.values(nearRpcUrls[network as keyof typeof nearRpcUrls]).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 setupBTCWallet,\n};\n", "import type { Wallet } from '@near-wallet-selector/core';\n\ninterface OriginalWallet {\n account: string | null;\n getPublicKey: () => Promise<string>;\n}\n\nconst walletUrlConfig: { [key: string]: string } = {\n dev: 'https://wallet-dev.satoshibridge.top',\n testnet: 'https://wallet-test.satoshibridge.top',\n mainnet: 'https://wallet.satoshibridge.top',\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: walletUrlConfig[network],\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", "export const walletConfig: Record<\n string,\n {\n base_url: string;\n token: string;\n contractId: string;\n walletUrl: string;\n }\n> = {\n dev: {\n base_url: 'https://api.dev.satoshibridge.top',\n token: 'nbtc1-nsp.testnet',\n contractId: 'dev1-nsp.testnet',\n walletUrl: 'https://wallet-dev.satoshibridge.top',\n },\n testnet: {\n base_url: 'https://api.testnet.satoshibridge.top',\n token: 'nbtc2-nsp.testnet',\n contractId: 'dev2-nsp.testnet',\n walletUrl: 'https://wallet-test.satoshibridge.top',\n },\n mainnet: {\n base_url: 'https://api.mainnet.satoshibridge.top',\n token: '',\n contractId: '',\n walletUrl: 'https://wallet.satoshibridge.top',\n },\n};\n\nexport const nearRpcUrls = {\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\nexport const btcRpcUrls = {\n mainnet: 'https://blockstream.info/api',\n testnet: 'https://blockstream.info/testnet/api',\n};\n", "interface RequestOptions<T> extends RequestInit {\n body?: RequestInit['body'] | any;\n retryCount?: number;\n timeout?: number;\n cacheTimeout?: number;\n pollingInterval?: number;\n maxPollingAttempts?: number;\n shouldStopPolling?: (response: T) => boolean;\n}\n\nconst cache = new Map<string, { timestamp: number; data: any }>();\n\nconst defaultCacheTimeout = 3000;\n\nexport default async function request<T>(url: string, options?: RequestOptions<T>): Promise<T> {\n const defaultHeaders = {\n 'Content-Type': 'application/json',\n };\n\n const cacheTimeout = options?.cacheTimeout || defaultCacheTimeout;\n\n const headers = {\n ...defaultHeaders,\n ...options?.headers,\n };\n\n let body = options?.body;\n if (headers['Content-Type'] === 'application/json' && body && typeof body !== 'string') {\n body = JSON.stringify(body);\n }\n\n const method = options?.method || 'GET';\n const cacheKey = method.toUpperCase() === 'GET' ? url : null;\n\n if (cacheKey) {\n const cached = cache.get(cacheKey);\n const isCacheValid = cached && Date.now() - cached.timestamp < cacheTimeout;\n if (isCacheValid) {\n return Promise.resolve(cached.data as T);\n }\n }\n\n const newOptions: RequestInit = {\n ...options,\n headers,\n body,\n method,\n };\n\n const retryCount = options?.retryCount ?? 1;\n\n const controller = new AbortController();\n const timeout = options?.timeout || 20000;\n const timeoutId = setTimeout(() => controller.abort(), timeout);\n\n try {\n const res = await fetch(url, { ...newOptions, signal: controller.signal }).finally(() =>\n clearTimeout(timeoutId),\n );\n\n if (!res.ok) throw new Error(res.statusText);\n const data = await res.json();\n\n if (cacheKey) {\n cache.set(cacheKey, { timestamp: Date.now(), data });\n setTimeout(() => {\n cache.delete(cacheKey);\n }, cacheTimeout);\n }\n\n if (options?.shouldStopPolling && options.shouldStopPolling(data)) {\n return data as T;\n }\n\n return data as T;\n } catch (err) {\n console.error(err);\n if (retryCount > 0) {\n console.log(`Retrying... attempts left: ${retryCount}`);\n return request(url, { ...options, retryCount: retryCount - 1 });\n } else if (options?.pollingInterval && options?.maxPollingAttempts) {\n if (options.maxPollingAttempts > 0) {\n console.log(`Polling... attempts left: ${options.maxPollingAttempts}`);\n await new Promise((resolve) => setTimeout(resolve, options.pollingInterval));\n return request(url, {\n ...options,\n maxPollingAttempts: options.maxPollingAttempts - 1,\n retryCount: retryCount,\n });\n }\n }\n return Promise.reject(err);\n }\n}\n", "import { providers } from 'near-api-js';\nimport Big from 'big.js';\nimport { walletConfig, btcRpcUrls, nearRpcUrls } from '../config';\nimport request from './request';\n\nasync function nearViewMethod<T>(\n contractId: string,\n methodName: string,\n args: any,\n network: string,\n): Promise<T> {\n const nearProvider = new providers.FailoverRpcProvider(\n nearRpcUrls[network as keyof typeof nearRpcUrls].map(\n (url) => new providers.JsonRpcProvider({ url }),\n ),\n );\n const res: any = await nearProvider.query({\n request_type: 'call_function',\n account_id: contractId,\n method_name: methodName,\n args_base64: Buffer.from(JSON.stringify(args)).toString('base64'),\n finality: 'optimistic',\n });\n return JSON.parse(Buffer.from(res.result).toString());\n}\n\nasync function getDepositAddress(\n btcPublicKey: string,\n contractId: string,\n network: string,\n): Promise<string> {\n const res = await nearViewMethod<string>(\n contractId,\n 'get_user_dapp_deposit_address',\n {\n deposit_type: {\n BtcPublicKey: { btc_public_key: btcPublicKey, dapp_operation: 'Burrowland->Supply' },\n },\n },\n network,\n );\n return res;\n}\n\nasync function getGasPrice(btcRpcUrl: string): Promise<number> {\n const defaultFeeRate = 100;\n try {\n const res = await request<Record<string, number>>(`${btcRpcUrl}/fee-estimates`);\n const feeRate = res[6]; // 6 blocks confirmation target\n return feeRate || defaultFeeRate;\n } catch (error) {\n return defaultFeeRate;\n }\n}\n\nasync function sendBitcoin(\n btcProvider: any,\n address: string,\n amount: string,\n feeRate: number,\n): Promise<string> {\n const satoshis = new Big(amount).mul(10 ** 8).toNumber();\n const txHash = await btcProvider.sendBitcoin(address, satoshis, { feeRate });\n return txHash;\n}\n\nasync function receiveDepositMsg(\n baseUrl: string,\n {\n btcPublicKey,\n txHash,\n depositType = 1,\n }: { btcPublicKey: string; txHash: string; depositType?: number },\n) {\n const res = await request<any>(`${baseUrl}/v1/receiveDepositMsg`, {\n method: 'POST',\n body: { btcPublicKey, txHash, depositType },\n });\n return res;\n}\n\nasync function checkTransactionStatus(baseUrl: string, txHash: string) {\n const res = await request<any>(`${baseUrl}/v1/bridgeFromTx?fromTxHash=${txHash}`);\n return res;\n}\n\nexport async function executeBurrowSupply(\n amount: string,\n environment: 'dev' | 'testnet' | 'mainnet',\n): Promise<void> {\n try {\n if (typeof window === 'undefined' || !window.btcContext) {\n throw new Error('BTC Provider is not initialized.');\n }\n const btcProvider = window.btcContext;\n\n const network = environment === 'dev' ? 'testnet' : environment;\n\n const config = walletConfig[environment];\n const btcRpcUrl = btcRpcUrls[network];\n\n const btcPublicKey = await btcProvider.getPublicKey();\n\n if (!btcPublicKey) {\n throw new Error('BTC Public Key is not available.');\n }\n\n const address = await getDepositAddress(btcPublicKey, config.contractId, network);\n const feeRate = await getGasPrice(btcRpcUrl);\n const txHash = await sendBitcoin(btcProvider, address, amount, feeRate);\n await receiveDepositMsg(config.base_url, { btcPublicKey, txHash });\n const status = await checkTransactionStatus(config.base_url, txHash);\n console.log('Transaction Status:', status);\n } catch (error) {\n console.error('Error executing Bridge+BurrowSupply:', error);\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOO,IAAe,gBAAf,MAA6B;AAoBpC;;;;;;ACzBO,IAAe,oBAAf,cAAyC,cAAc;AAAA,EAC5D,YAAoB,YAAoB;AAH1C;AAII,UAAM;AADY;AAElB,UAAM,SAAQ,UAAK,eAAL,mBAAiB,MAAM;AACrC,QAAI,CAAC,KAAK,cAAc,MAAM,SAAS,GAAG;AACxC,YAAM,IAAI,MAAM,+BAA+B;AAAA,IACjD;AAAA,EACF;AAAA,EACA,UAAmB;AACjB,QAAI,OAAO,WAAW,aAAa;AACjC,YAAM,QAAQ,KAAK,WAAW,MAAM,GAAG;AACvC,UAAI,MAAM,WAAW,GAAG;AACtB,eAAO,OAAQ,OAAe,MAAM,QAAQ;AAAA,MAC9C,OAAO;AACL,eACE,OAAQ,OAAe,MAAM,QAAQ,eAAe,OAAQ,OAAe,MAAM,IAAI,MAAM,QAAQ;AAAA,MAEvG;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAAA,EAEM,kBAAqC;AAAA;AACzC,YAAM,WAAW,MAAM,KAAK,mBAAmB,EAAE,gBAAgB;AACjE,cAAQ,IAAI,+DAAwD,QAAQ;AAC5E,aAAO;AAAA,IACT;AAAA;AAAA,EAEM,cAAiC;AAAA;AACrC,YAAM,WAAW,MAAM,KAAK,mBAAmB,EAAE,YA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AkB,OAAO,UAAU,EAAE,cAAc,OAAO,CAAC;AACjE,YAAM,SAAS,MAAM,uBAAuB,OAAO,UAAU,MAAM;AACnE,cAAQ,IAAI,uBAAuB,MAAM;AAAA,IAC3C,SAAS,OAAP;AACA,cAAQ,MAAM,wCAAwC,KAAK;AAAA,IAC7D;AAAA,EACF;AAAA;;;AjD7GO,IAAM,aAAa,MAAM;AAC9B,SAAO;AACT;AAEA,IAAI,OAAO,WAAW,aAAa;AACjC,EAAC,OAAe,iCAAiC,WAAW;AAC9D;",
6
- "names": ["EventEmitter", "import_chains", "import_react", "import_react", "sendBitcoin", "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", "_a", "sendBitcoin", "options", "smartAccount", "connector", "accounts", "_b", "import_react", "import_jsx_runtime", "Modal", "import_jsx_runtime", "Modal", "import_react", "import_jsx_runtime", "React", "sendBitcoin", "import_utils", "_a", "_0", "transactions", "bs58", "result", "wallet", "import_near_api_js", "Big"]
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/core/btcWalletSelectorContext.tsx", "../src/components/confirmBox/Modal.tsx", "../src/components/confirmBox/index.tsx", "../src/core/setupBTCWallet.ts", "../src/utils/initWalletButton.ts", "../src/config.ts", "../src/utils/request.ts", "../src/core/bridgeSupplyUtils.ts"],
4
+ "sourcesContent": ["export * from './connector';\nexport { ConnectProvider } from './context';\nexport * from './hooks';\nexport * from './core/btcWalletSelectorContext';\nexport * from './core/setupBTCWallet';\nexport * from './core/bridgeSupplyUtils';\nexport const getVersion = () => {\n return '0.2.7';\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';\n\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: (\n toAddress: string,\n satoshis: number,\n options?: { feeRate: number },\n ) => Promise<string>;\n accountContract: AccountContract;\n setAccountContract: (accountContract: AccountContract) => void;\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 {\n closeModal: closeSignModal,\n isModalOpen: signModalOpen,\n openModal: openSignModal,\n } = 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[\n Object.keys(options.aaOptions.accountContracts)?.[0] || 'BTC'\n ]?.[0].version || '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 !==\n accountContract.version ||\n (window as any)?.__bitcoinSmartAccount.smartAccountContract.name !==\n accountContract.name))\n ) {\n const smartAccount = new SmartAccount(\n new AASignerProvider(\n evmSupportChainIds,\n options.projectId,\n options.clientKey,\n options.rpcUrls,\n ) 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 const requestAccount = useCallback(\n async (connector: BaseConnector) => {\n let accounts = await connector.getAccounts();\n if (accounts.length === 0 && autoConnect) {\n accounts = await connector.requestAccounts();\n }\n setAccounts(accounts);\n },\n [autoConnect],\n );\n\n const requestDirectAccount = useCallback(async (connector: BaseConnector) => {\n let accounts = await connector.getAccounts();\n if (accounts.length === 0) {\n accounts = await connector.requestAccounts();\n }\n setAccounts(accounts);\n\n return accounts;\n }, []);\n\n useEffect(() => {\n if (connector) {\n requestAccount(connector).catch((e: any) => {\n console.error('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 }}\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 {\n SendTransactionParams,\n Transaction,\n UserOpBundle,\n UserOpParams,\n} 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\nexport const useETHProvider: any = () => {\n const { evmAccount, smartAccount } = 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(\n sendUserOp,\n smartAccount?.provider as any,\n evmAccount,\n );\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 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 = ({\n open,\n onClose,\n onOpen,\n}: {\n open: boolean;\n onClose: () => void;\n onOpen: () => void;\n}) => {\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<\n EVMDeserializeTransactionResult[] | undefined\n >();\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) =>\n BigInt(item.estimatedChanges?.natives?.[0]?.nativeChange?.replace('-', '') || 0),\n )\n .reduce((accumulator, currentValue) => accumulator + currentValue, BigInt(0));\n if (userOpBundle.userOp.paymasterAndData.length > 2) {\n setDisabled(nativeBalance < nativeChange);\n } else {\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\n open={open}\n onClose={onClose}\n isDismissable={false}\n contentClassName={styles.modalContent}\n >\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\n className={\n styles.detailsContent + (deserializeResult || requestArguments ? ` ${styles.fill}` : '')\n }\n >\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)} ${\n chainInfo?.nativeCurrency.symbol\n }`}</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\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 {\n bytesToHex,\n publicToAddress,\n toBytes,\n toChecksumAddress,\n toRpcSig,\n} from '@ethereumjs/util';\nimport type { UserOp } from '@particle-network/aa';\nimport bitcore from 'bitcore-lib';\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) +\n BigInt(userOp.verificationGasLimit) +\n BigInt(userOp.preVerificationGas)) *\n BigInt(userOp.maxFeePerGas)\n );\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 '../components/confirmBox';\nimport { delay } from '../utils';\n\nconst WalletSelectorContext = React.createContext<any>(null);\n\nexport function BtcWalletSelectorContextProvider({\n children,\n autoConnect = false,\n}: {\n children: React.ReactNode;\n autoConnect?: boolean;\n}) {\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 (\n <WalletSelectorContext.Provider value={walletSelectorContextValue}>\n <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 autoConnect={false}\n connectors={[new UnisatConnector()]}\n >\n {children}\n {isProcessing && (\n <ComfirmBox\n hash={''}\n status={0}\n onClose={() => {\n setIsProcessing(false);\n }}\n />\n )}\n <InitBtcWalletSelectorContext />\n </BTCConnectProvider>\n </WalletSelectorContext.Provider>\n );\n}\n\nfunction InitBtcWalletSelectorContext() {\n const context = useBtcWalletSelector();\n useEffect(() => {\n window.btcContext = context;\n }, [context]);\n return null;\n}\n\nexport function useBtcWalletSelector() {\n // @ts-ignore\n const { openConnectModal, openConnectModalAsync, disconnect, requestDirectAccount } =\n useConnectModal();\n const { accounts, sendBitcoin, getPublicKey, provider, signMessage, connector } =\n 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 const account = accounts && accounts.length ? accounts[0] : null;\n if (account) {\n return account;\n }\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 delay(500);\n if (times++ > 10) {\n return null;\n }\n }\n requestDirectAccount(connectorRef.current).catch((e: any) => {\n context.emit('btcLoginError');\n });\n },\n logout: () => {\n disconnect && disconnect();\n context.emit('btcLogOut');\n },\n account: accounts && accounts.length ? accounts[0] : null,\n getPublicKey: async () => {\n let times = 0;\n while (!publicKey.current) {\n await delay(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 delay(500);\n if (times++ > 10) {\n return null;\n }\n }\n\n const { total } = await providerRef.current.getBalance();\n return total;\n },\n sendBitcoin,\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 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 '../utils/initWalletButton';\nimport type { useBtcWalletSelector } from './btcWalletSelectorContext';\nimport { delay } from '../utils';\nimport { walletConfig, nearRpcUrls } from '../config';\nimport request from '../utils/request';\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 syncLogOut?: boolean;\n isDev?: boolean;\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 const currentConfig =\n 'isDev' in metadata && metadata.isDev\n ? walletConfig.dev\n : walletConfig[options.network.networkId];\n const walletNetwork = 'isDev' in metadata && metadata.isDev ? 'dev' : options.network.networkId;\n\n initWalletButton(walletNetwork, wallet);\n\n if (!inter) {\n inter = setInterval(async () => {\n // @ts-ignore\n const btcContext = window.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(walletNetwork, 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 context.on('btcLogOut', async (e: any) => {\n emitter.emit('accountsChanged', {\n accounts: [],\n });\n });\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 = await provider.query<any>({\n request_type: 'call_function',\n account_id: currentConfig.contractId,\n method_name: method,\n args_base64: Buffer.from(JSON.stringify(args)).toString('base64'),\n finality: 'optimistic',\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 const accountId = state.getAccount();\n const publicKey = state.getPublicKey();\n\n const btcContext = window.btcContext;\n\n initWalletButton(walletNetwork, 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 // @ts-ignore\n if (metadata.syncLogOut) {\n btcContext.logout();\n }\n\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(currentConfig.base_url, 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(currentConfig.base_url, 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: currentConfig.token,\n gas_limit: '3000',\n use_near_pay_gas: false,\n nonce,\n };\n\n const nearAccount = await provider.query<any>({\n request_type: 'view_account',\n account_id: accountId,\n finality: 'final',\n });\n const availableBalance = parseFloat(nearAccount.amount) / 10 ** 24;\n if (availableBalance > 0.2) {\n intention.use_near_pay_gas = true;\n }\n\n const strIntention = JSON.stringify(intention);\n\n const signature = await btcContext.signMessage(strIntention);\n\n const result = await uploadBTCTx(currentConfig.base_url, {\n sig: signature,\n btcPubKey: state.getBtcPublicKey(),\n data: toHex(strIntention),\n });\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:', {\n nearAccountId: accountId,\n btcAccountId: btcContext.account,\n });\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(url: string, accountId: string) {\n return request<any>(`${url}/v1/nonce?csna=${accountId}`);\n}\n\nfunction getNearNonceFromApi(url: string, accountId: string) {\n return request<any>(`${url}/v1/nonceNear?csna=${accountId}`);\n}\n\nfunction uploadBTCTx(url: string, data: any) {\n return request<any>(`${url}/v1/receiveTransaction`, {\n method: 'POST',\n body: data,\n });\n}\n\nexport function setupBTCWallet({\n iconUrl = 'https://assets.deltatrade.ai/assets/chain/btc.svg',\n deprecated = false,\n autoConnect = true,\n syncLogOut = true,\n isDev = false,\n}: BTCWalletParams | undefined = {}): WalletModuleFactory<InjectedWallet> {\n const btcWallet = 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 syncLogOut,\n isDev,\n },\n init: BTCWallet,\n } as any;\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\nasync function pollTransactionStatuses(network: string, hashes: string[]) {\n const provider = new providers.FailoverRpcProvider(\n Object.values(nearRpcUrls[network as keyof typeof nearRpcUrls]).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 setupBTCWallet,\n};\n", "import type { Wallet } from '@near-wallet-selector/core';\n\ninterface OriginalWallet {\n account: string | null;\n getPublicKey: () => Promise<string>;\n}\n\nconst walletUrlConfig: { [key: string]: string } = {\n dev: 'https://wallet-dev.satoshibridge.top',\n testnet: 'https://wallet-test.satoshibridge.top',\n mainnet: 'https://wallet.satoshibridge.top',\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: walletUrlConfig[network],\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 border: 'none',\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\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", "export const walletConfig: Record<\n string,\n {\n base_url: string;\n token: string;\n contractId: string;\n walletUrl: string;\n }\n> = {\n dev: {\n base_url: 'https://api.dev.satoshibridge.top',\n token: 'nbtc1-nsp.testnet',\n contractId: 'dev1-nsp.testnet',\n walletUrl: 'https://wallet-dev.satoshibridge.top',\n },\n testnet: {\n base_url: 'https://api.testnet.satoshibridge.top',\n token: 'nbtc2-nsp.testnet',\n contractId: 'dev2-nsp.testnet',\n walletUrl: 'https://wallet-test.satoshibridge.top',\n },\n mainnet: {\n base_url: 'https://api.mainnet.satoshibridge.top',\n token: '',\n contractId: '',\n walletUrl: 'https://wallet.satoshibridge.top',\n },\n};\n\nexport const nearRpcUrls = {\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\nexport const btcRpcUrls = {\n mainnet: 'https://mempool.space/api',\n testnet: 'https://mempool.space/testnet/api',\n};\n", "interface RequestOptions<T> extends RequestInit {\n body?: RequestInit['body'] | any;\n retryCount?: number;\n timeout?: number;\n cacheTimeout?: number;\n pollingInterval?: number;\n maxPollingAttempts?: number;\n shouldStopPolling?: (response: T) => boolean;\n}\n\nconst cache = new Map<string, { timestamp: number; data: any }>();\n\nconst defaultCacheTimeout = 3000;\n\nexport default async function request<T>(url: string, options?: RequestOptions<T>): Promise<T> {\n const defaultHeaders = {\n 'Content-Type': 'application/json',\n };\n\n const cacheTimeout = options?.cacheTimeout || defaultCacheTimeout;\n\n const headers = {\n ...defaultHeaders,\n ...options?.headers,\n };\n\n let body = options?.body;\n if (headers['Content-Type'] === 'application/json' && body && typeof body !== 'string') {\n body = JSON.stringify(body);\n }\n\n const method = options?.method || 'GET';\n const cacheKey = method.toUpperCase() === 'GET' ? url : null;\n\n if (cacheKey) {\n const cached = cache.get(cacheKey);\n const isCacheValid = cached && Date.now() - cached.timestamp < cacheTimeout;\n if (isCacheValid) {\n return Promise.resolve(cached.data as T);\n }\n }\n\n const newOptions: RequestInit = {\n ...options,\n headers,\n body,\n method,\n };\n\n const retryCount = options?.retryCount ?? 1;\n\n const controller = new AbortController();\n const timeout = options?.timeout || 20000;\n const timeoutId = setTimeout(() => controller.abort(), timeout);\n\n try {\n const res = await fetch(url, { ...newOptions, signal: controller.signal }).finally(() =>\n clearTimeout(timeoutId),\n );\n\n if (!res.ok) throw new Error(res.statusText);\n const data = await res.json();\n\n if (cacheKey) {\n cache.set(cacheKey, { timestamp: Date.now(), data });\n setTimeout(() => {\n cache.delete(cacheKey);\n }, cacheTimeout);\n }\n\n if (options?.shouldStopPolling && options.shouldStopPolling(data)) {\n return data as T;\n }\n\n return data as T;\n } catch (err) {\n console.error(err);\n if (retryCount > 0) {\n console.log(`Retrying... attempts left: ${retryCount}`);\n return request(url, { ...options, retryCount: retryCount - 1 });\n } else if (options?.pollingInterval && options?.maxPollingAttempts) {\n if (options.maxPollingAttempts > 0) {\n console.log(`Polling... attempts left: ${options.maxPollingAttempts}`);\n await new Promise((resolve) => setTimeout(resolve, options.pollingInterval));\n return request(url, {\n ...options,\n maxPollingAttempts: options.maxPollingAttempts - 1,\n retryCount: retryCount,\n });\n }\n }\n return Promise.reject(err);\n }\n}\n", "import { providers } from 'near-api-js';\nimport Big from 'big.js';\nimport { walletConfig, btcRpcUrls, nearRpcUrls } from '../config';\nimport request from '../utils/request';\n\nasync function nearViewMethod<T>(\n contractId: string,\n methodName: string,\n args: any,\n network: string,\n): Promise<T> {\n const nearProvider = new providers.FailoverRpcProvider(\n nearRpcUrls[network as keyof typeof nearRpcUrls].map(\n (url) => new providers.JsonRpcProvider({ url }),\n ),\n );\n const res: any = await nearProvider.query({\n request_type: 'call_function',\n account_id: contractId,\n method_name: methodName,\n args_base64: Buffer.from(JSON.stringify(args)).toString('base64'),\n finality: 'optimistic',\n });\n return JSON.parse(Buffer.from(res.result).toString());\n}\n\nasync function getDepositAddress(\n btcPublicKey: string,\n contractId: string,\n network: string,\n): Promise<string> {\n const res = await nearViewMethod<string>(\n contractId,\n 'get_user_dapp_deposit_address',\n {\n deposit_type: {\n BtcPublicKey: { btc_public_key: btcPublicKey, dapp_operation: 'Burrowland->Supply' },\n },\n },\n network,\n );\n return res;\n}\n\nasync function getGasPrice(network: string): Promise<number> {\n const defaultFeeRate = 100;\n try {\n const btcRpcUrl = btcRpcUrls[network as keyof typeof btcRpcUrls];\n const res = await fetch(`${btcRpcUrl}/v1/fees/recommended`).then((res) => res.json());\n const feeRate = res.fastestFee;\n return feeRate || defaultFeeRate;\n } catch (error) {\n return defaultFeeRate;\n }\n}\n\nasync function sendBitcoin(\n btcProvider: any,\n address: string,\n amount: string,\n feeRate: number,\n): Promise<string> {\n const satoshis = new Big(amount).mul(10 ** 8).toNumber();\n const txHash = await btcProvider.sendBitcoin(address, satoshis, { feeRate });\n return txHash;\n}\n\nasync function receiveDepositMsg(\n baseUrl: string,\n {\n btcPublicKey,\n txHash,\n depositType = 1,\n }: { btcPublicKey: string; txHash: string; depositType?: number },\n) {\n const res = await request<any>(`${baseUrl}/v1/receiveDepositMsg`, {\n method: 'POST',\n body: { btcPublicKey, txHash, depositType },\n });\n return res;\n}\n\nasync function checkTransactionStatus(baseUrl: string, txHash: string) {\n const res = await request<any>(`${baseUrl}/v1/bridgeFromTx?fromTxHash=${txHash}`, {\n timeout: 60000,\n pollingInterval: 5000,\n maxPollingAttempts: 10,\n shouldStopPolling: (res) => res.result_code === 0,\n });\n return res;\n}\n\ninterface ExecuteBurrowSupplyParams {\n /** btc amount, e.g. 0.01 */\n amount: string;\n /** fee rate, if not provided, will use the recommended fee rate from the btc node */\n feeRate?: number;\n /** environment, default is mainnet */\n environment?: 'dev' | 'testnet' | 'mainnet';\n}\n\nexport async function executeBurrowSupply({\n amount,\n feeRate,\n environment = 'mainnet',\n}: ExecuteBurrowSupplyParams): Promise<void> {\n try {\n if (typeof window === 'undefined' || !window.btcContext) {\n throw new Error('BTC Provider is not initialized.');\n }\n const btcProvider = window.btcContext;\n\n const network = environment === 'dev' ? 'testnet' : environment;\n\n const config = walletConfig[environment];\n\n const btcPublicKey = await btcProvider.getPublicKey();\n\n if (!btcPublicKey) {\n throw new Error('BTC Public Key is not available.');\n }\n\n const address = await getDepositAddress(btcPublicKey, config.contractId, network);\n const _feeRate = feeRate || (await getGasPrice(network));\n console.log('feeRate', _feeRate);\n const txHash = await sendBitcoin(btcProvider, address, amount, _feeRate);\n const receiveDepositMsgRes = await receiveDepositMsg(config.base_url, { btcPublicKey, txHash });\n console.log('receiveDepositMsg resp:', receiveDepositMsgRes);\n const checkTransactionStatusRes = await checkTransactionStatus(config.base_url, txHash);\n console.log('checkTransactionStatus resp:', checkTransactionStatusRes);\n } catch (error) {\n console.error('Error executing Bridge+BurrowSupply:', error);\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOO,IAAe,gBAAf,MAA6B;AAoBpC;;;;;;ACzBO,IAAe,oBAAf,cAAyC,cAAc;AAAA,EAC5D,YAAoB,YAAoB;AAH1C;AAII,UAAM;AADY;AAElB,UAAM,SAAQ,UAAK,eAAL,mBAAiB,MAAM;AACrC,QAAI,CAAC,KAAK,cAAc,MAAM,SAAS,GAAG;AACxC,YAAM,IAAI,MAAM,+BAA+B;AAAA,IACjD;AAAA,EACF;AAAA,EACA,UAAmB;AACjB,QAAI,OAAO,WAAW,aAAa;AACjC,YAAM,QAAQ,KAAK,WAAW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yB;AAAA,IACvE,SAAS,OAAP;AACA,cAAQ,MAAM,wCAAwC,KAAK;AAAA,IAC7D;AAAA,EACF;AAAA;;;AhD/HO,IAAM,aAAa,MAAM;AAC9B,SAAO;AACT;AAEA,IAAI,OAAO,WAAW,aAAa;AACjC,EAAC,OAAe,iCAAiC,WAAW;AAC9D;",
6
+ "names": ["EventEmitter", "import_chains", "import_react", "import_react", "sendBitcoin", "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", "_a", "sendBitcoin", "options", "smartAccount", "connector", "accounts", "_b", "import_react", "import_jsx_runtime", "Modal", "import_jsx_runtime", "Modal", "import_jsx_runtime", "React", "sendBitcoin", "import_utils", "_a", "_0", "transactions", "bs58", "result", "wallet", "import_near_api_js", "res", "Big"]
7
7
  }