near / nearcore

Reference client for NEAR Protocol
https://near.org
GNU General Public License v3.0
2.33k stars 629 forks source link

[feature request] generate contract ABI on contract compilation #5166

Open RoyTimes opened 3 years ago

RoyTimes commented 3 years ago

I noticed that there is no contract ABI generator for the SDKs. If this is an intentional decision, I wonder why.

If not, I guess the following high-level structure would be helpful for developers, just a very rough draft:

 chain metadata version: version string
 source: 

 { hash: a chain storage key? - where the wasm blob is stored compiler info.... sdk info... } 

contract: {
 name/account: contract name/contract account id(xxx.near)?
 version: contract version
 author: 

 {Alice <alice@example.com>} 

}
 func: {
 "method selector like 0x17ff6720" : 

 { mutate states? or view func, constructor? bool, payables? bool, name? for SDKs/clients, // now on func parameters & return types args w/borsh types, returnType?, } 

}
 storage: {} // maybe it's a good idea to give info on storage items in the contract 
 types: {} // if the contract has some customized types 
 // - define how they are supposed to be serialize or deserialize with borsh 
bowenwang1996 commented 3 years ago

Feel free to read about the history here https://github.com/near/NEPs/pull/3

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity in the last 2 months. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.