near / near-sdk-js

Tools for building NEAR smart contracts in JavaScript
https://near.github.io/near-sdk-js/
MIT License
192 stars 65 forks source link

Helper class inheritance or code generation to quickly build standard contract #290

Open ailisp opened 1 year ago

waynenilsen commented 1 year ago

Why would codegen be required? We should leverage all the existing features of JS/TS for code composition and not resort to codegen unless absolutely necessary.

Here, i think the Mix-In pattern would work nicely if it can be made possible, naturally some experimentation would be necessary

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#mix-ins

volovyks commented 1 year ago

Now, contract composability is not possible by extension, as proven here: https://github.com/near/near-sdk-js/pull/319 We need to define if this feature is important and if it is - add implementation and examples.

We can consider other options for composability. More info in https://github.com/near/near-sdk-js/pull/319