{"_id":"chaingate-react","_rev":"2-1e2de069ea6ce12dafbb5c27a11ac4c2","name":"chaingate-react","dist-tags":{"latest":"1.2.0"},"versions":{"1.0.0":{"name":"chaingate-react","version":"1.0.0","keywords":["cryptocurrency","blockchain","bitcoin","ethereum","react","react-hooks","web3","defi","multi-chain","wallet","crypto-wallet","hd-wallet","evm","utxo","polygon","arbitrum","litecoin","dogecoin","bitcoin-cash","token-transfer","erc20","nft","crypto-payments","blockchain-api","typescript","sdk","react-provider","wallet-management","fiat-conversion","dapp"],"author":{"name":"ChainGate"},"license":"MIT","_id":"chaingate-react@1.0.0","maintainers":[{"name":"drakensoftware","email":"info@draken.software"}],"homepage":"https://chaingate.dev","bugs":{"url":"https://github.com/drakensoftware/chaingate-react/issues"},"dist":{"shasum":"9e2f046872fbf195e982d4404ebd2abc22b99978","tarball":"https://registry.npmjs.org/chaingate-react/-/chaingate-react-1.0.0.tgz","fileCount":9,"integrity":"sha512-g0tepHhRdtEGb0ceVLc0cPPajVMDFdWD3m3UkjhbYiohH7Q7fqwHMNXz1DrB+7PuYLA4U3vGtoE7u89C8TU4DA==","signatures":[{"sig":"MEQCIG5f/gvbkbueWEBHdIsxVIQhZMRIi+pwh//8lV7P+aBHAiAS2VlFgH/55yM3KUfUQap6BQMSL962tlGvpVF2jLEJUw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14985},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=22.0.0"},"gitHead":"da5a4f3e59b5991ace248bb8df2fba8a2dcdd7d0","scripts":{"lint":"eslint src/ tests/","test":"vitest run","build":"tsc","format":"prettier --write \"src/**/*.{ts,tsx}\" \"tests/**/*.{ts,tsx}\"","prepare":"husky","lint:fix":"eslint src/ tests/ --fix","format:check":"prettier --check \"src/**/*.{ts,tsx}\" \"tests/**/*.{ts,tsx}\""},"_npmUser":{"name":"drakensoftware","email":"info@draken.software"},"repository":{"url":"git+https://github.com/drakensoftware/chaingate-react.git","type":"git"},"_npmVersion":"11.6.2","description":"React hooks and providers for ChainGate — integrate multi-chain cryptocurrency wallets into React apps with two hooks. Create, import, and manage wallets across Bitcoin, Ethereum, and 30+ blockchains with zero boilerplate and automatic state synchronizati","directories":{},"lint-staged":{"*.{ts,tsx}":["eslint --fix","prettier --write"]},"_nodeVersion":"24.12.0","_hasShrinkwrap":false,"devDependencies":{"husky":"^9.1.7","react":"^19.1.0","eslint":"^10.0.2","vitest":"^4.0.18","prettier":"^3.8.1","chaingate":"^1.0.0","happy-dom":"^20.8.4","react-dom":"^19.1.0","@eslint/js":"^10.0.1","typescript":"^5.8.2","lint-staged":"^16.2.7","@types/react":"^19.1.0","@types/react-dom":"^19.1.0","typescript-eslint":"^8.56.1","@testing-library/react":"^16.3.0","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.5"},"peerDependencies":{"react":">=18","chaingate":">=1"},"_npmOperationalInternal":{"tmp":"tmp/chaingate-react_1.0.0_1773819234405_0.32678394575683467","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"chaingate-react","version":"1.2.0","description":"React hooks and providers for ChainGate — integrate multi-chain cryptocurrency wallets into React apps with two hooks. Create, import, and manage wallets across Bitcoin, Ethereum, and 30+ blockchains with zero boilerplate and automatic state synchronizati","main":"dist/index.js","types":"dist/index.d.ts","license":"MIT","author":{"name":"ChainGate"},"homepage":"https://chaingate.dev","repository":{"type":"git","url":"git+https://github.com/drakensoftware/chaingate-react.git"},"bugs":{"url":"https://github.com/drakensoftware/chaingate-react/issues"},"keywords":["react","react-hooks","react-provider","react-context","cryptocurrency","blockchain","bitcoin","ethereum","litecoin","dogecoin","bitcoin-cash","polygon","arbitrum","avalanche","bnb-chain","base","evm","utxo","multi-chain","wallet","hd-wallet","bip39","mnemonic","web3","defi","erc20","erc721","nft","transactions","token-transfer","typescript","sdk","dapp"],"engines":{"node":">=22.0.0"},"scripts":{"build":"tsc","test":"vitest run","lint":"eslint src/ tests/","lint:fix":"eslint src/ tests/ --fix","format":"prettier --write \"src/**/*.{ts,tsx}\" \"tests/**/*.{ts,tsx}\"","format:check":"prettier --check \"src/**/*.{ts,tsx}\" \"tests/**/*.{ts,tsx}\"","prepare":"husky"},"peerDependencies":{"chaingate":">=1","react":">=18"},"devDependencies":{"@eslint/js":"^10.0.1","@testing-library/react":"^16.3.0","@types/react":"^19.1.0","@types/react-dom":"^19.1.0","chaingate":"^1.2.0","eslint":"^10.0.2","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.5","happy-dom":"^20.8.4","husky":"^9.1.7","lint-staged":"^16.2.7","prettier":"^3.8.1","react":"^19.1.0","react-dom":"^19.1.0","typescript":"^5.8.2","typescript-eslint":"^8.56.1","vitest":"^4.0.18"},"lint-staged":{"*.{ts,tsx}":["eslint --fix","prettier --write"]},"_id":"chaingate-react@1.2.0","gitHead":"2ac3dff080345fcc0cb7666b5b35d24f4ee0dbad","_nodeVersion":"22.22.2","_npmVersion":"10.9.7","dist":{"integrity":"sha512-fuqmj3SgUtPbab36k4Ucfzg2PjaUzJamy9XRoHRcuci8iPKlCQyArQ/mgW2O2XOITwZu2N6a2ihai89qiO9ocg==","shasum":"4ebdb6f293d6479e61e74c3f2b5c6a5e2fc8061d","tarball":"https://registry.npmjs.org/chaingate-react/-/chaingate-react-1.2.0.tgz","fileCount":9,"unpackedSize":15001,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/chaingate-react@1.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCJvRBTZNRoBWeSCRaUV63asLt8NfFo9h8XLcBjEhiS7QIgH2fDBzx+W0qVFS9LtiCNJpZVoZmmPoKox2AWo3itrTQ="}]},"_npmUser":{"name":"drakensoftware","email":"info@draken.software"},"directories":{},"maintainers":[{"name":"drakensoftware","email":"info@draken.software"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/chaingate-react_1.2.0_1778063031717_0.09315428797242498"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-18T07:33:54.296Z","modified":"2026-05-06T10:23:52.137Z","1.0.0":"2026-03-18T07:33:54.587Z","1.2.0":"2026-05-06T10:23:51.864Z"},"bugs":{"url":"https://github.com/drakensoftware/chaingate-react/issues"},"author":{"name":"ChainGate"},"license":"MIT","homepage":"https://chaingate.dev","keywords":["react","react-hooks","react-provider","react-context","cryptocurrency","blockchain","bitcoin","ethereum","litecoin","dogecoin","bitcoin-cash","polygon","arbitrum","avalanche","bnb-chain","base","evm","utxo","multi-chain","wallet","hd-wallet","bip39","mnemonic","web3","defi","erc20","erc721","nft","transactions","token-transfer","typescript","sdk","dapp"],"repository":{"type":"git","url":"git+https://github.com/drakensoftware/chaingate-react.git"},"description":"React hooks and providers for ChainGate — integrate multi-chain cryptocurrency wallets into React apps with two hooks. Create, import, and manage wallets across Bitcoin, Ethereum, and 30+ blockchains with zero boilerplate and automatic state synchronizati","maintainers":[{"name":"drakensoftware","email":"info@draken.software"}],"readme":"<p align=\"center\">\n  <img src=\"./logo.png\" alt=\"ChainGate\" height=\"80\" />\n</p>\n\n<h1 align=\"center\">chaingate-react</h1>\n\n<p align=\"center\">\n  React hooks and providers for the <a href=\"https://www.npmjs.com/package/chaingate\">ChainGate</a> cryptocurrency SDK.\n</p>\n\n<p align=\"center\">\n  <a href=\"https://github.com/drakensoftware/chaingate-react/actions/workflows/build.yml\"><img src=\"https://github.com/drakensoftware/chaingate-react/actions/workflows/build.yml/badge.svg\" alt=\"Build\" /></a>\n  <a href=\"https://github.com/drakensoftware/chaingate-react/actions/workflows/test.yml\"><img src=\"https://github.com/drakensoftware/chaingate-react/actions/workflows/test.yml/badge.svg\" alt=\"Test\" /></a>\n  <a href=\"https://github.com/drakensoftware/chaingate-react/actions/workflows/publish.yml\"><img src=\"https://github.com/drakensoftware/chaingate-react/actions/workflows/publish.yml/badge.svg\" alt=\"Publish\" /></a>\n  <a href=\"https://www.npmjs.com/package/chaingate-react\"><img src=\"https://img.shields.io/npm/v/chaingate-react?color=blue&label=npm\" alt=\"npm version\" /></a>\n  <a href=\"https://www.npmjs.com/package/chaingate-react\"><img src=\"https://img.shields.io/npm/dm/chaingate-react?color=green\" alt=\"npm downloads\" /></a>\n  <a href=\"https://docs.chaingate.dev\"><img src=\"https://img.shields.io/badge/docs-chaingate.dev-blueviolet?logo=readthedocs&logoColor=white\" alt=\"Documentation\" /></a>\n  <a href=\"https://api.chaingate.dev/dashboard\"><img src=\"https://img.shields.io/badge/API%20Key-dashboard-orange\" alt=\"Get API Key\" /></a>\n  <img src=\"https://img.shields.io/badge/react-%3E%3D18-61DAFB?logo=react&logoColor=white\" alt=\"React >= 18\" />\n  <img src=\"https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white\" alt=\"TypeScript\" />\n</p>\n\n---\n\n<h3 align=\"center\">\n  📦 <a href=\"https://www.npmjs.com/package/chaingate\">ChainGate SDK</a> &nbsp;&nbsp;|&nbsp;&nbsp; 📖 <a href=\"https://docs.chaingate.dev\">Documentation</a> &nbsp;&nbsp;|&nbsp;&nbsp; 🔑 <a href=\"https://api.chaingate.dev/dashboard\">Get your free API key</a>\n</h3>\n\n---\n\n## Features\n\n- 👛 **Wallet state management** -- Create, import, restore, and close wallets via React context\n- ⚡ **ChainGate provider** -- Initialize and share the API client across your component tree\n- 🪝 **Two hooks, zero boilerplate** -- `useWallet()` and `useChainGate()` for everything\n- 🔄 **Auto-sync** -- Wallet state updates are immediately available in all components\n\n## Install\n\n```bash\nnpm install chaingate-react chaingate react\n```\n\n## Examples\n\n### Setup Providers\n\n```tsx\nimport { ChainGateProvider, WalletProvider } from 'chaingate-react';\n\nfunction App() {\n  return (\n    <ChainGateProvider>\n      <WalletProvider>\n        <YourApp />\n      </WalletProvider>\n    </ChainGateProvider>\n  );\n}\n```\n\n### Initialize the API Client\n\n```tsx\nimport { useChainGate } from 'chaingate-react';\nimport { useEffect } from 'react';\n\nfunction Init() {\n  const { initializeChainGate } = useChainGate();\n\n  useEffect(() => {\n    initializeChainGate({ apiKey: 'your-api-key' });\n  }, []);\n\n  return null;\n}\n```\n\n### Create a Wallet\n\n```tsx\nimport { useWallet } from 'chaingate-react';\n\nfunction CreateWallet() {\n  const { newWallet } = useWallet();\n\n  const handleCreate = () => {\n    const { phrase, wallet } = newWallet();\n    console.log('Mnemonic:', phrase);\n    // wallet is now available across the app via useWallet().wallet\n  };\n\n  return <button onClick={handleCreate}>Create Wallet</button>;\n}\n```\n\n### Import a Wallet\n\n```tsx\nimport { useWallet } from 'chaingate-react';\n\nfunction ImportWallet() {\n  const { importWallet, createWalletFromString } = useWallet();\n\n  // From mnemonic\n  importWallet({ phrase: 'abandon abandon abandon ...' });\n\n  // From private key\n  importWallet({ privateKey: '0x...' });\n\n  // From xpub (view-only)\n  importWallet({ xpub: 'xpub...' });\n\n  // Auto-detect any format\n  createWalletFromString('xprv9s21ZrQH143K...');\n}\n```\n\n### Check Balance\n\n```tsx\nimport { useChainGate, useWallet } from 'chaingate-react';\n\nfunction Balance() {\n  const { chaingate } = useChainGate();\n  const { wallet } = useWallet();\n\n  const getBalance = async () => {\n    if (!chaingate || !wallet) return;\n    const eth = chaingate.connect(chaingate.networks.ethereum, wallet);\n    const { confirmed } = await eth.addressBalance();\n    console.log(confirmed.base(), confirmed.symbol);\n  };\n\n  return <button onClick={getBalance}>Get ETH Balance</button>;\n}\n```\n\n### Send a Transaction\n\n```tsx\nconst { chaingate } = useChainGate();\nconst { wallet } = useWallet();\n\nconst send = async () => {\n  if (!chaingate || !wallet) return;\n  const eth = chaingate.connect(chaingate.networks.ethereum, wallet);\n  const amount = chaingate.networks.ethereum.amount('0.1');\n  const tx = await eth.transfer(amount, '0xRecipient...');\n  tx.setFee('high');\n  const broadcasted = await tx.signAndBroadcast();\n  broadcasted.onConfirmed((details) => {\n    console.log('Confirmed in block', details.blockHeight);\n  });\n};\n```\n\n### Connect to Any EVM Chain\n\n```tsx\nconst bsc = chaingate.networks.evmRpc({\n  rpcUrl: 'https://bsc-dataseed.binance.org',\n  chainId: 56,\n  name: 'BNB Smart Chain',\n  symbol: 'BNB',\n});\n\nconst conn = chaingate.connect(bsc, wallet);\n```\n\n### Restore an Encrypted Wallet\n\n```tsx\nimport { useWallet } from 'chaingate-react';\n\nfunction RestoreWallet() {\n  const { deserializeWallet } = useWallet();\n\n  const restore = () => {\n    const saved = JSON.parse(localStorage.getItem('wallet')!);\n    deserializeWallet(saved, async () => {\n      return window.prompt('Enter your wallet password:');\n    });\n  };\n\n  return <button onClick={restore}>Restore Wallet</button>;\n}\n```\n\n### Close Wallet\n\n```tsx\nconst { closeWallet } = useWallet();\n\n<button onClick={closeWallet}>Log Out</button>\n```\n\n---\n\n<p align=\"center\">\n  <a href=\"https://docs.chaingate.dev\"><strong>📖 Read the full docs</strong></a>\n</p>\n","readmeFilename":"README.md"}