Skip to content

Commit

Permalink
Merge pull request #11 from JoinColony/enhancement/add-and-update-docs
Browse files Browse the repository at this point in the history
Add and update documentation and config
  • Loading branch information
Christian Maniewski authored Jan 11, 2020
2 parents ee2c16b + 55837b9 commit bc23673
Show file tree
Hide file tree
Showing 14 changed files with 223 additions and 85 deletions.
File renamed without changes.
46 changes: 46 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [[email protected]](mailto:[email protected]). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [https://contributor-covenant.org/version/1/4][version]

[homepage]: https://contributor-covenant.org
[version]: https://contributor-covenant.org/version/1/4/
29 changes: 29 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Contributing

Please read [Code of Conduct](CODE_OF_CONDUCT.md) before contributing.

## Report Issues

Report an issue using [GitHub Issues](https://github.com/JoinColony/node-metamask/issues). _Please fill out the template with as much detail as possible._

## GitHub Workflow

- Fork the repository

- Clone the forked repository into your working directory

- Create a new branch using the following naming schema:

- [fix/feature/...]/[issue-#]-[description-in-kebab-case]

- For example, `feature/6-add-connect-rinkeby-example`

- Commit your changes using the following guidelines:

- In the commit message, the first line must be capitalized

- Keep your branch up to date using `rebase` instead of `merge`

- Push your new fix/feature branch to your forked repository

- Create a pull request and fill out the pull request template
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Description

_Write a detailed description of the issue/feature/question._

## Steps to Reproduce

_If you are reporting a bug, list the steps you took that led to the issue._
31 changes: 31 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## Description

_Write a detailed description of the changes you made._

## Other Changes

_List any minor changes you may have made during development._

## Checklist

_List items that need to be completed before the request is merged._

## Scripts

_List any added/updated scripts._

**Added Scripts**:

**Updated Scripts**:

## Dependencies

_List any added/updated dependencies._

**Added Dependencies**:

**Updated Dependencies**:

## Related Issues

_If the pull request is related to an issue, add a link to the issue here._
73 changes: 0 additions & 73 deletions CODE_OF_CONDUCT.md

This file was deleted.

File renamed without changes.
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<div align="center">
<img src="/docs/img/nodeMetamask_fullColor.svg" width="600" />
</div>
<div align="center">
<a href="https://build.colony.io/">
<img src="https://img.shields.io/discourse/https/build.colony.io/status.svg" />
</a>
</div>

# node-metamask

Connect Node.js to MetaMask.

"Why would I ever want to do that?" - Sometimes you might have scripts or libraries that run in Node and require signed transactions that you would like to use MetaMask for (instead of dealing with private keys). This tool functions as a web3 provider that can be used with pretty much any MetaMask instance remotely. Please, only use this package locally to prevent PITM attacks (if you're brave enough to try it on mainnet).

Sounds crazy? It probably is. Also highly experimental. Please use with caution.

## Install

```
yarn add node-metamask
```

## Usage

```js

const MetaMaskConnector = require('node-metamask');
const connector = new MetaMaskConnector({
port: 3333, // this is the default port
onConnect() { console.log('MetaMask client connected') }, // Function to run when MetaMask is connected (optional)
});

connector.start().then(() => {
// Now go to http://localhost:3333 in your MetaMask enabled web browser.
const web3 = new Web3(connector.getProvider());
// Use web3 as you would normally do. Sign transactions in the browser.
});

```

When you're done with your MetaMask business, run the following code to clean up:

```js

connector.stop();

```

## Disclaimer

As I said, this is highly experimental. Tested only with web3 v1.0 (in node) and web3 0.20.3 (MetaMask, in the browser). Also it might not work with all functions supported by web3.

## Contribute

Please report any bugs you find so we can improve this.

- [Contributing](https://github.com/JoinColony/node-metamask/blob/master/.github/CONTRIBUTING.md)
28 changes: 18 additions & 10 deletions Readme.md → docs/_Docs_Overview.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
# node-metamask
---
title: Overview
section: Docs
order: 1
---

Connect to MetaMask from node.js.
Connect Node.js to MetaMask.

"Why would I ever want to do that?" - Sometimes you might have scripts / libraries that run in node and require signed transactions that you'd like to use MetaMask for (instead of dealing with private keys). This tool functions as a web3 Provider and can be used with pretty much any MetaMask instance remotely. Please, only use locally to prevent PITM attacks (if you're brave enough to try it on mainnet).
"Why would I ever want to do that?" - Sometimes you might have scripts or libraries that run in Node and require signed transactions that you would like to use MetaMask for (instead of dealing with private keys). This tool functions as a web3 provider that can be used with pretty much any MetaMask instance remotely. Please, only use this package locally to prevent PITM attacks (if you're brave enough to try it on mainnet).

Sounds crazy? It probably is. Also highly experimental. Please use with caution.

## Install

```shell
```
yarn add node-metamask
```

## Usage

```js

const MetaMaskConnector = require('node-metamask');
const connector = new MetaMaskConnector({
port: 3333, // this is the default port
Expand All @@ -26,20 +31,23 @@ connector.start().then(() => {
const web3 = new Web3(connector.getProvider());
// Use web3 as you would normally do. Sign transactions in the browser.
});

```

When you're don with your MetaMask business run
When you're done with your MetaMask business, run the following code to clean up:

```js

connector.stop();
```

to clean up.
```

## Disclaimer

As I said, this is highly experimental. Tested only with web3 v1.0 (in node) and web3 0.20.3 (MetaMask, in the browser). Also it might not work with all functions supported by web3. Please report any bugs you find so we can improve this.
As I said, this is highly experimental. Tested only with web3 v1.0 (in node) and web3 0.20.3 (MetaMask, in the browser). Also it might not work with all functions supported by web3.

## Contribute

## License
Please report any bugs you find so we can improve this.

MIT
- [Contributing](https://github.com/JoinColony/node-metamask/blob/master/.github/CONTRIBUTING.md)
6 changes: 6 additions & 0 deletions docs/doc.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"logo": "img/nodeMetamask_fullColor.svg",
"logoSmall": "img/nodeMetamask_logomark_red.svg",
"sectionOrder": ["Docs"],
"description": "A JavaScript library that functions as a Web3 provider connecting Node to MetaMask."
}
15 changes: 15 additions & 0 deletions docs/img/nodeMetamask_fullColor.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/img/nodeMetamask_logomark_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions docs/img/nodeMetamask_logomark_red.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@
"name": "node-metamask",
"version": "1.1.2",
"description": "🦊 Connect to MetaMask from node.js",
"author": "Christian Maniewski <[email protected]>",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/JoinColony/node-metamask.git"
},
"main": "index.js",
"scripts": {
"test": "eslint *.js"
},
"author": "Christian Maniewski <[email protected]>",
"license": "MIT",
"dependencies": {
"express": "^4.16.3",
"ws": "^5.2.0"
Expand Down

0 comments on commit bc23673

Please sign in to comment.