Skip to content

TON-1658: tonapi support in minter#478

Open
heyllog wants to merge 1 commit into
mainfrom
feat/TON-1658-minter-tonapi
Open

TON-1658: tonapi support in minter#478
heyllog wants to merge 1 commit into
mainfrom
feat/TON-1658-minter-tonapi

Conversation

@heyllog

@heyllog heyllog commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for dynamic API provider configuration enabling users to select between available providers through environment settings.
    • Introduced Tetra API key configuration capability.
  • Chores

    • Enhanced environment configuration system with new provider selection options.

@heyllog heyllog self-assigned this Jun 18, 2026
@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
appkit-minter Ready Ready Preview, Comment Jun 18, 2026 7:56am
kit-demo-wallet Ready Ready Preview, Comment Jun 18, 2026 7:56am

Request Review

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Two configuration files in appkit-minter are updated to support runtime selection between TonAPI and Toncenter. env.ts gains ENV_TON_API_PROVIDER (defaulting to 'toncenter') and ENV_TON_API_KEY_TETRA. app-kit.ts uses these to conditionally construct API clients, streaming providers, and gasless configuration.

Changes

Dynamic TonAPI/Toncenter Provider Selection

Layer / File(s) Summary
New environment constants
apps/appkit-minter/src/core/configs/env.ts
Adds ENV_TON_API_PROVIDER (from VITE_TON_API_PROVIDER, defaulting to 'toncenter') and ENV_TON_API_KEY_TETRA (from VITE_TON_API_TETRA_KEY, defaulting to '').
Dynamic client, streaming, and gasless wiring
apps/appkit-minter/src/core/configs/app-kit.ts
Adds createTonApiStreamingProvider import and ENV_TON_API_KEY_TETRA import; introduces useTonApi flag, createApiClient() and createStreamingProvider() helpers for conditional provider selection, a Tetra API client with key, conditional gaslessConfig, and updates appKit providers array to use these helpers.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Hop hop, a flag to choose the way,
TonAPI or Toncenter — your call today!
The streaming flows, the gasless keys align,
A little env var draws the dotted line.
No exports changed, no contracts broke,
Just cleaner paths with every keystroke! 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main feature being added: tonapi support to the minter component, which aligns with the PR objective and the substantial configuration changes in app-kit.ts and env.ts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/TON-1658-minter-tonapi

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
apps/appkit-minter/src/core/configs/app-kit.ts (1)

56-67: 💤 Low value

Redundant truthiness check on API keys.

Since ENV_TON_API_KEY_MAINNET and ENV_TON_API_KEY_TESTNET both have hardcoded default values in env.ts, the (ENV_TON_API_KEY_MAINNET || ENV_TON_API_KEY_TESTNET) condition is always truthy. The effective condition is just useTonApi.

Consider simplifying or updating the comment to reflect the actual intent—if it's meant to guard against explicitly empty keys overriding the defaults, the current check won't catch that either.

♻️ Suggested simplification
-const gaslessConfig =
-    useTonApi && (ENV_TON_API_KEY_MAINNET || ENV_TON_API_KEY_TESTNET)
-        ? {
+const gaslessConfig = useTonApi
+    ? {
               chains: {
                   [Network.mainnet().chainId]: { apiKey: ENV_TON_API_KEY_MAINNET },
                   [Network.testnet().chainId]: { apiKey: ENV_TON_API_KEY_TESTNET },
               },
           }
-        : undefined;
+    : undefined;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/appkit-minter/src/core/configs/app-kit.ts` around lines 56 - 67, The
gaslessConfig assignment in the app-kit.ts file contains a redundant truthiness
check on ENV_TON_API_KEY_MAINNET and ENV_TON_API_KEY_TESTNET. Since these
environment variables have hardcoded default values in env.ts, they are always
truthy, making the (ENV_TON_API_KEY_MAINNET || ENV_TON_API_KEY_TESTNET)
condition redundant. Simplify the conditional logic to just check useTonApi,
since that is the only meaningful condition. If there is a specific intent to
handle explicitly empty keys differently, clarify this in the comment or adjust
the logic accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@apps/appkit-minter/src/core/configs/app-kit.ts`:
- Around line 56-67: The gaslessConfig assignment in the app-kit.ts file
contains a redundant truthiness check on ENV_TON_API_KEY_MAINNET and
ENV_TON_API_KEY_TESTNET. Since these environment variables have hardcoded
default values in env.ts, they are always truthy, making the
(ENV_TON_API_KEY_MAINNET || ENV_TON_API_KEY_TESTNET) condition redundant.
Simplify the conditional logic to just check useTonApi, since that is the only
meaningful condition. If there is a specific intent to handle explicitly empty
keys differently, clarify this in the comment or adjust the logic accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 49281bd1-8d0c-40b6-8233-9576d14fb2fd

📥 Commits

Reviewing files that changed from the base of the PR and between db00ed0 and 156bbef.

📒 Files selected for processing (2)
  • apps/appkit-minter/src/core/configs/app-kit.ts
  • apps/appkit-minter/src/core/configs/env.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant