-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prefer author_getNextNonce for nonce retrieval #2576
Prefer author_getNextNonce for nonce retrieval #2576
Conversation
substrate's AccountId to support other type of accounts
The failing tests are caused by some change in this PR. c.c @Kailai-Wang |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
I removed P610
from the PR title :)
let nonce = 0; | ||
|
||
if (nonceHex) { | ||
nonce = context.api.createType('Index', '0x' + nonceHex.slice(2)?.match(/../g)?.reverse().join('')).toNumber(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hwo should we read this line:
nonceHex.slice(2)?.match(/../g)?.reverse().join('')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I borrowed that logic from here. What this line does is to reverse the order of two character groups in the hex string while keeping the '0x' prefix. (also known as byte swapping or endian swapping).
getSidechainNonce
indi-utils.ts
to retrieve the nonce usingauthor_getNextNonce
RPC call and updated the corresponding tests.author_getNextNonce
to expectIdentity
to support other type of accounts.