Closed thlorenz closed 2 years ago
That's great thank you!
I've got a small question, but I'm happy for you to merge this as-is if you think it's best.
export function createBuyInstruction(
accounts: BuyInstructionAccounts,
args: BuyInstructionArgs,
programId = new web3.PublicKey('hausS13jsjafwWwGqZTUQRmWyvyxn9EQpqMwV1PBBmk')
)
On the 4th line of the above example, wouldn't it make more sense to use the PROGRAM_ID
constant defined in generated/index.ts
?
On the 4th line of the above example, wouldn't it make more sense to use the
PROGRAM_ID
constant defined ingenerated/index.ts
?
I think it's fine to hard code this in generated code instead of depending on the index.ts
much higher up and potentially causing circular imports.
The PROGRAM_ID
exported there is just for user convenience.
Summary
This PR adds the ability for users to do the following:
programId
, if not provided it defaults to theprogramId
provided to solita during code generationtokenProgram
, if not provided it defaults to the keys provided by the respective librariesExample
Auction Houes
buy
instruction serves as a shortened example of what is generated now:Accounts Type
NOTE: that the optional accounts are not included in the comments as overriding them is a hidden feature.
Known Account Resolution
Program ID
NOTE:
programId
is not listed in the docs as overriding it is a hidden feature as well.FIXES: #44