Skip to content

Commit 34033cc

Browse files
PAPI upgrade
1 parent 632bbb8 commit 34033cc

File tree

5 files changed

+863
-561
lines changed

5 files changed

+863
-561
lines changed

.papi/descriptors/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"version": "0.1.0-autogenerated.14257783844949306470",
2+
"version": "0.1.0-autogenerated.16713261255167333264",
33
"name": "@polkadot-api/descriptors",
44
"files": [
55
"dist"
66
],
77
"exports": {
88
".": {
9+
"types": "./dist/index.d.ts",
910
"module": "./dist/index.mjs",
1011
"import": "./dist/index.mjs",
11-
"require": "./dist/index.js",
12-
"default": "./dist/index.js"
12+
"require": "./dist/index.js"
1313
},
1414
"./package.json": "./package.json"
1515
},

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
"dependencies": {
2626
"@actions/core": "^1.10.1",
2727
"@actions/github": "^5.1.1",
28-
"@polkadot-api/descriptors": "file:.papi/descriptors",
29-
"polkadot-api": "^0.12.0",
30-
"smoldot": "2.0.29"
28+
"@polkadot-api/descriptors": "portal:.papi/descriptors",
29+
"polkadot-api": "^1.8.2",
30+
"smoldot": "^2.0.34"
3131
},
3232
"devDependencies": {
3333
"@eng-automation/js-style": "^3.1.0",

src/fellows.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { collectives, people } from "@polkadot-api/descriptors";
2-
import { createClient, SS58String } from "polkadot-api";
1+
import { collectives, IdentityData, people } from "@polkadot-api/descriptors";
2+
import { Binary, createClient, SS58String } from "polkadot-api";
33
import { chainSpec as polkadotChainSpec } from "polkadot-api/chains/polkadot";
44
import { chainSpec as collectivesChainSpec } from "polkadot-api/chains/polkadot_collectives";
55
import { chainSpec as peopleChainSpec } from "polkadot-api/chains/polkadot_people";
@@ -51,7 +51,7 @@ export const fetchAllFellows = async (
5151

5252
if (identityOf) {
5353
const [identity] = identityOf;
54-
const github = identity.info.github.value;
54+
const github = readIdentityData(identity.info.github);
5555

5656
if (!github) {
5757
logger.debug(
@@ -139,3 +139,10 @@ export const fetchAllFellows = async (
139139
await smoldot.terminate();
140140
}
141141
};
142+
143+
function readIdentityData(identityData: IdentityData): Binary | null {
144+
if (identityData.type === "None" || identityData.type === "Raw0") return null;
145+
if (identityData.type === "Raw1")
146+
return Binary.fromBytes(new Uint8Array(identityData.value));
147+
return identityData.value;
148+
}

src/test/fellows.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,11 @@ describe("Fellows test", () => {
1414
test("Should fetch fellows", async () => {
1515
const members = await fetchAllFellows(logger);
1616
expect(members.length).toBeGreaterThan(0);
17+
expect(members).toContainEqual(
18+
expect.objectContaining({
19+
rank: 7,
20+
githubHandle: "gavofyork",
21+
}),
22+
);
1723
}, 60_000);
1824
});

0 commit comments

Comments
 (0)