-
Notifications
You must be signed in to change notification settings - Fork 11.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor ClientState API #584
Conversation
2bf48ab
to
55c96b1
Compare
55c96b1
to
12f13ed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need another round of refactoring after #594
LGTM
@@ -325,21 +325,25 @@ async fn sui_start( | |||
|
|||
// Sync all accounts. | |||
for address in addresses.iter() { | |||
let client_state = wallet_context | |||
.get_or_create_client_state(address) | |||
wallet_context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rest server should create its own account manager instead of using the wallet context, we can fix this after key pair removal, rest server will no longer need to handle keys after that.
wallet_context | ||
.create_account_state(address) | ||
.map_err(|error| { | ||
custom_http_error( | ||
StatusCode::FAILED_DEPENDENCY, | ||
format!("Could not get or create client state: {error}"), | ||
)); | ||
} | ||
}; | ||
let object_refs = client_state.object_refs(); | ||
) | ||
})?; | ||
let object_refs = wallet_context.address_manager.get_owned_objects(*address); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we shouldn't need to call create_account_state
explicitly, the account manager should handle it internally, however I guess it is not doable at the moment because of the key pair, will need to refactor this after #594
12f13ed
to
13c69dc
Compare
This is to address #577.
The current Client APIs are all implemented on ClientState which is per-account. This is problematic.
We want the APIs to be implemented on ClientAddressManager.
This PR moves all APIs over, and fixes all uses, tests and etc.