@basedone/core 0.2.7 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/{chunk-L63E7FZC.mjs → chunk-35WGIB5F.mjs} +165 -1
  2. package/dist/{client-CgmiTuEX.d.mts → client-BQzYwHDY.d.mts} +5 -2
  3. package/dist/{client-CgmiTuEX.d.ts → client-BQzYwHDY.d.ts} +5 -2
  4. package/dist/ecommerce.d.mts +195 -2
  5. package/dist/ecommerce.d.ts +195 -2
  6. package/dist/ecommerce.js +176 -0
  7. package/dist/ecommerce.mjs +1 -2
  8. package/dist/index.d.mts +114 -160
  9. package/dist/index.d.ts +114 -160
  10. package/dist/index.js +462 -41454
  11. package/dist/index.mjs +246 -639
  12. package/dist/react.d.mts +1 -1
  13. package/dist/react.d.ts +1 -1
  14. package/dist/react.mjs +0 -1
  15. package/index.ts +3 -0
  16. package/lib/abstraction/api.ts +106 -0
  17. package/lib/abstraction/index.ts +3 -0
  18. package/lib/abstraction/ratio.ts +61 -0
  19. package/lib/abstraction/types.ts +73 -0
  20. package/lib/constants/admin.ts +30 -0
  21. package/lib/ecommerce/client/customer.ts +42 -0
  22. package/lib/ecommerce/index.ts +14 -0
  23. package/lib/ecommerce/types/entities.ts +70 -0
  24. package/lib/ecommerce/types/enums.ts +37 -1
  25. package/lib/ecommerce/types/requests.ts +2 -0
  26. package/lib/ecommerce/types/responses.ts +28 -0
  27. package/lib/ecommerce/utils/orderStateMachine.ts +197 -0
  28. package/lib/hip3/market-info.ts +5 -1
  29. package/lib/hip3/utils.ts +2 -0
  30. package/lib/meta/metadata.ts +0 -666
  31. package/lib/types.ts +29 -0
  32. package/package.json +1 -1
  33. package/dist/chunk-4UEJOM6W.mjs +0 -7
  34. package/dist/meta-JB5ITE27.mjs +0 -1390
  35. package/dist/meta-UOGUG3OW.mjs +0 -1504
  36. package/dist/perpDexs-3LRJ5ZHM.mjs +0 -288
  37. package/dist/perpDexs-4ISLD7NX.mjs +0 -2975
  38. package/dist/spotMeta-GHXX7C5M.mjs +0 -6968
  39. package/dist/spotMeta-IBBUP2SG.mjs +0 -27592
  40. package/dist/staticMeta-GM7T3OYL.mjs +0 -20
  41. package/dist/staticMeta-QV2KMX57.mjs +0 -22
package/dist/react.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
3
  import { SpotMeta } from '@nktkas/hyperliquid';
4
- import { A as AllPerpsMeta, I as InstrumentClient } from './client-CgmiTuEX.mjs';
4
+ import { A as AllPerpsMeta, I as InstrumentClient } from './client-BQzYwHDY.mjs';
5
5
 
6
6
  interface InstrumentsProviderProps {
7
7
  spotMeta: SpotMeta;
package/dist/react.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
3
  import { SpotMeta } from '@nktkas/hyperliquid';
4
- import { A as AllPerpsMeta, I as InstrumentClient } from './client-CgmiTuEX.js';
4
+ import { A as AllPerpsMeta, I as InstrumentClient } from './client-BQzYwHDY.js';
5
5
 
6
6
  interface InstrumentsProviderProps {
7
7
  spotMeta: SpotMeta;
package/dist/react.mjs CHANGED
@@ -1,5 +1,4 @@
1
1
  import { InstrumentClient } from './chunk-VBC6EQ7Q.mjs';
2
- import './chunk-4UEJOM6W.mjs';
3
2
  import { createContext, useMemo, useContext } from 'react';
4
3
  import { jsx } from 'react/jsx-runtime';
5
4
 
package/index.ts CHANGED
@@ -2,13 +2,16 @@ export * from "./lib/cloid/cloid";
2
2
  export * from "./lib/fee";
3
3
  export * from "./lib/pup";
4
4
  export * from "./lib/constants/tokens";
5
+ export * from "./lib/constants/admin";
5
6
  export * from "./lib/meta/metadata";
6
7
  export * from "./lib/utils/formatter";
7
8
  export * from "./lib/utils/flooredDateTime";
8
9
  export * from "./lib/utils/time";
9
10
  export * from "./lib/hip3/utils";
10
11
  export * from "./lib/hip3/market-info";
12
+ export * from "./lib/abstraction";
11
13
  export * from "./lib/instrument/client";
14
+ export * from "./lib/types";
12
15
 
13
16
  // Ecommerce SDK
14
17
  export * from "./lib/ecommerce";
@@ -0,0 +1,106 @@
1
+ import {
2
+ ExchangeClient,
3
+ InfoClient,
4
+ SuccessResponse,
5
+ } from "@nktkas/hyperliquid";
6
+ import {
7
+ signL1Action,
8
+ signUserSignedAction,
9
+ } from "@nktkas/hyperliquid/signing";
10
+ import type {
11
+ UserAbstractionMode,
12
+ SettableAbstractionMode,
13
+ AgentAbstractionCode,
14
+ } from "./types";
15
+ import { ABSTRACTION_MODE_TO_AGENT_CODE } from "./types";
16
+
17
+ export const UserSetAbstractionTypes = {
18
+ "HyperliquidTransaction:UserSetAbstraction": [
19
+ { name: "hyperliquidChain", type: "string" },
20
+ { name: "user", type: "address" },
21
+ { name: "abstraction", type: "string" },
22
+ { name: "nonce", type: "uint64" },
23
+ ],
24
+ };
25
+
26
+ /**
27
+ * Query a user's current account abstraction mode.
28
+ */
29
+ export async function getUserAbstraction(
30
+ client: InfoClient,
31
+ user: string,
32
+ ): Promise<UserAbstractionMode> {
33
+ return await client.transport.request<UserAbstractionMode>("info", {
34
+ type: "userAbstraction",
35
+ user,
36
+ });
37
+ }
38
+
39
+ /**
40
+ * Set account abstraction mode using the owner wallet (user-signed action).
41
+ *
42
+ * Requires EIP-712 signature from the account owner.
43
+ */
44
+ export async function setUserAbstraction(
45
+ client: ExchangeClient,
46
+ abstraction: SettableAbstractionMode,
47
+ user: string,
48
+ ): Promise<SuccessResponse> {
49
+ const nonce = Date.now();
50
+ const isTestnet = client.isTestnet;
51
+
52
+ const action = {
53
+ type: "userSetAbstraction" as const,
54
+ hyperliquidChain: isTestnet ? "Testnet" : ("Mainnet" as string),
55
+ signatureChainId: isTestnet
56
+ ? ("0x66eee" as `0x${string}`)
57
+ : ("0xa4b1" as `0x${string}`),
58
+ user,
59
+ abstraction,
60
+ nonce,
61
+ };
62
+
63
+ const signature = await signUserSignedAction({
64
+ wallet: client.wallet,
65
+ action,
66
+ types: UserSetAbstractionTypes,
67
+ });
68
+
69
+ return await client.transport.request<SuccessResponse>("exchange", {
70
+ action,
71
+ signature,
72
+ nonce: action.nonce,
73
+ });
74
+ }
75
+
76
+ /**
77
+ * Set account abstraction mode using an agent wallet.
78
+ *
79
+ * Uses shorthand codes: "i" (disabled), "u" (unifiedAccount), "p" (portfolioMargin).
80
+ */
81
+ export async function agentSetAbstraction(
82
+ client: ExchangeClient,
83
+ abstraction: SettableAbstractionMode,
84
+ ): Promise<SuccessResponse> {
85
+ const nonce = Date.now();
86
+ const code: AgentAbstractionCode =
87
+ ABSTRACTION_MODE_TO_AGENT_CODE[abstraction];
88
+
89
+ const action = {
90
+ type: "agentSetAbstraction" as const,
91
+ abstraction: code,
92
+ };
93
+
94
+ const signature = await signL1Action({
95
+ wallet: client.wallet,
96
+ action,
97
+ isTestnet: client.isTestnet,
98
+ nonce,
99
+ });
100
+
101
+ return await client.transport.request<SuccessResponse>("exchange", {
102
+ action,
103
+ signature,
104
+ nonce,
105
+ });
106
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./types";
2
+ export * from "./api";
3
+ export * from "./ratio";
@@ -0,0 +1,61 @@
1
+ import type {
2
+ MultiverseMeta,
3
+ PerpDexClearinghouseState,
4
+ SpotBalance,
5
+ } from "./types";
6
+
7
+ /**
8
+ * Compute the unified account ratio for monitoring liquidation risk.
9
+ *
10
+ * The ratio represents cross maintenance margin used / available balance
11
+ * for the most leveraged collateral token. A higher ratio means closer
12
+ * to liquidation.
13
+ *
14
+ * @param multiverse - Map of DEX name to its metadata (index and collateral token)
15
+ * @param perpDexStates - Array of per-DEX clearinghouse states
16
+ * @param spotBalances - Array of spot balances per token
17
+ * @returns The maximum ratio across all collateral tokens (0 if no margin used)
18
+ */
19
+ export function computeUnifiedAccountRatio(
20
+ multiverse: Record<string, MultiverseMeta>,
21
+ perpDexStates: PerpDexClearinghouseState[],
22
+ spotBalances: SpotBalance[],
23
+ ): number {
24
+ const indexToCollateralToken: Record<number, number> = {};
25
+ for (const meta of Object.values(multiverse)) {
26
+ indexToCollateralToken[meta.index] = meta.collateralToken;
27
+ }
28
+
29
+ const crossMarginByToken: Record<number, number> = {};
30
+ const isolatedMarginByToken: Record<number, number> = {};
31
+
32
+ for (let index = 0; index < perpDexStates.length; index++) {
33
+ const dex = perpDexStates[index];
34
+ const token = indexToCollateralToken[index];
35
+ if (dex === undefined || token === undefined) continue;
36
+
37
+ crossMarginByToken[token] =
38
+ (crossMarginByToken[token] ?? 0) +
39
+ dex.clearinghouseState.crossMaintenanceMarginUsed;
40
+
41
+ for (const ap of dex.clearinghouseState.assetPositions) {
42
+ if (ap.position.leverage.type === "isolated") {
43
+ isolatedMarginByToken[token] =
44
+ (isolatedMarginByToken[token] ?? 0) + ap.position.marginUsed;
45
+ }
46
+ }
47
+ }
48
+
49
+ let maxRatio = 0;
50
+ for (const [tokenStr, crossMargin] of Object.entries(crossMarginByToken)) {
51
+ const token = Number(tokenStr);
52
+ const spotTotal = spotBalances.find((b) => b.token === token)?.total ?? 0;
53
+ const isolatedMargin = isolatedMarginByToken[token] ?? 0;
54
+ const available = spotTotal - isolatedMargin;
55
+ if (available > 0) {
56
+ maxRatio = Math.max(maxRatio, crossMargin / available);
57
+ }
58
+ }
59
+
60
+ return maxRatio;
61
+ }
@@ -0,0 +1,73 @@
1
+ /**
2
+ * User abstraction modes for controlling how spot and perps balances interact.
3
+ *
4
+ * - `disabled` (Standard): Separate perp and spot balances, separate DEX balances.
5
+ * - `unifiedAccount`: Single balance per asset collateralizing all cross margin positions.
6
+ * - `portfolioMargin`: Single portfolio unifying all eligible assets (pre-alpha).
7
+ * - `dexAbstraction`: Legacy mode (to be discontinued).
8
+ * - `default`: Server default (equivalent to standard/disabled for most users).
9
+ */
10
+ export type UserAbstractionMode =
11
+ | "unifiedAccount"
12
+ | "portfolioMargin"
13
+ | "disabled"
14
+ | "default"
15
+ | "dexAbstraction";
16
+
17
+ /**
18
+ * Shorthand codes used with agent-based abstraction setting.
19
+ * - `i` = disabled (standard)
20
+ * - `u` = unifiedAccount
21
+ * - `p` = portfolioMargin
22
+ */
23
+ export type AgentAbstractionCode = "i" | "u" | "p";
24
+
25
+ /**
26
+ * Settable abstraction modes (excludes read-only states like "default" and "dexAbstraction").
27
+ */
28
+ export type SettableAbstractionMode =
29
+ | "disabled"
30
+ | "unifiedAccount"
31
+ | "portfolioMargin";
32
+
33
+ export const ABSTRACTION_MODE_TO_AGENT_CODE: Record<
34
+ SettableAbstractionMode,
35
+ AgentAbstractionCode
36
+ > = {
37
+ disabled: "i",
38
+ unifiedAccount: "u",
39
+ portfolioMargin: "p",
40
+ };
41
+
42
+ export const AGENT_CODE_TO_ABSTRACTION_MODE: Record<
43
+ AgentAbstractionCode,
44
+ SettableAbstractionMode
45
+ > = {
46
+ i: "disabled",
47
+ u: "unifiedAccount",
48
+ p: "portfolioMargin",
49
+ };
50
+
51
+ export interface MultiverseMeta {
52
+ index: number;
53
+ collateralToken: number;
54
+ }
55
+
56
+ export interface PerpDexAssetPosition {
57
+ position: {
58
+ leverage: { type: string };
59
+ marginUsed: number;
60
+ };
61
+ }
62
+
63
+ export interface PerpDexClearinghouseState {
64
+ clearinghouseState: {
65
+ crossMaintenanceMarginUsed: number;
66
+ assetPositions: PerpDexAssetPosition[];
67
+ };
68
+ }
69
+
70
+ export interface SpotBalance {
71
+ token: number;
72
+ total: number;
73
+ }
@@ -0,0 +1,30 @@
1
+ // Super admin Privy user IDs — single source of truth for all apps
2
+ export const ADMINS = [
3
+ "did:privy:cmc3hycnb00pljs0m1z010geq",
4
+ "did:privy:cmc8w2ddl01rdju0nylb6rp1v",
5
+ "did:privy:cmc3oftiz005fjx0msox3xgey",
6
+ "did:privy:cmcbx7i4400q8l90mawdymaag",
7
+ "did:privy:cmctbwphs00vzjz0m3la3zm4c",
8
+ "did:privy:cmcblrplb009ol70mia13winn",
9
+ "did:privy:cmcmizpxm02xfju0oc81alfy0",
10
+ "did:privy:cmcd2bvft00w3l90ljeyb4wn6",
11
+ "did:privy:cmc4y13ka0119kv0nckvgla1u",
12
+ "did:privy:cmc8qc36g00c1l70nnutuscue",
13
+ "did:privy:cmc8f1tf9019zlh0myjpi420p",
14
+ "did:privy:cmc6bturg002ql80mhzqr1d76",
15
+ "did:privy:cmc8uyr4t01kljo0mk3unzjl3",
16
+ "did:privy:cmcke9v7h00yijy0o2a41nhms",
17
+ "did:privy:cmgfcjt2y0024kz0cpymoqbmp",
18
+ "did:privy:cmeqj8tsi01k6la0c3s7gsl6w", // elroy
19
+ "did:privy:cmiwrno1i00cdl70c5ro13eyp", // adele
20
+ "did:privy:cmkc0jyy200abji0d42a0syil", // matthew
21
+ "did:privy:cmlgc2zjk005vjo0cct10trdl", // adele
22
+ ];
23
+
24
+ // Global admin wallet addresses
25
+ export const ADMIN_WALLETS: string[] = [
26
+ "0x0c7582A67B8B6AD04Ea404A6C2A06aAc9E0d4e7c",
27
+ "0xDec587aDD20A6447fF0b29D70E95b10b197b1283",
28
+ "0x3e83987019c4CE29680401b72F8b18A2dE3f8fe6",
29
+ "0x5446A5Bc711170d5197DE33D8C193487794f30C0",
30
+ ];
@@ -68,6 +68,8 @@ import type {
68
68
  GetExpiringGemsResponse,
69
69
  CashAccountBalanceResponse,
70
70
  DeliveryAddressResponse,
71
+ CustomerNotificationsResponse,
72
+ MarkNotificationsReadResponse,
71
73
  } from "../types";
72
74
 
73
75
  /**
@@ -1110,4 +1112,44 @@ export class CustomerEcommerceClient extends BaseEcommerceClient {
1110
1112
  async getDeliveryAddress(): Promise<DeliveryAddressResponse> {
1111
1113
  return this.get("/api/basedpay/delivery-address");
1112
1114
  }
1115
+
1116
+ /**
1117
+ * Get user's Hyperliquid USDC balance (perp withdrawable)
1118
+ *
1119
+ * Returns the USDC balance available for escrow deposits via usdSend.
1120
+ *
1121
+ * @returns Balance response with amount and currency
1122
+ */
1123
+ async getUsdcBalance(): Promise<CashAccountBalanceResponse> {
1124
+ return this.get("/api/marketplace/usdc-balance");
1125
+ }
1126
+
1127
+ // ============================================================================
1128
+ // Notifications API
1129
+ // ============================================================================
1130
+
1131
+ /**
1132
+ * List notifications for the authenticated customer
1133
+ *
1134
+ * @param params - Query parameters for filtering and pagination
1135
+ * @returns Paginated list of notifications with unread count
1136
+ */
1137
+ async listNotifications(params?: {
1138
+ limit?: number;
1139
+ offset?: number;
1140
+ unreadOnly?: boolean;
1141
+ }): Promise<CustomerNotificationsResponse> {
1142
+ const queryString = params ? buildQueryString(params) : "";
1143
+ return this.get(`/api/marketplace/notifications${queryString}`);
1144
+ }
1145
+
1146
+ /**
1147
+ * Mark notifications as read
1148
+ *
1149
+ * @param ids - Specific notification IDs to mark as read. If omitted, marks all as read.
1150
+ * @returns Count of updated notifications
1151
+ */
1152
+ async markNotificationsAsRead(ids?: string[]): Promise<MarkNotificationsReadResponse> {
1153
+ return this.patch("/api/marketplace/notifications/read", { ids });
1154
+ }
1113
1155
  }
@@ -46,6 +46,20 @@ export {
46
46
  calculateFinalPrice,
47
47
  } from "./utils/helpers";
48
48
 
49
+ // Export order state machine
50
+ export {
51
+ ORDER_STATUS_TRANSITIONS,
52
+ validateStatusTransition,
53
+ getNextStatuses,
54
+ isPickupOrder,
55
+ getStatusLabel,
56
+ getStatusColor,
57
+ canCancelOrder,
58
+ requiresTrackingInfo,
59
+ shouldNotifyCustomer,
60
+ getStatusProgress,
61
+ } from "./utils/orderStateMachine";
62
+
49
63
  // Export client config type
50
64
  export type { EcommerceClientConfig } from "./client/base";
51
65
 
@@ -9,6 +9,8 @@ import {
9
9
  PaymentMethod,
10
10
  PaymentStatus,
11
11
  MerchantStatus,
12
+ MerchantBusinessType,
13
+ MerchantReturnPolicyType,
12
14
  ShipmentStatus,
13
15
  ReturnStatus,
14
16
  ReviewStatus,
@@ -127,6 +129,22 @@ export interface ProductVariant extends BaseEntity {
127
129
  sortOrder: number;
128
130
  }
129
131
 
132
+ /**
133
+ * Social links for merchant profile
134
+ */
135
+ export interface MerchantSocialLinks {
136
+ /** Twitter/X profile URL */
137
+ twitter?: string | null;
138
+ /** Instagram profile URL */
139
+ instagram?: string | null;
140
+ /** Facebook page URL */
141
+ facebook?: string | null;
142
+ /** Discord server invite URL */
143
+ discord?: string | null;
144
+ /** Telegram channel/group URL */
145
+ telegram?: string | null;
146
+ }
147
+
130
148
  /**
131
149
  * Merchant entity
132
150
  */
@@ -141,6 +159,44 @@ export interface Merchant extends BaseEntity {
141
159
  payoutAddress: string;
142
160
  /** Merchant status */
143
161
  status: MerchantStatus;
162
+
163
+ // Contact information
164
+ /** Contact email for notifications and customer inquiries */
165
+ email?: string | null;
166
+ /** Contact phone number */
167
+ phone?: string | null;
168
+ /** Store website URL */
169
+ website?: string | null;
170
+
171
+ // Business information
172
+ /** Business type (individual, company, etc.) */
173
+ businessType?: MerchantBusinessType;
174
+
175
+ // Branding
176
+ /** Store logo/avatar URL */
177
+ logoUrl?: string | null;
178
+ /** Store banner image URL */
179
+ bannerUrl?: string | null;
180
+
181
+ // Social links
182
+ /** Social media links */
183
+ socialLinks?: MerchantSocialLinks | null;
184
+
185
+ // Return policy
186
+ /** Return policy type */
187
+ returnPolicyType?: MerchantReturnPolicyType;
188
+ /** Custom return policy details/text */
189
+ returnPolicyDetails?: string | null;
190
+ /** Return window in days (e.g., 30) */
191
+ returnWindowDays?: number | null;
192
+
193
+ // Location
194
+ /** ISO 2-letter country code (for tax/shipping) */
195
+ country?: string | null;
196
+ /** City name */
197
+ city?: string | null;
198
+ /** Street address */
199
+ addressLine1?: string | null;
144
200
  }
145
201
 
146
202
  /**
@@ -301,6 +357,20 @@ export interface Order extends BaseEntity {
301
357
  };
302
358
  /** Order events */
303
359
  events?: OrderEvent[];
360
+ /** Expected ship date */
361
+ expectedShipDate?: string | null;
362
+ /** Estimated delivery date */
363
+ estimatedDeliveryDate?: string | null;
364
+ /** Estimated delivery days */
365
+ estimatedDeliveryDays?: number | null;
366
+ /** Auto-complete deadline */
367
+ autoCompleteDeadline?: string | null;
368
+ /** Customer confirmed receipt timestamp */
369
+ customerConfirmedAt?: string | null;
370
+ /** Auto-completed timestamp */
371
+ autoCompletedAt?: string | null;
372
+ /** Status transition timestamps */
373
+ statusTransitions?: Record<string, string> | null;
304
374
  }
305
375
 
306
376
  /**
@@ -22,6 +22,8 @@ export enum OrderStatus {
22
22
  DELIVERED = "DELIVERED",
23
23
  /** Order has been cancelled */
24
24
  CANCELLED = "CANCELLED",
25
+ /** Payment settled / escrow released to merchant */
26
+ SETTLED = "SETTLED",
25
27
  /** Order is confirmed (legacy status) */
26
28
  CONFIRMED = "CONFIRMED",
27
29
  /** Order is completed (legacy status) */
@@ -70,6 +72,38 @@ export enum MerchantStatus {
70
72
  PENDING = "PENDING",
71
73
  }
72
74
 
75
+ /**
76
+ * Merchant business type enum
77
+ */
78
+ export enum MerchantBusinessType {
79
+ /** Individual seller */
80
+ INDIVIDUAL = "INDIVIDUAL",
81
+ /** Registered company */
82
+ COMPANY = "COMPANY",
83
+ /** Partnership */
84
+ PARTNERSHIP = "PARTNERSHIP",
85
+ /** Non-profit organization */
86
+ NON_PROFIT = "NON_PROFIT",
87
+ }
88
+
89
+ /**
90
+ * Merchant return policy type enum
91
+ */
92
+ export enum MerchantReturnPolicyType {
93
+ /** No returns accepted */
94
+ NO_RETURNS = "NO_RETURNS",
95
+ /** Exchange for same/similar item only */
96
+ EXCHANGE_ONLY = "EXCHANGE_ONLY",
97
+ /** Refund as store credit only */
98
+ STORE_CREDIT = "STORE_CREDIT",
99
+ /** Full refund available */
100
+ FULL_REFUND = "FULL_REFUND",
101
+ /** Partial refund (restocking fee may apply) */
102
+ PARTIAL_REFUND = "PARTIAL_REFUND",
103
+ /** Handled on a case-by-case basis */
104
+ CASE_BY_CASE = "CASE_BY_CASE",
105
+ }
106
+
73
107
  /**
74
108
  * Shipment status enum
75
109
  */
@@ -254,8 +288,10 @@ export enum ProductSortBy {
254
288
  PRICE_ASC = "price_asc",
255
289
  /** Sort by price (high to low) */
256
290
  PRICE_DESC = "price_desc",
257
- /** Sort by popularity */
291
+ /** Sort by popularity (views) */
258
292
  POPULAR = "popular",
293
+ /** Sort by best selling (sold quantity) */
294
+ BEST_SELLING = "best_selling",
259
295
  /** Sort by featured status */
260
296
  FEATURED = "featured",
261
297
  /** Sort by proximity to user location (requires lat/lng) */
@@ -184,6 +184,8 @@ export interface CreateOrderRequest {
184
184
  export interface ListOrdersParams extends PaginationParams {
185
185
  /** Filter by status */
186
186
  status?: OrderStatus;
187
+ /** Filter by merchant ID (for godview access) */
188
+ merchantId?: string;
187
189
  }
188
190
 
189
191
  /**
@@ -286,6 +286,10 @@ export interface ValidateDiscountResponse {
286
286
  /** Discount amount */
287
287
  discountAmount: number;
288
288
  };
289
+ /** Merchant ID the discount belongs to */
290
+ merchantId?: string;
291
+ /** Merchant name the discount belongs to */
292
+ merchantName?: string | null;
289
293
  /** Subtotal */
290
294
  subtotal?: number;
291
295
  /** Total */
@@ -1325,6 +1329,30 @@ export interface CashAccountBalanceResponse {
1325
1329
  currency: string;
1326
1330
  }
1327
1331
 
1332
+ // ============================================================================
1333
+ // Customer Notification Responses
1334
+ // ============================================================================
1335
+
1336
+ export interface CustomerNotification {
1337
+ id: string;
1338
+ type: string;
1339
+ title: string;
1340
+ message: string;
1341
+ metadata: Record<string, any> | null;
1342
+ isRead: boolean;
1343
+ createdAt: string;
1344
+ }
1345
+
1346
+ export interface CustomerNotificationsResponse {
1347
+ notifications: CustomerNotification[];
1348
+ stats: { unread: number };
1349
+ pagination: { total: number; limit: number; offset: number; hasMore: boolean };
1350
+ }
1351
+
1352
+ export interface MarkNotificationsReadResponse {
1353
+ updated: number;
1354
+ }
1355
+
1328
1356
  export interface DeliveryAddressResponse {
1329
1357
  name: string;
1330
1358
  phoneNumber: string;