0.0.4 • Published 2 years ago

strapi-plugin-eth v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Strapi Plugin Eth

Integrate Ethereum in your Strapi application.

Table Of Content

Requirements

Strapi v4 is required.

Installation

npm install --save strapi-plugin-eth

Plugin Configuration

Add the plugin configuration to ./config/plugins.js:

module.exports = ({ env }) => ({
  eth: {
    enabled: true,
    config: {
      chains: [
        // this enables ethereum network
        {
          network: {
            name: 'ethereum',
            chainId: 1,
            ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
          },
          providers: [
            {
              url: `https://mainnet.infura.io/v3/${env('INFURA_PROJECT_ID')}`,
            },
          ],
        },
        // this enables matic network
        {
          network: {
            name: 'matic',
            chainId: 137,
          },
          providers: [
            {
              url: `https://polygon-mainnet.infura.io/v3/${env('INFURA_PROJECT_ID')}`,
            },
            {
              url: 'https://polygon-rpc.com',
            },
          ],
        },
      ],
    },
  },
})

Usage

This plugin exposes a service with the various blockchain providers:

const ethProviderService = strapi.service('plugin::eth.provider');
const ethereumProvider = ethProviderService.getProvider(1 /* or 'ethereum' */);
const maticProvider = ethProviderService.getProvider(137 /* or 'matic' */);
0.0.3

2 years ago

0.0.4

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago