diff --git a/src/methods/limitOrders/approveForOrder.ts b/src/methods/limitOrders/approveForOrder.ts index c80650b0..128351ec 100644 --- a/src/methods/limitOrders/approveForOrder.ts +++ b/src/methods/limitOrders/approveForOrder.ts @@ -7,6 +7,10 @@ export type ApproveTokenForLimitOrderFunctions = { /** @description approving AugustusRFQ as spender for makerAsset */ approveMakerTokenForLimitOrder: ApproveToken; /** @description approving AugustusSwapper as spender for takerAsset for Limit Orders that will be executed through it */ + /** @deprecated for OTC Orders approve directly the contract that the Order will be filled through: + * AugustusSwapper for old P2P orders; + * AugustusRFQ for new P2P orders + */ approveTakerTokenForLimitOrder: ApproveToken; }; diff --git a/src/methods/limitOrders/getOrders.ts b/src/methods/limitOrders/getOrders.ts index 426ea6ce..ad3b672e 100644 --- a/src/methods/limitOrders/getOrders.ts +++ b/src/methods/limitOrders/getOrders.ts @@ -32,6 +32,7 @@ export type LimitOrdersUserParams = ( export type GetRequiredAllowanceParams = { maker: Address; token?: Address; + filter?: { taker?: Address; notTaker?: Address; type?: LimitOrderType }; }; type GetLimitOrderByHash = ( @@ -57,6 +58,7 @@ export type GetLimitOrdersFunctions = { * @param userParams - parameters to get allowance for active orders * @param {string} userParams.maker - user to get required allowances for * @param {string=} userParams.token - if given `token`, the mapping will contain that token address only + * @param {{taker?:Address;notTaker?:Address;type?:LimitOrderType}=} userParams.filter - extra filter to get balance required for type=P2P or type=LIMIT orders separately * @param {AbortSignal=} signal - AbortSignal passed to fetcher * @returns `{Lowercase
=> wei number as string}` mapping of token to fillableBalance */ @@ -103,10 +105,16 @@ export const constructGetLimitOrders = ({ const getRequiredBalance: GetRequiredBalance = async (userParams, signal) => { const baseFetchURL = getBaseFetchURLByEntityType('fillablebalance'); const userURL = `${baseFetchURL}/${userParams.maker}` as const; - const fetchURL = userParams.token + let routeURL = userParams.token ? (`${userURL}/${userParams.token}` as const) : userURL; + const search = constructSearchString< + NonNullable + >(userParams.filter || {}); + + const fetchURL = `${routeURL}${search}` as const; + const response = await fetcher< Record, GetRequiredBalanceURL diff --git a/src/methods/limitOrders/helpers/buildOrderData.ts b/src/methods/limitOrders/helpers/buildOrderData.ts index 67445924..60eddf00 100644 --- a/src/methods/limitOrders/helpers/buildOrderData.ts +++ b/src/methods/limitOrders/helpers/buildOrderData.ts @@ -90,14 +90,9 @@ export function buildOrderData({ taker = ZERO_ADDRESS; } else { // otherwise for p2p order -> - if (AppVersion === '6.1') { - // limit taker to EOA for v6 version (no Arbitrary Token Swaps + OTC Fill, or OTC Fill through AugustusSwapper) - taker = takerInNonce; - } else { - // on v5 - // -> fill through Augustus only - taker = AugustusAddress; - } + // all new P2P Orders only fillable directly by EOA taker + // not through Augustus, this also disables BUY+FILL Order flow + taker = takerInNonce; } const order: OrderData = {