@ensdomains/ensjs 3.0.0-alpha.38 → 3.0.0-alpha.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,7 +43,7 @@ const supportedCodecs = [
43
43
  "arweave-ns"
44
44
  ];
45
45
  function matchProtocol(text) {
46
- return text.match(/^(ipfs|sia|ipns|bzz|onion|onion3|arweave):\/\/(.*)/) || text.match(/\/(ipfs)\/(.*)/) || text.match(/\/(ipns)\/(.*)/);
46
+ return text.match(/^(ipfs|sia|ipns|bzz|onion|onion3|arweave|ar):\/\/(.*)/) || text.match(/\/(ipfs)\/(.*)/) || text.match(/\/(ipns)\/(.*)/);
47
47
  }
48
48
  function decodeContenthash(encoded) {
49
49
  let decoded;
@@ -75,7 +75,7 @@ function decodeContenthash(encoded) {
75
75
  } else if (codec === "skynet-ns") {
76
76
  protocolType = "sia";
77
77
  } else if (codec === "arweave-ns") {
78
- protocolType = "arweave";
78
+ protocolType = "ar";
79
79
  } else {
80
80
  decoded = encoded;
81
81
  }
@@ -147,7 +147,7 @@ function encodeContenthash(text) {
147
147
  if (content.length === 46) {
148
148
  encoded = `0x${import_content_hash.default.encode("skynet-ns", content)}`;
149
149
  }
150
- } else if (contentType === "arweave") {
150
+ } else if (contentType === "arweave" || contentType === "ar") {
151
151
  if (content.length === 43) {
152
152
  encoded = `0x${import_content_hash.default.encode("arweave-ns", content)}`;
153
153
  }
@@ -11,7 +11,7 @@ var supportedCodecs = [
11
11
  "arweave-ns"
12
12
  ];
13
13
  function matchProtocol(text) {
14
- return text.match(/^(ipfs|sia|ipns|bzz|onion|onion3|arweave):\/\/(.*)/) || text.match(/\/(ipfs)\/(.*)/) || text.match(/\/(ipns)\/(.*)/);
14
+ return text.match(/^(ipfs|sia|ipns|bzz|onion|onion3|arweave|ar):\/\/(.*)/) || text.match(/\/(ipfs)\/(.*)/) || text.match(/\/(ipns)\/(.*)/);
15
15
  }
16
16
  function decodeContenthash(encoded) {
17
17
  let decoded;
@@ -43,7 +43,7 @@ function decodeContenthash(encoded) {
43
43
  } else if (codec === "skynet-ns") {
44
44
  protocolType = "sia";
45
45
  } else if (codec === "arweave-ns") {
46
- protocolType = "arweave";
46
+ protocolType = "ar";
47
47
  } else {
48
48
  decoded = encoded;
49
49
  }
@@ -115,7 +115,7 @@ function encodeContenthash(text) {
115
115
  if (content.length === 46) {
116
116
  encoded = `0x${contentHash.encode("skynet-ns", content)}`;
117
117
  }
118
- } else if (contentType === "arweave") {
118
+ } else if (contentType === "arweave" || contentType === "ar") {
119
119
  if (content.length === 43) {
120
120
  encoded = `0x${contentHash.encode("arweave-ns", content)}`;
121
121
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ensdomains/ensjs",
3
- "version": "3.0.0-alpha.38",
3
+ "version": "3.0.0-alpha.39",
4
4
  "description": "ENS javascript library for contract interaction",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.mjs",
@@ -19,7 +19,7 @@ const supportedCodecs = [
19
19
 
20
20
  function matchProtocol(text: string) {
21
21
  return (
22
- text.match(/^(ipfs|sia|ipns|bzz|onion|onion3|arweave):\/\/(.*)/) ||
22
+ text.match(/^(ipfs|sia|ipns|bzz|onion|onion3|arweave|ar):\/\/(.*)/) ||
23
23
  text.match(/\/(ipfs)\/(.*)/) ||
24
24
  text.match(/\/(ipns)\/(.*)/)
25
25
  )
@@ -55,7 +55,7 @@ export function decodeContenthash(encoded: any) {
55
55
  } else if (codec === 'skynet-ns') {
56
56
  protocolType = 'sia'
57
57
  } else if (codec === 'arweave-ns') {
58
- protocolType = 'arweave'
58
+ protocolType = 'ar'
59
59
  } else {
60
60
  decoded = encoded
61
61
  }
@@ -132,7 +132,7 @@ export function encodeContenthash(text: string) {
132
132
  if (content.length === 46) {
133
133
  encoded = `0x${contentHash.encode('skynet-ns', content)}`
134
134
  }
135
- } else if (contentType === 'arweave') {
135
+ } else if (contentType === 'arweave' || contentType === 'ar') {
136
136
  if (content.length === 43) {
137
137
  encoded = `0x${contentHash.encode('arweave-ns', content)}`
138
138
  }