Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shop3/strapi-plugin-eth
Integrate Ethereum in your Strapi application.
https://github.com/shop3/strapi-plugin-eth
ethereum ethers strapi strapi-plugin
Last synced: 10 days ago
JSON representation
Integrate Ethereum in your Strapi application.
- Host: GitHub
- URL: https://github.com/shop3/strapi-plugin-eth
- Owner: shop3
- License: mit
- Created: 2022-06-27T19:58:37.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-04T13:47:42.000Z (almost 2 years ago)
- Last Synced: 2024-11-15T05:20:43.242Z (about 1 month ago)
- Topics: ethereum, ethers, strapi, strapi-plugin
- Language: JavaScript
- Homepage:
- Size: 5.11 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Strapi Plugin Eth
Integrate Ethereum in your Strapi application.
## Table Of Content
- [Requirements](#requirements)
- [Installation](#installation)
- [Plugin Configuration](#plugin-configuration)
- [Usage](#usage)## Requirements
Strapi v4 is required.
## Installation
```bash
npm install --save strapi-plugin-eth
```## Plugin Configuration
Add the plugin configuration to `./config/plugins.js`:
```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:
```js
const ethProviderService = strapi.service('plugin::eth.provider');
const ethereumProvider = ethProviderService.getProvider(1 /* or 'ethereum' */);
const maticProvider = ethProviderService.getProvider(137 /* or 'matic' */);
```