Skip to content

Commit

Permalink
Merge branch 'beta' into feat/improve-procedure-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorVicente committed Feb 20, 2020
2 parents f86a6a8 + 454d285 commit 33480b2
Show file tree
Hide file tree
Showing 380 changed files with 78,247 additions and 12 deletions.
5 changes: 2 additions & 3 deletions .eslintrc
Expand Up @@ -68,10 +68,9 @@
"FunctionExpression": true
}
}
],
"tsdoc/syntax": "warn"
]
},
"plugins": ["@typescript-eslint", "eslint-plugin-tsdoc"],
"plugins": ["@typescript-eslint"],
"parserOptions": {
"sourceType": "module"
}
Expand Down
1 change: 1 addition & 0 deletions .gitbook.yaml
@@ -0,0 +1 @@
root: ./docs/api/
3 changes: 1 addition & 2 deletions .gitignore
Expand Up @@ -5,5 +5,4 @@ yarn-error.log
npm-package/
.idea/
coverage/
test.ts
docs/
test.ts
1 change: 1 addition & 0 deletions .prettierignore
@@ -0,0 +1 @@
docs
52 changes: 52 additions & 0 deletions docs/api/README.md
@@ -0,0 +1,52 @@
# @polymathnetwork/sdk - v2.0.1-beta.120

# Getting Started

## Purpose

The Polymath SDK's main goal is to provide external developers with a set of tools that will allow them to build powerful applications that interact with the Polymath protocol. It focuses on abstracting away all the complexities of the smart contracts (and the blockchain itself) and expose a simple but complete interface. The result is a feature-rich, user-friendly node.js library.

## Before moving on

This document assumes you are already familiar with [Security Tokens](https://thesecuritytokenstandard.org/) in general and [Polymath](https://www.polymath.network/) in particular.

## Technical Pre-requisites

In order to use the Polymath SDK, you must install [node](https://nodejs.org/) (version 10) and [npm](https://www.npmjs.com/). The library is written in [typescript](https://www.typescriptlang.org/), but can also be used in plain javascript. This document will assume you are using typescript, but the translation to javascript is very simple.

## How to use

### Installation

`npm i @polymathnetwork/sdk --save`

Or, if you're using yarn

`yarn add @polymathnetwork/sdk`

### Initializing the client

Before you can start creating Security Tokens and launching STOs, you have to connect the Polymath SDK client to an Ethereum node. This is a pretty straightforward process:

```typescript
import { Polymath } from '@polymathnetwork/sdk';

async function connectAndReturnStatus() {
const polyClient = new Polymath();
await polyClient.connect({
providerUrl: 'https://some-node-url.com',
privateKey: 'YOUWISH',
});

return polyClient.isConnected ? 'connected' : 'not connected';
}

connectAndReturnStatus().then(status => console.log(`Connection status: ${status}`)); // 'Connection status: connected'
```

Here is an overview of the parameters passed to the `connect` function:

- `providerUrl` is a URL that points to a running Ethereum node
- `privateKey` is the private key of the wallet that will be performing transactions

**NOTE:** if using the SDK on a browser environment (i.e. with MetaMask), there is no need to supply the node URL nor the private key.
634 changes: 634 additions & 0 deletions docs/api/SUMMARY.md

Large diffs are not rendered by default.

63 changes: 63 additions & 0 deletions docs/api/classes/_context_.context.md
@@ -0,0 +1,63 @@
# Class: Context

Context in which the SDK is being used

- Holds the current instance of the contract wrappers
- Holds the current wallet
- Holds the factories that create and cache entities

## Hierarchy

* **Context**

## Index

### Constructors

* [constructor](_context_.context.md#constructor)

### Properties

* [contractWrappers](_context_.context.md#contractwrappers)
* [currentWallet](_context_.context.md#currentwallet)
* [factories](_context_.context.md#factories)

## Constructors

### constructor

\+ **new Context**(`params`: [ConstructorParams](../interfaces/_context_.constructorparams.md)): *[Context](_context_.context.md)*

*Defined in [src/Context.ts:45](https://github.com/PolymathNetwork/polymath-sdk/blob/ade5412/src/Context.ts#L45)*

**Parameters:**

Name | Type |
------ | ------ |
`params` | [ConstructorParams](../interfaces/_context_.constructorparams.md) |

**Returns:** *[Context](_context_.context.md)*

## Properties

### contractWrappers

**contractWrappers**: *[PolymathBase](_polymathbase_.polymathbase.md)*

*Defined in [src/Context.ts:41](https://github.com/PolymathNetwork/polymath-sdk/blob/ade5412/src/Context.ts#L41)*

___

### currentWallet

**currentWallet**: *Wallet*

*Defined in [src/Context.ts:43](https://github.com/PolymathNetwork/polymath-sdk/blob/ade5412/src/Context.ts#L43)*

___

### factories

**factories**: *[Factories](../interfaces/_context_.factories.md)*

*Defined in [src/Context.ts:45](https://github.com/PolymathNetwork/polymath-sdk/blob/ade5412/src/Context.ts#L45)*
212 changes: 212 additions & 0 deletions docs/api/classes/_entities_checkpoint_.checkpoint.md
@@ -0,0 +1,212 @@
# Class: Checkpoint

Represents a snapshot of the Security Token's supply and Shareholder balances at a certain point in time

## Hierarchy

* [Entity](_entities_entity_.entity.md)[Params](../interfaces/_entities_checkpoint_.params.md)

**Checkpoint**

## Index

### Constructors

* [constructor](_entities_checkpoint_.checkpoint.md#constructor)

### Properties

* [createdAt](_entities_checkpoint_.checkpoint.md#createdat)
* [dividendDistributions](_entities_checkpoint_.checkpoint.md#dividenddistributions)
* [index](_entities_checkpoint_.checkpoint.md#index)
* [securityTokenId](_entities_checkpoint_.checkpoint.md#securitytokenid)
* [securityTokenSymbol](_entities_checkpoint_.checkpoint.md#securitytokensymbol)
* [shareholderBalances](_entities_checkpoint_.checkpoint.md#shareholderbalances)
* [totalSupply](_entities_checkpoint_.checkpoint.md#totalsupply)
* [uid](_entities_checkpoint_.checkpoint.md#uid)

### Methods

* [_refresh](_entities_checkpoint_.checkpoint.md#_refresh)
* [toPojo](_entities_checkpoint_.checkpoint.md#topojo)
* [generateId](_entities_checkpoint_.checkpoint.md#static-generateid)
* [unserialize](_entities_checkpoint_.checkpoint.md#static-unserialize)

## Constructors

### constructor

\+ **new Checkpoint**(`params`: [Params](../interfaces/_entities_checkpoint_.params.md) & [UniqueIdentifiers](../interfaces/_entities_checkpoint_.uniqueidentifiers.md)): *[Checkpoint](_entities_checkpoint_.checkpoint.md)*

*Defined in [src/entities/Checkpoint.ts:106](https://github.com/PolymathNetwork/polymath-sdk/blob/ade5412/src/entities/Checkpoint.ts#L106)*

Create a new Chekpoint instance

**Parameters:**

Name | Type |
------ | ------ |
`params` | [Params](../interfaces/_entities_checkpoint_.params.md) & [UniqueIdentifiers](../interfaces/_entities_checkpoint_.uniqueidentifiers.md) |

**Returns:** *[Checkpoint](_entities_checkpoint_.checkpoint.md)*

## Properties

### createdAt

**createdAt**: *Date*

*Defined in [src/entities/Checkpoint.ts:106](https://github.com/PolymathNetwork/polymath-sdk/blob/ade5412/src/entities/Checkpoint.ts#L106)*

___

### dividendDistributions

**dividendDistributions**: *[DividendDistribution](_entities_dividenddistribution_.dividenddistribution.md)[]*

*Defined in [src/entities/Checkpoint.ts:88](https://github.com/PolymathNetwork/polymath-sdk/blob/ade5412/src/entities/Checkpoint.ts#L88)*

dividend distributions associated to this snapshot

___

### index

**index**: *number*

*Defined in [src/entities/Checkpoint.ts:97](https://github.com/PolymathNetwork/polymath-sdk/blob/ade5412/src/entities/Checkpoint.ts#L97)*

numerical index of the checkpoint associated to this snapshot

___

### securityTokenId

**securityTokenId**: *string*

*Defined in [src/entities/Checkpoint.ts:92](https://github.com/PolymathNetwork/polymath-sdk/blob/ade5412/src/entities/Checkpoint.ts#L92)*

___

### securityTokenSymbol

**securityTokenSymbol**: *string*

*Defined in [src/entities/Checkpoint.ts:90](https://github.com/PolymathNetwork/polymath-sdk/blob/ade5412/src/entities/Checkpoint.ts#L90)*

___

### shareholderBalances

**shareholderBalances**: *[ShareholderBalance](../interfaces/_types_index_.shareholderbalance.md)[]*

*Defined in [src/entities/Checkpoint.ts:102](https://github.com/PolymathNetwork/polymath-sdk/blob/ade5412/src/entities/Checkpoint.ts#L102)*

shareholder balances at this specific checkpoint

___

### totalSupply

**totalSupply**: *BigNumber*

*Defined in [src/entities/Checkpoint.ts:104](https://github.com/PolymathNetwork/polymath-sdk/blob/ade5412/src/entities/Checkpoint.ts#L104)*

___

### uid

**uid**: *string*

*Overrides [Entity](_entities_entity_.entity.md).[uid](_entities_entity_.entity.md#abstract-uid)*

*Defined in [src/entities/Checkpoint.ts:83](https://github.com/PolymathNetwork/polymath-sdk/blob/ade5412/src/entities/Checkpoint.ts#L83)*

## Methods

### _refresh

**_refresh**(`params`: Partial‹[Params](../interfaces/_entities_checkpoint_.params.md)›): *void*

*Overrides [Entity](_entities_entity_.entity.md).[_refresh](_entities_entity_.entity.md#abstract-_refresh)*

*Defined in [src/entities/Checkpoint.ts:164](https://github.com/PolymathNetwork/polymath-sdk/blob/ade5412/src/entities/Checkpoint.ts#L164)*

Hydrate the entity

**Parameters:**

Name | Type |
------ | ------ |
`params` | Partial‹[Params](../interfaces/_entities_checkpoint_.params.md)› |

**Returns:** *void*

___

### toPojo

**toPojo**(): *object*

*Overrides [Entity](_entities_entity_.entity.md).[toPojo](_entities_entity_.entity.md#abstract-topojo)*

*Defined in [src/entities/Checkpoint.ts:137](https://github.com/PolymathNetwork/polymath-sdk/blob/ade5412/src/entities/Checkpoint.ts#L137)*

Convert entity to a POJO (Plain Old Javascript Object)

**Returns:** *object*

* **createdAt**: *Date*

* **dividendDistributions**: *object[]* = dividendDistributions.map(distribution => distribution.toPojo())

* **index**: *number*

* **securityTokenId**: *string*

* **securityTokenSymbol**: *string*

* **shareholderBalances**: *[ShareholderBalance](../interfaces/_types_index_.shareholderbalance.md)[]*

* **totalSupply**: *BigNumber*

* **uid**: *string*

___

### `Static` generateId

**generateId**(`__namedParameters`: object): *string*

*Defined in [src/entities/Checkpoint.ts:58](https://github.com/PolymathNetwork/polymath-sdk/blob/ade5412/src/entities/Checkpoint.ts#L58)*

Generate the Checkpoint's UUID from its identifying properties

**Parameters:**

**__namedParameters**: *object*

Name | Type |
------ | ------ |
`index` | number |
`securityTokenId` | string |

**Returns:** *string*

___

### `Static` unserialize

**unserialize**(`serialized`: string): *[UniqueIdentifiers](../interfaces/_entities_checkpoint_.uniqueidentifiers.md)*

*Defined in [src/entities/Checkpoint.ts:70](https://github.com/PolymathNetwork/polymath-sdk/blob/ade5412/src/entities/Checkpoint.ts#L70)*

Unserialize string to Checkpoint object

**Parameters:**

Name | Type |
------ | ------ |
`serialized` | string |

**Returns:** *[UniqueIdentifiers](../interfaces/_entities_checkpoint_.uniqueidentifiers.md)*

0 comments on commit 33480b2

Please sign in to comment.