Skip to main content

Introduction

The process of seeking a transaction associated with an external-in message is called message lookup. It should only be used for better UX to display, for example, the progress of the operation and its result.

Message normalization

Normalization is a standardization process that converts different external-in message representations into a consistent format. This needs to be done because the structure of external-in messages allows the same message to be constructed in different forms, which results in different possible hashes for the same external message. To address this, the ecosystem defines a standard that ensures consistent hash calculation. The normalization rules are specified in detail in the TEP-467 proposal. Message lookup by its normalized hash is already implemented in most TON RPC providers. How normalization works: The normalized hash is computed by applying the following standardization rules to an external-in message:
  1. Source Address (src): set to addr_none$00
  2. Import Fee (import_fee): set to 0
  3. InitState (init): set to an empty value
  4. Body: always stored as a reference

Transaction lookup using external message from TON Connect

Retrying API calls

Sometimes API requests may fail due to rate limits or network issues. Use the retry function presented below to deal with api failures:

Find the transaction by incoming message

The getTransactionByInMessage function searches the account’s transaction history for a match by normalized external message hash:
If found, it returns a Transaction object. Otherwise, it returns undefined.

Example

Waiting for transaction confirmation

If you’ve just sent a message, it may take a few seconds before it appears on-chain. The function waitForTransaction to poll the blockchain and wait for the corresponding transaction should be used in this case:

Example

See also