Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 146b096

Browse files
committed
Debug - old code
1 parent 431aa81 commit 146b096

File tree

1 file changed

+60
-57
lines changed

1 file changed

+60
-57
lines changed

packages/web3-core-method/src/index.js

Lines changed: 60 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -770,64 +770,27 @@ Method.prototype.buildCall = function () {
770770
return method.requestManager.send(payload, sendTxCallback);
771771
};
772772

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-
788-
// if (gasPrice) {
789-
// payload.params[0].gasPrice = gasPrice;
790-
// }
791-
792-
// if (isSendTx) {
793-
// setTimeout(() => {
794-
// defer.eventEmitter.emit('sending', payload);
795-
// }, 0);
796-
// }
797-
798-
// sendRequest(payload, method);
799-
// });
800-
801-
// } else {
802-
// if (isSendTx) {
803-
// setTimeout(() => {
804-
// defer.eventEmitter.emit('sending', payload);
805-
// }, 0);
806-
// }
807-
808-
// sendRequest(payload, method);
809-
// }
810-
811773
// Send the actual transaction
812774
if (isSendTx
813775
&& !!payload.params[0]
814776
&& typeof payload.params[0] === 'object'
815777
&& typeof payload.params[0].gasPrice === 'undefined'
816-
// && (
817-
// typeof payload.params[0].gasPrice === 'undefined'
818-
// && (
819-
// typeof payload.params[0].maxPriorityFeePerGas === 'undefined'
820-
// || typeof payload.params[0].maxFeePerGas === 'undefined'
821-
// )
822-
// )
823778
) {
824-
// if (typeof payload.params[0].type === 'undefined')
825-
// payload.params[0].type = _handleTxType(payload.params[0]);
826779

827-
_handleTxPricing(method, payload.params[0]).then(txPricing => {
828-
console.log('debug1', payload)
829-
payload.params[0] = {...payload.params[0], ...txPricing};
830-
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)
831794

832795
if (isSendTx) {
833796
setTimeout(() => {
@@ -836,7 +799,8 @@ Method.prototype.buildCall = function () {
836799
}
837800

838801
sendRequest(payload, method);
839-
})
802+
});
803+
840804
} else {
841805
if (isSendTx) {
842806
setTimeout(() => {
@@ -847,11 +811,50 @@ Method.prototype.buildCall = function () {
847811
sendRequest(payload, method);
848812
}
849813

850-
if (isSendTx) {
851-
setTimeout(() => {
852-
defer.eventEmitter.emit('sent', payload);
853-
}, 0);
854-
}
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+
// payload.params[0] = {...payload.params[0], ...txPricing};
833+
// console.log('debug2', payload)
834+
835+
// if (isSendTx) {
836+
// setTimeout(() => {
837+
// defer.eventEmitter.emit('sending', payload);
838+
// }, 0);
839+
// }
840+
841+
// sendRequest(payload, method);
842+
// })
843+
// } else {
844+
// if (isSendTx) {
845+
// setTimeout(() => {
846+
// defer.eventEmitter.emit('sending', payload);
847+
// }, 0);
848+
// }
849+
850+
// sendRequest(payload, method);
851+
// }
852+
853+
// if (isSendTx) {
854+
// setTimeout(() => {
855+
// defer.eventEmitter.emit('sent', payload);
856+
// }, 0);
857+
// }
855858

856859
return defer.eventEmitter;
857860
};

0 commit comments

Comments
 (0)