API Reference

SDK Installation

Install via npm

To install the SDK using npm, run the following command:

npm install --save ton-ai-sdk

Include via CDN

To include the SDK via a CDN, add the following script tag to your HTML file:

<script src="https://cdn.jsdelivr.net/npm/ton-ai-sdk/dist/index.js"></script>

Initializing the SDK

In a React Project

To initialize the SDK in a React project, import the SDK in your main file, such as App.jsx:

import { TonAdInit } from 'ton-ai-sdk';

Then, initialize the SDK inside a useEffect hook:

useEffect(() => {
    const result = TonAdInit();
    console.log('TonAdInit', result);
}, []);

In Other Frameworks

For other frameworks, you can initialize the SDK once the page has fully loaded:

<script>
  document.addEventListener('DOMContentLoaded', function () {
    // Initialize TonAd once the DOM is ready
    TonAdInit();
  });
</script>