@@ -568,6 +568,81 @@ describe('Rosetta API', () => {
568
568
const result = await supertest ( api . server ) . post ( `/rosetta/v1/construction/parse` ) . send ( request ) ;
569
569
expect ( result . status ) . toBe ( 200 ) ;
570
570
expect ( result . type ) . toBe ( 'application/json' ) ;
571
+ const expectedResponseParseSigned : RosettaConstructionParseResponse = {
572
+ operations : [
573
+ {
574
+ operation_identifier : {
575
+ index : 0 ,
576
+ } ,
577
+ type : 'fee' ,
578
+ status : 'pending' ,
579
+ account : {
580
+ address : 'STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6' ,
581
+ } ,
582
+ amount : {
583
+ value : '-180' ,
584
+ currency : {
585
+ symbol : 'STX' ,
586
+ decimals : 6 ,
587
+ } ,
588
+ } ,
589
+ } ,
590
+ {
591
+ operation_identifier : {
592
+ index : 1 ,
593
+ } ,
594
+ type : 'token_transfer' ,
595
+ status : 'pending' ,
596
+ account : {
597
+ address : 'STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6' ,
598
+ } ,
599
+ amount : {
600
+ value : '-1000' ,
601
+ currency : {
602
+ symbol : 'STX' ,
603
+ decimals : 6 ,
604
+ } ,
605
+ } ,
606
+ coin_change : {
607
+ coin_action : 'coin_spent' ,
608
+ coin_identifier : {
609
+ identifier : '0xaa16520ec7b15f2eb44b91957dfb7aa2484e76f430233971cdcfa452560e182f:1' ,
610
+ } ,
611
+ } ,
612
+ } ,
613
+ {
614
+ operation_identifier : {
615
+ index : 2 ,
616
+ } ,
617
+ related_operations : [
618
+ {
619
+ index : 0 ,
620
+ operation_identifier : {
621
+ index : 1 ,
622
+ } ,
623
+ } ,
624
+ ] ,
625
+ type : 'token_transfer' ,
626
+ status : 'pending' ,
627
+ account : {
628
+ address : 'STDE7Y8HV3RX8VBM2TZVWJTS7ZA1XB0SSC3NEVH0' ,
629
+ } ,
630
+ amount : {
631
+ value : '1000' ,
632
+ currency : {
633
+ symbol : 'STX' ,
634
+ decimals : 6 ,
635
+ } ,
636
+ } ,
637
+ coin_change : {
638
+ coin_action : 'coin_created' ,
639
+ coin_identifier : {
640
+ identifier : '0xaa16520ec7b15f2eb44b91957dfb7aa2484e76f430233971cdcfa452560e182f:2' ,
641
+ } ,
642
+ } ,
643
+ } ,
644
+ ] ,
645
+ } ;
571
646
expect ( JSON . parse ( result . text ) ) . toEqual ( expectedResponseParseSigned ) ;
572
647
} ) ;
573
648
@@ -585,6 +660,81 @@ describe('Rosetta API', () => {
585
660
const result = await supertest ( api . server ) . post ( `/rosetta/v1/construction/parse` ) . send ( request ) ;
586
661
expect ( result . status ) . toBe ( 200 ) ;
587
662
expect ( result . type ) . toBe ( 'application/json' ) ;
663
+ const expectedResponseParseUnsigned : RosettaConstructionParseResponse = {
664
+ operations : [
665
+ {
666
+ operation_identifier : {
667
+ index : 0 ,
668
+ } ,
669
+ type : 'fee' ,
670
+ status : 'pending' ,
671
+ account : {
672
+ address : 'STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6' ,
673
+ } ,
674
+ amount : {
675
+ value : '-180' ,
676
+ currency : {
677
+ symbol : 'STX' ,
678
+ decimals : 6 ,
679
+ } ,
680
+ } ,
681
+ } ,
682
+ {
683
+ operation_identifier : {
684
+ index : 1 ,
685
+ } ,
686
+ type : 'token_transfer' ,
687
+ status : 'pending' ,
688
+ account : {
689
+ address : 'STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6' ,
690
+ } ,
691
+ amount : {
692
+ value : '-1000' ,
693
+ currency : {
694
+ symbol : 'STX' ,
695
+ decimals : 6 ,
696
+ } ,
697
+ } ,
698
+ coin_change : {
699
+ coin_action : 'coin_spent' ,
700
+ coin_identifier : {
701
+ identifier : '0x8687d54aab157110decd8f9fe223d4bfb5d9e7d0d6afe7672bfe5510521c7b27:1' ,
702
+ } ,
703
+ } ,
704
+ } ,
705
+ {
706
+ operation_identifier : {
707
+ index : 2 ,
708
+ } ,
709
+ related_operations : [
710
+ {
711
+ index : 0 ,
712
+ operation_identifier : {
713
+ index : 1 ,
714
+ } ,
715
+ } ,
716
+ ] ,
717
+ type : 'token_transfer' ,
718
+ status : 'pending' ,
719
+ account : {
720
+ address : 'STDE7Y8HV3RX8VBM2TZVWJTS7ZA1XB0SSC3NEVH0' ,
721
+ } ,
722
+ amount : {
723
+ value : '1000' ,
724
+ currency : {
725
+ symbol : 'STX' ,
726
+ decimals : 6 ,
727
+ } ,
728
+ } ,
729
+ coin_change : {
730
+ coin_action : 'coin_created' ,
731
+ coin_identifier : {
732
+ identifier : '0x8687d54aab157110decd8f9fe223d4bfb5d9e7d0d6afe7672bfe5510521c7b27:2' ,
733
+ } ,
734
+ } ,
735
+ } ,
736
+ ] ,
737
+ } ;
588
738
expect ( JSON . parse ( result . text ) ) . toEqual ( expectedResponseParseUnsigned ) ;
589
739
} ) ;
590
740
@@ -598,154 +748,3 @@ describe('Rosetta API', () => {
598
748
await runMigrations ( undefined , 'down' ) ;
599
749
} ) ;
600
750
} ) ;
601
-
602
- const expectedResponseParseUnsigned : RosettaConstructionParseResponse = {
603
- operations : [
604
- {
605
- operation_identifier : {
606
- index : 0 ,
607
- } ,
608
- type : 'fee' ,
609
- status : 'pending' ,
610
- account : {
611
- address : 'STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6' ,
612
- } ,
613
- amount : {
614
- value : '-180' ,
615
- currency : {
616
- symbol : 'STX' ,
617
- decimals : 6 ,
618
- } ,
619
- } ,
620
- } ,
621
- {
622
- operation_identifier : {
623
- index : 1 ,
624
- } ,
625
- type : 'token_transfer' ,
626
- status : 'pending' ,
627
- account : {
628
- address : 'STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6' ,
629
- } ,
630
- amount : {
631
- value : '-1000' ,
632
- currency : {
633
- symbol : 'STX' ,
634
- decimals : 6 ,
635
- } ,
636
- } ,
637
- coin_change : {
638
- coin_action : 'coin_spent' ,
639
- coin_identifier : {
640
- identifier : '0x8687d54aab157110decd8f9fe223d4bfb5d9e7d0d6afe7672bfe5510521c7b27:1' ,
641
- } ,
642
- } ,
643
- } ,
644
- {
645
- operation_identifier : {
646
- index : 2 ,
647
- } ,
648
- related_operations : [
649
- {
650
- index : 0 ,
651
- operation_identifier : {
652
- index : 1 ,
653
- } ,
654
- } ,
655
- ] ,
656
- type : 'token_transfer' ,
657
- status : 'pending' ,
658
- account : {
659
- address : 'STDE7Y8HV3RX8VBM2TZVWJTS7ZA1XB0SSC3NEVH0' ,
660
- } ,
661
- amount : {
662
- value : '1000' ,
663
- currency : {
664
- symbol : 'STX' ,
665
- decimals : 6 ,
666
- } ,
667
- } ,
668
- coin_change : {
669
- coin_action : 'coin_created' ,
670
- coin_identifier : {
671
- identifier : '0x8687d54aab157110decd8f9fe223d4bfb5d9e7d0d6afe7672bfe5510521c7b27:2' ,
672
- } ,
673
- } ,
674
- } ,
675
- ] ,
676
- } ;
677
- const expectedResponseParseSigned : RosettaConstructionParseResponse = {
678
- operations : [
679
- {
680
- operation_identifier : {
681
- index : 0 ,
682
- } ,
683
- type : 'fee' ,
684
- status : 'pending' ,
685
- account : {
686
- address : 'STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6' ,
687
- } ,
688
- amount : {
689
- value : '-180' ,
690
- currency : {
691
- symbol : 'STX' ,
692
- decimals : 6 ,
693
- } ,
694
- } ,
695
- } ,
696
- {
697
- operation_identifier : {
698
- index : 1 ,
699
- } ,
700
- type : 'token_transfer' ,
701
- status : 'pending' ,
702
- account : {
703
- address : 'STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6' ,
704
- } ,
705
- amount : {
706
- value : '-1000' ,
707
- currency : {
708
- symbol : 'STX' ,
709
- decimals : 6 ,
710
- } ,
711
- } ,
712
- coin_change : {
713
- coin_action : 'coin_spent' ,
714
- coin_identifier : {
715
- identifier : '0xaa16520ec7b15f2eb44b91957dfb7aa2484e76f430233971cdcfa452560e182f:1' ,
716
- } ,
717
- } ,
718
- } ,
719
- {
720
- operation_identifier : {
721
- index : 2 ,
722
- } ,
723
- related_operations : [
724
- {
725
- index : 0 ,
726
- operation_identifier : {
727
- index : 1 ,
728
- } ,
729
- } ,
730
- ] ,
731
- type : 'token_transfer' ,
732
- status : 'pending' ,
733
- account : {
734
- address : 'STDE7Y8HV3RX8VBM2TZVWJTS7ZA1XB0SSC3NEVH0' ,
735
- } ,
736
- amount : {
737
- value : '1000' ,
738
- currency : {
739
- symbol : 'STX' ,
740
- decimals : 6 ,
741
- } ,
742
- } ,
743
- coin_change : {
744
- coin_action : 'coin_created' ,
745
- coin_identifier : {
746
- identifier : '0xaa16520ec7b15f2eb44b91957dfb7aa2484e76f430233971cdcfa452560e182f:2' ,
747
- } ,
748
- } ,
749
- } ,
750
- ] ,
751
- } ;
0 commit comments