Skip to content

Commit

Permalink
core: actions: update getWalletOrderIds to getWalletMatchableOrderIds
Browse files Browse the repository at this point in the history
  • Loading branch information
akirillo committed Oct 25, 2024
1 parent f086f47 commit f4bb455
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 44 deletions.
31 changes: 31 additions & 0 deletions packages/core/src/actions/getWalletMatchableOrderIds.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { ADMIN_WALLET_MATCHABLE_ORDER_IDS_ROUTE } from '../constants.js'
import type { Config } from '../createConfig.js'
import { BaseError, type BaseErrorType } from '../errors/base.js'
import { getRelayerWithAdmin } from '../utils/http.js'

export type GetWalletMatchableOrderIdsParameters = {
id: string
}

export type GetWalletMatchableOrderIdsReturnType = string[]

export type GetWalletMatchableOrderIdsErrorType = BaseErrorType

export async function getWalletMatchableOrderIds(
config: Config,
parameters: GetWalletMatchableOrderIdsParameters,
): Promise<GetWalletMatchableOrderIdsReturnType> {
const { id } = parameters
const { getRelayerBaseUrl } = config

const res = await getRelayerWithAdmin(
config,
getRelayerBaseUrl(ADMIN_WALLET_MATCHABLE_ORDER_IDS_ROUTE(id)),
)

if (!res.order_ids) {
throw new BaseError('No orders found')
}

return res.order_ids
}
31 changes: 0 additions & 31 deletions packages/core/src/actions/getWalletOrderIds.ts

This file was deleted.

6 changes: 3 additions & 3 deletions packages/core/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ export const ADMIN_ASSIGN_ORDER_ROUTE = (
// Route to get the matching pool for an order
export const ADMIN_GET_ORDER_MATCHING_POOL_ROUTE = (order_id: string) =>
`/admin/orders/${order_id}/matching-pool`
// Route to get all the order IDs for a given wallet
export const ADMIN_WALLET_ORDER_IDS_ROUTE = (wallet_id: string) =>
`/admin/wallet/${wallet_id}/order-ids`
// Route to get all the matchable order IDs for a given wallet
export const ADMIN_WALLET_MATCHABLE_ORDER_IDS_ROUTE = (wallet_id: string) =>
`/admin/wallet/${wallet_id}/matchable-order-ids`

// The admin wallet updates topic, streams opaque event indicating
// updates for all wallets
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/exports/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ export {
} from '../actions/getWalletId.js'

export {
type GetWalletOrderIdsParameters as GetWalletOrdersParameters,
type GetWalletOrderIdsReturnType as GetWalletOrdersReturnType,
type GetWalletOrderIdsErrorType as GetWalletOrdersErrorType,
getWalletOrderIds,
} from '../actions/getWalletOrderIds.js'
type GetWalletMatchableOrderIdsParameters,
type GetWalletMatchableOrderIdsReturnType,
type GetWalletMatchableOrderIdsErrorType,
getWalletMatchableOrderIds,
} from '../actions/getWalletMatchableOrderIds.js'

export {
type LookupWalletReturnType,
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/exports/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ export {
} from '../actions/getWalletId.js'

export {
type GetWalletOrderIdsParameters as GetWalletOrdersParameters,
type GetWalletOrderIdsReturnType as GetWalletOrdersReturnType,
type GetWalletOrderIdsErrorType as GetWalletOrdersErrorType,
getWalletOrderIds,
} from '../actions/getWalletOrderIds.js'
type GetWalletMatchableOrderIdsParameters,
type GetWalletMatchableOrderIdsReturnType,
type GetWalletMatchableOrderIdsErrorType,
getWalletMatchableOrderIds,
} from '../actions/getWalletMatchableOrderIds.js'

export {
type LookupWalletReturnType,
Expand Down

0 comments on commit f4bb455

Please sign in to comment.