Skip to content

Commit

Permalink
PAPI upgrade (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
mutantcornholio authored Jan 17, 2025
1 parent 632bbb8 commit 360f7db
Show file tree
Hide file tree
Showing 6 changed files with 865 additions and 563 deletions.
6 changes: 3 additions & 3 deletions .papi/descriptors/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"version": "0.1.0-autogenerated.14257783844949306470",
"version": "0.1.0-autogenerated.16713261255167333264",
"name": "@polkadot-api/descriptors",
"files": [
"dist"
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"module": "./dist/index.mjs",
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"default": "./dist/index.js"
"require": "./dist/index.js"
},
"./package.json": "./package.json"
},
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ outputs:

runs:
using: 'docker'
image: 'docker://ghcr.io/paritytech/get-fellows-action/action:1.2.0'
image: 'docker://ghcr.io/paritytech/get-fellows-action/action:1.3.0'
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "get-fellows-action",
"version": "1.2.0",
"version": "1.3.0",
"description": "Fetch all the GitHub handles from the Fellows",
"main": "src/index.ts",
"scripts": {
Expand All @@ -25,9 +25,9 @@
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/github": "^5.1.1",
"@polkadot-api/descriptors": "file:.papi/descriptors",
"polkadot-api": "^0.12.0",
"smoldot": "2.0.29"
"@polkadot-api/descriptors": "portal:.papi/descriptors",
"polkadot-api": "^1.8.2",
"smoldot": "^2.0.34"
},
"devDependencies": {
"@eng-automation/js-style": "^3.1.0",
Expand Down
13 changes: 10 additions & 3 deletions src/fellows.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { collectives, people } from "@polkadot-api/descriptors";
import { createClient, SS58String } from "polkadot-api";
import { collectives, IdentityData, people } from "@polkadot-api/descriptors";
import { Binary, createClient, SS58String } from "polkadot-api";
import { chainSpec as polkadotChainSpec } from "polkadot-api/chains/polkadot";
import { chainSpec as collectivesChainSpec } from "polkadot-api/chains/polkadot_collectives";
import { chainSpec as peopleChainSpec } from "polkadot-api/chains/polkadot_people";
Expand Down Expand Up @@ -51,7 +51,7 @@ export const fetchAllFellows = async (

if (identityOf) {
const [identity] = identityOf;
const github = identity.info.github.value;
const github = readIdentityData(identity.info.github);

if (!github) {
logger.debug(
Expand Down Expand Up @@ -139,3 +139,10 @@ export const fetchAllFellows = async (
await smoldot.terminate();
}
};

function readIdentityData(identityData: IdentityData): Binary | null {
if (identityData.type === "None" || identityData.type === "Raw0") return null;
if (identityData.type === "Raw1")
return Binary.fromBytes(new Uint8Array(identityData.value));
return identityData.value;
}
6 changes: 6 additions & 0 deletions src/test/fellows.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,11 @@ describe("Fellows test", () => {
test("Should fetch fellows", async () => {
const members = await fetchAllFellows(logger);
expect(members.length).toBeGreaterThan(0);
expect(members).toContainEqual(
expect.objectContaining({
rank: 7,
githubHandle: "gavofyork",
}),
);
}, 60_000);
});
Loading

0 comments on commit 360f7db

Please sign in to comment.