Skip to content

Conversation

@Twey
Copy link
Contributor

@Twey Twey commented Dec 4, 2025

Motivation

In #2194 I tried to abstract over the wallet by introducing a trait for values that could be persisted. However, this still exposed too much information about the wallet: the wallet data structure used by linera-client (then linera-service) contains additional information that is not useful to the core client. This made incremental porting hard, as to move the wallet into linera-core implied moving all that data (which includes TCP/gRPC-specific address information) into linera-core as well, where it does not belong. Much of this information (signing keys) has been separated out into the keystore.json in #3696, but some still remains (the default chain and the genesis config).

Now, in order to support wallet autosigning, we would like to support implementing wallets for more complicated JavaScript structures as well, which may not map neatly to the CLI wallet.json file structure.

Proposal

Add a Wallet trait to linera-core (as a component of Environment) that only exposes the part of the interface related to managing chains, as trait methods. Currently the trait expects shared-ref &self methods as the client will duplicate the wallet all over the place; after future client refactorings we can probably simplify it to support &mut methods.

Generalize linera-service to maintain the Environment abstraction a little better, though there are still places that fix various component types.

Test Plan

CI should be sufficient.

Release Plan

  • These changes should be backported to the latest testnet branch, then
    • be released in a new SDK,

Links

@Twey Twey marked this pull request as ready for review December 6, 2025 02:11
@@ -1,1008 +1,800 @@
// Copyright (c) Zefchain Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did the PR need to refactor this file?

Copy link
Contributor Author

@Twey Twey Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't have to, but I got frustrated making a bunch of changes to it every time I called ClientContext::new, so I refactored it to speed up my development.

(It could probably be done in a separate PR — but I'd already changed the APIs it calls and it was 3am 😅)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants