@@ -1000,7 +1000,84 @@ describe('Rosetta API', () => {
1000
1000
expect ( JSON . parse ( result3 . text ) ) . toEqual ( expectedResponse3 ) ;
1001
1001
} ) ;
1002
1002
1003
- test ( 'construction/preprocess' , async ( ) => {
1003
+ test ( 'construction/preprocess - Stack STX' , async ( ) => {
1004
+ const sender = testnetKeys [ 0 ] . stacksAddress ;
1005
+ const stacking_amount = 5000 ;
1006
+ const number_of_cycles = 5 ;
1007
+
1008
+ const request : RosettaConstructionPayloadsRequest = {
1009
+ network_identifier : {
1010
+ blockchain : RosettaConstants . blockchain ,
1011
+ network : getRosettaNetworkName ( ChainID . Testnet ) ,
1012
+ } ,
1013
+ operations : [
1014
+ {
1015
+ operation_identifier : {
1016
+ index : 1 ,
1017
+ network_index : 0 ,
1018
+ } ,
1019
+ related_operations : [ ] ,
1020
+ type : 'stack_stx' ,
1021
+ account : {
1022
+ address : sender ,
1023
+ metadata : { } ,
1024
+ } ,
1025
+ amount : {
1026
+ value : '-' + stacking_amount ,
1027
+ currency : {
1028
+ symbol : 'STX' ,
1029
+ decimals : 6 ,
1030
+ } ,
1031
+ } ,
1032
+ metadata : {
1033
+ number_of_cycles : number_of_cycles ,
1034
+ pox_addr : '1Xik14zRm29UsyS6DjhYg4iZeZqsDa8D3' ,
1035
+ }
1036
+ } ,
1037
+ ] ,
1038
+ metadata : {
1039
+ memo : 'SAMPLE MEMO' ,
1040
+ } ,
1041
+ max_fee : [
1042
+ {
1043
+ value : '12380898' ,
1044
+ currency : {
1045
+ symbol : 'STX' ,
1046
+ decimals : 6 ,
1047
+ } ,
1048
+ metadata : { } ,
1049
+ } ,
1050
+ ] ,
1051
+ suggested_fee_multiplier : 1 ,
1052
+ } ;
1053
+
1054
+ const result = await supertest ( api . server )
1055
+ . post ( `/rosetta/v1/construction/preprocess` )
1056
+ . send ( request ) ;
1057
+
1058
+ expect ( result . status ) . toBe ( 200 ) ;
1059
+ expect ( result . type ) . toBe ( 'application/json' ) ;
1060
+
1061
+ const expectResponse : RosettaConstructionPreprocessResponse = {
1062
+ options : {
1063
+ sender_address : 'STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6' ,
1064
+ type : 'stack_stx' ,
1065
+ number_of_cycles : 5 ,
1066
+ amount : '5000' ,
1067
+ symbol : 'STX' ,
1068
+ decimals : 6 ,
1069
+ pox_addr : '1Xik14zRm29UsyS6DjhYg4iZeZqsDa8D3' ,
1070
+ suggested_fee_multiplier : 1 ,
1071
+ max_fee : '12380898' ,
1072
+ size : 260 ,
1073
+ memo : 'SAMPLE MEMO'
1074
+ } ,
1075
+ required_public_keys : [ { address : 'STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6' } ]
1076
+ }
1077
+ expect ( JSON . parse ( result . text ) ) . toEqual ( expectResponse ) ;
1078
+ } ) ;
1079
+
1080
+ test ( 'construction/preprocess - token transfer' , async ( ) => {
1004
1081
const request : RosettaConstructionPreprocessRequest = {
1005
1082
network_identifier : {
1006
1083
blockchain : RosettaConstants . blockchain ,
0 commit comments