def make_solution(self, condition_dic: Dict[ConditionOpcode, List[ConditionVarPair]]): ret = [] for con_list in condition_dic.values(): for cvp in con_list: if cvp.opcode == ConditionOpcode.CREATE_COIN: ret.append(make_create_coin_condition(cvp.var1, cvp.var2)) if cvp.opcode == ConditionOpcode.AGG_SIG: ret.append(make_assert_aggsig_condition(cvp.var1)) if cvp.opcode == ConditionOpcode.ASSERT_COIN_CONSUMED: ret.append(make_assert_coin_consumed_condition(cvp.var1)) if cvp.opcode == ConditionOpcode.ASSERT_TIME_EXCEEDS: ret.append(make_assert_time_exceeds_condition(cvp.var1)) if cvp.opcode == ConditionOpcode.ASSERT_MY_COIN_ID: ret.append(make_assert_my_coin_id_condition(cvp.var1)) if cvp.opcode == ConditionOpcode.ASSERT_BLOCK_INDEX_EXCEEDS: ret.append( make_assert_block_index_exceeds_condition(cvp.var1)) if cvp.opcode == ConditionOpcode.ASSERT_BLOCK_AGE_EXCEEDS: ret.append( make_assert_block_age_exceeds_condition(cvp.var1)) if cvp.opcode == ConditionOpcode.ASSERT_FEE: ret.append(make_assert_fee_condition(cvp.var1)) return Program.to([puzzle_for_conditions(ret), []])
def make_solution( self, condition_dic: Dict[ConditionOpcode, List[ConditionVarPair]]) -> Program: ret = [] for con_list in condition_dic.values(): for cvp in con_list: if cvp.opcode == ConditionOpcode.CREATE_COIN: ret.append( make_create_coin_condition(cvp.vars[0], cvp.vars[1])) if cvp.opcode == ConditionOpcode.CREATE_ANNOUNCEMENT: ret.append(make_create_announcement(cvp.vars[0])) if cvp.opcode == ConditionOpcode.AGG_SIG: ret.append(make_assert_aggsig_condition(cvp.vars[0])) if cvp.opcode == ConditionOpcode.ASSERT_ANNOUNCEMENT: ret.append(make_assert_announcement(cvp.vars[0])) if cvp.opcode == ConditionOpcode.ASSERT_TIME_EXCEEDS: ret.append(make_assert_time_exceeds_condition(cvp.vars[0])) if cvp.opcode == ConditionOpcode.ASSERT_MY_COIN_ID: ret.append(make_assert_my_coin_id_condition(cvp.vars[0])) if cvp.opcode == ConditionOpcode.ASSERT_BLOCK_INDEX_EXCEEDS: ret.append( make_assert_block_index_exceeds_condition(cvp.vars[0])) if cvp.opcode == ConditionOpcode.ASSERT_BLOCK_AGE_EXCEEDS: ret.append( make_assert_block_age_exceeds_condition(cvp.vars[0])) if cvp.opcode == ConditionOpcode.ASSERT_FEE: ret.append(make_assert_fee_condition(cvp.vars[0])) return solution_for_conditions(Program.to(ret))
def make_solution( self, primaries: Optional[List[Dict[str, bytes32]]] = None, min_time=0, me=None, announcements=None, announcements_to_consume=None, fee=0, ): assert fee >= 0 condition_list = [] if primaries: for primary in primaries: condition_list.append(make_create_coin_condition(primary["puzzlehash"], primary["amount"])) if min_time > 0: condition_list.append(make_assert_time_exceeds_condition(min_time)) if me: condition_list.append(make_assert_my_coin_id_condition(me["id"])) if fee: condition_list.append(make_assert_fee_condition(fee)) if announcements: for announcement in announcements: condition_list.append(make_create_announcement(announcement)) if announcements_to_consume: for announcement_hash in announcements_to_consume: condition_list.append(make_assert_announcement(announcement_hash)) return solution_for_conditions(condition_list)
def make_solution(self, primaries=None, min_time=0, me=None, consumed=None, fee=0): assert fee >= 0 condition_list = [] if primaries: for primary in primaries: condition_list.append( make_create_coin_condition(primary["puzzlehash"], primary["amount"]) ) if consumed: for coin in consumed: condition_list.append(make_assert_coin_consumed_condition(coin)) if min_time > 0: condition_list.append(make_assert_time_exceeds_condition(min_time)) if me: condition_list.append(make_assert_my_coin_id_condition(me["id"])) if fee: condition_list.append(make_assert_fee_condition(fee)) return solution_for_conditions(condition_list)
def make_solution(self, primaries=None, min_time=0, me=None, consumed=None): condition_list = [] if primaries: for primary in primaries: condition_list.append( make_create_coin_condition(primary["puzzlehash"], primary["amount"])) if consumed: for coin in consumed: condition_list.append( make_assert_coin_consumed_condition(coin)) if min_time > 0: condition_list.append(make_assert_time_exceeds_condition(min_time)) if me: condition_list.append(make_assert_my_coin_id_condition(me["id"])) return clvm.to_sexp_f([puzzle_for_conditions(condition_list), []])