You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We want to use Gno Native Kit as a service where multiple clients are
interacting with it simultaneously. Therefore we want to move away from
the statefulness of the "active account", and instead require the client
to specify the address of the account to use on each call. This PR adds
this functionality but still supports the "active account". (We will
remove "active account" when dSocial and Gnokey Mobile are changed to
use the new API). This PR has four commits:
1. Many API methods such as `HasKeyByName` only need to interact with
the Keybase (not the RPC connection or signing). In `gnoNativeService`,
add the field `keybase` and use this where possible instead of
`getSigner().Keybase`. This is helpful because we will change
`getSigner`.
2. The `userAccount` struct currently holds the `password`. We change
this to hold the `signer` (which has the password inside). In
`gnoNativeService`, we also save the `chainID` separately. When
`SelectAccountRequest` creates a new `userAccount`, create a new signer
including the `chainID`. Change `getSigner` to take an account address
and use this to look up the signer in `s.userAccounts`. For temporary
backwards comptability, if the address is nil then use the active
account.
4. In `gnoNativeService`, change the gnomobile `client` field to only
hold the `rpcClient`. Change `getClient` to take an optional `signer`
and to return a new `gnoclient.Client` with the `signer` and the
`rpcClient`. In `Call`, `Send` and `Run`, use `getSigner` to use the
`CallerAddress` if available (instead of the "active account").
5. Add API methods `ActivateAccount` and `GetActivatedAccount`.
Deprecate `SelectAccount` and `GetActiveAccount`. See rpc.proto for
details. In gnonativetypes.go, add an `Address` field to
`SetPasswordRequest`, `UpdatePasswordRequest` and `SignTxRequest`. Use
this address in `getSigner`. Update the interface for
`GnoNativeService.ClientSignTx` to take the address.
(Due to circular dependencies with gnokey-mobile, this PR doesn't update
the expo module. We'll do another PR.)
---------
Signed-off-by: Jeff Thompson <[email protected]>
0 commit comments