From dea8ff289803e188fa78cf3fb94d616b80f8e7d4 Mon Sep 17 00:00:00 2001 From: Daniel Helm Date: Thu, 12 Aug 2021 16:36:13 -0500 Subject: [PATCH 1/2] add Skynet to demo tool --- demo/index.html | 110 ++++++++++++++++++++++++++++------------------ demo/main.js | 9 ++++ package-lock.json | 2 +- package.json | 3 +- 4 files changed, 80 insertions(+), 44 deletions(-) diff --git a/demo/index.html b/demo/index.html index b833840..7d66819 100644 --- a/demo/index.html +++ b/demo/index.html @@ -1,48 +1,74 @@ - - - - Content Hash Calculator - - + + + + Content Hash Calculator - - - - - -

Content Hash Calculator

-

A simple tool to encode/decode content hashes for EIP 1577 compliant ENS Resolvers.

-

You can find content-hash resolvers here :

-

MainNet 0xd3ddccdd3b25a8a7423b5bee360a42146eb4baf3

-

Ropsten 0xde469c7106a9fbc3fb98912bb00be983a89bddca

-

Open the console to use the 'contentHash' object !

-
-

IPFS -> content hash

- - -

-
-
-

Swarm -> content hash

- - -

-
-
-

Decode Content hash

- - -

- + + + + + + + + + + +

Content Hash Calculator

+

A simple tool to encode/decode content hashes for EIP + 1577 compliant ENS Resolvers.

+

You can find content-hash resolvers here :

+

MainNet 0xd3ddccdd3b25a8a7423b5bee360a42146eb4baf3

+

Ropsten 0xde469c7106a9fbc3fb98912bb00be983a89bddca

+

Open the console to use the 'contentHash' object !

+
+

IPFS -> content hash

+ + +

+
+
+

Skynet Skylink -> content hash

+ + +

+
+
+

Swarm -> content hash

+ + +

+
+
+

Decode Content hash

+ + +

+ +
+ + + \ No newline at end of file diff --git a/demo/main.js b/demo/main.js index 5754c5f..ec51acf 100644 --- a/demo/main.js +++ b/demo/main.js @@ -9,6 +9,13 @@ window.onload = () => { ipfsResultElem.innerHTML = contentHash.fromIpfs(ipfsInputElem.value) }) + const skynetInputElem = document.getElementById('skynet-input') + const skynetButtonElem = document.getElementById('skynet-encode') + const skynetResultElem = document.getElementById('skynet-result') + skynetButtonElem.addEventListener('click', () => { + skynetResultElem.innerHTML = contentHash.encode("skynet-ns", skynetInputElem.value) + }) + const swarmInputElem = document.getElementById('swarm-input') const swarmButtonElem = document.getElementById('swarm-encode') const swarmResultElem = document.getElementById('swarm-result') @@ -27,10 +34,12 @@ window.onload = () => { if(contentHash.getCodec(contentInputElem.value) === 'ipfs-ns')codec = 'ipfs' else if(contentHash.getCodec(contentInputElem.value) === 'swarm-ns')codec = 'swarm' + else if(contentHash.getCodec(contentInputElem.value) === 'skynet-ns')codec = 'skynet' let url = 'https://' if(codec === 'ipfs') url += 'gateway.ipfs.io/ipfs/' + cth + '/' else if(codec === 'swarm') url += 'swarm-gateways.net/bzz:/' + cth + '/' + else if(codec === 'skynet') url += 'siasky.net/' + cth + '/' else url = '#' codecResultElem.innerHTML = 'codec : ' + codec diff --git a/package-lock.json b/package-lock.json index 4326825..a637bfd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@ensdomains/content-hash", - "version": "2.5.5", + "version": "2.5.6", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 851ad31..68584bb 100644 --- a/package.json +++ b/package.json @@ -37,10 +37,11 @@ "resolver", "ipfs", "swarm", + "skynet", "content-hash", "content", "hash", "contenthash", "contentHash" ] -} +} \ No newline at end of file From 1515f9b7d1e59a021f304297f8bb2619f04c87d0 Mon Sep 17 00:00:00 2001 From: Daniel Helm Date: Thu, 12 Aug 2021 16:39:27 -0500 Subject: [PATCH 2/2] link to built project --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 688dd61..0f9d0e6 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ >This is a simple package made for encoding and decoding content hashes as specified in the [EIP 1577](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1577.md). This package will be useful for every [Ethereum](https://www.ethereum.org/) developer wanting to interact with [EIP 1577](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1577.md) compliant [ENS resolvers](http://docs.ens.domains/en/latest/introduction.html). -Here you can find a [live demo](https://content-hash.surge.sh/) of this package. +Here you can find a [live demo](https://5g0ab4bfifpa1rcvdainjdc9h6ldmmg4rlgke3rc1g1372mspdeevfg.siasky.net/) of this package. * link to [npm](https://www.npmjs.com/package/content-hash) * link to [Github](https://github.com/pldespaigne/content-hash) @@ -15,6 +15,7 @@ Here you can find a [live demo](https://content-hash.surge.sh/) of this package. - `swarm-ns` - `ipfs-ns` - `ipns-ns` +- `skynet-ns` - Every other codec supported by [multicodec](https://github.com/multiformats/multicodec) will be encoded by default in `utf-8`. > You can see the full list of codec supported [here](https://github.com/multiformats/multicodec/blob/master/table.csv)