Skip to content

Feat: update API Client#90

Open
nikdim03 wants to merge 7 commits into
mainfrom
feature/ton-1220-get-network
Open

Feat: update API Client#90
nikdim03 wants to merge 7 commits into
mainfrom
feature/ton-1220-get-network

Conversation

@nikdim03
Copy link
Copy Markdown
Contributor

No description provided.

@nikdim03 nikdim03 changed the base branch from main to feature/ton-1379-update-models May 20, 2026 09:31
@ProudOfZiggy
Copy link
Copy Markdown
Contributor

@nikdim03 Are you sure we updated all needed in this PR? I see we updated test for api client, but we didn't update any api client at all

@nikdim03 nikdim03 changed the base branch from feature/ton-1379-update-models to main May 20, 2026 19:27
nikdim03 added 4 commits May 20, 2026 22:27
The TON-1384 'narrow TONAPIClient' commit removed getBalance citing iOS
parity, but iOS actually has balance() on TONAPIClient (see kit-ios
feature/TON-1200-update-api-client and TON-1320-update-api-client) — the
iOS dev never removed it, only added.

Restores the full plumbing:
- TONAPIClient.getBalance(address, seqno?) abstract method
- BridgedJSAPIClient delegation
- WebViewManager.apiGetBalance @JavascriptInterface
- WalletKitEngine.walletClientGetBalance + RPC + request type
- METHOD_WALLET_CLIENT_GET_BALANCE constant
- All 3 demo TestAPIClient impls (mock / Toncenter / TonAPI)
- StubbedClient in TONAPIClientNetworkTest
@nikdim03 nikdim03 changed the title Feature/ton 1220 get network Feat: update API Client May 21, 2026
internal class BridgedJSAPIClient(
private val walletId: String,
private val engine: WalletKitEngine,
private val walletNetwork: TONNetwork,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@nikdim03 Just network

}

@JavascriptInterface
fun apiGetNetworkForChainId(chainId: String): String {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@nikdim03 I still don't understands purpose of this

override val client: TONAPIClient = BridgedJSAPIClient(
walletId = id,
engine = engine,
walletNetwork = engine.network,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@nikdim03 If it's called walletNetwork they why do we take engine network? What is engine network actually? Aren't we have one engine?

try {
Logger.d(TAG, "apiGetBalance: network=$network, address=$address")
// JS passes -1 to represent a missing optional seqno.
val seqnoArg = if (seqno == -1) null else seqno
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@nikdim03 Why do we have any logic here? All logic should be on JS side

}

@JavascriptInterface
fun apiFetchEmulation(networkJson: String, messageBoc: String, ignoreSignature: Int): String =
Copy link
Copy Markdown
Contributor

@ProudOfZiggy ProudOfZiggy May 22, 2026

Choose a reason for hiding this comment

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

@nikdim03 Is it possible to just use Bool for ignoreSignature parameter type? Also - in JS ignoreSignature is an optional parameter

@ProudOfZiggy
Copy link
Copy Markdown
Contributor

@nikdim03 Completely recheck with JS code

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.

2 participants