Currently, we only use the Codama IDL statically by generating code that can they be used by consumers to interact with the program.
We also need a dynamic version of this such that any app can dynamically interact with a program's components (accounts, instructions, types, errors, etc.) by simply providing it's Codama IDL.
This would be hugely beneficial for apps like explorer that need to access that information on demand.
This package would offer various helper functions that would always accept a Codama IDL first and then any required parameters afterwards.
For instance:
getAccountCodec(rootNode, accountName), getDefinedTypeCodec(rootNode, typeName), getInstructionCodec(rootNode, instructionName), etc.: Returns a web3.js Codec for a given component. Encoder / decoder versions can also be provided.
decodeAccount(rootNode, accountName, rawData), decodeInstruction(rootNode, instructionName, rawData), decodeDefinedType(rootNode, typeName, rawData), etc.: Similar but decodes directly.
identifyAccount(rootNode, rawData), identifyInstruction(rootNode, rawData), etc.: Tells us which components we are dealing with based on its raw data.
Currently, we only use the Codama IDL statically by generating code that can they be used by consumers to interact with the program.
We also need a dynamic version of this such that any app can dynamically interact with a program's components (accounts, instructions, types, errors, etc.) by simply providing it's Codama IDL.
This would be hugely beneficial for apps like explorer that need to access that information on demand.
This package would offer various helper functions that would always accept a Codama IDL first and then any required parameters afterwards.
For instance:
getAccountCodec(rootNode, accountName)
,getDefinedTypeCodec(rootNode, typeName)
,getInstructionCodec(rootNode, instructionName)
, etc.: Returns a web3.jsCodec
for a given component. Encoder / decoder versions can also be provided.decodeAccount(rootNode, accountName, rawData)
,decodeInstruction(rootNode, instructionName, rawData)
,decodeDefinedType(rootNode, typeName, rawData)
, etc.: Similar but decodes directly.identifyAccount(rootNode, rawData)
,identifyInstruction(rootNode, rawData)
, etc.: Tells us which components we are dealing with based on its raw data.