diff --git a/Cargo.toml b/Cargo.toml index 5f58c73..3571a1d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,9 +11,8 @@ categories = ["gui", "wasm", "web-programming"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ipfs-car = "1.1.0" js-sys = "0.3.66" once_cell = "1.18.0" -wasm-bindgen = "0.2.89" +wasm-bindgen = "0.2.90" wasm-bindgen-futures = "0.4.39" yew = { version="0.20", features=["csr"] } diff --git a/index.html b/index.html index cfb44a9..4347a06 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ DECA NFTs - - + + diff --git a/js/car.js b/js/car.js deleted file mode 100644 index c7c3e97..0000000 --- a/js/car.js +++ /dev/null @@ -1,47 +0,0 @@ -/* eslint-env browser */ -import varint from 'varint' -import { encode as cborEncode } from '@ipld/dag-cbor' - -/** - * @param {import('multiformats').UnknownLink[]} roots - * @returns {Uint8Array} - */ -function encodeHeader (roots) { - const headerBytes = cborEncode({ version: 1, roots }) - const varintBytes = varint.encode(headerBytes.length) - const header = new Uint8Array(varintBytes.length + headerBytes.length) - header.set(varintBytes, 0) - header.set(headerBytes, varintBytes.length) - return header -} - -/** - * @param {import('@ipld/unixfs').Block} block - * @returns {Uint8Array} - */ -function encodeBlock (block) { - const varintBytes = varint.encode(block.cid.bytes.length + block.bytes.length) - const bytes = new Uint8Array(varintBytes.length + block.cid.bytes.length + block.bytes.length) - bytes.set(varintBytes) - bytes.set(block.cid.bytes, varintBytes.length) - bytes.set(block.bytes, varintBytes.length + block.cid.bytes.length) - return bytes -} - -/** - * @extends {TransformStream} - */ -export class CAREncoderStream extends TransformStream { - /** @param {import('multiformats').UnknownLink[]} roots */ - constructor (roots = []) { - super({ - start: (controller) => controller.enqueue(encodeHeader(roots)), - transform: (block, controller) => { - controller.enqueue(encodeBlock(block)) - this.finalBlock = block - } - }) - /** @type {import('@ipld/unixfs').Block?} */ - this.finalBlock = null - } -} diff --git a/js/script2.js b/js/script2.js deleted file mode 100644 index d094221..0000000 --- a/js/script2.js +++ /dev/null @@ -1,35 +0,0 @@ -export async function getObj(i) { - let url = 'https://gateway.decentralizedscience.org/ipfs/bafybeiai4g5mluuwr4ds34jkqi4kojsrqxrcetntkp5tf76jhx6mccrybu/'+i+'.json'; - let obj = await (await fetch(url)).json(); - - //console.log(obj); - return obj; -} - -var tags; -export async function createDiv() { - for (var i=1; i<=68; i++) { - tags = await get(i); - var divTag = document.createElement("div"); - divTag.id = "div"+i; - divTag.className = "responsive"; - divTag.innerHTML = ""; - document.body.appendChild(divTag); - } -} diff --git a/package.json b/package.json deleted file mode 100644 index 02a53d5..0000000 --- a/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "dependencies": { - "helia": "^3.0.1", - "ipfs-car": "^1.1.0" - } -} diff --git a/src/bindings.rs b/src/bindings.rs index 1a18434..80ca76e 100644 --- a/src/bindings.rs +++ b/src/bindings.rs @@ -5,7 +5,3 @@ extern "C" { #[wasm_bindgen] pub fn get_now_date() -> String; } - -#[wasm_bindgen(module = "/js/index.js")] -extern "C"{ -}