From 3dd7205fb60862a178b79ee6fdd95e07dce14427 Mon Sep 17 00:00:00 2001 From: tnrdd Date: Tue, 17 Oct 2023 08:04:09 +0200 Subject: [PATCH 01/12] feat: geospatial publisher --- components/Map.tsx | 19 +- components/OffCanvasPanel.tsx | 34 ++-- components/cards/ClaimInfo.tsx | 6 +- components/cards/ParcelInfo.tsx | 118 ++++++----- components/map-style.ts | 50 +++-- components/publisher/GeospatialPublisher.tsx | 17 ++ components/sources/ParcelSource.tsx | 4 +- pages/index.tsx | 195 ++++++++++--------- public/plus-sign.svg | 1 + 9 files changed, 265 insertions(+), 179 deletions(-) create mode 100644 components/publisher/GeospatialPublisher.tsx create mode 100644 public/plus-sign.svg diff --git a/components/Map.tsx b/components/Map.tsx index 421ea233..9e230eb1 100644 --- a/components/Map.tsx +++ b/components/Map.tsx @@ -70,8 +70,8 @@ export enum STATE { PARCEL_EDITING_BID, PARCEL_PLACING_BID, PARCEL_ACCEPTING_BID, - EDITING_GALLERY, EDITING_METADATA, + PUBLISHING, PARCEL_REJECTING_BID, PARCEL_RECLAIMING, } @@ -197,6 +197,8 @@ export type MapProps = { auctionEnd: BigNumber; startingBid: BigNumber; endingBid: BigNumber; + isFullScreen: boolean; + setIsFullScreen: React.Dispatch>; }; const MAP_STYLE_KEY = "storedMapStyleName"; @@ -218,6 +220,8 @@ function Map(props: MapProps) { setSelectedParcelId, interactionState, setInteractionState, + isFullScreen, + setIsFullScreen, } = props; const { data, fetchMore, refetch } = useQuery(query, { variables: { @@ -266,7 +270,7 @@ function Map(props: MapProps) { }; const mapPadding = { - top: 120, + top: isFullScreen ? 0 : 120, bottom: 0, left: 0, right: 0, @@ -467,7 +471,7 @@ function Map(props: MapProps) { } function _onMove(nextViewport: ViewState) { - if (interactionState == STATE.EDITING_GALLERY || mapRef.current == null) { + if (interactionState == STATE.PUBLISHING || mapRef.current == null) { return; } setViewport(nextViewport); @@ -743,7 +747,6 @@ function Map(props: MapProps) { if (_checkParcelClick()) { return; } - setInteractionState(STATE.VIEWING); break; case STATE.PARCEL_EDITING_BID: case STATE.PARCEL_RECLAIMING: @@ -1119,9 +1122,7 @@ function Map(props: MapProps) { position="top-right" hideSearchBar={() => setShowSearchBar(false)} /> - ) : (!isMobile && !isTablet) || - document.body.clientHeight > 800 || - interactionState !== STATE.CLAIM_SELECTING ? ( + ) : (!isMobile && !isTablet) || !isFullScreen ? ( - {(!isMobile && !isTablet) || - document.body.clientHeight > 800 || - interactionState !== STATE.CLAIM_SELECTING ? ( + {(!isMobile && !isTablet) || !isFullScreen ? ( )} @@ -255,7 +256,7 @@ function OffCanvasPanel(props: OffCanvasPanelProps) { variant="link" size="sm" className={`${ - ((!isMobile && !isTablet) || isFullSize) && + ((!isMobile && !isTablet) || isFullScreen) && interactionState !== STATE.CLAIM_SELECTING && interactionState !== STATE.PARCEL_SELECTED ? "visible" @@ -276,7 +277,10 @@ function OffCanvasPanel(props: OffCanvasPanelProps) { src="close.svg" alt="close" width={28} - onClick={() => setInteractionState(STATE.VIEWING)} + onClick={() => { + setInteractionState(STATE.VIEWING); + setIsFullScreen(false); + }} /> @@ -290,8 +294,8 @@ function OffCanvasPanel(props: OffCanvasPanelProps) { parcelFieldsToUpdate={parcelFieldsToUpdate} setParcelFieldsToUpdate={setParcelFieldsToUpdate} licenseAddress={registryContract.address} - isFullSize={isFullSize} - setIsFullSize={setIsFullSize} + isFullScreen={isFullScreen} + setIsFullScreen={setIsFullScreen} key={selectedParcelId} > ) : null} @@ -300,7 +304,7 @@ function OffCanvasPanel(props: OffCanvasPanelProps) { setInteractionState={setInteractionState} parcelClaimInfo={parcelClaimInfo} isValidClaim={isValidClaim} - setIsFullSize={setIsFullSize} + setIsFullScreen={setIsFullScreen} /> ) : null} {interactionState === STATE.CLAIM_SELECTED && diff --git a/components/cards/ClaimInfo.tsx b/components/cards/ClaimInfo.tsx index c5034808..877bcb40 100644 --- a/components/cards/ClaimInfo.tsx +++ b/components/cards/ClaimInfo.tsx @@ -10,11 +10,11 @@ type ClaimInfoProps = { parcelClaimInfo: ParcelClaimInfo; setInteractionState: React.Dispatch>; isValidClaim: boolean; - setIsFullSize: React.Dispatch>; + setIsFullScreen: React.Dispatch>; }; function ClaimInfo(props: ClaimInfoProps) { - const { parcelClaimInfo, setInteractionState, isValidClaim, setIsFullSize } = + const { parcelClaimInfo, setInteractionState, isValidClaim, setIsFullScreen } = props; const { isMobile, isTablet } = useMediaQuery(); @@ -59,7 +59,7 @@ function ClaimInfo(props: ClaimInfoProps) { disabled={!isValidClaim} className="w-100 mb-2" onClick={() => { - setIsFullSize(true); + setIsFullScreen(true); setInteractionState(STATE.CLAIM_SELECTED); }} > diff --git a/components/cards/ParcelInfo.tsx b/components/cards/ParcelInfo.tsx index 5c2035c7..4c0040fd 100644 --- a/components/cards/ParcelInfo.tsx +++ b/components/cards/ParcelInfo.tsx @@ -25,7 +25,7 @@ import EditBidAction from "./EditBidAction"; import EditMetadataAction from "./EditMetadataAction"; import ReclaimAction from "./ReclaimAction"; import { BigNumber } from "ethers"; -import GalleryModal from "../gallery/GalleryModal"; +import GeospatialPublisher from "../publisher/GeospatialPublisher"; import OutstandingBidView from "./OutstandingBidView"; import AuctionInstructions from "../AuctionInstructions"; import PlaceBidAction from "./PlaceBidAction"; @@ -101,6 +101,9 @@ export type ParcelInfoProps = OffCanvasPanelProps & { licenseAddress: string; isFullSize: boolean; setIsFullSize: React.Dispatch>; + geoWebContent: GeoWebContent; + isFullScreen: boolean; + setIsFullScreen: React.Dispatch>; }; function ParcelInfo(props: ParcelInfoProps) { @@ -121,8 +124,8 @@ function ParcelInfo(props: ParcelInfoProps) { setParcelFieldsToUpdate, sfFramework, paymentToken, - isFullSize, - setIsFullSize, + isFullScreen, + setIsFullScreen, } = props; const { isMobile, isTablet } = useMediaQuery(); const { loading, data, refetch } = useQuery(parcelQuery, { @@ -301,23 +304,43 @@ function ParcelInfo(props: ParcelInfoProps) { className="w-100" onClick={() => { setInteractionState(STATE.PARCEL_SELECTED); - setIsFullSize(true); + setIsFullScreen(true); }} > Cancel ); + const editButton = ( + + ); + const editGalleryButton = ( ); @@ -328,7 +351,7 @@ function ParcelInfo(props: ParcelInfoProps) { className="w-100" onClick={() => { setInteractionState(STATE.PARCEL_PLACING_BID); - setIsFullSize(true); + setIsFullScreen(true); }} > Place Bid @@ -359,6 +382,8 @@ function ParcelInfo(props: ParcelInfoProps) { ? "Reclaim Parcel" : interactionState === STATE.PARCEL_RECLAIMING ? "Forclosure Claim" + : interactionState === STATE.PUBLISHING + ? "Geospatial Publisher" : isMobile || isTablet || interactionState === STATE.CLAIM_SELECTING || @@ -368,7 +393,7 @@ function ParcelInfo(props: ParcelInfoProps) { header = ( @@ -525,38 +550,40 @@ function ParcelInfo(props: ParcelInfoProps) { interactionState == STATE.PARCEL_ACCEPTING_BID || interactionState == STATE.PARCEL_REJECTING_BID || interactionState == STATE.EDITING_METADATA || - interactionState == STATE.EDITING_GALLERY)) ? ( - - - - For Sale Price: -
- {isLoading || parcelFieldsToUpdate?.forSalePrice - ? spinner - : forSalePrice} - {!isLoading && - accountAddress === licenseOwner && - !invalidLicenseId && - !parcelFieldsToUpdate?.forSalePrice && ( - Edit Price} - > - - - )} + + + )} +
@@ -725,12 +752,15 @@ function ParcelInfo(props: ParcelInfoProps) { ) : null}
- {interactionState == STATE.EDITING_GALLERY && ( - + */ + > )} ); diff --git a/components/map-style.ts b/components/map-style.ts index ac258f03..05dfff6e 100644 --- a/components/map-style.ts +++ b/components/map-style.ts @@ -54,15 +54,43 @@ export const cellHoverLayer: LayerProps = { "fill-opacity": 0.75, }, }; -export const parcelLayer: LayerProps = { - id: "parcels-layer", - type: "fill", - paint: { - "fill-color": "#2FC1C1", - "fill-opacity": 0.5, - "fill-outline-color": "#000000", - }, -}; +export function parcelBorderLayer( + parcelHoverId: string, + selectedParcelId: string +): LayerProps { + return { + id: "parcel-border-layer", + type: "line", + paint: { + "line-color": "#2FC1C1", + "line-width": 2, + }, + filter: [ + "any", + ["==", "parcelId", parcelHoverId], + ["==", "parcelId", selectedParcelId], + ], + }; +} +export function parcelLayer( + parcelHoverId: string, + selectedParcelId: string +): LayerProps { + return { + id: "parcels-layer", + type: "fill", + paint: { + "fill-color": "#2FC1C1", + "fill-opacity": 0.5, + "fill-outline-color": "#000000", + }, + filter: [ + "all", + ["!=", "parcelId", parcelHoverId], + ["!=", "parcelId", selectedParcelId], + ], + }; +} export function parcelHighlightLayer( parcelHoverId: string, selectedParcelId: string @@ -72,8 +100,8 @@ export function parcelHighlightLayer( type: "fill", paint: { "fill-color": "#2FC1C1", - "fill-opacity": 0.75, - "fill-outline-color": "#000000", + "fill-opacity": 0.2, + "fill-outline-color": "#2FC1C1", }, filter: [ "any", diff --git a/components/publisher/GeospatialPublisher.tsx b/components/publisher/GeospatialPublisher.tsx new file mode 100644 index 00000000..1ed5d65f --- /dev/null +++ b/components/publisher/GeospatialPublisher.tsx @@ -0,0 +1,17 @@ +import { useState } from "react"; +import Button from "react-bootstrap/Button"; +import Image from "react-bootstrap/Image"; + +export default function GeospatialPublisher() { + return ( + <> +

Add augments to your parcel.

+ + + ); +} diff --git a/components/sources/ParcelSource.tsx b/components/sources/ParcelSource.tsx index 157068b1..3c94cb38 100644 --- a/components/sources/ParcelSource.tsx +++ b/components/sources/ParcelSource.tsx @@ -6,6 +6,7 @@ import { parcelLayer, parcelHighlightLayer, parcelInvalidLayer, + parcelBorderLayer, } from "../map-style"; import type { Polygon, MultiPolygon, Position } from "@turf/turf"; import * as turf from "@turf/turf"; @@ -80,7 +81,8 @@ function ParcelSource(props: Props) { features: geoJsonFeatures, }} > - + + {invalidLicenseId == selectedParcelId && ( diff --git a/pages/index.tsx b/pages/index.tsx index ac13e182..96858e64 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -151,6 +151,7 @@ function IndexPage({ null ); const [w3Client, setW3Client] = React.useState(null); + const [isFullScreen, setIsFullScreen] = React.useState(false); const { chain } = useNetwork(); const { address } = useAccount(); @@ -430,102 +431,104 @@ function IndexPage({ return ( <> - - - -
- - Cadastre - BETA -
- - - - - - {address && - signer && - (smartAccount?.loginState === LoginState.CONNECTED || - smartAccount?.loginState === LoginState.CREATE || - smartAccount?.loginState === LoginState.CONNECTING || - smartAccount?.loginState === LoginState.FUND) && - sfFramework && - ceramic && - ipfs && - ceramic.did && - geoWebContent && - registryContract && - paymentToken && - chain?.id === NETWORK_ID && - library ? ( - - ) : ( - - )} - - - - - + - - - -
+ +
+ + Cadastre + BETA +
+ + + + + + {address && + signer && + (smartAccount?.loginState === LoginState.CONNECTED || + smartAccount?.loginState === LoginState.CREATE || + smartAccount?.loginState === LoginState.CONNECTING || + smartAccount?.loginState === LoginState.FUND) && + sfFramework && + ceramic && + ipfs && + ceramic.did && + geoWebContent && + registryContract && + paymentToken && + chain?.id === NETWORK_ID && + library ? ( + + ) : ( + + )} + + + + + + + + + + )} {registryContract && paymentToken && @@ -567,6 +570,8 @@ function IndexPage({ auctionEnd={auctionEnd} startingBid={startingBid} endingBid={endingBid} + isFullScreen={isFullScreen} + setIsFullScreen={setIsFullScreen} > ) : ( diff --git a/public/plus-sign.svg b/public/plus-sign.svg new file mode 100644 index 00000000..1505d515 --- /dev/null +++ b/public/plus-sign.svg @@ -0,0 +1 @@ + From 884d12cbebf818bebfb70417eea2c4113c900cc9 Mon Sep 17 00:00:00 2001 From: tnrdd Date: Wed, 15 Nov 2023 07:34:55 +0100 Subject: [PATCH 02/12] feat: add publishing form --- components/cards/ParcelInfo.tsx | 45 +-- components/publisher/AugmentPublisher.tsx | 69 ++++ components/publisher/GeospatialPublisher.tsx | 17 - components/publisher/PublishingForm.tsx | 317 +++++++++++++++++++ pages/index.tsx | 6 +- public/audio.svg | 4 + public/confirm.svg | 4 + public/image.svg | 4 + public/location-off.svg | 4 + public/location-on.svg | 4 + public/model.svg | 4 + public/video.svg | 4 + styles.scss | 12 + 13 files changed, 445 insertions(+), 49 deletions(-) create mode 100644 components/publisher/AugmentPublisher.tsx delete mode 100644 components/publisher/GeospatialPublisher.tsx create mode 100644 components/publisher/PublishingForm.tsx create mode 100644 public/audio.svg create mode 100644 public/confirm.svg create mode 100644 public/image.svg create mode 100644 public/location-off.svg create mode 100644 public/location-on.svg create mode 100644 public/model.svg create mode 100644 public/video.svg diff --git a/components/cards/ParcelInfo.tsx b/components/cards/ParcelInfo.tsx index 4c0040fd..e66982cc 100644 --- a/components/cards/ParcelInfo.tsx +++ b/components/cards/ParcelInfo.tsx @@ -25,7 +25,7 @@ import EditBidAction from "./EditBidAction"; import EditMetadataAction from "./EditMetadataAction"; import ReclaimAction from "./ReclaimAction"; import { BigNumber } from "ethers"; -import GeospatialPublisher from "../publisher/GeospatialPublisher"; +import AugmentPublisher from "../publisher/AugmentPublisher"; import OutstandingBidView from "./OutstandingBidView"; import AuctionInstructions from "../AuctionInstructions"; import PlaceBidAction from "./PlaceBidAction"; @@ -99,9 +99,6 @@ export type ParcelInfoProps = OffCanvasPanelProps & { >; minForSalePrice: BigNumber; licenseAddress: string; - isFullSize: boolean; - setIsFullSize: React.Dispatch>; - geoWebContent: GeoWebContent; isFullScreen: boolean; setIsFullScreen: React.Dispatch>; }; @@ -148,7 +145,8 @@ function ParcelInfo(props: ParcelInfoProps) { registryContract, selectedParcelId ); - const { getParcelCoords } = useParcelNavigation(selectedParcelId); + const { getParcelCoords, flyToParcel } = + useParcelNavigation(selectedParcelId); const spinner = ( @@ -311,19 +309,6 @@ function ParcelInfo(props: ParcelInfoProps) { ); - const editButton = ( - - ); - const editGalleryButton = ( ); @@ -364,7 +349,9 @@ function ParcelInfo(props: ParcelInfoProps) { if ( interactionState === STATE.CLAIM_SELECTING || interactionState === STATE.CLAIM_SELECTED || - (interactionState !== STATE.PARCEL_SELECTED && (isMobile || isTablet)) + (interactionState !== STATE.PARCEL_SELECTED && + interactionState !== STATE.PUBLISHING && + (isMobile || isTablet)) ) { const headerText = interactionState === STATE.PARCEL_PLACING_BID @@ -382,8 +369,6 @@ function ParcelInfo(props: ParcelInfoProps) { ? "Reclaim Parcel" : interactionState === STATE.PARCEL_RECLAIMING ? "Forclosure Claim" - : interactionState === STATE.PUBLISHING - ? "Geospatial Publisher" : isMobile || isTablet || interactionState === STATE.CLAIM_SELECTING || @@ -406,7 +391,8 @@ function ParcelInfo(props: ParcelInfoProps) { ? `${SPATIAL_DOMAIN}?latitude=${selectedParcelCoords[1]}&longitude=${selectedParcelCoords[0]}` : SPATIAL_DOMAIN; header = - interactionState === STATE.PARCEL_SELECTED || (!isMobile && !isTablet) ? ( + interactionState === STATE.PARCEL_SELECTED || + (!isMobile && !isTablet && interactionState !== STATE.PUBLISHING) ? ( <>
{ setInteractionState(STATE.EDITING_METADATA); - setIsFullSize(true); + setIsFullScreen(true); }} > add link @@ -468,7 +454,7 @@ function ParcelInfo(props: ParcelInfoProps) { className="p-0 pe-1 me-4" onClick={() => { setInteractionState(STATE.EDITING_METADATA); - setIsFullSize(true); + setIsFullScreen(true); }} > edit @@ -549,8 +535,7 @@ function ParcelInfo(props: ParcelInfoProps) { interactionState == STATE.PARCEL_PLACING_BID || interactionState == STATE.PARCEL_ACCEPTING_BID || interactionState == STATE.PARCEL_REJECTING_BID || - interactionState == STATE.EDITING_METADATA || - interactionState == STATE.PUBLISHING)) ? ( + interactionState == STATE.EDITING_METADATA)) ? ( @@ -573,7 +558,7 @@ function ParcelInfo(props: ParcelInfoProps) { className="p-0 m-0 shadow-none" onClick={() => { setInteractionState(STATE.PARCEL_EDITING_BID); - setIsFullSize(true); + setIsFullScreen(true); }} > {interactionState == STATE.PUBLISHING && ( - + > )} ); diff --git a/components/publisher/AugmentPublisher.tsx b/components/publisher/AugmentPublisher.tsx new file mode 100644 index 00000000..5cd3e91f --- /dev/null +++ b/components/publisher/AugmentPublisher.tsx @@ -0,0 +1,69 @@ +import { useState } from "react"; +import Button from "react-bootstrap/Button"; +import Image from "react-bootstrap/Image"; +import Dropdown from "react-bootstrap/Dropdown"; +import PublishingForm from "./PublishingForm"; + +export enum AugmentType { + MODEL = "3D Model", + IMAGE = "Image", + AUDIO = "Audio", + VIDEO = "Video", +} + +export default function AugmentPublisher() { + const [showForm, setShowForm] = useState(false); + const [augmentType, setAugmentType] = useState( + AugmentType.MODEL + ); + + return ( + <> + {!showForm && ( + <> +

Augment Publisher

+

Add augments to your parcel.

+ + )} + {showForm ? ( + + ) : ( +
+ + + {augmentType} + + + + setAugmentType(AugmentType.MODEL)}> + {AugmentType.MODEL} + + setAugmentType(AugmentType.IMAGE)}> + {AugmentType.IMAGE} + + setAugmentType(AugmentType.AUDIO)}> + {AugmentType.AUDIO} + + setAugmentType(AugmentType.VIDEO)}> + {AugmentType.VIDEO} + + + + +
+ )} + + ); +} diff --git a/components/publisher/GeospatialPublisher.tsx b/components/publisher/GeospatialPublisher.tsx deleted file mode 100644 index 1ed5d65f..00000000 --- a/components/publisher/GeospatialPublisher.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { useState } from "react"; -import Button from "react-bootstrap/Button"; -import Image from "react-bootstrap/Image"; - -export default function GeospatialPublisher() { - return ( - <> -

Add augments to your parcel.

- - - ); -} diff --git a/components/publisher/PublishingForm.tsx b/components/publisher/PublishingForm.tsx new file mode 100644 index 00000000..695cd581 --- /dev/null +++ b/components/publisher/PublishingForm.tsx @@ -0,0 +1,317 @@ +import { useState } from "react"; +import Button from "react-bootstrap/Button"; +import Image from "react-bootstrap/Image"; +import Form from "react-bootstrap/Form"; +import InputGroup from "react-bootstrap/InputGroup"; +import { AugmentType } from "./AugmentPublisher"; + +type PublishingFormProps = { + augmentType: AugmentType; + setShowForm: React.Dispatch>; +}; + +type AugmentArgs = { + contentURI: string; + name: string; + coords: { lat: string; lon: string }; + altitude: string; + orientation: string; + displayScale: string; + displayWidth: string; + audioVolume: string; +}; + +export default function PublishingForm(props: PublishingFormProps) { + const { augmentType, setShowForm } = props; + + const [isLocationOn, setIsLocationOn] = useState(false); + const [augmentArgs, setAugmentArgs] = useState({ + contentURI: "", + name: "", + coords: { lat: "", lon: "" }, + altitude: "", + orientation: "", + displayScale: "", + displayWidth: "", + audioVolume: "", + }); + + const title = ( +
+ { +

{augmentType}

+
+ ); + + return ( + <> + {title} + + Important: Geo-anchored augments rely on street mapping data for + positioning. For best results, place your anchor within direct view of a + publicly accessible road (i.e. front yards). + +
e.preventDefault()}> + + + + + + setAugmentArgs({ ...augmentArgs, name: e.target.value }) + } + /> + + + + + + setAugmentArgs({ + ...augmentArgs, + coords: { + ...augmentArgs.coords, + lat: e.target.value, + }, + }) + } + /> + + + setAugmentArgs({ + ...augmentArgs, + coords: { + ...augmentArgs.coords, + lon: e.target.value, + }, + }) + } + /> + + + + setAugmentArgs({ + ...augmentArgs, + altitude: e.target.value, + }) + } + /> + {augmentArgs.altitude && ( + + m + + )} + + + + setAugmentArgs({ + ...augmentArgs, + orientation: e.target.value, + }) + } + /> + {augmentArgs.orientation && ( + + ° + + )} + + {augmentType === AugmentType.MODEL ? ( + + + setAugmentArgs({ + ...augmentArgs, + displayScale: e.target.value, + }) + } + /> + {augmentArgs.displayScale && ( + + % + + )} + + ) : augmentType === AugmentType.IMAGE || + augmentType === AugmentType.VIDEO ? ( + + + setAugmentArgs({ + ...augmentArgs, + displayWidth: e.target.value, + }) + } + /> + {augmentArgs.displayWidth && ( + + m + + )} + + ) : augmentType === AugmentType.AUDIO ? ( + <> + console.log(e.target.value)} + > + + + + + + + + setAugmentArgs({ + ...augmentArgs, + audioVolume: e.target.value, + }) + } + /> + {augmentArgs.audioVolume && ( + + % + + )} + + + ) : null} + *Required field +
+ + +
+
+ + ); +} diff --git a/pages/index.tsx b/pages/index.tsx index 96858e64..53eb6909 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -61,6 +61,7 @@ import { SiweMessage } from "@didtools/cacao"; import axios from "axios"; import type { AuthenticationStatus } from "@rainbow-me/rainbowkit"; import * as u8a from "uint8arrays"; +import { useMediaQuery } from "../lib/mediaQuery"; const { httpClient, jsIpfs } = providers; @@ -156,6 +157,7 @@ function IndexPage({ const { chain } = useNetwork(); const { address } = useAccount(); const { data: signer } = useSigner(); + const { isMobile, isTablet } = useMediaQuery(); async function resetSession() { const store = new StoreIndexedDB("w3up-client"); @@ -431,7 +433,7 @@ function IndexPage({ return ( <> - {!isFullScreen && ( + {(!isMobile && !isTablet) || !isFullScreen ? ( - )} + ) : null} {registryContract && paymentToken && diff --git a/public/audio.svg b/public/audio.svg new file mode 100644 index 00000000..cc95dea5 --- /dev/null +++ b/public/audio.svg @@ -0,0 +1,4 @@ + + + + diff --git a/public/confirm.svg b/public/confirm.svg new file mode 100644 index 00000000..e1e99632 --- /dev/null +++ b/public/confirm.svg @@ -0,0 +1,4 @@ + + + + diff --git a/public/image.svg b/public/image.svg new file mode 100644 index 00000000..c2860e61 --- /dev/null +++ b/public/image.svg @@ -0,0 +1,4 @@ + + + + diff --git a/public/location-off.svg b/public/location-off.svg new file mode 100644 index 00000000..04848b9f --- /dev/null +++ b/public/location-off.svg @@ -0,0 +1,4 @@ + + + + diff --git a/public/location-on.svg b/public/location-on.svg new file mode 100644 index 00000000..54d8e1b1 --- /dev/null +++ b/public/location-on.svg @@ -0,0 +1,4 @@ + + + + diff --git a/public/model.svg b/public/model.svg new file mode 100644 index 00000000..f73219e2 --- /dev/null +++ b/public/model.svg @@ -0,0 +1,4 @@ + + + + diff --git a/public/video.svg b/public/video.svg new file mode 100644 index 00000000..2d5d2697 --- /dev/null +++ b/public/video.svg @@ -0,0 +1,4 @@ + + + + diff --git a/styles.scss b/styles.scss index 6a6972b2..49821ab2 100644 --- a/styles.scss +++ b/styles.scss @@ -54,6 +54,18 @@ body { overscroll-behavior: none; } +/* Chrome, Safari, Edge, Opera */ +input::-webkit-outer-spin-button, +input::-webkit-inner-spin-button { + -webkit-appearance: none; + margin: 0; +} + +/* Firefox */ +input[type="number"] { + -moz-appearance: textfield; +} + .mapboxgl-canvas { background-color: black; } From 1706533ce958014d0ccb97205c0d5c6ede9cb4ee Mon Sep 17 00:00:00 2001 From: tnrdd Date: Thu, 30 Nov 2023 14:10:59 +0100 Subject: [PATCH 03/12] build: port to vite --- .env.mainnet | 35 +- .env.testnet | 35 +- .eslintrc.json | 49 +- .github/workflows/main.yml | 6 +- .github/workflows/prettier.yml | 2 + .gitignore | 2 +- components/gallery/GalleryDisplayGrid.tsx | 76 - components/gallery/GalleryDisplayItem.tsx | 141 - components/gallery/GalleryFileFormat.ts | 44 - components/gallery/GalleryForm.tsx | 434 - components/gallery/GalleryModal.tsx | 426 - components/gallery/UploadNFTModal.tsx | 228 - config-overrides.js | 37 - dec.d.ts | 4 +- index.html | 18 + lib/constants.ts | 48 - lib/geo-web-content/mediaGallery.ts | 107 - localhost-key.pem | 28 + localhost.pem | 25 + next-env.d.ts | 5 - next.config.js | 36 - package.json | 87 +- public/index.html | 42 - pages/_app.tsx => src/App.tsx | 22 +- .../components}/ApproveButton.tsx | 0 .../components}/AuctionInstructions.tsx | 0 .../components}/ConnectWallet.tsx | 2 +- .../components}/CopyTokenAddress.tsx | 0 .../components}/CopyTooltip.tsx | 0 {components => src/components}/FAQ.tsx | 12 +- .../components}/FundsRaisedCounter.tsx | 0 {components => src/components}/Home.tsx | 0 .../components}/InfoTooltip.tsx | 0 {components => src/components}/Map.tsx | 46 +- .../components}/NotificationModal.tsx | 0 .../components}/OffCanvasPanel.tsx | 4 +- .../components}/OnRampWidget.tsx | 0 .../components}/OpRewardAlert.tsx | 0 .../components}/PerformButton.tsx | 0 {components => src/components}/Spinner.tsx | 0 .../components}/SubmitBundleButton.tsx | 0 .../components}/TransactionBundleDetails.tsx | 2 +- .../TransactionBundleSettingsModal.tsx | 2 +- .../TransactionBundleSettingsView.tsx | 4 +- .../components}/WelcomeChecklist.tsx | 0 .../components}/cards/AcceptBidAction.tsx | 0 .../components}/cards/ActionForm.tsx | 2 +- .../components}/cards/AuctionInfo.tsx | 12 +- .../components}/cards/ClaimAction.tsx | 4 +- .../components}/cards/ClaimInfo.tsx | 8 +- .../components}/cards/EditBidAction.tsx | 0 .../components}/cards/EditMetadataAction.tsx | 4 +- .../components}/cards/OutstandingBidView.tsx | 0 .../components}/cards/ParcelInfo.tsx | 90 +- .../components}/cards/PlaceBidAction.tsx | 2 +- .../components}/cards/ReclaimAction.tsx | 0 .../components}/cards/RejectBidAction.tsx | 2 +- .../components}/cards/StreamingInfo.tsx | 8 +- .../components}/cards/TransactionError.tsx | 0 .../cards/TransactionSummaryView.tsx | 11 +- {components => src/components}/map-style.ts | 0 .../components}/nav/NavMenu.tsx | 2 +- .../components}/parcels/Foreclosure.tsx | 0 .../components}/parcels/HighestValue.tsx | 0 .../components}/parcels/NeedsTransfer.tsx | 0 .../components}/parcels/OutstandingBid.tsx | 0 .../components}/parcels/ParcelList.tsx | 2 - .../components}/parcels/ParcelTable.tsx | 0 .../components}/parcels/Random.tsx | 0 .../components}/parcels/Recent.tsx | 0 .../components}/profile/AddFundsModal.tsx | 4 +- .../profile/ConnectAccountModal.tsx | 4 +- .../components}/profile/FlowingBalance.tsx | 0 .../components}/profile/Profile.tsx | 14 +- .../components}/profile/ProfileModal.tsx | 7 +- .../publisher/AugmentPublisher.tsx | 4 + .../components}/publisher/PublishingForm.tsx | 0 .../components}/sources/CellHoverSource.tsx | 0 .../components}/sources/ClaimSource.tsx | 0 .../components}/sources/GridSource.tsx | 0 .../components}/sources/ParcelSource.tsx | 2 +- .../components}/wrap/WrapModal.tsx | 0 {lib => src/lib}/Firebase.ts | 0 {lib => src/lib}/Geocoder.tsx | 0 src/lib/MUDContext.tsx | 23 + {lib => src/lib}/calculateRequiredBid.ts | 0 {lib => src/lib}/calculateWeiSubtotalField.ts | 0 src/lib/constants.ts | 58 + {lib => src/lib}/formatBalance.ts | 0 .../lib}/geo-web-content/basicProfile.ts | 0 src/lib/geo-web-content/world.ts | 88 + {lib => src/lib}/getBalance.ts | 0 {lib => src/lib}/mediaQuery.ts | 2 +- {lib => src/lib}/parcelNavigation.ts | 0 {lib => src/lib}/safe.ts | 6 +- {lib => src/lib}/superTokenBalance.ts | 0 .../lib}/transactionBundleSettings.tsx | 0 {lib => src/lib}/truncate.ts | 0 {lib => src/lib}/utils.ts | 0 src/main.tsx | 25 + pages/index.tsx => src/pages/IndexPage.tsx | 155 +- {redux => src/redux}/store.ts | 12 +- styles.scss => src/styles.scss | 8 +- tsconfig.json | 23 +- vite.config.ts | 50 + ....timestamp-1701355840815-a55d7958aaade.mjs | 55 + yarn.lock | 40248 +++++----------- 107 files changed, 11898 insertions(+), 31046 deletions(-) delete mode 100644 components/gallery/GalleryDisplayGrid.tsx delete mode 100644 components/gallery/GalleryDisplayItem.tsx delete mode 100644 components/gallery/GalleryFileFormat.ts delete mode 100644 components/gallery/GalleryForm.tsx delete mode 100644 components/gallery/GalleryModal.tsx delete mode 100644 components/gallery/UploadNFTModal.tsx delete mode 100644 config-overrides.js create mode 100644 index.html delete mode 100644 lib/constants.ts delete mode 100644 lib/geo-web-content/mediaGallery.ts create mode 100644 localhost-key.pem create mode 100644 localhost.pem delete mode 100644 next-env.d.ts delete mode 100644 next.config.js delete mode 100644 public/index.html rename pages/_app.tsx => src/App.tsx (93%) rename {components => src/components}/ApproveButton.tsx (100%) rename {components => src/components}/AuctionInstructions.tsx (100%) rename {components => src/components}/ConnectWallet.tsx (98%) rename {components => src/components}/CopyTokenAddress.tsx (100%) rename {components => src/components}/CopyTooltip.tsx (100%) rename {components => src/components}/FAQ.tsx (97%) rename {components => src/components}/FundsRaisedCounter.tsx (100%) rename {components => src/components}/Home.tsx (100%) rename {components => src/components}/InfoTooltip.tsx (100%) rename {components => src/components}/Map.tsx (96%) rename {components => src/components}/NotificationModal.tsx (100%) rename {components => src/components}/OffCanvasPanel.tsx (99%) rename {components => src/components}/OnRampWidget.tsx (100%) rename {components => src/components}/OpRewardAlert.tsx (100%) rename {components => src/components}/PerformButton.tsx (100%) rename {components => src/components}/Spinner.tsx (100%) rename {components => src/components}/SubmitBundleButton.tsx (100%) rename {components => src/components}/TransactionBundleDetails.tsx (99%) rename {components => src/components}/TransactionBundleSettingsModal.tsx (98%) rename {components => src/components}/TransactionBundleSettingsView.tsx (99%) rename {components => src/components}/WelcomeChecklist.tsx (100%) rename {components => src/components}/cards/AcceptBidAction.tsx (100%) rename {components => src/components}/cards/ActionForm.tsx (99%) rename {components => src/components}/cards/AuctionInfo.tsx (93%) rename {components => src/components}/cards/ClaimAction.tsx (98%) rename {components => src/components}/cards/ClaimInfo.tsx (95%) rename {components => src/components}/cards/EditBidAction.tsx (100%) rename {components => src/components}/cards/EditMetadataAction.tsx (99%) rename {components => src/components}/cards/OutstandingBidView.tsx (100%) rename {components => src/components}/cards/ParcelInfo.tsx (90%) rename {components => src/components}/cards/PlaceBidAction.tsx (99%) rename {components => src/components}/cards/ReclaimAction.tsx (100%) rename {components => src/components}/cards/RejectBidAction.tsx (99%) rename {components => src/components}/cards/StreamingInfo.tsx (93%) rename {components => src/components}/cards/TransactionError.tsx (100%) rename {components => src/components}/cards/TransactionSummaryView.tsx (98%) rename {components => src/components}/map-style.ts (100%) rename {components => src/components}/nav/NavMenu.tsx (98%) rename {components => src/components}/parcels/Foreclosure.tsx (100%) rename {components => src/components}/parcels/HighestValue.tsx (100%) rename {components => src/components}/parcels/NeedsTransfer.tsx (100%) rename {components => src/components}/parcels/OutstandingBid.tsx (100%) rename {components => src/components}/parcels/ParcelList.tsx (98%) rename {components => src/components}/parcels/ParcelTable.tsx (100%) rename {components => src/components}/parcels/Random.tsx (100%) rename {components => src/components}/parcels/Recent.tsx (100%) rename {components => src/components}/profile/AddFundsModal.tsx (98%) rename {components => src/components}/profile/ConnectAccountModal.tsx (99%) rename {components => src/components}/profile/FlowingBalance.tsx (100%) rename {components => src/components}/profile/Profile.tsx (88%) rename {components => src/components}/profile/ProfileModal.tsx (99%) rename {components => src/components}/publisher/AugmentPublisher.tsx (94%) rename {components => src/components}/publisher/PublishingForm.tsx (100%) rename {components => src/components}/sources/CellHoverSource.tsx (100%) rename {components => src/components}/sources/ClaimSource.tsx (100%) rename {components => src/components}/sources/GridSource.tsx (100%) rename {components => src/components}/sources/ParcelSource.tsx (98%) rename {components => src/components}/wrap/WrapModal.tsx (100%) rename {lib => src/lib}/Firebase.ts (100%) rename {lib => src/lib}/Geocoder.tsx (100%) create mode 100644 src/lib/MUDContext.tsx rename {lib => src/lib}/calculateRequiredBid.ts (100%) rename {lib => src/lib}/calculateWeiSubtotalField.ts (100%) create mode 100644 src/lib/constants.ts rename {lib => src/lib}/formatBalance.ts (100%) rename {lib => src/lib}/geo-web-content/basicProfile.ts (100%) create mode 100644 src/lib/geo-web-content/world.ts rename {lib => src/lib}/getBalance.ts (100%) rename {lib => src/lib}/mediaQuery.ts (96%) rename {lib => src/lib}/parcelNavigation.ts (100%) rename {lib => src/lib}/safe.ts (99%) rename {lib => src/lib}/superTokenBalance.ts (100%) rename {lib => src/lib}/transactionBundleSettings.tsx (100%) rename {lib => src/lib}/truncate.ts (100%) rename {lib => src/lib}/utils.ts (100%) create mode 100644 src/main.tsx rename pages/index.tsx => src/pages/IndexPage.tsx (76%) rename {redux => src/redux}/store.ts (76%) rename styles.scss => src/styles.scss (97%) create mode 100644 vite.config.ts create mode 100644 vite.config.ts.timestamp-1701355840815-a55d7958aaade.mjs diff --git a/.env.mainnet b/.env.mainnet index c73cbcd0..2c1d2f00 100644 --- a/.env.mainnet +++ b/.env.mainnet @@ -1,16 +1,19 @@ -NEXT_PUBLIC_NETWORK_ID = 10 -NEXT_PUBLIC_SUBGRAPH_URL = "https://api.thegraph.com/subgraphs/name/geo-web-project/geo-web-subgraph" -NEXT_PUBLIC_CERAMIC_URL = "https://ceramic.geoweb.network/" -NEXT_PUBLIC_CERAMIC_CONNECT_NETWORK = "mainnet" -NEXT_PUBLIC_BLOCK_EXPLORER = "https://optimistic.etherscan.io/" -NEXT_PUBLIC_SPATIAL_DOMAIN = "https://geoweb.app/" -NEXT_PUBLIC_APP_ENV = "mainnet" -NEXT_PUBLIC_IPFS_GATEWAY = https://ipfs.io -NEXT_PUBLIC_IPFS_DELEGATE = "/dns4/ceramic.geoweb.network/tcp/443/https" -NEXT_SSX_HOST=https://ssx.geoweb.network -NEXT_REFERRAL_HOST=https://referral.geoweb.network -RAMP_HOST_KEY = th2erp2odav33psv76km8dauua9nkxsagr5b34qm -GELATO_RELAY_API_KEY = vVq0N9RISYzNKOdsFLP7oE2BfBQxCUh7rR2z8vSJ1bg_ -REFUND_RECEIVER = 0x48d4516DeF236a0583e8cF05f1D489988738C3B5 -WALLET_CONNECT_PROJECT_ID = ed360fa2058a62cd7828610800e21c86 -TRANSAK_API_KEY = bf22a0d4-0492-44bd-9e32-a6030c14996e +VITE_NETWORK_ID = 10 +VITE_SUBGRAPH_URL = "https://api.thegraph.com/subgraphs/name/geo-web-project/geo-web-subgraph" +VITE_CERAMIC_URL = "https://ceramic.geoweb.network/" +VITE_CERAMIC_CONNECT_NETWORK = "mainnet" +VITE_BLOCK_EXPLORER = "https://optimistic.etherscan.io/" +VITE_WORLD_ADDRESS = +VITE_WORLD_BLOCK_NUMBER = +VITE_WS_RPC_URL = +VITE_SPATIAL_DOMAIN = "https://geoweb.app/" +VITE_APP_ENV = "mainnet" +VITE_IPFS_GATEWAY = https://ipfs.io +VITE_IPFS_DELEGATE = "/dns4/ceramic.geoweb.network/tcp/443/https" +VITE_SSX_HOST = https://ssx.geoweb.network +VITE_REFERRAL_HOST = https://referral.geoweb.network +VITE_RAMP_HOST_KEY = th2erp2odav33psv76km8dauua9nkxsagr5b34qm +VITE_GELATO_RELAY_API_KEY = vVq0N9RISYzNKOdsFLP7oE2BfBQxCUh7rR2z8vSJ1bg_ +VITE_REFUND_RECEIVER = 0x48d4516DeF236a0583e8cF05f1D489988738C3B5 +VITE_WALLET_CONNECT_PROJECT_ID = ed360fa2058a62cd7828610800e21c86 +VITE_TRANSAK_API_KEY = bf22a0d4-0492-44bd-9e32-a6030c14996e diff --git a/.env.testnet b/.env.testnet index fb23507d..6aa7d6dd 100644 --- a/.env.testnet +++ b/.env.testnet @@ -1,16 +1,19 @@ -NEXT_PUBLIC_NETWORK_ID = 420 -NEXT_PUBLIC_SUBGRAPH_URL = "https://api.thegraph.com/subgraphs/name/geo-web-project/geo-web-testnet" -NEXT_PUBLIC_CERAMIC_URL = "https://ceramic.geoweb.network/" -NEXT_PUBLIC_CERAMIC_CONNECT_NETWORK = "mainnet" -NEXT_PUBLIC_BLOCK_EXPLORER = "https://goerli-optimism.etherscan.io/" -NEXT_PUBLIC_SPATIAL_DOMAIN = "https://testnet.geoweb.app/" -NEXT_PUBLIC_APP_ENV = "testnet" -NEXT_PUBLIC_IPFS_GATEWAY = https://ipfs.io -NEXT_PUBLIC_IPFS_DELEGATE = "/dns4/ceramic-clay.geoweb.network/tcp/443/https" -NEXT_SSX_HOST=https://ssx-stg.geoweb.network -NEXT_REFERRAL_HOST=https://referral-stg.geoweb.network -RAMP_HOST_KEY = th2erp2odav33psv76km8dauua9nkxsagr5b34qm -GELATO_RELAY_API_KEY = CBnuvCHhO6HrJqwcGWoIlK_9mrGHUrF6XTXZAyvEC_0_ -REFUND_RECEIVER = 0x1a8b3554089d97Ad8656eb91F34225bf97055C68 -WALLET_CONNECT_PROJECT_ID = ed360fa2058a62cd7828610800e21c86 -TRANSAK_API_KEY = bf22a0d4-0492-44bd-9e32-a6030c14996e +VITE_NETWORK_ID = 420 +VITE_SUBGRAPH_URL = "https://api.thegraph.com/subgraphs/name/geo-web-project/geo-web-testnet" +VITE_CERAMIC_URL = "https://ceramic.geoweb.network/" +VITE_CERAMIC_CONNECT_NETWORK = "mainnet" +VITE_BLOCK_EXPLORER = "https://goerli-optimism.etherscan.io/" +VITE_WORLD_ADDRESS = 0x3904285496739BF5030d79C0CF259A569806F759 +VITE_WS_RPC_URL=wss://opt-goerli.g.alchemy.com/v2/Y4RuzHDAmcqDnO6iqLcfwDzmbTk4xHob +VITE_WORLD_BLOCK_NUMBER = 17280426 +VITE_SPATIAL_DOMAIN = "https://testnet.geoweb.app/" +VITE_APP_ENV = "testnet" +VITE_IPFS_GATEWAY = https://ipfs.io +VITE_IPFS_DELEGATE = "/dns4/ceramic-clay.geoweb.network/tcp/443/https" +VITE_SSX_HOST = https://ssx-stg.geoweb.network +VITE_REFERRAL_HOST = https://referral-stg.geoweb.network +VITE_RAMP_HOST_KEY = th2erp2odav33psv76km8dauua9nkxsagr5b34qm +VITE_GELATO_RELAY_API_KEY = CBnuvCHhO6HrJqwcGWoIlK_9mrGHUrF6XTXZAyvEC_0_ +VITE_REFUND_RECEIVER = 0x1a8b3554089d97Ad8656eb91F34225bf97055C68 +VITE_WALLET_CONNECT_PROJECT_ID = ed360fa2058a62cd7828610800e21c86 +VITE_TRANSAK_API_KEY = bf22a0d4-0492-44bd-9e32-a6030c14996e diff --git a/.eslintrc.json b/.eslintrc.json index 138debe4..4b1bab9e 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,50 +1,7 @@ { - "env": { - "browser": true, - "commonjs": true, - "es6": true, - "node": true - }, - "parser": "@typescript-eslint/parser", - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:import/errors", - "plugin:import/warnings", - "plugin:@next/next/recommended", // always put prettier at last - "prettier" - ], - "globals": { - "Atomics": "readonly", - "SharedArrayBuffer": "readonly" - }, - "parserOptions": { - "ecmaFeatures": { - "jsx": true // enable linting for jsx files - }, - "ecmaVersion": 11 - }, - "settings": { - "react": { - "version": "detect" - }, - "import/resolver": { - "node": { - "extensions": [ - ".js", - ".jsx", - ".ts", - ".tsx" - ] - } - } - }, - "plugins": ["react", "react-hooks", "@typescript-eslint"], + "extends": ["react-app", "prettier"], "rules": { - // NextJs specific fix: suppress errors for missing 'import React' in files for nextjs - "react/react-in-jsx-scope": "off", - // NextJs specific fix: allow jsx syntax in js files - "react/jsx-filename-extension": [1, { "extensions": [".ts", ".tsx"] }], //should add ".ts" if typescript project - "react/display-name": 1 + "react-hooks/exhaustive-deps": "off", + "react/no-unescaped-entities": "off" } } diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 49c071bc..636444fb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,7 @@ name: CI on: [push, pull_request] +env: + APP_ENV: testnet jobs: build: runs-on: ubuntu-latest @@ -8,10 +10,10 @@ jobs: - name: Begin CI uses: actions/checkout@v2 - - name: Use Node 16 + - name: Use Node 18 uses: actions/setup-node@v1 with: - node-version: 16.x + node-version: 18.x - name: Use cached node_modules uses: actions/cache@v1 diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index aa8f84da..aa3dbb33 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -17,4 +17,6 @@ jobs: uses: creyD/prettier_action@v4.2 with: dry: True + prettier_version: 2.8.4 + prettier_options: --write src/** github_token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index dc254b21..4c84c014 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,6 @@ yarn-error.log* .envrc .direnv -.next tsconfig.tsbuildinfo .vercel +dist diff --git a/components/gallery/GalleryDisplayGrid.tsx b/components/gallery/GalleryDisplayGrid.tsx deleted file mode 100644 index 1c0fb939..00000000 --- a/components/gallery/GalleryDisplayGrid.tsx +++ /dev/null @@ -1,76 +0,0 @@ -import { useLayoutEffect, useRef } from "react"; -import Col from "react-bootstrap/Col"; -import Row from "react-bootstrap/Row"; -import type { MediaObject } from "@geo-web/types"; -import GalleryDisplayItem from "./GalleryDisplayItem"; -import { GalleryModalProps } from "./GalleryModal"; - -export type GalleryDisplayGridProps = GalleryModalProps & { - newMediaGallery: MediaObject[]; - setNewMediaGallery: React.Dispatch< - React.SetStateAction - >; - selectedMediaGalleryItemIndex: number | null; - shouldMediaGalleryUpdate: boolean; - setSelectedMediaGalleryItemIndex: React.Dispatch< - React.SetStateAction - >; - setShouldMediaGalleryUpdate: React.Dispatch>; -}; - -function GalleryDisplayGrid(props: GalleryDisplayGridProps) { - const { newMediaGallery, selectedMediaGalleryItemIndex } = props; - - const galleryDisplayRef = useRef(null); - const prevMediaGalleryItems = useRef(newMediaGallery); - - useLayoutEffect(() => { - if (!galleryDisplayRef?.current) { - return; - } - - if (newMediaGallery.length > prevMediaGalleryItems.current.length) { - galleryDisplayRef.current.scrollTo( - 0, - galleryDisplayRef.current.scrollHeight - ); - } - - prevMediaGalleryItems.current = [...newMediaGallery]; - }, [newMediaGallery]); - - return ( - - {newMediaGallery.map((mediaGalleryItem, i) => ( - - - - ))} - {newMediaGallery.length == 0 ? ( - - No items in gallery - - ) : null} - - ); -} - -export default GalleryDisplayGrid; diff --git a/components/gallery/GalleryDisplayItem.tsx b/components/gallery/GalleryDisplayItem.tsx deleted file mode 100644 index 79e3db95..00000000 --- a/components/gallery/GalleryDisplayItem.tsx +++ /dev/null @@ -1,141 +0,0 @@ -import * as React from "react"; -import Col from "react-bootstrap/Col"; -import Row from "react-bootstrap/Row"; -import Container from "react-bootstrap/Container"; -import Button from "react-bootstrap/Button"; -import Image from "react-bootstrap/Image"; -import type { MediaObject } from "@geo-web/types"; -import { GalleryModalProps } from "./GalleryModal"; -import { getFormatType } from "./GalleryFileFormat"; - -const DISPLAY_TYPES: Record = { - "3DModel": "3D Model", - ImageObject: "Image", - VideoObject: "Video", - AudioObject: "Audio", -}; - -export type GalleryDisplayItemProps = GalleryModalProps & { - mediaGalleryItem: MediaObject; - newMediaGallery: MediaObject[]; - setNewMediaGallery: React.Dispatch< - React.SetStateAction - >; - index: number; - selectedMediaGalleryItemIndex: number | null; - shouldMediaGalleryUpdate: boolean; - setSelectedMediaGalleryItemIndex: React.Dispatch< - React.SetStateAction - >; - setShouldMediaGalleryUpdate: React.Dispatch>; -}; - -function GalleryDisplayItem(props: GalleryDisplayItemProps) { - const { - mediaGalleryItem, - newMediaGallery, - setNewMediaGallery, - index, - selectedMediaGalleryItemIndex, - shouldMediaGalleryUpdate, - setSelectedMediaGalleryItemIndex, - } = props; - - const [isHovered, setIsHovered] = React.useState(false); - const [isRemoving, setIsRemoving] = React.useState(false); - - const isEditing = selectedMediaGalleryItemIndex === index; - const shouldHighlight = !isRemoving && (isHovered || isEditing); - const name = mediaGalleryItem?.name; - const fileType = getFormatType(mediaGalleryItem?.encodingFormat); - - const spinner = ( - - - - ); - - let statusView; - if (isRemoving) { - statusView = ( - -

Removing

- {spinner} - - ); - } - - React.useEffect(() => { - if (isRemoving && !shouldMediaGalleryUpdate) { - setIsRemoving(false); - } - }, [shouldMediaGalleryUpdate]); - - async function removeMediaGalleryItem() { - if (newMediaGallery) { - setNewMediaGallery( - newMediaGallery.filter( - (item) => newMediaGallery.indexOf(item) !== index - ) - ); - } - } - - function handleEdit() { - setSelectedMediaGalleryItemIndex(index); - } - - return ( - setIsHovered(true)} - onMouseLeave={() => setIsHovered(false)} - className={`text-center p-3 rounded ${ - shouldHighlight ? "border border-secondary" : "" - }`} - > - - -

- {index + 1}. {name} -

- -
- - - -
{statusView}
- -
- {fileType && ( - - {DISPLAY_TYPES[fileType]} - - )} - - - - - - - - -
- ); -} - -export default GalleryDisplayItem; diff --git a/components/gallery/GalleryFileFormat.ts b/components/gallery/GalleryFileFormat.ts deleted file mode 100644 index 624268b1..00000000 --- a/components/gallery/GalleryFileFormat.ts +++ /dev/null @@ -1,44 +0,0 @@ -const galleryFileFormats: Format[] = [ - { extension: ".gif", encoding: "image/gif", type: "ImageObject" }, - { extension: ".glb", encoding: "model/gltf-binary", type: "3DModel" }, - { extension: ".jpeg", encoding: "image/jpeg", type: "ImageObject" }, - { extension: ".png", encoding: "image/png", type: "ImageObject" }, - { extension: ".svg", encoding: "image/svg+xml", type: "ImageObject" }, - { extension: ".usdz", encoding: "model/vnd.usdz+zip", type: "3DModel" }, -]; - -type Format = { - encoding?: string; - type?: string; - extension?: string; -}; - -const getFormat = (_filename: string) => { - const _extension = "." + _filename.split(".").pop(); - const _format: Format = {}; - - galleryFileFormats.forEach((e) => { - if (e.extension === _extension) { - _format.encoding = e.encoding; - _format.type = e.type; - } - }); - - return _format; -}; - -const getFormatCS = () => { - const _formats = galleryFileFormats.map((f) => { - return f.extension; - }); - return _formats.toString(); -}; - -const getFormatType = (encoding: string) => { - const _type = galleryFileFormats.filter((f) => { - return f.encoding === encoding; - }); - return _type[0]["type"]; -}; - -export { galleryFileFormats, getFormat, getFormatCS, getFormatType }; diff --git a/components/gallery/GalleryForm.tsx b/components/gallery/GalleryForm.tsx deleted file mode 100644 index 2185f294..00000000 --- a/components/gallery/GalleryForm.tsx +++ /dev/null @@ -1,434 +0,0 @@ -/* eslint-disable import/no-unresolved */ -import * as React from "react"; -import Form from "react-bootstrap/Form"; -import Col from "react-bootstrap/Col"; -import Row from "react-bootstrap/Row"; -import Button from "react-bootstrap/Button"; -import Image from "react-bootstrap/Image"; -import Spinner from "react-bootstrap/Spinner"; -import InputGroup from "react-bootstrap/InputGroup"; -import type { MediaObject, Encoding } from "@geo-web/types"; -import { GalleryModalProps } from "./GalleryModal"; -import { - galleryFileFormats, - getFormat, - getFormatCS, -} from "./GalleryFileFormat"; -import { uploadFile } from "@web3-storage/upload-client"; -import { useMediaQuery } from "../../lib/mediaQuery"; -import { OverlayTrigger, Tooltip } from "react-bootstrap"; -import UploadNFTModal from "./UploadNFTModal"; -import type { OwnedNft } from "alchemy-sdk"; - -interface MediaGalleryItem { - name?: string; - content?: string; - encodingFormat?: string; -} - -export type GalleryFormProps = GalleryModalProps & { - newMediaGallery: MediaObject[]; - setNewMediaGallery: React.Dispatch< - React.SetStateAction - >; - selectedMediaGalleryItemIndex: number | null; - shouldMediaGalleryUpdate: boolean; - setSelectedMediaGalleryItemIndex: React.Dispatch< - React.SetStateAction - >; - setShouldMediaGalleryUpdate: React.Dispatch>; -}; - -function GalleryForm(props: GalleryFormProps) { - const { - geoWebContent, - w3InvocationConfig, - newMediaGallery, - setNewMediaGallery, - selectedMediaGalleryItemIndex, - setSelectedMediaGalleryItemIndex, - } = props; - - const [detectedFileFormat, setDetectedFileFormat] = React.useState(null); - const [fileFormat, setFileFormat] = React.useState(null); - const [isUploading, setIsUploading] = React.useState(false); - const [isUploadingNFT, setIsUploadingNFT] = React.useState(false); - const [didFail, setDidFail] = React.useState(false); - - const [didNFTUploadFail, setDidNFTUploadFail] = React.useState(false); - const [errorMessage, setErrorMessage] = React.useState(""); - - const [mediaGalleryItem, setMediaGalleryItem] = - React.useState({}); - - const { isMobile } = useMediaQuery(); - - const [showNFTModal, setShowNFTModal] = React.useState(false); - - const handleOpenModal = () => { - setShowNFTModal(true); - }; - - const handleCloseModal = () => { - setShowNFTModal(false); - }; - - React.useEffect(() => { - if (selectedMediaGalleryItemIndex === null) { - return; - } - - setFileFormat( - newMediaGallery[selectedMediaGalleryItemIndex].encodingFormat - ); - setMediaGalleryItem({ - name: newMediaGallery[selectedMediaGalleryItemIndex].name, - content: - newMediaGallery[selectedMediaGalleryItemIndex].content.toString(), - encodingFormat: - newMediaGallery[selectedMediaGalleryItemIndex].encodingFormat, - }); - }, [selectedMediaGalleryItemIndex]); - - function updateMediaGalleryItem(updatedValues: MediaGalleryItem) { - function _updateData(updatedValues: MediaGalleryItem) { - return (prevState: MediaGalleryItem) => { - return { ...prevState, ...updatedValues }; - }; - } - - setMediaGalleryItem(_updateData(updatedValues)); - } - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - function updateContentUrl(event: React.ChangeEvent) { - const cid = event.target.value; - - if (!cid || cid.length == 0) { - updateMediaGalleryItem({ - content: undefined, - }); - - setDetectedFileFormat(null); - setFileFormat(null); - - return; - } - - updateMediaGalleryItem({ - content: cid, - encodingFormat: fileFormat ?? undefined, - }); - } - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - async function captureFile(event: React.ChangeEvent) { - event.persist(); - event.stopPropagation(); - event.preventDefault(); - - const file = event.target.files[0]; - - if (!file) { - return; - } - - setIsUploading(true); - - const format = getFormat(file.name); - const { encoding } = format; - setFileFormat(encoding ?? null); - - // Upload to Web3 storage - const added = await uploadFile(w3InvocationConfig, file); - - updateMediaGalleryItem({ - content: added.toString(), - encodingFormat: encoding, - }); - - setIsUploading(false); - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - async function uploadNFT(selectedNFT: OwnedNft) { - setIsUploadingNFT(true); - handleCloseModal(); - try { - if (!selectedNFT?.media?.[0]?.raw) { - throw Error("No Media attached to asset"); - } - updateMediaGalleryItem({ - name: selectedNFT?.title, - content: selectedNFT?.media?.[0]?.raw, - }); - - setErrorMessage(""); - setDidNFTUploadFail(false); - } catch (err) { - console.error(err); - setErrorMessage((err as Error).message); - setDidNFTUploadFail(true); - } - - setIsUploadingNFT(false); - } - - function clearForm() { - const form = document.getElementById("galleryForm") as HTMLFormElement; - form.reset(); - - setDetectedFileFormat(null); - setFileFormat(null); - setMediaGalleryItem({}); - setDidFail(false); - setSelectedMediaGalleryItemIndex(null); - } - - async function updateMediaGalleryView() { - if (!geoWebContent) { - return; - } - - const mediaObject = { - name: mediaGalleryItem.name ?? "", - // eslint-disable-next-line @typescript-eslint/no-explicit-any - content: mediaGalleryItem.content ?? "", - encodingFormat: mediaGalleryItem.encodingFormat as Encoding, - }; - - if (selectedMediaGalleryItemIndex !== null) { - setNewMediaGallery( - newMediaGallery.map((item, i) => { - if (i == selectedMediaGalleryItemIndex) { - return mediaObject; - } else { - return item; - } - }) - ); - } else { - setNewMediaGallery([...newMediaGallery, mediaObject]); - } - - clearForm(); - } - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - function onSelectFileFormat(event: React.ChangeEvent) { - setFileFormat(event.target.value); - - updateMediaGalleryItem({ - encodingFormat: event.target.value, - }); - } - - const isReadyToAdd = mediaGalleryItem.content && mediaGalleryItem.name; - - return ( - <> - {showNFTModal && ( -
- )} - -
- - - URI - - Device Upload} - > - - - Select from Wallet - } - > - - - - - - - - - Name - { - updateMediaGalleryItem({ - name: e.target.value, - }); - }} - /> - - - - -
- File Format - - - - {galleryFileFormats.map((_format, i) => ( - - ))} - -
- - {!isMobile && ( - - - Content Pinning Service - - - - - - )} -
- - - - - - - - {didFail ? ( - - Failed to add item. An unknown error occurred. - - ) : null} - {didNFTUploadFail ? ( - {errorMessage} - ) : null} - -
- - ); -} - -export default GalleryForm; diff --git a/components/gallery/GalleryModal.tsx b/components/gallery/GalleryModal.tsx deleted file mode 100644 index 708c0092..00000000 --- a/components/gallery/GalleryModal.tsx +++ /dev/null @@ -1,426 +0,0 @@ -import { useState, useEffect } from "react"; -import { BigNumber } from "ethers"; -import { AssetId } from "caip"; -import Modal from "react-bootstrap/Modal"; -import Card from "react-bootstrap/Card"; -import Col from "react-bootstrap/Col"; -import Row from "react-bootstrap/Row"; -import Button from "react-bootstrap/Button"; -import Image from "react-bootstrap/Image"; -import Spinner from "react-bootstrap/Spinner"; -import Container from "react-bootstrap/Container"; -import Alert from "react-bootstrap/Alert"; -import type { IPCOLicenseDiamond } from "@geo-web/contracts/dist/typechain-types/IPCOLicenseDiamond"; -import { GeoWebContent } from "@geo-web/content"; -import type { MediaObject } from "@geo-web/types"; -import GalleryForm from "./GalleryForm"; -import GalleryDisplayGrid from "./GalleryDisplayGrid"; -import { STATE } from "../Map"; -import { ParcelInfoProps } from "../cards/ParcelInfo"; -import { useMediaGallery } from "../../lib/geo-web-content/mediaGallery"; -import { useBundleSettings } from "../../lib/transactionBundleSettings"; -import { useSuperTokenBalance } from "../../lib/superTokenBalance"; -import { useSafe } from "../../lib/safe"; -import { ZERO_ADDRESS, NETWORK_ID } from "../../lib/constants"; - -export type GalleryModalProps = ParcelInfoProps & { - show: boolean; - geoWebContent: GeoWebContent | null; - licenseDiamondContract: IPCOLicenseDiamond | null; -}; - -function GalleryModal(props: GalleryModalProps) { - const { - geoWebContent, - smartAccount, - signer, - paymentToken, - licenseDiamondContract, - ceramic, - licenseAddress, - selectedParcelId, - show, - setInteractionState, - } = props; - const handleClose = () => { - setInteractionState(STATE.PARCEL_SELECTED); - }; - - const { - mediaGalleryItems, - shouldMediaGalleryUpdate, - setShouldMediaGalleryUpdate, - } = useMediaGallery( - geoWebContent, - ceramic, - licenseAddress, - selectedParcelId, - ); - const { relayTransaction, simulateSafeTx, estimateTransactionBundleFees } = - useSafe(smartAccount?.safe ?? null); - const { superTokenBalance } = useSuperTokenBalance( - smartAccount?.safe ? smartAccount.address : "", - paymentToken.address - ); - const bundleSettings = useBundleSettings(); - - const [selectedMediaGalleryItemIndex, setSelectedMediaGalleryItemIndex] = - useState(null); - const [newMediaGallery, setNewMediaGallery] = useState( - null - ); - const [isSaving, setIsSaving] = useState(false); - const [isSaved, setIsSaved] = useState(false); - const [showAlert, setShowAlert] = useState(false); - - useEffect(() => { - if (mediaGalleryItems) { - setNewMediaGallery(mediaGalleryItems); - } - }, [mediaGalleryItems]); - - useEffect(() => { - setIsSaved(false); - }, [newMediaGallery]); - - const spinner = ( - - Loading... - - ); - - const isLoading = newMediaGallery == null; - - const commitNewRoot = async () => { - if (!ceramic?.did) { - throw Error("Could not find Ceramic DID"); - } - - if (!newMediaGallery || !mediaGalleryItems) { - throw Error("Coul not find Media Gallery"); - } - - const assetId = new AssetId({ - chainId: `eip155:${NETWORK_ID}`, - assetName: { - namespace: "erc721", - reference: licenseAddress.toLowerCase(), - }, - tokenId: BigNumber.from(selectedParcelId).toString(), - }); - const ownerDID = ceramic.did.parent; - - let rootCid = await geoWebContent.raw.resolveRoot({ - ownerDID, - parcelId: assetId, - }); - const mediaGallery = await geoWebContent.raw.get(rootCid, "/mediaGallery", { - schema: "MediaGallery", - }); - - if (!mediaGallery) { - rootCid = await geoWebContent.raw.putPath(rootCid, "/mediaGallery", [], { - parentSchema: "ParcelRoot", - pin: true, - }); - } - - let newRoot; - - for (let i = 0; i < newMediaGallery.length; i++) { - newRoot = await geoWebContent.raw.putPath( - newRoot ?? rootCid, - `/mediaGallery/${i}`, - newMediaGallery[i], - { - parentSchema: "MediaGallery", - pin: true, - } - ); - } - - if (newMediaGallery.length < mediaGalleryItems.length) { - const itemsDeleted = mediaGalleryItems.length - newMediaGallery.length; - - for ( - let i = mediaGalleryItems.length - 1; - i >= mediaGalleryItems.length - itemsDeleted; - i-- - ) { - newRoot = await geoWebContent.raw.deletePath( - newRoot ?? rootCid, - `/mediaGallery/${i}` - ); - } - } - - if (!newRoot) { - throw Error("Could not upload parcel content"); - } - - const mediaGalleryPath = await geoWebContent.raw.get( - newRoot, - "/mediaGallery", - { schema: "MediaGallery" } - ); - - newRoot = await geoWebContent.raw.putPath( - newRoot, - `/mediaGallery`, - mediaGalleryPath, - { - parentSchema: "ParcelRoot", - pin: true, - } - ); - - const contentHash = await geoWebContent.raw.commit(newRoot); - - return contentHash; - }; - - const updateMediaGallery = async () => { - if (!licenseDiamondContract) { - throw new Error("Could not find licenseDiamondContract"); - } - - setIsSaving(true); - - try { - const contentHash = await commitNewRoot(); - - if (smartAccount?.safe) { - let wrap; - const metaTransactions = []; - const safeBalance = await smartAccount.safe.getBalance(); - const wrapAmount = - bundleSettings.isSponsored && - !bundleSettings.noWrap && - (bundleSettings.wrapAll || - BigNumber.from(bundleSettings.wrapAmount).gt(safeBalance)) && - safeBalance.gt(0) - ? safeBalance.toString() - : bundleSettings.isSponsored && - !bundleSettings.noWrap && - BigNumber.from(bundleSettings.wrapAmount).gt(0) && - safeBalance.gt(0) - ? BigNumber.from(bundleSettings.wrapAmount).toString() - : ""; - - if (bundleSettings.isSponsored && wrapAmount && safeBalance.gt(0)) { - wrap = await paymentToken.upgrade({ - amount: wrapAmount, - }).populateTransactionPromise; - } - - if (wrap?.to && wrap?.data) { - metaTransactions.push({ - to: wrap.to, - value: wrapAmount, - data: wrap.data, - }); - } - - const editContentHashData = - licenseDiamondContract.interface.encodeFunctionData( - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - "editContentHash(bytes)", - [contentHash] - ); - - const editContentHashTransaction = { - to: licenseDiamondContract.address, - data: editContentHashData, - value: "0", - }; - metaTransactions.push(editContentHashTransaction); - - const gasUsed = await simulateSafeTx(metaTransactions); - const transactionFeesEstimate = await estimateTransactionBundleFees( - gasUsed - ); - await relayTransaction(metaTransactions, { - isSponsored: bundleSettings.isSponsored, - gasToken: - bundleSettings.isSponsored && - bundleSettings.noWrap && - superTokenBalance.lt(transactionFeesEstimate ?? 0) - ? ZERO_ADDRESS - : bundleSettings.isSponsored && - (BigNumber.from(bundleSettings.wrapAmount).eq(0) || - superTokenBalance.gt(transactionFeesEstimate ?? 0)) - ? paymentToken.address - : ZERO_ADDRESS, - }); - } else { - if (!signer) { - throw new Error("Could not find signer"); - } - - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - const txn = await licenseDiamondContract - .connect(signer) - ["editContentHash(bytes)"](contentHash); - - await txn.wait(); - } - - setIsSaving(false); - setIsSaved(true); - setShouldMediaGalleryUpdate(true); - handleClose(); - } catch (err) { - console.error(err); - setIsSaving(false); - } - }; - - const handleExitIntent = () => { - if ( - isSaved || - JSON.stringify(mediaGalleryItems) === JSON.stringify(newMediaGallery) - ) { - handleClose(); - } else { - setShowAlert(true); - } - }; - - return ( - - -
- Your changes will not be saved. Are you sure? -
-
- - -
-
- - - - - Media Gallery - - - - - - - - {isLoading ? ( - - {spinner} - - ) : ( - <> - -

- The Media Gallery is a simple carousel viewing experience on the{" "} - - spatial browser - - . GLB and USDZ (iOS only) files can be viewed in AR on compatible - devices. -

- - - {" "} - Media Upload - - - - - - - - - - - - -
- - )} -
- ); -} - -export default GalleryModal; diff --git a/components/gallery/UploadNFTModal.tsx b/components/gallery/UploadNFTModal.tsx deleted file mode 100644 index f05c80d3..00000000 --- a/components/gallery/UploadNFTModal.tsx +++ /dev/null @@ -1,228 +0,0 @@ -import { useState, useEffect } from "react"; -import Modal from "react-bootstrap/Modal"; -import Card from "react-bootstrap/Card"; -import Col from "react-bootstrap/Col"; -import Row from "react-bootstrap/Row"; -import Button from "react-bootstrap/Button"; -import Image from "react-bootstrap/Image"; -import Container from "react-bootstrap/Container"; -import { ParcelInfoProps } from "../cards/ParcelInfo"; -import { Network, Alchemy, NftTokenType } from "alchemy-sdk"; - -import type { OwnedNft } from "alchemy-sdk"; - -const optimismSettings = { - apiKey: process.env.NEXT_PUBLIC_ALCHEMY_API_KEY, - network: Network.OPT_GOERLI, // Replace with OPT_MAINNET -}; - -const ethMainnetSettings = { - apiKey: process.env.NEXT_PUBLIC_ALCHEMY_API_KEY, - network: Network.ETH_MAINNET, -}; - -const optimismAlchemy = new Alchemy(optimismSettings); - -const ethMainnetAlchemy = new Alchemy(ethMainnetSettings); - -const initialOwnedNFT = { - balance: 0, - contract: { - address: "", - tokenType: NftTokenType.UNKNOWN, - }, - tokenId: "", - tokenType: NftTokenType.UNKNOWN, - title: "", - description: "", - timeLastUpdated: "", - metadataError: undefined, - rawMetadata: undefined, - tokenUri: undefined, - media: [], - spamInfo: undefined, - acquiredAt: undefined, -}; - -export type UploadNFTModalProps = ParcelInfoProps & { - showNFTModal: boolean; - onClose: () => void; - uploadNFT: (nft: OwnedNft) => void; -}; - -function GalleryModal(props: UploadNFTModalProps) { - const { showNFTModal, onClose, uploadNFT, account } = props; - - const [nftsForOwner, setNftsForOwner] = useState>([]); - const [selectedNFT, setSelectedNFT] = useState(initialOwnedNFT); - - const spinner = ( - - Loading... - - ); - - const isLoading = false; - - const selectNFTFromWallet = async () => { - uploadNFT(selectedNFT); - setSelectedNFT(initialOwnedNFT); - }; - - const closeModal = async () => { - setSelectedNFT(initialOwnedNFT); - onClose(); - }; - - useEffect(() => { - async function getNftsForOwner() { - try { - const nfts = []; - // Get the async iterable for the owner's NFTs. - const nftsIterable = - optimismAlchemy.nft.getNftsForOwnerIterator(account); - - // Iterate over the NFTs and add them to the nfts array. - for await (const nft of nftsIterable) { - nfts.push(nft); - } - - // Get the async iterable for the owner's NFTs. - const ethMainnetNftsIterable = - ethMainnetAlchemy.nft.getNftsForOwnerIterator(account); - - // Iterate over the NFTs and add them to the nfts array. - for await (const nft of ethMainnetNftsIterable) { - nfts.push(nft); - } - - // store NFTs in state - setNftsForOwner(nfts); - } catch (error) { - console.error(error); - } - } - - getNftsForOwner(); - }, [account]); - - return ( - - - - - - - NFTs Held by {account.slice(0, 6)}... - {account.slice(-4)} - - - - - - - - - {isLoading ? ( - - {spinner} - - ) : ( - <> - -

- Select NFT media from your wallet to add to your parcel's Media - Gallery. -

- - - {nftsForOwner.map((nft) => { - return ( - -
setSelectedNFT(nft)} - > - -
- -
- - - {nft?.title || ""} - - -
-
- - ); - })} -
- - - - - - - - -
- - )} -
- ); -} - -export default GalleryModal; diff --git a/config-overrides.js b/config-overrides.js deleted file mode 100644 index 3a35311c..00000000 --- a/config-overrides.js +++ /dev/null @@ -1,37 +0,0 @@ -const path = require("path"); - -module.exports = function override(config) { - config.experiments = { - asyncWebAssembly: true, - }; - - console.log(config); - - config.module.rules.push({ - test: /\.mjs$/, - include: /node_modules/, - type: "javascript/auto", - }); - - const wasmExtensionRegExp = /\.wasm$/; - - config.resolve.extensions.push(".wasm"); - - config.module.rules.forEach((rule) => { - (rule.oneOf || []).forEach((oneOf) => { - if (oneOf.loader && oneOf.loader.indexOf("file-loader") >= 0) { - // make file-loader ignore WASM files - oneOf.exclude.push(wasmExtensionRegExp); - } - }); - }); - - // add a dedicated loader for WASM - config.module.rules.push({ - test: wasmExtensionRegExp, - include: path.resolve(__dirname, "src"), - use: [{ loader: require.resolve("wasm-loader"), options: {} }], - }); - - return config; -}; diff --git a/dec.d.ts b/dec.d.ts index bafd5e27..84bef35f 100644 --- a/dec.d.ts +++ b/dec.d.ts @@ -1,7 +1,5 @@ declare module "react-map-gl-geocoder"; -declare module "ipfs-provider"; -declare module "secure-random"; declare module "as-geo-web-coordinate"; -declare module "@orbisclub/components"; declare module "lodash.merge"; declare module "@transak/transak-sdk"; +declare module '@geo-web/mud-world-base-setup' diff --git a/index.html b/index.html new file mode 100644 index 00000000..0d685855 --- /dev/null +++ b/index.html @@ -0,0 +1,18 @@ + + + + + + + Geo Web Cadastre + + + +
+ + + + diff --git a/lib/constants.ts b/lib/constants.ts deleted file mode 100644 index ead71690..00000000 --- a/lib/constants.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ -export const NETWORK_ID = parseInt(process.env.NEXT_PUBLIC_NETWORK_ID!); -export const SUBGRAPH_URL = process.env.NEXT_PUBLIC_SUBGRAPH_URL!; -export const CERAMIC_URL = process.env.NEXT_PUBLIC_CERAMIC_URL!; -export const CONNECT_NETWORK = process.env.NEXT_PUBLIC_CERAMIC_CONNECT_NETWORK!; -export const BLOCK_EXPLORER = process.env.NEXT_PUBLIC_BLOCK_EXPLORER!; -export const RPC_URLS: Record = { - 4: `https://rinkeby.infura.io/v3/${process.env - .NEXT_PUBLIC_INFURA_PROJECT_ID!}`, - 5: `https://goerli.infura.io/v3/${process.env - .NEXT_PUBLIC_INFURA_PROJECT_ID!}`, - 10: `https://optimism-mainnet.infura.io/v3/${process.env - .NEXT_PUBLIC_INFURA_PROJECT_ID!}`, - 420: `https://optimism-goerli.infura.io/v3/${process.env - .NEXT_PUBLIC_INFURA_PROJECT_ID!}`, -}; -export const SPATIAL_DOMAIN = process.env.NEXT_PUBLIC_SPATIAL_DOMAIN!; -export const SSX_HOST = process.env.NEXT_SSX_HOST!; -export const IPFS_DELEGATE = process.env.NEXT_PUBLIC_IPFS_DELEGATE!; -export const RAMP_HOST_KEY = process.env.RAMP_HOST_KEY!; -export const REFUND_RECEIVER = process.env.REFUND_RECEIVER!; -export const GELATO_RELAY_API_KEY = process.env.GELATO_RELAY_API_KEY!; -export const WALLET_CONNECT_PROJECT_ID = process.env.WALLET_CONNECT_PROJECT_ID!; -export const TRANSAK_API_KEY = process.env.TRANSAK_API_KEY!; -/* eslint-enable @typescript-eslint/no-non-null-assertion */ - -export const PAYMENT_TOKEN = "ETHx"; - -export const PAYMENT_TOKEN_FAUCET_URL = "https://faucet.paradigm.xyz"; -export const CERAMIC_EXPLORER = `https://cerscan.com/${CONNECT_NETWORK}/stream`; -export const GW_SAFE_SALT_NONCE = - "0x57c20148525f007e74c11aef90f86510f65727a5d018cb83c0cda328136f14b2"; -export const BETA_AGREEMENT_KEY = "storedBetaAgreement"; -export const PINATA_API_ENDPOINT = "https://api.pinata.cloud/psa"; -export const STORAGE_WORKER_ENDPOINT = - "https://storage-workers.geo-web.workers.dev"; -export const IPFS_GATEWAY = process.env.NEXT_PUBLIC_IPFS_GATEWAY; - -export const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"; -export const MIN_CLAIM_BALANCE = 0.008; -export const SECONDS_IN_WEEK = 60 * 60 * 24 * 7; -export const SECONDS_IN_YEAR = 60 * 60 * 24 * 365; -export const AUCTION_LENGTH = 1209600; -export const MAX_PARCEL_SIDE_DIM = 200; -export const MAX_PARCEL_CLAIM = 3000; -export const DRAWER_PREVIEW_HEIGHT_PARCEL = 116; -export const DRAWER_CLAIM_HEIGHT = 280; -export const DRAWER_PREVIEW_HEIGHT_TRANSACTION = 84; diff --git a/lib/geo-web-content/mediaGallery.ts b/lib/geo-web-content/mediaGallery.ts deleted file mode 100644 index 4a1f1f29..00000000 --- a/lib/geo-web-content/mediaGallery.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { useState, useEffect } from "react"; -import { AssetId } from "caip"; -import BN from "bn.js"; -import { CeramicClient } from "@ceramicnetwork/http-client"; -import { GeoWebContent } from "@geo-web/content"; -import type { MediaGallery, MediaObject } from "@geo-web/types"; -import { NETWORK_ID } from "../constants"; - -function useMediaGallery( - geoWebContent: GeoWebContent, - ceramic: CeramicClient, - licenseContractAddress: string, - parcelId: string -) { - const [mediaGalleryItems, setMediaGalleryItems] = useState< - MediaObject[] | null - >(null); - const [shouldMediaGalleryUpdate, setShouldMediaGalleryUpdate] = - useState(true); - - useEffect(() => { - if (!parcelId || !shouldMediaGalleryUpdate || !ceramic.did) { - return; - } - - const ownerDID = ceramic.did.parent; - - const timerId = setInterval(async () => { - try { - const _mediaGalleryItems = []; - const assetId = new AssetId({ - chainId: `eip155:${NETWORK_ID}`, - assetName: { - namespace: "erc721", - reference: licenseContractAddress.toLowerCase(), - }, - tokenId: new BN(parcelId.slice(2), "hex").toString(10), - }); - - const rootCid = await geoWebContent.raw.resolveRoot({ - ownerDID, - parcelId: assetId, - }); - const root = await geoWebContent.raw.get(rootCid, "/", { - schema: "ParcelRoot", - }); - - if (root?.mediaGallery) { - const mediaGalleryPath = await geoWebContent.raw.get( - rootCid, - "/mediaGallery", - { schema: "MediaGallery" } - ); - - for (const i in mediaGalleryPath) { - const mediaGalleryItem = await geoWebContent.raw.get( - rootCid, - `/mediaGallery/${i}`, - {} - ); - _mediaGalleryItems.push(mediaGalleryItem); - } - } else if (mediaGalleryItems === null) { - const mediaGallery: MediaGallery = []; - await geoWebContent.raw.putPath( - rootCid, - "/mediaGallery", - mediaGallery, - { - parentSchema: "ParcelRoot", - pin: true, - } - ); - - setMediaGalleryItems([]); - setShouldMediaGalleryUpdate(false); - clearInterval(timerId); - - return; - } - - if ( - JSON.stringify(_mediaGalleryItems) !== - JSON.stringify(mediaGalleryItems) - ) { - setMediaGalleryItems(_mediaGalleryItems); - setShouldMediaGalleryUpdate(false); - clearInterval(timerId); - } - } catch (err) { - setMediaGalleryItems(null); - console.error(err); - clearInterval(timerId); - } - }, 5000); - - return () => clearInterval(timerId); - }, [parcelId, shouldMediaGalleryUpdate]); - - return { - mediaGalleryItems, - shouldMediaGalleryUpdate, - setShouldMediaGalleryUpdate, - }; -} - -export { useMediaGallery }; diff --git a/localhost-key.pem b/localhost-key.pem new file mode 100644 index 00000000..68fb9638 --- /dev/null +++ b/localhost-key.pem @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDhtq61ncNSZKsz +HYsNaKi930MaxaN8/oT2fbYKY5lXoNjI7UprIoSB3zfOXCQ/T3OUtLDdgl6OD4Pn +aqS+oTWzwoVGLNwEaClfXi8zzdrm/XD1yT+idKAnOy/Kar5IGkbbrjrQLw+xwBl+ +pbELKWfNmcJ3XEZTAupgIm3M46Z1Yp+4GwjCSnp1vAum5/uv2tnS6gSeVZcL5ycG +GWmzTPvxU4T1oaDCHBssZgx6LXTwWaJAWndSfWYlCkb9bLwH8gIBpqpNG+vYGyin +vHHT1rgCIty6JlClmIUmAQbSXQxcku4vBQN5ucnwZdsEGawOS0DEkKasZbngdz0t +XczULS+zAgMBAAECggEBAL2gb6kPULBg+N+pu0/ZlKJn9oWAc3ioj+ZR+OVDhelz +rY0opfPZ/P7rHIRXLvCtfEn7f/eo9m1dJZD/LEcnQumxy6wINhPRuqhvhTJ9iKG1 +XPhxSe/fEUnEVMM26IPE57DZ8HlEgGfyHrki1NmuwJGf0xvaPw6wjV2UrzCKNSe5 +zsDgUMyyKWwyMtDe0xmWtX9WSHxtqolBOGKR/RPPQHsVQ31vunh4ncaS6m/OjvNr +0KHsDYy9jHN6VRGXuETAfg8ysaLbI5ar4FpibykDTIYJe9kVQ7Rrdp8hDFvb5MJD +zKqwnGYNwloCEzwmAkoBpY7IfmbxbcPfMsKeYeGsr0ECgYEA6784DQucpLjEgYA1 +xzE3iDyzD9ElubJ1mFETf2sf9/pCVjSWK1OkNmF2kmLL3zF+5FnDRCvB7z2gN3NI +eRVL4iFSEBDH7qa+Sy4mwgblOBlPFIZBi4u5xuU5WiFD8AGcxdSQy6uea3ELGphV +QMxKD1/ZLbwncSVizKCXNPQxNuECgYEA9RrM2lWYsVztbUNcwD/JP9gGiV2S2Wgs +rQmDXKOE/2qRZpxRH5vq1/WEfZRtKdkVbaL7nTacLTx6nYARKWo5A6QWWa7sEJBS +up7ia6UwAEvQ+pi8xCBJI4lINZbSf+zDskCWUnQKIs/riHjHvcrEXWPjikGKplkl +eQIgEllCvRMCgYEA14qtpL/JKJIGmKCwir7lFxroXL3M0EvqWKlIOmengwK9RDQw +WMzQhyf1UUIjRJ3sdrvbXKjlV+fwZMJysMJX7xin/yhYpEqwEezQYvYK/Y+mTg2y +P/QwlzldhpqDkxzmSbpf6NewsGtay6YbzHL8A7KOztII/dpAyvbJSRE7LgECgYEA +saLXvpD0le58YIjGispvx2Z/7kQz7n6yikHvw077T8VjVZOKs7bjb9qPSBgvOXoM +LqZFZv4yGBLR5p3vUi2a3omobRz6F1MRshD+lfdlH4HTFhtmC1o+x5NyEuyY6H+m +oORwTZet1OcNk529XU68G9cODKBNpRvMrbOdnM62MKMCgYB8zxIlTafeWZQVjrBs +OYl9KctzFAndhq5DB7I8q5RHDwRs6tGQedxKZXS/vmVqsqHyEkVnKDGuWE1RWTBo +Ca4DZu969YpadpNGco9WBCgHokYQh8F3hJENSTio/xoEhFKbP4zlad026oaf/FCs +4+thibdD5+KrBgRSa43Hzf1ZhQ== +-----END PRIVATE KEY----- diff --git a/localhost.pem b/localhost.pem new file mode 100644 index 00000000..731d97d5 --- /dev/null +++ b/localhost.pem @@ -0,0 +1,25 @@ +-----BEGIN CERTIFICATE----- +MIIEKjCCApKgAwIBAgIQMMNsRfWP2FkWfxq5V47G8TANBgkqhkiG9w0BAQsFADBz +MR4wHAYDVQQKExVta2NlcnQgZGV2ZWxvcG1lbnQgQ0ExJDAiBgNVBAsMG2NvZHlA +cGhvYm9zIChDb2R5IEhhdGZpZWxkKTErMCkGA1UEAwwibWtjZXJ0IGNvZHlAcGhv +Ym9zIChDb2R5IEhhdGZpZWxkKTAeFw0yMzAxMTkwMDEwMjlaFw0yNTA0MTgyMzEw +MjlaME8xJzAlBgNVBAoTHm1rY2VydCBkZXZlbG9wbWVudCBjZXJ0aWZpY2F0ZTEk +MCIGA1UECwwbY29keUBwaG9ib3MgKENvZHkgSGF0ZmllbGQpMIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4bautZ3DUmSrMx2LDWiovd9DGsWjfP6E9n22 +CmOZV6DYyO1KayKEgd83zlwkP09zlLSw3YJejg+D52qkvqE1s8KFRizcBGgpX14v +M83a5v1w9ck/onSgJzsvymq+SBpG26460C8PscAZfqWxCylnzZnCd1xGUwLqYCJt +zOOmdWKfuBsIwkp6dbwLpuf7r9rZ0uoEnlWXC+cnBhlps0z78VOE9aGgwhwbLGYM +ei108FmiQFp3Un1mJQpG/Wy8B/ICAaaqTRvr2Bsop7xx09a4AiLcuiZQpZiFJgEG +0l0MXJLuLwUDebnJ8GXbBBmsDktAxJCmrGW54Hc9LV3M1C0vswIDAQABo14wXDAO +BgNVHQ8BAf8EBAMCBaAwEwYDVR0lBAwwCgYIKwYBBQUHAwEwHwYDVR0jBBgwFoAU +WK7/mL0bPuqQZEwzn5eDUsrlObYwFAYDVR0RBA0wC4IJbG9jYWxob3N0MA0GCSqG +SIb3DQEBCwUAA4IBgQAgA/Iqy8Uo015/ljjFnOUOF06XUoOFVJMTkieoFuMUGl9X +/iYecGLzXJaOy5FX8g9lyeRlWVsmqRKrPTokT16rekAmDhIs605FztmfvXgwktuQ +Ps0D7apDFGcrWfuc8mnataBvBgoa/k4YMbrl+IYfdl6E1fBkZfzz4jtKngqu9Pk7 +ZP0ljVtwYs7P1cpZrgVKeBvHwx5/ufTQqHLg4wCS7rdXuDVyauLzXcYEkToyBwtb +ohavlHL1I670Y4vNhvJrmeaJAKpM6mKBUAKHIZck47Bt7PtHm+koEVQeWjYE2Ymp +0O9d+4s4vxNEtDh+xF55nK3BTs57Lp9hb/hcEUn9u5kX+yaEGzKYErB0qtubqbyh +2fa6dfq39Jrt1vaHG0kbM/hNdrnmRDCQgUhgygOWa9liL4g9WYRENpIYS5SuKCbv +O+yNDutsikewSs2NhYPkvI1J+3kDcm9VnE5DjGPVA2uIpmc/4pK3RWTTcIqPEEdH +2oF0IeYDiV/OZGOMdEg= +-----END CERTIFICATE----- diff --git a/next-env.d.ts b/next-env.d.ts deleted file mode 100644 index 4f11a03d..00000000 --- a/next-env.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/// -/// - -// NOTE: This file should not be edited -// see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/next.config.js b/next.config.js deleted file mode 100644 index 5f2514ec..00000000 --- a/next.config.js +++ /dev/null @@ -1,36 +0,0 @@ -const webpack = require("webpack"); -const { parsed: myEnv } = require("dotenv").config({ - path: `.env.${process.env.APP_ENV}`, -}); - -module.exports = { - output: "standalone", - webpack(config, { isServer, dev }) { - if (process.env.APP_ENV !== undefined) { - console.log(`Loading env from .env.${process.env.APP_ENV}`); - config.plugins.push(new webpack.EnvironmentPlugin(myEnv)); - - config.plugins.push( - new webpack.NormalModuleReplacementPlugin(/^node:/, (resource) => { - resource.request = resource.request.replace(/^node:/, ""); - }), - ); - config.resolve.fallback = { - ...config.resolve.fallback, - fs: false, - }; - config.experiments = { - topLevelAwait: true, - asyncWebAssembly: true, - }; - config.output.webassemblyModuleFilename = - isServer && !dev - ? "../static/wasm/[modulehash].wasm" - : "static/wasm/[modulehash].wasm"; - } - return config; - }, - typescript: { - ignoreBuildErrors: false, - }, -}; diff --git a/package.json b/package.json index 2f919df5..4642e8aa 100644 --- a/package.json +++ b/package.json @@ -3,40 +3,27 @@ "version": "0.1.0", "dependencies": { "@apollo/client": "^3.7.14", - "@ceramicnetwork/blockchain-utils-linking": "^2.0.12", - "@ceramicnetwork/common": "^2.14.0", - "@ceramicnetwork/http-client": "^2.11.0", - "@ceramicnetwork/stream-tile": "^2.10.0", "@didtools/cacao": "^1.1.0", "@didtools/pkh-ethereum": "^0.0.3", - "@geo-web/content": "^0.7.3", + "@geo-web/mud-world-base-contracts": "^0.1.0", + "@geo-web/mud-world-base-setup": "^0.1.0", "@geo-web/sdk": "^4.3.3", - "@geo-web/types": "^0.3.0", - "@ipld/car": "^4.1.3", "@mapbox/mapbox-gl-geocoder": "^5.0.1", - "@orbisclub/components": "^0.1.60", "@popperjs/core": "^2.11.5", "@rainbow-me/rainbowkit": "^0.12.18", - "@ramp-network/ramp-instant-sdk": "^4.0.3", "@reduxjs/toolkit": "^1.8.1", "@safe-global/protocol-kit": "^1.0.1", "@safe-global/relay-kit": "^1.0.0", "@safe-global/safe-deployments": "^1.23.0", - "@self.id/framework": "^0.3.0", "@superfluid-finance/sdk-core": "^0.5.6", "@superfluid-finance/sdk-redux": "^0.3.0", - "@testing-library/jest-dom": "^5.11.4", - "@testing-library/react": "^11.1.0", - "@testing-library/user-event": "^12.1.10", "@transak/transak-sdk": "^1.3.0", "@turf/turf": "^6.5.0", - "@web3-storage/access": "^15.2.0", - "@web3-storage/w3up-client": "^8.0.1", + "@web3-storage/access": "^18.0.5", + "@web3-storage/w3up-client": "^11.2.0", "alchemy-sdk": "^2.10.0", "as-geo-web-coordinate": "^0.8.0", "bootstrap": "^5.2.0", - "caip": "^1.1.0", - "ceramic-cacao": "^1.1.0", "dayjs": "^1.11.2", "did-session": "^1.0.0", "dids": "^3.3.1", @@ -44,57 +31,37 @@ "ethers": "^5.7.2", "firebase": "^8.7.1", "graphql": "^15.4.0", - "ipfs-core": "^0.15.4", - "ipfs-http-client": "^50.1.0", - "ipfs-provider": "2.0.1", - "ipld-dag-pb": "^0.22.3", - "js-pinning-service-http-client": "^1.0.2", "key-did-resolver": "^1.4.0", + "local-ssl-proxy": "^2.0.5", "mapbox-gl": "^2.14.1", "multiformats": "^11.0.2", - "next": "^12.3.1", - "next-redux-wrapper": "^7.0.5", - "nft-did-resolver": "^1.0.0", "queue-promise": "^2.2.1", "react": "^18.2.0", "react-bootstrap": "^2.5.0", "react-dom": "^18.2.0", "react-map-gl": "^7.0.23", "react-redux": "^8.0.1", - "react-scripts": "3.3.0", + "react-router-dom": "^6.20.0", "sass": "^1.49.9", - "schema-org-ceramic": "^1.3.0", - "secure-random": "^1.1.2", "siwe": "^1.1.6", - "use-wallet": "^0.8.1", + "viem": "^1.19.9", "wagmi": "^0.12.19", - "wasm-loader": "^1.3.0", - "web3.storage": "^4.4.0" + "wasm-loader": "^1.3.0" }, "scripts": { - "dev": "next dev", - "build": "next build", - "start": "next start", - "export": "next export", - "lint": "next lint", - "prettier": "prettier -w components/** lib/** pages/** redux/**", - "test": "jest" - }, - "eslintConfig": { - "extends": [ - "react-app", - "react-app/jest" - ] + "build": "NODE_OPTIONS='--max-old-space-size=4096' && vite build --mode $APP_ENV", + "dev-https": "local-ssl-proxy --key localhost-key.pem --cert localhost.pem --source 3001 --target 3000", + "dev": "source .env && vite --mode $APP_ENV", + "preview": "vite preview", + "typecheck": "tsc --noEmit", + "lint": "eslint src", + "prettier": "prettier -w src/**" }, "engines": { - "node": ">=16.0.0" + "node": ">=18.0.0" }, "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" - ], + "production": [">0.2%", "not dead", "not op_mini all"], "development": [ "last 1 chrome version", "last 1 firefox version", @@ -102,31 +69,29 @@ ] }, "devDependencies": { - "@next/eslint-plugin-next": "^12.1.6", "@safe-global/safe-core-sdk-types": "^2.0.0", - "@types/create-hash": "^1.2.2", "@types/mapbox__mapbox-gl-geocoder": "^4.7.3", "@types/node": "^17.0.25", "@types/react": "^18.0.9", "@types/react-dom": "^18.0.5", "@typescript-eslint/eslint-plugin": "^5.22.0", "@typescript-eslint/parser": "^5.22.0", + "@vitejs/plugin-react": "^4.2.0", "eslint": "^7.32.0", - "eslint-config-airbnb": "^18.2.1", "eslint-config-prettier": "^8.5.0", + "eslint-config-react-app": "^7.0.1", "eslint-plugin-import": "^2.24.2", "eslint-plugin-jsx-a11y": "^6.4.1", "eslint-plugin-react": "^7.26.0", "eslint-plugin-react-hooks": "^4.2.0", - "ipfs-core-types": "^0.13.0", - "jest": "^26.6.3", - "jest-environment-idx": "^0.6.1", "node-gyp": "^10.0.1", "prettier": "^2.8.4", - "react-test-renderer": "^18.2.0", - "typescript": "^4.6.3" + "typescript": "^5.1.3", + "vite": "^4.4.9", + "vite-plugin-eslint": "^1.8.1", + "vite-plugin-node-polyfills": "^0.17.0", + "vite-plugin-top-level-await": "^1.3.1", + "vite-plugin-wasm": "^3.2.2" }, - "jest": { - "testEnvironment": "jest-environment-idx" - } + "type": "module" } diff --git a/public/index.html b/public/index.html deleted file mode 100644 index ab76b3e6..00000000 --- a/public/index.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - Geo Web Cadastre - - - -
- - - diff --git a/pages/_app.tsx b/src/App.tsx similarity index 93% rename from pages/_app.tsx rename to src/App.tsx index d348d5f2..9e1255d4 100644 --- a/pages/_app.tsx +++ b/src/App.tsx @@ -1,4 +1,3 @@ -import { wrapper } from "../redux/store"; import React from "react"; import { ApolloClient, @@ -9,11 +8,10 @@ import { import { SUBGRAPH_URL, NETWORK_ID, - RPC_URLS, + RPC_URLS_HTTP, WALLET_CONNECT_PROJECT_ID, -} from "../lib/constants"; -import "../styles.scss"; -import { AppProps } from "next/app"; +} from "./lib/constants"; +import "./styles.scss"; import { MapProvider } from "react-map-gl"; import { configureChains, createClient, WagmiConfig } from "wagmi"; import { optimism, optimismGoerli } from "wagmi/chains"; @@ -41,11 +39,12 @@ import { Ed25519Provider, encodeDID } from "key-did-provider-ed25519"; import { generateKeyPairFromSeed } from "@stablelib/ed25519"; import KeyDidResolver from "key-did-resolver"; import { DID } from "dids"; +import IndexPage from "./pages/IndexPage"; import { randomBytes, randomString } from "@stablelib/random"; import { Cacao, SiweMessage as CacaoSiweMessage } from "@didtools/cacao"; import { getEIP191Verifier } from "@didtools/pkh-ethereum"; import merge from "lodash.merge"; -import { BundleSettingsProvider } from "../lib/transactionBundleSettings"; +import { BundleSettingsProvider } from "./lib/transactionBundleSettings"; const networkIdToChain: Record = { 10: optimism, 420: optimismGoerli, @@ -55,7 +54,7 @@ const { chains, provider } = configureChains( [ jsonRpcProvider({ rpc: (chain) => ({ - http: RPC_URLS[chain.id], + http: RPC_URLS_HTTP[chain.id], }), }), ] @@ -81,7 +80,7 @@ const wagmiClient = createClient({ provider, }); -export function App({ Component, pageProps }: AppProps) { +export default function App() { const [authStatus, setAuthStatus] = React.useState("loading"); @@ -114,7 +113,7 @@ export function App({ Component, pageProps }: AppProps) { issuedAt: now.toISOString(), expirationTime: oneWeekLater.toISOString(), chainId: chainId.toString(), - resources: ["ceramic://*"], + resources: [], }); return { siweMessage, keySeed }; @@ -233,8 +232,7 @@ export function App({ Component, pageProps }: AppProps) { - @@ -246,5 +244,3 @@ export function App({ Component, pageProps }: AppProps) { ); } - -export default wrapper.withRedux(App); diff --git a/components/ApproveButton.tsx b/src/components/ApproveButton.tsx similarity index 100% rename from components/ApproveButton.tsx rename to src/components/ApproveButton.tsx diff --git a/components/AuctionInstructions.tsx b/src/components/AuctionInstructions.tsx similarity index 100% rename from components/AuctionInstructions.tsx rename to src/components/AuctionInstructions.tsx diff --git a/components/ConnectWallet.tsx b/src/components/ConnectWallet.tsx similarity index 98% rename from components/ConnectWallet.tsx rename to src/components/ConnectWallet.tsx index 8534e5e5..7bd85d61 100644 --- a/components/ConnectWallet.tsx +++ b/src/components/ConnectWallet.tsx @@ -2,7 +2,7 @@ import { useState } from "react"; import Button from "react-bootstrap/Button"; import { useAccount, useNetwork } from "wagmi"; import { ConnectButton, useChainModal } from "@rainbow-me/rainbowkit"; -import { SmartAccount } from "../pages/index"; +import { SmartAccount } from "../pages/IndexPage"; import ConnectAccountModal from "./profile/ConnectAccountModal"; import { useMediaQuery } from "../lib/mediaQuery"; diff --git a/components/CopyTokenAddress.tsx b/src/components/CopyTokenAddress.tsx similarity index 100% rename from components/CopyTokenAddress.tsx rename to src/components/CopyTokenAddress.tsx diff --git a/components/CopyTooltip.tsx b/src/components/CopyTooltip.tsx similarity index 100% rename from components/CopyTooltip.tsx rename to src/components/CopyTooltip.tsx diff --git a/components/FAQ.tsx b/src/components/FAQ.tsx similarity index 97% rename from components/FAQ.tsx rename to src/components/FAQ.tsx index 6d7dde5e..f32a5fa6 100644 --- a/components/FAQ.tsx +++ b/src/components/FAQ.tsx @@ -267,20 +267,10 @@ function FAQ() {

The Geo Web leverages{" "} - - Ceramic - {" "} - and{" "} IPFS {" "} - for its content layer. The Cadastre automatically generates - and links a root Ceramic stream for each claimed parcel to - manage this linked content. + for its content layer.

We’ve set up free p2p content pinning and archive diff --git a/components/FundsRaisedCounter.tsx b/src/components/FundsRaisedCounter.tsx similarity index 100% rename from components/FundsRaisedCounter.tsx rename to src/components/FundsRaisedCounter.tsx diff --git a/components/Home.tsx b/src/components/Home.tsx similarity index 100% rename from components/Home.tsx rename to src/components/Home.tsx diff --git a/components/InfoTooltip.tsx b/src/components/InfoTooltip.tsx similarity index 100% rename from components/InfoTooltip.tsx rename to src/components/InfoTooltip.tsx diff --git a/components/Map.tsx b/src/components/Map.tsx similarity index 96% rename from components/Map.tsx rename to src/components/Map.tsx index 9e230eb1..1007f835 100644 --- a/components/Map.tsx +++ b/src/components/Map.tsx @@ -1,6 +1,6 @@ import { gql, useQuery } from "@apollo/client"; import * as React from "react"; -import { useRouter } from "next/router"; +import { useSearchParams } from "react-router-dom"; import { useEffect, useRef, useState } from "react"; import Col from "react-bootstrap/Col"; import ReactMapGL, { @@ -22,19 +22,18 @@ import Geocoder from "../lib/Geocoder"; import { DRAWER_PREVIEW_HEIGHT_PARCEL, DRAWER_CLAIM_HEIGHT, + MAPBOX_TOKEN, } from "../lib/constants"; import ParcelSource, { parcelsToMultiPoly } from "./sources/ParcelSource"; import OpRewardAlert from "./OpRewardAlert"; import { Contracts } from "@geo-web/sdk/dist/contract/types"; -import { GeoWebContent } from "@geo-web/content"; import Button from "react-bootstrap/Button"; import ButtonGroup from "react-bootstrap/ButtonGroup"; import Image from "react-bootstrap/Image"; import Alert from "react-bootstrap/Alert"; -import { CeramicClient } from "@ceramicnetwork/http-client"; import "@mapbox/mapbox-gl-geocoder/dist/mapbox-gl-geocoder.css"; import { ethers, BigNumber } from "ethers"; import "mapbox-gl/dist/mapbox-gl.css"; @@ -42,15 +41,10 @@ import "mapbox-gl/dist/mapbox-gl.css"; import { Client as W3Client } from "@web3-storage/w3up-client"; import { Framework, NativeAssetSuperToken } from "@superfluid-finance/sdk-core"; import firebase from "firebase/app"; -import type { IPFS } from "ipfs-core-types"; import type { MultiPolygon, Polygon } from "@turf/turf"; import * as turf from "@turf/turf"; - -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore -import type { InvocationConfig } from "@web3-storage/upload-client"; -import { SmartAccount } from "../pages/index"; +import { SmartAccount } from "../pages/IndexPage"; import ParcelList from "./parcels/ParcelList"; import { useMediaQuery } from "../lib/mediaQuery"; import { useParcelNavigation } from "../lib/parcelNavigation"; @@ -178,14 +172,7 @@ export type MapProps = { smartAccount: SmartAccount | null; setSmartAccount: React.Dispatch>; signer: ethers.Signer | null; - ceramic: CeramicClient; - setCeramic: React.Dispatch>; - ipfs: IPFS; - geoWebContent: GeoWebContent; w3Client: W3Client | null; - setGeoWebContent: React.Dispatch>; - w3InvocationConfig: InvocationConfig; - setW3InvocationConfig: React.Dispatch>; geoWebCoordinate: GeoWebCoordinate; firebasePerf: firebase.performance.Performance; paymentToken: NativeAssetSuperToken; @@ -221,7 +208,6 @@ function Map(props: MapProps) { interactionState, setInteractionState, isFullScreen, - setIsFullScreen, } = props; const { data, fetchMore, refetch } = useQuery(query, { variables: { @@ -315,8 +301,8 @@ function Map(props: MapProps) { const [showSearchBar, setShowSearchBar] = useState(false); const { isMobile, isTablet } = useMediaQuery(); - const router = useRouter(); const { parcelIdToCoords, flyToParcel } = useParcelNavigation(); + const [queryParams] = useSearchParams(); const gridZoomLevel = isMobile ? 16 : 17; const isGridVisible = @@ -432,9 +418,9 @@ function Map(props: MapProps) { return; } - const { query } = router; + const queryParamId = queryParams.get("id"); - if (process.env.NEXT_PUBLIC_APP_ENV === "testnet" && !query.id) { + if (import.meta.env.MODE === "testnet" && !queryParamId) { mapRef.current.easeTo({ center: [viewport.longitude, viewport.latitude], zoom: 13, @@ -454,8 +440,9 @@ function Map(props: MapProps) { setOldCoord(mapBounds.getCenter()); setInteractiveLayerIds(["parcels-layer"]); - if (query.id) { - const parcelId = typeof query.id === "string" ? query.id : query.id[0]; + if (queryParamId) { + const parcelId = + typeof queryParamId === "string" ? queryParamId : queryParamId[0]; const coords = await parcelIdToCoords(parcelId); if (coords) { @@ -471,7 +458,7 @@ function Map(props: MapProps) { } function _onMove(nextViewport: ViewState) { - if (interactionState == STATE.PUBLISHING || mapRef.current == null) { + if (interactionState === STATE.PUBLISHING || mapRef.current == null) { return; } setViewport(nextViewport); @@ -1041,7 +1028,7 @@ function Map(props: MapProps) {

)} - {interactionState != STATE.VIEWING ? ( + {interactionState !== STATE.VIEWING ? ( ) : null} - + {!isMobile || showSearchBar ? ( setShowSearchBar(false)} /> diff --git a/components/NotificationModal.tsx b/src/components/NotificationModal.tsx similarity index 100% rename from components/NotificationModal.tsx rename to src/components/NotificationModal.tsx diff --git a/components/OffCanvasPanel.tsx b/src/components/OffCanvasPanel.tsx similarity index 99% rename from components/OffCanvasPanel.tsx rename to src/components/OffCanvasPanel.tsx index f001b389..0d779e9f 100644 --- a/components/OffCanvasPanel.tsx +++ b/src/components/OffCanvasPanel.tsx @@ -8,7 +8,7 @@ import Col from "react-bootstrap/Col"; import ClaimAction from "./cards/ClaimAction"; import ClaimInfo from "./cards/ClaimInfo"; import ParcelInfo from "./cards/ParcelInfo"; -import { LoginState } from "../pages/index"; +import { LoginState } from "../pages/IndexPage"; import { STATE, MapProps, Coord, ParcelClaimInfo } from "./Map"; import ConnectWallet from "./ConnectWallet"; import { useMediaQuery } from "../lib/mediaQuery"; @@ -299,7 +299,7 @@ function OffCanvasPanel(props: OffCanvasPanelProps) { key={selectedParcelId} > ) : null} - {interactionState == STATE.CLAIM_SELECTING ? ( + {interactionState === STATE.CLAIM_SELECTING ? ( { if ( !bundleSettings.topUpTotalDigitsSelection || - bundleSettings.topUpTotalDigitsSelection == 0 + bundleSettings.topUpTotalDigitsSelection === 0 ) { bundleSettingsDispatch({ type: BundleSettingsActionType.UPDATE_BUNDLE_SETTINGS, @@ -491,7 +491,7 @@ function TransactionsBundleSettingsView(props: { onBlur={() => { if ( !bundleSettings.topUpSingleDigitsSelection || - bundleSettings.topUpSingleDigitsSelection == 0 + bundleSettings.topUpSingleDigitsSelection === 0 ) { bundleSettingsDispatch({ type: BundleSettingsActionType.UPDATE_BUNDLE_SETTINGS, diff --git a/components/WelcomeChecklist.tsx b/src/components/WelcomeChecklist.tsx similarity index 100% rename from components/WelcomeChecklist.tsx rename to src/components/WelcomeChecklist.tsx diff --git a/components/cards/AcceptBidAction.tsx b/src/components/cards/AcceptBidAction.tsx similarity index 100% rename from components/cards/AcceptBidAction.tsx rename to src/components/cards/AcceptBidAction.tsx diff --git a/components/cards/ActionForm.tsx b/src/components/cards/ActionForm.tsx similarity index 99% rename from components/cards/ActionForm.tsx rename to src/components/cards/ActionForm.tsx index 96f229aa..d2250b6f 100644 --- a/components/cards/ActionForm.tsx +++ b/src/components/cards/ActionForm.tsx @@ -326,7 +326,7 @@ export function ActionForm(props: ActionFormProps) { You can read more about Partial Common Ownership in our docs. diff --git a/components/cards/AuctionInfo.tsx b/src/components/cards/AuctionInfo.tsx similarity index 93% rename from components/cards/AuctionInfo.tsx rename to src/components/cards/AuctionInfo.tsx index 5d0d7f11..7844666a 100644 --- a/components/cards/AuctionInfo.tsx +++ b/src/components/cards/AuctionInfo.tsx @@ -104,9 +104,9 @@ function AuctionInfo(props: AuctionInfoProps) { }, [forSalePrice, auctionStartTimestamp, auctionLength]); const isLoading = - forSalePrice == null || - auctionStartTimestamp == null || - timeRemaining == null; + forSalePrice === null || + auctionStartTimestamp === null || + timeRemaining === null; const spinner = ( Loading... @@ -121,7 +121,7 @@ function AuctionInfo(props: AuctionInfoProps) { setInteractionState(STATE.PARCEL_RECLAIMING); }} > - {account?.toLowerCase() == licenseOwner?.toLowerCase() + {account?.toLowerCase() === licenseOwner?.toLowerCase() ? "Reclaim" : "Claim"} @@ -132,7 +132,7 @@ function AuctionInfo(props: AuctionInfoProps) {

- {interactionState == STATE.PARCEL_RECLAIMING + {interactionState === STATE.PARCEL_RECLAIMING ? "Dutch Auction Details" : "Foreclosure Dutch Auction"}

@@ -150,7 +150,7 @@ function AuctionInfo(props: AuctionInfoProps) { Time Remaining:{" "} {isLoading ? spinner : timeRemaining}

- {interactionState == STATE.PARCEL_RECLAIMING ? null : reclaimButton} + {interactionState === STATE.PARCEL_RECLAIMING ? null : reclaimButton}
diff --git a/components/cards/ClaimAction.tsx b/src/components/cards/ClaimAction.tsx similarity index 98% rename from components/cards/ClaimAction.tsx rename to src/components/cards/ClaimAction.tsx index a97dddb9..6c64a788 100644 --- a/components/cards/ClaimAction.tsx +++ b/src/components/cards/ClaimAction.tsx @@ -4,7 +4,7 @@ import { BigNumber, ethers } from "ethers"; import BN from "bn.js"; import { OffCanvasPanelProps, ParcelFieldsToUpdate } from "../OffCanvasPanel"; import StreamingInfo from "./StreamingInfo"; -import { SECONDS_IN_YEAR, SSX_HOST } from "../../lib/constants"; +import { SECONDS_IN_YEAR, SSX_HOST, REFERRAL_HOST } from "../../lib/constants"; import { fromValueToRate, calculateBufferNeeded } from "../../lib/utils"; import TransactionSummaryView from "./TransactionSummaryView"; import axios from "axios"; @@ -249,7 +249,7 @@ function ClaimAction(props: ClaimActionProps) { // Post all referrals to the referral server for (const referral of referrals) { const resp = await axios.post( - `${process.env.NEXT_REFERRAL_HOST}/claim`, + `${REFERRAL_HOST}/claim`, {}, { headers: { diff --git a/components/cards/ClaimInfo.tsx b/src/components/cards/ClaimInfo.tsx similarity index 95% rename from components/cards/ClaimInfo.tsx rename to src/components/cards/ClaimInfo.tsx index 877bcb40..338fe657 100644 --- a/components/cards/ClaimInfo.tsx +++ b/src/components/cards/ClaimInfo.tsx @@ -14,8 +14,12 @@ type ClaimInfoProps = { }; function ClaimInfo(props: ClaimInfoProps) { - const { parcelClaimInfo, setInteractionState, isValidClaim, setIsFullScreen } = - props; + const { + parcelClaimInfo, + setInteractionState, + isValidClaim, + setIsFullScreen, + } = props; const { isMobile, isTablet } = useMediaQuery(); diff --git a/components/cards/EditBidAction.tsx b/src/components/cards/EditBidAction.tsx similarity index 100% rename from components/cards/EditBidAction.tsx rename to src/components/cards/EditBidAction.tsx diff --git a/components/cards/EditMetadataAction.tsx b/src/components/cards/EditMetadataAction.tsx similarity index 99% rename from components/cards/EditMetadataAction.tsx rename to src/components/cards/EditMetadataAction.tsx index 4db38a45..6929cbdd 100644 --- a/components/cards/EditMetadataAction.tsx +++ b/src/components/cards/EditMetadataAction.tsx @@ -84,7 +84,7 @@ export function EditMetadataAction(props: EditMetadataActionProps) { parcelName !== basicProfile.name || parcelWebContentURI !== basicProfile.external_url; const isURIInvalid = parcelWebContentURI - ? /^(http|https|ipfs|ipns):\/\/[^ "]+$/.test(parcelWebContentURI) == + ? /^(http|https|ipfs|ipns):\/\/[^ "]+$/.test(parcelWebContentURI) === false || parcelWebContentURI.length > 150 : false; const isInvalid = isParcelNameInvalid || isURIInvalid; @@ -273,7 +273,7 @@ export function EditMetadataAction(props: EditMetadataActionProps) {
Geo Web spatial browser diff --git a/components/cards/OutstandingBidView.tsx b/src/components/cards/OutstandingBidView.tsx similarity index 100% rename from components/cards/OutstandingBidView.tsx rename to src/components/cards/OutstandingBidView.tsx diff --git a/components/cards/ParcelInfo.tsx b/src/components/cards/ParcelInfo.tsx similarity index 90% rename from components/cards/ParcelInfo.tsx rename to src/components/cards/ParcelInfo.tsx index e66982cc..810151d5 100644 --- a/components/cards/ParcelInfo.tsx +++ b/src/components/cards/ParcelInfo.tsx @@ -5,6 +5,10 @@ import { STATE } from "../Map"; import Button from "react-bootstrap/Button"; import Spinner from "react-bootstrap/Spinner"; import { + NETWORK_ID, + WORLD, + RPC_URLS_HTTP, + RPC_URLS_WS, PAYMENT_TOKEN, BLOCK_EXPLORER, SPATIAL_DOMAIN, @@ -19,7 +23,10 @@ import Dropdown from "react-bootstrap/Dropdown"; import NavItem from "react-bootstrap/NavItem"; import NavLink from "react-bootstrap/NavLink"; import CID from "cids"; +import { optimism, optimismGoerli } from "viem/chains"; +import { syncWorld, SyncWorldResult } from "@geo-web/mud-world-base-setup"; import { OffCanvasPanelProps, ParcelFieldsToUpdate } from "../OffCanvasPanel"; +import { MUDProvider } from "../../lib/MUDContext"; import { formatBalance } from "../../lib/formatBalance"; import EditBidAction from "./EditBidAction"; import EditMetadataAction from "./EditMetadataAction"; @@ -34,7 +41,7 @@ import RejectBidAction from "./RejectBidAction"; import AuctionInfo from "./AuctionInfo"; import ConnectWallet from "../ConnectWallet"; import NotificationModal from "../NotificationModal"; -import { LoginState } from "../../pages/index"; +import { LoginState } from "../../pages/IndexPage"; import { useBasicProfile } from "../../lib/geo-web-content/basicProfile"; import BN from "bn.js"; import { PCOLicenseDiamondFactory } from "@geo-web/sdk/dist/contract/index"; @@ -140,6 +147,8 @@ function ParcelInfo(props: ParcelInfoProps) { const [queryTimerId, setQueryTimerId] = React.useState( null ); + const [worldConfig, setWorldConfig] = + React.useState(); const { basicProfile, setShouldBasicProfileUpdate } = useBasicProfile( registryContract, @@ -197,6 +206,35 @@ function ParcelInfo(props: ParcelInfoProps) { navigator.clipboard.writeText(parcelLink.href); } + React.useEffect(() => { + (async () => { + if (accountAddress !== licenseOwner) { + return; + } + + const chain = + import.meta.env.MODE === "mainnet" ? optimism : optimismGoerli; + const mudChain = { + ...chain, + rpcUrls: { + ...chain.rpcUrls, + default: { + http: [RPC_URLS_HTTP[NETWORK_ID]], + webSocket: [RPC_URLS_WS[NETWORK_ID]], + }, + }, + }; + const worldConfig = await syncWorld({ + mudChain, + chainId: NETWORK_ID, + world: WORLD, + namespaces: [Number(selectedParcelId).toString()], + }); + + setWorldConfig(worldConfig); + })(); + }, [accountAddress, licenseOwner]); + React.useEffect(() => { const loadLicenseDiamond = async () => { if (!licenseDiamondAddress) { @@ -281,7 +319,7 @@ function ParcelInfo(props: ParcelInfoProps) { }; }, [parcelFieldsToUpdate, selectedParcelId]); - const isLoading = loading || data == null; + const isLoading = loading || data === null; let hrefWebContent; // Translate ipfs:// to case-insensitive base @@ -505,7 +543,7 @@ function ParcelInfo(props: ParcelInfoProps) { parcelFieldsToUpdate?.licenseOwner ) { buttons = null; - } else if (interactionState != STATE.PARCEL_SELECTED) { + } else if (interactionState !== STATE.PARCEL_SELECTED) { buttons = cancelButton; } else if (!isLoading) { if (!accountAddress || smartAccount?.loginState !== LoginState.CONNECTED) { @@ -518,7 +556,7 @@ function ParcelInfo(props: ParcelInfoProps) { {!hasOutstandingBid && } ); - } else if (accountAddress.toLowerCase() == licenseOwner?.toLowerCase()) { + } else if (accountAddress.toLowerCase() === licenseOwner?.toLowerCase()) { buttons =
{editGalleryButton}
; } else if (!hasOutstandingBid) { buttons = placeBidButton; @@ -528,14 +566,14 @@ function ParcelInfo(props: ParcelInfoProps) { return ( <> {header} - {interactionState == STATE.PARCEL_SELECTED || + {interactionState === STATE.PARCEL_SELECTED || (!isMobile && !isTablet && - (interactionState == STATE.PARCEL_EDITING_BID || - interactionState == STATE.PARCEL_PLACING_BID || - interactionState == STATE.PARCEL_ACCEPTING_BID || - interactionState == STATE.PARCEL_REJECTING_BID || - interactionState == STATE.EDITING_METADATA)) ? ( + (interactionState === STATE.PARCEL_EDITING_BID || + interactionState === STATE.PARCEL_PLACING_BID || + interactionState === STATE.PARCEL_ACCEPTING_BID || + interactionState === STATE.PARCEL_REJECTING_BID || + interactionState === STATE.EDITING_METADATA)) ? ( @@ -601,7 +639,7 @@ function ParcelInfo(props: ParcelInfoProps) { - {invalidLicenseId == selectedParcelId + {invalidLicenseId === selectedParcelId ? null : parcelFieldsToUpdate?.forSalePrice || parcelFieldsToUpdate?.licenseOwner @@ -613,9 +651,9 @@ function ParcelInfo(props: ParcelInfoProps) { ) : null} - {(interactionState == STATE.PARCEL_RECLAIMING || - (interactionState == STATE.PARCEL_SELECTED && - invalidLicenseId == selectedParcelId && + {(interactionState === STATE.PARCEL_RECLAIMING || + (interactionState === STATE.PARCEL_SELECTED && + invalidLicenseId === selectedParcelId && data)) && licenseOwner && currentOwnerBidForSalePrice && @@ -629,7 +667,7 @@ function ParcelInfo(props: ParcelInfoProps) { {...props} /> ) : null} - {interactionState == STATE.PARCEL_SELECTED && + {interactionState === STATE.PARCEL_SELECTED && hasOutstandingBid && outstandingBidForSalePrice && currentOwnerBidForSalePrice && @@ -647,7 +685,7 @@ function ParcelInfo(props: ParcelInfoProps) { ) : null} - {interactionState == STATE.PARCEL_EDITING_BID && + {interactionState === STATE.PARCEL_EDITING_BID && accountAddress && signer && data?.geoWebParcel && @@ -666,7 +704,7 @@ function ParcelInfo(props: ParcelInfoProps) { licenseOwner={licenseOwner} /> ) : null} - {interactionState == STATE.EDITING_METADATA && + {interactionState === STATE.EDITING_METADATA && basicProfile && accountAddress && signer && @@ -679,7 +717,7 @@ function ParcelInfo(props: ParcelInfoProps) { licenseDiamondContract={licenseDiamondContract} /> ) : null} - {interactionState == STATE.PARCEL_PLACING_BID && + {interactionState === STATE.PARCEL_PLACING_BID && accountAddress && signer && data?.geoWebParcel ? ( @@ -691,7 +729,7 @@ function ParcelInfo(props: ParcelInfoProps) { /> ) : null} {smartAccount?.safe && - interactionState == STATE.PARCEL_ACCEPTING_BID && + interactionState === STATE.PARCEL_ACCEPTING_BID && hasOutstandingBid && outstandingBidForSalePrice && currentOwnerBidForSalePrice && @@ -705,7 +743,7 @@ function ParcelInfo(props: ParcelInfoProps) { licenseDiamondContract={licenseDiamondContract} /> ) : null} - {interactionState == STATE.PARCEL_REJECTING_BID && + {interactionState === STATE.PARCEL_REJECTING_BID && accountAddress && signer && hasOutstandingBid && @@ -722,7 +760,7 @@ function ParcelInfo(props: ParcelInfoProps) { licenseDiamondContract={licenseDiamondContract} /> ) : null} - {interactionState == STATE.PARCEL_RECLAIMING && + {interactionState === STATE.PARCEL_RECLAIMING && accountAddress && signer && licenseOwner ? ( @@ -737,15 +775,17 @@ function ParcelInfo(props: ParcelInfoProps) { ) : null} - {interactionState == STATE.PUBLISHING && ( - + + > + )} ); diff --git a/components/cards/PlaceBidAction.tsx b/src/components/cards/PlaceBidAction.tsx similarity index 99% rename from components/cards/PlaceBidAction.tsx rename to src/components/cards/PlaceBidAction.tsx index 67ce9b07..6f135cf5 100644 --- a/components/cards/PlaceBidAction.tsx +++ b/src/components/cards/PlaceBidAction.tsx @@ -323,7 +323,7 @@ function PlaceBidAction(props: PlaceBidActionProps) { You can read more about Partial Common Ownership in our docs. diff --git a/components/cards/ReclaimAction.tsx b/src/components/cards/ReclaimAction.tsx similarity index 100% rename from components/cards/ReclaimAction.tsx rename to src/components/cards/ReclaimAction.tsx diff --git a/components/cards/RejectBidAction.tsx b/src/components/cards/RejectBidAction.tsx similarity index 99% rename from components/cards/RejectBidAction.tsx rename to src/components/cards/RejectBidAction.tsx index 870806c0..5df910f5 100644 --- a/components/cards/RejectBidAction.tsx +++ b/src/components/cards/RejectBidAction.tsx @@ -431,7 +431,7 @@ function RejectBidAction(props: RejectBidActionProps) { You can read more about Partial Common Ownership in our docs. diff --git a/components/cards/StreamingInfo.tsx b/src/components/cards/StreamingInfo.tsx similarity index 93% rename from components/cards/StreamingInfo.tsx rename to src/components/cards/StreamingInfo.tsx index 54d83fa9..d1ad25e8 100644 --- a/components/cards/StreamingInfo.tsx +++ b/src/components/cards/StreamingInfo.tsx @@ -4,12 +4,9 @@ import Col from "react-bootstrap/Col"; import Row from "react-bootstrap/Row"; import Container from "react-bootstrap/Container"; import Spinner from "react-bootstrap/Spinner"; -import { CeramicClient } from "@ceramicnetwork/http-client"; -import type { IPFS } from "ipfs-core-types"; import { Contracts } from "@geo-web/sdk/dist/contract/types"; -import { GeoWebContent } from "@geo-web/content"; import ProfileModal from "../profile/ProfileModal"; -import { SmartAccount } from "../../pages/index"; +import { SmartAccount } from "../../pages/IndexPage"; import { sfSubgraph } from "../../redux/store"; import { NETWORK_ID } from "../../lib/constants"; import { FlowingBalance } from "../profile/FlowingBalance"; @@ -24,9 +21,6 @@ type StreamingInfoProps = { signer: ethers.Signer; smartAccount: SmartAccount | null; setSmartAccount: React.Dispatch>; - ceramic: CeramicClient; - ipfs: IPFS; - geoWebContent: GeoWebContent; registryContract: Contracts["registryDiamondContract"]; paymentToken: NativeAssetSuperToken; setSelectedParcelId: React.Dispatch>; diff --git a/components/cards/TransactionError.tsx b/src/components/cards/TransactionError.tsx similarity index 100% rename from components/cards/TransactionError.tsx rename to src/components/cards/TransactionError.tsx diff --git a/components/cards/TransactionSummaryView.tsx b/src/components/cards/TransactionSummaryView.tsx similarity index 98% rename from components/cards/TransactionSummaryView.tsx rename to src/components/cards/TransactionSummaryView.tsx index 4ea24040..a82520e1 100644 --- a/components/cards/TransactionSummaryView.tsx +++ b/src/components/cards/TransactionSummaryView.tsx @@ -46,7 +46,7 @@ function TransactionSummaryView({ const { isMobile } = useMediaQuery(); const bundleSettings = useBundleSettings(); - const txnReady = newAnnualNetworkFee != null; + const txnReady = newAnnualNetworkFee !== null; const isDeltaPayment = !collateralDeposit && !claimPayment; @@ -133,15 +133,15 @@ function TransactionSummaryView({ if (claimPayment) { paymentView = (

- {interactionState == STATE.PARCEL_RECLAIMING && - account.toLowerCase() != licenseOwner?.toLowerCase() + {interactionState === STATE.PARCEL_RECLAIMING && + account.toLowerCase() !== licenseOwner?.toLowerCase() ? "Max Claim Payment (to Licensor): " : "Claim Payment: "} - {interactionState == STATE.PARCEL_RECLAIMING && + {interactionState === STATE.PARCEL_RECLAIMING && account.toLowerCase() === licenseOwner?.toLowerCase() ? "No one-time payment is required to reclaim your foreclosed parcel—just restart a network fee stream." : `Parcel claims require a flat, one-time payment of ${truncateEth( @@ -247,7 +247,8 @@ function TransactionSummaryView({ const streamView = (

; } else { return ; diff --git a/components/parcels/Foreclosure.tsx b/src/components/parcels/Foreclosure.tsx similarity index 100% rename from components/parcels/Foreclosure.tsx rename to src/components/parcels/Foreclosure.tsx diff --git a/components/parcels/HighestValue.tsx b/src/components/parcels/HighestValue.tsx similarity index 100% rename from components/parcels/HighestValue.tsx rename to src/components/parcels/HighestValue.tsx diff --git a/components/parcels/NeedsTransfer.tsx b/src/components/parcels/NeedsTransfer.tsx similarity index 100% rename from components/parcels/NeedsTransfer.tsx rename to src/components/parcels/NeedsTransfer.tsx diff --git a/components/parcels/OutstandingBid.tsx b/src/components/parcels/OutstandingBid.tsx similarity index 100% rename from components/parcels/OutstandingBid.tsx rename to src/components/parcels/OutstandingBid.tsx diff --git a/components/parcels/ParcelList.tsx b/src/components/parcels/ParcelList.tsx similarity index 98% rename from components/parcels/ParcelList.tsx rename to src/components/parcels/ParcelList.tsx index e93f448c..c4e3a7ee 100644 --- a/components/parcels/ParcelList.tsx +++ b/src/components/parcels/ParcelList.tsx @@ -2,7 +2,6 @@ import { useState } from "react"; import { BigNumber } from "ethers"; import { Modal, Container, Row, Col, Image, Button } from "react-bootstrap"; import { Framework } from "@superfluid-finance/sdk-core"; -import { GeoWebContent } from "@geo-web/content"; import { Contracts } from "@geo-web/sdk/dist/contract/types"; import HighestValue from "./HighestValue"; import Recent from "./Recent"; @@ -17,7 +16,6 @@ import { useParcelNavigation } from "../../lib/parcelNavigation"; interface ParcelListProps { sfFramework: Framework; - geoWebContent: GeoWebContent; registryContract: Contracts["registryDiamondContract"]; setSelectedParcelId: React.Dispatch>; setInteractionState: React.Dispatch>; diff --git a/components/parcels/ParcelTable.tsx b/src/components/parcels/ParcelTable.tsx similarity index 100% rename from components/parcels/ParcelTable.tsx rename to src/components/parcels/ParcelTable.tsx diff --git a/components/parcels/Random.tsx b/src/components/parcels/Random.tsx similarity index 100% rename from components/parcels/Random.tsx rename to src/components/parcels/Random.tsx diff --git a/components/parcels/Recent.tsx b/src/components/parcels/Recent.tsx similarity index 100% rename from components/parcels/Recent.tsx rename to src/components/parcels/Recent.tsx diff --git a/components/profile/AddFundsModal.tsx b/src/components/profile/AddFundsModal.tsx similarity index 98% rename from components/profile/AddFundsModal.tsx rename to src/components/profile/AddFundsModal.tsx index 7a0e86ec..c8b1fa18 100644 --- a/components/profile/AddFundsModal.tsx +++ b/src/components/profile/AddFundsModal.tsx @@ -12,7 +12,7 @@ import InfoTooltip from "../InfoTooltip"; import OnRampWidget from "../OnRampWidget"; import { useMediaQuery } from "../../lib/mediaQuery"; import { useSafe } from "../../lib/safe"; -import { SmartAccount } from "../../pages/index"; +import { SmartAccount } from "../../pages/IndexPage"; import { truncateEth } from "../../lib/truncate"; import { MIN_CLAIM_BALANCE } from "../../lib/constants"; @@ -198,7 +198,7 @@ function AddFundsModal(props: AddFundsModalProps) { target={ >; authStatus: string; - ceramic: CeramicClient; - setCeramic: React.Dispatch>; - setW3InvocationConfig: React.Dispatch>; - ipfs: IPFS; - geoWebContent: GeoWebContent; - setGeoWebContent: React.Dispatch>; registryContract: Contracts["registryDiamondContract"]; setSelectedParcelId: React.Dispatch>; interactionState: STATE; diff --git a/components/profile/ProfileModal.tsx b/src/components/profile/ProfileModal.tsx similarity index 99% rename from components/profile/ProfileModal.tsx rename to src/components/profile/ProfileModal.tsx index b23d2dd8..c2ce342c 100644 --- a/components/profile/ProfileModal.tsx +++ b/src/components/profile/ProfileModal.tsx @@ -27,20 +27,18 @@ import type { Point } from "@turf/turf"; import * as turf from "@turf/turf"; import { Contracts } from "@geo-web/sdk/dist/contract/types"; import { PCOLicenseDiamondFactory } from "@geo-web/sdk/dist/contract/index"; -import type { IPFS } from "ipfs-core-types"; import { FlowingBalance } from "./FlowingBalance"; import AddFundsModal from "./AddFundsModal"; import { CopyTokenAddress, TokenOptions } from "../CopyTokenAddress"; import InfoTooltip from "../InfoTooltip"; import CopyTooltip from "../CopyTooltip"; -import { SmartAccount } from "../../pages/index"; +import { SmartAccount } from "../../pages/IndexPage"; import TransactionBundleSettingsView from "../TransactionBundleSettingsView"; import OnRampWidget from "../OnRampWidget"; import { PAYMENT_TOKEN, SECONDS_IN_WEEK, SECONDS_IN_YEAR, - // RAMP_HOST_KEY, ZERO_ADDRESS, } from "../../lib/constants"; import { getETHBalance } from "../../lib/getBalance"; @@ -65,7 +63,6 @@ interface ProfileModalProps { smartAccount: SmartAccount | null; setSmartAccount: React.Dispatch>; sfFramework: Framework; - ipfs: IPFS; registryContract: Contracts["registryDiamondContract"]; setSelectedParcelId: React.Dispatch>; setInteractionState: React.Dispatch>; @@ -846,7 +843,7 @@ function ProfileModal(props: ProfileModalProps) { -

+ + setAugmentType(AugmentType.MODEL)} + > + {AugmentType.MODEL} + + setAugmentType(AugmentType.IMAGE)} + > + {AugmentType.IMAGE} + + setAugmentType(AugmentType.AUDIO)} + > + {AugmentType.AUDIO} + + setAugmentType(AugmentType.VIDEO)} + > + {AugmentType.VIDEO} + + + + + + + + + {mediaObjects.map((mediaObject, i) => { + let mediaType; + switch (mediaObject.mediaType) { + case MediaObjectType.Model: + mediaType = "3D Model"; + break; + case MediaObjectType.Audio: + mediaType = "Audio"; + break; + case MediaObjectType.Image: + mediaType = "Image"; + break; + case MediaObjectType.Video: + mediaType = "Video"; + break; + } + return ( + + + + + {/* */} + + ); + })} + +
{i + 1}{mediaObject.name}{mediaType} + +
+
+ )} ); diff --git a/src/styles.scss b/src/styles.scss index a7024d7f..2e31085e 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -317,3 +317,12 @@ input[type="number"] { opacity: 0; } } + +.table-dark { + --bs-table-bg: #12141d66; + --bs-table-striped-bg: #000000; +} + +td { + vertical-align: middle; +} diff --git a/yarn.lock b/yarn.lock index b8e37827..9018a7f1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7,11 +7,6 @@ resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz#d2a39395c587e092d77cbbc80acf956a54f38bf7" integrity sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q== -"@adraffy/ens-normalize@1.9.0": - version "1.9.0" - resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.9.0.tgz#223572538f6bea336750039bb43a4016dcc8182d" - integrity sha512-iowxq3U30sghZotgl4s/oJRci6WPBfNO5YYgk2cIOMCHr3LeGPcsZjCEr+33Q4N+oV3OABDAtA+pyvWjbvBifQ== - "@adraffy/ens-normalize@1.9.4": version "1.9.4" resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.9.4.tgz#aae21cb858bbb0411949d5b7b3051f4209043f62" @@ -2990,22 +2985,7 @@ date-fns "^2.28.0" remixd "^0.2.4-alpha.0" -"@geo-web/mud-world-base-contracts@0.0.12": - version "0.0.12" - resolved "https://registry.yarnpkg.com/@geo-web/mud-world-base-contracts/-/mud-world-base-contracts-0.0.12.tgz#48567be2b56d4fd1de820ae5aacab5f3699e956d" - integrity sha512-erfPhS6TR/F+09htvPuiCv2U/dq9jRUnrseed9S72nqoiP2+5I+CzfzkPBAzDccWmUkKUPYagsOIDL0Pm6DwcA== - dependencies: - "@ethersproject/abi" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/providers" "^5.7.2" - "@latticexyz/cli" "2.0.0-next.5" - "@latticexyz/config" "2.0.0-next.5" - "@latticexyz/schema-type" "2.0.0-next.5" - "@latticexyz/store" "2.0.0-next.5" - "@latticexyz/world" "2.0.0-next.5" - ethers "^5.7.2" - -"@geo-web/mud-world-base-contracts@^0.1.0": +"@geo-web/mud-world-base-contracts@0.1.0": version "0.1.0" resolved "https://registry.yarnpkg.com/@geo-web/mud-world-base-contracts/-/mud-world-base-contracts-0.1.0.tgz#45271c77e4fea0690f0329ffb577c354d0e298d4" integrity sha512-+PiaBxa4KvK/QenB4cRhmd+CiiPPqJkfD7z2xr+57y52gHQWcrD7bgwUy4lWQ79lIgvV3dI1/Vw8JiONiXH5og== @@ -3022,16 +3002,16 @@ "@openzeppelin/contracts" "^4.9.3" ethers "^5.7.2" -"@geo-web/mud-world-base-setup@^0.1.0": - version "0.1.0" - resolved "https://registry.yarnpkg.com/@geo-web/mud-world-base-setup/-/mud-world-base-setup-0.1.0.tgz#ed6adec48f32de7cee582b59e5e55393c845d5b2" - integrity sha512-xeDs6IN/lkLu+Z5JsHRM+NID0i2uMCDHX7Dop3uPJ7kC1AMYjIucJz8zYtr/OtJaCCEvpfcrY4ZkmVPKEcoMyg== +"@geo-web/mud-world-base-setup@0.1.2": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@geo-web/mud-world-base-setup/-/mud-world-base-setup-0.1.2.tgz#4321e59b3fde87c0d268a91e6c5eff91e0b6e7cf" + integrity sha512-Bnt+eH6eyYu7uGFuf6N/HrXccwbeCzWCCjb+9T3vwyHlpvCcME2vB5pYr8d58kdkgicHQSONk2u0+XenYE69ww== dependencies: "@ethersproject/providers" "^5.7.2" - "@geo-web/mud-world-base-contracts" "0.0.12" - "@latticexyz/common" "2.0.0-next.14" - "@latticexyz/store" "2.0.0-next.14" - "@latticexyz/store-sync" "2.0.0-next.14" + "@geo-web/mud-world-base-contracts" "0.1.0" + "@latticexyz/common" "2.0.0-next.15" + "@latticexyz/store" "2.0.0-next.15" + "@latticexyz/store-sync" "2.0.0-next.15" ethers "^5.7.2" react "^18.2.0" react-dom "^18.2.0" @@ -3275,12 +3255,12 @@ glob "^8.0.3" yargs "^17.7.1" -"@latticexyz/block-logs-stream@2.0.0-next.14": - version "2.0.0-next.14" - resolved "https://registry.yarnpkg.com/@latticexyz/block-logs-stream/-/block-logs-stream-2.0.0-next.14.tgz#8aef0c40d8234adf14e10f60d80790dd5e70faf9" - integrity sha512-8j74Cd0mpp6t7UIFiSawb5arzQ/pO74xzEIAb6o42zzhVfU3gjYCICcfQttJTrDEi6uyj5VBmK8QJ6oGiepF5A== +"@latticexyz/block-logs-stream@2.0.0-next.15": + version "2.0.0-next.15" + resolved "https://registry.yarnpkg.com/@latticexyz/block-logs-stream/-/block-logs-stream-2.0.0-next.15.tgz#54967a83c747f790f4660b5c86f632a7705dcbb5" + integrity sha512-OcvbBT3oOQVNJHfIX89a6KFUn6X3WFisKoG2Q0yYANdyFWPfoNYopep1h4RMzvKGebuN+XQ/ClHIsrupcAuxZA== dependencies: - "@latticexyz/common" "2.0.0-next.14" + "@latticexyz/common" "2.0.0-next.15" abitype "0.9.8" debug "^4.3.4" rxjs "7.5.5" @@ -3323,42 +3303,6 @@ zod "^3.21.4" zod-validation-error "^1.3.0" -"@latticexyz/cli@2.0.0-next.5": - version "2.0.0-next.5" - resolved "https://registry.yarnpkg.com/@latticexyz/cli/-/cli-2.0.0-next.5.tgz#b6fab18fee75713ca7cec701422940d7996d5911" - integrity sha512-9gmLw3yafJM6cj7SdW+4JAbOisCEatMaLM/RgsbMeBTibD3nJbccSNCXaPIS23eczTSmKcHHTQs22m72Qm76mg== - dependencies: - "@ethersproject/abi" "^5.7.0" - "@ethersproject/providers" "^5.7.2" - "@improbable-eng/grpc-web" "^0.15.0" - "@improbable-eng/grpc-web-node-http-transport" "^0.15.0" - "@latticexyz/common" "2.0.0-next.5" - "@latticexyz/config" "2.0.0-next.5" - "@latticexyz/gas-report" "2.0.0-next.5" - "@latticexyz/protocol-parser" "2.0.0-next.5" - "@latticexyz/schema-type" "2.0.0-next.5" - "@latticexyz/services" "2.0.0-next.5" - "@latticexyz/store" "2.0.0-next.5" - "@latticexyz/utils" "2.0.0-next.5" - "@latticexyz/world" "2.0.0-next.5" - "@typechain/ethers-v5" "^10.2.0" - chalk "^5.0.1" - chokidar "^3.5.3" - dotenv "^16.0.3" - ejs "^3.1.8" - ethers "^5.7.2" - execa "^7.0.0" - glob "^8.0.3" - nice-grpc-web "^2.0.1" - openurl "^1.1.1" - path "^0.12.7" - throttle-debounce "^5.0.0" - typechain "^8.1.1" - typescript "5.1.6" - yargs "^17.7.1" - zod "^3.21.4" - zod-validation-error "^1.3.0" - "@latticexyz/common@2.0.0-main-f6d214e3": version "2.0.0-main-f6d214e3" resolved "https://registry.yarnpkg.com/@latticexyz/common/-/common-2.0.0-main-f6d214e3.tgz#44656dc820cac9b63ecfa3b310c59104265c6c35" @@ -3389,12 +3333,12 @@ prettier-plugin-solidity "^1.1.2" viem "1.14.0" -"@latticexyz/common@2.0.0-next.14": - version "2.0.0-next.14" - resolved "https://registry.yarnpkg.com/@latticexyz/common/-/common-2.0.0-next.14.tgz#a3a5f7ce4be37697ab94c34f5542737e6a551c6c" - integrity sha512-sNEz6WLmyirUkmywS6X8of2CnKZRcPNb4izVfHK/vkGueaUHiRe2Kujf5B3+LxjxcmTMERoBTEdqov/QelKlSQ== +"@latticexyz/common@2.0.0-next.15": + version "2.0.0-next.15" + resolved "https://registry.yarnpkg.com/@latticexyz/common/-/common-2.0.0-next.15.tgz#643ea950a680ad4eee27c9076bc5aa2aee83d562" + integrity sha512-BncRMgjVqd0jbWtNBFUDk/RMWV+/LRcQAZAY2yWWuoVg7SZfX2ZrSSMOuf/V04TNJK2gKd6GVdRFF6Hjdi5C0A== dependencies: - "@latticexyz/schema-type" "2.0.0-next.14" + "@latticexyz/schema-type" "2.0.0-next.15" "@solidity-parser/parser" "^0.16.0" debug "^4.3.4" execa "^7.0.0" @@ -3404,22 +3348,6 @@ prettier-plugin-solidity "1.1.3" viem "1.14.0" -"@latticexyz/common@2.0.0-next.5": - version "2.0.0-next.5" - resolved "https://registry.yarnpkg.com/@latticexyz/common/-/common-2.0.0-next.5.tgz#b7de8d30905a33692d4fd7fc6a35c0ee7ad400a8" - integrity sha512-n4xZxm1c4ldMcpVqU0g67yv/7Ik0GH/eatV8rRvSc5WLNSEzIa+iV5MYsnhfIxJICOVk9co+9pwc53mXmifesw== - dependencies: - "@latticexyz/schema-type" "2.0.0-next.5" - "@solidity-parser/parser" "^0.16.0" - abitype "0.9.3" - chalk "^5.2.0" - debug "^4.3.4" - execa "^7.0.0" - p-retry "^5.1.2" - prettier "^2.8.4" - prettier-plugin-solidity "^1.1.2" - viem "1.6.0" - "@latticexyz/config@2.0.0-main-f6d214e3": version "2.0.0-main-f6d214e3" resolved "https://registry.yarnpkg.com/@latticexyz/config/-/config-2.0.0-main-f6d214e3.tgz#9715cca67e24ae79ce399cd3fb5e58b5410e70b7" @@ -3447,33 +3375,19 @@ zod "^3.21.4" zod-validation-error "^1.3.0" -"@latticexyz/config@2.0.0-next.14": - version "2.0.0-next.14" - resolved "https://registry.yarnpkg.com/@latticexyz/config/-/config-2.0.0-next.14.tgz#66b6ff474a199dcd1ad0e983ec374c962c5a6967" - integrity sha512-bcMWrbxakD3kpDJdE0KStDaOOiPJQbraDb2qkkliCLXKvFc1fTMRqWYV53sGZAmFz/3ygaR0/2dVWe5HWyNNbQ== +"@latticexyz/config@2.0.0-next.15": + version "2.0.0-next.15" + resolved "https://registry.yarnpkg.com/@latticexyz/config/-/config-2.0.0-next.15.tgz#92d6c6647d83169998fda02de0aff473af207353" + integrity sha512-dHcOJydgIBo4F6eK0bpo8JspE1kZN7TpXU0DceANlKTDUBg+KtSsSeGNDJBT3Ch0nJGeW0RXdA7LuiN6UIEG/Q== dependencies: - "@latticexyz/common" "2.0.0-next.14" - "@latticexyz/schema-type" "2.0.0-next.14" + "@latticexyz/common" "2.0.0-next.15" + "@latticexyz/schema-type" "2.0.0-next.15" esbuild "^0.17.15" find-up "^6.3.0" viem "1.14.0" zod "^3.21.4" zod-validation-error "^1.3.0" -"@latticexyz/config@2.0.0-next.5": - version "2.0.0-next.5" - resolved "https://registry.yarnpkg.com/@latticexyz/config/-/config-2.0.0-next.5.tgz#53a8669feb05991cda4f45013996ff20ddfc0da7" - integrity sha512-2qmtKHVJCdTWyXnYctusgaEWalXLig77lqMWkwI03mgnPKUa3Xtr/uicukWki0gHWl1fN5i3OkKQBntCBEiysg== - dependencies: - "@latticexyz/common" "2.0.0-next.5" - "@latticexyz/schema-type" "2.0.0-next.5" - chalk "^5.2.0" - esbuild "^0.17.15" - ethers "^5.7.2" - find-up "^6.3.0" - zod "^3.21.4" - zod-validation-error "^1.3.0" - "@latticexyz/gas-report@2.0.0-next.11": version "2.0.0-next.11" resolved "https://registry.yarnpkg.com/@latticexyz/gas-report/-/gas-report-2.0.0-next.11.tgz#3da785626f1671a74b72084803024a3aff8b1232" @@ -3487,18 +3401,6 @@ table "^6.8.1" yargs "^17.7.1" -"@latticexyz/gas-report@2.0.0-next.5": - version "2.0.0-next.5" - resolved "https://registry.yarnpkg.com/@latticexyz/gas-report/-/gas-report-2.0.0-next.5.tgz#fdd9729b50efc74c50c36acee08cd7a7962da89e" - integrity sha512-NQ24Pya+scWm5mDzC4RNKQeh/52YdTt8/xig1b0Pbx+VRIkML+FVxuRd52gLCPQ+YXPYkKH+wexyGVNzewSbDg== - dependencies: - chalk "^5.3.0" - dotenv "^16.0.3" - execa "^7.0.0" - strip-ansi "^7.1.0" - table "^6.8.1" - yargs "^17.7.1" - "@latticexyz/protocol-parser@2.0.0-next.11": version "2.0.0-next.11" resolved "https://registry.yarnpkg.com/@latticexyz/protocol-parser/-/protocol-parser-2.0.0-next.11.tgz#3c3fa154d4e8c424e98ff55b6770273aecb1f9c3" @@ -3509,33 +3411,23 @@ abitype "0.9.8" viem "1.14.0" -"@latticexyz/protocol-parser@2.0.0-next.14": - version "2.0.0-next.14" - resolved "https://registry.yarnpkg.com/@latticexyz/protocol-parser/-/protocol-parser-2.0.0-next.14.tgz#d95c4ae7551eae0bd5fb885aade5cd1cc9b3d49e" - integrity sha512-cpZYGi2iRjaH6qddIKop88m3zL7Hj1BSQvhougE1ZiX9JRzyr7XbtbHrHIR1nMRppxItFfHf9ZF1kC3DXx8uCA== +"@latticexyz/protocol-parser@2.0.0-next.15": + version "2.0.0-next.15" + resolved "https://registry.yarnpkg.com/@latticexyz/protocol-parser/-/protocol-parser-2.0.0-next.15.tgz#39d794964f3e2db82f8bdd7868c4555c2209c858" + integrity sha512-J6hMEhW2XnBGs5o1dccTO7Qbpg+waN3EdYVyp7H2c2fmHZs0LByZuzbYY4Qqx6CCsqWqS8N4CPROIWqH5vrl+Q== dependencies: - "@latticexyz/common" "2.0.0-next.14" - "@latticexyz/schema-type" "2.0.0-next.14" + "@latticexyz/common" "2.0.0-next.15" + "@latticexyz/schema-type" "2.0.0-next.15" abitype "0.9.8" viem "1.14.0" -"@latticexyz/protocol-parser@2.0.0-next.5": - version "2.0.0-next.5" - resolved "https://registry.yarnpkg.com/@latticexyz/protocol-parser/-/protocol-parser-2.0.0-next.5.tgz#c56b3f75d1eb6ac985f46b60ef1e35adad866e4e" - integrity sha512-8s2SoGIarQijwF9OXOlO5gXc5LuZUtKFYVcFCZ23XZIKVoACNFhqcpW1oulCUkqutyk5D43CKVdDsuYdVKJhIw== - dependencies: - "@latticexyz/common" "2.0.0-next.5" - "@latticexyz/schema-type" "2.0.0-next.5" - abitype "0.9.3" - viem "1.6.0" - -"@latticexyz/recs@2.0.0-next.14": - version "2.0.0-next.14" - resolved "https://registry.yarnpkg.com/@latticexyz/recs/-/recs-2.0.0-next.14.tgz#123acf7bfa546be391999e50411a77a0efdeafce" - integrity sha512-3kMqhFn5cUxwJQ75u/KR4q6x1rJI2nafXdDewOgZeyyTL3n1Pi9cwI9qhOLrXqlWs2xnSMh1hrtMTiMY2H2esw== +"@latticexyz/recs@2.0.0-next.15": + version "2.0.0-next.15" + resolved "https://registry.yarnpkg.com/@latticexyz/recs/-/recs-2.0.0-next.15.tgz#84bac156eceff390173d486b4bbcfc10cc017632" + integrity sha512-ECqWQ5t3ZkLCFgF/Nrh+S6JsbmJ8egVOmnW+WO+7LTShODU2ZCSW+cpRvFaWJQGd/BSprxBK7nExF3bD/vhKHQ== dependencies: - "@latticexyz/schema-type" "2.0.0-next.14" - "@latticexyz/utils" "2.0.0-next.14" + "@latticexyz/schema-type" "2.0.0-next.15" + "@latticexyz/utils" "2.0.0-next.15" mobx "^6.7.0" rxjs "7.5.5" @@ -3555,22 +3447,14 @@ abitype "0.9.8" viem "1.14.0" -"@latticexyz/schema-type@2.0.0-next.14": - version "2.0.0-next.14" - resolved "https://registry.yarnpkg.com/@latticexyz/schema-type/-/schema-type-2.0.0-next.14.tgz#3513b2c9bada92984f926a490015dd4c27025456" - integrity sha512-+XAu+lnhYnwm4bRzo2yFyqcHz1aLuot44uqNcfL/9kyDLHIsrWm5QUI6t8g/HhpnNMPZ9oaNLsWLEVM0xL7htg== +"@latticexyz/schema-type@2.0.0-next.15": + version "2.0.0-next.15" + resolved "https://registry.yarnpkg.com/@latticexyz/schema-type/-/schema-type-2.0.0-next.15.tgz#e01f95655907dfc854bf7eb81816fb37a41d612c" + integrity sha512-Tx23kYFhF10cGmapfV8/Bc/rqfOh0FWvVyEJ6oVYks7cuaSHj9Zw0my0lZy4Zi9RleVYArNnsgcOyLLBsHtaKw== dependencies: abitype "0.9.8" viem "1.14.0" -"@latticexyz/schema-type@2.0.0-next.5": - version "2.0.0-next.5" - resolved "https://registry.yarnpkg.com/@latticexyz/schema-type/-/schema-type-2.0.0-next.5.tgz#35c169f70efe11602014f1818247b0c9c24fd549" - integrity sha512-PwnshYJq5a2qxKgvRFrPYuhYME0mOGrSqcjCXyVvQLgBi9dT+P59phdEMe7cva2fZdFliRtjFJjQkKyf6NKkNw== - dependencies: - abitype "0.9.3" - viem "1.6.0" - "@latticexyz/services@2.0.0-next.11": version "2.0.0-next.11" resolved "https://registry.yarnpkg.com/@latticexyz/services/-/services-2.0.0-next.11.tgz#93409866964d001d9a84a26cfdb8499f622d1dd3" @@ -3581,30 +3465,21 @@ nice-grpc-web "^2.0.1" protobufjs "^7.2.3" -"@latticexyz/services@2.0.0-next.5": - version "2.0.0-next.5" - resolved "https://registry.yarnpkg.com/@latticexyz/services/-/services-2.0.0-next.5.tgz#337faacd19717a107edab7a55caaf88db54964b9" - integrity sha512-zw9V+7BgsaItqq3fo1O4GiWq45rv7eSMjVUUOwb1nKzO/BakfR2tuEVMB4Gu82WH/Ixn+uC+jFdULU0sazG+ug== - dependencies: - long "^5.2.1" - nice-grpc-common "^2.0.2" - nice-grpc-web "^2.0.1" - protobufjs "^7.2.3" - -"@latticexyz/store-sync@2.0.0-next.14": - version "2.0.0-next.14" - resolved "https://registry.yarnpkg.com/@latticexyz/store-sync/-/store-sync-2.0.0-next.14.tgz#9813dc7897f23ed1df89d992b967c635835a2195" - integrity sha512-A83F6JU3zIQ8bduRKcTbOACkxMQaoN17MaSrlkbSoojht+3udHQhjbXUWJFuFb7Ks0ZuinSBKkTMsPjN2hkbbw== - dependencies: - "@latticexyz/block-logs-stream" "2.0.0-next.14" - "@latticexyz/common" "2.0.0-next.14" - "@latticexyz/protocol-parser" "2.0.0-next.14" - "@latticexyz/recs" "2.0.0-next.14" - "@latticexyz/schema-type" "2.0.0-next.14" - "@latticexyz/store" "2.0.0-next.14" - "@latticexyz/world" "2.0.0-next.14" +"@latticexyz/store-sync@2.0.0-next.15": + version "2.0.0-next.15" + resolved "https://registry.yarnpkg.com/@latticexyz/store-sync/-/store-sync-2.0.0-next.15.tgz#a4d88a5137eafedb201fb03082e3f2b42b02df56" + integrity sha512-E8OpSPCLCQ41kG58PPs5SDRhYQPUZrE/fzm7FObPYfV5YGMdNRMfp9QvvSjFRoBXDoC+gQiLsX1mgLTzkHTDZQ== + dependencies: + "@latticexyz/block-logs-stream" "2.0.0-next.15" + "@latticexyz/common" "2.0.0-next.15" + "@latticexyz/protocol-parser" "2.0.0-next.15" + "@latticexyz/recs" "2.0.0-next.15" + "@latticexyz/schema-type" "2.0.0-next.15" + "@latticexyz/store" "2.0.0-next.15" + "@latticexyz/world" "2.0.0-next.15" "@trpc/client" "10.34.0" "@trpc/server" "10.34.0" + change-case "^5.2.0" debug "^4.3.4" drizzle-orm "^0.28.5" kysely "^0.26.3" @@ -3638,33 +3513,18 @@ abitype "0.9.8" zod "^3.21.4" -"@latticexyz/store@2.0.0-next.14": - version "2.0.0-next.14" - resolved "https://registry.yarnpkg.com/@latticexyz/store/-/store-2.0.0-next.14.tgz#07b62b9207ff0deee1e924ba3667b50e1fbfcfd7" - integrity sha512-k3fBGLEZZMSwHqf2OCqTOgCB8jcQKIvEC0bTYj95uB6CYGDeQPH5jaeNo/Agw4+zshdt7n8W0C2SdDtGweJ5LQ== +"@latticexyz/store@2.0.0-next.15": + version "2.0.0-next.15" + resolved "https://registry.yarnpkg.com/@latticexyz/store/-/store-2.0.0-next.15.tgz#44e4044330dade07d85b5f5dd86cfc61cf8a6e4f" + integrity sha512-ZU5O8hT9BqXPEFgEkpBJgcJeqVumYEAILhc7SxayKtbsLsjVuxdflH67Snvx4U+EHUXiO8BflCVrbBT5b57Vmw== dependencies: - "@latticexyz/common" "2.0.0-next.14" - "@latticexyz/config" "2.0.0-next.14" - "@latticexyz/schema-type" "2.0.0-next.14" + "@latticexyz/common" "2.0.0-next.15" + "@latticexyz/config" "2.0.0-next.15" + "@latticexyz/schema-type" "2.0.0-next.15" abitype "0.9.8" viem "1.14.0" zod "^3.21.4" -"@latticexyz/store@2.0.0-next.5": - version "2.0.0-next.5" - resolved "https://registry.yarnpkg.com/@latticexyz/store/-/store-2.0.0-next.5.tgz#766935ead0975f08ca30ba0c1c795107a8a4eec9" - integrity sha512-JRBMf3FCXeBLwI6p/QMzfesafg3ozBFPfuN8nLiOrzVGIiHctd0ePHOuoydjq7cjDNlLnwbZJ6RtnOXdoB9Wcg== - dependencies: - "@ethersproject/abi" "^5.7.0" - "@ethersproject/providers" "^5.7.2" - "@latticexyz/common" "2.0.0-next.5" - "@latticexyz/config" "2.0.0-next.5" - "@latticexyz/gas-report" "2.0.0-next.5" - "@latticexyz/schema-type" "2.0.0-next.5" - abitype "0.9.3" - ethers "^5.7.2" - zod "^3.21.4" - "@latticexyz/utils@2.0.0-next.11": version "2.0.0-next.11" resolved "https://registry.yarnpkg.com/@latticexyz/utils/-/utils-2.0.0-next.11.tgz#d02725a3d7faa36b8367649a5aff6ac5716ba54e" @@ -3675,21 +3535,11 @@ proxy-deep "^3.1.1" rxjs "7.5.5" -"@latticexyz/utils@2.0.0-next.14": - version "2.0.0-next.14" - resolved "https://registry.yarnpkg.com/@latticexyz/utils/-/utils-2.0.0-next.14.tgz#07f8ec33190de3c120d09013d8fbb5fb8eb230a0" - integrity sha512-g9kJ6rcyV2qoX5uF573lPbBtWaqMS4yxxCFqDgJ3j0YxilR1ldxL2A+xbiB/ELch/3xpy/+Zfvcvq0UIU03Rcg== - dependencies: - mobx "^6.7.0" - proxy-deep "^3.1.1" - rxjs "7.5.5" - -"@latticexyz/utils@2.0.0-next.5": - version "2.0.0-next.5" - resolved "https://registry.yarnpkg.com/@latticexyz/utils/-/utils-2.0.0-next.5.tgz#1701c557982aa2ae51cfea6a38d4c9a68f1696a1" - integrity sha512-8w0KgeBRIMmBA4s4cACziV6hgxeOrEuMsxvR7jFYf3LUJCN/qbvtnQywAJd7ro0QfQh3AmLJDPe6SpvRprmwlg== +"@latticexyz/utils@2.0.0-next.15": + version "2.0.0-next.15" + resolved "https://registry.yarnpkg.com/@latticexyz/utils/-/utils-2.0.0-next.15.tgz#a4610c61a13f439c15a04171df5aa24942c54f5c" + integrity sha512-kal4N+VPnvxkkWdPrWKZeFwWDle7JAw9JQq54Ur6/VmH82tbvcrkeOgESIz3RFuzworFK2wyHuaxF9wq3aWxEw== dependencies: - ethers "^5.7.2" mobx "^6.7.0" proxy-deep "^3.1.1" rxjs "7.5.5" @@ -3730,34 +3580,19 @@ "@latticexyz/store" "2.0.0-next.11" zod "^3.21.4" -"@latticexyz/world@2.0.0-next.14": - version "2.0.0-next.14" - resolved "https://registry.yarnpkg.com/@latticexyz/world/-/world-2.0.0-next.14.tgz#c0303e64c146218096d4351e78261ef800d3e01f" - integrity sha512-X1V5PU/knk/4iMbN5i7jr+zmK6R4/ZfER/p6szQyVBIA8jgerxH9WQTWSOO7mVWPko8iYAGHmZRYtzpEtOzajg== +"@latticexyz/world@2.0.0-next.15": + version "2.0.0-next.15" + resolved "https://registry.yarnpkg.com/@latticexyz/world/-/world-2.0.0-next.15.tgz#cc69ae50dc666296eb9bfdce470e21f7f226a5d4" + integrity sha512-Ypydf7sCckEqWRzkKWQleNAIenj0e5Lz5GggTJ98B3t5rsdNmBAjTJedAZpFcs1VSvwXdVanZ3+Rk7KY11vEqA== dependencies: - "@latticexyz/common" "2.0.0-next.14" - "@latticexyz/config" "2.0.0-next.14" - "@latticexyz/schema-type" "2.0.0-next.14" - "@latticexyz/store" "2.0.0-next.14" + "@latticexyz/common" "2.0.0-next.15" + "@latticexyz/config" "2.0.0-next.15" + "@latticexyz/schema-type" "2.0.0-next.15" + "@latticexyz/store" "2.0.0-next.15" abitype "0.9.8" viem "1.14.0" zod "^3.21.4" -"@latticexyz/world@2.0.0-next.5": - version "2.0.0-next.5" - resolved "https://registry.yarnpkg.com/@latticexyz/world/-/world-2.0.0-next.5.tgz#85638e2c3c31fef74b0ffdbd36bc9929f759697e" - integrity sha512-sBFoVfONpOjuOMGFhEMz0dWEz6a6+VZB1ZG8JsdcAwwh9b/Tkw46BqcU6+LDl07DBy9jqg3cmLPW3OU1IJousA== - dependencies: - "@ethersproject/abi" "^5.7.0" - "@ethersproject/providers" "^5.7.2" - "@latticexyz/common" "2.0.0-next.5" - "@latticexyz/config" "2.0.0-next.5" - "@latticexyz/gas-report" "2.0.0-next.5" - "@latticexyz/schema-type" "2.0.0-next.5" - "@latticexyz/store" "2.0.0-next.5" - ethers "^5.7.2" - zod "^3.21.4" - "@ledgerhq/connect-kit-loader@^1.0.1": version "1.0.2" resolved "https://registry.yarnpkg.com/@ledgerhq/connect-kit-loader/-/connect-kit-loader-1.0.2.tgz#8554e16943f86cc2a5f6348a14dfe6e5bd0c572a" @@ -3984,13 +3819,6 @@ dependencies: eslint-scope "5.1.1" -"@noble/curves@1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.1.0.tgz#f13fc667c89184bc04cccb9b11e8e7bae27d8c3d" - integrity sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA== - dependencies: - "@noble/hashes" "1.3.1" - "@noble/curves@1.2.0", "@noble/curves@^1.2.0", "@noble/curves@~1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" @@ -3998,13 +3826,6 @@ dependencies: "@noble/hashes" "1.3.2" -"@noble/curves@~1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.0.0.tgz#e40be8c7daf088aaf291887cbc73f43464a92932" - integrity sha512-2upgEu0iLiDVDZkNLeFV2+ht0BAVgQnEmCk6JsOch9Rp8xfkMCbvbAZlA2pBHQc73dbl+vFOXfqkf4uemdn0bw== - dependencies: - "@noble/hashes" "1.3.0" - "@noble/ed25519@^1.7.0", "@noble/ed25519@^1.7.3": version "1.7.3" resolved "https://registry.yarnpkg.com/@noble/ed25519/-/ed25519-1.7.3.tgz#57e1677bf6885354b466c38e2b620c62f45a7123" @@ -4015,21 +3836,16 @@ resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.1.2.tgz#e9e035b9b166ca0af657a7848eb2718f0f22f183" integrity sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA== -"@noble/hashes@1.3.0", "@noble/hashes@^1.1.2": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.0.tgz#085fd70f6d7d9d109671090ccae1d3bec62554a1" - integrity sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg== - -"@noble/hashes@1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.1.tgz#8831ef002114670c603c458ab8b11328406953a9" - integrity sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA== - "@noble/hashes@1.3.2", "@noble/hashes@^1.3.1", "@noble/hashes@^1.3.2", "@noble/hashes@~1.3.0", "@noble/hashes@~1.3.2": version "1.3.2" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== +"@noble/hashes@^1.1.2": + version "1.3.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.0.tgz#085fd70f6d7d9d109671090ccae1d3bec62554a1" + integrity sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg== + "@noble/secp256k1@1.6.3", "@noble/secp256k1@~1.6.0": version "1.6.3" resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.6.3.tgz#7eed12d9f4404b416999d0c87686836c4c5c9b94" @@ -4397,15 +4213,6 @@ "@noble/secp256k1" "~1.6.0" "@scure/base" "~1.1.0" -"@scure/bip32@1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.0.tgz#6c8d980ef3f290987736acd0ee2e0f0d50068d87" - integrity sha512-bcKpo1oj54hGholplGLpqPHRbIsnbixFtc06nwuNM5/dwSXOq/AAYoIBRsBmnZJSdfeNW5rnff7NTAz3ZCqR9Q== - dependencies: - "@noble/curves" "~1.0.0" - "@noble/hashes" "~1.3.0" - "@scure/base" "~1.1.0" - "@scure/bip32@1.3.2": version "1.3.2" resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.2.tgz#90e78c027d5e30f0b22c1f8d50ff12f3fb7559f8" @@ -4423,14 +4230,6 @@ "@noble/hashes" "~1.1.1" "@scure/base" "~1.1.0" -"@scure/bip39@1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.2.0.tgz#a207e2ef96de354de7d0002292ba1503538fc77b" - integrity sha512-SX/uKq52cuxm4YFXWFaVByaSHJh2w3BnokVSeUJVCv6K7WulT9u2BuNRBhuFl8vAuYnzx9bEu9WgpcNYTrYieg== - dependencies: - "@noble/hashes" "~1.3.0" - "@scure/base" "~1.1.0" - "@scure/bip39@1.2.1", "@scure/bip39@^1.2.1": version "1.2.1" resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.2.1.tgz#5cee8978656b272a917b7871c981e0541ad6ac2a" @@ -6276,14 +6075,6 @@ "@turf/invariant" "^6.5.0" d3-voronoi "1.1.2" -"@typechain/ethers-v5@^10.2.0": - version "10.2.1" - resolved "https://registry.yarnpkg.com/@typechain/ethers-v5/-/ethers-v5-10.2.1.tgz#50241e6957683281ecfa03fb5a6724d8a3ce2391" - integrity sha512-n3tQmCZjRE6IU4h6lqUGiQ1j866n5MTCBJreNEHHVWXa2u9GJTaeYyU1/k+1qLutkyw+sS6VAN+AbeiTqsxd/A== - dependencies: - lodash "^4.17.15" - ts-essentials "^7.0.1" - "@types/abstract-leveldown@*": version "7.2.0" resolved "https://registry.yarnpkg.com/@types/abstract-leveldown/-/abstract-leveldown-7.2.0.tgz#f055979a99f7654e84d6b8e6267419e9c4cfff87" @@ -6526,11 +6317,6 @@ dependencies: "@types/node" "*" -"@types/prettier@^2.1.1": - version "2.7.3" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.3.tgz#3e51a17e291d01d17d3fc61422015a933af7a08f" - integrity sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA== - "@types/promise-retry@^1.1.3": version "1.1.3" resolved "https://registry.yarnpkg.com/@types/promise-retry/-/promise-retry-1.1.3.tgz#baab427419da9088a1d2f21bf56249c21b3dd43c" @@ -6622,7 +6408,7 @@ dependencies: "@types/node" "*" -"@types/ws@^8.5.4", "@types/ws@^8.5.5": +"@types/ws@^8.5.5": version "8.5.10" resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.10.tgz#4acfb517970853fa6574a3a6886791d04a396787" integrity sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A== @@ -6914,11 +6700,6 @@ resolved "https://registry.yarnpkg.com/@wagmi/chains/-/chains-0.2.22.tgz#25e511e134a00742e4fbf5108613dadf876c5bd9" integrity sha512-TdiOzJT6TO1JrztRNjTA5Quz+UmQlbvWFG8N41u9tta0boHA1JCAzGGvU6KuIcOmJfRJkKOUIt67wlbopCpVHg== -"@wagmi/chains@1.6.0": - version "1.6.0" - resolved "https://registry.yarnpkg.com/@wagmi/chains/-/chains-1.6.0.tgz#eb992ad28dbaaab729b5bcab3e5b461e8a035656" - integrity sha512-5FRlVxse5P4ZaHG3GTvxwVANSmYJas1eQrTBHhjxVtqXoorm0aLmCHbhmN8Xo1yu09PaWKlleEvfE98yH4AgIw== - "@wagmi/connectors@0.3.24": version "0.3.24" resolved "https://registry.yarnpkg.com/@wagmi/connectors/-/connectors-0.3.24.tgz#2c1d69fc0ae6b85b75a4d57547fc7e2d4bc117e8" @@ -7495,11 +7276,6 @@ abbrev@^2.0.0: resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-2.0.0.tgz#cf59829b8b4f03f89dda2771cb7f3653828c89bf" integrity sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ== -abitype@0.9.3: - version "0.9.3" - resolved "https://registry.yarnpkg.com/abitype/-/abitype-0.9.3.tgz#294d25288ee683d72baf4e1fed757034e3c8c277" - integrity sha512-dz4qCQLurx97FQhnb/EIYTk/ldQ+oafEDUqC0VVIeQS1Q48/YWt/9YNfMmp9SLFqN41ktxny3c8aYxHjmFIB/w== - abitype@0.9.8: version "0.9.8" resolved "https://registry.yarnpkg.com/abitype/-/abitype-0.9.8.tgz#1f120b6b717459deafd213dfbf3a3dd1bf10ae8c" @@ -7842,16 +7618,6 @@ arr-union@^3.1.0: resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" integrity sha512-sKpyeERZ02v1FeCZT8lrfJq5u6goHCtpTAzPwJYe7c8SPFOboNjNg1vz2L4VTn9T4PQxEx13TbXLmYUcS6Ug7Q== -array-back@^3.0.1, array-back@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/array-back/-/array-back-3.1.0.tgz#b8859d7a508871c9a7b2cf42f99428f65e96bfb0" - integrity sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q== - -array-back@^4.0.1, array-back@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/array-back/-/array-back-4.0.2.tgz#8004e999a6274586beeb27342168652fdb89fa1e" - integrity sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg== - array-buffer-byte-length@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz#fabe8bc193fea865f317fe7807085ee0dee5aead" @@ -9064,6 +8830,11 @@ change-case@3.0.2: upper-case "^1.1.1" upper-case-first "^1.1.0" +change-case@^5.2.0: + version "5.4.2" + resolved "https://registry.yarnpkg.com/change-case/-/change-case-5.4.2.tgz#0b3e4d9746fb16b83f3a8b68a9411bc4a8a61863" + integrity sha512-WB3UiTDpT+vrTilAWaJS4gaIH/jc1He4H9f6erQvraUYas90uWT0JOYFkG1imdNv710XJ6gJvqynrgOHc4ihDA== + checkpoint-store@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/checkpoint-store/-/checkpoint-store-1.1.0.tgz#04e4cb516b91433893581e6d4601a78e9552ea06" @@ -9316,26 +9087,6 @@ command-exists@^1.2.8: resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.9.tgz#c50725af3808c8ab0260fd60b01fbfa25b954f69" integrity sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w== -command-line-args@^5.1.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/command-line-args/-/command-line-args-5.2.1.tgz#c44c32e437a57d7c51157696893c5909e9cec42e" - integrity sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg== - dependencies: - array-back "^3.1.0" - find-replace "^3.0.0" - lodash.camelcase "^4.3.0" - typical "^4.0.0" - -command-line-usage@^6.1.0: - version "6.1.3" - resolved "https://registry.yarnpkg.com/command-line-usage/-/command-line-usage-6.1.3.tgz#428fa5acde6a838779dfa30e44686f4b6761d957" - integrity sha512-sH5ZSPr+7UStsloltmDh7Ce5fb8XPlHyoPzTpyyMuYCtervL65+ubVZ6Q61cFtFl62UyJlc8/JwERRbAFPUqgw== - dependencies: - array-back "^4.0.2" - chalk "^2.4.2" - table-layout "^1.0.2" - typical "^5.2.0" - commander@2, commander@^2.20.3: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" @@ -9842,11 +9593,6 @@ deep-equal@1.x, deep-equal@^1.0.0: object-keys "^1.1.1" regexp.prototype.flags "^1.2.0" -deep-extend@~0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" - integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== - deep-is@^0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" @@ -11708,13 +11454,6 @@ finalhandler@1.2.0: statuses "2.0.1" unpipe "~1.0.0" -find-replace@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/find-replace/-/find-replace-3.0.0.tgz#3e7e23d3b05167a76f770c9fbd5258b0def68c38" - integrity sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ== - dependencies: - array-back "^3.0.1" - find-up@5.0.0, find-up@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" @@ -11917,7 +11656,7 @@ fs-extra@^4.0.2: jsonfile "^4.0.0" universalify "^0.1.0" -fs-extra@^7.0.0, fs-extra@^7.0.1: +fs-extra@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== @@ -12164,18 +11903,6 @@ glob-parent@^5.1.2, glob-parent@~5.1.2: dependencies: is-glob "^4.0.1" -glob@7.1.7: - version "7.1.7" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" - integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - glob@7.2.0: version "7.2.0" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" @@ -14146,7 +13873,7 @@ lodash.truncate@^4.4.2: resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" integrity sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw== -lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.20, lodash@^4.17.21: +lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.20, lodash@^4.17.21: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -14688,7 +14415,7 @@ mkdirp-promise@^5.0.1: dependencies: mkdirp "*" -mkdirp@*, mkdirp@^1.0.3, mkdirp@^1.0.4: +mkdirp@*, mkdirp@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== @@ -15370,14 +15097,9 @@ once@^1.3.0, once@^1.3.1, once@^1.4.0: dependencies: wrappy "1" -one-webcrypto@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/one-webcrypto/-/one-webcrypto-1.0.3.tgz#f951243cde29b79b6745ad14966fc598a609997c" - integrity sha512-fu9ywBVBPx0gS9K0etIROTiCkvI5S1TDjFsYFb3rC1ewFxeOqsbzq7aIMBHsYfrTHBcGXJaONXXjTl8B01cW1Q== - -"one-webcrypto@git+https://github.com/web3-storage/one-webcrypto.git": +one-webcrypto@^1.0.3, "one-webcrypto@https://github.com/web3-storage/one-webcrypto": version "1.0.3" - resolved "git+https://github.com/web3-storage/one-webcrypto.git#5148cd14d5489a8ac4cd38223870e02db15a2382" + resolved "https://github.com/web3-storage/one-webcrypto#5148cd14d5489a8ac4cd38223870e02db15a2382" onetime@^6.0.0: version "6.0.0" @@ -15974,11 +15696,6 @@ prettier-plugin-solidity@^1.1.2: semver "^7.5.4" solidity-comments-extractor "^0.0.7" -prettier@^2.3.1: - version "2.8.8" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" - integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== - prettier@^2.8.4: version "2.8.4" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.4.tgz#34dd2595629bfbb79d344ac4a91ff948694463c3" @@ -16626,11 +16343,6 @@ redent@^3.0.0: indent-string "^4.0.0" strip-indent "^3.0.0" -reduce-flatten@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/reduce-flatten/-/reduce-flatten-2.0.0.tgz#734fd84e65f375d7ca4465c69798c25c9d10ae27" - integrity sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w== - redux-thunk@^2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/redux-thunk/-/redux-thunk-2.4.1.tgz#0dd8042cf47868f4b29699941de03c9301a75714" @@ -17744,11 +17456,6 @@ strict-uri-encode@^2.0.0: resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546" integrity sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ== -string-format@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/string-format/-/string-format-2.0.0.tgz#f2df2e7097440d3b65de31b6d40d54c96eaffb9b" - integrity sha512-bbEs3scLeYNXLecRRuk6uJxdXUSj6le/8rNPHChIJTn2V79aXVTR1EH2OH5zLKKoz0V02fOUKZZcw01pLUShZA== - string-natural-compare@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4" @@ -18096,16 +17803,6 @@ syntax-error@^1.1.1: dependencies: acorn-node "^1.2.0" -table-layout@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/table-layout/-/table-layout-1.0.2.tgz#c4038a1853b0136d63365a734b6931cf4fad4a04" - integrity sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A== - dependencies: - array-back "^4.0.1" - deep-extend "~0.6.0" - typical "^5.2.0" - wordwrapjs "^4.0.0" - table@^6.0.9: version "6.8.0" resolved "https://registry.yarnpkg.com/table/-/table-6.8.0.tgz#87e28f14fa4321c3377ba286f07b79b281a3b3ca" @@ -18326,26 +18023,11 @@ trim-newlines@^3.0.0: resolved "https://registry.yarnpkg.com/true-case-path/-/true-case-path-2.2.1.tgz#c5bf04a5bbec3fd118be4084461b3a27c4d796bf" integrity sha512-0z3j8R7MCjy10kc/g+qg7Ln3alJTodw9aDuVWZa3uiWqfuBMKeAeP2ocWcxoyM3D73yz3Jt/Pu4qPr4wHSdB/Q== -ts-command-line-args@^2.2.0: - version "2.5.1" - resolved "https://registry.yarnpkg.com/ts-command-line-args/-/ts-command-line-args-2.5.1.tgz#e64456b580d1d4f6d948824c274cf6fa5f45f7f0" - integrity sha512-H69ZwTw3rFHb5WYpQya40YAX2/w7Ut75uUECbgBIsLmM+BNuYnxsltfyyLMxy6sEeKxgijLTnQtLd0nKd6+IYw== - dependencies: - chalk "^4.1.0" - command-line-args "^5.1.1" - command-line-usage "^6.1.0" - string-format "^2.0.0" - ts-error@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/ts-error/-/ts-error-1.0.6.tgz#277496f2a28de6c184cfce8dfd5cdd03a4e6b0fc" integrity sha512-tLJxacIQUM82IR7JO1UUkKlYuUTmoY9HBJAmNWFzheSlDS5SPMcNIepejHJa4BpPQLAcbRhRf3GDJzyj6rbKvA== -ts-essentials@^7.0.1: - version "7.0.3" - resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-7.0.3.tgz#686fd155a02133eedcc5362dc8b5056cde3e5a38" - integrity sha512-8+gr5+lqO3G84KdiTSMRLtuyJ+nTBVRKuCrK4lidMPdVeEp0uqC875uE5NMcaA7YYMN7XsNiFQuMvasF8HT/xQ== - ts-invariant@^0.10.3: version "0.10.3" resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.10.3.tgz#3e048ff96e91459ffca01304dbc7f61c1f642f6c" @@ -18529,22 +18211,6 @@ type@^2.5.0: resolved "https://registry.yarnpkg.com/type/-/type-2.7.2.tgz#2376a15a3a28b1efa0f5350dcf72d24df6ef98d0" integrity sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw== -typechain@^8.1.1: - version "8.3.2" - resolved "https://registry.yarnpkg.com/typechain/-/typechain-8.3.2.tgz#1090dd8d9c57b6ef2aed3640a516bdbf01b00d73" - integrity sha512-x/sQYr5w9K7yv3es7jo4KTX05CLxOf7TRWwoHlrjRh8H82G64g+k7VuWPJlgMo6qrjfCulOdfBjiaDtmhFYD/Q== - dependencies: - "@types/prettier" "^2.1.1" - debug "^4.3.1" - fs-extra "^7.0.0" - glob "7.1.7" - js-sha3 "^0.8.0" - lodash "^4.17.15" - mkdirp "^1.0.4" - prettier "^2.3.1" - ts-command-line-args "^2.2.0" - ts-essentials "^7.0.1" - typed-array-buffer@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz#18de3e7ed7974b0a729d3feecb94338d1472cd60" @@ -18616,16 +18282,6 @@ typescript@^5.1.3: resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.2.tgz#00d1c7c1c46928c5845c1ee8d0cc2791031d4c43" integrity sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ== -typical@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/typical/-/typical-4.0.0.tgz#cbeaff3b9d7ae1e2bbfaf5a4e6f11eccfde94fc4" - integrity sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw== - -typical@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/typical/-/typical-5.2.0.tgz#4daaac4f2b5315460804f0acf6cb69c52bb93066" - integrity sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg== - uint8arrays@^2.0.5, uint8arrays@^2.1.4: version "2.1.10" resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-2.1.10.tgz#34d023c843a327c676e48576295ca373c56e286a" @@ -19024,22 +18680,6 @@ viem@1.14.0: isomorphic-ws "5.0.0" ws "8.13.0" -viem@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/viem/-/viem-1.6.0.tgz#8befa678c3ac79b9558dfd1708130b2ecb1994f4" - integrity sha512-ae9Twkd0q2Qlj4yYpWjb4DzYAhKY0ibEpRH8FJaTywZXNpTjFidSdBaT0CVn1BaH7O7cnX4/O47zvDUMGJD1AA== - dependencies: - "@adraffy/ens-normalize" "1.9.0" - "@noble/curves" "1.1.0" - "@noble/hashes" "1.3.0" - "@scure/bip32" "1.3.0" - "@scure/bip39" "1.2.0" - "@types/ws" "^8.5.4" - "@wagmi/chains" "1.6.0" - abitype "0.9.3" - isomorphic-ws "5.0.0" - ws "8.12.0" - viem@^1.19.9: version "1.19.9" resolved "https://registry.yarnpkg.com/viem/-/viem-1.19.9.tgz#a11f3ad4a3323994ebd2010dbc659d1a2b12e583" @@ -20025,14 +19665,6 @@ word-wrap@^1.2.3: resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== -wordwrapjs@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/wordwrapjs/-/wordwrapjs-4.0.1.tgz#d9790bccfb110a0fc7836b5ebce0937b37a8b98f" - integrity sha512-kKlNACbvHrkpIw6oPeYDSmdCTu2hdMHoyXLTcUKala++lx5Y+wjJ/e474Jqv5abnVmwxw08DiTuHmw69lJGksA== - dependencies: - reduce-flatten "^2.0.0" - typical "^5.2.0" - workerpool@6.2.1: version "6.2.1" resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343" @@ -20083,11 +19715,6 @@ ws@7.4.6: resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== -ws@8.12.0: - version "8.12.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.12.0.tgz#485074cc392689da78e1828a9ff23585e06cddd8" - integrity sha512-kU62emKIdKVeEIOIKVegvqpXMSTAMLJozpHZaJNDYqBjzlSYXQGviYwN1osDLJ9av68qHd4a2oSjd7yD4pacig== - ws@8.13.0, ws@^8.5.0: version "8.13.0" resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" From 07f7f578f05536d4e296dbb7e846345b05eaec15 Mon Sep 17 00:00:00 2001 From: codynhat Date: Tue, 16 Jan 2024 11:58:03 -0800 Subject: [PATCH 05/12] feat: add markers for augments --- dec.d.ts | 3 +- package.json | 7 ++- public/markerRed.svg | 5 ++ src/components/Map.tsx | 19 ++++++ src/components/cards/ParcelInfo.tsx | 50 ++------------- src/pages/IndexPage.tsx | 97 ++++++++++++++++++++--------- yarn.lock | 10 +++ 7 files changed, 115 insertions(+), 76 deletions(-) create mode 100644 public/markerRed.svg diff --git a/dec.d.ts b/dec.d.ts index 84bef35f..223b7836 100644 --- a/dec.d.ts +++ b/dec.d.ts @@ -2,4 +2,5 @@ declare module "react-map-gl-geocoder"; declare module "as-geo-web-coordinate"; declare module "lodash.merge"; declare module "@transak/transak-sdk"; -declare module '@geo-web/mud-world-base-setup' +declare module "@geo-web/mud-world-base-setup"; +declare module "latlon-geohash"; diff --git a/package.json b/package.json index 5189956b..b411277f 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "firebase": "^8.7.1", "graphql": "^15.4.0", "key-did-resolver": "^1.4.0", + "latlon-geohash": "^2.0.0", "local-ssl-proxy": "^2.0.5", "mapbox-gl": "^2.14.1", "multiformats": "^11.0.2", @@ -61,7 +62,11 @@ "node": ">=18.0.0" }, "browserslist": { - "production": [">0.2%", "not dead", "not op_mini all"], + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], "development": [ "last 1 chrome version", "last 1 firefox version", diff --git a/public/markerRed.svg b/public/markerRed.svg new file mode 100644 index 00000000..267a0602 --- /dev/null +++ b/public/markerRed.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/components/Map.tsx b/src/components/Map.tsx index 1007f835..30802ec3 100644 --- a/src/components/Map.tsx +++ b/src/components/Map.tsx @@ -5,6 +5,7 @@ import { useEffect, useRef, useState } from "react"; import Col from "react-bootstrap/Col"; import ReactMapGL, { AttributionControl, + Marker, NavigationControl, } from "react-map-gl"; import type { ViewState, MapRef } from "react-map-gl"; @@ -48,6 +49,8 @@ import { SmartAccount } from "../pages/IndexPage"; import ParcelList from "./parcels/ParcelList"; import { useMediaQuery } from "../lib/mediaQuery"; import { useParcelNavigation } from "../lib/parcelNavigation"; +import { useWorld } from "../lib/geo-web-content/world"; +import Geohash from "latlon-geohash"; export const GW_CELL_SIZE_LAT = 23; export const GW_CELL_SIZE_LON = 24; @@ -226,6 +229,8 @@ function Map(props: MapProps) { MapStyleName.satellite ); + const { mediaObjects } = useWorld(); + const handleMapstyle = (newStyle: MapStyleName) => { localStorage.setItem(MAP_STYLE_KEY, newStyle); setMapStyleName(newStyle); @@ -1120,6 +1125,20 @@ function Map(props: MapProps) { ) : null} + {mediaObjects.map((mediaObject, i) => { + const coords = Geohash.decode(mediaObject.position.geohash); + return ( + + + + ); + })} + ( null ); - const [worldConfig, setWorldConfig] = - React.useState(); - const { basicProfile, setShouldBasicProfileUpdate } = useBasicProfile( registryContract, selectedParcelId @@ -206,36 +196,6 @@ function ParcelInfo(props: ParcelInfoProps) { navigator.clipboard.writeText(parcelLink.href); } - React.useEffect(() => { - (async () => { - if (accountAddress !== licenseOwner) { - return; - } - - const chain = - import.meta.env.MODE === "mainnet" ? optimism : optimismGoerli; - const mudChain = { - ...chain, - rpcUrls: { - ...chain.rpcUrls, - default: { - http: [RPC_URLS_HTTP[NETWORK_ID]], - webSocket: [RPC_URLS_WS[NETWORK_ID]], - }, - }, - }; - const worldConfig = await syncWorld({ - mudChain, - chainId: NETWORK_ID, - world: WORLD, - namespaces: [Number(selectedParcelId).toString()], - indexerUrl: "https://mud-testnet.geoweb.network/trpc", - }); - - setWorldConfig(worldConfig); - })(); - }, [accountAddress, licenseOwner]); - React.useEffect(() => { const loadLicenseDiamond = async () => { if (!licenseDiamondAddress) { @@ -776,17 +736,15 @@ function ParcelInfo(props: ParcelInfoProps) { ) : null} - {interactionState === STATE.PUBLISHING && worldConfig && ( - - - + > )} ); diff --git a/src/pages/IndexPage.tsx b/src/pages/IndexPage.tsx index 7fa7c572..a75cdfb1 100644 --- a/src/pages/IndexPage.tsx +++ b/src/pages/IndexPage.tsx @@ -10,7 +10,13 @@ import Row from "react-bootstrap/Row"; import Col from "react-bootstrap/Col"; import Image from "react-bootstrap/Image"; import Navbar from "react-bootstrap/Navbar"; -import { RPC_URLS_HTTP, NETWORK_ID, SSX_HOST } from "../lib/constants"; +import { + RPC_URLS_HTTP, + RPC_URLS_WS, + NETWORK_ID, + SSX_HOST, + WORLD, +} from "../lib/constants"; import Safe from "@safe-global/protocol-kit"; import { getContractsForChainOrThrow } from "@geo-web/sdk"; import { ethers, BigNumber } from "ethers"; @@ -41,6 +47,9 @@ import axios from "axios"; import type { AuthenticationStatus } from "@rainbow-me/rainbowkit"; import * as u8a from "uint8arrays"; import { useMediaQuery } from "../lib/mediaQuery"; +import { syncWorld, SyncWorldResult } from "@geo-web/mud-world-base-setup"; +import { optimism, optimismGoerli } from "viem/chains"; +import { MUDProvider } from "../lib/MUDContext"; async function createW3UpClient(didSession: DIDSession) { const store = new StoreIndexedDB("w3up-client"); @@ -125,6 +134,9 @@ function IndexPage({ const [w3Client, setW3Client] = React.useState(null); const [isFullScreen, setIsFullScreen] = React.useState(false); + const [worldConfig, setWorldConfig] = + React.useState(); + const { chain } = useNetwork(); const { address } = useAccount(); const { data: signer } = useSigner(); @@ -322,6 +334,32 @@ function IndexPage({ } }, [params]); + React.useEffect(() => { + (async () => { + const chain = + import.meta.env.MODE === "mainnet" ? optimism : optimismGoerli; + const mudChain = { + ...chain, + rpcUrls: { + ...chain.rpcUrls, + default: { + http: [RPC_URLS_HTTP[NETWORK_ID]], + webSocket: [RPC_URLS_WS[NETWORK_ID]], + }, + }, + }; + const worldConfig = await syncWorld({ + mudChain, + chainId: NETWORK_ID, + world: WORLD, + namespaces: [Number(selectedParcelId).toString()], + indexerUrl: "https://mud-testnet.geoweb.network/trpc", + }); + + setWorldConfig(worldConfig); + })(); + }, [selectedParcelId]); + return ( <> {(!isMobile && !isTablet) || !isFullScreen ? ( @@ -418,34 +456,37 @@ function IndexPage({ library && geoWebCoordinate && firebasePerf && - sfFramework ? ( + sfFramework && + worldConfig ? ( - + + + ) : ( diff --git a/yarn.lock b/yarn.lock index 9018a7f1..b14499b1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11754,6 +11754,11 @@ gensync@^1.0.0-beta.2: resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== +geohash@^0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/geohash/-/geohash-0.0.1.tgz#2210a4d5d60fec58b38cdeb59657b24c1cc81924" + integrity sha512-aQXMw2KthhNoegMx7KUxSr8CWkoa+Q5JkKfipjByQm7H1f90XEMSwisrHxjFRV9vHScwBXR3IFTSdNk5b/+2eA== + geojson-equality@0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/geojson-equality/-/geojson-equality-0.1.6.tgz#a171374ef043e5d4797995840bae4648e0752d72" @@ -13604,6 +13609,11 @@ language-tags@^1.0.9: dependencies: language-subtag-registry "^0.3.20" +latlon-geohash@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/latlon-geohash/-/latlon-geohash-2.0.0.tgz#2b0203ab30ef56a18600b0312b8c3a627cbd17d1" + integrity sha512-OKBswTwrvTdtenV+9C9euBmvgGuqyjJNAzpQCarRz1m8/pYD2nz9fKkXmLs2S3jeXaLi3Ry76twQplKKUlgS/g== + lcid@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" From 480500b56a8d0f6b4eacd951cee991c71f8098d3 Mon Sep 17 00:00:00 2001 From: codynhat Date: Wed, 17 Jan 2024 17:34:37 -0800 Subject: [PATCH 06/12] feat: add drop marker for publishing --- public/markerAdd.svg | 3 ++ public/markerGray.svg | 5 +++ src/components/Map.tsx | 31 +++++++++++++- src/components/cards/ParcelInfo.tsx | 19 ++++----- src/components/publisher/AugmentPublisher.tsx | 21 +++++++--- src/components/publisher/PublishingForm.tsx | 42 +++++++++++++++---- 6 files changed, 94 insertions(+), 27 deletions(-) create mode 100644 public/markerAdd.svg create mode 100644 public/markerGray.svg diff --git a/public/markerAdd.svg b/public/markerAdd.svg new file mode 100644 index 00000000..3de066b8 --- /dev/null +++ b/public/markerAdd.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/markerGray.svg b/public/markerGray.svg new file mode 100644 index 00000000..681ba003 --- /dev/null +++ b/public/markerGray.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/components/Map.tsx b/src/components/Map.tsx index 30802ec3..c1444b7c 100644 --- a/src/components/Map.tsx +++ b/src/components/Map.tsx @@ -69,6 +69,7 @@ export enum STATE { PARCEL_ACCEPTING_BID, EDITING_METADATA, PUBLISHING, + PUBLISHING_NEW_MARKER, PARCEL_REJECTING_BID, PARCEL_RECLAIMING, } @@ -304,6 +305,7 @@ function Map(props: MapProps) { }>({ id: "", timerId: null }); const [showParcelList, setShowParcelList] = React.useState(false); const [showSearchBar, setShowSearchBar] = useState(false); + const [lastClickPoint, setLastClickPoint] = useState(null); const { isMobile, isTablet } = useMediaQuery(); const { parcelIdToCoords, flyToParcel } = useParcelNavigation(); @@ -463,7 +465,11 @@ function Map(props: MapProps) { } function _onMove(nextViewport: ViewState) { - if (interactionState === STATE.PUBLISHING || mapRef.current == null) { + if ( + interactionState === STATE.PUBLISHING || + interactionState === STATE.PUBLISHING_NEW_MARKER || + mapRef.current == null + ) { return; } setViewport(nextViewport); @@ -569,6 +575,8 @@ function Map(props: MapProps) { return; } + setLastClickPoint(event.lngLat); + const parcelFeature = event.features?.find( (f) => f.layer.id === "parcels-layer" ); @@ -948,6 +956,9 @@ function Map(props: MapProps) { "claim-point-layer", ]); break; + case STATE.PUBLISHING_NEW_MARKER: + setLastClickPoint(null); + break; default: if (isGridVisible) { setInteractiveLayerIds(["parcels-layer", "grid-layer"]); @@ -1134,11 +1145,27 @@ function Map(props: MapProps) { latitude={coords.lat} anchor="bottom" > - + {interactionState === STATE.PUBLISHING_NEW_MARKER ? ( + + ) : ( + + )} ); })} + {interactionState === STATE.PUBLISHING_NEW_MARKER && + lastClickPoint && ( + + + + )} +
- + {invalidLicenseId === selectedParcelId ? null @@ -736,15 +739,9 @@ function ParcelInfo(props: ParcelInfoProps) { ) : null} - {interactionState === STATE.PUBLISHING && ( - + {(interactionState === STATE.PUBLISHING || + interactionState === STATE.PUBLISHING_NEW_MARKER) && ( + )} ); diff --git a/src/components/publisher/AugmentPublisher.tsx b/src/components/publisher/AugmentPublisher.tsx index 64f9b12c..1d9fa83e 100644 --- a/src/components/publisher/AugmentPublisher.tsx +++ b/src/components/publisher/AugmentPublisher.tsx @@ -6,6 +6,8 @@ import Table from "react-bootstrap/Table"; import PublishingForm from "./PublishingForm"; import Row from "react-bootstrap/Row"; import { MediaObjectType, useWorld } from "../../lib/geo-web-content/world"; +import { ParcelInfoProps } from "../cards/ParcelInfo"; +import { STATE } from "../Map"; export enum AugmentType { MODEL = "3D Model", @@ -14,8 +16,8 @@ export enum AugmentType { VIDEO = "Video", } -export default function AugmentPublisher() { - const [showForm, setShowForm] = useState(false); +export default function AugmentPublisher(props: ParcelInfoProps) { + const { interactionState, setInteractionState } = props; const [augmentType, setAugmentType] = useState( AugmentType.MODEL ); @@ -24,14 +26,21 @@ export default function AugmentPublisher() { return ( <> - {!showForm && ( + {interactionState === STATE.PUBLISHING && ( <>

Augment Publisher

Add augments to your parcel.

)} - {showForm ? ( - + {interactionState === STATE.PUBLISHING_NEW_MARKER ? ( + { + setInteractionState( + showForm ? STATE.PUBLISHING_NEW_MARKER : STATE.PUBLISHING + ); + }} + /> ) : ( <>
@@ -70,7 +79,7 @@ export default function AugmentPublisher() {
); + useEffect(() => { + map?.on(`click`, (ev) => { + setAugmentArgs({ + ...augmentArgs, + coords: { + lat: ev.lngLat.lat, + lon: ev.lngLat.lng, + }, + }); + }); + }, [map]); + return ( <> {title} @@ -75,6 +90,14 @@ export default function PublishingForm(props: PublishingFormProps) { positioning. For best results, place your anchor within direct view of a publicly accessible road (i.e. front yards). + + +
Position your augment by clicking on the map
+
e.preventDefault()}> @@ -121,7 +144,8 @@ export default function PublishingForm(props: PublishingFormProps) { - + {didFail && !isActing ? ( + setDidFail(false)} + /> + ) : null}
diff --git a/src/components/publisher/actions/ApproveAugmentButton.tsx b/src/components/publisher/actions/ApproveAugmentButton.tsx new file mode 100644 index 00000000..bc80a829 --- /dev/null +++ b/src/components/publisher/actions/ApproveAugmentButton.tsx @@ -0,0 +1,217 @@ +import * as React from "react"; +import Button from "react-bootstrap/Button"; +import Spinner from "react-bootstrap/Spinner"; +import Image from "react-bootstrap/Image"; +import { OffCanvasPanelProps } from "../../OffCanvasPanel"; +import { useMUD } from "../../../lib/MUDContext"; +import { concatHex, stringToHex } from "viem"; +import { resourceTypeIds } from "@latticexyz/common"; +import { AugmentType } from "../AugmentPublisher"; +import { getAugmentAddress } from "../AugmentPublisher"; + +export type ApproveAugmentButtonProps = OffCanvasPanelProps & { + isDisabled: boolean; + setErrorMessage: (v: string) => void; + isActing: boolean; + setIsActing: (v: boolean) => void; + setDidFail: (v: boolean) => void; + isAllowed: boolean; + setIsAllowed: React.Dispatch>; + augmentType: AugmentType; +}; + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +const asyncEvery = async (arr: any, predicate: any) => { + for (const e of arr) { + if (!(await predicate(e))) return false; + } + return true; +}; + +export function ApproveAugmentButton(props: ApproveAugmentButtonProps) { + const { + isDisabled, + worldContract, + account, + signer, + setErrorMessage, + isActing, + setIsActing, + setDidFail, + isAllowed, + setIsAllowed, + selectedParcelId, + augmentType, + } = props; + + const [approvals, setApprovals] = React.useState<(() => Promise)[]>( + [] + ); + const [approvalStr, setApprovalStr] = React.useState(""); + const [completedActions, setCompletedActions] = React.useState(0); + const [totalActions, setTotalActions] = React.useState(0); + + const { tables, useStore } = useMUD(); + + const namespaceId = React.useMemo(() => { + const typeId = resourceTypeIds.namespace; + return concatHex([ + stringToHex(typeId, { size: 2 }), + stringToHex(Number(selectedParcelId).toString(), { size: 14 }), + stringToHex("", { size: 16 }), + ]); + }, [selectedParcelId]); + + const namespaceOwner = useStore((state: any) => + state.getRecord(tables.NamespaceOwner, { namespaceId }) + ); + + const namespaceAccess = useStore((state: any) => + state.getRecord(tables.ResourceAccess, { + resourceId: namespaceId, + caller: getAugmentAddress(augmentType), + }) + ); + + const spinner = ( + + Sending Transaction... + + ); + + const claimNamespace = React.useCallback(async () => { + if (!signer) { + return false; + } + + try { + const txn = await worldContract + .connect(signer) + .claimParcelNamespace(Number(selectedParcelId)); + await txn.wait(); + } catch (err) { + console.error(err); + setErrorMessage( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (err as any).reason + ? // eslint-disable-next-line @typescript-eslint/no-explicit-any + (err as any).reason.replace("execution reverted: ", "") + : (err as Error).message + ); + setIsActing(false); + setDidFail(true); + return false; + } + + return true; + }, [worldContract, selectedParcelId]); + + const approveAugment = React.useCallback(async () => { + if (!signer) { + return false; + } + + try { + const txn = await worldContract + .connect(signer) + .functions.grantAccess(namespaceId, getAugmentAddress(augmentType)); + await txn.wait(); + } catch (err) { + console.error(err); + setErrorMessage( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (err as any).reason + ? // eslint-disable-next-line @typescript-eslint/no-explicit-any + (err as any).reason.replace("execution reverted: ", "") + : (err as Error).message + ); + setIsActing(false); + setDidFail(true); + return false; + } + + return true; + }, [worldContract, selectedParcelId]); + + React.useEffect(() => { + const checkRequirements = async () => { + const _approvals: (() => Promise)[] = []; + let _approvalStr = ``; + + // Check namespace claim + if ( + namespaceOwner?.value?.owner.toLowerCase() !== account.toLowerCase() + ) { + _approvals.push(claimNamespace); + _approvalStr = "Claim Permission"; + } + + // Check augment permissions + if (!namespaceAccess || namespaceAccess?.value?.access === false) { + _approvalStr = + _approvals.length > 0 + ? `${_approvalStr} & Approve Augment` + : "Approve Augment"; + _approvals.push(approveAugment); + } + + if (_approvals.length === 0) { + setIsAllowed(true); + } else { + setIsAllowed(false); + } + + setApprovals(_approvals); + setApprovalStr(_approvalStr); + }; + + checkRequirements(); + }, [account, signer, completedActions, namespaceOwner]); + + const submit = React.useCallback(async () => { + if (approvals.length > 0) { + setTotalActions(approvals.length); + setCompletedActions(0); + let _completedActions = 0; + const isSubmissionSuccessful = await asyncEvery( + approvals, + async (f: () => Promise) => { + const success = await f(); + setCompletedActions(++_completedActions); + return success; + } + ); + + if (!isSubmissionSuccessful) { + setCompletedActions(0); + setTotalActions(0); + } + } + }, [approvals, completedActions]); + + return ( + + ); +} + +export default ApproveAugmentButton; diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 46a2ffcb..980a8fbc 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -9,18 +9,17 @@ export const WORLD = { blockNumber: import.meta.env.VITE_WORLD_BLOCK_NUMBER, }; export const RPC_URLS_HTTP: Record = { - 10: `https://optimism-mainnet.infura.io/v3/${import.meta.env - .VITE_INFURA_PROJECT_ID!}`, - 420: `https://optimism-goerli.infura.io/v3/${import.meta.env - .VITE_INFURA_PROJECT_ID!}`, + 10: `https://opt-mainnet.g.alchemy.com/v2/${import.meta.env + .VITE_ALCHEMY_MAINNET_API_KEY!}`, + 420: `https://opt-goerli.g.alchemy.com/v2/${import.meta.env + .VITE_ALCHEMY_TESTNET_API_KEY!}`, }; export const RPC_URLS_WS: Record = { - 10: `https://opt-goerli.g.alchemy.com/v2/${import.meta.env - .VITE_ALCHEMY_API_KEY!}`, - 420: `https://opt-goerli.g.alchemy.com/v2/${import.meta.env - .VITE_ALCHEMY_API_KEY!}`, + 10: `wss://opt-goerli.g.alchemy.com/v2/${import.meta.env + .VITE_ALCHEMY_MAINNET_API_KEY!}`, + 420: `wss://opt-goerli.g.alchemy.com/v2/${import.meta.env + .VITE_ALCHEMY_TESTNET_API_KEY!}`, }; -export const WS_RPC_URL = import.meta.env.VITE_WS_RPC_URL!; export const SPATIAL_DOMAIN = import.meta.env.VITE_SPATIAL_DOMAIN!; export const SSX_HOST = import.meta.env.VITE_SSX_HOST!; export const REFERRAL_HOST = import.meta.env.VITE_REFERRAL_HOST!; diff --git a/src/pages/IndexPage.tsx b/src/pages/IndexPage.tsx index a75cdfb1..f4d4af2f 100644 --- a/src/pages/IndexPage.tsx +++ b/src/pages/IndexPage.tsx @@ -50,6 +50,7 @@ import { useMediaQuery } from "../lib/mediaQuery"; import { syncWorld, SyncWorldResult } from "@geo-web/mud-world-base-setup"; import { optimism, optimismGoerli } from "viem/chains"; import { MUDProvider } from "../lib/MUDContext"; +import { IWorld, IWorld__factory } from "@geo-web/mud-world-base-contracts"; async function createW3UpClient(didSession: DIDSession) { const store = new StoreIndexedDB("w3up-client"); @@ -136,6 +137,9 @@ function IndexPage({ const [worldConfig, setWorldConfig] = React.useState(); + const [worldContract, setWorldContract] = React.useState( + undefined + ); const { chain } = useNetwork(); const { address } = useAccount(); @@ -357,8 +361,16 @@ function IndexPage({ }); setWorldConfig(worldConfig); + + if (signer?.provider) { + setWorldContract( + IWorld__factory.connect(WORLD.worldAddress, signer.provider) + ); + } else { + setWorldContract(undefined); + } })(); - }, [selectedParcelId]); + }, [selectedParcelId, signer]); return ( <> @@ -457,7 +469,8 @@ function IndexPage({ geoWebCoordinate && firebasePerf && sfFramework && - worldConfig ? ( + worldConfig && + worldContract ? ( diff --git a/yarn.lock b/yarn.lock index b14499b1..4fc88f53 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11754,11 +11754,6 @@ gensync@^1.0.0-beta.2: resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== -geohash@^0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/geohash/-/geohash-0.0.1.tgz#2210a4d5d60fec58b38cdeb59657b24c1cc81924" - integrity sha512-aQXMw2KthhNoegMx7KUxSr8CWkoa+Q5JkKfipjByQm7H1f90XEMSwisrHxjFRV9vHScwBXR3IFTSdNk5b/+2eA== - geojson-equality@0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/geojson-equality/-/geojson-equality-0.1.6.tgz#a171374ef043e5d4797995840bae4648e0752d72" From 75b1f7c27e6b547d6280deab46c5e29e9e39ffc2 Mon Sep 17 00:00:00 2001 From: codynhat Date: Wed, 24 Jan 2024 09:07:36 -0800 Subject: [PATCH 10/12] feat: move to OP Sepolia --- .env.mainnet | 1 - .env.testnet | 11 ++++++----- package.json | 2 +- src/App.tsx | 13 ++++++++++++- src/lib/constants.ts | 9 ++++++--- src/pages/IndexPage.tsx | 12 +++++++++--- src/redux/store.ts | 3 +++ yarn.lock | 8 ++++---- 8 files changed, 41 insertions(+), 18 deletions(-) diff --git a/.env.mainnet b/.env.mainnet index 28be8063..284813fb 100644 --- a/.env.mainnet +++ b/.env.mainnet @@ -1,5 +1,4 @@ VITE_NETWORK_ID = 10 -VITE_SUBGRAPH_URL = "https://api.thegraph.com/subgraphs/name/geo-web-project/geo-web-subgraph" VITE_CERAMIC_URL = "https://ceramic.geoweb.network/" VITE_CERAMIC_CONNECT_NETWORK = "mainnet" VITE_BLOCK_EXPLORER = "https://optimistic.etherscan.io/" diff --git a/.env.testnet b/.env.testnet index d81b530c..e97d3f4e 100644 --- a/.env.testnet +++ b/.env.testnet @@ -1,10 +1,9 @@ -VITE_NETWORK_ID = 420 -VITE_SUBGRAPH_URL = "https://api.thegraph.com/subgraphs/name/geo-web-project/geo-web-testnet" +VITE_NETWORK_ID = 11155420 VITE_CERAMIC_URL = "https://ceramic.geoweb.network/" VITE_CERAMIC_CONNECT_NETWORK = "mainnet" -VITE_BLOCK_EXPLORER = "https://goerli-optimism.etherscan.io/" -VITE_WORLD_ADDRESS = 0x3904285496739BF5030d79C0CF259A569806F759 -VITE_WORLD_BLOCK_NUMBER = 17280426 +VITE_BLOCK_EXPLORER = "https://sepolia-optimism.etherscan.io/" +VITE_WORLD_ADDRESS = 0x943e0b3F1926008f2e1bEFCBc55FA2A75CeC2452 +VITE_WORLD_BLOCK_NUMBER = 6992231 VITE_SPATIAL_DOMAIN = "https://testnet.geoweb.app/" VITE_APP_ENV = "testnet" VITE_IPFS_GATEWAY = https://ipfs.io @@ -16,3 +15,5 @@ VITE_GELATO_RELAY_API_KEY = CBnuvCHhO6HrJqwcGWoIlK_9mrGHUrF6XTXZAyvEC_0_ VITE_REFUND_RECEIVER = 0x1a8b3554089d97Ad8656eb91F34225bf97055C68 VITE_WALLET_CONNECT_PROJECT_ID = ed360fa2058a62cd7828610800e21c86 VITE_TRANSAK_API_KEY = bf22a0d4-0492-44bd-9e32-a6030c14996e +VITE_SUBGRAPH_ID = Dv2u1QabAxCxjN59putrh24pLPuBCy8PidbEc4fZBFAo +VITE_NATIVE_SUPER_TOKEN = 0x0043d7c85C8b96a49A72A92C0B48CdC4720437d7 \ No newline at end of file diff --git a/package.json b/package.json index a8394423..2063ad76 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "@didtools/pkh-ethereum": "^0.0.3", "@geo-web/mud-world-base-contracts": "0.1.0", "@geo-web/mud-world-base-setup": "0.1.2", - "@geo-web/sdk": "^4.3.3", + "@geo-web/sdk": "^4.4.0", "@latticexyz/common": "2.0.0-next.11", "@latticexyz/protocol-parser": "2.0.0-next.11", "@mapbox/mapbox-gl-geocoder": "^5.0.1", diff --git a/src/App.tsx b/src/App.tsx index 921c139f..321a1188 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -45,9 +45,20 @@ import { Cacao, SiweMessage as CacaoSiweMessage } from "@didtools/cacao"; import { getEIP191Verifier } from "@didtools/pkh-ethereum"; import merge from "lodash.merge"; import { BundleSettingsProvider } from "./lib/transactionBundleSettings"; +const optimismSepolia = { + ...optimismGoerli, + id: 11155420, + name: "Optimism Sepolia", + network: "optimism-sepolia", + nativeCurrency: { + name: "OP Sepolia Ether", + symbol: "ETH", + decimals: 18, + }, +}; const networkIdToChain: Record = { 10: optimism, - 420: optimismGoerli, + 11155420: optimismSepolia, }; const { chains, provider } = configureChains( [networkIdToChain[NETWORK_ID]], diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 980a8fbc..0333dfb5 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -1,6 +1,8 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ export const NETWORK_ID = parseInt(import.meta.env.VITE_NETWORK_ID!); -export const SUBGRAPH_URL = import.meta.env.VITE_SUBGRAPH_URL!; +export const SUBGRAPH_URL = `https://gateway-arbitrum.network.thegraph.com/api/${import.meta + .env.VITE_SUBGRAPH_API_KEY!}/subgraphs/id/${import.meta.env + .VITE_SUBGRAPH_ID!}`; export const CERAMIC_URL = import.meta.env.VITE_CERAMIC_URL!; export const CONNECT_NETWORK = import.meta.env.VITE_CERAMIC_CONNECT_NETWORK!; export const BLOCK_EXPLORER = import.meta.env.VITE_BLOCK_EXPLORER!; @@ -11,13 +13,13 @@ export const WORLD = { export const RPC_URLS_HTTP: Record = { 10: `https://opt-mainnet.g.alchemy.com/v2/${import.meta.env .VITE_ALCHEMY_MAINNET_API_KEY!}`, - 420: `https://opt-goerli.g.alchemy.com/v2/${import.meta.env + 11155420: `https://opt-sepolia.g.alchemy.com/v2/${import.meta.env .VITE_ALCHEMY_TESTNET_API_KEY!}`, }; export const RPC_URLS_WS: Record = { 10: `wss://opt-goerli.g.alchemy.com/v2/${import.meta.env .VITE_ALCHEMY_MAINNET_API_KEY!}`, - 420: `wss://opt-goerli.g.alchemy.com/v2/${import.meta.env + 11155420: `wss://opt-sepolia.g.alchemy.com/v2/${import.meta.env .VITE_ALCHEMY_TESTNET_API_KEY!}`, }; export const SPATIAL_DOMAIN = import.meta.env.VITE_SPATIAL_DOMAIN!; @@ -34,6 +36,7 @@ export const TRANSAK_API_KEY = import.meta.env.VITE_TRANSAK_API_KEY!; /* eslint-enable @typescript-eslint/no-non-null-assertion */ export const PAYMENT_TOKEN = "ETHx"; +export const PAYMENT_TOKEN_ADDRESS = import.meta.env.VITE_NATIVE_SUPER_TOKEN!; export const PAYMENT_TOKEN_FAUCET_URL = "https://faucet.paradigm.xyz"; export const CERAMIC_EXPLORER = `https://cerscan.com/${CONNECT_NETWORK}/stream`; diff --git a/src/pages/IndexPage.tsx b/src/pages/IndexPage.tsx index f4d4af2f..bddd15bc 100644 --- a/src/pages/IndexPage.tsx +++ b/src/pages/IndexPage.tsx @@ -16,6 +16,7 @@ import { NETWORK_ID, SSX_HOST, WORLD, + PAYMENT_TOKEN_ADDRESS, } from "../lib/constants"; import Safe from "@safe-global/protocol-kit"; import { getContractsForChainOrThrow } from "@geo-web/sdk"; @@ -48,7 +49,7 @@ import type { AuthenticationStatus } from "@rainbow-me/rainbowkit"; import * as u8a from "uint8arrays"; import { useMediaQuery } from "../lib/mediaQuery"; import { syncWorld, SyncWorldResult } from "@geo-web/mud-world-base-setup"; -import { optimism, optimismGoerli } from "viem/chains"; +import { optimism, optimismGoerli, optimismSepolia } from "viem/chains"; import { MUDProvider } from "../lib/MUDContext"; import { IWorld, IWorld__factory } from "@geo-web/mud-world-base-contracts"; @@ -309,11 +310,16 @@ function IndexPage({ const framework = await Framework.create({ chainId: NETWORK_ID, + customSubgraphQueriesEndpoint: + "https://optimism-sepolia.subgraph.x.superfluid.dev", + resolverAddress: "0x554c06487bEc8c890A0345eb05a5292C1b1017Bd", provider: lib, }); setSfFramework(framework); - const superToken = await framework.loadNativeAssetSuperToken("ETHx"); + const superToken = await framework.loadNativeAssetSuperToken( + PAYMENT_TOKEN_ADDRESS + ); setPaymentToken(superToken); // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -341,7 +347,7 @@ function IndexPage({ React.useEffect(() => { (async () => { const chain = - import.meta.env.MODE === "mainnet" ? optimism : optimismGoerli; + import.meta.env.MODE === "mainnet" ? optimism : optimismSepolia; const mudChain = { ...chain, rpcUrls: { diff --git a/src/redux/store.ts b/src/redux/store.ts index 130fec90..e2468796 100644 --- a/src/redux/store.ts +++ b/src/redux/store.ts @@ -29,6 +29,9 @@ export const makeStore = () => { return await Framework.create({ chainId: NETWORK_ID, provider: new ethers.providers.JsonRpcProvider(RPC_URLS_HTTP[NETWORK_ID]), + customSubgraphQueriesEndpoint: + "https://optimism-sepolia.subgraph.x.superfluid.dev", + resolverAddress: "0x554c06487bEc8c890A0345eb05a5292C1b1017Bd", }); }); diff --git a/yarn.lock b/yarn.lock index 4fc88f53..9c19816c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3018,10 +3018,10 @@ rxjs "7.5.5" viem "1.14.0" -"@geo-web/sdk@^4.3.3": - version "4.3.3" - resolved "https://registry.yarnpkg.com/@geo-web/sdk/-/sdk-4.3.3.tgz#3189381e10fb43237f51f357602d0ea90d421ac1" - integrity sha512-cRuQr2FJddt0kv/HYvhKCrhuB3lCFqhWqoC2ap5mPmkFfX2W2y6eE86mK5fkb24BYuiiM6KQ5UKEt7xRETOqxg== +"@geo-web/sdk@^4.4.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@geo-web/sdk/-/sdk-4.4.0.tgz#2b857726491146344f4106f8bf158d271c514138" + integrity sha512-E6pnvZ69yKherAivNZXv93DGTFJos2ifHpkPyYXeuiClGKbITyAGdNfR5G2woHUokJzeltsxnluVmfQnSo4vXA== dependencies: "@geo-web/contracts" "4.3.1" ethers ">=5.0.0 <6.0.0" From c3611a6cdb3d7f10d6a924412067b2bf4155dad4 Mon Sep 17 00:00:00 2001 From: codynhat Date: Thu, 25 Jan 2024 08:51:38 -0800 Subject: [PATCH 11/12] build: use one graph URI env var --- .env.testnet | 1 - src/lib/constants.ts | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.env.testnet b/.env.testnet index e97d3f4e..fcf916b8 100644 --- a/.env.testnet +++ b/.env.testnet @@ -15,5 +15,4 @@ VITE_GELATO_RELAY_API_KEY = CBnuvCHhO6HrJqwcGWoIlK_9mrGHUrF6XTXZAyvEC_0_ VITE_REFUND_RECEIVER = 0x1a8b3554089d97Ad8656eb91F34225bf97055C68 VITE_WALLET_CONNECT_PROJECT_ID = ed360fa2058a62cd7828610800e21c86 VITE_TRANSAK_API_KEY = bf22a0d4-0492-44bd-9e32-a6030c14996e -VITE_SUBGRAPH_ID = Dv2u1QabAxCxjN59putrh24pLPuBCy8PidbEc4fZBFAo VITE_NATIVE_SUPER_TOKEN = 0x0043d7c85C8b96a49A72A92C0B48CdC4720437d7 \ No newline at end of file diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 0333dfb5..9231746c 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -1,8 +1,6 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ export const NETWORK_ID = parseInt(import.meta.env.VITE_NETWORK_ID!); -export const SUBGRAPH_URL = `https://gateway-arbitrum.network.thegraph.com/api/${import.meta - .env.VITE_SUBGRAPH_API_KEY!}/subgraphs/id/${import.meta.env - .VITE_SUBGRAPH_ID!}`; +export const SUBGRAPH_URL = import.meta.env.VITE_GRAPH_URI!; export const CERAMIC_URL = import.meta.env.VITE_CERAMIC_URL!; export const CONNECT_NETWORK = import.meta.env.VITE_CERAMIC_CONNECT_NETWORK!; export const BLOCK_EXPLORER = import.meta.env.VITE_BLOCK_EXPLORER!; From 275ab06cd40f03f26fbd22567c48353a2f140d28 Mon Sep 17 00:00:00 2001 From: codynhat Date: Thu, 25 Jan 2024 09:07:23 -0800 Subject: [PATCH 12/12] feat: remove mention of Ceramic in SIWE message --- src/App.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 321a1188..9b5a38f5 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -116,8 +116,6 @@ export default function App() { const siweMessage = new CacaoSiweMessage({ domain: window.location.hostname, address, - statement: - "Give this application access to some of your data on Ceramic", uri: didKey, version: "1", nonce,