Skip to content

Commit 2237cdb

Browse files
fixes #78 storage AccountNonce not found within module System (#79)
* fixes #78 storage AccountNonce not found within module System * fixes #78 storage AccountNonce not found within module System (review changes) Co-authored-by: Nikos Kitmeridis <nikos.kitmeridis@camelotls.com>
1 parent 03ce7c5 commit 2237cdb

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

main_test.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,17 +221,19 @@ func Example_makeASimpleTransfer() {
221221
panic(err)
222222
}
223223

224-
key, err := types.CreateStorageKey(meta, "System", "AccountNonce", signature.TestKeyringPairAlice.PublicKey, nil)
224+
key, err := types.CreateStorageKey(meta, "System", "Account", signature.TestKeyringPairAlice.PublicKey, nil)
225225
if err != nil {
226226
panic(err)
227227
}
228228

229-
var nonce uint32
230-
ok, err := api.RPC.State.GetStorageLatest(key, &nonce)
229+
var accountInfo types.AccountInfo
230+
ok, err := api.RPC.State.GetStorageLatest(key, &accountInfo)
231231
if err != nil || !ok {
232232
panic(err)
233233
}
234234

235+
nonce := uint32(accountInfo.Nonce)
236+
235237
o := types.SignatureOptions{
236238
BlockHash: genesisHash,
237239
Era: types.ExtrinsicEra{IsMortalEra: false},
@@ -435,17 +437,19 @@ func Example_transactionWithEvents() {
435437
}
436438

437439
// Get the nonce for Alice
438-
key, err := types.CreateStorageKey(meta, "System", "AccountNonce", signature.TestKeyringPairAlice.PublicKey, nil)
440+
key, err := types.CreateStorageKey(meta, "System", "Account", signature.TestKeyringPairAlice.PublicKey, nil)
439441
if err != nil {
440442
panic(err)
441443
}
442444

443-
var nonce uint32
444-
ok, err := api.RPC.State.GetStorageLatest(key, &nonce)
445+
var accountInfo types.AccountInfo
446+
ok, err := api.RPC.State.GetStorageLatest(key, &accountInfo)
445447
if err != nil || !ok {
446448
panic(err)
447449
}
448450

451+
nonce := uint32(accountInfo.Nonce)
452+
449453
o := types.SignatureOptions{
450454
BlockHash: genesisHash,
451455
Era: types.ExtrinsicEra{IsMortalEra: false},

0 commit comments

Comments
 (0)