@r2wa-org/eden 0.0.81 → 0.0.83

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;
@@ -6867,6 +6874,18 @@ export declare const adminRouter: Elysia<"/admin", {
6867
6874
  dailyUserBuyBaseLimit: string | null;
6868
6875
  dailyUserSellBaseLimit: string | null;
6869
6876
  maxSlippageBps: string;
6877
+ latestPrice: {
6878
+ id: string;
6879
+ createdAt: Date;
6880
+ updatedAt: Date;
6881
+ baseAssetId: string;
6882
+ baseAsset: string;
6883
+ quoteAssetId: string;
6884
+ quoteAsset: string;
6885
+ price: string;
6886
+ source: string;
6887
+ effectiveAt: Date;
6888
+ } | null;
6870
6889
  }[];
6871
6890
  pagination: {
6872
6891
  total: number;
@@ -8020,16 +8039,16 @@ export declare const adminRouter: Elysia<"/admin", {
8020
8039
  body: {
8021
8040
  description?: string | null | undefined;
8022
8041
  status?: "active" | "draft" | "paused" | "ended" | undefined;
8042
+ pricingAssetId?: string | undefined;
8043
+ sourcePricingAccountTypeId?: string | undefined;
8044
+ dailyPayoutAccountTypeId?: string | undefined;
8045
+ maturitySettlementAccountTypeId?: string | undefined;
8023
8046
  minShares?: number | undefined;
8024
8047
  maxSharesPerOrder?: number | null | undefined;
8025
8048
  saleStartAt?: Date | null | undefined;
8026
8049
  saleEndAt?: Date | null | undefined;
8027
8050
  name: string;
8028
8051
  rightsAssetId: string;
8029
- pricingAssetId: string;
8030
- sourcePricingAccountTypeId: string;
8031
- dailyPayoutAccountTypeId: string;
8032
- maturitySettlementAccountTypeId: string;
8033
8052
  pricePerShare: string;
8034
8053
  rightsPerShare: string;
8035
8054
  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;
@@ -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;
@@ -7190,6 +7197,18 @@ declare const app: Elysia<"/api", {
7190
7197
  dailyUserBuyBaseLimit: string | null;
7191
7198
  dailyUserSellBaseLimit: string | null;
7192
7199
  maxSlippageBps: string;
7200
+ latestPrice: {
7201
+ id: string;
7202
+ createdAt: Date;
7203
+ updatedAt: Date;
7204
+ baseAssetId: string;
7205
+ baseAsset: string;
7206
+ quoteAssetId: string;
7207
+ quoteAsset: string;
7208
+ price: string;
7209
+ source: string;
7210
+ effectiveAt: Date;
7211
+ } | null;
7193
7212
  }[];
7194
7213
  pagination: {
7195
7214
  total: number;
@@ -8343,16 +8362,16 @@ declare const app: Elysia<"/api", {
8343
8362
  body: {
8344
8363
  description?: string | null | undefined;
8345
8364
  status?: "active" | "draft" | "paused" | "ended" | undefined;
8365
+ pricingAssetId?: string | undefined;
8366
+ sourcePricingAccountTypeId?: string | undefined;
8367
+ dailyPayoutAccountTypeId?: string | undefined;
8368
+ maturitySettlementAccountTypeId?: string | undefined;
8346
8369
  minShares?: number | undefined;
8347
8370
  maxSharesPerOrder?: number | null | undefined;
8348
8371
  saleStartAt?: Date | null | undefined;
8349
8372
  saleEndAt?: Date | null | undefined;
8350
8373
  name: string;
8351
8374
  rightsAssetId: string;
8352
- pricingAssetId: string;
8353
- sourcePricingAccountTypeId: string;
8354
- dailyPayoutAccountTypeId: string;
8355
- maturitySettlementAccountTypeId: string;
8356
8375
  pricePerShare: string;
8357
8376
  rightsPerShare: string;
8358
8377
  cycleDays: number;
@@ -11061,6 +11080,13 @@ declare const app: Elysia<"/api", {
11061
11080
  response: {
11062
11081
  200: {
11063
11082
  data: {
11083
+ latestPrice?: {
11084
+ quoteAssetId: string;
11085
+ quoteAsset: string;
11086
+ price: string;
11087
+ source: string;
11088
+ effectiveAt: Date;
11089
+ } | null | undefined;
11064
11090
  symbol: string | null;
11065
11091
  type: {
11066
11092
  id: string;
@@ -11111,6 +11137,13 @@ declare const app: Elysia<"/api", {
11111
11137
  headers: {};
11112
11138
  response: {
11113
11139
  200: {
11140
+ latestPrice?: {
11141
+ quoteAssetId: string;
11142
+ quoteAsset: string;
11143
+ price: string;
11144
+ source: string;
11145
+ effectiveAt: Date;
11146
+ } | null | undefined;
11114
11147
  symbol: string | null;
11115
11148
  type: {
11116
11149
  id: string;
@@ -11154,6 +11187,13 @@ declare const app: Elysia<"/api", {
11154
11187
  headers: {};
11155
11188
  response: {
11156
11189
  200: {
11190
+ latestPrice?: {
11191
+ quoteAssetId: string;
11192
+ quoteAsset: string;
11193
+ price: string;
11194
+ source: string;
11195
+ effectiveAt: Date;
11196
+ } | null | undefined;
11157
11197
  symbol: string | null;
11158
11198
  type: {
11159
11199
  id: string;
@@ -12807,11 +12847,27 @@ declare const app: Elysia<"/api", {
12807
12847
  data: {
12808
12848
  id: string;
12809
12849
  name: string;
12810
- createdAt: Date;
12811
- updatedAt: Date;
12812
12850
  status: "active" | "draft" | "paused" | "ended";
12813
12851
  baseAssetId: string;
12852
+ baseAsset: {
12853
+ symbol: string | null;
12854
+ id: string;
12855
+ name: string;
12856
+ code: string;
12857
+ category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
12858
+ isActive: boolean;
12859
+ precision: number;
12860
+ };
12814
12861
  quoteAssetId: string;
12862
+ quoteAsset: {
12863
+ symbol: string | null;
12864
+ id: string;
12865
+ name: string;
12866
+ code: string;
12867
+ category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
12868
+ isActive: boolean;
12869
+ precision: number;
12870
+ };
12815
12871
  isBuyEnabled: boolean;
12816
12872
  isSellEnabled: boolean;
12817
12873
  minBaseAmount: string;
@@ -12819,6 +12875,10 @@ declare const app: Elysia<"/api", {
12819
12875
  dailyUserBuyBaseLimit: string | null;
12820
12876
  dailyUserSellBaseLimit: string | null;
12821
12877
  maxSlippageBps: string;
12878
+ latestPrice: {
12879
+ price: string;
12880
+ effectiveAt: Date;
12881
+ } | null;
12822
12882
  }[];
12823
12883
  pagination: {
12824
12884
  total: number;
@@ -12857,11 +12917,27 @@ declare const app: Elysia<"/api", {
12857
12917
  200: {
12858
12918
  id: string;
12859
12919
  name: string;
12860
- createdAt: Date;
12861
- updatedAt: Date;
12862
12920
  status: "active" | "draft" | "paused" | "ended";
12863
12921
  baseAssetId: string;
12922
+ baseAsset: {
12923
+ symbol: string | null;
12924
+ id: string;
12925
+ name: string;
12926
+ code: string;
12927
+ category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
12928
+ isActive: boolean;
12929
+ precision: number;
12930
+ };
12864
12931
  quoteAssetId: string;
12932
+ quoteAsset: {
12933
+ symbol: string | null;
12934
+ id: string;
12935
+ name: string;
12936
+ code: string;
12937
+ category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
12938
+ isActive: boolean;
12939
+ precision: number;
12940
+ };
12865
12941
  isBuyEnabled: boolean;
12866
12942
  isSellEnabled: boolean;
12867
12943
  minBaseAmount: string;
@@ -12869,6 +12945,10 @@ declare const app: Elysia<"/api", {
12869
12945
  dailyUserBuyBaseLimit: string | null;
12870
12946
  dailyUserSellBaseLimit: string | null;
12871
12947
  maxSlippageBps: string;
12948
+ latestPrice: {
12949
+ price: string;
12950
+ effectiveAt: Date;
12951
+ } | null;
12872
12952
  };
12873
12953
  401: "Unauthorized";
12874
12954
  422: {