Skip to content

Commit 4d27429

Browse files
ebadierequiet-node
andauthored
fix: allows nullable value for transaction.to (#2314) (#2319) (#2335)
fix: allow nullable value for `transaction.to` (#2314) Signed-off-by: Logan Nguyen <[email protected]> Co-authored-by: Logan Nguyen <[email protected]>
1 parent 5e16709 commit 4d27429

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

packages/server/src/validator/objectTypes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const OBJECTS_VALIDATIONS = {
4343
},
4444
to: {
4545
type: 'address',
46-
nullable: false,
46+
nullable: true,
4747
},
4848
gas: {
4949
type: 'hex',

packages/server/tests/acceptance/rpc_batch2.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,23 @@ describe('@api-batch-2 RPC Server Acceptance Tests', function () {
230230
expect(res).to.not.be.equal('0x0');
231231
});
232232

233+
it('should execute "eth_estimateGas" with `to` filed set to null (deployment transaction)', async function () {
234+
const res = await relay.call(
235+
RelayCalls.ETH_ENDPOINTS.ETH_ESTIMATE_GAS,
236+
[
237+
{
238+
from: '0x114f60009ee6b84861c0cdae8829751e517bc4d7',
239+
to: null,
240+
value: `0x${'00'.repeat(5121)}`,
241+
},
242+
],
243+
requestId,
244+
);
245+
expect(res).to.contain('0x');
246+
expect(res).to.not.be.equal('0x');
247+
expect(res).to.not.be.equal('0x0');
248+
});
249+
233250
it('should not be able to execute "eth_estimateGas" with no transaction object', async function () {
234251
await relay.callFailing('eth_estimateGas', [], predefined.MISSING_REQUIRED_PARAMETER(0), requestId);
235252
});

0 commit comments

Comments
 (0)