-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: In gnoNativeService, support using the remote Gnokey Mobile se…
…rvice (#163) 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). * In BridgeConfig and service.Config, add the config flag `UseGnokeyMobile`. * In `initService`, if `UseGnokeyMobile` then set `gnokeyMobileClient` to a gRPC client connected to the remote Gnokey Mobile service. Set `client` to a gnoclient without a Keybase (because the purpose is to use Keybase in the remote Gnokey Mobile service). * In `gnoNativeService`, add `getClient` which returns the correct `gnoclient.Client`. If not `useGnokeyMobile` then simply return `s.client` . If `useGnokeyMobile` then it's possible that Gnokey Mobile has been changed to use a different gno.land remote, so we must call the Gnokey Mobile method `GetRemote` . If this is different from our local `s.remote` then reconfigure the `RPCClient` of the gnoclient and save the new `s.remote`. Change `QueryAccount`, `Query`, `Render` and `QEval` to call `getClient` and then proceed as normal. This means that if an app is using Gno Native Kit with `UseGnokeyMobile`, 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. * In `GetRemote` and `ListKeyInfo`, if `useGnokeyMobile` then we directly use the Gnokey Mobile service. * In `Call`, if `useGnokeyMobile` then use the local `MakeCallTx` to make the transaction. Use the `SignTx` API of the remote Gnokey Mobile service to sign the transaction. Then use the local `BroadcastTxCommit` 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](https://github.com/gnolang/dsocial/blob/925846f2055e9f107cd91ddb776afa3e7be06820/mobile/app/_layout.tsx#L10-L13) for its `GnoNativeProvider`. * In the Go `Bridge`, add `StartGnokeyMobileService`. See the description comment. Add this method to the TypeScript `GoBridgeInterface` and to the Java and Swift `GnonativeModule`. * In the TypeScript `Config`, add a flag `start_gnokey_mobile_service`. Check this flag in the `GnoNativeApi` `initClient` and call `startGnokeyMobileService()`. --------- Signed-off-by: Jeff Thompson <[email protected]>
- Loading branch information
Showing
11 changed files
with
230 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.