Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
qiweiii committed Nov 6, 2023
1 parent 462f875 commit 235d686
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions packages/chopsticks/src/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,10 @@ const plugins = [
'try-runtime',
]

;(async () => {
for (const plugin of plugins) {
const { rpc, name } = await import(`./${plugin}`)
if (rpc) {
const methodName = name || _.camelCase(plugin)
pluginHandlers[`dev_${methodName}`] = rpc
logger.debug(`Registered plugin ${plugin} RPC`)
}
}
})()

export const loadRpcPlugin = async (method: string) => {
if (pluginHandlers[method]) return pluginHandlers[method]

const pluginName = _.snakeCase(method.split('_')[1])
const pluginName = _.snakeCase(method.split('dev_')[1])
if (!pluginName) return undefined

const { rpc } = await import(`./${pluginName}`)
Expand Down

0 comments on commit 235d686

Please sign in to comment.