@@ -22,14 +22,13 @@ export class RawTransactions {
2222
2323 // Array of hexes
2424 } else if ( Array . isArray ( hex ) ) {
25- const options : AxiosRequestConfig = {
26- method : "POST" ,
27- url : `${ this . restURL } rawtransactions/decodeRawTransaction` ,
28- data : {
25+ // Dev note: must use axios.post for unit test stubbing.
26+ const response : AxiosResponse = await axios . post (
27+ `${ this . restURL } rawtransactions/decodeRawTransaction` ,
28+ {
2929 hexes : hex
3030 }
31- }
32- const response : AxiosResponse = await axios ( options )
31+ )
3332
3433 return response . data
3534 }
@@ -52,14 +51,13 @@ export class RawTransactions {
5251
5352 return response . data
5453 } else if ( Array . isArray ( script ) ) {
55- const options : AxiosRequestConfig = {
56- method : "POST" ,
57- url : `${ this . restURL } rawtransactions/decodeScript` ,
58- data : {
54+ // Dev note: must use axios.post for unit test stubbing.
55+ const response : AxiosResponse = await axios . post (
56+ `${ this . restURL } rawtransactions/decodeScript` ,
57+ {
5958 hexes : script
6059 }
61- }
62- const response : AxiosResponse = await axios ( options )
60+ )
6361
6462 return response . data
6563 }
@@ -90,15 +88,14 @@ export class RawTransactions {
9088
9189 return response . data
9290 } else if ( Array . isArray ( txid ) ) {
93- const options : AxiosRequestConfig = {
94- method : "POST" ,
95- url : `${ this . restURL } rawtransactions/getRawTransaction` ,
96- data : {
91+ // Dev note: must use axios.post for unit test stubbing.
92+ const response : AxiosResponse = await axios . post (
93+ `${ this . restURL } rawtransactions/getRawTransaction` ,
94+ {
9795 txids : txid ,
9896 verbose : verbose
9997 }
100- }
101- const response : AxiosResponse = await axios ( options )
98+ )
10299
103100 return response . data
104101 }
@@ -133,14 +130,14 @@ export class RawTransactions {
133130
134131 // Array input
135132 } else if ( Array . isArray ( hex ) ) {
136- const options : AxiosRequestConfig = {
137- method : "POST" ,
138- url : `${ this . restURL } rawtransactions/sendRawTransaction` ,
139- data : {
133+
134+ // Dev note: must use axios.post for unit test stubbing.
135+ const response : AxiosResponse = await axios . post (
136+ `${ this . restURL } rawtransactions/sendRawTransaction` ,
137+ {
140138 hexes : hex
141139 }
142- }
143- const response : AxiosResponse = await axios ( options )
140+ )
144141
145142 return response . data
146143 }
0 commit comments