Open lorisleiva opened 3 months ago
It would be useful to have visitors such as addAccountsVisitor, addInstructionsVisitor, addDefinedTypesVisitor, addErrorsVisitor, etc.
addAccountsVisitor
addInstructionsVisitor
addDefinedTypesVisitor
addErrorsVisitor
By default these visitors would add the provided nodes to the main program of the RootNode.
program
RootNode
// Example. codama.update( addDefinedTypesVisitor([ definedTypeNode({ name: 'slot', type: numberTypeNode('u64') }), definedTypeNode({ name: 'hash', type: publicKeyTypeNode() }) ]) );
However, we could also support an additional signature that would look for the correct ProgramNode using the provided program name.
ProgramNode
// Example. codama.update( addDefinedTypesVisitor('someAdditionalProgram', [ definedTypeNode({ name: 'slot', type: numberTypeNode('u64') }), definedTypeNode({ name: 'hash', type: publicKeyTypeNode() }) ]) );
It would be useful to have visitors such as
addAccountsVisitor
,addInstructionsVisitor
,addDefinedTypesVisitor
,addErrorsVisitor
, etc.By default these visitors would add the provided nodes to the main
program
of theRootNode
.However, we could also support an additional signature that would look for the correct
ProgramNode
using the provided program name.