{"_id":"@asentum/connect","_rev":"5-054bdb2139fd4ce2be327ea63fe73a84","name":"@asentum/connect","dist-tags":{"latest":"0.1.9"},"versions":{"0.1.0":{"name":"@asentum/connect","version":"0.1.0","keywords":["asentum","wallet","web3","react","connect","dapp"],"license":"MIT","_id":"@asentum/connect@0.1.0","maintainers":[{"name":"milkie_eth","email":"its.quo.eth@gmail.com"}],"homepage":"https://github.com/asentum-network/asentum-connect#readme","bugs":{"url":"https://github.com/asentum-network/asentum-connect/issues"},"dist":{"shasum":"79e3bc5217ca5f3215f60d7786a934bcc024ed82","tarball":"https://registry.npmjs.org/@asentum/connect/-/connect-0.1.0.tgz","fileCount":9,"integrity":"sha512-fAsVf8kqqgE2YlemROUY7ZGu2zrRvVURz5oTo55EXMr1IDws5DLs9OmAlvpFpsCNiWNkAvi+nMxuI/4KNllSwA==","signatures":[{"sig":"MEUCIQDkzCvE+sQzDYLu+kNPt0bTaygyQbpglzts0vTygr2uOQIgcqOvSkgIDLQ3ZNeihVTQiX1lPq1N5V2c4oIFgm3y6do=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":95752},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"9e12d043f5473372857d388ef4af87e4dc7fba92","scripts":{"dev":"tsup --watch","build":"tsup","prepublishOnly":"npm run build"},"_npmUser":{"name":"milkie_eth","email":"its.quo.eth@gmail.com"},"repository":{"url":"git+https://github.com/asentum-network/asentum-connect.git","type":"git"},"_npmVersion":"10.9.0","description":"Drop-in wallet connect for AsentumChain dapps — <ConnectButton /> + hooks (useWallet, useAsentum). Zero CSS imports, zero heavy deps.","directories":{},"sideEffects":false,"_nodeVersion":"22.12.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.2.4","react":"^18.3.1","react-dom":"^18.3.1","typescript":"^5.5.4","@types/react":"^18.3.3"},"peerDependencies":{"react":">=17","react-dom":">=17"},"_npmOperationalInternal":{"tmp":"tmp/connect_0.1.0_1786259735937_0.9507614107653097","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@asentum/connect","version":"0.1.3","keywords":["asentum","wallet","web3","react","connect","dapp"],"license":"MIT","_id":"@asentum/connect@0.1.3","maintainers":[{"name":"milkie_eth","email":"its.quo.eth@gmail.com"}],"homepage":"https://github.com/asentum-network/asentum-connect#readme","bugs":{"url":"https://github.com/asentum-network/asentum-connect/issues"},"dist":{"shasum":"916632d8bdea5928dba9149fe978e451efae5e11","tarball":"https://registry.npmjs.org/@asentum/connect/-/connect-0.1.3.tgz","fileCount":9,"integrity":"sha512-902pMZYQV9AtOM6soYlxo8Ubnj/YBz3irS4hsUr7qJ1ydwn6lqq/4llCqW1y6PSoWg3TgHoV/mDVINfsO0kyzA==","signatures":[{"sig":"MEUCIQDFXBozUvUbQmWzoDVdzURHAJTomDKG3Ab5alFLy2MhyQIgQ9SBH6AkpcVt3cN6R0zuoapaiRynH03U+ENN8MDIyHw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQCThyi6mgyXs4UhS9ZYXW7eiC0ynDiXQjoBBNLx8Bgo4QIhAPbOgEl9xQBydD1S6F0f73gKnCewRw8IavFI00Wflp2W","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":144721},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"0a4011cb161c74785019197b680c0aa80e2e8846","scripts":{"dev":"tsup --watch","build":"tsup","prepare":"tsup","prepublishOnly":"npm run build"},"_npmUser":{"name":"milkie_eth","email":"its.quo.eth@gmail.com"},"repository":{"url":"git+https://github.com/asentum-network/asentum-connect.git","type":"git"},"_npmVersion":"10.9.0","description":"Drop-in wallet connect for AsentumChain dapps — <ConnectButton /> + hooks (useWallet, useAsentum). Zero CSS imports, zero heavy deps.","directories":{},"sideEffects":false,"_nodeVersion":"22.12.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.2.4","react":"^18.3.1","react-dom":"^18.3.1","typescript":"^5.5.4","@types/react":"^18.3.3"},"peerDependencies":{"react":">=17","react-dom":">=17"},"_npmOperationalInternal":{"tmp":"tmp/connect_0.1.3_1789464347298_0.4585901484649466","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@asentum/connect","version":"0.1.4","keywords":["asentum","wallet","web3","react","connect","dapp"],"license":"MIT","_id":"@asentum/connect@0.1.4","maintainers":[{"name":"milkie_eth","email":"its.quo.eth@gmail.com"}],"homepage":"https://github.com/asentum-network/asentum-connect#readme","bugs":{"url":"https://github.com/asentum-network/asentum-connect/issues"},"dist":{"shasum":"3978f9b44bb2e12a3f73d87e97428d38228eb0b2","tarball":"https://registry.npmjs.org/@asentum/connect/-/connect-0.1.4.tgz","fileCount":9,"integrity":"sha512-Zc71P+n8szTj4+poDEsJlt9EvkJR1uA22d8nQ2SPc8HvtxIF0ZZKStDpxHZZs4I/AyMLnQok6nMflFqFcotHEA==","signatures":[{"sig":"MEUCIQDK98YDkwR7z4Qcx4ls0hemtXGq7Thu8wksDJeye869fAIgEwOzIcKvYOCbhsvYszkcNzyIoxy0jj/UAus78rl3UZo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCIFHfYoLB+wJiiK+GZ4OJAunPSHy3PO4nSunQvtSAxzbjAiBq5lHIgUwfSZck3a0v9cRhSNATd1sxdudj9KFIv1DiDw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":153398},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"9f9a03652869ffff2bd3c92a75fb4735d547368a","scripts":{"dev":"tsup --watch","build":"tsup","prepare":"tsup","prepublishOnly":"npm run build"},"_npmUser":{"name":"milkie_eth","email":"its.quo.eth@gmail.com"},"repository":{"url":"git+https://github.com/asentum-network/asentum-connect.git","type":"git"},"_npmVersion":"10.9.0","description":"Drop-in wallet connect for AsentumChain dapps — <ConnectButton /> + hooks (useWallet, useAsentum). Zero CSS imports, zero heavy deps.","directories":{},"sideEffects":false,"_nodeVersion":"22.12.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.2.4","react":"^18.3.1","react-dom":"^18.3.1","typescript":"^5.5.4","@types/react":"^18.3.3"},"peerDependencies":{"react":">=17","react-dom":">=17"},"_npmOperationalInternal":{"tmp":"tmp/connect_0.1.4_1789729759101_0.772800530345013","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@asentum/connect","version":"0.1.5","keywords":["asentum","wallet","web3","react","connect","dapp"],"license":"MIT","_id":"@asentum/connect@0.1.5","maintainers":[{"name":"milkie_eth","email":"its.quo.eth@gmail.com"}],"homepage":"https://github.com/asentum-network/asentum-connect#readme","bugs":{"url":"https://github.com/asentum-network/asentum-connect/issues"},"dist":{"shasum":"312bab8b6f0e618b599cd7f304847c0f196668f8","tarball":"https://registry.npmjs.org/@asentum/connect/-/connect-0.1.5.tgz","fileCount":9,"integrity":"sha512-ASctIbTEcW8W1gpLLNYIm4LSX90aI+NWMgCahYseHK5oQYbwOEU3Lv2Tknivo+1Esnv233PvSo6mRinnV7wFtA==","signatures":[{"sig":"MEUCIQDdLB0uVixp44rsxWymqnX4Qb9CKe7J9WC0H5/wkyzXWgIgYKRlYwHMEgH4H9hGA1u39PjniKXfufVw0YgNVn2t7gs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCIHmZnWt3PqJ4WeHv2kkPmUG4yguLMpTij3c/rFhqvon1AiAIQfvT6E/Gq0t11b8sWhiN+SvrzPF7jpxsJmXoZvsYGw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":153478},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"78fba72845612ee64e48cd772667ecfd64d04117","scripts":{"dev":"tsup --watch","build":"tsup","prepare":"tsup","prepublishOnly":"npm run build"},"_npmUser":{"name":"milkie_eth","email":"its.quo.eth@gmail.com"},"repository":{"url":"git+https://github.com/asentum-network/asentum-connect.git","type":"git"},"_npmVersion":"10.9.0","description":"Drop-in wallet connect for AsentumChain dapps — <ConnectButton /> + hooks (useWallet, useAsentum). Zero CSS imports, zero heavy deps.","directories":{},"sideEffects":false,"_nodeVersion":"22.12.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.2.4","react":"^18.3.1","react-dom":"^18.3.1","typescript":"^5.5.4","@types/react":"^18.3.3"},"peerDependencies":{"react":">=17","react-dom":">=17"},"_npmOperationalInternal":{"tmp":"tmp/connect_0.1.5_1790068013084_0.6876770266759811","host":"s3://npm-registry-packages-npm-production"}},"0.1.9":{"_id":"@asentum/connect@0.1.9","bugs":{"url":"https://github.com/asentum-network/asentum-connect/issues"},"dist":{"shasum":"e272e0bf1226cc584e5cbc915d40bc0a4eef4b45","tarball":"https://registry.npmjs.org/@asentum/connect/-/connect-0.1.9.tgz","fileCount":9,"integrity":"sha512-mamVkGTU0WWFI0j1bQKHqQT+0q6s5PDatgpAJGCzgwwr1NMeSIHbcebhIWOxuE3zfGXIwBhQ+NqiomdI0qWPkQ==","signatures":[{"sig":"MEYCIQC69xrIQKg7qIYb7mdhcpR1ZisO9UTEBlxOuYsdG8vAPwIhAO6O8NwpctQJoL6zsZ14gxaOP7aBfqGICKKddmWR0QcW","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCg5O/BYk9idcWOXz+UiauRbIWXPnVIcOPTEU+Bg0AsYgIgesHLvlvE//4Y0CsbOTEMA4SoQNHhh7w99qsWIK82ZY8="}],"unpackedSize":347857},"main":"./dist/index.cjs","name":"@asentum/connect","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"c522b395dd9a6330c8117f71c154867021ad3a14","license":"MIT","scripts":{"dev":"tsup --watch","build":"tsup","prepare":"tsup","prepublishOnly":"npm run build"},"version":"0.1.9","_npmUser":{"name":"milkie_eth","email":"its.quo.eth@gmail.com"},"homepage":"https://github.com/asentum-network/asentum-connect#readme","keywords":["asentum","wallet","web3","react","connect","dapp"],"repository":{"url":"git+https://github.com/asentum-network/asentum-connect.git","type":"git"},"_npmVersion":"10.9.0","description":"Drop-in wallet connect for AsentumChain dapps — <ConnectButton /> + hooks (useWallet, useAsentum). Zero CSS imports, zero heavy deps.","directories":{},"maintainers":[{"name":"milkie_eth","email":"its.quo.eth@gmail.com"}],"sideEffects":false,"_nodeVersion":"22.12.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.2.4","react":"^18.3.1","react-dom":"^18.3.1","typescript":"^5.5.4","@types/react":"^18.3.3"},"peerDependencies":{"react":">=17","react-dom":">=17"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/connect_0.1.9_1790852152159_0.08925415286789051"}}},"time":{"created":"2026-08-09T07:15:35.783Z","modified":"2026-10-01T10:55:52.445Z","0.1.0":"2026-08-09T07:15:36.087Z","0.1.3":"2026-09-15T09:25:47.377Z","0.1.4":"2026-09-18T11:09:19.194Z","0.1.5":"2026-09-22T09:06:53.194Z","0.1.9":"2026-10-01T10:55:52.260Z"},"bugs":{"url":"https://github.com/asentum-network/asentum-connect/issues"},"license":"MIT","homepage":"https://github.com/asentum-network/asentum-connect#readme","keywords":["asentum","wallet","web3","react","connect","dapp"],"repository":{"url":"git+https://github.com/asentum-network/asentum-connect.git","type":"git"},"description":"Drop-in wallet connect for AsentumChain dapps — <ConnectButton /> + hooks (useWallet, useAsentum). Zero CSS imports, zero heavy deps.","maintainers":[{"name":"milkie_eth","email":"its.quo.eth@gmail.com"}],"readme":"# @asentum/connect\n\nWallet connect for **AsentumChain** dapps: a `<ConnectButton />`, a connect\nmodal (browser extension, Telegram, create-new), and hooks (`useWallet`,\n`useAsentum`, `useContract`, `useBalance`). No CSS to import, react as the only\npeer dep. Styling is via props and inline styles.\n\n```bash\nnpm install @asentum/connect\n```\n\nFull guide with worked examples:\n<https://asentum.com/docs/guides/wallet-connect>\n\n## Quick start\n\nWrap your app once, then drop the button anywhere:\n\n```tsx\nimport { AsentumProvider, ConnectButton } from '@asentum/connect';\n\nexport default function App({ children }) {\n  return (\n    <AsentumProvider\n      rpc=\"https://testnet.asentum.com\"\n      dappName=\"My Dapp\"                       // shown in the wallet's approval prompt\n      telegramBot=\"AsentumWalletBot\"           // optional: adds the Telegram option\n      onConnect={(address) => console.log('linked', address)}\n    >\n      <ConnectButton />\n      {children}\n    </AsentumProvider>\n  );\n}\n```\n\nIn Next.js the provider is a client component, so it needs `'use client'` at\nthe top of the file that renders it.\n\n### Styling the button\n\n```tsx\n<ConnectButton text=\"Sign in\" bg=\"#111318\" color=\"#fff\" border=\"1px solid #333\" radius={8} />\n```\n\nProps: `text`, `bg`, `color`, `border`, `radius`, `menu` (copy/disconnect menu\nwhen connected, on by default; with it off a second click disconnects), plus\n`className` / `style` escape hatches. `style` is merged last, so it wins over\nevery other prop.\n\nThe modal itself is not themeable. It is deliberately the same across Asentum\ndapps so users recognise it. For a different look, use your own trigger.\n\n### Your own trigger\n\n`<ConnectButton>` renders the modal for you. If you replace the button with\nyour own markup, mount `<ConnectModal />` yourself once inside the provider,\nor nothing will open:\n\n```tsx\nimport { ConnectModal, useWallet } from '@asentum/connect';\n\nfunction Header() {\n  const { connected, address, openConnect, disconnect } = useWallet();\n  return (\n    <>\n      {connected\n        ? <button onClick={disconnect}>{address.slice(0, 10)}…</button>\n        : <button onClick={openConnect}>Connect</button>}\n      <ConnectModal />\n    </>\n  );\n}\n```\n\n## Hooks\n\n```tsx\nimport { useWallet, useAsentum, useContract, useBalance } from '@asentum/connect';\n\nfunction Swap() {\n  const { address, connected, openConnect } = useWallet();\n  const client = useAsentum();\n  const dex = useContract('ase1yourcontract...');\n  const { balance, refresh } = useBalance();      // native ASE, wei string, polls every 12s\n\n  async function trade() {\n    if (!connected) return openConnect();\n    const out = await dex.view('quote', ['1', tokenIn, amountIn]);            // read, free\n    const tx  = await dex.call('swapExactIn', ['1', tokenIn, amountIn, '1']); // write, signed\n    const receipt = await client.waitReceipt(tx);\n    if (!receipt.success) throw new Error('swap reverted');\n    refresh();\n  }\n}\n```\n\n## API\n\n- **`<AsentumProvider>`** — `rpc?` (default `https://testnet.asentum.com`),\n  `dappName?`, `telegramBot?`, `botApi?` (default\n  `https://wallet.asentum.com`), `onCreateWallet?`, `onConnect?`,\n  `onDisconnect?`, `persist?` (remember the address across page loads, on by\n  default), `extensionStatus?` (`'ready'` by default: the browser-extension\n  option is offered and connectable; pass `'soon'` to render it disabled with a\n  Soon chip), `allowCustomRpc?` (on by default: lets the person using your\n  dapp point reads at their own node; see \"Custom RPC\" below).\n- **`<ConnectButton>`** — the button; renders the modal automatically.\n- **`<ConnectModal>`** — the modal on its own, for custom triggers.\n- **`useWallet()`** → `{ address, ase1Address, connected, connecting, error, hasWallet, connect, disconnect, openConnect }`.\n- **`useAsentum()`** → `AsentumClient` (`view`, `call`, `transfer`, `deploy`, `waitReceipt`, `balanceOf`).\n- **`useContract(addr)`** → `{ address, view(method,args), call(method,args,value) }`.\n- **`useBalance(addr?, pollMs?)`** → `{ balance, loading, refresh }`. `balance` is a wei decimal string.\n- **`useRpc()`** → `{ rpc, defaultRpc, isCustom, allowed, failing, readingFromDefault, setRpc(url), resetRpc(), readFromDefault(on) }`. `setRpc` resolves to `{ ok, height?, error?, checks?, note? }`.\n- **`<NetworkSettings />`**: the Network row on its own, for custom menus.\n- **`normalizeRpcUrl`, `validateRpc`, `formatHeight`**: the checks `setRpc` runs, usable on their own.\n- **`AsentumClient`** — the client class, usable without React for read-only\n  scripts and back-ends. Writes need a signer, so they only work in a browser\n  with the extension present or a paired Telegram session; to sign server-side\n  use `@asentum/sdk`, which holds a key directly.\n- **`shortAddress(addr, lead?, tail?)`** and **`DEFAULT_RPC`** — small helpers. `shortAddress` always renders ase1.\n- **`toAse1`, `hexToAse1`, `ase1ToHex`, `isAse1`, `shortAse1`** — ase1 (bech32, HRP `ase`) helpers. Show users `ase1Address` or `toAse1(x)`; never show hex. `address` stays in the form the wallet returned it, for RPC calls. Client methods accept ase1 or hex addresses.\n\n## How it works\n\nReads (`view`, `balanceOf`) hit the RPC's `/view` and `/balance` (your `rpc`,\nor the user's own node if they chose one), so they need no wallet at all. Writes are routed to whichever signer the user\nconnected with: the **Asentum browser extension** (`window.asentum`) or a\npaired **Telegram wallet** session. Either way the user is prompted to approve,\nand private keys never touch this library.\n\n## Custom RPC\n\nAnyone can run an Asentum node, and validators often serve their own RPC. With\n`allowCustomRpc` on (the default) the person using your dapp can switch to\ntheir own node from the **Network** row in the connected menu of\n`<ConnectButton>` (also shown at the bottom of the connect modal): **Change**,\npaste the address, **Save**. **Reset to default** goes back to your `rpc`.\n\nBefore saving, the kit checks the node:\n\n1. the address is `https://` (plain `http://` is only accepted for\n   `localhost`, `127.0.0.1` or a private network address, and an https page\n   cannot reach a plain http node on the network anyway);\n2. `GET <url>/metadata` answers within 5 seconds with chain `1423`\n   (`chainIdDecimal: \"1423\"` or `chainId: \"0x58f\"`);\n3. `GET <url>/v3/heads` reports a numeric finalized block height.\n\nTrailing slashes are stripped. On success the row shows\n`Connected: block 309,120`. The choice is saved in `localStorage` under\n`asentum.rpc` (read after mount, so server rendering always uses your `rpc`).\n\nWhat it covers:\n\n- **Reads from this dapp**: `view`, `balanceOf`, `useBalance`, `useContract().view`\n  and the receipt polling in `waitReceipt`, including after a Telegram-signed\n  transaction.\n- **Not extension-signed transactions.** The Asentum browser extension signs\n  and sends through its own RPC setting (Settings, Network RPC, in the\n  extension). The Telegram wallet likewise broadcasts through the node set in\n  the Telegram wallet; the kit never passes an RPC to the signer.\n\nIf the saved node stops answering, the kit does not quietly switch to another\nnode. `useRpc().failing` turns true and the Network row says \"Your custom RPC\nis not answering. Switch back to the default?\" with **Switch to default** and\n**Read from default for now** (reads only, for this page load).\n\n```tsx\nimport { useRpc } from '@asentum/connect';\n\nfunction NodePicker() {\n  const { rpc, isCustom, setRpc, resetRpc } = useRpc();\n  async function use(url: string) {\n    const r = await setRpc(url);\n    alert(r.ok ? `Connected: block ${r.height}` : r.error);\n  }\n  return isCustom ? <button onClick={resetRpc}>Back to default ({rpc})</button> : null;\n}\n```\n\nPass `allowCustomRpc={false}` to keep every read on your `rpc` (the Network row\nthen only shows the host).\n\nThe `create-new` and `telegram` options are opt-in: the modal only shows them\nif you pass `onCreateWallet` / `telegramBot` to the provider.\n\n## License\n\nMIT, © Asentum. Use it in your own dapp.\n","readmeFilename":"README.md"}