API formatting for inputs & outputs (#171)

* API formatting for inputs & outputs

* Shorten naming

* getStorage (signle key) operational

* Remove api-format (not used in api anymore)

* Cleanup creation logic

* Cleanup linting

* Cleanup storage creation

* e2e state test

* Add code test

* Add isBare flag to toU8a

* Uppercase... wtill wrong though

* Update metadata json

* We are creating keys properly

* Cleanup tslint

* Type splitting,m handling Tuple & Vector

* StorageChangeSet results in-place

* Update deps

* Allow Tuples to have array constructors

* Test for uncloded vec/tuple

* Update deps
This commit is contained in:
Jaco Greeff
2018-09-28 15:42:23 +02:00
committed by GitHub
parent 8380455599
commit 74737b6367
70 changed files with 748 additions and 697 deletions
+2 -2
View File
@@ -32,7 +32,7 @@
"@polkadot/extrinsics": "^0.30.1",
"@polkadot/params": "^0.30.1",
"@polkadot/primitives": "^0.30.1",
"@polkadot/util": "^0.30.4",
"@polkadot/util-keyring": "^0.30.4"
"@polkadot/util": "^0.30.7",
"@polkadot/util-keyring": "^0.30.7"
}
}
@@ -112,8 +112,8 @@ export default function decodeValue (decode: Decoder, type: Param$Type, _input:
case 'VoteThreshold':
return byte(input);
case 'StorageResult':
case 'StorageResultSet':
case 'StorageData':
case 'StorageChangeSet':
default:
// tslint:disable-next-line
(type as never);
@@ -7,11 +7,11 @@ import toU8a from '@polkadot/util/u8a/toU8a';
import encode from './index';
describe('storageKey', () => {
it.skip('encodes storageKey -> Uint8Array properly', () => {
describe.skip('storageKey', () => {
it('encodes storageKey -> Uint8Array properly', () => {
expect(
encode('StorageKey', [
storage.staking.public.freeBalanceOf,
storage.balances.freeBalance,
'5EhmTa7fL6SdjgKXo9g6hetR6nHnRAmrtisoGFWEESjzECtY'
])
).toEqual(
+1 -1
View File
@@ -14,7 +14,7 @@ export type EncodingVersions = 'poc-1' | 'latest';
// - @polkadot/storage/key/params.ts
// - decode/value/index.js
// - encode/type/index.js
export type Param$Type = 'AccountId' | 'AccountIndex' | 'Balance' | 'BlockNumber' | 'bool' | 'Bytes' | 'Call' | 'CandidateReceipt' | 'Code' | 'Digest' | 'Gas' | 'Hash' | 'Header' | 'KeyValue' | 'Metadata' | 'MisbehaviorReport' | 'ParachainId' | 'PendingExtrinsics' | 'PropIndex' | 'Proposal' | 'ReferendumIndex' | 'RuntimeVersion' | 'SessionKey' | 'Signature' | 'SignedBlock' | 'StorageKey' | 'StorageKeyValue' | 'StorageResult' | 'StorageResultSet' | 'String' | 'Timestamp' | 'u32' | 'u64' | 'u128' | 'VoteIndex' | 'VoteThreshold';
export type Param$Type = 'AccountId' | 'AccountIndex' | 'Balance' | 'BlockNumber' | 'bool' | 'Bytes' | 'Call' | 'CandidateReceipt' | 'Code' | 'Digest' | 'Gas' | 'Hash' | 'Header' | 'KeyValue' | 'Metadata' | 'MisbehaviorReport' | 'ParachainId' | 'PendingExtrinsics' | 'PropIndex' | 'Proposal' | 'ReferendumIndex' | 'RuntimeVersion' | 'SessionKey' | 'Signature' | 'SignedBlock' | 'StorageKey' | 'StorageKeyValue' | 'StorageData' | 'StorageChangeSet' | 'String' | 'Timestamp' | 'u32' | 'u64' | 'u128' | 'VoteIndex' | 'VoteThreshold' | 'Vec<StorageKey>';
export type Param$Type$Array = Array<Param$Type | Array<Param$Type | Array<Param$Type>>>;