-
Notifications
You must be signed in to change notification settings - Fork 68
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
JS SDK Should Auto-Convert camelCase to snake_case for Function Names #136
Comments
This issue was created to start the conversation, topic merits a broader discussion! |
In my humble opinion, adding an auto-convert from camelCase to snake_case will add an extra layer of complexity in near-sdk-js. Because of this, I think we should not add it. However, I do agree that we should standardize always using snake_case in all our examples, and be clear with the community on why we recommend doing so. |
I suggest the compiler to wasm to emit a warning, and not do auto-conversions. |
After additional discussions, we came up with a decision on this:
We should be clear about why we are using |
I've created this issue to mention |
Mentioned in docs now: near/docs#1290 |
Introduction
During last DevRel working session, Benji pointed out that the names inconsistencies between JS and Rust for functions will lead to inconsistent naming for logic that is performed on chain.
e.g.:
nft_mint
for a Rust contract vs.nftMint
for a JS contractProblem
dApps that listen to data on-chain searching for specific function names will miss data. Some dApps might be built foundationally on the assumption of this being consistent.
Solution
JS SDK auto-converts naming for view and call methods from camelCase or whatever case to snake_case to keep consistency with existing function naming for the ecosystem.
The text was updated successfully, but these errors were encountered: