Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
03c7c92
feat: setup monorepo structure and refactor auth
yknl Jul 27, 2020
c27d948
feat: remove storage functions from user session
yknl Aug 11, 2020
2132b08
feat: update common package
yknl Aug 11, 2020
1867afe
feat: create storage package
yknl Aug 11, 2020
c99680b
feat: create storage package
yknl Aug 11, 2020
cb7b293
feat: move encryption functions out of storage package
yknl Aug 11, 2020
f0f97de
feat: remove references to GaiaHubConfig in auth package
yknl Aug 11, 2020
7f49981
build: update package.json
yknl Aug 11, 2020
1608d7c
feat: move CLI package
yknl Aug 13, 2020
e3fbb0a
feat: add cli src files
yknl Aug 13, 2020
6781230
feat: add cli bin.js
yknl Aug 19, 2020
5fbe772
feat: add keychain package
yknl Aug 19, 2020
5f4a961
build: update package.json
yknl Aug 19, 2020
faa3620
feat: clean up legacy code
yknl Aug 23, 2020
01c8f82
feat: update tsconfig and use tsdx
yknl Aug 23, 2020
a82dd0c
feat: update tsconfig and use tsdx
yknl Aug 23, 2020
da8ec58
feat: add network package
yknl Aug 23, 2020
d27a657
feat: add profile package
yknl Aug 23, 2020
0b9f0d0
build: remove tsconfig.build.json from packages
yknl Aug 23, 2020
b088271
fix: cli global install
yknl Aug 24, 2020
2959c20
fix: cli build config
yknl Aug 24, 2020
3a1dfba
fix: more circular dependencies removed from auth package
yknl Aug 24, 2020
9ce79f6
fix: remove unused auth.ts
yknl Aug 24, 2020
c749612
fix: profile package circular dependency
yknl Aug 26, 2020
e60cf32
fix: lookup profile args in storage
yknl Sep 2, 2020
e35e57e
feat: refactor tests to use jest and move into respective packages
yknl Sep 6, 2020
d31cf3c
feat: move transactions package from @blockstack/stacks-transactions
yknl Sep 6, 2020
9fc294e
fix: remove cache files from git
yknl Sep 9, 2020
30e446f
fix: remove old tests and data from auth package
yknl Sep 9, 2020
833b748
feat: switch cli to @stacks/transactions
yknl Sep 16, 2020
f6c63b7
build: bump @stacks/cli alpha version
yknl Sep 16, 2020
c05e353
fix: tests and ci
yknl Sep 18, 2020
1eb00ec
fix: ci config
yknl Sep 18, 2020
77758cd
fix: ci config
yknl Sep 18, 2020
9d5d3f1
fix: ci config
yknl Sep 18, 2020
fbb4281
fix: add tsdx to packages
yknl Sep 18, 2020
3812c3f
fix: ci config
yknl Sep 21, 2020
f62f500
fix: remove transaction package prepare script
yknl Sep 21, 2020
a63528e
fix: update ci config
yknl Sep 21, 2020
ac9b3a5
fix: update transactions package readme
yknl Sep 21, 2020
3760bf2
feat: blockstack.js to stacks.js migration guide
yknl Sep 22, 2020
860fd50
docs: transactions readme update
yknl Sep 25, 2020
b163133
docs: address migration guide feedback
yknl Sep 25, 2020
f701fe2
build: update package.json versions for publish
yknl Sep 28, 2020
dc192d4
feat: create random private key with optional entropy
yknl Sep 28, 2020
dbac3aa
v1.0.0-beta.1
yknl Sep 28, 2020
cbb2835
fix: dep versions not bumped to beta
yknl Sep 28, 2020
c195003
fix: dep versions not bumped to beta
yknl Sep 28, 2020
9fbc1df
feat: addSignature method
yknl Oct 1, 2020
4e26fa4
feat: codecov
yknl Oct 2, 2020
a3d94c8
feat: codecov
yknl Oct 2, 2020
f1eb1a4
feat: codecov
yknl Oct 2, 2020
9a6ad14
fix: eslint, yarn workspaces
aulneau Oct 2, 2020
17fc891
fix: lint prettier all packages
aulneau Oct 2, 2020
aaf8978
build: auth tsdx, typescript fixes
aulneau Oct 2, 2020
01f6e4e
v1.0.0-beta.2
yknl Oct 6, 2020
470a813
build: keychain tsdx
aulneau Oct 6, 2020
93bf0f0
build: network tsdx
aulneau Oct 6, 2020
5848fb4
build: profile tsdx
aulneau Oct 6, 2020
16ea055
build(wip): transactions started, many errors
aulneau Oct 6, 2020
fd71e71
feat: build update for common, encryption and storage packages
yknl Oct 8, 2020
86829fe
fix: transaction lib build
yknl Oct 8, 2020
1c0f0e3
feat(transactions): export cvToHex, hexToCV, parseReadOnlyResponse
friedger Oct 8, 2020
da29e8e
fix: transactions package tests
yknl Oct 8, 2020
59f17de
fix: auth package tests
yknl Oct 9, 2020
dc1d807
v1.0.0-beta.2
yknl Oct 9, 2020
83fa782
v1.0.0-beta.3
yknl Oct 9, 2020
ccd5f00
fix: issue with jest version
yknl Oct 9, 2020
c48d118
fix: restore protocolEchoDetection
yknl Oct 9, 2020
0f607c9
fix: package.json files
yknl Oct 9, 2020
ee1a7e1
v1.0.0-beta.4
yknl Oct 9, 2020
d75429f
fix: syntax in migration guide
yknl Oct 9, 2020
9cdf5e2
fix: cli build errors
yknl Oct 13, 2020
65f71ac
fix: cli build fixes
aulneau Oct 13, 2020
12eaf53
fix: add entries in package.json
aulneau Oct 13, 2020
b2bfe1c
fix: cli running
aulneau Oct 13, 2020
ad13e46
fix: cli error with extending BlockstackNetwork class
yknl Oct 14, 2020
df60924
fix: tx broadcast error msgs
yknl Oct 14, 2020
0bc9d38
fix: keychain tests failing in ci
yknl Oct 14, 2020
1cfe263
fix: keychain tests failing in ci
yknl Oct 14, 2020
78f22be
Merge branch 'feature/monorepo-refactor' into feat/monorepo-fixes
yknl Oct 14, 2020
e1e1300
fix: package-lock conflicts
yknl Oct 14, 2020
f4b7560
Merge pull request #824 from blockstack/feat/monorepo-fixes
yknl Oct 14, 2020
ab28d80
v1.0.0-beta.5
yknl Oct 15, 2020
9899890
fix: remove unused bitcoinjs-lib dependency from common lib
yknl Oct 15, 2020
442bc3d
fix: clean up dependencies
yknl Oct 15, 2020
6c85a52
fix: prepend txid with 0x in CLI
yknl Oct 15, 2020
77e28d9
v1.0.0-beta.6
yknl Oct 15, 2020
a7015cb
build: update build scripts
yknl Oct 15, 2020
ce733d6
v1.0.0-beta.7
yknl Oct 15, 2020
9da9ac4
build: update package.json data
yknl Oct 15, 2020
fca6bb5
feat: add mocknet network config
yknl Oct 16, 2020
e6651d2
docs: update README
yknl Oct 19, 2020
2b4f8c4
docs: update README
yknl Oct 19, 2020
5a321ae
docs: update README
yknl Oct 19, 2020
92af5b5
fix: change default buffer encoding to hex in cvToString() function
reedrosenbluth Oct 21, 2020
c12e369
fix: no clone on tx broadcast result
yknl Oct 21, 2020
8ba42d2
Merge pull request #838 from blockstack/fix/buffer-encoding
yknl Oct 22, 2020
a859be0
Merge pull request #826 from friedger/feature/cv_hex_utils
yknl Oct 22, 2020
124b5ca
Merge pull request #839 from blockstack/fix/broadcast-response-clone
yknl Oct 22, 2020
30d1fff
docs: update package readme
yknl Oct 22, 2020
ba2243e
feat: enable creation of unsigned contract calls
yknl Oct 22, 2020
4ced06e
Merge pull request #841 from blockstack/feat/unsigned-contract-call
yknl Oct 22, 2020
f8403f0
fix: CLI unable to specify node URL
yknl Oct 23, 2020
ca569eb
docs: add docs to git
yknl Oct 26, 2020
b939f09
docs: merge docs
yknl Oct 27, 2020
8767be4
Merge branch 'master' into feature/monorepo-refactor
yknl Oct 27, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
34 changes: 17 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:10.15.1
- image: circleci/node:14.6.0

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
Expand All @@ -20,28 +20,28 @@ jobs:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
# - restore_cache:
# keys:
# - v1-dependencies-{{ checksum "package.json" }}
# # fallback to using the latest cache if no exact match is found
# - v1-dependencies-

- run: npm install
- run: npx lerna bootstrap

- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
# - save_cache:
# paths:
# - node_modules
# key: v1-dependencies-{{ checksum "package.json" }}

# run tests!
- run: npm run lint:formatting
# run tests!
#- run: npm run lint:formatting

- run: npm test
- run: npx lerna run build

- run: npm run build
- run: npx lerna run test

- run: npm run codecovUpload
- run: npx lerna run codecovUpload

- store_artifacts:
path: docs
destination: docs
destination: docs
151 changes: 7 additions & 144 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,146 +1,9 @@
module.exports = {
"extends": [
"eslint:recommended",
"airbnb-base",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier/@typescript-eslint"

],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"tsconfigRootDir": __dirname
},
"plugins": [
"import",
"@typescript-eslint"
],
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [ ".ts" ]
},
"import/resolver": { "typescript": {} }
},
"env": {
"browser": true,
"node": true
},
"rules": {
"no-tabs": 0,
"no-restricted-globals": 0,
"no-buffer-constructor": 0,
"no-mixed-operators": 0,
"no-plusplus": 0,
"no-bitwise": 0,
"prefer-promise-reject-errors": 0,
"class-methods-use-this": 0,
"prefer-destructuring": 0,
"no-prototype-builtins": 0,
"comma-dangle": "off",
"quotes": [2, "single"],
"eol-last": 2,
"no-debugger": 1,
"no-mixed-requires": 0,
"no-underscore-dangle": 0,
"no-multi-spaces": 0,
"no-trailing-spaces": 0,
"no-extra-boolean-cast": 0,
"no-undef": 2,
"no-var": 2,
"no-param-reassign": 0,
"no-else-return": 0,
"no-console": 0,
"prefer-const": 2,
"new-cap": 0,
"semi": 0,
"valid-jsdoc": "off",
"object-curly-newline": "off",
"arrow-parens": "off",
"function-paren-newline": 0,
"max-classes-per-file": "off",
"prefer-object-spread": "off",
"no-multiple-empty-lines": "off",
"no-shadow": "off",
"no-use-before-define": "off",
"no-return-await": "off",
"no-useless-constructor": "off",
"indent": [2, 2, {
"FunctionDeclaration" : { "parameters": "first" },
"FunctionExpression" : { "parameters": "first" },
"ObjectExpression": "first",
"ArrayExpression": "first",
"ImportDeclaration": "first",
"CallExpression": { "arguments": "first" }
}],
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/class-name-casing": "off",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/array-type": "off",
"@typescript-eslint/member-delimiter-style": "off",
"@typescript-eslint/no-angle-bracket-type-assertion": "off",
"@typescript-eslint/prefer-interface": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/consistent-type-assertions": "off",
"@typescript-eslint/prefer-regexp-exec": "off",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/require-await": "error",
"@typescript-eslint/await-thenable": "error",


// TODO: enable these when reasonable
"@typescript-eslint/promise-function-async": "off",
"@typescript-eslint/prefer-includes": "off",
"@typescript-eslint/prefer-string-starts-ends-with": "off",
// ---


"import/no-unresolved": "error",
"import/named": "error",
"import/prefer-default-export": "off",

// TODO: enable these when reasonable -- these can help module dependencies be easier to bundle w/ tree-shaking.
"import/no-cycle": "off",
// ---

"import/no-self-import": "error",
"import/no-useless-path-segments": ["error", { noUselessIndex: true }],
"import/no-unused-modules": ["error", { "missingExports": true }],
"import/export": "error",
"import/no-extraneous-dependencies": "error",
"import/no-duplicates": "error",
"import/no-unassigned-import": "error",
"import/order": "error",

"import/no-nodejs-modules": ["error", { "allow": [

]}],

// ---- Enforce some blockstack.js specific rules ----

"no-restricted-globals": ["error", {
"name": "fetch",
"message": "Use `privateFetch` instead."
}
],

"no-restricted-modules": ["error", {
"name": "crypto",
"message": "Use a specific module from `./src/encryption/` "
}
]

// ----
root: true,
reportUnusedDisableDirectives: true,
extends: ['@blockstack/eslint-config'],
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./packages/**/tsconfig.json', './tsconfig.json']
}
}
};
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,9 @@ src/testing/browser/blockstack-proofs.js

lib
dist
docs

.rts2_cache_cjs/
.rts2_cache_esm/
.rts2_cache_umd/
.idea

111 changes: 23 additions & 88 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,104 +1,39 @@
# blockstack.js [![CircleCI](https://img.shields.io/circleci/project/blockstack/blockstack.js/master.svg)](https://circleci.com/gh/blockstack/blockstack.js/tree/master) [![npm](https://img.shields.io/npm/v/blockstack.svg)](https://www.npmjs.com/package/blockstack) [![npm](https://img.shields.io/npm/dm/blockstack.svg)](https://www.npmjs.com/package/blockstack) [![npm](https://img.shields.io/npm/l/blockstack.svg)](https://www.npmjs.com/package/blockstack) [![Slack](https://img.shields.io/badge/join-slack-e32072.svg?style=flat)](http://slack.blockstack.org/)
# Stacks.js Monorepo [![CircleCI](https://img.shields.io/circleci/project/blockstack/blockstack.js/master.svg)](https://circleci.com/gh/blockstack/blockstack.js/tree/master)

Note: If you're looking for the Blockstack CLI repo it was merged with [Blockstack Core](https://github.com/blockstack/blockstack-core).
This repo is home to the Stacks.js libraries which provide everything you need to work with the Stacks blockchain.

- [Installation](#installation)
- [About](#about)
- [Documentation](#documentation)
- [Compatibility](#compatibility)
- [Contributing](#contributing)
- [Maintainer](#maintainer)
- [Testing](#testing)
- [Testing in a browser](#testing-in-a-browser)
- [Releasing](#releasing)
- [`@stacks/auth`](./packages/auth) Construct and decode authentication requests for Stacks apps.
- [`@stacks/storage`](./packages/storage) Store and fetch files with Gaia, the decentralized storage system.
- [`@stacks/transactions`](./packages/transactions) Construct, decode transactions and work with Clarity smart contracts on the Stacks blockchain.
- [`@stacks/cli`](./packages/cli) Command line interface to interact with auth, storage and Stacks transactions.
- [`@stacks/keychain`](./packages/keychain) Create and manage keys/wallets for the Stacks blockchain.
- [`@stacks/network`](./packages/network) Network and API library for working with Stacks blockchain nodes.
- [`@stacks/encryption`](./packages/encryption) Encryption functions used by Stacks.js packages.
- [`@stacks/profile`](./packages/profile) Functions for manipulating user profiles.
- [`@stacks/common`](./packages/common) Common utilities used by Stacks.js packages.

## Installation
See `README` in each package directory for installation instructions and usage.

```
$ npm install blockstack
```
## Migrating from blockstack.js

### Using blockstack.js with a CDN
To migrate your app from blockstack.js to stacks.js follow the steps in the [migration guide](./migration-guide.md).

You can import `blockstack.js` as a script without using a package manager.
To securely use the latest distribution of blockstack.js from a CDN, use the following script in your application:
## Development environment setup

<!-- cdn -->
```html
<script src="https://unpkg.com/blockstack@21.1.1/dist/blockstack.js" integrity="sha384-QsRlJlLKvr/Vq4iv1MPwTqoMx5hd0StlnCBCTdwbb0ituqCGaTxjNIkdahGHlnwb" crossorigin="anonymous"></script>
```
<!-- cdnstop -->

_Note: this is script is bundled as standalone (UMD) lib, targeting ES6 (ECMAScript 2015)._



## About

Blockstack JS is a library for profiles/identity, authentication, and storage.

The authentication portion of this library can be used to:

1. create an authentication request
2. create an authentication response

The profiles/identity portion of this library can be used to:

1. transform a JSON profile into cryptographically-signed tokens
2. recover a JSON profile from signed tokens
3. validate signed profile tokens

The storage portion of this library can be used to:

1. store and retrieve your app's data in storage that is controlled by the user

_Note:_ this lib is written in Typescript and is compiled to ES6 (ECMAScript 2015)
syntax and uses CommonJS modules. The NPM package works out of the box within the
Node.js runtime, and within browsers when using a common bundler (e.g. Webpack,
Browserify, Rollup, etc).
To setup the development environment for this repository, follow these steps:

1. Clone this package.
2. Run `lerna bootstrap` to install dependencies
3. Run `lerna run build` to build packages
4. Run `lerna run test` to run tests

## Documentation

[![Documentation](/docs-button.png)](http://blockstack.github.io/blockstack.js/index.html)

## Compatibility

_Note:_ blockstack.js 0.14.0 and newer versions use a new on-disk format that is not backward compatible with prior versions.
[![Documentation](/docs-button.png)](https://docs.blockstack.org/)

## Contributing

This repository uses the [git flow branching mode](http://nvie.com/posts/a-successful-git-branching-model/).

The latest released code as deployed to npm is in `master` and the latest delivered development
changes for the next release are in `develop`.

We use the [git-flow-avh](https://github.com/petervanderdoes/gitflow-avh) plugin.

Please send pull requests against `develop`. Pull requests should include tests,
[flow static type annotations](https://flow.org) and be lint free. Open your pull request using the template in `PULL_REQUEST_TEMPLATE.md`

Github issues marked [help-wanted](https://github.com/blockstack/blockstack.js/labels/help-wanted)
are great places to start. Please ask in a github issue or slack before embarking
Github issues marked [help-wanted](https://github.com/blockstack/stacks.js/labels/help-wanted)
are great places to start. Please ask in a github issue or discord before embarking
on larger issues that aren't labeled as help wanted or adding additional
functionality so that we can make sure your contribution can be included!

## Maintainer

This repository is maintained by [yukan.id](https://explorer.blockstack.org/name/yukan.id).

## Testing

$ npm run test

We test on the "Active LTS" version of Node.

### Testing in a browser

_This test will only work with your browser's Cross-Origin Restrictions disabled._

Run `npm run compile; npm run browserify` before opening the file `test.html`
in your browser.

## Releasing
See `release-checklist.md`
29 changes: 14 additions & 15 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
module.exports = function (api) {

module.exports = function(api) {
// TODO: Should cache on api.caller and api.env for faster build times.
api.cache.invalidate(() => true);

const isTestEnv = api.env("test");
const isDevEnv = api.env("development");
const isTestEnv = api.env('test');
const isDevEnv = api.env('development');

// Babel config for web browser lib dist with wide-spread browser support.
let opts = {
presets: [
["@babel/preset-env", {
"targets": {
"esmodules": true
}
}]
[
'@babel/preset-env',
{
targets: {
esmodules: true,
},
},
],
],
plugins: [
"@babel/proposal-class-properties",
"@babel/proposal-object-rest-spread"
]
plugins: ['@babel/proposal-class-properties', '@babel/proposal-object-rest-spread'],
};

// Use full source maps in development env.
if (!opts.sourceMaps && isDevEnv) {
opts.sourceMaps = "both";
opts.sourceMaps = 'both';
}

return opts;
}
};
Loading