-
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 pull request #212 from PolymathNetwork/beta
Beta
- Loading branch information
Showing
605 changed files
with
73,860 additions
and
12,669 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"extends": ["airbnb-base", "prettier", "prettier/@typescript-eslint"], | ||
"env": { | ||
"browser": true, | ||
"jest": true | ||
}, | ||
"rules": { | ||
"no-unused-vars": "off", | ||
"camelcase": "off", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ | ||
"vars": "all", | ||
"args": "after-used", | ||
"ignoreRestSiblings": true | ||
} | ||
], | ||
"import/no-unresolved": "off", | ||
"no-extra-boolean-cast": "off", | ||
"func-names": "off", | ||
"max-len": [ | ||
"error", | ||
{ | ||
"code": 100, | ||
"ignoreComments": true, | ||
"ignoreStrings": true, | ||
"ignoreRegExpLiterals": true, | ||
"ignoreTemplateLiterals": true | ||
} | ||
], | ||
"import/prefer-default-export": "off", | ||
"class-methods-use-this": "off", | ||
"no-underscore-dangle": "off", | ||
"no-confusing-arrow": "off", | ||
"arrow-body-style": "off", | ||
"no-else-return": "off", | ||
"no-plusplus": "off", | ||
"no-nested-ternary": "off", | ||
"no-restricted-globals": "off", | ||
"arrow-parens": "off", | ||
"no-multi-str": "off", | ||
"implicit-arrow-linebreak": "off", | ||
"comma-dangle": [ | ||
"error", | ||
{ | ||
"arrays": "always-multiline", | ||
"objects": "always-multiline", | ||
"imports": "always-multiline", | ||
"exports": "always-multiline", | ||
"functions": "never" | ||
} | ||
], | ||
"import/no-extraneous-dependencies": [ | ||
"off", | ||
{ | ||
"packageDir": ["../../", "./"] | ||
} | ||
], | ||
"require-jsdoc": [ | ||
"warn", | ||
{ | ||
"require": { | ||
"FunctionDeclaration": true, | ||
"MethodDefinition": true, | ||
"ClassDeclaration": true, | ||
"ArrowFunctionExpression": true, | ||
"FunctionExpression": true | ||
} | ||
} | ||
] | ||
}, | ||
"plugins": ["@typescript-eslint"], | ||
"parserOptions": { | ||
"sourceType": "module" | ||
} | ||
} |
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 |
---|---|---|
|
@@ -2,4 +2,7 @@ | |
node_modules/ | ||
dist/ | ||
yarn-error.log | ||
npm-package/ | ||
npm-package/ | ||
.idea/ | ||
coverage/ | ||
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 @@ | ||
__tests__ |
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "es5" | ||
"trailingComma": "es5", | ||
"tabWidth": 2, | ||
"printWidth": 100 | ||
} |
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 |
---|---|---|
|
@@ -13,4 +13,6 @@ jobs: | |
script: | ||
- yarn | ||
- yarn build:ci | ||
- yarn test | ||
- yarn coveralls | ||
- yarn semantic-release |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"editor.tabSize": 2, | ||
"editor.formatOnSave": true | ||
} |
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 |
---|---|---|
|
@@ -9,7 +9,7 @@ docs | |
doc | ||
website | ||
images | ||
assets | ||
!istanbul-reports/lib/html/assets | ||
|
||
# examples | ||
example | ||
|
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 |
---|---|---|
@@ -1,9 +1,71 @@ | ||
![Polymath logo](Polymath.png) | ||
[![Coverage Status](https://coveralls.io/repos/github/PolymathNetwork/polymath-sdk/badge.svg?branch=master)](https://coveralls.io/github/PolymathNetwork/polymath-sdk?branch=master) | ||
|
||
# Polymath SDK | ||
|
||
A Javascript SDK for interacting with the Polymath network for the browser and Node.js | ||
|
||
# Supported Polymath Protocol versions | ||
|
||
- 3.0 | ||
- 3.1 | ||
|
||
# Usage | ||
|
||
First, configure your Polymath Client: | ||
|
||
```ts | ||
// polyClient.ts | ||
import { Polymath, browserUtils } from '@polymathnetwork/sdk'; | ||
|
||
// create the necessary Web3 providers on its own. You can pass custom ones | ||
// if you want though. | ||
const config = { | ||
polymathRegistryAddress: '0x1234...', | ||
}; | ||
|
||
// You could have multiple configs for each network you support: | ||
const networkConfigs = { | ||
['1']: { | ||
/* */ | ||
}, | ||
['42']: { | ||
/* */ | ||
}, | ||
}; | ||
const networkId = await browserUtils.getNetworkId(); | ||
const config = networkConfigs[networkId]; | ||
|
||
// You'll want to reuse the smae instance of the Polymath client in the rest of | ||
// your app for the same network. | ||
export const polyClient = new Polymath(config); | ||
``` | ||
|
||
Initializing your client | ||
|
||
```ts | ||
// Pending | ||
``` | ||
|
||
Finally, let's start a procedure to reserve a Security Token | ||
|
||
```ts | ||
// Builds a list of transactions required to reserve a security token | ||
const transactionQueue = await polyClient.reserveSecurityToken({ | ||
name: 'My Token', | ||
symbol: 'MY-TOKEN', | ||
}); | ||
|
||
// We can listen to events for individual transactions as well as the queue | ||
// itself. For now, let's just listen to the whole queue | ||
|
||
await transactionQueue.run(); // Will run sequentially every transaction required | ||
|
||
// At this point my token has been reserved | ||
const myTokenReservation = await polyClient.getSecurityTokenReservation({ | ||
symbol: 'MY-TOKEN', | ||
}); | ||
``` | ||
|
||
# Documentation | ||
|
||
https://developers.polymath.network/developers/ |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.