Skip to content

Commit

Permalink
Move json metadata to ts
Browse files Browse the repository at this point in the history
  • Loading branch information
jacogr committed Sep 28, 2018
1 parent bbe2a30 commit bd97130
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
1 change: 0 additions & 1 deletion packages/api-codec/src/Metadata.rpc.json

This file was deleted.

File renamed without changes.
6 changes: 2 additions & 4 deletions packages/api-codec/src/Metadata.spec.js
Expand Up @@ -3,13 +3,11 @@
// of the ISC license. See the LICENSE file for details.

import Metadata from './Metadata';
import rpcdata from './Metadata.rpc.json';
import rpcdata from './Metadata.rpc';

describe('Metadata', () => {
it('decodes properly', () => {
const decoded = new Metadata().fromJSON(
rpcdata.result
);
const decoded = new Metadata().fromJSON(rpcdata);

const str = JSON.stringify(decoded.toJSON());

Expand Down
4 changes: 2 additions & 2 deletions packages/type-storage/src/fromMetadata.spec.js
Expand Up @@ -3,12 +3,12 @@
// of the ISC license. See the LICENSE file for details.

import Metadata from '@polkadot/api-codec/Metadata';
import json from '@polkadot/api-codec/Metadata.rpc.json';
import json from '@polkadot/api-codec/Metadata.rpc';

import fromMetadata from './fromMetadata';

// Use the pre-generated metadata
const metadata = new Metadata().fromJSON(json.result);
const metadata = new Metadata().fromJSON(json);
const newStorage = fromMetadata({}, metadata);

describe('fromMetadata', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/type-storage/src/testing.ts
Expand Up @@ -2,13 +2,13 @@
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.

import metadataArray from '@polkadot/api-codec/Metadata.array';
import metadataRpc from '@polkadot/api-codec/Metadata.rpc';
import Metadata from '@polkadot/api-codec/Metadata';

import storage from './index';
import fromMetadata from './fromMetadata';

export default fromMetadata(
storage,
new Metadata().fromJSON(metadataArray)
new Metadata().fromJSON(metadataRpc)
);

0 comments on commit bd97130

Please sign in to comment.