Commit Graph
25 Commits
Author SHA1 Message Date
Jaco Greeff 782f4f1f54 Support new v3 extrinsic (payload with genesisHash) (#1248)
* Make a start, copy stuff

* Payload adjusted

* Linting

* Small cleanups after testing

* Some duplication cleanups (yes... this needs work)

* Slightly less duplication (still not great)

* Typo in getter
2019-08-02 14:36:08 +02:00
Jaco Greeff fe35527a65 Method -> Call, expose findMethod on api (#1222)
* Rename Method -> Call (interface, align with Rust)

* Export Call types from types, expose findCall
2019-07-29 09:04:37 +02:00
Jaco Greeff 4094b44625 Linked queries accept params again (#1217)
* Linked queries accept params again

* Remove invalidated test, cleanup prefix strip
2019-07-27 23:58:09 +02:00
Jaco Greeff 99368a6d4d createType allows multiple params (#1207) 2019-07-27 08:05:11 +02:00
Jaco Greeff d56905d1b5 Move Extrinsic/Method to generic (#1205)
* Move Extrinsic/Method to generic

* Strip Generic* primitives

* Move Origin & Method, pass lint/tests
2019-07-26 18:04:33 +02:00
Amaury Martiny 441148889d CreateType is typed, add createTypeUnsafe just in case (#1199)
* Use unsafe internally

* Add comments

* Remove <> in createType

* Fix lint

* Fix classOf

* Remove createType from Text

* Fix lint

* Fix Fallback type

* Fix fallback in createType
2019-07-26 14:00:25 +02:00
Jaco Greeff 700eb7e1f4 Remove injectDefinitions import, prefer injector (#1195)
* Convert RPC classes to primitive classes or /srml types

* Lint passes... lokking at tests next.

* Tests pass.

* Types with basic docs (lots of work here)

* Update StorageKey.spec.ts

* Add injector to metadata doc generation

* Fix import

* Remove injectDefinitions import, prefer injector
2019-07-26 11:12:17 +02:00
Jaco Greeff 478f54c703 Convert RPC classes to primitive classes or /srml types (#1192)
* Convert RPC classes to primitive classes or /srml types

* Lint passes... lokking at tests next.

* Tests pass.

* Types with basic docs (lots of work here)

* Update StorageKey.spec.ts

* Add injector to metadata doc generation

* Fix import
2019-07-26 10:23:37 +02:00
Jaco Greeff 39323a8896 Convert all type/* (and some primitives) to srml/* (#1189)
* Convert (almost-all) non-primitives (and some primitives) to srml/*

* Move Vote to primitives, remove type folder

* Move Balance :-o

* Fixup tests, override Balance.toRaw()
2019-07-25 16:34:47 +02:00
Jaco Greeff ed6aad8265 Remove any from storage function param (#1186) 2019-07-25 13:43:11 +02:00
Jaco Greeff a25110b281 Move additional classes to definition-only (#1165)
* Move additional classes to definition-only

* Move some additional quick-hit types

* Last of the easier type/* conversions

* Remove rhd files

* Remove commented line

* Add injector to types loading

* typo

* Update comment

* Merge master

* Rework & organize CHANGELOG

* Some small helper cleanups
2019-07-25 10:32:26 +02:00
Jaco Greeff 79e5f7c9cc Metadata v7 (#1182)
* Make a start... static is in, code copied as a start.

* Get exports (more-or-less) right

* Well, the v7/* tests pass... now just to tweak storage generation

* Linting is happy, it doesn't mean it will work...

* It compiles... ship it.
2019-07-24 21:34:51 +02:00
Jaco Greeff 48159cfb5a DoubleMap extended tests (#1179)
* DoubleMap extended tests

* TwoX64Concat test (aligned with Rust)

* Remove .only

* Update Type.ts

* And working

* Check the full JSON output for the keys (future-proof)

* Renames
2019-07-24 16:04:55 +02:00
Amaury Martiny c3811ee6e9 feat: Implement twox64concat (#1166)
* feat: Implement twox64concat

* Import order

* use u8aToU8a
2019-07-23 16:10:36 +02:00
Jaco Greeff ebc2fbe3ee Move (some) from session & elections to srml/types (#1158)
* Move (some) from session & elections to srml/types

* Just use createType instad of (new ClassOf(type))(value)

* Cleanup generation script (import file duplication)
2019-07-23 11:47:45 +02:00
Jaco Greeff f9a3f3e53f Fix linked maps with defaults (#1162)
* isPedantic matches [] with isEmpty

* Fix undefined.undefined on  headKey

* Adjust fallback for linked maps

* Add tests for the linked map fallbacks (head and value)
2019-07-23 10:56:45 +02:00
Jaco GreeffandAmaury Martiny 50a2314544 Extrinsic v2 (#1150)
* Extrinsic v2

* Save after last move of files

* Signature V2

* Rework signature decoding

* Simplify V1 and V2 underlying impl.

* Detect chain extrinsic version

* SignaturePayload

* remove Raw payload variant link (Payload is now raw)

* Remove v2 comments referring to v1 data

* Pass isSigned to Extrinsic{V1, V2}

* Cleanup era injection

* It flows :)

* Add SignerPayload and signPayload for Signer (#1152)

* Add SignerPayload and signPayload for Signer

* Submittables use signPayload

* Don't pass version on deprecated interface

* Update after all e2e tx tests passes

* Comment around payload generation

* Adjust blocktime to default (nice round 50 block eras)

* Fix calc

* Re-add test comment

* Update packages/api/src/types.ts

Co-Authored-By: Amaury Martiny <amaury.martiny@protonmail.com>

* Update packages/types/src/primitive/BalanceCompact.ts

Co-Authored-By: Amaury Martiny <amaury.martiny@protonmail.com>

* Backwards compatibility for current in-store signers

* Apply options suggestions

* Add missing Compact params (linting)
2019-07-22 17:08:06 +02:00
Jaco Greeff dd7b138c02 Move contracts classes to srml/contracts (now as types-only) (#1153)
* Move contracts classes to srml/contracts (now as types-only)

* Exclude srml generated files from codeclimate

* Alos excluse types/src/scripts

* Replace Compact<T>.toBn() with unwrap()

* Fic compact type (#1156)

* Remove as unknown as T (T typing is working)

* Move interfaces back to the relevant types.ts
2019-07-22 14:49:08 +02:00
Jaco Greeff 3b282f0306 Don't export constants as ConstantCodec (TS casting) (#1140)
* Don't export constants as ConstantCodec (TS casting)

* Import ConstantCodec from types
2019-07-16 20:53:12 +02:00
Stefanie Doll d57dca53f4 Reorganize test setup (#1132)
* Moved all e2e tests to 'api' folder

* Moved metadata test

* fix imports

* Add jest options for testing the different endpoint types separately

* Add check for empty test suites and return empt test to prevent jest from throwing an error

* Fix import paths

* Fix const tests for polkadot chains

* Update to latest Substrate 2.0 image

* Move contract files for e2e testing to e2e tesing folder

* reorder & fix promise query tests for all test nodes

* final fixes for promise query

* eslint fixes

* removed trailing space

* fix linting errors

* Address codeclimate "Function getWsEndpoints has a Cognitive Complexity of 7 (exceeds 5 allowed)."

* Fix contract ABI import paths

* linter endpoint types

* replace alice with alice_stash

* split off promise-queries file

* Remove apiType, smaller cleanups, added local to only: [] tests suites

* relative paths changed to `@polkadot` import

* moved contract wasm & abi's back to `api-contract`
2019-07-16 16:03:53 +02:00
Jaco Greeff 6c9fe763e1 Export meta on consts (#1119)
* Export meta on consts

* Comment around meta extension

* Add meta manual check
2019-07-15 11:13:59 +02:00
Jaco Greeff 71c5920b1f eslint rules (#1099)
* Off to the races - 3760 problems (1794 errors, 1966 warnings)

* Convert Array<T> -> T[] (not all correct, eg. extends)

* () => { -> (): void  => {

* get is/as -> public get is/as

* public for getters, constructors & base Codec

* Some cleanups from previous overzealous search & replace

* Under 2k, 1874 problems (649 errors, 1225 warnings)

* ^^^ check that commit for details ;)

* Minor.

* rm config header

* Minor cleanups

* Default to tslint, eslint as option

* Trigger

* Update jsonrpc

* 1494 problems (433 errors, 1061 warnings)

* 1103 problems (135 errors, 968 warnings)

* 899 problems (9 errors, 890 warnings)

* 483 problems (9 errors, 474 warnings) (ignore any... for now)

* 366 problems (9 errors, 357 warnings)

* 336 problems (9 errors, 327 warnings)

* 148 problems (9 errors, 139 warnings)

* 31 problems (8 errors, 23 warnings)

* 0, 0
2019-07-14 12:15:14 +02:00
Jaco Greeff 7772caaa9d Bump metadata (#1108)
* Bump metadata

* Add Phantom type (grrr... don't like this in meta, but it is what it is)

* yarn test:one Metadata passes

* Update with new section indexes
2019-07-12 11:50:05 +02:00
Jaco Greeff edea20dad8 Export storage prefix on StorageEntry (#1106) 2019-07-12 11:22:14 +02:00
Axel Chalon 9abbaab991 Pull parameter_types! from metadata (#1066)
* @polkadot/{extrinsics,storage} moved to @polkadot/metadata

* Fix previous commit

* Fix previous commit

* Expose parameter types using api.consts

* Grumbles; update v6 static metadata; add UncleEntryItem (fix #1067)

* Update api.query.* to api.consts.* where changed

* Update tests and stray api.query.staking.sessionsPerEra

* Grumbles

* Grumbles

* Revert updates to api-derive (taken care of by #1068)

* Grumbles; fix UncleEntryItem

* Rename "@polkadot/metadata" => "@polkadot/api-metadata"

* Skip derive test

* Grumbles

* Grumbles

* Grumbles

* Cleanup merge, ensure metadata is latest

* Move api-metadata to actual api-metadata folder

* README api-metadata description (& folder link)

* Remove stray type-extrinsics package.json
2019-07-09 08:54:28 +02:00