Zilliqa / zilliqa-js

JavaScript SDK for Zilliqa blockchain
https://www.npmjs.com/package/@zilliqa-js/zilliqa
GNU General Public License v3.0
131 stars 74 forks source link

ABI uses "name" instead of "vname" #160

Closed bogdan closed 3 years ago

bogdan commented 5 years ago

The contract info generation now uses vname instead of name for a key name everywhere according to https://github.com/Zilliqa/scilla/pull/313

I get the following format from running scilla-checker -contractinfo <file> https://gist.github.com/ed8c869ee2282ea625f4736605d141ee

Does it require to change name to vname for the ABI and Transition type definitions?

edison0xyz commented 5 years ago

Good catch there! I've fixed the typings for ABI and Transition type definitions. https://github.com/Zilliqa/Zilliqa-JavaScript-Library/commit/0a2d81efe838322a01fb9dcf4bec7156602d9bba

Before I push a new package, this also reminds us that ABI (Application Binary Interface) is not a technically correct, and we might be introducing a new term to name this (which might be Scilla Application Interface (SAI))

Anyway, as an engineer, what we need to make sure is to include the relevant fields under this "SAI". How are you using this ABI feature for now in the Contract class?

CC: @vaivaswatha

bogdan commented 5 years ago

I didn't use the ABI feature yet, but I hoped in can simplify the contract method call because currently in order to call a transition I have to manually specify the arguments types which is unseen suckyness: you (as a contract) know the types of the arguments, their names and order, why do you ask them when you just need values?

So I hope that transition call can be simplified with ABI from:

registry.call(
        'bestow',             
      [ { vname: 'label', type: 'String', value: 'tld' },
      { vname: 'owner',
        type: 'ByStr20',
        value: '0xd90f2e538ce0df89c8273cad3b63ec44a3c4ed82' },
      { vname: 'resolver',
        type: 'ByStr20',
        value: '0xc6e4fa9abb99f2b3919990ba194d273fd3e21ac9' } ],
        txParams,
)

To:

      registry.call(
        'bestow',
        [ 'tld',
          '0x' + address,
          resolver.address,
        }),
        txParams,
      )
edison0xyz commented 5 years ago

I agree that the interface should be used. Currently, scilla-checker gives this info but no one (other than savant IDE) uses it. This is a very good feature request, but might be too big for me to do at the moment.

Will be creating a feature request and keeping track as a separate issue.

neeboo commented 5 years ago

I'm trying to make a abi-coder like ethers.js did, how ever it takes time to consume all the datatypes and data transformation.

I will open source it when it is good to go

edison0xyz commented 5 years ago

@neeboo

As scilla does not have binary, it is not technically correct to call it ABI. We are thinking of a few possible names to rename it, which one do you guys prefer?

neeboo commented 5 years ago

@neeboo

As scilla does not have binary, it is not technically correct to call it ABI. We are thinking of a few possible names to rename it, which one do you guys prefer?

  • SAI: Scilla Application Interface
  • ASI: Application Scilla Interface
  • AII: Application Interaction Interface
  • CII: Contract Interaction Interface

I prefer SAI better.

bogdan commented 5 years ago

All my life time things like that were called Application Programming Interface aka API. I am not sure why you want to be special here: no one really cares whether it is binary or trinary - it is still an API.