> For the complete documentation index, see [llms.txt](https://vladimirs-organization-15.gitbook.io/prophet-swap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vladimirs-organization-15.gitbook.io/prophet-swap/prophet-swap.md).

# Prophet Swap

## Quick Start

```html


1. Add required script to your HTML:
<script src="https://krc20.safunet.com/bundle.js"></script>

2. Add html tag
<token-swap-chat
    theme="dark"
    default-tokens="KAS,KRTO,PINTL,NACHO"
    default-buy-token="PINTL">
</token-swap-chat>


Example:
<!DOCTYPE html>
<html>
<head>
    <title>Prophet Swap Integration</title>
    <script src="https://krc20.safunet.com/bundle.js"></script>
</head>
<body>
    <token-swap-chat
        theme="dark"
        default-tokens="KAS,KRTO,PINTL,NACHO"
        default-buy-token="PINTL">
    </token-swap-chat>

    <script>
        const chat = document.querySelector('token-swap-chat');
        
        // Optional: Customize theme
        chat.updateTheme({
            dimensions: {
                height: '600px',
                width: '440px'
            }
        });

        // Optional: Handle events
        chat.addEventListener('message', (e) => {
            console.log('Transaction status:', e.detail);
        });
    </script>
</body>
</html>
```

## Available Settings

### HTML Attributes

```html
<token-swap-chat
    theme="dark|light"
    default-tokens="KAS,KRTO,PINTL"
    default-buy-token="PINTL"
    title="Prophet Swap"
    subtitle="Available commands: /swap, /buy"
    connect-message="Please connect your wallet"
    disconnect-message="Wallet disconnected"
    input-placeholder="Type a command or message..."
    connect-button-text="Connect Wallet"
    confirm-button-text="Confirm"
    cancel-button-text="Cancel"
>
</token-swap-chat>
```

### Theme Configuration

```javascript
chat.updateTheme({
    fontFamily: 'Inter, sans-serif',
    fontSize: {
        base: '0.9375rem',
        small: '0.875rem',
        title: '1.125rem'
    },
    colors: {
        primary: '#2563eb',
        primaryHover: '#1d4ed8',
        background: '#ffffff',
        text: '#1a1a1a',
        border: '#e5e7eb',
        messageUser: {
            background: '#2563eb',
            text: '#ffffff'
        },
        messageBot: {
            background: '#f3f4f6',
            text: '#1a1a1a'
        }
    },
    dark: {
        background: '#111827',
        text: '#f9fafb',
        border: '#374151',
        messageBot: {
            background: '#1f2937',
            text: '#f9fafb'
        }
    },
    borderRadius: {
        container: '16px',
        button: '12px',
        input: '12px'
    },
    dimensions: {
        height: '600px',
        width: '440px',
        padding: '16px'
    }
});
```

### Text Configuration

```javascript
chat.updateText({
    title: "Prophet Swap",
    subtitle: "Available commands: /swap, /buy",
    connectMessage: "Please connect your KASWARE wallet to start trading",
    disconnectMessage: "Wallet disconnected. Please connect your wallet to continue.",
    inputPlaceholder: "Type a command or message...",
    connectButtonText: "Connect KASWARE Wallet",
    confirmButtonText: "Confirm",
    cancelButtonText: "Cancel"
});
```

### Available Methods

```javascript
// Wallet connection
await chat.connect();
await chat.disconnect();

// Interface management
await chat.reset();
const history = chat.getHistory();

// Configuration
chat.updateTheme(themeConfig);
chat.updateText(textConfig);
chat.configure({
    defaultTokens: ['KAS', 'KRTO', 'PINTL'],
    defaultBuyToken: 'PINTL'
});
```

### Events

```javascript
chat.addEventListener('stateChanged', (e) => {
    // Wallet state changed
    console.log('Wallet state:', e.detail);
});

chat.addEventListener('message', (e) => {
    // New message received
    console.log('Message:', e.detail);
});

chat.addEventListener('error', (e) => {
    // Error occurred
    console.log('Error:', e.detail);
});
```

### Message Types

```typescript
interface MessageData {
    id: number;
    type: MessageType.USER | MessageType.BOT;
    text: string;
    buttons?: MessageButtons;
}

interface MessageButtons {
    type: 'token_select' | 'quick_buy' | 'confirm' | 'connect_wallet';
    tokens?: Token[];
    symbol?: string;
    data?: { action: string };
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://vladimirs-organization-15.gitbook.io/prophet-swap/prophet-swap.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
