Feat: update API Client#90
Open
nikdim03 wants to merge 7 commits into
Open
Conversation
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 |
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
| internal class BridgedJSAPIClient( | ||
| private val walletId: String, | ||
| private val engine: WalletKitEngine, | ||
| private val walletNetwork: TONNetwork, |
| } | ||
|
|
||
| @JavascriptInterface | ||
| fun apiGetNetworkForChainId(chainId: String): String { |
Contributor
There was a problem hiding this comment.
@nikdim03 I still don't understands purpose of this
| override val client: TONAPIClient = BridgedJSAPIClient( | ||
| walletId = id, | ||
| engine = engine, | ||
| walletNetwork = engine.network, |
Contributor
There was a problem hiding this comment.
@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 |
Contributor
There was a problem hiding this comment.
@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 = |
Contributor
There was a problem hiding this comment.
@nikdim03 Is it possible to just use Bool for ignoreSignature parameter type? Also - in JS ignoreSignature is an optional parameter
Contributor
|
@nikdim03 Completely recheck with JS code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.