UNPKG

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.

21 lines (20 loc) 1.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var parser_1 = require("../parser"); var scillaJson = JSON.parse("\n{\n \"type\": \"Map (Uint256) (Product)\",\n \"value\": [\n {\n \"key\": \"168430090\",\n \"val\": {\n \"argtypes\": [],\n \"arguments\": [\n \"168430090\",\n \"1000000000\",\n \"100\",\n \"1000\",\n \"0\",\n \"0\",\n {\n \"argtypes\": [],\n \"arguments\": [],\n \"constructor\": \"False\"\n }\n ],\n \"constructor\": \"Product\"\n }\n }\n ],\n \"vname\": \"productsMap\"\n }\n"); test('custom1', function () { expect(function () { parser_1.ScillaDataParser.fetchCustomData('Product', { argtypes: [ { vname: 'id', type: 'Uint256' }, { vname: 'price', type: 'Uint128' }, { vname: 'available', type: 'Uint128' }, { vname: 'supply', type: 'Uint128' }, { vname: 'sold', type: 'Uint128' }, { vname: 'interval', type: 'Uint128' }, { vname: 'renewable', type: 'Bool' }, ], }); var simpleJson = parser_1.ScillaDataParser.convertToSimpleJson(scillaJson, false); }).not.toThrow(); });