Skip to content

Commit 2ed44c2

Browse files
committed
fix: add ipfs bs58
1 parent 0915989 commit 2ed44c2

3 files changed

Lines changed: 35 additions & 14 deletions

File tree

packages/toolbox/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,16 @@
2828
"generate:snapshot-org": "bunx genql --endpoint https://hub.snapshot.org/graphql --output ./src/ecosystem/generated/snapshot-org"
2929
},
3030
"dependencies": {
31+
"bs58": "^6.0.0",
3132
"diff": "^8.0.3",
3233
"eventsource": "^4.1.0",
3334
"js-yaml": "^4.1.0"
3435
},
3536
"devDependencies": {
37+
"@aave-dao/aave-delivery-infrastructure": "github:aave-dao/aave-delivery-infrastructure",
38+
"@aave-dao/aave-governance-v3": "github:aave-dao/aave-governance-v3",
3639
"@aave-dao/aave-umbrella": "1.0.0",
3740
"@aave-dao/aave-v3-origin": "3.6.0",
38-
"@aave-dao/aave-governance-v3": "github:aave-dao/aave-governance-v3",
39-
"@aave-dao/aave-delivery-infrastructure": "github:aave-dao/aave-delivery-infrastructure",
4041
"@bgd-labs/aave-address-book": "^4.31.0",
4142
"@bgd-labs/aave-price-feeds": "github:bgd-labs/aave-price-feeds",
4243
"@bgd-labs/solidity-utils": "^1.1.2",

packages/toolbox/src/ecosystem/ipfs.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { CID } from "multiformats/cid";
22
import { sha256 } from "multiformats/hashes/sha2";
33
import * as dagPB from "@ipld/dag-pb";
44
import { UnixFS } from "ipfs-unixfs";
5+
import bs58 from "bs58";
56

67
/**
78
* Generates an IPFS CIDv0 hash for the given content
@@ -29,3 +30,7 @@ export async function hash(content: string | Uint8Array): Promise<string> {
2930

3031
return cid.toString();
3132
}
33+
34+
export async function cidV0ToBs58(cid: string): Promise<string> {
35+
return `0x${Buffer.from(bs58.decode(cid)).slice(2).toString("hex")}`;
36+
}

pnpm-lock.yaml

Lines changed: 27 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)