-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from novasamatech/develop
* Detect RuntimeCall and RuntimeEvent in exotic paths * Multi tx nonce (#72) * Multi tx nonce * Code style
- Loading branch information
Showing
8 changed files
with
77 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
fearless-utils/src/main/java/jp/co/soramitsu/fearless_utils/runtime/extrinsic/Nonce.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package jp.co.soramitsu.fearless_utils.runtime.extrinsic | ||
|
||
import java.math.BigInteger | ||
|
||
/** | ||
* Structure for Nonce that is capable of carrying out information about multiple to-be-submitted txs | ||
*/ | ||
data class Nonce( | ||
/** | ||
* Nonce that should be used to submit first tx | ||
*/ | ||
val baseNonce: BigInteger, | ||
/** | ||
* Offset from the [baseNonce] for the case when multiple txs are being submitted | ||
*/ | ||
val offset: BigInteger | ||
) { | ||
|
||
val nonce: BigInteger = baseNonce + offset | ||
|
||
companion object { | ||
|
||
fun singleTx(nonce: BigInteger): Nonce { | ||
return Nonce(baseNonce = nonce, offset = BigInteger.ZERO) | ||
} | ||
|
||
fun zero(): Nonce = singleTx(BigInteger.ZERO) | ||
} | ||
} | ||
|
||
fun Nonce.replaceBaseNone(baseNonce: BigInteger): Nonce { | ||
return copy(baseNonce = baseNonce) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters