Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug: Calling some RPC methods cause the RPC proxy to crash #1234

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions packages/errors/src/available-errors/function/function.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/errors/src/available-errors/function/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/errors/src/available-errors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export * from './bloom';
export * from './certificate';
export * from './contract';
export * from './data';
export * from './function';
export * from './hdnode';
export * from './http';
export * from './keystore';
Expand Down
25 changes: 0 additions & 25 deletions packages/errors/tests/available-errors/function.unit.test.ts

This file was deleted.

6 changes: 3 additions & 3 deletions packages/hardhat-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import './type-extensions';
import { HardhatEthersProvider } from '@nomicfoundation/hardhat-ethers/internal/hardhat-ethers-provider';
import { contractAdapter, factoryAdapter } from '@vechain/sdk-ethers-adapter';
import { type FactoryOptions } from '@nomicfoundation/hardhat-ethers/src/types';
import { FunctionNotImplemented } from '@vechain/sdk-errors';
import { VechainSDKError } from '@vechain/sdk-errors';

/**
* Extend the environment with provider to be able to use VeChain functions
Expand Down Expand Up @@ -143,9 +143,9 @@ extendEnvironment((hre) => {
},

getImpersonatedSigner: (_address: string) => {
throw new FunctionNotImplemented(
throw new VechainSDKError(
'getImpersonatedSigner()',
'Method not implemented',
'Method not implemented.',
{ functionName: 'getImpersonatedSigner' }
);
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { FunctionNotImplemented } from '@vechain/sdk-errors';
import { type ThorClient } from '../../../../../../thor-client';
import { VeChainSDKLogger } from '@vechain/sdk-logging';

/**
* RPC Method debug_getBadBlocks implementation
Expand All @@ -10,25 +9,16 @@ import { type ThorClient } from '../../../../../../thor-client';
* * params[0]: ...
* * params[1]: ...
* * params[n]: ...
* @throws {FunctionNotImplemented}
*/
const debugGetBadBlocks = async (
thorClient: ThorClient,
params: unknown[]
): Promise<void> => {
const debugGetBadBlocks = async (): Promise<void> => {
// To avoid eslint error
await Promise.resolve(0);

// Not implemented yet
throw new FunctionNotImplemented(
'debug_getBadBlocks',
'Method "debug_getBadBlocks" has not been implemented yet.',
{
functionName: 'debug_getBadBlocks',
thorClient,
params
}
);
VeChainSDKLogger('warning').log({
title: 'debug_getBadBlocks',
messages: ['Method "debug_getBadBlocks" has not been implemented yet.']
});
};

export { debugGetBadBlocks };
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { FunctionNotImplemented } from '@vechain/sdk-errors';
import { type ThorClient } from '../../../../../../thor-client';
import { VeChainSDKLogger } from '@vechain/sdk-logging';

/**
* RPC Method debug_getRawBlock implementation
Expand All @@ -10,25 +9,16 @@ import { type ThorClient } from '../../../../../../thor-client';
* * params[0]: ...
* * params[1]: ...
* * params[n]: ...
* @throws {FunctionNotImplemented}
*/
const debugGetRawBlock = async (
thorClient: ThorClient,
params: unknown[]
): Promise<void> => {
const debugGetRawBlock = async (): Promise<void> => {
// To avoid eslint error
await Promise.resolve(0);

// Not implemented yet
throw new FunctionNotImplemented(
'debug_getRawBlock',
'Method "debug_getRawBlock" has not been implemented yet.',
{
functionName: 'debug_getRawBlock',
thorClient,
params
}
);
VeChainSDKLogger('warning').log({
title: 'debug_getRawBlock',
messages: ['Method "debug_getRawBlock" has not been implemented yet.']
});
};

export { debugGetRawBlock };
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { FunctionNotImplemented } from '@vechain/sdk-errors';
import { type ThorClient } from '../../../../../../thor-client';
import { VeChainSDKLogger } from '@vechain/sdk-logging';

/**
* RPC Method debug_getRawHeader implementation
Expand All @@ -10,25 +9,16 @@ import { type ThorClient } from '../../../../../../thor-client';
* * params[0]: ...
* * params[1]: ...
* * params[n]: ...
* @throws {FunctionNotImplemented}
*/
const debugGetRawHeader = async (
thorClient: ThorClient,
params: unknown[]
): Promise<void> => {
const debugGetRawHeader = async (): Promise<void> => {
// To avoid eslint error
await Promise.resolve(0);

// Not implemented yet
throw new FunctionNotImplemented(
'debug_getRawHeader',
'Method "debug_getRawHeader" has not been implemented yet.',
{
functionName: 'debug_getRawHeader',
thorClient,
params
}
);
VeChainSDKLogger('warning').log({
title: 'debug_getRawHeader',
messages: ['Method "debug_getRawHeader" has not been implemented yet.']
});
};

export { debugGetRawHeader };
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { FunctionNotImplemented } from '@vechain/sdk-errors';
import { type ThorClient } from '../../../../../../thor-client';
import { VeChainSDKLogger } from '@vechain/sdk-logging';

/**
* RPC Method debug_getRawReceipts implementation
Expand All @@ -10,25 +9,18 @@ import { type ThorClient } from '../../../../../../thor-client';
* * params[0]: ...
* * params[1]: ...
* * params[n]: ...
* @throws {FunctionNotImplemented}
*/
const debugGetRawReceipts = async (
thorClient: ThorClient,
params: unknown[]
): Promise<void> => {
const debugGetRawReceipts = async (): Promise<void> => {
// To avoid eslint error
await Promise.resolve(0);

// Not implemented yet
throw new FunctionNotImplemented(
'debug_getRawReceipts',
'Method "debug_getRawReceipts" has not been implemented yet.',
{
functionName: 'debug_getRawReceipts',
thorClient,
params
}
);
VeChainSDKLogger('warning').log({
title: 'debug_getRawReceipts',
messages: [
'Method "debug_getRawReceipts" has not been implemented yet.'
]
});
};

export { debugGetRawReceipts };
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { type ThorClient } from '../../../../../../thor-client';
import { FunctionNotImplemented } from '@vechain/sdk-errors';
import { VeChainSDKLogger } from '@vechain/sdk-logging';

/**
* RPC Method debug_getRawTransaction implementation
Expand All @@ -10,25 +9,18 @@ import { FunctionNotImplemented } from '@vechain/sdk-errors';
* * params[0]: ...
* * params[1]: ...
* * params[n]: ...
@throws {FunctionNotImplemented}
*/
const debugGetRawTransaction = async (
thorClient: ThorClient,
params: unknown[]
): Promise<void> => {
const debugGetRawTransaction = async (): Promise<void> => {
// To avoid eslint error
await Promise.resolve(0);

// Not implemented yet
throw new FunctionNotImplemented(
'debug_getRawTransaction',
'Method "debug_getRawTransaction" has not been implemented yet.',
{
functionName: 'debug_getRawTransaction',
thorClient,
params
}
);
VeChainSDKLogger('warning').log({
title: 'debug_getRawTransaction',
messages: [
'Method "debug_getRawTransaction" has not been implemented yet.'
]
});
};

export { debugGetRawTransaction };
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { type ThorClient } from '../../../../../../thor-client';
import { FunctionNotImplemented } from '@vechain/sdk-errors';

import { VeChainSDKLogger } from '@vechain/sdk-logging';
/**
* RPC Method engine_exchangeCapabilities implementation
*
Expand All @@ -10,25 +8,18 @@ import { FunctionNotImplemented } from '@vechain/sdk-errors';
* * params[0]: ...
* * params[1]: ...
* * params[n]: ...
* @throws {FunctionNotImplemented}
*/
const engineExchangeCapabilities = async (
thorClient: ThorClient,
params: unknown[]
): Promise<void> => {
const engineExchangeCapabilities = async (): Promise<void> => {
// To avoid eslint error
await Promise.resolve(0);

// Not implemented yet
throw new FunctionNotImplemented(
'engine_exchangeCapabilities',
'Method "engine_exchangeCapabilities" has not been implemented yet.',
{
functionName: 'engine_exchangeCapabilities',
thorClient,
params
}
);
VeChainSDKLogger('warning').log({
title: 'engine_exchangeCapabilities',
messages: [
'Method "engine_exchangeCapabilities" has not been implemented yet.'
]
});
};

export { engineExchangeCapabilities };
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { type ThorClient } from '../../../../../../thor-client';
import { FunctionNotImplemented } from '@vechain/sdk-errors';
import { VeChainSDKLogger } from '@vechain/sdk-logging';

/**
* RPC Method engine_exchangeTransitionConfigurationV1 implementation
Expand All @@ -10,25 +9,18 @@ import { FunctionNotImplemented } from '@vechain/sdk-errors';
* * params[0]: ...
* * params[1]: ...
* * params[n]: ...
* @throws {FunctionNotImplemented}
*/
const engineExchangeTransitionConfigurationV1 = async (
thorClient: ThorClient,
params: unknown[]
): Promise<void> => {
const engineExchangeTransitionConfigurationV1 = async (): Promise<void> => {
// To avoid eslint error
await Promise.resolve(0);

// Not implemented yet
throw new FunctionNotImplemented(
'engine_exchangeTransitionConfigurationV1',
'Method "engine_exchangeTransitionConfigurationV1" has not been implemented yet.',
{
functionName: 'engine_exchangeTransitionConfigurationV1',
thorClient,
params
}
);
VeChainSDKLogger('warning').log({
title: 'engine_exchangeTransitionConfigurationV1',
messages: [
'Method "engine_exchangeTransitionConfigurationV1" has not been implemented yet.'
]
});
};

export { engineExchangeTransitionConfigurationV1 };
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { type ThorClient } from '../../../../../../thor-client';
import { FunctionNotImplemented } from '@vechain/sdk-errors';
import { VeChainSDKLogger } from '@vechain/sdk-logging';

/**
* RPC Method engine_forkchoiceUpdatedV1 implementation
Expand All @@ -10,25 +9,18 @@ import { FunctionNotImplemented } from '@vechain/sdk-errors';
* * params[0]: ...
* * params[1]: ...
* * params[n]: ...
* @throws {FunctionNotImplemented}
*/
const engineForkchoiceUpdatedV1 = async (
thorClient: ThorClient,
params: unknown[]
): Promise<void> => {
const engineForkchoiceUpdatedV1 = async (): Promise<void> => {
// To avoid eslint error
await Promise.resolve(0);

// Not implemented yet
throw new FunctionNotImplemented(
'engine_forkchoiceUpdatedV1',
'Method "engine_forkchoiceUpdatedV1" has not been implemented yet.',
{
functionName: 'engine_forkchoiceUpdatedV1',
thorClient,
params
}
);
VeChainSDKLogger('warning').log({
title: 'engine_forkchoiceUpdatedV1',
messages: [
'Method "engine_forkchoiceUpdatedV1" has not been implemented yet.'
]
});
};

export { engineForkchoiceUpdatedV1 };
Loading