Commit Graph
84 Commits
Author SHA1 Message Date
Jaco Greeff de67a88f45 Remove /index imports (swap to bare) (#362) 2019-03-14 08:41:00 +01:00
Stefanie Doll 2602a43eab Parsing function for JSON objects (#359)
* Added parsin function for JSON objects

* Re-defined wording

* code formatting/ new lines
2019-03-12 11:58:11 +01:00
Jaco Greeff 4f719ce377 Remove syncify (NodeJS only) (#349)
* Remove syncify (NodeJS only)

* Bump version (interface change)
2019-03-04 16:47:55 +01:00
Jaco Greeff 1e6eb2c283 Converts tests to TypeScript (#300) 2019-02-14 10:48:08 +01:00
Jaco Greeff 89030f41b3 2019 (#287)
* 2019

* Bump deps

* Cleanup deps

* Update dev (markdown plugin)

* Bump deps (hopefully finally fixes doc gen)

* Fix inherit plugin
2019-01-04 14:50:50 +01:00
Jaco Greeff d47b865df9 TextEncoder/Decoder polyfill optimisation (#286) 2019-01-03 13:52:03 +01:00
Jaco Greeff 7b9ca4ad6e Minimum number of bytes for compact encoding (#285)
* Minimum number of bytes for compact encoding

* Cleanup comment
2018-12-25 13:29:33 +01:00
Amaury Martiny 0c8547d49c Add tests from Rust (#283)
* Add tests from Rust

* Fix compact encoding
2018-12-21 15:15:59 +01:00
Jaco Greeff f011334152 Add actual real-test data, detect bitLength (#282)
* Add actual real-test data, detect bitLength

* Cleanup misplaced log

* Cleanup test, no length passed
2018-12-21 12:47:40 +01:00
Jaco Greeff 5585a16814 Fix large-value Compact encoding (#281) 2018-12-21 10:04:11 +01:00
Amaury Martiny 74744e694b Fix negative BNs (#280)
* Fix bug fromTwos

* Better default values

* Fix bugs

* Fix tests

* Eth uses BE!

* Add back compat

* Fix test

* Remove useless arg
2018-12-20 17:00:57 +01:00
Jaco Greeff 3988773572 Bump deps (#279)
* Bump deps

* Bump local deps

* Add Uint8Array fill polyfill
2018-12-20 10:53:43 +01:00
Amaury Martiny 0e30c48379 Add conversion to negative BN's (#277)
* Support negative number hexToBn

* Fix u8aToBn

* Update signature

* Update params description
2018-12-19 18:43:44 +01:00
Jaco Greeff 6d8e78840b Expand and organise polyfills (#276) 2018-12-18 15:15:10 +01:00
Jaco Greeff 7188f6b67a Polyfills for RN support (#275)
* Polyfills for RN support

* Expand polyfill tests
2018-12-18 09:59:02 +01:00
Jaco Greeff 30bf357d5d React native support, strengthen TextEncoder/Decoder (#273) 2018-12-17 21:24:02 +01:00
Jaco Greeff cd7f64486b Fallback fallback ascii-only encoder/decoder (#271) 2018-12-17 14:12:52 +01:00
Jaco Greeff cab0713f33 Make exports consistent (#269)
* Make exports consistent

* Cleanup trie impl
2018-12-09 13:25:14 +01:00
Jaco Greeff fbd6c1e9bf Cleanup more Codeclimate issues (#267)
* Cleanup more Codeclimate issues

* Cleanup unused imports
2018-12-08 14:34:36 +01:00
Jaco Greeff 2be211cc98 Optimise u8aToHex function (32% of original time) (#265) 2018-12-06 12:04:08 +01:00
Jaco Greeff ccfed2a8b4 Bump @polkadot/dev, expand compact description (#263) 2018-12-03 14:29:30 +01:00
Jaco Greeff e3b45e7617 Rename types.d.ts -> types.ts (#262) 2018-11-29 11:54:25 +01:00
Jaco Greeff f82092e603 Allow blake2 & parity-codec in trie (#251)
* Start codec implementation

* Expose all constants

* NodeHeader encoding/decoding

* Encoding in NodeHeader

* Constants for Node types

* Moce codec to trie-codec

* Encode/decode in place (untested)

* WIP, tests starting to be put in place

* One passing test :)

* Another test bites the dust...

* One more test down...

* One more down

* Additional tests

* Formatting

* Long keys passing

* Trie tests

* Follow the script, no all-in-all encoder

* First simple trie test passing

* Another one down

* Extra checks remove (debug)

* 80% there with tests...

* One more, one left

* Trie tests passing

* ISC -> Apache-2.0

* Add compact util functions

* Tests to TypeScript

* Remove @polkadot/types deps, ethereum stub

* Bump

* Genesis tests with chainspecs

* Cleanup tests (ease of debugging)

* Substrate test passes, branch fails (again)

* Checks passing, tests passing

* Re-add Ethereum & snapshot tests (not passing atm)

* Re-add index test (also not 100%)

* Mid-way in generic trie-root

* Cleanup ethereumjs-testing definitions

* Update deps

* Less intrusive renames in trie-hash

* Self-review cleanups #1

* asNibbles -> toNibbles

* Cleanups

* Expand tests

* Cleanup imports

* Fix logger test (fly-by refactor)

* Update snapshot test
2018-11-22 14:29:34 +01:00
Jaco Greeff 477be907d8 Compact support for decoding and decoding (#256) 2018-11-21 15:41:19 +01:00
Jaco Greeff 3bc1b7541b LICENSE and README updates (#254)
* LICENSE and README updates

* Remove duplicated definition

* Remove duplicated file
2018-11-21 12:26:38 +01:00
Amaury Martiny 7a43354ece isString true for String object (#245)
* Fix isString

* value is

* Fix isHex too

* Fix isHex

* Add hex test with String
2018-11-12 16:23:18 +01:00
Luke Schoen 1fb1f9d743 docs: Fixes #157. Add Gitbook documentation for Polkadot-JS Common (#231)
* fix: Remove prior docs attempt files

* docs: Add Gitbook docs for common repo with examples. See detailed comments

* Remove old attempt at docs in docs/ folders

* Add Typedoc config typedoc.js

* Add .nvmrc for easily switching Node.js version with NVM

* Add ESLint config .eslintrc.json and .eslintignore

* Fix in tsconfig.json so is keyring not util-keyring

* Update package.json with dependencies and script same as in polkadot-js/api

* Update root README fixing CI icons, adding guide same as in polkadot-js/api, and fixing link to keyring, not util-keyring

* Update root .gitignore with Gitbook build files same as in polkadot-js/api

* Add Gitbook docs structure same as in polkadot-js/api

* Add Gitbook examples for keyring, trie-db, util-crypto

* Add Gitbook outer summary for the menu, Readme, logo and styles same as in polkadot-js/api

* Add Gitbook config book.json

* docs: Remove db and util-rlp from Gitbook summary menu since RLP not in PoC-3

* docs: Add Typedocs with examples for db MemoryDb and DiskDb

* docs: Update db/ Readme with CI icons fixed, and indicating that no methods exposed in Common Docs

* docs: Update keyring Readme with CI icons fixed and link to Common Docs

* fix: Fix keyring package.json info to refer to common, not client

* fix: Updates license in 4x files in keyring/address folder with keyring, not util-keyring

* docs: Add Typedocs to Keyring class, pair function, and testKeyring function

* docs: Update keyring Readme with CI icons fixed and link to Common Docs

* fix: Update package.json moving @polkadot/db from devDependencies to dependencies

* fix: Update test to iterate array not object with forEach

* fix: Use semicolon instead of comma in tests to fix linting errors. Fix typo

* docs: Add Typedoc to Trie class

* docs: Add Typedoc to is functions

* docs: Update keyring Readme with CI icons fixed and link to Common Docs

* fix: Add return type to encodeAux function

* docs: Add Typedoc to encode function

* fix: Fix formatting of Typedoc example for root

* docs: Add Typedoc for genRoot

* docs: Add Typedoc for pairsUniq

* docs: Add Typedoc for getSharedLength

* docs: Add Typedoc for sharedPrefixLength

* fix: Fix formatting of Typedoc example for rootOrdered, asNibbles, fromNibbles

* fix: Various fixes to util-crypto. See commit detail comments

* Update root Readme with class and function info
* Fix typos and Typedoc examples
* Expose mnemonic by exporting it in an index.ts
* Fix naming from naclKeypair to naclKeypairFromRandom
* Fix typos
* Fix randomAsU8s to be randomAsU8a
* Fix spelling of bitLength

* fix: Various fixes to util-rlp. See detailed commit comments

* Update keyring Readme with CI icons fixed and link to Common Docs mentioning since RLP not in PoC-3 nothing exposed in Common Docs
* Add Typedocs
* Move Typedocs to different file so they appear in Common Docs

* fix: Various fixes to util. See detailed commit comments

* Update root Readme to use Yarn and list and explain exposed Common Docs methods
* Fix typos and Typedoc examples

* fix: Restore tests back using variable they were iterating over before

* docs: Move nested part of Summary to individual package Readme. Add Usage to Readmes

* fix: Add missing semicolon to existing test

* fix: Remove docs/gitbook folder and files since generated by CI

* feat: Update Gitignore to ignore CI-generated files like .html and docs/gitbook/ folder

* docs: Remove CI-icons from all packages within polkadot-js/common, except its root Readme

* fix: Update to incorporate changes from PR #233 and #229

* fix: Ignore build directories in Jest tests using modulePathIgnorePatterns

* fix: Remove useless docs/html from .gitignore since there is no html subdirectory

* fix: Update util-crypto README with link to mnemonicToSeed instead of toSecret

* docs: Update keyring create account example to show result to user

* fix: Update dependencies in examples so the examples work again

* fix: Update keyring example 02 load accounts not to use addFromAddress

* fix: Update .gitignore so it is suitable for both polkadot-js common and api

* fix: Adjust .gitignore after testing changes that work with polkadot-js api too

* fix: Resolve .gitignore to overcome FileNotFoundError: No README file (or is ignored)

* fix: Remove from Git tracking docs/.nojekyll since generated

* fix: Add lerna to gitignore to match api repo

* Revert to original .gitignore. Does not work without Gitbooks files Git tracked

* docs: Hide trie-db Examples since have limited use
2018-10-19 17:33:58 +02:00
Jaco Greeff 65b8468e5b Import util via {...} (#236)
* Import util via {...}

* Fix test failures
2018-10-18 15:24:13 +02:00
Jaco Greeff 57eddba598 Remove from* variants, move fromString to stringTo (#233)
* Remove from* variants, move fromString to stringTo

* Bump
2018-10-18 10:30:14 +02:00
Amaury Martiny b73ca86982 Fix camel case (#220) 2018-09-28 15:17:30 +02:00
Amaury Martiny 9a6a02ce46 Add stringLowerFirst, stringUpperFirst, stringCamelCase (#219)
* Add stringLowerFirst

* Add stringUpperFirst

* Change test description

* Add camelcase

* Add header
2018-09-28 13:38:36 +02:00
Jaco Greeff adea971ee1 Expose logger format (#216) 2018-09-13 13:21:40 +02:00
Jaco Greeff e1135a665b Re-implementation of Patricia-Merkle Trie (#203)
* Start of trie-db re-implementation

* WIP commit

* More WIP

* WIP, seems complete, untested

* Ported trie-db operational

* Add Ethereum trie tests

* Use u8aConcat to construct u8a

* Basic RocksDb interface

* Combine engines into DB, expand tests

* Update Trie with transaction wrapper

* LevelDb (sync) interface

* Remove unused (for now) package (compatibility)

* trie-d -> trie-db-old, trie-db-ext -> trie-db

* Version bump

* Skip old trie tests (package to be removed)

* Skip tests (fixed)

* Remove non-used RocksDb spec

* Skip FileFlat tests (deprecated?)
2018-09-01 22:17:57 +02:00
Jaco Greeff b21940d5b4 toU8a allows Array<number> 2018-08-15 13:17:45 +02:00
Jaco Greeff 141bed8320 Format log date with moment (#181) 2018-07-27 15:22:05 +02:00
Jaco Greeff cf570fd729 Make isLe required in conversion (#180)
* Make isLe required in conversion

* Update logger Date format

* Fallback encoding sizes
2018-07-27 12:03:11 +02:00
Jaco Greeff 243df6d030 Add MemoryDb Trie-wrapper (#159)
* Pass along hashing function (keccak or blake2)

* Allow syncify to handle Promises with no return values

* Add sync MemoryDb interface
2018-07-03 14:31:01 +02:00
Jaco Greeff 2d4af33715 submitExtrinsic returns hash (#154) 2018-06-28 13:02:22 +02:00
Jaco Greeff f0c34bea09 Use bn types from @types (#153)
* Use bn.js definitions from @types

* Update isHex & isObservable
2018-06-27 15:05:55 +02:00
Jaco Greeff 73477a2809 Add tslint (#151) 2018-06-27 10:15:46 +02:00
Jaco Greeff 2f1aebe908 Update @polkadot/dev, finsing deasync jest resolution 2018-06-26 16:49:17 +02:00
Jaco Greeff 69239d56e6 Use Jest default files as fallback 2018-06-26 16:38:24 +02:00
Jaco Greeff 5759a61689 Re-introduce ip4/ip6 checks 2018-06-26 13:22:01 +02:00
Jaco Greeff ae814c646d ExtError doesn't require any arguments 2018-06-24 14:41:16 +02:00
Jaco Greeff 4470dfa7b9 TypeScript conversion (#142)
* Auto-conversion

* Cleanup type conversion errors

* Inching closer, resolution sorted

* Additional cleanups

* TS, TS everywhere

* Minor version for TS release

* Last roundups
2018-06-22 21:17:50 +02:00
Jaco Greeff 99b86d9849 Use ES6 import/export (#139)
* Use ES6 import/export

* Fix tests
2018-06-20 16:36:07 +02:00
Jaco Greeff 29d635d913 Allow u8aToU8a to convert buffers (#138)
* Allow u8aToU8a to convert buffers

* Cater for utf8 -> u8a strings
2018-06-15 11:53:18 +02:00
Jaco Greeff 461dde7c3c Copyright project authors (#137)
* Copyright project authors

* Add contributors
2018-06-13 22:24:48 +02:00
Jaco Greeff 9186a46bf9 Handle u8a null inputs in formatters (#134) 2018-06-11 10:16:03 +02:00
Jaco Greeff ece9480c94 Allow logging with colors (based on type) (#133) 2018-06-08 10:29:26 +02:00