# @tevm/decorators Action decorators for extending Tevm clients: EIP-1193 providers, Ethereum JSON-RPC methods, and Tevm-specific actions. Full API: [packages/decorators/docs](https://github.com/evmts/tevm/tree/main/packages/decorators/docs). ## Installation ```bash npm install @tevm/decorators@1.0.0-rc.151 @tevm/node@1.0.0-rc.151 viem ``` ## API Reference ### Core Functions - [`ethActions()`](https://github.com/evmts/tevm/blob/main/packages/decorators/docs/functions/ethActions.md) - standard Ethereum JSON-RPC methods. - [`requestEip1193()`](https://github.com/evmts/tevm/blob/main/packages/decorators/docs/functions/requestEip1193.md) - EIP-1193 provider extension. - [`tevmActions()`](https://github.com/evmts/tevm/blob/main/packages/decorators/docs/functions/tevmActions.md) - Tevm-specific actions. - [`tevmSend()`](https://github.com/evmts/tevm/blob/main/packages/decorators/docs/functions/tevmSend.md) - send Tevm JSON-RPC requests. ### Provider Types - [`Eip1193RequestProvider`](https://github.com/evmts/tevm/tree/main/packages/decorators/docs/type-aliases/Eip1193RequestProvider.md) - [`EIP1193Parameters`](https://github.com/evmts/tevm/tree/main/packages/decorators/docs/type-aliases/EIP1193Parameters.md) - [`EIP1193RequestFn`](https://github.com/evmts/tevm/tree/main/packages/decorators/docs/type-aliases/EIP1193RequestFn.md) - [`EIP1193RequestOptions`](https://github.com/evmts/tevm/tree/main/packages/decorators/docs/type-aliases/EIP1193RequestOptions.md) ### Action Types - [`EthActionsApi`](https://github.com/evmts/tevm/blob/main/packages/decorators/docs/type-aliases/EthActionsApi.md) - [`TevmActionsApi`](https://github.com/evmts/tevm/blob/main/packages/decorators/docs/type-aliases/TevmActionsApi.md) - [`TevmSendApi`](https://github.com/evmts/tevm/blob/main/packages/decorators/docs/type-aliases/TevmSendApi.md) ### RPC Schema Types - [`RpcSchema`](https://github.com/evmts/tevm/blob/main/packages/decorators/docs/type-aliases/RpcSchema.md) - [`RpcSchemaOverride`](https://github.com/evmts/tevm/blob/main/packages/decorators/docs/type-aliases/RpcSchemaOverride.md) - [`DerivedRpcSchema`](https://github.com/evmts/tevm/blob/main/packages/decorators/docs/type-aliases/DerivedRpcSchema.md) - [`JsonRpcSchemaPublic`](https://github.com/evmts/tevm/blob/main/packages/decorators/docs/type-aliases/JsonRpcSchemaPublic.md) - [`JsonRpcSchemaTevm`](https://github.com/evmts/tevm/blob/main/packages/decorators/docs/type-aliases/JsonRpcSchemaTevm.md) - [`JsonRpcSchemaWallet`](https://github.com/evmts/tevm/blob/main/packages/decorators/docs/type-aliases/JsonRpcSchemaWallet.md) - [`TestRpcSchema`](https://github.com/evmts/tevm/blob/main/packages/decorators/docs/type-aliases/TestRpcSchema.md) ### Ethereum Types - [`AddEthereumChainParameter`](https://github.com/evmts/tevm/blob/main/packages/decorators/docs/type-aliases/AddEthereumChainParameter.md) - [`WatchAssetParams`](https://github.com/evmts/tevm/blob/main/packages/decorators/docs/type-aliases/WatchAssetParams.md) - [`WalletPermission`](https://github.com/evmts/tevm/blob/main/packages/decorators/docs/type-aliases/WalletPermission.md) - [`WalletPermissionCaveat`](https://github.com/evmts/tevm/blob/main/packages/decorators/docs/type-aliases/WalletPermissionCaveat.md) ### Utility Types - [`Hash`](https://github.com/evmts/tevm/blob/main/packages/decorators/docs/type-aliases/Hash.md) - [`LogTopic`](https://github.com/evmts/tevm/blob/main/packages/decorators/docs/type-aliases/LogTopic.md) - [`NetworkSync`](https://github.com/evmts/tevm/blob/main/packages/decorators/docs/type-aliases/NetworkSync.md) - [`Quantity`](https://github.com/evmts/tevm/blob/main/packages/decorators/docs/type-aliases/Quantity.md) ## Usage Examples ```typescript import { createTevmNode } from '@tevm/node' import { requestEip1193, ethActions, tevmActions } from '@tevm/decorators' const node = createTevmNode() const eip1193Node = node.extend(requestEip1193()) const chainId = await eip1193Node.request({ method: 'eth_chainId' }) const ethNode = node.extend(ethActions()) const balance = await ethNode.eth.getBalance({ address: '0x1111111111111111111111111111111111111111', }) const tevmNode = node.extend(tevmActions()) await tevmNode.setAccount({ address: '0x1111111111111111111111111111111111111111', balance: 1n, }) const account = await tevmNode.getAccount({ address: '0x1111111111111111111111111111111111111111', }) console.log(chainId, balance, account.balance) ``` ### Error Codes ```typescript try { await client.request({ method: 'eth_call', params: [{ to: '0x...', data: '0x...' }] }) } catch (error) { if (error.code === 4001) { // user rejected } else if (error.code === -32000) { // execution error } } ``` ### Chain Parameters ```typescript const chainParams: AddEthereumChainParameter = { chainId: '0x1', chainName: 'Ethereum Mainnet', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: ['https://...'], } ``` ## See Also - [JSON-RPC API](/api/json-rpc) - [Actions Guide](/reference/actions) - [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) - [Ethereum JSON-RPC](https://ethereum.org/en/developers/docs/apis/json-rpc/)