@r2wa-org/eden 0.0.80 → 0.0.82

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.
@@ -975,6 +975,13 @@ export declare const adminRouter: Elysia<"/admin", {
975
975
  response: {
976
976
  200: {
977
977
  data: {
978
+ latestPrice?: {
979
+ quoteAssetId: string;
980
+ quoteAsset: string;
981
+ price: string;
982
+ source: string;
983
+ effectiveAt: Date;
984
+ } | null | undefined;
978
985
  symbol: string | null;
979
986
  type: {
980
987
  id: string;
@@ -1269,16 +1276,16 @@ export declare const adminRouter: Elysia<"/admin", {
1269
1276
  body: {
1270
1277
  description?: string | null | undefined;
1271
1278
  status?: "active" | "draft" | "paused" | "ended" | undefined;
1279
+ payAssetId?: string | undefined;
1280
+ payAccountTypeId?: string | undefined;
1281
+ receiveAccountTypeId?: string | undefined;
1282
+ settlementMode?: "available" | "locked" | undefined;
1272
1283
  allowPurchase?: boolean | undefined;
1273
1284
  isHot?: boolean | undefined;
1274
1285
  name: string;
1275
1286
  productCategoryKey: "gold" | "gov_bond" | "real_estate" | "corporate_credit";
1276
1287
  targetAssetId: string;
1277
- payAssetId: string;
1278
- payAccountTypeId: string;
1279
- receiveAccountTypeId: string;
1280
1288
  minPayAmount: string;
1281
- settlementMode: "available" | "locked";
1282
1289
  };
1283
1290
  params: {};
1284
1291
  query: {};
@@ -8020,16 +8027,16 @@ export declare const adminRouter: Elysia<"/admin", {
8020
8027
  body: {
8021
8028
  description?: string | null | undefined;
8022
8029
  status?: "active" | "draft" | "paused" | "ended" | undefined;
8030
+ pricingAssetId?: string | undefined;
8031
+ sourcePricingAccountTypeId?: string | undefined;
8032
+ dailyPayoutAccountTypeId?: string | undefined;
8033
+ maturitySettlementAccountTypeId?: string | undefined;
8023
8034
  minShares?: number | undefined;
8024
8035
  maxSharesPerOrder?: number | null | undefined;
8025
8036
  saleStartAt?: Date | null | undefined;
8026
8037
  saleEndAt?: Date | null | undefined;
8027
8038
  name: string;
8028
8039
  rightsAssetId: string;
8029
- pricingAssetId: string;
8030
- sourcePricingAccountTypeId: string;
8031
- dailyPayoutAccountTypeId: string;
8032
- maturitySettlementAccountTypeId: string;
8033
8040
  pricePerShare: string;
8034
8041
  rightsPerShare: string;
8035
8042
  cycleDays: number;
@@ -44,6 +44,13 @@ export declare const assetAdminItemResponseSchema: import("@sinclair/typebox").T
44
44
  key: import("@sinclair/typebox").TString;
45
45
  isActive: import("@sinclair/typebox").TBoolean;
46
46
  }>, import("@sinclair/typebox").TNull]>;
47
+ latestPrice: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
48
+ quoteAssetId: import("@sinclair/typebox").TString;
49
+ quoteAsset: import("@sinclair/typebox").TString;
50
+ price: import("@sinclair/typebox").TString;
51
+ source: import("@sinclair/typebox").TString;
52
+ effectiveAt: import("@sinclair/typebox").TDate;
53
+ }>, import("@sinclair/typebox").TNull]>>;
47
54
  }>;
48
55
  export type AssetAdminItemResponseType = typeof assetAdminItemResponseSchema.static;
49
56
  export declare const assetAdminListResponseSchema: import("@sinclair/typebox").TObject<{
@@ -70,6 +77,13 @@ export declare const assetAdminListResponseSchema: import("@sinclair/typebox").T
70
77
  key: import("@sinclair/typebox").TString;
71
78
  isActive: import("@sinclair/typebox").TBoolean;
72
79
  }>, import("@sinclair/typebox").TNull]>;
80
+ latestPrice: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
81
+ quoteAssetId: import("@sinclair/typebox").TString;
82
+ quoteAsset: import("@sinclair/typebox").TString;
83
+ price: import("@sinclair/typebox").TString;
84
+ source: import("@sinclair/typebox").TString;
85
+ effectiveAt: import("@sinclair/typebox").TDate;
86
+ }>, import("@sinclair/typebox").TNull]>>;
73
87
  }>>;
74
88
  pagination: import("@sinclair/typebox").TObject<{
75
89
  pageSize: import("@sinclair/typebox").TNumber;
@@ -401,6 +401,13 @@ export declare const assetAdminRouter: Elysia<"/assets", {
401
401
  response: {
402
402
  200: {
403
403
  data: {
404
+ latestPrice?: {
405
+ quoteAssetId: string;
406
+ quoteAsset: string;
407
+ price: string;
408
+ source: string;
409
+ effectiveAt: Date;
410
+ } | null | undefined;
404
411
  symbol: string | null;
405
412
  type: {
406
413
  id: string;
@@ -3,11 +3,19 @@ import { BaseAssetService } from '../internal/service';
3
3
  export interface AssetAdminListQueryOptions extends AssetAdminListQueryType {
4
4
  }
5
5
  export declare abstract class AdminAssetService extends BaseAssetService {
6
+ private static getLatestPriceMapForAssets;
6
7
  private static resolveIconUrlByFileId;
7
8
  private static buildAdminListWhere;
8
9
  private static createInitialPriceInTx;
9
10
  static listAssets(options?: AssetAdminListQueryOptions): Promise<{
10
11
  items: {
12
+ latestPrice: {
13
+ quoteAssetId: string;
14
+ quoteAsset: string;
15
+ price: string;
16
+ source: string;
17
+ effectiveAt: Date;
18
+ } | null;
11
19
  symbol: string | null;
12
20
  id: string;
13
21
  name: string;
@@ -34,6 +34,13 @@ export declare const assetUserItemResponseSchema: import("@sinclair/typebox").TO
34
34
  key: import("@sinclair/typebox").TString;
35
35
  isActive: import("@sinclair/typebox").TBoolean;
36
36
  }>, import("@sinclair/typebox").TNull]>;
37
+ latestPrice: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
38
+ quoteAssetId: import("@sinclair/typebox").TString;
39
+ quoteAsset: import("@sinclair/typebox").TString;
40
+ price: import("@sinclair/typebox").TString;
41
+ source: import("@sinclair/typebox").TString;
42
+ effectiveAt: import("@sinclair/typebox").TDate;
43
+ }>, import("@sinclair/typebox").TNull]>>;
37
44
  }>;
38
45
  export type AssetUserItemResponseType = typeof assetUserItemResponseSchema.static;
39
46
  export declare const assetUserIdParamsSchema: import("@sinclair/typebox").TObject<{
@@ -66,6 +73,13 @@ export declare const assetUserListResponseSchema: import("@sinclair/typebox").TO
66
73
  key: import("@sinclair/typebox").TString;
67
74
  isActive: import("@sinclair/typebox").TBoolean;
68
75
  }>, import("@sinclair/typebox").TNull]>;
76
+ latestPrice: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
77
+ quoteAssetId: import("@sinclair/typebox").TString;
78
+ quoteAsset: import("@sinclair/typebox").TString;
79
+ price: import("@sinclair/typebox").TString;
80
+ source: import("@sinclair/typebox").TString;
81
+ effectiveAt: import("@sinclair/typebox").TDate;
82
+ }>, import("@sinclair/typebox").TNull]>>;
69
83
  }>>;
70
84
  pagination: import("@sinclair/typebox").TObject<{
71
85
  pageSize: import("@sinclair/typebox").TNumber;
@@ -397,6 +397,13 @@ export declare const assetRouter: Elysia<"/assets", {
397
397
  response: {
398
398
  200: {
399
399
  data: {
400
+ latestPrice?: {
401
+ quoteAssetId: string;
402
+ quoteAsset: string;
403
+ price: string;
404
+ source: string;
405
+ effectiveAt: Date;
406
+ } | null | undefined;
400
407
  symbol: string | null;
401
408
  type: {
402
409
  id: string;
@@ -447,6 +454,13 @@ export declare const assetRouter: Elysia<"/assets", {
447
454
  headers: {};
448
455
  response: {
449
456
  200: {
457
+ latestPrice?: {
458
+ quoteAssetId: string;
459
+ quoteAsset: string;
460
+ price: string;
461
+ source: string;
462
+ effectiveAt: Date;
463
+ } | null | undefined;
450
464
  symbol: string | null;
451
465
  type: {
452
466
  id: string;
@@ -490,6 +504,13 @@ export declare const assetRouter: Elysia<"/assets", {
490
504
  headers: {};
491
505
  response: {
492
506
  200: {
507
+ latestPrice?: {
508
+ quoteAssetId: string;
509
+ quoteAsset: string;
510
+ price: string;
511
+ source: string;
512
+ effectiveAt: Date;
513
+ } | null | undefined;
493
514
  symbol: string | null;
494
515
  type: {
495
516
  id: string;
@@ -3,8 +3,16 @@ import { BaseAssetService } from '../internal/service';
3
3
  export interface AssetUserListQueryOptions extends AssetUserListQueryType {
4
4
  }
5
5
  export declare abstract class UserAssetService extends BaseAssetService {
6
+ private static getLatestPriceMapForAssets;
6
7
  static listAssets(options?: AssetUserListQueryOptions): Promise<{
7
8
  items: {
9
+ latestPrice: {
10
+ price: string;
11
+ source: string;
12
+ effectiveAt: Date;
13
+ quoteAssetId: string;
14
+ quoteAsset: string;
15
+ } | null;
8
16
  symbol: string | null;
9
17
  id: string;
10
18
  name: string;
@@ -366,14 +366,14 @@ export declare const assetConvertProductCreateSchema: import("@sinclair/typebox"
366
366
  corporate_credit: "corporate_credit";
367
367
  }>;
368
368
  targetAssetId: import("@sinclair/typebox").TString;
369
- payAssetId: import("@sinclair/typebox").TString;
370
- payAccountTypeId: import("@sinclair/typebox").TString;
371
- receiveAccountTypeId: import("@sinclair/typebox").TString;
369
+ payAssetId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
370
+ payAccountTypeId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
371
+ receiveAccountTypeId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
372
372
  minPayAmount: import("@sinclair/typebox").TString;
373
- settlementMode: import("@sinclair/typebox").TEnum<{
373
+ settlementMode: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<{
374
374
  available: "available";
375
375
  locked: "locked";
376
- }>;
376
+ }>>;
377
377
  status: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<{
378
378
  active: "active";
379
379
  draft: "draft";
@@ -386,16 +386,16 @@ export declare const assetConvertProductAdminRouter: Elysia<"/asset_convert_prod
386
386
  body: {
387
387
  description?: string | null | undefined;
388
388
  status?: "active" | "draft" | "paused" | "ended" | undefined;
389
+ payAssetId?: string | undefined;
390
+ payAccountTypeId?: string | undefined;
391
+ receiveAccountTypeId?: string | undefined;
392
+ settlementMode?: "available" | "locked" | undefined;
389
393
  allowPurchase?: boolean | undefined;
390
394
  isHot?: boolean | undefined;
391
395
  name: string;
392
396
  productCategoryKey: "gold" | "gov_bond" | "real_estate" | "corporate_credit";
393
397
  targetAssetId: string;
394
- payAssetId: string;
395
- payAccountTypeId: string;
396
- receiveAccountTypeId: string;
397
398
  minPayAmount: string;
398
- settlementMode: "available" | "locked";
399
399
  };
400
400
  params: {};
401
401
  query: {};
@@ -1,6 +1,9 @@
1
1
  import type { TransactionTx } from '../../db/transaction';
2
2
  import type { AssetConvertOrderListQueryType, AssetConvertOrderStatsQueryType, AssetConvertOrderStatsResponseType, AssetConvertProductCreateInputType, AssetConvertProductListQueryType, AssetConvertProductUpdateInputType } from './dto.schemas';
3
3
  export declare abstract class AdminAssetConvertProductService {
4
+ private static resolveDefaultPayAssetId;
5
+ private static resolveDefaultAccountTypeId;
6
+ private static resolveCreateInputDefaults;
4
7
  private static validateMinPayAmount;
5
8
  private static getProductById;
6
9
  private static mapProductResponse;
@@ -3,6 +3,7 @@ export * from './db.schemas';
3
3
  export * from './errors';
4
4
  export * from './internal/service';
5
5
  export * from './permissions';
6
+ export * from './seed';
6
7
  export * from './schema';
7
8
  export { assetConvertProductRouter } from './user/router';
8
9
  export * from './user/service';
@@ -0,0 +1 @@
1
+ export declare function seedAssetConvertProducts(): Promise<void>;
@@ -0,0 +1,7 @@
1
+ import type { CronTaskDefinition } from '../cron';
2
+ /**
3
+ * 资产价格历史清理任务
4
+ * - 按环境变量保留最近 N 个月数据
5
+ * - 每个 base/quote/source 组合至少保留 1 条最新记录
6
+ */
7
+ export declare const assetPriceCronTasks: CronTaskDefinition[];
@@ -11,4 +11,10 @@ export declare abstract class InternalAssetPriceService {
11
11
  source: string;
12
12
  effectiveAt: Date;
13
13
  }>;
14
+ static cleanupExpiredHistory(retentionMonths: number, now?: Date, batchSize?: number): Promise<{
15
+ deletedCount: number;
16
+ retentionMonths: number;
17
+ cutoffAt: Date;
18
+ batchSize: number;
19
+ }>;
14
20
  }
@@ -2,6 +2,7 @@ declare const _default: {
2
2
  TZ?: string | undefined;
3
3
  PGTZ?: string | undefined;
4
4
  LOG_LEVEL?: "debug" | "info" | "warn" | "error" | undefined;
5
+ ASSET_PRICE_RETENTION_MONTHS?: number | undefined;
5
6
  HTTP_ACCESS_LOG?: boolean | undefined;
6
7
  ALLOWED_ORIGINS?: string[] | undefined;
7
8
  FEATURE_FLAGS?: string[] | undefined;
package/dist/index.d.ts CHANGED
@@ -1298,6 +1298,13 @@ declare const app: Elysia<"/api", {
1298
1298
  response: {
1299
1299
  200: {
1300
1300
  data: {
1301
+ latestPrice?: {
1302
+ quoteAssetId: string;
1303
+ quoteAsset: string;
1304
+ price: string;
1305
+ source: string;
1306
+ effectiveAt: Date;
1307
+ } | null | undefined;
1301
1308
  symbol: string | null;
1302
1309
  type: {
1303
1310
  id: string;
@@ -1592,16 +1599,16 @@ declare const app: Elysia<"/api", {
1592
1599
  body: {
1593
1600
  description?: string | null | undefined;
1594
1601
  status?: "active" | "draft" | "paused" | "ended" | undefined;
1602
+ payAssetId?: string | undefined;
1603
+ payAccountTypeId?: string | undefined;
1604
+ receiveAccountTypeId?: string | undefined;
1605
+ settlementMode?: "available" | "locked" | undefined;
1595
1606
  allowPurchase?: boolean | undefined;
1596
1607
  isHot?: boolean | undefined;
1597
1608
  name: string;
1598
1609
  productCategoryKey: "gold" | "gov_bond" | "real_estate" | "corporate_credit";
1599
1610
  targetAssetId: string;
1600
- payAssetId: string;
1601
- payAccountTypeId: string;
1602
- receiveAccountTypeId: string;
1603
1611
  minPayAmount: string;
1604
- settlementMode: "available" | "locked";
1605
1612
  };
1606
1613
  params: {};
1607
1614
  query: {};
@@ -8343,16 +8350,16 @@ declare const app: Elysia<"/api", {
8343
8350
  body: {
8344
8351
  description?: string | null | undefined;
8345
8352
  status?: "active" | "draft" | "paused" | "ended" | undefined;
8353
+ pricingAssetId?: string | undefined;
8354
+ sourcePricingAccountTypeId?: string | undefined;
8355
+ dailyPayoutAccountTypeId?: string | undefined;
8356
+ maturitySettlementAccountTypeId?: string | undefined;
8346
8357
  minShares?: number | undefined;
8347
8358
  maxSharesPerOrder?: number | null | undefined;
8348
8359
  saleStartAt?: Date | null | undefined;
8349
8360
  saleEndAt?: Date | null | undefined;
8350
8361
  name: string;
8351
8362
  rightsAssetId: string;
8352
- pricingAssetId: string;
8353
- sourcePricingAccountTypeId: string;
8354
- dailyPayoutAccountTypeId: string;
8355
- maturitySettlementAccountTypeId: string;
8356
8363
  pricePerShare: string;
8357
8364
  rightsPerShare: string;
8358
8365
  cycleDays: number;
@@ -11061,6 +11068,13 @@ declare const app: Elysia<"/api", {
11061
11068
  response: {
11062
11069
  200: {
11063
11070
  data: {
11071
+ latestPrice?: {
11072
+ quoteAssetId: string;
11073
+ quoteAsset: string;
11074
+ price: string;
11075
+ source: string;
11076
+ effectiveAt: Date;
11077
+ } | null | undefined;
11064
11078
  symbol: string | null;
11065
11079
  type: {
11066
11080
  id: string;
@@ -11111,6 +11125,13 @@ declare const app: Elysia<"/api", {
11111
11125
  headers: {};
11112
11126
  response: {
11113
11127
  200: {
11128
+ latestPrice?: {
11129
+ quoteAssetId: string;
11130
+ quoteAsset: string;
11131
+ price: string;
11132
+ source: string;
11133
+ effectiveAt: Date;
11134
+ } | null | undefined;
11114
11135
  symbol: string | null;
11115
11136
  type: {
11116
11137
  id: string;
@@ -11154,6 +11175,13 @@ declare const app: Elysia<"/api", {
11154
11175
  headers: {};
11155
11176
  response: {
11156
11177
  200: {
11178
+ latestPrice?: {
11179
+ quoteAssetId: string;
11180
+ quoteAsset: string;
11181
+ price: string;
11182
+ source: string;
11183
+ effectiveAt: Date;
11184
+ } | null | undefined;
11157
11185
  symbol: string | null;
11158
11186
  type: {
11159
11187
  id: string;
@@ -12,10 +12,6 @@ export declare const welfareCyclePlanCreateSchema: import("@sinclair/typebox").T
12
12
  ended: "ended";
13
13
  }>>;
14
14
  rightsAssetId: import("@sinclair/typebox").TString;
15
- pricingAssetId: import("@sinclair/typebox").TString;
16
- sourcePricingAccountTypeId: import("@sinclair/typebox").TString;
17
- dailyPayoutAccountTypeId: import("@sinclair/typebox").TString;
18
- maturitySettlementAccountTypeId: import("@sinclair/typebox").TString;
19
15
  pricePerShare: import("@sinclair/typebox").TString;
20
16
  rightsPerShare: import("@sinclair/typebox").TString;
21
17
  cycleDays: import("@sinclair/typebox").TInteger;
@@ -25,6 +21,10 @@ export declare const welfareCyclePlanCreateSchema: import("@sinclair/typebox").T
25
21
  maxSharesPerOrder: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TInteger, import("@sinclair/typebox").TNull]>>;
26
22
  saleStartAt: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TNull]>>;
27
23
  saleEndAt: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TNull]>>;
24
+ pricingAssetId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
25
+ sourcePricingAccountTypeId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
26
+ dailyPayoutAccountTypeId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
27
+ maturitySettlementAccountTypeId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
28
28
  coverImageFileId: import("@sinclair/typebox").TString;
29
29
  }>;
30
30
  export type WelfareCyclePlanCreateInputType = typeof welfareCyclePlanCreateSchema.static;
@@ -386,16 +386,16 @@ export declare const welfareCycleAdminRouter: Elysia<"/welfare_cycle", {
386
386
  body: {
387
387
  description?: string | null | undefined;
388
388
  status?: "active" | "draft" | "paused" | "ended" | undefined;
389
+ pricingAssetId?: string | undefined;
390
+ sourcePricingAccountTypeId?: string | undefined;
391
+ dailyPayoutAccountTypeId?: string | undefined;
392
+ maturitySettlementAccountTypeId?: string | undefined;
389
393
  minShares?: number | undefined;
390
394
  maxSharesPerOrder?: number | null | undefined;
391
395
  saleStartAt?: Date | null | undefined;
392
396
  saleEndAt?: Date | null | undefined;
393
397
  name: string;
394
398
  rightsAssetId: string;
395
- pricingAssetId: string;
396
- sourcePricingAccountTypeId: string;
397
- dailyPayoutAccountTypeId: string;
398
- maturitySettlementAccountTypeId: string;
399
399
  pricePerShare: string;
400
400
  rightsPerShare: string;
401
401
  cycleDays: number;
@@ -1,5 +1,8 @@
1
1
  import type { WelfareCycleDailyPayoutListQueryType, WelfareCycleMaturitySettlementListQueryType, WelfareCyclePlanCreateInputType, WelfareCyclePlanListQueryType, WelfareCyclePlanUpdateInputType, WelfareCycleRunDailyPayoutInputType, WelfareCycleRunMaturitySettlementInputType, WelfareCycleSubscriptionListQueryType } from './dto.schemas';
2
2
  export declare abstract class AdminWelfareCycleService {
3
+ private static resolveDefaultPricingAssetId;
4
+ private static resolveDefaultAccountTypeId;
5
+ private static resolvePlanReferenceDefaults;
3
6
  private static resolveCoverImageUrlByFileId;
4
7
  private static mapDailyPayoutResponse;
5
8
  private static mapMaturitySettlementResponse;
@@ -3,5 +3,6 @@ export * from './db.schemas';
3
3
  export * from './internal/service';
4
4
  export * from './permissions';
5
5
  export * from './schema';
6
+ export * from './seed';
6
7
  export { welfareCycleRouter } from './user/router';
7
8
  export * from './user/service';
@@ -0,0 +1 @@
1
+ export declare function seedWelfareCyclePlans(): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r2wa-org/eden",
3
- "version": "0.0.80",
3
+ "version": "0.0.82",
4
4
  "description": "Elysia API type definitions for Eden Treaty",
5
5
  "files": [
6
6
  "dist"