Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow wrapper program to be passed down from getClientForMarket #155

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions client/ts/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,15 @@ export class ManifestClient {
* @param connection Connection
* @param marketPk PublicKey of the market
* @param payerKeypair Keypair of the trader
* @param wrapperProgram PublicKey of wrapper program to use if payer doesn't have a userWrapper
*
* @returns ManifestClient
*/
public static async getClientForMarket(
connection: Connection,
marketPk: PublicKey,
payerKeypair: Keypair,
wrapperProgram: PublicKey,
): Promise<ManifestClient> {
const marketObject: Market = await Market.loadFromAddress({
connection: connection,
Expand Down Expand Up @@ -176,12 +178,15 @@ export class ManifestClient {
owner: payerKeypair.publicKey,
wrapperState: wrapperKeypair.publicKey,
});
const claimSeatIx: TransactionInstruction = createClaimSeatInstruction({
manifestProgram: MANIFEST_PROGRAM_ID,
owner: payerKeypair.publicKey,
market: marketPk,
wrapperState: wrapperKeypair.publicKey,
});
const claimSeatIx: TransactionInstruction = createClaimSeatInstruction(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you need to call the ui wrapper or bot wrapper version of this fn depending on program because they require different accounts. currently, all of the client is connected to bot wrapper

https://github.com/CKS-Systems/manifest/blob/main/programs/ui-wrapper/src/instruction.rs#L27
https://github.com/CKS-Systems/manifest/blob/main/programs/wrapper/src/instruction.rs#L23

createClaimSeatInstruction,

{
manifestProgram: MANIFEST_PROGRAM_ID,
owner: payerKeypair.publicKey,
market: marketPk,
wrapperState: wrapperKeypair.publicKey,
},
wrapperProgram,
);
transaction.add(createAccountIx);
transaction.add(createWrapperIx);
transaction.add(claimSeatIx);
Expand Down
Loading