Skip to content

Commit

Permalink
API upgrade (#1361)
Browse files Browse the repository at this point in the history
* Update metadata-protobuf package

* Update types package

* Update polkadot dependencies

* Update schema.graphql

* Align queries to API changes

* Align code to the API changes

* Remove old files from packages/types

* Update and sync polkadot dependencies

* Fix code style issues

* Use metadata in mocking command

* Use id_eq: null in queries

* Update selectMember test util

* Update selectAccount test util

* Refactor selects test utils

* Update post action params

* Fix create post modal tests

Co-authored-by: Piotr Sadlik <[email protected]>
  • Loading branch information
jodator and p-sad authored Sep 7, 2021
1 parent 1ac834e commit cc406bf
Show file tree
Hide file tree
Showing 78 changed files with 5,725 additions and 8,116 deletions.
29 changes: 14 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,19 @@
"eslint": "^7.29.0"
},
"resolutions": {
"@polkadot/api": "4.2.1",
"@polkadot/api-contract": "4.2.1",
"@polkadot/api-derive": "4.2.1",
"@polkadot/hw-ledger": "6.0.5",
"@polkadot/keyring": "6.0.5",
"@polkadot/metadata": "4.2.1",
"@polkadot/networks": "6.0.5",
"@polkadot/rpc-core": "4.2.1",
"@polkadot/rpc-provider": "4.2.1",
"@polkadot/types": "4.2.1",
"@polkadot/types-known": "4.2.1",
"@polkadot/util": "6.0.5",
"@polkadot/util-crypto": "6.0.5",
"@polkadot/wasm-crypto": "4.0.2",
"bn.js": "^5.1.2"
"@polkadot/api": "5.3.2",
"@polkadot/api-contract": "5.3.2",
"@polkadot/api-derive": "5.3.2",
"@polkadot/hw-ledger": "7.1.1",
"@polkadot/keyring": "7.1.1",
"@polkadot/networks": "7.1.1",
"@polkadot/rpc-core": "5.3.2",
"@polkadot/rpc-provider": "5.3.2",
"@polkadot/types": "5.3.2",
"@polkadot/types-known": "5.3.2",
"@polkadot/util": "7.1.1",
"@polkadot/util-crypto": "7.1.1",
"@polkadot/wasm-crypto": "4.2.1",
"bn.js": "^4.11.9"
}
}
96 changes: 96 additions & 0 deletions packages/metadata-protobuf/compiled/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,102 @@ export class ForumPostMetadata implements IForumPostMetadata {
public toJSON(): { [k: string]: any };
}

/** Properties of a ForumThreadMetadata. */
export interface IForumThreadMetadata {

/** ForumThreadMetadata title */
title?: (string|null);

/** ForumThreadMetadata tags */
tags?: (string[]|null);
}

/** Represents a ForumThreadMetadata. */
export class ForumThreadMetadata implements IForumThreadMetadata {

/**
* Constructs a new ForumThreadMetadata.
* @param [properties] Properties to set
*/
constructor(properties?: IForumThreadMetadata);

/** ForumThreadMetadata title. */
public title: string;

/** ForumThreadMetadata tags. */
public tags: string[];

/**
* Creates a new ForumThreadMetadata instance using the specified properties.
* @param [properties] Properties to set
* @returns ForumThreadMetadata instance
*/
public static create(properties?: IForumThreadMetadata): ForumThreadMetadata;

/**
* Encodes the specified ForumThreadMetadata message. Does not implicitly {@link ForumThreadMetadata.verify|verify} messages.
* @param message ForumThreadMetadata message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: IForumThreadMetadata, writer?: $protobuf.Writer): $protobuf.Writer;

/**
* Encodes the specified ForumThreadMetadata message, length delimited. Does not implicitly {@link ForumThreadMetadata.verify|verify} messages.
* @param message ForumThreadMetadata message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: IForumThreadMetadata, writer?: $protobuf.Writer): $protobuf.Writer;

/**
* Decodes a ForumThreadMetadata message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns ForumThreadMetadata
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): ForumThreadMetadata;

/**
* Decodes a ForumThreadMetadata message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns ForumThreadMetadata
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): ForumThreadMetadata;

/**
* Verifies a ForumThreadMetadata message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);

/**
* Creates a ForumThreadMetadata message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns ForumThreadMetadata
*/
public static fromObject(object: { [k: string]: any }): ForumThreadMetadata;

/**
* Creates a plain object from a ForumThreadMetadata message. Also converts values to other types if specified.
* @param message ForumThreadMetadata
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: ForumThreadMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any };

/**
* Converts this ForumThreadMetadata to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
}

/** Properties of a MembershipMetadata. */
export interface IMembershipMetadata {

Expand Down
226 changes: 226 additions & 0 deletions packages/metadata-protobuf/compiled/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,232 @@ $root.ForumPostMetadata = (function() {
return ForumPostMetadata;
})();

$root.ForumThreadMetadata = (function() {

/**
* Properties of a ForumThreadMetadata.
* @exports IForumThreadMetadata
* @interface IForumThreadMetadata
* @property {string|null} [title] ForumThreadMetadata title
* @property {Array.<string>|null} [tags] ForumThreadMetadata tags
*/

/**
* Constructs a new ForumThreadMetadata.
* @exports ForumThreadMetadata
* @classdesc Represents a ForumThreadMetadata.
* @implements IForumThreadMetadata
* @constructor
* @param {IForumThreadMetadata=} [properties] Properties to set
*/
function ForumThreadMetadata(properties) {
this.tags = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}

/**
* ForumThreadMetadata title.
* @member {string} title
* @memberof ForumThreadMetadata
* @instance
*/
ForumThreadMetadata.prototype.title = "";

/**
* ForumThreadMetadata tags.
* @member {Array.<string>} tags
* @memberof ForumThreadMetadata
* @instance
*/
ForumThreadMetadata.prototype.tags = $util.emptyArray;

/**
* Creates a new ForumThreadMetadata instance using the specified properties.
* @function create
* @memberof ForumThreadMetadata
* @static
* @param {IForumThreadMetadata=} [properties] Properties to set
* @returns {ForumThreadMetadata} ForumThreadMetadata instance
*/
ForumThreadMetadata.create = function create(properties) {
return new ForumThreadMetadata(properties);
};

/**
* Encodes the specified ForumThreadMetadata message. Does not implicitly {@link ForumThreadMetadata.verify|verify} messages.
* @function encode
* @memberof ForumThreadMetadata
* @static
* @param {IForumThreadMetadata} message ForumThreadMetadata message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ForumThreadMetadata.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.title != null && Object.hasOwnProperty.call(message, "title"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.title);
if (message.tags != null && message.tags.length)
for (var i = 0; i < message.tags.length; ++i)
writer.uint32(/* id 2, wireType 2 =*/18).string(message.tags[i]);
return writer;
};

/**
* Encodes the specified ForumThreadMetadata message, length delimited. Does not implicitly {@link ForumThreadMetadata.verify|verify} messages.
* @function encodeDelimited
* @memberof ForumThreadMetadata
* @static
* @param {IForumThreadMetadata} message ForumThreadMetadata message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ForumThreadMetadata.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};

/**
* Decodes a ForumThreadMetadata message from the specified reader or buffer.
* @function decode
* @memberof ForumThreadMetadata
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {ForumThreadMetadata} ForumThreadMetadata
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ForumThreadMetadata.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.ForumThreadMetadata();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.title = reader.string();
break;
case 2:
if (!(message.tags && message.tags.length))
message.tags = [];
message.tags.push(reader.string());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};

/**
* Decodes a ForumThreadMetadata message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof ForumThreadMetadata
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {ForumThreadMetadata} ForumThreadMetadata
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ForumThreadMetadata.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};

/**
* Verifies a ForumThreadMetadata message.
* @function verify
* @memberof ForumThreadMetadata
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
ForumThreadMetadata.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.title != null && message.hasOwnProperty("title"))
if (!$util.isString(message.title))
return "title: string expected";
if (message.tags != null && message.hasOwnProperty("tags")) {
if (!Array.isArray(message.tags))
return "tags: array expected";
for (var i = 0; i < message.tags.length; ++i)
if (!$util.isString(message.tags[i]))
return "tags: string[] expected";
}
return null;
};

/**
* Creates a ForumThreadMetadata message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof ForumThreadMetadata
* @static
* @param {Object.<string,*>} object Plain object
* @returns {ForumThreadMetadata} ForumThreadMetadata
*/
ForumThreadMetadata.fromObject = function fromObject(object) {
if (object instanceof $root.ForumThreadMetadata)
return object;
var message = new $root.ForumThreadMetadata();
if (object.title != null)
message.title = String(object.title);
if (object.tags) {
if (!Array.isArray(object.tags))
throw TypeError(".ForumThreadMetadata.tags: array expected");
message.tags = [];
for (var i = 0; i < object.tags.length; ++i)
message.tags[i] = String(object.tags[i]);
}
return message;
};

/**
* Creates a plain object from a ForumThreadMetadata message. Also converts values to other types if specified.
* @function toObject
* @memberof ForumThreadMetadata
* @static
* @param {ForumThreadMetadata} message ForumThreadMetadata
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
ForumThreadMetadata.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.arrays || options.defaults)
object.tags = [];
if (options.defaults)
object.title = "";
if (message.title != null && message.hasOwnProperty("title"))
object.title = message.title;
if (message.tags && message.tags.length) {
object.tags = [];
for (var j = 0; j < message.tags.length; ++j)
object.tags[j] = message.tags[j];
}
return object;
};

/**
* Converts this ForumThreadMetadata to JSON.
* @function toJSON
* @memberof ForumThreadMetadata
* @instance
* @returns {Object.<string,*>} JSON object
*/
ForumThreadMetadata.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};

return ForumThreadMetadata;
})();

$root.MembershipMetadata = (function() {

/**
Expand Down
Loading

0 comments on commit cc406bf

Please sign in to comment.