Skip to content

Commit

Permalink
Fix todo for order type compatibility in client (#26)
Browse files Browse the repository at this point in the history
* Fix todo for order type compatibility in client

* fmt

* min out atoms
  • Loading branch information
brittcyr authored Aug 27, 2024
1 parent 28ebfe8 commit 957180b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 15 deletions.
5 changes: 1 addition & 4 deletions client/idl/generateIdl.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,7 @@ function modifyIdlCore(programName) {
name: 'PostOnly',
},
{
name: 'PostOnlySlide',
},
{
name: 'FillOrKill',
name: 'Global',
},
],
},
Expand Down
5 changes: 1 addition & 4 deletions client/idl/wrapper.json
Original file line number Diff line number Diff line change
Expand Up @@ -474,10 +474,7 @@
"name": "PostOnly"
},
{
"name": "PostOnlySlide"
},
{
"name": "FillOrKill"
"name": "Global"
}
]
}
Expand Down
7 changes: 3 additions & 4 deletions client/ts/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export class ManifestClient {
*
* @returns TransactionInstruction
*/
public static createMarketIx(
private static createMarketIx(
payer: PublicKey,
baseMint: PublicKey,
quoteMint: PublicKey,
Expand Down Expand Up @@ -468,7 +468,7 @@ export type WrapperPlaceOrderParamsExternal = {
/** Type of order (Limit, PostOnly, ...). */
orderType: OrderType;
/** Used in fill or kill orders. Set to zero otherwise. */
minOutAtoms: bignum;
minOutAtoms?: bignum;
/** Client order id used for cancelling orders. Does not need to be unique. */
clientOrderId: bignum;
};
Expand All @@ -485,11 +485,10 @@ function toWrapperPlaceOrderParams(
}
priceMantissa = Math.floor(priceMantissa);

// TODO: Fix this
// @ts-ignore
return {
...wrapperPlaceOrderParamsExternal,
priceMantissa,
priceExponent,
minOutAtoms: wrapperPlaceOrderParamsExternal.minOutAtoms ?? 0,
};
}
3 changes: 1 addition & 2 deletions client/ts/src/wrapper/types/OrderType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ export enum OrderType {
Limit,
ImmediateOrCancel,
PostOnly,
PostOnlySlide,
FillOrKill,
Global,
}

/**
Expand Down
2 changes: 1 addition & 1 deletion client/ts/tests/createMarket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export async function createMarket(
programId: PROGRAM_ID,
});

const createMarketIx = ManifestClient.createMarketIx(
const createMarketIx = ManifestClient['createMarketIx'](
payerKeypair.publicKey,
baseMint,
quoteMint,
Expand Down

0 comments on commit 957180b

Please sign in to comment.