perun-network / erdstall-ts-sdk

TypeScript client SDK to interact with Erdstall.
Apache License 2.0
5 stars 2 forks source link

Split Erdstall and Ledger Client into Client and Session #33

Closed sebastianst closed 3 years ago

sebastianst commented 3 years ago

The LedgerConnection, EnclaveConnection and Erdstall interfaces currently mix up read-only operations (state reads and event subscriptions) and write operations (sending of transactions). This is problematic because a read-only user like a marketplace only needs the read parts. Also, the implementations need signers, which a read-only actor doesn't have and shouldn't need to provide.

So we split up the interfaces and call the read-only part Client/Reader and the extended write part Session/Writer. Interface Erdstall from erdstall.ts should become ErdstallSession. It extends ErdstallClient, which only extends the read-only interfaces. The Enclave and Ledger connections are split into Reader and Writer parts.

Full interface extension tree

The following tree shows how interfaces extend (embed) each other, and mentions some methods explicitly.

ErdstallSession

Implementations

The implementations also need to be split up, so that we can have a read-only Client that implements the ErdstallClient interface and a writing, user-bound ErdstallSession that implements the Session interface.

sebastianst commented 3 years ago

@RmbRT please check if #37 implemented a sensible hierarchy. It doesn't need to be exactly as above, of course, but be sensible.