chore: In gnoNativeService, support using the remote Gnokey Mobile service #163
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.
PR gnolang/gnokey-mobile#2 creates the Gnokey Mobile service. This PR updates
GnoNativeService
with the option to use the remote Gnokey Mobile service as needed (for example, to sign a transaction).UseGnokeyMobile
.initService
, ifUseGnokeyMobile
then setgnokeyMobileClient
to a gRPC client connected to the remote Gnokey Mobile service. Setclient
to a gnoclient without a Keybase (because the purpose is to use Keybase in the remote Gnokey Mobile service).gnoNativeService
, addgetClient
which returns the correctgnoclient.Client
. If notuseGnokeyMobile
then simply returns.client
. IfuseGnokeyMobile
then it's possible that Gnokey Mobile has been changed to use a different gno.land remote, so we must call the Gnokey Mobile methodGetRemote
. If this is different from our locals.remote
then reconfigure theRPCClient
of the gnoclient and save the news.remote
. ChangeQueryAccount
,Query
,Render
andQEval
to callgetClient
and then proceed as normal. This means that if an app is using Gno Native Kit withUseGnokeyMobile
, then the app can send these queries directly to the gno.land remote node, but we must make sure that it is the correct remote.GetRemote
andListKeyInfo
, ifuseGnokeyMobile
then we directly use the Gnokey Mobile service.Call
, ifuseGnokeyMobile
then use the localMakeCallTx
to make the transaction. Use theSignTx
API of the remote Gnokey Mobile service to sign the transaction. Then use the localBroadcastTxCommit
to broadcast the signed transaction and get the streaming result.The above changes allow an app to configure its Gno Native Kit to use a gRPC client with the Gnokey Mobile service. But we still need the Gnokey Mobile app to start the Gnokey Mobile gRPC server. The following changes allow the Gnokey Mobile app to set
start_gnokey_mobile_service
in the configuration for itsGnoNativeProvider
.Bridge
, addStartGnokeyMobileService
. See the description comment. Add this method to the TypeScriptGoBridgeInterface
and to the Java and SwiftGnonativeModule
.Config
, add a flagstart_gnokey_mobile_service
. Check this flag in theGnoNativeApi
initClient
and callstartGnokeyMobileService()
.