-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'beta' into feat/improve-procedure-tests
- Loading branch information
Showing
380 changed files
with
78,247 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
root: ./docs/api/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,4 @@ yarn-error.log | |
npm-package/ | ||
.idea/ | ||
coverage/ | ||
test.ts | ||
docs/ | ||
test.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)* |
Oops, something went wrong.