Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Shvandre opened this issue Nov 12, 2024 · 3 comments
Open
Assignees
Labels
scope: ts-wrappers Implementation of TypeScript wrappers generation for Sandbox tests (src/bindings)
Milestone

Comments

@Shvandre
Copy link
Contributor

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;
}
@Shvandre Shvandre added enhancement scope: codegen Code generation, a.k.a. compiler backend (src/generator) labels Nov 12, 2024
@Gusarich
Copy link
Member

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 anton-trunov added this to the v1.6.0 milestone Nov 18, 2024
@anton-trunov anton-trunov added scope: ts-wrappers Implementation of TypeScript wrappers generation for Sandbox tests (src/bindings) and removed scope: codegen Code generation, a.k.a. compiler backend (src/generator) labels Nov 18, 2024
@anton-trunov
Copy link
Member

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

@verytactical
Copy link
Contributor

This one would take a bit more effort than initially expected.

The code we generate doesn't type that well as classes, not to mention problems created by Blockchain#openContract.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: ts-wrappers Implementation of TypeScript wrappers generation for Sandbox tests (src/bindings)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants