Skip to content

Commit

Permalink
♻️ Update actions types to consistent api
Browse files Browse the repository at this point in the history
✅ Fix build:

♻️ Regenerate
  • Loading branch information
Will Cory authored and Will Cory committed Jan 27, 2024
1 parent 11d1563 commit 9455c63
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 37 deletions.
10 changes: 5 additions & 5 deletions extensions/viem/src/tevmViemExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const tevmViemExtension = () => {
*/
const request = async (req) => {
try {
const result = await client.request(/** @type any*/ (req))
const result = await client.request(/** @type any*/(req))
return /** @type any */ ({
jsonrpc: '2.0',
method: req.method,
Expand Down Expand Up @@ -103,7 +103,7 @@ export const tevmViemExtension = () => {
...getCallArgs(params),
deployedBytecode: params.deployedBytecode,
data: encodeFunctionData(
/** @type any*/ ({
/** @type any*/({
abi: params.abi,
functionName: params.functionName,
args: params.args,
Expand All @@ -114,7 +114,7 @@ export const tevmViemExtension = () => {
)
)
out.data = decodeFunctionResult(
/** @type any*/ ({
/** @type any*/({
data: out.rawData,
abi: params.abi,
functionName: params.functionName,
Expand Down Expand Up @@ -253,7 +253,7 @@ export const tevmViemExtension = () => {
const out = await call({
...params,
data: encodeFunctionData(
/** @type any*/ ({
/** @type any*/({
abi: params.abi,
functionName: params.functionName,
args: params.args,
Expand All @@ -262,7 +262,7 @@ export const tevmViemExtension = () => {
})

const data = decodeFunctionResult(
/** @type any*/ ({
/** @type any*/({
data: out.rawData,
abi: params.abi,
functionName: params.functionName,
Expand Down
4 changes: 2 additions & 2 deletions packages/memory-client/src/createMemoryClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ export const createMemoryClient = async (options = {}) => {
header: common.genesis(),
...(common.isActivatedEIP(4895)
? {
withdrawals:
withdrawals:
/** @type {Array<import('@ethereumjs/util').WithdrawalData>}*/ ([]),
}
}
: {}),
},
{ common, setHardfork: false, skipConsensusFormatValidation: true },
Expand Down
60 changes: 30 additions & 30 deletions packages/procedures/src/eth/ethCallProcedure.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,34 @@ import { callProcedure } from '../index.js'
* @returns {import('@tevm/procedures-types').EthCallJsonRpcProcedure}
*/
export const ethCallProcedure = (evm) => async (req) => {
const [tx, blockTag] = req.params
const { data, from, to, gas, gasPrice, value } = tx
const response = await callProcedure(evm)({
...(req.id !== undefined ? { id: req.id } : {}),
jsonrpc: req.jsonrpc,
method: 'tevm_call',
params: {
...(gasPrice !== undefined ? { gasPrice } : {}),
...(data !== undefined ? { data } : {}),
...(gas !== undefined ? { gas } : {}),
...(value !== undefined ? { value } : {}),
...(to !== undefined ? { to } : {}),
...(from !== undefined ? { from } : {}),
...(blockTag !== undefined ? { blockTag } : {}),
},
})
if (!response.result) {
return {
jsonrpc: req.jsonrpc,
method: 'eth_call',
error: response.error,
...(req.id !== undefined ? { id: req.id } : {}),
}
}
return {
jsonrpc: req.jsonrpc,
method: 'eth_call',
result: response.result.rawData,
...(req.id !== undefined ? { id: req.id } : {}),
}
const [tx, blockTag] = req.params
const { data, from, to, gas, gasPrice, value } = tx
const response = await callProcedure(evm)({
...(req.id !== undefined ? { id: req.id } : {}),
jsonrpc: req.jsonrpc,
method: 'tevm_call',
params: {
...(gasPrice !== undefined ? { gasPrice } : {}),
...(data !== undefined ? { data } : {}),
...(gas !== undefined ? { gas } : {}),
...(value !== undefined ? { value } : {}),
...(to !== undefined ? { to } : {}),
...(from !== undefined ? { from } : {}),
...(blockTag !== undefined ? { blockTag } : {}),
},
})
if (!response.result) {
return {
jsonrpc: req.jsonrpc,
method: 'eth_call',
error: response.error,
...(req.id !== undefined ? { id: req.id } : {}),
}
}
return {
jsonrpc: req.jsonrpc,
method: 'eth_call',
result: response.result.rawData,
...(req.id !== undefined ? { id: req.id } : {}),
}
}

0 comments on commit 9455c63

Please sign in to comment.