Expand description
Runtime-neutral building blocks for a TON Connect wallet implementation.
This crate models the protocol wire format and the NaCl-compatible HTTP bridge session encryption. It deliberately contains no HTTP client, executor, wallet implementation, or persistence policy.
Structs§
- Account
Address Error - A value is neither a canonical raw nor a valid friendly TON address.
- AppManifest
- Validated contents of
tonconnect-manifest.json. - AppRequest
- Raw
{ method, params, id }request envelope received from a dApp. - Base64
Value - A validated standard or URL-safe base64 wire value.
- Bridge
Message - One encrypted message delivered by the HTTP bridge over SSE.
- Bridge
SseDecoder - Incremental decoder for the
text/event-streamreturned by/events. - Bridge
SseMessage - One decoded bridge message together with its SSE resume cursor.
- CellBoc
- Base64 wire value known to contain exactly one valid TON cell root.
- Client
Id - A 32-byte X25519 public key encoded as 64 lowercase hexadecimal characters.
- Connect
Event Error - Error details carried by a
connect_errorevent. - Connect
Event Payload - Payload of a successful connect event.
- Connect
Item Error - Error reply for a specific requested connect item.
- Connect
Link - A parsed TON Connect universal, unified, or custom-scheme link.
- Connect
Request - Initial plaintext request carried by a TON Connect deep link.
- Decimal
String - A non-negative integer in the decimal-string wire representation.
- Device
Info - Wallet self-description returned in a successful connect event.
- Disconnect
Request - A validated
disconnectrequest. - Ed25519
Public Key - A 32-byte Ed25519 public key encoded as lowercase hex on the wire.
- Ed25519
Signature - A 64-byte Ed25519 signature encoded as canonical standard base64.
- Embedded
Response Error - Error body for an embedded action.
- Embedded
Response Success - Success body for an embedded action.
- Empty
Object - Protocol object that is valid only when it contains no properties.
- Extra
Currencies - Extra-currency identifier to non-negative elementary-unit amount.
- Feature
Validation Error - Feature capability violates the normative schema constraints.
- Friendly
Address - Validated TEP-2 base64url address with bounce and test-only flags intact.
- Friendly
Address Error - A value is not a canonical TEP-2 user-friendly address.
- Http
Bridge Url - Validated base URL of a TON Connect HTTP bridge.
- Https
Url - An absolute HTTPS URL with a host.
- Injected
Wallet Info - Optional wallet metadata exposed directly by an injected bridge.
- JsBridge
Descriptor - Static properties exposed by
window.<key>.tonconnect. - Network
Id - A TON network
global_idencoded as the opaque stringified-integer wire value. - NonEmpty
Vec - A protocol array statically known to contain at least one value.
- Persisted
Http Session - Confidential state required to resume one wallet-side HTTP bridge session.
- Persisted
Session KeyPair - Serializable key material required to resume one HTTP-bridge session.
- Prepared
AppRequest - Accepted request plus the state that must be persisted before processing.
- Prepared
Bridge Post - Fully prepared body and URL for one HTTP bridge
POST /messagecall. - Prepared
Wallet Event - Prepared event ID plus the state that must be persisted before publication.
- Prepared
Wallet Event Receipt - Accepted wallet event and cursor that must be persisted first.
- RawAccount
Address - Canonical raw TON account address used by TON Connect signed payloads.
- RawMessage
- A raw outgoing message in
sendTransactionorsignMessage. - RawTransaction
Payload - A transaction payload containing caller-built raw messages.
- RpcMethod
Error - A method name is not part of the current TON Connect RPC catalogue.
- RpcRequest
Id - A dApp RPC request ID ordered as an arbitrary-precision unsigned integer.
- Send
Transaction Feature - Advertised
SendTransactionlimits. - Send
Transaction Request - A validated
sendTransactionrequest. - Session
Crypto NaClcrypto_boxsession cryptography used by the TON Connect HTTP bridge.- Sign
Data Feature - Advertised
SignDatavariants. - Sign
Data Request - A validated
signDatarequest. - Sign
Data Result - Typed success body returned by
signData. - Sign
Message Feature - Advertised
SignMessagelimits. - Sign
Message Request - A validated
signMessagerequest. - Sign
Message Result - Typed success body returned by
signMessage. - Standard
Wallet State - Public state extracted from a recognized standard wallet
StateInit. - Structured
Transaction Payload - A transaction payload containing wallet-built structured items.
- TonAddress
Item - Request for the connected wallet address and optional target network hint.
- TonAddress
Item Reply - Connected account information returned for
ton_addr. - TonProof
- Wallet ownership proof returned during connect.
- TonProof
Domain - dApp domain bound into a
ton_proofsignature. - TonProof
Item - Request for a wallet ownership proof bound to a dApp payload.
- TonProof
Item Reply - Successful
ton_proofitem reply. - TraceId
- A UUID-shaped trace identifier accepted by the TON Connect bridge schema.
- Uint64
String - An unsigned 64-bit integer serialized as a canonical decimal string.
- Unsupported
Connect Item Error - Invalid construction of a forward-compatible connect item.
- Wallet
Event Cursor - Durable dApp-side cursor for monotonic wallet events.
- Wallet
Info - One validated wallet entry from
wallets-v2.json. - Wallet
Info Config - Unvalidated fields used to construct a
WalletInfo. - Wallet
Response Error - Protocol RPC error body.
- Wallet
Response Success - Successful wallet RPC response.
- Wallet
Session State - Persistable state required for monotonic IDs, replay rejection, and disconnect.
- Wallet
State Init - Canonical standard-base64 encoding of a valid, single-root TON
StateInitBoC. - Wallets
List - Non-empty validated TON Connect wallet registry.
Enums§
- Account
Address - Validated TON account address where the protocol permits raw or friendly form.
- Account
Verification Error - Failure while verifying a signed response against its connected account.
- AppMessage
- Anything a dApp can send to a wallet through TON Connect.
- Bridge
Codec Error - Failure while encoding or decoding an end-to-end encrypted bridge value.
- Capability
Error - A request exceeds the capabilities advertised by the connected wallet.
- Cell
BocError - Base64 text or decoded bytes are not a valid single-root cell
BoC. - Connect
Event - Wallet-initiated event sent to the dApp.
- Connect
Event Error Code - Connect-event error catalogue.
- Connect
Item - Data item requested during the initial connect handshake.
- Connect
Item Error Code - Per-connect-item protocol error catalogue.
- Connect
Item Reply - Reply corresponding to one requested connect item.
- Connect
Link Error - Failure to parse a TON Connect link.
- Connect
Validation Error - A connect event cannot be correlated safely with its initiating request.
- Device
Info Validation Error - Runtime wallet metadata is not a valid protocol-v2
DeviceInfovalue. - Device
Platform - Wallet runtime reported in
DeviceInfo. - Embedded
Request - An RPC request embedded in a connect link, before a request ID exists.
- Embedded
Request Error - Failure to decode or encode the compact
econnect-link parameter. - Embedded
Response - Method-specific response attached to a successful connect event.
- Feature
- Wallet capability advertised in
DeviceInfo.features. - Heartbeat
Mode - Heartbeat representation requested from the bridge SSE endpoint.
- Http
Bridge Error - Invalid bridge configuration or untrusted SSE input.
- Http
Session Error - Persisted HTTP bridge session is malformed or cryptographically inconsistent.
- JsBridge
Contract Error - Injected bridge metadata is internally inconsistent.
- Known
AppRequest - A known request with its nested JSON parameter parsed and validated.
- Known
Wallet Response - Method-specific response after correlation and payload validation.
- Manifest
Error - Semantic manifest validation failure beyond the scalar JSON schema.
- Request
Context Error - Request constraints conflict with the wallet’s active session context.
- Response
Validation Error - Failure to correlate or validate a wallet response for a known request.
- Return
Strategy - Action the wallet takes after the connect prompt completes.
- RpcError
- Failure while decoding or encoding an RPC request.
- RpcError
Code - Central TON Connect RPC error catalogue.
- RpcMethod
- RPC methods defined by the current TON Connect specification.
- Session
Crypto Error - A session encryption or decryption failure.
- Session
KeyPair Error - A failure to restore persisted TON Connect session key material.
- Session
State Error - A rejected session-state transition.
- Sign
Data Payload - Discriminated
signDatapayload. - Sign
Data Signing Payload - Borrowed payload used to build a TON Connect
signDatasigning digest. - Sign
Data Type - Data variants accepted by the
signDatamethod. - Signature
Domain - Signature domain accepted by TON Connect proof and
signDataverification. - Signing
Error - Failure to construct or verify a TON Connect signing payload.
- Standard
Wallet Version - Standard wallet contract recognized by local
StateInitinspection. - Structured
Item - A wallet-built structured transfer item.
- Structured
Item Type - Structured transfer kinds accepted by a wallet.
- Transaction
Payload - Payload shared by
sendTransactionandsignMessage. - Value
Error - A failure to validate a protocol scalar value.
- Wallet
Bridge - Bridge transport published by a wallet registry entry.
- Wallet
Event Cursor Error - Wallet event is replayed, reordered, or belongs to a terminated session.
- Wallet
Event Kind - Wallet event transition whose identifier is allocated by the session reducer.
- Wallet
Message - Anything a wallet can send to a dApp through TON Connect.
- Wallet
Platform - Platform identifier allowed by
wallets-v2.json. - Wallet
Response - Wallet response correlated to one dApp request ID.
- Wallet
Result - Success result permitted by the generic wallet-response schema.
- Wallet
Session Phase - Durable lifecycle phase of one wallet-side TON Connect session.
- Wallet
State Error - Failure to parse or authenticate a TON Connect wallet
StateInit. - Wallets
List Error - Wallet registry entry violates
wallets-v2.schema.jsonsemantics.
Constants§
- PROTOCOL_
VERSION - TON Connect transport protocol version implemented by this crate.
- SPEC_
REVISION - Normative specification revision used for this implementation.
Traits§
- JsBridge
- Runtime-neutral host contract matching
TonConnectBridgefrombridge.md.
Functions§
- decode_
embedded_ request_ param - Decodes the unpadded base64url
econnect-link parameter. - decode_
telegram_ url_ parameters - Decodes Telegram
startappsubstitutions back to a TON Connect query. - encode_
embedded_ request_ param - Encodes a request as the unpadded base64url
eparameter. - encode_
telegram_ url_ parameters - Encodes a TON Connect query for Telegram’s
startapptransport. - sign_
data_ signing_ hash - Computes the 32-byte digest that a wallet signs for
signData. - ton_
proof_ message - Builds the exact preimage inside the two SHA-256 rounds of
ton_proof. - ton_
proof_ signing_ hash - Computes the 32-byte digest that a wallet signs for
ton_proof. - verify_
signature - Verifies an Ed25519 signature over an already constructed TON Connect digest.
Type Aliases§
- JsBridge
Event Listener - Callback receiving wallet-initiated events from an injected bridge.
- Wallet
Event - Wallet-initiated event carried by TON Connect.