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

Generate Builder Pattern for external contract representations #4

Closed
swfsql opened this issue Oct 12, 2021 · 0 comments
Closed

Generate Builder Pattern for external contract representations #4

swfsql opened this issue Oct 12, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@swfsql
Copy link

swfsql commented Oct 12, 2021

There are some discussions related to this, such as:

External Contract's methods can be represented by a builder, something like:

_impl::Request::contract("my.contract".parse().unwrap())
        .args(String::from("my_value"))
        .send_amount(0)
        .prepaid_gas(Gas::from(SINGLE_CALL_GAS))
        .request();

Or a current code example.

They must be able to be built client-side, such as from the trait definitions as it is today. For when the client has access into the external contract's src code, this builder can be generated by the external contract's src code itself, so the client would only need to import and then use the builder.

For builders prepared on specific impls, they can take advantage of the payable, or maybe gas = x attributes to eg. actually refrain from implementing payment option, or make a attached gas check to early panic (instead of making a call and then it panicking on the server contract)

Another related feature is to have a generic external contract call while also having a builder-pattern structure. This is mostly implemented in here (outdated) but it could use more design iteration.

@swfsql swfsql added the enhancement New feature or request label Oct 12, 2021
@swfsql swfsql self-assigned this Oct 22, 2021
@swfsql swfsql closed this as completed in 072fc85 Oct 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant