Skip to content

Commit

Permalink
[Bug] Fix immortal transactions (eraPeriod = 0) (leonardocustodio#362)
Browse files Browse the repository at this point in the history
* Fix immortal transactions

* bump version
  • Loading branch information
leonardocustodio authored Nov 8, 2023
1 parent 86309e1 commit 9b7ec8e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/polkadart/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.2.2

- Fixes issue to encode immortal transactions (eraPeriod = 0)

## 0.2.1

- Added AssetHub signed extensions.
Expand Down
4 changes: 3 additions & 1 deletion packages/polkadart/lib/extrinsic/extrinsic_payload.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ class Extrinsic {
'signer': signer,
'method': method,
'signature': signature,
'era': Era.codec.encodeMortal(blockNumber, eraPeriod),
'era': eraPeriod == 0
? '00'
: Era.codec.encodeMortal(blockNumber, eraPeriod),
'nonce': encodeHex(CompactCodec.codec.encode(nonce)),
'assetId': assetId != null ? assetId!.toRadixString(16) : '',
'tip': tip is int
Expand Down
4 changes: 3 additions & 1 deletion packages/polkadart/lib/extrinsic/signing_payload.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ class SigningPayload {
encodeHex(U32Codec.codec.encode(transactionVersion)),
'genesisHash': genesisHash.replaceAll('0x', ''),
'blockHash': blockHash.replaceAll('0x', ''),
'era': Era.codec.encodeMortal(blockNumber, eraPeriod),
'era': eraPeriod == 0
? '00'
: Era.codec.encodeMortal(blockNumber, eraPeriod),
'nonce': encodeHex(CompactCodec.codec.encode(nonce)),
'assetId': assetId != null ? assetId!.toRadixString(16) : '',
'tip': tip is int
Expand Down
2 changes: 1 addition & 1 deletion packages/polkadart/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: polkadart
description: Interfaces for interacting with Polkadot JSON RPC interface
version: 0.2.1
version: 0.2.2
homepage: https://github.com/leonardocustodio/polkadart/tree/main/packages/polkadart
repository: https://github.com/leonardocustodio/polkadart

Expand Down

0 comments on commit 9b7ec8e

Please sign in to comment.