Skip to content

Commit

Permalink
first commit (#1)
Browse files Browse the repository at this point in the history
* first commit

* update readme
  • Loading branch information
MickWang authored and Honglei-Cong committed Jan 8, 2020
1 parent 66d4e02 commit 44f280a
Show file tree
Hide file tree
Showing 130 changed files with 37,257 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"env": {
"development": {
"presets": [
[
"env",
{
"modules": false,
"targets": {
"chrome": 67
}
}
]
],
"plugins": [
"transform-object-rest-spread"
]
},
"production": {
"presets": [
[
"env",
{
"modules": false
}
]
],
"plugins": [
"transform-object-rest-spread",
["transform-runtime", {
"regenerator": true
}]
]
}
}
}
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
node_modules
/.project
/.settings/


/docs/_build/
lib/

# Logs
*.log

# Coverage
/.nyc_output
/coverage

# IDE specific
/.vscode

/.DS_Store
src/.DS_Store

apidoc/
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
src/
node_modules/
tsconfig.json
36 changes: 36 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Contributing
=========================================

We welcome contributions. Please follow the guidelines when opening issues and contributing code to the repo.

Contributing
------------

We follow the [fork-and-pull](https://stackoverflow.com/a/11582996/3830876) Git workflow:

1. **Fork** the repo on GitHub
2. **Clone** it to your own machine
3. **Commit** changes to your fork
4. **Push** changes to your fork
5. Submit a **Pull request** for review

**NOTE:** Be sure to merge the latest changes before making a pull request!

Pull Requests
------
As outlined in Keavy McMinn's article ["How to write the perfect pull request"](https://github.blog/2015-01-21-how-to-write-the-perfect-pull-request/), you should include:

1. The purpose of the PR
2. A brief overview of what you did
3. Tag any issues that the PR relates to and [close issues with a keyword](https://help.github.com/en/articles/closing-issues-using-keywords)
4. What kind of feedback you're looking for (if any)
5. Tag individuals you want feedback from (if any)

Issues
------

Feel free to submit issues and enhancement requests [here](https://github.com/ontio/DNA-ts-sdk/issues/new). Please consider [how to ask a good question](https://stackoverflow.com/help/how-to-ask) and take the time to research your issue before asking for help.

Duplicate questions will be closed.

Any unrelated comments or questions can be asked in the [DNA Discord](https://discordapp.com/invite/4TQujHj).
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Expand Down
129 changes: 129 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@

<h1 align="center">DNA TypeScript SDK </h1>
<h4 align="center">Version V1.1.0 </h4>

- [Overview](#overview)
- [Installation](#installation)
- [Download Through npm/Yarn](#download-through-npmyarn)
- [Build from Source Code](#build-from-source-code)
- [Downloading](#downloading)
- [Compiling](#compiling)
- [Testing](#testing)
- [Use in Project](#use-in-project)
- [Import](#import)
- [Require](#require)
- [In the Browser](#in-the-browser)
- [Contributing](#contributing)
- [License](#license)

## Overview

This is the official DNA TypeScript SDK - a comprehensive library for developing with the DNA blockchain in both TypeScript and JavaScript. It currently supports management of wallets, digital identities and digital assets - as well as the deployment and invocation of smart contracts.

## Installation

### Download Through npm/Yarn

````
npm install 'dna-ts-sdk' --save
````

or

```
yarn add 'dna-ts-sdk'
```

### Build from Source Code

#### Downloading

```
git clone 'https://github.com/DNAProject/DNA-ts-SDK.git'
```

Then install the dependencies with:

```
npm install
```

or

```
yarn
```

#### Compiling

Compile the project with the:

````
npm run build:dev // or npm run build:prod
````

or

```
yarn run build:dev // or yarn run build:prod
```

This will create a compiled version of the SDK in the `lib` directory.

#### Testing

To run the tests in the `test` directory, use:

```
npm run test
```

or

```
yarn run test
```

### Use in Project

#### Import

Using `import` to include the modules from `'DNA-ts-sdk'`:

```
import {Wallet} from 'DNA-ts-sdk';
var wallet = Wallet.create('test');
```

#### Require

Using `require` to include the modules from `'DNA-ts-sdk'`:

````
var DNA = require('DNA-ts-sdk');
var wallet = DNA.Wallet.create('test');
````

#### In the Browser

To use in the browser you must use the compiled version (as listed above).
The `browser.js` file is located in the `lib` directory.
Include it into the project with a `<script>` tag:

````
<script src="./lib/browser.js"></script>
````

Everything will be available under the `DNA` variable, just like in the `require` example above.

```
var wallet = DNA.Wallet.create('test');
```

## Contributing

Contributors are welcome to the `DNA-ts-sdk`. Before beginning, please take a look at our [contributing guidelines](CONTRIBUTING.md). You can open an issue by [clicking here](https://github.com/DNAProject/DNA-ts-sdk/issues/new).

## License

The DNA TypeScript SDK is availabl under the [LGPL-3.0 License](LICENSE).
7 changes: 7 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
transform: {
"^.+\\.tsx?$": "ts-jest",
},
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
};
Loading

0 comments on commit 44f280a

Please sign in to comment.