Skip to content

Commit

Permalink
v0.1.0 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
blockmason-circleci committed Apr 23, 2019
1 parent 9973457 commit d5c3c93
Show file tree
Hide file tree
Showing 5 changed files with 4,011 additions and 1 deletion.
20 changes: 20 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright 2019 Blockmason

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

83 changes: 83 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Blockmason Link SDK for JavaScript

[![CircleCI][3]][4]

## Installing

To add this library to your app, do one of the following:

Using [Yarn][1]:

```
yarn add @blockmason/link-sdk
```

Using [NPM][2]:

```
npm install @blockmason/link-sdk
```

## Usage

### Importing the module

First, your app should import the `link` module from this library.

Using ES6:

```
import { link } from '@blockmason/link';
```

Using CommonJS modules (Node.js):

```
const { link } = require('@blockmason/link');
```

### Configuring

Once you have the `link()` function imported, create a client for your
Link project like this:

```
const project = link({
clientId: '<your-client-id>',
clientSecret: '<your-client-secret>'
});
```

Use the **Client ID** and **Client Secret** provided by your Link project
to fill in the respective values above.

### Interacting with your Link project

Then, you can use the `project` object to make requests against your
Link project.

For example, assuming your project has a **GET /echo** endpoint that
expects a `message` input and responds with a `message` output:

```
const { message } = await project.get('/echo', {
message: 'Hello, world!'
});
console.log(message);
// "Hello, world!"
```

Another example, assuming your project has a **POST /mint** endpoint
that expects `to` and `amount` inputs:

```
await project.post('/mint', {
amount: 1000,
to: '0x1111222233334444555566667777888899990000'
});
```

[1]: https://yarnpkg.com/
[2]: https://nodejs.org/
[3]: https://circleci.com/gh/blockmason/link-sdk.js.svg?style=svg
[4]: https://circleci.com/gh/blockmason/link-sdk.js
1 change: 1 addition & 0 deletions index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 40 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1 +1,40 @@
{}
{
"name": "@blockmason/link-sdk",
"version": "0.1.0",
"description": "Convenience library for accessing an API hosted on Blockmason Link.",
"main": "index.js",
"repository": "https://github.com/blockmason/link-sdk.js",
"author": {
"email": "devin@blockmason.io",
"name": "Devin Canterberry"
},
"license": "MIT",
"publishConfig": {
"repository": "git@github.com:blockmason/link-sdk.js.package.git"
},
"scripts": {
"build": "rm -vfR lib; babel --only '**/index.js' --no-comments --compact true --minified --source-maps false --out-dir lib src; cp -vfR package.json yarn.lock README.md LICENSE.md lib/",
"clean": "rm -fR lib docs .nyc_output",
"coverage": "nyc report",
"documentation": "rm -fR docs; (cd src; find . -type f -name index.js | xargs jsdoc --destination ../docs --package ../package.json --readme ../README.md)",
"lint": "eslint src",
"test": "find src -type f -name spec.js | xargs nyc --silent --check-coverage --lines 100 --per-file mocha --require @babel/register src/spec.setup.js"
},
"devDependencies": {
"@babel/cli": "7.4.3",
"@babel/core": "7.4.3",
"@babel/polyfill": "7.4.3",
"@babel/preset-env": "7.4.3",
"@babel/register": "7.4.0",
"babel-eslint": "10.0.1",
"chai": "4.2.0",
"chai-as-promised": "7.1.1",
"eslint": "5.16.0",
"eslint-plugin-ante": "1.0.2",
"jsdoc": "3.5.5",
"mocha": "6.1.4",
"nyc": "14.0.0",
"sinon": "7.3.2",
"sinon-chai": "3.3.0"
}
}
Loading

0 comments on commit d5c3c93

Please sign in to comment.