Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Bump ipfs-http-client from 48.1.1 to 49.0.1 #951

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"eosjs": "^21.0.3",
"eth-multicall": "^1.3.13",
"fast-sort": "^2.2.0",
"ipfs-http-client": "^48.1.0",
"ipfs-http-client": "^49.0.1",
"lodash": "^4.17.15",
"lodash-webpack-plugin": "^0.11.5",
"lodash.debounce": "^4.0.8",
Expand Down
11 changes: 9 additions & 2 deletions src/store/modules/governance/ethGovernance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -571,15 +571,22 @@ export class EthereumGovernance extends VuexModule.With({

let metadata;

for await (const file of ipfs.get(hash, {
for await (const f of ipfs.get(hash, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done because TypeScript doesn't support Explicit type in a "for..of loop"
microsoft/TypeScript#3500

timeout: timeoutInSeconds * 1000
})) {
const file: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done because the docs (although slightly wrong with an extra <>) show this

type: string;
path: string;
content?: AsyncIterable<Uint8Array>;
mode: Number;
mtime?: { secs: Number; nsecs: Number };
} = f;
if (!file.content) continue;

let content = "";

for await (const chunk of file.content) {
content += chunk.toString("utf8");
content += new TextDecoder("utf-8").decode(chunk);
}

metadata = JSON.parse(content);
Expand Down
Loading