Commit 7b6e921
authored
Remove the
## Motivation
We have the `Account` in two contexts:
* The `linera-sdk/src/abis/fungible.rs`
* The `linera-base/src/identifiers.rs`
which is not great. This PR unifies both types.
Fixes #2496
Fixes #3462
## Proposal
It is a given fact that in Linera, we will have a type `Account` that
contains both the `ChainId` and the `AccountOwner`. An additional
complication is that GraphQL forces to have one type in input and
another type in output.
The current design is to use the `fungible::Account` for the GraphQL
with the following (simplified) design:
```rust
#[derive(SimpleObject, InputObject)]
#[graphql(input_name = "FungibleAccount")]
struct Account { .... }
```
with this design the input type is `FungibleAccount` and the output type
is `Account`. This is inadequate since an account could have many usage
besides `FungibleAccount`. This is the error visible in issue #3462.
Instead the types should reflect the nature of the type; things like
`AccountInput`, `AccountOutput` and so on.
Generally, we assign a specific type to the input with something like
`TypeInput`. That is not great in our context. The type `Account` will
mostly be on input, and rarely on output. Therefore, we choose to use
`Account` on input and `AccountOutput` on output. This is done via the
following:
```rust
#[graphql(name = "AccountOutput", input_name = "Account")]
```
With this change, we can simplify the `FungibleAccount` into `Account`
for the input. The output type `AccountOutput` concerns only the refund
grant to entry for cross-chain messages.
## Test Plan
The CI addresses it.
However, the change from `FungibleAccount` to `Account` means that some
code in other crates may need to be updated as well.
## Release Plan
- Nothing to do / These changes follow the usual release cycle.
## Links
None.Account duplication. (#4403)1 parent 692d3f6 commit 7b6e921
File tree
38 files changed
+173
-140
lines changed- examples
- amm
- src
- crowd-funding/src
- fungible
- src
- tests
- web-frontend/src
- qql
- gen-nft
- src
- web-frontend/src
- matching-engine/src
- native-fungible/src
- non-fungible
- src
- web-frontend/src
- rfq/src
- linera-base/src
- linera-client/src
- linera-core/src/unit_tests
- linera-indexer/example/tests
- linera-sdk/src/abis
- linera-service-graphql-client
- gql
- src
- tests
- linera-service
- src
- tests
38 files changed
+173
-140
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | | - | |
| 11 | + | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | | - | |
| 5 | + | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
| 9 | + | |
11 | 10 | | |
12 | 11 | | |
13 | | - | |
| 12 | + | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
0 commit comments