@@ -18,7 +18,7 @@ import {
18
18
} from '@blockstack/stacks-transactions' ;
19
19
import * as BN from 'bn.js' ;
20
20
import { getCoreNodeEndpoint , StacksCoreRpcClient } from '../core-rpc/client' ;
21
- import { timeout , bufferToHexPrefixString } from '../helpers' ;
21
+ import { bufferToHexPrefixString } from '../helpers' ;
22
22
import {
23
23
RosettaConstructionDeriveRequest ,
24
24
RosettaConstructionDeriveResponse ,
@@ -39,12 +39,6 @@ describe('Rosetta API', () => {
39
39
let eventServer : Server ;
40
40
let api : ApiServer ;
41
41
42
- function getStacksTestnetNetwork ( ) {
43
- const stacksNetwork = new StacksTestnet ( ) ;
44
- stacksNetwork . coreApiUrl = `http://${ getCoreNodeEndpoint ( ) } ` ;
45
- return stacksNetwork ;
46
- }
47
-
48
42
beforeAll ( async ( ) => {
49
43
process . env . PG_DATABASE = 'postgres' ;
50
44
await cycleMigrations ( ) ;
@@ -340,7 +334,7 @@ describe('Rosetta API', () => {
340
334
recipient : 'STRYYQQ9M8KAF4NS7WNZQYY59X93XEKR31JP64CP' ,
341
335
amount : new BN ( 3852 ) ,
342
336
senderKey : 'c71700b07d520a8c9731e4d0f095aa6efb91e16e25fb27ce2b72e7b698f8127a01' ,
343
- network : getStacksTestnetNetwork ( ) ,
337
+ network : GetStacksTestnetNetwork ( ) ,
344
338
memo : 'test1234' ,
345
339
} ) ;
346
340
expectedTxId = '0x' + transferTx . txid ( ) ;
@@ -418,9 +412,9 @@ describe('Rosetta API', () => {
418
412
} ) ;
419
413
} ) ;
420
414
421
- /** rosetta construction tests */
422
- /**derive api tests */
423
- test ( 'derive api ' , async ( ) => {
415
+ /* rosetta construction api tests below */
416
+
417
+ test ( 'construction/ derive' , async ( ) => {
424
418
const request : RosettaConstructionDeriveRequest = {
425
419
network_identifier : {
426
420
blockchain : RosettaConstants . blockchain ,
@@ -485,10 +479,8 @@ describe('Rosetta API', () => {
485
479
486
480
expect ( JSON . parse ( result3 . text ) ) . toEqual ( expectedResponse3 ) ;
487
481
} ) ;
488
- /**end */
489
482
490
- /**preprocess api tests */
491
- test ( 'construction preprocess api success' , async ( ) => {
483
+ test ( 'construction/preprocess' , async ( ) => {
492
484
const request : RosettaConstructionPreprocessRequest = {
493
485
network_identifier : {
494
486
blockchain : RosettaConstants . blockchain ,
@@ -597,7 +589,7 @@ describe('Rosetta API', () => {
597
589
expect ( JSON . parse ( result . text ) ) . toEqual ( expectResponse ) ;
598
590
} ) ;
599
591
600
- test ( 'construction preprocess api failure' , async ( ) => {
592
+ test ( 'construction/ preprocess - failure' , async ( ) => {
601
593
const request2 = {
602
594
network_identifier : {
603
595
blockchain : RosettaConstants . blockchain ,
@@ -691,10 +683,8 @@ describe('Rosetta API', () => {
691
683
692
684
expect ( JSON . parse ( result2 . text ) ) . toEqual ( expectedResponse2 ) ;
693
685
} ) ;
694
- /**end */
695
686
696
- /**metadata api test cases */
697
- test ( 'metadata api' , async ( ) => {
687
+ test ( 'construction/metadata - success' , async ( ) => {
698
688
const request : RosettaConstructionMetadataRequest = {
699
689
network_identifier : {
700
690
blockchain : 'stacks' ,
@@ -722,7 +712,7 @@ describe('Rosetta API', () => {
722
712
expect ( JSON . parse ( result . text ) ) . toHaveProperty ( 'metadata' ) ;
723
713
} ) ;
724
714
725
- test ( 'metadata api empty network identifier' , async ( ) => {
715
+ test ( 'construction/ metadata - empty network identifier' , async ( ) => {
726
716
const request = {
727
717
options : {
728
718
sender_address : 'STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6' ,
@@ -756,7 +746,7 @@ describe('Rosetta API', () => {
756
746
expect ( JSON . parse ( result . text ) ) . toEqual ( expectResponse ) ;
757
747
} ) ;
758
748
759
- test ( 'metadata invalid transfer type' , async ( ) => {
749
+ test ( 'construction/ metadata - invalid transfer type' , async ( ) => {
760
750
const request : RosettaConstructionMetadataRequest = {
761
751
network_identifier : {
762
752
blockchain : 'stacks' ,
@@ -791,7 +781,7 @@ describe('Rosetta API', () => {
791
781
expect ( JSON . parse ( result . text ) ) . toEqual ( expectResponse ) ;
792
782
} ) ;
793
783
794
- test ( 'metadata invalid sender address' , async ( ) => {
784
+ test ( 'construction/ metadata - invalid sender address' , async ( ) => {
795
785
const request : RosettaConstructionMetadataRequest = {
796
786
network_identifier : {
797
787
blockchain : 'stacks' ,
@@ -826,7 +816,7 @@ describe('Rosetta API', () => {
826
816
expect ( JSON . parse ( result . text ) ) . toEqual ( expectResponse ) ;
827
817
} ) ;
828
818
829
- test ( 'metadata invalid recipient address' , async ( ) => {
819
+ test ( 'construction/ metadata - invalid recipient address' , async ( ) => {
830
820
const request : RosettaConstructionMetadataRequest = {
831
821
network_identifier : {
832
822
blockchain : 'stacks' ,
@@ -860,10 +850,8 @@ describe('Rosetta API', () => {
860
850
861
851
expect ( JSON . parse ( result . text ) ) . toEqual ( expectResponse ) ;
862
852
} ) ;
863
- /** end */
864
853
865
- /**hash api test cases */
866
- test ( 'construction hash api success' , async ( ) => {
854
+ test ( 'construction/hash' , async ( ) => {
867
855
const request : RosettaConstructionHashRequest = {
868
856
network_identifier : {
869
857
blockchain : RosettaConstants . blockchain ,
@@ -885,7 +873,7 @@ describe('Rosetta API', () => {
885
873
expect ( JSON . parse ( result . text ) ) . toEqual ( expectedResponse ) ;
886
874
} ) ;
887
875
888
- test ( 'construction hash api no `0x` prefix' , async ( ) => {
876
+ test ( 'construction/ hash - no `0x` prefix' , async ( ) => {
889
877
const request : RosettaConstructionHashRequest = {
890
878
network_identifier : {
891
879
blockchain : RosettaConstants . blockchain ,
@@ -903,7 +891,7 @@ describe('Rosetta API', () => {
903
891
expect ( JSON . parse ( result . text ) ) . toEqual ( expectedResponse ) ;
904
892
} ) ;
905
893
906
- test ( 'construction hash api odd number of hex digits ' , async ( ) => {
894
+ test ( 'construction/ hash - odd number of hex digits' , async ( ) => {
907
895
const request : RosettaConstructionHashRequest = {
908
896
network_identifier : {
909
897
blockchain : RosettaConstants . blockchain ,
@@ -921,7 +909,7 @@ describe('Rosetta API', () => {
921
909
expect ( JSON . parse ( result . text ) ) . toEqual ( expectedResponse ) ;
922
910
} ) ;
923
911
924
- test ( 'construction hash api an unsigned transaction ' , async ( ) => {
912
+ test ( 'construction/ hash - unsigned transaction' , async ( ) => {
925
913
const request : RosettaConstructionHashRequest = {
926
914
network_identifier : {
927
915
blockchain : RosettaConstants . blockchain ,
@@ -940,7 +928,7 @@ describe('Rosetta API', () => {
940
928
expect ( JSON . parse ( result . text ) ) . toEqual ( expectedResponse ) ;
941
929
} ) ;
942
930
943
- test ( 'parse api signed' , async ( ) => {
931
+ test ( 'construction/ parse - signed' , async ( ) => {
944
932
const publicKey = publicKeyToString (
945
933
getPublicKey ( createStacksPrivateKey ( testnetKeys [ 0 ] . secretKey ) )
946
934
) ;
@@ -981,7 +969,7 @@ describe('Rosetta API', () => {
981
969
expect ( actual . operations [ 2 ] . amount ?. value ) . toEqual ( amount . toString ( ) ) ;
982
970
} ) ;
983
971
984
- test ( 'parse api unsigned' , async ( ) => {
972
+ test ( 'construction/ parse - unsigned' , async ( ) => {
985
973
const publicKey = publicKeyToString (
986
974
getPublicKey ( createStacksPrivateKey ( testnetKeys [ 0 ] . secretKey ) )
987
975
) ;
@@ -1022,7 +1010,7 @@ describe('Rosetta API', () => {
1022
1010
expect ( actual . operations [ 2 ] . amount ?. value ) . toEqual ( amount . toString ( ) ) ;
1023
1011
} ) ;
1024
1012
1025
- /** end */
1013
+ /* rosetta construction end */
1026
1014
1027
1015
afterAll ( async ( ) => {
1028
1016
await new Promise ( resolve => eventServer . close ( ( ) => resolve ( ) ) ) ;
0 commit comments