From 47b8496f596c1126e195f22968d20723a6bbe8d2 Mon Sep 17 00:00:00 2001 From: polyprogrammist Date: Fri, 12 Jan 2024 22:45:02 -0500 Subject: [PATCH] add hashmap --- src/ast.ts | 7 + src/astbuilder/handle_type.ts | 7 + src/generators/typescript/generator.ts | 46 ++ src/main.ts | 2 + test/generated_files/generated_block.ts | 579 +++++++++++++++--------- test/generated_files/generated_test.ts | 29 +- 6 files changed, 444 insertions(+), 226 deletions(-) diff --git a/src/ast.ts b/src/ast.ts index e8aae94..e8ad4e6 100644 --- a/src/ast.ts +++ b/src/ast.ts @@ -91,6 +91,12 @@ export type TLBVarIntegerType = { n: TLBMathExpr; } +export type TLBHashmapType = { + kind: "TLBHashmapType"; + key: TLBFieldType, + value: TLBFieldType +} + export type TLBCellType = { kind: "TLBCellType"; }; @@ -136,6 +142,7 @@ export type TLBFieldType = | TLBBoolType | TLBCoinsType | TLBAddressType + | TLBHashmapType | TLBVarIntegerType | TLBCellType | TLBMathExprType diff --git a/src/astbuilder/handle_type.ts b/src/astbuilder/handle_type.ts index 5c4fdc3..f57fad9 100644 --- a/src/astbuilder/handle_type.ts +++ b/src/astbuilder/handle_type.ts @@ -161,6 +161,13 @@ export function getType( constructor ), }; + } else if (expr.name == "HashmapE") { + if (expr.args.length != 2) { + throw new Error('') + } + let key = getType(expr.args[0], constructor, fieldTypeName) + let value = getType(expr.args[1], constructor, fieldTypeName) + return { kind: "TLBHashmapType", key: key, value: value }; } else if ( expr.name == "VarUInteger" && (expr.args[0] instanceof MathExpr || diff --git a/src/generators/typescript/generator.ts b/src/generators/typescript/generator.ts index d8c63ea..bea56b2 100644 --- a/src/generators/typescript/generator.ts +++ b/src/generators/typescript/generator.ts @@ -761,6 +761,52 @@ export class TypescriptGenerator implements CodeGenerator { } else { throw new Error("Address has type other than ['Internal', 'External', 'Any']") } + } else if (fieldType.kind == "TLBHashmapType") { + let key: Expression + if (fieldType.key.kind == 'TLBExprMathType') { + key = tFunctionCall(tMemberExpression(id('Dictionary.Keys'), id('Uint')), [convertToAST(fieldType.key.expr, ctx.constructor)]); + } else { + throw new Error('') + } + let subExprInfo = this.handleType( + field, + fieldType.value, + false, + ctx, + slicePrefix, + argIndex + ); + let functionId = id('createTheFunction' + (Math.random() + 1).toString(36).substring(7)) + let value = tFunctionCall(functionId, []) + result.loadExpr = tFunctionCall(tMemberExpression(id('Dictionary'), id('load')), [key, value, id(currentSlice)]) + if (subExprInfo.typeParamExpr && subExprInfo.loadFunctionExpr && subExprInfo.storeStmtInside) { + this.jsCodeFunctionsDeclarations.push( + tFunctionDeclaration( + functionId, + tTypeParametersExpression([]), + tTypeWithParameters( + id('DictionaryValue'), + tTypeParametersExpression([ + subExprInfo.typeParamExpr + ]) + ) + , [], [tReturnStatement(tObjectExpression([ + tObjectProperty(id('serialize'), + tArrowFunctionExpression([tTypedIdentifier(id('arg'), subExprInfo.typeParamExpr), tTypedIdentifier(id('builder'), id('Builder'))], [subExprInfo.storeStmtInside]) + ), + tObjectProperty(id('parse'), + subExprInfo.loadFunctionExpr + ) + ]))] + )) + result.typeParamExpr = tTypeWithParameters(id('Dictionary'), tTypeParametersExpression([id('number'), subExprInfo.typeParamExpr])) + } + storeParametersInside = storeParametersInside.concat([key, value]) + storeParametersOutside = storeParametersOutside.concat([key, value]) + result.storeStmtInside = tExpressionStatement(tFunctionCall(tMemberExpression(id(currentCell), id('storeDict')), storeParametersInside)) + result.storeStmtOutside = tExpressionStatement(tFunctionCall(tMemberExpression(id(currentCell), id('storeDict')), storeParametersOutside)) + if (subExprInfo.loadExpr) + console.log(toCode(subExprInfo.loadExpr).code) } else if (fieldType.kind == "TLBExprMathType") { result.loadExpr = convertToAST(fieldType.expr, ctx.constructor); result.storeStmtOutside = tExpressionStatement(result.loadExpr); diff --git a/src/main.ts b/src/main.ts index 86112f4..2db2d8e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -27,6 +27,8 @@ export function generate(tree: Program, input: string) { codeGenerator.addTonCoreClassUsage("Cell"); codeGenerator.addTonCoreClassUsage("Address"); codeGenerator.addTonCoreClassUsage("ExternalAddress"); + codeGenerator.addTonCoreClassUsage("Dictionary") + codeGenerator.addTonCoreClassUsage("DictionaryValue") codeGenerator.addBitLenFunction(); diff --git a/test/generated_files/generated_block.ts b/test/generated_files/generated_block.ts index 574866d..6d382fd 100644 --- a/test/generated_files/generated_block.ts +++ b/test/generated_files/generated_block.ts @@ -1,10 +1,12 @@ -import { Builder, Dictionary, DictionaryValue } from 'ton' +import { Builder } from 'ton' import { Slice } from 'ton' import { beginCell } from 'ton' import { BitString } from 'ton' import { Cell } from 'ton' import { Address } from 'ton' import { ExternalAddress } from 'ton' +import { Dictionary } from 'ton' +import { DictionaryValue } from 'ton' export function bitLen(n: number) { return n.toString(2).length;; } @@ -395,7 +397,7 @@ extra_currencies$_ dict:(HashmapE 32 (VarUInteger 32)) export interface ExtraCurrencyCollection { readonly kind: 'ExtraCurrencyCollection'; - readonly dict: HashmapE; + readonly dict: Dictionary; } /* @@ -528,7 +530,7 @@ export interface StateInitWithLibs { readonly special: Maybe; readonly code: Maybe; readonly data: Maybe; - readonly library: HashmapE; + readonly library: Dictionary; } // simple_lib$_ public:Bool root:^Cell = SimpleLib; @@ -853,7 +855,7 @@ export interface ProcessedUpto { export interface ProcessedInfo { readonly kind: 'ProcessedInfo'; - readonly anon0: HashmapE; + readonly anon0: Dictionary; } // ihr_pending$_ import_lt:uint64 = IhrPendingSince; @@ -867,7 +869,7 @@ export interface IhrPendingSince { export interface IhrPendingInfo { readonly kind: 'IhrPendingInfo'; - readonly anon0: HashmapE; + readonly anon0: Dictionary; } /* @@ -1592,7 +1594,7 @@ export interface ShardStateUnsplit { readonly underload_history: number; readonly total_balance: CurrencyCollection; readonly total_validator_fees: CurrencyCollection; - readonly libraries: HashmapE; + readonly libraries: Dictionary; readonly master_ref: Maybe; readonly custom: Maybe; } @@ -1911,7 +1913,7 @@ export interface ShardDescr_shard_descr_new { export interface ShardHashes { readonly kind: 'ShardHashes'; - readonly anon0: HashmapE>; + readonly anon0: Dictionary>; } // bta_leaf$0 {X:Type} {Y:Type} extra:Y leaf:X = BinTreeAug X Y; @@ -2039,7 +2041,7 @@ export type BlockCreateStats = BlockCreateStats_block_create_stats | BlockCreate export interface BlockCreateStats_block_create_stats { readonly kind: 'BlockCreateStats_block_create_stats'; - readonly counters: HashmapE; + readonly counters: Dictionary; } export interface BlockCreateStats_block_create_stats_ext { @@ -2161,7 +2163,7 @@ export interface McBlockExtra { readonly key_block: number; readonly shard_hashes: ShardHashes; readonly shard_fees: ShardFees; - readonly prev_blk_signatures: Dictionary; + readonly prev_blk_signatures: Dictionary; readonly recover_create_msg: Maybe; readonly mint_msg: Maybe; readonly config: ConfigParams | undefined; @@ -2216,7 +2218,7 @@ export interface ValidatorSet_validators_ext { readonly total: number; readonly main: number; readonly total_weight: number; - readonly list: HashmapE; + readonly list: Dictionary; } // _ config_addr:bits256 = ConfigParam 0; @@ -2384,7 +2386,7 @@ export interface ConfigParam__11 { export interface ConfigParam__12 { readonly kind: 'ConfigParam__12'; - readonly workchains: HashmapE; + readonly workchains: Dictionary; } export interface ConfigParam__13 { @@ -2472,7 +2474,7 @@ export interface ConfigParam__27 { export interface ConfigParam__28 { readonly kind: 'ConfigParam__28'; - readonly fundamental_smc_addr: HashmapE; + readonly fundamental_smc_addr: Dictionary; } export interface ConfigParam__29 { @@ -2507,7 +2509,7 @@ export interface ConfigParam__34 { export interface ConfigParam__35 { readonly kind: 'ConfigParam__35'; - readonly anon0: HashmapE; + readonly anon0: Dictionary; } export interface ConfigParam__36 { @@ -2621,7 +2623,7 @@ export interface ConfigProposalStatus { readonly expires: number; readonly proposal: ConfigProposal; readonly is_critical: boolean; - readonly voters: HashmapE; + readonly voters: Dictionary; readonly remaining_weight: number; readonly validator_set_id: bigint; readonly rounds_remaining: number; @@ -3050,7 +3052,7 @@ export interface SizeLimitsConfig_size_limits_config_v2 { export interface SuspendedAddressList { readonly kind: 'SuspendedAddressList'; - readonly addresses: HashmapE; + readonly addresses: Dictionary; readonly suspended_until: number; } @@ -3060,7 +3062,7 @@ export interface OracleBridgeParams { readonly kind: 'OracleBridgeParams'; readonly bridge_address: BitString; readonly oracle_mutlisig_address: BitString; - readonly oracles: HashmapE; + readonly oracles: Dictionary; readonly external_chain_address: BitString; } @@ -3092,7 +3094,7 @@ export interface JettonBridgeParams_jetton_bridge_params_v0 { readonly kind: 'JettonBridgeParams_jetton_bridge_params_v0'; readonly bridge_address: BitString; readonly oracles_address: BitString; - readonly oracles: HashmapE; + readonly oracles: Dictionary; readonly state_flags: number; readonly burn_bridge_fee: Coins; } @@ -3101,7 +3103,7 @@ export interface JettonBridgeParams_jetton_bridge_params_v1 { readonly kind: 'JettonBridgeParams_jetton_bridge_params_v1'; readonly bridge_address: BitString; readonly oracles_address: BitString; - readonly oracles: HashmapE; + readonly oracles: Dictionary; readonly state_flags: number; readonly prices: JettonBridgePrices; readonly external_chain_address: BitString; @@ -3116,7 +3118,7 @@ export interface BlockSignaturesPure { readonly kind: 'BlockSignaturesPure'; readonly sig_count: number; readonly sig_weight: number; - readonly signatures: HashmapE; + readonly signatures: Dictionary; } // block_signatures#11 validator_info:ValidatorBaseInfo pure_signatures:BlockSignaturesPure = BlockSignatures; @@ -3170,7 +3172,7 @@ export interface TopBlockDescr { export interface TopBlockDescrSet { readonly kind: 'TopBlockDescrSet'; - readonly collection: HashmapE; + readonly collection: Dictionary; } /* @@ -3223,7 +3225,7 @@ export interface ValidatorComplaint { export interface ValidatorComplaintStatus { readonly kind: 'ValidatorComplaintStatus'; readonly complaint: ValidatorComplaint; - readonly voters: HashmapE; + readonly voters: Dictionary; readonly vset_id: bigint; readonly weight_remaining: number; } @@ -3375,7 +3377,7 @@ export interface VmStackList_vm_stk_cons { export interface VmSaveList { readonly kind: 'VmSaveList'; - readonly cregs: HashmapE; + readonly cregs: Dictionary; } /* @@ -3395,7 +3397,7 @@ export interface VmGasLimits { export interface VmLibraries { readonly kind: 'VmLibraries'; - readonly libraries: HashmapE; + readonly libraries: Dictionary; } /* @@ -3502,7 +3504,7 @@ export interface VmCont_vmc_pushint { export interface DNS_RecordSet { readonly kind: 'DNS_RecordSet'; - readonly anon0: HashmapE; + readonly anon0: Dictionary; } // chunk_ref_empty$_ = TextChunkRef 0; @@ -4847,16 +4849,26 @@ export function storeCoins(coins: Coins): (builder: Builder) => void { } +export function createTheFunctionve0sp(): DictionaryValue { + return { + serialize: ((arg: bigint, builder: Builder) => { + builder.storeVarUint(arg, bitLen((32 - 1))); + }), + parse: ((slice: Slice) => { + return slice.loadVarUintBig(bitLen((32 - 1))) + + }), + } + +} + /* extra_currencies$_ dict:(HashmapE 32 (VarUInteger 32)) = ExtraCurrencyCollection; */ export function loadExtraCurrencyCollection(slice: Slice): ExtraCurrencyCollection { - let dict: HashmapE = loadHashmapE(slice, 32, ((slice: Slice) => { - return slice.loadVarUintBig(bitLen((32 - 1))) - - })); + let dict: Dictionary = Dictionary.load(Dictionary.Keys.Uint(32), createTheFunctionve0sp(), slice); return { kind: 'ExtraCurrencyCollection', dict: dict, @@ -4866,12 +4878,7 @@ export function loadExtraCurrencyCollection(slice: Slice): ExtraCurrencyCollecti export function storeExtraCurrencyCollection(extraCurrencyCollection: ExtraCurrencyCollection): (builder: Builder) => void { return ((builder: Builder) => { - storeHashmapE(extraCurrencyCollection.dict, ((arg: bigint) => { - return ((builder: Builder) => { - builder.storeVarUint(arg, bitLen((32 - 1))); - }) - - }))(builder); + builder.storeDict(extraCurrencyCollection.dict, Dictionary.Keys.Uint(32), createTheFunctionve0sp()); }) } @@ -5202,6 +5209,16 @@ export function storeStateInit(stateInit: StateInit): (builder: Builder) => void } +export function createTheFunction9lwom(): DictionaryValue { + return { + serialize: ((arg: SimpleLib, builder: Builder) => { + storeSimpleLib; + }), + parse: loadSimpleLib, + } + +} + /* _ split_depth:(Maybe (## 5)) special:(Maybe TickTock) code:(Maybe ^Cell) data:(Maybe ^Cell) @@ -5224,7 +5241,7 @@ export function loadStateInitWithLibs(slice: Slice): StateInitWithLibs { return slice1 })); - let library: HashmapE = loadHashmapE(slice, 256, loadSimpleLib); + let library: Dictionary = Dictionary.load(Dictionary.Keys.Uint(256), createTheFunction9lwom(), slice); return { kind: 'StateInitWithLibs', split_depth: split_depth, @@ -5263,7 +5280,7 @@ export function storeStateInitWithLibs(stateInitWithLibs: StateInitWithLibs): (b }) }))(builder); - storeHashmapE(stateInitWithLibs.library, storeSimpleLib)(builder); + builder.storeDict(stateInitWithLibs.library, Dictionary.Keys.Uint(256), createTheFunction9lwom()); }) } @@ -6211,10 +6228,20 @@ export function storeProcessedUpto(processedUpto: ProcessedUpto): (builder: Buil } +export function createTheFunctiondtzm3(): DictionaryValue { + return { + serialize: ((arg: ProcessedUpto, builder: Builder) => { + storeProcessedUpto; + }), + parse: loadProcessedUpto, + } + +} + // _ (HashmapE 96 ProcessedUpto) = ProcessedInfo; export function loadProcessedInfo(slice: Slice): ProcessedInfo { - let anon0: HashmapE = loadHashmapE(slice, 96, loadProcessedUpto); + let anon0: Dictionary = Dictionary.load(Dictionary.Keys.Uint(96), createTheFunctiondtzm3(), slice); return { kind: 'ProcessedInfo', anon0: anon0, @@ -6224,7 +6251,7 @@ export function loadProcessedInfo(slice: Slice): ProcessedInfo { export function storeProcessedInfo(processedInfo: ProcessedInfo): (builder: Builder) => void { return ((builder: Builder) => { - storeHashmapE(processedInfo.anon0, storeProcessedUpto)(builder); + builder.storeDict(processedInfo.anon0, Dictionary.Keys.Uint(96), createTheFunctiondtzm3()); }) } @@ -6247,10 +6274,20 @@ export function storeIhrPendingSince(ihrPendingSince: IhrPendingSince): (builder } +export function createTheFunctionyy697(): DictionaryValue { + return { + serialize: ((arg: IhrPendingSince, builder: Builder) => { + storeIhrPendingSince; + }), + parse: loadIhrPendingSince, + } + +} + // _ (HashmapE 320 IhrPendingSince) = IhrPendingInfo; export function loadIhrPendingInfo(slice: Slice): IhrPendingInfo { - let anon0: HashmapE = loadHashmapE(slice, 320, loadIhrPendingSince); + let anon0: Dictionary = Dictionary.load(Dictionary.Keys.Uint(320), createTheFunctionyy697(), slice); return { kind: 'IhrPendingInfo', anon0: anon0, @@ -6260,7 +6297,7 @@ export function loadIhrPendingInfo(slice: Slice): IhrPendingInfo { export function storeIhrPendingInfo(ihrPendingInfo: IhrPendingInfo): (builder: Builder) => void { return ((builder: Builder) => { - storeHashmapE(ihrPendingInfo.anon0, storeIhrPendingSince)(builder); + builder.storeDict(ihrPendingInfo.anon0, Dictionary.Keys.Uint(320), createTheFunctionyy697()); }) } @@ -6652,6 +6689,31 @@ export function storeShardAccounts(shardAccounts: ShardAccounts): (builder: Buil } +export function createTheFunctionuqvvt(): DictionaryValue> { + return { + serialize: ((arg: Message, builder: Builder) => { + let cell1 = beginCell(); + storeMessage(arg, ((arg: Slice) => { + return ((builder: Builder) => { + builder.storeSlice(arg); + }) + + }))(cell1); + builder.storeRef(cell1); + + }), + parse: ((slice: Slice) => { + let slice1 = slice.loadRef().beginParse(); + return loadMessage(slice1, ((slice: Slice) => { + return slice + + })) + + }), + } + +} + /* transaction$0111 account_addr:bits256 lt:uint64 prev_trans_hash:bits256 prev_trans_lt:uint64 now:uint32 @@ -6662,35 +6724,6 @@ transaction$0111 account_addr:bits256 lt:uint64 description:^TransactionDescr = Transaction; */ -function createMessageSliceValue(): DictionaryValue> { - return { - serialize: (src, buidler) => { - ((arg: Message) => { - return ((builder: Builder) => { - let cell1 = beginCell(); - storeMessage(arg, ((arg: Slice) => { - return ((builder: Builder) => { - builder.storeSlice(arg); - }) - - }))(cell1); - builder.storeRef(cell1); - - }) - - })(src)(buidler) - }, - parse: ((slice: Slice) => { - let slice1 = slice.loadRef().beginParse(); - return loadMessage(slice1, ((slice: Slice) => { - return slice - - })) - - }) - } -} - export function loadTransaction(slice: Slice): Transaction { if (((slice.remainingBits >= 4) && (slice.preloadUint(4) == 0b0111))) { slice.loadUint(4); @@ -6711,16 +6744,7 @@ export function loadTransaction(slice: Slice): Transaction { })) })); - let out_msgs: Dictionary> = Dictionary.load(Dictionary.Keys.Uint(15), createMessageSliceValue(), slice1); - - // let out_msgs: HashmapE> = loadHashmapE>(slice1, 15, ((slice: Slice) => { - // let slice1 = slice.loadRef().beginParse(); - // return loadMessage(slice1, ((slice: Slice) => { - // return slice - - // })) - - // })); + let out_msgs: Dictionary> = Dictionary.load(Dictionary.Keys.Uint(15), createTheFunctionuqvvt(), slice1); let total_fees: CurrencyCollection = loadCurrencyCollection(slice); let slice2 = slice.loadRef().beginParse(); let state_update: HASH_UPDATE = loadHASH_UPDATE(slice2, loadAccount); @@ -6773,21 +6797,7 @@ export function storeTransaction(transaction: Transaction): (builder: Builder) = }) }))(cell1); - cell1.storeDict(transaction.out_msgs, Dictionary.Keys.Uint(15), createMessageSliceValue()) - // storeHashmapE>(transaction.out_msgs, ((arg: Message) => { - // return ((builder: Builder) => { - // let cell1 = beginCell(); - // storeMessage(arg, ((arg: Slice) => { - // return ((builder: Builder) => { - // builder.storeSlice(arg); - // }) - - // }))(cell1); - // builder.storeRef(cell1); - - // }) - - // }))(cell1); + cell1.storeDict(transaction.out_msgs, Dictionary.Keys.Uint(15), createTheFunctionuqvvt()); builder.storeRef(cell1); storeCurrencyCollection(transaction.total_fees)(builder); let cell2 = beginCell(); @@ -8174,6 +8184,16 @@ export function storeBlkMasterInfo(blkMasterInfo: BlkMasterInfo): (builder: Buil } +export function createTheFunction90t5h(): DictionaryValue { + return { + serialize: ((arg: LibDescr, builder: Builder) => { + storeLibDescr; + }), + parse: loadLibDescr, + } + +} + /* shard_state#9023afe2 global_id:int32 shard_id:ShardIdent @@ -8212,7 +8232,7 @@ export function loadShardStateUnsplit(slice: Slice): ShardStateUnsplit { let underload_history: number = slice3.loadUint(64); let total_balance: CurrencyCollection = loadCurrencyCollection(slice3); let total_validator_fees: CurrencyCollection = loadCurrencyCollection(slice3); - let libraries: HashmapE = loadHashmapE(slice3, 256, loadLibDescr); + let libraries: Dictionary = Dictionary.load(Dictionary.Keys.Uint(256), createTheFunction90t5h(), slice3); let master_ref: Maybe = loadMaybe(slice3, loadBlkMasterInfo); let custom: Maybe = loadMaybe(slice, ((slice: Slice) => { let slice1 = slice.loadRef().beginParse(); @@ -8266,7 +8286,7 @@ export function storeShardStateUnsplit(shardStateUnsplit: ShardStateUnsplit): (b cell3.storeUint(shardStateUnsplit.underload_history, 64); storeCurrencyCollection(shardStateUnsplit.total_balance)(cell3); storeCurrencyCollection(shardStateUnsplit.total_validator_fees)(cell3); - storeHashmapE(shardStateUnsplit.libraries, storeLibDescr)(cell3); + cell3.storeDict(shardStateUnsplit.libraries, Dictionary.Keys.Uint(256), createTheFunction90t5h()); storeMaybe(shardStateUnsplit.master_ref, storeBlkMasterInfo)(cell3); builder.storeRef(cell3); storeMaybe(shardStateUnsplit.custom, ((arg: McStateExtra) => { @@ -9123,14 +9143,27 @@ export function storeShardDescr(shardDescr: ShardDescr): (builder: Builder) => v throw new Error('Expected one of "ShardDescr_shard_descr", "ShardDescr_shard_descr_new" in loading "ShardDescr", but data does not satisfy any constructor'); } -// _ (HashmapE 32 ^(BinTree ShardDescr)) = ShardHashes; +export function createTheFunctionvqnxt(): DictionaryValue> { + return { + serialize: ((arg: BinTree, builder: Builder) => { + let cell1 = beginCell(); + storeBinTree(arg, storeShardDescr)(cell1); + builder.storeRef(cell1); -export function loadShardHashes(slice: Slice): ShardHashes { - let anon0: HashmapE> = loadHashmapE>(slice, 32, ((slice: Slice) => { + }), + parse: ((slice: Slice) => { let slice1 = slice.loadRef().beginParse(); return loadBinTree(slice1, loadShardDescr) - })); + }), + } + +} + +// _ (HashmapE 32 ^(BinTree ShardDescr)) = ShardHashes; + +export function loadShardHashes(slice: Slice): ShardHashes { + let anon0: Dictionary> = Dictionary.load(Dictionary.Keys.Uint(32), createTheFunctionvqnxt(), slice); return { kind: 'ShardHashes', anon0: anon0, @@ -9140,15 +9173,7 @@ export function loadShardHashes(slice: Slice): ShardHashes { export function storeShardHashes(shardHashes: ShardHashes): (builder: Builder) => void { return ((builder: Builder) => { - storeHashmapE>(shardHashes.anon0, ((arg: BinTree) => { - return ((builder: Builder) => { - let cell1 = beginCell(); - storeBinTree(arg, storeShardDescr)(cell1); - builder.storeRef(cell1); - - }) - - }))(builder); + builder.storeDict(shardHashes.anon0, Dictionary.Keys.Uint(32), createTheFunctionvqnxt()); }) } @@ -9462,6 +9487,16 @@ export function storeCreatorStats(creatorStats: CreatorStats): (builder: Builder } +export function createTheFunctionfex3h(): DictionaryValue { + return { + serialize: ((arg: CreatorStats, builder: Builder) => { + storeCreatorStats; + }), + parse: loadCreatorStats, + } + +} + // block_create_stats#17 counters:(HashmapE 256 CreatorStats) = BlockCreateStats; // block_create_stats_ext#34 counters:(HashmapAugE 256 CreatorStats uint32) = BlockCreateStats; @@ -9469,7 +9504,7 @@ export function storeCreatorStats(creatorStats: CreatorStats): (builder: Builder export function loadBlockCreateStats(slice: Slice): BlockCreateStats { if (((slice.remainingBits >= 8) && (slice.preloadUint(8) == 0x17))) { slice.loadUint(8); - let counters: HashmapE = loadHashmapE(slice, 256, loadCreatorStats); + let counters: Dictionary = Dictionary.load(Dictionary.Keys.Uint(256), createTheFunctionfex3h(), slice); return { kind: 'BlockCreateStats_block_create_stats', counters: counters, @@ -9495,7 +9530,7 @@ export function storeBlockCreateStats(blockCreateStats: BlockCreateStats): (buil if ((blockCreateStats.kind == 'BlockCreateStats_block_create_stats')) { return ((builder: Builder) => { builder.storeUint(0x17, 8); - storeHashmapE(blockCreateStats.counters, storeCreatorStats)(builder); + builder.storeDict(blockCreateStats.counters, Dictionary.Keys.Uint(256), createTheFunctionfex3h()); }) } @@ -9775,6 +9810,16 @@ export function storeSignedCertificate(signedCertificate: SignedCertificate): (b } +export function createTheFunctionheuph(): DictionaryValue { + return { + serialize: ((arg: CryptoSignaturePair, builder: Builder) => { + storeCryptoSignaturePair; + }), + parse: loadCryptoSignaturePair, + } + +} + /* masterchain_block_extra#cca5 key_block:(## 1) @@ -9787,18 +9832,6 @@ masterchain_block_extra#cca5 = McBlockExtra; */ - -function createSliceValue(): DictionaryValue { - return { - serialize: (src, buidler) => { - buidler.storeSlice(src); - }, - parse: (src) => { - return src; - } - } -} - export function loadMcBlockExtra(slice: Slice): McBlockExtra { if (((slice.remainingBits >= 16) && (slice.preloadUint(16) == 0xcca5))) { slice.loadUint(16); @@ -9806,7 +9839,7 @@ export function loadMcBlockExtra(slice: Slice): McBlockExtra { let shard_hashes: ShardHashes = loadShardHashes(slice); let shard_fees: ShardFees = loadShardFees(slice); let slice1 = slice.loadRef().beginParse(); - let prev_blk_signatures: Dictionary = Dictionary.load(Dictionary.Keys.Uint(16), createSliceValue(), slice1) //loadHashmapE(slice1, 16, loadCryptoSignaturePair); + let prev_blk_signatures: Dictionary = Dictionary.load(Dictionary.Keys.Uint(16), createTheFunctionheuph(), slice1); let recover_create_msg: Maybe = loadMaybe(slice1, ((slice: Slice) => { let slice1 = slice.loadRef().beginParse(); return loadInMsg(slice1) @@ -9840,7 +9873,7 @@ export function storeMcBlockExtra(mcBlockExtra: McBlockExtra): (builder: Builder storeShardHashes(mcBlockExtra.shard_hashes)(builder); storeShardFees(mcBlockExtra.shard_fees)(builder); let cell1 = beginCell(); - cell1.storeDict(mcBlockExtra.prev_blk_signatures) + cell1.storeDict(mcBlockExtra.prev_blk_signatures, Dictionary.Keys.Uint(16), createTheFunctionheuph()); storeMaybe(mcBlockExtra.recover_create_msg, ((arg: InMsg) => { return ((builder: Builder) => { let cell1 = beginCell(); @@ -9926,6 +9959,16 @@ validators#11 utime_since:uint32 utime_until:uint32 list:(Hashmap 16 ValidatorDescr) = ValidatorSet; */ +export function createTheFunctionn45pu(): DictionaryValue { + return { + serialize: ((arg: ValidatorDescr, builder: Builder) => { + storeValidatorDescr; + }), + parse: loadValidatorDescr, + } + +} + /* validators_ext#12 utime_since:uint32 utime_until:uint32 total:(## 16) main:(## 16) { main <= total } { main >= 1 } @@ -9963,7 +10006,7 @@ export function loadValidatorSet(slice: Slice): ValidatorSet { let total: number = slice.loadUint(16); let main: number = slice.loadUint(16); let total_weight: number = slice.loadUint(64); - let list: HashmapE = loadHashmapE(slice, 16, loadValidatorDescr); + let list: Dictionary = Dictionary.load(Dictionary.Keys.Uint(16), createTheFunctionn45pu(), slice); if ((!(main <= total))) { throw new Error('Condition (main <= total) is not satisfied while loading "ValidatorSet_validators_ext" for type "ValidatorSet"'); } @@ -10010,7 +10053,7 @@ export function storeValidatorSet(validatorSet: ValidatorSet): (builder: Builder builder.storeUint(validatorSet.total, 16); builder.storeUint(validatorSet.main, 16); builder.storeUint(validatorSet.total_weight, 64); - storeHashmapE(validatorSet.list, storeValidatorDescr)(builder); + builder.storeDict(validatorSet.list, Dictionary.Keys.Uint(16), createTheFunctionn45pu()); if ((!(validatorSet.main <= validatorSet.total))) { throw new Error('Condition (validatorSet.main <= validatorSet.total) is not satisfied while loading "ValidatorSet_validators_ext" for type "ValidatorSet"'); } @@ -10047,6 +10090,16 @@ export function storeValidatorSet(validatorSet: ValidatorSet): (builder: Builder // _ ConfigVotingSetup = ConfigParam 11; +export function createTheFunctiongt0f6(): DictionaryValue { + return { + serialize: ((arg: WorkchainDescr, builder: Builder) => { + storeWorkchainDescr; + }), + parse: loadWorkchainDescr, + } + +} + // _ workchains:(HashmapE 32 WorkchainDescr) = ConfigParam 12; // _ ComplaintPricing = ConfigParam 13; @@ -10089,6 +10142,16 @@ _ max_validators:(## 16) max_main_validators:(## 16) min_validators:(## 16) // _ ConsensusConfig = ConfigParam 29; +export function createTheFunctiond9tr8(): DictionaryValue { + return { + serialize: ((arg: True, builder: Builder) => { + storeTrue; + }), + parse: loadTrue, + } + +} + // _ fundamental_smc_addr:(HashmapE 256 True) = ConfigParam 31; // _ prev_validators:ValidatorSet = ConfigParam 32; @@ -10103,6 +10166,16 @@ _ max_validators:(## 16) max_main_validators:(## 16) min_validators:(## 16) // _ next_temp_validators:ValidatorSet = ConfigParam 37; +export function createTheFunction8dq62g(): DictionaryValue { + return { + serialize: ((arg: ValidatorSignedTempKey, builder: Builder) => { + storeValidatorSignedTempKey; + }), + parse: loadValidatorSignedTempKey, + } + +} + // _ (HashmapE 256 ValidatorSignedTempKey) = ConfigParam 39; // _ MisbehaviourPunishmentConfig = ConfigParam 40; @@ -10223,7 +10296,7 @@ export function loadConfigParam(slice: Slice, arg0: number): ConfigParam { } if ((arg0 == 12)) { - let workchains: HashmapE = loadHashmapE(slice, 32, loadWorkchainDescr); + let workchains: Dictionary = Dictionary.load(Dictionary.Keys.Uint(32), createTheFunctiongt0f6(), slice); return { kind: 'ConfigParam__12', workchains: workchains, @@ -10376,7 +10449,7 @@ export function loadConfigParam(slice: Slice, arg0: number): ConfigParam { } if ((arg0 == 31)) { - let fundamental_smc_addr: HashmapE = loadHashmapE(slice, 256, loadTrue); + let fundamental_smc_addr: Dictionary = Dictionary.load(Dictionary.Keys.Uint(256), createTheFunctiond9tr8(), slice); return { kind: 'ConfigParam__28', fundamental_smc_addr: fundamental_smc_addr, @@ -10432,7 +10505,7 @@ export function loadConfigParam(slice: Slice, arg0: number): ConfigParam { } if ((arg0 == 39)) { - let anon0: HashmapE = loadHashmapE(slice, 256, loadValidatorSignedTempKey); + let anon0: Dictionary = Dictionary.load(Dictionary.Keys.Uint(256), createTheFunction8dq62g(), slice); return { kind: 'ConfigParam__35', anon0: anon0, @@ -10590,7 +10663,7 @@ export function storeConfigParam(configParam: ConfigParam): (builder: Builder) = } if ((configParam.kind == 'ConfigParam__12')) { return ((builder: Builder) => { - storeHashmapE(configParam.workchains, storeWorkchainDescr)(builder); + builder.storeDict(configParam.workchains, Dictionary.Keys.Uint(32), createTheFunctiongt0f6()); }) } @@ -10703,7 +10776,7 @@ export function storeConfigParam(configParam: ConfigParam): (builder: Builder) = } if ((configParam.kind == 'ConfigParam__28')) { return ((builder: Builder) => { - storeHashmapE(configParam.fundamental_smc_addr, storeTrue)(builder); + builder.storeDict(configParam.fundamental_smc_addr, Dictionary.Keys.Uint(256), createTheFunctiond9tr8()); }) } @@ -10745,7 +10818,7 @@ export function storeConfigParam(configParam: ConfigParam): (builder: Builder) = } if ((configParam.kind == 'ConfigParam__35')) { return ((builder: Builder) => { - storeHashmapE(configParam.anon0, storeValidatorSignedTempKey)(builder); + builder.storeDict(configParam.anon0, Dictionary.Keys.Uint(256), createTheFunction8dq62g()); }) } @@ -11013,6 +11086,16 @@ export function storeConfigProposal(configProposal: ConfigProposal): (builder: B } +export function createTheFunctionr3asa(): DictionaryValue { + return { + serialize: ((arg: True, builder: Builder) => { + storeTrue; + }), + parse: loadTrue, + } + +} + /* cfg_proposal_status#ce expires:uint32 proposal:^ConfigProposal is_critical:Bool voters:(HashmapE 16 True) remaining_weight:int64 validator_set_id:uint256 @@ -11026,7 +11109,7 @@ export function loadConfigProposalStatus(slice: Slice): ConfigProposalStatus { let slice1 = slice.loadRef().beginParse(); let proposal: ConfigProposal = loadConfigProposal(slice1); let is_critical: boolean = slice.loadBoolean(); - let voters: HashmapE = loadHashmapE(slice, 16, loadTrue); + let voters: Dictionary = Dictionary.load(Dictionary.Keys.Uint(16), createTheFunctionr3asa(), slice); let remaining_weight: number = slice.loadInt(64); let validator_set_id: bigint = slice.loadUintBig(256); let rounds_remaining: number = slice.loadUint(8); @@ -11057,7 +11140,7 @@ export function storeConfigProposalStatus(configProposalStatus: ConfigProposalSt storeConfigProposal(configProposalStatus.proposal)(cell1); builder.storeRef(cell1); builder.storeBit(configProposalStatus.is_critical); - storeHashmapE(configProposalStatus.voters, storeTrue)(builder); + builder.storeDict(configProposalStatus.voters, Dictionary.Keys.Uint(16), createTheFunctionr3asa()); builder.storeInt(configProposalStatus.remaining_weight, 64); builder.storeUint(configProposalStatus.validator_set_id, 256); builder.storeUint(configProposalStatus.rounds_remaining, 8); @@ -12224,12 +12307,22 @@ export function storeSizeLimitsConfig(sizeLimitsConfig: SizeLimitsConfig): (buil throw new Error('Expected one of "SizeLimitsConfig_size_limits_config", "SizeLimitsConfig_size_limits_config_v2" in loading "SizeLimitsConfig", but data does not satisfy any constructor'); } +export function createTheFunctionzcilx(): DictionaryValue { + return { + serialize: ((arg: Unit, builder: Builder) => { + storeUnit; + }), + parse: loadUnit, + } + +} + // suspended_address_list#00 addresses:(HashmapE 288 Unit) suspended_until:uint32 = SuspendedAddressList; export function loadSuspendedAddressList(slice: Slice): SuspendedAddressList { if (((slice.remainingBits >= 8) && (slice.preloadUint(8) == 0x00))) { slice.loadUint(8); - let addresses: HashmapE = loadHashmapE(slice, 288, loadUnit); + let addresses: Dictionary = Dictionary.load(Dictionary.Keys.Uint(288), createTheFunctionzcilx(), slice); let suspended_until: number = slice.loadUint(32); return { kind: 'SuspendedAddressList', @@ -12244,21 +12337,31 @@ export function loadSuspendedAddressList(slice: Slice): SuspendedAddressList { export function storeSuspendedAddressList(suspendedAddressList: SuspendedAddressList): (builder: Builder) => void { return ((builder: Builder) => { builder.storeUint(0x00, 8); - storeHashmapE(suspendedAddressList.addresses, storeUnit)(builder); + builder.storeDict(suspendedAddressList.addresses, Dictionary.Keys.Uint(288), createTheFunctionzcilx()); builder.storeUint(suspendedAddressList.suspended_until, 32); }) } +export function createTheFunction418gr(): DictionaryValue { + return { + serialize: ((arg: bigint, builder: Builder) => { + builder.storeUint(arg, 256); + }), + parse: ((slice: Slice) => { + return slice.loadUintBig(256) + + }), + } + +} + // oracle_bridge_params#_ bridge_address:bits256 oracle_mutlisig_address:bits256 oracles:(HashmapE 256 uint256) external_chain_address:bits256 = OracleBridgeParams; export function loadOracleBridgeParams(slice: Slice): OracleBridgeParams { let bridge_address: BitString = slice.loadBits(256); let oracle_mutlisig_address: BitString = slice.loadBits(256); - let oracles: HashmapE = loadHashmapE(slice, 256, ((slice: Slice) => { - return slice.loadUintBig(256) - - })); + let oracles: Dictionary = Dictionary.load(Dictionary.Keys.Uint(256), createTheFunction418gr(), slice); let external_chain_address: BitString = slice.loadBits(256); return { kind: 'OracleBridgeParams', @@ -12274,12 +12377,7 @@ export function storeOracleBridgeParams(oracleBridgeParams: OracleBridgeParams): return ((builder: Builder) => { builder.storeBits(oracleBridgeParams.bridge_address); builder.storeBits(oracleBridgeParams.oracle_mutlisig_address); - storeHashmapE(oracleBridgeParams.oracles, ((arg: bigint) => { - return ((builder: Builder) => { - builder.storeUint(arg, 256); - }) - - }))(builder); + builder.storeDict(oracleBridgeParams.oracles, Dictionary.Keys.Uint(256), createTheFunction418gr()); builder.storeBits(oracleBridgeParams.external_chain_address); }) @@ -12324,8 +12422,34 @@ export function storeJettonBridgePrices(jettonBridgePrices: JettonBridgePrices): } +export function createTheFunctioni0poef(): DictionaryValue { + return { + serialize: ((arg: bigint, builder: Builder) => { + builder.storeUint(arg, 256); + }), + parse: ((slice: Slice) => { + return slice.loadUintBig(256) + + }), + } + +} + // jetton_bridge_params_v0#00 bridge_address:bits256 oracles_address:bits256 oracles:(HashmapE 256 uint256) state_flags:uint8 burn_bridge_fee:Coins = JettonBridgeParams; +export function createTheFunction7c3ja(): DictionaryValue { + return { + serialize: ((arg: bigint, builder: Builder) => { + builder.storeUint(arg, 256); + }), + parse: ((slice: Slice) => { + return slice.loadUintBig(256) + + }), + } + +} + // jetton_bridge_params_v1#01 bridge_address:bits256 oracles_address:bits256 oracles:(HashmapE 256 uint256) state_flags:uint8 prices:^JettonBridgePrices external_chain_address:bits256 = JettonBridgeParams; export function loadJettonBridgeParams(slice: Slice): JettonBridgeParams { @@ -12333,10 +12457,7 @@ export function loadJettonBridgeParams(slice: Slice): JettonBridgeParams { slice.loadUint(8); let bridge_address: BitString = slice.loadBits(256); let oracles_address: BitString = slice.loadBits(256); - let oracles: HashmapE = loadHashmapE(slice, 256, ((slice: Slice) => { - return slice.loadUintBig(256) - - })); + let oracles: Dictionary = Dictionary.load(Dictionary.Keys.Uint(256), createTheFunctioni0poef(), slice); let state_flags: number = slice.loadUint(8); let burn_bridge_fee: Coins = loadCoins(slice); return { @@ -12353,10 +12474,7 @@ export function loadJettonBridgeParams(slice: Slice): JettonBridgeParams { slice.loadUint(8); let bridge_address: BitString = slice.loadBits(256); let oracles_address: BitString = slice.loadBits(256); - let oracles: HashmapE = loadHashmapE(slice, 256, ((slice: Slice) => { - return slice.loadUintBig(256) - - })); + let oracles: Dictionary = Dictionary.load(Dictionary.Keys.Uint(256), createTheFunction7c3ja(), slice); let state_flags: number = slice.loadUint(8); let slice1 = slice.loadRef().beginParse(); let prices: JettonBridgePrices = loadJettonBridgePrices(slice1); @@ -12381,12 +12499,7 @@ export function storeJettonBridgeParams(jettonBridgeParams: JettonBridgeParams): builder.storeUint(0x00, 8); builder.storeBits(jettonBridgeParams.bridge_address); builder.storeBits(jettonBridgeParams.oracles_address); - storeHashmapE(jettonBridgeParams.oracles, ((arg: bigint) => { - return ((builder: Builder) => { - builder.storeUint(arg, 256); - }) - - }))(builder); + builder.storeDict(jettonBridgeParams.oracles, Dictionary.Keys.Uint(256), createTheFunctioni0poef()); builder.storeUint(jettonBridgeParams.state_flags, 8); storeCoins(jettonBridgeParams.burn_bridge_fee)(builder); }) @@ -12397,12 +12510,7 @@ export function storeJettonBridgeParams(jettonBridgeParams: JettonBridgeParams): builder.storeUint(0x01, 8); builder.storeBits(jettonBridgeParams.bridge_address); builder.storeBits(jettonBridgeParams.oracles_address); - storeHashmapE(jettonBridgeParams.oracles, ((arg: bigint) => { - return ((builder: Builder) => { - builder.storeUint(arg, 256); - }) - - }))(builder); + builder.storeDict(jettonBridgeParams.oracles, Dictionary.Keys.Uint(256), createTheFunction7c3ja()); builder.storeUint(jettonBridgeParams.state_flags, 8); let cell1 = beginCell(); storeJettonBridgePrices(jettonBridgeParams.prices)(cell1); @@ -12414,6 +12522,16 @@ export function storeJettonBridgeParams(jettonBridgeParams: JettonBridgeParams): throw new Error('Expected one of "JettonBridgeParams_jetton_bridge_params_v0", "JettonBridgeParams_jetton_bridge_params_v1" in loading "JettonBridgeParams", but data does not satisfy any constructor'); } +export function createTheFunction9hvl2(): DictionaryValue { + return { + serialize: ((arg: CryptoSignaturePair, builder: Builder) => { + storeCryptoSignaturePair; + }), + parse: loadCryptoSignaturePair, + } + +} + /* block_signatures_pure#_ sig_count:uint32 sig_weight:uint64 signatures:(HashmapE 16 CryptoSignaturePair) = BlockSignaturesPure; @@ -12422,7 +12540,7 @@ block_signatures_pure#_ sig_count:uint32 sig_weight:uint64 export function loadBlockSignaturesPure(slice: Slice): BlockSignaturesPure { let sig_count: number = slice.loadUint(32); let sig_weight: number = slice.loadUint(64); - let signatures: HashmapE = loadHashmapE(slice, 16, loadCryptoSignaturePair); + let signatures: Dictionary = Dictionary.load(Dictionary.Keys.Uint(16), createTheFunction9hvl2(), slice); return { kind: 'BlockSignaturesPure', sig_count: sig_count, @@ -12436,7 +12554,7 @@ export function storeBlockSignaturesPure(blockSignaturesPure: BlockSignaturesPur return ((builder: Builder) => { builder.storeUint(blockSignaturesPure.sig_count, 32); builder.storeUint(blockSignaturesPure.sig_weight, 64); - storeHashmapE(blockSignaturesPure.signatures, storeCryptoSignaturePair)(builder); + builder.storeDict(blockSignaturesPure.signatures, Dictionary.Keys.Uint(16), createTheFunction9hvl2()); }) } @@ -12623,16 +12741,29 @@ export function storeTopBlockDescr(topBlockDescr: TopBlockDescr): (builder: Buil } +export function createTheFunctiontftili(): DictionaryValue { + return { + serialize: ((arg: TopBlockDescr, builder: Builder) => { + let cell1 = beginCell(); + storeTopBlockDescr(arg)(cell1); + builder.storeRef(cell1); + + }), + parse: ((slice: Slice) => { + let slice1 = slice.loadRef().beginParse(); + return loadTopBlockDescr(slice1) + + }), + } + +} + // top_block_descr_set#4ac789f3 collection:(HashmapE 96 ^TopBlockDescr) = TopBlockDescrSet; export function loadTopBlockDescrSet(slice: Slice): TopBlockDescrSet { if (((slice.remainingBits >= 32) && (slice.preloadUint(32) == 0x4ac789f3))) { slice.loadUint(32); - let collection: HashmapE = loadHashmapE(slice, 96, ((slice: Slice) => { - let slice1 = slice.loadRef().beginParse(); - return loadTopBlockDescr(slice1) - - })); + let collection: Dictionary = Dictionary.load(Dictionary.Keys.Uint(96), createTheFunctiontftili(), slice); return { kind: 'TopBlockDescrSet', collection: collection, @@ -12645,15 +12776,7 @@ export function loadTopBlockDescrSet(slice: Slice): TopBlockDescrSet { export function storeTopBlockDescrSet(topBlockDescrSet: TopBlockDescrSet): (builder: Builder) => void { return ((builder: Builder) => { builder.storeUint(0x4ac789f3, 32); - storeHashmapE(topBlockDescrSet.collection, ((arg: TopBlockDescr) => { - return ((builder: Builder) => { - let cell1 = beginCell(); - storeTopBlockDescr(arg)(cell1); - builder.storeRef(cell1); - - }) - - }))(builder); + builder.storeDict(topBlockDescrSet.collection, Dictionary.Keys.Uint(96), createTheFunctiontftili()); }) } @@ -12805,6 +12928,16 @@ export function storeValidatorComplaint(validatorComplaint: ValidatorComplaint): } +export function createTheFunctionv6lf7(): DictionaryValue { + return { + serialize: ((arg: True, builder: Builder) => { + storeTrue; + }), + parse: loadTrue, + } + +} + // complaint_status#2d complaint:^ValidatorComplaint voters:(HashmapE 16 True) vset_id:uint256 weight_remaining:int64 = ValidatorComplaintStatus; export function loadValidatorComplaintStatus(slice: Slice): ValidatorComplaintStatus { @@ -12812,7 +12945,7 @@ export function loadValidatorComplaintStatus(slice: Slice): ValidatorComplaintSt slice.loadUint(8); let slice1 = slice.loadRef().beginParse(); let complaint: ValidatorComplaint = loadValidatorComplaint(slice1); - let voters: HashmapE = loadHashmapE(slice, 16, loadTrue); + let voters: Dictionary = Dictionary.load(Dictionary.Keys.Uint(16), createTheFunctionv6lf7(), slice); let vset_id: bigint = slice.loadUintBig(256); let weight_remaining: number = slice.loadInt(64); return { @@ -12833,7 +12966,7 @@ export function storeValidatorComplaintStatus(validatorComplaintStatus: Validato let cell1 = beginCell(); storeValidatorComplaint(validatorComplaintStatus.complaint)(cell1); builder.storeRef(cell1); - storeHashmapE(validatorComplaintStatus.voters, storeTrue)(builder); + builder.storeDict(validatorComplaintStatus.voters, Dictionary.Keys.Uint(16), createTheFunctionv6lf7()); builder.storeUint(validatorComplaintStatus.vset_id, 256); builder.storeInt(validatorComplaintStatus.weight_remaining, 64); }) @@ -13230,10 +13363,20 @@ export function storeVmStackList(vmStackList: VmStackList): (builder: Builder) = throw new Error('Expected one of "VmStackList_vm_stk_nil", "VmStackList_vm_stk_cons" in loading "VmStackList", but data does not satisfy any constructor'); } +export function createTheFunctionx3ic2j(): DictionaryValue { + return { + serialize: ((arg: VmStackValue, builder: Builder) => { + storeVmStackValue; + }), + parse: loadVmStackValue, + } + +} + // _ cregs:(HashmapE 4 VmStackValue) = VmSaveList; export function loadVmSaveList(slice: Slice): VmSaveList { - let cregs: HashmapE = loadHashmapE(slice, 4, loadVmStackValue); + let cregs: Dictionary = Dictionary.load(Dictionary.Keys.Uint(4), createTheFunctionx3ic2j(), slice); return { kind: 'VmSaveList', cregs: cregs, @@ -13243,7 +13386,7 @@ export function loadVmSaveList(slice: Slice): VmSaveList { export function storeVmSaveList(vmSaveList: VmSaveList): (builder: Builder) => void { return ((builder: Builder) => { - storeHashmapE(vmSaveList.cregs, storeVmStackValue)(builder); + builder.storeDict(vmSaveList.cregs, Dictionary.Keys.Uint(4), createTheFunctionx3ic2j()); }) } @@ -13281,14 +13424,27 @@ export function storeVmGasLimits(vmGasLimits: VmGasLimits): (builder: Builder) = } -// _ libraries:(HashmapE 256 ^Cell) = VmLibraries; +export function createTheFunctionhc2hz(): DictionaryValue { + return { + serialize: ((arg: Slice, builder: Builder) => { + let cell1 = beginCell(); + cell1.storeSlice(arg); + builder.storeRef(cell1); -export function loadVmLibraries(slice: Slice): VmLibraries { - let libraries: HashmapE = loadHashmapE(slice, 256, ((slice: Slice) => { + }), + parse: ((slice: Slice) => { let slice1 = slice.loadRef().beginParse(); return slice1 - })); + }), + } + +} + +// _ libraries:(HashmapE 256 ^Cell) = VmLibraries; + +export function loadVmLibraries(slice: Slice): VmLibraries { + let libraries: Dictionary = Dictionary.load(Dictionary.Keys.Uint(256), createTheFunctionhc2hz(), slice); return { kind: 'VmLibraries', libraries: libraries, @@ -13298,15 +13454,7 @@ export function loadVmLibraries(slice: Slice): VmLibraries { export function storeVmLibraries(vmLibraries: VmLibraries): (builder: Builder) => void { return ((builder: Builder) => { - storeHashmapE(vmLibraries.libraries, ((arg: Slice) => { - return ((builder: Builder) => { - let cell1 = beginCell(); - cell1.storeSlice(arg); - builder.storeRef(cell1); - - }) - - }))(builder); + builder.storeDict(vmLibraries.libraries, Dictionary.Keys.Uint(256), createTheFunctionhc2hz()); }) } @@ -13617,14 +13765,27 @@ export function storeVmCont(vmCont: VmCont): (builder: Builder) => void { throw new Error('Expected one of "VmCont_vmc_std", "VmCont_vmc_envelope", "VmCont_vmc_quit", "VmCont_vmc_quit_exc", "VmCont_vmc_repeat", "VmCont_vmc_until", "VmCont_vmc_again", "VmCont_vmc_while_cond", "VmCont_vmc_while_body", "VmCont_vmc_pushint" in loading "VmCont", but data does not satisfy any constructor'); } -// _ (HashmapE 256 ^DNSRecord) = DNS_RecordSet; +export function createTheFunctioncpt7pi(): DictionaryValue { + return { + serialize: ((arg: DNSRecord, builder: Builder) => { + let cell1 = beginCell(); + storeDNSRecord(arg)(cell1); + builder.storeRef(cell1); -export function loadDNS_RecordSet(slice: Slice): DNS_RecordSet { - let anon0: HashmapE = loadHashmapE(slice, 256, ((slice: Slice) => { + }), + parse: ((slice: Slice) => { let slice1 = slice.loadRef().beginParse(); return loadDNSRecord(slice1) - })); + }), + } + +} + +// _ (HashmapE 256 ^DNSRecord) = DNS_RecordSet; + +export function loadDNS_RecordSet(slice: Slice): DNS_RecordSet { + let anon0: Dictionary = Dictionary.load(Dictionary.Keys.Uint(256), createTheFunctioncpt7pi(), slice); return { kind: 'DNS_RecordSet', anon0: anon0, @@ -13634,15 +13795,7 @@ export function loadDNS_RecordSet(slice: Slice): DNS_RecordSet { export function storeDNS_RecordSet(dNS_RecordSet: DNS_RecordSet): (builder: Builder) => void { return ((builder: Builder) => { - storeHashmapE(dNS_RecordSet.anon0, ((arg: DNSRecord) => { - return ((builder: Builder) => { - let cell1 = beginCell(); - storeDNSRecord(arg)(cell1); - builder.storeRef(cell1); - - }) - - }))(builder); + builder.storeDict(dNS_RecordSet.anon0, Dictionary.Keys.Uint(256), createTheFunctioncpt7pi()); }) } diff --git a/test/generated_files/generated_test.ts b/test/generated_files/generated_test.ts index af2bb2d..c8a8c9f 100644 --- a/test/generated_files/generated_test.ts +++ b/test/generated_files/generated_test.ts @@ -1,10 +1,12 @@ -import { Builder, Dictionary, DictionaryValue } from 'ton' +import { Builder } from 'ton' import { Slice } from 'ton' import { beginCell } from 'ton' import { BitString } from 'ton' import { Cell } from 'ton' import { Address } from 'ton' import { ExternalAddress } from 'ton' +import { Dictionary } from 'ton' +import { DictionaryValue } from 'ton' export function bitLen(n: number) { return n.toString(2).length;; } @@ -2186,22 +2188,23 @@ export function storeHashmapE(hashmapE: HashmapE, storeX: (x: X) => (build throw new Error('Expected one of "HashmapE_hme_empty", "HashmapE_hme_root" in loading "HashmapE", but data does not satisfy any constructor'); } -// a$_ x:(HashmapE 8 uint16) = HashmapEUser; - - -function createNumberValue(): DictionaryValue { +export function createTheFunctionyuf4c(): DictionaryValue { return { - serialize: (src, buidler) => { - buidler.storeUint(src, 16); - }, - parse: (src) => { - return src.loadUint(16); - } + serialize: ((arg: number, builder: Builder) => { + builder.storeUint(arg, 16); + }), + parse: ((slice: Slice) => { + return slice.loadUint(16) + + }), } + } +// a$_ x:(HashmapE 8 uint16) = HashmapEUser; + export function loadHashmapEUser(slice: Slice): HashmapEUser { - let x: Dictionary = Dictionary.load(Dictionary.Keys.Uint(8), createNumberValue(), slice) + let x: Dictionary = Dictionary.load(Dictionary.Keys.Uint(8), createTheFunctionyuf4c(), slice); return { kind: 'HashmapEUser', x: x, @@ -2211,7 +2214,7 @@ export function loadHashmapEUser(slice: Slice): HashmapEUser { export function storeHashmapEUser(hashmapEUser: HashmapEUser): (builder: Builder) => void { return ((builder: Builder) => { - builder.storeDict(hashmapEUser.x, Dictionary.Keys.Uint(8), createNumberValue()) + builder.storeDict(hashmapEUser.x, Dictionary.Keys.Uint(8), createTheFunctionyuf4c()); }) }