Skip to content

Commit

Permalink
Merge pull request #352 from Kredeum/2fixes
Browse files Browse the repository at this point in the history
2fixes
  • Loading branch information
zapaz authored Apr 26, 2023
2 parents cb7721f + cb380b7 commit e249ce3
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 22 deletions.
4 changes: 0 additions & 4 deletions svelte/components/Nft/NftBurn.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
let burnTxHash: string;
let burnError: string;
let refreshAll: Writable<number> = getContext("refreshAll");
const _burnError = (err: string): void => {
burnError = err;
console.error(burnError);
Expand Down Expand Up @@ -97,8 +95,6 @@
burning = S5_BURNED;
nftStoreRemove(chainId, address, tokenID);
$refreshAll += 1;
};
onMount(() => {
Expand Down
2 changes: 0 additions & 2 deletions svelte/components/Nft/NftMintPopup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@
let account: string;
let refreshAll: Writable<number> = getContext("refreshAll");
let address: string;
let price: BigNumber;
Expand Down
9 changes: 3 additions & 6 deletions svelte/components/Nft/NftSetPrice.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import type { Readable } from "svelte/store";
import { Readable } from "svelte/store";
import { BigNumber, constants } from "ethers";
Expand All @@ -21,7 +21,7 @@
import { setTokenPrice } from "@lib/nft/nft-automarket-set";
import { metamaskSignerAddress } from "@stores/metamask";
import { nftStoreAndRefresh, nftStoreRefresh, nftStoreSet } from "@stores/nft/nft";
import { nftStoreAndRefresh, nftStoreRefresh } from "@stores/nft/nft";
import InputPrice from "../Input/InputPrice.svelte";
import NftIncomes from "./NftIncomes.svelte";
Expand Down Expand Up @@ -146,10 +146,7 @@
tokenSettingPrice = S4_PRICE_SETTED;
// console.log("tokenSetPriceTx S4", tokenSettingPrice);
// Set price to nft in store, as onchain data not yet updated
// TODO : make some nsfStoreRemoveAndRefresh() ?
$nft.price = price;
nftStoreSet($nft);
nftStoreRefresh(chainId, address, tokenID);
};
const removeFromSale = async (): Promise<void> => {
Expand Down
7 changes: 2 additions & 5 deletions svelte/components/Nft/NftTransfer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import { transferNft } from "@lib/nft/nft-transfer";
import { metamaskChainId, metamaskSignerAddress } from "@stores/metamask";
import { nftStore, nftStoreRemove } from "@stores/nft/nft";
import { nftStore, nftStoreRefresh } from "@stores/nft/nft";
import InputEthAddress from "../Input/InputEthAddress.svelte";
import { nftRoyaltyMinimum } from "@lib/nft/nft";
Expand All @@ -32,7 +32,6 @@
$: nft = nftStore(chainId, address, tokenID);
/////////////////////////////////////////////////
let refreshAll: Writable<number> = getContext("refreshAll");
let transfering: number;
let transferTxHash: string;
let transferError: string;
Expand Down Expand Up @@ -98,9 +97,7 @@
transfering = S4_TRANSFERED;
nftStoreRemove(chainId, address, tokenID);
$refreshAll += 1;
nftStoreRefresh(chainId, address, tokenID);
};
onMount(() => {
Expand Down
2 changes: 1 addition & 1 deletion svelte/helpers/shortcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const shortcodeOpenSkyNft = (nft: NftType): string =>
nft
)}[/kredeum_opensky]`;

const shortcodeOpenSky = (nft: NftType, coll: boolean): string =>
const shortcodeOpenSky = (nft: NftType, coll = false): string =>
coll ? shortcodeOpenSkyCollection(nft) : shortcodeOpenSkyNft(nft);

export { shortcodeOpenSky, shortcodeOpenSkyNft, shortcodeOpenSkyCollection };
7 changes: 3 additions & 4 deletions svelte/stores/nft/nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@ const nftStoreRefresh = async (chainId: number, address: string, tokenID: string
// console.log("nftStoreRefresh ~ _coll", _coll);

try {
const _nftOld = get(nftListStore).get(keyNft(chainId, address, tokenID));
const _nftOld = get(nftListStore).get(keyNft(chainId, address, tokenID)) || {};
const _nftLib = await nftGet(chainId, address, tokenID, _coll, true);

Object.assign(_nftLib, _nftOld);
const _nftNew = Object.assign(_nftOld, _nftLib);

// console.log("nftStoreRefresh _nftLib", _nftLib);
nftStoreSet(_nftLib);
nftStoreSet(_nftNew);
} catch (err) {
console.info("nftStoreRefresh known", err);
}
Expand Down

0 comments on commit e249ce3

Please sign in to comment.