@r2wa-org/eden 0.0.66 → 0.0.68

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,200 +1,82 @@
1
- import { InternalAssetPriceService } from "../internal/service";
2
1
  import type { AssetPriceAdminCreateInputType, AssetPriceAdminListQueryType } from "./dto.schemas";
3
- export declare abstract class AdminAssetPriceService extends InternalAssetPriceService {
4
- private static toAdminResponse;
2
+ export declare abstract class AdminAssetPriceService {
5
3
  static listAssetPrices(query?: AssetPriceAdminListQueryType): Promise<{
6
4
  items: {
7
- baseAssetInfo: {
8
- id: string;
9
- code: string;
10
- name: string;
11
- symbol: string;
12
- precision: number;
13
- category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
14
- isActive: boolean;
15
- };
16
- quoteAssetInfo: {
17
- id: string;
18
- code: string;
19
- name: string;
20
- symbol: string;
21
- precision: number;
22
- category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
23
- isActive: boolean;
24
- };
25
5
  id: string;
26
- createdAt: Date;
27
- updatedAt: Date;
28
6
  baseAssetId: string;
29
7
  baseAsset: string;
30
- quoteAssetId: string;
31
- quoteAsset: string;
32
8
  price: string;
33
9
  source: string;
34
10
  effectiveAt: Date;
11
+ createdAt: Date;
12
+ updatedAt: Date;
35
13
  baseAssetEntity: {
36
- id: string;
37
- code: string;
38
- name: string;
39
14
  symbol: string;
40
- precision: number;
41
- category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
42
- isActive: boolean;
43
- } | null;
44
- quoteAssetEntity: {
45
15
  id: string;
46
- code: string;
47
16
  name: string;
48
- symbol: string;
49
- precision: number;
17
+ code: string;
50
18
  category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
51
19
  isActive: boolean;
52
- } | null;
20
+ precision: number;
21
+ };
53
22
  }[];
54
23
  total: number;
55
24
  }>;
56
- static getAssetPriceById(id: string): Promise<{
57
- baseAssetInfo: {
58
- id: string;
59
- code: string;
60
- name: string;
61
- symbol: string;
62
- precision: number;
63
- category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
64
- isActive: boolean;
65
- };
66
- quoteAssetInfo: {
67
- id: string;
68
- code: string;
69
- name: string;
70
- symbol: string;
71
- precision: number;
72
- category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
73
- isActive: boolean;
74
- };
25
+ static getLatestAssetPrice(baseAsset: string): Promise<{
75
26
  id: string;
76
- createdAt: Date;
77
- updatedAt: Date;
78
27
  baseAssetId: string;
79
28
  baseAsset: string;
80
- quoteAssetId: string;
81
- quoteAsset: string;
82
29
  price: string;
83
30
  source: string;
84
31
  effectiveAt: Date;
32
+ createdAt: Date;
33
+ updatedAt: Date;
85
34
  baseAssetEntity: {
86
- id: string;
87
- code: string;
88
- name: string;
89
35
  symbol: string;
90
- precision: number;
91
- category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
92
- isActive: boolean;
93
- } | null;
94
- quoteAssetEntity: {
95
36
  id: string;
96
- code: string;
97
37
  name: string;
98
- symbol: string;
99
- precision: number;
100
- category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
101
- isActive: boolean;
102
- } | null;
103
- }>;
104
- static getLatestAssetPrice(baseAsset: string, quoteAsset: string): Promise<{
105
- baseAssetInfo: {
106
- id: string;
107
38
  code: string;
108
- name: string;
109
- symbol: string;
110
- precision: number;
111
39
  category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
112
40
  isActive: boolean;
113
- };
114
- quoteAssetInfo: {
115
- id: string;
116
- code: string;
117
- name: string;
118
- symbol: string;
119
41
  precision: number;
120
- category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
121
- isActive: boolean;
122
42
  };
43
+ }>;
44
+ static getAssetPriceById(id: string): Promise<{
123
45
  id: string;
124
- createdAt: Date;
125
- updatedAt: Date;
126
46
  baseAssetId: string;
127
47
  baseAsset: string;
128
- quoteAssetId: string;
129
- quoteAsset: string;
130
48
  price: string;
131
49
  source: string;
132
50
  effectiveAt: Date;
51
+ createdAt: Date;
52
+ updatedAt: Date;
133
53
  baseAssetEntity: {
134
- id: string;
135
- code: string;
136
- name: string;
137
54
  symbol: string;
138
- precision: number;
139
- category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
140
- isActive: boolean;
141
- } | null;
142
- quoteAssetEntity: {
143
55
  id: string;
144
- code: string;
145
56
  name: string;
146
- symbol: string;
147
- precision: number;
148
- category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
149
- isActive: boolean;
150
- } | null;
151
- }>;
152
- static createAssetPrice(input: AssetPriceAdminCreateInputType): Promise<{
153
- baseAssetInfo: {
154
- id: string;
155
57
  code: string;
156
- name: string;
157
- symbol: string;
158
- precision: number;
159
58
  category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
160
59
  isActive: boolean;
161
- };
162
- quoteAssetInfo: {
163
- id: string;
164
- code: string;
165
- name: string;
166
- symbol: string;
167
60
  precision: number;
168
- category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
169
- isActive: boolean;
170
61
  };
62
+ }>;
63
+ static createAssetPrice(input: AssetPriceAdminCreateInputType): Promise<{
171
64
  id: string;
172
- createdAt: Date;
173
- updatedAt: Date;
174
65
  baseAssetId: string;
175
66
  baseAsset: string;
176
- quoteAssetId: string;
177
- quoteAsset: string;
178
67
  price: string;
179
68
  source: string;
180
69
  effectiveAt: Date;
70
+ createdAt: Date;
71
+ updatedAt: Date;
181
72
  baseAssetEntity: {
182
- id: string;
183
- code: string;
184
- name: string;
185
73
  symbol: string;
186
- precision: number;
187
- category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
188
- isActive: boolean;
189
- } | null;
190
- quoteAssetEntity: {
191
74
  id: string;
192
- code: string;
193
75
  name: string;
194
- symbol: string;
195
- precision: number;
76
+ code: string;
196
77
  category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
197
78
  isActive: boolean;
198
- } | null;
79
+ precision: number;
80
+ };
199
81
  }>;
200
82
  }
@@ -0,0 +1,2 @@
1
+ export declare const ASSET_PRICE_MAIN_ANCHOR_ASSET: "CNY";
2
+ export declare const ASSET_PRICE_DEFAULT_SOURCE: "ADMIN_PANEL";
@@ -2,6 +2,7 @@ export * from "./locales/zh";
2
2
  export declare const AssetPriceErrorCodes: {
3
3
  readonly ASSET_PRICE_BASE_ASSET_REQUIRED: "ASSET_PRICE_BASE_ASSET_REQUIRED";
4
4
  readonly ASSET_PRICE_QUOTE_ASSET_REQUIRED: "ASSET_PRICE_QUOTE_ASSET_REQUIRED";
5
+ readonly ASSET_PRICE_QUOTE_ASSET_MUST_BE_CNY: "ASSET_PRICE_QUOTE_ASSET_MUST_BE_CNY";
5
6
  readonly ASSET_PRICE_ASSET_NOT_FOUND: "ASSET_PRICE_ASSET_NOT_FOUND";
6
7
  readonly ASSET_PRICE_PAIR_INVALID: "ASSET_PRICE_PAIR_INVALID";
7
8
  readonly ASSET_PRICE_VALUE_INVALID: "ASSET_PRICE_VALUE_INVALID";
@@ -1,6 +1,7 @@
1
1
  export declare const zh: {
2
2
  ASSET_PRICE_BASE_ASSET_REQUIRED: string;
3
3
  ASSET_PRICE_QUOTE_ASSET_REQUIRED: string;
4
+ ASSET_PRICE_QUOTE_ASSET_MUST_BE_CNY: string;
4
5
  ASSET_PRICE_ASSET_NOT_FOUND: string;
5
6
  ASSET_PRICE_PAIR_INVALID: string;
6
7
  ASSET_PRICE_VALUE_INVALID: string;
@@ -1,5 +1,6 @@
1
1
  export * from "./admin/dto.schemas";
2
2
  export * from "./admin/service";
3
+ export * from "./constants";
3
4
  export * from "./db.schemas";
4
5
  export * from "./errors";
5
6
  export * from "./internal/service";
@@ -1,45 +1,5 @@
1
- import type { AssetPriceAdminCreateInputType, AssetPriceAdminListQueryType } from "../admin/dto.schemas";
2
- declare abstract class BaseAssetPriceService {
3
- protected static isUniqueViolationError(error: unknown): boolean;
4
- protected static normalizeBaseAsset(baseAsset: string): string;
5
- protected static normalizeQuoteAsset(quoteAsset: string): string;
6
- protected static validatePair(baseAsset: string, quoteAsset: string): void;
7
- protected static getActiveAssetByCode(code: string): Promise<{
8
- id: string;
9
- code: string;
10
- }>;
11
- protected static validatePrice(price: string): string;
12
- protected static buildWhere(query?: AssetPriceAdminListQueryType): import("drizzle-orm").SQL<unknown> | undefined;
13
- }
14
- export declare abstract class InternalAssetPriceService extends BaseAssetPriceService {
15
- static getLatestPrice(baseAsset: string, quoteAsset: string): Promise<{
16
- id: string;
17
- createdAt: Date;
18
- updatedAt: Date;
19
- baseAssetId: string;
20
- baseAsset: string;
21
- quoteAssetId: string;
22
- quoteAsset: string;
23
- price: string;
24
- source: string;
25
- effectiveAt: Date;
26
- }>;
27
- static listPrices(query?: AssetPriceAdminListQueryType): Promise<{
28
- items: {
29
- id: string;
30
- createdAt: Date;
31
- updatedAt: Date;
32
- baseAssetId: string;
33
- baseAsset: string;
34
- quoteAssetId: string;
35
- quoteAsset: string;
36
- price: string;
37
- source: string;
38
- effectiveAt: Date;
39
- }[];
40
- total: number;
41
- }>;
42
- static createPrice(input: AssetPriceAdminCreateInputType): Promise<{
1
+ export declare abstract class InternalAssetPriceService {
2
+ static getLatestPrice(baseAsset: string): Promise<{
43
3
  id: string;
44
4
  createdAt: Date;
45
5
  updatedAt: Date;
@@ -52,4 +12,3 @@ export declare abstract class InternalAssetPriceService extends BaseAssetPriceSe
52
12
  effectiveAt: Date;
53
13
  }>;
54
14
  }
55
- export {};