
Security News
PolinRider: North Korea-Linked Supply Chain Campaign Expands Across Open Source Ecosystems
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.
@tonconnect/protocol
Advanced tools
ℹ️ If you want to integrate TonConnect to your dApp, you should use [@tonconnect/sdk](https://www.npmjs.com/package/@tonconnect/sdk)
ℹ️ If you want to integrate TonConnect to your dApp, you should use @tonconnect/sdk
Package contains protocol requests, responses and event models and encoding, decoding functions.
You can use it to integrate TonConnect to your wallet app (written with TypeScript).
npm i @tonconnect/protocol
import { AppRequest, RpcMethod, WalletResponse } from '@tonconnect/protocol';
function myWalletAppRequestsHandler<T extends RpcMethod>(request: AppRequest<T>): Promise<WalletResponse<T>> {
// handle request, ask the user for a confirmation and return WalletResponse
}
import { SessionCrypto, WalletMessage, Base64, hexToByteArray } from '@tonconnect/protocol';
function encodeIncommingHTTPBridgeRequest(encryptedMessage: string, from: string): WalletMessage {
const sessionCrypto = new SessionCrypto(yourStoredSessionReypair);
const decryptedMessage =
sessionCrypto.decrypt(
Base64.decode(bridgeIncomingMessage.message).toUint8Array(),
hexToByteArray(bridgeIncomingMessage.from)
);
return JSON.parse(decryptedMessage);
}
The 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.
The 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.
FAQs
ℹ️ If you want to integrate TonConnect to your dApp, you should use [@tonconnect/sdk](https://www.npmjs.com/package/@tonconnect/sdk)
The npm package @tonconnect/protocol receives a total of 45,612 weekly downloads. As such, @tonconnect/protocol popularity was classified as popular.
We found that @tonconnect/protocol demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.

Security News
Open source attacks are accelerating as AI coding agents pull in dependencies faster, with less human review.

Research
/Security News
Malicious Chrome and Firefox extensions posed as free VPNs while stealing clipboard data through later extension updates.