@chainstream-io/sdk 0.0.8 → 0.0.9

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/src/api/stream.ts CHANGED
@@ -297,7 +297,7 @@ export class StreamApi {
297
297
  price24h: this.formatScientificNotation(data.p24h),
298
298
  openInUsd24h: this.formatScientificNotation(data.oiu24h),
299
299
  closeInUsd24h: this.formatScientificNotation(data.ciu24h),
300
-
300
+
301
301
  price: this.formatScientificNotation(data.p),
302
302
  }), filter, "subscribeTokenStats");
303
303
  }
@@ -362,31 +362,31 @@ export class StreamApi {
362
362
  callback(
363
363
  data.map(
364
364
  (it: any) =>
365
- ({
366
- tokenAddress: it.a,
367
- name: it.n,
368
- symbol: it.s,
369
- imageUrl: it.iu,
370
- description: it.de,
371
- socialMedia: (() => {
372
- const socialMedia: any = {};
373
- if (it.sm?.tw) {socialMedia.twitter = it.sm.tw}
374
- if (it.sm?.tg) {socialMedia.telegram = it.sm.tg}
375
- if (it.sm?.w) {socialMedia.website = it.sm.w}
376
- if (it.sm?.tt) {socialMedia.tiktok = it.sm.tt}
377
- if (it.sm?.dc) {socialMedia.discord = it.sm.dc}
378
- if (it.sm?.fb) {socialMedia.facebook = it.sm.fb}
379
- if (it.sm?.gh) {socialMedia.github = it.sm.gh}
380
- if (it.sm?.ig) {socialMedia.instagram = it.sm.ig}
381
- if (it.sm?.li) {socialMedia.linkedin = it.sm.li}
382
- if (it.sm?.md) {socialMedia.medium = it.sm.md}
383
- if (it.sm?.rd) {socialMedia.reddit = it.sm.rd}
384
- if (it.sm?.yt) {socialMedia.youtube = it.sm.yt}
385
- if (it.sm?.bb) {socialMedia.bitbucket = it.sm.bb}
386
- return socialMedia;
387
- })(),
388
- createdAtMs: it.cts,
389
- })
365
+ ({
366
+ tokenAddress: it.a,
367
+ name: it.n,
368
+ symbol: it.s,
369
+ imageUrl: it.iu,
370
+ description: it.de,
371
+ socialMedia: (() => {
372
+ const socialMedia: any = {};
373
+ if (it.sm?.tw) { socialMedia.twitter = it.sm.tw }
374
+ if (it.sm?.tg) { socialMedia.telegram = it.sm.tg }
375
+ if (it.sm?.w) { socialMedia.website = it.sm.w }
376
+ if (it.sm?.tt) { socialMedia.tiktok = it.sm.tt }
377
+ if (it.sm?.dc) { socialMedia.discord = it.sm.dc }
378
+ if (it.sm?.fb) { socialMedia.facebook = it.sm.fb }
379
+ if (it.sm?.gh) { socialMedia.github = it.sm.gh }
380
+ if (it.sm?.ig) { socialMedia.instagram = it.sm.ig }
381
+ if (it.sm?.li) { socialMedia.linkedin = it.sm.li }
382
+ if (it.sm?.md) { socialMedia.medium = it.sm.md }
383
+ if (it.sm?.rd) { socialMedia.reddit = it.sm.rd }
384
+ if (it.sm?.yt) { socialMedia.youtube = it.sm.yt }
385
+ if (it.sm?.bb) { socialMedia.bitbucket = it.sm.bb }
386
+ return socialMedia;
387
+ })(),
388
+ createdAtMs: it.cts,
389
+ })
390
390
  )
391
391
  )
392
392
  );
@@ -494,7 +494,7 @@ export class StreamApi {
494
494
  dex?: Dex;
495
495
  callback: (data: RankingTokenList[]) => void;
496
496
  }): Unsubscrible {
497
- const channel = dex
497
+ const channel = dex
498
498
  ? `dex-ranking-list:${chain}_${ranking_type}_${dex}`
499
499
  : `dex-ranking-list:${chain}_${ranking_type}`;
500
500
  return this.subscribe(channel, (data: any[]) =>
@@ -504,135 +504,163 @@ export class StreamApi {
504
504
 
505
505
  // TokenMetadata (t)
506
506
  if (item.t) {
507
- result.tokenAddress = item.t.a;
508
- if (item.t.n) {result.name = item.t.n}
509
- if (item.t.s) {result.symbol = item.t.s}
510
- if (item.t.iu) {result.imageUrl = item.t.iu}
511
- if (item.t.de) {result.description = item.t.de}
507
+ result.metadata = {
508
+ tokenAddress: item.t.a,
509
+ };
510
+ if (item.t.n) { result.metadata.name = item.t.n }
511
+ if (item.t.s) { result.metadata.symbol = item.t.s }
512
+ if (item.t.iu) { result.metadata.imageUrl = item.t.iu }
513
+ if (item.t.de) { result.metadata.description = item.t.de }
514
+ if (item.t.d) { result.metadata.decimals = item.t.dec }
515
+ if (item.t.cts) { result.metadata.createdAtMs = item.t.cts }
516
+ if (item.t.lf) {
517
+ result.metadata.launchFrom = {};
518
+ if (item.t.lf.pa) { result.metadata.launchFrom.programAddress = item.t.lf.pa }
519
+ if (item.t.lf.pf) { result.metadata.launchFrom.protocolFamily = item.t.lf.pf }
520
+ if (item.t.lf.pn) { result.metadata.launchFrom.protocolName = item.t.lf.pn }
521
+ }
522
+ if (item.t.mt) {
523
+ result.metadata.migratedTo = {};
524
+ if (item.t.mt.pa) { result.metadata.migratedTo.programAddress = item.t.mt.pa }
525
+ if (item.t.mt.pf) { result.metadata.migratedTo.protocolFamily = item.t.mt.pf }
526
+ if (item.t.mt.pn) { result.metadata.migratedTo.protocolName = item.t.mt.pn }
527
+ }
512
528
  if (item.t.sm) {
513
- result.socialMedia = {};
514
- if (item.t.sm.tw) {result.socialMedia.twitter = item.t.sm.tw}
515
- if (item.t.sm.tg) {result.socialMedia.telegram = item.t.sm.tg}
516
- if (item.t.sm.w) {result.socialMedia.website = item.t.sm.w}
517
- if (item.t.sm.tt) {result.socialMedia.tiktok = item.t.sm.tt}
518
- if (item.t.sm.dc) {result.socialMedia.discord = item.t.sm.dc}
519
- if (item.t.sm.fb) {result.socialMedia.facebook = item.t.sm.fb}
520
- if (item.t.sm.gh) {result.socialMedia.github = item.t.sm.gh}
521
- if (item.t.sm.ig) {result.socialMedia.instagram = item.t.sm.ig}
522
- if (item.t.sm.li) {result.socialMedia.linkedin = item.t.sm.li}
523
- if (item.t.sm.md) {result.socialMedia.medium = item.t.sm.md}
524
- if (item.t.sm.rd) {result.socialMedia.reddit = item.t.sm.rd}
525
- if (item.t.sm.yt) {result.socialMedia.youtube = item.t.sm.yt}
526
- if (item.t.sm.bb) {result.socialMedia.bitbucket = item.t.sm.bb}
529
+ result.metadata.socialMedia = {};
530
+ if (item.t.sm.tw) { result.metadata.socialMedia.twitter = item.t.sm.tw }
531
+ if (item.t.sm.tg) { result.metadata.socialMedia.telegram = item.t.sm.tg }
532
+ if (item.t.sm.w) { result.metadata.socialMedia.website = item.t.sm.w }
533
+ if (item.t.sm.tt) { result.metadata.socialMedia.tiktok = item.t.sm.tt }
534
+ if (item.t.sm.dc) { result.metadata.socialMedia.discord = item.t.sm.dc }
535
+ if (item.t.sm.fb) { result.metadata.socialMedia.facebook = item.t.sm.fb }
536
+ if (item.t.sm.gh) { result.metadata.socialMedia.github = item.t.sm.gh }
537
+ if (item.t.sm.ig) { result.metadata.socialMedia.instagram = item.t.sm.ig }
538
+ if (item.t.sm.li) { result.metadata.socialMedia.linkedin = item.t.sm.li }
539
+ if (item.t.sm.md) { result.metadata.socialMedia.medium = item.t.sm.md }
540
+ if (item.t.sm.rd) { result.metadata.socialMedia.reddit = item.t.sm.rd }
541
+ if (item.t.sm.yt) { result.metadata.socialMedia.youtube = item.t.sm.yt }
542
+ if (item.t.sm.bb) { result.metadata.socialMedia.bitbucket = item.t.sm.bb }
527
543
  }
528
- if (item.t.cts) {result.createdAtMs = item.t.cts}
544
+ if (item.t.cts) { result.metadata.createdAtMs = item.t.cts }
545
+ }
546
+
547
+ // TokenBondingCurve (bc)
548
+ if (item.bc) {
549
+ result.bondingCurve = {};
550
+ if (item.bc.pr) { result.bondingCurve.progressRatio = this.formatScientificNotation(item.bc.pr) }
529
551
  }
530
552
 
531
553
  // TokenHolder (h)
532
554
  if (item.h) {
533
- if (item.h.a) {result.tokenAddress = item.h.a}
534
- if (item.h.h !== undefined) {result.holders = item.h.h}
535
- if (item.h.t100a !== undefined) {result.top100Amount = this.formatScientificNotation(item.h.t100a)}
536
- if (item.h.t10a !== undefined) {result.top10Amount = this.formatScientificNotation(item.h.t10a)}
537
- if (item.h.t100h !== undefined) {result.top100Holders = item.h.t100h}
538
- if (item.h.t10h !== undefined) {result.top10Holders = item.h.t10h}
539
- if (item.h.t100r !== undefined) {result.top100Ratio = this.formatScientificNotation(item.h.t100r)}
540
- if (item.h.t10r !== undefined) {result.top10Ratio = this.formatScientificNotation(item.h.t10r)}
541
- if (item.h.ts !== undefined) {result.timestamp = item.h.ts}
555
+ result.holder = {
556
+ tokenAddress: item.h.a,
557
+ timestamp: item.h.ts || 0,
558
+ };
559
+ if (item.h.h) { result.holder.holders = item.h.h }
560
+ if (item.h.t100a) { result.holder.top100Amount = this.formatScientificNotation(item.h.t100a) }
561
+ if (item.h.t10a) { result.holder.top10Amount = this.formatScientificNotation(item.h.t10a) }
562
+ if (item.h.t100h) { result.holder.top100Holders = item.h.t100h }
563
+ if (item.h.t10h) { result.holder.top10Holders = item.h.t10h }
564
+ if (item.h.t100r) { result.holder.top100Ratio = this.formatScientificNotation(item.h.t100r) }
565
+ if (item.h.t10r) { result.holder.top10Ratio = this.formatScientificNotation(item.h.t10r) }
542
566
  }
543
567
 
544
568
  // TokenSupply (s)
545
569
  if (item.s) {
546
- if (item.s.a) {result.tokenAddress = item.s.a}
547
- if (item.s.s !== undefined) {result.supply = item.s.s}
548
- if (item.s.mc !== undefined) {result.marketCapInUsd = item.s.mc}
549
- if (item.s.ts !== undefined) {result.timestamp = item.s.ts}
570
+ result.supply = {
571
+ tokenAddress: item.s.a,
572
+ timestamp: item.s.ts || 0,
573
+ };
574
+ if (item.s.s) { result.supply.supply = item.s.s }
575
+ if (item.s.mc) { result.supply.marketCapInUsd = item.s.mc }
550
576
  }
551
577
 
552
578
  // TokenStat (ts)
553
579
  if (item.ts) {
554
- if (item.ts.a) {result.address = item.ts.a}
555
- if (item.ts.t !== undefined) {result.timestamp = item.ts.t}
556
-
580
+ result.stat = {
581
+ address: item.ts.a,
582
+ timestamp: item.ts.t || 0,
583
+ };
584
+
557
585
  // 1m data
558
- if (item.ts.b1m !== undefined) {result.buys1m = item.ts.b1m}
559
- if (item.ts.s1m !== undefined) {result.sells1m = item.ts.s1m}
560
- if (item.ts.be1m !== undefined) {result.buyers1m = item.ts.be1m}
561
- if (item.ts.se1m !== undefined) {result.sellers1m = item.ts.se1m}
562
- if (item.ts.bviu1m !== undefined) {result.buyVolumeInUsd1m = this.formatScientificNotation(item.ts.bviu1m)}
563
- if (item.ts.sviu1m !== undefined) {result.sellVolumeInUsd1m = this.formatScientificNotation(item.ts.sviu1m)}
564
- if (item.ts.p1m !== undefined) {result.price1m = this.formatScientificNotation(item.ts.p1m)}
565
- if (item.ts.oiu1m !== undefined) {result.openInUsd1m = this.formatScientificNotation(item.ts.oiu1m)}
566
- if (item.ts.ciu1m !== undefined) {result.closeInUsd1m = this.formatScientificNotation(item.ts.ciu1m)}
586
+ if (item.ts.b1m) { result.stat.buys1m = item.ts.b1m }
587
+ if (item.ts.s1m) { result.stat.sells1m = item.ts.s1m }
588
+ if (item.ts.be1m) { result.stat.buyers1m = item.ts.be1m }
589
+ if (item.ts.se1m) { result.stat.sellers1m = item.ts.se1m }
590
+ if (item.ts.bviu1m) { result.stat.buyVolumeInUsd1m = this.formatScientificNotation(item.ts.bviu1m) }
591
+ if (item.ts.sviu1m) { result.stat.sellVolumeInUsd1m = this.formatScientificNotation(item.ts.sviu1m) }
592
+ if (item.ts.p1m) { result.stat.price1m = this.formatScientificNotation(item.ts.p1m) }
593
+ if (item.ts.oiu1m) { result.stat.openInUsd1m = this.formatScientificNotation(item.ts.oiu1m) }
594
+ if (item.ts.ciu1m) { result.stat.closeInUsd1m = this.formatScientificNotation(item.ts.ciu1m) }
567
595
 
568
596
  // 5m data
569
- if (item.ts.b5m !== undefined) {result.buys5m = item.ts.b5m}
570
- if (item.ts.s5m !== undefined) {result.sells5m = item.ts.s5m}
571
- if (item.ts.be5m !== undefined) {result.buyers5m = item.ts.be5m}
572
- if (item.ts.se5m !== undefined) {result.sellers5m = item.ts.se5m}
573
- if (item.ts.bviu5m !== undefined) {result.buyVolumeInUsd5m = this.formatScientificNotation(item.ts.bviu5m)}
574
- if (item.ts.sviu5m !== undefined) {result.sellVolumeInUsd5m = this.formatScientificNotation(item.ts.sviu5m)}
575
- if (item.ts.p5m !== undefined) {result.price5m = this.formatScientificNotation(item.ts.p5m)}
576
- if (item.ts.oiu5m !== undefined) {result.openInUsd5m = this.formatScientificNotation(item.ts.oiu5m)}
577
- if (item.ts.ciu5m !== undefined) {result.closeInUsd5m = this.formatScientificNotation(item.ts.ciu5m)}
597
+ if (item.ts.b5m) { result.stat.buys5m = item.ts.b5m }
598
+ if (item.ts.s5m) { result.stat.sells5m = item.ts.s5m }
599
+ if (item.ts.be5m) { result.stat.buyers5m = item.ts.be5m }
600
+ if (item.ts.se5m) { result.stat.sellers5m = item.ts.se5m }
601
+ if (item.ts.bviu5m) { result.stat.buyVolumeInUsd5m = this.formatScientificNotation(item.ts.bviu5m) }
602
+ if (item.ts.sviu5m) { result.stat.sellVolumeInUsd5m = this.formatScientificNotation(item.ts.sviu5m) }
603
+ if (item.ts.p5m) { result.stat.price5m = this.formatScientificNotation(item.ts.p5m) }
604
+ if (item.ts.oiu5m) { result.stat.openInUsd5m = this.formatScientificNotation(item.ts.oiu5m) }
605
+ if (item.ts.ciu5m) { result.stat.closeInUsd5m = this.formatScientificNotation(item.ts.ciu5m) }
578
606
 
579
607
  // 15m data
580
- if (item.ts.b15m !== undefined) {result.buys15m = item.ts.b15m}
581
- if (item.ts.s15m !== undefined) {result.sells15m = item.ts.s15m}
582
- if (item.ts.be15m !== undefined) {result.buyers15m = item.ts.be15m}
583
- if (item.ts.se15m !== undefined) {result.sellers15m = item.ts.se15m}
584
- if (item.ts.bviu15m !== undefined) {result.buyVolumeInUsd15m = this.formatScientificNotation(item.ts.bviu15m)}
585
- if (item.ts.sviu15m !== undefined) {result.sellVolumeInUsd15m = this.formatScientificNotation(item.ts.sviu15m)}
586
- if (item.ts.p15m !== undefined) {result.price15m = this.formatScientificNotation(item.ts.p15m)}
587
- if (item.ts.oiu15m !== undefined) {result.openInUsd15m = this.formatScientificNotation(item.ts.oiu15m)}
588
- if (item.ts.ciu15m !== undefined) {result.closeInUsd15m = this.formatScientificNotation(item.ts.ciu15m)}
608
+ if (item.ts.b15m) { result.stat.buys15m = item.ts.b15m }
609
+ if (item.ts.s15m) { result.stat.sells15m = item.ts.s15m }
610
+ if (item.ts.be15m) { result.stat.buyers15m = item.ts.be15m }
611
+ if (item.ts.se15m) { result.stat.sellers15m = item.ts.se15m }
612
+ if (item.ts.bviu15m) { result.stat.buyVolumeInUsd15m = this.formatScientificNotation(item.ts.bviu15m) }
613
+ if (item.ts.sviu15m) { result.stat.sellVolumeInUsd15m = this.formatScientificNotation(item.ts.sviu15m) }
614
+ if (item.ts.p15m) { result.stat.price15m = this.formatScientificNotation(item.ts.p15m) }
615
+ if (item.ts.oiu15m) { result.stat.openInUsd15m = this.formatScientificNotation(item.ts.oiu15m) }
616
+ if (item.ts.ciu15m) { result.stat.closeInUsd15m = this.formatScientificNotation(item.ts.ciu15m) }
589
617
 
590
618
  // 30m data
591
- if (item.ts.b30m !== undefined) {result.buys30m = item.ts.b30m}
592
- if (item.ts.s30m !== undefined) {result.sells30m = item.ts.s30m}
593
- if (item.ts.be30m !== undefined) {result.buyers30m = item.ts.be30m}
594
- if (item.ts.se30m !== undefined) {result.sellers30m = item.ts.se30m}
595
- if (item.ts.bviu30m !== undefined) {result.buyVolumeInUsd30m = this.formatScientificNotation(item.ts.bviu30m)}
596
- if (item.ts.sviu30m !== undefined) {result.sellVolumeInUsd30m = this.formatScientificNotation(item.ts.sviu30m)}
597
- if (item.ts.p30m !== undefined) {result.price30m = this.formatScientificNotation(item.ts.p30m)}
598
- if (item.ts.oiu30m !== undefined) {result.openInUsd30m = this.formatScientificNotation(item.ts.oiu30m)}
599
- if (item.ts.ciu30m !== undefined) {result.closeInUsd30m = this.formatScientificNotation(item.ts.ciu30m)}
619
+ if (item.ts.b30m) { result.stat.buys30m = item.ts.b30m }
620
+ if (item.ts.s30m) { result.stat.sells30m = item.ts.s30m }
621
+ if (item.ts.be30m) { result.stat.buyers30m = item.ts.be30m }
622
+ if (item.ts.se30m) { result.stat.sellers30m = item.ts.se30m }
623
+ if (item.ts.bviu30m) { result.stat.buyVolumeInUsd30m = this.formatScientificNotation(item.ts.bviu30m) }
624
+ if (item.ts.sviu30m) { result.stat.sellVolumeInUsd30m = this.formatScientificNotation(item.ts.sviu30m) }
625
+ if (item.ts.p30m) { result.stat.price30m = this.formatScientificNotation(item.ts.p30m) }
626
+ if (item.ts.oiu30m) { result.stat.openInUsd30m = this.formatScientificNotation(item.ts.oiu30m) }
627
+ if (item.ts.ciu30m) { result.stat.closeInUsd30m = this.formatScientificNotation(item.ts.ciu30m) }
600
628
 
601
629
  // 1h data
602
- if (item.ts.b1h !== undefined) {result.buys1h = item.ts.b1h}
603
- if (item.ts.s1h !== undefined) {result.sells1h = item.ts.s1h}
604
- if (item.ts.be1h !== undefined) {result.buyers1h = item.ts.be1h}
605
- if (item.ts.se1h !== undefined) {result.sellers1h = item.ts.se1h}
606
- if (item.ts.bviu1h !== undefined) {result.buyVolumeInUsd1h = this.formatScientificNotation(item.ts.bviu1h)}
607
- if (item.ts.sviu1h !== undefined) {result.sellVolumeInUsd1h = this.formatScientificNotation(item.ts.sviu1h)}
608
- if (item.ts.p1h !== undefined) {result.price1h = this.formatScientificNotation(item.ts.p1h)}
609
- if (item.ts.oiu1h !== undefined) {result.openInUsd1h = this.formatScientificNotation(item.ts.oiu1h)}
610
- if (item.ts.ciu1h !== undefined) {result.closeInUsd1h = this.formatScientificNotation(item.ts.ciu1h)}
630
+ if (item.ts.b1h) { result.stat.buys1h = item.ts.b1h }
631
+ if (item.ts.s1h) { result.stat.sells1h = item.ts.s1h }
632
+ if (item.ts.be1h) { result.stat.buyers1h = item.ts.be1h }
633
+ if (item.ts.se1h) { result.stat.sellers1h = item.ts.se1h }
634
+ if (item.ts.bviu1h) { result.stat.buyVolumeInUsd1h = this.formatScientificNotation(item.ts.bviu1h) }
635
+ if (item.ts.sviu1h) { result.stat.sellVolumeInUsd1h = this.formatScientificNotation(item.ts.sviu1h) }
636
+ if (item.ts.p1h) { result.stat.price1h = this.formatScientificNotation(item.ts.p1h) }
637
+ if (item.ts.oiu1h) { result.stat.openInUsd1h = this.formatScientificNotation(item.ts.oiu1h) }
638
+ if (item.ts.ciu1h) { result.stat.closeInUsd1h = this.formatScientificNotation(item.ts.ciu1h) }
611
639
 
612
640
  // 4h data
613
- if (item.ts.b4h !== undefined) {result.buys4h = item.ts.b4h}
614
- if (item.ts.s4h !== undefined) {result.sells4h = item.ts.s4h}
615
- if (item.ts.be4h !== undefined) {result.buyers4h = item.ts.be4h}
616
- if (item.ts.se4h !== undefined) {result.sellers4h = item.ts.se4h}
617
- if (item.ts.bviu4h !== undefined) {result.buyVolumeInUsd4h = this.formatScientificNotation(item.ts.bviu4h)}
618
- if (item.ts.sviu4h !== undefined) {result.sellVolumeInUsd4h = this.formatScientificNotation(item.ts.sviu4h)}
619
- if (item.ts.p4h !== undefined) {result.price4h = this.formatScientificNotation(item.ts.p4h)}
620
- if (item.ts.oiu4h !== undefined) {result.openInUsd4h = this.formatScientificNotation(item.ts.oiu4h)}
621
- if (item.ts.ciu4h !== undefined) {result.closeInUsd4h = this.formatScientificNotation(item.ts.ciu4h)}
641
+ if (item.ts.b4h) { result.stat.buys4h = item.ts.b4h }
642
+ if (item.ts.s4h) { result.stat.sells4h = item.ts.s4h }
643
+ if (item.ts.be4h) { result.stat.buyers4h = item.ts.be4h }
644
+ if (item.ts.se4h) { result.stat.sellers4h = item.ts.se4h }
645
+ if (item.ts.bviu4h) { result.stat.buyVolumeInUsd4h = this.formatScientificNotation(item.ts.bviu4h) }
646
+ if (item.ts.sviu4h) { result.stat.sellVolumeInUsd4h = this.formatScientificNotation(item.ts.sviu4h) }
647
+ if (item.ts.p4h) { result.stat.price4h = this.formatScientificNotation(item.ts.p4h) }
648
+ if (item.ts.oiu4h) { result.stat.openInUsd4h = this.formatScientificNotation(item.ts.oiu4h) }
649
+ if (item.ts.ciu4h) { result.stat.closeInUsd4h = this.formatScientificNotation(item.ts.ciu4h) }
622
650
 
623
651
  // 24h data
624
- if (item.ts.b24h !== undefined) {result.buys24h = item.ts.b24h}
625
- if (item.ts.s24h !== undefined) {result.sells24h = item.ts.s24h}
626
- if (item.ts.be24h !== undefined) {result.buyers24h = item.ts.be24h}
627
- if (item.ts.se24h !== undefined) {result.sellers24h = item.ts.se24h}
628
- if (item.ts.bviu24h !== undefined) {result.buyVolumeInUsd24h = this.formatScientificNotation(item.ts.bviu24h)}
629
- if (item.ts.sviu24h !== undefined) {result.sellVolumeInUsd24h = this.formatScientificNotation(item.ts.sviu24h)}
630
- if (item.ts.p24h !== undefined) {result.price24h = this.formatScientificNotation(item.ts.p24h)}
631
- if (item.ts.oiu24h !== undefined) {result.openInUsd24h = this.formatScientificNotation(item.ts.oiu24h)}
632
- if (item.ts.ciu24h !== undefined) {result.closeInUsd24h = this.formatScientificNotation(item.ts.ciu24h)}
652
+ if (item.ts.b24h) { result.stat.buys24h = item.ts.b24h }
653
+ if (item.ts.s24h) { result.stat.sells24h = item.ts.s24h }
654
+ if (item.ts.be24h) { result.stat.buyers24h = item.ts.be24h }
655
+ if (item.ts.se24h) { result.stat.sellers24h = item.ts.se24h }
656
+ if (item.ts.bviu24h) { result.stat.buyVolumeInUsd24h = this.formatScientificNotation(item.ts.bviu24h) }
657
+ if (item.ts.sviu24h) { result.stat.sellVolumeInUsd24h = this.formatScientificNotation(item.ts.sviu24h) }
658
+ if (item.ts.p24h) { result.stat.price24h = this.formatScientificNotation(item.ts.p24h) }
659
+ if (item.ts.oiu24h) { result.stat.openInUsd24h = this.formatScientificNotation(item.ts.oiu24h) }
660
+ if (item.ts.ciu24h) { result.stat.closeInUsd24h = this.formatScientificNotation(item.ts.ciu24h) }
633
661
 
634
662
  // Current price
635
- if (item.ts.p !== undefined) {result.price = this.formatScientificNotation(item.ts.p)}
663
+ if (item.ts.p) { result.stat.price = this.formatScientificNotation(item.ts.p) }
636
664
  }
637
665
 
638
666
  return result;
@@ -772,12 +800,12 @@ export class StreamApi {
772
800
  callback(
773
801
  data?.map(
774
802
  (it: any) =>
775
- ({
776
- tokenAddress: it.a,
777
- supply: it.s,
778
- marketCapInUsd: it.mc,
779
- timestamp: it.ts,
780
- })
803
+ ({
804
+ tokenAddress: it.a,
805
+ supply: it.s,
806
+ marketCapInUsd: it.mc,
807
+ timestamp: it.ts,
808
+ })
781
809
  )
782
810
  )
783
811
  );
package/src/index.ts CHANGED
@@ -39,7 +39,7 @@ export interface DexAggregatorOptions {
39
39
  streamUrl?: string;
40
40
  }
41
41
 
42
- export const LIB_VERSION = "0.0.8";
42
+ export const LIB_VERSION = "0.0.9";
43
43
 
44
44
  class UserAgentMiddleware implements Middleware {
45
45
  public pre(context: RequestContext): Promise<RequestContext> {
@@ -42,29 +42,29 @@ export class TokenExtraDTO {
42
42
  */
43
43
  'primarySaleHappened'?: boolean;
44
44
  /**
45
- * DTO.TOKEN.EXTRA.OUTER_PROGRAM_ADDRESS
45
+ * DTO.TOKEN.EXTRA.LAUNCH_FROM_PROGRAM_ADDRESS
46
46
  */
47
- 'outerProgramAddress'?: string;
47
+ 'launchFromProgramAddress'?: string;
48
48
  /**
49
- * DTO.TOKEN.EXTRA.OUTER_PROGRAM_PROTOCOL_FAMILY
49
+ * DTO.TOKEN.EXTRA.LAUNCH_FROM_PROTOCOL_FAMILY
50
50
  */
51
- 'outerProgramProtocolFamily'?: string;
51
+ 'launchFromProtocolFamily'?: string;
52
52
  /**
53
53
  * DTO.TOKEN.EXTRA.PROGRAM_ADDRESS
54
54
  */
55
55
  'programAddress'?: string;
56
56
  /**
57
- * DTO.TOKEN.EXTRA.MIGRATED_PROGRAM_ADDRESS
57
+ * DTO.TOKEN.EXTRA.MIGRATED_TO_PROGRAM_ADDRESS
58
58
  */
59
- 'migratedProgramAddress'?: string;
59
+ 'migratedToProgramAddress'?: string;
60
60
  /**
61
- * DTO.TOKEN.EXTRA.MIGRATED_PROTOCOL_FAMILY
61
+ * DTO.TOKEN.EXTRA.MIGRATED_TO_PROTOCOL_FAMILY
62
62
  */
63
- 'migratedProtocolFamily'?: string;
63
+ 'migratedToProtocolFamily'?: string;
64
64
  /**
65
- * DTO.TOKEN.EXTRA.MIGRATED_POOL_ADDRESS
65
+ * DTO.TOKEN.EXTRA.MIGRATED_TO_POOL_ADDRESS
66
66
  */
67
- 'migratedPoolAddress'?: string;
67
+ 'migratedToPoolAddress'?: string;
68
68
  /**
69
69
  * DTO.TOKEN.EXTRA.MIGRATED_AT
70
70
  */
@@ -146,14 +146,14 @@ export class TokenExtraDTO {
146
146
  "format": ""
147
147
  },
148
148
  {
149
- "name": "outerProgramAddress",
150
- "baseName": "outerProgramAddress",
149
+ "name": "launchFromProgramAddress",
150
+ "baseName": "launchFromProgramAddress",
151
151
  "type": "string",
152
152
  "format": ""
153
153
  },
154
154
  {
155
- "name": "outerProgramProtocolFamily",
156
- "baseName": "outerProgramProtocolFamily",
155
+ "name": "launchFromProtocolFamily",
156
+ "baseName": "launchFromProtocolFamily",
157
157
  "type": "string",
158
158
  "format": ""
159
159
  },
@@ -164,20 +164,20 @@ export class TokenExtraDTO {
164
164
  "format": ""
165
165
  },
166
166
  {
167
- "name": "migratedProgramAddress",
168
- "baseName": "migratedProgramAddress",
167
+ "name": "migratedToProgramAddress",
168
+ "baseName": "migratedToProgramAddress",
169
169
  "type": "string",
170
170
  "format": ""
171
171
  },
172
172
  {
173
- "name": "migratedProtocolFamily",
174
- "baseName": "migratedProtocolFamily",
173
+ "name": "migratedToProtocolFamily",
174
+ "baseName": "migratedToProtocolFamily",
175
175
  "type": "string",
176
176
  "format": ""
177
177
  },
178
178
  {
179
- "name": "migratedPoolAddress",
180
- "baseName": "migratedPoolAddress",
179
+ "name": "migratedToPoolAddress",
180
+ "baseName": "migratedToPoolAddress",
181
181
  "type": "string",
182
182
  "format": ""
183
183
  },