@r2wa-org/eden 0.0.63 → 0.0.65

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
- targetAssetInfo: {
11
+ targetAsset: {
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
- payAssetInfo: {
24
+ payAsset: {
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
- payAccountTypeInfo: {
37
+ payAccountType: {
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;
44
- };
45
- receiveAccountTypeInfo: {
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;
61
+ };
62
+ receiveAccountType: {
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;
@@ -63,7 +112,7 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
63
112
  receiveAccountTypeId: string;
64
113
  minPayAmount: string;
65
114
  settlementMode: "available" | "locked";
66
- targetAssetInfo: {
115
+ targetAsset: {
67
116
  symbol: string;
68
117
  id: string;
69
118
  name: string;
@@ -71,7 +120,7 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
71
120
  isActive: boolean;
72
121
  precision: number;
73
122
  };
74
- payAssetInfo: {
123
+ payAsset: {
75
124
  symbol: string;
76
125
  id: string;
77
126
  name: string;
@@ -79,13 +128,13 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
79
128
  isActive: boolean;
80
129
  precision: number;
81
130
  };
82
- payAccountTypeInfo: {
131
+ payAccountType: {
83
132
  id: string;
84
133
  name: string;
85
134
  key: string;
86
135
  isActive: boolean;
87
136
  };
88
- receiveAccountTypeInfo: {
137
+ receiveAccountType: {
89
138
  id: string;
90
139
  name: string;
91
140
  key: string;
@@ -106,7 +155,7 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
106
155
  receiveAccountTypeId: string;
107
156
  minPayAmount: string;
108
157
  settlementMode: "available" | "locked";
109
- targetAssetInfo: {
158
+ targetAsset: {
110
159
  symbol: string;
111
160
  id: string;
112
161
  name: string;
@@ -114,7 +163,7 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
114
163
  isActive: boolean;
115
164
  precision: number;
116
165
  };
117
- payAssetInfo: {
166
+ payAsset: {
118
167
  symbol: string;
119
168
  id: string;
120
169
  name: string;
@@ -122,13 +171,13 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
122
171
  isActive: boolean;
123
172
  precision: number;
124
173
  };
125
- payAccountTypeInfo: {
174
+ payAccountType: {
126
175
  id: string;
127
176
  name: string;
128
177
  key: string;
129
178
  isActive: boolean;
130
179
  };
131
- receiveAccountTypeInfo: {
180
+ receiveAccountType: {
132
181
  id: string;
133
182
  name: string;
134
183
  key: string;
@@ -149,7 +198,7 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
149
198
  receiveAccountTypeId: string;
150
199
  minPayAmount: string;
151
200
  settlementMode: "available" | "locked";
152
- targetAssetInfo: {
201
+ targetAsset: {
153
202
  symbol: string;
154
203
  id: string;
155
204
  name: string;
@@ -157,7 +206,7 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
157
206
  isActive: boolean;
158
207
  precision: number;
159
208
  };
160
- payAssetInfo: {
209
+ payAsset: {
161
210
  symbol: string;
162
211
  id: string;
163
212
  name: string;
@@ -165,13 +214,13 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
165
214
  isActive: boolean;
166
215
  precision: number;
167
216
  };
168
- payAccountTypeInfo: {
217
+ payAccountType: {
169
218
  id: string;
170
219
  name: string;
171
220
  key: string;
172
221
  isActive: boolean;
173
222
  };
174
- receiveAccountTypeInfo: {
223
+ receiveAccountType: {
175
224
  id: string;
176
225
  name: string;
177
226
  key: string;
@@ -192,7 +241,7 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
192
241
  receiveAccountTypeId: string;
193
242
  minPayAmount: string;
194
243
  settlementMode: "available" | "locked";
195
- targetAssetInfo: {
244
+ targetAsset: {
196
245
  symbol: string;
197
246
  id: string;
198
247
  name: string;
@@ -200,7 +249,7 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
200
249
  isActive: boolean;
201
250
  precision: number;
202
251
  };
203
- payAssetInfo: {
252
+ payAsset: {
204
253
  symbol: string;
205
254
  id: string;
206
255
  name: string;
@@ -208,21 +257,20 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
208
257
  isActive: boolean;
209
258
  precision: number;
210
259
  };
211
- payAccountTypeInfo: {
260
+ payAccountType: {
212
261
  id: string;
213
262
  name: string;
214
263
  key: string;
215
264
  isActive: boolean;
216
265
  };
217
- receiveAccountTypeInfo: {
266
+ receiveAccountType: {
218
267
  id: string;
219
268
  name: string;
220
269
  key: string;
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;
@@ -236,7 +284,7 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
236
284
  receiveAccountTypeId: string;
237
285
  minPayAmount: string;
238
286
  settlementMode: "available" | "locked";
239
- targetAssetInfo: {
287
+ targetAsset: {
240
288
  symbol: string;
241
289
  id: string;
242
290
  name: string;
@@ -244,7 +292,7 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
244
292
  isActive: boolean;
245
293
  precision: number;
246
294
  };
247
- payAssetInfo: {
295
+ payAsset: {
248
296
  symbol: string;
249
297
  id: string;
250
298
  name: string;
@@ -252,13 +300,13 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
252
300
  isActive: boolean;
253
301
  precision: number;
254
302
  };
255
- payAccountTypeInfo: {
303
+ payAccountType: {
256
304
  id: string;
257
305
  name: string;
258
306
  key: string;
259
307
  isActive: boolean;
260
308
  };
261
- receiveAccountTypeInfo: {
309
+ receiveAccountType: {
262
310
  id: string;
263
311
  name: string;
264
312
  key: string;
@@ -280,7 +328,7 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
280
328
  receiveAccountTypeId: string;
281
329
  minPayAmount: string;
282
330
  settlementMode: "available" | "locked";
283
- targetAssetInfo: {
331
+ targetAsset: {
284
332
  symbol: string;
285
333
  id: string;
286
334
  name: string;
@@ -288,7 +336,7 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
288
336
  isActive: boolean;
289
337
  precision: number;
290
338
  };
291
- payAssetInfo: {
339
+ payAsset: {
292
340
  symbol: string;
293
341
  id: string;
294
342
  name: string;
@@ -296,13 +344,13 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
296
344
  isActive: boolean;
297
345
  precision: number;
298
346
  };
299
- payAccountTypeInfo: {
347
+ payAccountType: {
300
348
  id: string;
301
349
  name: string;
302
350
  key: string;
303
351
  isActive: boolean;
304
352
  };
305
- receiveAccountTypeInfo: {
353
+ receiveAccountType: {
306
354
  id: string;
307
355
  name: string;
308
356
  key: string;
@@ -318,18 +366,26 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
318
366
  };
319
367
  }>;
320
368
  static getOrderDetail(orderId: string): Promise<{
321
- debitLedgerEntryInfo?: {
369
+ debitLedgerEntry?: {
322
370
  id: string;
323
371
  createdAt: Date;
324
372
  bizType: "deposit_credit" | "withdraw_freeze" | "withdraw_release" | "withdraw_debit" | "transfer_out" | "transfer_in" | "internal_transfer_out" | "internal_transfer_in" | "manual_increase" | "manual_decrease" | "welfare_cycle_subscribe_transfer" | "welfare_cycle_daily_yield_payout" | "welfare_cycle_maturity_yield_payout" | "welfare_cycle_maturity_principal_return" | "asset_convert_order_pay_debit" | "asset_convert_order_target_credit" | "trade_market_buy_quote_transfer" | "trade_market_buy_base_transfer" | "trade_market_sell_base_transfer" | "trade_market_sell_quote_transfer";
325
373
  amount: string;
326
374
  } | undefined;
327
- creditLedgerEntryInfo?: {
375
+ creditLedgerEntry?: {
328
376
  id: string;
329
377
  createdAt: Date;
330
378
  bizType: "deposit_credit" | "withdraw_freeze" | "withdraw_release" | "withdraw_debit" | "transfer_out" | "transfer_in" | "internal_transfer_out" | "internal_transfer_in" | "manual_increase" | "manual_decrease" | "welfare_cycle_subscribe_transfer" | "welfare_cycle_daily_yield_payout" | "welfare_cycle_maturity_yield_payout" | "welfare_cycle_maturity_principal_return" | "asset_convert_order_pay_debit" | "asset_convert_order_target_credit" | "trade_market_buy_quote_transfer" | "trade_market_buy_base_transfer" | "trade_market_sell_base_transfer" | "trade_market_sell_quote_transfer";
331
379
  amount: string;
332
380
  } | undefined;
381
+ user: {
382
+ email: string;
383
+ id: string;
384
+ username: string | null;
385
+ displayUsername: string | null;
386
+ phoneNumber: string | null;
387
+ banned: boolean | null;
388
+ };
333
389
  id: string;
334
390
  createdAt: Date;
335
391
  updatedAt: Date;
@@ -352,7 +408,13 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
352
408
  creditLedgerEntryId: string | null;
353
409
  failureCode: string | null;
354
410
  failureReason: string | null;
355
- targetAssetInfo: {
411
+ product: {
412
+ id: string;
413
+ name: string;
414
+ status: "active" | "draft" | "paused" | "ended";
415
+ productCategoryKey: "gold" | "gov_bond" | "real_estate" | "corporate_credit";
416
+ };
417
+ payAssetSnapshot: {
356
418
  symbol: string;
357
419
  id: string;
358
420
  name: string;
@@ -360,7 +422,7 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
360
422
  isActive: boolean;
361
423
  precision: number;
362
424
  };
363
- payAssetInfo: {
425
+ targetAssetSnapshot: {
364
426
  symbol: string;
365
427
  id: string;
366
428
  name: string;
@@ -368,21 +430,7 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
368
430
  isActive: boolean;
369
431
  precision: number;
370
432
  };
371
- userInfo: {
372
- email: string;
373
- id: string;
374
- username: string | null;
375
- displayUsername: string | null;
376
- phoneNumber: string | null;
377
- banned: boolean | null;
378
- };
379
- productInfo: {
380
- id: string;
381
- name: string;
382
- status: "active" | "draft" | "paused" | "ended";
383
- productCategoryKey: "gold" | "gov_bond" | "real_estate" | "corporate_credit";
384
- };
385
- quoteAssetInfo: {
433
+ quoteAssetSnapshot: {
386
434
  symbol: string;
387
435
  id: string;
388
436
  name: string;
@@ -390,13 +438,13 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
390
438
  isActive: boolean;
391
439
  precision: number;
392
440
  };
393
- sourcePayAccountInfo: {
441
+ sourcePayAccount: {
394
442
  id: string;
395
443
  status: "active" | "frozen" | "disabled";
396
444
  assetId: string;
397
445
  ledgerAccountTypeId: string;
398
446
  };
399
- receiveAccountInfo: {
447
+ receiveAccount: {
400
448
  id: string;
401
449
  status: "active" | "frozen" | "disabled";
402
450
  assetId: string;
@@ -404,18 +452,26 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
404
452
  };
405
453
  }>;
406
454
  static getOrderByOrderNo(orderNo: string): Promise<{
407
- debitLedgerEntryInfo?: {
455
+ debitLedgerEntry?: {
408
456
  id: string;
409
457
  createdAt: Date;
410
458
  bizType: "deposit_credit" | "withdraw_freeze" | "withdraw_release" | "withdraw_debit" | "transfer_out" | "transfer_in" | "internal_transfer_out" | "internal_transfer_in" | "manual_increase" | "manual_decrease" | "welfare_cycle_subscribe_transfer" | "welfare_cycle_daily_yield_payout" | "welfare_cycle_maturity_yield_payout" | "welfare_cycle_maturity_principal_return" | "asset_convert_order_pay_debit" | "asset_convert_order_target_credit" | "trade_market_buy_quote_transfer" | "trade_market_buy_base_transfer" | "trade_market_sell_base_transfer" | "trade_market_sell_quote_transfer";
411
459
  amount: string;
412
460
  } | undefined;
413
- creditLedgerEntryInfo?: {
461
+ creditLedgerEntry?: {
414
462
  id: string;
415
463
  createdAt: Date;
416
464
  bizType: "deposit_credit" | "withdraw_freeze" | "withdraw_release" | "withdraw_debit" | "transfer_out" | "transfer_in" | "internal_transfer_out" | "internal_transfer_in" | "manual_increase" | "manual_decrease" | "welfare_cycle_subscribe_transfer" | "welfare_cycle_daily_yield_payout" | "welfare_cycle_maturity_yield_payout" | "welfare_cycle_maturity_principal_return" | "asset_convert_order_pay_debit" | "asset_convert_order_target_credit" | "trade_market_buy_quote_transfer" | "trade_market_buy_base_transfer" | "trade_market_sell_base_transfer" | "trade_market_sell_quote_transfer";
417
465
  amount: string;
418
466
  } | undefined;
467
+ user: {
468
+ email: string;
469
+ id: string;
470
+ username: string | null;
471
+ displayUsername: string | null;
472
+ phoneNumber: string | null;
473
+ banned: boolean | null;
474
+ };
419
475
  id: string;
420
476
  createdAt: Date;
421
477
  updatedAt: Date;
@@ -438,7 +494,13 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
438
494
  creditLedgerEntryId: string | null;
439
495
  failureCode: string | null;
440
496
  failureReason: string | null;
441
- targetAssetInfo: {
497
+ product: {
498
+ id: string;
499
+ name: string;
500
+ status: "active" | "draft" | "paused" | "ended";
501
+ productCategoryKey: "gold" | "gov_bond" | "real_estate" | "corporate_credit";
502
+ };
503
+ payAssetSnapshot: {
442
504
  symbol: string;
443
505
  id: string;
444
506
  name: string;
@@ -446,7 +508,7 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
446
508
  isActive: boolean;
447
509
  precision: number;
448
510
  };
449
- payAssetInfo: {
511
+ targetAssetSnapshot: {
450
512
  symbol: string;
451
513
  id: string;
452
514
  name: string;
@@ -454,21 +516,7 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
454
516
  isActive: boolean;
455
517
  precision: number;
456
518
  };
457
- userInfo: {
458
- email: string;
459
- id: string;
460
- username: string | null;
461
- displayUsername: string | null;
462
- phoneNumber: string | null;
463
- banned: boolean | null;
464
- };
465
- productInfo: {
466
- id: string;
467
- name: string;
468
- status: "active" | "draft" | "paused" | "ended";
469
- productCategoryKey: "gold" | "gov_bond" | "real_estate" | "corporate_credit";
470
- };
471
- quoteAssetInfo: {
519
+ quoteAssetSnapshot: {
472
520
  symbol: string;
473
521
  id: string;
474
522
  name: string;
@@ -476,13 +524,13 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
476
524
  isActive: boolean;
477
525
  precision: number;
478
526
  };
479
- sourcePayAccountInfo: {
527
+ sourcePayAccount: {
480
528
  id: string;
481
529
  status: "active" | "frozen" | "disabled";
482
530
  assetId: string;
483
531
  ledgerAccountTypeId: string;
484
532
  };
485
- receiveAccountInfo: {
533
+ receiveAccount: {
486
534
  id: string;
487
535
  status: "active" | "frozen" | "disabled";
488
536
  assetId: string;
@@ -491,18 +539,26 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
491
539
  }>;
492
540
  static listOrders(filters?: AssetConvertOrderListQueryType): Promise<{
493
541
  data: {
494
- debitLedgerEntryInfo?: {
542
+ debitLedgerEntry?: {
495
543
  id: string;
496
544
  createdAt: Date;
497
545
  bizType: "deposit_credit" | "withdraw_freeze" | "withdraw_release" | "withdraw_debit" | "transfer_out" | "transfer_in" | "internal_transfer_out" | "internal_transfer_in" | "manual_increase" | "manual_decrease" | "welfare_cycle_subscribe_transfer" | "welfare_cycle_daily_yield_payout" | "welfare_cycle_maturity_yield_payout" | "welfare_cycle_maturity_principal_return" | "asset_convert_order_pay_debit" | "asset_convert_order_target_credit" | "trade_market_buy_quote_transfer" | "trade_market_buy_base_transfer" | "trade_market_sell_base_transfer" | "trade_market_sell_quote_transfer";
498
546
  amount: string;
499
547
  } | undefined;
500
- creditLedgerEntryInfo?: {
548
+ creditLedgerEntry?: {
501
549
  id: string;
502
550
  createdAt: Date;
503
551
  bizType: "deposit_credit" | "withdraw_freeze" | "withdraw_release" | "withdraw_debit" | "transfer_out" | "transfer_in" | "internal_transfer_out" | "internal_transfer_in" | "manual_increase" | "manual_decrease" | "welfare_cycle_subscribe_transfer" | "welfare_cycle_daily_yield_payout" | "welfare_cycle_maturity_yield_payout" | "welfare_cycle_maturity_principal_return" | "asset_convert_order_pay_debit" | "asset_convert_order_target_credit" | "trade_market_buy_quote_transfer" | "trade_market_buy_base_transfer" | "trade_market_sell_base_transfer" | "trade_market_sell_quote_transfer";
504
552
  amount: string;
505
553
  } | undefined;
554
+ user: {
555
+ email: string;
556
+ id: string;
557
+ username: string | null;
558
+ displayUsername: string | null;
559
+ phoneNumber: string | null;
560
+ banned: boolean | null;
561
+ };
506
562
  id: string;
507
563
  createdAt: Date;
508
564
  updatedAt: Date;
@@ -525,7 +581,13 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
525
581
  creditLedgerEntryId: string | null;
526
582
  failureCode: string | null;
527
583
  failureReason: string | null;
528
- targetAssetInfo: {
584
+ product: {
585
+ id: string;
586
+ name: string;
587
+ status: "active" | "draft" | "paused" | "ended";
588
+ productCategoryKey: "gold" | "gov_bond" | "real_estate" | "corporate_credit";
589
+ };
590
+ payAssetSnapshot: {
529
591
  symbol: string;
530
592
  id: string;
531
593
  name: string;
@@ -533,7 +595,7 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
533
595
  isActive: boolean;
534
596
  precision: number;
535
597
  };
536
- payAssetInfo: {
598
+ targetAssetSnapshot: {
537
599
  symbol: string;
538
600
  id: string;
539
601
  name: string;
@@ -541,21 +603,7 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
541
603
  isActive: boolean;
542
604
  precision: number;
543
605
  };
544
- userInfo: {
545
- email: string;
546
- id: string;
547
- username: string | null;
548
- displayUsername: string | null;
549
- phoneNumber: string | null;
550
- banned: boolean | null;
551
- };
552
- productInfo: {
553
- id: string;
554
- name: string;
555
- status: "active" | "draft" | "paused" | "ended";
556
- productCategoryKey: "gold" | "gov_bond" | "real_estate" | "corporate_credit";
557
- };
558
- quoteAssetInfo: {
606
+ quoteAssetSnapshot: {
559
607
  symbol: string;
560
608
  id: string;
561
609
  name: string;
@@ -563,13 +611,13 @@ export declare abstract class AdminAssetConvertProductService extends BaseAssetC
563
611
  isActive: boolean;
564
612
  precision: number;
565
613
  };
566
- sourcePayAccountInfo: {
614
+ sourcePayAccount: {
567
615
  id: string;
568
616
  status: "active" | "frozen" | "disabled";
569
617
  assetId: string;
570
618
  ledgerAccountTypeId: string;
571
619
  };
572
- receiveAccountInfo: {
620
+ receiveAccount: {
573
621
  id: string;
574
622
  status: "active" | "frozen" | "disabled";
575
623
  assetId: string;
@@ -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
  }