This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async readOnly(instruction: TransactionInstruction, instructionName: string): Promise<{ value: any }> { | |
// Filter through your IDL to get the actual read instruction schema and return type | |
const ixx = IDL.instructions.find((i) => i.name == instructionName); | |
// This checks if the instruction contains Mutable account, if it does, then it isn't a read only instruction | |
const isMut = ixx && [...ixx.accounts].find((a: any) => a.isMut); | |
const returnType = ixx && (ixx as any).returns; | |
if (isMut || !returnType) return { value: null }; // basically return null value if ix is mutable or it doesn't contain a return type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
print(''' | |
This Code was created by Isaac Frank.. | |
You can contact him on:: | |
=============================================== | |
Facebook: http://facebook.com/zikyfranky | |
=============================================== | |
Twitter: http//twitter.com/zikyfranky | |
=============================================== |