Skip to main content

Crate ton_connect_core

Crate ton_connect_core 

Source
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§

AccountAddressError
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.
Base64Value
A validated standard or URL-safe base64 wire value.
BridgeMessage
One encrypted message delivered by the HTTP bridge over SSE.
BridgeSseDecoder
Incremental decoder for the text/event-stream returned by /events.
BridgeSseMessage
One decoded bridge message together with its SSE resume cursor.
CellBoc
Base64 wire value known to contain exactly one valid TON cell root.
ClientId
A 32-byte X25519 public key encoded as 64 lowercase hexadecimal characters.
ConnectEventError
Error details carried by a connect_error event.
ConnectEventPayload
Payload of a successful connect event.
ConnectItemError
Error reply for a specific requested connect item.
ConnectLink
A parsed TON Connect universal, unified, or custom-scheme link.
ConnectRequest
Initial plaintext request carried by a TON Connect deep link.
DecimalString
A non-negative integer in the decimal-string wire representation.
DeviceInfo
Wallet self-description returned in a successful connect event.
DisconnectRequest
A validated disconnect request.
Ed25519PublicKey
A 32-byte Ed25519 public key encoded as lowercase hex on the wire.
Ed25519Signature
A 64-byte Ed25519 signature encoded as canonical standard base64.
EmbeddedResponseError
Error body for an embedded action.
EmbeddedResponseSuccess
Success body for an embedded action.
EmptyObject
Protocol object that is valid only when it contains no properties.
ExtraCurrencies
Extra-currency identifier to non-negative elementary-unit amount.
FeatureValidationError
Feature capability violates the normative schema constraints.
FriendlyAddress
Validated TEP-2 base64url address with bounce and test-only flags intact.
FriendlyAddressError
A value is not a canonical TEP-2 user-friendly address.
HttpBridgeUrl
Validated base URL of a TON Connect HTTP bridge.
HttpsUrl
An absolute HTTPS URL with a host.
InjectedWalletInfo
Optional wallet metadata exposed directly by an injected bridge.
JsBridgeDescriptor
Static properties exposed by window.<key>.tonconnect.
NetworkId
A TON network global_id encoded as the opaque stringified-integer wire value.
NonEmptyVec
A protocol array statically known to contain at least one value.
PersistedHttpSession
Confidential state required to resume one wallet-side HTTP bridge session.
PersistedSessionKeyPair
Serializable key material required to resume one HTTP-bridge session.
PreparedAppRequest
Accepted request plus the state that must be persisted before processing.
PreparedBridgePost
Fully prepared body and URL for one HTTP bridge POST /message call.
PreparedWalletEvent
Prepared event ID plus the state that must be persisted before publication.
PreparedWalletEventReceipt
Accepted wallet event and cursor that must be persisted first.
RawAccountAddress
Canonical raw TON account address used by TON Connect signed payloads.
RawMessage
A raw outgoing message in sendTransaction or signMessage.
RawTransactionPayload
A transaction payload containing caller-built raw messages.
RpcMethodError
A method name is not part of the current TON Connect RPC catalogue.
RpcRequestId
A dApp RPC request ID ordered as an arbitrary-precision unsigned integer.
SendTransactionFeature
Advertised SendTransaction limits.
SendTransactionRequest
A validated sendTransaction request.
SessionCrypto
NaCl crypto_box session cryptography used by the TON Connect HTTP bridge.
SignDataFeature
Advertised SignData variants.
SignDataRequest
A validated signData request.
SignDataResult
Typed success body returned by signData.
SignMessageFeature
Advertised SignMessage limits.
SignMessageRequest
A validated signMessage request.
SignMessageResult
Typed success body returned by signMessage.
StandardWalletState
Public state extracted from a recognized standard wallet StateInit.
StructuredTransactionPayload
A transaction payload containing wallet-built structured items.
TonAddressItem
Request for the connected wallet address and optional target network hint.
TonAddressItemReply
Connected account information returned for ton_addr.
TonProof
Wallet ownership proof returned during connect.
TonProofDomain
dApp domain bound into a ton_proof signature.
TonProofItem
Request for a wallet ownership proof bound to a dApp payload.
TonProofItemReply
Successful ton_proof item reply.
TraceId
A UUID-shaped trace identifier accepted by the TON Connect bridge schema.
Uint64String
An unsigned 64-bit integer serialized as a canonical decimal string.
UnsupportedConnectItemError
Invalid construction of a forward-compatible connect item.
WalletEventCursor
Durable dApp-side cursor for monotonic wallet events.
WalletInfo
One validated wallet entry from wallets-v2.json.
WalletInfoConfig
Unvalidated fields used to construct a WalletInfo.
WalletResponseError
Protocol RPC error body.
WalletResponseSuccess
Successful wallet RPC response.
WalletSessionState
Persistable state required for monotonic IDs, replay rejection, and disconnect.
WalletStateInit
Canonical standard-base64 encoding of a valid, single-root TON StateInit BoC.
WalletsList
Non-empty validated TON Connect wallet registry.

Enums§

AccountAddress
Validated TON account address where the protocol permits raw or friendly form.
AccountVerificationError
Failure while verifying a signed response against its connected account.
AppMessage
Anything a dApp can send to a wallet through TON Connect.
BridgeCodecError
Failure while encoding or decoding an end-to-end encrypted bridge value.
CapabilityError
A request exceeds the capabilities advertised by the connected wallet.
CellBocError
Base64 text or decoded bytes are not a valid single-root cell BoC.
ConnectEvent
Wallet-initiated event sent to the dApp.
ConnectEventErrorCode
Connect-event error catalogue.
ConnectItem
Data item requested during the initial connect handshake.
ConnectItemErrorCode
Per-connect-item protocol error catalogue.
ConnectItemReply
Reply corresponding to one requested connect item.
ConnectLinkError
Failure to parse a TON Connect link.
ConnectValidationError
A connect event cannot be correlated safely with its initiating request.
DeviceInfoValidationError
Runtime wallet metadata is not a valid protocol-v2 DeviceInfo value.
DevicePlatform
Wallet runtime reported in DeviceInfo.
EmbeddedRequest
An RPC request embedded in a connect link, before a request ID exists.
EmbeddedRequestError
Failure to decode or encode the compact e connect-link parameter.
EmbeddedResponse
Method-specific response attached to a successful connect event.
Feature
Wallet capability advertised in DeviceInfo.features.
HeartbeatMode
Heartbeat representation requested from the bridge SSE endpoint.
HttpBridgeError
Invalid bridge configuration or untrusted SSE input.
HttpSessionError
Persisted HTTP bridge session is malformed or cryptographically inconsistent.
JsBridgeContractError
Injected bridge metadata is internally inconsistent.
KnownAppRequest
A known request with its nested JSON parameter parsed and validated.
KnownWalletResponse
Method-specific response after correlation and payload validation.
ManifestError
Semantic manifest validation failure beyond the scalar JSON schema.
RequestContextError
Request constraints conflict with the wallet’s active session context.
ResponseValidationError
Failure to correlate or validate a wallet response for a known request.
ReturnStrategy
Action the wallet takes after the connect prompt completes.
RpcError
Failure while decoding or encoding an RPC request.
RpcErrorCode
Central TON Connect RPC error catalogue.
RpcMethod
RPC methods defined by the current TON Connect specification.
SessionCryptoError
A session encryption or decryption failure.
SessionKeyPairError
A failure to restore persisted TON Connect session key material.
SessionStateError
A rejected session-state transition.
SignDataPayload
Discriminated signData payload.
SignDataSigningPayload
Borrowed payload used to build a TON Connect signData signing digest.
SignDataType
Data variants accepted by the signData method.
SignatureDomain
Signature domain accepted by TON Connect proof and signData verification.
SigningError
Failure to construct or verify a TON Connect signing payload.
StandardWalletVersion
Standard wallet contract recognized by local StateInit inspection.
StructuredItem
A wallet-built structured transfer item.
StructuredItemType
Structured transfer kinds accepted by a wallet.
TransactionPayload
Payload shared by sendTransaction and signMessage.
ValueError
A failure to validate a protocol scalar value.
WalletBridge
Bridge transport published by a wallet registry entry.
WalletEventCursorError
Wallet event is replayed, reordered, or belongs to a terminated session.
WalletEventKind
Wallet event transition whose identifier is allocated by the session reducer.
WalletMessage
Anything a wallet can send to a dApp through TON Connect.
WalletPlatform
Platform identifier allowed by wallets-v2.json.
WalletResponse
Wallet response correlated to one dApp request ID.
WalletResult
Success result permitted by the generic wallet-response schema.
WalletSessionPhase
Durable lifecycle phase of one wallet-side TON Connect session.
WalletStateError
Failure to parse or authenticate a TON Connect wallet StateInit.
WalletsListError
Wallet registry entry violates wallets-v2.schema.json semantics.

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 TonConnectBridge from bridge.md.

Functions§

decode_embedded_request_param
Decodes the unpadded base64url e connect-link parameter.
decode_telegram_url_parameters
Decodes Telegram startapp substitutions back to a TON Connect query.
encode_embedded_request_param
Encodes a request as the unpadded base64url e parameter.
encode_telegram_url_parameters
Encodes a TON Connect query for Telegram’s startapp transport.
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§

JsBridgeEventListener
Callback receiving wallet-initiated events from an injected bridge.
WalletEvent
Wallet-initiated event carried by TON Connect.