Skip to content

Commit

Permalink
Merge pull request #89 from ensdomains/mdt/content-hash-update
Browse files Browse the repository at this point in the history
update content-hash to pair with @ensdomains/ui
  • Loading branch information
TateB authored Dec 15, 2022
2 parents 36da5b1 + 796b9fc commit d7b7d87
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/ensjs/src/utils/contentHash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const supportedCodecs = [

function matchProtocol(text: string) {
return (
text.match(/^(ipfs|sia|ipns|bzz|onion|onion3|arweave):\/\/(.*)/) ||
text.match(/^(ipfs|sia|ipns|bzz|onion|onion3|arweave|ar):\/\/(.*)/) ||
text.match(/\/(ipfs)\/(.*)/) ||
text.match(/\/(ipns)\/(.*)/)
)
Expand Down Expand Up @@ -55,7 +55,7 @@ export function decodeContenthash(encoded: any) {
} else if (codec === 'skynet-ns') {
protocolType = 'sia'
} else if (codec === 'arweave-ns') {
protocolType = 'arweave'
protocolType = 'ar'
} else {
decoded = encoded
}
Expand Down Expand Up @@ -132,7 +132,7 @@ export function encodeContenthash(text: string) {
if (content.length === 46) {
encoded = `0x${contentHash.encode('skynet-ns', content)}`
}
} else if (contentType === 'arweave') {
} else if (contentType === 'arweave' || contentType === 'ar') {
if (content.length === 43) {
encoded = `0x${contentHash.encode('arweave-ns', content)}`
}
Expand Down

0 comments on commit d7b7d87

Please sign in to comment.