Skip to content

Commit

Permalink
Update examples and tutorials for deprecated index (#2054)
Browse files Browse the repository at this point in the history
* updates examples

* updated the code samples, index to nonce

* updated the sample code
  • Loading branch information
Rashmirreddy authored Sep 7, 2023
1 parent ce7a798 commit 0e5e832
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions content/md/en/docs/reference/account-data-structures.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub type Account<T: Config> = StorageMap<
_,
Blake2_128Concat,
T::AccountId,
AccountInfo<T::Index, T::AccountData>,
AccountInfo<T::Nonce, T::AccountData>,
ValueQuery,
>;
```
Expand All @@ -29,7 +29,7 @@ The `StorageMap` for an `Account` consists of the following parameters:

- The first parameter (\_) is used in macro expansion.
- `Blake2_128Concat` specifies the hashing algorithm to use.
- `T::AccountId` is used as the key for over the `AccountInfo<T::Index, T::AccountData>` struct.
- `T::AccountId` is used as the key for over the `AccountInfo<T::Nonce, T::AccountData>` struct.

See [`StorageMap` API](https://paritytech.github.io/substrate/master/frame_support/storage/types/struct.StorageMap.html#impl) for details.

Expand All @@ -39,9 +39,9 @@ The `AccountInfo` for an account is defined in the [`frame_system` pallet](https

```rust
#[derive(Clone, Eq, PartialEq, Default, RuntimeDebug, Encode, Decode)]
pub struct AccountInfo<Index, AccountData> {
pub struct AccountInfo<Nonce, AccountData> {
/// The number of transactions this account has sent.
pub nonce: Index,
pub nonce: Nonce,
/// The number of other modules that currently depend on this account's existence. The account
/// cannot be reaped until this is zero.
pub consumers: RefCount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ To enable offchain workers to send signed transactions:
call: RuntimeCall,
public: <Signature as Verify>::Signer,
account: AccountId,
nonce: Index,
nonce: Nonce,
) -> Option<(RuntimeCall, <UncheckedExtrinsic as traits::Extrinsic>::SignaturePayload)> {
let tip = 0;
// take the biggest period possible.
Expand Down

0 comments on commit 0e5e832

Please sign in to comment.