scilla-data-parser
Version:
Scilla data types can be very verbose, making it hard for developers to use the state directly. The parser will help developers can make references and manipulation to state more easily.
22 lines (19 loc) • 744 B
text/typescript
import { ScillaDataParser } from '../parser';
//This case used an array as input so we'll use convertToScillaDataList to revert back to list scilla data.
var scillaJson = JSON.parse(`
[
{ "vname": "_balance", "type": "Uint128", "value": "0" },
{ "vname": "turn", "type": "Uint32", "value": "1" },
{
"vname": "accepted",
"type": "Bool",
"value": { "constructor": "True", "argtypes": [], "arguments": [] }
},
{ "vname": "welcome_msg", "type": "String", "value": "Hello There" }
]
`);
test('basic', () => {
var straightJson = ScillaDataParser.convertToSimpleJson(scillaJson, true);
var revertScillaJson = ScillaDataParser.convertToScillaDataList(straightJson);
expect(revertScillaJson).toMatchObject(scillaJson);
});