@sereel/sdk 0.1.6 → 0.2.0

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.
package/dist/index.d.cts CHANGED
@@ -19,10 +19,7 @@ interface NetworkDetails {
19
19
  native_currency: NativeCurrency;
20
20
  rpc_endpoint: string;
21
21
  explorer_urls: string[];
22
- can_deploy_cmtat_token: boolean;
23
- can_deploy_trex_token: boolean;
24
22
  is_testnet: boolean;
25
- is_supported: boolean;
26
23
  }
27
24
  interface SdkTokenProspectus {
28
25
  name: string;
@@ -53,8 +50,11 @@ interface SdkSecurityDetails {
53
50
  admin: string;
54
51
  icon_url: string | null;
55
52
  prospectus: SdkTokenProspectus | null;
53
+ issuer: SdkIssuerSummary | null;
54
+ book: SdkBookSummary | null;
56
55
  partners: SdkTokenPartner[] | null;
57
56
  rule_engine: SdkRuleEngineSummary | null;
57
+ network: NetworkDetails;
58
58
  created_at: string | null;
59
59
  trex_claim_topics: number[] | null;
60
60
  trex_issuers: string[] | null;
@@ -75,8 +75,6 @@ interface SdkFundConfig {
75
75
  exit_fee_bps: string;
76
76
  dealing_mode: number;
77
77
  redemption_gate_bps: string;
78
- protocol_subscription_fee_bps: string | null;
79
- protocol_fee_recipient: string | null;
80
78
  management_fee_bps_per_annum: string;
81
79
  }
82
80
  type IssuanceStatus = "OPEN" | "CLOSED" | "FINALIZED" | "SETTLED" | "CANCELLED";
@@ -86,13 +84,8 @@ interface SdkBookSummary {
86
84
  name: string | null;
87
85
  book_type: string | null;
88
86
  token_address: string;
89
- fund_token: string;
90
87
  network_id: string;
91
- admin_wallet: string | null;
92
- manager_wallet: string | null;
93
88
  settlement_token: string;
94
- factory_address: string | null;
95
- deployment_txn_hash: string | null;
96
89
  order_book_address: string;
97
90
  fund_address: string;
98
91
  fund_id: string;
@@ -100,20 +93,13 @@ interface SdkBookSummary {
100
93
  fund_config: SdkFundConfig;
101
94
  status: IssuanceStatus;
102
95
  created_at: string | null;
103
- updated_at: string | null;
104
- }
105
- interface SdkAssetRecord {
106
- security: SdkSecurityDetails;
107
- issuer: SdkIssuerSummary;
108
- books: SdkBookSummary[];
109
- network: NetworkDetails;
110
96
  }
111
97
  interface SdkAssetsResponse {
112
- data: SdkAssetRecord[];
98
+ data: SdkSecurityDetails[];
113
99
  count: number;
114
100
  }
115
101
  interface SdkAssetResponse {
116
- data: SdkAssetRecord;
102
+ data: SdkSecurityDetails;
117
103
  }
118
104
  interface SereelSdkClient {
119
105
  getAssets(): Promise<SdkAssetsResponse>;
@@ -159,4 +145,4 @@ declare class TimeoutError extends SereelSdkError {
159
145
  declare class MalformedResponseError extends SereelSdkError {
160
146
  }
161
147
 
162
- export { type ClientConfig, ENVIRONMENT_BASE_URLS, ForbiddenError, HttpError, InvalidConfigurationError, type IssuanceStatus, MalformedResponseError, type NativeCurrency, type NetworkDetails, NetworkError, NotFoundError, RateLimitError, type SdkAssetRecord, type SdkAssetResponse, type SdkAssetsResponse, type SdkBookSummary, type SdkFundConfig, type SdkIssuerSummary, type SdkRuleEngineSummary, type SdkRuleSummary, type SdkSecurityDetails, type SdkTokenPartner, type SdkTokenProspectus, type SereelEnvironment, type SereelSdkClient, SereelSdkError, ServerError, TimeoutError, UnauthorizedError, createClient, resolveBaseUrl };
148
+ export { type ClientConfig, ENVIRONMENT_BASE_URLS, ForbiddenError, HttpError, InvalidConfigurationError, type IssuanceStatus, MalformedResponseError, type NativeCurrency, type NetworkDetails, NetworkError, NotFoundError, RateLimitError, type SdkAssetResponse, type SdkAssetsResponse, type SdkBookSummary, type SdkFundConfig, type SdkIssuerSummary, type SdkRuleEngineSummary, type SdkRuleSummary, type SdkSecurityDetails, type SdkTokenPartner, type SdkTokenProspectus, type SereelEnvironment, type SereelSdkClient, SereelSdkError, ServerError, TimeoutError, UnauthorizedError, createClient, resolveBaseUrl };
package/dist/index.d.ts CHANGED
@@ -19,10 +19,7 @@ interface NetworkDetails {
19
19
  native_currency: NativeCurrency;
20
20
  rpc_endpoint: string;
21
21
  explorer_urls: string[];
22
- can_deploy_cmtat_token: boolean;
23
- can_deploy_trex_token: boolean;
24
22
  is_testnet: boolean;
25
- is_supported: boolean;
26
23
  }
27
24
  interface SdkTokenProspectus {
28
25
  name: string;
@@ -53,8 +50,11 @@ interface SdkSecurityDetails {
53
50
  admin: string;
54
51
  icon_url: string | null;
55
52
  prospectus: SdkTokenProspectus | null;
53
+ issuer: SdkIssuerSummary | null;
54
+ book: SdkBookSummary | null;
56
55
  partners: SdkTokenPartner[] | null;
57
56
  rule_engine: SdkRuleEngineSummary | null;
57
+ network: NetworkDetails;
58
58
  created_at: string | null;
59
59
  trex_claim_topics: number[] | null;
60
60
  trex_issuers: string[] | null;
@@ -75,8 +75,6 @@ interface SdkFundConfig {
75
75
  exit_fee_bps: string;
76
76
  dealing_mode: number;
77
77
  redemption_gate_bps: string;
78
- protocol_subscription_fee_bps: string | null;
79
- protocol_fee_recipient: string | null;
80
78
  management_fee_bps_per_annum: string;
81
79
  }
82
80
  type IssuanceStatus = "OPEN" | "CLOSED" | "FINALIZED" | "SETTLED" | "CANCELLED";
@@ -86,13 +84,8 @@ interface SdkBookSummary {
86
84
  name: string | null;
87
85
  book_type: string | null;
88
86
  token_address: string;
89
- fund_token: string;
90
87
  network_id: string;
91
- admin_wallet: string | null;
92
- manager_wallet: string | null;
93
88
  settlement_token: string;
94
- factory_address: string | null;
95
- deployment_txn_hash: string | null;
96
89
  order_book_address: string;
97
90
  fund_address: string;
98
91
  fund_id: string;
@@ -100,20 +93,13 @@ interface SdkBookSummary {
100
93
  fund_config: SdkFundConfig;
101
94
  status: IssuanceStatus;
102
95
  created_at: string | null;
103
- updated_at: string | null;
104
- }
105
- interface SdkAssetRecord {
106
- security: SdkSecurityDetails;
107
- issuer: SdkIssuerSummary;
108
- books: SdkBookSummary[];
109
- network: NetworkDetails;
110
96
  }
111
97
  interface SdkAssetsResponse {
112
- data: SdkAssetRecord[];
98
+ data: SdkSecurityDetails[];
113
99
  count: number;
114
100
  }
115
101
  interface SdkAssetResponse {
116
- data: SdkAssetRecord;
102
+ data: SdkSecurityDetails;
117
103
  }
118
104
  interface SereelSdkClient {
119
105
  getAssets(): Promise<SdkAssetsResponse>;
@@ -159,4 +145,4 @@ declare class TimeoutError extends SereelSdkError {
159
145
  declare class MalformedResponseError extends SereelSdkError {
160
146
  }
161
147
 
162
- export { type ClientConfig, ENVIRONMENT_BASE_URLS, ForbiddenError, HttpError, InvalidConfigurationError, type IssuanceStatus, MalformedResponseError, type NativeCurrency, type NetworkDetails, NetworkError, NotFoundError, RateLimitError, type SdkAssetRecord, type SdkAssetResponse, type SdkAssetsResponse, type SdkBookSummary, type SdkFundConfig, type SdkIssuerSummary, type SdkRuleEngineSummary, type SdkRuleSummary, type SdkSecurityDetails, type SdkTokenPartner, type SdkTokenProspectus, type SereelEnvironment, type SereelSdkClient, SereelSdkError, ServerError, TimeoutError, UnauthorizedError, createClient, resolveBaseUrl };
148
+ export { type ClientConfig, ENVIRONMENT_BASE_URLS, ForbiddenError, HttpError, InvalidConfigurationError, type IssuanceStatus, MalformedResponseError, type NativeCurrency, type NetworkDetails, NetworkError, NotFoundError, RateLimitError, type SdkAssetResponse, type SdkAssetsResponse, type SdkBookSummary, type SdkFundConfig, type SdkIssuerSummary, type SdkRuleEngineSummary, type SdkRuleSummary, type SdkSecurityDetails, type SdkTokenPartner, type SdkTokenProspectus, type SereelEnvironment, type SereelSdkClient, SereelSdkError, ServerError, TimeoutError, UnauthorizedError, createClient, resolveBaseUrl };
package/dist/index.js CHANGED
@@ -195,9 +195,6 @@ function isString(value) {
195
195
  function isNullableString(value) {
196
196
  return typeof value === "string" || value === null;
197
197
  }
198
- function isOptionalNullableString(value) {
199
- return typeof value === "string" || value === null || value === void 0;
200
- }
201
198
  function isFiniteNumber(value) {
202
199
  return typeof value === "number" && Number.isFinite(value);
203
200
  }
@@ -286,79 +283,6 @@ function isRuleEngineSummary(value, ctx, path) {
286
283
  }
287
284
  return true;
288
285
  }
289
- function isSecurityDetails(value, ctx, path) {
290
- const v = asRecord(value);
291
- if (!ctx.check(v !== void 0, path, "object", value)) return false;
292
- ctx.check(
293
- isString(v.token_address),
294
- `${path}.token_address`,
295
- "string",
296
- v.token_address
297
- );
298
- ctx.check(
299
- isString(v.token_name),
300
- `${path}.token_name`,
301
- "string",
302
- v.token_name
303
- );
304
- ctx.check(
305
- isString(v.token_symbol),
306
- `${path}.token_symbol`,
307
- "string",
308
- v.token_symbol
309
- );
310
- ctx.check(
311
- isString(v.token_decimal),
312
- `${path}.token_decimal`,
313
- "string",
314
- v.token_decimal
315
- );
316
- ctx.check(
317
- isString(v.network_id),
318
- `${path}.network_id`,
319
- "string",
320
- v.network_id
321
- );
322
- ctx.check(
323
- isString(v.token_type),
324
- `${path}.token_type`,
325
- "string",
326
- v.token_type
327
- );
328
- ctx.check(isString(v.admin), `${path}.admin`, "string", v.admin);
329
- ctx.check(
330
- isNullableString(v.icon_url),
331
- `${path}.icon_url`,
332
- "string | null",
333
- v.icon_url
334
- );
335
- ctx.check(
336
- isNullableString(v.created_at),
337
- `${path}.created_at`,
338
- "string | null",
339
- v.created_at
340
- );
341
- if (v.prospectus !== null && v.prospectus !== void 0) {
342
- isProspectus(v.prospectus, ctx, `${path}.prospectus`);
343
- }
344
- if (v.partners !== null && v.partners !== void 0) {
345
- const partnersOk = ctx.check(
346
- Array.isArray(v.partners),
347
- `${path}.partners`,
348
- "array",
349
- v.partners
350
- );
351
- if (partnersOk) {
352
- v.partners.forEach(
353
- (partner, i) => isTokenPartner(partner, ctx, `${path}.partners[${i}]`)
354
- );
355
- }
356
- }
357
- if (v.rule_engine !== null && v.rule_engine !== void 0) {
358
- isRuleEngineSummary(v.rule_engine, ctx, `${path}.rule_engine`);
359
- }
360
- return true;
361
- }
362
286
  function isIssuerSummary(value, ctx, path) {
363
287
  const v = asRecord(value);
364
288
  if (!ctx.check(v !== void 0, path, "object", value)) return false;
@@ -448,30 +372,12 @@ function isNetworkDetails(value, ctx, path) {
448
372
  )
449
373
  );
450
374
  }
451
- ctx.check(
452
- isBoolean(v.can_deploy_cmtat_token),
453
- `${path}.can_deploy_cmtat_token`,
454
- "boolean",
455
- v.can_deploy_cmtat_token
456
- );
457
- ctx.check(
458
- isBoolean(v.can_deploy_trex_token),
459
- `${path}.can_deploy_trex_token`,
460
- "boolean",
461
- v.can_deploy_trex_token
462
- );
463
375
  ctx.check(
464
376
  isBoolean(v.is_testnet),
465
377
  `${path}.is_testnet`,
466
378
  "boolean",
467
379
  v.is_testnet
468
380
  );
469
- ctx.check(
470
- isBoolean(v.is_supported),
471
- `${path}.is_supported`,
472
- "boolean",
473
- v.is_supported
474
- );
475
381
  return true;
476
382
  }
477
383
  function isFundConfig(value, ctx, path) {
@@ -519,18 +425,6 @@ function isFundConfig(value, ctx, path) {
519
425
  "string",
520
426
  v.redemption_gate_bps
521
427
  );
522
- ctx.check(
523
- isOptionalNullableString(v.protocol_subscription_fee_bps),
524
- `${path}.protocol_subscription_fee_bps`,
525
- "string | null | undefined",
526
- v.protocol_subscription_fee_bps
527
- );
528
- ctx.check(
529
- isOptionalNullableString(v.protocol_fee_recipient),
530
- `${path}.protocol_fee_recipient`,
531
- "string | null | undefined",
532
- v.protocol_fee_recipient
533
- );
534
428
  ctx.check(
535
429
  isString(v.management_fee_bps_per_annum),
536
430
  `${path}.management_fee_bps_per_annum`,
@@ -587,48 +481,18 @@ function isBookSummary(value, ctx, path) {
587
481
  "string",
588
482
  v.token_address
589
483
  );
590
- ctx.check(
591
- isString(v.fund_token),
592
- `${path}.fund_token`,
593
- "string",
594
- v.fund_token
595
- );
596
484
  ctx.check(
597
485
  isString(v.network_id),
598
486
  `${path}.network_id`,
599
487
  "string",
600
488
  v.network_id
601
489
  );
602
- ctx.check(
603
- isOptionalNullableString(v.admin_wallet),
604
- `${path}.admin_wallet`,
605
- "string | null | undefined",
606
- v.admin_wallet
607
- );
608
- ctx.check(
609
- isOptionalNullableString(v.manager_wallet),
610
- `${path}.manager_wallet`,
611
- "string | null | undefined",
612
- v.manager_wallet
613
- );
614
490
  ctx.check(
615
491
  isString(v.settlement_token),
616
492
  `${path}.settlement_token`,
617
493
  "string",
618
494
  v.settlement_token
619
495
  );
620
- ctx.check(
621
- isNullableString(v.factory_address),
622
- `${path}.factory_address`,
623
- "string | null",
624
- v.factory_address
625
- );
626
- ctx.check(
627
- isNullableString(v.deployment_txn_hash),
628
- `${path}.deployment_txn_hash`,
629
- "string | null",
630
- v.deployment_txn_hash
631
- );
632
496
  ctx.check(
633
497
  isString(v.order_book_address),
634
498
  `${path}.order_book_address`,
@@ -661,31 +525,122 @@ function isBookSummary(value, ctx, path) {
661
525
  "string | null",
662
526
  v.created_at
663
527
  );
664
- ctx.check(
665
- isNullableString(v.updated_at),
666
- `${path}.updated_at`,
667
- "string | null",
668
- v.updated_at
669
- );
670
528
  return true;
671
529
  }
672
- function isAssetRecord(value, ctx, path) {
530
+ function isSecurityDetails(value, ctx, path) {
673
531
  const v = asRecord(value);
674
532
  if (!ctx.check(v !== void 0, path, "object", value)) return false;
675
- isSecurityDetails(v.security, ctx, `${path}.security`);
676
- isIssuerSummary(v.issuer, ctx, `${path}.issuer`);
677
- const booksOk = ctx.check(
678
- Array.isArray(v.books),
679
- `${path}.books`,
680
- "array",
681
- v.books
533
+ ctx.check(
534
+ isString(v.token_address),
535
+ `${path}.token_address`,
536
+ "string",
537
+ v.token_address
538
+ );
539
+ ctx.check(
540
+ isString(v.token_name),
541
+ `${path}.token_name`,
542
+ "string",
543
+ v.token_name
544
+ );
545
+ ctx.check(
546
+ isString(v.token_symbol),
547
+ `${path}.token_symbol`,
548
+ "string",
549
+ v.token_symbol
550
+ );
551
+ ctx.check(
552
+ isString(v.token_decimal),
553
+ `${path}.token_decimal`,
554
+ "string",
555
+ v.token_decimal
556
+ );
557
+ ctx.check(
558
+ isString(v.network_id),
559
+ `${path}.network_id`,
560
+ "string",
561
+ v.network_id
562
+ );
563
+ ctx.check(
564
+ isString(v.token_type),
565
+ `${path}.token_type`,
566
+ "string",
567
+ v.token_type
568
+ );
569
+ ctx.check(isString(v.admin), `${path}.admin`, "string", v.admin);
570
+ ctx.check(
571
+ isNullableString(v.icon_url),
572
+ `${path}.icon_url`,
573
+ "string | null",
574
+ v.icon_url
682
575
  );
683
- if (booksOk) {
684
- v.books.forEach(
685
- (book, i) => isBookSummary(book, ctx, `${path}.books[${i}]`)
576
+ ctx.check(
577
+ isNullableString(v.created_at),
578
+ `${path}.created_at`,
579
+ "string | null",
580
+ v.created_at
581
+ );
582
+ if (v.prospectus !== null && v.prospectus !== void 0) {
583
+ isProspectus(v.prospectus, ctx, `${path}.prospectus`);
584
+ }
585
+ if (v.issuer !== null && v.issuer !== void 0) {
586
+ isIssuerSummary(v.issuer, ctx, `${path}.issuer`);
587
+ }
588
+ if (v.book !== null && v.book !== void 0) {
589
+ isBookSummary(v.book, ctx, `${path}.book`);
590
+ }
591
+ if (v.partners !== null && v.partners !== void 0) {
592
+ const partnersOk = ctx.check(
593
+ Array.isArray(v.partners),
594
+ `${path}.partners`,
595
+ "array",
596
+ v.partners
686
597
  );
598
+ if (partnersOk) {
599
+ v.partners.forEach(
600
+ (partner, i) => isTokenPartner(partner, ctx, `${path}.partners[${i}]`)
601
+ );
602
+ }
603
+ }
604
+ if (v.rule_engine !== null && v.rule_engine !== void 0) {
605
+ isRuleEngineSummary(v.rule_engine, ctx, `${path}.rule_engine`);
687
606
  }
688
607
  isNetworkDetails(v.network, ctx, `${path}.network`);
608
+ if (v.trex_claim_topics !== null && v.trex_claim_topics !== void 0) {
609
+ const topicsOk = ctx.check(
610
+ Array.isArray(v.trex_claim_topics),
611
+ `${path}.trex_claim_topics`,
612
+ "number[]",
613
+ v.trex_claim_topics
614
+ );
615
+ if (topicsOk) {
616
+ v.trex_claim_topics.forEach(
617
+ (topic, i) => ctx.check(
618
+ isFiniteNumber(topic),
619
+ `${path}.trex_claim_topics[${i}]`,
620
+ "finite number",
621
+ topic
622
+ )
623
+ );
624
+ }
625
+ }
626
+ if (v.trex_issuers !== null && v.trex_issuers !== void 0) {
627
+ const issuersOk = ctx.check(
628
+ Array.isArray(v.trex_issuers),
629
+ `${path}.trex_issuers`,
630
+ "string[]",
631
+ v.trex_issuers
632
+ );
633
+ if (issuersOk) {
634
+ v.trex_issuers.forEach(
635
+ (issuer, i) => ctx.check(
636
+ isString(issuer),
637
+ `${path}.trex_issuers[${i}]`,
638
+ "string",
639
+ issuer
640
+ )
641
+ );
642
+ }
643
+ }
689
644
  return true;
690
645
  }
691
646
  function buildValidationError(value, failures) {
@@ -710,7 +665,7 @@ function validateSdkAssetsResponse(value) {
710
665
  );
711
666
  if (Array.isArray(value.data)) {
712
667
  value.data.forEach(
713
- (item, i) => isAssetRecord(item, ctx, `<root>.data[${i}]`)
668
+ (item, i) => isSecurityDetails(item, ctx, `<root>.data[${i}]`)
714
669
  );
715
670
  }
716
671
  }
@@ -723,7 +678,7 @@ function validateSdkAssetResponse(value) {
723
678
  const ctx = new ValidationContext();
724
679
  ctx.check(isRecord(value), "<root>", "object", value);
725
680
  if (isRecord(value)) {
726
- isAssetRecord(value.data, ctx, "<root>.data");
681
+ isSecurityDetails(value.data, ctx, "<root>.data");
727
682
  }
728
683
  if (ctx.failures.length > 0) {
729
684
  throw buildValidationError(value, ctx.failures);