Skip to content

Commit

Permalink
PAPI upgrade (#141)
Browse files Browse the repository at this point in the history
Fixes #140
  • Loading branch information
mutantcornholio authored Jan 16, 2025
1 parent 441acc7 commit c16b3df
Show file tree
Hide file tree
Showing 6 changed files with 762 additions and 534 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.9533819768557819421",
"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
Binary file modified .papi/metadata/collectives.scale
Binary file not shown.
Binary file modified .papi/metadata/people.scale
Binary file not shown.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
"@actions/core": "^1.10.1",
"@actions/github": "^6.0.0",
"@eng-automation/js": "^2.2.0",
"@polkadot-api/descriptors": "file:.papi/descriptors",
"@polkadot-api/descriptors": "portal:.papi/descriptors",
"joi": "^17.13.1",
"polkadot-api": "^0.12.0",
"smoldot": "^2.0.29",
"polkadot-api": "^1.8.2",
"smoldot": "^2.0.34",
"yaml": "^2.3.4"
},
"packageManager": "[email protected]",
Expand Down
12 changes: 9 additions & 3 deletions src/polkadot/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, TypedApi } from "polkadot-api";
import { collectives, IdentityData, people } from "@polkadot-api/descriptors";
import { Binary, createClient, SS58String, TypedApi } 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 All @@ -26,7 +26,7 @@ export class PolkadotFellows implements TeamApi {

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

if (!github) {
logger.debug(`'${address}' does not have an additional field named 'github'`);
Expand Down Expand Up @@ -174,3 +174,9 @@ export class PolkadotFellows implements TeamApi {
return users;
}
}

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;
}
Loading

0 comments on commit c16b3df

Please sign in to comment.