2.0.2 • Published 2 days ago

ontology-ts-sdk v2.0.2

Weekly downloads
330
License
LGPL-3.0
Repository
github
Last release
2 days ago

Overview

This is the official Ontology TypeScript SDK - a comprehensive library for developing with the Ontology 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.

Getting Started

Installation

Download Through npm/Yarn

npm install 'ontology-ts-sdk' --save

or

yarn add 'ontology-ts-sdk'

Build from Source Code

Downloading

git clone 'https://github.com/ontio/ontology-ts-sdk.git'

Then install the dependencies with:

yarn

Compiling

Compile the project with the:

yarn build:dev // or yarn build:prod

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

Testing

The tests can be found in the test directory. They are distinguished into three categories stored in separate subfolders:

  • unit: unit tests that can be run without external or network dependencies
  • integration: integration tests that require access to one or more Blockchain nodes and test the actual interaction with the Blockchain
  • example: pure sample code without test assertations that can be used for explorative testing or documentation purposes

To run the tests, use one of:

# unit tests
npm run test:unit
# integration tests
npm run test:integration
# examples
npm run test:example
# all
npm run test

or

yarn run test:unit
# integration tests
yarn run test:integration
# examples
yarn run test:example
# all
yarn test

The integration tests use several accounts on the testnet that require funding of ONG tokens in order to pay for the transactions. If there are any test failures with error messages like "insufficient funds" or similar, make sure the following accounts are properly funded:

  • APT4wZG9sFQfjhyfGALPXQj5UyrQ3ZCVkY
  • ANH5bHrrt111XwNEnuPZj6u95Dd6u7G4D6
  • AXK2KtCfcJnSMyRzSwTuwTKgNrtx5aXfFX
  • AVXf5w8WD2y6jV1Lzi36oSKYNif1C7Surc
  • AdLUBSSHUuFaak9j169hiamXUmPuCTnaRz
  • AJkkLbouowk6teTaxz1F2DYKfJh24PVk3r
  • ATk57i8rMXFSBpHAdX3UQ4TNe48BBrfCoc
  • AU9TioM24rXk5E3tUGrv8jwgBA1aZVVKDW
  • AHTdWzj4jYBzbU48YBCfovvouTMc45M6iP
  • AJym8dF7wZLjtoiY8C3mmYt8f2tZDxq5iz

Use in Project

Import

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

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

Require

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

var Ont = require('ontology-ts-sdk');
var wallet = Ont.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 Ont variable, just like in the require example above.

var wallet = Ont.Wallet.create('test');

Contributing

Contributors are welcome to the ontology-ts-sdk. Before beginning, please take a look at our contributing guidelines. You can open an issue by clicking here.

If you have any issues getting setup, open an issue or reach out in the Ontology Discord.

License

The Ontology TypeScript SDK is availabl under the LGPL-3.0 License.

2.0.2

2 days ago

2.0.1

10 months ago

2.0.0

2 years ago

1.2.0

2 years ago

2.0.0-beta.0

2 years ago

1.1.22

3 years ago

1.1.21

3 years ago

1.1.20

3 years ago

1.1.19

3 years ago

1.1.18

3 years ago

1.1.17

3 years ago

1.1.17-alpha.5

4 years ago

1.1.17-alpha.3

4 years ago

1.1.17-alpha.4

4 years ago

1.1.17-alpha.1

4 years ago

1.1.17-alpha.2

4 years ago

1.1.16

4 years ago

1.1.15

4 years ago

1.1.14

4 years ago

1.1.14-alpha.3

4 years ago

1.1.14-alpha.2

4 years ago

1.1.14-alpha.1

4 years ago

1.1.13-alpha.1

4 years ago

1.1.12

4 years ago

1.1.11

4 years ago

1.1.13

4 years ago

1.1.10-alpha.1

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.26

4 years ago

1.0.25

4 years ago

1.0.24

4 years ago

1.0.23

4 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.9.9

5 years ago

0.9.8

6 years ago

0.9.7

6 years ago

0.9.6

6 years ago

0.9.5

6 years ago

0.9.4

6 years ago

0.9.3

6 years ago

0.9.2

6 years ago

0.9.1

6 years ago

0.9.0

6 years ago