Skip to content

Commit

Permalink
Merge pull request #13 from PolymeshAssociation/beta
Browse files Browse the repository at this point in the history
  • Loading branch information
prashantasdeveloper committed Apr 16, 2024
2 parents 2c78f6c + a016b00 commit c257170
Show file tree
Hide file tree
Showing 419 changed files with 16,423 additions and 197,247 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI

on:
push:
branches: [master, beta, alpha]
branches: [master, beta, alpha, confidential-assets]
pull_request:
types: [assigned, opened, synchronize, reopened]

Expand Down
6 changes: 4 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
".vscode-insiders",
"src/polkadot",
"src/middleware",
".eslintrc",
".eslintrc"
],
"cSpell.ignoreRegExpList": [
"/from\\s+(['\"]).*\\1/", // ignore imports
"/\/\/ TODO @\\w+/", // ignore github handles in TODOs
"/// TODO @\\w+/", // ignore github handles in TODOs
"/0x.+/" // ignore hex values
],
"cSpell.words": [
Expand All @@ -35,12 +35,14 @@
"discoverability",
"dispatchable",
"dispatchables",
"Elgamal",
"Encodable",
"Externalagents",
"Extrinsics",
"Falsyable",
"Figi",
"frontends",
"Gamal",
"inmemory",
"Isin",
"millis",
Expand Down
38 changes: 20 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,58 @@
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg?style=flat-square)](https://github.com/standard/semistandard)
[![Types](https://img.shields.io/npm/types/@polymeshassociation/polymesh-sdk)](https://)
[![npm](https://img.shields.io/npm/v/@polymeshassociation/polymesh-sdk)](https://www.npmjs.com/package/@polymeshassociation/polymesh-sdk)
[![Types](https://img.shields.io/npm/types/@polymeshassociation/polymesh-private-sdk)](https://)
[![npm](https://img.shields.io/npm/v/@polymeshassociation/polymesh-private-sdk)](https://www.npmjs.com/package/@polymeshassociation/polymesh-private-sdk)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=PolymeshAssociation_polymesh-sdk&metric=coverage)](https://sonarcloud.io/summary/new_code?id=PolymeshAssociation_polymesh-sdk)
[![Github Actions Workflow](https://github.com/PolymeshAssociation/polymesh-sdk/actions/workflows/main.yml/badge.svg)](https://github.com/PolymeshAssociation/polymesh-sdk/actions)
[![Sonar Status](https://sonarcloud.io/api/project_badges/measure?project=PolymeshAssociation_polymesh-sdk&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=PolymeshAssociation_polymesh-sdk)
[![Issues](https://img.shields.io/github/issues/PolymeshAssociation/polymesh-sdk)](https://github.com/PolymeshAssociation/polymesh-sdk/issues)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=PolymeshAssociation_polymesh-private-sdk&metric=coverage)](https://sonarcloud.io/summary/new_code?id=PolymeshAssociation_polymesh-sdk)
[![Github Actions Workflow](https://github.com/PolymeshAssociation/polymesh-private-sdk/actions/workflows/main.yml/badge.svg)](https://github.com/PolymeshAssociation/polymesh-private-sdk/actions)
[![Sonar Status](https://sonarcloud.io/api/project_badges/measure?project=PolymeshAssociation_polymesh-private-sdk&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=PolymeshAssociation_polymesh-private-sdk)
[![Issues](https://img.shields.io/github/issues/PolymeshAssociation/polymesh-private-sdk)](https://github.com/PolymeshAssociation/polymesh-private-sdk/issues)

## \@polymeshassociation/polymesh-sdk

<!--- This section is autogenerated, do not modify --->

## Polymesh version

This release is compatible with Polymesh v6.x.x
This release is compatible with Polymesh v6.x.x and Polymesh Private v1.x.x

<!--- End of section --->

## Getting Started

### Purpose
This package provides confidential asset support (aka [Polymesh Private](https://polymesh.network/private)) and is an extension of the [public SDK](https://github.com/PolymeshAssociation/polymesh-sdk).

Unless you specifically need confidential asset support, then you should use the public version. If you are adding confidential support then upgrading from public version should be a matter of updating the import from `@polymeshassociation/polymesh-sdk` to `@polymeshassociation/private-polymesh-sdk`, and updating the version. The public API should remain unchanged.

The Polymesh 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 Polymesh protocol. It focuses on abstracting away all the complexities of the Polymesh blockchain and expose a simple but complete interface. The result is a feature-rich, user-friendly node.js library.
Note, the SDK does not contain any logic around generating confidential proofs. To generate zero knowledge proofs a [confidential proof server](https://github.com/PolymeshAssociation/polymesh-private-proof-api) needs to be available, and integrating code will need to call the right endpoints when appropriate.

### Before moving on
### Purpose

This document assumes you are already familiar with [Security Tokens](https://thesecuritytokenstandard.org/) in general and [Polymath](https://www.polymath.network/) as well as [Polymesh](https://polymath.network/polymesh) in particular.
The Polymesh Private SDK's provides additional functions to the Polymesh SDK to provide support for confidential assets.

### Technical Pre-requisites

In order to use the Polymath SDK, you must install [node](https://nodejs.org/) \(version 16\) 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.
In order to use the Polymesh Private SDK, you must install [node](https://nodejs.org/) \(version 16\) 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.

### Documentation

Polymesh SDK API Reference:
Polymesh Public SDK API Reference:

https://developers.polymesh.network/sdk-docs/

### How to use

#### Installation

`npm i @polymeshassociation/polymesh-sdk --save`
`npm i @polymeshassociation/polymesh-private-sdk --save`

Or, if you're using yarn

`yarn add @polymeshassociation/polymesh-sdk`
`yarn add @polymeshassociation/polymesh-private-sdk`

Or, if using pnpm

`pnpm add @polymeshassociation/polymesh-sdk`
`pnpm add @polymeshassociation/polymesh-private-sdk`

**NOTE** it is _highly_ recommended that you use one of these three package managers. This project uses package resolutions/overrides to pin certain problematic dependencies, and these are only supported by the aforementioned package managers. Using a different package manager may result in unexpected behavior

Expand All @@ -61,7 +63,7 @@ Or, if using pnpm
Before you can start registering Tickers and creating Assets, you have to connect the Polymesh SDK client to a Polymesh node. This is a pretty straightforward process:

```typescript
import { Polymesh } from '@polymeshassociation/polymesh-sdk';
import { Polymesh } from '@polymeshassociation/polymesh-private-sdk';
import { LocalSigningManager } from '@polymeshassociation/local-signing-manager';

async function run() {
Expand Down Expand Up @@ -92,7 +94,7 @@ Here is an overview of the parameters passed to the `connect` function:
**NOTE:** if using the SDK on a browser environment \(i.e. with the Polymesh wallet browser extension\), you would use the `BrowserExtensionSigningManager` provided by `@polymeshassociation/browser-extension-signing-manager`

```typescript
import { Polymesh } from '@polymeshassociation/polymesh-sdk';
import { Polymesh } from '@polymeshassociation/polymesh-private-sdk';
import { BrowserExtensionSigningManager } from '@polymeshassociation/browser-extension-signing-manager';

async function run() {
Expand Down
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "@polymeshassociation/polymesh-sdk",
"name": "@polymeshassociation/polymesh-private-sdk",
"version": "0.0.0",
"description": "High-level API to interact with the Polymesh blockchain",
"description": "High-level API to interact with the Polymesh Private blockchain",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"author": "Polymesh Association",
"license": "ISC",
"homepage": "https://github.com/PolymeshAssociation/polymesh-sdk/wiki",
"homepage": "https://github.com/PolymeshAssociation/polymesh-private-sdk/wiki",
"bugs": {
"url": "https://github.com/PolymeshAssociation/polymesh-sdk/issues"
"url": "https://github.com/PolymeshAssociation/polymesh-private-sdk/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/PolymeshAssociation/polymesh-sdk"
"url": "https://github.com/PolymeshAssociation/polymesh-private-sdk"
},
"keywords": [
"polymesh",
Expand Down Expand Up @@ -49,12 +49,14 @@
"@babel/plugin-transform-modules-commonjs": "7.22.11",
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0",
"@golevelup/ts-jest": "^0.4.0",
"@graphql-codegen/cli": "5.0.0",
"@graphql-codegen/typescript": "4.0.1",
"@ovos-media/ts-transform-paths": "^1.7.18-1",
"@polkadot/dev-ts": "^0.76.22",
"@polkadot/typegen": "10.9.1",
"@polymeshassociation/local-signing-manager": "^3.0.1",
"@polymeshassociation/polymesh-types": "^5.8.0",
"@polymeshassociation/signing-manager-types": "^3.0.0",
"@polymeshassociation/typedoc-theme": "^1.1.0",
"@semantic-release/changelog": "^6.0.1",
Expand Down Expand Up @@ -121,9 +123,11 @@
},
"dependencies": {
"@apollo/client": "^3.8.1",
"@noble/curves": "^1.4.0",
"@polkadot/api": "10.9.1",
"@polkadot/util": "12.4.2",
"@polkadot/util-crypto": "12.4.2",
"@polymeshassociation/polymesh-sdk": "24.1.0",
"bignumber.js": "9.0.1",
"bluebird": "^3.7.2",
"cross-fetch": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion release.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
repositoryUrl: 'https://github.com/PolymeshAssociation/polymesh-sdk.git',
repositoryUrl: 'https://github.com/PolymeshAssociation/polymesh-private-sdk.git',
branches: [
'master',
{
Expand Down
31 changes: 15 additions & 16 deletions scripts/fetchDefinitions.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/* eslint-disable */
const http = require('http');
const path = require('path');
const fs = require('fs');
const rimraf = require('rimraf');
const util = require('util');
const { forEach, camelCase, mapKeys } = require('lodash');
const { NODE_URL, SCHEMA_PORT } = require('./consts');

const { typesBundle } = require('@polymeshassociation/polymesh-types');
const types = require('@polymeshassociation/polymesh-types/types/6.1.x.json');

const definitionsDir = path.resolve('src', 'polkadot');
const typesDir = path.resolve(definitionsDir, 'polymesh');
Expand Down Expand Up @@ -111,17 +112,15 @@ function writeDefinitions(schemaObj) {
fs.writeFileSync(path.resolve(definitionsDir, 'definitions.ts'), defExports);
}

http.get(`http://${NODE_URL}:${SCHEMA_PORT}/polymesh_schema.json`, res => {
const chunks = [];
res.on('data', chunk => {
chunks.push(chunk);
});

res.on('end', () => {
const schema = Buffer.concat(chunks);
const schemaObj = JSON.parse(schema);
transformSchema(schemaObj);

writeDefinitions(schemaObj);
});
});
(() => {
const { rpc, runtime, signedExtensions } = typesBundle.spec.polymesh_dev;
const schema = {
types,
rpc,
runtime,
signedExtensions,
};

transformSchema(schema);
writeDefinitions(schema);
})();
2 changes: 1 addition & 1 deletion scripts/processDocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const markdownLinks = getMarkdownLinks(hierarchy, 0);

fs.writeFileSync(
sidebarFilePath,
`## @polymeshassociation/polymesh-sdk
`## @polymeshassociation/polymesh-private-sdk
- [Home](../wiki/Home)
Expand Down
31 changes: 29 additions & 2 deletions scripts/transactions.json
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@
"exempt_ticker_affirmation": "exempt_ticker_affirmation",
"remove_ticker_affirmation_exemption": "remove_ticker_affirmation_exemption",
"pre_approve_ticker": "pre_approve_ticker",
"remove_ticker_pre_approval": "remove_ticker_pre_approval"
"remove_ticker_pre_approval": "remove_ticker_pre_approval",
"add_mandatory_mediators": "add_mandatory_mediators",
"remove_mandatory_mediators": "remove_mandatory_mediators"
},
"CapitalDistribution": {
"distribute": "distribute",
Expand Down Expand Up @@ -387,7 +389,12 @@
"affirm_with_receipts_with_count": "affirm_with_receipts_with_count",
"affirm_instruction_with_count": "affirm_instruction_with_count",
"reject_instruction_with_count": "reject_instruction_with_count",
"withdraw_affirmation_with_count": "withdraw_affirmation_with_count"
"withdraw_affirmation_with_count": "withdraw_affirmation_with_count",
"add_instruction_with_mediators": "add_instruction_with_mediators",
"add_and_affirm_with_mediators": "add_and_affirm_with_mediators",
"affirm_instruction_as_mediator": "affirm_instruction_as_mediator",
"withdraw_affirmation_as_mediator": "withdraw_affirmation_as_mediator",
"reject_instruction_as_mediator": "reject_instruction_as_mediator"
},
"Statistics": {
"add_transfer_manager": "add_transfer_manager",
Expand Down Expand Up @@ -486,5 +493,25 @@
"issue_nft": "issue_nft",
"redeem_nft": "redeem_nft",
"controller_transfer": "controller_transfer"
},
"ConfidentialAsset": {
"create_account": "create_account",
"create_confidential_asset": "create_confidential_asset",
"mint_confidential_asset": "mint_confidential_asset",
"apply_incoming_balance": "apply_incoming_balance",
"create_venue": "create_venue",
"set_venue_filtering": "set_venue_filtering",
"allow_venues": "allow_venues",
"disallow_venues": "disallow_venues",
"add_transaction": "add_transaction",
"affirm_transactions": "affirm_transactions",
"execute_transaction": "execute_transaction",
"reject_transaction": "reject_transaction",
"create_asset": "create_asset",
"mint": "mint",
"set_asset_frozen": "set_asset_frozen",
"set_account_asset_frozen": "set_account_asset_frozen",
"apply_incoming_balances": "apply_incoming_balances",
"burn": "burn"
}
}
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sonar.organization=polymeshassociation
sonar.projectKey=PolymeshAssociation_polymesh-sdk
sonar.projectKey=PolymeshAssociation_polymesh-private-sdk
sonar.sources=src
sonar.coverage.exclusions=**/testUtils/**,**/polkadot/**,**/__tests__/**,**/generated/**,src/utils/typeguards.ts,src/types/internal.ts,src/middleware/enums.ts
sonar.cpd.exclusions=**/__tests__/**,**/polkadot/**
Expand Down

0 comments on commit c257170

Please sign in to comment.