Skip to content

A plugin for retrieving configuration objects to be used to create Dai.js Maker instances.

License

Notifications You must be signed in to change notification settings

isabella232/dai-plugin-config

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dai Config Plugin

GitHub License NPM

Development

This plugin fetches configuration data from a testchain backend, and creates a config object to be provided to the Maker SDK so it can be used with a testchain. Add it to the end of the plugins array to ensure the options override the default config.

see Dai.js for more details

Example using the Maker SDK

import Maker from '@makerdao/dai';
import configPlugin from '@makerdao/dai-plugin-config';

const config = {
    plugins: [
        [configPlugin, { testchainId: '123abc', backendEnv: 'dev' }]
        ],
    log: false
  };

await Maker.create('http', config);

Details

testchainId: Must be a running testchain ID on the selected backend environment.

backendEnv: (optional) defaults to the 'prod' URL, which is http://18.185.172.121:4000/chain/. Options are prod, dev, or any user-specified URL.

In the beforeCreate block, the plugin will fetch testchain data from the URL. This includes the testchain RPC, all the deployed contracts, and required tokens. It will create a config object that looks like this:

config = {
        url: rpc_url,
        provider: {
          type: 'HTTP',
          network: chainConfig.type
        },
        smartContract: { addContracts },
        token: { erc20 }
      };

Code Style

We run Prettier on-commit, which means you can write code in whatever style you want and it will be automatically formatted according to the common style when you run git commit.

License

The dai config plugin is MIT licensed.

About

A plugin for retrieving configuration objects to be used to create Dai.js Maker instances.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 91.5%
  • Shell 8.5%