@@ -770,67 +770,27 @@ Method.prototype.buildCall = function () {
770
770
return method . requestManager . send ( payload , sendTxCallback ) ;
771
771
} ;
772
772
773
- // Send the actual transaction
774
- if ( isSendTx
775
- && ! ! payload . params [ 0 ]
776
- && typeof payload . params [ 0 ] === 'object'
777
- && typeof payload . params [ 0 ] . gasPrice === 'undefined'
778
- ) {
779
-
780
- var getGasPrice = ( new Method ( {
781
- name : 'getGasPrice' ,
782
- call : 'eth_gasPrice' ,
783
- params : 0
784
- } ) ) . createFunction ( method . requestManager ) ;
785
-
786
- getGasPrice ( function ( err , gasPrice ) {
787
- console . log ( 'debug1' , gasPrice , payload )
788
-
789
- if ( gasPrice ) {
790
- payload . params [ 0 ] . gasPrice = gasPrice ;
791
- }
792
-
793
- console . log ( 'debug2' , gasPrice , payload )
794
-
795
- if ( isSendTx ) {
796
- setTimeout ( ( ) => {
797
- defer . eventEmitter . emit ( 'sending' , payload ) ;
798
- } , 0 ) ;
799
- }
800
-
801
- sendRequest ( payload , method ) ;
802
- } ) ;
803
-
804
- } else {
805
- if ( isSendTx ) {
806
- setTimeout ( ( ) => {
807
- defer . eventEmitter . emit ( 'sending' , payload ) ;
808
- } , 0 ) ;
809
- }
810
-
811
- sendRequest ( payload , method ) ;
812
- }
813
-
814
773
// Send the actual transaction
815
774
// if (isSendTx
816
775
// && !!payload.params[0]
817
776
// && typeof payload.params[0] === 'object'
818
777
// && typeof payload.params[0].gasPrice === 'undefined'
819
- // // && (
820
- // // typeof payload.params[0].gasPrice === 'undefined'
821
- // // && (
822
- // // typeof payload.params[0].maxPriorityFeePerGas === 'undefined'
823
- // // || typeof payload.params[0].maxFeePerGas === 'undefined'
824
- // // )
825
- // // )
826
778
// ) {
827
- // // if (typeof payload.params[0].type === 'undefined')
828
- // // payload.params[0].type = _handleTxType(payload.params[0]);
829
779
830
- // _handleTxPricing(method, payload.params[0]).then(txPricing => {
831
- // console.log('debug1', payload)
832
- // payload.params[0] = {...payload.params[0], ...txPricing};
833
- // console.log('debug2', payload)
780
+ // var getGasPrice = (new Method({
781
+ // name: 'getGasPrice',
782
+ // call: 'eth_gasPrice',
783
+ // params: 0
784
+ // })).createFunction(method.requestManager);
785
+
786
+ // getGasPrice(function (err, gasPrice) {
787
+ // console.log('debug1', gasPrice, payload)
788
+
789
+ // if (gasPrice) {
790
+ // payload.params[0].gasPrice = gasPrice;
791
+ // }
792
+
793
+ // console.log('debug2', gasPrice, payload)
834
794
835
795
// if (isSendTx) {
836
796
// setTimeout(() => {
@@ -839,7 +799,8 @@ Method.prototype.buildCall = function () {
839
799
// }
840
800
841
801
// sendRequest(payload, method);
842
- // })
802
+ // });
803
+
843
804
// } else {
844
805
// if (isSendTx) {
845
806
// setTimeout(() => {
@@ -850,11 +811,53 @@ Method.prototype.buildCall = function () {
850
811
// sendRequest(payload, method);
851
812
// }
852
813
853
- // if (isSendTx) {
854
- // setTimeout(() => {
855
- // defer.eventEmitter.emit('sent', payload);
856
- // }, 0);
857
- // }
814
+ // Send the actual transaction
815
+ if ( isSendTx
816
+ && ! ! payload . params [ 0 ]
817
+ && typeof payload . params [ 0 ] === 'object'
818
+ && typeof payload . params [ 0 ] . gasPrice === 'undefined'
819
+ // && (
820
+ // typeof payload.params[0].gasPrice === 'undefined'
821
+ // && (
822
+ // typeof payload.params[0].maxPriorityFeePerGas === 'undefined'
823
+ // || typeof payload.params[0].maxFeePerGas === 'undefined'
824
+ // )
825
+ // )
826
+ ) {
827
+ // if (typeof payload.params[0].type === 'undefined')
828
+ // payload.params[0].type = _handleTxType(payload.params[0]);
829
+
830
+ _handleTxPricing ( method , payload . params [ 0 ] ) . then ( txPricing => {
831
+ console . log ( 'debug1' , payload )
832
+ console . log ( 'debug3' , txPricing )
833
+ if ( txPricing . gasPrice )
834
+ payload . params [ 0 ] . gasPrice = txPricing . gasPrice ;
835
+ // payload.params[0] = {...payload.params[0], ...txPricing};
836
+ console . log ( 'debug2' , payload )
837
+
838
+ if ( isSendTx ) {
839
+ setTimeout ( ( ) => {
840
+ defer . eventEmitter . emit ( 'sending' , payload ) ;
841
+ } , 0 ) ;
842
+ }
843
+
844
+ sendRequest ( payload , method ) ;
845
+ } )
846
+ } else {
847
+ if ( isSendTx ) {
848
+ setTimeout ( ( ) => {
849
+ defer . eventEmitter . emit ( 'sending' , payload ) ;
850
+ } , 0 ) ;
851
+ }
852
+
853
+ sendRequest ( payload , method ) ;
854
+ }
855
+
856
+ if ( isSendTx ) {
857
+ setTimeout ( ( ) => {
858
+ defer . eventEmitter . emit ( 'sent' , payload ) ;
859
+ } , 0 ) ;
860
+ }
858
861
859
862
return defer . eventEmitter ;
860
863
} ;
0 commit comments