tact-lang / tact

Tact compiler main repository
https://tact-lang.org
MIT License
395 stars 111 forks source link

Enum "Opcodes" and "Errors" are possibly missing in generated .ts file #1033

Open Shvandre opened 1 week ago

Shvandre commented 1 week ago

When writing sandbox test it is very convenient to check if transaction with exact op was completed (or aborted with exact exit_code). Adding this will definitely make writing tests more convenient. Some example of possible syntax:

export abstract class Op {
    static transfer = 0xf8a7ea5;
    static transfer_notification = 0x7362d09c;
    static internal_transfer = 0x178d4519;
    static excesses = 0xd53276db;
    static burn = 0x595f07bc;
    static burn_notification = 0x7bdd97de;

    static provide_wallet_address = 0x2c76b973;
    static take_wallet_address = 0xd1735400;
    static mint = 21;
    static change_admin = 3;
    static change_content = 4;
}

export abstract class Errors {
    static invalid_op = 709;
    static not_admin  = 73;
    static unouthorized_burn = 74;
    static discovery_fee_not_matched = 75;
    static wrong_op = 0xffff;
    static not_owner = 705;
    static not_enough_ton = 709;
    static not_enough_gas = 707;
    static not_valid_wallet = 707;
    static wrong_workchain = 333;
    static balance_error   = 706;
}
Gusarich commented 1 week ago

yeah it makes sense. even though we have all these values in ts wrapper already, they're defined in a not very useful way for devs

anton-trunov commented 1 week ago

@Gusarich @Shvandre would one of you self-assign for this issue?