-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): correctly serialize/deserialize transactions with no valid…
…ity interval
- Loading branch information
1 parent
d7eb8d9
commit 5e6e3eb
Showing
3 changed files
with
48 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* eslint-disable max-len */ | ||
import { CML, cmlToCore, coreToCml } from '../../src'; | ||
import { ManagedFreeableScope } from '@cardano-sdk/util'; | ||
|
||
describe('reserialization', () => { | ||
let scope: ManagedFreeableScope; | ||
|
||
const testReserialization = (testName: string, originalSerialized: string) => | ||
test(testName, () => { | ||
const cmlTx = CML.Transaction.from_bytes(Buffer.from(originalSerialized, 'hex')); | ||
const deserialized = cmlToCore.newTx(cmlTx); | ||
const cmlTxReserialized = coreToCml.tx(scope, deserialized); | ||
const reserialized = Buffer.from(cmlTxReserialized.to_bytes()).toString('hex'); | ||
expect(reserialized).toEqual(originalSerialized); | ||
}); | ||
|
||
beforeEach(() => { | ||
scope = new ManagedFreeableScope(); | ||
}); | ||
|
||
afterEach(() => { | ||
scope.dispose(); | ||
}); | ||
|
||
testReserialization( | ||
'simple tx', | ||
'84a30081825820c2df24d66077bc77f5a566b211662fe1bd85820024b37fb1a3f13eca263f80c1010182825839003492aa317ad5a41ceaf03f0ff7ba16b4760c63614d75d02a3fec7d98b903affb7b9b39ecad90b3023e6154764e65e9e7a1567d8f7ff9a6251a002dc6c0825839005cf6c91279a859a072601779fb33bb07c34e1d641d45df51ff63b967f15db05f56035465bf8900a09bdaa16c3d8b8244fea686524408dd801b0000048c2708f81b021a00029125a10081825820368cf6a11ac7e29917568a366af62a596cb9cde8174bfe7f6e88393ecdb1dcc65840b2eb6ad0b749246dc9d6e8f6fca2793781688dadcf364a37c2e3713ede7bd40dd04c48289a0252be3b5ff413e8536879b8482a916e481b472e83169c51a1e508f5f6' | ||
); | ||
}); |