Skip to content

Commit

Permalink
fix: origins when using web3.storage
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtPooki committed Sep 6, 2023
1 parent a9888e3 commit 654ddfa
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/heliaRemotePinner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class HeliaRemotePinner {
}
}

private async getOrigins (otherOrigins: Pin['origins']): Promise<Set<string>> {
private getOrigins (otherOrigins: Pin['origins']): Set<string> {
const origins = new Set(this.heliaInstance.libp2p.getMultiaddrs().map(multiaddr => multiaddr.toString()))
if (otherOrigins != null) {
for (const origin of otherOrigins) {
Expand Down Expand Up @@ -107,7 +107,8 @@ export class HeliaRemotePinner {
pin: {
...otherArgs,
cid: cid.toString(),
origins: await this.getOrigins(otherArgs.origins)
// @ts-expect-error - broken types: origins needs to be an array of strings
origins: [...this.getOrigins(otherArgs.origins)].filter((_, i) => i < 20) // web3.storage will only accept 20 origins
}
}, {
signal
Expand All @@ -123,7 +124,8 @@ export class HeliaRemotePinner {
pin: {
...otherArgs,
cid: cid.toString(),
origins: await this.getOrigins(otherArgs.origins)
// @ts-expect-error - broken types: origins needs to be an array of strings
origins: [...this.getOrigins(otherArgs.origins)].filter((_, i) => i < 20) // web3.storage will only accept 20 origins
}
}, {
signal
Expand Down

0 comments on commit 654ddfa

Please sign in to comment.