diff --git a/packages/kosu.js/docs/classes/eventemitter.md b/packages/kosu.js/docs/classes/eventemitter.md index 6060be59..1d6a9bf0 100644 --- a/packages/kosu.js/docs/classes/eventemitter.md +++ b/packages/kosu.js/docs/classes/eventemitter.md @@ -18,19 +18,11 @@ to subscribe to future events. - [constructor](eventemitter.md#constructor) -### Properties - -- [address](eventemitter.md#private-address) -- [kosuWeb3Wrapper](eventemitter.md#private-kosuweb3wrapper) -- [web3Wrapper](eventemitter.md#private-web3wrapper) - ### Methods -- [\_decodeLogs](eventemitter.md#private-_decodelogs) - [getAddress](eventemitter.md#getaddress) - [getFutureDecodedLogs](eventemitter.md#getfuturedecodedlogs) - [getPastDecodedLogs](eventemitter.md#getpastdecodedlogs) -- [getPastLogsFromKosuEndpoint](eventemitter.md#private-getpastlogsfromkosuendpoint) ## Constructors @@ -38,7 +30,7 @@ to subscribe to future events. \+ **new EventEmitter**(`options`: [KosuOptions](../interfaces/kosuoptions.md)): _[EventEmitter](eventemitter.md)_ -_Defined in [EventEmitter.ts:47](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/EventEmitter.ts#L47)_ +_Defined in [EventEmitter.ts:47](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/EventEmitter.ts#L47)_ Create a new `EventEmitter` instance. @@ -50,61 +42,13 @@ Create a new `EventEmitter` instance. **Returns:** _[EventEmitter](eventemitter.md)_ -## Properties - -### `Private` address - -• **address**: _string_ - -_Defined in [EventEmitter.ts:41](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/EventEmitter.ts#L41)_ - -The address of the deployed `EventEmitter` contract for the current Ethereum -network. - ---- - -### `Private` kosuWeb3Wrapper - -• **kosuWeb3Wrapper**: _`Web3Wrapper`_ - -_Defined in [EventEmitter.ts:47](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/EventEmitter.ts#L47)_ - -A separate `web3Wrapper` instance that can be configured with the Kosu -development proof-of-authority network for testing purposes. - ---- - -### `Private` web3Wrapper - -• **web3Wrapper**: _`Web3Wrapper`_ - -_Defined in [EventEmitter.ts:35](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/EventEmitter.ts#L35)_ - -The `web3Wrapper` instance with the contract's ABI loaded. - ## Methods -### `Private` \_decodeLogs - -▸ **\_decodeLogs**(`logs`: `LogEntry`[]): _`Array>`_ - -_Defined in [EventEmitter.ts:143](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/EventEmitter.ts#L143)_ - -**Parameters:** - -| Name | Type | -| ------ | ------------ | -| `logs` | `LogEntry`[] | - -**Returns:** _`Array>`_ - ---- - ### getAddress ▸ **getAddress**(): _`Promise`_ -_Defined in [EventEmitter.ts:63](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/EventEmitter.ts#L63)_ +_Defined in [EventEmitter.ts:63](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/EventEmitter.ts#L63)_ Return the address of the configured deployed contract. If not already cached, will return the deployed address for the detected network ID (if available). @@ -117,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:109](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/EventEmitter.ts#L109)_ +_Defined in [EventEmitter.ts:109](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/EventEmitter.ts#L109)_ **`todo`** document better (and confirm) @@ -147,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:82](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/EventEmitter.ts#L82)_ +_Defined in [EventEmitter.ts:82](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/EventEmitter.ts#L82)_ Get all past decoded logs from the Kosu `EventEmitter` contract, with the oldest event at position 0. @@ -161,22 +105,3 @@ oldest event at position 0. **Returns:** _`Promise>>`_ An array of event logs with decoded arguments from the EventEmitter. - ---- - -### `Private` getPastLogsFromKosuEndpoint - -▸ **getPastLogsFromKosuEndpoint**(`config`: `FilterObject`): _`Promise`_ - -_Defined in [EventEmitter.ts:133](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/EventEmitter.ts#L133)_ - -Load all historical even logs from the Kosu EventEmitter contract that is -deployed on the Kosu private test-network. - -**Parameters:** - -| Name | Type | Description | -| -------- | -------------- | ---------------------------------------------------------------------- | -| `config` | `FilterObject` | Filter object for querying past logs (see `web3Wrapper.getLogsAsync`). | - -**Returns:** _`Promise`_ diff --git a/packages/kosu.js/docs/classes/kosu.md b/packages/kosu.js/docs/classes/kosu.md index b7589cee..57aba9c0 100644 --- a/packages/kosu.js/docs/classes/kosu.md +++ b/packages/kosu.js/docs/classes/kosu.md @@ -31,6 +31,7 @@ contracts. - [Signature](kosu.md#signature) - [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 +49,7 @@ contracts. \+ **new Kosu**(`options`: [KosuOptions](../interfaces/kosuoptions.md)): _[Kosu](kosu.md)_ -_Defined in [Kosu.ts:126](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Kosu.ts#L126)_ +_Defined in [Kosu.ts:137](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Kosu.ts#L137)_ Create a new `kosu` instance and instantiate wrappers for each Kosu system contract. @@ -72,7 +73,7 @@ of transactions and generation of signatures will not be possible. • **Signature**: _`Signature`_ -_Defined in [Kosu.ts:121](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Kosu.ts#L121)_ +_Defined in [Kosu.ts:132](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Kosu.ts#L132)_ Utilities for generating and recovering signatures for use within the Kosu system. @@ -83,7 +84,7 @@ Kosu system. • **eventEmitter**: _[EventEmitter](eventemitter.md)_ -_Defined in [Kosu.ts:107](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Kosu.ts#L107)_ +_Defined in [Kosu.ts:118](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Kosu.ts#L118)_ The `eventEmitter` enables the query of and subscription to decoded event logs from the Kosu `EventEmitter` contract. @@ -94,17 +95,30 @@ logs from the Kosu `EventEmitter` contract. • **kosuToken**: _[KosuToken](kosutoken.md)_ -_Defined in [Kosu.ts:72](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Kosu.ts#L72)_ +_Defined in [Kosu.ts:83](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Kosu.ts#L83)_ The `kosuToken` provides methods for interacting with the KOSU ERC-20 token. --- +### node + +• **node**: _[NodeClient](nodeclient.md)_ + +_Defined in [Kosu.ts:58](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Kosu.ts#L58)_ + +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:59](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Kosu.ts#L59)_ +_Defined in [Kosu.ts:70](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Kosu.ts#L70)_ The `orderGateway` instance provides access to the `OrderGateway` contract which is used to direct settlement of orders to their corresponding @@ -119,7 +133,7 @@ type, based on a `SubContract` address. • **orderHelper**: _[OrderHelper](orderhelper.md)_ -_Defined in [Kosu.ts:67](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Kosu.ts#L67)_ +_Defined in [Kosu.ts:78](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Kosu.ts#L78)_ The `orderHelper` instance provides methods for generating and signing maker orders, signing orders for submission to the Kosu network, and @@ -132,7 +146,7 @@ submitting orders for settlement on the Ethereum blockchain via the • **posterRegistry**: _[PosterRegistry](posterregistry.md)_ -_Defined in [Kosu.ts:92](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Kosu.ts#L92)_ +_Defined in [Kosu.ts:103](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Kosu.ts#L103)_ The `posterRegistry` instance enables users to interact with the Kosu `PosterRegistry` contract to bond and un-bond KOSU tokens to access the @@ -144,7 +158,7 @@ order relay feature of the Kosu network. • **treasury**: _[Treasury](treasury.md)_ -_Defined in [Kosu.ts:78](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Kosu.ts#L78)_ +_Defined in [Kosu.ts:89](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Kosu.ts#L89)_ The `treasury` instance provides access to functionality of the Kosu `Treasury` contract, such as deposits/withdrawals and allowance management. @@ -155,7 +169,7 @@ The `treasury` instance provides access to functionality of the Kosu • **utils**: _[KosuUtils](../interfaces/kosuutils.md)_ -_Defined in [Kosu.ts:115](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Kosu.ts#L115)_ +_Defined in [Kosu.ts:126](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Kosu.ts#L126)_ Common and helpful utility methods and constants for interacting with the Kosu contract system and Ethereum blockchain. @@ -166,7 +180,7 @@ Kosu contract system and Ethereum blockchain. • **validatorRegistry**: _[ValidatorRegistry](validatorregistry.md)_ -_Defined in [Kosu.ts:101](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Kosu.ts#L101)_ +_Defined in [Kosu.ts:112](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Kosu.ts#L112)_ The `validatorRegistry` instance enables interaction with the `ValidatorRegistry` token-curated registry system. The system enables users to submit proposals @@ -180,7 +194,7 @@ It also provides query access to past challenges and the current listings. • **version**: _string_ -_Defined in [Kosu.ts:126](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Kosu.ts#L126)_ +_Defined in [Kosu.ts:137](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Kosu.ts#L137)_ The current `@kosu/kosu.js` package version. @@ -190,7 +204,7 @@ The current `@kosu/kosu.js` package version. • **voting**: _[Voting](voting.md)_ -_Defined in [Kosu.ts:85](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Kosu.ts#L85)_ +_Defined in [Kosu.ts:96](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Kosu.ts#L96)_ The `voting` instance provides access to the Kosu `voting` contract and allows users to participate in voting on governance measures, and claiming @@ -202,7 +216,7 @@ rewards for correctly participating in winning polls. • **web3**: _`Web3`_ -_Defined in [Kosu.ts:40](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Kosu.ts#L40)_ +_Defined in [Kosu.ts:41](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/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 @@ -214,7 +228,7 @@ wrapper and can be used to directly access the `web3` API. • **web3Wrapper**: _`Web3Wrapper`_ -_Defined in [Kosu.ts:47](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Kosu.ts#L47)_ +_Defined in [Kosu.ts:48](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/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.js/docs/classes/kosutoken.md b/packages/kosu.js/docs/classes/kosutoken.md index 6558cec7..95937d87 100644 --- a/packages/kosu.js/docs/classes/kosutoken.md +++ b/packages/kosu.js/docs/classes/kosutoken.md @@ -21,13 +21,6 @@ If instantiated outside the `Kosu` class, an instance of `web3` and of the - [constructor](kosutoken.md#constructor) -### Properties - -- [address](kosutoken.md#private-address) -- [contract](kosutoken.md#private-contract) -- [web3](kosutoken.md#private-web3) -- [web3Wrapper](kosutoken.md#private-web3wrapper) - ### Methods - [allowance](kosutoken.md#allowance) @@ -36,7 +29,6 @@ If instantiated outside the `Kosu` class, an instance of `web3` and of the - [bondTokens](kosutoken.md#bondtokens) - [estimateEtherToToken](kosutoken.md#estimateethertotoken) - [estimateTokenToEther](kosutoken.md#estimatetokentoether) -- [getContract](kosutoken.md#private-getcontract) - [pay](kosutoken.md#pay) - [releaseTokens](kosutoken.md#releasetokens) - [totalSupply](kosutoken.md#totalsupply) @@ -49,7 +41,7 @@ If instantiated outside the `Kosu` class, an instance of `web3` and of the \+ **new KosuToken**(`options`: [KosuOptions](../interfaces/kosuoptions.md)): _[KosuToken](kosutoken.md)_ -_Defined in [KosuToken.ts:37](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/KosuToken.ts#L37)_ +_Defined in [KosuToken.ts:37](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/KosuToken.ts#L37)_ Creates a new KosuToken instance, supplied with an options object. @@ -71,56 +63,13 @@ const kosuToken = new KosuToken(options); **Returns:** _[KosuToken](kosutoken.md)_ -## Properties - -### `Private` address - -• **address**: _string_ - -_Defined in [KosuToken.ts:37](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/KosuToken.ts#L37)_ - -The current KosuToken deployed address, loaded based on the detected -`networkId` from a mapping of known deployed addresses. - ---- - -### `Private` contract - -• **contract**: _`KosuTokenContract`_ - -_Defined in [KosuToken.ts:31](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/KosuToken.ts#L31)_ - -An instance of the lower-level contract wrapper for the Kosu token, auto- -generated from the Solidity source code. - ---- - -### `Private` web3 - -• **web3**: _`Web3`_ - -_Defined in [KosuToken.ts:19](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/KosuToken.ts#L19)_ - -An instance of `web3` used to interact with the Ethereum blockchain. - ---- - -### `Private` web3Wrapper - -• **web3Wrapper**: _`Web3Wrapper`_ - -_Defined in [KosuToken.ts:25](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/KosuToken.ts#L25)_ - -An instance of a 0x `Web3Wrapper` used for some RPC calls and for certain -methods. - ## Methods ### allowance ▸ **allowance**(`owner`: string, `spender`: string): _`Promise`_ -_Defined in [KosuToken.ts:151](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/KosuToken.ts#L151)_ +_Defined in [KosuToken.ts:151](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/KosuToken.ts#L151)_ Reads approved allowance for a given `owner` and `spender` account. @@ -141,7 +90,7 @@ The allowance granted to the `spender` in units of wei. ▸ **approve**(`spender`: string, `value`: `BigNumber`): _`Promise`_ -_Defined in [KosuToken.ts:139](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/KosuToken.ts#L139)_ +_Defined in [KosuToken.ts:139](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/KosuToken.ts#L139)_ Sets approval for user to transfer tokens on `coinbase`'s behalf. @@ -162,7 +111,7 @@ The transaction receipt after it has been included in a block. ▸ **balanceOf**(`owner`: string): _`Promise`_ -_Defined in [KosuToken.ts:102](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/KosuToken.ts#L102)_ +_Defined in [KosuToken.ts:102](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/KosuToken.ts#L102)_ Reads the balance for a user address, returned in wei. @@ -182,7 +131,7 @@ The `owner`'s KOSU balance in wei. ▸ **bondTokens**(`value`: `BigNumber`, `minPayout`: `BigNumber`): _`Promise`_ -_Defined in [KosuToken.ts:185](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/KosuToken.ts#L185)_ +_Defined in [KosuToken.ts:185](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/KosuToken.ts#L185)_ Sends ether to the contract to bond tokens. @@ -203,7 +152,7 @@ Logs from the transaction block. ▸ **estimateEtherToToken**(`etherInput`: `BigNumber`): _`Promise`_ -_Defined in [KosuToken.ts:162](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/KosuToken.ts#L162)_ +_Defined in [KosuToken.ts:162](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/KosuToken.ts#L162)_ Calculated tokens to be minted from deposited ether. @@ -223,7 +172,7 @@ Estimation of tokens to be minted. ▸ **estimateTokenToEther**(`tokensToBurn`: `BigNumber`): _`Promise`_ -_Defined in [KosuToken.ts:173](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/KosuToken.ts#L173)_ +_Defined in [KosuToken.ts:173](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/KosuToken.ts#L173)_ Calculates ether to be returned for burning tokens. @@ -239,25 +188,11 @@ Estimation of ether to be returned. --- -### `Private` getContract - -▸ **getContract**(): _`Promise`_ - -_Defined in [KosuToken.ts:63](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/KosuToken.ts#L63)_ - -Asynchronously initializes the contract instance or returns it from cache. - -**Returns:** _`Promise`_ - -The low-level KosuToken contract wrapper instance. - ---- - ### pay ▸ **pay**(`value`: `BigNumber`): _`Promise`_ -_Defined in [KosuToken.ts:209](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/KosuToken.ts#L209)_ +_Defined in [KosuToken.ts:209](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/KosuToken.ts#L209)_ Sends ether to the contract to bond tokens. @@ -277,7 +212,7 @@ Logs from the transaction block. ▸ **releaseTokens**(`tokensToBurn`: `BigNumber`): _`Promise`_ -_Defined in [KosuToken.ts:198](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/KosuToken.ts#L198)_ +_Defined in [KosuToken.ts:198](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/KosuToken.ts#L198)_ Releases tokens to be burned and return bonded ether. @@ -297,7 +232,7 @@ Logs from the transaction block. ▸ **totalSupply**(): _`Promise`_ -_Defined in [KosuToken.ts:91](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/KosuToken.ts#L91)_ +_Defined in [KosuToken.ts:91](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/KosuToken.ts#L91)_ Reads the total supply of KOSU, resolves to a `BigNumber` of the amount of tokens in units of wei. @@ -312,7 +247,7 @@ The total KOSU supply in wei. ▸ **transfer**(`to`: string, `value`: `BigNumber`): _`Promise`_ -_Defined in [KosuToken.ts:114](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/KosuToken.ts#L114)_ +_Defined in [KosuToken.ts:114](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/KosuToken.ts#L114)_ Transfers tokens to an address, from the current `coinbase` account. @@ -333,7 +268,7 @@ The transaction's receipt after inclusion in a block. ▸ **transferFrom**(`from`: string, `to`: string, `value`: `BigNumber`): _`Promise`_ -_Defined in [KosuToken.ts:127](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/KosuToken.ts#L127)_ +_Defined in [KosuToken.ts:127](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/KosuToken.ts#L127)_ Transfers token from an address to a destination address. diff --git a/packages/kosu.js/docs/classes/nodeclient.md b/packages/kosu.js/docs/classes/nodeclient.md new file mode 100644 index 00000000..003ed6dd --- /dev/null +++ b/packages/kosu.js/docs/classes/nodeclient.md @@ -0,0 +1,436 @@ +> **[kosu.js](../README.md)** + +[Globals](../globals.md) / [NodeClient](nodeclient.md) / + +# Class: NodeClient + +A simple JSONRPC/WebSocket client for the `go-kosu` JSONRPC-API. Supports the +full Kosu JSONRPC, including subscriptions. + +It is built on the [web3](https://www.npmjs.com/package/web3) `WebSocketProvider` +JSONRPC client, through a more desirable fork provided by [0x.](https://0x.org) +As such, it can be configured with the same options supported by the underlying +client. + +It must be initialized with the URL of a `go-kosu` node serving the JSONRPC +over WebSocket. + +View the Kosu RPC documentation [here.](https://docs.kosu.io/go-kosu/kosu_rpc.html) + +## Hierarchy + +- **NodeClient** + +## Index + +### Constructors + +- [constructor](nodeclient.md#constructor) + +### Properties + +- [NODE_ID_HASH_OFFSET](nodeclient.md#static-node_id_hash_offset) +- [PUBLIC_KEY_LENGTH](nodeclient.md#static-public_key_length) + +### Methods + +- [addOrders](nodeclient.md#addorders) +- [latestHeight](nodeclient.md#latestheight) +- [numberPosters](nodeclient.md#numberposters) +- [queryPoster](nodeclient.md#queryposter) +- [queryValidator](nodeclient.md#queryvalidator) +- [remainingLimit](nodeclient.md#remaininglimit) +- [roundInfo](nodeclient.md#roundinfo) +- [subscribeToBlocks](nodeclient.md#subscribetoblocks) +- [subscribeToOrders](nodeclient.md#subscribetoorders) +- [subscribeToRebalances](nodeclient.md#subscribetorebalances) +- [totalOrders](nodeclient.md#totalorders) +- [unsubscribe](nodeclient.md#unsubscribe) +- [validators](nodeclient.md#validators) +- [publicKeyToNodeId](nodeclient.md#static-publickeytonodeid) + +### Object literals + +- [DEFAULT_OPTIONS](nodeclient.md#static-default_options) + +## Constructors + +### constructor + +\+ **new NodeClient**(`url`: string, `options?`: `WebsocketProviderOptions`): _[NodeClient](nodeclient.md)_ + +_Defined in [NodeClient.ts:69](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/NodeClient.ts#L69)_ + +Create a new NodeClient (`node`) via a connection to a Kosu node serving +the Kosu JSONRPC/WebSocket. + +**`example`** + +```typescript +// create a node client (with a request/connection timeout of 1s) +const node = new NodeClient("wss://localhost:14342", { timeout: 1000 }); +``` + +**Parameters:** + +| Name | Type | Description | +| ---------- | -------------------------- | ------------------------------------------------------- | +| `url` | string | Full URL to the Kosu node's WebSocket JSONRPC endpoint. | +| `options?` | `WebsocketProviderOptions` | Options to provide the underlying `WebSocketProvider`. | + +**Returns:** _[NodeClient](nodeclient.md)_ + +## Properties + +### `Static` NODE_ID_HASH_OFFSET + +▪ **NODE_ID_HASH_OFFSET**: _number_ = 20 + +_Defined in [NodeClient.ts:37](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/NodeClient.ts#L37)_ + +Kosu validator node IDs are the first 20 bytes of the SHA-256 hash of the +public key. + +--- + +### `Static` PUBLIC_KEY_LENGTH + +▪ **PUBLIC_KEY_LENGTH**: _number_ = 32 + +_Defined in [NodeClient.ts:31](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/NodeClient.ts#L31)_ + +Kosu validator public key's are 32 bytes long. + +## Methods + +### addOrders + +▸ **addOrders**(...`orders`: any[]): _`Promise`_ + +_Defined in [NodeClient.ts:101](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/NodeClient.ts#L101)_ + +See [`kosu_addOrders`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#addorders) + +Submit poster-signed orders to the Kosu node to be subsequently proposed +to the network. In order for them to be accepted, they must have signatures +from valid posters who have bonded Kosu tokens. + +See the `posterRegistry.registerTokens()` method to bond KOSU. + +**Parameters:** + +| Name | Type | Description | +| ----------- | ----- | ----------------------------------------------------- | +| `...orders` | any[] | Orders to submit to the node as subsequent arguments. | + +**Returns:** _`Promise`_ + +Validation results from the Kosu node, and/or the transaction +ID's of the accepted orders. + +--- + +### latestHeight + +▸ **latestHeight**(): _`Promise`_ + +_Defined in [NodeClient.ts:112](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/NodeClient.ts#L112)_ + +See [`kosu_latestHeight`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#latestheight) + +Get the height of the most recently committed and finalized Kosu block. + +**Returns:** _`Promise`_ + +The most recent Kosu block number. + +--- + +### numberPosters + +▸ **numberPosters**(): _`Promise`_ + +_Defined in [NodeClient.ts:123](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/NodeClient.ts#L123)_ + +See [`kosu_numberPosters`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#numberposters) + +Get the total number registered posters from the Kosu node. + +**Returns:** _`Promise`_ + +The total number of poster accounts the node is tracking. + +--- + +### queryPoster + +▸ **queryPoster**(`address`: string): _`Promise`_ + +_Defined in [NodeClient.ts:135](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/NodeClient.ts#L135)_ + +See [`kosu_queryPoster`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#queryposter) + +Get finalized (committed into current state) balance and order limit data +about a specified poster account. + +**Parameters:** + +| Name | Type | +| --------- | ------ | +| `address` | string | + +**Returns:** _`Promise`_ + +Balance and order limit data for the specified poster account. + +--- + +### queryValidator + +▸ **queryValidator**(`nodeId`: string): _`Promise`_ + +_Defined in [NodeClient.ts:152](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/NodeClient.ts#L152)_ + +See [`kosu_queryValidator`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#queryvalidator) + +Get finalized (committed into current state) information about a Kosu +validator node, identified by their node ID (also called Tendermint +address). + +See `NodeClient.publicKeyToNodeId()` to converting a validator's encoded +public key to it's node ID. + +**Parameters:** + +| Name | Type | +| -------- | ------ | +| `nodeId` | string | + +**Returns:** _`Promise`_ + +Information about the requested validator (see `Validator`). + +--- + +### remainingLimit + +▸ **remainingLimit**(): _`Promise`_ + +_Defined in [NodeClient.ts:169](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/NodeClient.ts#L169)_ + +See [`kosu_remainingLimit`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#remaininglimit) + +Get the total number of orders that _may_ be posted this period. It is +equal to the sum of the unutilized bandwidth allocation for each poster +account for the current rebalance period. + +**Returns:** _`Promise`_ + +The unutilized order bandwidth for the current period. + +--- + +### roundInfo + +▸ **roundInfo**(): _`Promise`_ + +_Defined in [NodeClient.ts:181](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/NodeClient.ts#L181)_ + +See [`kosu_roundInfo`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#roundinfo) + +Get the current rebalance period number, starting Ethereum block, ending +Ethereum block, and the maximum number of orders for the period. + +**Returns:** _`Promise`_ + +Information about the current rebalance period. + +--- + +### subscribeToBlocks + +▸ **subscribeToBlocks**(`cb`: function): _`Promise`_ + +_Defined in [NodeClient.ts:237](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/NodeClient.ts#L237)_ + +Read about Kosu subscriptions [here](https://docs.kosu.io/go-kosu/kosu_rpc.html#subscriptions). + +See [`kosu_subscribe` for topic `newBlocks`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#newblocks) + +Subscribe to new block events, and be updated with the full Tendermint block +after each successful commit. + +**Parameters:** + +▪ **cb**: _function_ + +A callback function to handle new rebalance information. + +▸ (`block`: any): _void_ + +**Parameters:** + +| Name | Type | +| ------- | ---- | +| `block` | any | + +**Returns:** _`Promise`_ + +A UUID that can be used to cancel the new subscription (see `node.unsubscribe()`). + +--- + +### subscribeToOrders + +▸ **subscribeToOrders**(`cb`: function): _`Promise`_ + +_Defined in [NodeClient.ts:222](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/NodeClient.ts#L222)_ + +Read about Kosu subscriptions [here](https://docs.kosu.io/go-kosu/kosu_rpc.html#subscriptions). + +See [`kosu_subscribe` for topic `newOrders`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#neworders) + +Subscribe to order transaction events, and be udpdated with an array of new +orders each time they are included in a Kosu block. + +**Parameters:** + +▪ **cb**: _function_ + +A callback function to handle each array of new orders. + +▸ (`order`: any): _void_ + +**Parameters:** + +| Name | Type | +| ------- | ---- | +| `order` | any | + +**Returns:** _`Promise`_ + +A UUID that can be used to cancel the new subscription (see `node.unsubscribe()`). + +--- + +### subscribeToRebalances + +▸ **subscribeToRebalances**(`cb`: function): _`Promise`_ + +_Defined in [NodeClient.ts:252](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/NodeClient.ts#L252)_ + +Read about Kosu subscriptions [here](https://docs.kosu.io/go-kosu/kosu_rpc.html#subscriptions). + +See [`kosu_subscribe` for topic `newRebalances`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#newrebalances) + +Subscribe to rebalance events, and be updated with each new rebalance round +information (starting block, ending block, etc.). + +**Parameters:** + +▪ **cb**: _function_ + +A callback function to handle new rebalance information. + +▸ (`roundInfo`: [RoundInfo](../interfaces/roundinfo.md)): _void_ + +**Parameters:** + +| Name | Type | +| ----------- | --------------------------------------- | +| `roundInfo` | [RoundInfo](../interfaces/roundinfo.md) | + +**Returns:** _`Promise`_ + +A UUID that can be used to cancel the new subscription (see `node.unsubscribe()`). + +--- + +### totalOrders + +▸ **totalOrders**(): _`Promise`_ + +_Defined in [NodeClient.ts:194](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/NodeClient.ts#L194)_ + +See [`kosu_totalOrders`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#totalorders) + +Get the total number of orders that have been processed by the network +since genesis. + +**Returns:** _`Promise`_ + +The total number of orders posted since network genesis. + +--- + +### unsubscribe + +▸ **unsubscribe**(`subscriptionId`: string): _`Promise`_ + +_Defined in [NodeClient.ts:261](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/NodeClient.ts#L261)_ + +Cancel an active subscription. + +**Parameters:** + +| Name | Type | Description | +| ---------------- | ------ | --------------------------------------- | +| `subscriptionId` | string | The UUID of the subscription to cancel. | + +**Returns:** _`Promise`_ + +--- + +### validators + +▸ **validators**(): _`Promise`_ + +_Defined in [NodeClient.ts:206](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/NodeClient.ts#L206)_ + +See [`kosu_validators`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#validators) + +Get finalized (committed into current state) information about the current +full validator set. Returns the full set (not paginated). + +**Returns:** _`Promise`_ + +Information about all active Kosu validators (see `Validator`). + +--- + +### `Static` publicKeyToNodeId + +▸ **publicKeyToNodeId**(`publicKey`: string): _string_ + +_Defined in [NodeClient.ts:50](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/NodeClient.ts#L50)_ + +Convert a Kosu/Tendermint public key to the corresponding node ID. + +The node ID is the first 20 bytes of the SHA-256 hash of the public key. + +**Parameters:** + +| Name | Type | Description | +| ----------- | ------ | ------------------------------------ | +| `publicKey` | string | Base64-encoded validator public key. | + +**Returns:** _string_ + +The node ID (tendermint "address") for that public key. + +## Object literals + +### `Static` DEFAULT_OPTIONS + +### ▪ **DEFAULT_OPTIONS**: _object_ + +_Defined in [NodeClient.ts:26](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/NodeClient.ts#L26)_ + +The default options specify a connection timeout of 3s, all other defaults +are inherited from `WebsocketProviderOptions`. + +### timeout + +• **timeout**: _number_ = 3000 + +_Defined in [NodeClient.ts:26](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/NodeClient.ts#L26)_ diff --git a/packages/kosu.js/docs/classes/ordergateway.md b/packages/kosu.js/docs/classes/ordergateway.md index 5757a4b4..c448f048 100644 --- a/packages/kosu.js/docs/classes/ordergateway.md +++ b/packages/kosu.js/docs/classes/ordergateway.md @@ -25,19 +25,10 @@ specified SubContract during serialization and signature generation. - [constructor](ordergateway.md#constructor) -### Properties - -- [address](ordergateway.md#private-address) -- [contract](ordergateway.md#private-contract) -- [initializing](ordergateway.md#private-initializing) -- [web3](ordergateway.md#private-web3) -- [web3Wrapper](ordergateway.md#private-web3wrapper) - ### Methods - [amountRemaining](ordergateway.md#amountremaining) - [arguments](ordergateway.md#arguments) -- [init](ordergateway.md#private-init) - [isValid](ordergateway.md#isvalid) - [participate](ordergateway.md#participate) @@ -47,7 +38,7 @@ specified SubContract during serialization and signature generation. \+ **new OrderGateway**(`options`: [KosuOptions](../interfaces/kosuoptions.md)): _[OrderGateway](ordergateway.md)_ -_Defined in [OrderGateway.ts:46](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderGateway.ts#L46)_ +_Defined in [OrderGateway.ts:46](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/OrderGateway.ts#L46)_ Create a new OrderGateway instance. @@ -59,65 +50,13 @@ Create a new OrderGateway instance. **Returns:** _[OrderGateway](ordergateway.md)_ -## Properties - -### `Private` address - -• **address**: _string_ - -_Defined in [OrderGateway.ts:40](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderGateway.ts#L40)_ - -The address of the deployed OrderGateway contract for the detected network. - ---- - -### `Private` contract - -• **contract**: _`OrderGatewayContract`_ - -_Defined in [OrderGateway.ts:46](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderGateway.ts#L46)_ - -An instance of the lower-level contract wrapper for the Kosu OrderGateway, -auto-generated from the Solidity source code. - ---- - -### `Private` initializing - -• **initializing**: _`Promise`_ - -_Defined in [OrderGateway.ts:35](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderGateway.ts#L35)_ - -A promise that resolves when initialization has completed successfully. - ---- - -### `Private` web3 - -• **web3**: _`Web3`_ - -_Defined in [OrderGateway.ts:24](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderGateway.ts#L24)_ - -An instance of `web3` used to interact with the Ethereum blockchain. - ---- - -### `Private` web3Wrapper - -• **web3Wrapper**: _`Web3Wrapper`_ - -_Defined in [OrderGateway.ts:30](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderGateway.ts#L30)_ - -An instance of a 0x `Web3Wrapper` used for some RPC calls and for certain -methods. - ## Methods ### amountRemaining ▸ **amountRemaining**(`order`: [Order](../interfaces/order.md)): _`Promise`_ -_Defined in [OrderGateway.ts:150](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderGateway.ts#L150)_ +_Defined in [OrderGateway.ts:150](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/OrderGateway.ts#L150)_ Checks amount of partial exchange tokens remaining, depending on the implementation of the SubContract specified in the supplied order. @@ -139,7 +78,7 @@ implementation of the `amountRemaining` method. ▸ **arguments**(`subContract`: string): _`Promise`_ -_Defined in [OrderGateway.ts:117](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderGateway.ts#L117)_ +_Defined in [OrderGateway.ts:117](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/OrderGateway.ts#L117)_ Read the required arguments from a deployed SubContract. @@ -155,31 +94,11 @@ The JSON array that defines the arguments for the SubContract. --- -### `Private` init - -▸ **init**(`options`: [KosuOptions](../interfaces/kosuoptions.md)): _`Promise`_ - -_Defined in [OrderGateway.ts:66](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderGateway.ts#L66)_ - -Asynchronously initializes the instance after construction. - -**Parameters:** - -| Name | Type | Description | -| --------- | ------------------------------------------- | ----------------------------------------------- | -| `options` | [KosuOptions](../interfaces/kosuoptions.md) | Instantiation options (see `KosuOptions` type). | - -**Returns:** _`Promise`_ - -A promise to await complete instantiation for further calls - ---- - ### isValid ▸ **isValid**(`order`: [Order](../interfaces/order.md)): _`Promise`_ -_Defined in [OrderGateway.ts:134](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderGateway.ts#L134)_ +_Defined in [OrderGateway.ts:134](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/OrderGateway.ts#L134)_ Checks validity of order data according the order's SubContract implementation. @@ -197,7 +116,7 @@ Checks validity of order data according the order's SubContract implementation. ▸ **participate**(`order`: [Order](../interfaces/order.md), `taker`: string): _`Promise`_ -_Defined in [OrderGateway.ts:96](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderGateway.ts#L96)_ +_Defined in [OrderGateway.ts:96](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/OrderGateway.ts#L96)_ 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.js/docs/classes/orderhelper.md b/packages/kosu.js/docs/classes/orderhelper.md index 404df376..3fd7840d 100644 --- a/packages/kosu.js/docs/classes/orderhelper.md +++ b/packages/kosu.js/docs/classes/orderhelper.md @@ -21,11 +21,6 @@ of transactions. - [constructor](orderhelper.md#constructor) -### Properties - -- [orderGateway](orderhelper.md#private-ordergateway) -- [web3](orderhelper.md#private-web3) - ### Methods - [makeOrder](orderhelper.md#makeorder) @@ -41,7 +36,7 @@ of transactions. \+ **new OrderHelper**(`web3`: `Web3`, `orderGateway`: [OrderGateway](ordergateway.md)): _[OrderHelper](orderhelper.md)_ -_Defined in [OrderHelper.ts:24](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderHelper.ts#L24)_ +_Defined in [OrderHelper.ts:24](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/OrderHelper.ts#L24)_ Create a new `OrderHelper` instance (requires a provider via supplied `web3` instance). @@ -55,33 +50,13 @@ instance). **Returns:** _[OrderHelper](orderhelper.md)_ -## Properties - -### `Private` orderGateway - -• **orderGateway**: _[OrderGateway](ordergateway.md)_ - -_Defined in [OrderHelper.ts:24](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderHelper.ts#L24)_ - -Instance of the `OrderGateway` wrapper. - ---- - -### `Private` web3 - -• **web3**: _`Web3`_ - -_Defined in [OrderHelper.ts:19](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderHelper.ts#L19)_ - -An instance of `web3` used to interact with the Ethereum blockchain. - ## Methods ### makeOrder ▸ **makeOrder**(`order`: [Order](../interfaces/order.md)): _`Promise`_ -_Defined in [OrderHelper.ts:44](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderHelper.ts#L44)_ +_Defined in [OrderHelper.ts:44](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/OrderHelper.ts#L44)_ Sign and complete a maker order (requires a pre-configured Order object). @@ -101,7 +76,7 @@ The supplied maker order with an appended `makerSignature`. ▸ **makerHex**(`order`: [Order](../interfaces/order.md)): _`Promise`_ -_Defined in [OrderHelper.ts:92](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderHelper.ts#L92)_ +_Defined in [OrderHelper.ts:92](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/OrderHelper.ts#L92)_ Generate the maker hex (serialized `makerValues`). @@ -119,7 +94,7 @@ Generate the maker hex (serialized `makerValues`). ▸ **prepareForPost**(`order`: [Order](../interfaces/order.md), `poster`: string): _`Promise`_ -_Defined in [OrderHelper.ts:73](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderHelper.ts#L73)_ +_Defined in [OrderHelper.ts:73](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/OrderHelper.ts#L73)_ Sign and order as a poster and append the poster signature to an order prior to submission to the Kosu relay network. @@ -141,7 +116,7 @@ The maker order now signed and prepared for post with an appended `posterSignatu ▸ **recoverMaker**(`order`: [Order](../interfaces/order.md)): _`Promise`_ -_Defined in [OrderHelper.ts:102](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderHelper.ts#L102)_ +_Defined in [OrderHelper.ts:102](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/OrderHelper.ts#L102)_ Recover the maker address from a signed order. @@ -159,7 +134,7 @@ Recover the maker address from a signed order. ▸ **recoverPoster**(`order`: [PostableOrder](../interfaces/postableorder.md)): _`Promise`_ -_Defined in [OrderHelper.ts:113](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderHelper.ts#L113)_ +_Defined in [OrderHelper.ts:113](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/OrderHelper.ts#L113)_ Recover the poster address from a maker order that has been signed from a poster. @@ -178,7 +153,7 @@ poster. ▸ **takeOrder**(`order`: [TakeableOrder](../interfaces/takeableorder.md), `taker`: string): _`Promise`_ -_Defined in [OrderHelper.ts:61](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderHelper.ts#L61)_ +_Defined in [OrderHelper.ts:61](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/OrderHelper.ts#L61)_ 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.js/docs/classes/posterregistry.md b/packages/kosu.js/docs/classes/posterregistry.md index 742118c4..4a686b9c 100644 --- a/packages/kosu.js/docs/classes/posterregistry.md +++ b/packages/kosu.js/docs/classes/posterregistry.md @@ -20,17 +20,8 @@ and to view their balance, as well as the cumulative lockup. - [constructor](posterregistry.md#constructor) -### Properties - -- [address](posterregistry.md#private-address) -- [contract](posterregistry.md#private-contract) -- [treasury](posterregistry.md#private-treasury) -- [web3](posterregistry.md#private-web3) -- [web3Wrapper](posterregistry.md#private-web3wrapper) - ### Methods -- [getContract](posterregistry.md#private-getcontract) - [pay](posterregistry.md#pay) - [registerTokens](posterregistry.md#registertokens) - [releaseTokens](posterregistry.md#releasetokens) @@ -43,7 +34,7 @@ and to view their balance, as well as the cumulative lockup. \+ **new PosterRegistry**(`options`: [KosuOptions](../interfaces/kosuoptions.md), `treasury`: [Treasury](treasury.md)): _[PosterRegistry](posterregistry.md)_ -_Defined in [PosterRegistry.ts:41](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/PosterRegistry.ts#L41)_ +_Defined in [PosterRegistry.ts:41](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/PosterRegistry.ts#L41)_ Create a new PosterRegistry instance. @@ -56,78 +47,13 @@ Create a new PosterRegistry instance. **Returns:** _[PosterRegistry](posterregistry.md)_ -## Properties - -### `Private` address - -• **address**: _string_ - -_Defined in [PosterRegistry.ts:41](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/PosterRegistry.ts#L41)_ - -The address of the deployed PosterRegistry proxy contract. - ---- - -### `Private` contract - -• **contract**: _`PosterRegistryContract`_ - -_Defined in [PosterRegistry.ts:36](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/PosterRegistry.ts#L36)_ - -A lower-level, auto-generated contract wrapper for the PosterRegistry -proxy contract. Generated from solidity source code. - ---- - -### `Private` treasury - -• **treasury**: _[Treasury](treasury.md)_ - -_Defined in [PosterRegistry.ts:30](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/PosterRegistry.ts#L30)_ - -An instantiated Treasury contract wrapper. - ---- - -### `Private` web3 - -• **web3**: _`Web3`_ - -_Defined in [PosterRegistry.ts:20](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/PosterRegistry.ts#L20)_ - -An instance of `web3` used to interact with the Ethereum blockchain. - ---- - -### `Private` web3Wrapper - -• **web3Wrapper**: _`Web3Wrapper`_ - -_Defined in [PosterRegistry.ts:25](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/PosterRegistry.ts#L25)_ - -The `web3Wrapper` instance with the contract's ABI loaded. - ## Methods -### `Private` getContract - -▸ **getContract**(): _`Promise`_ - -_Defined in [PosterRegistry.ts:61](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/PosterRegistry.ts#L61)_ - -Asynchronously initializes the contract instance or returns it from cache. - -**Returns:** _`Promise`_ - -The contract wrapper instance. - ---- - ### pay ▸ **pay**(`value`: `BigNumber`): _`Promise`_ -_Defined in [PosterRegistry.ts:149](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/PosterRegistry.ts#L149)_ +_Defined in [PosterRegistry.ts:149](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/PosterRegistry.ts#L149)_ Sends ether to the contract to bond and register tokens for posting. @@ -147,7 +73,7 @@ Logs from the transaction block. ▸ **registerTokens**(`amount`: `BigNumber`): _`Promise`_ -_Defined in [PosterRegistry.ts:107](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/PosterRegistry.ts#L107)_ +_Defined in [PosterRegistry.ts:107](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/PosterRegistry.ts#L107)_ Register tokens into the PosterRegistry contract by bonding KOSU tokens. @@ -167,7 +93,7 @@ A transaction receipt from the mined `register` transaction. ▸ **releaseTokens**(`amount`: `BigNumber`): _`Promise`_ -_Defined in [PosterRegistry.ts:138](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/PosterRegistry.ts#L138)_ +_Defined in [PosterRegistry.ts:138](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/PosterRegistry.ts#L138)_ Release tokens from the PosterRegistry for the `coinbase` address (un-bond). @@ -187,7 +113,7 @@ A transaction receipt from the mined `register` transaction. ▸ **tokensContributed**(): _`Promise`_ -_Defined in [PosterRegistry.ts:85](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/PosterRegistry.ts#L85)_ +_Defined in [PosterRegistry.ts:85](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/PosterRegistry.ts#L85)_ Reads total KOSU tokens contributed to registry. @@ -201,7 +127,7 @@ The total pool of locked KOSU tokens in units of wei. ▸ **tokensRegisteredFor**(`address`: string): _`Promise`_ -_Defined in [PosterRegistry.ts:96](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/PosterRegistry.ts#L96)_ +_Defined in [PosterRegistry.ts:96](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/PosterRegistry.ts#L96)_ Reads number of tokens registered for a given address. diff --git a/packages/kosu.js/docs/classes/treasury.md b/packages/kosu.js/docs/classes/treasury.md index 7cacfe85..eecf5048 100644 --- a/packages/kosu.js/docs/classes/treasury.md +++ b/packages/kosu.js/docs/classes/treasury.md @@ -25,19 +25,13 @@ constructor must include the Treasury's ABI (from the compiled Solidity source). ### Properties -- [address](treasury.md#private-address) -- [coinbase](treasury.md#private-coinbase) -- [contract](treasury.md#private-contract) - [kosuToken](treasury.md#kosutoken) -- [web3](treasury.md#private-web3) -- [web3Wrapper](treasury.md#private-web3wrapper) ### Methods - [approveTreasury](treasury.md#approvetreasury) - [currentBalance](treasury.md#currentbalance) - [deposit](treasury.md#deposit) -- [getContract](treasury.md#private-getcontract) - [pay](treasury.md#pay) - [systemBalance](treasury.md#systembalance) - [treasuryAllowance](treasury.md#treasuryallowance) @@ -49,7 +43,7 @@ constructor must include the Treasury's ABI (from the compiled Solidity source). \+ **new Treasury**(`options`: [KosuOptions](../interfaces/kosuoptions.md), `kosuToken`: [KosuToken](kosutoken.md)): _[Treasury](treasury.md)_ -_Defined in [Treasury.ts:49](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Treasury.ts#L49)_ +_Defined in [Treasury.ts:49](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Treasury.ts#L49)_ Creates a new Treasury instance. @@ -64,72 +58,21 @@ Creates a new Treasury instance. ## Properties -### `Private` address - -• **address**: _string_ - -_Defined in [Treasury.ts:44](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Treasury.ts#L44)_ - -They deployed Treasury's address for the detected networkID. - ---- - -### `Private` coinbase - -• **coinbase**: _string_ - -_Defined in [Treasury.ts:49](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Treasury.ts#L49)_ - -The user's coinbase address (if available via supplied provider). - ---- - -### `Private` contract - -• **contract**: _`TreasuryContract`_ - -_Defined in [Treasury.ts:39](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Treasury.ts#L39)_ - -A lower-level, auto-generated contract wrapper for the Treasury contract, -generated from solidity source code. - ---- - ### kosuToken • **kosuToken**: _[KosuToken](kosutoken.md)_ -_Defined in [Treasury.ts:33](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Treasury.ts#L33)_ +_Defined in [Treasury.ts:33](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Treasury.ts#L33)_ An instance of the `KosuToken` class to communicate with the KOSU ERC-20 token. ---- - -### `Private` web3 - -• **web3**: _`Web3`_ - -_Defined in [Treasury.ts:23](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Treasury.ts#L23)_ - -An instance of `web3` used to interact with the Ethereum blockchain. - ---- - -### `Private` web3Wrapper - -• **web3Wrapper**: _`Web3Wrapper`_ - -_Defined in [Treasury.ts:28](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Treasury.ts#L28)_ - -The `web3Wrapper` instance with the contract's ABI loaded. - ## Methods ### approveTreasury ▸ **approveTreasury**(`value`: `BigNumber`): _`Promise`_ -_Defined in [Treasury.ts:210](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Treasury.ts#L210)_ +_Defined in [Treasury.ts:210](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Treasury.ts#L210)_ Approve the treasury to transfer KOSU on behalf of the user's `coinbase` account. @@ -159,7 +102,7 @@ The decoded transaction receipt, after the TX has been mined. ▸ **currentBalance**(`address`: string): _`Promise`_ -_Defined in [Treasury.ts:172](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Treasury.ts#L172)_ +_Defined in [Treasury.ts:172](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Treasury.ts#L172)_ Read the available (current) treasury balance for a provided `address`. @@ -191,7 +134,7 @@ The user's current treasury balance (in wei). ▸ **deposit**(`value`: `BigNumber`): _`Promise`_ -_Defined in [Treasury.ts:99](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Treasury.ts#L99)_ +_Defined in [Treasury.ts:99](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Treasury.ts#L99)_ Deposit tokens in the treasury, from the detected `coinbase` account. @@ -216,25 +159,11 @@ The decoded transaction receipt, after the TX has been included in a block. --- -### `Private` getContract - -▸ **getContract**(): _`Promise`_ - -_Defined in [Treasury.ts:69](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Treasury.ts#L69)_ - -Asynchronously initializes the contract instance, or returns it from cache. - -**Returns:** _`Promise`_ - -The lower-level contract wrapper instance. - ---- - ### pay ▸ **pay**(`value`: `BigNumber`): _`Promise`_ -_Defined in [Treasury.ts:221](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Treasury.ts#L221)_ +_Defined in [Treasury.ts:221](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Treasury.ts#L221)_ Sends ether to the contract to bond and deposit tokens. @@ -254,7 +183,7 @@ Logs from the transaction block. ▸ **systemBalance**(`address`: string): _`Promise`_ -_Defined in [Treasury.ts:151](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Treasury.ts#L151)_ +_Defined in [Treasury.ts:151](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Treasury.ts#L151)_ Read the total system balance of KOSU for a provided `address` string. @@ -286,7 +215,7 @@ The user's total KOSU system balance, in wei. ▸ **treasuryAllowance**(): _`Promise`_ -_Defined in [Treasury.ts:191](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Treasury.ts#L191)_ +_Defined in [Treasury.ts:191](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Treasury.ts#L191)_ View the current treasury allowance for the detected `coinbase` account. @@ -311,7 +240,7 @@ The current KOSU approval for the Treasury for the current user, in wei. ▸ **withdraw**(`value`: `BigNumber`): _`Promise`_ -_Defined in [Treasury.ts:130](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Treasury.ts#L130)_ +_Defined in [Treasury.ts:130](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Treasury.ts#L130)_ Withdraw tokens from treasury to the detected `coinbase` account. diff --git a/packages/kosu.js/docs/classes/validatorregistry.md b/packages/kosu.js/docs/classes/validatorregistry.md index 530fbfd6..042e7b6c 100644 --- a/packages/kosu.js/docs/classes/validatorregistry.md +++ b/packages/kosu.js/docs/classes/validatorregistry.md @@ -16,15 +16,6 @@ Integration with ValidatorRegistry contract on an Ethereum blockchain. - [constructor](validatorregistry.md#constructor) -### Properties - -- [address](validatorregistry.md#private-address) -- [coinbase](validatorregistry.md#private-coinbase) -- [contract](validatorregistry.md#private-contract) -- [treasury](validatorregistry.md#private-treasury) -- [web3](validatorregistry.md#private-web3) -- [web3Wrapper](validatorregistry.md#private-web3wrapper) - ### Methods - [applicationPeriod](validatorregistry.md#applicationperiod) @@ -41,7 +32,6 @@ Integration with ValidatorRegistry contract on an Ethereum blockchain. - [getAllListings](validatorregistry.md#getalllistings) - [getChallenge](validatorregistry.md#getchallenge) - [getChallenges](validatorregistry.md#getchallenges) -- [getContract](validatorregistry.md#private-getcontract) - [getListing](validatorregistry.md#getlisting) - [getListings](validatorregistry.md#getlistings) - [hexToBase64](validatorregistry.md#hextobase64) @@ -62,7 +52,7 @@ Integration with ValidatorRegistry contract on an Ethereum blockchain. \+ **new ValidatorRegistry**(`options`: [KosuOptions](../interfaces/kosuoptions.md), `treasury`: [Treasury](treasury.md)): _[ValidatorRegistry](validatorregistry.md)_ -_Defined in [ValidatorRegistry.ts:18](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L18)_ +_Defined in [ValidatorRegistry.ts:18](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L18)_ Create a new ValidatorRegistry instance. @@ -75,61 +65,13 @@ Create a new ValidatorRegistry instance. **Returns:** _[ValidatorRegistry](validatorregistry.md)_ -## Properties - -### `Private` address - -• **address**: _string_ - -_Defined in [ValidatorRegistry.ts:18](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L18)_ - ---- - -### `Private` coinbase - -• **coinbase**: _string_ - -_Defined in [ValidatorRegistry.ts:16](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L16)_ - ---- - -### `Private` contract - -• **contract**: _`ValidatorRegistryContract`_ - -_Defined in [ValidatorRegistry.ts:15](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L15)_ - ---- - -### `Private` treasury - -• **treasury**: _[Treasury](treasury.md)_ - -_Defined in [ValidatorRegistry.ts:14](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L14)_ - ---- - -### `Private` web3 - -• **web3**: _`Web3`_ - -_Defined in [ValidatorRegistry.ts:13](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L13)_ - ---- - -### `Private` web3Wrapper - -• **web3Wrapper**: _`Web3Wrapper`_ - -_Defined in [ValidatorRegistry.ts:17](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L17)_ - ## Methods ### applicationPeriod ▸ **applicationPeriod**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:64](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L64)_ +_Defined in [ValidatorRegistry.ts:64](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L64)_ Reads the application period @@ -141,7 +83,7 @@ Reads the application period ▸ **challengeListing**(`_pubKey`: string, `_details`: string): _`Promise`_ -_Defined in [ValidatorRegistry.ts:256](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L256)_ +_Defined in [ValidatorRegistry.ts:256](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L256)_ Starts a challenge of a listing @@ -160,7 +102,7 @@ Starts a challenge of a listing ▸ **challengePeriod**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:80](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L80)_ +_Defined in [ValidatorRegistry.ts:80](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L80)_ Reads the challenge period @@ -172,7 +114,7 @@ Reads the challenge period ▸ **claimRewards**(`_pubKey`: string): _`Promise`_ -_Defined in [ValidatorRegistry.ts:285](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L285)_ +_Defined in [ValidatorRegistry.ts:285](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L285)_ Claims the rewards of a generating/burning listing @@ -190,7 +132,7 @@ Claims the rewards of a generating/burning listing ▸ **claimWinnings**(`challengeId`: `BigNumber`): _`Promise`_ -_Defined in [ValidatorRegistry.ts:315](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L315)_ +_Defined in [ValidatorRegistry.ts:315](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L315)_ Claims winnings from complete challenge @@ -208,7 +150,7 @@ Claims winnings from complete challenge ▸ **commitPeriod**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:72](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L72)_ +_Defined in [ValidatorRegistry.ts:72](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L72)_ Reads the commit period @@ -220,7 +162,7 @@ Reads the commit period ▸ **confirmListing**(`_pubKey`: string): _`Promise`_ -_Defined in [ValidatorRegistry.ts:245](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L245)_ +_Defined in [ValidatorRegistry.ts:245](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L245)_ Confirms listing after application period @@ -238,7 +180,7 @@ Confirms listing after application period ▸ **convertPubKey**(`_pubKey`: string): _string_ -_Defined in [ValidatorRegistry.ts:326](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L326)_ +_Defined in [ValidatorRegistry.ts:326](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L326)_ Converts public key to hex if input is not currently in hex @@ -258,7 +200,7 @@ hex encoded tendermint public key ▸ **exitPeriod**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:88](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L88)_ +_Defined in [ValidatorRegistry.ts:88](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L88)_ Reads the exit period @@ -270,7 +212,7 @@ Reads the exit period ▸ **finalizeExit**(`_pubKey`: string): _`Promise`_ -_Defined in [ValidatorRegistry.ts:305](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L305)_ +_Defined in [ValidatorRegistry.ts:305](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L305)_ Finalizes the exit of a listing @@ -288,7 +230,7 @@ Finalizes the exit of a listing ▸ **getAllChallenges**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:199](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L199)_ +_Defined in [ValidatorRegistry.ts:199](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L199)_ Reads all challenges @@ -300,7 +242,7 @@ Reads all challenges ▸ **getAllListings**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:162](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L162)_ +_Defined in [ValidatorRegistry.ts:162](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L162)_ Reads the registered listings @@ -312,7 +254,7 @@ Reads the registered listings ▸ **getChallenge**(`challengeId`: `BigNumber`): _`Promise`_ -_Defined in [ValidatorRegistry.ts:180](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L180)_ +_Defined in [ValidatorRegistry.ts:180](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L180)_ Reads the challenge by challengeId @@ -330,7 +272,7 @@ Reads the challenge by challengeId ▸ **getChallenges**(`challengeIds`: `BigNumber`[]): _`Promise`_ -_Defined in [ValidatorRegistry.ts:190](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L190)_ +_Defined in [ValidatorRegistry.ts:190](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L190)_ Reads the challenges by challengeIds @@ -344,25 +286,11 @@ Reads the challenges by challengeIds --- -### `Private` getContract - -▸ **getContract**(): _`Promise`_ - -_Defined in [ValidatorRegistry.ts:38](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L38)_ - -Asynchronously initializes the contract instance or returns it from cache - -**Returns:** _`Promise`_ - -The contract - ---- - ### getListing ▸ **getListing**(`_pubKey`: string): _`Promise`_ -_Defined in [ValidatorRegistry.ts:146](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L146)_ +_Defined in [ValidatorRegistry.ts:146](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L146)_ Reads the listing for public key @@ -380,7 +308,7 @@ Reads the listing for public key ▸ **getListings**(`_pubKeys`: string[]): _`Promise`_ -_Defined in [ValidatorRegistry.ts:154](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L154)_ +_Defined in [ValidatorRegistry.ts:154](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L154)_ Reads the requested listings @@ -398,7 +326,7 @@ Reads the requested listings ▸ **hexToBase64**(`_pubKey`: string): _string_ -_Defined in [ValidatorRegistry.ts:350](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L350)_ +_Defined in [ValidatorRegistry.ts:350](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L350)_ Converts hex encoded public key back to tendermint base64 @@ -418,7 +346,7 @@ Base64 tendermint public key ▸ **initExit**(`_pubKey`: string): _`Promise`_ -_Defined in [ValidatorRegistry.ts:295](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L295)_ +_Defined in [ValidatorRegistry.ts:295](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L295)_ Initializes an exit of a listing from the registry @@ -436,7 +364,7 @@ Initializes an exit of a listing from the registry ▸ **kosuToken**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:128](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L128)_ +_Defined in [ValidatorRegistry.ts:128](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L128)_ Reads the kosuToken address @@ -448,7 +376,7 @@ Reads the kosuToken address ▸ **listingKeys**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:136](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L136)_ +_Defined in [ValidatorRegistry.ts:136](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L136)_ Reads the current listing keys @@ -460,7 +388,7 @@ Reads the current listing keys ▸ **maxRewardRate**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:170](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L170)_ +_Defined in [ValidatorRegistry.ts:170](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L170)_ Reads the max reward rate @@ -472,7 +400,7 @@ Reads the max reward rate ▸ **minimumBalance**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:104](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L104)_ +_Defined in [ValidatorRegistry.ts:104](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L104)_ Reads the minimum balance @@ -484,7 +412,7 @@ Reads the minimum balance ▸ **registerListing**(`_pubKey`: string, `_tokensToStake`: `BigNumber`, `_rewardRate`: `BigNumber`, `_details`: string): _`Promise`_ -_Defined in [ValidatorRegistry.ts:212](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L212)_ +_Defined in [ValidatorRegistry.ts:212](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L212)_ Register a new listing @@ -505,7 +433,7 @@ Register a new listing ▸ **resolveChallenge**(`_pubKey`: string): _`Promise`_ -_Defined in [ValidatorRegistry.ts:275](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L275)_ +_Defined in [ValidatorRegistry.ts:275](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L275)_ Resolves challenge of a listing @@ -523,7 +451,7 @@ Resolves challenge of a listing ▸ **rewardPeriod**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:96](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L96)_ +_Defined in [ValidatorRegistry.ts:96](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L96)_ Reads the reward period @@ -535,7 +463,7 @@ Reads the reward period ▸ **stakeholderCut**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:112](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L112)_ +_Defined in [ValidatorRegistry.ts:112](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L112)_ Reads the stakeholder cut @@ -547,7 +475,7 @@ Reads the stakeholder cut ▸ **voting**(): _`Promise`_ -_Defined in [ValidatorRegistry.ts:120](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/ValidatorRegistry.ts#L120)_ +_Defined in [ValidatorRegistry.ts:120](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/ValidatorRegistry.ts#L120)_ Reads the Voting contract address diff --git a/packages/kosu.js/docs/classes/voting.md b/packages/kosu.js/docs/classes/voting.md index a18cdc1f..2aadd54e 100644 --- a/packages/kosu.js/docs/classes/voting.md +++ b/packages/kosu.js/docs/classes/voting.md @@ -16,20 +16,10 @@ Integration with Voting contract on an Ethereum blockchain. - [constructor](voting.md#constructor) -### Properties - -- [address](voting.md#private-address) -- [coinbase](voting.md#private-coinbase) -- [contract](voting.md#private-contract) -- [treasury](voting.md#private-treasury) -- [web3](voting.md#private-web3) -- [web3Wrapper](voting.md#private-web3wrapper) - ### Methods - [commitVote](voting.md#commitvote) - [encodeVote](voting.md#encodevote) -- [getContract](voting.md#private-getcontract) - [revealVote](voting.md#revealvote) - [totalRevealedTokens](voting.md#totalrevealedtokens) - [totalWinningTokens](voting.md#totalwinningtokens) @@ -42,7 +32,7 @@ Integration with Voting contract on an Ethereum blockchain. \+ **new Voting**(`options`: [KosuOptions](../interfaces/kosuoptions.md), `treasury`: [Treasury](treasury.md)): _[Voting](voting.md)_ -_Defined in [Voting.ts:18](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Voting.ts#L18)_ +_Defined in [Voting.ts:18](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Voting.ts#L18)_ Create a new Voting instance. @@ -55,61 +45,13 @@ Create a new Voting instance. **Returns:** _[Voting](voting.md)_ -## Properties - -### `Private` address - -• **address**: _string_ - -_Defined in [Voting.ts:16](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Voting.ts#L16)_ - ---- - -### `Private` coinbase - -• **coinbase**: _string_ - -_Defined in [Voting.ts:18](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Voting.ts#L18)_ - ---- - -### `Private` contract - -• **contract**: _any_ - -_Defined in [Voting.ts:17](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Voting.ts#L17)_ - ---- - -### `Private` treasury - -• **treasury**: _[Treasury](treasury.md)_ - -_Defined in [Voting.ts:14](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Voting.ts#L14)_ - ---- - -### `Private` web3 - -• **web3**: _`Web3`_ - -_Defined in [Voting.ts:13](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Voting.ts#L13)_ - ---- - -### `Private` web3Wrapper - -• **web3Wrapper**: _`Web3Wrapper`_ - -_Defined in [Voting.ts:15](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Voting.ts#L15)_ - ## Methods ### commitVote ▸ **commitVote**(`_pollId`: `BigNumber`, `_vote`: string, `_tokensToCommit`: `BigNumber`): _`Promise`_ -_Defined in [Voting.ts:67](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Voting.ts#L67)_ +_Defined in [Voting.ts:67](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Voting.ts#L67)_ Commits vote to voting contract @@ -129,7 +71,7 @@ Commits vote to voting contract ▸ **encodeVote**(`_voteOption`: string, `_voteSalt`: string): _string_ -_Defined in [Voting.ts:158](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Voting.ts#L158)_ +_Defined in [Voting.ts:158](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Voting.ts#L158)_ Encodes a vote by hashing the option and salt @@ -146,25 +88,11 @@ Encoded vote --- -### `Private` getContract - -▸ **getContract**(): _`Promise`_ - -_Defined in [Voting.ts:38](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Voting.ts#L38)_ - -Asynchronously initializes the contract instance or returns it from cache - -**Returns:** _`Promise`_ - -The contract - ---- - ### revealVote ▸ **revealVote**(`_pollId`: `BigNumber`, `_voteOption`: `BigNumber`, `_voteSalt`: `BigNumber`): _`Promise`_ -_Defined in [Voting.ts:96](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Voting.ts#L96)_ +_Defined in [Voting.ts:96](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Voting.ts#L96)_ Reveals vote on voting contract @@ -184,7 +112,7 @@ Reveals vote on voting contract ▸ **totalRevealedTokens**(`_pollId`: `BigNumber`): _`Promise`_ -_Defined in [Voting.ts:134](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Voting.ts#L134)_ +_Defined in [Voting.ts:134](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Voting.ts#L134)_ Reads the total winning tokens for poll @@ -202,7 +130,7 @@ Reads the total winning tokens for poll ▸ **totalWinningTokens**(`_pollId`: `BigNumber`): _`Promise`_ -_Defined in [Voting.ts:124](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Voting.ts#L124)_ +_Defined in [Voting.ts:124](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Voting.ts#L124)_ Reads the total winning tokens for poll @@ -220,7 +148,7 @@ Reads the total winning tokens for poll ▸ **userWinningTokens**(`_pollId`: `BigNumber`, `_userAddress`: string): _`Promise`_ -_Defined in [Voting.ts:145](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Voting.ts#L145)_ +_Defined in [Voting.ts:145](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Voting.ts#L145)_ Reads users winning tokens committed for poll @@ -239,7 +167,7 @@ Reads users winning tokens committed for poll ▸ **winningOption**(`_pollId`: `BigNumber`): _`Promise`_ -_Defined in [Voting.ts:114](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Voting.ts#L114)_ +_Defined in [Voting.ts:114](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Voting.ts#L114)_ Reads the winning option for poll diff --git a/packages/kosu.js/docs/globals.md b/packages/kosu.js/docs/globals.md index ee0491da..14e26e26 100644 --- a/packages/kosu.js/docs/globals.md +++ b/packages/kosu.js/docs/globals.md @@ -11,6 +11,7 @@ - [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) @@ -26,8 +27,13 @@ - [LogWithDecodedKosuArgs](interfaces/logwithdecodedkosuargs.md) - [Order](interfaces/order.md) - [OrderArgument](interfaces/orderargument.md) +- [OrderRejectionInfo](interfaces/orderrejectioninfo.md) +- [OrderValidationResult](interfaces/ordervalidationresult.md) - [PostableOrder](interfaces/postableorder.md) +- [Poster](interfaces/poster.md) +- [RoundInfo](interfaces/roundinfo.md) - [TakeableOrder](interfaces/takeableorder.md) +- [Validator](interfaces/validator.md) ### Variables @@ -51,7 +57,7 @@ • **NULL_ADDRESS**: _string_ = "0x0000000000000000000000000000000000000000" -_Defined in [utils.ts:12](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/utils.ts#L12)_ +_Defined in [utils.ts:12](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/utils.ts#L12)_ --- @@ -59,7 +65,7 @@ _Defined in [utils.ts:12](https://github.com/ParadigmFoundation/kosu-monorepo/bl • **version**: _any_ = process.env.npm_package_version || require("../package.json").version -_Defined in [Kosu.ts:17](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Kosu.ts#L17)_ +_Defined in [Kosu.ts:18](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Kosu.ts#L18)_ ## Functions @@ -67,7 +73,7 @@ _Defined in [Kosu.ts:17](https://github.com/ParadigmFoundation/kosu-monorepo/blo ▸ **\_serialize**(`_arguments`: any, `values`: any): _string_ -_Defined in [OrderSerializer.ts:8](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderSerializer.ts#L8)_ +_Defined in [OrderSerializer.ts:8](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/OrderSerializer.ts#L8)_ **Parameters:** @@ -84,7 +90,7 @@ _Defined in [OrderSerializer.ts:8](https://github.com/ParadigmFoundation/kosu-mo ▸ **toBytes32**(`value`: string): _string_ -_Defined in [utils.ts:8](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/utils.ts#L8)_ +_Defined in [utils.ts:8](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/utils.ts#L8)_ Convert an arbitrary string to a `bytes32` version. @@ -102,11 +108,11 @@ Convert an arbitrary string to a `bytes32` version. ### ▪ **KosuEndpoints**: _object_ -_Defined in [EventEmitter.ts:7](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/EventEmitter.ts#L7)_ +_Defined in [EventEmitter.ts:7](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/EventEmitter.ts#L7)_ ▪ **1**: _object_ -_Defined in [EventEmitter.ts:8](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/EventEmitter.ts#L8)_ +_Defined in [EventEmitter.ts:8](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/EventEmitter.ts#L8)_ - **http**: _string_ = `https://ethnet.zaidan.io/mainnet` @@ -114,7 +120,7 @@ _Defined in [EventEmitter.ts:8](https://github.com/ParadigmFoundation/kosu-monor ▪ **3**: _object_ -_Defined in [EventEmitter.ts:12](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/EventEmitter.ts#L12)_ +_Defined in [EventEmitter.ts:12](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/EventEmitter.ts#L12)_ - **http**: _string_ = `https://ethnet.zaidan.io/ropsten` @@ -122,7 +128,7 @@ _Defined in [EventEmitter.ts:12](https://github.com/ParadigmFoundation/kosu-mono ▪ **42**: _object_ -_Defined in [EventEmitter.ts:16](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/EventEmitter.ts#L16)_ +_Defined in [EventEmitter.ts:16](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/EventEmitter.ts#L16)_ - **http**: _string_ = `https://ethnet.zaidan.io/kovan` @@ -130,7 +136,7 @@ _Defined in [EventEmitter.ts:16](https://github.com/ParadigmFoundation/kosu-mono ▪ **6174**: _object_ -_Defined in [EventEmitter.ts:20](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/EventEmitter.ts#L20)_ +_Defined in [EventEmitter.ts:20](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/EventEmitter.ts#L20)_ - **http**: _string_ = `https://ethnet.zaidan.io/kosu` @@ -142,7 +148,7 @@ _Defined in [EventEmitter.ts:20](https://github.com/ParadigmFoundation/kosu-mono ### ▪ **OrderSerializer**: _object_ -_Defined in [OrderSerializer.ts:42](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderSerializer.ts#L42)_ +_Defined in [OrderSerializer.ts:42](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/OrderSerializer.ts#L42)_ could add to utils (or create order-utils pacakge) @@ -150,7 +156,7 @@ could add to utils (or create order-utils pacakge) ▸ **makerHex**(`order`: [Order](interfaces/order.md), `_arguments`: any): _string_ -_Defined in [OrderSerializer.ts:88](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderSerializer.ts#L88)_ +_Defined in [OrderSerializer.ts:88](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/OrderSerializer.ts#L88)_ Generate the maker hex from order @@ -167,7 +173,7 @@ Generate the maker hex from order ▸ **posterSignatureHex**(`order`: [Order](interfaces/order.md), `_arguments`: any): _string_ -_Defined in [OrderSerializer.ts:64](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderSerializer.ts#L64)_ +_Defined in [OrderSerializer.ts:64](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/OrderSerializer.ts#L64)_ Generates hex to be used for the poster signing process @@ -184,7 +190,7 @@ Generates hex to be used for the poster signing process ▸ **recoverMaker**(`order`: [Order](interfaces/order.md), `_arguments`: any[]): _string_ -_Defined in [OrderSerializer.ts:109](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderSerializer.ts#L109)_ +_Defined in [OrderSerializer.ts:109](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/OrderSerializer.ts#L109)_ Recovers the maker from the signed information @@ -201,7 +207,7 @@ Recovers the maker from the signed information ▸ **recoverPoster**(`order`: [PostableOrder](interfaces/postableorder.md), `_arguments`: any[]): _string_ -_Defined in [OrderSerializer.ts:78](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderSerializer.ts#L78)_ +_Defined in [OrderSerializer.ts:78](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/OrderSerializer.ts#L78)_ Recovers the poster from the poster signature @@ -218,7 +224,7 @@ Recovers the poster from the poster signature ▸ **serialize**(`_arguments`: any, `order`: [Order](interfaces/order.md)): _string_ -_Defined in [OrderSerializer.ts:49](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/OrderSerializer.ts#L49)_ +_Defined in [OrderSerializer.ts:49](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/OrderSerializer.ts#L49)_ Serializes the data into bytes @@ -237,15 +243,15 @@ Serializes the data into bytes ### ▪ **Signature**: _object_ -_Defined in [Signature.ts:7](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Signature.ts#L7)_ +_Defined in [Signature.ts:7](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Signature.ts#L7)_ -_Defined in [types.d.ts:45](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L45)_ +_Defined in [types.d.ts:45](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L45)_ ### generate ▸ **generate**(`web3`: `Web3`, `messageHex`: string, `signer`: string): _`Promise`_ -_Defined in [Signature.ts:16](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Signature.ts#L16)_ +_Defined in [Signature.ts:16](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Signature.ts#L16)_ Generates a signature for a message hex using calls to a provider though web3 @@ -263,7 +269,7 @@ A vrs signature ▸ **generate**(`web3`: `Web3`, `messageHex`: string, `signer`: string): _`Promise`_ -_Defined in [types.d.ts:46](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L46)_ +_Defined in [types.d.ts:46](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L46)_ **Parameters:** @@ -279,7 +285,7 @@ _Defined in [types.d.ts:46](https://github.com/ParadigmFoundation/kosu-monorepo/ ▸ **recoverAddress**(`messageHex`: any, `signature`: string): _string_ -_Defined in [Signature.ts:38](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Signature.ts#L38)_ +_Defined in [Signature.ts:38](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Signature.ts#L38)_ Recovers address from a message hex and signature @@ -294,7 +300,7 @@ Recovers address from a message hex and signature ▸ **recoverAddress**(`messageHex`: any, `signature`: string): _string_ -_Defined in [types.d.ts:48](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L48)_ +_Defined in [types.d.ts:48](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L48)_ **Parameters:** @@ -309,7 +315,7 @@ _Defined in [types.d.ts:48](https://github.com/ParadigmFoundation/kosu-monorepo/ ▸ **sign**(`web3`: `Web3`, `messageHex`: string, `signer`: string): _`Promise`_ -_Defined in [Signature.ts:56](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Signature.ts#L56)_ +_Defined in [Signature.ts:56](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Signature.ts#L56)_ Sign hex with provided address @@ -325,7 +331,7 @@ Sign hex with provided address ▸ **sign**(`web3`: `Web3`, `messageHex`: string, `signer`: string): _`Promise`_ -_Defined in [types.d.ts:49](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L49)_ +_Defined in [types.d.ts:49](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L49)_ **Parameters:** @@ -341,7 +347,7 @@ _Defined in [types.d.ts:49](https://github.com/ParadigmFoundation/kosu-monorepo/ ▸ **validate**(`messageHex`: string, `signature`: string, `signer`: string): _boolean_ -_Defined in [Signature.ts:28](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/Signature.ts#L28)_ +_Defined in [Signature.ts:28](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/Signature.ts#L28)_ Validates the signature of a messageHex is from the provided signer @@ -359,7 +365,7 @@ boolean representing if the signer in fact generated the signature with this mes ▸ **validate**(`messageHex`: string, `signature`: string, `signer`: string): _boolean_ -_Defined in [types.d.ts:47](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L47)_ +_Defined in [types.d.ts:47](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L47)_ **Parameters:** diff --git a/packages/kosu.js/docs/interfaces/kosuoptions.md b/packages/kosu.js/docs/interfaces/kosuoptions.md index 8953c0af..32570a94 100644 --- a/packages/kosu.js/docs/interfaces/kosuoptions.md +++ b/packages/kosu.js/docs/interfaces/kosuoptions.md @@ -13,10 +13,10 @@ ### Properties - [eventEmitterAddress](kosuoptions.md#optional-eventemitteraddress) +- [kosuNodeUrl](kosuoptions.md#optional-kosunodeurl) - [kosuTokenAddress](kosuoptions.md#optional-kosutokenaddress) - [networkId](kosuoptions.md#optional-networkid) - [orderGatewayAddress](kosuoptions.md#optional-ordergatewayaddress) -- [orderStreamURL](kosuoptions.md#optional-orderstreamurl) - [posterRegistryAddress](kosuoptions.md#optional-posterregistryaddress) - [provider](kosuoptions.md#optional-provider) - [treasuryAddress](kosuoptions.md#optional-treasuryaddress) @@ -31,7 +31,15 @@ • **eventEmitterAddress**? : _string_ -_Defined in [types.d.ts:10](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L10)_ +_Defined in [types.d.ts:10](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L10)_ + +--- + +### `Optional` kosuNodeUrl + +• **kosuNodeUrl**? : _string_ + +_Defined in [types.d.ts:6](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L6)_ --- @@ -39,7 +47,7 @@ _Defined in [types.d.ts:10](https://github.com/ParadigmFoundation/kosu-monorepo/ • **kosuTokenAddress**? : _string_ -_Defined in [types.d.ts:9](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L9)_ +_Defined in [types.d.ts:9](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L9)_ --- @@ -47,7 +55,7 @@ _Defined in [types.d.ts:9](https://github.com/ParadigmFoundation/kosu-monorepo/b • **networkId**? : _number | string_ -_Defined in [types.d.ts:3](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L3)_ +_Defined in [types.d.ts:3](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L3)_ --- @@ -55,15 +63,7 @@ _Defined in [types.d.ts:3](https://github.com/ParadigmFoundation/kosu-monorepo/b • **orderGatewayAddress**? : _string_ -_Defined in [types.d.ts:11](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L11)_ - ---- - -### `Optional` orderStreamURL - -• **orderStreamURL**? : _string_ - -_Defined in [types.d.ts:6](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L6)_ +_Defined in [types.d.ts:11](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L11)_ --- @@ -71,7 +71,7 @@ _Defined in [types.d.ts:6](https://github.com/ParadigmFoundation/kosu-monorepo/b • **posterRegistryAddress**? : _string_ -_Defined in [types.d.ts:12](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L12)_ +_Defined in [types.d.ts:12](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L12)_ --- @@ -79,7 +79,7 @@ _Defined in [types.d.ts:12](https://github.com/ParadigmFoundation/kosu-monorepo/ • **provider**? : _[provider](kosuoptions.md#optional-provider)_ -_Defined in [types.d.ts:2](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L2)_ +_Defined in [types.d.ts:2](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L2)_ --- @@ -87,7 +87,7 @@ _Defined in [types.d.ts:2](https://github.com/ParadigmFoundation/kosu-monorepo/b • **treasuryAddress**? : _string_ -_Defined in [types.d.ts:8](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L8)_ +_Defined in [types.d.ts:8](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L8)_ --- @@ -95,7 +95,7 @@ _Defined in [types.d.ts:8](https://github.com/ParadigmFoundation/kosu-monorepo/b • **validatorRegistryAddress**? : _string_ -_Defined in [types.d.ts:13](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L13)_ +_Defined in [types.d.ts:13](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L13)_ --- @@ -103,7 +103,7 @@ _Defined in [types.d.ts:13](https://github.com/ParadigmFoundation/kosu-monorepo/ • **votingAddress**? : _string_ -_Defined in [types.d.ts:7](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L7)_ +_Defined in [types.d.ts:7](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L7)_ --- @@ -111,7 +111,7 @@ _Defined in [types.d.ts:7](https://github.com/ParadigmFoundation/kosu-monorepo/b • **web3**? : _`Web3`_ -_Defined in [types.d.ts:4](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L4)_ +_Defined in [types.d.ts:4](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L4)_ --- @@ -119,4 +119,4 @@ _Defined in [types.d.ts:4](https://github.com/ParadigmFoundation/kosu-monorepo/b • **web3Wrapper**? : _`Web3Wrapper`_ -_Defined in [types.d.ts:5](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L5)_ +_Defined in [types.d.ts:5](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L5)_ diff --git a/packages/kosu.js/docs/interfaces/kosuutils.md b/packages/kosu.js/docs/interfaces/kosuutils.md index 079bdfdb..319b2546 100644 --- a/packages/kosu.js/docs/interfaces/kosuutils.md +++ b/packages/kosu.js/docs/interfaces/kosuutils.md @@ -24,7 +24,7 @@ • **NULL_ADDRESS**: _string_ -_Defined in [types.d.ts:42](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L42)_ +_Defined in [types.d.ts:42](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L42)_ ## Methods @@ -32,7 +32,7 @@ _Defined in [types.d.ts:42](https://github.com/ParadigmFoundation/kosu-monorepo/ ▸ **toBytes32**(`value`: string): _number | string | `BN`_ -_Defined in [types.d.ts:41](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L41)_ +_Defined in [types.d.ts:41](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L41)_ **Parameters:** diff --git a/packages/kosu.js/docs/interfaces/logwithdecodedkosuargs.md b/packages/kosu.js/docs/interfaces/logwithdecodedkosuargs.md index 71bdc52a..6091e4f1 100644 --- a/packages/kosu.js/docs/interfaces/logwithdecodedkosuargs.md +++ b/packages/kosu.js/docs/interfaces/logwithdecodedkosuargs.md @@ -30,7 +30,7 @@ • **args**: _`A`_ -_Defined in [types.d.ts:56](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L56)_ +_Defined in [types.d.ts:56](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L56)_ --- @@ -38,7 +38,7 @@ _Defined in [types.d.ts:56](https://github.com/ParadigmFoundation/kosu-monorepo/ • **decodedArgs**: _`B`_ -_Defined in [types.d.ts:57](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L57)_ +_Defined in [types.d.ts:57](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L57)_ --- @@ -46,4 +46,4 @@ _Defined in [types.d.ts:57](https://github.com/ParadigmFoundation/kosu-monorepo/ • **event**: _string_ -_Defined in [types.d.ts:55](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L55)_ +_Defined in [types.d.ts:55](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L55)_ diff --git a/packages/kosu.js/docs/interfaces/order.md b/packages/kosu.js/docs/interfaces/order.md index 59aa650e..229736a8 100644 --- a/packages/kosu.js/docs/interfaces/order.md +++ b/packages/kosu.js/docs/interfaces/order.md @@ -31,7 +31,7 @@ • **arguments**? : _any_ -_Defined in [types.d.ts:22](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L22)_ +_Defined in [types.d.ts:22](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L22)_ --- @@ -39,7 +39,7 @@ _Defined in [types.d.ts:22](https://github.com/ParadigmFoundation/kosu-monorepo/ • **id**: _any_ -_Defined in [types.d.ts:23](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L23)_ +_Defined in [types.d.ts:23](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L23)_ --- @@ -47,7 +47,7 @@ _Defined in [types.d.ts:23](https://github.com/ParadigmFoundation/kosu-monorepo/ • **maker**: _string_ -_Defined in [types.d.ts:18](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L18)_ +_Defined in [types.d.ts:18](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L18)_ --- @@ -55,7 +55,7 @@ _Defined in [types.d.ts:18](https://github.com/ParadigmFoundation/kosu-monorepo/ • **makerSignature**? : _any_ -_Defined in [types.d.ts:21](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L21)_ +_Defined in [types.d.ts:21](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L21)_ --- @@ -63,7 +63,7 @@ _Defined in [types.d.ts:21](https://github.com/ParadigmFoundation/kosu-monorepo/ • **makerValues**: _any_ -_Defined in [types.d.ts:19](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L19)_ +_Defined in [types.d.ts:19](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L19)_ --- @@ -71,7 +71,7 @@ _Defined in [types.d.ts:19](https://github.com/ParadigmFoundation/kosu-monorepo/ • **poster**: _string_ -_Defined in [types.d.ts:24](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L24)_ +_Defined in [types.d.ts:24](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L24)_ --- @@ -79,7 +79,7 @@ _Defined in [types.d.ts:24](https://github.com/ParadigmFoundation/kosu-monorepo/ • **subContract**: _string_ -_Defined in [types.d.ts:17](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L17)_ +_Defined in [types.d.ts:17](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L17)_ --- @@ -87,4 +87,4 @@ _Defined in [types.d.ts:17](https://github.com/ParadigmFoundation/kosu-monorepo/ • **takerValues**? : _any_ -_Defined in [types.d.ts:20](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L20)_ +_Defined in [types.d.ts:20](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L20)_ diff --git a/packages/kosu.js/docs/interfaces/orderargument.md b/packages/kosu.js/docs/interfaces/orderargument.md index 2002fbc5..8b0933c5 100644 --- a/packages/kosu.js/docs/interfaces/orderargument.md +++ b/packages/kosu.js/docs/interfaces/orderargument.md @@ -21,7 +21,7 @@ • **datatype**: _string_ -_Defined in [types.d.ts:37](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L37)_ +_Defined in [types.d.ts:37](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L37)_ --- @@ -29,4 +29,4 @@ _Defined in [types.d.ts:37](https://github.com/ParadigmFoundation/kosu-monorepo/ • **name**: _string_ -_Defined in [types.d.ts:36](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L36)_ +_Defined in [types.d.ts:36](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L36)_ diff --git a/packages/kosu.js/docs/interfaces/orderrejectioninfo.md b/packages/kosu.js/docs/interfaces/orderrejectioninfo.md new file mode 100644 index 00000000..aac8df89 --- /dev/null +++ b/packages/kosu.js/docs/interfaces/orderrejectioninfo.md @@ -0,0 +1,32 @@ +> **[kosu.js](../README.md)** + +[Globals](../globals.md) / [OrderRejectionInfo](orderrejectioninfo.md) / + +# Interface: OrderRejectionInfo + +## Hierarchy + +- **OrderRejectionInfo** + +## Index + +### Properties + +- [order](orderrejectioninfo.md#order) +- [reason](orderrejectioninfo.md#reason) + +## Properties + +### order + +• **order**: _string_ + +_Defined in [types.d.ts:66](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L66)_ + +--- + +### reason + +• **reason**: _string_ + +_Defined in [types.d.ts:67](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L67)_ diff --git a/packages/kosu.js/docs/interfaces/ordervalidationresult.md b/packages/kosu.js/docs/interfaces/ordervalidationresult.md new file mode 100644 index 00000000..77cd385a --- /dev/null +++ b/packages/kosu.js/docs/interfaces/ordervalidationresult.md @@ -0,0 +1,32 @@ +> **[kosu.js](../README.md)** + +[Globals](../globals.md) / [OrderValidationResult](ordervalidationresult.md) / + +# Interface: OrderValidationResult + +## Hierarchy + +- **OrderValidationResult** + +## Index + +### Properties + +- [accepted](ordervalidationresult.md#accepted) +- [rejected](ordervalidationresult.md#rejected) + +## Properties + +### accepted + +• **accepted**: _string[]_ + +_Defined in [types.d.ts:61](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L61)_ + +--- + +### rejected + +• **rejected**: _[OrderRejectionInfo](orderrejectioninfo.md)[]_ + +_Defined in [types.d.ts:62](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L62)_ diff --git a/packages/kosu.js/docs/interfaces/postableorder.md b/packages/kosu.js/docs/interfaces/postableorder.md index f65d6307..ddd197e5 100644 --- a/packages/kosu.js/docs/interfaces/postableorder.md +++ b/packages/kosu.js/docs/interfaces/postableorder.md @@ -32,7 +32,7 @@ _Inherited from [Order](order.md).[arguments](order.md#optional-arguments)_ -_Defined in [types.d.ts:22](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L22)_ +_Defined in [types.d.ts:22](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L22)_ --- @@ -42,7 +42,7 @@ _Defined in [types.d.ts:22](https://github.com/ParadigmFoundation/kosu-monorepo/ _Inherited from [Order](order.md).[id](order.md#id)_ -_Defined in [types.d.ts:23](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L23)_ +_Defined in [types.d.ts:23](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L23)_ --- @@ -52,7 +52,7 @@ _Defined in [types.d.ts:23](https://github.com/ParadigmFoundation/kosu-monorepo/ _Inherited from [Order](order.md).[maker](order.md#maker)_ -_Defined in [types.d.ts:18](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L18)_ +_Defined in [types.d.ts:18](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L18)_ --- @@ -62,7 +62,7 @@ _Defined in [types.d.ts:18](https://github.com/ParadigmFoundation/kosu-monorepo/ _Inherited from [Order](order.md).[makerSignature](order.md#optional-makersignature)_ -_Defined in [types.d.ts:21](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L21)_ +_Defined in [types.d.ts:21](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L21)_ --- @@ -72,7 +72,7 @@ _Defined in [types.d.ts:21](https://github.com/ParadigmFoundation/kosu-monorepo/ _Inherited from [Order](order.md).[makerValues](order.md#makervalues)_ -_Defined in [types.d.ts:19](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L19)_ +_Defined in [types.d.ts:19](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L19)_ --- @@ -82,7 +82,7 @@ _Defined in [types.d.ts:19](https://github.com/ParadigmFoundation/kosu-monorepo/ _Inherited from [Order](order.md).[poster](order.md#poster)_ -_Defined in [types.d.ts:24](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L24)_ +_Defined in [types.d.ts:24](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L24)_ --- @@ -90,7 +90,7 @@ _Defined in [types.d.ts:24](https://github.com/ParadigmFoundation/kosu-monorepo/ • **posterSignature**: _string_ -_Defined in [types.d.ts:28](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L28)_ +_Defined in [types.d.ts:28](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L28)_ --- @@ -100,7 +100,7 @@ _Defined in [types.d.ts:28](https://github.com/ParadigmFoundation/kosu-monorepo/ _Inherited from [Order](order.md).[subContract](order.md#subcontract)_ -_Defined in [types.d.ts:17](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L17)_ +_Defined in [types.d.ts:17](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L17)_ --- @@ -110,4 +110,4 @@ _Defined in [types.d.ts:17](https://github.com/ParadigmFoundation/kosu-monorepo/ _Inherited from [Order](order.md).[takerValues](order.md#optional-takervalues)_ -_Defined in [types.d.ts:20](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L20)_ +_Defined in [types.d.ts:20](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L20)_ diff --git a/packages/kosu.js/docs/interfaces/poster.md b/packages/kosu.js/docs/interfaces/poster.md new file mode 100644 index 00000000..f0e8587b --- /dev/null +++ b/packages/kosu.js/docs/interfaces/poster.md @@ -0,0 +1,32 @@ +> **[kosu.js](../README.md)** + +[Globals](../globals.md) / [Poster](poster.md) / + +# Interface: Poster + +## Hierarchy + +- **Poster** + +## Index + +### Properties + +- [balance](poster.md#balance) +- [limit](poster.md#limit) + +## Properties + +### balance + +• **balance**: _number_ + +_Defined in [types.d.ts:71](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L71)_ + +--- + +### limit + +• **limit**: _number_ + +_Defined in [types.d.ts:72](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L72)_ diff --git a/packages/kosu.js/docs/interfaces/roundinfo.md b/packages/kosu.js/docs/interfaces/roundinfo.md new file mode 100644 index 00000000..b57a6b0d --- /dev/null +++ b/packages/kosu.js/docs/interfaces/roundinfo.md @@ -0,0 +1,50 @@ +> **[kosu.js](../README.md)** + +[Globals](../globals.md) / [RoundInfo](roundinfo.md) / + +# Interface: RoundInfo + +## Hierarchy + +- **RoundInfo** + +## Index + +### Properties + +- [endsAt](roundinfo.md#endsat) +- [limit](roundinfo.md#limit) +- [number](roundinfo.md#number) +- [startsAt](roundinfo.md#startsat) + +## Properties + +### endsAt + +• **endsAt**: _number_ + +_Defined in [types.d.ts:90](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L90)_ + +--- + +### limit + +• **limit**: _number_ + +_Defined in [types.d.ts:91](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L91)_ + +--- + +### number + +• **number**: _number_ + +_Defined in [types.d.ts:88](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L88)_ + +--- + +### startsAt + +• **startsAt**: _number_ + +_Defined in [types.d.ts:89](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L89)_ diff --git a/packages/kosu.js/docs/interfaces/takeableorder.md b/packages/kosu.js/docs/interfaces/takeableorder.md index 9e07d14a..217212b9 100644 --- a/packages/kosu.js/docs/interfaces/takeableorder.md +++ b/packages/kosu.js/docs/interfaces/takeableorder.md @@ -31,7 +31,7 @@ _Inherited from [Order](order.md).[arguments](order.md#optional-arguments)_ -_Defined in [types.d.ts:22](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L22)_ +_Defined in [types.d.ts:22](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L22)_ --- @@ -41,7 +41,7 @@ _Defined in [types.d.ts:22](https://github.com/ParadigmFoundation/kosu-monorepo/ _Inherited from [Order](order.md).[id](order.md#id)_ -_Defined in [types.d.ts:23](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L23)_ +_Defined in [types.d.ts:23](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L23)_ --- @@ -51,7 +51,7 @@ _Defined in [types.d.ts:23](https://github.com/ParadigmFoundation/kosu-monorepo/ _Inherited from [Order](order.md).[maker](order.md#maker)_ -_Defined in [types.d.ts:18](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L18)_ +_Defined in [types.d.ts:18](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L18)_ --- @@ -61,7 +61,7 @@ _Defined in [types.d.ts:18](https://github.com/ParadigmFoundation/kosu-monorepo/ _Inherited from [Order](order.md).[makerSignature](order.md#optional-makersignature)_ -_Defined in [types.d.ts:21](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L21)_ +_Defined in [types.d.ts:21](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L21)_ --- @@ -71,7 +71,7 @@ _Defined in [types.d.ts:21](https://github.com/ParadigmFoundation/kosu-monorepo/ _Inherited from [Order](order.md).[makerValues](order.md#makervalues)_ -_Defined in [types.d.ts:19](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L19)_ +_Defined in [types.d.ts:19](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L19)_ --- @@ -81,7 +81,7 @@ _Defined in [types.d.ts:19](https://github.com/ParadigmFoundation/kosu-monorepo/ _Inherited from [Order](order.md).[poster](order.md#poster)_ -_Defined in [types.d.ts:24](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L24)_ +_Defined in [types.d.ts:24](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L24)_ --- @@ -91,7 +91,7 @@ _Defined in [types.d.ts:24](https://github.com/ParadigmFoundation/kosu-monorepo/ _Inherited from [Order](order.md).[subContract](order.md#subcontract)_ -_Defined in [types.d.ts:17](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L17)_ +_Defined in [types.d.ts:17](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L17)_ --- @@ -101,4 +101,4 @@ _Defined in [types.d.ts:17](https://github.com/ParadigmFoundation/kosu-monorepo/ _Overrides [Order](order.md).[takerValues](order.md#optional-takervalues)_ -_Defined in [types.d.ts:32](https://github.com/ParadigmFoundation/kosu-monorepo/blob/c134674/packages/kosu.js/src/types.d.ts#L32)_ +_Defined in [types.d.ts:32](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L32)_ diff --git a/packages/kosu.js/docs/interfaces/validator.md b/packages/kosu.js/docs/interfaces/validator.md new file mode 100644 index 00000000..9f34ab73 --- /dev/null +++ b/packages/kosu.js/docs/interfaces/validator.md @@ -0,0 +1,95 @@ +> **[kosu.js](../README.md)** + +[Globals](../globals.md) / [Validator](validator.md) / + +# Interface: Validator + +## Hierarchy + +- **Validator** + +## Index + +### Properties + +- [active](validator.md#active) +- [applied](validator.md#applied) +- [balance](validator.md#balance) +- [firstVote](validator.md#firstvote) +- [lastProposed](validator.md#lastproposed) +- [lastVoted](validator.md#lastvoted) +- [power](validator.md#power) +- [publicKey](validator.md#publickey) +- [totalVotes](validator.md#totalvotes) + +## Properties + +### active + +• **active**: _number_ + +_Defined in [types.d.ts:83](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L83)_ + +--- + +### applied + +• **applied**: _number_ + +_Defined in [types.d.ts:84](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L84)_ + +--- + +### balance + +• **balance**: _number_ + +_Defined in [types.d.ts:76](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L76)_ + +--- + +### firstVote + +• **firstVote**: _number_ + +_Defined in [types.d.ts:79](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L79)_ + +--- + +### lastProposed + +• **lastProposed**: _number_ + +_Defined in [types.d.ts:81](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L81)_ + +--- + +### lastVoted + +• **lastVoted**: _number_ + +_Defined in [types.d.ts:80](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L80)_ + +--- + +### power + +• **power**: _number_ + +_Defined in [types.d.ts:77](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L77)_ + +--- + +### publicKey + +• **publicKey**: _string_ + +_Defined in [types.d.ts:78](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L78)_ + +--- + +### totalVotes + +• **totalVotes**: _number_ + +_Defined in [types.d.ts:82](https://github.com/ParadigmFoundation/kosu-monorepo/blob/4048650/packages/kosu.js/src/types.d.ts#L82)_ diff --git a/packages/kosu.js/package.json b/packages/kosu.js/package.json index a63c51d0..c995a3d7 100644 --- a/packages/kosu.js/package.json +++ b/packages/kosu.js/package.json @@ -12,6 +12,7 @@ "test:ganache_detached": "docker run --rm -d -p 8545:8545 ${npm_package_config_ganache_image_uri}", "build": "tsc", "lint": "tslint -p .", + "lint:fix": "tslint -p . --fix", "docs": "typedoc ./src" }, "repository": { @@ -27,6 +28,7 @@ }, "dependencies": { "@0x/utils": "^4.3.1", + "@0x/web3-providers-fork": "^0.0.7", "@0x/web3-wrapper": "^6.0.5", "@babel/core": "^7.4.4", "@kosu/system-contracts": "^0.1.6", @@ -36,14 +38,17 @@ "ethereumjs-abi": "^0.6.6", "ethereumjs-util": "^5.2.0", "isomorphic-ws": "^4.0.1", + "lodash": "^4.17.15", "node-fetch": "^2.2.0", + "uuid": "^3.3.3", "web3": "1.2.0", "web3-provider-engine": "15.0.0", "web3-utils": "1.2.0", - "ws": "^6.1.4" + "ws": "^7.1.2" }, "devDependencies": { "@istanbuljs/nyc-config-typescript": "^0.1.3", + "@types/ws": "^6.0.2", "nyc": "^14.1.1", "simple-mock": "^0.8.0", "source-map-support": "^0.5.12", diff --git a/packages/kosu.js/src/Kosu.ts b/packages/kosu.js/src/Kosu.ts index 99057f5e..85322e01 100644 --- a/packages/kosu.js/src/Kosu.ts +++ b/packages/kosu.js/src/Kosu.ts @@ -4,6 +4,7 @@ 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"; @@ -46,6 +47,16 @@ 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 /** @@ -158,6 +169,11 @@ 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.Signature = Signature; diff --git a/packages/kosu.js/src/NodeClient.ts b/packages/kosu.js/src/NodeClient.ts new file mode 100644 index 00000000..e3b9bb02 --- /dev/null +++ b/packages/kosu.js/src/NodeClient.ts @@ -0,0 +1,285 @@ +import { BigNumber } from "@0x/utils"; +import { WebsocketProvider, WebsocketProviderOptions } from "@0x/web3-providers-fork"; +import assert from "assert"; +import { createHash } from "crypto"; +import { isFunction, isString } from "lodash"; +import uuid from "uuid/v4"; + +/** + * A simple JSONRPC/WebSocket client for the `go-kosu` JSONRPC-API. Supports the + * full Kosu JSONRPC, including subscriptions. + * + * It is built on the [web3](https://www.npmjs.com/package/web3) `WebSocketProvider` + * JSONRPC client, through a more desirable fork provided by [0x.](https://0x.org) + * As such, it can be configured with the same options supported by the underlying + * client. + * + * It must be initialized with the URL of a `go-kosu` node serving the JSONRPC + * over WebSocket. + * + * View the Kosu RPC documentation [here.](https://docs.kosu.io/go-kosu/kosu_rpc.html) + */ +export class NodeClient { + /** + * The default options specify a connection timeout of 3s, all other defaults + * are inherited from `WebsocketProviderOptions`. + */ + public static DEFAULT_OPTIONS: WebsocketProviderOptions = { timeout: 3000 }; + + /** + * Kosu validator public key's are 32 bytes long. + */ + public static PUBLIC_KEY_LENGTH = 32; + + /** + * Kosu validator node IDs are the first 20 bytes of the SHA-256 hash of the + * public key. + */ + public static NODE_ID_HASH_OFFSET = 20; + + private readonly _provider: WebsocketProvider; + private readonly _subscriptionIdMap: { [uuid: string]: string }; + + /** + * Convert a Kosu/Tendermint public key to the corresponding node ID. + * + * The node ID is the first 20 bytes of the SHA-256 hash of the public key. + * + * @param publicKey Base64-encoded validator public key. + * @returns The node ID (tendermint "address") for that public key. + */ + public static publicKeyToNodeId(publicKey: string): string { + const pub = Buffer.from(publicKey, "base64"); + assert.equal(pub.length, NodeClient.PUBLIC_KEY_LENGTH, "invalid public key"); + + const hash = createHash("SHA256").update(pub); + const digest = hash.digest(); + const nodeId = digest.slice(0, NodeClient.NODE_ID_HASH_OFFSET); + return nodeId.toString("hex"); + } + + private static _convertValidatorData(...rawValidators: any[]): Validator[] { + const validators = []; + for (const validator of rawValidators) { + // HACK: protobuf nests the balance as `balance: "value: N"` + const balance = new BigNumber(validator.balance.split(": ")[1]); + validators.push({ ...validator, balance }); + } + return validators; + } + + /** + * Create a new NodeClient (`node`) via a connection to a Kosu node serving + * the Kosu JSONRPC/WebSocket. + * + * @param url Full URL to the Kosu node's WebSocket JSONRPC endpoint. + * @param options Options to provide the underlying `WebSocketProvider`. + * @example + * ```typescript + * // create a node client (with a request/connection timeout of 1s) + * const node = new NodeClient("wss://localhost:14342", { timeout: 1000 }); + * ``` + */ + constructor(url: string, options?: WebsocketProviderOptions) { + this._provider = new WebsocketProvider(url, options || NodeClient.DEFAULT_OPTIONS); + this._subscriptionIdMap = {}; + } + + /** + * See [`kosu_addOrders`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#addorders) + * + * Submit poster-signed orders to the Kosu node to be subsequently proposed + * to the network. In order for them to be accepted, they must have signatures + * from valid posters who have bonded Kosu tokens. + * + * See the `posterRegistry.registerTokens()` method to bond KOSU. + * + * @param orders Orders to submit to the node as subsequent arguments. + * @returns Validation results from the Kosu node, and/or the transaction + * ID's of the accepted orders. + */ + public async addOrders(...orders: any[]): Promise { + return this._call("kosu_addOrders", ...orders); + } + + /** + * See [`kosu_latestHeight`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#latestheight) + * + * Get the height of the most recently committed and finalized Kosu block. + * + * @returns The most recent Kosu block number. + */ + public async latestHeight(): Promise { + return this._call("kosu_latestHeight"); + } + + /** + * See [`kosu_numberPosters`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#numberposters) + * + * Get the total number registered posters from the Kosu node. + * + * @returns The total number of poster accounts the node is tracking. + */ + public async numberPosters(): Promise { + return this._call("kosu_numberPosters"); + } + + /** + * See [`kosu_queryPoster`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#queryposter) + * + * Get finalized (committed into current state) balance and order limit data + * about a specified poster account. + * + * @returns Balance and order limit data for the specified poster account. + */ + public async queryPoster(address: string): Promise { + assert(/^0x[a-fA-F0-9]{40}$/.test(address), "invalid Ethereum address string"); + const raw = await this._call("kosu_queryPoster", address.toLowerCase()); + + // HACK: dealing with protobuf `balance: 'value: N'` encoding + const balance = new BigNumber(raw.balance.split(": ")[1]); + return { ...raw, balance }; + } + + /** + * See [`kosu_queryValidator`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#queryvalidator) + * + * Get finalized (committed into current state) information about a Kosu + * validator node, identified by their node ID (also called Tendermint + * address). + * + * See `NodeClient.publicKeyToNodeId()` to converting a validator's encoded + * public key to it's node ID. + * + * @returns Information about the requested validator (see `Validator`). + */ + public async queryValidator(nodeId: string): Promise { + assert(/^[a-fA-F0-9]{40}$/.test(nodeId), "invalid nodeId string"); + + // hack: dealing with protobuf decoding issues + const raw = await this._call("kosu_queryValidator", nodeId); + return NodeClient._convertValidatorData(raw)[0]; + } + + /** + * See [`kosu_remainingLimit`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#remaininglimit) + * + * Get the total number of orders that _may_ be posted this period. It is + * equal to the sum of the unutilized bandwidth allocation for each poster + * account for the current rebalance period. + * + * @returns The unutilized order bandwidth for the current period. + */ + public async remainingLimit(): Promise { + return this._call("kosu_remainingLimit"); + } + + /** + * See [`kosu_roundInfo`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#roundinfo) + * + * Get the current rebalance period number, starting Ethereum block, ending + * Ethereum block, and the maximum number of orders for the period. + * + * @returns Information about the current rebalance period. + */ + public async roundInfo(): Promise { + const { number: num, limit: lim, starts_at: startsAt, ends_at: endsAt } = await this._call("kosu_roundInfo"); + return { number: num, limit: lim, startsAt, endsAt }; + } + + /** + * See [`kosu_totalOrders`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#totalorders) + * + * Get the total number of orders that have been processed by the network + * since genesis. + * + * @returns The total number of orders posted since network genesis. + */ + public async totalOrders(): Promise { + return this._call("kosu_totalOrders"); + } + + /** + * See [`kosu_validators`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#validators) + * + * Get finalized (committed into current state) information about the current + * full validator set. Returns the full set (not paginated). + * + * @returns Information about all active Kosu validators (see `Validator`). + */ + public async validators(): Promise { + const rawValidators = await this._call("kosu_validators"); + return NodeClient._convertValidatorData(...rawValidators); + } + + /** + * Read about Kosu subscriptions [here](https://docs.kosu.io/go-kosu/kosu_rpc.html#subscriptions). + * + * See [`kosu_subscribe` for topic `newOrders`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#neworders) + * + * Subscribe to order transaction events, and be udpdated with an array of new + * orders each time they are included in a Kosu block. + * + * @param cb A callback function to handle each array of new orders. + * @returns A UUID that can be used to cancel the new subscription (see `node.unsubscribe()`). + */ + public async subscribeToOrders(cb: (order: any) => void): Promise { + return this._subscribe("newOrders", (res: any) => cb(res.result.transaction_order)); + } + + /** + * Read about Kosu subscriptions [here](https://docs.kosu.io/go-kosu/kosu_rpc.html#subscriptions). + * + * See [`kosu_subscribe` for topic `newBlocks`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#newblocks) + * + * Subscribe to new block events, and be updated with the full Tendermint block + * after each successful commit. + * + * @param cb A callback function to handle new rebalance information. + * @returns A UUID that can be used to cancel the new subscription (see `node.unsubscribe()`). + */ + public async subscribeToBlocks(cb: (block: any) => void): Promise { + return this._subscribe("newBlocks", (res: any) => cb(res.result.block)); + } + + /** + * Read about Kosu subscriptions [here](https://docs.kosu.io/go-kosu/kosu_rpc.html#subscriptions). + * + * See [`kosu_subscribe` for topic `newRebalances`.](https://docs.kosu.io/go-kosu/kosu_rpc.html#newrebalances) + * + * Subscribe to rebalance events, and be updated with each new rebalance round + * information (starting block, ending block, etc.). + * + * @param cb A callback function to handle new rebalance information. + * @returns A UUID that can be used to cancel the new subscription (see `node.unsubscribe()`). + */ + public async subscribeToRebalances(cb: (roundInfo: RoundInfo) => void): Promise { + return this._subscribe("newRebalances", (res: any) => cb(res.result.round_info)); + } + + /** + * Cancel an active subscription. + * + * @param subscriptionId The UUID of the subscription to cancel. + */ + public async unsubscribe(subscriptionId: string): Promise { + assert(isString(subscriptionId), "subscriptionId must be a string"); + await this._call("kosu_unsubscribe", this._subscriptionIdMap[subscriptionId]); + } + + private async _call(method: string, ...params: any[]): Promise { + assert(isString(method), "method must be a string"); + return this._provider.send(method, params || []); + } + + private async _subscribe(topic: string, cb: (...args: any) => any): Promise { + assert(isString(topic), "topic must be a string"); + assert(isFunction(cb), "cb must be a function"); + + const kosuSubscriptionId = await this._provider.subscribe("kosu_subscribe", topic, []); + const mappingId = uuid(); + this._subscriptionIdMap[mappingId] = kosuSubscriptionId; + this._provider.on(kosuSubscriptionId, cb as any); + return mappingId; + } +} diff --git a/packages/kosu.js/src/index.ts b/packages/kosu.js/src/index.ts index 354c74a7..6d0e2f24 100644 --- a/packages/kosu.js/src/index.ts +++ b/packages/kosu.js/src/index.ts @@ -11,3 +11,4 @@ export { NULL_ADDRESS, toBytes32 } from "./utils"; export { ValidatorRegistry } from "./ValidatorRegistry"; export { Voting } from "./Voting"; export { OrderSerializer } from "./OrderSerializer"; +export { NodeClient } from "./NodeClient"; diff --git a/packages/kosu.js/src/types.d.ts b/packages/kosu.js/src/types.d.ts index 8666ded4..6e5bf24b 100644 --- a/packages/kosu.js/src/types.d.ts +++ b/packages/kosu.js/src/types.d.ts @@ -3,7 +3,7 @@ interface KosuOptions { networkId?: number | string; web3?: Web3; web3Wrapper?: Web3Wrapper; - orderStreamURL?: string; + kosuNodeUrl?: string; votingAddress?: string; treasuryAddress?: string; kosuTokenAddress?: string; @@ -56,3 +56,37 @@ interface LogWithDecodedKosuArgs extends LogWithDecodedArgs { args: A; decodedArgs: B; } + +interface OrderValidationResult { + accepted: string[]; + rejected: OrderRejectionInfo[]; +} + +interface OrderRejectionInfo { + order: string; + reason: string; +} + +interface Poster { + balance: BigNumber; + limit: number; +} + +interface Validator { + balance: BigNumber; + power: number; + publicKey: string; + firstVote: number; + lastVoted: number; + lastProposed: number; + totalVotes: number; + active: number; + applied: number; +} + +interface RoundInfo { + number: number; + startsAt: number; + endsAt: number; + limit: number; +} diff --git a/packages/kosu.js/tsconfig.json b/packages/kosu.js/tsconfig.json index c68a8544..cf59eb0d 100644 --- a/packages/kosu.js/tsconfig.json +++ b/packages/kosu.js/tsconfig.json @@ -6,7 +6,7 @@ "resolveJsonModule": true, "sourceMap": true, "moduleResolution": "node", - "typeRoots": ["node_modules/@types"] + "typeRoots": ["node_modules/@types", "node_modules/@0x/typescript-typings/types"] }, "include": ["./src/**/*", "../kosu-system-contracts/src/types.d.ts"] } diff --git a/packages/kosu.js/typedoc.json b/packages/kosu.js/typedoc.json index 3d5749b5..c94033e7 100644 --- a/packages/kosu.js/typedoc.json +++ b/packages/kosu.js/typedoc.json @@ -4,6 +4,7 @@ "readme": "./README.md", "theme": "markdown", "out": "./docs", + "excludePrivate": true, "excludeExternals": true, "ignoreCompilerErrors": true, "includeDeclarations": true diff --git a/yarn.lock b/yarn.lock index 9318dbaf..e3bd6a47 100644 --- a/yarn.lock +++ b/yarn.lock @@ -544,6 +544,23 @@ js-sha3 "^0.7.0" lodash "^4.17.11" +"@0x/web3-providers-fork@^0.0.7": + version "0.0.7" + resolved "https://registry.yarnpkg.com/@0x/web3-providers-fork/-/web3-providers-fork-0.0.7.tgz#9cf40ebb6a2aa230283c5accb195d92594bb0aa7" + integrity sha512-TB8Y/VY0RBXzkuP5Tzv5WdXIOjx0YMa/1tPe/7v4nP3z0CjlKWoXuD9PXUIQv1qlLx1sGR5/mf+XcjruYfnWoA== + dependencies: + "@babel/runtime" "^7.3.1" + "@types/node" "^10.12.18" + eventemitter3 "3.1.0" + lodash "^4.17.11" + url-parse "1.4.4" + web3-core "2.0.0-alpha" + web3-core-helpers "2.0.0-alpha" + web3-core-method "2.0.0-alpha" + web3-utils "2.0.0-alpha" + websocket "^1.0.28" + xhr2-cookies "1.1.0" + "@0x/web3-wrapper@^6.0.5", "@0x/web3-wrapper@^6.0.8": version "6.0.8" resolved "https://registry.yarnpkg.com/@0x/web3-wrapper/-/web3-wrapper-6.0.8.tgz#04515c902aeb8253af93d0babfcf19337129f4db" @@ -1756,6 +1773,13 @@ core-js "^2.5.3" regenerator-runtime "^0.11.1" +"@babel/runtime@^7.3.1": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.5.5.tgz#74fba56d35efbeca444091c7850ccd494fd2f132" + integrity sha512-28QvEGyQyNkB0/m2B4FU7IEZGK2NUrcMtT6BZEFALTguLk+AUT6ofsHtPk5QyjAdUkpMJ+/Em+quwz4HOt30AQ== + dependencies: + regenerator-runtime "^0.13.2" + "@babel/template@7.0.0-beta.47": version "7.0.0-beta.47" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.47.tgz#0473970a7c0bee7a1a18c1ca999d3ba5e5bad83d" @@ -2657,7 +2681,7 @@ dependencies: defer-to-connect "^1.0.1" -"@types/bn.js@*", "@types/bn.js@^4.11.0": +"@types/bn.js@*", "@types/bn.js@^4.11.0", "@types/bn.js@^4.11.4": version "4.11.5" resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-4.11.5.tgz#40e36197433f78f807524ec623afcf0169ac81dc" dependencies: @@ -2768,10 +2792,20 @@ version "12.6.8" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.6.8.tgz#e469b4bf9d1c9832aee4907ba8a051494357c12c" +"@types/node@^10.12.18": + version "10.14.16" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.16.tgz#4d690c96cbb7b2728afea0e260d680501b3da5cf" + integrity sha512-/opXIbfn0P+VLt+N8DE4l8Mn8rbhiJgabU96ZJ0p9mxOkIks5gh6RUnpHak7Yh0SFkyjO/ODbxsQQPV2bpMmyA== + "@types/node@^10.3.2": version "10.14.13" resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.13.tgz#ac786d623860adf39a3f51d629480aacd6a6eec7" +"@types/node@^12.6.1": + version "12.7.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.2.tgz#c4e63af5e8823ce9cc3f0b34f7b998c2171f0c44" + integrity sha512-dyYO+f6ihZEtNPDcWNR1fkoTDf3zAK3lAABDze3mz6POyIercH0lEUawUFXlG8xaQZmm1yEBON/4TsYv/laDYg== + "@types/prop-types@*": version "15.7.1" resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.1.tgz#f1a11e7babb0c3cad68100be381d1e064c68f1f6" @@ -2800,6 +2834,13 @@ dependencies: "@types/ethereum-protocol" "*" +"@types/ws@^6.0.2": + version "6.0.2" + resolved "https://registry.yarnpkg.com/@types/ws/-/ws-6.0.2.tgz#f3340f7e3d7a07104a5dbcaa8ada4e8d2d45eecb" + integrity sha512-22XiR1ox9LftTaAtn/c5JCninwc7moaqbkJfaDUb7PkaUitcf5vbTZHdq9dxSMviCm9C3W85rzB8e6yNR70apQ== + dependencies: + "@types/node" "*" + "@types/yargs@^11.0.0": version "11.1.2" resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-11.1.2.tgz#fd4b676846fe731a5de5c6d2e5ef6a377262fc30" @@ -3457,6 +3498,11 @@ async-eventemitter@^0.2.2: dependencies: async "^2.4.0" +async-limiter@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" + integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== + async-limiter@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8" @@ -6601,6 +6647,15 @@ eth-lib@0.2.7: elliptic "^6.4.0" xhr-request-promise "^0.1.2" +eth-lib@0.2.8: + version "0.2.8" + resolved "https://registry.yarnpkg.com/eth-lib/-/eth-lib-0.2.8.tgz#b194058bef4b220ad12ea497431d6cb6aa0623c8" + integrity sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw== + dependencies: + bn.js "^4.11.6" + elliptic "^6.4.0" + xhr-request-promise "^0.1.2" + eth-lightwallet@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/eth-lightwallet/-/eth-lightwallet-3.0.1.tgz#297022932aa568f4e4eb0873bff257f5e5b78709" @@ -6845,7 +6900,7 @@ ethers@~4.0.4: uuid "2.0.1" xmlhttprequest "1.8.0" -ethjs-unit@0.1.6: +ethjs-unit@0.1.6, ethjs-unit@^0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/ethjs-unit/-/ethjs-unit-0.1.6.tgz#c665921e476e87bce2a9d588a6fe0405b2c41699" dependencies: @@ -6863,6 +6918,11 @@ eventemitter3@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-1.1.1.tgz#47786bdaa087caf7b1b75e73abc5c7d540158cd0" +eventemitter3@3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.0.tgz#090b4d6cdbd645ed10bf750d4b5407942d7ba163" + integrity sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA== + eventemitter3@3.1.2, eventemitter3@^3.0.0, eventemitter3@^3.1.0: version "3.1.2" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" @@ -12195,7 +12255,7 @@ querystring@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" -querystringify@^2.1.1: +querystringify@^2.0.0, querystringify@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.1.1.tgz#60e5a5fd64a7f8bfa4d2ab2ed6fdf4c85bad154e" @@ -12211,7 +12271,7 @@ randomatic@^3.0.0: kind-of "^6.0.0" math-random "^1.0.1" -randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.0.6: +randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.0.6, randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" dependencies: @@ -12463,6 +12523,11 @@ regenerator-runtime@^0.11.0, regenerator-runtime@^0.11.1: version "0.11.1" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" +regenerator-runtime@^0.13.2: + version "0.13.3" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz#7cf6a77d8f5c6f60eb73c5fc1955b2ceb01e6bf5" + integrity sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw== + regenerator-transform@^0.10.0: version "0.10.1" resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.10.1.tgz#1e4996837231da8b7f3cf4114d71b5691a0680dd" @@ -14734,6 +14799,14 @@ url-parse-lax@^3.0.0: dependencies: prepend-http "^2.0.0" +url-parse@1.4.4: + version "1.4.4" + resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.4.4.tgz#cac1556e95faa0303691fec5cf9d5a1bc34648f8" + integrity sha512-/92DTTorg4JjktLNLe6GPS2/RvAd/RGr6LuktmWSMLEOa6rjnlrFXNgSbSmkNvCoL2T028A0a1JaJLzRMlFoHg== + dependencies: + querystringify "^2.0.0" + requires-port "^1.0.0" + url-parse@^1.4.3: version "1.4.7" resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.4.7.tgz#a8a83535e8c00a316e403a5db4ac1b9b853ae278" @@ -14833,6 +14906,11 @@ uuid@3.3.2, uuid@^3.0.1, uuid@^3.1.0, uuid@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" +uuid@^3.3.3: + version "3.3.3" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" + integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== + v8-compile-cache@2.0.3, v8-compile-cache@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.0.3.tgz#00f7494d2ae2b688cfe2899df6ed2c54bef91dbe" @@ -15115,6 +15193,17 @@ web3-core-helpers@1.2.0: web3-eth-iban "1.2.0" web3-utils "1.2.0" +web3-core-helpers@2.0.0-alpha: + version "2.0.0-alpha" + resolved "https://registry.yarnpkg.com/web3-core-helpers/-/web3-core-helpers-2.0.0-alpha.tgz#76d720e50a6d5fbf91761a350060cc155fa9e3d3" + integrity sha512-zTeVHIoa4ih7PWFWJX2giqivDMOoD/cX3XHlNcghgdfsyhuf17ktar6003c1QxrvRXmV8HMlBorcZjYzYuTsiA== + dependencies: + "@babel/runtime" "^7.3.1" + lodash "^4.17.11" + web3-core "2.0.0-alpha" + web3-eth-iban "2.0.0-alpha" + web3-utils "2.0.0-alpha" + web3-core-method@1.0.0-beta.35: version "1.0.0-beta.35" resolved "https://registry.yarnpkg.com/web3-core-method/-/web3-core-method-1.0.0-beta.35.tgz#fc10e2d546cf4886038e6130bd5726b0952a4e5f" @@ -15135,6 +15224,20 @@ web3-core-method@1.2.0: web3-core-subscriptions "1.2.0" web3-utils "1.2.0" +web3-core-method@2.0.0-alpha: + version "2.0.0-alpha" + resolved "https://registry.yarnpkg.com/web3-core-method/-/web3-core-method-2.0.0-alpha.tgz#453063885ab3cdd2bf63e5e586cdb3ee7d9cdfcb" + integrity sha512-BlOumHB4Guh5/c41v20EMlyjTBhgVPJ+dqZG5o7i42KOASgJ1ZqTTR2hq16F6zqgTuBAvJ8o/AjyWSBPsU2Twg== + dependencies: + "@babel/runtime" "^7.3.1" + eventemitter3 "3.1.0" + lodash "^4.17.11" + rxjs "^6.4.0" + web3-core "2.0.0-alpha" + web3-core-helpers "2.0.0-alpha" + web3-core-subscriptions "2.0.0-alpha" + web3-utils "2.0.0-alpha" + web3-core-promievent@1.0.0-beta.35: version "1.0.0-beta.35" resolved "https://registry.yarnpkg.com/web3-core-promievent/-/web3-core-promievent-1.0.0-beta.35.tgz#4f1b24737520fa423fee3afee110fbe82bcb8691" @@ -15185,6 +15288,15 @@ web3-core-subscriptions@1.2.0: underscore "1.9.1" web3-core-helpers "1.2.0" +web3-core-subscriptions@2.0.0-alpha: + version "2.0.0-alpha" + resolved "https://registry.yarnpkg.com/web3-core-subscriptions/-/web3-core-subscriptions-2.0.0-alpha.tgz#f8cb496af6e56b76bc0718213b7d777eeeacc741" + integrity sha512-xvOVyIrm5mF1iioxU+MGGWYMFftMOw5ILTqX1HQns4BVYiP1oEQu/PJ6h8wMMERC1uNkE+owNwJLCpf3BDn3EA== + dependencies: + "@babel/runtime" "^7.3.1" + eventemitter3 "^3.1.0" + lodash "^4.17.11" + web3-core@1.0.0-beta.35: version "1.0.0-beta.35" resolved "https://registry.yarnpkg.com/web3-core/-/web3-core-1.0.0-beta.35.tgz#0c44d3c50d23219b0b1531d145607a9bc7cd4b4f" @@ -15203,6 +15315,19 @@ web3-core@1.2.0: web3-core-requestmanager "1.2.0" web3-utils "1.2.0" +web3-core@2.0.0-alpha: + version "2.0.0-alpha" + resolved "https://registry.yarnpkg.com/web3-core/-/web3-core-2.0.0-alpha.tgz#79722bd65e5d9e28b47e2f43638c8994ed3f2b8e" + integrity sha512-K3DVpEv1peu/KarD/oB1DGl9h8aGj5hBecFeY3prNYVF1Ho9+2J9kKYsArW3Bss6Pa/KEv5MsVHMEYpx5wto0w== + dependencies: + "@babel/runtime" "^7.3.1" + "@types/bn.js" "^4.11.4" + "@types/node" "^12.6.1" + lodash "^4.17.11" + web3-core-method "2.0.0-alpha" + web3-providers "2.0.0-alpha" + web3-utils "2.0.0-alpha" + web3-eth-abi@1.0.0-beta.35: version "1.0.0-beta.35" resolved "https://registry.yarnpkg.com/web3-eth-abi/-/web3-eth-abi-1.0.0-beta.35.tgz#2eb9c1c7c7233db04010defcb192293e0db250e6" @@ -15303,6 +15428,15 @@ web3-eth-iban@1.2.0: bn.js "4.11.8" web3-utils "1.2.0" +web3-eth-iban@2.0.0-alpha: + version "2.0.0-alpha" + resolved "https://registry.yarnpkg.com/web3-eth-iban/-/web3-eth-iban-2.0.0-alpha.tgz#87c164d964b50c000554b1c58e46dac8e2b04787" + integrity sha512-SDSaU5QEbxaVwP/B/xl0S4xfu0UBzBD0c+rRYtB/o9NWKkRhcpnGqPnzBN9TB6C1+zbKba6/QlAbIUQsNO9WJQ== + dependencies: + "@babel/runtime" "^7.3.1" + bn.js "4.11.8" + web3-utils "2.0.0-alpha" + web3-eth-personal@1.0.0-beta.35: version "1.0.0-beta.35" resolved "https://registry.yarnpkg.com/web3-eth-personal/-/web3-eth-personal-1.0.0-beta.35.tgz#ecac95b7a53d04a567447062d5cae5f49879e89f" @@ -15498,6 +15632,23 @@ web3-providers-ws@1.2.0: web3-core-helpers "1.2.0" websocket "github:frozeman/WebSocket-Node#browserifyCompatible" +web3-providers@2.0.0-alpha: + version "2.0.0-alpha" + resolved "https://registry.yarnpkg.com/web3-providers/-/web3-providers-2.0.0-alpha.tgz#6bce7f6e6d08fa874bd78214c6c54251cd7a81da" + integrity sha512-29+2xv7CRY9HNyjSc/S2S4NfqrVqJzad2py2AIW+7HigAu+S40QKVKGx66h3KGA5NZrV5uGbMaNoNnlVNIrbDw== + dependencies: + "@babel/runtime" "^7.3.1" + "@types/node" "^10.12.18" + eventemitter3 "3.1.0" + lodash "^4.17.11" + url-parse "1.4.4" + web3-core "2.0.0-alpha" + web3-core-helpers "2.0.0-alpha" + web3-core-method "2.0.0-alpha" + web3-utils "2.0.0-alpha" + websocket "^1.0.28" + xhr2-cookies "1.1.0" + web3-shh@1.0.0-beta.35: version "1.0.0-beta.35" resolved "https://registry.yarnpkg.com/web3-shh/-/web3-shh-1.0.0-beta.35.tgz#7e4a585f8beee0c1927390937c6537748a5d1a58" @@ -15540,6 +15691,22 @@ web3-utils@1.2.0: underscore "1.9.1" utf8 "3.0.0" +web3-utils@2.0.0-alpha: + version "2.0.0-alpha" + resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-2.0.0-alpha.tgz#2e8b91f4887380672a270f8045826d72b58c12a4" + integrity sha512-EXPxfLdezx9nyt3dO0O0a8Er1sOvVW+lELcwoBWa+A3HwGLyc09Re0Fer+yW/NUp9UGJ9pp45bHkYAZul8tWHw== + dependencies: + "@babel/runtime" "^7.3.1" + "@types/bn.js" "^4.11.4" + "@types/node" "^12.6.1" + bn.js "4.11.8" + eth-lib "0.2.8" + ethjs-unit "^0.1.6" + lodash "^4.17.11" + number-to-bn "1.7.0" + randombytes "^2.1.0" + utf8 "2.1.1" + web3@0.20.2: version "0.20.2" resolved "https://registry.yarnpkg.com/web3/-/web3-0.20.2.tgz#c54dac5fc0e377399c04c1a6ecbb12e4513278d6" @@ -15779,7 +15946,7 @@ websocket@1.0.26: typedarray-to-buffer "^3.1.2" yaeti "^0.0.6" -websocket@^1.0.26: +websocket@^1.0.26, websocket@^1.0.28: version "1.0.29" resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.29.tgz#3f83e49d3279657c58b02a22d90749c806101b98" dependencies: @@ -16076,11 +16243,12 @@ ws@^5.1.1: dependencies: async-limiter "~1.0.0" -ws@^6.1.4: - version "6.2.1" - resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.1.tgz#442fdf0a47ed64f59b6a5d8ff130f4748ed524fb" +ws@^7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.1.2.tgz#c672d1629de8bb27a9699eb599be47aeeedd8f73" + integrity sha512-gftXq3XI81cJCgkUiAVixA0raD9IVmXqsylCrjRygw4+UOOGzPoxnQ6r/CnVL9i+mDncJo94tSkyrtuuQVBmrg== dependencies: - async-limiter "~1.0.0" + async-limiter "^1.0.0" wsrun@^3.6.5: version "3.6.6"