From 6d9674289ee6c3cb46c70cdda453145d74e88b3e Mon Sep 17 00:00:00 2001 From: SergeyG-Solicy Date: Fri, 13 Mar 2026 15:31:37 +0400 Subject: [PATCH] Added TonCenter API key support --- src/multichain/core/ton.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/multichain/core/ton.ts b/src/multichain/core/ton.ts index bfe4dfd9..c40af016 100644 --- a/src/multichain/core/ton.ts +++ b/src/multichain/core/ton.ts @@ -26,14 +26,25 @@ export class TON extends DefaultChain { this.name = "ton" } + private _apiKey?: string + override setRpc(rpc_url: string): void { this.rpc_url = rpc_url this.provider = new TonClient({ endpoint: this.rpc_url, + ...(this._apiKey && { apiKey: this._apiKey }), }) } + setApiKey(apiKey: string): void { + this._apiKey = apiKey + // Recreate provider with the API key + if (this.rpc_url) { + this.setRpc(this.rpc_url) + } + } + async connect() { try { const info = await this.provider.getMasterchainInfo()