Skip to content

Commit

Permalink
packages: core: actions: update order create/update actions to accept…
Browse files Browse the repository at this point in the history
… external matches flag
  • Loading branch information
akirillo committed Oct 19, 2024
1 parent ee58f44 commit 9d85d5d
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 13 deletions.
3 changes: 3 additions & 0 deletions packages/core/src/actions/createOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type CreateOrderParameters = {
amount: bigint
worstCasePrice?: string
minFillSize?: bigint
allowExternalMatches?: boolean
}

export type CreateOrderReturnType = { taskId: string }
Expand All @@ -34,6 +35,7 @@ export async function createOrder(
amount,
worstCasePrice = '',
minFillSize = BigInt(0),
allowExternalMatches = false,
} = parameters
const {
getRelayerBaseUrl,
Expand All @@ -55,6 +57,7 @@ export async function createOrder(
toHex(amount),
worstCasePrice,
toHex(minFillSize),
allowExternalMatches,
)

try {
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/actions/createOrderInMatchingPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export async function createOrderInMatchingPool(
amount,
worstCasePrice = '',
minFillSize = BigInt(0),
allowExternalMatches = false,
matchingPool,
} = parameters
const {
Expand All @@ -49,6 +50,7 @@ export async function createOrderInMatchingPool(
toHex(amount),
worstCasePrice,
toHex(minFillSize),
allowExternalMatches,
matchingPool,
)

Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/actions/updateOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type UpdateOrderParameters = {
amount: bigint
worstCasePrice?: string
minFillSize?: bigint
allowExternalMatches?: boolean
}

export type UpdateOrderReturnType = Promise<{ taskId: string }>
Expand All @@ -31,6 +32,7 @@ export async function updateOrder(
amount,
worstCasePrice = '',
minFillSize = BigInt(0),
allowExternalMatches = false,
} = parameters
const {
getRelayerBaseUrl,
Expand All @@ -52,6 +54,7 @@ export async function updateOrder(
toHex(amount),
worstCasePrice,
toHex(minFillSize),
allowExternalMatches,
)

try {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/types/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type Order = {
worst_case_price: string
amount: bigint
min_fill_size: bigint
allow_external_matches: boolean
}

export enum OrderState {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ export function new_order(seed: string, wallet_str: string, id: string, base_min
* @param {string} amount
* @param {string} worst_case_price
* @param {string} min_fill_size
* @param {string} matching_pool
* @param {boolean} allow_external_matches
* @param {string} matching_pool
* @returns {any}
*/
export function new_order_in_matching_pool(seed: string, wallet_str: string, id: string, base_mint: string, quote_mint: string, side: string, amount: string, worst_case_price: string, min_fill_size: string, matching_pool: string, allow_external_matches: boolean): any;
export function new_order_in_matching_pool(seed: string, wallet_str: string, id: string, base_mint: string, quote_mint: string, side: string, amount: string, worst_case_price: string, min_fill_size: string, allow_external_matches: boolean, matching_pool: string): any;
/**
* @param {string} seed
* @param {string} wallet_str
Expand Down
4 changes: 2 additions & 2 deletions packages/node/renegade-utils/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ export function new_order(seed: string, wallet_str: string, id: string, base_min
* @param {string} amount
* @param {string} worst_case_price
* @param {string} min_fill_size
* @param {string} matching_pool
* @param {boolean} allow_external_matches
* @param {string} matching_pool
* @returns {any}
*/
export function new_order_in_matching_pool(seed: string, wallet_str: string, id: string, base_mint: string, quote_mint: string, side: string, amount: string, worst_case_price: string, min_fill_size: string, matching_pool: string, allow_external_matches: boolean): any;
export function new_order_in_matching_pool(seed: string, wallet_str: string, id: string, base_mint: string, quote_mint: string, side: string, amount: string, worst_case_price: string, min_fill_size: string, allow_external_matches: boolean, matching_pool: string): any;
/**
* @param {string} seed
* @param {string} wallet_str
Expand Down
6 changes: 3 additions & 3 deletions packages/node/renegade-utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,11 @@ module.exports.new_order = function(seed, wallet_str, id, base_mint, quote_mint,
* @param {string} amount
* @param {string} worst_case_price
* @param {string} min_fill_size
* @param {string} matching_pool
* @param {boolean} allow_external_matches
* @param {string} matching_pool
* @returns {any}
*/
module.exports.new_order_in_matching_pool = function(seed, wallet_str, id, base_mint, quote_mint, side, amount, worst_case_price, min_fill_size, matching_pool, allow_external_matches) {
module.exports.new_order_in_matching_pool = function(seed, wallet_str, id, base_mint, quote_mint, side, amount, worst_case_price, min_fill_size, allow_external_matches, matching_pool) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(seed, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
Expand All @@ -363,7 +363,7 @@ module.exports.new_order_in_matching_pool = function(seed, wallet_str, id, base_
const len8 = WASM_VECTOR_LEN;
const ptr9 = passStringToWasm0(matching_pool, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len9 = WASM_VECTOR_LEN;
wasm.new_order_in_matching_pool(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, ptr9, len9, allow_external_matches);
wasm.new_order_in_matching_pool(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, allow_external_matches, ptr9, len9);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
Expand Down
Binary file modified packages/node/renegade-utils/index_bg.wasm
Binary file not shown.
4 changes: 2 additions & 2 deletions packages/react/renegade-utils/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ export function new_order(seed: string, wallet_str: string, id: string, base_min
* @param {string} amount
* @param {string} worst_case_price
* @param {string} min_fill_size
* @param {string} matching_pool
* @param {boolean} allow_external_matches
* @param {string} matching_pool
* @returns {any}
*/
export function new_order_in_matching_pool(seed: string, wallet_str: string, id: string, base_mint: string, quote_mint: string, side: string, amount: string, worst_case_price: string, min_fill_size: string, matching_pool: string, allow_external_matches: boolean): any;
export function new_order_in_matching_pool(seed: string, wallet_str: string, id: string, base_mint: string, quote_mint: string, side: string, amount: string, worst_case_price: string, min_fill_size: string, allow_external_matches: boolean, matching_pool: string): any;
/**
* @param {string} seed
* @param {string} wallet_str
Expand Down
6 changes: 3 additions & 3 deletions packages/react/renegade-utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,11 @@ export function new_order(seed, wallet_str, id, base_mint, quote_mint, side, amo
* @param {string} amount
* @param {string} worst_case_price
* @param {string} min_fill_size
* @param {string} matching_pool
* @param {boolean} allow_external_matches
* @param {string} matching_pool
* @returns {any}
*/
export function new_order_in_matching_pool(seed, wallet_str, id, base_mint, quote_mint, side, amount, worst_case_price, min_fill_size, matching_pool, allow_external_matches) {
export function new_order_in_matching_pool(seed, wallet_str, id, base_mint, quote_mint, side, amount, worst_case_price, min_fill_size, allow_external_matches, matching_pool) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
const ptr0 = passStringToWasm0(seed, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
Expand All @@ -360,7 +360,7 @@ export function new_order_in_matching_pool(seed, wallet_str, id, base_mint, quot
const len8 = WASM_VECTOR_LEN;
const ptr9 = passStringToWasm0(matching_pool, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len9 = WASM_VECTOR_LEN;
wasm.new_order_in_matching_pool(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, ptr9, len9, allow_external_matches);
wasm.new_order_in_matching_pool(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, allow_external_matches, ptr9, len9);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
Expand Down
Binary file modified packages/react/renegade-utils/index_bg.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion wasm/src/external_api/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,8 @@ pub fn new_order_in_matching_pool(
amount: &str,
worst_case_price: &str,
min_fill_size: &str,
matching_pool: &str,
allow_external_matches: bool,
matching_pool: &str,
) -> Result<JsValue, JsError> {
let create_order_req = create_order_request(
seed,
Expand Down

0 comments on commit 9d85d5d

Please sign in to comment.