diff --git a/generated_block.ts b/generated_block.ts index c942501..0ee53d4 100644 --- a/generated_block.ts +++ b/generated_block.ts @@ -350,9 +350,9 @@ export type CommonMsgInfo = CommonMsgInfo_int_msg_info | CommonMsgInfo_ext_in_ms export interface CommonMsgInfo_int_msg_info { readonly kind: 'CommonMsgInfo_int_msg_info'; - readonly ihr_disabled: Bool; - readonly bounce: Bool; - readonly bounced: Bool; + readonly ihr_disabled: boolean; + readonly bounce: boolean; + readonly bounced: boolean; readonly src: MsgAddressInt; readonly dest: MsgAddressInt; readonly value: CurrencyCollection; @@ -381,9 +381,9 @@ export type CommonMsgInfoRelaxed = CommonMsgInfoRelaxed_int_msg_info | CommonMsg export interface CommonMsgInfoRelaxed_int_msg_info { readonly kind: 'CommonMsgInfoRelaxed_int_msg_info'; - readonly ihr_disabled: Bool; - readonly bounce: Bool; - readonly bounced: Bool; + readonly ihr_disabled: boolean; + readonly bounce: boolean; + readonly bounced: boolean; readonly src: MsgAddress; readonly dest: MsgAddressInt; readonly value: CurrencyCollection; @@ -403,8 +403,8 @@ export interface CommonMsgInfoRelaxed_ext_out_msg_info { export interface TickTock { readonly kind: 'TickTock'; - readonly tick: Bool; - readonly tock: Bool; + readonly tick: boolean; + readonly tock: boolean; } export interface StateInit { @@ -427,7 +427,7 @@ export interface StateInitWithLibs { export interface SimpleLib { readonly kind: 'SimpleLib'; - readonly public0: Bool; + readonly public0: boolean; readonly root: Slice; } @@ -815,9 +815,9 @@ export interface TrComputePhase_tr_phase_compute_skipped { export interface TrComputePhase_tr_phase_compute_vm { readonly kind: 'TrComputePhase_tr_phase_compute_vm'; - readonly success: Bool; - readonly msg_state_used: Bool; - readonly account_activated: Bool; + readonly success: boolean; + readonly msg_state_used: boolean; + readonly account_activated: boolean; readonly gas_fees: Grams; readonly gas_used: VarUInteger; readonly gas_limit: VarUInteger; @@ -850,9 +850,9 @@ export interface ComputeSkipReason_cskip_suspended { export interface TrActionPhase { readonly kind: 'TrActionPhase'; - readonly success: Bool; - readonly valid: Bool; - readonly no_funds: Bool; + readonly success: boolean; + readonly valid: boolean; + readonly no_funds: boolean; readonly status_change: AccStatusChange; readonly total_fwd_fees: Maybe; readonly total_action_fees: Maybe; @@ -889,14 +889,14 @@ export type TransactionDescr = TransactionDescr_trans_ord | TransactionDescr_tra export interface TransactionDescr_trans_ord { readonly kind: 'TransactionDescr_trans_ord'; - readonly credit_first: Bool; + readonly credit_first: boolean; readonly storage_ph: Maybe; readonly credit_ph: Maybe; readonly compute_ph: TrComputePhase; readonly action: Maybe; - readonly aborted: Bool; + readonly aborted: boolean; readonly bounce: Maybe; - readonly destroyed: Bool; + readonly destroyed: boolean; } export interface TransactionDescr_trans_storage { @@ -906,12 +906,12 @@ export interface TransactionDescr_trans_storage { export interface TransactionDescr_trans_tick_tock { readonly kind: 'TransactionDescr_trans_tick_tock'; - readonly is_tock: Bool; + readonly is_tock: boolean; readonly storage_ph: TrStoragePhase; readonly compute_ph: TrComputePhase; readonly action: Maybe; - readonly aborted: Bool; - readonly destroyed: Bool; + readonly aborted: boolean; + readonly destroyed: boolean; } export interface TransactionDescr_trans_split_prepare { @@ -920,22 +920,22 @@ export interface TransactionDescr_trans_split_prepare { readonly storage_ph: Maybe; readonly compute_ph: TrComputePhase; readonly action: Maybe; - readonly aborted: Bool; - readonly destroyed: Bool; + readonly aborted: boolean; + readonly destroyed: boolean; } export interface TransactionDescr_trans_split_install { readonly kind: 'TransactionDescr_trans_split_install'; readonly split_info: SplitMergeInfo; readonly prepare_transaction: Transaction; - readonly installed: Bool; + readonly installed: boolean; } export interface TransactionDescr_trans_merge_prepare { readonly kind: 'TransactionDescr_trans_merge_prepare'; readonly split_info: SplitMergeInfo; readonly storage_ph: TrStoragePhase; - readonly aborted: Bool; + readonly aborted: boolean; } export interface TransactionDescr_trans_merge_install { @@ -946,8 +946,8 @@ export interface TransactionDescr_trans_merge_install { readonly credit_ph: Maybe; readonly compute_ph: TrComputePhase; readonly action: Maybe; - readonly aborted: Bool; - readonly destroyed: Bool; + readonly aborted: boolean; + readonly destroyed: boolean; } export interface SplitMergeInfo { @@ -1102,9 +1102,9 @@ export interface BlockInfo { readonly after_merge: number; readonly before_split: number; readonly after_split: number; - readonly want_split: Bool; - readonly want_merge: Bool; - readonly key_block: Bool; + readonly want_split: boolean; + readonly want_merge: boolean; + readonly key_block: boolean; readonly vert_seqno_incr: number; readonly flags: number; readonly seq_no: number; @@ -1226,11 +1226,11 @@ export interface ShardDescr_shard_descr { readonly end_lt: number; readonly root_hash: BitString; readonly file_hash: BitString; - readonly before_split: Bool; - readonly before_merge: Bool; - readonly want_split: Bool; - readonly want_merge: Bool; - readonly nx_cc_updated: Bool; + readonly before_split: boolean; + readonly before_merge: boolean; + readonly want_split: boolean; + readonly want_merge: boolean; + readonly nx_cc_updated: boolean; readonly flags: number; readonly next_catchain_seqno: number; readonly next_validator_shard: number; @@ -1249,11 +1249,11 @@ export interface ShardDescr_shard_descr_new { readonly end_lt: number; readonly root_hash: BitString; readonly file_hash: BitString; - readonly before_split: Bool; - readonly before_merge: Bool; - readonly want_split: Bool; - readonly want_merge: Bool; - readonly nx_cc_updated: Bool; + readonly before_split: boolean; + readonly before_merge: boolean; + readonly want_split: boolean; + readonly want_merge: boolean; + readonly nx_cc_updated: boolean; readonly flags: number; readonly next_catchain_seqno: number; readonly next_validator_shard: number; @@ -1305,7 +1305,7 @@ export interface ValidatorInfo { readonly kind: 'ValidatorInfo'; readonly validator_list_hash_short: number; readonly catchain_seqno: number; - readonly nx_cc_updated: Bool; + readonly nx_cc_updated: boolean; } export interface ValidatorBaseInfo { @@ -1316,13 +1316,13 @@ export interface ValidatorBaseInfo { export interface KeyMaxLt { readonly kind: 'KeyMaxLt'; - readonly key: Bool; + readonly key: boolean; readonly max_end_lt: number; } export interface KeyExtBlkRef { readonly kind: 'KeyExtBlkRef'; - readonly key: Bool; + readonly key: boolean; readonly blk_ref: ExtBlkRef; } @@ -1364,7 +1364,7 @@ export interface McStateExtra { readonly flags: number; readonly validator_info: ValidatorInfo; readonly prev_blocks: OldMcBlocksInfo; - readonly after_key_block: Bool; + readonly after_key_block: boolean; readonly last_key_block: Maybe; readonly block_create_stats: BlockCreateStats | undefined; readonly global_balance: CurrencyCollection; @@ -1743,7 +1743,7 @@ export interface ConfigProposalStatus { readonly kind: 'ConfigProposalStatus'; readonly expires: number; readonly proposal: ConfigProposal; - readonly is_critical: Bool; + readonly is_critical: boolean; readonly voters: HashmapE; readonly remaining_weight: number; readonly validator_set_id: number; @@ -1785,8 +1785,8 @@ export interface WorkchainDescr_workchain { readonly min_split: number; readonly max_split: number; readonly basic: number; - readonly active: Bool; - readonly accept_msgs: Bool; + readonly active: boolean; + readonly accept_msgs: boolean; readonly flags: number; readonly zerostate_root_hash: BitString; readonly zerostate_file_hash: BitString; @@ -1801,8 +1801,8 @@ export interface WorkchainDescr_workchain_v2 { readonly min_split: number; readonly max_split: number; readonly basic: number; - readonly active: Bool; - readonly accept_msgs: Bool; + readonly active: boolean; + readonly accept_msgs: boolean; readonly flags: number; readonly zerostate_root_hash: BitString; readonly zerostate_file_hash: BitString; @@ -1900,7 +1900,7 @@ export interface CatchainConfig_catchain_config { export interface CatchainConfig_catchain_config_new { readonly kind: 'CatchainConfig_catchain_config_new'; readonly flags: number; - readonly shuffle_mc_validators: Bool; + readonly shuffle_mc_validators: boolean; readonly mc_catchain_lifetime: number; readonly shard_catchain_lifetime: number; readonly shard_validators_lifetime: number; @@ -1924,7 +1924,7 @@ export interface ConsensusConfig_consensus_config { export interface ConsensusConfig_consensus_config_new { readonly kind: 'ConsensusConfig_consensus_config_new'; readonly flags: number; - readonly new_catchain_ids: Bool; + readonly new_catchain_ids: boolean; readonly round_candidates: number; readonly next_candidate_delay_ms: number; readonly consensus_timeout_ms: number; @@ -1938,7 +1938,7 @@ export interface ConsensusConfig_consensus_config_new { export interface ConsensusConfig_consensus_config_v3 { readonly kind: 'ConsensusConfig_consensus_config_v3'; readonly flags: number; - readonly new_catchain_ids: Bool; + readonly new_catchain_ids: boolean; readonly round_candidates: number; readonly next_candidate_delay_ms: number; readonly consensus_timeout_ms: number; @@ -1953,7 +1953,7 @@ export interface ConsensusConfig_consensus_config_v3 { export interface ConsensusConfig_consensus_config_v4 { readonly kind: 'ConsensusConfig_consensus_config_v4'; readonly flags: number; - readonly new_catchain_ids: Bool; + readonly new_catchain_ids: boolean; readonly round_candidates: number; readonly next_candidate_delay_ms: number; readonly consensus_timeout_ms: number; @@ -2475,8 +2475,8 @@ export type ChanState = ChanState_chan_state_init | ChanState_chan_state_close | export interface ChanState_chan_state_init { readonly kind: 'ChanState_chan_state_init'; - readonly signed_A: Bool; - readonly signed_B: Bool; + readonly signed_A: boolean; + readonly signed_B: boolean; readonly min_A: Grams; readonly min_B: Grams; readonly expire_at: number; @@ -2486,8 +2486,8 @@ export interface ChanState_chan_state_init { export interface ChanState_chan_state_close { readonly kind: 'ChanState_chan_state_close'; - readonly signed_A: Bool; - readonly signed_B: Bool; + readonly signed_A: boolean; + readonly signed_B: boolean; readonly promise_A: Grams; readonly promise_B: Grams; readonly expire_at: number; @@ -3971,9 +3971,9 @@ ext_out_msg_info$11 src:MsgAddressInt dest:MsgAddressExt export function loadCommonMsgInfo(slice: Slice): CommonMsgInfo { if (((slice.remainingBits >= 1) && (slice.preloadUint(1) == 0b0))) { slice.loadUint(1); - let ihr_disabled: Bool = loadBool(slice); - let bounce: Bool = loadBool(slice); - let bounced: Bool = loadBool(slice); + let ihr_disabled: boolean = slice.loadBoolean(); + let bounce: boolean = slice.loadBoolean(); + let bounced: boolean = slice.loadBoolean(); let src: MsgAddressInt = loadMsgAddressInt(slice); let dest: MsgAddressInt = loadMsgAddressInt(slice); let value: CurrencyCollection = loadCurrencyCollection(slice); @@ -4031,9 +4031,9 @@ export function storeCommonMsgInfo(commonMsgInfo: CommonMsgInfo): (builder: Buil if ((commonMsgInfo.kind == 'CommonMsgInfo_int_msg_info')) { return ((builder: Builder) => { builder.storeUint(0b0, 1); - storeBool(commonMsgInfo.ihr_disabled)(builder); - storeBool(commonMsgInfo.bounce)(builder); - storeBool(commonMsgInfo.bounced)(builder); + builder.storeBit(commonMsgInfo.ihr_disabled); + builder.storeBit(commonMsgInfo.bounce); + builder.storeBit(commonMsgInfo.bounced); storeMsgAddressInt(commonMsgInfo.src)(builder); storeMsgAddressInt(commonMsgInfo.dest)(builder); storeCurrencyCollection(commonMsgInfo.value)(builder); @@ -4081,9 +4081,9 @@ ext_out_msg_info$11 src:MsgAddress dest:MsgAddressExt export function loadCommonMsgInfoRelaxed(slice: Slice): CommonMsgInfoRelaxed { if (((slice.remainingBits >= 1) && (slice.preloadUint(1) == 0b0))) { slice.loadUint(1); - let ihr_disabled: Bool = loadBool(slice); - let bounce: Bool = loadBool(slice); - let bounced: Bool = loadBool(slice); + let ihr_disabled: boolean = slice.loadBoolean(); + let bounce: boolean = slice.loadBoolean(); + let bounced: boolean = slice.loadBoolean(); let src: MsgAddress = loadMsgAddress(slice); let dest: MsgAddressInt = loadMsgAddressInt(slice); let value: CurrencyCollection = loadCurrencyCollection(slice); @@ -4128,9 +4128,9 @@ export function storeCommonMsgInfoRelaxed(commonMsgInfoRelaxed: CommonMsgInfoRel if ((commonMsgInfoRelaxed.kind == 'CommonMsgInfoRelaxed_int_msg_info')) { return ((builder: Builder) => { builder.storeUint(0b0, 1); - storeBool(commonMsgInfoRelaxed.ihr_disabled)(builder); - storeBool(commonMsgInfoRelaxed.bounce)(builder); - storeBool(commonMsgInfoRelaxed.bounced)(builder); + builder.storeBit(commonMsgInfoRelaxed.ihr_disabled); + builder.storeBit(commonMsgInfoRelaxed.bounce); + builder.storeBit(commonMsgInfoRelaxed.bounced); storeMsgAddress(commonMsgInfoRelaxed.src)(builder); storeMsgAddressInt(commonMsgInfoRelaxed.dest)(builder); storeCurrencyCollection(commonMsgInfoRelaxed.value)(builder); @@ -4157,8 +4157,8 @@ export function storeCommonMsgInfoRelaxed(commonMsgInfoRelaxed: CommonMsgInfoRel // tick_tock$_ tick:Bool tock:Bool = TickTock; export function loadTickTock(slice: Slice): TickTock { - let tick: Bool = loadBool(slice); - let tock: Bool = loadBool(slice); + let tick: boolean = slice.loadBoolean(); + let tock: boolean = slice.loadBoolean(); return { kind: 'TickTock', tick: tick, @@ -4169,8 +4169,8 @@ export function loadTickTock(slice: Slice): TickTock { export function storeTickTock(tickTock: TickTock): (builder: Builder) => void { return ((builder: Builder) => { - storeBool(tickTock.tick)(builder); - storeBool(tickTock.tock)(builder); + builder.storeBit(tickTock.tick); + builder.storeBit(tickTock.tock); }) } @@ -4322,7 +4322,7 @@ export function storeStateInitWithLibs(stateInitWithLibs: StateInitWithLibs): (b // simple_lib$_ public:Bool root:^Cell = SimpleLib; export function loadSimpleLib(slice: Slice): SimpleLib { - let public0: Bool = loadBool(slice); + let public0: boolean = slice.loadBoolean(); let slice1 = slice.loadRef().beginParse(); let root: Slice = slice1; return { @@ -4335,7 +4335,7 @@ export function loadSimpleLib(slice: Slice): SimpleLib { export function storeSimpleLib(simpleLib: SimpleLib): (builder: Builder) => void { return ((builder: Builder) => { - storeBool(simpleLib.public0)(builder); + builder.storeBit(simpleLib.public0); let cell1 = beginCell(); cell1.storeSlice(simpleLib.root); builder.storeRef(cell1); @@ -6114,9 +6114,9 @@ export function loadTrComputePhase(slice: Slice): TrComputePhase { } if (((slice.remainingBits >= 1) && (slice.preloadUint(1) == 0b1))) { slice.loadUint(1); - let success: Bool = loadBool(slice); - let msg_state_used: Bool = loadBool(slice); - let account_activated: Bool = loadBool(slice); + let success: boolean = slice.loadBoolean(); + let msg_state_used: boolean = slice.loadBoolean(); + let account_activated: boolean = slice.loadBoolean(); let gas_fees: Grams = loadGrams(slice); let slice1 = slice.loadRef().beginParse(); let gas_used: VarUInteger = loadVarUInteger(slice1, 7); @@ -6166,9 +6166,9 @@ export function storeTrComputePhase(trComputePhase: TrComputePhase): (builder: B if ((trComputePhase.kind == 'TrComputePhase_tr_phase_compute_vm')) { return ((builder: Builder) => { builder.storeUint(0b1, 1); - storeBool(trComputePhase.success)(builder); - storeBool(trComputePhase.msg_state_used)(builder); - storeBool(trComputePhase.account_activated)(builder); + builder.storeBit(trComputePhase.success); + builder.storeBit(trComputePhase.msg_state_used); + builder.storeBit(trComputePhase.account_activated); storeGrams(trComputePhase.gas_fees)(builder); let cell1 = beginCell(); storeVarUInteger(trComputePhase.gas_used)(cell1); @@ -6276,9 +6276,9 @@ tr_phase_action$_ success:Bool valid:Bool no_funds:Bool */ export function loadTrActionPhase(slice: Slice): TrActionPhase { - let success: Bool = loadBool(slice); - let valid: Bool = loadBool(slice); - let no_funds: Bool = loadBool(slice); + let success: boolean = slice.loadBoolean(); + let valid: boolean = slice.loadBoolean(); + let no_funds: boolean = slice.loadBoolean(); let status_change: AccStatusChange = loadAccStatusChange(slice); let total_fwd_fees: Maybe = loadMaybe(slice, loadGrams); let total_action_fees: Maybe = loadMaybe(slice, loadGrams); @@ -6315,9 +6315,9 @@ export function loadTrActionPhase(slice: Slice): TrActionPhase { export function storeTrActionPhase(trActionPhase: TrActionPhase): (builder: Builder) => void { return ((builder: Builder) => { - storeBool(trActionPhase.success)(builder); - storeBool(trActionPhase.valid)(builder); - storeBool(trActionPhase.no_funds)(builder); + builder.storeBit(trActionPhase.success); + builder.storeBit(trActionPhase.valid); + builder.storeBit(trActionPhase.no_funds); storeAccStatusChange(trActionPhase.status_change)(builder); storeMaybe(trActionPhase.total_fwd_fees, storeGrams)(builder); storeMaybe(trActionPhase.total_action_fees, storeGrams)(builder); @@ -6466,7 +6466,7 @@ trans_merge_install$0111 split_info:SplitMergeInfo export function loadTransactionDescr(slice: Slice): TransactionDescr { if (((slice.remainingBits >= 4) && (slice.preloadUint(4) == 0b0000))) { slice.loadUint(4); - let credit_first: Bool = loadBool(slice); + let credit_first: boolean = slice.loadBoolean(); let storage_ph: Maybe = loadMaybe(slice, loadTrStoragePhase); let credit_ph: Maybe = loadMaybe(slice, loadTrCreditPhase); let compute_ph: TrComputePhase = loadTrComputePhase(slice); @@ -6475,9 +6475,9 @@ export function loadTransactionDescr(slice: Slice): TransactionDescr { return loadTrActionPhase(slice1) })); - let aborted: Bool = loadBool(slice); + let aborted: boolean = slice.loadBoolean(); let bounce: Maybe = loadMaybe(slice, loadTrBouncePhase); - let destroyed: Bool = loadBool(slice); + let destroyed: boolean = slice.loadBoolean(); return { kind: 'TransactionDescr_trans_ord', credit_first: credit_first, @@ -6502,7 +6502,7 @@ export function loadTransactionDescr(slice: Slice): TransactionDescr { } if (((slice.remainingBits >= 3) && (slice.preloadUint(3) == 0b001))) { slice.loadUint(3); - let is_tock: Bool = loadBool(slice); + let is_tock: boolean = slice.loadBoolean(); let storage_ph: TrStoragePhase = loadTrStoragePhase(slice); let compute_ph: TrComputePhase = loadTrComputePhase(slice); let action: Maybe = loadMaybe(slice, ((slice: Slice) => { @@ -6510,8 +6510,8 @@ export function loadTransactionDescr(slice: Slice): TransactionDescr { return loadTrActionPhase(slice1) })); - let aborted: Bool = loadBool(slice); - let destroyed: Bool = loadBool(slice); + let aborted: boolean = slice.loadBoolean(); + let destroyed: boolean = slice.loadBoolean(); return { kind: 'TransactionDescr_trans_tick_tock', is_tock: is_tock, @@ -6533,8 +6533,8 @@ export function loadTransactionDescr(slice: Slice): TransactionDescr { return loadTrActionPhase(slice1) })); - let aborted: Bool = loadBool(slice); - let destroyed: Bool = loadBool(slice); + let aborted: boolean = slice.loadBoolean(); + let destroyed: boolean = slice.loadBoolean(); return { kind: 'TransactionDescr_trans_split_prepare', split_info: split_info, @@ -6551,7 +6551,7 @@ export function loadTransactionDescr(slice: Slice): TransactionDescr { let split_info: SplitMergeInfo = loadSplitMergeInfo(slice); let slice1 = slice.loadRef().beginParse(); let prepare_transaction: Transaction = loadTransaction(slice1); - let installed: Bool = loadBool(slice); + let installed: boolean = slice.loadBoolean(); return { kind: 'TransactionDescr_trans_split_install', split_info: split_info, @@ -6564,7 +6564,7 @@ export function loadTransactionDescr(slice: Slice): TransactionDescr { slice.loadUint(4); let split_info: SplitMergeInfo = loadSplitMergeInfo(slice); let storage_ph: TrStoragePhase = loadTrStoragePhase(slice); - let aborted: Bool = loadBool(slice); + let aborted: boolean = slice.loadBoolean(); return { kind: 'TransactionDescr_trans_merge_prepare', split_info: split_info, @@ -6586,8 +6586,8 @@ export function loadTransactionDescr(slice: Slice): TransactionDescr { return loadTrActionPhase(slice1) })); - let aborted: Bool = loadBool(slice); - let destroyed: Bool = loadBool(slice); + let aborted: boolean = slice.loadBoolean(); + let destroyed: boolean = slice.loadBoolean(); return { kind: 'TransactionDescr_trans_merge_install', split_info: split_info, @@ -6608,7 +6608,7 @@ export function storeTransactionDescr(transactionDescr: TransactionDescr): (buil if ((transactionDescr.kind == 'TransactionDescr_trans_ord')) { return ((builder: Builder) => { builder.storeUint(0b0000, 4); - storeBool(transactionDescr.credit_first)(builder); + builder.storeBit(transactionDescr.credit_first); storeMaybe(transactionDescr.storage_ph, storeTrStoragePhase)(builder); storeMaybe(transactionDescr.credit_ph, storeTrCreditPhase)(builder); storeTrComputePhase(transactionDescr.compute_ph)(builder); @@ -6621,9 +6621,9 @@ export function storeTransactionDescr(transactionDescr: TransactionDescr): (buil }) }))(builder); - storeBool(transactionDescr.aborted)(builder); + builder.storeBit(transactionDescr.aborted); storeMaybe(transactionDescr.bounce, storeTrBouncePhase)(builder); - storeBool(transactionDescr.destroyed)(builder); + builder.storeBit(transactionDescr.destroyed); }) } @@ -6637,7 +6637,7 @@ export function storeTransactionDescr(transactionDescr: TransactionDescr): (buil if ((transactionDescr.kind == 'TransactionDescr_trans_tick_tock')) { return ((builder: Builder) => { builder.storeUint(0b001, 3); - storeBool(transactionDescr.is_tock)(builder); + builder.storeBit(transactionDescr.is_tock); storeTrStoragePhase(transactionDescr.storage_ph)(builder); storeTrComputePhase(transactionDescr.compute_ph)(builder); storeMaybe(transactionDescr.action, ((arg: TrActionPhase) => { @@ -6649,8 +6649,8 @@ export function storeTransactionDescr(transactionDescr: TransactionDescr): (buil }) }))(builder); - storeBool(transactionDescr.aborted)(builder); - storeBool(transactionDescr.destroyed)(builder); + builder.storeBit(transactionDescr.aborted); + builder.storeBit(transactionDescr.destroyed); }) } @@ -6669,8 +6669,8 @@ export function storeTransactionDescr(transactionDescr: TransactionDescr): (buil }) }))(builder); - storeBool(transactionDescr.aborted)(builder); - storeBool(transactionDescr.destroyed)(builder); + builder.storeBit(transactionDescr.aborted); + builder.storeBit(transactionDescr.destroyed); }) } @@ -6681,7 +6681,7 @@ export function storeTransactionDescr(transactionDescr: TransactionDescr): (buil let cell1 = beginCell(); storeTransaction(transactionDescr.prepare_transaction)(cell1); builder.storeRef(cell1); - storeBool(transactionDescr.installed)(builder); + builder.storeBit(transactionDescr.installed); }) } @@ -6690,7 +6690,7 @@ export function storeTransactionDescr(transactionDescr: TransactionDescr): (buil builder.storeUint(0b0110, 4); storeSplitMergeInfo(transactionDescr.split_info)(builder); storeTrStoragePhase(transactionDescr.storage_ph)(builder); - storeBool(transactionDescr.aborted)(builder); + builder.storeBit(transactionDescr.aborted); }) } @@ -6713,8 +6713,8 @@ export function storeTransactionDescr(transactionDescr: TransactionDescr): (buil }) }))(builder); - storeBool(transactionDescr.aborted)(builder); - storeBool(transactionDescr.destroyed)(builder); + builder.storeBit(transactionDescr.aborted); + builder.storeBit(transactionDescr.destroyed); }) } @@ -7375,9 +7375,9 @@ export function loadBlockInfo(slice: Slice): BlockInfo { let after_merge: number = slice.loadUint(1); let before_split: number = slice.loadUint(1); let after_split: number = slice.loadUint(1); - let want_split: Bool = loadBool(slice); - let want_merge: Bool = loadBool(slice); - let key_block: Bool = loadBool(slice); + let want_split: boolean = slice.loadBoolean(); + let want_merge: boolean = slice.loadBoolean(); + let key_block: boolean = slice.loadBoolean(); let vert_seqno_incr: number = slice.loadUint(1); let flags: number = slice.loadUint(8); let seq_no: number = slice.loadUint(32); @@ -7450,9 +7450,9 @@ export function storeBlockInfo(blockInfo: BlockInfo): (builder: Builder) => void builder.storeUint(blockInfo.after_merge, 1); builder.storeUint(blockInfo.before_split, 1); builder.storeUint(blockInfo.after_split, 1); - storeBool(blockInfo.want_split)(builder); - storeBool(blockInfo.want_merge)(builder); - storeBool(blockInfo.key_block)(builder); + builder.storeBit(blockInfo.want_split); + builder.storeBit(blockInfo.want_merge); + builder.storeBit(blockInfo.key_block); builder.storeUint(blockInfo.vert_seqno_incr, 1); builder.storeUint(blockInfo.flags, 8); builder.storeUint(blockInfo.seq_no, 32); @@ -7948,11 +7948,11 @@ export function loadShardDescr(slice: Slice): ShardDescr { let end_lt: number = slice.loadUint(64); let root_hash: BitString = slice.loadBits(256); let file_hash: BitString = slice.loadBits(256); - let before_split: Bool = loadBool(slice); - let before_merge: Bool = loadBool(slice); - let want_split: Bool = loadBool(slice); - let want_merge: Bool = loadBool(slice); - let nx_cc_updated: Bool = loadBool(slice); + let before_split: boolean = slice.loadBoolean(); + let before_merge: boolean = slice.loadBoolean(); + let want_split: boolean = slice.loadBoolean(); + let want_merge: boolean = slice.loadBoolean(); + let nx_cc_updated: boolean = slice.loadBoolean(); let flags: number = slice.loadUint(3); let next_catchain_seqno: number = slice.loadUint(32); let next_validator_shard: number = slice.loadUint(64); @@ -7996,11 +7996,11 @@ export function loadShardDescr(slice: Slice): ShardDescr { let end_lt: number = slice.loadUint(64); let root_hash: BitString = slice.loadBits(256); let file_hash: BitString = slice.loadBits(256); - let before_split: Bool = loadBool(slice); - let before_merge: Bool = loadBool(slice); - let want_split: Bool = loadBool(slice); - let want_merge: Bool = loadBool(slice); - let nx_cc_updated: Bool = loadBool(slice); + let before_split: boolean = slice.loadBoolean(); + let before_merge: boolean = slice.loadBoolean(); + let want_split: boolean = slice.loadBoolean(); + let want_merge: boolean = slice.loadBoolean(); + let nx_cc_updated: boolean = slice.loadBoolean(); let flags: number = slice.loadUint(3); let next_catchain_seqno: number = slice.loadUint(32); let next_validator_shard: number = slice.loadUint(64); @@ -8050,11 +8050,11 @@ export function storeShardDescr(shardDescr: ShardDescr): (builder: Builder) => v builder.storeUint(shardDescr.end_lt, 64); builder.storeBits(shardDescr.root_hash); builder.storeBits(shardDescr.file_hash); - storeBool(shardDescr.before_split)(builder); - storeBool(shardDescr.before_merge)(builder); - storeBool(shardDescr.want_split)(builder); - storeBool(shardDescr.want_merge)(builder); - storeBool(shardDescr.nx_cc_updated)(builder); + builder.storeBit(shardDescr.before_split); + builder.storeBit(shardDescr.before_merge); + builder.storeBit(shardDescr.want_split); + builder.storeBit(shardDescr.want_merge); + builder.storeBit(shardDescr.nx_cc_updated); builder.storeUint(shardDescr.flags, 3); builder.storeUint(shardDescr.next_catchain_seqno, 32); builder.storeUint(shardDescr.next_validator_shard, 64); @@ -8078,11 +8078,11 @@ export function storeShardDescr(shardDescr: ShardDescr): (builder: Builder) => v builder.storeUint(shardDescr.end_lt, 64); builder.storeBits(shardDescr.root_hash); builder.storeBits(shardDescr.file_hash); - storeBool(shardDescr.before_split)(builder); - storeBool(shardDescr.before_merge)(builder); - storeBool(shardDescr.want_split)(builder); - storeBool(shardDescr.want_merge)(builder); - storeBool(shardDescr.nx_cc_updated)(builder); + builder.storeBit(shardDescr.before_split); + builder.storeBit(shardDescr.before_merge); + builder.storeBit(shardDescr.want_split); + builder.storeBit(shardDescr.want_merge); + builder.storeBit(shardDescr.nx_cc_updated); builder.storeUint(shardDescr.flags, 3); builder.storeUint(shardDescr.next_catchain_seqno, 32); builder.storeUint(shardDescr.next_validator_shard, 64); @@ -8283,7 +8283,7 @@ validator_info$_ export function loadValidatorInfo(slice: Slice): ValidatorInfo { let validator_list_hash_short: number = slice.loadUint(32); let catchain_seqno: number = slice.loadUint(32); - let nx_cc_updated: Bool = loadBool(slice); + let nx_cc_updated: boolean = slice.loadBoolean(); return { kind: 'ValidatorInfo', validator_list_hash_short: validator_list_hash_short, @@ -8297,7 +8297,7 @@ export function storeValidatorInfo(validatorInfo: ValidatorInfo): (builder: Buil return ((builder: Builder) => { builder.storeUint(validatorInfo.validator_list_hash_short, 32); builder.storeUint(validatorInfo.catchain_seqno, 32); - storeBool(validatorInfo.nx_cc_updated)(builder); + builder.storeBit(validatorInfo.nx_cc_updated); }) } @@ -8331,7 +8331,7 @@ export function storeValidatorBaseInfo(validatorBaseInfo: ValidatorBaseInfo): (b // _ key:Bool max_end_lt:uint64 = KeyMaxLt; export function loadKeyMaxLt(slice: Slice): KeyMaxLt { - let key: Bool = loadBool(slice); + let key: boolean = slice.loadBoolean(); let max_end_lt: number = slice.loadUint(64); return { kind: 'KeyMaxLt', @@ -8343,7 +8343,7 @@ export function loadKeyMaxLt(slice: Slice): KeyMaxLt { export function storeKeyMaxLt(keyMaxLt: KeyMaxLt): (builder: Builder) => void { return ((builder: Builder) => { - storeBool(keyMaxLt.key)(builder); + builder.storeBit(keyMaxLt.key); builder.storeUint(keyMaxLt.max_end_lt, 64); }) @@ -8352,7 +8352,7 @@ export function storeKeyMaxLt(keyMaxLt: KeyMaxLt): (builder: Builder) => void { // _ key:Bool blk_ref:ExtBlkRef = KeyExtBlkRef; export function loadKeyExtBlkRef(slice: Slice): KeyExtBlkRef { - let key: Bool = loadBool(slice); + let key: boolean = slice.loadBoolean(); let blk_ref: ExtBlkRef = loadExtBlkRef(slice); return { kind: 'KeyExtBlkRef', @@ -8364,7 +8364,7 @@ export function loadKeyExtBlkRef(slice: Slice): KeyExtBlkRef { export function storeKeyExtBlkRef(keyExtBlkRef: KeyExtBlkRef): (builder: Builder) => void { return ((builder: Builder) => { - storeBool(keyExtBlkRef.key)(builder); + builder.storeBit(keyExtBlkRef.key); storeExtBlkRef(keyExtBlkRef.blk_ref)(builder); }) @@ -8516,7 +8516,7 @@ export function loadMcStateExtra(slice: Slice): McStateExtra { let flags: number = slice1.loadUint(16); let validator_info: ValidatorInfo = loadValidatorInfo(slice1); let prev_blocks: OldMcBlocksInfo = loadOldMcBlocksInfo(slice1); - let after_key_block: Bool = loadBool(slice1); + let after_key_block: boolean = slice1.loadBoolean(); let last_key_block: Maybe = loadMaybe(slice1, loadExtBlkRef); let block_create_stats: BlockCreateStats | undefined = ((flags & (1 << 0)) ? loadBlockCreateStats(slice1) : undefined); let global_balance: CurrencyCollection = loadCurrencyCollection(slice); @@ -8546,7 +8546,7 @@ export function storeMcStateExtra(mcStateExtra: McStateExtra): (builder: Builder cell1.storeUint(mcStateExtra.flags, 16); storeValidatorInfo(mcStateExtra.validator_info)(cell1); storeOldMcBlocksInfo(mcStateExtra.prev_blocks)(cell1); - storeBool(mcStateExtra.after_key_block)(cell1); + cell1.storeBit(mcStateExtra.after_key_block); storeMaybe(mcStateExtra.last_key_block, storeExtBlkRef)(cell1); if ((mcStateExtra.block_create_stats != undefined)) { storeBlockCreateStats(mcStateExtra.block_create_stats)(cell1); @@ -9992,7 +9992,7 @@ export function loadConfigProposalStatus(slice: Slice): ConfigProposalStatus { let expires: number = slice.loadUint(32); let slice1 = slice.loadRef().beginParse(); let proposal: ConfigProposal = loadConfigProposal(slice1); - let is_critical: Bool = loadBool(slice); + let is_critical: boolean = slice.loadBoolean(); let voters: HashmapE = loadHashmapE(slice, 16, loadTrue); let remaining_weight: number = slice.loadInt(64); let validator_set_id: number = slice.loadUint(256); @@ -10023,7 +10023,7 @@ export function storeConfigProposalStatus(configProposalStatus: ConfigProposalSt let cell1 = beginCell(); storeConfigProposal(configProposalStatus.proposal)(cell1); builder.storeRef(cell1); - storeBool(configProposalStatus.is_critical)(builder); + builder.storeBit(configProposalStatus.is_critical); storeHashmapE(configProposalStatus.voters, storeTrue)(builder); builder.storeInt(configProposalStatus.remaining_weight, 64); builder.storeUint(configProposalStatus.validator_set_id, 256); @@ -10190,8 +10190,8 @@ export function loadWorkchainDescr(slice: Slice): WorkchainDescr { let min_split: number = slice.loadUint(8); let max_split: number = slice.loadUint(8); let basic: number = slice.loadUint(1); - let active: Bool = loadBool(slice); - let accept_msgs: Bool = loadBool(slice); + let active: boolean = slice.loadBoolean(); + let accept_msgs: boolean = slice.loadBoolean(); let flags: number = slice.loadUint(13); let zerostate_root_hash: BitString = slice.loadBits(256); let zerostate_file_hash: BitString = slice.loadBits(256); @@ -10227,8 +10227,8 @@ export function loadWorkchainDescr(slice: Slice): WorkchainDescr { let min_split: number = slice.loadUint(8); let max_split: number = slice.loadUint(8); let basic: number = slice.loadUint(1); - let active: Bool = loadBool(slice); - let accept_msgs: Bool = loadBool(slice); + let active: boolean = slice.loadBoolean(); + let accept_msgs: boolean = slice.loadBoolean(); let flags: number = slice.loadUint(13); let zerostate_root_hash: BitString = slice.loadBits(256); let zerostate_file_hash: BitString = slice.loadBits(256); @@ -10271,8 +10271,8 @@ export function storeWorkchainDescr(workchainDescr: WorkchainDescr): (builder: B builder.storeUint(workchainDescr.min_split, 8); builder.storeUint(workchainDescr.max_split, 8); builder.storeUint(workchainDescr.basic, 1); - storeBool(workchainDescr.active)(builder); - storeBool(workchainDescr.accept_msgs)(builder); + builder.storeBit(workchainDescr.active); + builder.storeBit(workchainDescr.accept_msgs); builder.storeUint(workchainDescr.flags, 13); builder.storeBits(workchainDescr.zerostate_root_hash); builder.storeBits(workchainDescr.zerostate_file_hash); @@ -10295,8 +10295,8 @@ export function storeWorkchainDescr(workchainDescr: WorkchainDescr): (builder: B builder.storeUint(workchainDescr.min_split, 8); builder.storeUint(workchainDescr.max_split, 8); builder.storeUint(workchainDescr.basic, 1); - storeBool(workchainDescr.active)(builder); - storeBool(workchainDescr.accept_msgs)(builder); + builder.storeBit(workchainDescr.active); + builder.storeBit(workchainDescr.accept_msgs); builder.storeUint(workchainDescr.flags, 13); builder.storeBits(workchainDescr.zerostate_root_hash); builder.storeBits(workchainDescr.zerostate_file_hash); @@ -10670,7 +10670,7 @@ export function loadCatchainConfig(slice: Slice): CatchainConfig { if (((slice.remainingBits >= 8) && (slice.preloadUint(8) == 0xc2))) { slice.loadUint(8); let flags: number = slice.loadUint(7); - let shuffle_mc_validators: Bool = loadBool(slice); + let shuffle_mc_validators: boolean = slice.loadBoolean(); let mc_catchain_lifetime: number = slice.loadUint(32); let shard_catchain_lifetime: number = slice.loadUint(32); let shard_validators_lifetime: number = slice.loadUint(32); @@ -10707,7 +10707,7 @@ export function storeCatchainConfig(catchainConfig: CatchainConfig): (builder: B return ((builder: Builder) => { builder.storeUint(0xc2, 8); builder.storeUint(catchainConfig.flags, 7); - storeBool(catchainConfig.shuffle_mc_validators)(builder); + builder.storeBit(catchainConfig.shuffle_mc_validators); builder.storeUint(catchainConfig.mc_catchain_lifetime, 32); builder.storeUint(catchainConfig.shard_catchain_lifetime, 32); builder.storeUint(catchainConfig.shard_validators_lifetime, 32); @@ -10784,7 +10784,7 @@ export function loadConsensusConfig(slice: Slice): ConsensusConfig { if (((slice.remainingBits >= 8) && (slice.preloadUint(8) == 0xd7))) { slice.loadUint(8); let flags: number = slice.loadUint(7); - let new_catchain_ids: Bool = loadBool(slice); + let new_catchain_ids: boolean = slice.loadBoolean(); let round_candidates: number = slice.loadUint(8); let next_candidate_delay_ms: number = slice.loadUint(32); let consensus_timeout_ms: number = slice.loadUint(32); @@ -10817,7 +10817,7 @@ export function loadConsensusConfig(slice: Slice): ConsensusConfig { if (((slice.remainingBits >= 8) && (slice.preloadUint(8) == 0xd8))) { slice.loadUint(8); let flags: number = slice.loadUint(7); - let new_catchain_ids: Bool = loadBool(slice); + let new_catchain_ids: boolean = slice.loadBoolean(); let round_candidates: number = slice.loadUint(8); let next_candidate_delay_ms: number = slice.loadUint(32); let consensus_timeout_ms: number = slice.loadUint(32); @@ -10852,7 +10852,7 @@ export function loadConsensusConfig(slice: Slice): ConsensusConfig { if (((slice.remainingBits >= 8) && (slice.preloadUint(8) == 0xd9))) { slice.loadUint(8); let flags: number = slice.loadUint(7); - let new_catchain_ids: Bool = loadBool(slice); + let new_catchain_ids: boolean = slice.loadBoolean(); let round_candidates: number = slice.loadUint(8); let next_candidate_delay_ms: number = slice.loadUint(32); let consensus_timeout_ms: number = slice.loadUint(32); @@ -10911,7 +10911,7 @@ export function storeConsensusConfig(consensusConfig: ConsensusConfig): (builder return ((builder: Builder) => { builder.storeUint(0xd7, 8); builder.storeUint(consensusConfig.flags, 7); - storeBool(consensusConfig.new_catchain_ids)(builder); + builder.storeBit(consensusConfig.new_catchain_ids); builder.storeUint(consensusConfig.round_candidates, 8); builder.storeUint(consensusConfig.next_candidate_delay_ms, 32); builder.storeUint(consensusConfig.consensus_timeout_ms, 32); @@ -10933,7 +10933,7 @@ export function storeConsensusConfig(consensusConfig: ConsensusConfig): (builder return ((builder: Builder) => { builder.storeUint(0xd8, 8); builder.storeUint(consensusConfig.flags, 7); - storeBool(consensusConfig.new_catchain_ids)(builder); + builder.storeBit(consensusConfig.new_catchain_ids); builder.storeUint(consensusConfig.round_candidates, 8); builder.storeUint(consensusConfig.next_candidate_delay_ms, 32); builder.storeUint(consensusConfig.consensus_timeout_ms, 32); @@ -10956,7 +10956,7 @@ export function storeConsensusConfig(consensusConfig: ConsensusConfig): (builder return ((builder: Builder) => { builder.storeUint(0xd9, 8); builder.storeUint(consensusConfig.flags, 7); - storeBool(consensusConfig.new_catchain_ids)(builder); + builder.storeBit(consensusConfig.new_catchain_ids); builder.storeUint(consensusConfig.round_candidates, 8); builder.storeUint(consensusConfig.next_candidate_delay_ms, 32); builder.storeUint(consensusConfig.consensus_timeout_ms, 32); @@ -13088,8 +13088,8 @@ export function storeChanConfig(chanConfig: ChanConfig): (builder: Builder) => v export function loadChanState(slice: Slice): ChanState { if (((slice.remainingBits >= 3) && (slice.preloadUint(3) == 0b000))) { slice.loadUint(3); - let signed_A: Bool = loadBool(slice); - let signed_B: Bool = loadBool(slice); + let signed_A: boolean = slice.loadBoolean(); + let signed_B: boolean = slice.loadBoolean(); let min_A: Grams = loadGrams(slice); let min_B: Grams = loadGrams(slice); let expire_at: number = slice.loadUint(32); @@ -13109,8 +13109,8 @@ export function loadChanState(slice: Slice): ChanState { } if (((slice.remainingBits >= 3) && (slice.preloadUint(3) == 0b001))) { slice.loadUint(3); - let signed_A: Bool = loadBool(slice); - let signed_B: Bool = loadBool(slice); + let signed_A: boolean = slice.loadBoolean(); + let signed_B: boolean = slice.loadBoolean(); let promise_A: Grams = loadGrams(slice); let promise_B: Grams = loadGrams(slice); let expire_at: number = slice.loadUint(32); @@ -13146,8 +13146,8 @@ export function storeChanState(chanState: ChanState): (builder: Builder) => void if ((chanState.kind == 'ChanState_chan_state_init')) { return ((builder: Builder) => { builder.storeUint(0b000, 3); - storeBool(chanState.signed_A)(builder); - storeBool(chanState.signed_B)(builder); + builder.storeBit(chanState.signed_A); + builder.storeBit(chanState.signed_B); storeGrams(chanState.min_A)(builder); storeGrams(chanState.min_B)(builder); builder.storeUint(chanState.expire_at, 32); @@ -13159,8 +13159,8 @@ export function storeChanState(chanState: ChanState): (builder: Builder) => void if ((chanState.kind == 'ChanState_chan_state_close')) { return ((builder: Builder) => { builder.storeUint(0b001, 3); - storeBool(chanState.signed_A)(builder); - storeBool(chanState.signed_B)(builder); + builder.storeBit(chanState.signed_A); + builder.storeBit(chanState.signed_B); storeGrams(chanState.promise_A)(builder); storeGrams(chanState.promise_B)(builder); builder.storeUint(chanState.expire_at, 32); diff --git a/generated_test.ts b/generated_test.ts index e7a9b46..7cbdeb6 100644 --- a/generated_test.ts +++ b/generated_test.ts @@ -478,6 +478,21 @@ export interface RefCombinatorInRef { readonly msg: RefCombinatorInRefHelper; } +export type Bool = Bool_bool_false | Bool_bool_true; + +export interface Bool_bool_false { + readonly kind: 'Bool_bool_false'; +} + +export interface Bool_bool_true { + readonly kind: 'Bool_bool_true'; +} + +export interface BoolUser { + readonly kind: 'BoolUser'; + readonly a: boolean; +} + export function bitLen(n: number) { return n.toString(2).length;; } @@ -2473,3 +2488,59 @@ export function storeRefCombinatorInRef(refCombinatorInRef: RefCombinatorInRef): } +// bool_false$0 = Bool; + +// bool_true$1 = Bool; + +export function loadBool(slice: Slice): Bool { + if (((slice.remainingBits >= 1) && (slice.preloadUint(1) == 0b0))) { + slice.loadUint(1); + return { + kind: 'Bool_bool_false', + } + + } + if (((slice.remainingBits >= 1) && (slice.preloadUint(1) == 0b1))) { + slice.loadUint(1); + return { + kind: 'Bool_bool_true', + } + + } + throw new Error('Expected one of "Bool_bool_false", "Bool_bool_true" in loading "Bool", but data does not satisfy any constructor'); +} + +export function storeBool(bool: Bool): (builder: Builder) => void { + if ((bool.kind == 'Bool_bool_false')) { + return ((builder: Builder) => { + builder.storeUint(0b0, 1); + }) + + } + if ((bool.kind == 'Bool_bool_true')) { + return ((builder: Builder) => { + builder.storeUint(0b1, 1); + }) + + } + throw new Error('Expected one of "Bool_bool_false", "Bool_bool_true" in loading "Bool", but data does not satisfy any constructor'); +} + +// _ a:Bool = BoolUser; + +export function loadBoolUser(slice: Slice): BoolUser { + let a: boolean = slice.loadBoolean(); + return { + kind: 'BoolUser', + a: a, + } + +} + +export function storeBoolUser(boolUser: BoolUser): (builder: Builder) => void { + return ((builder: Builder) => { + builder.storeBit(boolUser.a); + }) + +} + diff --git a/src/codegen/combinator.ts b/src/codegen/combinator.ts index 22765a3..38eed51 100644 --- a/src/codegen/combinator.ts +++ b/src/codegen/combinator.ts @@ -16,8 +16,8 @@ type FieldInfoType = { } type ExprForParam = { - argLoadExpr: Expression - argStoreExpr: Expression + argLoadExpr: Expression | undefined + argStoreExpr: Expression | undefined paramType: string fieldLoadSuffix: string fieldStoreSuffix: string @@ -161,8 +161,8 @@ export function handleCombinator(expr: ParserExpression, fieldName: string, isFi exprForParam = {argLoadExpr: tNumericLiteral(theNum), argStoreExpr: tNumericLiteral(theNum), paramType: 'number', fieldLoadSuffix: 'Uint', fieldStoreSuffix: 'Uint'} } else if ((theNum = splitForTypeValue(expr.name, 'bits')) != undefined) { exprForParam = {argLoadExpr: tNumericLiteral(theNum), argStoreExpr: tNumericLiteral(theNum), paramType: 'BitString', fieldLoadSuffix: 'Bits', fieldStoreSuffix: 'Bits'} - // } else if (expr.name == 'Bool') { - // exprForParam = {argLoadExpr: tIdentifier(''), argStoreExpr: tIdentifier(''), paramType: 'boolean', fieldLoadStoreSuffix: 'Boolean'} + } else if (expr.name == 'Bool') { + exprForParam = {argLoadExpr: undefined, argStoreExpr: undefined, paramType: 'boolean', fieldLoadSuffix: 'Boolean', fieldStoreSuffix: 'Bit'} } else { if (constructor.variablesMap.get(expr.name)?.type == '#') { result.loadExpr = getVarExprByName(expr.name, constructor) @@ -268,10 +268,12 @@ export function handleCombinator(expr: ParserExpression, fieldName: string, isFi } if (exprForParam) { if (exprForParam.paramType != 'BitString' && exprForParam.paramType != 'Slice') { - insideStoreParameters.push(exprForParam.argStoreExpr); - insideStoreParameters2.push(exprForParam.argStoreExpr); + if (exprForParam.argStoreExpr) { + insideStoreParameters.push(exprForParam.argStoreExpr); + insideStoreParameters2.push(exprForParam.argStoreExpr); + } } - result.loadExpr = tFunctionCall(tMemberExpression(tIdentifier(currentSlice), tIdentifier('load' + exprForParam.fieldLoadSuffix)), [exprForParam.argLoadExpr]); + result.loadExpr = tFunctionCall(tMemberExpression(tIdentifier(currentSlice), tIdentifier('load' + exprForParam.fieldLoadSuffix)), (exprForParam.argLoadExpr ? [exprForParam.argLoadExpr] : [])); if (exprForParam.paramType == 'Slice') { result.loadExpr = tIdentifier(currentSlice) result.loadFunctionExpr = tArrowFunctionExpression([tTypedIdentifier(tIdentifier('slice'), tIdentifier('Slice'))], [tReturnStatement(tIdentifier('slice'))]) diff --git a/tests/fixtures/tlb/test.tlb b/tests/fixtures/tlb/test.tlb index be2e546..b39f568 100644 --- a/tests/fixtures/tlb/test.tlb +++ b/tests/fixtures/tlb/test.tlb @@ -125,7 +125,7 @@ a$_ const:# = CheckKeyword; a$_ {X:Type} t:# y:(Maybe ^X) = RefCombinatorInRefHelper X; a$_ msg:^(RefCombinatorInRefHelper Any) = RefCombinatorInRef; -//bool_false$0 = Bool; -//bool_true$1 = Bool; +bool_false$0 = Bool; +bool_true$1 = Bool; -//_ a:Bool = BoolUser; \ No newline at end of file +_ a:Bool = BoolUser; \ No newline at end of file diff --git a/tests/tlbgen.spec.ts b/tests/tlbgen.spec.ts index 96ade9c..7ed94f8 100644 --- a/tests/tlbgen.spec.ts +++ b/tests/tlbgen.spec.ts @@ -8,9 +8,9 @@ import { generate } from '../src/codegen/main' import { Program } from '../src/ast/nodes' import { BitString, Slice, Builder, Cell } from 'ton' -import { TwoConstructors, Simple, loadTwoConstructors, loadSimple, storeTwoConstructors, storeSimple, TypedParam, loadTypedParam, storeTypedParam, TypedField, loadTypedField, storeTypedField, ExprArg, BitLenArg, loadBitLenArg, storeBitLenArg, BitLenArgUser, loadBitLenArgUser, storeBitLenArgUser, ExprArgUser, loadExprArgUser, storeExprArgUser, ComplexTypedField, loadComplexTypedField, storeComplexTypedField, CellTypedField, storeCellTypedField, loadCellTypedField, CellsSimple, loadCellsSimple, storeCellsSimple, IntBitsOutside, loadIntBitsOutside, storeIntBitsOutside, IntBitsParametrizedOutside, loadIntBitsParametrizedOutside, storeIntBitsParametrizedOutside, LessThan, loadLessThan, storeLessThan, Unary, loadUnary, storeUnary, ParamConst, loadParamConst, storeParamConst, ParamDifNames, loadParamDifNames, storeParamDifNames, NegationFromImplicit, loadNegationFromImplicit, storeNegationFromImplicit, loadManyComb, storeManyComb, ManyComb, ParamDifNamesUser, loadParamDifNamesUser, storeParamDifNamesUser, UnaryUserCheckOrder, loadUnaryUserCheckOrder, storeUnaryUserCheckOrder, CombArgCellRef, loadCombArgCellRef, storeCombArgCellRef, CombArgCellRefUser, loadCombArgCellRefUser, storeCombArgCellRefUser, MathExprAsCombArg, loadMathExprAsCombArg, storeMathExprAsCombArg, SharpConstructor, loadSharpConstructor, storeSharpConstructor, EmptyTag, loadEmptyTag, storeEmptyTag, SharpTag, loadSharpTag, storeSharpTag, DollarTag, loadDollarTag, storeDollarTag, TupleCheck, loadTupleCheck, storeTupleCheck, HashmapE, loadHashmapE, storeHashmapE, HashmapEUser, loadHashmapEUser, storeHashmapEUser, ConditionalField, loadConditionalField, storeConditionalField, BitSelection, loadBitSelection, storeBitSelection, ImplicitCondition, loadImplicitCondition, storeImplicitCondition, MultipleEmptyConstructor, loadMultipleEmptyConstructor, storeMultipleEmptyConstructor, True, loadTrue, storeTrue, ParamNamedArgInSecondConstr, loadParamNamedArgInSecondConstr, storeParamNamedArgInSecondConstr, RefCombinatorAny, loadRefCombinatorAny, storeRefCombinatorAny, EqualityExpression, loadEqualityExpression, storeEqualityExpression, ConditionalRef, loadConditionalRef, storeConditionalRef, LoadFromNegationOutsideExpr, loadLoadFromNegationOutsideExpr, storeLoadFromNegationOutsideExpr, AnonymousData, loadAnonymousData, storeAnonymousData, FalseAnonField, loadFalseAnonField, storeFalseAnonField, ConstructorOrder, loadConstructorOrder, storeConstructorOrder, CheckCrc32, loadCheckCrc32, storeCheckCrc32, CheckKeyword, loadCheckKeyword, storeCheckKeyword, RefCombinatorInRef, loadRefCombinatorInRef, storeRefCombinatorInRef} from '../generated_test' +import { TwoConstructors, Simple, loadTwoConstructors, loadSimple, storeTwoConstructors, storeSimple, TypedParam, loadTypedParam, storeTypedParam, TypedField, loadTypedField, storeTypedField, ExprArg, BitLenArg, loadBitLenArg, storeBitLenArg, BitLenArgUser, loadBitLenArgUser, storeBitLenArgUser, ExprArgUser, loadExprArgUser, storeExprArgUser, ComplexTypedField, loadComplexTypedField, storeComplexTypedField, CellTypedField, storeCellTypedField, loadCellTypedField, CellsSimple, loadCellsSimple, storeCellsSimple, IntBitsOutside, loadIntBitsOutside, storeIntBitsOutside, IntBitsParametrizedOutside, loadIntBitsParametrizedOutside, storeIntBitsParametrizedOutside, LessThan, loadLessThan, storeLessThan, Unary, loadUnary, storeUnary, ParamConst, loadParamConst, storeParamConst, ParamDifNames, loadParamDifNames, storeParamDifNames, NegationFromImplicit, loadNegationFromImplicit, storeNegationFromImplicit, loadManyComb, storeManyComb, ManyComb, ParamDifNamesUser, loadParamDifNamesUser, storeParamDifNamesUser, UnaryUserCheckOrder, loadUnaryUserCheckOrder, storeUnaryUserCheckOrder, CombArgCellRef, loadCombArgCellRef, storeCombArgCellRef, CombArgCellRefUser, loadCombArgCellRefUser, storeCombArgCellRefUser, MathExprAsCombArg, loadMathExprAsCombArg, storeMathExprAsCombArg, SharpConstructor, loadSharpConstructor, storeSharpConstructor, EmptyTag, loadEmptyTag, storeEmptyTag, SharpTag, loadSharpTag, storeSharpTag, DollarTag, loadDollarTag, storeDollarTag, TupleCheck, loadTupleCheck, storeTupleCheck, HashmapE, loadHashmapE, storeHashmapE, HashmapEUser, loadHashmapEUser, storeHashmapEUser, ConditionalField, loadConditionalField, storeConditionalField, BitSelection, loadBitSelection, storeBitSelection, ImplicitCondition, loadImplicitCondition, storeImplicitCondition, MultipleEmptyConstructor, loadMultipleEmptyConstructor, storeMultipleEmptyConstructor, True, loadTrue, storeTrue, ParamNamedArgInSecondConstr, loadParamNamedArgInSecondConstr, storeParamNamedArgInSecondConstr, RefCombinatorAny, loadRefCombinatorAny, storeRefCombinatorAny, EqualityExpression, loadEqualityExpression, storeEqualityExpression, ConditionalRef, loadConditionalRef, storeConditionalRef, LoadFromNegationOutsideExpr, loadLoadFromNegationOutsideExpr, storeLoadFromNegationOutsideExpr, AnonymousData, loadAnonymousData, storeAnonymousData, FalseAnonField, loadFalseAnonField, storeFalseAnonField, ConstructorOrder, loadConstructorOrder, storeConstructorOrder, CheckCrc32, loadCheckCrc32, storeCheckCrc32, CheckKeyword, loadCheckKeyword, storeCheckKeyword, RefCombinatorInRef, loadRefCombinatorInRef, storeRefCombinatorInRef, BoolUser, loadBoolUser, storeBoolUser} from '../generated_test' import { beginCell } from 'ton' -import { loadBit, loadBlock, storeBlock } from '../generated_block' +import { loadBit, loadBlock, storeBlock, storeBool } from '../generated_block' const fixturesDir = path.resolve(__dirname, 'fixtures') @@ -146,6 +146,15 @@ describe('Generating tlb code', () => { checkSameOnStoreLoad(checkBigInt, (slice: Slice) => {return loadBitLenArg(slice, checkBigInt.x)}, storeBitLenArg) }) + test('Primitives', () => { + expect.hasAssertions() + + let boolUserTrue: BoolUser = {kind: 'BoolUser', a: true} + checkSameOnStoreLoad(boolUserTrue, loadBoolUser, storeBoolUser); + let boolUserFalse: BoolUser = {kind: 'BoolUser', a: false} + checkSameOnStoreLoad(boolUserFalse, loadBoolUser, storeBoolUser); + }) + test('Combinators', () => { expect.hasAssertions() let manyComb: ManyComb = {kind: 'ManyComb', y: {kind: 'OneComb', t: 5, x: {kind: 'OneComb', t: 6, x: {kind: 'OneComb', t: 7, x: 3}}}};