diff --git a/packages/kosu-contract-helpers/docs/README.md b/packages/kosu-contract-helpers/docs/README.md index a183e6b37..924cefa5d 100644 --- a/packages/kosu-contract-helpers/docs/README.md +++ b/packages/kosu-contract-helpers/docs/README.md @@ -1,4 +1,4 @@ -> **[kosu.js](README.md)** +> **[contract-helpers](README.md)** [Globals](globals.md) / diff --git a/packages/kosu-contract-helpers/docs/classes/eventemitter.md b/packages/kosu-contract-helpers/docs/classes/eventemitter.md index ed3ccc1e1..09e69eb1a 100644 --- a/packages/kosu-contract-helpers/docs/classes/eventemitter.md +++ b/packages/kosu-contract-helpers/docs/classes/eventemitter.md @@ -1,4 +1,4 @@ -> **[kosu.js](../README.md)** +> **[contract-helpers](../README.md)** [Globals](../globals.md) / [EventEmitter](eventemitter.md) / @@ -30,7 +30,7 @@ to subscribe to future events. \+ **new EventEmitter**(`options`: `KosuOptions`): _[EventEmitter](eventemitter.md)_ -_Defined in [EventEmitter.ts:49](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/EventEmitter.ts#L49)_ +_Defined in [EventEmitter.ts:49](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/EventEmitter.ts#L49)_ Create a new `EventEmitter` instance. @@ -48,7 +48,7 @@ Create a new `EventEmitter` instance. ▸ **getAddress**(): _`Promise`_ -_Defined in [EventEmitter.ts:65](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/EventEmitter.ts#L65)_ +_Defined in [EventEmitter.ts:65](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/EventEmitter.ts#L65)_ Return the address of the configured deployed contract. If not already cached, will return the deployed address for the detected network ID (if available). @@ -61,7 +61,7 @@ will return the deployed address for the detected network ID (if available). ▸ **getFutureDecodedLogs**(`start`: number, `callback`: function): _`Timeout`_ -_Defined in [EventEmitter.ts:111](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/EventEmitter.ts#L111)_ +_Defined in [EventEmitter.ts:111](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/EventEmitter.ts#L111)_ **`todo`** document better (and confirm) @@ -91,7 +91,7 @@ A callback function to be called on an array of each new event log. ▸ **getPastDecodedLogs**(`config`: `FilterObject`): _`Promise>>`_ -_Defined in [EventEmitter.ts:84](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/EventEmitter.ts#L84)_ +_Defined in [EventEmitter.ts:84](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/EventEmitter.ts#L84)_ Get all past decoded logs from the Kosu `EventEmitter` contract, with the oldest event at position 0. diff --git a/packages/kosu-contract-helpers/docs/classes/kosu.md b/packages/kosu-contract-helpers/docs/classes/kosu.md index 784bc6853..4ba1785f6 100644 --- a/packages/kosu-contract-helpers/docs/classes/kosu.md +++ b/packages/kosu-contract-helpers/docs/classes/kosu.md @@ -1,4 +1,4 @@ -> **[kosu.js](../README.md)** +> **[contract-helpers](../README.md)** [Globals](../globals.md) / [Kosu](kosu.md) / @@ -30,7 +30,6 @@ contracts. - [eventEmitter](kosu.md#eventemitter) - [kosuToken](kosu.md#kosutoken) -- [node](kosu.md#node) - [orderGateway](kosu.md#ordergateway) - [orderHelper](kosu.md#orderhelper) - [posterRegistry](kosu.md#posterregistry) @@ -48,7 +47,7 @@ contracts. \+ **new Kosu**(`options`: `KosuOptions`): _[Kosu](kosu.md)_ -_Defined in [Kosu.ts:132](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Kosu.ts#L132)_ +_Defined in [Kosu.ts:121](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Kosu.ts#L121)_ Create a new `kosu` instance and instantiate wrappers for each Kosu system contract. @@ -72,7 +71,7 @@ of transactions and generation of signatures will not be possible. • **eventEmitter**: _[EventEmitter](eventemitter.md)_ -_Defined in [Kosu.ts:119](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Kosu.ts#L119)_ +_Defined in [Kosu.ts:108](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Kosu.ts#L108)_ The `eventEmitter` enables the query of and subscription to decoded event logs from the Kosu `EventEmitter` contract. @@ -83,30 +82,17 @@ logs from the Kosu `EventEmitter` contract. • **kosuToken**: _[KosuToken](kosutoken.md)_ -_Defined in [Kosu.ts:84](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Kosu.ts#L84)_ +_Defined in [Kosu.ts:73](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Kosu.ts#L73)_ The `kosuToken` provides methods for interacting with the KOSU ERC-20 token. --- -### node - -• **node**: _[NodeClient](nodeclient.md)_ - -_Defined in [Kosu.ts:59](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Kosu.ts#L59)_ - -A JSONRPC client for a Kosu node, enabled if a `kosuNodeUrl` is provided -to the Kosu constructor (as part of the options object). - -Enables access to the `go-kosu` JSONRPC-API, including subscriptions. - ---- - ### orderGateway • **orderGateway**: _[OrderGateway](ordergateway.md)_ -_Defined in [Kosu.ts:71](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Kosu.ts#L71)_ +_Defined in [Kosu.ts:60](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Kosu.ts#L60)_ The `orderGateway` instance provides access to the `OrderGateway` contract which is used to direct settlement of orders to their corresponding @@ -121,7 +107,7 @@ type, based on a `SubContract` address. • **orderHelper**: _[OrderHelper](orderhelper.md)_ -_Defined in [Kosu.ts:79](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Kosu.ts#L79)_ +_Defined in [Kosu.ts:68](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Kosu.ts#L68)_ The `orderHelper` instance provides methods for generating and signing maker orders, signing orders for submission to the Kosu network, and @@ -134,7 +120,7 @@ submitting orders for settlement on the Ethereum blockchain via the • **posterRegistry**: _[PosterRegistry](posterregistry.md)_ -_Defined in [Kosu.ts:104](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Kosu.ts#L104)_ +_Defined in [Kosu.ts:93](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Kosu.ts#L93)_ The `posterRegistry` instance enables users to interact with the Kosu `PosterRegistry` contract to bond and un-bond KOSU tokens to access the @@ -146,7 +132,7 @@ order relay feature of the Kosu network. • **treasury**: _[Treasury](treasury.md)_ -_Defined in [Kosu.ts:90](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Kosu.ts#L90)_ +_Defined in [Kosu.ts:79](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Kosu.ts#L79)_ The `treasury` instance provides access to functionality of the Kosu `Treasury` contract, such as deposits/withdrawals and allowance management. @@ -157,7 +143,7 @@ The `treasury` instance provides access to functionality of the Kosu • **utils**: _`KosuUtils`_ -_Defined in [Kosu.ts:127](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Kosu.ts#L127)_ +_Defined in [Kosu.ts:116](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Kosu.ts#L116)_ Common and helpful utility methods and constants for interacting with the Kosu contract system and Ethereum blockchain. @@ -168,7 +154,7 @@ Kosu contract system and Ethereum blockchain. • **validatorRegistry**: _[ValidatorRegistry](validatorregistry.md)_ -_Defined in [Kosu.ts:113](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Kosu.ts#L113)_ +_Defined in [Kosu.ts:102](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Kosu.ts#L102)_ The `validatorRegistry` instance enables interaction with the `ValidatorRegistry` token-curated registry system. The system enables users to submit proposals @@ -182,7 +168,7 @@ It also provides query access to past challenges and the current listings. • **version**: _string_ -_Defined in [Kosu.ts:132](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Kosu.ts#L132)_ +_Defined in [Kosu.ts:121](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Kosu.ts#L121)_ The current `@kosu/kosu.js` package version. @@ -192,7 +178,7 @@ The current `@kosu/kosu.js` package version. • **voting**: _[Voting](voting.md)_ -_Defined in [Kosu.ts:97](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Kosu.ts#L97)_ +_Defined in [Kosu.ts:86](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Kosu.ts#L86)_ The `voting` instance provides access to the Kosu `voting` contract and allows users to participate in voting on governance measures, and claiming @@ -204,7 +190,7 @@ rewards for correctly participating in winning polls. • **web3**: _`Web3`_ -_Defined in [Kosu.ts:42](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Kosu.ts#L42)_ +_Defined in [Kosu.ts:41](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Kosu.ts#L41)_ The primary `web3` instance provides access to an Ethereum node's JSONRPC API and utilities. This instance is used to interact with each Kosu contract @@ -216,7 +202,7 @@ wrapper and can be used to directly access the `web3` API. • **web3Wrapper**: _`Web3Wrapper`_ -_Defined in [Kosu.ts:49](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Kosu.ts#L49)_ +_Defined in [Kosu.ts:48](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Kosu.ts#L48)_ The `web3Wrapper` is used for some extended features, and provides a higher-level API to the same underlying `web3` provider. It it used to diff --git a/packages/kosu-contract-helpers/docs/classes/kosutoken.md b/packages/kosu-contract-helpers/docs/classes/kosutoken.md index 01f6da03b..028f38299 100644 --- a/packages/kosu-contract-helpers/docs/classes/kosutoken.md +++ b/packages/kosu-contract-helpers/docs/classes/kosutoken.md @@ -1,4 +1,4 @@ -> **[kosu.js](../README.md)** +> **[contract-helpers](../README.md)** [Globals](../globals.md) / [KosuToken](kosutoken.md) / @@ -41,7 +41,7 @@ If instantiated outside the `Kosu` class, an instance of `web3` and of the \+ **new KosuToken**(`options`: `KosuOptions`): _[KosuToken](kosutoken.md)_ -_Defined in [KosuToken.ts:39](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/KosuToken.ts#L39)_ +_Defined in [KosuToken.ts:39](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/KosuToken.ts#L39)_ Creates a new KosuToken instance, supplied with an options object. @@ -69,7 +69,7 @@ const kosuToken = new KosuToken(options); ▸ **allowance**(`owner`: string, `spender`: string): _`Promise`_ -_Defined in [KosuToken.ts:153](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/KosuToken.ts#L153)_ +_Defined in [KosuToken.ts:153](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/KosuToken.ts#L153)_ Reads approved allowance for a given `owner` and `spender` account. @@ -90,7 +90,7 @@ The allowance granted to the `spender` in units of wei. ▸ **approve**(`spender`: string, `value`: `BigNumber`): _`Promise`_ -_Defined in [KosuToken.ts:141](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/KosuToken.ts#L141)_ +_Defined in [KosuToken.ts:141](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/KosuToken.ts#L141)_ Sets approval for user to transfer tokens on `coinbase`'s behalf. @@ -111,7 +111,7 @@ The transaction receipt after it has been included in a block. ▸ **balanceOf**(`owner`: string): _`Promise`_ -_Defined in [KosuToken.ts:104](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/KosuToken.ts#L104)_ +_Defined in [KosuToken.ts:104](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/KosuToken.ts#L104)_ Reads the balance for a user address, returned in wei. @@ -131,7 +131,7 @@ The `owner`'s KOSU balance in wei. ▸ **bondTokens**(`value`: `BigNumber`, `minPayout`: `BigNumber`): _`Promise`_ -_Defined in [KosuToken.ts:187](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/KosuToken.ts#L187)_ +_Defined in [KosuToken.ts:187](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/KosuToken.ts#L187)_ Sends ether to the contract to bond tokens. @@ -152,7 +152,7 @@ Logs from the transaction block. ▸ **estimateEtherToToken**(`etherInput`: `BigNumber`): _`Promise`_ -_Defined in [KosuToken.ts:164](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/KosuToken.ts#L164)_ +_Defined in [KosuToken.ts:164](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/KosuToken.ts#L164)_ Calculated tokens to be minted from deposited ether. @@ -172,7 +172,7 @@ Estimation of tokens to be minted. ▸ **estimateTokenToEther**(`tokensToBurn`: `BigNumber`): _`Promise`_ -_Defined in [KosuToken.ts:175](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/KosuToken.ts#L175)_ +_Defined in [KosuToken.ts:175](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/KosuToken.ts#L175)_ Calculates ether to be returned for burning tokens. @@ -192,7 +192,7 @@ Estimation of ether to be returned. ▸ **pay**(`value`: `BigNumber`): _`Promise`_ -_Defined in [KosuToken.ts:211](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/KosuToken.ts#L211)_ +_Defined in [KosuToken.ts:211](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/KosuToken.ts#L211)_ Sends ether to the contract to bond tokens. @@ -212,7 +212,7 @@ Logs from the transaction block. ▸ **releaseTokens**(`tokensToBurn`: `BigNumber`): _`Promise`_ -_Defined in [KosuToken.ts:200](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/KosuToken.ts#L200)_ +_Defined in [KosuToken.ts:200](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/KosuToken.ts#L200)_ Releases tokens to be burned and return bonded ether. @@ -232,7 +232,7 @@ Logs from the transaction block. ▸ **totalSupply**(): _`Promise`_ -_Defined in [KosuToken.ts:93](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/KosuToken.ts#L93)_ +_Defined in [KosuToken.ts:93](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/KosuToken.ts#L93)_ Reads the total supply of KOSU, resolves to a `BigNumber` of the amount of tokens in units of wei. @@ -247,7 +247,7 @@ The total KOSU supply in wei. ▸ **transfer**(`to`: string, `value`: `BigNumber`): _`Promise`_ -_Defined in [KosuToken.ts:116](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/KosuToken.ts#L116)_ +_Defined in [KosuToken.ts:116](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/KosuToken.ts#L116)_ Transfers tokens to an address, from the current `coinbase` account. @@ -268,7 +268,7 @@ The transaction's receipt after inclusion in a block. ▸ **transferFrom**(`from`: string, `to`: string, `value`: `BigNumber`): _`Promise`_ -_Defined in [KosuToken.ts:129](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/KosuToken.ts#L129)_ +_Defined in [KosuToken.ts:129](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/KosuToken.ts#L129)_ Transfers token from an address to a destination address. diff --git a/packages/kosu-contract-helpers/docs/classes/ordergateway.md b/packages/kosu-contract-helpers/docs/classes/ordergateway.md index d140e0abe..b34d1ca6e 100644 --- a/packages/kosu-contract-helpers/docs/classes/ordergateway.md +++ b/packages/kosu-contract-helpers/docs/classes/ordergateway.md @@ -1,4 +1,4 @@ -> **[kosu.js](../README.md)** +> **[contract-helpers](../README.md)** [Globals](../globals.md) / [OrderGateway](ordergateway.md) / @@ -38,7 +38,7 @@ specified SubContract during serialization and signature generation. \+ **new OrderGateway**(`options`: `KosuOptions`): _[OrderGateway](ordergateway.md)_ -_Defined in [OrderGateway.ts:48](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/OrderGateway.ts#L48)_ +_Defined in [OrderGateway.ts:48](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/OrderGateway.ts#L48)_ Create a new OrderGateway instance. @@ -56,7 +56,7 @@ Create a new OrderGateway instance. ▸ **amountRemaining**(`order`: `Order`): _`Promise`_ -_Defined in [OrderGateway.ts:152](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/OrderGateway.ts#L152)_ +_Defined in [OrderGateway.ts:152](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/OrderGateway.ts#L152)_ Checks amount of partial exchange tokens remaining, depending on the implementation of the SubContract specified in the supplied order. @@ -78,7 +78,7 @@ implementation of the `amountRemaining` method. ▸ **arguments**(`subContract`: string): _`Promise`_ -_Defined in [OrderGateway.ts:119](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/OrderGateway.ts#L119)_ +_Defined in [OrderGateway.ts:119](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/OrderGateway.ts#L119)_ Read the required arguments from a deployed SubContract. @@ -98,7 +98,7 @@ The JSON array that defines the arguments for the SubContract. ▸ **isValid**(`order`: `Order`): _`Promise`_ -_Defined in [OrderGateway.ts:136](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/OrderGateway.ts#L136)_ +_Defined in [OrderGateway.ts:136](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/OrderGateway.ts#L136)_ Checks validity of order data according the order's SubContract implementation. @@ -116,7 +116,7 @@ Checks validity of order data according the order's SubContract implementation. ▸ **participate**(`order`: `Order`, `taker`: string): _`Promise`_ -_Defined in [OrderGateway.ts:98](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/OrderGateway.ts#L98)_ +_Defined in [OrderGateway.ts:98](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/OrderGateway.ts#L98)_ Participate in a trade as a taker (or on behalf of one), by submitting the maker order, and the Ethereum address of the taker. The fill transaction diff --git a/packages/kosu-contract-helpers/docs/classes/orderhelper.md b/packages/kosu-contract-helpers/docs/classes/orderhelper.md index 5e14ffd04..5296ce525 100644 --- a/packages/kosu-contract-helpers/docs/classes/orderhelper.md +++ b/packages/kosu-contract-helpers/docs/classes/orderhelper.md @@ -1,4 +1,4 @@ -> **[kosu.js](../README.md)** +> **[contract-helpers](../README.md)** [Globals](../globals.md) / [OrderHelper](orderhelper.md) / @@ -37,7 +37,7 @@ of transactions. \+ **new OrderHelper**(`web3`: `Web3`, `orderGateway`: [OrderGateway](ordergateway.md)): _[OrderHelper](orderhelper.md)_ -_Defined in [OrderHelper.ts:25](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/OrderHelper.ts#L25)_ +_Defined in [OrderHelper.ts:25](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/OrderHelper.ts#L25)_ Create a new `OrderHelper` instance (requires a provider via supplied `web3` instance). @@ -57,7 +57,7 @@ instance). ▸ **makeOrder**(`order`: `Order`): _`Promise`_ -_Defined in [OrderHelper.ts:45](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/OrderHelper.ts#L45)_ +_Defined in [OrderHelper.ts:45](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/OrderHelper.ts#L45)_ Sign and complete a maker order (requires a pre-configured Order object). @@ -77,7 +77,7 @@ The supplied maker order with an appended `makerSignature`. ▸ **makerHex**(`order`: `Order`): _`Promise`_ -_Defined in [OrderHelper.ts:105](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/OrderHelper.ts#L105)_ +_Defined in [OrderHelper.ts:105](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/OrderHelper.ts#L105)_ Generate the maker hex (serialized `makerValues`). @@ -95,7 +95,7 @@ Generate the maker hex (serialized `makerValues`). ▸ **prepareForPost**(`order`: `Order`, `poster`: string): _`Promise`_ -_Defined in [OrderHelper.ts:77](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/OrderHelper.ts#L77)_ +_Defined in [OrderHelper.ts:77](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/OrderHelper.ts#L77)_ Sign and order as a poster and append the poster signature to an order prior to submission to the Kosu relay network. @@ -117,7 +117,7 @@ The maker order now signed and prepared for post with an appended `posterSignatu ▸ **recoverMaker**(`order`: `Order`): _`Promise`_ -_Defined in [OrderHelper.ts:115](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/OrderHelper.ts#L115)_ +_Defined in [OrderHelper.ts:115](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/OrderHelper.ts#L115)_ Recover the maker address from a signed order. @@ -135,7 +135,7 @@ Recover the maker address from a signed order. ▸ **recoverPoster**(`order`: `PostableOrder`): _`Promise`_ -_Defined in [OrderHelper.ts:126](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/OrderHelper.ts#L126)_ +_Defined in [OrderHelper.ts:126](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/OrderHelper.ts#L126)_ Recover the poster address from a maker order that has been signed from a poster. @@ -154,7 +154,7 @@ poster. ▸ **serialize**(`order`: `Order`): _`Promise`_ -_Defined in [OrderHelper.ts:136](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/OrderHelper.ts#L136)_ +_Defined in [OrderHelper.ts:136](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/OrderHelper.ts#L136)_ Generates the contract submission bytes from the arguments of provided order. @@ -172,7 +172,7 @@ Generates the contract submission bytes from the arguments of provided order. ▸ **takeOrder**(`order`: `TakeableOrder`, `taker`: string): _`Promise`_ -_Defined in [OrderHelper.ts:65](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/OrderHelper.ts#L65)_ +_Defined in [OrderHelper.ts:65](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/OrderHelper.ts#L65)_ Take a signed maker order on the Ethereum blockchain via the order's specified SubContract, from the supplied taker address (should be available diff --git a/packages/kosu-contract-helpers/docs/classes/posterregistry.md b/packages/kosu-contract-helpers/docs/classes/posterregistry.md index b8658c2d8..fbdccd585 100644 --- a/packages/kosu-contract-helpers/docs/classes/posterregistry.md +++ b/packages/kosu-contract-helpers/docs/classes/posterregistry.md @@ -1,4 +1,4 @@ -> **[kosu.js](../README.md)** +> **[contract-helpers](../README.md)** [Globals](../globals.md) / [PosterRegistry](posterregistry.md) / @@ -34,7 +34,7 @@ and to view their balance, as well as the cumulative lockup. \+ **new PosterRegistry**(`options`: `KosuOptions`, `treasury`: [Treasury](treasury.md)): _[PosterRegistry](posterregistry.md)_ -_Defined in [PosterRegistry.ts:43](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/PosterRegistry.ts#L43)_ +_Defined in [PosterRegistry.ts:43](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/PosterRegistry.ts#L43)_ Create a new PosterRegistry instance. @@ -53,7 +53,7 @@ Create a new PosterRegistry instance. ▸ **pay**(`value`: `BigNumber`): _`Promise`_ -_Defined in [PosterRegistry.ts:151](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/PosterRegistry.ts#L151)_ +_Defined in [PosterRegistry.ts:151](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/PosterRegistry.ts#L151)_ Sends ether to the contract to bond and register tokens for posting. @@ -73,7 +73,7 @@ Logs from the transaction block. ▸ **registerTokens**(`amount`: `BigNumber`): _`Promise`_ -_Defined in [PosterRegistry.ts:109](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/PosterRegistry.ts#L109)_ +_Defined in [PosterRegistry.ts:109](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/PosterRegistry.ts#L109)_ Register tokens into the PosterRegistry contract by bonding KOSU tokens. @@ -93,7 +93,7 @@ A transaction receipt from the mined `register` transaction. ▸ **releaseTokens**(`amount`: `BigNumber`): _`Promise`_ -_Defined in [PosterRegistry.ts:140](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/PosterRegistry.ts#L140)_ +_Defined in [PosterRegistry.ts:140](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/PosterRegistry.ts#L140)_ Release tokens from the PosterRegistry for the `coinbase` address (un-bond). @@ -113,7 +113,7 @@ A transaction receipt from the mined `register` transaction. ▸ **tokensContributed**(): _`Promise`_ -_Defined in [PosterRegistry.ts:87](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/PosterRegistry.ts#L87)_ +_Defined in [PosterRegistry.ts:87](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/PosterRegistry.ts#L87)_ Reads total KOSU tokens contributed to registry. @@ -127,7 +127,7 @@ The total pool of locked KOSU tokens in units of wei. ▸ **tokensRegisteredFor**(`address`: string): _`Promise`_ -_Defined in [PosterRegistry.ts:98](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/PosterRegistry.ts#L98)_ +_Defined in [PosterRegistry.ts:98](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/PosterRegistry.ts#L98)_ Reads number of tokens registered for a given address. diff --git a/packages/kosu-contract-helpers/docs/classes/treasury.md b/packages/kosu-contract-helpers/docs/classes/treasury.md index c15fb6bba..b94de3c1d 100644 --- a/packages/kosu-contract-helpers/docs/classes/treasury.md +++ b/packages/kosu-contract-helpers/docs/classes/treasury.md @@ -1,4 +1,4 @@ -> **[kosu.js](../README.md)** +> **[contract-helpers](../README.md)** [Globals](../globals.md) / [Treasury](treasury.md) / @@ -43,7 +43,7 @@ constructor must include the Treasury's ABI (from the compiled Solidity source). \+ **new Treasury**(`options`: `KosuOptions`, `kosuToken`: [KosuToken](kosutoken.md)): _[Treasury](treasury.md)_ -_Defined in [Treasury.ts:51](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Treasury.ts#L51)_ +_Defined in [Treasury.ts:51](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Treasury.ts#L51)_ Creates a new Treasury instance. @@ -62,7 +62,7 @@ Creates a new Treasury instance. • **kosuToken**: _[KosuToken](kosutoken.md)_ -_Defined in [Treasury.ts:35](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Treasury.ts#L35)_ +_Defined in [Treasury.ts:35](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Treasury.ts#L35)_ An instance of the `KosuToken` class to communicate with the KOSU ERC-20 token. @@ -72,7 +72,7 @@ An instance of the `KosuToken` class to communicate with the KOSU ERC-20 token. ▸ **approveTreasury**(`value`: `BigNumber`): _`Promise`_ -_Defined in [Treasury.ts:212](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Treasury.ts#L212)_ +_Defined in [Treasury.ts:212](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Treasury.ts#L212)_ Approve the treasury to transfer KOSU on behalf of the user's `coinbase` account. @@ -102,7 +102,7 @@ The decoded transaction receipt, after the TX has been mined. ▸ **currentBalance**(`address`: string): _`Promise`_ -_Defined in [Treasury.ts:174](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Treasury.ts#L174)_ +_Defined in [Treasury.ts:174](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Treasury.ts#L174)_ Read the available (current) treasury balance for a provided `address`. @@ -134,7 +134,7 @@ The user's current treasury balance (in wei). ▸ **deposit**(`value`: `BigNumber`): _`Promise`_ -_Defined in [Treasury.ts:101](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Treasury.ts#L101)_ +_Defined in [Treasury.ts:101](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Treasury.ts#L101)_ Deposit tokens in the treasury, from the detected `coinbase` account. @@ -163,7 +163,7 @@ The decoded transaction receipt, after the TX has been included in a block. ▸ **pay**(`value`: `BigNumber`): _`Promise`_ -_Defined in [Treasury.ts:223](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Treasury.ts#L223)_ +_Defined in [Treasury.ts:223](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Treasury.ts#L223)_ Sends ether to the contract to bond and deposit tokens. @@ -183,7 +183,7 @@ Logs from the transaction block. ▸ **systemBalance**(`address`: string): _`Promise`_ -_Defined in [Treasury.ts:153](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Treasury.ts#L153)_ +_Defined in [Treasury.ts:153](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Treasury.ts#L153)_ Read the total system balance of KOSU for a provided `address` string. @@ -215,7 +215,7 @@ The user's total KOSU system balance, in wei. ▸ **treasuryAllowance**(): _`Promise`_ -_Defined in [Treasury.ts:193](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Treasury.ts#L193)_ +_Defined in [Treasury.ts:193](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Treasury.ts#L193)_ View the current treasury allowance for the detected `coinbase` account. @@ -240,7 +240,7 @@ The current KOSU approval for the Treasury for the current user, in wei. ▸ **withdraw**(`value`: `BigNumber`): _`Promise`_ -_Defined in [Treasury.ts:132](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Treasury.ts#L132)_ +_Defined in [Treasury.ts:132](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Treasury.ts#L132)_ Withdraw tokens from treasury to the detected `coinbase` account. diff --git a/packages/kosu-contract-helpers/docs/classes/validatorregistry.md b/packages/kosu-contract-helpers/docs/classes/validatorregistry.md index 8e987107d..c4d87670b 100644 --- a/packages/kosu-contract-helpers/docs/classes/validatorregistry.md +++ b/packages/kosu-contract-helpers/docs/classes/validatorregistry.md @@ -1,4 +1,4 @@ -> **[kosu.js](../README.md)** +> **[contract-helpers](../README.md)** [Globals](../globals.md) / [ValidatorRegistry](validatorregistry.md) / @@ -52,7 +52,7 @@ Integration with ValidatorRegistry contract on an Ethereum blockchain. \+ **new ValidatorRegistry**(`options`: `KosuOptions`, `treasury`: [Treasury](treasury.md)): _[ValidatorRegistry](validatorregistry.md)_ -_Defined in [ValidatorRegistry.ts:20](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L20)_ +_Defined in [ValidatorRegistry.ts:20](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L20)_ Create a new ValidatorRegistry instance. @@ -71,7 +71,7 @@ Create a new ValidatorRegistry instance. ▸ **applicationPeriod**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:66](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L66)_ +_Defined in [ValidatorRegistry.ts:66](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L66)_ Reads the application period @@ -83,7 +83,7 @@ Reads the application period ▸ **challengeListing**(`_pubKey`: string, `_details`: string): _`Promise`_ -_Defined in [ValidatorRegistry.ts:258](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L258)_ +_Defined in [ValidatorRegistry.ts:258](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L258)_ Starts a challenge of a listing @@ -102,7 +102,7 @@ Starts a challenge of a listing ▸ **challengePeriod**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:82](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L82)_ +_Defined in [ValidatorRegistry.ts:82](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L82)_ Reads the challenge period @@ -114,7 +114,7 @@ Reads the challenge period ▸ **claimRewards**(`_pubKey`: string): _`Promise`_ -_Defined in [ValidatorRegistry.ts:287](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L287)_ +_Defined in [ValidatorRegistry.ts:287](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L287)_ Claims the rewards of a generating/burning listing @@ -132,7 +132,7 @@ Claims the rewards of a generating/burning listing ▸ **claimWinnings**(`challengeId`: `BigNumber`): _`Promise`_ -_Defined in [ValidatorRegistry.ts:317](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L317)_ +_Defined in [ValidatorRegistry.ts:317](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L317)_ Claims winnings from complete challenge @@ -150,7 +150,7 @@ Claims winnings from complete challenge ▸ **commitPeriod**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:74](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L74)_ +_Defined in [ValidatorRegistry.ts:74](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L74)_ Reads the commit period @@ -162,7 +162,7 @@ Reads the commit period ▸ **confirmListing**(`_pubKey`: string): _`Promise`_ -_Defined in [ValidatorRegistry.ts:247](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L247)_ +_Defined in [ValidatorRegistry.ts:247](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L247)_ Confirms listing after application period @@ -180,7 +180,7 @@ Confirms listing after application period ▸ **convertPubKey**(`_pubKey`: string): _string_ -_Defined in [ValidatorRegistry.ts:328](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L328)_ +_Defined in [ValidatorRegistry.ts:328](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L328)_ Converts public key to hex if input is not currently in hex @@ -200,7 +200,7 @@ hex encoded tendermint public key ▸ **exitPeriod**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:90](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L90)_ +_Defined in [ValidatorRegistry.ts:90](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L90)_ Reads the exit period @@ -212,7 +212,7 @@ Reads the exit period ▸ **finalizeExit**(`_pubKey`: string): _`Promise`_ -_Defined in [ValidatorRegistry.ts:307](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L307)_ +_Defined in [ValidatorRegistry.ts:307](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L307)_ Finalizes the exit of a listing @@ -230,7 +230,7 @@ Finalizes the exit of a listing ▸ **getAllChallenges**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:201](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L201)_ +_Defined in [ValidatorRegistry.ts:201](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L201)_ Reads all challenges @@ -242,7 +242,7 @@ Reads all challenges ▸ **getAllListings**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:164](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L164)_ +_Defined in [ValidatorRegistry.ts:164](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L164)_ Reads the registered listings @@ -254,7 +254,7 @@ Reads the registered listings ▸ **getChallenge**(`challengeId`: `BigNumber`): _`Promise`_ -_Defined in [ValidatorRegistry.ts:182](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L182)_ +_Defined in [ValidatorRegistry.ts:182](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L182)_ Reads the challenge by challengeId @@ -272,7 +272,7 @@ Reads the challenge by challengeId ▸ **getChallenges**(`challengeIds`: `BigNumber`[]): _`Promise`_ -_Defined in [ValidatorRegistry.ts:192](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L192)_ +_Defined in [ValidatorRegistry.ts:192](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L192)_ Reads the challenges by challengeIds @@ -290,7 +290,7 @@ Reads the challenges by challengeIds ▸ **getListing**(`_pubKey`: string): _`Promise`_ -_Defined in [ValidatorRegistry.ts:148](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L148)_ +_Defined in [ValidatorRegistry.ts:148](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L148)_ Reads the listing for public key @@ -308,7 +308,7 @@ Reads the listing for public key ▸ **getListings**(`_pubKeys`: string[]): _`Promise`_ -_Defined in [ValidatorRegistry.ts:156](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L156)_ +_Defined in [ValidatorRegistry.ts:156](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L156)_ Reads the requested listings @@ -326,7 +326,7 @@ Reads the requested listings ▸ **hexToBase64**(`_pubKey`: string): _string_ -_Defined in [ValidatorRegistry.ts:352](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L352)_ +_Defined in [ValidatorRegistry.ts:352](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L352)_ Converts hex encoded public key back to tendermint base64 @@ -346,7 +346,7 @@ Base64 tendermint public key ▸ **initExit**(`_pubKey`: string): _`Promise`_ -_Defined in [ValidatorRegistry.ts:297](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L297)_ +_Defined in [ValidatorRegistry.ts:297](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L297)_ Initializes an exit of a listing from the registry @@ -364,7 +364,7 @@ Initializes an exit of a listing from the registry ▸ **kosuToken**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:130](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L130)_ +_Defined in [ValidatorRegistry.ts:130](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L130)_ Reads the kosuToken address @@ -376,7 +376,7 @@ Reads the kosuToken address ▸ **listingKeys**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:138](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L138)_ +_Defined in [ValidatorRegistry.ts:138](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L138)_ Reads the current listing keys @@ -388,7 +388,7 @@ Reads the current listing keys ▸ **maxRewardRate**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:172](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L172)_ +_Defined in [ValidatorRegistry.ts:172](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L172)_ Reads the max reward rate @@ -400,7 +400,7 @@ Reads the max reward rate ▸ **minimumBalance**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:106](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L106)_ +_Defined in [ValidatorRegistry.ts:106](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L106)_ Reads the minimum balance @@ -412,7 +412,7 @@ Reads the minimum balance ▸ **registerListing**(`_pubKey`: string, `_tokensToStake`: `BigNumber`, `_rewardRate`: `BigNumber`, `_details`: string): _`Promise`_ -_Defined in [ValidatorRegistry.ts:214](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L214)_ +_Defined in [ValidatorRegistry.ts:214](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L214)_ Register a new listing @@ -433,7 +433,7 @@ Register a new listing ▸ **resolveChallenge**(`_pubKey`: string): _`Promise`_ -_Defined in [ValidatorRegistry.ts:277](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L277)_ +_Defined in [ValidatorRegistry.ts:277](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L277)_ Resolves challenge of a listing @@ -451,7 +451,7 @@ Resolves challenge of a listing ▸ **rewardPeriod**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:98](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L98)_ +_Defined in [ValidatorRegistry.ts:98](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L98)_ Reads the reward period @@ -463,7 +463,7 @@ Reads the reward period ▸ **stakeholderCut**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:114](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L114)_ +_Defined in [ValidatorRegistry.ts:114](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L114)_ Reads the stakeholder cut @@ -475,7 +475,7 @@ Reads the stakeholder cut ▸ **voting**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:122](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L122)_ +_Defined in [ValidatorRegistry.ts:122](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/ValidatorRegistry.ts#L122)_ Reads the Voting contract address diff --git a/packages/kosu-contract-helpers/docs/classes/voting.md b/packages/kosu-contract-helpers/docs/classes/voting.md index 6a69d7312..8fc6b17cd 100644 --- a/packages/kosu-contract-helpers/docs/classes/voting.md +++ b/packages/kosu-contract-helpers/docs/classes/voting.md @@ -1,4 +1,4 @@ -> **[kosu.js](../README.md)** +> **[contract-helpers](../README.md)** [Globals](../globals.md) / [Voting](voting.md) / @@ -32,7 +32,7 @@ Integration with Voting contract on an Ethereum blockchain. \+ **new Voting**(`options`: `KosuOptions`, `treasury`: [Treasury](treasury.md)): _[Voting](voting.md)_ -_Defined in [Voting.ts:20](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Voting.ts#L20)_ +_Defined in [Voting.ts:20](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Voting.ts#L20)_ Create a new Voting instance. @@ -51,7 +51,7 @@ Create a new Voting instance. ▸ **commitVote**(`_pollId`: `BigNumber`, `_vote`: string, `_tokensToCommit`: `BigNumber`): _`Promise`_ -_Defined in [Voting.ts:69](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Voting.ts#L69)_ +_Defined in [Voting.ts:69](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Voting.ts#L69)_ Commits vote to voting contract @@ -71,7 +71,7 @@ Commits vote to voting contract ▸ **encodeVote**(`_voteOption`: string, `_voteSalt`: string): _string_ -_Defined in [Voting.ts:167](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Voting.ts#L167)_ +_Defined in [Voting.ts:167](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Voting.ts#L167)_ Encodes a vote by hashing the option and salt @@ -92,7 +92,7 @@ Encoded vote ▸ **revealVote**(`_pollId`: `BigNumber`, `_voteOption`: `BigNumber`, `_voteSalt`: `BigNumber`): _`Promise`_ -_Defined in [Voting.ts:98](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Voting.ts#L98)_ +_Defined in [Voting.ts:98](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Voting.ts#L98)_ Reveals vote on voting contract @@ -112,7 +112,7 @@ Reveals vote on voting contract ▸ **totalRevealedTokens**(`_pollId`: `BigNumber`): _`Promise`_ -_Defined in [Voting.ts:136](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Voting.ts#L136)_ +_Defined in [Voting.ts:136](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Voting.ts#L136)_ Reads the total winning tokens for poll @@ -130,7 +130,7 @@ Reads the total winning tokens for poll ▸ **totalWinningTokens**(`_pollId`: `BigNumber`): _`Promise`_ -_Defined in [Voting.ts:126](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Voting.ts#L126)_ +_Defined in [Voting.ts:126](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Voting.ts#L126)_ Reads the total winning tokens for poll @@ -148,7 +148,7 @@ Reads the total winning tokens for poll ▸ **userWinningTokens**(`_pollId`: `BigNumber`, `_userAddress`: string): _`Promise`_ -_Defined in [Voting.ts:147](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Voting.ts#L147)_ +_Defined in [Voting.ts:147](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Voting.ts#L147)_ Reads users winning tokens committed for poll @@ -167,7 +167,7 @@ Reads users winning tokens committed for poll ▸ **winningOption**(`_pollId`: `BigNumber`): _`Promise`_ -_Defined in [Voting.ts:116](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Voting.ts#L116)_ +_Defined in [Voting.ts:116](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Voting.ts#L116)_ Reads the winning option for poll diff --git a/packages/kosu-contract-helpers/docs/globals.md b/packages/kosu-contract-helpers/docs/globals.md index d6e6a8adf..f2f7d012e 100644 --- a/packages/kosu-contract-helpers/docs/globals.md +++ b/packages/kosu-contract-helpers/docs/globals.md @@ -1,8 +1,8 @@ -> **[kosu.js](README.md)** +> **[contract-helpers](README.md)** [Globals](globals.md) / -# kosu.js +# contract-helpers ## Index @@ -11,7 +11,6 @@ - [EventEmitter](classes/eventemitter.md) - [Kosu](classes/kosu.md) - [KosuToken](classes/kosutoken.md) -- [NodeClient](classes/nodeclient.md) - [OrderGateway](classes/ordergateway.md) - [OrderHelper](classes/orderhelper.md) - [PosterRegistry](classes/posterregistry.md) @@ -39,7 +38,7 @@ • **version**: _any_ = process.env.npm_package_version || require("../package.json").version -_Defined in [Kosu.ts:19](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Kosu.ts#L19)_ +_Defined in [Kosu.ts:18](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Kosu.ts#L18)_ ## Functions @@ -47,7 +46,7 @@ _Defined in [Kosu.ts:19](https://github.com/ParadigmFoundation/kosu-monorepo/blo ▸ **\_serialize**(`_arguments`: any, `values`: any): _string_ -_Defined in [OrderSerializer.ts:9](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/OrderSerializer.ts#L9)_ +_Defined in [OrderSerializer.ts:9](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/OrderSerializer.ts#L9)_ **Parameters:** @@ -64,11 +63,11 @@ _Defined in [OrderSerializer.ts:9](https://github.com/ParadigmFoundation/kosu-mo ### ▪ **KosuEndpoints**: _object_ -_Defined in [EventEmitter.ts:9](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/EventEmitter.ts#L9)_ +_Defined in [EventEmitter.ts:9](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/EventEmitter.ts#L9)_ ▪ **1**: _object_ -_Defined in [EventEmitter.ts:10](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/EventEmitter.ts#L10)_ +_Defined in [EventEmitter.ts:10](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/EventEmitter.ts#L10)_ - **http**: _string_ = `https://ethnet.zaidan.io/mainnet` @@ -76,7 +75,7 @@ _Defined in [EventEmitter.ts:10](https://github.com/ParadigmFoundation/kosu-mono ▪ **3**: _object_ -_Defined in [EventEmitter.ts:14](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/EventEmitter.ts#L14)_ +_Defined in [EventEmitter.ts:14](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/EventEmitter.ts#L14)_ - **http**: _string_ = `https://ethnet.zaidan.io/ropsten` @@ -84,7 +83,7 @@ _Defined in [EventEmitter.ts:14](https://github.com/ParadigmFoundation/kosu-mono ▪ **42**: _object_ -_Defined in [EventEmitter.ts:18](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/EventEmitter.ts#L18)_ +_Defined in [EventEmitter.ts:18](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/EventEmitter.ts#L18)_ - **http**: _string_ = `https://ethnet.zaidan.io/kovan` @@ -92,7 +91,7 @@ _Defined in [EventEmitter.ts:18](https://github.com/ParadigmFoundation/kosu-mono ▪ **6174**: _object_ -_Defined in [EventEmitter.ts:22](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/EventEmitter.ts#L22)_ +_Defined in [EventEmitter.ts:22](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/EventEmitter.ts#L22)_ - **http**: _string_ = `https://ethnet.zaidan.io/kosu` @@ -104,7 +103,7 @@ _Defined in [EventEmitter.ts:22](https://github.com/ParadigmFoundation/kosu-mono ### ▪ **OrderSerializer**: _object_ -_Defined in [OrderSerializer.ts:52](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/OrderSerializer.ts#L52)_ +_Defined in [OrderSerializer.ts:52](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/OrderSerializer.ts#L52)_ could add to utils (or create order-utils pacakge) @@ -112,7 +111,7 @@ could add to utils (or create order-utils pacakge) ▸ **makerHex**(`order`: `Order`, `_arguments`: any): _string_ -_Defined in [OrderSerializer.ts:98](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/OrderSerializer.ts#L98)_ +_Defined in [OrderSerializer.ts:98](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/OrderSerializer.ts#L98)_ Generate the maker hex from order @@ -129,7 +128,7 @@ Generate the maker hex from order ▸ **posterSignatureHex**(`order`: `Order`, `_arguments`: any): _string_ -_Defined in [OrderSerializer.ts:74](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/OrderSerializer.ts#L74)_ +_Defined in [OrderSerializer.ts:74](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/OrderSerializer.ts#L74)_ Generates hex to be used for the poster signing process @@ -146,7 +145,7 @@ Generates hex to be used for the poster signing process ▸ **recoverMaker**(`order`: `Order`, `_arguments`: any[]): _string_ -_Defined in [OrderSerializer.ts:126](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/OrderSerializer.ts#L126)_ +_Defined in [OrderSerializer.ts:126](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/OrderSerializer.ts#L126)_ Recovers the maker from the signed information @@ -163,7 +162,7 @@ Recovers the maker from the signed information ▸ **recoverPoster**(`order`: `PostableOrder`, `_arguments`: any[]): _string_ -_Defined in [OrderSerializer.ts:88](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/OrderSerializer.ts#L88)_ +_Defined in [OrderSerializer.ts:88](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/OrderSerializer.ts#L88)_ Recovers the poster from the poster signature @@ -180,7 +179,7 @@ Recovers the poster from the poster signature ▸ **serialize**(`_arguments`: any, `order`: `Order`): _string_ -_Defined in [OrderSerializer.ts:59](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/OrderSerializer.ts#L59)_ +_Defined in [OrderSerializer.ts:59](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/OrderSerializer.ts#L59)_ Serializes the data into bytes @@ -199,13 +198,13 @@ Serializes the data into bytes ### ▪ **Signature**: _object_ -_Defined in [Signature.ts:6](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Signature.ts#L6)_ +_Defined in [Signature.ts:6](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Signature.ts#L6)_ ### generate ▸ **generate**(`web3`: `Web3`, `messageHex`: string, `signer`: string): _`Promise`_ -_Defined in [Signature.ts:15](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Signature.ts#L15)_ +_Defined in [Signature.ts:15](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Signature.ts#L15)_ Generates a signature for a message hex using calls to a provider though web3 @@ -225,7 +224,7 @@ A vrs signature ▸ **recoverAddress**(`messageHex`: any, `signature`: string): _string_ -_Defined in [Signature.ts:37](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Signature.ts#L37)_ +_Defined in [Signature.ts:37](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Signature.ts#L37)_ Recovers address from a message hex and signature @@ -242,7 +241,7 @@ Recovers address from a message hex and signature ▸ **sign**(`web3`: `Web3`, `messageHex`: string, `signer`: string): _`Promise`_ -_Defined in [Signature.ts:55](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Signature.ts#L55)_ +_Defined in [Signature.ts:55](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Signature.ts#L55)_ Sign hex with provided address @@ -260,7 +259,7 @@ Sign hex with provided address ▸ **validate**(`messageHex`: string, `signature`: string, `signer`: string): _boolean_ -_Defined in [Signature.ts:27](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/Signature.ts#L27)_ +_Defined in [Signature.ts:27](https://github.com/ParadigmFoundation/kosu-monorepo/blob/515d6d59/packages/kosu-contract-helpers/src/Signature.ts#L27)_ Validates the signature of a messageHex is from the provided signer diff --git a/packages/kosu-contract-helpers/package.json b/packages/kosu-contract-helpers/package.json index c23c56aa3..b6695556f 100644 --- a/packages/kosu-contract-helpers/package.json +++ b/packages/kosu-contract-helpers/package.json @@ -8,8 +8,6 @@ "test": "mocha", "coverage": "nyc mocha && istanbul report html && open coverage/lcov-report/index.html", "test:ci": "ts-mocha -p tsconfig.json test/ --timeout 20000 -- geth", - "test:ganache": "docker run --rm -p 8545:8545 ${npm_package_config_ganache_image_uri}", - "test:ganache_detached": "docker run --rm -d -p 8545:8545 ${npm_package_config_ganache_image_uri}", "build": "tsc", "clean": "shx rm -rf dist/", "lint": "tslint -p .", diff --git a/packages/kosu-contract-helpers/src/Kosu.ts b/packages/kosu-contract-helpers/src/Kosu.ts index 6f0d1711f..f9417a21b 100644 --- a/packages/kosu-contract-helpers/src/Kosu.ts +++ b/packages/kosu-contract-helpers/src/Kosu.ts @@ -6,7 +6,6 @@ import Web3 from "web3"; import { EventEmitter } from "./EventEmitter"; import { KosuToken } from "./KosuToken"; -import { NodeClient } from "./NodeClient"; import { OrderGateway } from "./OrderGateway"; import { OrderHelper } from "./OrderHelper"; import { PosterRegistry } from "./PosterRegistry"; @@ -48,16 +47,6 @@ export class Kosu { */ public readonly web3Wrapper: Web3Wrapper; - // KOSU NODE CLIENT - - /** - * A JSONRPC client for a Kosu node, enabled if a `kosuNodeUrl` is provided - * to the Kosu constructor (as part of the options object). - * - * Enables access to the `go-kosu` JSONRPC-API, including subscriptions. - */ - public readonly node: NodeClient; - // KOSU CONTRACTS /** @@ -164,11 +153,6 @@ export class Kosu { this.orderHelper = new OrderHelper(this.web3, this.orderGateway); this.eventEmitter = new EventEmitter(options); - // Setup Kosu node JSONRPC client if url is provided - if (options.kosuNodeUrl) { - this.node = new NodeClient(options.kosuNodeUrl); - } - // Utilities this.utils = { toBytes32, NULL_ADDRESS }; this.version = version; diff --git a/packages/kosu-contract-helpers/src/index.ts b/packages/kosu-contract-helpers/src/index.ts index 242be84e3..0ade95095 100644 --- a/packages/kosu-contract-helpers/src/index.ts +++ b/packages/kosu-contract-helpers/src/index.ts @@ -10,4 +10,3 @@ export { Treasury } from "./Treasury"; export { ValidatorRegistry } from "./ValidatorRegistry"; export { Voting } from "./Voting"; export { OrderSerializer } from "./OrderSerializer"; -export { NodeClient } from "./NodeClient"; diff --git a/packages/kosu-contract-helpers/typedoc.json b/packages/kosu-contract-helpers/typedoc.json index c94033e7f..601977325 100644 --- a/packages/kosu-contract-helpers/typedoc.json +++ b/packages/kosu-contract-helpers/typedoc.json @@ -1,5 +1,5 @@ { - "name": "kosu.js", + "name": "contract-helpers", "mode": "file", "readme": "./README.md", "theme": "markdown", diff --git a/packages/kosu-node-client/.gitignore b/packages/kosu-node-client/.gitignore new file mode 100644 index 000000000..53c37a166 --- /dev/null +++ b/packages/kosu-node-client/.gitignore @@ -0,0 +1 @@ +dist \ No newline at end of file diff --git a/packages/kosu-node-client/README.md b/packages/kosu-node-client/README.md new file mode 100644 index 000000000..5b2156442 --- /dev/null +++ b/packages/kosu-node-client/README.md @@ -0,0 +1,68 @@ +# Node Client + +A TypeScript/JavaScript library for interacting with the Kosu order relay network. + +**View [the documentation here.](https://github.com/ParadigmFoundation/kosu-monorepo/blob/master/packages/node-client/docs/)** + +## Installation + +The Node Client can be installed into your project through `yarn` or `npm`, and can be passed through `webpack` or `browserify` for usage in the browser. + +### Install + +**Yarn:** + +``` +yarn add @kosu/node-client +``` + +**NPM:** + +``` +npm install --save @kosu/node-client +``` + +### Import + +Kosu and its exported classes can be imported directly into TypeScript or JavaScript projects. + +**TypeScript (and ES6+):** + +```typescript +// top-level Kosu class +import { NodeClient } from "@kosu/node-client"; +``` + +**JavaScript (CommonJS):** + +```javascript +const { NodeClient } = require("@kosu/node-client"); +``` + +## Development + +``` +@todo: add contribution guidelines summary and link +``` + +### Linting + +The TypeScript source can be linted with: + +``` +yarn lint +``` + +### Building + +Build the TypeScript source to distributable JavaScript (CommonJS) as well as source mappings and typing files with: + +``` +yarn build +``` + +## License + +Open-source software, [MIT licensed.](https://github.com/ParadigmFoundation/kosu-monorepo/blob/master/LICENSE) + +Copyright (c) 2019 Paradigm Labs, corp. diff --git a/packages/kosu-node-client/docs/README.md b/packages/kosu-node-client/docs/README.md new file mode 100644 index 000000000..242b10b6f --- /dev/null +++ b/packages/kosu-node-client/docs/README.md @@ -0,0 +1,72 @@ +> **[node-client](README.md)** + +[Globals](globals.md) / + +# Node Client + +A TypeScript/JavaScript library for interacting with the Kosu order relay network. + +**View [the documentation here.](https://github.com/ParadigmFoundation/kosu-monorepo/blob/master/packages/node-client/docs/)** + +## Installation + +The Node Client can be installed into your project through `yarn` or `npm`, and can be passed through `webpack` or `browserify` for usage in the browser. + +### Install + +**Yarn:** + +``` +yarn add @kosu/node-client +``` + +**NPM:** + +``` +npm install --save @kosu/node-client +``` + +### Import + +Kosu and its exported classes can be imported directly into TypeScript or JavaScript projects. + +**TypeScript (and ES6+):** + +```typescript +// top-level Kosu class +import { NodeClient } from "@kosu/node-client"; +``` + +**JavaScript (CommonJS):** + +```javascript +const { NodeClient } = require("@kosu/node-client"); +``` + +## Development + +``` +@todo: add contribution guidelines summary and link +``` + +### Linting + +The TypeScript source can be linted with: + +``` +yarn lint +``` + +### Building + +Build the TypeScript source to distributable JavaScript (CommonJS) as well as source mappings and typing files with: + +``` +yarn build +``` + +## License + +Open-source software, [MIT licensed.](https://github.com/ParadigmFoundation/kosu-monorepo/blob/master/LICENSE) + +Copyright (c) 2019 Paradigm Labs, corp. diff --git a/packages/kosu-contract-helpers/docs/classes/nodeclient.md b/packages/kosu-node-client/docs/classes/nodeclient.md similarity index 77% rename from packages/kosu-contract-helpers/docs/classes/nodeclient.md rename to packages/kosu-node-client/docs/classes/nodeclient.md index 81dba300d..8a9e5dc07 100644 --- a/packages/kosu-contract-helpers/docs/classes/nodeclient.md +++ b/packages/kosu-node-client/docs/classes/nodeclient.md @@ -1,4 +1,4 @@ -> **[kosu.js](../README.md)** +> **[node-client](../README.md)** [Globals](../globals.md) / [NodeClient](nodeclient.md) / @@ -59,7 +59,7 @@ View the Kosu RPC documentation [here.](https://docs.kosu.io/go-kosu/kosu_rpc.ht \+ **new NodeClient**(`url`: string, `options?`: `WebsocketProviderOptions`): _[NodeClient](nodeclient.md)_ -_Defined in [NodeClient.ts:70](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/NodeClient.ts#L70)_ +Defined in NodeClient.ts:70 Create a new NodeClient (`node`) via a connection to a Kosu node serving the Kosu JSONRPC/WebSocket. @@ -86,7 +86,7 @@ const node = new NodeClient("wss://localhost:14342", { timeout: 1000 }); ▪ **NODE_ID_HASH_OFFSET**: _number_ = 20 -_Defined in [NodeClient.ts:39](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/NodeClient.ts#L39)_ +Defined in NodeClient.ts:39 Kosu validator node IDs are the first 20 bytes of the SHA-256 hash of the public key. @@ -97,7 +97,7 @@ public key. ▪ **PUBLIC_KEY_LENGTH**: _number_ = 32 -_Defined in [NodeClient.ts:33](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/NodeClient.ts#L33)_ +Defined in NodeClient.ts:33 Kosu validator public key's are 32 bytes long. @@ -107,7 +107,7 @@ Kosu validator public key's are 32 bytes long. ▸ **addOrders**(...`orders`: any[]): _`Promise`_ -_Defined in [NodeClient.ts:102](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/NodeClient.ts#L102)_ +Defined in NodeClient.ts:102 See [`kosu_addOrders`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#addorders) @@ -134,7 +134,7 @@ ID's of the accepted orders. ▸ **latestHeight**(): _`Promise`_ -_Defined in [NodeClient.ts:113](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/NodeClient.ts#L113)_ +Defined in NodeClient.ts:113 See [`kosu_latestHeight`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#latestheight) @@ -150,7 +150,7 @@ The most recent Kosu block number. ▸ **numberPosters**(): _`Promise`_ -_Defined in [NodeClient.ts:124](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/NodeClient.ts#L124)_ +Defined in NodeClient.ts:124 See [`kosu_numberPosters`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#numberposters) @@ -166,7 +166,7 @@ The total number of poster accounts the node is tracking. ▸ **queryPoster**(`address`: string): _`Promise`_ -_Defined in [NodeClient.ts:136](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/NodeClient.ts#L136)_ +Defined in NodeClient.ts:136 See [`kosu_queryPoster`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#queryposter) @@ -189,7 +189,7 @@ Balance and order limit data for the specified poster account. ▸ **queryValidator**(`nodeId`: string): _`Promise`_ -_Defined in [NodeClient.ts:157](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/NodeClient.ts#L157)_ +Defined in NodeClient.ts:157 See [`kosu_queryValidator`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#queryvalidator) @@ -216,7 +216,7 @@ Information about the requested validator (see `Validator`). ▸ **remainingLimit**(): _`Promise`_ -_Defined in [NodeClient.ts:174](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/NodeClient.ts#L174)_ +Defined in NodeClient.ts:174 See [`kosu_remainingLimit`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#remaininglimit) @@ -234,7 +234,7 @@ The unutilized order bandwidth for the current period. ▸ **roundInfo**(): _`Promise`_ -_Defined in [NodeClient.ts:186](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/NodeClient.ts#L186)_ +Defined in NodeClient.ts:186 See [`kosu_roundInfo`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#roundinfo) @@ -251,7 +251,7 @@ Information about the current rebalance period. ▸ **subscribeToBlocks**(`cb`: function): _`Promise`_ -_Defined in [NodeClient.ts:242](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/NodeClient.ts#L242)_ +Defined in NodeClient.ts:242 Read about Kosu subscriptions [here](https://docs.kosu.io/go-kosu/kosu_rpc.html#subscriptions). @@ -284,7 +284,7 @@ A UUID that can be used to cancel the new subscription (see `node.unsubscribe()` ▸ **subscribeToOrders**(`cb`: function): _`Promise`_ -_Defined in [NodeClient.ts:227](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/NodeClient.ts#L227)_ +Defined in NodeClient.ts:227 Read about Kosu subscriptions [here](https://docs.kosu.io/go-kosu/kosu_rpc.html#subscriptions). @@ -317,7 +317,7 @@ A UUID that can be used to cancel the new subscription (see `node.unsubscribe()` ▸ **subscribeToRebalances**(`cb`: function): _`Promise`_ -_Defined in [NodeClient.ts:257](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/NodeClient.ts#L257)_ +Defined in NodeClient.ts:257 Read about Kosu subscriptions [here](https://docs.kosu.io/go-kosu/kosu_rpc.html#subscriptions). @@ -350,7 +350,7 @@ A UUID that can be used to cancel the new subscription (see `node.unsubscribe()` ▸ **totalOrders**(): _`Promise`_ -_Defined in [NodeClient.ts:199](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/NodeClient.ts#L199)_ +Defined in NodeClient.ts:199 See [`kosu_totalOrders`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#totalorders) @@ -367,7 +367,7 @@ The total number of orders posted since network genesis. ▸ **unsubscribe**(`subscriptionId`: string): _`Promise`_ -_Defined in [NodeClient.ts:266](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/NodeClient.ts#L266)_ +Defined in NodeClient.ts:266 Cancel an active subscription. @@ -385,7 +385,7 @@ Cancel an active subscription. ▸ **validators**(): _`Promise`_ -_Defined in [NodeClient.ts:211](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/NodeClient.ts#L211)_ +Defined in NodeClient.ts:211 See [`kosu_validators`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#validators) @@ -402,7 +402,7 @@ Information about all active Kosu validators (see `Validator`). ▸ **publicKeyToNodeId**(`publicKey`: string): _string_ -_Defined in [NodeClient.ts:52](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/NodeClient.ts#L52)_ +Defined in NodeClient.ts:52 Convert a Kosu/Tendermint public key to the corresponding node ID. @@ -424,7 +424,7 @@ The node ID (tendermint "address") for that public key. ### ▪ **DEFAULT_OPTIONS**: _object_ -_Defined in [NodeClient.ts:28](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/NodeClient.ts#L28)_ +Defined in NodeClient.ts:28 The default options specify a connection timeout of 3s, all other defaults are inherited from `WebsocketProviderOptions`. @@ -433,4 +433,4 @@ are inherited from `WebsocketProviderOptions`. • **timeout**: _number_ = 3000 -_Defined in [NodeClient.ts:28](https://github.com/ParadigmFoundation/kosu-monorepo/blob/a7ce3d5b/packages/kosu-contract-helpers/src/NodeClient.ts#L28)_ +Defined in NodeClient.ts:28 diff --git a/packages/kosu-node-client/docs/globals.md b/packages/kosu-node-client/docs/globals.md new file mode 100644 index 000000000..59c791071 --- /dev/null +++ b/packages/kosu-node-client/docs/globals.md @@ -0,0 +1,11 @@ +> **[node-client](README.md)** + +[Globals](globals.md) / + +# node-client + +## Index + +### Classes + +- [NodeClient](classes/nodeclient.md) diff --git a/packages/kosu-node-client/package.json b/packages/kosu-node-client/package.json new file mode 100644 index 000000000..2b18aa519 --- /dev/null +++ b/packages/kosu-node-client/package.json @@ -0,0 +1,57 @@ +{ + "name": "@kosu/node-client", + "version": "0.3.0", + "description": "JavaScript module for connecting with Kosu.", + "main": "dist/src/index.js", + "license": "MIT", + "scripts": { + "test": "mocha", + "coverage": "nyc mocha && istanbul report html && open coverage/lcov-report/index.html", + "test:ci": "ts-mocha -p tsconfig.json test/ --timeout 20000 -- geth", + "build": "tsc", + "clean": "shx rm -rf dist/", + "lint": "tslint -p .", + "lint:fix": "tslint -p . --fix", + "docs": "typedoc ./src" + }, + "repository": { + "type": "git", + "url": "https://github.com/ParadigmFoundation/kosu-monorepo.git" + }, + "bugs": { + "url": "https://github.com/ParadigmFoundation/kosu-monorepo/issues" + }, + "config": { + "test_mnemonic": "plate tag lend tissue capable ketchup evidence deliver aspect salt used always", + "ganache_image_uri": "gcr.io/kosu-io/kosu-ganache:latest" + }, + "dependencies": { + "@0x/utils": "^4.3.1", + "@0x/web3-providers-fork": "^0.0.7", + "@babel/core": "^7.4.4", + "@kosu/types": "^0.3.0", + "@kosu/tsc-config": "^0.1.0", + "@kosu/tslint-config": "^0.0.4", + "lodash": "^4.17.15", + "uuid": "^3.3.3" + }, + "devDependencies": { + "@istanbuljs/nyc-config-typescript": "^0.1.3", + "@kosu/migrations": "^0.3.0", + "@types/ws": "^6.0.2", + "nyc": "^14.1.1", + "simple-mock": "^0.8.0", + "source-map-support": "^0.5.12", + "ts-mocha": "^6.0.0", + "ts-node": "^8.1.0", + "typedoc": "^0.14.2", + "typedoc-plugin-markdown": "^2.0.1" + }, + "publishConfig": { + "access": "public" + }, + "files": [ + "dist/", + "README.md" + ] +} diff --git a/packages/kosu-contract-helpers/src/NodeClient.ts b/packages/kosu-node-client/src/NodeClient.ts similarity index 100% rename from packages/kosu-contract-helpers/src/NodeClient.ts rename to packages/kosu-node-client/src/NodeClient.ts diff --git a/packages/kosu-node-client/src/index.ts b/packages/kosu-node-client/src/index.ts new file mode 100644 index 000000000..ed1166a5f --- /dev/null +++ b/packages/kosu-node-client/src/index.ts @@ -0,0 +1 @@ +export { NodeClient } from "./NodeClient"; diff --git a/packages/kosu-node-client/test/mocha.opts b/packages/kosu-node-client/test/mocha.opts new file mode 100644 index 000000000..5e19e2aee --- /dev/null +++ b/packages/kosu-node-client/test/mocha.opts @@ -0,0 +1,5 @@ +--require ts-node/register/transpile-only +--require source-map-support/register +--recursive +--timeout 20000 +test/ \ No newline at end of file diff --git a/packages/kosu-node-client/test/setup_test.js b/packages/kosu-node-client/test/setup_test.js new file mode 100644 index 000000000..80773cbf9 --- /dev/null +++ b/packages/kosu-node-client/test/setup_test.js @@ -0,0 +1,81 @@ +const Web3Wrapper = require("@0x/web3-wrapper").Web3Wrapper; +const Web3 = require("web3"); +const chai = require("chai"); +const CAP = require("chai-as-promised"); +const Web3ProviderEngine = require("web3-provider-engine"); +const providerUtils = require("@0x/utils").providerUtils; +const GanacheSubprovider = require("@0x/subproviders").GanacheSubprovider; +const RPCSubprovider = require("@0x/subproviders").RPCSubprovider; +const migrations = require("@kosu/migrations").migrations; +const Helpers = require("@kosu/test-helpers"); +const BlockchainLifecycle = require("@0x/dev-utils").BlockchainLifecycle; +const { Kosu } = require("../src"); +const BigNumber = require("@0x/utils").BigNumber; + +chai.use(CAP); + +const useGeth = process.argv.includes("geth"); + +before(async () => { + global.assert = chai.assert; + chai.should(); + + global.provider = new Web3ProviderEngine(); + + if (useGeth) { + const rpcSubprovider = new RPCSubprovider(process.env.WEB3_URI); + provider.addProvider(rpcSubprovider); + } else { + const ganacheSubprovider = new GanacheSubprovider({ + network_id: 6175, + mnemonic: process.env.npm_package_config_test_mnemonic, + }); + provider.addProvider(ganacheSubprovider); + } + + providerUtils.startProviderEngine(provider); + + global.web3Wrapper = new Web3Wrapper(provider); + await new BlockchainLifecycle(web3Wrapper).startAsync(); + + global.web3 = new Web3(provider); + global.accounts = await web3.eth.personal.getAccounts(); + global.BigNumber = BigNumber; + global.MAX_UINT = BigNumber("2") + .pow(BigNumber("256")) + .minus(BigNumber("1")) + .toString(); + + const config = { + provider, + networkId: await web3.eth.net.getId(), + from: accounts[0].toLowerCase(), + }; + + if (!useGeth) { + config.migratedContracts = await migrations(provider, { from: accounts[0].toLowerCase() }); + config.votingAddress = config.migratedContracts.voting.address; + config.treasuryAddress = config.migratedContracts.treasury.address; + config.kosuTokenAddress = config.migratedContracts.kosuToken.address; + config.eventEmitterAddress = config.migratedContracts.eventEmitter.address; + config.orderGatewayAddress = config.migratedContracts.orderGateway.address; + config.posterRegistryAddress = config.migratedContracts.posterRegistry.address; + config.validatorRegistryAddress = config.migratedContracts.validatorRegistry.address; + } + global.testHelpers = new Helpers.TestHelpers(web3Wrapper, config); + + const nullProvider = new Web3ProviderEngine(); + const nullGanacheSubprovider = new GanacheSubprovider({}); + nullProvider.addProvider(nullGanacheSubprovider); + providerUtils.startProviderEngine(nullProvider); + global.nullWeb3Wrapper = new Web3Wrapper(nullProvider); + + global.TestValues = Helpers.TestValues; + // global.testHelpers = new Helpers.TestHelpers(web3Wrapper, ) +}); + +describe("config", () => { + it("should connect to web3", () => { + accounts.length.should.be.gte(10, "There should be 10 ETH accounts."); + }); +}); diff --git a/packages/kosu-node-client/tsconfig.json b/packages/kosu-node-client/tsconfig.json new file mode 100644 index 000000000..1e9daea83 --- /dev/null +++ b/packages/kosu-node-client/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "@kosu/tsc-config", + "compilerOptions": { + "outDir": "dist", + "rootDir": ".", + "resolveJsonModule": true, + "sourceMap": true, + "moduleResolution": "node" + }, + "include": ["./src/**/*"] +} diff --git a/packages/kosu-node-client/tslint.json b/packages/kosu-node-client/tslint.json new file mode 100644 index 000000000..7f9aa5909 --- /dev/null +++ b/packages/kosu-node-client/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": ["@kosu/tslint-config"] +} diff --git a/packages/kosu-node-client/typedoc.json b/packages/kosu-node-client/typedoc.json new file mode 100644 index 000000000..95f65250b --- /dev/null +++ b/packages/kosu-node-client/typedoc.json @@ -0,0 +1,11 @@ +{ + "name": "node-client", + "mode": "file", + "readme": "./README.md", + "theme": "markdown", + "out": "./docs", + "excludePrivate": true, + "excludeExternals": true, + "ignoreCompilerErrors": true, + "includeDeclarations": true +} diff --git a/packages/kosu-system-contracts/docs/KosuToken.md b/packages/kosu-system-contracts/docs/KosuToken.md index 6b4f42f4f..2a3340849 100644 --- a/packages/kosu-system-contracts/docs/KosuToken.md +++ b/packages/kosu-system-contracts/docs/KosuToken.md @@ -10,6 +10,7 @@ KosuToken (KOSU) is an implementation of the ERC-20 interface and supporting bon - [balanceOf](#balanceof) - [bondTokens](#bondtokens) - [burn](#burn) + - [constructor](#constructor) - [decreaseAllowance](#decreaseallowance) - [estimateEtherToToken](#estimateethertotoken) - [estimateTokenToEther](#estimatetokentoether) @@ -111,6 +112,22 @@ function burn(amount uint256) public | --------- | --------- | ------------------------- | | `amount` | `uint256` | Number of tokens to burn. | +### constructor + +Initializes KosuToken with the authorizedAddresses shared permission contract to protect functions. + +#### Signature + +```solidity +constructor(_auth address) public +``` + +#### Parameters: + +| Parameter | Type | Description | +| --------- | --------- | -------------------------------------- | +| `_auth` | `address` | Deployed AuthorizedAddresses contract. | + ### decreaseAllowance Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed\_[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol Emits an Approval event. diff --git a/packages/kosu-system-contracts/docs/Treasury.md b/packages/kosu-system-contracts/docs/Treasury.md index 0e4a5e284..99598bc08 100644 --- a/packages/kosu-system-contracts/docs/Treasury.md +++ b/packages/kosu-system-contracts/docs/Treasury.md @@ -17,6 +17,7 @@ The Kosu Treasury manages KosuToken balances to allow tokens in use within the c - [deposit](#deposit) - [registerVote](#registervote) - [releaseTokens](#releasetokens) + - [setVoting](#setvoting) - [systemBalance](#systembalance) - [tokenLocksExpire](#tokenlocksexpire) - [validatorLock](#validatorlock) @@ -207,13 +208,13 @@ function registerVote(account address, pollId uint256, amount uint256, endBlock #### Parameters: -| Parameter | Type | Description | -| ---------------- | --------- | ---------------------------------- | -| `account` | `address` | The account voting. | -| `pollId` | `uint256` | The poll the account is voting on. | -| `amount` | `uint256` | Number of tokens contributed. | -| `endBlock` | `uint256` | -| `losingEndBlock` | `uint256` | +| Parameter | Type | Description | +| ---------------- | --------- | ------------------------------------------------------------------------------------- | +| `account` | `address` | The account voting. | +| `pollId` | `uint256` | The poll the account is voting on. | +| `amount` | `uint256` | Number of tokens contributed. | +| `endBlock` | `uint256` | Block number vote token lock should expire. | +| `losingEndBlock` | `uint256` | Block number vote token lock should expire if vote was in support of a losing option. | ### releaseTokens @@ -232,6 +233,22 @@ function releaseTokens(account address, amount uint256) public | `account` | `address` | Account to release tokens to. | | `amount` | `uint256` | Number of tokens to release. | +### setVoting + +Set the voting contract after post deployment of the Treasury contract. + +#### Signature + +```solidity +function setVoting(votingAddress address) public +``` + +#### Parameters: + +| Parameter | Type | Description | +| --------------- | --------- | ---------------------------------------- | +| `votingAddress` | `address` | address of the deployed Voting contract. | + ### systemBalance Reports the total balance within the entire contract system for an account. diff --git a/packages/kosu-system-contracts/docs/ValidatorRegistry.md b/packages/kosu-system-contracts/docs/ValidatorRegistry.md index b865dc6c8..3ec10eddc 100644 --- a/packages/kosu-system-contracts/docs/ValidatorRegistry.md +++ b/packages/kosu-system-contracts/docs/ValidatorRegistry.md @@ -101,19 +101,19 @@ constructor(_treasuryAddress address, _votingAddress address, _events address, _ #### Parameters: -| Parameter | Type | Description | -| ------------------------ | --------- | --------------------------------------------------------------------------- | -| `_treasuryAddress` | `address` | Deployed Treasury address. | -| `_votingAddress` | `address` | Deployed Voting address. | -| `_events` | `address` | Deployed EventEmitter address. | -| `_applicationPeriod` | `uint256` | Initial application period (in blocks) for pending listings. | -| `_commitPeriod` | `uint256` | Number of blocks after challenge initiated in which votes can be committed. | -| `_challengePeriod` | `uint256` | Number of blocks a challenge lasts before being finalized. | -| `_exitPeriod` | `uint256` | Number of blocks exiting listings must wait before claiming stake. | -| `_rewardPeriod` | `uint256` | The frequency (in blocks) with which validator rewards may be issued. | -| `_exitLockPeriod` | `uint256` | -| `_winningVoteLockPeriod` | `uint256` | -| `_losingVoteLockPeriod` | `uint256` | +| Parameter | Type | Description | +| ------------------------ | --------- | -------------------------------------------------------------------------------------------- | +| `_treasuryAddress` | `address` | Deployed Treasury address. | +| `_votingAddress` | `address` | Deployed Voting address. | +| `_events` | `address` | Deployed EventEmitter address. | +| `_applicationPeriod` | `uint256` | Initial application period (in blocks) for pending listings. | +| `_commitPeriod` | `uint256` | Number of blocks after challenge initiated in which votes can be committed. | +| `_challengePeriod` | `uint256` | Number of blocks a challenge lasts before being finalized. | +| `_exitPeriod` | `uint256` | Number of blocks exiting listings must wait before claiming stake. | +| `_rewardPeriod` | `uint256` | The frequency (in blocks) with which validator rewards may be issued. | +| `_exitLockPeriod` | `uint256` | Number of blocks tokens will be locked after a successful exit. | +| `_winningVoteLockPeriod` | `uint256` | Number of blocks winning voters will have tokens locked after a challenge has been resolved. | +| `_losingVoteLockPeriod` | `uint256` | Number of blocks losing voters will have tokens locked after a challenge has been resolved. | ### finalizeExit diff --git a/packages/kosu.js/package.json b/packages/kosu.js/package.json index 32f47389a..f559a6b62 100644 --- a/packages/kosu.js/package.json +++ b/packages/kosu.js/package.json @@ -26,7 +26,8 @@ "@kosu/tsc-config": "^0.1.0", "@kosu/tslint-config": "^0.0.4", "@kosu/contract-helpers": "0.3.0", - "@kosu/contract-utils": "0.3.0" + "@kosu/contract-utils": "0.3.0", + "@kosu/node-client": "0.3.0" }, "devDependencies": { "@istanbuljs/nyc-config-typescript": "^0.1.3", diff --git a/packages/kosu.js/src/index.ts b/packages/kosu.js/src/index.ts index 105f96501..65de2ff70 100644 --- a/packages/kosu.js/src/index.ts +++ b/packages/kosu.js/src/index.ts @@ -1,3 +1,4 @@ export * from "@kosu/system-contracts"; export * from "@kosu/contract-helpers"; export * from "@kosu/contract-utils"; +export * from "@kosu/node-client";