{"_id":"@0xgery/wallet-sdk","_rev":"6-e21f46bd220ae17ce29bde44b0c8c158","name":"@0xgery/wallet-sdk","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.0-dev":{"name":"@0xgery/wallet-sdk","version":"0.1.0-dev","keywords":["octra","wallet","blockchain","dapp","web3","sdk","extension","unofficial","community"],"author":{"name":"NullxGery","email":"0xgery@proton.me"},"license":"MIT","_id":"@0xgery/wallet-sdk@0.1.0-dev","maintainers":[{"name":"0xgery","email":"0xgery@proton.me"}],"homepage":"https://github.com/0xGery/Octra#readme","bugs":{"url":"https://github.com/0xGery/Octra/issues"},"dist":{"shasum":"4363d2e7f217ba05920f8887f706f6ed68e873da","tarball":"https://registry.npmjs.org/@0xgery/wallet-sdk/-/wallet-sdk-0.1.0-dev.tgz","fileCount":9,"integrity":"sha512-Pefo1IepK185EddiRueU/mvmW+XOAhzLWGxNXMPrUR7u7aOnGnPzxg61WU9y5653wvCQhkhwcWweI7rhhXUsxg==","signatures":[{"sig":"MEQCIDxAbJtbb7bOIKFXTqoLLBi8PJIobKFps1poZKtghYVVAiAYTFgSaOLPhbLvZlAtqBwABWoC7U/kdO7z0g3jr/Kh4g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":195008},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.esm.js","browser":"dist/index.umd.js","engines":{"node":">=16.0.0"},"gitHead":"697fab7a4eac040b121f270a141d78b409756edd","scripts":{"dev":"rollup -c -w","lint":"eslint src/**/*.ts","test":"jest","build":"rollup -c","prepare":"npm run build","typecheck":"tsc --noEmit"},"_npmUser":{"name":"0xgery","email":"0xgery@proton.me"},"repository":{"url":"git+https://github.com/0xGery/Octra.git","type":"git","directory":"wallet-sdk"},"_npmVersion":"10.8.2","description":"TypeScript SDK for integrating with Octra Wallet Extension","directories":{},"_nodeVersion":"20.19.4","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","tslib":"^2.6.2","eslint":"^8.57.0","rollup":"^4.12.0","typescript":"^5.3.3","@types/jest":"^29.5.12","rollup-plugin-dts":"^6.1.0","@rollup/plugin-replace":"^6.0.2","@rollup/plugin-typescript":"^11.1.6","@typescript-eslint/parser":"^6.21.0","@typescript-eslint/eslint-plugin":"^6.21.0"},"_npmOperationalInternal":{"tmp":"tmp/wallet-sdk_0.1.0-dev_1756178812227_0.6564832436670838","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.1.1-dev":{"name":"@0xgery/wallet-sdk","version":"0.1.1-dev","keywords":["octra","wallet","blockchain","dapp","web3","sdk","extension","unofficial","community"],"author":{"name":"NullxGery","email":"0xgery@proton.me"},"license":"MIT","_id":"@0xgery/wallet-sdk@0.1.1-dev","maintainers":[{"name":"0xgery","email":"0xgery@proton.me"}],"homepage":"https://github.com/0xGery/Octra#readme","bugs":{"url":"https://github.com/0xGery/Octra/issues"},"dist":{"shasum":"1379cbec31db46266553ecf742f165462a04c784","tarball":"https://registry.npmjs.org/@0xgery/wallet-sdk/-/wallet-sdk-0.1.1-dev.tgz","fileCount":9,"integrity":"sha512-SAsg8GP09CzV3CWEeMO75ICn9Gzio3c6ERU9YjFXDyd+/Dq4DEXvveMq/gYQESrgG8uURWX/k0MbWPofCBh20Q==","signatures":[{"sig":"MEYCIQDayV0TcwwrlTsw24cvBdK3GY4pXjAbJuHMdpbInm+A+AIhAJE1phJWoasMDf4nL/qDLzZW2nEKMTKEjLYs/1sDcdSn","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":195021},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.esm.js","browser":"dist/index.umd.js","engines":{"node":">=16.0.0"},"gitHead":"697fab7a4eac040b121f270a141d78b409756edd","scripts":{"dev":"rollup -c -w","lint":"eslint src/**/*.ts","test":"jest","build":"rollup -c","prepare":"npm run build","typecheck":"tsc --noEmit"},"_npmUser":{"name":"0xgery","email":"0xgery@proton.me"},"repository":{"url":"git+https://github.com/0xGery/Octra.git","type":"git","directory":"wallet-sdk"},"_npmVersion":"10.8.2","description":"TypeScript SDK for integrating with Octra Wallet Extension","directories":{},"_nodeVersion":"20.19.4","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","tslib":"^2.6.2","eslint":"^8.57.0","rollup":"^4.12.0","typescript":"^5.3.3","@types/jest":"^29.5.12","rollup-plugin-dts":"^6.1.0","@rollup/plugin-replace":"^6.0.2","@rollup/plugin-typescript":"^11.1.6","@typescript-eslint/parser":"^6.21.0","@typescript-eslint/eslint-plugin":"^6.21.0"},"_npmOperationalInternal":{"tmp":"tmp/wallet-sdk_0.1.1-dev_1756178883300_0.011316724844639525","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.1.2-dev":{"name":"@0xgery/wallet-sdk","version":"0.1.2-dev","keywords":["octra","wallet","blockchain","dapp","web3","sdk","extension","unofficial","community"],"author":{"name":"NullxGery","email":"0xgery@proton.me"},"license":"MIT","_id":"@0xgery/wallet-sdk@0.1.2-dev","maintainers":[{"name":"0xgery","email":"0xgery@proton.me"}],"homepage":"https://github.com/0xGery/Octra#readme","bugs":{"url":"https://github.com/0xGery/Octra/issues"},"dist":{"shasum":"2be3936903fa879845baa15099a2277963becf94","tarball":"https://registry.npmjs.org/@0xgery/wallet-sdk/-/wallet-sdk-0.1.2-dev.tgz","fileCount":9,"integrity":"sha512-l8Pqm0Al2qD0fm4/801vyy192kMYszo5dCMSJalVh7vg6CNKBUnCIHQvOVdO6nPrJbSjRkfkV03U2mflQlwlkg==","signatures":[{"sig":"MEYCIQD+UQ37FRwluDdnANNGfVkItcSct2enHy9R54lxr0xjGwIhAII+UwkELUJDwfVQPxsCx6oLuxydf5SthlVpRYqc1hvX","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":183398},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.esm.js","browser":"dist/index.umd.js","engines":{"node":">=16.0.0"},"gitHead":"a5723be7f04251aa5fa6d3598e42d8f9747bbce3","scripts":{"dev":"rollup -c -w","lint":"eslint src/**/*.ts","test":"jest","build":"rollup -c","prepare":"npm run build","typecheck":"tsc --noEmit"},"_npmUser":{"name":"0xgery","email":"0xgery@proton.me"},"repository":{"url":"git+https://github.com/0xGery/Octra.git","type":"git","directory":"wallet-sdk"},"_npmVersion":"10.8.2","description":"TypeScript SDK for integrating with Octra Wallet Extension","directories":{},"_nodeVersion":"20.19.4","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","tslib":"^2.6.2","eslint":"^8.57.0","rollup":"^4.12.0","typescript":"^5.3.3","@types/jest":"^29.5.12","rollup-plugin-dts":"^6.1.0","@rollup/plugin-replace":"^6.0.2","@rollup/plugin-typescript":"^11.1.6","@typescript-eslint/parser":"^6.21.0","@typescript-eslint/eslint-plugin":"^6.21.0"},"_npmOperationalInternal":{"tmp":"tmp/wallet-sdk_0.1.2-dev_1757085276242_0.5921867192804207","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.2.0":{"name":"@0xgery/wallet-sdk","version":"0.2.0","keywords":["octra","wallet","blockchain","dapp","web3","sdk","extension","unofficial","community"],"author":{"name":"NullxGery","email":"0xgery@proton.me"},"license":"MIT","_id":"@0xgery/wallet-sdk@0.2.0","maintainers":[{"name":"0xgery","email":"0xgery@proton.me"}],"homepage":"https://github.com/0xGery/Octra#readme","bugs":{"url":"https://github.com/0xGery/Octra/issues"},"dist":{"shasum":"2dbe01d04200abafd06e76a94c9e76a6e6710766","tarball":"https://registry.npmjs.org/@0xgery/wallet-sdk/-/wallet-sdk-0.2.0.tgz","fileCount":9,"integrity":"sha512-DaES38J/x5AZIjsZbcEWI9k+qVXG1Jq0QpTf4MUOEnjKIp8FQHiuTJtZ5GWkJoPx0d7BHoHIXtwQjAYXA3FtuA==","signatures":[{"sig":"MEUCIHa1G5t43MxR9VB+IELKO4I4nYm7m9zrsGoS+KKlBpybAiEA9HrHomaXJkJwWOW0eRLyrej+Tay1GP28AuYmKVrJUnc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":300317},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.esm.js","browser":"dist/index.umd.js","engines":{"node":">=16.0.0"},"gitHead":"a5723be7f04251aa5fa6d3598e42d8f9747bbce3","scripts":{"dev":"rollup -c -w","lint":"eslint src/**/*.ts","test":"jest","build":"rollup -c","prepare":"npm run build","typecheck":"tsc --noEmit"},"_npmUser":{"name":"0xgery","email":"0xgery@proton.me"},"repository":{"url":"git+https://github.com/0xGery/Octra.git","type":"git","directory":"wallet-sdk"},"_npmVersion":"10.8.2","description":"TypeScript SDK for integrating with Octra Wallet Extension","directories":{},"_nodeVersion":"20.19.4","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","tslib":"^2.6.2","eslint":"^8.57.0","rollup":"^4.12.0","typescript":"^5.3.3","@types/jest":"^29.5.12","rollup-plugin-dts":"^6.1.0","@rollup/plugin-replace":"^6.0.2","@rollup/plugin-typescript":"^11.1.6","@typescript-eslint/parser":"^6.21.0","@typescript-eslint/eslint-plugin":"^6.21.0"},"_npmOperationalInternal":{"tmp":"tmp/wallet-sdk_0.2.0_1757402978088_0.16444124323823917","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.2.1":{"name":"@0xgery/wallet-sdk","version":"0.2.1","keywords":["octra","wallet","blockchain","dapp","web3","sdk","extension","unofficial","community"],"author":{"name":"NullxGery","email":"0xgery@proton.me"},"license":"MIT","_id":"@0xgery/wallet-sdk@0.2.1","maintainers":[{"name":"0xgery","email":"0xgery@proton.me"}],"homepage":"https://github.com/0xGery/Octra#readme","bugs":{"url":"https://github.com/0xGery/Octra/issues"},"dist":{"shasum":"9018b7e42fcb631f351534c3cd6ec3c069fe3d7f","tarball":"https://registry.npmjs.org/@0xgery/wallet-sdk/-/wallet-sdk-0.2.1.tgz","fileCount":9,"integrity":"sha512-pRR8UuaROdxTUlCx8LN3ysM/QKestEmdIEX480O99JLnX7DYvPn/cvmxJX0JPo+m9sFGkQcHxE1iVUBbCDiK2w==","signatures":[{"sig":"MEQCIEInPmirIRXkDu2fXhw6uVD3Age/fxnu0ykarV3lCMfLAiA1pq3Y4F0dgGSFghLDaXMGExwM51BlGt45Tfazx6AS2g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":303328},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.esm.js","browser":"dist/index.umd.js","engines":{"node":">=16.0.0"},"gitHead":"4a25ec37e51818a9c3d5a9fdb180724d6a949195","scripts":{"dev":"rollup -c -w","lint":"eslint src/**/*.ts","test":"jest","build":"rollup -c","prepare":"npm run build","typecheck":"tsc --noEmit"},"_npmUser":{"name":"0xgery","email":"0xgery@proton.me"},"repository":{"url":"git+https://github.com/0xGery/Octra.git","type":"git","directory":"wallet-sdk"},"_npmVersion":"10.8.2","description":"TypeScript SDK for integrating with Octra Wallet Extension","directories":{},"_nodeVersion":"20.19.4","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","tslib":"^2.6.2","eslint":"^8.57.0","rollup":"^4.12.0","typescript":"^5.3.3","@types/jest":"^29.5.12","rollup-plugin-dts":"^6.1.0","@rollup/plugin-replace":"^6.0.2","@rollup/plugin-typescript":"^11.1.6","@typescript-eslint/parser":"^6.21.0","@typescript-eslint/eslint-plugin":"^6.21.0"},"_npmOperationalInternal":{"tmp":"tmp/wallet-sdk_0.2.1_1757403382774_0.06932316328465471","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."}},"time":{"created":"2025-08-26T03:26:52.125Z","modified":"2025-10-04T15:56:54.872Z","0.1.0-dev":"2025-08-26T03:26:52.424Z","0.1.1-dev":"2025-08-26T03:28:03.519Z","0.1.2-dev":"2025-09-05T15:14:36.437Z","0.2.0":"2025-09-09T07:29:38.263Z","0.2.1":"2025-09-09T07:36:22.962Z"},"bugs":{"url":"https://github.com/0xGery/Octra/issues"},"author":{"name":"NullxGery","email":"0xgery@proton.me"},"license":"MIT","homepage":"https://github.com/0xGery/Octra#readme","keywords":["octra","wallet","blockchain","dapp","web3","sdk","extension","unofficial","community"],"repository":{"url":"git+https://github.com/0xGery/Octra.git","type":"git","directory":"wallet-sdk"},"description":"TypeScript SDK for integrating with Octra Wallet Extension","maintainers":[{"name":"0xgery","email":"0xgery@proton.me"}],"readme":"# Octra Wallet SDK\n\nA comprehensive TypeScript/JavaScript SDK that enables seamless integration between decentralized applications (DApps) and the Octra Wallet browser extension. This toolkit provides developers with a secure, type-safe, and user-friendly way to interact with the Octra blockchain network.\n\n## What is this SDK?\n\nThe Octra Wallet SDK bridges the gap between web applications and blockchain functionality, allowing developers to:\n\n- **Connect to Octra Wallet**: Establish secure connections with users' Octra wallet extensions\n- **Manage Transactions**: Send regular and private transactions with full type safety\n- **Handle Balances**: Read public and encrypted private balance information\n- **Event-Driven Architecture**: React to wallet events like balance changes, network switches, and connection status\n- **Private Features**: Support for Octra's unique private balance encryption and private transfer system\n- **Multi-Framework Support**: Works with React, Vue, Svelte, and vanilla JavaScript applications\n\n## Why use this SDK?\n\n- **Security First**: Only authenticated DApps with proper SDK integration can connect\n- **TypeScript Native**: Full type definitions for better development experience\n- **Smart Extension Detection**: Built-in extension monitoring with automatic retry logic\n- **Event-Driven Architecture**: Real-time updates replace polling for better performance\n- **Robust Error Handling**: Detailed diagnostics with automatic retry and exponential backoff\n- **Framework Agnostic**: Compatible with any JavaScript framework or vanilla JS\n- **Developer Friendly**: Advanced debugging tools and development mode logging\n- **Production Ready**: Clean builds with zero console noise in production\n\n> **Disclaimer**: This is an unofficial, community-built project for the Octra network. It is not affiliated with, endorsed by, or maintained by the official Octra team.\n\n> **Note**: This SDK is developed by NullxGery (0xGery) for the Octra network ecosystem.\n\n## What's New in v0.2.0\n\n**Major Performance & Reliability Improvements:**\n\n- **Built-in Extension Detection**: No more manual polling - SDK automatically detects extension availability\n- **Automatic Retry Logic**: Exponential backoff retry system (3 attempts: 1s → 2s → 4s)  \n- **Enhanced Error Diagnostics**: Detailed failure context with browser/extension state information\n- **Event-Based Communication**: Real-time extension events replace polling for instant updates\n- **Advanced Development Tools**: Rich debugging with browser console utilities\n- **Production-Safe Logging**: Zero console output in production builds\n\n[View Full Changelog](./CHANGELOG.md)\n\n## Quick Start\n\n### Installation\n\n```bash\n# npm\nnpm install @0xgery/wallet-sdk\n\n# yarn\nyarn add @0xgery/wallet-sdk\n\n# CDN (for quick testing)\n<script src=\"https://unpkg.com/@0xgery/wallet-sdk@0.2.0/dist/index.umd.js\"></script>\n```\n\n### Basic Usage\n\n```typescript\nimport { OctraWallet } from '@0xgery/wallet-sdk';\n\n// Create wallet instance\nconst wallet = new OctraWallet({\n  appName: 'My Awesome DApp',\n  appDescription: 'A revolutionary decentralized application',\n  requiredPermissions: ['read_balance', 'send_transactions']\n});\n\n// Initialize and connect\nawait wallet.initialize();\nconst connection = await wallet.connect();\n\nconsole.log('Connected!', connection.address);\n\n// Get balance\nconst balance = await wallet.getBalance();\nconsole.log('Balance:', balance.total, 'OCT');\n\n// Send transaction\nconst result = await wallet.sendTransaction({\n  to: 'recipient_address',\n  amount: 10.5,\n  message: 'Hello from my DApp!'\n});\n\nconsole.log('Transaction sent:', result.txHash);\n```\n\n### Simple Setup (Auto-connect)\n\n```javascript\nimport { createOctraWallet } from '@0xgery/wallet-sdk';\n\nconst wallet = await createOctraWallet({\n  appName: 'My DApp',\n  autoConnect: true,\n  debug: true\n});\n\nif (wallet.isConnected()) {\n  const balance = await wallet.getBalance();\n  console.log('Balance:', balance.total, 'OCT');\n}\n```\n\n## API Reference\n\n### OctraWallet Class\n\n#### Constructor\n\n```typescript\nnew OctraWallet(config: SDKConfig)\n```\n\n**SDKConfig:**\n```typescript\ninterface SDKConfig {\n  appName: string;                    // Required: Your DApp name\n  appDescription?: string;            // App description for user\n  appVersion?: string;               // App version (default: '1.0.0')\n  appUrl?: string;                   // App URL (auto-detected)\n  appIcon?: string;                  // App icon URL\n  requiredPermissions?: Permission[]; // Required permissions\n  networkId?: string;                // Target network ('mainnet', 'testnet')\n  debug?: boolean;                   // Enable debug logging\n}\n```\n\n#### Methods\n\n##### Initialize\n```typescript\nawait wallet.initialize(): Promise<boolean>\n```\nInitialize the SDK. Must be called before any other methods.\n\n##### Connection Management\n```typescript\nawait wallet.connect(options?: ConnectOptions): Promise<ConnectEvent>\nawait wallet.disconnect(): Promise<void>\nwallet.isConnected(): boolean\nwallet.getConnectionInfo(): ConnectionInfo\n```\n\n##### Wallet Information\n```typescript\nwallet.getAddress(): string | null\nawait wallet.getBalance(forceRefresh?: boolean): Promise<Balance>\nawait wallet.getNetworkInfo(): Promise<NetworkInfo>\n```\n\n##### Transactions\n```typescript\nawait wallet.sendTransaction(txData: TransactionData): Promise<TransactionResult>\nawait wallet.getTransactionHistory(page?: number, limit?: number): Promise<TransactionHistory>\n```\n\n##### Private Features\n```typescript\nawait wallet.getPrivateBalanceInfo(): Promise<PrivateBalanceInfo>\nawait wallet.encryptBalance(amount: number): Promise<boolean>\nawait wallet.decryptBalance(amount: number): Promise<boolean>\nawait wallet.sendPrivateTransfer(data: PrivateTransferData): Promise<TransactionResult>\nawait wallet.getPendingPrivateTransfers(): Promise<PendingPrivateTransfer[]>\nawait wallet.claimPrivateTransfer(transferId: string): Promise<TransactionResult>\n```\n\n##### Event Handling\n```typescript\nwallet.on(event: WalletEventType, listener: (data) => void): void\nwallet.off(event: WalletEventType, listener: Function): void\nwallet.once(event: WalletEventType, listener: (data) => void): void\n```\n\n**Events:**\n- `connect` - Wallet connected\n- `disconnect` - Wallet disconnected  \n- `accountChanged` - Account switched\n- `balanceChanged` - Balance updated\n- `networkChanged` - Network switched\n- `transactionConfirmed` - Transaction confirmed\n- `error` - Error occurred\n- `extensionLocked` - Extension was locked\n- `extensionUnlocked` - Extension was unlocked\n\n### Utility Functions\n\nThe SDK now exports useful utility functions:\n\n```typescript\nimport {\n  // Validation utilities\n  isValidAddress,\n  isValidAmount,\n  isValidMessage,\n  isValidFeeLevel,\n  isValidNetworkId,\n  \n  // Formatting utilities  \n  formatOCT,\n  formatAddress,\n  formatTimestamp,\n  formatTxHash,\n  \n  // Conversion utilities\n  toMicroOCT,\n  fromMicroOCT,\n  \n  // Error utilities\n  createErrorMessage,\n  isErrorType,\n  \n  // Async utilities\n  delay,\n  retry,\n  withTimeout,\n  \n  // Browser utilities\n  isBrowser,\n  checkBrowserSupport,\n  \n  // Development utilities\n  generateMockData,\n  createLogger\n} from '@0xgery/wallet-sdk';\n\n// Example usage\nconst isValid = isValidAddress('OCTxyz123...');\nconst formatted = formatOCT(123.456789, 2); // \"123.46\"\nconst shortAddr = formatAddress('OCTxyz123...abc', 6, 4); // \"OCTxyz...abc\"\n```\n\n### Development & Debugging Tools\n\nThe SDK includes advanced debugging tools available in development environments:\n\n```javascript\n// Available at window.__OCTRA_SDK_UTILS__ in development\nwindow.__OCTRA_SDK_UTILS__.enableDebugMode();   // Enable detailed logging\nwindow.__OCTRA_SDK_UTILS__.disableDebugMode();  // Disable logging\nwindow.__OCTRA_SDK_UTILS__.getSDKInfo();        // Get SDK version info\nwindow.__OCTRA_SDK_UTILS__.simulateExtensionEvent('balanceChanged', data); // Test events\nwindow.__OCTRA_SDK_UTILS__.showWelcome();       // Show SDK welcome message\n```\n\n**Automatic Development Detection:**\n- Localhost and development domains automatically enable debug utilities\n- Rich console output with grouped logging and clear indicators  \n- Extension state monitoring and diagnostics\n- Event simulation for testing\n- Zero production overhead\n\n## Integration Examples\n\n### React Integration\n\n```jsx\nimport React, { useState, useEffect } from 'react';\nimport { OctraWallet, createOctraWallet } from '@0xgery/wallet-sdk';\n\nfunction WalletConnector() {\n  const [wallet, setWallet] = useState(null);\n  const [connected, setConnected] = useState(false);\n  const [address, setAddress] = useState('');\n  const [balance, setBalance] = useState(0);\n\n  useEffect(() => {\n    async function initWallet() {\n      try {\n        const walletInstance = await createOctraWallet({\n          appName: 'My React DApp',\n          debug: process.env.NODE_ENV === 'development'\n        });\n\n        // Setup event listeners\n        walletInstance.on('connect', (event) => {\n          setConnected(true);\n          setAddress(event.address);\n          setBalance(event.balance.total);\n        });\n\n        walletInstance.on('disconnect', () => {\n          setConnected(false);\n          setAddress('');\n          setBalance(0);\n        });\n\n        walletInstance.on('balanceChanged', (event) => {\n          setBalance(event.newBalance.total);\n        });\n\n        setWallet(walletInstance);\n      } catch (error) {\n        console.error('Failed to initialize wallet:', error);\n      }\n    }\n\n    initWallet();\n  }, []);\n\n  const connect = async () => {\n    try {\n      await wallet.connect();\n    } catch (error) {\n      alert('Connection failed: ' + error.message);\n    }\n  };\n\n  const sendTransaction = async () => {\n    try {\n      const result = await wallet.sendTransaction({\n        to: 'recipient_address',\n        amount: 1,\n        message: 'Test from React DApp'\n      });\n      alert('Transaction sent: ' + result.txHash);\n    } catch (error) {\n      alert('Transaction failed: ' + error.message);\n    }\n  };\n\n  return (\n    <div>\n      <h2>Octra Wallet Integration</h2>\n      \n      {!connected ? (\n        <button onClick={connect} disabled={!wallet}>\n          {wallet ? 'Connect Wallet' : 'Loading...'}\n        </button>\n      ) : (\n        <div>\n          <p>Connected: {address}</p>\n          <p>Balance: {balance} OCT</p>\n          <button onClick={() => wallet.disconnect()}>Disconnect</button>\n          <button onClick={sendTransaction}>Send Test Transaction</button>\n        </div>\n      )}\n    </div>\n  );\n}\n\nexport default WalletConnector;\n```\n\n### Vue.js Integration\n\n```vue\n<template>\n  <div>\n    <h2>Octra Wallet Integration</h2>\n    \n    <div v-if=\"!connected\">\n      <button @click=\"connect\" :disabled=\"!wallet\">\n        {{ wallet ? 'Connect Wallet' : 'Loading...' }}\n      </button>\n    </div>\n    \n    <div v-else>\n      <p>Connected: {{ address }}</p>\n      <p>Balance: {{ balance }} OCT</p>\n      <button @click=\"disconnect\">Disconnect</button>\n      <button @click=\"sendTransaction\">Send Test Transaction</button>\n    </div>\n  </div>\n</template>\n\n<script>\nimport { createOctraWallet } from '@0xgery/wallet-sdk';\n\nexport default {\n  data() {\n    return {\n      wallet: null,\n      connected: false,\n      address: '',\n      balance: 0\n    };\n  },\n  \n  async mounted() {\n    try {\n      this.wallet = await createOctraWallet({\n        appName: 'My Vue DApp',\n        debug: process.env.NODE_ENV === 'development'\n      });\n\n      // Setup event listeners\n      this.wallet.on('connect', (event) => {\n        this.connected = true;\n        this.address = event.address;\n        this.balance = event.balance.total;\n      });\n\n      this.wallet.on('disconnect', () => {\n        this.connected = false;\n        this.address = '';\n        this.balance = 0;\n      });\n    } catch (error) {\n      console.error('Failed to initialize wallet:', error);\n    }\n  },\n  \n  methods: {\n    async connect() {\n      try {\n        await this.wallet.connect();\n      } catch (error) {\n        alert('Connection failed: ' + error.message);\n      }\n    },\n    \n    async disconnect() {\n      await this.wallet.disconnect();\n    },\n    \n    async sendTransaction() {\n      try {\n        const result = await this.wallet.sendTransaction({\n          to: 'recipient_address',\n          amount: 1,\n          message: 'Test from Vue DApp'\n        });\n        alert('Transaction sent: ' + result.txHash);\n      } catch (error) {\n        alert('Transaction failed: ' + error.message);\n      }\n    }\n  }\n};\n</script>\n```\n\n### Vanilla JavaScript Integration\n\n```html\n<!DOCTYPE html>\n<html>\n<head>\n    <title>Octra Wallet Integration</title>\n    <script src=\"https://unpkg.com/@0xgery/wallet-sdk/dist/index.umd.js\"></script>\n</head>\n<body>\n    <div id=\"app\">\n        <h2>Octra Wallet Integration</h2>\n        <div id=\"connection-status\">Loading...</div>\n        <button id=\"connect-btn\" style=\"display: none;\">Connect Wallet</button>\n        <button id=\"disconnect-btn\" style=\"display: none;\">Disconnect</button>\n        <button id=\"send-btn\" style=\"display: none;\">Send Transaction</button>\n    </div>\n\n    <script>\n        let wallet;\n        \n        async function initWallet() {\n            try {\n                wallet = await OctraWalletSDK.createOctraWallet({\n                    appName: 'My Vanilla JS DApp',\n                    debug: true\n                });\n\n                // Setup event listeners\n                wallet.on('connect', (event) => {\n                    document.getElementById('connection-status').textContent = \n                        `Connected: ${event.address} (${event.balance.total} OCT)`;\n                    document.getElementById('connect-btn').style.display = 'none';\n                    document.getElementById('disconnect-btn').style.display = 'inline';\n                    document.getElementById('send-btn').style.display = 'inline';\n                });\n\n                wallet.on('disconnect', () => {\n                    document.getElementById('connection-status').textContent = 'Disconnected';\n                    document.getElementById('connect-btn').style.display = 'inline';\n                    document.getElementById('disconnect-btn').style.display = 'none';\n                    document.getElementById('send-btn').style.display = 'none';\n                });\n\n                // Show connect button\n                document.getElementById('connection-status').textContent = 'Ready to connect';\n                document.getElementById('connect-btn').style.display = 'inline';\n                \n            } catch (error) {\n                document.getElementById('connection-status').textContent = 'Error: ' + error.message;\n                console.error('Failed to initialize wallet:', error);\n            }\n        }\n\n        // Event handlers\n        document.getElementById('connect-btn').addEventListener('click', async () => {\n            try {\n                await wallet.connect();\n            } catch (error) {\n                alert('Connection failed: ' + error.message);\n            }\n        });\n\n        document.getElementById('disconnect-btn').addEventListener('click', async () => {\n            await wallet.disconnect();\n        });\n\n        document.getElementById('send-btn').addEventListener('click', async () => {\n            try {\n                const result = await wallet.sendTransaction({\n                    to: 'recipient_address',\n                    amount: 1,\n                    message: 'Test from Vanilla JS DApp'\n                });\n                alert('Transaction sent: ' + result.txHash);\n            } catch (error) {\n                alert('Transaction failed: ' + error.message);\n            }\n        });\n\n        // Initialize on page load\n        initWallet();\n    </script>\n</body>\n</html>\n```\n\n## Security Best Practices\n\n### 1. Input Validation\n```typescript\nimport { isValidAddress, isValidAmount } from '@0xgery/wallet-sdk';\n\n// Always validate user inputs\nconst recipientAddress = userInput.trim();\nif (!isValidAddress(recipientAddress)) {\n  throw new Error('Invalid recipient address');\n}\n\nconst amount = parseFloat(userAmountInput);\nif (!isValidAmount(amount)) {\n  throw new Error('Invalid transaction amount');\n}\n```\n\n### 2. Enhanced Error Handling\n```typescript\nimport { OctraWalletError, ErrorCode, isErrorType } from '@0xgery/wallet-sdk';\n\ntry {\n  await wallet.sendTransaction(txData);\n} catch (error) {\n  if (isErrorType(error, ErrorCode.INSUFFICIENT_BALANCE)) {\n    alert('Not enough balance for this transaction');\n  } else if (isErrorType(error, ErrorCode.USER_REJECTED)) {\n    console.log('User cancelled the transaction');\n  } else if (isErrorType(error, ErrorCode.EXTENSION_NOT_FOUND)) {\n    // Enhanced diagnostics available\n    console.error('Extension not found. Details:', error.details);\n    alert('Please install Octra Wallet extension');\n  } else {\n    // All errors now include detailed context\n    console.error('Transaction failed:', {\n      message: error.message,\n      code: error.code,\n      details: error.details // Browser/extension state info\n    });\n    alert('Transaction failed: ' + error.message);\n  }\n}\n```\n\n### 3. Network Validation\n```typescript\nconst networkInfo = await wallet.getNetworkInfo();\nif (networkInfo.id !== 'mainnet') {\n  console.warn('Not connected to mainnet!');\n  // Show warning to user or switch network\n}\n```\n\n## Development\n\n### Prerequisites\n- Node.js 16+\n- TypeScript 4.5+\n- Modern browser with extension support\n\n### Building from Source\n```bash\ngit clone https://github.com/0xGery/Octra.git\ncd Octra/wallet-sdk\nnpm install\nnpm run build\n```\n\n### Testing\n```bash\nnpm run test\nnpm run typecheck\nnpm run lint\n```\n\n## Type Definitions\n\nThe SDK is fully typed with TypeScript. Import types as needed:\n\n```typescript\nimport {\n  Balance,\n  TransactionData,\n  TransactionResult,\n  WalletEventType,\n  ConnectEvent,\n  ErrorCode\n} from '@0xgery/wallet-sdk';\n```\n\n## Error Codes\n\n| Code | Description |\n|------|-------------|\n| `EXTENSION_NOT_FOUND` | Octra Wallet extension not installed |\n| `CONNECTION_REFUSED` | User denied connection request |\n| `USER_REJECTED` | User rejected transaction/action |\n| `INSUFFICIENT_BALANCE` | Not enough balance for transaction |\n| `INVALID_ADDRESS` | Invalid wallet address format |\n| `INVALID_AMOUNT` | Invalid transaction amount |\n| `NETWORK_ERROR` | Network communication failure |\n| `TRANSACTION_FAILED` | Transaction processing failed |\n| `PERMISSION_DENIED` | Missing required permissions |\n| `WALLET_LOCKED` | Wallet needs to be unlocked |\n\n## Support\n\n- **Issues**: [GitHub Issues](https://github.com/0xGery/Octra/issues)\n- **Discussions**: [GitHub Discussions](https://github.com/0xGery/Octra/discussions)\n- **Developer**: NullxGery (0xGery)\n- **Contact**: [Telegram](https://t.me/nullXgery)\n\n## License\n\nMIT License - see [LICENSE](LICENSE) for details.\n\n---\n\nBuilt by NullxGery (0xGery) for the Octra network","readmeFilename":"README.md"}