Skip to content

Commit

Permalink
Merge branch '4.x' into dependabot/npm_and_yarn/docs/babel/traverse-7…
Browse files Browse the repository at this point in the history
….23.2
  • Loading branch information
jdevcs authored Oct 17, 2023
2 parents a75e520 + 226b3ba commit 87491dc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/web3-eth/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ Documentation:

- Ensure provider.supportsSubscriptions exists before watching by subscription (#6440)
- Fixed param sent to `checkRevertBeforeSending` in `sendSignedTransaction`
- Fixed `defaultTransactionBuilder` for value issue (#6509)

### Added

Expand Down
2 changes: 1 addition & 1 deletion packages/web3-eth/src/utils/transaction_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export async function defaultTransactionBuilder<ReturnType = Transaction>(option
}

if (isNullish(populatedTransaction.value)) {
populatedTransaction.value = '0x';
populatedTransaction.value = '0x0';
}

if (!isNullish(populatedTransaction.data)) {
Expand Down
18 changes: 16 additions & 2 deletions packages/web3-eth/test/unit/default_transaction_builder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ describe('defaultTransactionBuilder', () => {
});

describe('should populate value', () => {
it('should populate with 0x', async () => {
it('should populate with 0x0 if not provided', async () => {
const input = { ...transaction };
delete input.value;
delete input.maxPriorityFeePerGas;
Expand All @@ -239,7 +239,21 @@ describe('defaultTransactionBuilder', () => {
web3Context,
fillGasPrice: true,
});
expect(result.value).toBe('0x');
expect(result.value).toBe('0x0');
});


it('should not populate with 0x0 if provided', async () => {
const input = { ...transaction };
delete input.maxPriorityFeePerGas;
delete input.maxFeePerGas;

const result = await defaultTransactionBuilder({
transaction: input,
web3Context,
fillGasPrice: true,
});
expect(result.value).not.toBe('0x0');
});
});

Expand Down

0 comments on commit 87491dc

Please sign in to comment.