{"_id":"@alejandbel/ton-connect-protocol","name":"@alejandbel/ton-connect-protocol","dist-tags":{"latest":"2.4.0"},"versions":{"2.4.0":{"name":"@alejandbel/ton-connect-protocol","version":"2.4.0","repository":{"type":"git","url":"git+https://github.com/Alejandbel/ton-connect-sdk.git"},"homepage":"https://github.com/Alejandbel/ton-connect-sdk/tree/main/packages/protocol","bugs":{"url":"https://github.com/Alejandbel/ton-connect-sdk/issues"},"keywords":["TON","Wallet","ton-connect","Connect","Tonkeeper"],"author":{"name":"tonconnect"},"license":"Apache-2.0","main":"./lib/cjs/index.cjs","module":"./lib/esm/index.mjs","types":"./lib/types/index.d.ts","exports":{".":{"types":"./lib/types/index.d.ts","require":"./lib/cjs/index.cjs","import":"./lib/esm/index.mjs","default":"./lib/cjs/index.cjs"}},"dependencies":{"tweetnacl":"^1.0.3","tweetnacl-util":"^0.15.1"},"devDependencies":{"@rollup/plugin-typescript":"^12.1.4","@types/jest":"^29.5.0","@types/node":"^24.2.0","jest":"^29.7.0","rollup":"^4.46.2","ts-jest":"^29.2.5"},"typedoc":{"entryPoint":"./src/index.ts"},"scripts":{"build":"rimraf types-dist && rimraf lib && rollup -c rollup.config.mjs && tsc && api-extractor run && rimraf types-dist","test":"jest --ci"},"_id":"@alejandbel/ton-connect-protocol@2.4.0","description":"ℹ️ If you want to integrate TonConnect to your dApp, you should use [@tonconnect/sdk](https://www.npmjs.com/package/@tonconnect/sdk)","_integrity":"sha512-QJlppwkYNcWA6tEzqfLYbXMSTrXZclvz1GOcEY0wjU9cgPcmU30DTTONT+uh7UZZeEJ4HIqwlsmpTObquNPndA==","_resolved":"/private/var/folders/h9/wfnrk3496fx8kcbxgcpnmwsm0000gn/T/89bc496e829fd2699275392da5524393/alejandbel-ton-connect-protocol-2.4.0.tgz","_from":"file:alejandbel-ton-connect-protocol-2.4.0.tgz","_nodeVersion":"24.11.0","_npmVersion":"11.6.1","dist":{"integrity":"sha512-QJlppwkYNcWA6tEzqfLYbXMSTrXZclvz1GOcEY0wjU9cgPcmU30DTTONT+uh7UZZeEJ4HIqwlsmpTObquNPndA==","shasum":"4dfbdc790ca98655499f778bb7c2862dcf739063","tarball":"https://registry.npmjs.org/@alejandbel/ton-connect-protocol/-/ton-connect-protocol-2.4.0.tgz","fileCount":8,"unpackedSize":52958,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIBVjWSpmoWRMCPv9zDH7fOwwCcUY57ajV+0YM/61ApwgAiAVsfCnhMBh2b4yVHNR5gXJVpZm8NNK10bmDuAXcQMACA=="}]},"_npmUser":{"name":"a-bahdanau","email":"bogdanov28c@gmail.com"},"directories":{},"maintainers":[{"name":"a-bahdanau","email":"bogdanov28c@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ton-connect-protocol_2.4.0_1773234446405_0.32950131678173844"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-11T13:07:26.293Z","2.4.0":"2026-03-11T13:07:26.556Z","modified":"2026-03-11T13:07:26.833Z"},"maintainers":[{"name":"a-bahdanau","email":"bogdanov28c@gmail.com"}],"description":"ℹ️ If you want to integrate TonConnect to your dApp, you should use [@tonconnect/sdk](https://www.npmjs.com/package/@tonconnect/sdk)","homepage":"https://github.com/Alejandbel/ton-connect-sdk/tree/main/packages/protocol","keywords":["TON","Wallet","ton-connect","Connect","Tonkeeper"],"repository":{"type":"git","url":"git+https://github.com/Alejandbel/ton-connect-sdk.git"},"author":{"name":"tonconnect"},"bugs":{"url":"https://github.com/Alejandbel/ton-connect-sdk/issues"},"license":"Apache-2.0","readme":"# TON Connect protocol models\n\nℹ️ If you want to integrate TonConnect to your dApp, you should use [@tonconnect/sdk](https://www.npmjs.com/package/@tonconnect/sdk)\n\n[Latest API documentation](https://ton-connect.github.io/sdk/modules/_tonconnect_protocol.html)\n\n## Summary\nPackage contains protocol requests, responses and event models and encoding, decoding functions.\n\nYou can use it to integrate TonConnect to your wallet app (written with TypeScript).\n\n## Get started\n\n### Install package\n`npm i @tonconnect/protocol`\n\n### Use protocol models in your app\n\n```ts\nimport { AppRequest, RpcMethod, WalletResponse } from '@tonconnect/protocol';\n\nfunction myWalletAppRequestsHandler<T extends RpcMethod>(request: AppRequest<T>): Promise<WalletResponse<T>> {\n    // handle request, ask the user for a confirmation and return WalletResponse\n}\n\n```\n\n### Use protocol cryptography in your app\n\n```ts\nimport { SessionCrypto, WalletMessage, Base64, hexToByteArray } from '@tonconnect/protocol';\n\nfunction encodeIncommingHTTPBridgeRequest(encryptedMessage: string, from: string): WalletMessage {\n    const sessionCrypto = new SessionCrypto(yourStoredSessionReypair);\n\n    const decryptedMessage =\n        sessionCrypto.decrypt(\n            Base64.decode(bridgeIncomingMessage.message).toUint8Array(),\n            hexToByteArray(bridgeIncomingMessage.from)\n        );\n    \n    return  JSON.parse(decryptedMessage);\n}\n```\n\n### Network identifiers\n\nThe package exports `CHAIN` enum with values `MAINNET = '-239'` and `TESTNET = '-3'` representing TON network IDs. The `ChainId` type (`CHAIN | string`) allows using these predefined values or any custom network identifier string, enabling support for custom networks and future network additions without protocol changes.\n\nThe `ChainId` is used to specify the desired network when establishing wallet connections (via `TonAddressItem.network` field), and for indicating the network context in transaction sending and data signing operations (like `SignDataPayload.network` field), ensuring that all protocol operations can target the correct network.\n","readmeFilename":"README.md","_rev":"1-c7fbb67a401a64631ae0b2dfc7606a5e"}