Socket
Socket
Sign inDemoInstall

@polymathnetwork/contract-wrappers

Package Overview
Dependencies
18
Maintainers
6
Versions
91
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @polymathnetwork/contract-wrappers

Smart TS wrappers for Polymath smart contracts


Version published
Weekly downloads
133
increased by241.03%
Maintainers
6
Created
Weekly downloads
 

Changelog

Source

3.0.0-beta.1 (2020-03-18)

Bug Fixes

  • 🐛 adapt code to compile 3.1.0 contracts (bdf6038)
  • 🐛 adapt plcr to new events refactor (dea59ec)
  • 🐛 add MATM typeguard (10fc063)
  • 🐛 add assertion to securitytokenreigstry tickers (dbf435a)
  • 🐛 add bundle-analyzer to visualize size of project (4b6e660)
  • 🐛 add deleteDelegateMulti and addDelegateMulti tests (1ef23d3)
  • 🐛 add fixes from review included usdtieredSto, new test (2a1f3a8)
  • 🐛 add improvements requested by VW (fab0d35)
  • 🐛 add isLockUpTransferManager_3_0_0 method (0c6c301)
  • 🐛 add isLockUpTransferManager_3_0_0 reference (230bfd1)
  • 🐛 add isManualApprovalTransferManager_3_0_0 method (6cffd39)
  • 🐛 add LTM typeguard (c20b966)
  • 🐛 add missing behavior and cover it with new tests (4d81af4)
  • 🐛 add moduleInstanceComponent to addInvestorToWhitelist (d0aee82)
  • 🐛 add new assert funcion in revealVote method (62ee776)
  • 🐛 add new assert logic (db3f8e7)
  • 🐛 add new fixes regarding Jere's feedback (44fc54e)
  • 🐛 add no-non-null-assertion disable line (c4b9017)
  • 🐛 add reference for 3.1.0 in src/index.ts (c221f44)
  • 🐛 add retun types missed on sto wrapper (b7ba542)
  • 🐛 add retun types missed on usd tiered sto (988aa20)
  • 🐛 add return type in modifySchedule method (3.0 and 3.1) (1b60964)
  • 🐛 add return type missed on capped sto (04b1f5c)
  • 🐛 add return types missed for * registries (e06df71)
  • 🐛 add return types missed in all tokens folder (4c586da)
  • 🐛 add return types missed into dividend checkpoint (23148e4)
  • 🐛 add return types missed on * transfer manager modules (75055e6)
  • 🐛 add return types missed on blacklist transfer manager (cbdce5c)
  • 🐛 add return types missed on erc20 dividend checkpoint (070cc47)
  • 🐛 add return types missed on ether dividend checkpoint (8303fc4)
  • 🐛 add return types missed on general permission (0d403bc)
  • 🐛 add return types missed on module * factory (1fc1074)
  • 🐛 add return types missed on VEW (fd675b4)
  • 🐛 add revealVote test and cover 100% (36c1e03)
  • 🐛 add solidityKeccak256 function in commitVote method (26b9989)
  • 🐛 add VEW to exports in index.ts (5e66672)
  • 🐛 advances in revealVote and TODO comment for getLogsAsync (92d0372)
  • 🐛 and test modular example for GPM (remove txparams) (e7e5d10)
  • 🐛 change mocked currency symbol to make it more consistent (7e2d068)
  • 🐛 check ModuleWrapper type fix (c140fc8)
  • 🐛 checkAndAsk becomes getPolyTokens example for faucet (da56829)
  • 🐛 comlete example file and fix feedback requested by PR (5488990)
  • 🐛 complete txparams removal (41b8ca1)
  • 🐛 convert 'data' properly in transfer functions (f166885)
  • 🐛 Decode events at getLogsAsync and SubscribeAsync (77ab063)
  • 🐛 Delegate details return type (6668d85)
  • 🐛 duplicate TM in types (031fb19)
  • 🐛 examples, remove the txParams and add prettier syntax (9289129)
  • 🐛 export ST events (bc13aac)
  • 🐛 export USDTieredSTO typeguard (c1f4df9)
  • 🐛 extends from DividendCheckpoint instead Module (4229b77)
  • 🐛 feedback fixes (a1e7df1)
  • 🐛 feedback fixes (84520c9)
  • 🐛 Fetch decimals from stable coins when BuyWithUSD (5b140d7)
  • 🐛 fix advanced_p_l_c_r_voting_checkpoint_wrapper test (72bb1b4)
  • 🐛 fix all create ballot methods (2cb54a4)
  • 🐛 fix broken test (ff728a6)
  • 🐛 fix faulty imports (ff3a306)
  • 🐛 fix faulty non-hex default (068e0bc)
  • 🐛 fix getFees method return type (6e9052d)
  • 🐛 fix lint wrnings (6e3d746)
  • 🐛 fix solidityKeccak256 assertion for multiple choices (b8a453d)
  • 🐛 fix test requested by victor (798e95c)
  • 🐛 fix weird formatting in common test (4a28b49)
  • 🐛 Fix yarn.lock file and build issues (8c0981c)
  • 🐛 Fixed blacklistTM exports (5a85268)
  • 🐛 getBallotResults fix (c8488e3)
  • 🐛 hookup the gtm to the index and rest of project (decba23)
  • 🐛 import BlacklistTransferManager_3_0_0 to fix Travis CI (769e012)
  • 🐛 Improve multi-version events handling (8961a73)
  • 🐛 improve typos and definitions (eacfe73)
  • 🐛 improvements requested by Jere (98073e2)
  • 🐛 isValidModule fix so that burn types filter works (ad87574)
  • 🐛 make data optional and convert it properly (1d08f07)
  • 🐛 make usdtieredsto wrapper and tests conform to new gtm (5fe37d6)
  • 🐛 manual merge form multi-version-support (867a926)
  • 🐛 manual merge from develop (65ce2ca)
  • 🐛 manual merge from develop into it this branch (05b9b96)
  • 🐛 manual merge from feature to vew3.1.0 (d5bc11f)
  • 🐛 missing CountTM get method in wrapper Factory (698bdad)
  • 🐛 moduleFactory reference in examples (yarn start working) (e4fb61e)
  • 🐛 modules need to get poly on their ST balance (f5895d6)
  • 🐛 move event method from common to 3.0.0 (ade266a)
  • 🐛 move events method from common to specific version (fec8e18)
  • 🐛 Move getLogs y subscribe methods to common files (166800d)
  • 🐛 Multi-version support for transactionParams (0fb4ae7)
  • 🐛 rebuild with travis CLI fix (130bbb9)
  • 🐛 remake valid module check to support archived modules (b860eae)
  • 🐛 remnove types and typo errors requested by review (2f8d4de)
  • 🐛 remove construct method (ca46460)
  • 🐛 remove duplicate test (5fffe8f)
  • 🐛 remove else and add new if condition (dc0dd30)
  • 🐛 remove other txParams usage from CTM module (289db3a)
  • 🐛 remove PTM test (21856b4)
  • 🐛 remove stringArrayToBytes32Array import (e0bba41)
  • 🐛 remove TODO comment (87863bd)
  • 🐛 remove unneccessary test file likely breaking build (10fea5f)
  • 🐛 rename export wrappers and events (1887c5a)
  • 🐛 Restore deleted SecurityTokenRegistry events (c56a46a)
  • 🐛 return correct instance of the ST from factory getters (92f3a24)
  • 🐛 return human readable fees (d180d06)
  • 🐛 Typo (3ac83e9)
  • 🐛 Typo at GTM eventArgs (7df1437)
  • 🐛 Typo at USDTieredSTO eventArgs (1d67d60)
  • 🐛 Typo importing types in dividend and sto wrappers (60f882f)
  • 🐛 update abi-wrappers to beta.7 (14879d7)
  • 🐛 update to include fedes recent method returnType changes (83e1e1f)
  • 🐛 update yarn lock (29fdc30)
  • 🐛 usdTieredSTO modular example now functioning (5a5aebf)
  • 🐛 use correct hashing function for fee type (2975654)
  • 🐛 use correct STO ABIs for adding modules (74b4ac3)
  • add error message when bytes32 string is over 32 chars long (00b4269)
  • add usdTiered to the contract event args (56c5fad)
  • example for cappedSTO (9428a36)
  • infer any type (4e5b303)
  • make imports specific to their file names (fe9e3a3)
  • merge second commit (cc788c8)
  • reference to module data interfaces in examples (11cbe15)
  • remove unnecessary event subscription and reorganize imports (b4d6388)
  • remove unnecessary import for events in example (f60179b)
  • typo in comments for restrictedPartialSaleTM (12e670b)
  • use wrapper common type, not any for the typeguard (22240b6)
  • vew imports as well (2f921c8)
  • vrtm needs longer examples delay (fbe9225)
  • yarn build can now compile without throwing error (1e02e0e)

chore

  • 🤖 Added changelog plugin to semantic-release (7450890)
  • 🤖 Merge master updates (1025dca)

Features

  • 🎸 [WIP] add scaffolding and base code for AdvancedPLCRVC (6d69fbd)
  • 🎸 adapt dividend modules to multi version (5d4377a)
  • 🎸 add getPermission to RestrictedPartialSaleTM (654e7c7)
  • 🎸 add methods and assertions for Advanced PLCR voting (157bbfb)
  • 🎸 add new 3.1.0 methods (5bc752d)
  • 🎸 add new versioned architecture wrappers GTM 3.0 and 3.1 (57c116a)
  • 🎸 add new versioned architecture wrappers VEW 3.0 and 3.1 (67f6309)
  • 🎸 add new VEW 3.1.0 modules (31c81c3)
  • 🎸 add remaining method to restrictedpartialsaleTM (b19a0d4)
  • 🎸 add restrictedPartialSaleTM example file (f40d80e)
  • 🎸 Add sign transfer data method for dynamic whitelisting (a2373d8)
  • 🎸 add ST backwards compatibility module (ce41823)
  • 🎸 add the restrictedPartialSaleTM as a wrapper on its own (fb4c0f5)
  • 🎸 adding more to example, setting up to use module (66699bb)
  • 🎸 BTM backwards compatibility migration (435efb7)
  • 🎸 export common wrappers (d977378)
  • 🎸 export type guards for common wrappers (d9f8b18)
  • 🎸 finish minimum requirements for the rPSTM module exampl (86c9394)
  • 🎸 Goerli PolymathRegistry address support (c78a87b)
  • 🎸 LTM backwards compatibility migration (2dcb065)
  • 🎸 MATM backwards compatibility migration (0ae4f2d)
  • 🎸 merge develop into advancedVoting (3aa3197)
  • 🎸 New versioned architecture wrappers GPM 3.0 and 3.1 (4e9c6e2)
  • 🎸 refine typeguards (7fa69d6)
  • 🎸 Sign ack methods for freezeIssuance & disableController (28d69e8)
  • 🎸 support multi-version STOs (4b2a88f)
  • 🎸 usd tiered sto with capability to support stablecoins (14ccf21)
  • 🎸 VRTM backwards compatibility migration (aecd2ac)
  • adding new 3.1.0 event args to types (2baa35b)

BREAKING CHANGES

  • 🧨 N
  • data arg must be hex string when required
  • N
  • New USDTieredSTO configure interface
  • N
  • N
  • N
  • N
  • N
  • Y
  • N
  • N

Closes: N

  • CappedSTO is now split into CappedSTO_3_0_0 and CappedSTO_3_1_0. Same for USDTieredSTO

Readme

Source

Build Status Coverage Status Gitter Telegram

Polymath logo

@polymathnetwork/contract-wrappers

Version 3.0.0 of the Polymath-Core Ethereum Smart Contracts

Smart TS wrappers for Polymath smart contracts.

Installation

Install

npm install @polymathnetwork/contract-wrappers --save

Import

import { PolymathAPI } from '@polymathnetwork/contract-wrappers';

If your project is in TypeScript, add the following to your tsconfig.json:

"compilerOptions": {
    "typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
}

Documentation

This project uses typedoc documentation style.

You can access these docs by cloning this repo and opening docs/index.html in the browser.

Contributing

We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.

Commits should follow the conventional commits standard. You can use yarn commit which will launch commitizen to help you format commit messages in the correct manner

A note on breaking changes

Anything that forcefully changes the way the client interacts with the package is considered a breaking change and should be described in the BREAKING CHANGE section of the corresponding commit. This includes (but is not limited to):

  • Renaming a public function/class/interface/type
  • Deleting a public function/class/interface/type
  • Changing a public function's argument list in a way that the user needs to rewrite existing calls to it
  • Changing a public function's return type

Whatever is written under BREAKING CHANGES is literally what will go into the changelog, so please be clear on the messages. For example, if I change the return type of a function called foo in class Bar, the BREAKING CHANGE section of my commit should say something like

change return type of the `Bar` class's `foo` function from `string` to `number`

Install dependencies

If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:

yarn config set workspaces-experimental true

Then install dependencies

yarn install

Build

To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:

yarn build

or continuously rebuild on change:

yarn watch

Clean

yarn clean

Lint

yarn lint

Testing

This project uses Jest to do unit testing on the contract wrappers.

yarn jest

Deployment

This package has automatic publishing and versioning via semantic-release and forceful use of conventional commits

Sandbox

We provide a sandbox dev server to manually play with the package in the browser

To boot it up:

yarn start

This will generate a git-ignored sandbox.ts file you can edit locally to start playing around with the code

Starting up- Code Examples

In order to setup the Polymath API included in these contract wrappers, you must first establish a blockchain provider.

Ethereum providers are important in both reading and writing from an Ethereum RPC Node.

The API must be provided with the network id you would like to use, or RPC Node. The provider may exist on a node, on the browser as an injected provider (like Metamask), or both.

In order to configure the provider use the following code samples to set up the Project. Follow one of the following examples to set this up in your sandbox, dapp or node server, dependent on the situation.

For cases (1) and (2) you will need to set up an Injected Web3 Provider (Metamask). An example of doing so is below. More info on new and legacy metamask providers here: Metamask Medium Post

async function getInjectedProviderIfExists(): Promise<Provider> {
  // New Metamask Version
  let injectedProviderIfExists = (window as any).ethereum;
  if (injectedProviderIfExists !== undefined) {
    if (injectedProviderIfExists.enable !== undefined) {
      try {
        await injectedProviderIfExists.enable();
      } catch (err) {
        // Error with Enabling Metamask
      }
    }
  } else {
    // Legacy Metamask Version
    const injectedWeb3IfExists = (window as any).web3;
    if (injectedWeb3IfExists !== undefined && injectedWeb3IfExists.currentProvider !== undefined) {
      injectedProviderIfExists = injectedWeb3IfExists.currentProvider;
    } else {
      // Error with legacy metamask
    }
  }
  return injectedProviderIfExists;
}

Setting up Polymath API for 4 different cases

(1) Using Injected Provider (Metamask) to read from the blockchain and publish transactions on the blockchain.

const injectedProviderIfExists = await getInjectedProviderIfExists();
// Setup API
const params: ApiConstructorParams = {
  provider: new MetamaskSubprovider(injectedProviderIfExists),
  polymathRegistryAddress: '<Deployed Polymath Registry Address>',
};
const polymathAPI = new PolymathAPI(params);

(2) Using a Redundant Provider on node to read from the blokchain and Injected Provider (Metamask) to publish transactions.

// Instantiate a provider engine
const providerEngine = new Web3ProviderEngine();

const injectedProviderIfExists = await getInjectedProviderIfExists();
providerEngine.addProvider(new MetamaskSubprovider(injectedProviderIfExists));

// Add Redundant Subprovider
providerEngine.addProvider(new RedundantSubprovider([new RPCSubprovider('<http://examplenoderpc:port>')]));
providerEngine.start();

// Setup API
const params: ApiConstructorParams = {
  provider: providerEngine,
  polymathRegistryAddress: '<Deployed Polymath Registry Address>',
};
const polymathAPI = new PolymathAPI(params);

(3) Using a Redundant Provider on a node to read from the blockchain and publish transactions on an unlocked blockchain node (No Private Key Required).

// Instantiate Provider Engine
const providerEngine = new Web3ProviderEngine();
providerEngine.addProvider(new RedundantSubprovider([new RPCSubprovider('<http://examplenoderpc:port>')]));
providerEngine.start();

// Setup API
const params: ApiConstructorParams = {
  provider: providerEngine,
  polymathRegistryAddress: '<Deployed Polymath Registry Address>',
};
const polymathAPI = new PolymathAPI(params);

(4) Using a PrivateKeyWalletSubProvider to sign transactions being published on a normal blockchain node, and using Redundant Provider to read from blockchain.

// Instantiate Provider Engine
const providerEngine = new Web3ProviderEngine();
providerEngine.addProvider(new PrivateKeyWalletSubprovider('<Private Key Here>'));
providerEngine.addProvider(new RedundantSubprovider([new RPCSubprovider('<http://examplenoderpc:port>')]));
providerEngine.start();

// Setup API
const params: ApiConstructorParams = {
  provider: providerEngine,
  polymathRegistryAddress: '<Deployed Polymath Registry Address>',
};
const polymathAPI = new PolymathAPI(params);

Module code examples

In the /examples directory there are several examples to help developers understand how to use the API within the sandbox.

These examples demonstrate the use of the project's PolymathAPI to get data and publish transactions with Polymath's smart contracts. Register a ticker, generate a new security token and then you can add a module.

When a security token has a module successfully attached, the examples demonstrate how one can work with sto creation, transfer restrictions, permissioning, and directly with the security token.

The sandbox code included in the examples demonstrates how to subscribe to events fired from the smart contracts. It also demonstrates how to better catch issues when they happen, during token transfers for instance.

Keywords

FAQs

Last updated on 18 Mar 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc