0.11.2 • Published 6 months ago

@evmts/rollup-plugin v0.11.2

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

@evmts/plugin

A rollup plugin for importing solidity files.

Currently @evmts/plugin only works in forge projects but work to make it support all wagmi plugins is underway

Instalation

pnpm i @evmts/rollup-plugin

Vite usage

Install rollup plugin

npm i @evmts/rollup-plugin

Add to your vite config

import { evmtsPluginrollup } from '@evmts/rollup-plugin`
import { defineConfig } from 'vite'

export default defineConfig({
  plugins: [evmtsPluginRollup()]
})

Rollup usage

const { evmtsPlugin } = require('@evmts/plugin');

module.exports = {
  ...
  plugins: [evmtsPlugin()]
};

ConfigOptions

To configure pass in the forge executable and the root folder that your foundery.toml is in

plugins: [
  evmtsPlugin({
    forgeExecutable: "forge",
    projectRoot: __dirname,
  }),
];

How it works

Under the hood this plugin will transform solidity imports

When the plugin sees a solidity import it will make the following changes

  1. Update the import to import a .ts file
- import scripts from './MyScript.sol'
+ import scripts from './MyScript.sol.ts'

Insert a new typescript file MyScript.sol.ts as an artifact

// MyScript.sol.ts
export default {
  name,
  artifactPath,
  contractPath,
  address,
  abi,
  bytecode,
};

The typescript can then go ahead and use the artifacts however it pleases

Usage in @evmts/core

See full evms-core for how it's used in evmts. This plugin can be used in other repos as well.

Usage in other libraries

Currently only @evmts/core is using this but this could easily be adapted or extended for other libraries.

Autocompletion and Typesafety

For typesafety and autocompletion in your editor add @evmts/ts-plugin to your tsconfig.json.

Custom Ts plugins are for developer experience only

The typescript compiler does not use custom ts plugins at compile time only in your editor. You will get red squiggly lines telling you something is wrong but it will still compile.

License 📄

1.0.0-next.19

6 months ago

1.0.0-next.18

6 months ago

1.0.0-next.17

6 months ago

1.0.0-next.11

6 months ago

1.0.0-next.10

6 months ago

1.0.0-next.15

6 months ago

1.0.0-next.13

6 months ago

1.0.0-next.12

6 months ago

0.11.2

8 months ago

1.0.0-next.0

6 months ago

1.0.0-next.2

6 months ago

0.1.0

10 months ago

0.3.0

10 months ago

1.0.0-next.3

6 months ago

0.9.0

8 months ago

0.5.4

10 months ago

1.0.0-next.4

6 months ago

0.7.1

9 months ago

0.5.3

10 months ago

1.0.0-next.5

6 months ago

0.5.6

10 months ago

1.0.0-next.6

6 months ago

0.5.5

10 months ago

0.5.0

10 months ago

1.0.0-next.8

6 months ago

1.0.0-next.9

6 months ago

0.7.0

9 months ago

0.5.2

10 months ago

0.5.1

10 months ago

0.5.7

10 months ago

0.10.0

8 months ago

0.0.3

11 months ago

0.2.0

10 months ago

0.0.2

11 months ago

0.8.1

8 months ago

0.8.0

8 months ago

0.4.1

10 months ago

0.4.0

10 months ago

0.0.4

10 months ago

0.6.0

10 months ago

0.4.2

10 months ago

0.0.2-next.0

11 months ago