Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
zapaz committed May 6, 2024
1 parent ab67abc commit 3be0a03
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 70 deletions.
8 changes: 4 additions & 4 deletions config/src/mainnets.handlebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"chainName": "arbitrum",
"rpcUrls": [
"https://rpc.ankr.com/arbitrum/{{ANKR_API_KEY}}",
"https://arbitrum-mainnet.infura.io/v3/{{INFURA_API_KEY}}",
"https://arb-mainnet.g.alchemy.com/v2/{{ALCHEMY_API_KEY_ARBITRUM}}"
"https://arb-mainnet.g.alchemy.com/v2/{{ALCHEMY_API_KEY_ARBITRUM}}",
"https://arbitrum-mainnet.infura.io/v3/{{INFURA_API_KEY}}"
],
"nativeCurrency": {
"name": "Ether",
Expand Down Expand Up @@ -77,8 +77,8 @@
"chainName": "optimism",
"rpcUrls": [
"https://rpc.ankr.com/optimism/{{ANKR_API_KEY}}",
"https://optimism-mainnet.infura.io/v3/{{INFURA_API_KEY}}",
"https://opt-mainnet.g.alchemy.com/v2/{{ALCHEMY_API_KEY_OPTIMISM}}",
"https://optimism-mainnet.infura.io/v3/{{INFURA_API_KEY}}",
"https://mainnet.optimism.io"
],
"nativeCurrency": {
Expand Down Expand Up @@ -270,8 +270,8 @@
"chainName": "polygon",
"rpcUrls": [
"https://rpc.ankr.com/polygon/{{ANKR_API_KEY}}",
"https://polygon-mainnet.infura.io/v3/{{INFURA_API_KEY}}",
"https://polygon-mainnet.g.alchemy.com/v2/{{ALCHEMY_API_KEY_POLYGON}}",
"https://polygon-mainnet.infura.io/v3/{{INFURA_API_KEY}}",
"https://polygon-rpc.com/"
],
"nativeCurrency": {
Expand Down
16 changes: 16 additions & 0 deletions svelte/src/components/Global/ButtonAll.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<script lang="ts">
/////////////////////////////////////////////////
// <ButtonOwner bind:{all} />
// Select All button
/////////////////////////////////////////////////
export let all: boolean;
/////////////////////////////////////////////////
</script>

<button
class="clear"
on:click={() => (all = !all)}
title=" {all ? 'Click to View My NFTs' : 'Click to View All NFTs'}"
>
<i class="fas fa-{all ? 'user' : 'users'}" />
</button>
25 changes: 0 additions & 25 deletions svelte/src/components/Global/ButtonOwner.svelte

This file was deleted.

49 changes: 25 additions & 24 deletions svelte/src/components/Main/Dapp.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import AccountConnect from "../Account/AccountConnect.svelte";
import CollectionSelect from "../Collection/CollectionSelect.svelte";
import ButtonOwner from "../Global/ButtonOwner.svelte";
import ButtonAll from "../Global/ButtonAll.svelte";
import ButtonRefresh from "../Global/ButtonRefresh.svelte";
import Create from "../Global/Create.svelte";
import HomeLayout from "../Global/HomeLayout.svelte";
Expand All @@ -18,8 +18,8 @@
import Nft from "../Nft/Nft.svelte";
import Nfts from "../Nfts/Nfts.svelte";
import { metamaskInit, metamaskSwitchChain } from "../../helpers/metamask";
import { refPage2UrlHash, refPageFromUrlHash } from "../../helpers/refPage";
import { metamaskInit, metamaskSwitchChain } from "../../helpers/metamask";
import { metamaskChainId, metamaskSignerAddress } from "../../stores/metamask";
////////////////////////////////////////////////////////////////////
Expand All @@ -29,9 +29,8 @@
let address: string;
let tokenID: string;
let account: string;
let owner: string;
let signer: string;
let all = false;
let initalized = false;
let refreshingCollections = false;
let refreshingNfts = false;
Expand Down Expand Up @@ -73,12 +72,12 @@
if (initalized) resetTokenID();
};
// SET account on signer change
$: isAddressNotZero(signer) && handleSigner();
// SET account on $metamaskSignerAddress change
$: isAddressNotZero($metamaskSignerAddress) && handleSigner();
const handleSigner = async () => {
// console.log("<Dapp handleSigner", initalized, signer);
// console.log("<Dapp handleSigner", initalized, $metamaskSignerAddress);
if (initalized) account = signer;
if (initalized) account = $metamaskSignerAddress;
};
// SET URL HASH on chainId, address or account change
Expand All @@ -88,18 +87,15 @@
const resetAddress = () => {
address = ADDRESS_ZERO;
resetTokenID();
// console.log("<Dapp resetAddress", owner);
};
const resetTokenID = () => {
owner = account;
tokenID = "";
// console.log("<Dapp resetTokenID");
};
onMount(async () => {
// GET optionnal params from URL HASH
const _refHash = refPageFromUrlHash(window.location.hash);
// console.log("<Dapp get _refHash", _refHash);
console.log("<Dapp get _refHash", JSON.stringify(_refHash));
// init Metamask
await metamaskInit();
Expand Down Expand Up @@ -128,13 +124,11 @@
<span slot="header">
<Title />

<Create {chainId} {signer} />

<!-- <BreadCrumb {chainId} {address} {tokenID} {account} {signer} display={true} /> -->
<Create {chainId} />

<div class="row alignbottom">
<div class="col col-xs-12 col-sm-3 kre-copy-ref-container">
<AccountConnect bind:signer />
<AccountConnect />
</div>

<!-- <Networks {chainId} /> -->
Expand All @@ -147,10 +141,10 @@
</div>

<div class="col col-sm-3">
{#if isAddressNotZero(account)}
<ButtonOwner {account} bind:owner />
{/if}
<ButtonRefresh {refresh} />
{#if account && !(tokenIdCount(tokenID) == 1)}
<ButtonAll bind:all />
{/if}
</div>
</div>
</span>
Expand All @@ -160,13 +154,20 @@
{#if tokenIdCount(tokenID) == 1}
<h2 class="m-b-20 return">
<i class="fa fa-arrow-left fa-left" />
<span role="button" tabindex="0" on:click={resetTokenID} on:keydown={resetTokenID} class="link"
>Back to collection</span
>
<span role="button" tabindex="0" on:click={resetTokenID} on:keydown={resetTokenID} class="link">
Back to collection
</span>
</h2>
<Nft {chainId} {address} {tokenID} {owner} details={true} mode="detail" />
<Nft {chainId} {address} {tokenID} owner={account} details={true} mode="detail" />
{:else}
<Nfts {chainId} {address} {owner} bind:tokenID bind:refreshing={refreshingNfts} mode="grid6" />
<Nfts
{chainId}
{address}
owner={all ? ADDRESS_ZERO : account}
bind:tokenID
bind:refreshing={refreshingNfts}
mode="grid6"
/>
{/if}
{/if}
</span>
Expand Down
19 changes: 4 additions & 15 deletions sveltekit/src/lib/components/StatsNetwork2.svelte
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
<script lang="ts">
import type { CollectionType, NetworkType } from "@kredeum/common/src/common/types";
import type { CollectionType } from "@kredeum/common/src/common/types";
import { networks } from "@kredeum/common/src/common/networks";
import HomeLayout from "@kredeum/svelte/src/components/Global/HomeLayout.svelte";
import Navigation from "@kredeum/svelte/src/components/Global/Navigation.svelte";
import {
resolverGetCollectionsInfos,
resolverGetCollectionsAddresses
} from "@kredeum/common/src/resolver/resolver-get-collection";
import {
ADDRESS_DEAD,
ADDRESS_ZERO,
explorerCollectionUrl,
getDappUrl,
getShortAddress
} from "@kredeum/common/src/common/config";
import { collectionStore } from "../../../../svelte/src/stores/collection/collection";
import { resolverGetCollectionsInfos } from "@kredeum/common/src/resolver/resolver-get-collection";
import { ADDRESS_ZERO, explorerCollectionUrl, getDappUrl } from "@kredeum/common/src/common/config";
import { onMount } from "svelte";
import Account from "../../../../svelte/src/components/Account/Account.svelte";
///////////////////////////////////////
// <StatsNetwork {chainId} />
Expand Down Expand Up @@ -62,7 +51,7 @@
<td>{collection.name}</td>
<td>{collection.totalSupply} {collection.symbol}</td>
<td>
<a href="{getDappUrl(chainId, { address: collection.address }, '')}@{ADDRESS_ZERO}" target="_blank"
<a href="{getDappUrl(chainId, { address: collection.address }, '')}" target="_blank"
>view collection</a
>
</td>
Expand Down
1 change: 0 additions & 1 deletion sveltekit/src/lib/components/StatsNetworks.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script lang="ts">
import type { NetworkType } from "@kredeum/common/src/common/types";
import StatsNetworkLine from "./StatsNetworkLine.svelte";
import { stats, statsSort, statsSubTotal, statsSubTotalUpdated } from "$lib/stores/statsCounts";
Expand Down
2 changes: 1 addition & 1 deletion sveltekit/src/routes/stats/[chainId]/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { page } from "$app/stores";
import StatsNetwork from "$lib/components/StatsNetwork.svelte";
import StatsNetwork from "$lib/components/StatsNetwork2.svelte";
</script>

<StatsNetwork chainId={Number($page.params.chainId)} />

0 comments on commit 3be0a03

Please sign in to comment.