From 092a106d6b43394b423c95029e8200aad154111a Mon Sep 17 00:00:00 2001 From: Nick Chisiu Date: Wed, 28 Mar 2018 20:12:03 +0300 Subject: [PATCH] add platform mvp --- README.md | 344 +++++++++++++++++++++++++++++++++++------------- bin/Squeezer.js | 2 +- package.json | 2 +- 3 files changed, 254 insertions(+), 94 deletions(-) diff --git a/README.md b/README.md index f37d772..e4c8b18 100644 --- a/README.md +++ b/README.md @@ -1,126 +1,286 @@ - +--- +title: Introduction - Get started +--- -#### Framework : [squeezer.io](https://squeezer.io) -#### Docs : [squeezer.io/docs](https://squeezer.io/docs/) -#### Chat : [chat.squeezer.io](http://chat.squeezer.io) +### Platform -[![Squeezer.IO](https://cdn.rawgit.com/SqueezerIO/squeezer/9a010c35/docs/gitbook/images/badge.svg)](https://Squeezer.IO) -[![Build Status](https://travis-ci.org/SqueezerIO/squeezer.svg?branch=master)](https://travis-ci.org/SqueezerIO/squeezer) -[![npm version](https://badge.fury.io/js/squeezer-cli.svg)](https://badge.fury.io/js/squeezer-cli) -[![Join the chat at https://gitter.im/SqueezerIO/squeezer](https://badges.gitter.im/SqueezerIO/squeezer.svg)](https://gitter.im/SqueezerIO/squeezer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![DUB](https://img.shields.io/dub/l/vibe-d.svg)]() +#### Login and SSO -### Contents +The Squeezer platform will support multiple code repositories integration and SSO third-party vendors. -* [Getting Started](#getting-started) -* [Example Projects](#example-projects) -* [Features](#features) -* [Templates](#templates) -* [Plugins](#plugins) -* [Example Projects](#example-projects) -* [Contributing](#contributing) -* [Community](#community) -* [Meetups](#meetups) + -### What is Squeezer ? +#### Overview -Squeezer is a framework designed to help developers to get a better architecture on serverless -zero-administration compute platforms where code runs on the top of -`functions` clouds like -[AWS Lambda](https://aws.amazon.com/documentation/lambda/) , [Azure Functions](https://azure.microsoft.com/en-us/services/functions/) , [IBM OpenWhisk](https://developer.ibm.com/openwhisk/) & [Google Functions](https://cloud.google.com/functions/) +The “overview” dashboard will display information about current deployments split into multiple stages; this way, a project’s team is in-sync for the entire development cycle. -### Features in short + -- [Swagger UI](http://swagger.io/) API REST documentation support -- **SEO-friendly** web apps -- share components between functions -- auto-deployable, auto-scalable , no DevOps requirements -- silent deployments ,no interruption for the current functionality ( really useful on production ) -- access deployed resources credentials (DB user, pass ...) directly from `process.env` variables -- one single command to simultaneously deploy all available functions on your project -- quick intuitive code deployments by using a special mechanism which will deploy only assets, functions and file packages -where code changed from the last deployment -- automatic rollback to the previous working deployment if something goes wrong -- sequential deployments, wait for the current deployments in progress to finish -- self-healing functions -- test your code locally on a simulated functions platform for a faster development cycle -- separate your environments in multiple stages -- extend framework functionality with your own "home-made" plugins -- pay only for the usage ( no monthly subscriptions ) -- competitive pricing ( >= 2$ / 1 million HTTP requests ) -- smart external dependencies inclusion into the compiled function ( **node_modules** and other project files ) ... just -like on any other trivial NodeJS project -- Webpack integration +#### Deploys -#### Requirements +This section will allow developers to get more detailed information about the deployment in progress. They can trigger retries on a specific deployment or clear the deployment cache in order to fix crashed builds. -- [Install node.js](http://nodejs.org/) version `>=6` + -### Squeezer CLI +#### Settings -> Squeezer command-line interface +The settings section will provide most of the required input fields to make the developer’s experience of the platform as straightforward and intuitive as possible. -#### Templates + -Create a quick project stub by using templates : +### Install Squeezer's command line tool -| template | description | -|-----|--------------| -|api-nodejs | AWS generic API app template. | +`npm install squeezer-cli -g` -#### Plugins +### Using the CLI -Extend or merge the Squeezer framework functionality with plugins +1. Create a new project . `sqz create --project my-first-project --template api-nodejs` +2. `cd my-first-project` +3. `sqz install` - Install all project's packages ( npm ... ) +4. `sqz compile` - Compile functions , sources , ... +5. `sqz serve` - Will start a live-reloading development environment accessible at `localhost:4001` ( **Live compiling** ) -| Plugin | Author | -|-----|--------------| -|**[Serve Plugin](https://github.com/SqueezerIO/squeezer-serve)**
This plugin enables serving support for local development within the Squeezer Framework. | [Nick Chisiu](https://github.com/nickchisiu) | -|**[Swagger Plugin](https://github.com/SqueezerIO/squeezer-swagger)**
This plugin enables Swagger API Documentation support within the Squeezer Framework. | [Nick Chisiu](https://github.com/nickchisiu) | +### Deploy a project -#### Example Projects +Configure provider & setup credentials -| Project Name | Author | Demo | -|-------------|------|---------| -| **[Generic API](https://github.com/SqueezerIO/example-projects/tree/master/api-nodejs)**
Generic API Hello World + Swagger API Docs | [Nick Chisiu](https://github.com/nickchisiu) | [demo]() | -| **[REST API](https://github.com/SqueezerIO/example-projects/tree/master/api-rest-nodejs)**
REST API using MongoDB + Swagger API Docs | [Nick Chisiu](https://github.com/nickchisiu) | [demo]() | +1. `sqz install` - Install packages +2. `sqz compile --cloud --stage dev` - Compile functions , sources , ... ( cloud ready ) +3. `sqz deploy` - Deploys project into the cloud -#### Getting started -NOTE: **Windows** users should [enable symlinks](http://answers.perforce.com/articles/KB/3472/?q=enabling&l=en_US&fs=Search&pn=1) in order to avoid unwanted symbolic links errors . +## Blockchain Connector -##### Serve +**https://github.com/SqueezerIO/squeezer-blockchain-connector** -| | cmd | description | -|----|-----|--------------| -| 1. | **npm i squeezer-cli -g** | Install Squeezer CLI | -| 2. | **sqz create --project my-first-project --template api-nodejs** | Create a project | -| 3. | **cd my-first-project** | Switch to the project's directory | -| 4. | **sqz install** | Install dependencies | -| 4. | **sqz compile** | Compile functions | -| 5. | **sqz serve** | Development mode
**Live compiling** | -##### Deploy +### Initialize -| | cmd | description | -|----|-----|--------------| -| 1. | Configure provider & setup credentials | | -| 2. | **sqz compile --cloud --stage dev** | Compile functions for cloud deployments | -| 3. | **sqz deploy** | Deploy your app into the cloud provider | +``` +const blockchainConnector = require('squeezer-blockchain-connector').init({ + key : 'squeezer-key', + type: 'ETH', + environment: 'test' +}); +``` +Created api-key is used when generate new wallet +## Using connector -#### Contributing +### Create new Wallet -See [contributing.md](CONTRIBUTING.md) for contribution guidelines +``` +POST /v1/wallets/CreateWallet +``` -### Community +#### Description +Create new wallet address using api-key -* [Squeezer issues](https://github.com/SqueezerIO/squeezer/issues) -* [Gitter Chatroom](http://chat.squeezer.io/) -* [Facebook](https://www.facebook.com/Squeezer.IO/) -* [Twitter](https://twitter.com/SqueezerIO) -* [Contact Us](mailto:nick@squeezer.io) -### Meetups +#### Parameter -* [Workshop: Serverless javascript with Squeezer](https://www.meetup.com/Cluj-Javascripters/events/243915438/?) +* accessKey - api-key generated at connector initialization +* currencyType - what type of wallet want + +#### Return format + +A JSON object with keystore and address of wallet + +#### Example + +Request + +``` +POST /v1/wallets/CreateWallet +``` + +Body + +``` +{ + "accessKey": "3fb1cd2cd96c6d5c0b5eb3322d807b34482481d4" +} +``` + +Response +``` +{ + "version": 3, + "id": "f0efc549-88c0-45cf-9991-6ec53ba7ba13", + "address": "7c110b7761b695d4343f6dfe786a49cd5c03e31e", + "crypto": { + "ciphertext": "6ec3946b5ed85d1acd5c2b67289ea05bee0b3095cdf3661469a6d8acc6cf85f5", + "cipherparams": { + "iv": "ea54225d082c7a010467d73b3a309eda" + }, + "cipher": "aes-128-ctr", + "kdf": "scrypt", + "kdfparams": { + "dklen": 32, + "salt": "dfc9c26cda4253852b93c60f7d7099a5b3f127031faf19e2dbf0593a0d3190f8", + "n": 262144, + "r": 8, + "p": 1 + }, + "mac": "ce5c87d1b0d0b2df0fbe4f389806594203fa091be4beaa6bfa6e1a10856d369e" + } +} +``` + +### Get balance + +``` +POST /v1/wallets/GetBalance +``` + +#### Description + +Get balance of specified address + +#### Parameters + +* walletAddress - wallet's address +* network - if use test environment should be passed network (rinkeby, ropsten, kovan - ETH, bitcoin-testnet -BTC) + +#### Return format +A string with amount of wallet + +#### Example +Request +``` +POST /v1/wallets/GetBalance +``` +Body +``` +{ + "walletAddress": "0xc1f9e93081e7797ec3ef2134e0e656b2c8d542f1" +} +``` +Response +``` +"1.895178899999999998" +``` +### Send transaction + +``` +POST /v1/blockchainlink/SendTransaction +``` + +#### Description + +Send coins from one wallet to another + +#### Parameters + +* toWallet - wallet's address +* currencyType - what type of wallet want +* amount - amount of coins +* keyStore - fromWallet's keystore +* accessKey - api-key used to generate wallet +* network - if use test environment should be passed network (rinkeby, ropsten, kovan - ETH and bitcoin-testnet -BTC) + +#### Return format + +A JSON object that contain informations about that transaction + +#### Example + +Request +``` +POST /v1/wallets/SendTransaction +``` +Body +``` +{ + "toWallet": "0x8a5cf6d5e86ebfe3e1ab573d1eafc299c04c8cf9", + "amount": 0.001, + "keyStore": { + "version": 3, + "id": "0af46c1e-4d02-4f9b-af62-ec358612a3c2", + "address": "c1f9e93081e7797ec3ef2134e0e656b2c8d542f1", + "crypto": { + "ciphertext": "cc3bb088bd53ea45172b0ab5f01c9e28e6b7b3743a589a4437844b9fce922888", + "cipherparams": { + "iv": "55b1aeeffa8ce3ffe24a488e58174c0f" + }, + "cipher": "aes-128-ctr", + "kdf": "scrypt", + "kdfparams": { + "dklen": 32, + "salt": "0c990d41edcf0d8f5541713ef0e2f0629366ffadb8190b0d3a32755488de6877", + "n": 262144, + "r": 8, + "p": 1 + }, + "mac": "4ea78c87318dbe87ac4e109845301d248d4caf25f82882dff1fbaa1fe4b3d70c" + } + }, + "accessKey": "3fb1cd2cd96c6d5c0b5eb3322d807b34482481d4", + "network" : "rinkeby" +} +``` +Response +``` +{ + "transaction": { + "transaction": "0xad63f8fc7db990058ef3ec6433190cbc5b0e0af670be79c49a70d8e1daacfb29", + "transactionStatus": 0, + "_id": "5ab2b1fd6e578b3ae275e351", + "__v": 0 + } +} +``` +### Get transaction + +``` +POST /v1/blockchainlink/GetTransaction +``` + +#### Description + +Get info about one transaction + +#### Parameters + +* transactionHash - transaction hash returned by SendTransaction +* network - if use test environment should be passed network (rinkeby, ropsten, kovan - ETH and bitcoin-testnet -BTC) + +#### Return format + +A JSON object that contain informations about transaction + +#### Example + +Request +``` +POST /v1/wallets/GetTransaction +``` +Body +``` +{ + "transactionHash": "0xad63f8fc7db990058ef3ec6433190cbc5b0e0af670be79c49a70d8e1daacfb29", + "currencyType" : "ETH", + "network" : "rinkeby" + new +} +``` +Response +``` +{ + "blockHash": "0xb589d75b759436e43381dc30f89a792f6f7bace421bf04f5eb1f2cca7c8e0628", + "blockNumber": 1972693, + "from": "0xc1f9e93081e7797ec3ef2134e0e656b2c8d542f1", + "gas": 21000, + "gasPrice": "1000000000", + "hash": "0xad63f8fc7db990058ef3ec6433190cbc5b0e0af670be79c49a70d8e1daacfb29", + "input": "0x", + "nonce": 11, + "to": "0x8a5cf6d5e86ebfe3e1ab573d1eafc299c04c8cf9", + "transactionIndex": 9, + "value": "1000000000000000", + "v": "0x1b", + "r": "0xf62198309971d6c3725f2f0cddc7eb60da5715fed89b597d4a273322313aebe4", + "s": "0x5b86ac969b259c73d7fccc3dec9f28fdbdc024a8f72c842939baeb198eb9b6b1" +} +``` \ No newline at end of file diff --git a/bin/Squeezer.js b/bin/Squeezer.js index 69932d1..d12de9c 100644 --- a/bin/Squeezer.js +++ b/bin/Squeezer.js @@ -37,7 +37,7 @@ class Squeezer { }, functions: {}, hooks: [], - apiBaseUrl: 'https://api.squeezer.io', + apiBaseUrl: 'https://api.squeezer.io/prod', outputs: {}, assets: { functions: [], diff --git a/package.json b/package.json index acbb017..cda66d8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "squeezer-cli", - "version": "1.1.27", + "version": "1.1.28", "preferGlobal": true, "description": "Event-driven APIs & Web apps on functions, serverless ! Squeezer is a framework designed to help developers to get a better architecture on serverless zero-administration compute platforms with code that runs into cloud functions like [AWS Lambda](https://aws.amazon.com/documentation/lambda/) , [Azure Functions](https://azure.microsoft.com/en-us/services/functions/) , [Google Cloud Functions](https://cloud.google.com/functions/docs/) and [IBM OpenWhisk](https://developer.ibm.com/openwhisk/) .", "homepage": "https://squeezer.io/",