{"_id":"@aspect3/funs-wallet-sdk","name":"@aspect3/funs-wallet-sdk","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@aspect3/funs-wallet-sdk","version":"1.0.0","description":"Official SDK for connecting dApps to FunS Wallet — supports Chrome Extension and mobile deep link","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","scripts":{"build":"tsc","clean":"rm -rf dist","prepublishOnly":"npm run clean && npm run build"},"keywords":["funs-wallet","web3","ethereum","bsc","wallet","sdk","eip-1193","dapp","blockchain","crypto"],"author":{"name":"FunS Team"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/tololalo/funs-platform.git"},"homepage":"https://tololalo.github.io/funs-platform/","devDependencies":{"typescript":"^5.4.0"},"peerDependencies":{},"engines":{"node":">=16.0.0"},"_id":"@aspect3/funs-wallet-sdk@1.0.0","bugs":{"url":"https://github.com/tololalo/funs-platform/issues"},"_nodeVersion":"25.9.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-6IZOy+xKmkVM9BFbGmg6AwqV5kskxWfbM82hF9/olygClGx4fYhKMgdYyaLf4za2SxGq8kx3CHoMJzz8K8PPvg==","shasum":"41a07c41e9ded108474382b897070f0ba1f140d5","tarball":"https://registry.npmjs.org/@aspect3/funs-wallet-sdk/-/funs-wallet-sdk-1.0.0.tgz","fileCount":34,"unpackedSize":88411,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDAL719OZPvvbccry5ftdviNvb5voQBTIFrG4Mq+893oQIgFWSdNbjfNPW+n+qNYLRC5XkVD3yMsjR0HfXJaXDwQaA="}]},"_npmUser":{"name":"funsdev","email":"eirif7396@gmail.com"},"directories":{},"maintainers":[{"name":"funsdev","email":"eirif7396@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/funs-wallet-sdk_1.0.0_1777690532158_0.6021471267388607"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-02T02:55:32.059Z","1.0.0":"2026-05-02T02:55:32.298Z","modified":"2026-05-02T02:55:32.539Z"},"maintainers":[{"name":"funsdev","email":"eirif7396@gmail.com"}],"description":"Official SDK for connecting dApps to FunS Wallet — supports Chrome Extension and mobile deep link","homepage":"https://tololalo.github.io/funs-platform/","keywords":["funs-wallet","web3","ethereum","bsc","wallet","sdk","eip-1193","dapp","blockchain","crypto"],"repository":{"type":"git","url":"git+https://github.com/tololalo/funs-platform.git"},"author":{"name":"FunS Team"},"bugs":{"url":"https://github.com/tololalo/funs-platform/issues"},"license":"MIT","readme":"# @aspect3/funs-wallet-sdk\n\nOfficial SDK for connecting dApps to **FunS Wallet** — supports Chrome Extension and mobile deep link.\n\n## Installation\n\n```bash\nnpm install @aspect3/funs-wallet-sdk\n```\n\n## Quick Start\n\n```typescript\nimport { FunsWallet } from '@aspect3/funs-wallet-sdk';\n\nconst wallet = new FunsWallet({\n  appName: 'My dApp',\n  debug: true,\n});\n\n// Connect\nconst { accounts, chainId } = await wallet.connect();\nconsole.log('Connected:', accounts[0], 'on chain', chainId);\n\n// Sign a message\nconst signature = await wallet.signMessage('Hello FunS!');\n\n// Send a transaction\nconst txHash = await wallet.sendTransaction({\n  from: accounts[0],\n  to: '0x...',\n  value: '0x2386F26FC10000', // 0.01 ETH/BNB in wei (hex)\n});\n\n// Listen for events\nwallet.on('accountsChanged', (accounts) => {\n  console.log('Accounts changed:', accounts);\n});\n\nwallet.on('chainChanged', (chainId) => {\n  console.log('Chain changed:', chainId);\n});\n```\n\n## Connection Modes\n\n| Mode | Description |\n|------|-------------|\n| `auto` (default) | Try Chrome Extension first, fall back to deep link on mobile |\n| `extension` | Chrome Extension only |\n| `deeplink` | Mobile app deep link only |\n\n```typescript\n// Force extension mode\nconst wallet = new FunsWallet({ mode: 'extension' });\n\n// Force deep link mode (mobile)\nconst wallet = new FunsWallet({ mode: 'deeplink' });\n```\n\n## API Reference\n\n### Constructor\n\n```typescript\nnew FunsWallet(options?: FunsWalletOptions)\n```\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `mode` | `'auto' \\| 'extension' \\| 'deeplink'` | `'auto'` | Connection mode |\n| `defaultChainId` | `string` | `'0x38'` (BSC) | Default chain ID (hex) |\n| `appName` | `string` | `'dApp'` | Your dApp name |\n| `appIcon` | `string` | `''` | Your dApp icon URL |\n| `timeout` | `number` | `60000` | Request timeout (ms) |\n| `debug` | `boolean` | `false` | Enable debug logs |\n\n### Properties\n\n| Property | Type | Description |\n|----------|------|-------------|\n| `isConnected` | `boolean` | Connection status |\n| `accounts` | `string[]` | Connected accounts |\n| `chainId` | `string` | Current chain ID (hex) |\n| `connectionMode` | `string \\| null` | Active connection mode |\n| `isExtensionAvailable` | `boolean` | Whether extension is installed |\n\n### Methods\n\n#### `connect(): Promise<ConnectResult>`\nConnect to FunS Wallet. Returns accounts and chain ID.\n\n#### `disconnect(): Promise<void>`\nDisconnect from wallet.\n\n#### `getAccounts(): Promise<string[]>`\nGet connected accounts.\n\n#### `getChainId(): Promise<string>`\nGet current chain ID.\n\n#### `switchChain(chainId: string): Promise<void>`\nSwitch to a different chain.\n\n#### `sendTransaction(tx: TransactionRequest): Promise<string>`\nSend a transaction. Returns transaction hash.\n\n#### `signMessage(message: string, address?: string): Promise<string>`\nSign a personal message (EIP-191). Returns signature.\n\n#### `signTypedData(typedData: string | object, address?: string): Promise<string>`\nSign typed data (EIP-712). Returns signature.\n\n#### `request(args: { method: string; params?: any[] }): Promise<any>`\nSend a raw JSON-RPC request.\n\n### Events\n\n```typescript\nwallet.on('connect', ({ chainId }) => { ... });\nwallet.on('disconnect', () => { ... });\nwallet.on('accountsChanged', (accounts: string[]) => { ... });\nwallet.on('chainChanged', (chainId: string) => { ... });\n```\n\n## Supported Chains\n\n| Chain | Chain ID (hex) | Chain ID (dec) |\n|-------|---------------|----------------|\n| BNB Smart Chain | `0x38` | 56 |\n| Ethereum Mainnet | `0x1` | 1 |\n| BSC Testnet | `0x61` | 97 |\n| Ethereum Sepolia | `0xaa36a7` | 11155111 |\n\n## Error Handling\n\n```typescript\nimport { FunsWalletError, UserRejectedError, ProviderNotFoundError } from '@aspect3/funs-wallet-sdk';\n\ntry {\n  await wallet.connect();\n} catch (error) {\n  if (error instanceof ProviderNotFoundError) {\n    console.log('Please install FunS Wallet');\n  } else if (error instanceof UserRejectedError) {\n    console.log('User rejected connection');\n  } else if (error instanceof FunsWalletError) {\n    console.log('Wallet error:', error.code, error.message);\n  }\n}\n```\n\n## Demo\n\nOpen `demo/index.html` in a browser to see the SDK in action.\n\n## Build\n\n```bash\nnpm install\nnpm run build\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-054ec7b0f8984d517472b170507c7be1"}