Updated child storage parameters (#1709)
* Added child_definition and child_type to chicl dtorage RPC methods * reset comments in test file * reverse docs re-built * Fix linting on child storage tests
This commit is contained in:
committed by
Jaco Greeff
parent
6c25d0ab0d
commit
cc4a4607f1
@@ -103,7 +103,7 @@ describeE2E({
|
||||
const storageKeys = await rpc.state.getKeys(CHILD_STORAGE).toPromise();
|
||||
|
||||
rpc.state
|
||||
.getChildKeys(storageKeys[0], '0x')
|
||||
.getChildKeys(storageKeys[0], '0x', '0x00', '0x')
|
||||
.subscribe((keys: StorageKey[]): void => {
|
||||
expect(keys.length).toBeGreaterThanOrEqual(1);
|
||||
done();
|
||||
@@ -112,10 +112,10 @@ describeE2E({
|
||||
|
||||
it('getChildStorage(): retrieves the default value of the incrementer smart contract', async (done): Promise<void> => {
|
||||
const storageKeys = await rpc.state.getKeys(CHILD_STORAGE).toPromise();
|
||||
const childStorageKeys = await rpc.state.getChildKeys(storageKeys[0], '0x').toPromise();
|
||||
const childStorageKeys = await rpc.state.getChildKeys(storageKeys[0], '0x', '0x01', '0x').toPromise();
|
||||
|
||||
rpc.state
|
||||
.getChildStorage(storageKeys[0], childStorageKeys[0])
|
||||
.getChildStorage(childStorageKeys[0], '0x', '0x01', storageKeys[0])
|
||||
.subscribe((storage: StorageData): void => {
|
||||
const storageValue = hexToBn(storage.toHex(), { isLe: true });
|
||||
expect(storageValue).toBeInstanceOf(BN);
|
||||
@@ -126,10 +126,10 @@ describeE2E({
|
||||
|
||||
it('getChildStorageHash(): retrieves the Hash of the incrementer smart contract', async (done): Promise<void> => {
|
||||
const storageKeys = await rpc.state.getKeys(CHILD_STORAGE).toPromise();
|
||||
const childStorageKeys = await rpc.state.getChildKeys(storageKeys[0].toHex(), '0x').toPromise();
|
||||
const childStorageKeys = await rpc.state.getChildKeys(storageKeys[0], '0x', '0x01', '0x').toPromise();
|
||||
|
||||
rpc.state
|
||||
.getChildStorageHash(storageKeys[0], childStorageKeys[0])
|
||||
.getChildStorageHash(childStorageKeys[0], '0x', '0x01', storageKeys[0])
|
||||
.subscribe((storage: StorageData): void => {
|
||||
expect(isInstanceOf(storage, H256)).toBeTruthy();
|
||||
done();
|
||||
@@ -138,10 +138,10 @@ describeE2E({
|
||||
|
||||
it('getChildStorageSize(): retrieves the size of the incrementer smart contract', async (done): Promise<void> => {
|
||||
const storageKeys = await rpc.state.getKeys(CHILD_STORAGE).toPromise();
|
||||
const childStorageKeys = await rpc.state.getChildKeys(storageKeys[0], '0x').toPromise();
|
||||
const childStorageKeys = await rpc.state.getChildKeys(storageKeys[0], '0x', '0x01', '0x').toPromise();
|
||||
|
||||
rpc.state
|
||||
.getChildStorageSize(storageKeys[0], childStorageKeys[0])
|
||||
.getChildStorageSize(childStorageKeys[0], '0x', '0x01', storageKeys[0])
|
||||
.subscribe((storage): void => {
|
||||
expect(storage.toString()).toBe('4');
|
||||
done();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { Option, Vec } from '@polkadot/types/codec';
|
||||
import { Bytes, H256, Metadata, StorageData, StorageKey, Text, u64 } from '@polkadot/types';
|
||||
import { Bytes, H256, Metadata, StorageData, StorageKey, Text, u32, u64 } from '@polkadot/types';
|
||||
import { AccountId, BlockNumber, Extrinsic, Hash, Header, Index, SignedBlock } from '@polkadot/types/interfaces/runtime';
|
||||
import { ContractCallRequest, ContractExecResult } from '@polkadot/types/interfaces/contracts';
|
||||
import { BlockHash, ChainProperties, ExtrinsicOrHash, ExtrinsicStatus, Health, NetworkState, PeerInfo, RpcMethods, RuntimeDispatchInfo, RuntimeVersion, StorageChangeSet } from '@polkadot/types/interfaces/rpc';
|
||||
@@ -41,10 +41,10 @@ export interface RpcInterface {
|
||||
};
|
||||
state: {
|
||||
call(method: Text | string, data: Bytes | Uint8Array | string, at?: BlockHash | Uint8Array | string): Observable<Bytes>;
|
||||
getChildKeys(childStorageKey: any, key: any, at?: BlockHash | Uint8Array | string): Observable<Vec<StorageKey>>;
|
||||
getChildStorage(childStorageKey: any, key: any, at?: BlockHash | Uint8Array | string): Observable<StorageData>;
|
||||
getChildStorageHash(childStorageKey: any, key: any, at?: BlockHash | Uint8Array | string): Observable<Hash>;
|
||||
getChildStorageSize(childStorageKey: any, key: any, at?: BlockHash | Uint8Array | string): Observable<u64>;
|
||||
getChildKeys(childStorageKey: any, childDefinition: any, childType: u32 | Uint8Array | number | string, key: any, at?: BlockHash | Uint8Array | string): Observable<Vec<StorageKey>>;
|
||||
getChildStorage(childStorageKey: any, childDefinition: any, childType: u32 | Uint8Array | number | string, key: any, at?: BlockHash | Uint8Array | string): Observable<StorageData>;
|
||||
getChildStorageHash(childStorageKey: any, childDefinition: any, childType: u32 | Uint8Array | number | string, key: any, at?: BlockHash | Uint8Array | string): Observable<Hash>;
|
||||
getChildStorageSize(childStorageKey: any, childDefinition: any, childType: u32 | Uint8Array | number | string, key: any, at?: BlockHash | Uint8Array | string): Observable<u64>;
|
||||
getKeys(key: any, at?: BlockHash | Uint8Array | string): Observable<Vec<StorageKey>>;
|
||||
getMetadata(at?: BlockHash | Uint8Array | string): Observable<Metadata>;
|
||||
getRuntimeVersion(at?: BlockHash | Uint8Array | string): Observable<RuntimeVersion>;
|
||||
|
||||
@@ -50,6 +50,8 @@ const getStorageSize: RpcMethodOpt = {
|
||||
|
||||
const CHILD_QUERY_PARAMS = [
|
||||
createParam('childStorageKey', 'StorageKey'),
|
||||
createParam('childDefinition', 'StorageKey'),
|
||||
createParam('childType', 'u32'),
|
||||
createParam('key', 'StorageKey'),
|
||||
createParam('at', 'BlockHash', { isOptional: true })
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user