Skip to content

Commit 1daf4f5

Browse files
authored
fix: allows nullable value for transaction.to (#2314) (#2319)
fix: allow nullable value for `transaction.to` (#2314) Signed-off-by: Logan Nguyen <[email protected]>
1 parent 5f26a6a commit 1daf4f5

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
@@ -237,6 +237,23 @@ describe('@api-batch-2 RPC Server Acceptance Tests', function () {
237237
expect(res).to.not.be.equal('0x0');
238238
});
239239

240+
it('should execute "eth_estimateGas" with `to` filed set to null (deployment transaction)', async function () {
241+
const res = await relay.call(
242+
RelayCalls.ETH_ENDPOINTS.ETH_ESTIMATE_GAS,
243+
[
244+
{
245+
from: '0x114f60009ee6b84861c0cdae8829751e517bc4d7',
246+
to: null,
247+
value: `0x${'00'.repeat(5121)}`,
248+
},
249+
],
250+
requestId,
251+
);
252+
expect(res).to.contain('0x');
253+
expect(res).to.not.be.equal('0x');
254+
expect(res).to.not.be.equal('0x0');
255+
});
256+
240257
it('should not be able to execute "eth_estimateGas" with no transaction object', async function () {
241258
await relay.callFailing('eth_estimateGas', [], predefined.MISSING_REQUIRED_PARAMETER(0), requestId);
242259
});

0 commit comments

Comments
 (0)