Support new versioned metadata format (#632)
* Start something... * Parsing via proxy (everything still all-ok) * Imp[ort order (minor) * WIP expanding the structure * Adjust V1 structure * Parsing seems to do the trick... * Add CodeHash and Schedule types * //v0/ -> /v0/ * Update Extrinsic.ts * Updated with compact outerDispatch, non-throw construction * v1 to V0 conversion * Bubble non-magic errors in constructor * Update e2e after testing them * Bump version with CHANGELOG (potentially breaking change)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api",
|
||||
"version": "0.40.26",
|
||||
"version": "0.41.0",
|
||||
"description": "An RxJS wrapper around the Polkadot JS RPC",
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
@@ -30,12 +30,12 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.2.0",
|
||||
"@polkadot/api-derive": "^0.40.26",
|
||||
"@polkadot/extrinsics": "^0.40.26",
|
||||
"@polkadot/rpc-provider": "^0.40.26",
|
||||
"@polkadot/rpc-rx": "^0.40.26",
|
||||
"@polkadot/storage": "^0.40.26",
|
||||
"@polkadot/types": "^0.40.26",
|
||||
"@polkadot/api-derive": "^0.41.0",
|
||||
"@polkadot/extrinsics": "^0.41.0",
|
||||
"@polkadot/rpc-provider": "^0.41.0",
|
||||
"@polkadot/rpc-rx": "^0.41.0",
|
||||
"@polkadot/storage": "^0.41.0",
|
||||
"@polkadot/types": "^0.41.0",
|
||||
"@types/rx": "^4.1.1",
|
||||
"rxjs": "^6.3.3"
|
||||
}
|
||||
|
||||
@@ -300,8 +300,8 @@ export default abstract class ApiBase<OnCall> implements ApiBaseInterface<OnCall
|
||||
this._runtimeVersion = await this._rpcBase.chain.getRuntimeVersion();
|
||||
this._genesisHash = await this._rpcBase.chain.getBlockHash(0);
|
||||
|
||||
const extrinsics = extrinsicsFromMeta(this.runtimeMetadata);
|
||||
const storage = storageFromMeta(this.runtimeMetadata);
|
||||
const extrinsics = extrinsicsFromMeta(this.runtimeMetadata.asV0);
|
||||
const storage = storageFromMeta(this.runtimeMetadata.asV0);
|
||||
|
||||
this._extrinsics = this.decorateExtrinsics(extrinsics, this.onCall);
|
||||
this._query = this.decorateStorage(storage, this.onCall);
|
||||
@@ -312,7 +312,7 @@ export default abstract class ApiBase<OnCall> implements ApiBaseInterface<OnCall
|
||||
this._rx.query = this.decorateStorage(storage, rxOnCall);
|
||||
this._rx.derive = this.decorateDerive(this._rx as ApiInterface$Rx, rxOnCall);
|
||||
|
||||
Event.injectMetadata(this.runtimeMetadata);
|
||||
Event.injectMetadata(this.runtimeMetadata.asV0);
|
||||
Method.injectMethods(extrinsics);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -54,7 +54,7 @@ describe.skip('e2e queries', () => {
|
||||
|
||||
it('subscribes to queries (default)', (done) => {
|
||||
api.query.staking.validatorPreferences(keyring.ferdie.address(), (prefs) => {
|
||||
expect(prefs.unstakeThreshold.toNumber()).toBe(12);
|
||||
expect(prefs.unstakeThreshold.toNumber()).toBe(3);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user