@r2wa-org/eden 0.0.57 → 0.0.59

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.
@@ -6,6 +6,7 @@ export declare const assetUserListQuerySchema: import("@sinclair/typebox").TObje
6
6
  RWA: "RWA";
7
7
  }>>;
8
8
  isActive: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
9
+ typeId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
9
10
  limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
10
11
  offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
11
12
  pageSize: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
@@ -36,6 +37,14 @@ export declare const assetUserItemResponseSchema: import("@sinclair/typebox").TO
36
37
  }>;
37
38
  }>;
38
39
  export type AssetUserItemResponseType = typeof assetUserItemResponseSchema.static;
40
+ export declare const assetUserIdParamsSchema: import("@sinclair/typebox").TObject<{
41
+ id: import("@sinclair/typebox").TString;
42
+ }>;
43
+ export type AssetUserIdParamsType = typeof assetUserIdParamsSchema.static;
44
+ export declare const assetUserCodeParamsSchema: import("@sinclair/typebox").TObject<{
45
+ code: import("@sinclair/typebox").TString;
46
+ }>;
47
+ export type AssetUserCodeParamsType = typeof assetUserCodeParamsSchema.static;
39
48
  export declare const assetUserListResponseSchema: import("@sinclair/typebox").TObject<{
40
49
  data: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
41
50
  symbol: import("@sinclair/typebox").TString;
@@ -69,86 +78,3 @@ export declare const assetUserListResponseSchema: import("@sinclair/typebox").TO
69
78
  }>;
70
79
  }>;
71
80
  export type AssetUserListResponseType = typeof assetUserListResponseSchema.static;
72
- export declare const assetHoldingListQuerySchema: import("@sinclair/typebox").TObject<{
73
- quoteAsset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
74
- walletId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
75
- ledgerAccountId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
76
- }>;
77
- export type AssetHoldingListQueryType = typeof assetHoldingListQuerySchema.static;
78
- export declare const assetHoldingItemSchema: import("@sinclair/typebox").TObject<{
79
- assetId: import("@sinclair/typebox").TString;
80
- assetCode: import("@sinclair/typebox").TString;
81
- assetName: import("@sinclair/typebox").TString;
82
- quantity: import("@sinclair/typebox").TString;
83
- totalValuation: import("@sinclair/typebox").TString;
84
- }>;
85
- export type AssetHoldingItemType = typeof assetHoldingItemSchema.static;
86
- export declare const assetHoldingListResponseSchema: import("@sinclair/typebox").TObject<{
87
- quoteAsset: import("@sinclair/typebox").TString;
88
- items: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
89
- assetId: import("@sinclair/typebox").TString;
90
- assetCode: import("@sinclair/typebox").TString;
91
- assetName: import("@sinclair/typebox").TString;
92
- quantity: import("@sinclair/typebox").TString;
93
- totalValuation: import("@sinclair/typebox").TString;
94
- }>>;
95
- }>;
96
- export type AssetHoldingListResponseType = typeof assetHoldingListResponseSchema.static;
97
- export declare const assetOverviewParamsSchema: import("@sinclair/typebox").TObject<{
98
- assetId: import("@sinclair/typebox").TString;
99
- }>;
100
- export type AssetOverviewParamsType = typeof assetOverviewParamsSchema.static;
101
- export declare const assetOverviewQuerySchema: import("@sinclair/typebox").TObject<{
102
- quoteAsset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
103
- days: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
104
- }>;
105
- export type AssetOverviewQueryType = typeof assetOverviewQuerySchema.static;
106
- export declare const assetOverviewCurveItemSchema: import("@sinclair/typebox").TObject<{
107
- at: import("@sinclair/typebox").TDate;
108
- value: import("@sinclair/typebox").TString;
109
- }>;
110
- export type AssetOverviewCurveItemType = typeof assetOverviewCurveItemSchema.static;
111
- export declare const assetOverviewAccountDistributionItemSchema: import("@sinclair/typebox").TObject<{
112
- ledgerAccountId: import("@sinclair/typebox").TString;
113
- ledgerAccountTypeId: import("@sinclair/typebox").TString;
114
- ledgerAccountTypeKey: import("@sinclair/typebox").TString;
115
- ledgerAccountTypeName: import("@sinclair/typebox").TString;
116
- quantity: import("@sinclair/typebox").TString;
117
- valuation: import("@sinclair/typebox").TString;
118
- proportion: import("@sinclair/typebox").TString;
119
- }>;
120
- export type AssetOverviewAccountDistributionItemType = typeof assetOverviewAccountDistributionItemSchema.static;
121
- export declare const assetOverviewResponseSchema: import("@sinclair/typebox").TObject<{
122
- quoteAsset: import("@sinclair/typebox").TString;
123
- asset: import("@sinclair/typebox").TObject<{
124
- symbol: import("@sinclair/typebox").TString;
125
- id: import("@sinclair/typebox").TString;
126
- name: import("@sinclair/typebox").TString;
127
- code: import("@sinclair/typebox").TString;
128
- iconUrl: import("@sinclair/typebox").TString;
129
- category: import("@sinclair/typebox").TEnum<{
130
- FIAT: "FIAT";
131
- CRYPTO: "CRYPTO";
132
- POINT: "POINT";
133
- RWA: "RWA";
134
- }>;
135
- isActive: import("@sinclair/typebox").TBoolean;
136
- precision: import("@sinclair/typebox").TInteger;
137
- }>;
138
- quantity: import("@sinclair/typebox").TString;
139
- totalValuation: import("@sinclair/typebox").TString;
140
- curve: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
141
- at: import("@sinclair/typebox").TDate;
142
- value: import("@sinclair/typebox").TString;
143
- }>>;
144
- accountDistribution: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
145
- ledgerAccountId: import("@sinclair/typebox").TString;
146
- ledgerAccountTypeId: import("@sinclair/typebox").TString;
147
- ledgerAccountTypeKey: import("@sinclair/typebox").TString;
148
- ledgerAccountTypeName: import("@sinclair/typebox").TString;
149
- quantity: import("@sinclair/typebox").TString;
150
- valuation: import("@sinclair/typebox").TString;
151
- proportion: import("@sinclair/typebox").TString;
152
- }>>;
153
- }>;
154
- export type AssetOverviewResponseType = typeof assetOverviewResponseSchema.static;
@@ -387,6 +387,7 @@ export declare const assetRouter: Elysia<"/assets", {
387
387
  query: {
388
388
  category?: "FIAT" | "CRYPTO" | "POINT" | "RWA" | undefined;
389
389
  isActive?: boolean | undefined;
390
+ typeId?: string | undefined;
390
391
  limit?: number | undefined;
391
392
  offset?: number | undefined;
392
393
  pageSize?: number | undefined;
@@ -436,83 +437,33 @@ export declare const assetRouter: Elysia<"/assets", {
436
437
  };
437
438
  } & {
438
439
  assets: {
439
- holdings: {
440
- get: {
441
- body: {};
442
- params: {};
443
- query: {
444
- quoteAsset?: string | undefined;
445
- ledgerAccountId?: string | undefined;
446
- walletId?: string | undefined;
447
- };
448
- headers: {};
449
- response: {
450
- 200: {
451
- items: {
452
- assetId: string;
453
- assetCode: string;
454
- totalValuation: string;
455
- assetName: string;
456
- quantity: string;
457
- }[];
458
- quoteAsset: string;
459
- };
460
- 422: {
461
- type: "validation";
462
- on: string;
463
- summary?: string;
464
- message?: string;
465
- found?: unknown;
466
- property?: string;
467
- expected?: string;
468
- };
469
- 401: "Unauthorized";
470
- };
471
- };
472
- };
473
- };
474
- } & {
475
- assets: {
476
- ":assetId": {
477
- overview: {
440
+ code: {
441
+ ":code": {
478
442
  get: {
479
443
  body: {};
480
444
  params: {
481
- assetId: string;
482
- };
483
- query: {
484
- quoteAsset?: string | undefined;
485
- days?: number | undefined;
445
+ code: string;
486
446
  };
447
+ query: {};
487
448
  headers: {};
488
449
  response: {
489
450
  200: {
490
- asset: {
491
- symbol: string;
451
+ symbol: string;
452
+ type: {
492
453
  id: string;
493
454
  name: string;
494
- code: string;
495
- iconUrl: string;
496
- category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
455
+ key: string;
456
+ isGasAsset: boolean;
497
457
  isActive: boolean;
498
- precision: number;
499
458
  };
500
- quoteAsset: string;
501
- totalValuation: string;
502
- quantity: string;
503
- curve: {
504
- at: Date;
505
- value: string;
506
- }[];
507
- accountDistribution: {
508
- ledgerAccountTypeId: string;
509
- ledgerAccountId: string;
510
- quantity: string;
511
- ledgerAccountTypeKey: string;
512
- ledgerAccountTypeName: string;
513
- valuation: string;
514
- proportion: string;
515
- }[];
459
+ id: string;
460
+ name: string;
461
+ code: string;
462
+ iconUrl: string;
463
+ category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
464
+ isActive: boolean;
465
+ typeId: string;
466
+ precision: number;
516
467
  };
517
468
  422: {
518
469
  type: "validation";
@@ -529,6 +480,49 @@ export declare const assetRouter: Elysia<"/assets", {
529
480
  };
530
481
  };
531
482
  };
483
+ } & {
484
+ assets: {
485
+ ":id": {
486
+ get: {
487
+ body: {};
488
+ params: {
489
+ id: string;
490
+ };
491
+ query: {};
492
+ headers: {};
493
+ response: {
494
+ 200: {
495
+ symbol: string;
496
+ type: {
497
+ id: string;
498
+ name: string;
499
+ key: string;
500
+ isGasAsset: boolean;
501
+ isActive: boolean;
502
+ };
503
+ id: string;
504
+ name: string;
505
+ code: string;
506
+ iconUrl: string;
507
+ category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
508
+ isActive: boolean;
509
+ typeId: string;
510
+ precision: number;
511
+ };
512
+ 422: {
513
+ type: "validation";
514
+ on: string;
515
+ summary?: string;
516
+ message?: string;
517
+ found?: unknown;
518
+ property?: string;
519
+ expected?: string;
520
+ };
521
+ 401: "Unauthorized";
522
+ };
523
+ };
524
+ };
525
+ };
532
526
  }, {
533
527
  derive: {};
534
528
  resolve: {};
@@ -1,5 +1,5 @@
1
1
  import { BaseAssetService } from "../internal/service";
2
- import type { AssetHoldingListQueryType, AssetOverviewParamsType, AssetOverviewQueryType, AssetUserListQueryType } from "./dto.schemas";
2
+ import type { AssetUserCodeParamsType, AssetUserIdParamsType, AssetUserListQueryType } from "./dto.schemas";
3
3
  export interface AssetUserListQueryOptions extends AssetUserListQueryType {
4
4
  }
5
5
  export declare abstract class UserAssetService extends BaseAssetService {
@@ -29,50 +29,50 @@ export declare abstract class UserAssetService extends BaseAssetService {
29
29
  }[];
30
30
  total: number;
31
31
  }>;
32
- private static normalizeQuoteAsset;
33
- private static toDecimal;
34
- private static createCurvePoints;
35
- private static getLatestPriceMapForAssets;
36
- private static getPriceRowsForAsset;
37
- private static pickLatestPriceAt;
38
- private static getQuoteAssetEntity;
39
- private static resolveFilteredAccountRows;
40
- static listAssetHoldings(userId: string, query?: AssetHoldingListQueryType): Promise<{
41
- quoteAsset: string;
42
- items: {
43
- assetId: string;
44
- assetCode: string;
45
- assetName: string;
46
- quantity: string;
47
- totalValuation: string;
48
- }[];
32
+ static getAssetById(params: AssetUserIdParamsType): Promise<{
33
+ symbol: string;
34
+ id: string;
35
+ name: string;
36
+ createdAt: Date;
37
+ updatedAt: Date;
38
+ code: string;
39
+ iconUrl: string;
40
+ category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
41
+ isActive: boolean;
42
+ typeId: string;
43
+ precision: number;
44
+ type: {
45
+ id: string;
46
+ name: string;
47
+ createdAt: Date;
48
+ updatedAt: Date;
49
+ description: string | null;
50
+ key: string;
51
+ isGasAsset: boolean;
52
+ isActive: boolean;
53
+ };
49
54
  }>;
50
- static getAssetOverview(userId: string, params: AssetOverviewParamsType, query?: AssetOverviewQueryType): Promise<{
51
- quoteAsset: string;
52
- asset: {
55
+ static getAssetByCode(params: AssetUserCodeParamsType): Promise<{
56
+ symbol: string;
57
+ id: string;
58
+ name: string;
59
+ createdAt: Date;
60
+ updatedAt: Date;
61
+ code: string;
62
+ iconUrl: string;
63
+ category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
64
+ isActive: boolean;
65
+ typeId: string;
66
+ precision: number;
67
+ type: {
53
68
  id: string;
54
- code: string;
55
69
  name: string;
56
- iconUrl: string;
57
- symbol: string;
58
- precision: number;
59
- category: "FIAT" | "CRYPTO" | "POINT" | "RWA";
70
+ createdAt: Date;
71
+ updatedAt: Date;
72
+ description: string | null;
73
+ key: string;
74
+ isGasAsset: boolean;
60
75
  isActive: boolean;
61
76
  };
62
- quantity: string;
63
- totalValuation: string;
64
- curve: {
65
- at: Date;
66
- value: string;
67
- }[];
68
- accountDistribution: {
69
- ledgerAccountId: string;
70
- ledgerAccountTypeId: string;
71
- ledgerAccountTypeKey: string;
72
- ledgerAccountTypeName: string;
73
- quantity: string;
74
- valuation: string;
75
- proportion: string;
76
- }[];
77
77
  }>;
78
78
  }
@@ -6,6 +6,7 @@ export declare const AssetPriceErrorCodes: {
6
6
  readonly ASSET_PRICE_PAIR_INVALID: "ASSET_PRICE_PAIR_INVALID";
7
7
  readonly ASSET_PRICE_VALUE_INVALID: "ASSET_PRICE_VALUE_INVALID";
8
8
  readonly ASSET_PRICE_TIME_RANGE_INVALID: "ASSET_PRICE_TIME_RANGE_INVALID";
9
+ readonly ASSET_PRICE_TIME_WINDOW_EXCEEDED: "ASSET_PRICE_TIME_WINDOW_EXCEEDED";
9
10
  readonly ASSET_PRICE_POINT_ALREADY_EXISTS: "ASSET_PRICE_POINT_ALREADY_EXISTS";
10
11
  readonly ASSET_PRICE_NOT_FOUND: "ASSET_PRICE_NOT_FOUND";
11
12
  readonly ASSET_PRICE_CREATE_FAILED: "ASSET_PRICE_CREATE_FAILED";
@@ -5,6 +5,7 @@ export declare const zh: {
5
5
  ASSET_PRICE_PAIR_INVALID: string;
6
6
  ASSET_PRICE_VALUE_INVALID: string;
7
7
  ASSET_PRICE_TIME_RANGE_INVALID: string;
8
+ ASSET_PRICE_TIME_WINDOW_EXCEEDED: string;
8
9
  ASSET_PRICE_POINT_ALREADY_EXISTS: string;
9
10
  ASSET_PRICE_NOT_FOUND: string;
10
11
  ASSET_PRICE_CREATE_FAILED: string;
@@ -179,11 +179,11 @@ export declare const assetPriceUserResponseSchema: import("drizzle-typebox").Bui
179
179
  export type AssetPriceUserResponseType = typeof assetPriceUserResponseSchema.static;
180
180
  export declare const assetPriceUserListQuerySchema: import("@sinclair/typebox").TObject<{
181
181
  limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
182
- offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
183
182
  pageSize: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
183
+ offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
184
184
  pageIndex: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
185
- baseAsset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
186
- quoteAsset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
185
+ baseAsset: import("@sinclair/typebox").TString;
186
+ quoteAsset: import("@sinclair/typebox").TString;
187
187
  source: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
188
188
  startDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TDate>;
189
189
  endDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TDate>;
@@ -194,6 +194,10 @@ export declare const assetPriceUserLatestParamsSchema: import("@sinclair/typebox
194
194
  quoteAsset: import("@sinclair/typebox").TString;
195
195
  }>;
196
196
  export type AssetPriceUserLatestParamsType = typeof assetPriceUserLatestParamsSchema.static;
197
+ export declare const assetPriceUserLatestCnyParamsSchema: import("@sinclair/typebox").TObject<{
198
+ baseAsset: import("@sinclair/typebox").TString;
199
+ }>;
200
+ export type AssetPriceUserLatestCnyParamsType = typeof assetPriceUserLatestCnyParamsSchema.static;
197
201
  export declare const assetPriceUserListResponseSchema: import("@sinclair/typebox").TObject<{
198
202
  data: import("@sinclair/typebox").TArray<import("drizzle-typebox").BuildSchema<"select", {
199
203
  createdAt: import("drizzle-orm/pg-core").PgColumn<{
@@ -385,8 +385,6 @@ export declare const assetPriceRouter: Elysia<"/asset_prices", {
385
385
  body: {};
386
386
  params: {};
387
387
  query: {
388
- baseAsset?: string | undefined;
389
- quoteAsset?: string | undefined;
390
388
  source?: string | undefined;
391
389
  startDate?: Date | undefined;
392
390
  limit?: number | undefined;
@@ -394,6 +392,8 @@ export declare const assetPriceRouter: Elysia<"/asset_prices", {
394
392
  pageSize?: number | undefined;
395
393
  pageIndex?: number | undefined;
396
394
  endDate?: Date | undefined;
395
+ baseAsset: string;
396
+ quoteAsset: string;
397
397
  };
398
398
  headers: {};
399
399
  response: {
@@ -431,6 +431,47 @@ export declare const assetPriceRouter: Elysia<"/asset_prices", {
431
431
  };
432
432
  };
433
433
  };
434
+ } & {
435
+ asset_prices: {
436
+ latest: {
437
+ cny: {
438
+ ":baseAsset": {
439
+ get: {
440
+ body: {};
441
+ params: {
442
+ baseAsset: string;
443
+ };
444
+ query: {};
445
+ headers: {};
446
+ response: {
447
+ 200: {
448
+ id: string;
449
+ createdAt: Date;
450
+ updatedAt: Date;
451
+ baseAssetId: string;
452
+ baseAsset: string;
453
+ quoteAssetId: string;
454
+ quoteAsset: string;
455
+ price: string;
456
+ source: string;
457
+ effectiveAt: Date;
458
+ };
459
+ 422: {
460
+ type: "validation";
461
+ on: string;
462
+ summary?: string;
463
+ message?: string;
464
+ found?: unknown;
465
+ property?: string;
466
+ expected?: string;
467
+ };
468
+ 401: "Unauthorized";
469
+ };
470
+ };
471
+ };
472
+ };
473
+ };
474
+ };
434
475
  } & {
435
476
  asset_prices: {
436
477
  latest: {
@@ -1,7 +1,7 @@
1
1
  import { InternalAssetPriceService } from "../internal/service";
2
2
  import type { AssetPriceUserListQueryType } from "./dto.schemas";
3
3
  export declare abstract class UserAssetPriceService extends InternalAssetPriceService {
4
- static listAssetPrices(query?: AssetPriceUserListQueryType): Promise<{
4
+ static listAssetPrices(query: AssetPriceUserListQueryType): Promise<{
5
5
  items: {
6
6
  id: string;
7
7
  createdAt: Date;
@@ -28,4 +28,16 @@ export declare abstract class UserAssetPriceService extends InternalAssetPriceSe
28
28
  source: string;
29
29
  effectiveAt: Date;
30
30
  }>;
31
+ static getLatestAssetPriceToCny(baseAsset: string): Promise<{
32
+ id: string;
33
+ createdAt: Date;
34
+ updatedAt: Date;
35
+ baseAssetId: string;
36
+ baseAsset: string;
37
+ quoteAssetId: string;
38
+ quoteAsset: string;
39
+ price: string;
40
+ source: string;
41
+ effectiveAt: Date;
42
+ }>;
31
43
  }