wharfkit / antelope

Core types, client interfaces, and other tools for working with Antelope-based blockchains.
Other
42 stars 23 forks source link

Caching ABI in Action for future use #69

Closed aaroncox closed 10 months ago

aaroncox commented 11 months ago

This is an idea to help the contract kit send transactions to the session kit...

The problem right now with the contract kit, when performing transactions, is you need to manually specify and pass in the ABIs to the session.transact call to prevent duplicate calls to retrieve the ABI.

The idea was that in situations where we have the ABI or a Struct, we can embed that into the Action class, which is what's passed into session.transact. If an ABI existed someplace like action.abi, then the Session Kit during the transct call would be able to do something like:

actions.forEach(action => {
  if (actions.abi) {
    // add ABI to ABI Cache
  }
})

Which would then prevent the session kit from needing to go out and fetch the ABI (since it's in the action already).

It's basically a trojan horse to pass along the ABI inside of the Action, for processes upstream that might be interacting with that Action.

This is probably a bad implementation, but it works, and submitted this as a draft to express the idea.

aaroncox commented 11 months ago

This is related to: https://github.com/wharfkit/contract/pull/29

The PR on the contract kit shows how we have to currently pass in the ABI to the transact call.