mirror of
https://github.com/getwax/bls-wallet.git
synced 2026-01-10 06:17:55 -05:00
Add more logging
This commit is contained in:
@@ -75,6 +75,7 @@ export default class BlsProvider extends ethers.providers.JsonRpcProvider {
|
||||
contractAddress: resolvedTransaction.to.toString(),
|
||||
encodedFunction: resolvedTransaction.data?.toString() ?? "0x",
|
||||
};
|
||||
console.log("action:", action);
|
||||
|
||||
const nonce = await this.getTransactionCount(
|
||||
resolvedTransaction.from.toString(),
|
||||
@@ -89,12 +90,13 @@ export default class BlsProvider extends ethers.providers.JsonRpcProvider {
|
||||
// alternative would be to use a signer instance in this method which is undesirable,
|
||||
// as this would result in tight coupling between a provider and a signer.
|
||||
const throwawayPrivateKey = await BlsWalletWrapper.getRandomBlsPrivateKey();
|
||||
console.log("throwawayPrivateKey:", throwawayPrivateKey);
|
||||
console.log("throwaway privateKey:", throwawayPrivateKey);
|
||||
const throwawayBlsWalletWrapper = await BlsWalletWrapper.connect(
|
||||
throwawayPrivateKey,
|
||||
this.verificationGatewayAddress,
|
||||
this,
|
||||
);
|
||||
console.log("throwaway wallet:", throwawayBlsWalletWrapper);
|
||||
|
||||
const feeEstimate = await this.aggregator.estimateFee(
|
||||
throwawayBlsWalletWrapper.sign({
|
||||
@@ -104,7 +106,10 @@ export default class BlsProvider extends ethers.providers.JsonRpcProvider {
|
||||
);
|
||||
|
||||
const feeRequired = BigNumber.from(feeEstimate.feeRequired);
|
||||
console.log("feeRequired:", ethers.utils.formatUnits(feeRequired));
|
||||
console.log(
|
||||
"feeEstimate:",
|
||||
ethers.utils.formatUnits(addSafetyPremiumToFee(feeRequired)),
|
||||
);
|
||||
return addSafetyPremiumToFee(feeRequired);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
// MockERC20__factory,
|
||||
} from "../clients/src";
|
||||
import getNetworkConfig from "../shared/helpers/getNetworkConfig";
|
||||
import addSafetyPremiumToFee from "../clients/src/helpers/addSafetyDivisorToFee";
|
||||
// import addSafetyPremiumToFee from "../clients/src/helpers/addSafetyDivisorToFee";
|
||||
|
||||
let networkConfig: NetworkConfig;
|
||||
|
||||
@@ -499,12 +499,15 @@ describe("BlsSigner", () => {
|
||||
encodedFunction: "0x",
|
||||
};
|
||||
|
||||
console.log("expectedAction:", expectedAction);
|
||||
|
||||
const wallet = await BlsWalletWrapper.connect(
|
||||
privateKey,
|
||||
verificationGateway,
|
||||
blsProvider,
|
||||
);
|
||||
const walletAddress = wallet.address;
|
||||
console.log("expected wallet:", wallet);
|
||||
|
||||
const expectedNonce = await BlsWalletWrapper.Nonce(
|
||||
wallet.PublicKey(),
|
||||
@@ -522,25 +525,27 @@ describe("BlsSigner", () => {
|
||||
sinon.fake.resolves(privateKey),
|
||||
);
|
||||
|
||||
const actionsWithFeePaymentAction =
|
||||
blsProvider._addFeePaymentActionForFeeEstimation([expectedAction]);
|
||||
const expectedFeeEstimate = await blsProvider.estimateGas(transaction);
|
||||
|
||||
const expectedFeeEstimate = await blsProvider.aggregator.estimateFee(
|
||||
blsSigner.wallet.sign({
|
||||
nonce: expectedNonce,
|
||||
actions: [...actionsWithFeePaymentAction],
|
||||
}),
|
||||
);
|
||||
// const actionsWithFeePaymentAction =
|
||||
// blsProvider._addFeePaymentActionForFeeEstimation([expectedAction]);
|
||||
|
||||
console.log("expected feeRequired", expectedFeeEstimate.feeRequired);
|
||||
// const expectedFeeEstimate = await blsProvider.aggregator.estimateFee(
|
||||
// blsSigner.wallet.sign({
|
||||
// nonce: expectedNonce,
|
||||
// actions: [...actionsWithFeePaymentAction],
|
||||
// }),
|
||||
// );
|
||||
|
||||
const safeFee = addSafetyPremiumToFee(
|
||||
BigNumber.from(expectedFeeEstimate.feeRequired),
|
||||
);
|
||||
console.log("expectedFeeEstimate", expectedFeeEstimate);
|
||||
|
||||
// const safeFee = addSafetyPremiumToFee(
|
||||
// BigNumber.from(expectedFeeEstimate.feeRequired),
|
||||
// );
|
||||
|
||||
const actionsWithSafeFee = blsProvider._addFeePaymentActionWithSafeFee(
|
||||
[expectedAction],
|
||||
safeFee,
|
||||
expectedFeeEstimate,
|
||||
);
|
||||
|
||||
const expectedOperation = {
|
||||
|
||||
Reference in New Issue
Block a user