@r2wa-org/eden 0.0.63 → 0.0.64

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.
@@ -1,53 +1,102 @@
1
- import { BaseAssetConvertProductService } from "../internal/service";
1
+ import type { TransactionTx } from "../../db/transaction";
2
2
  import type { AssetConvertOrderListQueryType, AssetConvertOrderStatsQueryType, AssetConvertOrderStatsResponseType, AssetConvertProductCreateInputType, AssetConvertProductListQueryType, AssetConvertProductUpdateInputType } from "./dto.schemas";
3
- export declare abstract class AdminAssetConvertProductService extends BaseAssetConvertProductService {
3
+ export declare abstract class AdminAssetConvertProductService {
4
+ private static getProductById;
4
5
  private static mapProductResponse;
5
6
  private static mapOrderResponse;
6
7
  private static ensureValidTimeRange;
7
8
  private static assertStatusTransitionAllowed;
8
9
  private static ensureProductReferencesValid;
9
10
  static createProduct(input: AssetConvertProductCreateInputType): Promise<{
10
- id: string;
11
- name: string;
12
- createdAt: Date;
13
- updatedAt: Date;
14
- description: string | null;
15
- status: "active" | "draft" | "paused" | "ended";
16
- productCategoryKey: "gold" | "gov_bond" | "real_estate" | "corporate_credit";
17
- targetAssetId: string;
18
- payAssetId: string;
19
- payAccountTypeId: string;
20
- receiveAccountTypeId: string;
21
- minPayAmount: string;
22
- settlementMode: "available" | "locked";
23
11
  targetAssetInfo: {
24
12
  symbol: string;
25
13
  id: string;
26
14
  name: string;
15
+ createdAt: Date;
16
+ updatedAt: Date;
27
17
  code: string;
18
+ iconUrl: string;
19
+ category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
28
20
  isActive: boolean;
21
+ typeId: string;
29
22
  precision: number;
30
23
  };
31
24
  payAssetInfo: {
32
25
  symbol: string;
33
26
  id: string;
34
27
  name: string;
28
+ createdAt: Date;
29
+ updatedAt: Date;
35
30
  code: string;
31
+ iconUrl: string;
32
+ category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
36
33
  isActive: boolean;
34
+ typeId: string;
37
35
  precision: number;
38
36
  };
39
37
  payAccountTypeInfo: {
40
38
  id: string;
41
39
  name: string;
40
+ createdAt: Date;
41
+ updatedAt: Date;
42
+ description: string | null;
42
43
  key: string;
43
44
  isActive: boolean;
45
+ allowDeposit: boolean;
46
+ allowWithdraw: boolean;
47
+ minWithdrawAmount: string;
48
+ maxWithdrawAmount: string;
49
+ allowTransfer: boolean;
50
+ minTransferAmount: string;
51
+ maxTransferAmount: string;
52
+ allowInternalTransfer: boolean;
53
+ allowInternalReceiveTransfer: boolean;
54
+ minInternalTransferAmount: string;
55
+ maxInternalTransferAmount: string;
56
+ internalTransferRatio: string;
57
+ allowTransaction: boolean;
58
+ hasExpiry: boolean;
59
+ expiryDays: number | null;
60
+ sortOrder: number;
44
61
  };
45
62
  receiveAccountTypeInfo: {
46
63
  id: string;
47
64
  name: string;
65
+ createdAt: Date;
66
+ updatedAt: Date;
67
+ description: string | null;
48
68
  key: string;
49
69
  isActive: boolean;
70
+ allowDeposit: boolean;
71
+ allowWithdraw: boolean;
72
+ minWithdrawAmount: string;
73
+ maxWithdrawAmount: string;
74
+ allowTransfer: boolean;
75
+ minTransferAmount: string;
76
+ maxTransferAmount: string;
77
+ allowInternalTransfer: boolean;
78
+ allowInternalReceiveTransfer: boolean;
79
+ minInternalTransferAmount: string;
80
+ maxInternalTransferAmount: string;
81
+ internalTransferRatio: string;
82
+ allowTransaction: boolean;
83
+ hasExpiry: boolean;
84
+ expiryDays: number | null;
85
+ sortOrder: number;
50
86
  };
87
+ id: string;
88
+ name: string;
89
+ createdAt: Date;
90
+ updatedAt: Date;
91
+ description: string | null;
92
+ status: "active" | "draft" | "paused" | "ended";
93
+ productCategoryKey: "gold" | "gov_bond" | "real_estate" | "corporate_credit";
94
+ targetAssetId: string;
95
+ payAssetId: string;
96
+ payAccountTypeId: string;
97
+ receiveAccountTypeId: string;
98
+ minPayAmount: string;
99
+ settlementMode: "available" | "locked";
51
100
  }>;
52
101
  static updateProduct(productId: string, input: AssetConvertProductUpdateInputType): Promise<{
53
102
  id: string;
@@ -221,8 +270,7 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
221
270
  isActive: boolean;
222
271
  };
223
272
  }>;
224
- private static changeStatus;
225
- static getProductDetail(productId: string): Promise<{
273
+ static getProductDetail(productId: string, tx?: TransactionTx): Promise<{
226
274
  id: string;
227
275
  name: string;
228
276
  createdAt: Date;
@@ -1,67 +1,2 @@
1
- import Decimal from "decimal.js";
2
- import type { TransactionTx } from "../../db/transaction";
3
- import { assetConvertOrder, assetConvertProduct } from "../schema";
4
- export declare abstract class BaseAssetConvertProductService {
5
- protected static validatePayAmount(payAmount: string): Decimal;
6
- protected static getProductById(productId: string, tx?: TransactionTx): Promise<{
7
- id: string;
8
- name: string;
9
- createdAt: Date;
10
- updatedAt: Date;
11
- description: string | null;
12
- status: "active" | "draft" | "paused" | "ended";
13
- productCategoryKey: "gold" | "gov_bond" | "real_estate" | "corporate_credit";
14
- targetAssetId: string;
15
- payAssetId: string;
16
- payAccountTypeId: string;
17
- receiveAccountTypeId: string;
18
- minPayAmount: string;
19
- settlementMode: "available" | "locked";
20
- }>;
21
- protected static assertProductActive(product: typeof assetConvertProduct.$inferSelect): void;
22
- protected static ensureProductPayAmount(productMinPayAmount: string, payAmount: Decimal): void;
23
- protected static calcTargetAmount(payAmount: Decimal, price: string): string;
24
- protected static getLatestProductPrice(tx: TransactionTx, product: typeof assetConvertProduct.$inferSelect): Promise<{
25
- id: string;
26
- createdAt: Date;
27
- updatedAt: Date;
28
- baseAssetId: string;
29
- baseAsset: string;
30
- quoteAssetId: string;
31
- quoteAsset: string;
32
- price: string;
33
- source: string;
34
- effectiveAt: Date;
35
- }>;
36
- protected static getPayAccountForUser(tx: TransactionTx, userId: string, payAssetId: string, payAccountTypeId: string): Promise<{
37
- id: string;
38
- createdAt: Date;
39
- updatedAt: Date;
40
- userId: string;
41
- status: "active" | "frozen" | "disabled";
42
- assetId: string;
43
- ledgerAccountTypeId: string;
44
- available: string;
45
- locked: string;
46
- version: number;
47
- }>;
48
- protected static getReceiveAccountForUser(tx: TransactionTx, userId: string, product: typeof assetConvertProduct.$inferSelect): Promise<{
49
- id: string;
50
- createdAt: Date;
51
- updatedAt: Date;
52
- userId: string;
53
- status: "active" | "frozen" | "disabled";
54
- assetId: string;
55
- ledgerAccountTypeId: string;
56
- available: string;
57
- locked: string;
58
- version: number;
59
- }>;
60
- protected static assertIdempotentPayload(existing: typeof assetConvertOrder.$inferSelect, input: {
61
- productId: string;
62
- payAmount: string;
63
- idempotencyKey: string;
64
- }): void;
65
- }
66
- export declare abstract class InternalAssetConvertProductService extends BaseAssetConvertProductService {
1
+ export declare abstract class InternalAssetConvertProductService {
67
2
  }