Skip to content

Commit

Permalink
patch bee-js stream.js file for node
Browse files Browse the repository at this point in the history
  • Loading branch information
zapaz committed Feb 1, 2024
1 parent da921e3 commit 5c8ad1f
Show file tree
Hide file tree
Showing 15 changed files with 53 additions and 30 deletions.
1 change: 0 additions & 1 deletion common/lib/apis/api-thegraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { fetchGQL, FETCH_LIMIT } from "@kredeum/common/lib/common/fetch";
import { keyCollection, keyNft } from "@kredeum/common/lib/common/keys";
import { networks } from "@kredeum/common/lib/common/networks";


const thegraphNftList = async (
chainId: number,
collection: CollectionType,
Expand Down
7 changes: 6 additions & 1 deletion common/lib/collection/collection-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ import { getAbi } from "@kredeum/common/lib/common/artifacts";
import { resolverGetCollection } from "@kredeum/common/lib/resolver/resolver-get-collection";
import { providerGetSignerOrProvider } from "@kredeum/common/lib/common/provider-get";
import { keyCollectionContract, keyCollection } from "@kredeum/common/lib/common/keys";
import { ADDRESS_ZERO, explorerAddressUrl, getChecksumAddress, isAddressNotZero } from "@kredeum/common/lib/common/config";
import {
ADDRESS_ZERO,
explorerAddressUrl,
getChecksumAddress,
isAddressNotZero
} from "@kredeum/common/lib/common/config";
import { isAddress } from "ethers/lib/utils";
import { collectionSupports } from "./collection";

Expand Down
1 change: 0 additions & 1 deletion common/lib/resolver/resolver-get-collection.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import type { CollectionType } from "@kredeum/common/lib/common/types";
import { resolverConvOpenNFTsCollectionInfos } from "@kredeum/common/lib/resolver/resolver-conv-collection-infos";
import { resolverGetContract } from "@kredeum/common/lib/resolver/resolver-get";
Expand Down
1 change: 0 additions & 1 deletion common/lib/resolver/resolver-get-nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { FETCH_LIMIT } from "@kredeum/common/lib/common/fetch";
import { collectionIsERC1155 } from "@kredeum/common/lib/collection/collection";
import { ADDRESS_ZERO } from "@kredeum/common/lib/common/config";


// COLLECTION
// name
// symbol
Expand Down
4 changes: 3 additions & 1 deletion common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"lib": "lib"
},
"scripts": {
"patch:stream": "cd patch && source stream.patch.sh",
"postinstall": "pnpm patch:stream",
"clean": "rm -rf node_modules types abis",
"format": "prettier lib/**/*.ts --write --list-different",
"check": "eslint lib/**/*.ts"
Expand Down Expand Up @@ -47,4 +49,4 @@
"@kredeum/config": "workspace:^",
"@kredeum/contracts": "workspace:^"
}
}
}
1 change: 1 addition & 0 deletions common/patch/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
stream.js
12 changes: 12 additions & 0 deletions common/patch/stream.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- a/stream.js
+++ b/stream.js
@@ -1,7 +1,6 @@
-import { Readable as NodeReadableNative } from 'stream';
import { isStrictlyObject } from "./type.js";
import { ReadableStream } from 'web-streams-polyfill';
-const NodeReadable = NodeReadableNative || class {};
+const NodeReadable = class {};
/**
* Validates if passed object is either browser's ReadableStream
* or Node's Readable.
--
11 changes: 11 additions & 0 deletions common/patch/stream.patch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#/bin/sh

# `source stream.patch.sh` to apply patch
# `source stream.patch.sh -R` to revert patch

DIR="../node_modules/@ethersphere/bee-js/dist/mjs/utils"
cp $DIR/stream.js .

git apply stream.patch $1 2>> /dev/null && cp ./stream.js $DIR

rm stream.js
2 changes: 1 addition & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"build:forge": "forge build",
"build:typechain": "pnpx typechain --target ethers-v5 --out-dir types out/**/*.json",
"check": "pnpm check:solidity",
"check:solidity": "solhint --fix src/**/*.sol",
"check:solidity": "solhint src/**/*.sol",
"clean": "pnpm run clean:foundry && rm -rf node_modules lib types artifacts broadcast",
"clean:foundry": "forge clean && rm -rf cache-forge out",
"deploy:deploy": "pnpm run deploy:all --fork-url $CHAIN --sender $SENDER --account $ACCOUNT --broadcast",
Expand Down
20 changes: 9 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion sveltekit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"test:unit": "vitest"
},
"devDependencies": {

"@ethersproject/providers": "^5.7.2",
"@metamask/detect-provider": "^2.0.0",
"@playwright/test": "^1.41.1",
Expand Down
6 changes: 5 additions & 1 deletion sveltekit/src/lib/components/Global/ButtonOwner.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
onMount(toggleOwner);
</script>

<button class="clear" on:click={toggleOwner} title=" {isAddressNotZero(owner) ? 'Click to View All NFTs' : 'Click to View My NFTs'}">
<button
class="clear"
on:click={toggleOwner}
title=" {isAddressNotZero(owner) ? 'Click to View All NFTs' : 'Click to View My NFTs'}"
>
<i class="fas fa-{isAddressNotZero(owner) ? 'users' : 'user'}" />
</button>
8 changes: 2 additions & 6 deletions sveltekit/src/lib/components/Global/Navigation.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@
</nav>
</div>

<a
class="discord-link"
href="https://discord.gg/Vz5AyU2Nfx"
target="_blank"
rel="noreferrer"
title="Discord Kredeum"><i class="icon-discord" /></a
<a class="discord-link" href="https://discord.gg/Vz5AyU2Nfx" target="_blank" rel="noreferrer" title="Discord Kredeum"
><i class="icon-discord" /></a
>
4 changes: 1 addition & 3 deletions sveltekit/src/lib/components/Input/InputAudioMint.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@
Your browser does not support the
<code>audio</code> element.
</audio>
<span
role="button" tabindex="0"
class="kre-delete-file" on:click={resetFileAudio} on:keydown={resetFileAudio}
<span role="button" tabindex="0" class="kre-delete-file" on:click={resetFileAudio} on:keydown={resetFileAudio}
><i class="fa fa-trash" aria-hidden="true" /></span
>
</div>
Expand Down
4 changes: 2 additions & 2 deletions sveltekit/src/lib/components/Nft/NftTransfer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
/////////////////////////////////////////////////
let transfering: number;
let transferTxHash: string= "";
let transferTxHash: string = "";
let transferError: string;
let destinationAddress = "";
Expand Down Expand Up @@ -83,7 +83,7 @@
transfering = S2_SIGN_TX;
const transferTxResp = (await transferTxRespYield.next()).value;
transferTxHash = transferTxResp?.hash|| "";
transferTxHash = transferTxResp?.hash || "";
if (!transferTxHash)
return _transferError(`ERROR while sending transaction... ${JSON.stringify(transferTxResp, null, 2)}`);
Expand Down

0 comments on commit 5c8ad1f

Please sign in to comment.