You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The JavaScript renderer currently renders the following fields and types given a program:
exportconstPASS_PROGRAM_ADDRESS='nabZn3LTGJpknPtSDiqLXZq98VwfYVicy6zDfPu82Cs'asAddress<'nabZn3LTGJpknPtSDiqLXZq98VwfYVicy6zDfPu82Cs'>;exportenumPassInstruction{CreatePass,UpdatePass,MintPass,MintPass2,}exportfunctionidentifyPassInstruction(instruction: {data: Uint8Array}|Uint8Array): PassInstruction{constdata=instructioninstanceofUint8Array ? instruction : instruction.data;if(containsBytes(data,getU8Encoder().encode(0),0)){returnPassInstruction.CreatePass;}if(containsBytes(data,getU8Encoder().encode(1),1)){returnPassInstruction.UpdatePass;}if(containsBytes(data,getU8Encoder().encode(2),2)){returnPassInstruction.MintPass;}if(containsBytes(data,getU8Encoder().encode(3),3)){returnPassInstruction.MintPass2;}thrownewError('The provided instruction could not be identified as a pass instruction.');}exporttypeParsedPassInstruction<TProgramextendsstring='nabZn3LTGJpknPtSDiqLXZq98VwfYVicy6zDfPu82Cs',>=|({instructionType: PassInstruction.CreatePass;}&ParsedCreatePassInstruction<TProgram>)|({instructionType: PassInstruction.UpdatePass;}&ParsedUpdatePassInstruction<TProgram>)|({instructionType: PassInstruction.MintPass;}&ParsedMintPassInstruction<TProgram>)|({instructionType: PassInstruction.MintPass2;}&ParsedMintPass2Instruction<TProgram>);
It would be useful to additionally generate a generic instruction codec to decode/encode any of the programs instructions which may work on top of identifyInstruction.
The text was updated successfully, but these errors were encountered:
That's a great feature request, thanks! What do you think about generating a parseMyProgramInstruction helper that identifies the instruction first and then switch/cases into the appropriate parse function for that particular instruction? This would only fill the "decode" aspect of the requested codec but would be more idiomatic to the way things are currently generated.
The JavaScript renderer currently renders the following fields and types given a program:
It would be useful to additionally generate a generic instruction codec to decode/encode any of the programs instructions which may work on top of
identifyInstruction
.The text was updated successfully, but these errors were encountered: