Skip to content

Commit

Permalink
collections: fix typos in README (#20452)
Browse files Browse the repository at this point in the history
  • Loading branch information
polymaer authored May 25, 2024
1 parent e05fe92 commit 5930ee3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions collections/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ We already know the first three arguments of the ``NewMap`` function.

The fourth parameter is our `KeyCodec`, we know that the ``Map`` has `string` as key so we pass it a `KeyCodec` that handles strings as keys.

The fifth parameter is our `ValueCodec`, we know that the `Map` as a `uint64` as value so we pass it a `ValueCodec` that handles uint64.
The fifth parameter is our `ValueCodec`, we know that the `Map` has a `uint64` as value so we pass it a `ValueCodec` that handles uint64.

Collections already comes with all the required implementations for golang primitive types.

Expand Down Expand Up @@ -587,7 +587,7 @@ Let's analyse each method in the example and how it makes use of the `Iterate` a
In `GetAllAccounts` we pass to our `Iterate` a nil `Ranger`. This means that the returned `Iterator` will include
all the existing keys within the collection.

Then we use some the `Values` method from the returned `Iterator` API to collect all the values into a slice.
Then we use the `Values` method from the returned `Iterator` API to collect all the values into a slice.

`Iterator` offers other methods such as `Keys()` to collect only the keys and not the values and `KeyValues` to collect
all the keys and values.
Expand All @@ -602,7 +602,7 @@ we instruct it to report us results in reverse order through `Descending`
Then we pass the range instruction to `Iterate` and get an `Iterator`, which will contain only the results
we specified in the range.

Then we use again th `Values` method of the `Iterator` to collect all the results.
Then we use again the `Values` method of the `Iterator` to collect all the results.

`collections.Range` also offers a `Prefix` API which is not applicable to all keys types,
for example uint64 cannot be prefix because it is of constant size, but a `string` key
Expand Down Expand Up @@ -777,7 +777,7 @@ We use the `collections.Join` function to generate the composite key.
`collections.Pair` contains the two keys we have joined, it also exposes two methods: `K1` to fetch the 1st part of the
key and `K2` to fetch the second part.

As always, we use the `collections.Map.Set` method to map the composite key to our value (`math.Int`in this case)
As always, we use the `collections.Map.Set` method to map the composite key to our value (`math.Int` in this case)

#### GetBalance

Expand Down Expand Up @@ -860,7 +860,7 @@ Then we can see in our `AccountIndexes` struct the `Number` field is defined as:
```

Where the first type parameter is `uint64`, which is the field type of our index.
The second type parameter is the primary key `sdk.AccAddress`
The second type parameter is the primary key `sdk.AccAddress`.
And the third type parameter is the actual object we're storing `authtypes.BaseAccount`.

Then we create a `NewAccountIndexes` function that instantiates and returns the `AccountsIndexes` struct.
Expand Down

0 comments on commit 5930ee3

Please sign in to comment.